Remove slot check.
|
I am using a PI 317 server
So when someone needs to buy something from a shop, their money needs to be in the top left corner of their inventory or else it will say "you do not have enough coins"
Is there a way to fix this so the money doesn't need to be there and can be anywhere in the inventory?
here's my shop assistant
Here is my shophandlerCode:package server.model.shops; import server.Config; import server.Server; import server.model.items.Item; import server.model.players.Client; public class ShopAssistant { private Client c; public ShopAssistant(Client client) { this.c = client; } /** *Shops **/ public void openShop(int ShopID){ c.getItems().resetItems(3823); resetShop(ShopID); c.isShopping = true; c.myShopId = ShopID; c.getPA().sendFrame248(3824, 3822); c.getPA().sendFrame126(Server.shopHandler.ShopName[ShopID], 3901); } public boolean shopSellsItem(int itemID) { for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if(itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) { return true; } } return false; } public void updatePlayerShop() { for (int i = 1; i < Config.MAX_PLAYERS; i++) { if (Server.playerHandler.players[i] != null) { if (Server.playerHandler.players[i].isShopping == true && Server.playerHandler.players[i].myShopId == c.myShopId && i != c.playerId) { Server.playerHandler.players[i].updateShop = true; } } } } public void updateshop(int i){ resetShop(i); } public void resetShop(int ShopID) { //synchronized(c) { int TotalItems = 0; for (int i = 0; i < Server.shopHandler.MaxShopItems; i++) { if (Server.shopHandler.ShopItems[ShopID][i] > 0) { TotalItems++; } } if (TotalItems > Server.shopHandler.MaxShopItems) { TotalItems = Server.shopHandler.MaxShopItems; } c.getOutStream().createFrameVarSizeWord(53); c.getOutStream().writeWord(3900); c.getOutStream().writeWord(TotalItems); int TotalCount = 0; for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if (Server.shopHandler.ShopItems[ShopID][i] > 0 || i <= Server.shopHandler.ShopItemsStandard[ShopID]) { if (Server.shopHandler.ShopItemsN[ShopID][i] > 254) { c.getOutStream().writeByte(255); c.getOutStream().writeDWord_v2(Server.shopHandler.ShopItemsN[ShopID][i]); } else { c.getOutStream().writeByte(Server.shopHandler.ShopItemsN[ShopID][i]); } if (Server.shopHandler.ShopItems[ShopID][i] > Config.ITEM_LIMIT || Server.shopHandler.ShopItems[ShopID][i] < 0) { Server.shopHandler.ShopItems[ShopID][i] = Config.ITEM_LIMIT; } c.getOutStream().writeWordBigEndianA(Server.shopHandler.ShopItems[ShopID][i]); TotalCount++; } if (TotalCount > TotalItems) { break; } } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); // } } public double getItemShopValue(int ItemID, int Type, int fromSlot) { double ShopValue = 1; double Overstock = 0; double TotPrice = 0; for (int i = 0; i < Config.ITEM_LIMIT; i++) { if (Server.itemHandler.ItemList[i] != null) { if (Server.itemHandler.ItemList[i].itemId == ItemID) { ShopValue = Server.itemHandler.ItemList[i].ShopValue; } } } TotPrice = ShopValue; if (Server.shopHandler.ShopBModifier[c.myShopId] == 1) { TotPrice *= 1; TotPrice *= 1; if (Type == 1) { TotPrice *= 1; } } else if (Type == 1) { TotPrice *= 1; } return TotPrice; } public int getItemShopValue(int itemId) { for (int i = 0; i < Config.ITEM_LIMIT; i++) { if (Server.itemHandler.ItemList[i] != null) { if (Server.itemHandler.ItemList[i].itemId == itemId) { return (int)Server.itemHandler.ItemList[i].ShopValue; } } } return 0; } /** *buy item from shop (Shop Price) **/ public void buyFromShopPrice(int removeId, int removeSlot){ int ShopValue = (int)Math.floor(getItemShopValue(removeId, 0, removeSlot)); ShopValue *= 1; String ShopAdd = ""; if (c.myShopId == 18) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Pk Points."); return; } if (c.myShopId == 73) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Pk Points."); return; } if (c.myShopId == 90) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Vote Points."); return; } if (c.myShopId == 74) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Pk Points."); return; } if (c.myShopId == 15) { c.sendMessage("This item current costs " + c.getItems().getUntradePrice(removeId) + " coins."); return; } if (c.myShopId == 48) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " slayer points."); return; } if (ShopValue >= 1000 && ShopValue < 1000000) { ShopAdd = " (" + (ShopValue / 1000) + "K)"; } else if (ShopValue >= 1000000) { ShopAdd = " (" + (ShopValue / 1000000) + " million)"; } c.sendMessage(c.getItems().getItemName(removeId)+": currently costs "+ShopValue+" coins"+ShopAdd); } public int getSpecialItemValue(int id) { switch (id) { case 15220: case 15018: case 15019: case 15020: return 225; case 13263: return 175; case 15492: return 215; case 15403: return 350; case 15126: return 150; case 11283: return 300; case 11665: case 11664: case 11663: return 7; case 8839: case 8840: return 20; case 8842: return 5; case 19785: case 19786: return 25; case 6542: return 4; case 18349: case 18353: case 18355: return 175; case 18361: return 400; case 18351: return 1000; case 18357: return 750; case 18359: return 850; case 18363: return 65; case 18335: return 25; case 19669: return 35; case 10551: return 20; case 10548: return 15; case 20072: return 15; case 19780: return 225; case 15486: return 30; case 13887: case 13893: return 135; case 13899: return 150; case 13905: return 85; case 13884: case 13890: return 120; case 13896: return 150; case 13902: return 100; case 13858: case 13861: return 75; case 13864: case 13867: case 13876: return 25; case 13870: case 13873: return 75; case 13879: case 13883: return 2; case 18705: case 18708: case 18709: return 15; case 18706: case 18707: return 35; case 13101: return 20; case 19335: return 30; case 14632: return 10; case 14490: case 14492: return 10; case 14494: return 5; case 13099: return 5; case 15069: case 15071: return 3; case 15013: return 15; case 15017: return 30; case 989: return 3; case 13661: return 25; case 6739: return 12; case 15259: return 12; case 15441: case 15442: case 15443: case 15444: return 5; case 2581: case 2577: return 275; case 1040: return 20; } return 0; } /** *Sell item to shop (Shop Price) **/ public void sellToShopPrice(int removeId, int removeSlot) { for (int i : Config.ITEM_SELLABLE) { if (i == removeId) { c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+"."); return; } } boolean IsIn = false; if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) { for (int j = 0; j <= Server.shopHandler.ShopItemsStandard[c.myShopId]; j++) { if (removeId == (Server.shopHandler.ShopItems[c.myShopId][j] - 1)) { IsIn = true; break; } } } else { IsIn = true; } if (IsIn == false) { c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+" to this store."); } else { int ShopValue = (int)Math.floor(getItemShopValue(removeId, 1, removeSlot)); String ShopAdd = ""; if (ShopValue >= 1000 && ShopValue < 1000000) { ShopAdd = " (" + (ShopValue / 1000) + "K)"; } else if (ShopValue >= 1000000) { ShopAdd = " (" + (ShopValue / 1000000) + " million)"; } c.sendMessage(c.getItems().getItemName(removeId)+": shop will buy for "+ShopValue+" coins"+ShopAdd); } } public boolean sellItem(int itemID, int fromSlot, int amount) { if(c.inTrade) { c.sendMessage("You cant sell items to the shop while your in trade!"); return false; } if (c.myShopId == 14) return false; for (int i : Config.ITEM_SELLABLE) { if (i == itemID) { c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+"."); return false; } } if (amount > 0 && itemID == (c.playerItems[fromSlot] - 1)) { if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) { boolean IsIn = false; for (int i = 0; i <= Server.shopHandler.ShopItemsStandard[c.myShopId]; i++) { if (itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) { IsIn = true; break; } } if (IsIn == false) { c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+" to this store."); return false; } } if (amount > c.playerItemsN[fromSlot] && (Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == true || Item.itemStackable[(c.playerItems[fromSlot] - 1)] == true)) { amount = c.playerItemsN[fromSlot]; } else if (amount > c.getItems().getItemAmount(itemID) && Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == false && Item.itemStackable[(c.playerItems[fromSlot] - 1)] == false) { amount = c.getItems().getItemAmount(itemID); } //double ShopValue; //double TotPrice; int TotPrice2 = 0; //int Overstock; for (int i = amount; i > 0; i--) { TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 1, fromSlot)); if (c.getItems().freeSlots() > 0 || c.getItems().playerHasItem(995)) { if (Item.itemIsNote[itemID] == false) { c.getItems().deleteItem(itemID, c.getItems().getItemSlot(itemID), 1); } else { c.getItems().deleteItem(itemID, fromSlot, 1); } c.getItems().addItem(995, TotPrice2); addShopItem(itemID, 1); } else { c.sendMessage("You don't have enough space in your inventory."); break; } } c.getItems().resetItems(3823); resetShop(c.myShopId); updatePlayerShop(); return true; } return true; } public boolean addShopItem(int itemID, int amount) { boolean Added = false; if (amount <= 0) { return false; } if (Item.itemIsNote[itemID] == true) { itemID = c.getItems().getUnnotedItem(itemID); } for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if ((Server.shopHandler.ShopItems[c.myShopId][i] - 1) == itemID) { Server.shopHandler.ShopItemsN[c.myShopId][i] += amount; Added = true; } } if (Added == false) { for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if (Server.shopHandler.ShopItems[c.myShopId][i] == 0) { Server.shopHandler.ShopItems[c.myShopId][i] = (itemID + 1); Server.shopHandler.ShopItemsN[c.myShopId][i] = amount; Server.shopHandler.ShopItemsDelay[c.myShopId][i] = 0; break; } } } return true; } public long buyDelay; public boolean buyItem(int itemID, int fromSlot, int amount) { if(System.currentTimeMillis() - buyDelay < 1) { return false; } if (c.myShopId == 14) { skillBuy(itemID); return false; } else if (c.myShopId == 15) { buyVoid(itemID); return false; } else if (c.myShopId == 1) { buyVoid(itemID); return false; } if(itemID != itemID) { c.sendMessage("Don't dupe or you will be IP Banned"); return false; } if(!shopSellsItem(itemID)) return false; if (amount > 0) { if (amount > Server.shopHandler.ShopItemsN[c.myShopId][fromSlot]) { amount = Server.shopHandler.ShopItemsN[c.myShopId][fromSlot]; } //double ShopValue; //double TotPrice; int TotPrice2 = 0; //int Overstock; int Slot = 0; int Slot1 = 0;//Reward Tokens int Slot2 = 0;//Pking Points int Slot3 = 0;//Donator Gold if (c.myShopId == 18) { handleOtherShop(itemID); return false; } if (c.myShopId == 73) { handleOtherShop(itemID); return false; } if (c.myShopId == 90) { handleOtherShop(itemID); return false; } if (c.myShopId == 74) { handleOtherShop(itemID); return false; } if (c.myShopId == 48) { handleOtherShop(itemID); return false; } for (int i = amount; i > 0; i--) { TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot)); Slot1 = c.getItems().getItemSlot(7774); if(Slot1 == -1 && c.myShopId == 79) { c.sendMessage("You don't have Reward Tokens."); break; } if(TotPrice2 <= 1) { TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot)); TotPrice2 *= 1.66; } if(c.myShopId == 29 || c.myShopId == 30 || c.myShopId == 31) { if (c.playerItemsN[Slot1] >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.getItems().deleteItem(7774, c.getItems().getItemSlot(7774), TotPrice2); c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough Reward Tokens."); break; } } else if(c.myShopId == 47) { if (c.pkPoints >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.pkPoints -= TotPrice2; c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough Pk Points."); break; } } else if(c.myShopId == 11) { if (c.playerItemsN[Slot3] >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.getItems().deleteItem(5555, c.getItems().getItemSlot(5555), TotPrice2); c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough donator gold."); break; } } else if(c.myShopId != 11 && c.myShopId != 29 || c.myShopId != 30 || c.myShopId != 31 || c.myShopId != 47) { if (c.playerItemsN[Slot] >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.getItems().deleteItem(995, c.getItems().getItemSlot(995), TotPrice2); c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough coins."); break; } } } c.getItems().resetItems(3823); resetShop(c.myShopId); updatePlayerShop(); return true; } return false; } public void handleOtherShop(int itemID) { if (c.myShopId == 18) { if (c.pkPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.pkPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough Pk points to buy this item."); } } if (c.myShopId == 90) { if (c.votePoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.votePoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough vote points to buy this item."); } } if (c.myShopId == 48) { if (c.slayerPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.slayerPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough slayer points to buy this item."); } } if (c.myShopId == 73) { if (c.pkPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.pkPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough Pk points to buy this item."); } } if (c.myShopId == 74) { if (c.pkPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.pkPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough Pk points to buy this item."); } } } public void openSkillCape() { int capes = get99Count(); if (capes > 1) capes = 1; else capes = 0; c.myShopId = 14; setupSkillCapes(capes, get99Count()); } /*public int[][] skillCapes = {{0,9747,4319,2679},{1,2683,4329,2685},{2,2680,4359,2682},{3,2701,4341,2703},{4,2686,4351,2688},{5,2689,4347,2691},{6,2692,4343,2691}, {7,2737,4325,2733},{8,2734,4353,2736},{9,2716,4337,2718},{10,2728,4335,2730},{11,2695,4321,2697},{12,2713,4327,2715},{13,2725,4357,2727}, {14,2722,4345,2724},{15,2707,4339,2709},{16,2704,4317,2706},{17,2710,4361,2712},{18,2719,4355,2721},****,2737,4331,2739},{20,2698,4333,2700}};*/ public int[] skillCapes = {9747,9753,9750,9768,9756,9759,9762,9801,9807,9783,9798,9804,9780,9795,9792,9774,9771,9777,9786,9810,9765,9948,12169,18508}; public int get99Count() { int count = 0; for (int j = 0; j < c.playerLevel.length; j++) { if (c.getLevelForXP(c.playerXP[j]) >= 99) { count++; } } return count; } public void setupSkillCapes(int capes, int capes2) { //synchronized(c) { c.getItems().resetItems(3823); c.isShopping = true; c.myShopId = 14; c.getPA().sendFrame248(3824, 3822); c.getPA().sendFrame126("Skillcape Shop", 3901); int TotalItems = 0; TotalItems = capes2; if (TotalItems > Server.shopHandler.MaxShopItems) { TotalItems = Server.shopHandler.MaxShopItems; } c.getOutStream().createFrameVarSizeWord(53); c.getOutStream().writeWord(3900); c.getOutStream().writeWord(TotalItems); int TotalCount = 0; for (int i = 0; i < 24; i++) { if (c.getLevelForXP(c.playerXP[i]) < 99) continue; c.getOutStream().writeByte(1); c.getOutStream().writeWordBigEndianA(skillCapes[i] + 2); TotalCount++; } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); // } } public void skillBuy(int item) { int nn = get99Count(); if (nn > 1) nn = 1; else nn = 0; for (int j = 0; j < skillCapes.length; j++) { if (skillCapes[j] == item || skillCapes[j]+1 == item) { if (c.getItems().freeSlots() > 1) { if (c.getItems().playerHasItem(995,99000)) { if (c.getLevelForXP(c.playerXP[j]) >= 99) { c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000); c.getItems().addItem(skillCapes[j] + nn,1); c.getItems().addItem(skillCapes[j] + 2,1); } else { c.sendMessage("You must have 99 in the skill of the cape you're trying to buy."); } } else { c.sendMessage("You need 99k to buy this item."); } } else { c.sendMessage("You must have at least 1 inventory spaces to buy this item."); } } /*if (skillCapes[j][1 + nn] == item) { if (c.getItems().freeSlots() >= 1) { if (c.getItems().playerHasItem(995,99000)) { if (c.getLevelForXP(c.playerXP[j]) >= 99) { c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000); c.getItems().addItem(skillCapes[j] + nn,1); c.getItems().addItem(skillCapes[j] + 2,1); } else { c.sendMessage("You must have 99 in the skill of the cape you're trying to buy."); } } else { c.sendMessage("You need 99k to buy this item."); } } else { c.sendMessage("You must have at least 1 inventory spaces to buy this item."); } break; }*/ } c.getItems().resetItems(3823); } public void openVoid() { /*synchronized(c) { c.getItems().resetItems(3823); c.isShopping = true; c.myShopId = 15; c.getPA().sendFrame248(3824, 3822); c.getPA().sendFrame126("Void Recovery", 3901); int TotalItems = 5; c.getOutStream().createFrameVarSizeWord(53); c.getOutStream().writeWord(3900); c.getOutStream().writeWord(TotalItems); for (int i = 0; i < c.voidStatus.length; i++) { c.getOutStream().writeByte(c.voidStatus[i]); c.getOutStream().writeWordBigEndianA(2519 + i * 2); } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); }*/ } public void buyVoid(int item) { /*if (item > 2527 || item < 2518) return; //c.sendMessage("" + item); if (c.voidStatus[(item-2518)/2] > 0) { if (c.getItems().freeSlots() >= 1) { if (c.getItems().playerHasItem(995,c.getItems().getUntradePrice(item))) { c.voidStatus[(item-2518)/2]--; c.getItems().deleteItem(995,c.getItems().getItemSlot(995), c.getItems().getUntradePrice(item)); c.getItems().addItem(item,1); openVoid(); } else { c.sendMessage("This item costs " + c.getItems().getUntradePrice(item) + " coins to rebuy."); } } else { c.sendMessage("I should have a free inventory space."); } } else { c.sendMessage("I don't need to recover this item from the void knights."); }*/ } }
Code:package server.world; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import server.Config; import server.Server; import server.util.Misc; /** * Shops **/ public class ShopHandler { public static int MaxShops = 101; public static int MaxShopItems = 101; public static int MaxInShopItems = 20; public static int MaxShowDelay = 10; public static int MaxSpecShowDelay = 60; public static int TotalShops = 0; public static int[][] ShopItems = new int[MaxShops][MaxShopItems]; public static int[][] ShopItemsN = new int[MaxShops][MaxShopItems]; public static int[][] ShopItemsDelay = new int[MaxShops][MaxShopItems]; public static int[][] ShopItemsSN = new int[MaxShops][MaxShopItems]; public static int[] ShopItemsStandard = new int[MaxShops]; public static String[] ShopName = new String[MaxShops]; public static int[] ShopSModifier = new int[MaxShops]; public static int[] ShopBModifier = new int[MaxShops]; public ShopHandler() { for(int i = 0; i < MaxShops; i++) { for(int j = 0; j < MaxShopItems; j++) { ResetItem(i, j); ShopItemsSN[i][j] = 0; } ShopItemsStandard[i] = 0; ShopSModifier[i] = 0; ShopBModifier[i] = 0; ShopName[i] = ""; } TotalShops = 0; loadShops("shops.cfg"); } public static void shophandler() { Misc.println("Shop Handler class successfully loaded"); } public void process() { boolean DidUpdate = false; for(int i = 1; i <= TotalShops; i++) { for(int j = 0; j < MaxShopItems; j++) { if (ShopItems[i][j] > 0) { if (ShopItemsDelay[i][j] >= MaxShowDelay) { if (j <= ShopItemsStandard[i] && ShopItemsN[i][j] <= ShopItemsSN[i][j]) { if (ShopItemsN[i][j] < ShopItemsSN[i][j]) { ShopItemsN[i][j] += 1; DidUpdate = true; ShopItemsDelay[i][j] = 1; ShopItemsDelay[i][j] = 0; DidUpdate = true; } } else if (ShopItemsDelay[i][j] >= MaxSpecShowDelay) { DiscountItem(i, j); ShopItemsDelay[i][j] = 0; DidUpdate = true; } } ShopItemsDelay[i][j]++; } } if (DidUpdate == true) { for (int k = 1; k < Config.MAX_PLAYERS; k++) { if (Server.playerHandler.players[k] != null) { if (Server.playerHandler.players[k].isShopping == true && Server.playerHandler.players[k].myShopId == i) { Server.playerHandler.players[k].updateShop = true; DidUpdate =false; Server.playerHandler.players[k].updateshop(i); } } } DidUpdate = false; } } } public void DiscountItem(int ShopID, int ArrayID) { ShopItemsN[ShopID][ArrayID] -= 1; if (ShopItemsN[ShopID][ArrayID] <= 0) { ShopItemsN[ShopID][ArrayID] = 0; ResetItem(ShopID, ArrayID); } } public void ResetItem(int ShopID, int ArrayID) { ShopItems[ShopID][ArrayID] = 0; ShopItemsN[ShopID][ArrayID] = 0; ShopItemsDelay[ShopID][ArrayID] = 0; } public boolean loadShops(String FileName) { String line = ""; String token = ""; String token2 = ""; String token2_2 = ""; String[] token3 = new String[(MaxShopItems * 2)]; boolean EndOfFile = false; int ReadMode = 0; BufferedReader characterfile = null; try { characterfile = new BufferedReader(new FileReader("./Data/CFG/"+FileName)); } catch(FileNotFoundException fileex) { Misc.println(FileName+": file not found."); return false; } try { line = characterfile.readLine(); } catch(IOException ioexception) { Misc.println(FileName+": error loading file."); return false; } while(EndOfFile == false && line != null) { line = line.trim(); int spot = line.indexOf("="); if (spot > -1) { token = line.substring(0, spot); token = token.trim(); token2 = line.substring(spot + 1); token2 = token2.trim(); token2_2 = token2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token2_2 = token2_2.replaceAll("\t\t", "\t"); token3 = token2_2.split("\t"); if (token.equals("shop")) { int ShopID = Integer.parseInt(token3[0]); ShopName[ShopID] = token3[1].replaceAll("_", " "); ShopSModifier[ShopID] = Integer.parseInt(token3[2]); ShopBModifier[ShopID] = Integer.parseInt(token3[3]); for (int i = 0; i < ((token3.length - 4) / 2); i++) { if (token3[(4 + (i * 2))] != null) { ShopItems[ShopID][i] = (Integer.parseInt(token3[(4 + (i * 2))]) + 1); ShopItemsN[ShopID][i] = Integer.parseInt(token3[(5 + (i * 2))]); ShopItemsSN[ShopID][i] = Integer.parseInt(token3[(5 + (i * 2))]); ShopItemsStandard[ShopID]++; } else { break; } } TotalShops++; } } else { if (line.equals("[ENDOFSHOPLIST]")) { try { characterfile.close(); } catch(IOException ioexception) { } return true; } } try { line = characterfile.readLine(); } catch(IOException ioexception1) { EndOfFile = true; } } try { characterfile.close(); } catch(IOException ioexception) { } return false; } }
Replace ShopAssistant:
Code:package server.model.shops; import server.Config; import server.Server; import server.model.items.Item; import server.model.players.Client; public class ShopAssistant { private Client c; public ShopAssistant(Client client) { this.c = client; } /** *Shops **/ public void openShop(int ShopID){ c.getItems().resetItems(3823); resetShop(ShopID); c.isShopping = true; c.myShopId = ShopID; c.getPA().sendFrame248(3824, 3822); c.getPA().sendFrame126(Server.shopHandler.ShopName[ShopID], 3901); } public boolean shopSellsItem(int itemID) { for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if(itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) { return true; } } return false; } public void updatePlayerShop() { for (int i = 1; i < Config.MAX_PLAYERS; i++) { if (Server.playerHandler.players[i] != null) { if (Server.playerHandler.players[i].isShopping == true && Server.playerHandler.players[i].myShopId == c.myShopId && i != c.playerId) { Server.playerHandler.players[i].updateShop = true; } } } } public void updateshop(int i){ resetShop(i); } public void resetShop(int ShopID) { //synchronized(c) { int TotalItems = 0; for (int i = 0; i < Server.shopHandler.MaxShopItems; i++) { if (Server.shopHandler.ShopItems[ShopID][i] > 0) { TotalItems++; } } if (TotalItems > Server.shopHandler.MaxShopItems) { TotalItems = Server.shopHandler.MaxShopItems; } c.getOutStream().createFrameVarSizeWord(53); c.getOutStream().writeWord(3900); c.getOutStream().writeWord(TotalItems); int TotalCount = 0; for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if (Server.shopHandler.ShopItems[ShopID][i] > 0 || i <= Server.shopHandler.ShopItemsStandard[ShopID]) { if (Server.shopHandler.ShopItemsN[ShopID][i] > 254) { c.getOutStream().writeByte(255); c.getOutStream().writeDWord_v2(Server.shopHandler.ShopItemsN[ShopID][i]); } else { c.getOutStream().writeByte(Server.shopHandler.ShopItemsN[ShopID][i]); } if (Server.shopHandler.ShopItems[ShopID][i] > Config.ITEM_LIMIT || Server.shopHandler.ShopItems[ShopID][i] < 0) { Server.shopHandler.ShopItems[ShopID][i] = Config.ITEM_LIMIT; } c.getOutStream().writeWordBigEndianA(Server.shopHandler.ShopItems[ShopID][i]); TotalCount++; } if (TotalCount > TotalItems) { break; } } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); // } } public double getItemShopValue(int ItemID, int Type, int fromSlot) { double ShopValue = 1; double Overstock = 0; double TotPrice = 0; for (int i = 0; i < Config.ITEM_LIMIT; i++) { if (Server.itemHandler.ItemList[i] != null) { if (Server.itemHandler.ItemList[i].itemId == ItemID) { ShopValue = Server.itemHandler.ItemList[i].ShopValue; } } } TotPrice = ShopValue; if (Server.shopHandler.ShopBModifier[c.myShopId] == 1) { TotPrice *= 1; TotPrice *= 1; if (Type == 1) { TotPrice *= 1; } } else if (Type == 1) { TotPrice *= 1; } return TotPrice; } public int getItemShopValue(int itemId) { for (int i = 0; i < Config.ITEM_LIMIT; i++) { if (Server.itemHandler.ItemList[i] != null) { if (Server.itemHandler.ItemList[i].itemId == itemId) { return (int)Server.itemHandler.ItemList[i].ShopValue; } } } return 0; } /** *buy item from shop (Shop Price) **/ public void buyFromShopPrice(int removeId, int removeSlot){ int ShopValue = (int)Math.floor(getItemShopValue(removeId, 0, removeSlot)); ShopValue *= 1; String ShopAdd = ""; if (c.myShopId == 18) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Pk Points."); return; } if (c.myShopId == 73) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Pk Points."); return; } if (c.myShopId == 90) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Vote Points."); return; } if (c.myShopId == 74) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Pk Points."); return; } if (c.myShopId == 15) { c.sendMessage("This item current costs " + c.getItems().getUntradePrice(removeId) + " coins."); return; } if (c.myShopId == 48) { c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " slayer points."); return; } if (ShopValue >= 1000 && ShopValue < 1000000) { ShopAdd = " (" + (ShopValue / 1000) + "K)"; } else if (ShopValue >= 1000000) { ShopAdd = " (" + (ShopValue / 1000000) + " million)"; } c.sendMessage(c.getItems().getItemName(removeId)+": currently costs "+ShopValue+" coins"+ShopAdd); } public int getSpecialItemValue(int id) { switch (id) { case 15220: case 15018: case 15019: case 15020: return 225; case 13263: return 175; case 15492: return 215; case 15403: return 350; case 15126: return 150; case 11283: return 300; case 11665: case 11664: case 11663: return 7; case 8839: case 8840: return 20; case 8842: return 5; case 19785: case 19786: return 25; case 6542: return 4; case 18349: case 18353: case 18355: return 175; case 18361: return 400; case 18351: return 1000; case 18357: return 750; case 18359: return 850; case 18363: return 65; case 18335: return 25; case 19669: return 35; case 10551: return 20; case 10548: return 15; case 20072: return 15; case 19780: return 225; case 15486: return 30; case 13887: case 13893: return 135; case 13899: return 150; case 13905: return 85; case 13884: case 13890: return 120; case 13896: return 150; case 13902: return 100; case 13858: case 13861: return 75; case 13864: case 13867: case 13876: return 25; case 13870: case 13873: return 75; case 13879: case 13883: return 2; case 18705: case 18708: case 18709: return 15; case 18706: case 18707: return 35; case 13101: return 20; case 19335: return 30; case 14632: return 10; case 14490: case 14492: return 10; case 14494: return 5; case 13099: return 5; case 15069: case 15071: return 3; case 15013: return 15; case 15017: return 30; case 989: return 3; case 13661: return 25; case 6739: return 12; case 15259: return 12; case 15441: case 15442: case 15443: case 15444: return 5; case 2581: case 2577: return 275; case 1040: return 20; } return 0; } /** *Sell item to shop (Shop Price) **/ public void sellToShopPrice(int removeId, int removeSlot) { for (int i : Config.ITEM_SELLABLE) { if (i == removeId) { c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+"."); return; } } boolean IsIn = false; if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) { for (int j = 0; j <= Server.shopHandler.ShopItemsStandard[c.myShopId]; j++) { if (removeId == (Server.shopHandler.ShopItems[c.myShopId][j] - 1)) { IsIn = true; break; } } } else { IsIn = true; } if (IsIn == false) { c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+" to this store."); } else { int ShopValue = (int)Math.floor(getItemShopValue(removeId, 1, removeSlot)); String ShopAdd = ""; if (ShopValue >= 1000 && ShopValue < 1000000) { ShopAdd = " (" + (ShopValue / 1000) + "K)"; } else if (ShopValue >= 1000000) { ShopAdd = " (" + (ShopValue / 1000000) + " million)"; } c.sendMessage(c.getItems().getItemName(removeId)+": shop will buy for "+ShopValue+" coins"+ShopAdd); } } public boolean sellItem(int itemID, int fromSlot, int amount) { if(c.inTrade) { c.sendMessage("You cant sell items to the shop while your in trade!"); return false; } if (c.myShopId == 14) return false; for (int i : Config.ITEM_SELLABLE) { if (i == itemID) { c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+"."); return false; } } if (amount > 0 && itemID == (c.playerItems[fromSlot] - 1)) { if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) { boolean IsIn = false; for (int i = 0; i <= Server.shopHandler.ShopItemsStandard[c.myShopId]; i++) { if (itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) { IsIn = true; break; } } if (IsIn == false) { c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+" to this store."); return false; } } if (amount > c.playerItemsN[fromSlot] && (Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == true || Item.itemStackable[(c.playerItems[fromSlot] - 1)] == true)) { amount = c.playerItemsN[fromSlot]; } else if (amount > c.getItems().getItemAmount(itemID) && Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == false && Item.itemStackable[(c.playerItems[fromSlot] - 1)] == false) { amount = c.getItems().getItemAmount(itemID); } //double ShopValue; //double TotPrice; int TotPrice2 = 0; //int Overstock; for (int i = amount; i > 0; i--) { TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 1, fromSlot)); if (c.getItems().freeSlots() > 0 || c.getItems().playerHasItem(995)) { if (Item.itemIsNote[itemID] == false) { c.getItems().deleteItem(itemID, c.getItems().getItemSlot(itemID), 1); } else { c.getItems().deleteItem(itemID, fromSlot, 1); } c.getItems().addItem(995, TotPrice2); addShopItem(itemID, 1); } else { c.sendMessage("You don't have enough space in your inventory."); break; } } c.getItems().resetItems(3823); resetShop(c.myShopId); updatePlayerShop(); return true; } return true; } public boolean addShopItem(int itemID, int amount) { boolean Added = false; if (amount <= 0) { return false; } if (Item.itemIsNote[itemID] == true) { itemID = c.getItems().getUnnotedItem(itemID); } for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if ((Server.shopHandler.ShopItems[c.myShopId][i] - 1) == itemID) { Server.shopHandler.ShopItemsN[c.myShopId][i] += amount; Added = true; } } if (Added == false) { for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) { if (Server.shopHandler.ShopItems[c.myShopId][i] == 0) { Server.shopHandler.ShopItems[c.myShopId][i] = (itemID + 1); Server.shopHandler.ShopItemsN[c.myShopId][i] = amount; Server.shopHandler.ShopItemsDelay[c.myShopId][i] = 0; break; } } } return true; } public long buyDelay; public boolean buyItem(int itemID, int fromSlot, int amount) { if(System.currentTimeMillis() - buyDelay < 1) { return false; } if (c.myShopId == 14) { skillBuy(itemID); return false; } else if (c.myShopId == 15) { buyVoid(itemID); return false; } else if (c.myShopId == 1) { buyVoid(itemID); return false; } if(itemID != itemID) { c.sendMessage("Don't dupe or you will be IP Banned"); return false; } if(!shopSellsItem(itemID)) return false; if (amount > 0) { if (amount > Server.shopHandler.ShopItemsN[c.myShopId][fromSlot]) { amount = Server.shopHandler.ShopItemsN[c.myShopId][fromSlot]; } //double ShopValue; //double TotPrice; int TotPrice2 = 0; //int Overstock; int Slot = c.getItems().getItemSlot(995); int Slot1 = 0;//Reward Tokens int Slot2 = 0;//Pking Points int Slot3 = 0;//Donator Gold if (c.myShopId == 18) { handleOtherShop(itemID); return false; } if (c.myShopId == 73) { handleOtherShop(itemID); return false; } if (c.myShopId == 90) { handleOtherShop(itemID); return false; } if (c.myShopId == 74) { handleOtherShop(itemID); return false; } if (c.myShopId == 48) { handleOtherShop(itemID); return false; } for (int i = amount; i > 0; i--) { TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot)); Slot1 = c.getItems().getItemSlot(7774); if(Slot1 == -1 && c.myShopId == 79) { c.sendMessage("You don't have Reward Tokens."); break; } if(TotPrice2 <= 1) { TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot)); TotPrice2 *= 1.66; } if(c.myShopId == 29 || c.myShopId == 30 || c.myShopId == 31) { if (c.playerItemsN[Slot1] >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.getItems().deleteItem(7774, c.getItems().getItemSlot(7774), TotPrice2); c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough Reward Tokens."); break; } } else if(c.myShopId == 47) { if (c.pkPoints >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.pkPoints -= TotPrice2; c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough Pk Points."); break; } } else if(c.myShopId == 11) { if (c.playerItemsN[Slot3] >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.getItems().deleteItem(5555, c.getItems().getItemSlot(5555), TotPrice2); c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough donator gold."); break; } } else if(c.myShopId != 11 && c.myShopId != 29 || c.myShopId != 30 || c.myShopId != 31 || c.myShopId != 47) { if (c.playerItemsN[Slot] >= TotPrice2) { if (c.getItems().freeSlots() > 0) { buyDelay = System.currentTimeMillis(); c.getItems().deleteItem(995, c.getItems().getItemSlot(995), TotPrice2); c.getItems().addItem(itemID, 1); Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1; Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0; if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) { Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0; } } else { c.sendMessage("You don't have enough space in your inventory."); break; } } else { c.sendMessage("You don't have enough coins."); break; } } } c.getItems().resetItems(3823); resetShop(c.myShopId); updatePlayerShop(); return true; } return false; } public void handleOtherShop(int itemID) { if (c.myShopId == 18) { if (c.pkPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.pkPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough Pk points to buy this item."); } } if (c.myShopId == 90) { if (c.votePoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.votePoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough vote points to buy this item."); } } if (c.myShopId == 48) { if (c.slayerPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.slayerPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough slayer points to buy this item."); } } if (c.myShopId == 73) { if (c.pkPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.pkPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough Pk points to buy this item."); } } if (c.myShopId == 74) { if (c.pkPoints >= getSpecialItemValue(itemID)) { if (c.getItems().freeSlots() > 0){ c.pkPoints -= getSpecialItemValue(itemID); c.getItems().addItem(itemID,1); c.getItems().resetItems(3823); } } else { c.sendMessage("You do not have enough Pk points to buy this item."); } } } public void openSkillCape() { int capes = get99Count(); if (capes > 1) capes = 1; else capes = 0; c.myShopId = 14; setupSkillCapes(capes, get99Count()); } /*public int[][] skillCapes = {{0,9747,4319,2679},{1,2683,4329,2685},{2,2680,4359,2682},{3,2701,4341,2703},{4,2686,4351,2688},{5,2689,4347,2691},{6,2692,4343,2691}, {7,2737,4325,2733},{8,2734,4353,2736},{9,2716,4337,2718},{10,2728,4335,2730},{11,2695,4321,2697},{12,2713,4327,2715},{13,2725,4357,2727}, {14,2722,4345,2724},{15,2707,4339,2709},{16,2704,4317,2706},{17,2710,4361,2712},{18,2719,4355,2721},****,2737,4331,2739},{20,2698,4333,2700}};*/ public int[] skillCapes = {9747,9753,9750,9768,9756,9759,9762,9801,9807,9783,9798,9804,9780,9795,9792,9774,9771,9777,9786,9810,9765,9948,12169,18508}; public int get99Count() { int count = 0; for (int j = 0; j < c.playerLevel.length; j++) { if (c.getLevelForXP(c.playerXP[j]) >= 99) { count++; } } return count; } public void setupSkillCapes(int capes, int capes2) { //synchronized(c) { c.getItems().resetItems(3823); c.isShopping = true; c.myShopId = 14; c.getPA().sendFrame248(3824, 3822); c.getPA().sendFrame126("Skillcape Shop", 3901); int TotalItems = 0; TotalItems = capes2; if (TotalItems > Server.shopHandler.MaxShopItems) { TotalItems = Server.shopHandler.MaxShopItems; } c.getOutStream().createFrameVarSizeWord(53); c.getOutStream().writeWord(3900); c.getOutStream().writeWord(TotalItems); int TotalCount = 0; for (int i = 0; i < 24; i++) { if (c.getLevelForXP(c.playerXP[i]) < 99) continue; c.getOutStream().writeByte(1); c.getOutStream().writeWordBigEndianA(skillCapes[i] + 2); TotalCount++; } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); // } } public void skillBuy(int item) { int nn = get99Count(); if (nn > 1) nn = 1; else nn = 0; for (int j = 0; j < skillCapes.length; j++) { if (skillCapes[j] == item || skillCapes[j]+1 == item) { if (c.getItems().freeSlots() > 1) { if (c.getItems().playerHasItem(995,99000)) { if (c.getLevelForXP(c.playerXP[j]) >= 99) { c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000); c.getItems().addItem(skillCapes[j] + nn,1); c.getItems().addItem(skillCapes[j] + 2,1); } else { c.sendMessage("You must have 99 in the skill of the cape you're trying to buy."); } } else { c.sendMessage("You need 99k to buy this item."); } } else { c.sendMessage("You must have at least 1 inventory spaces to buy this item."); } } /*if (skillCapes[j][1 + nn] == item) { if (c.getItems().freeSlots() >= 1) { if (c.getItems().playerHasItem(995,99000)) { if (c.getLevelForXP(c.playerXP[j]) >= 99) { c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000); c.getItems().addItem(skillCapes[j] + nn,1); c.getItems().addItem(skillCapes[j] + 2,1); } else { c.sendMessage("You must have 99 in the skill of the cape you're trying to buy."); } } else { c.sendMessage("You need 99k to buy this item."); } } else { c.sendMessage("You must have at least 1 inventory spaces to buy this item."); } break; }*/ } c.getItems().resetItems(3823); } public void openVoid() { /*synchronized(c) { c.getItems().resetItems(3823); c.isShopping = true; c.myShopId = 15; c.getPA().sendFrame248(3824, 3822); c.getPA().sendFrame126("Void Recovery", 3901); int TotalItems = 5; c.getOutStream().createFrameVarSizeWord(53); c.getOutStream().writeWord(3900); c.getOutStream().writeWord(TotalItems); for (int i = 0; i < c.voidStatus.length; i++) { c.getOutStream().writeByte(c.voidStatus[i]); c.getOutStream().writeWordBigEndianA(2519 + i * 2); } c.getOutStream().endFrameVarSizeWord(); c.flushOutStream(); }*/ } public void buyVoid(int item) { /*if (item > 2527 || item < 2518) return; //c.sendMessage("" + item); if (c.voidStatus[(item-2518)/2] > 0) { if (c.getItems().freeSlots() >= 1) { if (c.getItems().playerHasItem(995,c.getItems().getUntradePrice(item))) { c.voidStatus[(item-2518)/2]--; c.getItems().deleteItem(995,c.getItems().getItemSlot(995), c.getItems().getUntradePrice(item)); c.getItems().addItem(item,1); openVoid(); } else { c.sendMessage("This item costs " + c.getItems().getUntradePrice(item) + " coins to rebuy."); } } else { c.sendMessage("I should have a free inventory space."); } } else { c.sendMessage("I don't need to recover this item from the void knights."); }*/ } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |