diff --git a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql index 2f406602..c775ff01 100644 --- a/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql +++ b/sqlupdates/2_4_0-RC-1 to 2_4_0-RC-2.sql @@ -12,4 +12,7 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_softki -- Rank ignoring INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.error.ignore_higher_rank', 'You can\'t ignore this user.'); -INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staffs', '1'); \ No newline at end of file +INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staffs', '1'); + +-- Bot Inventory Limiting +INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('hotel.bot.max.amount.message', 'You can\'t buy or pickup anymore bots until you place some, the maximum amount of bots you are allowed is %amount%.'); diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index d948c332..f6449e4f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -163,6 +163,7 @@ public class BotManager { } public void pickUpBot(Bot bot, Habbo habbo) { + int botConfigSize = Emulator.getConfig().getInt("hotel.bots.max.inventory"); if (bot != null && habbo != null) { BotPickUpEvent pickedUpEvent = new BotPickUpEvent(bot, habbo); Emulator.getPluginManager().fireEvent(pickedUpEvent); @@ -171,8 +172,9 @@ public class BotManager { return; if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) { - if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= 15) - return; + if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= botConfigSize) { + habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); + } bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom()); habbo.getHabboInfo().getCurrentRoom().removeBot(bot); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java index a20ea1b8..b154b49e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java @@ -192,6 +192,13 @@ public class CatalogBuyItemEvent extends MessageHandler { else item = page.getCatalogItem(itemId); // temp patch, can a dev with better knowledge than me look into this asap pls. + if (page instanceof BotsLayout) { + int botConfigSize = Emulator.getConfig().getInt("hotel.bots.max.inventory"); + if (!this.client.getHabbo().hasPermission("acc_unlimited_bots") && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= botConfigSize) { + this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + "")); + return; + } + } if (page instanceof PetsLayout) { // checks it's the petlayout String[] check = extraData.split("\n"); // splits the extradata if ((check.length != 3) || (check[0].length() < PET_NAME_LENGTH_MINIMUM) || (check[0].length() > PET_NAME_LENGTH_MAXIMUM) || (!StringUtils.isAlphanumeric(check[0])))// checks if there's 3 parts (always is with pets, if not it fucks them off)