/** * Cash packages have data in both the Commodity and Package section of Etc.wz * Client sends package SN which is stored in the commodity section of WZ files (one of the ~12000 entries) * The commodity itemid (not SN) contains the SN for the CashPackage * The CashPackage (one of ~450) contains the cash item SN's of the package items */ public static void BuyPackage(WvsShopClient c, CInPacket p) { if (p.Available < 9) { return; } p.Decode1(); // 00 var cashType = (CashType)p.Decode4(); var nCommoditySN = p.Decode4(); var commodityInfo = MasterManager.CommodityProvider[nCommoditySN]; if (commodityInfo is null) { return; } if (!commodityInfo.OnSale) { return; // TODO proper error code/response } if (!c.Account.HasCash(cashType, commodityInfo.Price)) { return; // TODO proper error code/response } var packagedata = MasterManager.CreateCashPackageItems(commodityInfo.ItemID); packagedata.ForEach(item => { item.dwAccountID = c.Account.ID; item.dwCharacterID = c.dwCharId; }); #if RELEASE c.Account.ModifyCash(cashType, -commodityInfo.Price); #else foreach (var item in packagedata) { item.dwAccountID = c.Account.ID; item.dwCharacterID = c.dwCharId; c.Account.AccountData.Locker.Add(item); } Log.Info($"================COMMODITYSN {nCommoditySN}"); // temporary so i can quickly find a buncha serial numbers return; #endif c.SendPacket(CPacket.CCashShop.BuyPackageResponse(packagedata)); }