Skip to content

Commit

Permalink
chore. Prevent tanks and heals in config (#50)
Browse files Browse the repository at this point in the history
Co-authored-by: Tony931023 <[email protected]>
  • Loading branch information
pangolp and Tony931023 authored Mar 17, 2024
1 parent f463db2 commit 27ba171
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
22 changes: 15 additions & 7 deletions conf/1v1arena.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
27 changes: 5 additions & 22 deletions src/npc_arena1v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,32 +401,15 @@ class npc_1v1arena : public CreatureScript
if (!player)
return false;

if (sConfigMgr->GetOption<bool>("Arena1v1.BlockForbiddenTalents", true) == false)
return true;

uint32 count = 0;

for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
if (player->HasHealSpec() && (sConfigMgr->GetOption<bool>("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<bool>("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;
}

Expand Down

0 comments on commit 27ba171

Please sign in to comment.