on sellitem method like
Code:if(itemId = Blue charm id){ c.getItems.additem(totprice2/2,995); }
|
I want it where you say buy a blue charm for 5m and sell for 50% of it, but i dont wamnna go through and do tht to everything in the shops. Is there a way i can make where verything that you can sell back is 50% less?
anyone add in there so everything is 50% of buy price? It help a lotCode: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; }
here u go
Code: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/2); 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; }
Didnt work, it still is same as the buy price
Code:for (int i = amount; i > 0; i--) { TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 1, fromSlot))/2; 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; } }
ipk thats not how mine is my prices go off of prices.txt, in item.cfg there isnt any, and thock i get errors
many people have told me to change it in item.cfg, so i decided to delete the price for whip from prices.txt and add it to item.cfg
this is the code
I made them all diff to see what the prices would be, unfortunately they only go off the second one as the buy and sell is the same.Code:item = 4151 Abyssal_whip A_weapon_from_the_Abyss. 15000000 1000000 5000 10000 82 0 0 0 0 0
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |