diff --git a/2006Redone Server/src/com/rebotted/game/shops/ShopAssistant.java b/2006Redone Server/src/com/rebotted/game/shops/ShopAssistant.java index 64049f83..a0fa218e 100644 --- a/2006Redone Server/src/com/rebotted/game/shops/ShopAssistant.java +++ b/2006Redone Server/src/com/rebotted/game/shops/ShopAssistant.java @@ -276,32 +276,32 @@ public class ShopAssistant { String itemName = ItemAssistant.getItemName(unNotedItemID); for (int i : GameConstants.ITEM_SELLABLE) { if (unNotedItemID == i) { - player.getPacketSender().sendMessage("You can't sell " + ItemAssistant.getItemName(removeId).toLowerCase() + "."); + player.getPacketSender().sendMessage("You can't sell " + itemName + "."); return; } } - boolean IsIn = false; + boolean canSellItem = false; switch (ShopHandler.shopSModifier[player.shopId]) { // Only buys what is in stock case 2: for (int j = 0; j <= ShopHandler.shopItemsStandard[player.shopId]; j++) { if (unNotedItemID == (ShopHandler.shopItems[player.shopId][j] - 1)) { - IsIn = true; + canSellItem = true; break; } } break; // General store case 1: - IsIn = true; + canSellItem = true; break; // Player owns this store case 0: - IsIn = ShopHandler.playerOwnsStore(player.shopId, player); + canSellItem = ShopHandler.playerOwnsStore(player.shopId, player); break; } - if (IsIn == false) { + if (canSellItem == false) { player.getPacketSender().sendMessage("You can't sell " + ItemAssistant.getItemName(removeId).toLowerCase() + " to this store."); } else { int ShopValue = (int) Math.floor(getItemShopValue(unNotedItemID, 1, true)); @@ -468,7 +468,7 @@ public class ShopAssistant { private static int getUnNoted(int itemID){ String itemName = ItemAssistant.getItemName(itemID).toLowerCase(); String ItemNameUnNotedItem = ItemAssistant.getItemName(itemID - 1).toLowerCase(); - if (itemName.contains(ItemNameUnNotedItem)) { + if (itemName.equalsIgnoreCase(ItemNameUnNotedItem)) { itemID--; //Replace the noted item by it's un-noted version. } return itemID; @@ -477,7 +477,7 @@ public class ShopAssistant { private static int getNoted(int itemID){ String itemName = ItemAssistant.getItemName(itemID).toLowerCase(); String ItemNameUnNotedItem = ItemAssistant.getItemName(itemID + 1).toLowerCase(); - if (itemName.contains(ItemNameUnNotedItem)) { + if (itemName.equalsIgnoreCase(ItemNameUnNotedItem)) { itemID++; //Replace the item by it's noted version. } return itemID; diff --git a/2006Redone Server/src/com/rebotted/game/shops/ShopHandler.java b/2006Redone Server/src/com/rebotted/game/shops/ShopHandler.java index a985a49c..27eb5524 100644 --- a/2006Redone Server/src/com/rebotted/game/shops/ShopHandler.java +++ b/2006Redone Server/src/com/rebotted/game/shops/ShopHandler.java @@ -16,9 +16,9 @@ public class ShopHandler { public static int MAX_SHOP_ITEMS = 40; - public static int SHOW_DELAY = 2; + public static int SHOW_DELAY = 1; // Restock 1 item every tick - public static int SPECIAL_DELAY = 60; + public static int SPECIAL_DELAY = 60; // Remove overstocked items after 60 ticks public static int totalshops = 0; @@ -106,11 +106,13 @@ public class ShopHandler { shopItemsN[shopID][ArrayID] -= 1; if (shopItemsN[shopID][ArrayID] <= 0) { shopItemsN[shopID][ArrayID] = 0; - ResetItem(shopID, ArrayID); + if (shopItemsStandard[shopID] <= ArrayID) + ResetItem(shopID, ArrayID); } } private static void ResetItem(int shopID, int ArrayID) { + if (shopItemsStandard[shopID] > ArrayID) return; shopItems[shopID][ArrayID] = 0; shopItemsN[shopID][ArrayID] = 0; shopItemsDelay[shopID][ArrayID] = 0; @@ -143,19 +145,19 @@ public class ShopHandler { token = line.substring(0, spot); token = token.trim(); token2 = line.substring(spot + 1); - token2 = token2.trim(); - token2_2 = token2.replaceAll("\t+", "\t"); - token3 = token2_2.split("\t"); + token3 = token2.trim().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))]); + int itemID = Integer.parseInt(token3[(4 + (i * 2))]); + int itemAmount = Integer.parseInt(token3[(5 + (i * 2))]); + if (itemID > 0) { + shopItems[shopID][i] = itemID + 1; + shopItemsN[shopID][i] = itemAmount; + shopItemsSN[shopID][i] = itemAmount; shopItemsStandard[shopID]++; } else { break; @@ -164,7 +166,7 @@ public class ShopHandler { totalshops++; } } else { - if (line.equals("[ENDOFshopLIST]")) { + if (line.equalsIgnoreCase("[ENDOFSHOPLIST]")) { try { characterfile.close(); } catch (IOException ioexception) { diff --git a/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopAssistant.class b/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopAssistant.class index 58be24cd..d923d3ce 100644 Binary files a/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopAssistant.class and b/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopAssistant.class differ diff --git a/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopHandler.class b/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopHandler.class index cdcddfbe..ac245dda 100644 Binary files a/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopHandler.class and b/CompiledServer/production/2006rebotted/com/rebotted/game/shops/ShopHandler.class differ