-
Notifications
You must be signed in to change notification settings - Fork 55
Load with the new configuration #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,38 +90,45 @@ CFBG* CFBG::instance() | |
| return &instance; | ||
| } | ||
|
|
||
| void CFBG::LoadConfig() | ||
| void CFBG::LoadWGSkipClasses(std::string skipClasses) | ||
| { | ||
| _IsEnableSystem = sConfigMgr->GetOption<bool>("CFBG.Enable", false); | ||
| if (!_IsEnableSystem) | ||
| return; | ||
|
|
||
| _IsEnableWGSystem = sConfigMgr->GetOption<bool>("CFBG.Battlefield.Enable", true); | ||
| _IsEnableWGTeamLock = sConfigMgr->GetOption<bool>("CFBG.Battlefield.TeamLock.Enable", true); | ||
| _IsEnableWGNativePriority = sConfigMgr->GetOption<bool>("CFBG.Battlefield.NativePriority.Enable", true); | ||
| _IsEnableWGReapplyOnResurrect = sConfigMgr->GetOption<bool>("CFBG.Battlefield.ReapplyOnResurrect.Enable", true); | ||
|
|
||
| _wgSkipClasses.clear(); | ||
| std::string const skipClasses = sConfigMgr->GetOption<std::string>("CFBG.Battlefield.SkipClasses", ""); | ||
| for (auto const& token : Acore::Tokenize(skipClasses, ',', false)) | ||
| { | ||
| if (Optional<uint8> playerClass = Acore::StringTo<uint8>(token)) | ||
| _wgSkipClasses.insert(*playerClass); | ||
| } | ||
| } | ||
|
|
||
| void CFBG::LoadConfig(bool reload) | ||
| { | ||
| _OutConfigData.Initialize(reload); | ||
| } | ||
|
|
||
| void CFBGOutConfigData::BuildConfigCache() | ||
| { | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableSystem, "CFBG.Enable", false); | ||
| if (!sCFBG->IsEnableSystem()) | ||
| return; | ||
|
|
||
| _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); | ||
| _IsEnableBalanceClassLowLevel = sConfigMgr->GetOption<bool>("CFBG.BalancedTeams.Class.LowLevel", true); | ||
| _IsEnableResetCooldowns = sConfigMgr->GetOption<bool>("CFBG.ResetCooldowns", false); | ||
| _IsEnableBalanceTeamsOnEntry = sConfigMgr->GetOption<bool>("CFBG.BalanceTeamsOnEntry.Enabled", true); | ||
| _showPlayerName = sConfigMgr->GetOption<bool>("CFBG.Show.PlayerName", false); | ||
| _EvenTeamsMaxPlayersThreshold = sConfigMgr->GetOption<uint32>("CFBG.EvenTeams.MaxPlayersThreshold", 0); | ||
| _MaxPlayersCountInGroup = sConfigMgr->GetOption<uint32>("CFBG.Players.Count.In.Group", 3); | ||
| _balanceClassMinLevel = sConfigMgr->GetOption<uint8>("CFBG.BalancedTeams.Class.MinLevel", 10); | ||
| _balanceClassMaxLevel = sConfigMgr->GetOption<uint8>("CFBG.BalancedTeams.Class.MaxLevel", 19); | ||
| _balanceClassLevelDiff = sConfigMgr->GetOption<uint8>("CFBG.BalancedTeams.Class.LevelDiff", 2); | ||
| _randomizeRaces = sConfigMgr->GetOption<bool>("CFBG.RandomRaceSelection", true); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableWGSystem, "CFBG.Battlefield.Enable", false); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the old default for CFBG.Battlefield.Enable was true, with false here anyone without the key in their conf silently loses the Wintergrasp integration |
||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableWGTeamLock, "CFBG.Battlefield.TeamLock.Enable", true); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableWGNativePriority, "CFBG.Battlefield.NativePriority.Enable", true); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableWGReapplyOnResurrect, "CFBG.Battlefield.ReapplyOnResurrect.Enable", true); | ||
|
|
||
| SetConfigValue<std::string>(CFBGOutConfig::_IsEnableWGSkipClasses, "CFBG.Battlefield.SkipClasses", ""); | ||
| sCFBG->LoadWGSkipClasses(sCFBG->IsEnableWGSkipClasses()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this getter returns the skip class list rather than a flag, maybe GetWGSkipClasses would read better than IsEnableWGSkipClasses |
||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableBalancedTeams, "CFBG.BalancedTeams", false); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableBalanceClassLowLevel, "CFBG.BalancedTeams.Class.LowLevel", false); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, the old default for CFBG.BalancedTeams.Class.LowLevel was true. |
||
| SetConfigValue<uint32>(CFBGOutConfig::_balanceClassMinLevel, "CFBG.BalancedTeams.Class.MinLevel", 10); | ||
| SetConfigValue<uint32>(CFBGOutConfig::_balanceClassMaxLevel, "CFBG.BalancedTeams.Class.MaxLevel", 19); | ||
| SetConfigValue<uint32>(CFBGOutConfig::_balanceClassLevelDiff, "CFBG.BalancedTeams.Class.LevelDiff", 2); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableEvenTeams, "CFBG.EvenTeams.Enabled", false); | ||
| SetConfigValue<uint32>(CFBGOutConfig::_EvenTeamsMaxPlayersThreshold, "CFBG.EvenTeams.MaxPlayersThreshold", 0); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableAvgIlvl, "CFBG.Include.Avg.Ilvl.Enable", false); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableBalanceTeamsOnEntry, "CFBG.BalanceTeamsOnEntry.Enabled", true); | ||
| SetConfigValue<uint32>(CFBGOutConfig::_MaxPlayersCountInGroup, "CFBG.Players.Count.In.Group", 3); | ||
| SetConfigValue<bool>(CFBGOutConfig::_IsEnableResetCooldowns, "CFBG.ResetCooldowns", false); | ||
| SetConfigValue<bool>(CFBGOutConfig::_randomizeRaces, "CFBG.RandomRaceSelection", true); | ||
| } | ||
|
|
||
| uint32 CFBG::GetBGTeamAverageItemLevel(Battleground* bg, TeamId team) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this early return could crash the worldserver at startup when
CFBG.Enable = 0:because
Initialize()callsVerifyAllConfigsLoaded()afterBuildConfigCache()and it asserts on any config slot that was never set.Running with the module compiled but disabled is a normal setup, so we should load all values unconditionally and keep the enable check at the call sites, like WorldConfig::BuildConfigCache does in the core.