public ExBuySellList_Buy(L2Player player, ND_shopList shop, double mod, double tax, int shopId) { _shop = shop; _adena = player.getAdena(); _mod = mod; _tax = tax; _shopId = shopId; }
//List<L2Item> _sells = new List<L2Item>(); public ExBuySellList(L2Player player, ND_shopList shop, double mod, double tax, int shopId) { base.makeme(); _shop = shop; _adena = player.getAdena(); _mod = mod; _tax = tax; _shopId = shopId; //foreach (L2Item item in player.getAllItems()) //{ // if (item._template.is_trade == 0 || item._augmentationId > 0 || item._isEquipped == 1) // continue; // if (item._template._type == ItemTemplate.L2ItemType.asset) // continue; // _sells.Add(item); //} }
public override void run() { L2Player player = getClient().CurrentPlayer; if (_count <= 0) { player.sendActionFailed(); return; } L2Citizen trader = player.FolkNpc; if (trader == null) { player.sendSystemMessage(1802); //The attempt to trade has failed. player.sendActionFailed(); return; } ND_shop shop = NpcData.getInstance()._shops[trader.Template.NpcId]; if (shop == null) { player.sendSystemMessage(1802); //The attempt to trade has failed. player.sendActionFailed(); return; } ND_shopList list = shop.lists[(short)_listId]; if (list == null) { player.sendSystemMessage(1802); //The attempt to trade has failed. player.sendActionFailed(); return; } long adena = 0; int slots = 0, weight = 0; for (int i = 0; i < _count; i++) { int itemId = (int)_items[i * 2]; bool notfound = true; foreach (ND_shopItem item in list.items) { if (item.item.ItemID == itemId) { adena += item.item.Price * _items[i * 2 + 1]; if (!item.item.isStackable()) { slots++; } else { if (!player.hasItem(item.item.ItemID)) { slots++; } } weight += (int)(item.item.Weight * _items[i * 2 + 1]); notfound = false; break; } } if (notfound) { player.sendSystemMessage(1802); //The attempt to trade has failed. player.sendActionFailed(); return; } } if (adena > player.getAdena()) { player.sendSystemMessage(279); //You do not have enough adena. return; } player.reduceAdena(adena, false, false); for (int i = 0; i < _count; i++) { int itemId = (int)_items[i * 2]; long count = _items[i * 2 + 1]; player.Inventory.addItem(itemId, count, false, false); } player.sendPacket(new ExBuySellList_Close()); }
public ShopPreviewList(L2Player player, ND_shopList shop, int shopId) { _adena = player.getAdena(); _shop = shop; _shopId = shopId; }