Skip to content

Commit

Permalink
Prevent switching spec while in queue for Solo Arena (#20)
Browse files Browse the repository at this point in the history
* prevent switching spec while in solo queue

* Update solo3v3_sc.h

* Update src/solo3v3_sc.h

---------

Co-authored-by: Stefano Borzì <[email protected]>
  • Loading branch information
laasker and Helias authored Sep 24, 2024
1 parent f687038 commit 78a93e3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
28 changes: 1 addition & 27 deletions src/solo3v3_sc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,33 +721,6 @@ bool PlayerScript3v3Arena::CanBattleFieldPort(Player* player, uint8 arenaType, B
return true;
}


// class Spell_SC : public SpellSC
// {
// public:
// Spell_SC() : SpellSC("Spell_SC") { }

// bool CanSelectSpecTalent(Spell* spell) override
// {
// if (!spell)
// return false;

// if (spell->GetCaster()->isPlayer())
// {
// Player* plr = spell->GetCaster()->ToPlayer();

// if (plr->InBattlegroundQueueForBattlegroundQueueType((BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_3v3_SOLO) /*||
// plr->InBattlegroundQueueForBattlegroundQueueType((BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_1v1)*/)
// {
// plr->GetSession()->SendAreaTriggerMessage("You can't change your talents while in queue for 3v3."); // or 1v1
// return false;
// }
// }

// return true;
// }
// }

void AddSC_Solo_3v3_Arena()
{
if (!ArenaTeam::ArenaSlotByType.count(ARENA_TEAM_SOLO_3v3))
Expand All @@ -771,4 +744,5 @@ void AddSC_Solo_3v3_Arena()
new ConfigLoader3v3Arena();
new PlayerScript3v3Arena();
new Arena_SC();
new Solo3v3Spell();
}
28 changes: 28 additions & 0 deletions src/solo3v3_sc.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Config.h"
#include "Battleground.h"
#include "solo3v3.h"
#include "Spell.h"

enum Npc3v3Actions {
NPC_3v3_ACTION_CREATE_ARENA_TEAM = 1,
Expand Down Expand Up @@ -140,3 +141,30 @@ class Arena_SC : public ArenaScript
return true;
}
};

class Solo3v3Spell : public SpellSC
{
public:
Solo3v3Spell() : SpellSC("Solo3v3Spell") { }


bool CanSelectSpecTalent(Spell* spell) override
{
if (!spell)
return false;

if (spell->GetCaster()->IsPlayer())
{
Player* plr = spell->GetCaster()->ToPlayer();

if (plr->InBattlegroundQueueForBattlegroundQueueType((BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_3v3_SOLO))
{
plr->GetSession()->SendAreaTriggerMessage("You can't change your talents while in queue for solo arena.");
return false;
}
}

return true;
}

};

0 comments on commit 78a93e3

Please sign in to comment.