Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void buyItem(int itemID, int fromSlot, int amount) {
- /*if (!c.isShopping) {
- return false;
- }*/
- if (Server.getMultiplayerSessionListener().inAnySession(c))
- return;
- if (c.myShopId == 14) {
- skillBuy(itemID);
- return;
- }
- if (c.myShopId == 16) {
- c.getShops().buyFromZulrahExchange(itemID, amount);
- return;
- }
- if (!shopSellsItem(itemID))
- return;
- if (amount > 0) {
- if (amount > ShopHandler.ShopItemsN[c.myShopId][fromSlot]) {
- amount = ShopHandler.ShopItemsN[c.myShopId][fromSlot];
- }
- int coins = c.getItems().getItemSlot(995);
- if (c.myShopId == 2 || c.myShopId == 8 || c.myShopId == 9
- || c.myShopId == 10 || c.myShopId == 12 || c.myShopId == 13) {
- handleOtherShop(itemID);
- return;
- }
- coins = c.getItems().getItemSlot(995);
- if (c.playerItemsN[coins] >= (c.getShops().getItemShopValue(itemID) * amount)) {
- if (c.getItems().freeSlots() > 0) {
- if(!Item.itemStackable[itemID] && amount > c.getItems().freeSlots()) {
- amount = c.getItems().freeSlots();
- }
- c.getItems().deleteItem(995, c.getItems().getItemSlot(995), (c.getShops().getItemShopValue(itemID) * amount));
- c.getItems().addItem(itemID, amount);
- c.getItems().resetItems(3823);
- resetShop(c.myShopId);
- updatePlayerShop();
- return;
- } else {
- c.sendMessage("You don't have enough space in your inventory.");
- }
- } else {
- c.sendMessage("You don't have enough coins.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement