Fix mem leak is caused by shop disable shop

This commit is contained in:
luis
2026-08-23 08:24:02 -03:00
parent 659cbe34e1
commit d3bf90c301
+6 -70
View File
@@ -30,10 +30,6 @@
#include "Util.h"
#include "World.h"
//WowCommunity
#include "Config.h"
//WowCommunity
void WorldSession::SendAuthResponse(uint32 code, bool queued, uint32 queuePos)
{
WorldPackets::Auth::AuthResponse response;
@@ -112,10 +108,7 @@ void WorldSession::SendSetTimeZoneInformation()
void WorldSession::SendFeatureSystemStatusGlueScreen()
{
WorldPackets::System::FeatureSystemStatusGlueScreen features;
// WorldSession::SendFeatureSystemStatus. Both follow the Shop.Enabled worldserver.conf toggle.
bool const shopEnabled = sWorld->getBoolConfig(CONFIG_SHOP_ENABLED);
features.BpayStoreAvailable = shopEnabled;
features.CommerceServerEnabled = shopEnabled;
features.BpayStoreAvailable = false;
features.BpayStoreDisabledByParentalControls = false;
features.CharUndeleteEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED);
features.MaxCharactersOnThisRealm = sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM);
@@ -147,27 +140,6 @@ void WorldSession::SendFeatureSystemStatusGlueScreen()
features.AvailableGameModeIDs.push_back(8); // GameMode.db2, standard
// In-game Shop character boost. These three are what the client's glue screen reads to decide
// whether to offer a boost at all: C_CharacterServices consults IsTrialBoostEnabled before drawing
// the boost/"Try New Class" affordances, and the two type fields tell it WHICH boost, which has to
// match the BoostID our catalog's CharacterBoost deliverable carries or the UI describes a different
// product to the one the account owns.
//
// They follow ownership, not configuration: the flag is set only while this account actually holds
// an unapplied boost entitlement, so the client never offers a boost that CMSG_CHARACTER_UPGRADE_START
// would then have to refuse. _shopBoostAdvertised records what we said, so the Shop can push a
// corrected copy of this packet when the answer changes mid-session (see LoadBattlePayEntitlements).
_shopBoostAdvertised = shopEnabled
&& sWorld->getBoolConfig(CONFIG_SHOP_ENTITLEMENTS_ENABLED)
&& HasBattlePayCharacterBoost();
if (_shopBoostAdvertised)
{
features.TrialBoostEnabled = true;
features.ActiveBoostType = BattlePayMgr::GetCharacterBoostType();
features.TrialBoostType = BattlePayMgr::GetCharacterBoostType();
}
SendPacket(features.Write());
WorldPackets::System::MirrorVarSingle vars[] =
@@ -175,25 +147,10 @@ void WorldSession::SendFeatureSystemStatusGlueScreen()
{ "raidLockoutExtendEnabled"sv, "1"sv },
{ "sellAllJunkEnabled"sv, "1"sv },
{ "bypassItemLevelScalingCode"sv, "0"sv },
// In-game Shop. Two independent client store gates:
// bpayStoreEnable - the legacy BattlePay opcode path (CMSG_BATTLE_PAY_GET_PRODUCT_LIST ->
// our BattlePayMgr catalog). This is the one we actually implement, so it follows Shop.Enabled.
// shop2Enabled - the MODERN path, which is NOT a game-opcode flow at all: the client talks
// HTTPS to Blizzard web services whose endpoints arrive in these very MirrorVars
// (shop2HostUrlRequests = https://us.api.blizzard.com, shop2HostUrlAuth =
// https://oauth.battle.net, plus shop2ClientIdStr and the VC/POP GUIDs - all captured in
// ingame-shop_ordersCrafting_professions.pkt). Announcing shop2Enabled=1 while shipping no
// endpoints leaves the client with the modern store switched on and nowhere to reach, so it
// is OFF by default and gated behind its own config. Turn Shop.Shop2Enabled on only when a
// real endpoint exists to answer it.
{ "shop2Enabled"sv, (shopEnabled && sWorld->getBoolConfig(CONFIG_SHOP_SHOP2_ENABLED)) ? "1"sv : "0"sv },
{ "bpayStoreEnable"sv, shopEnabled ? "1"sv : "0"sv },
// Recent Allies is implemented server-side (RecentAlliesMgr + the 5 opcodes); retail sends 1.
{ "recentAlliesEnabledClient"sv, "1"sv },
// In-game browser widget (retail sends 1); the Shop uses it to render richer content.
{ "browserEnabled"sv, "1"sv },
// Master looter is a fully supported loot method (LOOT_METHOD_MASTER); retail sends 1.
{ "masterLooterEnabled"sv, "1"sv },
{ "shop2Enabled"sv, "0"sv },
{ "bpayStoreEnable"sv, "0"sv },
{ "recentAlliesEnabledClient"sv, "0"sv },
{ "browserEnabled"sv, "0"sv },
{ "housingEnableCreateGuildNeighborhood"sv, "0"sv },
{ "housingEnableDeleteHouse"sv, "0"sv },
{ "housingServiceEnabled"sv, "0"sv },
@@ -203,28 +160,7 @@ void WorldSession::SendFeatureSystemStatusGlueScreen()
{ "housingMarketEnabled"sv, "0"sv },
};
// shop2 endpoint advertisement. The client reaches the modern store over HTTPS at whatever host
// these vars name - they are the ONLY thing that points it anywhere, so serving our own endpoint
// is a matter of naming it here (no hosts file, no hostname impersonation). The client's built-in
// defaults are Blizzard's dev hosts (https://us.apidev.blizzard.net, https://oauth.web.blizzard.net),
// which is why an arbitrary host is acceptable to it. Only advertised when Shop.Shop2Enabled is on
// AND a URL is actually configured, so we never announce a store with nowhere to reach.
std::vector<WorldPackets::System::MirrorVarSingle> varList(std::begin(vars), std::end(vars));
if (shopEnabled && sWorld->getBoolConfig(CONFIG_SHOP_SHOP2_ENABLED))
{
auto addIfConfigured = [&varList](std::string_view name, char const* configKey)
{
std::string value = sConfigMgr->GetStringDefault(configKey, "");
if (!value.empty())
varList.emplace_back(name, value);
};
addIfConfigured("shop2HostUrlRequests"sv, "Shop.Shop2HostUrlRequests");
addIfConfigured("shop2HostUrlAuth"sv, "Shop.Shop2HostUrlAuth");
addIfConfigured("shop2ClientIdStr"sv, "Shop.Shop2ClientId");
}
WorldPackets::System::MirrorVars variables;
variables.Variables = varList;
variables.Variables = vars;
SendPacket(variables.Write());
}