From 27ba1715ca73429f68f58d05980df5844868ae12 Mon Sep 17 00:00:00 2001 From: Walter Pagani Date: Sat, 16 Mar 2024 23:15:32 -0300 Subject: [PATCH] chore. Prevent tanks and heals in config (#50) Co-authored-by: Tony931023 --- conf/1v1arena.conf.dist | 22 +++++++++++++++------- src/npc_arena1v1.cpp | 27 +++++---------------------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/conf/1v1arena.conf.dist b/conf/1v1arena.conf.dist index 9eb269f..c85069d 100644 --- a/conf/1v1arena.conf.dist +++ b/conf/1v1arena.conf.dist @@ -53,13 +53,22 @@ Arena1v1.VendorRating = 0 Arena1v1.ArenaPointsMulti = 0.64 # -# Arena1v1.BlockForbiddenTalents -# Description: If true, healers can't join 1v1 arena, if they invested more than 35 talentpoints in a healing-talenttree. -# You can also block tanks and other talents, if you modify FORBIDDEN_TALENTS_IN_1V1_ARENA in the npc_arena1v1.h file (hardcoding). See TalentTab.dbc for available talents (you will need an DBC-Editor). -# Default: 1 - (true) -# 0 - (false) +# Arena1v1.PreventHealingTalents +# Description: If enabled, it prevents people from having healing talents. +# Default: false +# Value: false +# true -Arena1v1.BlockForbiddenTalents = 1 +Arena1v1.PreventHealingTalents = false + +# +# Arena1v1.PreventTankTalents +# Description: If enabled, it prevents people from having tank talents. +# Default: false +# Value: false +# true + +Arena1v1.PreventTankTalents = false # # Arena1v1.ForbiddenTalentsIDs @@ -69,7 +78,6 @@ Arena1v1.BlockForbiddenTalents = 1 Arena1v1.ForbiddenTalentsIDs = "0" - # # Arena1v1.ArenaSlotID # Description: The slot the 1v1 will be working over. Needs to be bigger or equals then 3 otherwise it will overwrite the 2v2, 3v3 or 5v5 data diff --git a/src/npc_arena1v1.cpp b/src/npc_arena1v1.cpp index e4d1a53..9ef1455 100644 --- a/src/npc_arena1v1.cpp +++ b/src/npc_arena1v1.cpp @@ -401,32 +401,15 @@ class npc_1v1arena : public CreatureScript if (!player) return false; - if (sConfigMgr->GetOption("Arena1v1.BlockForbiddenTalents", true) == false) - return true; - - uint32 count = 0; - - for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) + if (player->HasHealSpec() && (sConfigMgr->GetOption("Arena1v1.PreventHealingTalents", false))) { - TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); - - if (!talentInfo) - continue; - - if (std::find(forbiddenTalents.begin(), forbiddenTalents.end(), talentInfo->TalentID) != forbiddenTalents.end()) - { - ChatHandler(player->GetSession()).SendSysMessage("You can not join because you have forbidden talents."); - return false; - } - - for (int8 rank = MAX_TALENT_RANK - 1; rank >= 0; --rank) - if (talentInfo->RankID[rank] == 0) - continue; + ChatHandler(player->GetSession()).SendSysMessage("You can't join because you have forbidden talents (Heal)"); + return false; } - if (count >= 36) + if (player->HasTankSpec() && (sConfigMgr->GetOption("Arena1v1.PreventTankTalents", false))) { - ChatHandler(player->GetSession()).SendSysMessage("You can not join because you have too many talent points in a forbidden tree. (Heal / Tank)"); + ChatHandler(player->GetSession()).SendSysMessage("You can't join because you have forbidden talents (Tank)"); return false; }