Remove items from players store/bank

This commit is contained in:
RedSparr0w
2019-11-23 02:20:06 +13:00
parent ca12809861
commit e0925538c7
8 changed files with 55 additions and 16 deletions
@@ -66,8 +66,8 @@ public class Bot {
}
int item_id = Misc.randomArrayListItem(items);
String item_name = ItemAssistant.getItemName(item_id);
int value = botClient.getShopAssistant().getItemShopValue(item_id);
botClient.forcedChat("Selling " + item_name + " " + GameLogger.formatCurrency(value) + "ea");
int value = Math.max(1, botClient.getShopAssistant().getItemShopValue(item_id, 0, false));
botClient.forcedChat("Selling " + item_name + " " + formatSellPrice(value) + " ea");
/*
Real chat - Disabled for now, can't get it to function correctly
@@ -80,4 +80,16 @@ public class Bot {
botClient.setChatTextUpdateRequired(true);
*/
}
private String formatSellPrice(int price) {
if (price > 1e9) {
return (Math.floor(price / 1e8) / 10) + "B";
} else if (price > 1e6) {
return (Math.floor(price / 1e8) / 10) + "M";
} else if (price > 1e3) {
return (Math.floor(price / 100) / 10) + "K";
} else {
return "" + price;
}
}
}
@@ -66,12 +66,24 @@ public class BotHandler
return null;
}
public static void addTobank(int shop, int item, int itemN){
public static void addTobank(int shop_id, int item_id, int amount){
for(Bot bot : botList) {
if(bot != null && bot.getBotClient() != null) {
Client botClient = bot.getBotClient();
if(botClient.myShopId == shop) {
botClient.getItemAssistant().addItemToBank(item, itemN);
if(botClient.myShopId == shop_id) {
botClient.getItemAssistant().addItemToBank(item_id, amount);
return;
}
}
}
}
public static void removeFrombank(int shop_id, int item_id, int amount){
for(Bot bot : botList) {
if(bot != null && bot.getBotClient() != null) {
Client botClient = bot.getBotClient();
if(botClient.myShopId == shop_id) {
botClient.getItemAssistant().removeitemFromBank(item_id, amount);
return;
}
}