This commit is contained in:
harmonic 2020-06-04 16:44:19 +01:00
parent 7ac72b2935
commit 43a1ca2a30
4 changed files with 15 additions and 7 deletions

View File

@ -22,6 +22,8 @@ import java.lang.reflect.Method;
import java.sql.*;
import java.util.Map;
public class BotManager {
private static final Logger LOGGER = LoggerFactory.getLogger(BotManager.class);
@ -30,7 +32,7 @@ public class BotManager {
public static int MAXIMUM_CHAT_SPEED = 604800;
public static int MAXIMUM_CHAT_LENGTH = 120;
public static int MAXIMUM_NAME_LENGTH = 15;
public static int MAXIMUM_BOT_INVENTORY_SIZE = 25;
public BotManager() throws Exception {
long millis = System.currentTimeMillis();
@ -163,7 +165,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);
@ -172,8 +174,8 @@ public class BotManager {
return;
if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER)) {
if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= botConfigSize) {
habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", botConfigSize + ""));
if (!habbo.hasPermission(Permission.ACC_UNLIMITED_BOTS) && habbo.getInventory().getBotsComponent().getBots().size() >= MAXIMUM_BOT_INVENTORY_SIZE) {
habbo.alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", MAXIMUM_BOT_INVENTORY_SIZE + ""));
}
bot.onPickUp(habbo, habbo.getHabboInfo().getCurrentRoom());

View File

@ -1,6 +1,7 @@
package com.eu.habbo.messages.incoming.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.BotManager;
import com.eu.habbo.habbohotel.catalog.CatalogItem;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.catalog.CatalogPage;
@ -28,6 +29,8 @@ import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_
import static com.eu.habbo.messages.incoming.catalog.CheckPetNameEvent.PET_NAME_LENGTH_MINIMUM;
public class CatalogBuyItemEvent extends MessageHandler {
@Override
public void handle() throws Exception {
if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp >= CatalogManager.PURCHASE_COOLDOWN) {
@ -194,9 +197,8 @@ public class CatalogBuyItemEvent extends MessageHandler {
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(Permission.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 + ""));
if (!this.client.getHabbo().hasPermission(Permission.ACC_UNLIMITED_BOTS) && this.client.getHabbo().getInventory().getBotsComponent().getBots().size() >= BotManager.MAXIMUM_BOT_INVENTORY_SIZE) {
this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.bot.max.amount.message").replace("%amount%", BotManager.MAXIMUM_BOT_INVENTORY_SIZE + ""));
return;
}
}

View File

@ -5,6 +5,8 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.messages.incoming.MessageHandler;
public class BotPickupEvent extends MessageHandler {
@Override
public void handle() throws Exception {
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();

View File

@ -150,6 +150,8 @@ public class PluginManager {
CameraPurchaseEvent.CAMERA_PURCHASE_POINTS_TYPE = Emulator.getConfig().getInt("camera.price.points.type", 0);
BuyRoomPromotionEvent.ROOM_PROMOTION_BADGE = Emulator.getConfig().getValue("room.promotion.badge", "RADZZ");
BotManager.MAXIMUM_BOT_INVENTORY_SIZE = Emulator.getConfig().getInt("hotel.bots.max.inventory");
NewNavigatorEventCategoriesComposer.CATEGORIES.clear();
for (String category : Emulator.getConfig().getValue("navigator.eventcategories", "").split(";")) {