bpay
Build (Windows x64) / build (push) Canceled after 0s
Build (Windows x64) / linux-build (push) Canceled after 0s

This commit is contained in:
luis
2026-08-08 22:34:07 -03:00
parent 54b15dfae3
commit d14442d623
10 changed files with 429 additions and 33 deletions
@@ -0,0 +1,137 @@
UPDATE `creature_template` SET `type` = 14 WHERE `entry` IN (
240137,
240994,
241150,
241297,
241346,
241416,
242176,
242180,
242452,
242652,
244145,
244146,
244263,
245043,
245204,
245215,
245217,
245474,
245475,
245476,
245477,
245479,
245480,
245481,
245482,
245494,
245495,
245496,
245497,
245498,
245499,
245500,
245501,
245502,
245503,
245504,
245505,
245506,
245545,
245616,
245647,
246660,
246661,
246662,
246663,
246696,
246983,
247463,
247465,
248495,
249488,
250583,
251804,
251817,
251819,
251820,
251821,
251822,
251889,
252859,
253374,
253399,
254356,
254359,
254647,
254689,
254979,
254986,
255119,
255257,
255689,
255736,
255750,
255921,
256014,
256059,
256237,
256265,
256269,
256271,
256559,
256560,
256565,
256566,
256567,
256663,
256759,
256985,
257493,
257616,
257695,
257802,
257857,
258281,
258803,
259728,
260899
) AND `type` = 12;
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_mage_hot_streak', 'spell_mage_hot_streak_ignite_marker');
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(44448, 'spell_mage_hot_streak'),
(11366, 'spell_mage_hot_streak_ignite_marker'),
(2120, 'spell_mage_hot_streak_ignite_marker');
DELETE FROM `spell_proc` WHERE `SpellId` IN (44448,48108);
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
(44448,0x04,3,0x00C00013,0x00100000,0x00000000,0x00000000,0x0,0x0,0x1,0x2,0x0,0x0,0x0,0,0,0,0), -- Pyroblast Clearcasting Driver
(48108,0x00,3,0x00000000,0x00000000,0x00000000,0x00000000,0x0,0x4,0x0,0x0,0x0,0x8,0x0,0,0,0,1); -- Hot Streak!
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
-- Keystones / access
(1223423, 'spell_dh_consume_soul_devourer'),
(1217605, 'spell_dh_void_metamorphosis_cast'),
(1217607, 'spell_dh_void_metamorphosis_devourer'),
(1221150, 'spell_dh_collapsing_star'),
(1221162, 'spell_dh_collapsing_star_damage');
UPDATE `creature_template`
SET `npcflag` = `npcflag` | 0x40000000
WHERE `type` = 14
AND (`npcflag` & 0x40000000) = 0;
DELETE FROM `creature_template_gossip` WHERE `CreatureID` = 86056 AND `MenuID` = 14991;
INSERT INTO `creature_template_gossip` (`CreatureID`, `MenuID`, `VerifiedBuild`) VALUES
(86056, 14991, 0);
DELETE FROM `creature_trainer` WHERE `CreatureID` = 185960;
INSERT INTO `creature_trainer` (`CreatureID`, `TrainerID`, `MenuID`, `OptionID`) VALUES
(185960, 580, 14991, 0);
+7 -5
View File
@@ -108,8 +108,10 @@ void WorldSession::SendSetTimeZoneInformation()
void WorldSession::SendFeatureSystemStatusGlueScreen()
{
WorldPackets::System::FeatureSystemStatusGlueScreen features;
features.BpayStoreAvailable = true;
features.CommerceServerEnabled = true;
// 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.BpayStoreDisabledByParentalControls = false;
features.CharUndeleteEnabled = sWorld->getBoolConfig(CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_ENABLED);
features.MaxCharactersOnThisRealm = sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM);
@@ -152,9 +154,9 @@ void WorldSession::SendFeatureSystemStatusGlueScreen()
// Retail 12.0.7 sends both "1" (verified against the in-game-shop sniff). The core product
// list rides C_StoreSecure.GetProductList -> CMSG_BATTLE_PAY_GET_PRODUCT_LIST, which our
// BattlePayMgr answers with the captured catalog; shop2's web-checkout extras stay inert
// (we don't ship Blizzard service URLs) but do not block that path.
{ "shop2Enabled"sv, "1"sv },
{ "bpayStoreEnable"sv, "1"sv },
// (we don't ship Blizzard service URLs) but do not block that path. Follows Shop.Enabled.
{ "shop2Enabled"sv, shopEnabled ? "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.
+175 -17
View File
@@ -16,11 +16,19 @@
*/
#include "WorldSession.h"
//#include "WowTokenMgr.h"
#include "BattlePayMgr.h"
#include "BattlePayPackets.h"
#include "DatabaseEnv.h"
#include "DBCEnums.h"
#include "Item.h"
#include "ItemTemplate.h"
#include "ItemEnchantmentMgr.h"
#include "Log.h"
#include "Mail.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "World.h"
#include <algorithm>
namespace
{
@@ -33,6 +41,60 @@ namespace
constexpr int32 RESULT_OK = 0;
constexpr int32 RESULT_NOT_ENOUGH_BALANCE = 29;
constexpr int32 RESULT_PRODUCT_NOT_PURCHASABLE = 57;
// Delivers `count` of `itemId` in full: as much as fits into the player's bags, the remainder by
// mail (retail parity - a near-full inventory must never turn a full-price purchase into a partial
// delivery, see audit C-06). Returns false only if the item template is invalid; once past that,
// bags + mail together always take the whole quantity so the caller may charge safely.
bool BattlePayDeliverItem(Player* player, uint32 itemId, uint32 count)
{
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
if (!proto || !count)
return false;
uint32 noSpaceCount = 0;
ItemPosCountVec dest;
InventoryResult const msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceCount);
uint32 const toBags = (msg == EQUIP_ERR_OK) ? count : (count - noSpaceCount);
if (toBags && !dest.empty())
{
if (Item* item = player->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId)))
player->SendNewItem(item, toBags, true, false);
}
uint32 remainder = count - toBags;
if (remainder)
{
// Mail the overflow in max-stack chunks.
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
MailDraft draft("In-game Shop Purchase", "The items you purchased did not all fit in your bags; the remainder is attached.");
uint32 const maxStack = std::max<uint32>(1u, proto->GetMaxStackSize());
uint32 attached = 0;
while (remainder && attached < MAX_MAIL_ITEMS)
{
uint32 const stackCount = std::min(remainder, maxStack);
Item* mailItem = Item::CreateItem(itemId, stackCount, ItemContext::NONE, player);
if (!mailItem)
break;
mailItem->SaveToDB(trans);
draft.AddItem(mailItem);
remainder -= stackCount;
++attached;
}
draft.SendMailTo(trans, MailReceiver(player, player->GetGUID().GetCounter()), MailSender(MAIL_NORMAL, 0, MAIL_STATIONERY_GM));
CharacterDatabase.CommitTransaction(trans);
if (remainder)
{
// More than a full mail's worth left over - refuse rather than silently swallow the rest.
TC_LOG_ERROR("network", "BattlePay: item {} x{} exceeded bag + mail capacity for {}; {} undelivered.",
itemId, count, player->GetName(), remainder);
return false;
}
}
return true;
}
}
// In-game Shop (BattlePay). P0: reply to the catalog request with the captured, client-validated
@@ -40,15 +102,29 @@ namespace
// nothing (shop opens empty) rather than fabricating wire.
void WorldSession::HandleBattlePayGetProductList(WorldPackets::BattlePay::GetProductList& /*getProductList*/)
{
if (!sWorld->getBoolConfig(CONFIG_SHOP_ENABLED))
return;
if (!sBattlePayMgr->HasCatalog())
{
TC_LOG_DEBUG("network", "BattlePay: GetProductList from {} but no catalog loaded.", GetPlayerInfo());
return;
}
// Throttle the 58 KB blob: serve it at most once per catalog generation for this session. The client
// re-requests on every shop open, so without this a STATUS_AUTHED session could pull it repeatedly.
// A `.reload shop_catalog` bumps the generation, so a fresh catalog still reaches the next request.
uint32 const generation = sBattlePayMgr->GetCatalogGeneration();
if (_battlePayCatalogGeneration == generation)
{
TC_LOG_DEBUG("network", "BattlePay: GetProductList from {} already served catalog gen {}.", GetPlayerInfo(), generation);
return;
}
WorldPackets::BattlePay::ProductListResponse response;
response.RawData = &sBattlePayMgr->GetProductListBlob();
SendPacket(response.Write());
_battlePayCatalogGeneration = generation;
}
// Drives the purchase to completion for a given productID: validate, charge (gold or a token item),
@@ -85,6 +161,15 @@ void WorldSession::BattlePayProcessPurchase(uint32 productID)
return;
}
// Already-known spell (mount / toy / appearance) is not purchasable: block BEFORE charging so a
// repeat purchase never takes gold for nothing (audit C-05). The wire flag 256 HideWhenOwned hides
// it client-side, but the server gate is authoritative.
if (product->GrantType == 2 && player->HasSpell(product->GrantId))
{
respond(STATUS_FAILED, RESULT_PRODUCT_NOT_PURCHASABLE, 0);
return;
}
// Cost check (gold and/or a token item).
if (product->CostMoney && !player->HasEnoughMoney(product->CostMoney))
{
@@ -101,20 +186,12 @@ void WorldSession::BattlePayProcessPurchase(uint32 productID)
bool granted = false;
switch (product->GrantType)
{
case 1: // item
granted = player->AddItem(product->GrantId, product->GrantCount);
case 1: // item - full delivery to bags, overflow to mail (no partial-stack-at-full-price)
granted = BattlePayDeliverItem(player, product->GrantId, product->GrantCount);
break;
case 2: // spell (mount / toy / appearance)
if (!player->HasSpell(product->GrantId))
player->LearnSpell(product->GrantId, false);
granted = true;
break;
case 3: // WoW Token - the retail acquisition path: bought from the shop, then sellable
// for (uint32 i = 0; i < std::max<uint32>(product->GrantCount, 1); ++i)
// sWowTokenMgr->CreateToken(GetAccountId(), WOW_TOKEN_STATE_AUCTIONABLE);
// Confirmed trigger for this push: the account's token holdings changed.
// SendCommerceTokenUpdate();
case 2: // spell (mount / toy / appearance) - LearnSpell routes it into the account-wide
// collection via CollectionMgr, so the mount/toy/appearance is available account-wide
player->LearnSpell(product->GrantId, false);
granted = true;
break;
default:
@@ -142,16 +219,78 @@ void WorldSession::BattlePayProcessPurchase(uint32 productID)
void WorldSession::HandleBattlePayStartPurchase(WorldPackets::BattlePay::StartPurchase& startPurchase)
{
if (!sWorld->getBoolConfig(CONFIG_SHOP_ENABLED))
return;
// The productID scalar is a strong candidate (setter is Warden-obfuscated). Log all three fields so a
// live purchase confirms which scalar is the productID; GetProduct() also guards against a wrong guess.
TC_LOG_INFO("network", "BattlePay: StartPurchase from {}: u32={} u64={} flag={}",
GetPlayerInfo(), startPurchase.ProductID, startPurchase.ScalarU64, uint32(startPurchase.Flag));
// Two-step retail confirmation flow (opt-in): stash the pending product, prompt the client, and
// complete the purchase only when it answers CMSG_BATTLE_PAY_CONFIRM_PURCHASE_RESPONSE. Off by
// default because the confirm packet layout is inferred (see ConfirmPurchase in BattlePayPackets.h);
// the proven direct path runs otherwise.
if (sWorld->getBoolConfig(CONFIG_SHOP_PURCHASE_CONFIRMATION))
{
Player* player = GetPlayer();
BattlePayProduct const* product = player ? sBattlePayMgr->GetProduct(startPurchase.ProductID) : nullptr;
if (!product)
{
WorldPackets::BattlePay::StartPurchaseResponse ack;
ack.PurchaseID = sBattlePayMgr->GeneratePurchaseID();
ack.ResultB = uint32(RESULT_PRODUCT_NOT_PURCHASABLE);
SendPacket(ack.Write());
return;
}
uint64 const purchaseID = sBattlePayMgr->GeneratePurchaseID();
_battlePayPendingProductID = startPurchase.ProductID;
_battlePayConfirmToken = uint32(purchaseID) | 0x1u; // non-zero token = a purchase is pending
WorldPackets::BattlePay::ConfirmPurchase confirm;
confirm.PurchaseID = purchaseID;
confirm.ProductID = startPurchase.ProductID;
confirm.CurrentPriceFixedPoint = (product->CostMoney / 10000) * 100000; // copper -> shop fixed-point
confirm.ServerToken = _battlePayConfirmToken;
SendPacket(confirm.Write());
return;
}
BattlePayProcessPurchase(startPurchase.ProductID);
}
void WorldSession::HandleBattlePayConfirmPurchaseResponse(WorldPackets::BattlePay::ConfirmPurchaseResponse& confirmPurchaseResponse)
{
if (!sWorld->getBoolConfig(CONFIG_SHOP_ENABLED))
return;
// Ignore stale/unsolicited responses (guards against a replayed confirm double-charging).
if (!_battlePayConfirmToken || confirmPurchaseResponse.ServerToken != _battlePayConfirmToken)
{
TC_LOG_DEBUG("network", "BattlePay: ConfirmPurchaseResponse from {} with unexpected token {} (pending {}).",
GetPlayerInfo(), confirmPurchaseResponse.ServerToken, _battlePayConfirmToken);
return;
}
uint32 const productID = _battlePayPendingProductID;
_battlePayConfirmToken = 0; // consume the pending purchase before doing any work
_battlePayPendingProductID = 0;
if (!confirmPurchaseResponse.Confirmed)
{
TC_LOG_INFO("network", "BattlePay: {} cancelled purchase of product {}.", GetPlayerInfo(), productID);
return;
}
BattlePayProcessPurchase(productID);
}
void WorldSession::HandleBattlePayOpenCheckout(WorldPackets::BattlePay::OpenCheckout& openCheckout)
{
if (!sWorld->getBoolConfig(CONFIG_SHOP_ENABLED))
return;
// Retail routes purchases here (-> Battle.net web-checkout) using a distributionID rather than a
// productID. We cannot map that to a product without the distribution setup, so log it for diagnosis;
// server-defined products are purchased via StartPurchase above.
@@ -159,12 +298,31 @@ void WorldSession::HandleBattlePayOpenCheckout(WorldPackets::BattlePay::OpenChec
GetPlayerInfo(), openCheckout.DistributionID);
}
// Replays the captured distribution-list blob unsolicited at session start. There is no CMSG that
// requests it; retail pushes it after the glue feature status, and the client's StoreFrame_IsLoading
// gate stays stuck until HasDistributionList() flips, which this response does.
void WorldSession::SendBattlePayDistributionList()
{
if (!sWorld->getBoolConfig(CONFIG_SHOP_ENABLED))
return;
if (!sBattlePayMgr->HasDistributionList())
return;
WorldPackets::BattlePay::GetDistributionListResponse response;
response.RawData = &sBattlePayMgr->GetDistributionListBlob();
SendPacket(response.Write());
}
void WorldSession::HandleBattlePayGetPurchaseList(WorldPackets::BattlePay::GetPurchaseList& /*getPurchaseList*/)
{
// The client polls this whenever the Shop is opened (390 requests across our sniffs) and blocks its
// purchase UI until it gets a reply. Answer with this account's real purchase history: the Shop only
// grants products through BattlePayProcessPurchase, which does not persist a purchase ledger, so the
// honest answer today is an empty list rather than fabricated entries.
// purchase UI (HasPurchaseList) until it gets a reply. Answer with this account's real purchase
// history: the Shop only grants products through BattlePayProcessPurchase, which does not persist a
// purchase ledger, so the honest answer today is an empty list rather than fabricated entries.
if (!sWorld->getBoolConfig(CONFIG_SHOP_ENABLED))
return;
WorldPackets::BattlePay::GetPurchaseListResponse response;
response.Result = 0; // PurchaseResult::Ok
SendPacket(response.Write());
@@ -1261,6 +1261,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
SendPerksAnimToggleKillSwitch();
SendPerksProgramActivityUpdate();
// Unblock the in-game Shop panel: the client's StoreFrame_IsLoading gate waits on the distribution
// list (HasDistributionList). Retail sends it right after the feature status; we replay the blob.
SendBattlePayDistributionList();
// Send MOTD
{
@@ -1655,8 +1658,10 @@ void WorldSession::SendFeatureSystemStatus()
features.GuildChatThrottle.TriesRestoredPerSecond = 20;
features.GroupChatThrottle.UsedTriesPerMessage = 1;
features.GroupChatThrottle.TriesRestoredPerSecond = 20;
features.BpayStoreAvailable = true;
features.CommerceServerEnabled = true;
// Gated by the Shop.Enabled worldserver.conf toggle (default on).
bool const shopEnabled = sWorld->getBoolConfig(CONFIG_SHOP_ENABLED);
features.BpayStoreAvailable = shopEnabled;
features.CommerceServerEnabled = shopEnabled;
SendPacket(features.Write());
}
@@ -27,6 +27,14 @@ namespace WorldPackets::BattlePay
return &_worldPacket;
}
WorldPacket const* GetDistributionListResponse::Write()
{
if (RawData && !RawData->empty())
_worldPacket.append(RawData->data(), RawData->size());
return &_worldPacket;
}
void StartPurchase::Read()
{
_worldPacket >> ProductID;
@@ -48,11 +56,32 @@ namespace WorldPackets::BattlePay
return &_worldPacket;
}
// INFERRED layout - see the ConfirmPurchase comment in the header. Gated off by default.
WorldPacket const* ConfirmPurchase::Write()
{
_worldPacket << PurchaseID;
_worldPacket << ProductID;
_worldPacket << CurrentPriceFixedPoint;
_worldPacket << ServerToken;
_worldPacket.WriteBits(0u, 8); // walletName length (empty), bit-packed like the other records
_worldPacket.FlushBits();
return &_worldPacket;
}
void ConfirmPurchaseResponse::Read()
{
_worldPacket >> ServerToken;
Confirmed = _worldPacket.ReadBit();
}
// Record order proven against the live 68974 purchase list (TESTER_SNIFF2_LINDORMI_MINE, 458 B =
// 8 + 10x45): { u64 PurchaseID, i32 Status, i32 ResultCode, u32 ProductID, u64 BasePrice,
// u64 UserPrice, i64 TimeCreated, u8 walletNameLen }. walletName sits at the END of the record -
// in all 10 live records the unix purchase time aligns at record offset 36 and byte 44 is the
// empty-wallet 0; with the u8 after ProductID the time would start at 37, one byte late.
// Shares the JamBattlePayPurchase record layout with PurchaseUpdate::Write (walletName length
// record-final - see the comment there). Answered honestly-empty today (no purchase ledger yet).
WorldPacket const* GetPurchaseListResponse::Write()
{
_worldPacket << Result;
@@ -72,8 +101,6 @@ namespace WorldPackets::BattlePay
return &_worldPacket;
}
// Same JamBattlePayPurchase record layout as GetPurchaseListResponse above (walletName record-final,
// 68974 capture evidence there).
WorldPacket const* PurchaseUpdate::Write()
{
_worldPacket << Result;
@@ -57,6 +57,20 @@ namespace WorldPackets
std::vector<uint8> const* RawData = nullptr;
};
// Sent unsolicited at session start (there is no matching CMSG). The client's shop panel gate
// StoreFrame_IsLoading blocks until HasDistributionList() is true, which this response flips.
// We replay a byte-exact 107 B blob captured from a real 68275 session (6 B header + 101 B
// JamBattlePayDistributionObject record). RawData is the message BODY (opcode header prepended).
class GetDistributionListResponse final : public ServerPacket
{
public:
explicit GetDistributionListResponse() : ServerPacket(SMSG_BATTLE_PAY_GET_DISTRIBUTION_LIST_RESPONSE) {}
WorldPacket const* Write() override;
std::vector<uint8> const* RawData = nullptr;
};
// Client initiates an in-game purchase. Layout from the client Write method (0x5d9f90):
// u32, u64, then a 1-bit bool. The u32 is the strong candidate for the productID (the setter is
// Warden-obfuscated so the exact semantic is runtime-confirmed via the handler's diagnostic log).
@@ -83,6 +97,44 @@ namespace WorldPackets
uint32 DistributionID = 0;
};
// Server-driven purchase confirmation prompt (retail interposes this between StartPurchase and
// completion; it clears the client's WaitingOnConfirmation and shows the confirm dialog, whose
// C_StoreSecure.GetConfirmationInfo() reads productID, walletName and the current price).
//
// INFERRED LAYOUT - NOT byte-verified: the 68275 client read struct (sub_7FF7290A91A0, opcode
// 0x420232) is an opaque nested reflection struct in the RE dump and this opcode never appears
// on-wire in any of the 8 captures (retail hands purchases to web checkout). The field set below
// is the classic JamBattlePayConfirmPurchase shape that GetConfirmationInfo consumes. Because a
// malformed packet could disconnect a live client, sending this is gated behind the
// Shop.PurchaseConfirmation config (default off) until a live client validates the layout; the
// proven direct-grant path (StartPurchase -> grant/charge -> PurchaseUpdate) stays the default.
class ConfirmPurchase final : public ServerPacket
{
public:
explicit ConfirmPurchase() : ServerPacket(SMSG_BATTLE_PAY_CONFIRM_PURCHASE, 8 + 4 + 8 + 4 + 1) {}
WorldPacket const* Write() override;
uint64 PurchaseID = 0;
uint32 ProductID = 0;
uint64 CurrentPriceFixedPoint = 0; // wire fixed-point /100000 (same scale as the catalog)
uint32 ServerToken = 0; // echoed back in the response so we can match the prompt
};
// Client's answer to the confirmation prompt. Layout byte-grounded from the 68275 client read of
// CMSG_BATTLE_PAY_CONFIRM_PURCHASE_RESPONSE (0x4000fb): a u32 then a 1-bit bool. The u32 echoes
// our ServerToken; the bool is confirm(true)/cancel(false).
class ConfirmPurchaseResponse final : public ClientPacket
{
public:
explicit ConfirmPurchaseResponse(WorldPacket&& packet) : ClientPacket(CMSG_BATTLE_PAY_CONFIRM_PURCHASE_RESPONSE, std::move(packet)) {}
void Read() override;
uint32 ServerToken = 0;
bool Confirmed = false;
};
// Server ack for StartPurchase. Layout from the client read ctor (0x608ec0): u32, u32, u64.
class StartPurchaseResponse final : public ServerPacket
{
@@ -125,10 +177,9 @@ namespace WorldPackets
// Reply to CMSG_BATTLE_PAY_GET_PURCHASE_LIST. Body layout is identical to
// SMSG_BATTLE_PAY_PURCHASE_UPDATE: { uint32 Result, uint32 Count, Count x PurchaseRecord }.
// Proven against live sniffs: a retail account with 9 purchases produced a 413-byte body
// (8 + 9 * 45), and the 68974 capture (10 purchases, 458 B = 8 + 10x45) fixes the record
// order as u64+i32+i32+u32+u64+u64+i64+u8 - walletName length LAST (times align at
// record offset 36; see the .cpp writer comment).
// Proven against a live sniff: a retail account with 9 purchases produced a 413-byte body, and
// 8 (header) + 9 * 45 (PurchaseRecord = u64+i32+i32+u32+u64+u64+i64+u8) == 413 exactly. The
// record layout (walletName length record-final) matches the fixed PurchaseUpdate serializer.
class GetPurchaseListResponse final : public ServerPacket
{
public:
+3 -3
View File
@@ -221,7 +221,7 @@ void OpcodeTable::InitializeClientOpcodes()
DEFINE_HANDLER(CMSG_BATTLENET_REQUEST, STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlenetRequest);
DEFINE_HANDLER(CMSG_BATTLE_PAY_ACK_FAILED_RESPONSE, STATUS_IGNORED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_BATTLE_PAY_CANCEL_OPEN_CHECKOUT, STATUS_IGNORED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_BATTLE_PAY_CONFIRM_PURCHASE_RESPONSE, STATUS_IGNORED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_BATTLE_PAY_CONFIRM_PURCHASE_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlePayConfirmPurchaseResponse);
DEFINE_HANDLER(CMSG_BATTLE_PAY_DISTRIBUTION_ASSIGN_TO_TARGET, STATUS_IGNORED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_BATTLE_PAY_DISTRIBUTION_ASSIGN_VAS, STATUS_IGNORED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_BATTLE_PAY_GET_PRODUCT_LIST, STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleBattlePayGetProductList);
@@ -1281,13 +1281,13 @@ void OpcodeTable::InitializeServerOpcodes()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_ACK_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_BATTLE_PET_DELIVERED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_COLLECTION_ITEM_DELIVERED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_CONFIRM_PURCHASE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_CONFIRM_PURCHASE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_DELIVERY_ENDED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_DELIVERY_STARTED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_DISTRIBUTION_ASSIGN_VAS_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_DISTRIBUTION_UNREVOKED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_DISTRIBUTION_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_GET_DISTRIBUTION_LIST_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_GET_DISTRIBUTION_LIST_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_GET_PRODUCT_LIST_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_GET_PURCHASE_LIST_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PAY_MOUNT_DELIVERED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+12
View File
@@ -130,6 +130,7 @@ namespace WorldPackets
class GetPurchaseList;
class StartPurchase;
class OpenCheckout;
class ConfirmPurchaseResponse;
}
namespace AreaTrigger
@@ -2379,6 +2380,8 @@ public:
void HandleBattlePayStartPurchase(WorldPackets::BattlePay::StartPurchase& startPurchase);
void HandleBattlePayOpenCheckout(WorldPackets::BattlePay::OpenCheckout & openCheckout);
void BattlePayProcessPurchase(uint32 productID);
void HandleBattlePayConfirmPurchaseResponse(WorldPackets::BattlePay::ConfirmPurchaseResponse& confirmPurchaseResponse);
void SendBattlePayDistributionList();
void HandleRequestPvpReward(WorldPackets::Battleground::RequestPVPRewards& packet);
void HandleSurrenderArena(WorldPackets::Battleground::SurrenderArena& surrenderArena);
@@ -2903,6 +2906,15 @@ public:
// Packets cooldown
time_t _calendarEventCreationCooldown;
// In-game Shop: last catalog generation this session was served the product-list blob for
// (0 = never). Throttles the 58 KB blob to once per generation; see BattlePayMgr.
uint32 _battlePayCatalogGeneration = 0;
// In-game Shop: pending purchase awaiting the client's confirmation response (two-step flow,
// Shop.PurchaseConfirmation). _battlePayConfirmToken 0 = nothing pending.
uint32 _battlePayPendingProductID = 0;
uint32 _battlePayConfirmToken = 0;
std::unique_ptr<BattlePets::BattlePetMgr> _battlePetMgr;
std::unique_ptr<CollectionMgr> _collectionMgr;
+2
View File
@@ -719,6 +719,8 @@ void World::LoadConfigSettings(bool reload)
{ .Name = "Housing.EnableCreateCharterNeighborhood"sv, .DefaultValue = true, .Index = CONFIG_HOUSING_ENABLE_CREATE_CHARTER_NEIGHBORHOOD },
{ .Name = "Housing.EnableCreateGuildNeighborhood"sv, .DefaultValue = true, .Index = CONFIG_HOUSING_ENABLE_CREATE_GUILD_NEIGHBORHOOD },
{ .Name = "Housing.TutorialsEnabled"sv, .DefaultValue = true, .Index = CONFIG_HOUSING_TUTORIALS_ENABLED },
{ .Name = "Shop.Enabled"sv, .DefaultValue = true, .Index = CONFIG_SHOP_ENABLED },
{ .Name = "Shop.PurchaseConfirmation"sv, .DefaultValue = false, .Index = CONFIG_SHOP_PURCHASE_CONFIRMATION },
} };
static constexpr ConfigOptionLoadDefinitionArray<uint32, INT_CONFIG_VALUE_COUNT> ints =
+2
View File
@@ -203,6 +203,8 @@ enum WorldBoolConfigs : uint32
CONFIG_HOUSING_ENABLE_CREATE_CHARTER_NEIGHBORHOOD,
CONFIG_HOUSING_ENABLE_CREATE_GUILD_NEIGHBORHOOD,
CONFIG_HOUSING_TUTORIALS_ENABLED,
CONFIG_SHOP_ENABLED,
CONFIG_SHOP_PURCHASE_CONFIRMATION,
BOOL_CONFIG_VALUE_COUNT
};