From c0cf9bb5aa31720c1b60a8891289e87208f92fe9 Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sun, 20 Aug 2023 15:37:08 -0500 Subject: [PATCH] [Expansions] Expansion settings tweaks (#3556) * Expansion tweaks testing on PEQ * Update zoning.cpp * Update aa.cpp * Update aa.cpp * Tweak --- common/ruletypes.h | 3 ++- world/client.cpp | 7 +++++-- zone/aa.cpp | 4 +--- zone/client.h | 1 + zone/client_packet.cpp | 17 +++++++++++------ zone/entity.cpp | 2 ++ zone/zoning.cpp | 5 ++--- 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 2ac07f0b4..cbcd75396 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -288,7 +288,8 @@ RULE_BOOL(World, GMAccountIPList, false, "Check IP list against GM accounts. Thi RULE_INT(World, MinGMAntiHackStatus, 1, "Minimum status to check against AntiHack list") RULE_INT(World, SoFStartZoneID, -1, "Sets the Starting Zone for SoF Clients separate from Titanium Clients (-1 is disabled)") RULE_INT(World, TitaniumStartZoneID, -1, "Sets the Starting Zone for Titanium Clients (-1 is disabled). Replaces the old method") -RULE_INT(World, ExpansionSettings, 16383, "Sets the expansion settings for the server, This is sent on login to world and affects client expansion settings. Defaults to all expansions enabled up to TSS, value is bitmask") +RULE_INT(World, ExpansionSettings, 16383, "Sets the expansion settings bitmask for the server, This is sent on login to world and affects client expansion settings. Defaults to all expansions enabled up to TSS, value is bitmask") +RULE_INT(World, CharacterSelectExpansionSettings, -1, "Sets the expansion settings bitmask for character select if you wish to override. -1 is off") RULE_BOOL(World, UseClientBasedExpansionSettings, true, "If true it will overrule World, ExpansionSettings and set someone's expansion based on the client they're using") RULE_INT(World, PVPSettings, 0, "Sets the PVP settings for the server. 1=Rallos Zek RuleSet, 2=Tallon/Vallon Zek Ruleset, 4=Sullon Zek Ruleset, 6=Discord Ruleset, anything above 6 is the Discord Ruleset without the no-drop restrictions removed. NOTE: edit IsAttackAllowed in Zone-table to accomodate for these rules") RULE_INT(World, PVPMinLevel, 0, "Minimum level to pvp") diff --git a/world/client.cpp b/world/client.cpp index 1c6b88f93..9c31ba4c1 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -208,11 +208,14 @@ void Client::SendExpansionInfo() { auto outapp = new EQApplicationPacket(OP_ExpansionInfo, sizeof(ExpansionInfo_Struct)); ExpansionInfo_Struct *eis = (ExpansionInfo_Struct*)outapp->pBuffer; - if (RuleB(World, UseClientBasedExpansionSettings)) { + if (RuleI(World, CharacterSelectExpansionSettings) != -1) { + eis->Expansions = RuleI(World, CharacterSelectExpansionSettings); + } + else if (RuleB(World, UseClientBasedExpansionSettings)) { eis->Expansions = EQ::expansions::ConvertClientVersionToExpansionsMask(eqs->ClientVersion()); } else { - eis->Expansions = (RuleI(World, ExpansionSettings) & EQ::expansions::ConvertClientVersionToExpansionsMask(eqs->ClientVersion())); + eis->Expansions = RuleI(World, ExpansionSettings); } QueuePacket(outapp); diff --git a/zone/aa.cpp b/zone/aa.cpp index 0aaa524fa..4b706459c 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1701,9 +1701,7 @@ bool Mob::CanPurchaseAlternateAdvancementRank(AA::Rank *rank, bool check_price, } void Zone::LoadAlternateAdvancement() { - if(!content_db.LoadAlternateAdvancementAbilities(aa_abilities, - aa_ranks)) - { + if (!content_db.LoadAlternateAdvancementAbilities(aa_abilities, aa_ranks)) { aa_abilities.clear(); aa_ranks.clear(); LogInfo("Failed to load Alternate Advancement Data"); diff --git a/zone/client.h b/zone/client.h index ce4089514..5cc672aef 100644 --- a/zone/client.h +++ b/zone/client.h @@ -385,6 +385,7 @@ public: inline PetInfo* GetPetInfo(uint16 pet) { return (pet==1)?&m_suspendedminion:&m_petinfo; } inline InspectMessage_Struct& GetInspectMessage() { return m_inspect_message; } inline const InspectMessage_Struct& GetInspectMessage() const { return m_inspect_message; } + void ReloadExpansionProfileSetting(); void SetPetCommandState(int button, int state); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f6375e070..83161f194 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1445,12 +1445,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) if (m_pp.ldon_points_tak < 0 || m_pp.ldon_points_tak > 2000000000) { m_pp.ldon_points_tak = 0; } if (m_pp.ldon_points_available < 0 || m_pp.ldon_points_available > 2000000000) { m_pp.ldon_points_available = 0; } - if (RuleB(World, UseClientBasedExpansionSettings)) { - m_pp.expansions = EQ::expansions::ConvertClientVersionToExpansionsMask(ClientVersion()); - } - else { - m_pp.expansions = (RuleI(World, ExpansionSettings) & EQ::expansions::ConvertClientVersionToExpansionsMask(ClientVersion())); - } + ReloadExpansionProfileSetting(); if (!database.LoadAlternateAdvancement(this)) { LogError("Error loading AA points for [{}]", GetName()); @@ -16483,3 +16478,13 @@ void Client::RecordStats() CharacterStatsRecordRepository::InsertOne(database, r); } } + +void Client::ReloadExpansionProfileSetting() +{ + if (RuleB(World, UseClientBasedExpansionSettings)) { + m_pp.expansions = EQ::expansions::ConvertClientVersionToExpansionsMask(ClientVersion()); + } + else { + m_pp.expansions = RuleI(World, ExpansionSettings); + } +} diff --git a/zone/entity.cpp b/zone/entity.cpp index a4339627f..6df61b95d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -5647,6 +5647,8 @@ void EntityList::StopMobAI() void EntityList::SendAlternateAdvancementStats() { for (auto &c : client_list) { + c.second->Message(Chat::White, "Reloading AA"); + c.second->ReloadExpansionProfileSetting(); c.second->SendClearPlayerAA(); c.second->SendAlternateAdvancementTable(); c.second->SendAlternateAdvancementStats(); diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 240a50855..38e4bb1d5 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -341,9 +341,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { //TODO: ADVENTURE ENTRANCE CHECK - /** - * Expansion check - */ + // Expansion checks and routing if (content_service.GetCurrentExpansion() >= Expansion::Classic && !GetGM()) { bool meets_zone_expansion_check = false; @@ -367,6 +365,7 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) { if (content_service.GetCurrentExpansion() >= Expansion::Classic && GetGM()) { LogInfo("[{}] Bypassing Expansion zone checks because GM status is set", GetCleanName()); + Message(Chat::Yellow, "Bypassing Expansion zone checks because GM status is set"); } if (zoning_message == ZoningMessage::ZoneSuccess) {