Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions conf/CFBG.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
# Default: 1 - (Enabled)
# 0 - (Disabled)
#
# CFBG.Battlefield.SkipClasses
# Description: Comma-separated list of class IDs excluded from Wintergrasp
# cross-faction selection. Players of these classes always keep
# their native faction and are never morphed/reassigned.
# Class IDs: 1 Warrior, 2 Paladin, 3 Hunter, 4 Rogue, 5 Priest,
# 6 Death Knight, 7 Shaman, 8 Mage, 9 Warlock, 11 Druid.
# Requires CFBG.Battlefield.Enable = 1.
# Example: "2,7" - (Paladins and Shamans stay native)
# Default: "" - (no class skipped)
#
# CFBG.Include.Avg.Ilvl.Enable
# Description: Enable check average item level for bg
# Default: 0
Expand Down Expand Up @@ -101,6 +111,7 @@ CFBG.Enable = 1
CFBG.Battlefield.Enable = 1
CFBG.Battlefield.TeamLock.Enable = 1
CFBG.Battlefield.ReapplyOnResurrect.Enable = 1
CFBG.Battlefield.SkipClasses = ""
CFBG.BalancedTeams = 1
CFBG.BalancedTeams.Class.LowLevel = 0
CFBG.BalancedTeams.Class.MinLevel = 10
Expand Down
10 changes: 10 additions & 0 deletions src/CFBG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "Opcodes.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "StringConvert.h"
#include "Tokenize.h"
#include "GameTime.h"
#include "Player.h"
#include "WorldSessionMgr.h"
Expand Down Expand Up @@ -152,6 +154,14 @@ void CFBG::LoadConfig()
_IsEnableWGSystem = sConfigMgr->GetOption<bool>("CFBG.Battlefield.Enable", true);
_IsEnableWGTeamLock = sConfigMgr->GetOption<bool>("CFBG.Battlefield.TeamLock.Enable", true);
_IsEnableWGReapplyOnResurrect = sConfigMgr->GetOption<bool>("CFBG.Battlefield.ReapplyOnResurrect.Enable", true);

_wgSkipClasses.clear();
for (auto const& token : Acore::Tokenize(sConfigMgr->GetOption<std::string>("CFBG.Battlefield.SkipClasses", ""), ',', false))
{
if (Optional<uint8> playerClass = Acore::StringTo<uint8>(token))
_wgSkipClasses.insert(*playerClass);
}

_IsEnableAvgIlvl = sConfigMgr->GetOption<bool>("CFBG.Include.Avg.Ilvl.Enable", false);
_IsEnableBalancedTeams = sConfigMgr->GetOption<bool>("CFBG.BalancedTeams", false);
_IsEnableEvenTeams = sConfigMgr->GetOption<bool>("CFBG.EvenTeams.Enabled", false);
Expand Down
3 changes: 3 additions & 0 deletions src/CFBG.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <array>
#include <optional>
#include <unordered_map>
#include <unordered_set>
#include <vector>

class Player;
Expand Down Expand Up @@ -138,6 +139,7 @@ class CFBG
inline bool IsEnableWGSystem() const { return _IsEnableWGSystem; }
inline bool IsEnableWGTeamLock() const { return _IsEnableWGTeamLock; }
inline bool IsEnableWGReapplyOnResurrect() const { return _IsEnableWGReapplyOnResurrect; }
inline bool IsWGSkipClass(uint8 playerClass) const { return _wgSkipClasses.count(playerClass) > 0; }
inline bool IsEnableAvgIlvl() const { return _IsEnableAvgIlvl; }
inline bool IsEnableBalancedTeams() const { return _IsEnableBalancedTeams; }
inline bool IsEnableBalanceClassLowLevel() const { return _IsEnableBalanceClassLowLevel; }
Expand Down Expand Up @@ -226,6 +228,7 @@ class CFBG
bool _IsEnableWGSystem;
bool _IsEnableWGTeamLock;
bool _IsEnableWGReapplyOnResurrect;
std::unordered_set<uint8> _wgSkipClasses;
bool _IsEnableAvgIlvl;
bool _IsEnableBalancedTeams;
bool _IsEnableBalanceClassLowLevel;
Expand Down
3 changes: 3 additions & 0 deletions src/CFBG_SC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ class CFBG_Battlefield : public BattlefieldScript
if (sCFBG->IsPlayerFake(player))
return;

if (sCFBG->IsWGSkipClass(player->getClass()))
return;

TeamId realTeam = player->GetTeamId(true);
TeamId assignedTeam = realTeam;

Expand Down
Loading