From cdb3ec433ca8c223e69d05a1d44cd8e5ffde7ada Mon Sep 17 00:00:00 2001 From: laasker <79991768+laasker@users.noreply.github.com> Date: Mon, 23 Sep 2024 08:38:18 -0300 Subject: [PATCH 1/3] prevent switching spec while in solo queue --- src/solo3v3_sc.cpp | 28 +--------------------------- src/solo3v3_sc.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/solo3v3_sc.cpp b/src/solo3v3_sc.cpp index 1809935..0c50cc7 100644 --- a/src/solo3v3_sc.cpp +++ b/src/solo3v3_sc.cpp @@ -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)) @@ -771,4 +744,5 @@ void AddSC_Solo_3v3_Arena() new ConfigLoader3v3Arena(); new PlayerScript3v3Arena(); new Arena_SC(); + new Solo3v3Spell(); } diff --git a/src/solo3v3_sc.h b/src/solo3v3_sc.h index f41545b..619c4e7 100644 --- a/src/solo3v3_sc.h +++ b/src/solo3v3_sc.h @@ -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, @@ -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()->GetTypeId() == TYPEID_PLAYER) + { + 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 solo arena."); + return false; + } + } + + return true; + } + +}; From c17a87467944a163d1a47ebc617ccd3b52ddd003 Mon Sep 17 00:00:00 2001 From: laasker <79991768+laasker@users.noreply.github.com> Date: Mon, 23 Sep 2024 08:41:27 -0300 Subject: [PATCH 2/3] Update solo3v3_sc.h --- src/solo3v3_sc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solo3v3_sc.h b/src/solo3v3_sc.h index 619c4e7..efe754b 100644 --- a/src/solo3v3_sc.h +++ b/src/solo3v3_sc.h @@ -153,7 +153,7 @@ class Solo3v3Spell : public SpellSC if (!spell) return false; - if (spell->GetCaster()->GetTypeId() == TYPEID_PLAYER) + if (spell->GetCaster()->IsPlayer()) { Player* plr = spell->GetCaster()->ToPlayer(); From 8b66b9eb4e5aea02cf451e8e94571c3b5b53da39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefano=20Borz=C3=AC?= Date: Wed, 25 Sep 2024 00:53:23 +0200 Subject: [PATCH 3/3] Update src/solo3v3_sc.h --- src/solo3v3_sc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solo3v3_sc.h b/src/solo3v3_sc.h index efe754b..508d61c 100644 --- a/src/solo3v3_sc.h +++ b/src/solo3v3_sc.h @@ -157,7 +157,7 @@ class Solo3v3Spell : public SpellSC { Player* plr = spell->GetCaster()->ToPlayer(); - if (plr->InBattlegroundQueueForBattlegroundQueueType((BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_3v3_SOLO) || plr->InBattlegroundQueueForBattlegroundQueueType((BattlegroundQueueTypeId)BATTLEGROUND_QUEUE_1v1)) + 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;