Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. public void buyItem(int itemID, int fromSlot, int amount) {
  2. /*if (!c.isShopping) {
  3. return false;
  4. }*/
  5. if (Server.getMultiplayerSessionListener().inAnySession(c))
  6. return;
  7.  
  8. if (c.myShopId == 14) {
  9. skillBuy(itemID);
  10. return;
  11. }
  12. if (c.myShopId == 16) {
  13. c.getShops().buyFromZulrahExchange(itemID, amount);
  14. return;
  15. }
  16. if (!shopSellsItem(itemID))
  17. return;
  18.  
  19. if (amount > 0) {
  20. if (amount > ShopHandler.ShopItemsN[c.myShopId][fromSlot]) {
  21. amount = ShopHandler.ShopItemsN[c.myShopId][fromSlot];
  22. }
  23. int coins = c.getItems().getItemSlot(995);
  24. if (c.myShopId == 2 || c.myShopId == 8 || c.myShopId == 9
  25. || c.myShopId == 10 || c.myShopId == 12 || c.myShopId == 13) {
  26. handleOtherShop(itemID);
  27. return;
  28. }
  29. coins = c.getItems().getItemSlot(995);
  30. if (c.playerItemsN[coins] >= (c.getShops().getItemShopValue(itemID) * amount)) {
  31. if (c.getItems().freeSlots() > 0) {
  32. if(!Item.itemStackable[itemID] && amount > c.getItems().freeSlots()) {
  33. amount = c.getItems().freeSlots();
  34. }
  35. c.getItems().deleteItem(995, c.getItems().getItemSlot(995), (c.getShops().getItemShopValue(itemID) * amount));
  36. c.getItems().addItem(itemID, amount);
  37. c.getItems().resetItems(3823);
  38. resetShop(c.myShopId);
  39. updatePlayerShop();
  40. return;
  41. } else {
  42. c.sendMessage("You don't have enough space in your inventory.");
  43. }
  44. } else {
  45. c.sendMessage("You don't have enough coins.");
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement