[Rules] Add option rule to load AA based on CurrentExpansion rule (#1758)

* Add option rule to load AA based on CurrentExpansion rule

* Default UseCurrentExpansionAAOnly to true

* Only clear the PlayerAA when reloadingAA
This commit is contained in:
Natedog2012 2021-11-14 19:54:45 -06:00 committed by GitHub
parent 76b0183a0f
commit 6400e2f8bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View File

@ -764,6 +764,7 @@ RULE_CATEGORY_END()
RULE_CATEGORY(Expansion)
RULE_INT(Expansion, CurrentExpansion, -1, "The current expansion enabled for the server [-1 = ALL, 0 = Classic, 1 = Kunark etc.]")
RULE_BOOL(Expansion, UseCurrentExpansionAAOnly, true, "When true will only load AA ranks that match CurrentExpansion rule")
RULE_CATEGORY_END()
RULE_CATEGORY(Instances)

View File

@ -499,9 +499,19 @@ void Client::ResetAA() {
void Client::SendClearAA()
{
auto outapp = new EQApplicationPacket(OP_ClearLeadershipAbilities, 0);
SendClearLeadershipAA();
SendClearPlayerAA();
}
void Client::SendClearPlayerAA()
{
auto outapp = new EQApplicationPacket(OP_ClearAA, 0);
FastQueuePacket(&outapp);
outapp = new EQApplicationPacket(OP_ClearAA, 0);
}
void Client::SendClearLeadershipAA()
{
auto outapp = new EQApplicationPacket(OP_ClearLeadershipAbilities, 0);
FastQueuePacket(&outapp);
}
@ -1700,11 +1710,18 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
}
LogInfo("Loaded [{}] Alternate Advancement Abilities", (int)abilities.size());
int expansion = RuleI(Expansion, CurrentExpansion);
bool use_expansion_aa = RuleB(Expansion, UseCurrentExpansionAAOnly);
LogInfo("Loading Alternate Advancement Ability Ranks");
ranks.clear();
query = "SELECT id, upper_hotkey_sid, lower_hotkey_sid, title_sid, desc_sid, cost, level_req, spell, spell_type, recast_time, "
if (use_expansion_aa && expansion >= 0) {
query = fmt::format("SELECT id, upper_hotkey_sid, lower_hotkey_sid, title_sid, desc_sid, cost, level_req, spell, spell_type, recast_time, "
"next_id, expansion FROM aa_ranks WHERE expansion <= {}", expansion);
} else {
query = "SELECT id, upper_hotkey_sid, lower_hotkey_sid, title_sid, desc_sid, cost, level_req, spell, spell_type, recast_time, "
"next_id, expansion FROM aa_ranks";
}
results = QueryDatabase(query);
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {

View File

@ -897,6 +897,8 @@ public:
void ResetAA();
void RefundAA();
void SendClearAA();
void SendClearLeadershipAA();
void SendClearPlayerAA();
inline uint32 GetAAXP() const { return m_pp.expAA; }
inline uint32 GetAAPercent() const { return m_epp.perAA; }
int32 CalcAAFocus(focusType type, const AA::Rank &rank, uint16 spell_id);

View File

@ -5331,6 +5331,7 @@ void EntityList::StopMobAI()
void EntityList::SendAlternateAdvancementStats() {
for(auto &c : client_list) {
c.second->SendClearPlayerAA();
c.second->SendAlternateAdvancementTable();
c.second->SendAlternateAdvancementStats();
c.second->SendAlternateAdvancementPoints();