Code:
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 < ShopHandler.ShopItems.length; i++) {
if ((ShopHandler.ShopItems[c.myShopId][i] - 1) == itemID) {
ShopHandler.ShopItemsN[c.myShopId][i] += amount;
Added = true;
}
}
if (Added == false) {
for (int i = 0; i < ShopHandler.ShopItems.length; i++) {
if (ShopHandler.ShopItems[c.myShopId][i] == 0) {
ShopHandler.ShopItems[c.myShopId][i] = (itemID + 1);
ShopHandler.ShopItemsN[c.myShopId][i] = amount;
ShopHandler.ShopItemsDelay[c.myShopId][i] = 0;
break;
}
}
}
return true;
}
Code:
public boolean sellItem(int itemID, int fromSlot, int amount) {
for (int i : Config.ITEM_SELLABLE) {
if (i == itemID) {
c.sendMessage("You can't sell "
+ c.getItems().getItemName(itemID).toLowerCase() + ".");
return false;
}
}
if (c.playerRights == 2 && !Config.ADMIN_CAN_SELL_ITEMS) {
c.sendMessage("Selling items as an admin has been disabled.");
return false;
}
if (amount > 0 && itemID == (c.playerItems[fromSlot] - 1)) {
if (ShopHandler.ShopSModifier[c.myShopId] > 1) {
boolean IsIn = false;
for (int i = 0; i <= ShopHandler.ShopItemsStandard[c.myShopId]; i++) {
if (itemID == (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) * 0.90);
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;
}
I don't see how this has to do with high alching tbh. (Green = The line number that gives me the error)