public CashShop() { CashShopItemTemplate t = new CashShopItemTemplate(); t.ClientID = 1080001; t.Item = ItemTable.getInstance().getItem(22000); t.Category = 5; CashShopItem item = new CashShopItem(t); item.Count = 1; item.Price = 250; _items.Add(item.Template.ClientID, item); CashShopItemTemplate t2 = new CashShopItemTemplate(); t2.ClientID = 1080039; t2.Item = ItemTable.getInstance().getItem(22057); t2.Category = 5; CashShopItem item2 = new CashShopItem(t2); item2.Count = 1; item2.Price = 600; _items.Add(item2.Template.ClientID, item2); }
public void requestBuyItem(L2Player player, int clientID, int count) { if (count > MAX_BUY_COUNT) { count = MAX_BUY_COUNT; } if (count < 1) { count = 1; } if (!_items.ContainsKey(clientID)) { sendResult(player, BR_BUY_INVALID_ITEM); return; } CashShopItem item = _items[clientID]; if (player.ExtraPoints < (item.Price * count)) { sendResult(player, BR_BUY_LACK_OF_POINT); return; } //if (item.Stock - item.MaxStock < 1) //{ // sendResult(player, BR_BUY_SOLD_OUT); // return; //} if (!player.CheckFreeWeight(item.Template.Item.Weight * count)) { sendResult(player, BR_BUY_INVENTROY_OVERFLOW); return; } if (!player.CheckFreeSlotsInventory(item.Template.Item, count)) { sendResult(player, BR_BUY_INVENTROY_OVERFLOW); return; } player.ExtraPoints = player.ExtraPoints - (item.Price * count); player.sendPacket(new ExBR_GamePoint(player.ObjID, player.ExtraPoints)); player.Inventory.addItem(item.Template.Item, count, 0, true, true); sendResult(player, BR_BUY_SUCCESS); }