diff --git a/featurelist.md b/featurelist.md index 7f494997..3a63b5ab 100644 --- a/featurelist.md +++ b/featurelist.md @@ -132,7 +132,7 @@ If you wish to contribute to this list, features are laid out in the following f > [`Habbo.getHabboStats()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L94) > [`Habbo.getRoomUnit()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L102) > [`HabboManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java) -> [`HabboManager.getOfflineHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L47) +> [`Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L47) > [`HabboManager.getCloneAccounts()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L203) > [`HabboManager.setRank()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L243) > [`HabboInfo`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java index cff434d7..1bdaf554 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java @@ -17,7 +17,6 @@ import com.eu.habbo.plugin.events.bots.BotChatEvent; import com.eu.habbo.plugin.events.bots.BotShoutEvent; import com.eu.habbo.plugin.events.bots.BotTalkEvent; import com.eu.habbo.plugin.events.bots.BotWhisperEvent; -import com.eu.habbo.threading.runnables.BotFollowHabbo; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; @@ -64,13 +63,16 @@ public class Bot extends Unit implements Runnable { @Getter @Setter private short lastChatIndex; - private final int bubble; + @Getter + private final int bubbleId; @Getter private final String type; @Getter private int effect; private transient boolean canWalk = true; private boolean needsUpdate; + @Getter + @Setter private transient int followingHabboId; @Getter @Setter @@ -95,7 +97,7 @@ public class Bot extends Unit implements Runnable { this.chatLines = new ArrayList<>(); this.type = "generic_bot"; this.room = null; - this.bubble = RoomChatMessageBubbles.BOT_RENTABLE.getType(); + this.bubbleId = RoomChatMessageBubbles.BOT_RENTABLE.getType(); } public Bot(ResultSet set) throws SQLException { @@ -116,7 +118,7 @@ public class Bot extends Unit implements Runnable { this.room = null; this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay; this.needsUpdate = false; - this.bubble = set.getInt("bubble_id"); + this.bubbleId = set.getInt("bubble_id"); this.roomUnit = new RoomBot(); } @@ -135,7 +137,7 @@ public class Bot extends Unit implements Runnable { this.chatLines = new ArrayList<>(List.of("Default Message :D")); this.type = bot.getType(); this.effect = bot.getEffect(); - this.bubble = bot.getBubbleId(); + this.bubbleId = bot.getBubbleId(); this.needsUpdate = false; } @@ -177,7 +179,7 @@ public class Bot extends Unit implements Runnable { statement.setString(12, this.chatRandom ? "1" : "0"); statement.setInt(13, this.chatDelay); statement.setInt(14, this.effect); - statement.setInt(15, this.bubble); + statement.setInt(15, this.bubbleId); statement.setInt(16, this.id); statement.execute(); this.needsUpdate = false; @@ -287,12 +289,10 @@ public class Bot extends Unit implements Runnable { } - public void onUserSay(final RoomChatMessage message) { - - } + public void onUserSay(final RoomChatMessage message) {} public int getBubbleId() { - return bubble; + return bubbleId; } public void setName(String name) { @@ -396,20 +396,6 @@ public class Bot extends Unit implements Runnable { } } - public int getFollowingHabboId() { - return this.followingHabboId; - } - - public void startFollowingHabbo(Habbo habbo) { - this.followingHabboId = habbo.getHabboInfo().getId(); - - Emulator.getThreading().run(new BotFollowHabbo(this, habbo, habbo.getRoomUnit().getRoom())); - } - - public void stopFollowingHabbo() { - this.followingHabboId = 0; - } - public boolean canWalk() { return this.canWalk; } @@ -441,7 +427,7 @@ public class Bot extends Unit implements Runnable { statement.setString(15, this.chatRandom ? "1" : "0"); statement.setInt(16, this.chatDelay); statement.setInt(17, this.effect); - statement.setInt(18, this.bubble); + statement.setInt(18, this.bubbleId); statement.setInt(19, this.id); statement.execute(); } catch (SQLException e) { 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 4fed28b7..a8f6931c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -190,7 +190,7 @@ public class BotManager { bot.onPickUp(habbo, room); room.getRoomUnitManager().removeBot(bot); - bot.stopFollowingHabbo(); + bot.setFollowingHabboId(0); bot.setOwnerId(botOwnerInfo.getId()); bot.setOwnerName(botOwnerInfo.getUsername()); bot.needsUpdate(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 2434c6c6..386753b4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -1005,7 +1005,7 @@ public class CatalogManager { if (guild != null && Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo) != null) { InteractionGuildFurni habboItem = (InteractionGuildFurni) Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata); - habboItem.setExtradata(""); + habboItem.setExtraData(""); habboItem.needsUpdate(true); Emulator.getThreading().run(habboItem); diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java index b852fd30..ce152637 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/marketplace/MarketPlace.java @@ -281,7 +281,7 @@ public class MarketPlace { } event.price = calculateCommision(event.price); - item.setOwnerId(client.getHabbo().getHabboInfo().getId()); + item.setOwnerInfo(client.getHabbo().getHabboInfo()); item.needsUpdate(true); Emulator.getThreading().run(item); @@ -362,7 +362,7 @@ public class MarketPlace { MarketPlaceOffer offer = new MarketPlaceOffer(event.getItem(), event.getPrice(), client.getHabbo()); client.getHabbo().getInventory().addMarketplaceOffer(offer); client.getHabbo().getInventory().getItemsComponent().removeHabboItem(event.getItem()); - item.setOwnerId(-1); + item.setOwnerInfo(null); item.needsUpdate(true); Emulator.getThreading().run(item); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/GiveRankCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/GiveRankCommand.java index 3c832360..1e6dc93b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/GiveRankCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/GiveRankCommand.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.permissions.PermissionGroup; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import org.apache.commons.lang3.StringUtils; public class GiveRankCommand extends Command { @@ -40,7 +39,7 @@ public class GiveRankCommand extends Command { return true; } - HabboInfo habbo = HabboManager.getOfflineHabboInfo(params[1]); + HabboInfo habbo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]); if (habbo != null) { if (habbo.getPermissionGroup().getId() > gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/LayCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/LayCommand.java index 3f2b7d54..164b7fbb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/LayCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/LayCommand.java @@ -35,7 +35,7 @@ public class LayCommand extends Command { return false; } - gameClient.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.LAY, 0.5 + ""); + gameClient.getHabbo().getRoomUnit().addStatus(RoomUnitStatus.LAY, 0.5 + ""); gameClient.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(gameClient.getHabbo().getRoomUnit()).compose()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/RedeemCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/RedeemCommand.java index 3f89bb8e..6a939ff7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/RedeemCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/RedeemCommand.java @@ -30,7 +30,7 @@ public class RedeemCommand extends Command { TIntIntMap points = new TIntIntHashMap(); for (RoomItem item : gameClient.getHabbo().getInventory().getItemsComponent().getItemsAsValueCollection()) { - if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_")) && item.getOwnerId() == gameClient.getHabbo().getHabboInfo().getId()) { + if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_")) && item.getOwnerInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) { items.add(item); if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) { try { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/ReloadRoomCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ReloadRoomCommand.java index a9a67383..63c0947e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/ReloadRoomCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ReloadRoomCommand.java @@ -22,7 +22,7 @@ public class ReloadRoomCommand extends Command { Room room = gameClient.getHabbo().getRoomUnit().getRoom(); if (room != null) { Collection habbos = new ArrayList<>(room.getRoomUnitManager().getCurrentHabbos().values()); - Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); + room.dispose(); room = Emulator.getGameEnvironment().getRoomManager().getRoom(room.getRoomInfo().getId()); ServerMessage message = new RoomForwardMessageComposer(room.getRoomInfo().getId()).compose(); habbos.forEach(habbo -> habbo.getClient().sendResponse(message)); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/StandCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/StandCommand.java index bb0eeb9f..8d2cf0d6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/StandCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/StandCommand.java @@ -10,8 +10,10 @@ public class StandCommand extends Command { @Override public boolean handle(GameClient gameClient, String[] params) { - if (gameClient.getHabbo().getHabboInfo().getRiding() == null) + if (gameClient.getHabbo().getHabboInfo().getRiding() == null) { gameClient.getHabbo().getRoomUnit().makeStand(); + } + return true; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/SubscriptionCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/SubscriptionCommand.java index 70618942..bd1e8f85 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/SubscriptionCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/SubscriptionCommand.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.HabboStats; import com.eu.habbo.habbohotel.users.subscriptions.Subscription; @@ -45,7 +44,7 @@ public class SubscriptionCommand extends Command { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_subscription.invalid_params", "Invalid command format"), RoomChatMessageBubbles.ALERT); return true; } - HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]); + HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]); if (info == null) { gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.user_not_found", "%user% was not found"), params[1]), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java index 9637e77b..871be6ec 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java @@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import gnu.trove.iterator.TIntIntIterator; import java.text.SimpleDateFormat; @@ -30,7 +29,7 @@ public class UserInfoCommand extends Command { HabboInfo habbo = (onlineHabbo != null ? onlineHabbo.getHabboInfo() : null); if (habbo == null) { - habbo = HabboManager.getOfflineHabboInfo(params[1]); + habbo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]); } if (habbo == null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BadgeCommand.java index 51a57aec..ae6e1f71 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/BadgeCommand.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import lombok.extern.slf4j.Slf4j; import java.sql.Connection; @@ -42,7 +41,7 @@ public class BadgeCommand extends BaseBadgeCommand { return true; } else { - HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(params[1]); + HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]); if (habboInfo == null) { gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_badge.unknown_user"), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/TakeBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/TakeBadgeCommand.java index 923ca3e0..d27c0bbb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/TakeBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/badge/TakeBadgeCommand.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.users.inventory.BadgesComponent; import com.eu.habbo.messages.outgoing.inventory.BadgesComposer; import com.eu.habbo.messages.outgoing.users.UserBadgesComposer; @@ -51,7 +50,7 @@ public class TakeBadgeCommand extends BaseBadgeCommand { if (habbo != null) userId = habbo.getHabboInfo().getId(); else { - HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(username); + HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(username); if (habboInfo != null) userId = habboInfo.getId(); } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BanCommand.java index 3215fb19..4839d98e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BanCommand.java @@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.modtool.ModToolBanType; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -54,7 +53,7 @@ public class BanCommand extends Command { if (t != null) { target = t.getHabboInfo(); } else { - target = HabboManager.getOfflineHabboInfo(params[1]); + target = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]); } if (target == null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BaseBanCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BaseBanCommand.java index a0073c31..4bd23179 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BaseBanCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/bans/BaseBanCommand.java @@ -1,10 +1,10 @@ package com.eu.habbo.habbohotel.commands.list.bans; +import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.commands.Command; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -43,7 +43,7 @@ public abstract class BaseBanCommand extends Command { if (h != null) { return h.getHabboInfo(); } else { - return HabboManager.getOfflineHabboInfo(params[1]); + return Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]); } } return null; diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/CreditsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/CreditsCommand.java index 8b362593..ecff906c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/CreditsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/credits/CreditsCommand.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; public class CreditsCommand extends BaseCreditsCommand { private static final String INVALID_AMOUNT = "commands.error.cmd_credits.invalid_amount"; @@ -17,7 +16,7 @@ public class CreditsCommand extends BaseCreditsCommand { @Override public boolean handle(GameClient gameClient, String[] params) { if (params.length == 3) { - HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]); + HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]); if (info != null) { Habbo habbo = getHabbo(params[1]); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/GiftCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/GiftCommand.java index 9ea0bad4..c72b46ee 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/GiftCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/gift/GiftCommand.java @@ -4,10 +4,9 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; +import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer; import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer; @@ -46,7 +45,7 @@ public class GiftCommand extends BaseGiftCommand { return true; } - HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(username); + HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(username); if (habboInfo == null) { gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_gift.user_not_found"), username), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java index edb0fe5e..8968e945 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java @@ -70,7 +70,7 @@ public class BattleBanzaiGame extends Game { } for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { - item.setExtradata("1"); + item.setExtraData("1"); this.room.updateItemState(item); } @@ -105,12 +105,12 @@ public class BattleBanzaiGame extends Game { if (this.countDown == 0) { for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { - item.setExtradata("1"); + item.setExtraData("1"); this.room.updateItemState(item); if(this.countDown2 > 0) { this.countDown2--; if(this.countDown2 == 0) { - item.setExtradata("2"); + item.setExtraData("2"); this.room.updateItemState(item); } } @@ -147,7 +147,7 @@ public class BattleBanzaiGame extends Game { if (highestScore != null) { for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { - item.setExtradata((highestScore.teamColor.type + 2) + ""); + item.setExtraData((highestScore.teamColor.type + 2) + ""); this.room.updateItemState(item); } } @@ -195,7 +195,7 @@ public class BattleBanzaiGame extends Game { } for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { - item.setExtradata((6 + winningTeam.teamColor.type) + ""); + item.setExtraData((6 + winningTeam.teamColor.type) + ""); this.room.updateItemState(item); } synchronized (this.lockedTiles) { @@ -213,8 +213,8 @@ public class BattleBanzaiGame extends Game { this.refreshGates(); for (RoomItem tile : this.gameTiles.values()) { - if (tile.getExtradata().equals("1")) { - tile.setExtradata("0"); + if (tile.getExtraData().equals("1")) { + tile.setExtraData("0"); this.room.updateItem(tile); } } @@ -228,14 +228,14 @@ public class BattleBanzaiGame extends Game { this.tileCount = 0; for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) { if (item instanceof InteractionBattleBanzaiTile) { - item.setExtradata("1"); + item.setExtraData("1"); this.room.updateItemState(item); this.tileCount++; this.gameTiles.put(item.getId(), item); } if (item instanceof InteractionBattleBanzaiScoreboard) { - item.setExtradata("0"); + item.setExtraData("0"); this.room.updateItemState(item); } } @@ -262,8 +262,8 @@ public class BattleBanzaiGame extends Game { if (doNotCheckFill) return; - final int x = item.getX(); - final int y = item.getY(); + final int x = item.getCurrentPosition().getX(); + final int y = item.getCurrentPosition().getY(); final List> filledAreas = new ArrayList<>(); final THashSet lockedTiles = new THashSet<>(this.lockedTiles.get(teamColor)); @@ -278,12 +278,12 @@ public class BattleBanzaiGame extends Game { if (largestAreaOfAll.isPresent()) { for (RoomTile tile : largestAreaOfAll.get()) { - Optional tileItem = this.gameTiles.values().stream().filter(i -> i.getX() == tile.getX() && i.getY() == tile.getY() && i instanceof InteractionBattleBanzaiTile).findAny(); + Optional tileItem = this.gameTiles.values().stream().filter(i -> i.getCurrentPosition().getX() == tile.getX() && i.getCurrentPosition().getY() == tile.getY() && i instanceof InteractionBattleBanzaiTile).findAny(); tileItem.ifPresent(habboItem -> { this.tileLocked(teamColor, habboItem, habbo, true); - habboItem.setExtradata((2 + (teamColor.type * 3)) + ""); + habboItem.setExtraData((2 + (teamColor.type * 3)) + ""); this.room.updateItem(habboItem); }); } @@ -322,7 +322,7 @@ public class BattleBanzaiGame extends Game { private boolean hasLockedTileAtCoordinates(int x, int y, THashSet lockedTiles) { for (RoomItem item : lockedTiles) { - if (item.getX() == x && item.getY() == y) return true; + if (item.getCurrentPosition().getX() == x && item.getCurrentPosition().getY() == y) return true; } return false; @@ -330,7 +330,7 @@ public class BattleBanzaiGame extends Game { private boolean isOutOfBounds(int x, int y) { for (RoomItem item : this.gameTiles.values()) { - if (item.getX() == x && item.getY() == y) return false; + if (item.getCurrentPosition().getX() == x && item.getCurrentPosition().getY() == y) return false; } return true; @@ -341,7 +341,7 @@ public class BattleBanzaiGame extends Game { if (lockedTilesForColor.getKey() == color) continue; for (RoomItem item : lockedTilesForColor.getValue()) { - if (item.getX() == x && item.getY() == y) return true; + if (item.getCurrentPosition().getX() == x && item.getCurrentPosition().getY() == y) return true; } } @@ -366,16 +366,16 @@ public class BattleBanzaiGame extends Game { THashMap scoreBoards = this.room.getRoomSpecialTypes().getBattleBanzaiScoreboards(teamColors); for (InteractionBattleBanzaiScoreboard scoreboard : scoreBoards.values()) { - if (scoreboard.getExtradata().isEmpty()) { - scoreboard.setExtradata("0"); + if (scoreboard.getExtraData().isEmpty()) { + scoreboard.setExtraData("0"); } - int oldScore = Integer.parseInt(scoreboard.getExtradata()); + int oldScore = Integer.parseInt(scoreboard.getExtraData()); if (oldScore == totalScore) continue; - scoreboard.setExtradata(totalScore + ""); + scoreboard.setExtraData(totalScore + ""); this.room.updateItemState(scoreboard); } } @@ -384,7 +384,7 @@ public class BattleBanzaiGame extends Game { Collection gates = this.room.getRoomSpecialTypes().getBattleBanzaiGates().values(); THashSet tilesToUpdate = new THashSet<>(gates.size()); for (RoomItem item : gates) { - tilesToUpdate.add(this.room.getLayout().getTile(item.getX(), item.getY())); + tilesToUpdate.add(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); } this.room.updateTiles(tilesToUpdate); @@ -410,7 +410,7 @@ public class BattleBanzaiGame extends Game { } this.refreshCounters(habbo.getHabboInfo().getGamePlayer().getTeamColor()); - tile.setExtradata(state + ""); + tile.setExtraData(state + ""); this.room.updateItem(tile); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java index f4427915..50460edc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGameTeam.java @@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.games.freeze.FreezeGame; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; @@ -38,10 +37,10 @@ public class BattleBanzaiGameTeam extends GameTeam { Habbo habbo = gamePlayer.getHabbo(); Game game = habbo.getRoomUnit().getRoom().getGame(FreezeGame.class); - RoomUnit roomUnit = habbo.getRoomUnit(); - Room room = roomUnit.getRoom(); + RoomHabbo roomHabbo = habbo.getRoomUnit(); + Room room = roomHabbo.getRoom(); if(room == null) return; - RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY()); + RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomHabbo.getCurrentPosition().getX(), roomHabbo.getCurrentPosition().getY()); int nextEffectM = 0; int nextEffectF = 0; int nextEffectDuration = -1; @@ -49,10 +48,10 @@ public class BattleBanzaiGameTeam extends GameTeam { if (topItem != null) { nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectF = topItem.getBaseItem().getEffectF(); - } else if (roomUnit.getPreviousEffectId() > 0) { - nextEffectF = roomUnit.getPreviousEffectId(); - nextEffectM = roomUnit.getPreviousEffectId(); - nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); + } else if (roomHabbo.getPreviousEffectId() > 0) { + nextEffectF = roomHabbo.getPreviousEffectId(); + nextEffectM = roomHabbo.getPreviousEffectId(); + nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp(); } if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { @@ -64,7 +63,7 @@ public class BattleBanzaiGameTeam extends GameTeam { habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration, true); } - roomUnit.setCanWalk(true); + roomHabbo.setCanWalk(true); if (room.getRoomSpecialTypes() != null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java index 2abe1ff4..f859c4f8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java @@ -80,7 +80,7 @@ public class FreezeGame extends Game { synchronized void resetMap() { for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) { if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeScoreboard) { - item.setExtradata("0"); + item.setExtraData("0"); this.room.updateItemState(item); } } @@ -90,10 +90,10 @@ public class FreezeGame extends Game { if (!this.state.equals(GameState.RUNNING) || !habbo.getHabboInfo().isInGame() || habbo.getHabboInfo().getCurrentGame() != this.getClass()) return; - if (!item.getExtradata().equalsIgnoreCase("0") && !item.getExtradata().isEmpty()) + if (!item.getExtraData().equalsIgnoreCase("0") && !item.getExtraData().isEmpty()) return; - if (RoomLayout.tilesAdjecent(habbo.getRoomUnit().getCurrentPosition(), this.room.getLayout().getTile(item.getX(), item.getY()))) { + if (RoomLayout.tilesAdjecent(habbo.getRoomUnit().getCurrentPosition(), this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()))) { if (((FreezeGamePlayer) habbo.getHabboInfo().getGamePlayer()).canThrowSnowball()) { Emulator.getThreading().run(new FreezeThrowSnowball(habbo, item, this.room)); } @@ -147,7 +147,7 @@ public class FreezeGame extends Game { powerUp += Emulator.getRandom().nextInt(6) + 1; } - block.setExtradata((powerUp + 1) + String.format("%3d", delay)); + block.setExtraData((powerUp + 1) + String.format("%3d", delay)); this.room.updateItemState(block); } @@ -173,7 +173,7 @@ public class FreezeGame extends Game { Emulator.getThreading().run(new FreezeClearEffects(player.getHabbo()), 1000); if (this.room.getRoomSpecialTypes().hasFreezeExitTile()) { InteractionFreezeExitTile tile = this.room.getRoomSpecialTypes().getRandomFreezeExitTile(); - tile.setExtradata("1"); + tile.setExtraData("1"); this.room.updateItemState(tile); this.room.teleportHabboToItem(player.getHabbo(), tile); } @@ -194,7 +194,7 @@ public class FreezeGame extends Game { for (RoomItem item : this.room.getRoomItemManager().getItemsAt(habbo.getRoomUnit().getCurrentPosition())) { if (item instanceof InteractionFreezeTile) { RoomItem exitTile = this.room.getRoomSpecialTypes().getRandomFreezeExitTile(); - WiredEffectTeleport.teleportUnitToTile(habbo.getRoomUnit(), this.room.getLayout().getTile(exitTile.getX(), exitTile.getY())); + WiredEffectTeleport.teleportUnitToTile(habbo.getRoomUnit(), this.room.getLayout().getTile(exitTile.getCurrentPosition().getX(), exitTile.getCurrentPosition().getY())); } } } @@ -227,16 +227,16 @@ public class FreezeGame extends Game { THashMap scoreBoards = this.room.getRoomSpecialTypes().getFreezeScoreboards(team.teamColor); for (InteractionFreezeScoreboard scoreboard : scoreBoards.values()) { - if (scoreboard.getExtradata().isEmpty()) { - scoreboard.setExtradata("0"); + if (scoreboard.getExtraData().isEmpty()) { + scoreboard.setExtraData("0"); } - int oldScore = Integer.parseInt(scoreboard.getExtradata()); + int oldScore = Integer.parseInt(scoreboard.getExtraData()); if (oldScore == totalScore) continue; - scoreboard.setExtradata(totalScore + ""); + scoreboard.setExtraData(totalScore + ""); this.room.updateItemState(scoreboard); } } @@ -282,7 +282,7 @@ public class FreezeGame extends Game { for (Map.Entry set : this.room.getRoomSpecialTypes().getFreezeGates().entrySet()) { if (teamMemberCount.containsKey(set.getValue().teamColor)) { int amount = Math.min(teamMemberCount.get(set.getValue().teamColor), 5); - set.getValue().setExtradata(amount + ""); + set.getValue().setExtraData(amount + ""); teamMemberCount.put(set.getValue().teamColor, teamMemberCount.get(set.getValue().teamColor) - amount); this.room.updateItemState(set.getValue()); } @@ -295,7 +295,7 @@ public class FreezeGame extends Game { public void setFreezeTileState(String state) { this.room.getRoomSpecialTypes().getFreezeExitTiles().forEachValue(object -> { - object.setExtradata(state); + object.setExtraData(state); FreezeGame.this.room.updateItemState(object); return true; }); @@ -305,7 +305,7 @@ public class FreezeGame extends Game { private void refreshGates() { THashSet tilesToUpdate = new THashSet<>(); for (RoomItem item : this.room.getRoomSpecialTypes().getFreezeGates().values()) { - tilesToUpdate.add(this.room.getLayout().getTile(item.getX(), item.getY())); + tilesToUpdate.add(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); } this.room.updateTiles(tilesToUpdate); diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java index 9993c69f..a31f278d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGameTeam.java @@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; @@ -25,11 +24,11 @@ public class FreezeGameTeam extends GameTeam { Habbo habbo = gamePlayer.getHabbo(); Game game = habbo.getRoomUnit().getRoom().getGame(FreezeGame.class); - RoomUnit roomUnit = habbo.getRoomUnit(); - Room room = roomUnit.getRoom(); + RoomHabbo roomHabbo = habbo.getRoomUnit(); + Room room = roomHabbo.getRoom(); if(room == null) return; - RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY()); + RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomHabbo.getCurrentPosition().getX(), roomHabbo.getCurrentPosition().getY()); int nextEffectM = 0; int nextEffectF = 0; int nextEffectDuration = -1; @@ -37,10 +36,10 @@ public class FreezeGameTeam extends GameTeam { if (topItem != null) { nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectF = topItem.getBaseItem().getEffectF(); - } else if (roomUnit.getPreviousEffectId() > 0) { - nextEffectF = roomUnit.getPreviousEffectId(); - nextEffectM = roomUnit.getPreviousEffectId(); - nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); + } else if (roomHabbo.getPreviousEffectId() > 0) { + nextEffectF = roomHabbo.getPreviousEffectId(); + nextEffectM = roomHabbo.getPreviousEffectId(); + nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp(); } if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { @@ -52,7 +51,7 @@ public class FreezeGameTeam extends GameTeam { habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration, true); } - roomUnit.setCanWalk(true); + roomHabbo.setCanWalk(true); if (room.getRoomSpecialTypes() != null) { for (InteractionGameGate gate : room.getRoomSpecialTypes().getFreezeGates().values()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java b/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java index 8cdb6f11..743d9d56 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/tag/TagGame.java @@ -10,7 +10,6 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; @@ -121,7 +120,7 @@ public abstract class TagGame extends Game { } if (pole != null) { - pole.setExtradata("1"); + pole.setExtraData("1"); room.updateItemState(pole); Emulator.getThreading().run(new HabboItemNewState(pole, room, "0"), 1000); } @@ -173,11 +172,11 @@ public abstract class TagGame extends Game { super.removeHabbo(habbo); this.taggers.remove(habbo); - RoomUnit roomUnit = habbo.getRoomUnit(); - Room room = roomUnit.getRoom(); + RoomHabbo roomHabbo = habbo.getRoomUnit(); + Room room = roomHabbo.getRoom(); if (room == null) return; - RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY()); + RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomHabbo.getCurrentPosition().getX(), roomHabbo.getCurrentPosition().getY()); int nextEffectM = 0; int nextEffectF = 0; int nextEffectDuration = -1; @@ -185,10 +184,10 @@ public abstract class TagGame extends Game { if (topItem != null) { nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectF = topItem.getBaseItem().getEffectF(); - } else if (roomUnit.getPreviousEffectId() > 0) { - nextEffectF = roomUnit.getPreviousEffectId(); - nextEffectM = roomUnit.getPreviousEffectId(); - nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); + } else if (roomHabbo.getPreviousEffectId() > 0) { + nextEffectF = roomHabbo.getPreviousEffectId(); + nextEffectM = roomHabbo.getPreviousEffectId(); + nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp(); } if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { diff --git a/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java b/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java index f438461b..0bf1d1d6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java +++ b/src/main/java/com/eu/habbo/habbohotel/games/wired/WiredGame.java @@ -41,11 +41,11 @@ public class WiredGame extends Game { @Override public void removeHabbo(Habbo habbo) { super.removeHabbo(habbo); - RoomHabbo roomUnit = habbo.getRoomUnit(); + RoomHabbo roomHabbo = habbo.getRoomUnit(); Room room = this.room; if (room == null) return; - RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY()); + RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomHabbo.getCurrentPosition().getX(), roomHabbo.getCurrentPosition().getY()); int nextEffectM = 0; int nextEffectF = 0; int nextEffectDuration = -1; @@ -53,19 +53,19 @@ public class WiredGame extends Game { if (topItem != null) { nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectF = topItem.getBaseItem().getEffectF(); - } else if (roomUnit.getPreviousEffectId() > 0) { - nextEffectF = roomUnit.getPreviousEffectId(); - nextEffectM = roomUnit.getPreviousEffectId(); - nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); + } else if (roomHabbo.getPreviousEffectId() > 0) { + nextEffectF = roomHabbo.getPreviousEffectId(); + nextEffectM = roomHabbo.getPreviousEffectId(); + nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp(); } if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { - roomUnit.giveEffect(nextEffectM, nextEffectDuration, true); + roomHabbo.giveEffect(nextEffectM, nextEffectDuration, true); return; } if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) { - roomUnit.giveEffect(nextEffectF, nextEffectDuration, true); + roomHabbo.giveEffect(nextEffectF, nextEffectDuration, true); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/Item.java b/src/main/java/com/eu/habbo/habbohotel/items/Item.java index 25e6ae8a..8827829d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/Item.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/Item.java @@ -66,13 +66,13 @@ public class Item implements ISerialize { public static double getCurrentHeight(RoomItem item) { if (item instanceof InteractionMultiHeight && item.getBaseItem().getMultiHeights().length > 0) { - if (item.getExtradata().isEmpty()) { - item.setExtradata("0"); + if (item.getExtraData().isEmpty()) { + item.setExtraData("0"); } try { - int index = Integer.parseInt(item.getExtradata()) % (item.getBaseItem().getMultiHeights().length); - return item.getBaseItem().getMultiHeights()[(item.getExtradata().isEmpty() ? 0 : index)]; + int index = Integer.parseInt(item.getExtraData()) % (item.getBaseItem().getMultiHeights().length); + return item.getBaseItem().getMultiHeights()[(item.getExtraData().isEmpty() ? 0 : index)]; } catch (NumberFormatException ignored) { } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java index 00240bbc..0532ab67 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java @@ -51,8 +51,9 @@ import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob; import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraRandom; import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraUnseen; import com.eu.habbo.habbohotel.items.interactions.wired.triggers.*; -import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager; import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer; import com.eu.habbo.plugin.events.emulator.EmulatorLoadItemsManagerEvent; @@ -488,13 +489,14 @@ public class ItemManager { try (ResultSet set = statement.getGeneratedKeys()) { if (set.next()) { Class itemClass = item.getInteractionType().getType(); + HabboInfo userInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(habboId); if (itemClass != null) { try { - return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells); + return itemClass.getDeclaredConstructor(int.class, HabboInfo.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), userInfo, item, extraData, limitedStack, limitedSells); } catch (Exception e) { log.error("Caught exception", e); - return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells); + return new InteractionDefault(set.getInt(1), userInfo, item, extraData, limitedStack, limitedSells); } } } @@ -562,7 +564,7 @@ public class ItemManager { preparedStatement.setInt(1, set.getInt(1)); preparedStatement.setInt(2, Integer.parseInt(itemId)); preparedStatement.addBatch(); - item = new InteractionDefault(set.getInt(1), habbo.getHabboInfo().getId(), Emulator.getGameEnvironment().getCatalogManager().ecotronItem, extradata, 0, 0); + item = new InteractionDefault(set.getInt(1), habbo.getHabboInfo(), Emulator.getGameEnvironment().getCatalogManager().ecotronItem, extradata, 0, 0); } preparedStatement.executeBatch(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java index 6506c596..3c04a3e6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBackgroundToner.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.modtool.ScripterManager; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.BackgroundAnimation; @@ -18,16 +19,16 @@ public class InteractionBackgroundToner extends RoomItem { super(set, baseItem); } - public InteractionBackgroundToner(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionBackgroundToner(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt(5 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(4); - if (this.getExtradata().split(":").length == 4) { - String[] colorData = this.getExtradata().split(":"); + if (this.getExtraData().split(":").length == 4) { + String[] colorData = this.getExtraData().split(":"); serverMessage.appendInt(Integer.parseInt(colorData[0])); serverMessage.appendInt(Integer.parseInt(colorData[1])); serverMessage.appendInt(Integer.parseInt(colorData[2])); @@ -37,7 +38,7 @@ public class InteractionBackgroundToner extends RoomItem { serverMessage.appendInt(126); serverMessage.appendInt(126); serverMessage.appendInt(126); - this.setExtradata("0:126:126:126"); + this.setExtraData("0:126:126:126"); this.needsUpdate(true); Emulator.getThreading().run(this); } @@ -77,12 +78,12 @@ public class InteractionBackgroundToner extends RoomItem { } } - if (this.getExtradata().split(":").length == 4) { - String[] data = this.getExtradata().split(":"); - this.setExtradata((data[0].equals("0") ? "1" : "0") + ":" + data[1] + ":" + data[2] + ":" + data[3]); + if (this.getExtraData().split(":").length == 4) { + String[] data = this.getExtraData().split(":"); + this.setExtraData((data[0].equals("0") ? "1" : "0") + ":" + data[1] + ":" + data[2] + ":" + data[3]); room.updateItem(this); } else { - this.setExtradata("0:126:126:126"); + this.setExtraData("0:126:126:126"); room.updateItem(this); } this.needsUpdate(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBadgeDisplay.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBadgeDisplay.java index aa9d223a..d62cf21c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBadgeDisplay.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBadgeDisplay.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class InteractionBadgeDisplay extends RoomItem { super(set, baseItem); } - public InteractionBadgeDisplay(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionBadgeDisplay(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -24,13 +25,13 @@ public class InteractionBadgeDisplay extends RoomItem { serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(4); serverMessage.appendString("0"); - String[] data = this.getExtradata().split((char) 9 + ""); + String[] data = this.getExtraData().split((char) 9 + ""); if (data.length == 3) { serverMessage.appendString(data[2]); serverMessage.appendString(data[1]); serverMessage.appendString(data[0]); } else { - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); serverMessage.appendString("Unknown User"); serverMessage.appendString("Unknown Date"); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java index 672d77e8..c8a6493a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -15,8 +16,8 @@ public class InteractionBlackHole extends InteractionGate { super(set, baseItem); } - public InteractionBlackHole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionBlackHole(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -24,10 +25,10 @@ public class InteractionBlackHole extends InteractionGate { Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount"); int holesCountProgress = 0; - Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getOwnerId()); + Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getOwnerInfo().getId()); if (owner == null) { - holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerId(), holeCountAchievement); + holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerInfo().getId(), holeCountAchievement); } else { holesCountProgress = owner.getHabboStats().getAchievementProgress(holeCountAchievement); } @@ -37,7 +38,7 @@ public class InteractionBlackHole extends InteractionGate { if (owner != null) { AchievementManager.progressAchievement(owner, holeCountAchievement, holeDifference); } else { - AchievementManager.progressAchievement(this.getOwnerId(), holeCountAchievement, holeDifference); + AchievementManager.progressAchievement(this.getOwnerInfo().getId(), holeCountAchievement, holeDifference); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java index a8b5eff1..cde00f3b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBuildArea.java @@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.outgoing.rooms.items.ObjectsMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import gnu.trove.TCollections; @@ -39,8 +38,8 @@ public class InteractionBuildArea extends InteractionCustomValues { tiles = new THashSet<>(); } - public InteractionBuildArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); + public InteractionBuildArea(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues); defaultValues.put("tilesLeft", "0"); defaultValues.put("tilesRight", "0"); defaultValues.put("tilesFront", "0"); @@ -69,7 +68,7 @@ public class InteractionBuildArea extends InteractionCustomValues { if (builder != null) { builderInfo = builder.getHabboInfo(); } else { - builderInfo = HabboManager.getOfflineHabboInfo(builderName); + builderInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(builderName); } if (builderInfo != null) { canBuild.add(builderInfo.getId()); @@ -80,7 +79,7 @@ public class InteractionBuildArea extends InteractionCustomValues { for (RoomTile tile : this.tiles) { THashSet tileItems = room.getRoomItemManager().getItemsAt(tile); for (RoomItem tileItem : tileItems) { - if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) { + if (canBuild.contains(tileItem.getOwnerInfo().getId()) && tileItem != this) { room.getRoomItemManager().pickUpItem(tileItem, null); } } @@ -103,7 +102,7 @@ public class InteractionBuildArea extends InteractionCustomValues { if (builder != null) { builderInfo = builder.getHabboInfo(); } else { - builderInfo = HabboManager.getOfflineHabboInfo(builderName); + builderInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(builderName); } if (builderInfo != null) { canBuild.add(builderInfo.getId()); @@ -130,7 +129,7 @@ public class InteractionBuildArea extends InteractionCustomValues { THashSet tileItems = room.getRoomItemManager().getItemsAt(tile); if (newTiles.contains(tile)) continue; for (RoomItem tileItem : tileItems) { - if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) { + if (canBuild.contains(tileItem.getOwnerInfo().getId()) && tileItem != this) { room.getRoomItemManager().pickUpItem(tileItem, null); } } @@ -151,10 +150,10 @@ public class InteractionBuildArea extends InteractionCustomValues { } private void regenAffectedTiles(Room room) { - int minX = Math.max(0, this.getX() - Integer.parseInt(this.values.get("tilesBack"))); - int minY = Math.max(0, this.getY() - Integer.parseInt(this.values.get("tilesRight"))); - int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(this.values.get("tilesFront"))); - int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(this.values.get("tilesLeft"))); + int minX = Math.max(0, this.getCurrentPosition().getX() - Integer.parseInt(this.values.get("tilesBack"))); + int minY = Math.max(0, this.getCurrentPosition().getY() - Integer.parseInt(this.values.get("tilesRight"))); + int maxX = Math.min(room.getLayout().getMapSizeX(), this.getCurrentPosition().getX() + Integer.parseInt(this.values.get("tilesFront"))); + int maxY = Math.min(room.getLayout().getMapSizeY(), this.getCurrentPosition().getY() + Integer.parseInt(this.values.get("tilesLeft"))); this.tiles.clear(); @@ -179,7 +178,7 @@ public class InteractionBuildArea extends InteractionCustomValues { if (builder != null) { builderInfo = builder.getHabboInfo(); } else { - builderInfo = HabboManager.getOfflineHabboInfo(builderName); + builderInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(builderName); } if (builderInfo != null) { canBuild.add(builderInfo.getId()); @@ -188,10 +187,10 @@ public class InteractionBuildArea extends InteractionCustomValues { THashSet oldTiles = new THashSet<>(); - int minX = Math.max(0, this.getX() - Integer.parseInt(oldValues.get("tilesBack"))); - int minY = Math.max(0, this.getY() - Integer.parseInt(oldValues.get("tilesRight"))); - int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(oldValues.get("tilesFront"))); - int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(oldValues.get("tilesLeft"))); + int minX = Math.max(0, this.getCurrentPosition().getX() - Integer.parseInt(oldValues.get("tilesBack"))); + int minY = Math.max(0, this.getCurrentPosition().getY() - Integer.parseInt(oldValues.get("tilesRight"))); + int maxX = Math.min(room.getLayout().getMapSizeX(), this.getCurrentPosition().getX() + Integer.parseInt(oldValues.get("tilesFront"))); + int maxY = Math.min(room.getLayout().getMapSizeY(), this.getCurrentPosition().getY() + Integer.parseInt(oldValues.get("tilesLeft"))); for (int x = minX; x <= maxX; x++) { for (int y = minY; y <= maxY; y++) { @@ -204,7 +203,7 @@ public class InteractionBuildArea extends InteractionCustomValues { for (RoomTile tile : oldTiles) { THashSet tileItems = room.getRoomItemManager().getItemsAt(tile); for (RoomItem tileItem : tileItems) { - if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) { + if (canBuild.contains(tileItem.getOwnerInfo().getId()) && tileItem != this) { room.getRoomItemManager().pickUpItem(tileItem, null); } } @@ -222,10 +221,10 @@ public class InteractionBuildArea extends InteractionCustomValues { int id = 0; for (RoomTile tile : this.tiles) { id--; - RoomItem item = new InteractionDefault(id, -1, effectItem, "1", 0, 0); - item.setX(tile.getX()); - item.setY(tile.getY()); - item.setZ(tile.relativeHeight()); + RoomItem item = new InteractionDefault(id, null, effectItem, "1", 0, 0); + + item.setCurrentPosition(tile); + item.setCurrentZ(tile.relativeHeight()); items.add(item); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCannon.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCannon.java index a2f3a65e..ebf28fc5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCannon.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCannon.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.CannonKickAction; import com.eu.habbo.threading.runnables.CannonResetCooldownAction; @@ -20,18 +21,18 @@ public class InteractionCannon extends RoomItem { public InteractionCannon(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionCannon(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionCannon(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -55,7 +56,7 @@ public class InteractionCannon extends RoomItem { if (room == null) return; - RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tile = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); RoomTile fuseTile = this.getRotation() >= 4 ? tile : room.getLayout().getTileInFront(tile, ((this.getRotation() % 2) + 2) % 8); List tiles = room.getLayout().getTilesAround(fuseTile); tiles.remove(room.getLayout().getTileInFront(tile, (this.getRotation() + (this.getRotation() >= 4 ? -1 : 0)) % 8)); @@ -70,7 +71,7 @@ public class InteractionCannon extends RoomItem { } this.cooldown = true; - this.setExtradata(this.getExtradata().equals("1") ? "0" : "1"); + this.setExtraData(this.getExtraData().equals("1") ? "0" : "1"); room.updateItemState(this); Emulator.getThreading().run(new CannonKickAction(this, room, client), 750); Emulator.getThreading().run(new CannonResetCooldownAction(this), 2000); @@ -94,7 +95,7 @@ public class InteractionCannon extends RoomItem { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionClothing.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionClothing.java index bfd245bd..d34bc24c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionClothing.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionClothing.java @@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class InteractionClothing extends RoomItem { super(set, baseItem); } - public InteractionClothing(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionClothing(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java index d530ba7c..43d2ca82 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorPlate.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import lombok.extern.slf4j.Slf4j; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class InteractionColorPlate extends InteractionDefault { super(set, baseItem); } - public InteractionColorPlate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionColorPlate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -36,12 +37,12 @@ public class InteractionColorPlate extends InteractionDefault { private void change(Room room, int amount) { int state = 0; - if (this.getExtradata() == null || this.getExtradata().isEmpty()) { - this.setExtradata("0"); + if (this.getExtraData() == null || this.getExtraData().isEmpty()) { + this.setExtraData("0"); } try { - state = Integer.parseInt(this.getExtradata()); + state = Integer.parseInt(this.getExtraData()); } catch (Exception e) { log.error("Caught exception", e); } @@ -55,7 +56,7 @@ public class InteractionColorPlate extends InteractionDefault { state = 0; } - this.setExtradata(state + ""); + this.setExtraData(state + ""); this.needsUpdate(true); room.updateItemState(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorWheel.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorWheel.java index 1a7d9f06..f7c817ac 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorWheel.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorWheel.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.ItemUpdateMessageComposer; import com.eu.habbo.threading.runnables.RandomDiceNumber; @@ -20,14 +21,14 @@ public class InteractionColorWheel extends RoomItem { super(set, baseItem); } - public InteractionColorWheel(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionColorWheel(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -49,8 +50,8 @@ public class InteractionColorWheel extends RoomItem { if (!room.getRoomRightsManager().hasRights(client.getHabbo())) return; - if (this.rollTaks == null && !this.getExtradata().equalsIgnoreCase("-1")) { - this.setExtradata("-1"); + if (this.rollTaks == null && !this.getExtraData().equalsIgnoreCase("-1")) { + this.setExtraData("-1"); room.sendComposer(new ItemUpdateMessageComposer(this).compose()); Emulator.getThreading().run(this); Emulator.getThreading().run(new RandomDiceNumber(this, room, this.getBaseItem().getStateCount()), 3000); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCostumeHopper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCostumeHopper.java index 96e83953..55ed6ed2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCostumeHopper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCostumeHopper.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer; import java.sql.ResultSet; @@ -13,8 +14,8 @@ public class InteractionCostumeHopper extends InteractionHopper { super(set, baseItem); } - public InteractionCostumeHopper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionCostumeHopper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java index 3909c88f..2cf7524a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.CrackableExplode; @@ -27,19 +28,19 @@ public class InteractionCrackable extends RoomItem { super(set, baseItem); } - public InteractionCrackable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionCrackable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { - if (this.getExtradata().length() == 0) - this.setExtradata("0"); + if (this.getExtraData().length() == 0) + this.setExtraData("0"); serverMessage.appendInt(7 + (this.isLimited() ? 256 : 0)); - serverMessage.appendString(Emulator.getGameEnvironment().getItemManager().calculateCrackState(Integer.parseInt(this.getExtradata()), Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()), this.getBaseItem()) + ""); - serverMessage.appendInt(Integer.parseInt(this.getExtradata())); + serverMessage.appendString(Emulator.getGameEnvironment().getItemManager().calculateCrackState(Integer.parseInt(this.getExtraData()), Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()), this.getBaseItem()) + ""); + serverMessage.appendInt(Integer.parseInt(this.getExtraData())); serverMessage.appendInt(Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())); super.serializeExtradata(serverMessage); @@ -69,13 +70,13 @@ public class InteractionCrackable extends RoomItem { if (this.cracked) return; - if (this.userRequiredToBeAdjacent() && client.getHabbo().getRoomUnit().getCurrentPosition().distance(room.getLayout().getTile(this.getX(), this.getY())) > 1.5) { - client.getHabbo().getRoomUnit().setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), Rotation.Calculate(client.getHabbo().getRoomUnit().getCurrentPosition().getX(), client.getHabbo().getRoomUnit().getCurrentPosition().getY(), this.getX(), this.getY()))); + if (this.userRequiredToBeAdjacent() && client.getHabbo().getRoomUnit().getCurrentPosition().distance(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) > 1.5) { + client.getHabbo().getRoomUnit().setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), Rotation.Calculate(client.getHabbo().getRoomUnit().getCurrentPosition().getX(), client.getHabbo().getRoomUnit().getCurrentPosition().getY(), this.getCurrentPosition().getX(), this.getCurrentPosition().getY()))); return; } - if (this.getExtradata().length() == 0) - this.setExtradata("0"); + if (this.getExtraData().length() == 0) + this.setExtraData("0"); if (this.getBaseItem().getEffectF() > 0) if (client.getHabbo().getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() == client.getHabbo().getRoomUnit().getEffectId()) @@ -92,7 +93,7 @@ public class InteractionCrackable extends RoomItem { public void onTick(Habbo habbo, Room room) { if (this.cracked) return; - if (this.allowAnyone() || this.getOwnerId() == habbo.getHabboInfo().getId()) { + if (this.allowAnyone() || this.getOwnerInfo().getId() == habbo.getHabboInfo().getId()) { CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId()); if (rewardData != null) { @@ -102,10 +103,10 @@ public class InteractionCrackable extends RoomItem { if(this.ticks < 1) { // If there are no ticks (for example because the room has been reloaded), check the current extradata of the item and update the ticks. - this.ticks = Integer.parseInt(this.getExtradata()); + this.ticks = Integer.parseInt(this.getExtraData()); } this.ticks++; - this.setExtradata("" + (this.ticks)); + this.setExtraData("" + (this.ticks)); this.needsUpdate(true); room.updateItem(this); @@ -114,7 +115,7 @@ public class InteractionCrackable extends RoomItem { } if (!this.cracked && this.ticks == Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())) { this.cracked = true; - Emulator.getThreading().run(new CrackableExplode(room, this, habbo, !this.placeInRoom(), this.getX(), this.getY()), 1500); + Emulator.getThreading().run(new CrackableExplode(room, this, habbo, !this.placeInRoom(), this.getCurrentPosition()), 1500); if (!rewardData.getAchievementCracked().isEmpty()) { AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.getAchievementCracked())); @@ -168,7 +169,7 @@ public class InteractionCrackable extends RoomItem { public void reset(Room room) { this.cracked = false; this.ticks = 0; - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackableMaster.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackableMaster.java index 60244939..af4de4b3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackableMaster.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackableMaster.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,8 +11,8 @@ public class InteractionCrackableMaster extends InteractionCrackable { super(set, baseItem); } - public InteractionCrackableMaster(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionCrackableMaster(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCustomValues.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCustomValues.java index ed124f97..bb996240 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCustomValues.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCustomValues.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.map.hash.THashMap; @@ -29,8 +30,8 @@ public abstract class InteractionCustomValues extends RoomItem { } } - public InteractionCustomValues(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, THashMap defaultValues) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionCustomValues(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, THashMap defaultValues) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.values.putAll(defaultValues); } @@ -52,7 +53,7 @@ public abstract class InteractionCustomValues extends RoomItem { @Override public void run() { - this.setExtradata(this.toExtraData()); + this.setExtraData(this.toExtraData()); super.run(); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java index 55cb7c7f..a198504d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java @@ -1,6 +1,5 @@ package com.eu.habbo.habbohotel.items.interactions; -import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; @@ -8,11 +7,8 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; -import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomBot; -import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.ServerMessage; import lombok.extern.slf4j.Slf4j; @@ -26,14 +22,14 @@ public class InteractionDefault extends RoomItem { super(set, baseItem); } - public InteractionDefault(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionDefault(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -79,19 +75,19 @@ public class InteractionDefault extends RoomItem { if (objects != null && objects.length > 0) { if (objects[0] instanceof Integer) { - if (this.getExtradata().length() == 0) - this.setExtradata("0"); + if (this.getExtraData().length() == 0) + this.setExtraData("0"); if (this.getBaseItem().getStateCount() > 0) { int currentState = 0; try { - currentState = Integer.parseInt(this.getExtradata()); + currentState = Integer.parseInt(this.getExtraData()); } catch (NumberFormatException e) { - log.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")"); + log.error("Incorrect extradata (" + this.getExtraData() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")"); } - this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount()); + this.setExtraData("" + (currentState + 1) % this.getBaseItem().getStateCount()); this.needsUpdate(true); room.updateItemState(this); @@ -109,115 +105,11 @@ public class InteractionDefault extends RoomItem { @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - - if (roomUnit == null || (this.getBaseItem().getEffectF() == 0 && this.getBaseItem().getEffectM() == 0)) { - return; - } - - if (roomUnit instanceof RoomHabbo roomHabbo) { - Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomHabbo); - - if (habbo == null) return; - - if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomHabbo.getEffectId() != this.getBaseItem().getEffectM()) { - if (roomHabbo.getEffectId() > 0) { - roomHabbo.setPreviousEffectId(roomHabbo.getEffectId(), roomHabbo.getPreviousEffectEndTimestamp()); - } - - roomHabbo.giveEffect(this.getBaseItem().getEffectM(), -1); - return; - } - - if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomHabbo.getEffectId() != this.getBaseItem().getEffectF()) { - if (roomHabbo.getEffectId() > 0) { - roomHabbo.setPreviousEffectId(roomHabbo.getEffectId(), roomHabbo.getPreviousEffectEndTimestamp()); - } - roomHabbo.giveEffect(this.getBaseItem().getEffectF(), -1); - } - } else if (roomUnit instanceof RoomBot roomBot) { - Bot bot = room.getRoomUnitManager().getBotByRoomUnit(roomBot); - - if (bot == null) return; - - if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomBot.getEffectId() != this.getBaseItem().getEffectM()) { - if (roomBot.getEffectId() > 0) { - roomBot.setPreviousEffectId(roomBot.getEffectId(), roomBot.getPreviousEffectEndTimestamp()); - } - - roomBot.giveEffect(this.getBaseItem().getEffectM(), -1); - return; - } - - if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomBot.getEffectId() != this.getBaseItem().getEffectF()) { - if (roomBot.getEffectId() > 0) { - roomUnit.setPreviousEffectId(roomBot.getEffectId(), roomBot.getPreviousEffectEndTimestamp()); - } - - roomBot.giveEffect(this.getBaseItem().getEffectF(), -1); - } - } } @Override public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOff(roomUnit, room, objects); - - if (roomUnit != null) { - if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) { - int nextEffectM = 0; - int nextEffectF = 0; - int nextEffectDuration = -1; - - if (objects != null && objects.length == 2) { - if (objects[0] instanceof RoomTile goalTile && objects[1] instanceof RoomTile) { - RoomItem exclude = (objects[0] != objects[1]) ? this : null; - RoomItem topItem = room.getRoomItemManager().getTopItemAt(goalTile.getX(), goalTile.getY(), exclude); - - if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) { - return; - } - - if (topItem != null) { - nextEffectM = topItem.getBaseItem().getEffectM(); - nextEffectF = topItem.getBaseItem().getEffectF(); - } else if (roomUnit.getPreviousEffectId() > 0) { - nextEffectF = roomUnit.getPreviousEffectId(); - nextEffectM = roomUnit.getPreviousEffectId(); - nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); - } - } - } - - if (roomUnit.getRoomUnitType().equals(RoomUnitType.HABBO)) { - Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); - - if (habbo != null) { - - if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) { - habbo.getRoomUnit().giveEffect(nextEffectM, nextEffectDuration); - return; - } - - if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) { - habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration); - } - } - } else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) { - Bot bot = room.getRoomUnitManager().getRoomBotById(roomUnit.getVirtualId()); - - if (bot != null) { - if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) { - bot.getRoomUnit().giveEffect(nextEffectM, nextEffectDuration); - return; - } - - if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) { - bot.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration); - } - } - } - } - } } public boolean canToggle(Habbo habbo, Room room) { @@ -227,7 +119,7 @@ public class InteractionDefault extends RoomItem { RoomItem rentSpace = room.getRoomItemManager().getRoomItemById(habbo.getHabboStats().getRentedItemId()); - return rentSpace != null && RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())); + return rentSpace != null && RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getCurrentPosition().getX(), rentSpace.getCurrentPosition().getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDice.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDice.java index 6a9cdffe..8f983a3d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDice.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDice.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.plugin.events.furniture.FurnitureDiceRolledEvent; import com.eu.habbo.threading.runnables.RandomDiceNumber; @@ -15,8 +16,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class InteractionDice extends RoomItem { - public InteractionDice(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionDice(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public InteractionDice(ResultSet set, Item baseItem) throws SQLException { @@ -26,7 +27,7 @@ public class InteractionDice extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -46,14 +47,14 @@ public class InteractionDice extends RoomItem { super.onClick(client, room, objects); if (client != null) { - if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) { - if (!this.getExtradata().equalsIgnoreCase("-1")) { + if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) { + if (!this.getExtraData().equalsIgnoreCase("-1")) { FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1)); if (event.isCancelled()) return; - this.setExtradata("-1"); + this.setExtraData("-1"); room.updateItemState(this); Emulator.getThreading().run(this); @@ -74,7 +75,7 @@ public class InteractionDice extends RoomItem { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java index d4138670..e88ff3fd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGate.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.CloseGate; import java.sql.ResultSet; @@ -29,12 +30,12 @@ public class InteractionEffectGate extends InteractionDefault implements Conditi public InteractionEffectGate(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionEffectGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionEffectGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -61,7 +62,7 @@ public class InteractionEffectGate extends InteractionDefault implements Conditi super.onWalkOn(roomUnit, room, objects); if (this.canWalkOn(roomUnit, room, objects)) { - this.setExtradata("1"); + this.setExtraData("1"); room.updateItemState(this); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java index 9e321918..75781047 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -15,28 +16,28 @@ import java.sql.SQLException; public class InteractionEffectGiver extends InteractionDefault { public InteractionEffectGiver(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionEffectGiver(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionEffectGiver(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); - if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getX(), this.getY())) || - (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getY())) { + if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) || + (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getCurrentPosition().getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getCurrentPosition().getY())) { this.handle(room, client.getHabbo().getRoomUnit()); } } protected void handle(Room room, RoomUnit roomUnit) { - if (this.getExtradata().isEmpty()) this.setExtradata("0"); + if (this.getExtraData().isEmpty()) this.setExtraData("0"); - if (!this.getExtradata().equals("0")) return; + if (!this.getExtraData().equals("0")) return; RoomItem instance = this; @@ -45,11 +46,11 @@ public class InteractionEffectGiver extends InteractionDefault { } if (this.getBaseItem().getStateCount() > 1) { - this.setExtradata("1"); + this.setExtraData("1"); room.updateItem(this); Emulator.getThreading().run(() -> { - InteractionEffectGiver.this.setExtradata("0"); + InteractionEffectGiver.this.setExtraData("0"); room.updateItem(instance); }, 500); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java index 3504ef38..a89643ef 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -20,8 +21,8 @@ public class InteractionEffectTile extends InteractionPressurePlate { super(set, baseItem); } - public InteractionEffectTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionEffectTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java index d003bb94..50a30309 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectToggle.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,19 +14,19 @@ public class InteractionEffectToggle extends InteractionDefault { super(set, baseItem); } - public InteractionEffectToggle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionEffectToggle(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - if (this.getExtradata().isEmpty()) { - this.setExtradata("0"); + if (this.getExtraData().isEmpty()) { + this.setExtraData("0"); } if (client != null) { if (room.getRoomRightsManager().hasRights(client.getHabbo())) { - if (Integer.parseInt(this.getExtradata()) < this.getBaseItem().getStateCount() - 1) { + if (Integer.parseInt(this.getExtraData()) < this.getBaseItem().getStateCount() - 1) { if ((client.getHabbo().getHabboInfo().getGender() == HabboGender.M && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) || (client.getHabbo().getHabboInfo().getGender() == HabboGender.F && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectF())) { super.onClick(client, room, objects); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java index 91da5312..f579950b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,12 +11,12 @@ import java.sql.SQLException; public class InteractionEffectVendingMachine extends InteractionVendingMachine { public InteractionEffectVendingMachine(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionEffectVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionEffectVendingMachine(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java index ffd43e91..c7a77d10 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachineNoSides.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; @@ -12,12 +13,12 @@ import java.sql.SQLException; public class InteractionEffectVendingMachineNoSides extends InteractionVendingMachine { public InteractionEffectVendingMachineNoSides(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionEffectVendingMachineNoSides(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionEffectVendingMachineNoSides(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -31,7 +32,7 @@ public class InteractionEffectVendingMachineNoSides extends InteractionVendingMa THashSet tiles = new THashSet<>(); for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { - RoomTile tile = room.getLayout().getTile((short)(this.getX() + x), (short)(this.getY() + y)); + RoomTile tile = room.getLayout().getTile((short)(this.getCurrentPosition().getX() + x), (short)(this.getCurrentPosition().getY() + y)); if(tile != null) { tiles.add(tile); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java index 7be45959..b5c5e429 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class InteractionExternalImage extends RoomItem { super(set, baseItem); } - public InteractionExternalImage(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionExternalImage(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -37,7 +38,7 @@ public class InteractionExternalImage extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java index 89d7e53d..9ebe2cb2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFXBox.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; @@ -18,15 +19,15 @@ public class InteractionFXBox extends InteractionDefault { // this.setExtradata("0"); } - public InteractionFXBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionFXBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); // this.setExtradata("0"); } @Override public void onClick(GameClient client, Room room, Object[] objects) { - if (client != null && this.getOwnerId() == client.getHabbo().getHabboInfo().getId()) { - if(this.getExtradata().equals("1")) + if (client != null && this.getOwnerInfo().getId() == client.getHabbo().getHabboInfo().getId()) { + if (this.getExtraData().equals("1")) return; int effectId = -1; @@ -43,23 +44,23 @@ public class InteractionFXBox extends InteractionDefault { } } - if(effectId < 0) + if (effectId < 0) return; - if(client.getHabbo().getInventory().getEffectsComponent().ownsEffect(effectId)) + if (client.getHabbo().getInventory().getEffectsComponent().ownsEffect(effectId)) return; client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0); client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId); - this.setExtradata("1"); + this.setExtraData("1"); room.updateItemState(this); room.getRoomItemManager().removeRoomItem(this); RoomItem item = this; Emulator.getThreading().run(() -> { new QueryDeleteHabboItem(item.getId()).run(); room.sendComposer(new RemoveFloorItemComposer(item).compose()); - room.updateTile(room.getLayout().getTile(this.getX(), this.getY())); + room.updateTile(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); }, 500); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java index 777811bd..482005ae 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionFireworks.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import lombok.extern.slf4j.Slf4j; @@ -30,8 +31,8 @@ public class InteractionFireworks extends InteractionDefault { super(set, baseItem); } - public InteractionFireworks(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionFireworks(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -53,10 +54,10 @@ public class InteractionFireworks extends InteractionDefault { // Wireds can always detonate fireworks if charged if (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE) { - if (this.getExtradata().equalsIgnoreCase(STATE_CHARGED)) { + if (this.getExtraData().equalsIgnoreCase(STATE_CHARGED)) { super.onClick(client, room, objects); - if (this.getExtradata().equalsIgnoreCase(STATE_EXPLOSION)) { + if (this.getExtraData().equalsIgnoreCase(STATE_EXPLOSION)) { this.reCharge(room); } } @@ -70,7 +71,7 @@ public class InteractionFireworks extends InteractionDefault { // Habbos without rights have to walk to an adjecent tile to be able to detonate the fireworks if (!this.canToggle(client.getHabbo(), room)) { RoomTile closestTile = null; - for (RoomTile tile : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) { + for (RoomTile tile : room.getLayout().getTilesAround(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()))) { if (tile.isWalkable() && (closestTile == null || closestTile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()) > tile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()))) { closestTile = tile; } @@ -91,10 +92,10 @@ public class InteractionFireworks extends InteractionDefault { } } - if (this.getExtradata().equalsIgnoreCase(STATE_CHARGED)) { + if (this.getExtraData().equalsIgnoreCase(STATE_CHARGED)) { super.onClick(client, room, objects); - if (this.getExtradata().equalsIgnoreCase(STATE_EXPLOSION)) + if (this.getExtraData().equalsIgnoreCase(STATE_EXPLOSION)) { this.reCharge(room); AchievementManager.progressAchievement(client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("FireworksCharger")); @@ -110,13 +111,13 @@ public class InteractionFireworks extends InteractionDefault { @Override public void onPlace(Room room) { super.onPlace(room); - this.setExtradata(STATE_CHARGED); + this.setExtraData(STATE_CHARGED); } @Override public boolean canToggle(Habbo habbo, Room room) { return room.getRoomRightsManager().hasRights(habbo) || RoomLayout.tilesAdjecent( - room.getLayout().getTile(this.getX(), this.getY()), + room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), habbo.getRoomUnit().getCurrentPosition() ); } @@ -133,7 +134,7 @@ public class InteractionFireworks extends InteractionDefault { } Emulator.getThreading().run(() -> { - this.setExtradata(STATE_CHARGED); + this.setExtraData(STATE_CHARGED); this.needsUpdate(true); room.updateItemState(this); }, explodeDuration); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java index d22864bd..ec9eee39 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.ServerMessage; @@ -17,14 +18,14 @@ public class InteractionGate extends RoomItem { super(set, baseItem); } - public InteractionGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -34,7 +35,7 @@ public class InteractionGate extends RoomItem { } public boolean isWalkable() { - return this.getExtradata().equals("1"); + return this.getExtraData().equals("1"); } @Override @@ -44,16 +45,16 @@ public class InteractionGate extends RoomItem { if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !executedByWired) return; // If a Habbo is standing on a tile occupied by the gate, the gate shouldn't open/close - for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) + for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) if (room.getRoomUnitManager().hasHabbosAt(tile)) return; // Gate closed = 0, open = 1 - if (this.getExtradata().length() == 0) - this.setExtradata("0"); + if (this.getExtraData().length() == 0) + this.setExtraData("0"); - this.setExtradata((Integer.parseInt(this.getExtradata()) + 1) % 2 + ""); - room.updateTile(room.getLayout().getTile(this.getX(), this.getY())); + this.setExtraData((Integer.parseInt(this.getExtraData()) + 1) % 2 + ""); + room.updateTile(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); this.needsUpdate(true); room.updateItemState(this); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java index 991fbcd4..5498893e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -37,8 +38,8 @@ public class InteractionGift extends RoomItem { } } - public InteractionGift(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionGift(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); try { this.loadData(); @@ -91,8 +92,8 @@ public class InteractionGift extends RoomItem { private void loadData() throws NumberFormatException { String[] data = null; - if (this.getExtradata().contains("\t")) - data = this.getExtradata().split("\t"); + if (this.getExtraData().contains("\t")) + data = this.getExtraData().split("\t"); if (data != null && data.length >= 5) { int count = Integer.parseInt(data[0]); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupEffectTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupEffectTile.java index 721f252f..9e74799c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupEffectTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupEffectTile.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,8 +11,8 @@ public class InteractionGroupEffectTile extends InteractionEffectTile { super(set, baseItem); } - public InteractionGroupEffectTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionGroupEffectTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupPressurePlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupPressurePlate.java index 6aae5d31..7e1082b7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupPressurePlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGroupPressurePlate.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,8 +11,8 @@ public class InteractionGroupPressurePlate extends InteractionPressurePlate { super(set, baseItem); } - public InteractionGroupPressurePlate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionGroupPressurePlate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java index cc34a193..8646cead 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildFurni.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.guilds.Guild; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; @@ -23,8 +24,8 @@ public class InteractionGuildFurni extends InteractionDefault { this.guildId = set.getInt("guild_id"); } - public InteractionGuildFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionGuildFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.guildId = 0; } @@ -43,14 +44,14 @@ public class InteractionGuildFurni extends InteractionDefault { if (guild != null) { serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(5); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); serverMessage.appendString(guild.getId() + ""); serverMessage.appendString(guild.getBadge()); serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getSymbolColor(guild.getColorOne()).getValueA()); serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getBackgroundColor(guild.getColorTwo()).getValueA()); } else { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); } if (this.isLimited()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java index 802049a1..048c837a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGuildGate.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.CloseGate; import java.sql.ResultSet; @@ -17,12 +18,12 @@ import java.sql.SQLException; public class InteractionGuildGate extends InteractionGuildFurni implements ConditionalGate { public InteractionGuildGate(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionGuildGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionGuildGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -45,7 +46,7 @@ public class InteractionGuildGate extends InteractionGuildFurni implements Condi super.onWalkOn(roomUnit, room, objects); if (this.canWalkOn(roomUnit, room, objects)) { - this.setExtradata("1"); + this.setExtraData("1"); room.updateItemState(this); } } @@ -59,7 +60,7 @@ public class InteractionGuildGate extends InteractionGuildFurni implements Condi @Override public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) { - this.setExtradata("0"); + this.setExtraData("0"); room.updateItemState(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java index acf0813b..417cf5a0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java @@ -13,6 +13,7 @@ import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -25,8 +26,8 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC super(set, baseItem); } - public InteractionGymEquipment(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionGymEquipment(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -66,9 +67,9 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC this.reset(room); - if (roomUnit != null) { - Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); - RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY()); + if (roomUnit instanceof RoomAvatar roomAvatar) { + Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomAvatar); + RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomAvatar.getCurrentPosition().getX(), roomAvatar.getCurrentPosition().getY()); int nextEffectM = 0; int nextEffectF = 0; int nextEffectDuration = -1; @@ -76,23 +77,23 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC if (topItem != null) { nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectF = topItem.getBaseItem().getEffectF(); - } else if (roomUnit.getPreviousEffectId() > 0) { - nextEffectF = roomUnit.getPreviousEffectId(); - nextEffectM = roomUnit.getPreviousEffectId(); - nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); + } else if (roomAvatar.getPreviousEffectId() > 0) { + nextEffectF = roomAvatar.getPreviousEffectId(); + nextEffectM = roomAvatar.getPreviousEffectId(); + nextEffectDuration = roomAvatar.getPreviousEffectEndTimestamp(); } if (this.forceRotation()) { - roomUnit.setCanRotate(true); + roomAvatar.setCanRotate(true); } if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { - habbo.getRoomUnit().giveEffect(nextEffectM, nextEffectDuration, true); + roomAvatar.giveEffect(nextEffectM, nextEffectDuration, true); return; } if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) { - habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration, true); + roomAvatar.giveEffect(nextEffectF, nextEffectDuration, true); } } } @@ -175,7 +176,7 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC private void reset(Room room) { this.roomUnitId = -1; this.startTime = 0; - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java index 181698a7..77ec9e26 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.rooms.users.CarryObjectMessageComposer; import java.sql.ResultSet; @@ -18,24 +19,24 @@ public class InteractionHanditem extends InteractionDefault { super(set, baseItem); } - public InteractionHanditem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionHanditem(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); - if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getX(), this.getY())) || - (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getY())) { + if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) || + (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getCurrentPosition().getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getCurrentPosition().getY())) { this.handle(room, client.getHabbo().getRoomUnit()); } } protected void handle(Room room, RoomUnit roomUnit) { - if (this.getExtradata().isEmpty()) this.setExtradata("0"); + if (this.getExtraData().isEmpty()) this.setExtraData("0"); - if (!this.getExtradata().equals("0")) return; + if (!this.getExtraData().equals("0")) return; if(!(roomUnit instanceof RoomAvatar roomAvatar)) { return; @@ -46,11 +47,11 @@ public class InteractionHanditem extends InteractionDefault { room.sendComposer(new CarryObjectMessageComposer(roomAvatar).compose()); if (this.getBaseItem().getStateCount() > 1) { - this.setExtradata("1"); + this.setExtraData("1"); room.updateItem(this); Emulator.getThreading().run(() -> { - InteractionHanditem.this.setExtradata("0"); + InteractionHanditem.this.setExtraData("0"); room.updateItem(instance); }, 500); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java index 13e5d5d6..bf8c2bd0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,15 +14,15 @@ public class InteractionHanditemTile extends InteractionHanditem { super(set, baseItem); } - public InteractionHanditemTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionHanditemTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { InteractionHanditemTile instance = this; Emulator.getThreading().run(() -> { - if (roomUnit.getCurrentPosition().getX() == instance.getX() && roomUnit.getCurrentPosition().getY() == instance.getY()) { + if (roomUnit.getCurrentPosition().getX() == instance.getCurrentPosition().getX() && roomUnit.getCurrentPosition().getY() == instance.getCurrentPosition().getY()) { instance.handle(room, roomUnit); } }, 3000); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java index 9e3ab63a..b4a939e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHopper.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.hopper.HopperActionOne; @@ -16,18 +17,18 @@ import java.sql.SQLException; public class InteractionHopper extends RoomItem { public InteractionHopper(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionHopper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionHopper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -56,7 +57,7 @@ public class InteractionHopper extends RoomItem { if (loc != null) { if (this.canUseTeleport(client, loc, room)) { client.getHabbo().getRoomUnit().setTeleporting(true); - this.setExtradata("1"); + this.setExtraData("1"); room.updateItemState(this); Emulator.getThreading().run(new HopperActionOne(this, room, client), 500); @@ -69,13 +70,13 @@ public class InteractionHopper extends RoomItem { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } @Override public void run() { - if (!this.getExtradata().equals("0")) { - this.setExtradata("0"); + if (!this.getExtraData().equals("0")) { + this.setExtraData("0"); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); if (room != null) { @@ -95,7 +96,7 @@ public class InteractionHopper extends RoomItem { if (client.getHabbo().getRoomUnit().isTeleporting()) return false; - RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tile = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if(tile == null) { return false; @@ -104,6 +105,6 @@ public class InteractionHopper extends RoomItem { if (room.getRoomUnitManager().hasHabbosAt(tile)) return false; - return this.getExtradata().equals("0"); + return this.getExtraData().equals("0"); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java index b75412c2..2a508003 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.habboway.nux.InClientLinkMessageComposer; import gnu.trove.map.hash.THashMap; @@ -22,8 +23,8 @@ public class InteractionInformationTerminal extends InteractionCustomValues { super(set, baseItem, defaultValues); } - public InteractionInformationTerminal(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); + public InteractionInformationTerminal(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java index ccc4287c..f97e02cc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionJukeBox.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -15,14 +16,14 @@ public class InteractionJukeBox extends RoomItem { super(set, baseItem); } - public InteractionJukeBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionJukeBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -60,7 +61,7 @@ public class InteractionJukeBox extends RoomItem { @Override public void onPickUp(Room room) { super.onPickUp(room); - this.setExtradata("0"); + this.setExtraData("0"); room.getRoomTraxManager().removeTraxOnRoom(this); } @@ -69,7 +70,7 @@ public class InteractionJukeBox extends RoomItem { super.onPlace(room); room.getRoomTraxManager().addTraxOnRoom(this); if (room.getRoomTraxManager().isPlaying()) { - this.setExtradata("1"); + this.setExtraData("1"); } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionLoveLock.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionLoveLock.java index c676a9a4..630fad81 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionLoveLock.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionLoveLock.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.lovelock.FriendFurniStartConfirmationMessageComposer; @@ -24,8 +25,8 @@ public class InteractionLoveLock extends RoomItem { super(set, baseItem); } - public InteractionLoveLock(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionLoveLock(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -33,7 +34,7 @@ public class InteractionLoveLock extends RoomItem { serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(6); - String[] data = this.getExtradata().split("\t"); + String[] data = this.getExtraData().split("\t"); if (data.length == 6) { serverMessage.appendString("1"); @@ -71,13 +72,13 @@ public class InteractionLoveLock extends RoomItem { @Override public void onClick(GameClient client, Room room, Object[] objects) { - if (this.getExtradata().contains("\t")) + if (this.getExtraData().contains("\t")) return; if (client == null) return; - if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getX(), this.getY()))) { + if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()))) { if (this.userOneId == 0) { this.userOneId = client.getHabbo().getHabboInfo().getId(); client.sendResponse(new FriendFurniStartConfirmationMessageComposer(this)); @@ -95,7 +96,7 @@ public class InteractionLoveLock extends RoomItem { } public boolean lock(Habbo userOne, Habbo userTwo, Room room) { - RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tile = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if (RoomLayout.tilesAdjecent(userOne.getRoomUnit().getCurrentPosition(), tile) && RoomLayout.tilesAdjecent(userTwo.getRoomUnit().getCurrentPosition(), tile)) { String data = "1"; data += "\t"; @@ -109,7 +110,7 @@ public class InteractionLoveLock extends RoomItem { data += "\t"; data += Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR); - this.setExtradata(data); + this.setExtraData(data); this.needsUpdate(true); Emulator.getThreading().run(this); room.updateItem(this); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java index 18a26b93..6d9d71db 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java @@ -4,8 +4,9 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.clothingvalidation.ClothingValidationManager; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer; @@ -19,8 +20,8 @@ public class InteractionMannequin extends RoomItem { super(set, baseItem); } - public InteractionMannequin(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionMannequin(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -32,8 +33,8 @@ public class InteractionMannequin extends RoomItem { public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(3); - if (this.getExtradata().split(":").length >= 2) { - String[] data = this.getExtradata().split(":"); + if (this.getExtraData().split(":").length >= 2) { + String[] data = this.getExtraData().split(":"); serverMessage.appendString("GENDER"); serverMessage.appendString(data[0].toLowerCase()); serverMessage.appendString("FIGURE"); @@ -47,7 +48,7 @@ public class InteractionMannequin extends RoomItem { serverMessage.appendString(""); serverMessage.appendString("OUTFIT_NAME"); serverMessage.appendString("My Look"); - this.setExtradata("m: :My look"); + this.setExtraData("m: :My look"); this.needsUpdate(true); Emulator.getThreading().run(this); } @@ -66,7 +67,7 @@ public class InteractionMannequin extends RoomItem { @Override public void onClick(GameClient client, Room room, Object[] objects) { - String[] data = this.getExtradata().split(":"); + String[] data = this.getExtraData().split(":"); if(data.length < 2) return; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java index 9940030a..1d79a5e4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.ICycleable; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -18,8 +19,8 @@ public class InteractionMonsterCrackable extends InteractionCrackable implements super(set, baseItem); } - public InteractionMonsterCrackable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionMonsterCrackable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -46,9 +47,10 @@ public class InteractionMonsterCrackable extends InteractionCrackable implements @Override public void reset(Room room) { RoomTile tile = room.getRandomWalkableTile(); - this.setX(tile.getX()); - this.setY(tile.getY()); - this.setZ(room.getStackHeight(tile.getX(), tile.getY(), false)); + + this.setCurrentPosition(tile); + this.setCurrentZ(room.getStackHeight(tile.getX(), tile.getY(), false)); + super.reset(room); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMoodLight.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMoodLight.java index bd2c79cd..42474010 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMoodLight.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMoodLight.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomMoodlightData; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.map.TIntObjectMap; @@ -17,14 +18,14 @@ public class InteractionMoodLight extends RoomItem { super(set, baseItem); } - public InteractionMoodLight(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionMoodLight(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -49,7 +50,7 @@ public class InteractionMoodLight extends RoomItem { if (room != null) { for (RoomMoodlightData data : ((TIntObjectMap) room.getRoomInfo().getMoodLightData()).valueCollection()) { if (data.isEnabled()) { - this.setExtradata(data.toString()); + this.setExtraData(data.toString()); this.needsUpdate(true); room.updateItem(this); Emulator.getThreading().run(this); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java index 3095e6f0..2c6e09f2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java @@ -7,9 +7,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; -import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; @@ -19,8 +17,8 @@ import java.sql.SQLException; import java.util.Collection; public class InteractionMultiHeight extends RoomItem { - public InteractionMultiHeight(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionMultiHeight(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public InteractionMultiHeight(ResultSet set, Item baseItem) throws SQLException { @@ -30,7 +28,7 @@ public class InteractionMultiHeight extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -49,42 +47,47 @@ public class InteractionMultiHeight extends RoomItem { public void onClick(GameClient client, Room room, Object[] objects) throws Exception { super.onClick(client, room, objects); - if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !(objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE)) + if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !(objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE)) { return; + } - if (objects.length <= 0) { + if (objects.length == 0) { return; } if (objects[0] instanceof Integer && room != null) { - RoomItem topItem = room.getRoomItemManager().getTopItemAt(this.getX(), this.getY()); + RoomItem topItem = room.getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); + if (topItem != null && !topItem.equals(this)) { // multiheight items cannot change height even if there is a stackable item on top - no items allowed on top return; } this.needsUpdate(true); - if (this.getExtradata().length() == 0) - this.setExtradata("0"); + if (this.getExtraData().length() == 0) { + this.setExtraData("0"); + } if (this.getBaseItem().getMultiHeights().length > 0) { - this.setExtradata("" + (Integer.parseInt(this.getExtradata()) + 1) % (this.getBaseItem().getMultiHeights().length)); + this.setExtraData(String.valueOf((Integer.parseInt(this.getExtraData()) + 1) % (this.getBaseItem().getMultiHeights().length))); this.needsUpdate(true); - room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())); + room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())); room.updateItemState(this); } } } public void updateUnitsOnItem(Room room) { - THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); + THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); for(RoomTile tile : occupiedTiles) { Collection unitsOnItem = room.getRoomUnitManager().getRoomUnitsAt(room.getLayout().getTile(tile.getX(), tile.getY())); for (RoomUnit unit : unitsOnItem) { - if (unit.hasStatus(RoomUnitStatus.MOVE) && unit.getGoalLocation() != tile) { - continue; + if (unit.hasStatus(RoomUnitStatus.MOVE)) { + if (unit.getTargetPosition() != tile) { + continue; + } } if (this.getBaseItem().allowSit() || unit.hasStatus(RoomUnitStatus.SIT)) { @@ -92,8 +95,6 @@ public class InteractionMultiHeight extends RoomItem { unit.setStatusUpdateNeeded(true); } else { unit.setCurrentZ(unit.getCurrentPosition().getStackHeight()); - unit.setPreviousLocationZ(unit.getCurrentZ()); - unit.setStatusUpdateNeeded(true); } } } @@ -107,45 +108,11 @@ public class InteractionMultiHeight extends RoomItem { @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - - if (roomUnit != null - && (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) - && roomUnit.getRoomUnitType().equals(RoomUnitType.HABBO)) { - Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); - - if (habbo != null) { - if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) { - habbo.getRoomUnit().giveEffect(this.getBaseItem().getEffectM(), -1); - return; - } - - if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) { - habbo.getRoomUnit().giveEffect(this.getBaseItem().getEffectF(), -1); - } - } - } } @Override public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOff(roomUnit, room, objects); - - if (roomUnit != null - && (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) - && roomUnit.getRoomUnitType().equals(RoomUnitType.HABBO)) { - Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); - - if (habbo != null) { - if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) { - habbo.getRoomUnit().giveEffect(0, -1); - return; - } - - if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) { - habbo.getRoomUnit().giveEffect(0, -1); - } - } - } } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java index d81205aa..3cb5277f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMusicDisc.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import lombok.extern.slf4j.Slf4j; @@ -18,7 +19,7 @@ public class InteractionMusicDisc extends RoomItem { public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - String[] stuff = this.getExtradata().split("\n"); + String[] stuff = this.getExtraData().split("\n"); if (stuff.length >= 7 && !stuff[6].isEmpty()) { try { @@ -29,10 +30,10 @@ public class InteractionMusicDisc extends RoomItem { } } - public InteractionMusicDisc(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionMusicDisc(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); - String[] stuff = this.getExtradata().split("\n"); + String[] stuff = this.getExtraData().split("\n"); if (stuff.length >= 7 && !stuff[6].isEmpty()) { try { @@ -46,7 +47,7 @@ public class InteractionMusicDisc extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java index 8ff653eb..f0824698 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMuteArea.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.outgoing.rooms.items.ObjectDataUpdateMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.ObjectsMessageComposer; @@ -39,8 +40,8 @@ public class InteractionMuteArea extends InteractionCustomValues { tiles = new THashSet<>(); } - public InteractionMuteArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); + public InteractionMuteArea(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues); tiles = new THashSet<>(); } @@ -96,10 +97,10 @@ public class InteractionMuteArea extends InteractionCustomValues { } private void regenAffectedTiles(Room room) { - int minX = Math.max(0, this.getX() - Integer.parseInt(this.values.get("tilesBack"))); - int minY = Math.max(0, this.getY() - Integer.parseInt(this.values.get("tilesRight"))); - int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(this.values.get("tilesFront"))); - int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(this.values.get("tilesLeft"))); + int minX = Math.max(0, this.getCurrentPosition().getX() - Integer.parseInt(this.values.get("tilesBack"))); + int minY = Math.max(0, this.getCurrentPosition().getY() - Integer.parseInt(this.values.get("tilesRight"))); + int maxX = Math.min(room.getLayout().getMapSizeX(), this.getCurrentPosition().getX() + Integer.parseInt(this.values.get("tilesFront"))); + int maxY = Math.min(room.getLayout().getMapSizeY(), this.getCurrentPosition().getY() + Integer.parseInt(this.values.get("tilesLeft"))); this.tiles.clear(); @@ -129,10 +130,10 @@ public class InteractionMuteArea extends InteractionCustomValues { int id = 0; for(RoomTile tile : this.tiles) { id--; - RoomItem item = new InteractionDefault(id, -1, effectItem, "1", 0, 0); - item.setX(tile.getX()); - item.setY(tile.getY()); - item.setZ(tile.relativeHeight()); + RoomItem item = new InteractionDefault(id, null, effectItem, "1", 0, 0); + + item.setCurrentPosition(tile); + item.setCurrentZ(tile.relativeHeight()); items.add(item); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java index f31560db..b8516dda 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionNoSidesVendingMachine.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; @@ -13,8 +14,8 @@ public class InteractionNoSidesVendingMachine extends InteractionVendingMachine super(set, baseItem); } - public InteractionNoSidesVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionNoSidesVendingMachine(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -23,7 +24,7 @@ public class InteractionNoSidesVendingMachine extends InteractionVendingMachine THashSet tiles = new THashSet<>(); for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { - RoomTile tile = room.getLayout().getTile((short)(this.getX() + x), (short)(this.getY() + y)); + RoomTile tile = room.getLayout().getTile((short)(this.getCurrentPosition().getX() + x), (short)(this.getCurrentPosition().getY() + y)); if(tile != null) { tiles.add(tile); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java index c6969081..16752dbd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionObstacle.java @@ -13,6 +13,7 @@ import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; @@ -26,20 +27,20 @@ public class InteractionObstacle extends RoomItem implements ICycleable { public InteractionObstacle(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); this.middleTiles = new THashSet<>(); } - public InteractionObstacle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionObstacle(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); this.middleTiles = new THashSet<>(); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -155,12 +156,12 @@ public class InteractionObstacle extends RoomItem implements ICycleable { middleTiles.clear(); if(this.getRotation() == 2) { - middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), this.getY())); - middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), (short)(this.getY() + 1))); + middleTiles.add(room.getLayout().getTile((short)(this.getCurrentPosition().getX() + 1), this.getCurrentPosition().getY())); + middleTiles.add(room.getLayout().getTile((short)(this.getCurrentPosition().getX() + 1), (short)(this.getCurrentPosition().getY() + 1))); } else if(this.getRotation() == 4) { - middleTiles.add(room.getLayout().getTile(this.getX(), (short)(this.getY() + 1))); - middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), (short)(this.getY() + 1))); + middleTiles.add(room.getLayout().getTile(this.getCurrentPosition().getX(), (short)(this.getCurrentPosition().getY() + 1))); + middleTiles.add(room.getLayout().getTile((short)(this.getCurrentPosition().getX() + 1), (short)(this.getCurrentPosition().getY() + 1))); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java index 934f166e..f66f4939 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.ServerMessage; @@ -23,12 +24,12 @@ public class InteractionOneWayGate extends RoomItem { public InteractionOneWayGate(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionOneWayGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionOneWayGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -48,13 +49,13 @@ public class InteractionOneWayGate extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { - if (this.getExtradata().length() == 0) { - this.setExtradata("0"); + if (this.getExtraData().length() == 0) { + this.setExtraData("0"); this.needsUpdate(true); } serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -64,11 +65,11 @@ public class InteractionOneWayGate extends RoomItem { super.onClick(client, room, objects); if (client != null) { - RoomTile tileInfront = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation()); + RoomTile tileInfront = room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), this.getRotation()); if (tileInfront == null) return; - RoomTile currentLocation = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile currentLocation = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if (currentLocation == null) return; @@ -83,7 +84,7 @@ public class InteractionOneWayGate extends RoomItem { onSuccess.add(() -> { unit.setCanLeaveRoomByDoor(false); walkable = this.getBaseItem().allowWalk(); - RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation() + 4); + RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), this.getRotation() + 4); unit.setGoalLocation(tile); Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onFail, onFail)); @@ -122,14 +123,14 @@ public class InteractionOneWayGate extends RoomItem { } private void refresh(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); room.sendComposer(new DiceValueMessageComposer(this.getId(), 0).compose()); - room.updateTile(room.getLayout().getTile(this.getX(), this.getY())); + room.updateTile(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); } @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); this.refresh(room); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPostIt.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPostIt.java index 94e2dd3d..f9a31eb7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPostIt.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPostIt.java @@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -16,8 +17,8 @@ public class InteractionPostIt extends RoomItem { super(set, baseItem); } - public InteractionPostIt(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPostIt(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -38,7 +39,7 @@ public class InteractionPostIt extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata().replace(((char) 9) + "", "")); + serverMessage.appendString(this.getExtraData().replace(((char) 9) + "", "")); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPoster.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPoster.java index c58d0a40..2b5d2180 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPoster.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPoster.java @@ -2,16 +2,17 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; import java.sql.SQLException; public class InteractionPoster extends RoomItem { - public InteractionPoster(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPoster(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public InteractionPoster(ResultSet set, Item baseItem) throws SQLException { @@ -36,7 +37,7 @@ public class InteractionPoster extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java index 137466af..6af9943d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; @@ -15,12 +16,12 @@ import java.util.HashSet; public class InteractionPressurePlate extends InteractionDefault { public InteractionPressurePlate(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionPressurePlate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionPressurePlate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -66,7 +67,7 @@ public class InteractionPressurePlate extends InteractionDefault { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } public void updateState(Room room) { @@ -74,7 +75,7 @@ public class InteractionPressurePlate extends InteractionDefault { if (room == null || room.getLayout() == null || this.getBaseItem() == null) return; - RoomTile tileAtItem = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tileAtItem = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if (tileAtItem == null) return; @@ -95,7 +96,7 @@ public class InteractionPressurePlate extends InteractionDefault { } } - this.setExtradata(occupied ? "1" : "0"); + this.setExtraData(occupied ? "1" : "0"); room.updateItemState(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java index 6e8a1d67..ab19efe7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPushable.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.KickBallAction; import java.sql.ResultSet; @@ -21,12 +22,12 @@ public abstract class InteractionPushable extends InteractionDefault { public InteractionPushable(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionPushable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionPushable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -64,7 +65,7 @@ public abstract class InteractionPushable extends InteractionDefault { super.onClick(client, room, objects); if (client == null) return; - if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getX(), this.getY()))) { + if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()))) { int velocity = this.getTackleVelocity(client.getHabbo().getRoomUnit(), room); RoomRotation direction = this.getWalkOnDirection(client.getHabbo().getRoomUnit(), room); this.onTackle(room, client.getHabbo().getRoomUnit(), velocity, direction); @@ -87,7 +88,7 @@ public abstract class InteractionPushable extends InteractionDefault { boolean isDrag = false; RoomRotation direction; - if (this.getX() == roomUnit.getGoalLocation().getX() && this.getY() == roomUnit.getGoalLocation().getY()) //User clicked on the tile the ball is on, they want to kick it + if (this.getCurrentPosition().getX() == roomUnit.getTargetPosition().getX() && this.getCurrentPosition().getY() == roomUnit.getTargetPosition().getY()) //User clicked on the tile the ball is on, they want to kick it { velocity = this.getWalkOnVelocity(roomUnit, room); direction = this.getWalkOnDirection(roomUnit, room); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java index 77412e64..04679175 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; @@ -19,35 +20,35 @@ public class InteractionPuzzleBox extends RoomItem { super(set, baseItem); } - public InteractionPuzzleBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPuzzleBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - RoomTile boxLocation = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile boxLocation = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); RoomRotation rotation = null; - if (this.getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX()) { - if (this.getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() + 1) { + if (this.getCurrentPosition().getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX()) { + if (this.getCurrentPosition().getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() + 1) { rotation = RoomRotation.SOUTH; } else { - if (this.getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() - 1) { + if (this.getCurrentPosition().getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() - 1) { rotation = RoomRotation.NORTH; } } } else { - if (this.getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY()) { - if (this.getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX() + 1) { + if (this.getCurrentPosition().getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY()) { + if (this.getCurrentPosition().getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX() + 1) { rotation = RoomRotation.EAST; - } else if (this.getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX() - 1) { + } else if (this.getCurrentPosition().getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX() - 1) { rotation = RoomRotation.WEST; } } } if (rotation == null) { - RoomTile nearestTile = client.getHabbo().getRoomUnit().getClosestAdjacentTile(this.getX(), this.getY(), false); + RoomTile nearestTile = client.getHabbo().getRoomUnit().getClosestAdjacentTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), false); if (nearestTile != null) client.getHabbo().getRoomUnit().setGoalLocation(nearestTile); return; @@ -55,7 +56,7 @@ public class InteractionPuzzleBox extends RoomItem { super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); - RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), rotation.getValue()); + RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), rotation.getValue()); if (tile == null || tile.getState() == RoomTileState.INVALID || room.getRoomUnitManager().hasHabbosAt(tile)) { return; @@ -69,8 +70,9 @@ public class InteractionPuzzleBox extends RoomItem { if (item != null && !room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY()).getBaseItem().allowStack()) return; - this.setZ(room.getStackHeight(tile.getX(), tile.getY(), false)); + this.setCurrentZ(room.getStackHeight(tile.getX(), tile.getY(), false)); this.needsUpdate(true); + room.updateItem(this); room.scheduledComposers.add(new FloorItemOnRollerComposer(this, null, tile, 0, room).compose()); @@ -85,7 +87,7 @@ public class InteractionPuzzleBox extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java index d9998149..150c90ef 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPyramid.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -16,26 +17,26 @@ public class InteractionPyramid extends InteractionGate { super(set, baseItem); } - public InteractionPyramid(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPyramid(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public void change(Room room) { - if (!(this.getExtradata().equals("0") || this.getExtradata().equals("1"))) - this.setExtradata("0"); + if (!(this.getExtraData().equals("0") || this.getExtraData().equals("1"))) + this.setExtraData("0"); if (room != null) { - RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tile = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if(tile == null) { return; } if (!room.getRoomUnitManager().hasHabbosAt(tile)) { - int state = Integer.parseInt(this.getExtradata()); + int state = Integer.parseInt(this.getExtraData()); state = Math.abs(state - 1); - this.setExtradata(state + ""); + this.setExtraData(state + ""); room.updateItemState(this); this.nextChange = Emulator.getIntUnixTimestamp() + 1 + (Emulator.getRandom().nextInt(Emulator.getConfig().getInt("pyramids.max.delay"))); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java index 2178ccef..7a4e42c2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRandomState.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.RandomStateParams; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,28 +14,28 @@ public class InteractionRandomState extends InteractionDefault { super(set, baseItem); } - public InteractionRandomState(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionRandomState(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onPlace(Room room) { super.onPlace(room); - this.setExtradata(""); + this.setExtraData(""); room.updateItemState(this); } public void onRandomStateClick(Room room) throws Exception { RandomStateParams params = new RandomStateParams(this.getBaseItem().getCustomParams()); - this.setExtradata(""); + this.setExtraData(""); room.updateItemState(this); int randomState = Emulator.getRandom().nextInt(params.getStates()) + 1; Emulator.getThreading().run(() -> { - this.setExtradata(randomState + ""); + this.setExtraData(randomState + ""); room.updateItemState(this); }, params.getDelay()); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRedeemableSubscriptionBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRedeemableSubscriptionBox.java index 250d7504..95c2f938 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRedeemableSubscriptionBox.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRedeemableSubscriptionBox.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,8 +11,8 @@ public class InteractionRedeemableSubscriptionBox extends InteractionCrackable { super(set, baseItem); } - public InteractionRedeemableSubscriptionBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionRedeemableSubscriptionBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public boolean userRequiredToBeAdjacent() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java index fa1ea0fa..a12142b9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRentableSpace.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceStatusMessageComposer; import com.eu.habbo.threading.runnables.ClearRentedSpace; @@ -66,15 +67,15 @@ public class InteractionRentableSpace extends RoomItem { } } - public InteractionRentableSpace(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionRentableSpace(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.renterName = ""; } @Override public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { - if (this.getExtradata().isEmpty()) + if (this.getExtraData().isEmpty()) return false; Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); @@ -109,8 +110,8 @@ public class InteractionRentableSpace extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { - if (this.getExtradata().isEmpty()) - this.setExtradata("0:0"); + if (this.getExtraData().isEmpty()) + this.setExtraData("0:0"); serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0)); @@ -156,17 +157,17 @@ public class InteractionRentableSpace extends RoomItem { if (room == null) return; - Rectangle rect = RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); + Rectangle rect = RoomLayout.getRectangle(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); THashSet items = new THashSet<>(); for (int i = rect.x; i < rect.x + rect.getWidth(); i++) { for (int j = rect.y; j < rect.y + rect.getHeight(); j++) { - items.addAll(room.getRoomItemManager().getItemsAt(i, j, this.getZ())); + items.addAll(room.getRoomItemManager().getItemsAt(i, j, this.getCurrentZ())); } } for (RoomItem item : items) { - if (item.getOwnerId() == this.renterId) { + if (item.getOwnerInfo().getId() == this.renterId) { room.getRoomItemManager().pickUpItem(item, null); } } @@ -196,7 +197,7 @@ public class InteractionRentableSpace extends RoomItem { } @Override - public String getExtradata() { + public String getExtraData() { return this.renterId + ":" + this.endTimestamp; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java index 267cd835..d146d843 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; import org.apache.commons.math3.util.Pair; @@ -20,18 +21,18 @@ public class InteractionRoller extends RoomItem { public InteractionRoller(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionRoller(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionRoller(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java index a09f2fd5..3b6329ea 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.map.hash.THashMap; import java.sql.ResultSet; @@ -22,8 +23,8 @@ public class InteractionRoomAds extends InteractionCustomValues { super(set, baseItem, defaultValues); } - public InteractionRoomAds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); + public InteractionRoomAds(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubGate.java index 834a8e8e..808f26a1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubGate.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer; import com.eu.habbo.threading.runnables.CloseGate; @@ -16,12 +17,12 @@ import java.sql.SQLException; public class InteractionRoomClubGate extends InteractionDefault implements ConditionalGate { public InteractionRoomClubGate(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionRoomClubGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionRoomClubGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -41,7 +42,7 @@ public class InteractionRoomClubGate extends InteractionDefault implements Condi super.onWalkOn(roomUnit, room, objects); if (this.canWalkOn(roomUnit, room, objects)) { - this.setExtradata("1"); + this.setExtraData("1"); room.updateItemState(this); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubHopper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubHopper.java index 51936c4c..0ebcc7e7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubHopper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubHopper.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class InteractionRoomClubHopper extends InteractionHopper { super(set, baseItem); } - public InteractionRoomClubHopper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionRoomClubHopper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubTeleportTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubTeleportTile.java index 12a228a0..e6e940b6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubTeleportTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomClubTeleportTile.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -14,8 +15,8 @@ public class InteractionRoomClubTeleportTile extends InteractionTeleportTile { super(set, baseItem); } - public InteractionRoomClubTeleportTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionRoomClubTeleportTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomOMatic.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomOMatic.java index 8384d916..65f58760 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomOMatic.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomOMatic.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.navigator.NoOwnedRoomsAlertMessageComposer; import java.sql.ResultSet; @@ -13,8 +14,8 @@ public class InteractionRoomOMatic extends InteractionDefault { super(set, baseItem); } - public InteractionRoomOMatic(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionRoomOMatic(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java index 731b1483..fe64e06e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java @@ -9,8 +9,8 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; -import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.set.hash.THashSet; import java.awt.*; @@ -18,8 +18,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class InteractionSnowboardSlope extends InteractionMultiHeight { - public InteractionSnowboardSlope(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionSnowboardSlope(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public InteractionSnowboardSlope(ResultSet set, Item baseItem) throws SQLException { @@ -27,19 +27,13 @@ public class InteractionSnowboardSlope extends InteractionMultiHeight { } @Override - public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { - if(roomUnit instanceof RoomAvatar roomAvatar) { - roomAvatar.giveEffect(97, -1); - } + public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { + super.onWalkOn(roomUnit, room, objects); } @Override public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOff(roomUnit, room, objects); - - if (roomUnit instanceof RoomAvatar roomAvatar && roomAvatar.getEffectId() == 97) { - roomAvatar.giveEffect(0, -1); - } } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSpinningBottle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSpinningBottle.java index b47baa1b..e1e21051 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSpinningBottle.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSpinningBottle.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.plugin.events.furniture.FurnitureDiceRolledEvent; import com.eu.habbo.threading.runnables.RandomSpinningBottleNumber; @@ -15,8 +16,8 @@ import java.sql.ResultSet; import java.sql.SQLException; public class InteractionSpinningBottle extends RoomItem { - public InteractionSpinningBottle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionSpinningBottle(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public InteractionSpinningBottle(ResultSet set, Item baseItem) throws SQLException { @@ -26,7 +27,7 @@ public class InteractionSpinningBottle extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -46,14 +47,14 @@ public class InteractionSpinningBottle extends RoomItem { super.onClick(client, room, objects); if (client != null) { - if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) { - if (!this.getExtradata().equalsIgnoreCase("-1")) { + if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) { + if (!this.getExtraData().equalsIgnoreCase("-1")) { FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1)); if (event.isCancelled()) return; - this.setExtradata("-1"); + this.setExtraData("-1"); room.updateItemState(this); Emulator.getThreading().run(this); @@ -74,7 +75,7 @@ public class InteractionSpinningBottle extends RoomItem { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java index 7c6cd846..71557ba1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java @@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class InteractionStackHelper extends RoomItem { super(set, baseItem); } - public InteractionStackHelper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionStackHelper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -36,7 +37,7 @@ public class InteractionStackHelper extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStickyPole.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStickyPole.java index cd434e5f..96024d2f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStickyPole.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStickyPole.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,7 +11,7 @@ public class InteractionStickyPole extends InteractionDefault { super(set, baseItem); } - public InteractionStickyPole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionStickyPole(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java index 5bac0dc9..d23b1791 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import java.sql.ResultSet; @@ -19,13 +20,13 @@ public class InteractionSwitch extends InteractionDefault { super(set, baseItem); } - public InteractionSwitch(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionSwitch(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public boolean canToggle(Habbo habbo, Room room) { - return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), habbo.getRoomUnit().getCurrentPosition()); + return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), habbo.getRoomUnit().getCurrentPosition()); } @Override @@ -45,7 +46,7 @@ public class InteractionSwitch extends InteractionDefault { if (!this.canToggle(client.getHabbo(), room)) { RoomTile closestTile = null; - for (RoomTile tile : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) { + for (RoomTile tile : room.getLayout().getTilesAround(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()))) { if (tile.isWalkable() && (closestTile == null || closestTile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()) > tile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()))) { closestTile = tile; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java index 2bc51667..c5da00e3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitchRemoteControl.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import lombok.extern.slf4j.Slf4j; import java.sql.ResultSet; @@ -16,13 +17,13 @@ public class InteractionSwitchRemoteControl extends InteractionDefault { super(set, baseItem); } - public InteractionSwitchRemoteControl(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionSwitchRemoteControl(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public boolean canToggle(Habbo habbo, Room room) { - return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), habbo.getRoomUnit().getCurrentPosition()); + return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), habbo.getRoomUnit().getCurrentPosition()); } @Override @@ -40,19 +41,19 @@ public class InteractionSwitchRemoteControl extends InteractionDefault { if (room != null) { super.onClick(client, room, objects); - if (this.getExtradata().length() == 0) - this.setExtradata("0"); + if (this.getExtraData().length() == 0) + this.setExtraData("0"); if (this.getBaseItem().getStateCount() > 0) { int currentState = 0; try { - currentState = Integer.parseInt(this.getExtradata()); + currentState = Integer.parseInt(this.getExtraData()); } catch (NumberFormatException e) { - log.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")"); + log.error("Incorrect extradata (" + this.getExtraData() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")"); } - this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount()); + this.setExtraData("" + (currentState + 1) % this.getBaseItem().getStateCount()); this.needsUpdate(true); room.updateItemState(this); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTalkingFurniture.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTalkingFurniture.java index c958a9d4..6d7be0ce 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTalkingFurniture.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTalkingFurniture.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,7 +11,7 @@ public class InteractionTalkingFurniture extends InteractionDefault { super(set, baseItem); } - public InteractionTalkingFurniture(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTalkingFurniture(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java index 87fda1d2..9c209f90 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import com.eu.habbo.threading.runnables.teleport.TeleportActionOne; @@ -27,19 +28,19 @@ public class InteractionTeleport extends RoomItem { public InteractionTeleport(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); walkable = baseItem.allowWalk(); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionTeleport(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTeleport(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); walkable = item.allowWalk(); - this.setExtradata("0"); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -73,7 +74,7 @@ public class InteractionTeleport extends RoomItem { return; } - RoomTile currentItemLocation = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile currentItemLocation = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if (currentItemLocation == null) { return; @@ -97,7 +98,7 @@ public class InteractionTeleport extends RoomItem { } else if (roomHabbo.getCurrentPosition().equals(currentItemLocation) || roomHabbo.getCurrentPosition().equals(inFrontTile)) { // set state 1 and walk on item this.roomUnitID = roomHabbo.getVirtualId(); - this.setExtradata("1"); + this.setExtraData("1"); room.updateItemState(this); roomHabbo.setGoalLocation(inFrontTile); @@ -115,7 +116,7 @@ public class InteractionTeleport extends RoomItem { onFail.add(() -> { this.walkable = this.getBaseItem().allowWalk(); room.updateTile(currentItemLocation); - this.setExtradata("0"); + this.setExtraData("0"); room.updateItemState(this); this.roomUnitID = -1; roomHabbo.removeOverrideTile(currentItemLocation); @@ -155,8 +156,8 @@ public class InteractionTeleport extends RoomItem { @Override public void run() { - if (!this.getExtradata().equals("0")) { - this.setExtradata("0"); + if (!this.getExtraData().equals("0")) { + this.setExtraData("0"); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); if (room != null) { @@ -171,7 +172,7 @@ public class InteractionTeleport extends RoomItem { this.targetId = 0; this.targetRoomId = 0; this.roomUnitID = -1; - this.setExtradata("0"); + this.setExtraData("0"); } public int getTargetId() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleportTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleportTile.java index 9dff7a27..53aac853 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleportTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleportTile.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,8 +14,8 @@ public class InteractionTeleportTile extends InteractionTeleport { super(set, baseItem); } - public InteractionTeleportTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTeleportTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTent.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTent.java index e295e4b2..fb2653ba 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTent.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTent.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -12,8 +13,8 @@ public class InteractionTent extends InteractionDefault { super(set, baseItem); } - public InteractionTent(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTent(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java index 22ee08b2..f6cc49e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTileEffectProvider.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.map.hash.THashMap; import java.sql.ResultSet; @@ -20,8 +21,8 @@ public class InteractionTileEffectProvider extends InteractionCustomValues { super(set, baseItem, defaultValues); } - public InteractionTileEffectProvider(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); + public InteractionTileEffectProvider(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java index a02d58ff..66bac372 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -16,13 +17,13 @@ public class InteractionTrap extends InteractionDefault { super(set, baseItem); } - public InteractionTrap(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTrap(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { - if (this.getExtradata().equals("0") || roomUnit == null || room.getRoomUnitManager().getHabboByRoomUnit(roomUnit) == null) return; + if (this.getExtraData().equals("0") || roomUnit == null || room.getRoomUnitManager().getHabboByRoomUnit(roomUnit) == null) return; Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrophy.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrophy.java index 80f2c39c..6a9f93c4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrophy.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrophy.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -10,8 +11,8 @@ public class InteractionTrophy extends InteractionDefault { super(set, baseItem); } - public InteractionTrophy(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTrophy(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 1249d52a..c002bbcf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -12,6 +12,7 @@ import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; @@ -26,12 +27,12 @@ import java.util.List; public class InteractionVendingMachine extends RoomItem { public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionVendingMachine(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } public THashSet getActivatorTiles(Room room) { @@ -41,14 +42,14 @@ public class InteractionVendingMachine extends RoomItem { if (tileInFront != null) tiles.add(tileInFront); - tiles.add(room.getLayout().getTile(this.getX(), this.getY())); + tiles.add(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); return tiles; } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -77,7 +78,7 @@ public class InteractionVendingMachine extends RoomItem { return; } - this.setExtradata("1"); + this.setExtraData("1"); room.updateItem(this); try { @@ -159,8 +160,8 @@ public class InteractionVendingMachine extends RoomItem { @Override public void run() { super.run(); - if (this.getExtradata().equals("1")) { - this.setExtradata("0"); + if (this.getExtraData().equals("1")) { + this.setExtraData("0"); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); if (room != null) { room.updateItem(this); @@ -184,7 +185,7 @@ public class InteractionVendingMachine extends RoomItem { } private void rotateToMachine(RoomUnit unit) { - RoomRotation rotation = RoomRotation.values()[Rotation.Calculate(unit.getCurrentPosition().getX(), unit.getCurrentPosition().getY(), this.getX(), this.getY())]; + RoomRotation rotation = RoomRotation.values()[Rotation.Calculate(unit.getCurrentPosition().getX(), unit.getCurrentPosition().getY(), this.getCurrentPosition().getX(), this.getCurrentPosition().getY())]; if(Math.abs(unit.getBodyRotation().getValue() - rotation.getValue()) > 1) { unit.setRotation(rotation); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java index 11f9d80c..43b095e9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVikingCotie.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -14,23 +15,23 @@ public class InteractionVikingCotie extends InteractionDefault { super(set, baseItem); } - public InteractionVikingCotie(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionVikingCotie(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onClick(GameClient client, Room room, Object[] objects) { - if (this.getExtradata().isEmpty()) { - this.setExtradata("0"); + if (this.getExtraData().isEmpty()) { + this.setExtraData("0"); } - if (client != null && client.getHabbo().getHabboInfo().getId() == this.getOwnerId()) { + if (client != null && client.getHabbo().getHabboInfo().getId() == this.getOwnerInfo().getId()) { if (client.getHabbo().getRoomUnit().getEffectId() == 172 || client.getHabbo().getRoomUnit().getEffectId() == 173) { - int state = Integer.parseInt(this.getExtradata()); + int state = Integer.parseInt(this.getExtraData()); if (state < 5) { state++; - this.setExtradata(state + ""); + this.setExtraData(state + ""); room.updateItem(this); if (state == 5) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVoteCounter.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVoteCounter.java index d77c5307..6f4cfee2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVoteCounter.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVoteCounter.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.ServerMessage; @@ -21,18 +22,18 @@ public class InteractionVoteCounter extends RoomItem { public InteractionVoteCounter(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - if(!this.getExtradata().contains(",")) { - this.setExtradata("1,0"); // frozen,votes + if(!this.getExtraData().contains(",")) { + this.setExtraData("1,0"); // frozen,votes } - String[] bits = this.getExtradata().split(","); + String[] bits = this.getExtraData().split(","); frozen = bits[0].equals("1"); votes = Integer.parseInt(bits[1]); votedUsers = new ArrayList<>(); } - public InteractionVoteCounter(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionVoteCounter(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); if(!extradata.contains(",")) { extradata = "1,0"; @@ -63,7 +64,7 @@ public class InteractionVoteCounter extends RoomItem { } private void updateExtradata() { - this.setExtradata((this.frozen ? "1" : "0") + "," + this.votes); + this.setExtraData((this.frozen ? "1" : "0") + "," + this.votes); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java index f032fd25..a91eb450 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java @@ -11,6 +11,7 @@ import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.set.hash.THashSet; import org.apache.commons.math3.util.Pair; @@ -32,8 +33,8 @@ public class InteractionWater extends InteractionDefault { this.isInRoom = this.getRoomId() != 0; } - public InteractionWater(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionWater(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.isDeepWater = false; this.isInRoom = this.getRoomId() != 0; } @@ -89,7 +90,7 @@ public class InteractionWater extends InteractionDefault { return; if (!pet.getRoomUnit().hasStatus(RoomUnitStatus.SWIM) && pet.getPetData().isCanSwim()) { - pet.getRoomUnit().setStatus(RoomUnitStatus.SWIM, ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.SWIM, ""); } } @@ -206,55 +207,63 @@ public class InteractionWater extends InteractionDefault { byte _12 = 0; // Check if we are touching a water tile. - if (this.isValidForMask(room, this.getX() - 1, this.getY() - 1, this.getZ(), true)) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() - 1, this.getCurrentPosition().getY() - 1, this.getCurrentZ(), true)) { _1 = 1; } - if (this.isValidForMask(room, this.getX(), this.getY() - 1, this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX(), this.getCurrentPosition().getY() - 1, this.getCurrentZ())) { _2 = 1; } - if (this.isValidForMask(room, this.getX() + 1, this.getY() - 1, this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() + 1, this.getCurrentPosition().getY() - 1, this.getCurrentZ())) { _3 = 1; } - if (this.isValidForMask(room, this.getX() + 2, this.getY() - 1, this.getZ(), true)) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() + 2, this.getCurrentPosition().getY() - 1, this.getCurrentZ(), true)) { _4 = 1; } - if (this.isValidForMask(room, this.getX() - 1, this.getY(), this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() - 1, this.getCurrentPosition().getY(), this.getCurrentZ())) { _5 = 1; } - if (this.isValidForMask(room, this.getX() + 2, this.getY(), this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() + 2, this.getCurrentPosition().getY(), this.getCurrentZ())) { _6 = 1; } - if (this.isValidForMask(room, this.getX() - 1, this.getY() + 1, this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() - 1, this.getCurrentPosition().getY() + 1, this.getCurrentZ())) { _7 = 1; } - if (this.isValidForMask(room, this.getX() + 2, this.getY() + 1, this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() + 2, this.getCurrentPosition().getY() + 1, this.getCurrentZ())) { _8 = 1; } - if (this.isValidForMask(room, this.getX() - 1, this.getY() + 2, this.getZ(), true)) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() - 1, this.getCurrentPosition().getY() + 2, this.getCurrentZ(), true)) { _9 = 1; } - if (this.isValidForMask(room, this.getX(), this.getY() + 2, this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX(), this.getCurrentPosition().getY() + 2, this.getCurrentZ())) { _10 = 1; } - if (this.isValidForMask(room, this.getX() + 1, this.getY() + 2, this.getZ())) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() + 1, this.getCurrentPosition().getY() + 2, this.getCurrentZ())) { _11 = 1; } - if (this.isValidForMask(room, this.getX() + 2, this.getY() + 2, this.getZ(), true)) { + if (this.isValidForMask(room, this.getCurrentPosition().getX() + 2, this.getCurrentPosition().getY() + 2, this.getCurrentZ(), true)) { _12 = 1; } // Check if we are touching invalid tiles. // if (_1 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() -1))) _1 = 1; - if (_2 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() - 1))) _2 = 1; - if (_3 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() - 1))) _3 = 1; + if (_2 == 0 && room.getLayout().isVoidTile(this.getCurrentPosition().getX(), (short) (this.getCurrentPosition().getY() - 1))) + _2 = 1; + if (_3 == 0 && room.getLayout().isVoidTile((short) (this.getCurrentPosition().getX() + 1), (short) (this.getCurrentPosition().getY() - 1))) + _3 = 1; // if (_4 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() - 1))) _4 = 1; - if (_5 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), this.getY())) _5 = 1; - if (_6 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), this.getY())) _6 = 1; - if (_7 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), (short) (this.getY() + 1))) _7 = 1; - if (_8 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 1))) _8 = 1; + if (_5 == 0 && room.getLayout().isVoidTile((short) (this.getCurrentPosition().getX() - 1), this.getCurrentPosition().getY())) + _5 = 1; + if (_6 == 0 && room.getLayout().isVoidTile((short) (this.getCurrentPosition().getX() + 2), this.getCurrentPosition().getY())) + _6 = 1; + if (_7 == 0 && room.getLayout().isVoidTile((short) (this.getCurrentPosition().getX() - 1), (short) (this.getCurrentPosition().getY() + 1))) + _7 = 1; + if (_8 == 0 && room.getLayout().isVoidTile((short) (this.getCurrentPosition().getX() + 2), (short) (this.getCurrentPosition().getY() + 1))) + _8 = 1; // if (_9 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() + 2))) _9 = 1; - if (_10 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() + 2))) _10 = 1; - if (_11 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() + 2))) _11 = 1; + if (_10 == 0 && room.getLayout().isVoidTile(this.getCurrentPosition().getX(), (short) (this.getCurrentPosition().getY() + 2))) + _10 = 1; + if (_11 == 0 && room.getLayout().isVoidTile((short) (this.getCurrentPosition().getX() + 1), (short) (this.getCurrentPosition().getY() + 2))) + _11 = 1; // if (_12 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 2))) _12 = 1; // Update water. @@ -273,8 +282,8 @@ public class InteractionWater extends InteractionDefault { String updatedData = String.valueOf(result); - if (!this.getExtradata().equals(updatedData)) { - this.setExtradata(updatedData); + if (!this.getExtraData().equals(updatedData)) { + this.setExtraData(updatedData); this.needsUpdate(true); room.updateItem(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java index 6573f64b..0be5c28b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.set.hash.THashSet; import java.awt.*; @@ -17,8 +18,8 @@ public class InteractionWaterItem extends InteractionMultiHeight { super(set, baseItem); } - public InteractionWaterItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionWaterItem(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -30,7 +31,7 @@ public class InteractionWaterItem extends InteractionMultiHeight { @Override public void onPickUp(Room room) { super.onPickUp(room); - this.setExtradata("0"); + this.setExtraData("0"); this.needsUpdate(true); } @@ -79,8 +80,8 @@ public class InteractionWaterItem extends InteractionMultiHeight { // Update data if changed. String updatedData = foundWater ? "1" : "0"; - if (!this.getExtradata().equals(updatedData)) { - this.setExtradata(updatedData); + if (!this.getExtraData().equals(updatedData)) { + this.setExtraData(updatedData); this.needsUpdate(true); room.updateItemState(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java index 78af151f..176fc794 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.IWiredInteraction; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.outgoing.MessageComposer; @@ -38,13 +39,13 @@ public abstract class InteractionWired extends InteractionDefault implements IWi public InteractionWired(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); this.wiredSettings = new WiredSettings(); - this.setExtradata("0"); + this.setExtraData("0"); } - InteractionWired(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + InteractionWired(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.wiredSettings = new WiredSettings(); - this.setExtradata("0"); + this.setExtraData("0"); } public abstract boolean execute(RoomUnit roomUnit, Room room, Object[] stuff); @@ -190,7 +191,7 @@ public abstract class InteractionWired extends InteractionDefault implements IWi } public void activateBox(Room room, RoomUnit roomUnit, long millis) { - this.setExtradata(this.getExtradata().equals("1") ? "0" : "1"); + this.setExtraData(this.getExtraData().equals("1") ? "0" : "1"); room.sendComposer(new OneWayDoorStatusMessageComposer(this).compose()); if (roomUnit != null) { this.addUserExecutionCache(roomUnit.getVirtualId(), millis); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java index a9b85cce..fe6bef8f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java @@ -1,11 +1,9 @@ package com.eu.habbo.habbohotel.items.interactions; -import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; -import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionType; -import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer; import java.sql.ResultSet; import java.sql.SQLException; @@ -15,8 +13,8 @@ public abstract class InteractionWiredCondition extends InteractionWired { super(set, baseItem); } - public InteractionWiredCondition(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionWiredCondition(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public abstract WiredConditionType getType(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java index 5b027410..68981e6c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredEffect.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.IWiredEffectInteraction; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import gnu.trove.set.hash.THashSet; import lombok.Getter; @@ -26,13 +27,13 @@ public abstract class InteractionWiredEffect extends InteractionWired implements super(set, baseItem); } - public InteractionWiredEffect(int id, int userId, Item item, String extraData, int limitedStack, int limitedSells) { - super(id, userId, item, extraData, limitedStack, limitedSells); + public InteractionWiredEffect(int id, HabboInfo ownerInfo, Item item, String extraData, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extraData, limitedStack, limitedSells); } public List getBlockedTriggers(Room room) { List blockedTriggers = new ArrayList<>(); - THashSet triggers = room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()); + THashSet triggers = room.getRoomSpecialTypes().getTriggers(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); for(InteractionWiredTrigger trigger : triggers) { if(!trigger.isTriggeredByRoomUnit()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredExtra.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredExtra.java index d89937c3..c0bae61a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredExtra.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredExtra.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,8 +14,8 @@ public abstract class InteractionWiredExtra extends InteractionWired { super(set, baseItem); } - protected InteractionWiredExtra(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + protected InteractionWiredExtra(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java index 6836e782..f75c8e58 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredHighscore.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -46,8 +47,8 @@ public class InteractionWiredHighscore extends RoomItem { this.reloadData(); } - public InteractionWiredHighscore(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionWiredHighscore(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.scoreType = WiredHighscoreScoreType.CLASSIC; this.clearType = WiredHighscoreClearType.ALLTIME; @@ -84,13 +85,13 @@ public class InteractionWiredHighscore extends RoomItem { if (room == null || !((client != null && room.getRoomRightsManager().hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType))) return; - if (this.getExtradata() == null || this.getExtradata().isEmpty() || this.getExtradata().length() == 0) { - this.setExtradata("0"); + if (this.getExtraData() == null || this.getExtraData().isEmpty() || this.getExtraData().length() == 0) { + this.setExtraData("0"); } try { - int state = Integer.parseInt(this.getExtradata()); - this.setExtradata(Math.abs(state - 1) + ""); + int state = Integer.parseInt(this.getExtraData()); + this.setExtraData(Math.abs(state - 1) + ""); room.updateItem(this); } catch (Exception e) { log.error("Caught exception", e); @@ -105,7 +106,7 @@ public class InteractionWiredHighscore extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt(6); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); serverMessage.appendInt(this.scoreType.getType()); serverMessage.appendInt(this.clearType.getType()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java index be6fc806..86e1108f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredTrigger.java @@ -1,11 +1,10 @@ package com.eu.habbo.habbohotel.items.interactions; -import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.IWiredTriggerInteraction; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; -import com.eu.habbo.messages.outgoing.wired.WiredTriggerDataComposer; import gnu.trove.set.hash.THashSet; import lombok.Getter; import lombok.Setter; @@ -28,13 +27,13 @@ public abstract class InteractionWiredTrigger extends InteractionWired implement super(set, baseItem); } - protected InteractionWiredTrigger(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + protected InteractionWiredTrigger(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public List getBlockedEffects(Room room) { List blockedEffects = new ArrayList<>(); - THashSet effects = room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()); + THashSet effects = room.getRoomSpecialTypes().getEffects(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); for(InteractionWiredEffect effect : effects) { if (!effect.requiresTriggeringUser()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionYoutubeTV.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionYoutubeTV.java index d3555cb0..e341d276 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionYoutubeTV.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionYoutubeTV.java @@ -5,8 +5,9 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.YoutubeManager; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.youtube.YoutubeDisplayVideoMessageComposer; @@ -26,8 +27,8 @@ public class InteractionYoutubeTV extends RoomItem { super(set, baseItem); } - public InteractionYoutubeTV(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionYoutubeTV(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -47,8 +48,8 @@ public class InteractionYoutubeTV extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { - if (this.getExtradata().length() == 0) - this.setExtradata(""); + if (this.getExtraData().length() == 0) + this.setExtraData(""); serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(1); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java index 10615da4..47d768bf 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameGate.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -13,17 +14,17 @@ import java.sql.SQLException; public abstract class InteractionGameGate extends InteractionGameTeamItem { public InteractionGameGate(ResultSet set, Item baseItem, GameTeamColors teamColor) throws SQLException { super(set, baseItem, teamColor); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionGameGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); - this.setExtradata("0"); + public InteractionGameGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); + this.setExtraData("0"); } @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } @Override @@ -34,7 +35,7 @@ public abstract class InteractionGameGate extends InteractionGameTeamItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -49,7 +50,7 @@ public abstract class InteractionGameGate extends InteractionGameTeamItem { if (memberCount > maxPlayers) { memberCount = maxPlayers; } - this.setExtradata(memberCount + ""); + this.setExtraData(memberCount + ""); game.getRoom().updateItem(this); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameScoreboard.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameScoreboard.java index eb416b80..cf81f3fd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameScoreboard.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameScoreboard.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.games; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -11,24 +12,24 @@ import java.sql.SQLException; public abstract class InteractionGameScoreboard extends InteractionGameTeamItem { protected InteractionGameScoreboard(ResultSet set, Item baseItem, GameTeamColors teamColor) throws SQLException { super(set, baseItem, teamColor); - this.setExtradata("0"); + this.setExtraData("0"); } - protected InteractionGameScoreboard(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); - this.setExtradata("0"); + protected InteractionGameScoreboard(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTeamItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTeamItem.java index adf89c03..583040bb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTeamItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTeamItem.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.games; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -16,8 +17,8 @@ public abstract class InteractionGameTeamItem extends RoomItem { this.teamColor = teamColor; } - protected InteractionGameTeamItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells); + protected InteractionGameTeamItem(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.teamColor = teamColor; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java index 4be41c87..3f1b02b9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -76,7 +77,7 @@ public class InteractionGameTimer extends RoomItem implements Runnable { } if (data.length >= 1) { - this.setExtradata(data[0] + "\t0"); + this.setExtraData(data[0] + "\t0"); } } catch (Exception e) { @@ -85,8 +86,8 @@ public class InteractionGameTimer extends RoomItem implements Runnable { } } - public InteractionGameTimer(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionGameTimer(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); parseCustomParams(item); } @@ -163,7 +164,7 @@ public class InteractionGameTimer extends RoomItem implements Runnable { public void onPickUp(Room room) { this.endGame(room); - this.setExtradata(this.baseTime + "\t" + this.baseTime); + this.setExtraData(this.baseTime + "\t" + this.baseTime); this.needsUpdate(true); } @@ -175,7 +176,7 @@ public class InteractionGameTimer extends RoomItem implements Runnable { this.timeNow = this.baseTime; - this.setExtradata(this.timeNow + "\t" + this.baseTime); + this.setExtraData(this.timeNow + "\t" + this.baseTime); room.updateItem(this); this.needsUpdate(true); @@ -202,8 +203,8 @@ public class InteractionGameTimer extends RoomItem implements Runnable { @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - if (this.getExtradata().isEmpty()) { - this.setExtradata("0\t" + this.TIMER_INTERVAL_STEPS[0]); + if (this.getExtraData().isEmpty()) { + this.setExtraData("0\t" + this.TIMER_INTERVAL_STEPS[0]); } // if wired triggered it @@ -313,7 +314,7 @@ public class InteractionGameTimer extends RoomItem implements Runnable { } this.baseTime = baseTime; - this.setExtradata(this.timeNow + "\t" + this.baseTime); + this.setExtraData(this.timeNow + "\t" + this.baseTime); this.timeNow = this.baseTime; room.updateItem(this); @@ -322,7 +323,7 @@ public class InteractionGameTimer extends RoomItem implements Runnable { @Override public String getDatabaseExtraData() { - return this.getExtradata(); + return this.getExtraData(); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java index b30ecadc..b0002330 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java @@ -12,6 +12,7 @@ import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -21,8 +22,8 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable { super(set, baseItem); } - public InteractionBattleBanzaiPuck(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionBattleBanzaiPuck(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -78,9 +79,9 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable { return RoomRotation.SOUTH; case NORTH_EAST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_WEST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_WEST.getValue()))) return RoomRotation.NORTH_WEST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_EAST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_EAST.getValue()))) return RoomRotation.SOUTH_EAST; else return RoomRotation.SOUTH_WEST; @@ -89,9 +90,9 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable { return RoomRotation.WEST; case SOUTH_EAST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_WEST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_WEST.getValue()))) return RoomRotation.SOUTH_WEST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_EAST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_EAST.getValue()))) return RoomRotation.NORTH_EAST; else return RoomRotation.NORTH_WEST; @@ -100,9 +101,9 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable { return RoomRotation.NORTH; case SOUTH_WEST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_EAST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_EAST.getValue()))) return RoomRotation.SOUTH_EAST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_WEST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_WEST.getValue()))) return RoomRotation.NORTH_WEST; else return RoomRotation.NORTH_EAST; @@ -111,9 +112,9 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable { return RoomRotation.EAST; case NORTH_WEST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_EAST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_EAST.getValue()))) return RoomRotation.NORTH_EAST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_WEST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_WEST.getValue()))) return RoomRotation.SOUTH_WEST; else return RoomRotation.SOUTH_EAST; @@ -167,7 +168,7 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable { } catch (Exception e) { return; } - this.setExtradata(team.teamColor.type + ""); + this.setExtraData(team.teamColor.type + ""); room.updateItemState(this); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiSphere.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiSphere.java index 0009d8b1..a518ca52 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiSphere.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiSphere.java @@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -12,18 +13,18 @@ import java.sql.SQLException; public class InteractionBattleBanzaiSphere extends RoomItem { public InteractionBattleBanzaiSphere(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionBattleBanzaiSphere(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionBattleBanzaiSphere(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java index 11109f6e..3e8744a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTeleporter.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.threading.runnables.BanzaiRandomTeleport; @@ -16,18 +17,18 @@ import java.sql.SQLException; public class InteractionBattleBanzaiTeleporter extends RoomItem { public InteractionBattleBanzaiTeleporter(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionBattleBanzaiTeleporter(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionBattleBanzaiTeleporter(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -60,7 +61,7 @@ public class InteractionBattleBanzaiTeleporter extends RoomItem { RoomItem target = room.getRoomSpecialTypes().getRandomTeleporter(null, this); if (target == null) return; - this.setExtradata("1"); + this.setExtraData("1"); room.updateItemState(this); roomUnit.removeStatus(RoomUnitStatus.MOVE); roomUnit.setGoalLocation(roomUnit.getCurrentPosition()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java index 9667d347..b336d2aa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; import org.apache.commons.math3.util.Pair; @@ -19,18 +20,18 @@ import java.util.List; public class InteractionBattleBanzaiTile extends RoomItem { public InteractionBattleBanzaiTile(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionBattleBanzaiTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionBattleBanzaiTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -54,10 +55,10 @@ public class InteractionBattleBanzaiTile extends RoomItem { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - if (this.getExtradata().isEmpty()) - this.setExtradata("0"); + if (this.getExtraData().isEmpty()) + this.setExtraData("0"); - int state = Integer.parseInt(this.getExtradata()); + int state = Integer.parseInt(this.getExtraData()); if (state % 3 == 2) return; @@ -85,10 +86,10 @@ public class InteractionBattleBanzaiTile extends RoomItem { } public boolean isLocked() { - if (this.getExtradata().isEmpty()) + if (this.getExtraData().isEmpty()) return false; - return Integer.parseInt(this.getExtradata()) % 3 == 2; + return Integer.parseInt(this.getExtraData()) % 3 == 2; } @Override @@ -104,7 +105,7 @@ public class InteractionBattleBanzaiTile extends RoomItem { public void onPickUp(Room room) { super.onPickUp(room); - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); } @@ -115,7 +116,7 @@ public class InteractionBattleBanzaiTile extends RoomItem { BattleBanzaiGame game = (BattleBanzaiGame) room.getGame(BattleBanzaiGame.class); if (game != null && game.getState() != GameState.IDLE) { - this.setExtradata("1"); + this.setExtraData("1"); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java index 58e6f2f6..04c1b7d9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGate.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -19,8 +20,8 @@ public class InteractionBattleBanzaiGate extends InteractionGameGate { super(set, baseItem, teamColor); } - public InteractionBattleBanzaiGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); + public InteractionBattleBanzaiGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateBlue.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateBlue.java index 206bd98b..6596d2e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateBlue.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateBlue.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiGateBlue extends InteractionBattleBanzaiGate super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiGateBlue(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiGateBlue(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateGreen.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateGreen.java index ee488fba..54052d44 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateGreen.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateGreen.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiGateGreen extends InteractionBattleBanzaiGat super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiGateGreen(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiGateGreen(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateRed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateRed.java index ceeca701..6b6f1c24 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateRed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateRed.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiGateRed extends InteractionBattleBanzaiGate super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiGateRed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiGateRed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateYellow.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateYellow.java index ec6609e4..770a1fe8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateYellow.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/gates/InteractionBattleBanzaiGateYellow.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiGateYellow extends InteractionBattleBanzaiGa super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiGateYellow(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiGateYellow(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboard.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboard.java index ffb02954..2198418b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboard.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboard.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameScoreboard; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -14,8 +15,8 @@ public class InteractionBattleBanzaiScoreboard extends InteractionGameScoreboard super(set, baseItem, teamColor); } - public InteractionBattleBanzaiScoreboard(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); + public InteractionBattleBanzaiScoreboard(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardBlue.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardBlue.java index a5452738..af47fe4e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardBlue.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardBlue.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboard import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiScoreboardBlue extends InteractionBattleBanz super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiScoreboardBlue(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiScoreboardBlue(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardGreen.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardGreen.java index a42332f9..1f57ffac 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardGreen.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardGreen.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboard import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiScoreboardGreen extends InteractionBattleBan super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiScoreboardGreen(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiScoreboardGreen(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardRed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardRed.java index 9abf0aad..431c6290 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardRed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardRed.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboard import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiScoreboardRed extends InteractionBattleBanza super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiScoreboardRed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiScoreboardRed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardYellow.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardYellow.java index 6b4b8950..36d80166 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardYellow.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/scoreboards/InteractionBattleBanzaiScoreboardYellow.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboard import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionBattleBanzaiScoreboardYellow extends InteractionBattleBa super(set, baseItem, TEAM_COLOR); } - public InteractionBattleBanzaiScoreboardYellow(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionBattleBanzaiScoreboardYellow(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java index 9ba08b4b..bb205a17 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java @@ -12,6 +12,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.rooms.items.OneWayDoorStatusMessageComposer; import com.eu.habbo.util.pathfinding.Rotation; @@ -26,14 +27,14 @@ public class InteractionFootball extends InteractionPushable { super(set, baseItem); } - public InteractionFootball(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionFootball(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public int getWalkOnVelocity(RoomUnit roomUnit, Room room) { - if (roomUnit.getPath().isEmpty() && roomUnit.getTilesMoved() == 2 && this.getExtradata().equals("1")) + if (roomUnit.getPath().isEmpty() && roomUnit.getTilesMoved() == 2 && this.getExtraData().equals("1")) return 0; if (roomUnit.getPath().isEmpty() && roomUnit.getTilesMoved() == 1) @@ -72,7 +73,12 @@ public class InteractionFootball extends InteractionPushable { @Override public RoomRotation getWalkOffDirection(RoomUnit roomUnit, Room room) { RoomTile peek = roomUnit.getPath().peek(); - RoomTile nextWalkTile = peek != null ? room.getLayout().getTile(peek.getX(), peek.getY()) : roomUnit.getGoalLocation(); + RoomTile nextWalkTile; + if (peek != null) { + nextWalkTile = room.getLayout().getTile(peek.getX(), peek.getY()); + } else { + nextWalkTile = roomUnit.getTargetPosition(); + } return RoomRotation.values()[(RoomRotation.values().length + Rotation.Calculate(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY(), nextWalkTile.getX(), nextWalkTile.getY()) + 4) % 8]; } @@ -103,9 +109,9 @@ public class InteractionFootball extends InteractionPushable { return RoomRotation.SOUTH; case NORTH_EAST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_WEST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_WEST.getValue()))) return RoomRotation.NORTH_WEST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_EAST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_EAST.getValue()))) return RoomRotation.SOUTH_EAST; else return RoomRotation.SOUTH_WEST; @@ -114,9 +120,9 @@ public class InteractionFootball extends InteractionPushable { return RoomRotation.WEST; case SOUTH_EAST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_WEST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_WEST.getValue()))) return RoomRotation.SOUTH_WEST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_EAST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_EAST.getValue()))) return RoomRotation.NORTH_EAST; else return RoomRotation.NORTH_WEST; @@ -125,9 +131,9 @@ public class InteractionFootball extends InteractionPushable { return RoomRotation.NORTH; case SOUTH_WEST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_EAST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_EAST.getValue()))) return RoomRotation.SOUTH_EAST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_WEST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_WEST.getValue()))) return RoomRotation.NORTH_WEST; else return RoomRotation.NORTH_EAST; @@ -136,9 +142,9 @@ public class InteractionFootball extends InteractionPushable { return RoomRotation.EAST; case NORTH_WEST: - if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.NORTH_EAST.getValue()))) + if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.NORTH_EAST.getValue()))) return RoomRotation.NORTH_EAST; - else if (this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomRotation.SOUTH_WEST.getValue()))) + else if (this.validMove(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), RoomRotation.SOUTH_WEST.getValue()))) return RoomRotation.SOUTH_WEST; else return RoomRotation.SOUTH_EAST; @@ -162,8 +168,8 @@ public class InteractionFootball extends InteractionPushable { } // Ball can only go up by 1.65 according to Habbo (tested using stack tile on 22-03-2022) - BigDecimal topItemHeight = BigDecimal.valueOf(topItem.getZ() + topItem.getBaseItem().getHeight()); - BigDecimal ballHeight = BigDecimal.valueOf(this.getZ()); + BigDecimal topItemHeight = BigDecimal.valueOf(topItem.getCurrentZ() + topItem.getBaseItem().getHeight()); + BigDecimal ballHeight = BigDecimal.valueOf(this.getCurrentZ()); if (topItemHeight.subtract(ballHeight).compareTo(BigDecimal.valueOf(1.65)) > 0) { return false; @@ -222,7 +228,7 @@ public class InteractionFootball extends InteractionPushable { game.onScore(kicker, color); } - this.setExtradata(Math.abs(currentStep - (totalSteps + 1)) + ""); + this.setExtraData(Math.abs(currentStep - (totalSteps + 1)) + ""); room.sendComposer(new OneWayDoorStatusMessageComposer(this).compose()); } @@ -233,7 +239,7 @@ public class InteractionFootball extends InteractionPushable { @Override public void onStop(Room room, RoomUnit kicker, int currentStep, int totalSteps) { - this.setExtradata("0"); + this.setExtraData("0"); room.sendComposer(new OneWayDoorStatusMessageComposer(this).compose()); } @@ -245,7 +251,7 @@ public class InteractionFootball extends InteractionPushable { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java index 45cb0b6d..cbe737e2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootballGate.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.clothingvalidation.ClothingValidationManager; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer; @@ -33,8 +34,8 @@ public class InteractionFootballGate extends RoomItem { this.figureF = bits.length > 1 ? bits[1] : ""; } - public InteractionFootballGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionFootballGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); String[] bits = extradata.split(";"); this.figureM = bits.length > 0 ? bits[0] : ""; @@ -76,7 +77,7 @@ public class InteractionFootballGate extends RoomItem { public void setFigureM(String look) { this.figureM = look; - this.setExtradata(this.figureM + ";" + this.figureF); + this.setExtraData(this.figureM + ";" + this.figureF); this.needsUpdate(true); Emulator.getThreading().run(this); } @@ -84,7 +85,7 @@ public class InteractionFootballGate extends RoomItem { public void setFigureF(String look) { this.figureF = look; - this.setExtradata(this.figureM + ";" + this.figureF); + this.setExtraData(this.figureM + ";" + this.figureF); this.needsUpdate(true); Emulator.getThreading().run(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java index e50163c7..a87c770c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class InteractionFootballGoal extends InteractionGameTeamItem { super(set, baseItem, teamColor); } - public InteractionFootballGoal(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); + public InteractionFootballGoal(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); } @Override @@ -37,7 +38,7 @@ public class InteractionFootballGoal extends InteractionGameTeamItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalBlue.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalBlue.java index 34d2b52f..1e600210 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalBlue.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalBlue.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.goals; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballGoalBlue extends InteractionFootballGoal { super(set, baseItem, GameTeamColors.BLUE); } - public InteractionFootballGoalBlue(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.BLUE); + public InteractionFootballGoalBlue(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.BLUE); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalGreen.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalGreen.java index 42276c9e..da40f7be 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalGreen.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalGreen.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.goals; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballGoalGreen extends InteractionFootballGoal { super(set, baseItem, GameTeamColors.GREEN); } - public InteractionFootballGoalGreen(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.GREEN); + public InteractionFootballGoalGreen(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.GREEN); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalRed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalRed.java index b4d9b5d4..945a0227 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalRed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalRed.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.goals; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballGoalRed extends InteractionFootballGoal { super(set, baseItem, GameTeamColors.RED); } - public InteractionFootballGoalRed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.RED); + public InteractionFootballGoalRed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.RED); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalYellow.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalYellow.java index ba725033..252cc98a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalYellow.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoalYellow.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.goals; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballGoalYellow extends InteractionFootballGoal { super(set, baseItem, GameTeamColors.YELLOW); } - public InteractionFootballGoalYellow(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.YELLOW); + public InteractionFootballGoalYellow(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.YELLOW); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java index ed3862e7..2305665a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboard.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameScoreboard; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -20,14 +21,14 @@ public class InteractionFootballScoreboard extends InteractionGameScoreboard { super(set, baseItem, teamColor); try { - this.score = Integer.parseInt(this.getExtradata()); + this.score = Integer.parseInt(this.getExtraData()); } catch (Exception e) { this.score = 0; } } - public InteractionFootballScoreboard(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); + public InteractionFootballScoreboard(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); try { this.score = Integer.parseInt(extradata); @@ -58,7 +59,7 @@ public class InteractionFootballScoreboard extends InteractionGameScoreboard { this.score = 99; } - this.setExtradata(this.score + ""); + this.setExtraData(this.score + ""); this.needsUpdate(true); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); @@ -84,7 +85,7 @@ public class InteractionFootballScoreboard extends InteractionGameScoreboard { this.score = 99; } - this.setExtradata(this.score + ""); + this.setExtraData(this.score + ""); this.needsUpdate(true); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardBlue.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardBlue.java index 1a4cd219..912e0f22 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardBlue.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardBlue.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballScoreboardBlue extends InteractionFootballScoreb super(set, baseItem, GameTeamColors.BLUE); } - public InteractionFootballScoreboardBlue(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.BLUE); + public InteractionFootballScoreboardBlue(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.BLUE); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardGreen.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardGreen.java index 1f785c0c..f9522567 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardGreen.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardGreen.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballScoreboardGreen extends InteractionFootballScore super(set, baseItem, GameTeamColors.GREEN); } - public InteractionFootballScoreboardGreen(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.GREEN); + public InteractionFootballScoreboardGreen(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.GREEN); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardRed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardRed.java index 6d65b7ea..bf40c6a0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardRed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardRed.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballScoreboardRed extends InteractionFootballScorebo super(set, baseItem, GameTeamColors.RED); } - public InteractionFootballScoreboardRed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.RED); + public InteractionFootballScoreboardRed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.RED); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardYellow.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardYellow.java index 731a9e82..93d4498b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardYellow.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/scoreboards/InteractionFootballScoreboardYellow.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.football.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionFootballScoreboardYellow extends InteractionFootballScor super(set, baseItem, GameTeamColors.YELLOW); } - public InteractionFootballScoreboardYellow(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, GameTeamColors.YELLOW); + public InteractionFootballScoreboardYellow(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, GameTeamColors.YELLOW); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java index 3dc26e13..2df02776 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeBlock.java @@ -12,6 +12,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; @@ -21,12 +22,12 @@ import java.sql.SQLException; public class InteractionFreezeBlock extends RoomItem { public InteractionFreezeBlock(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionFreezeBlock(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionFreezeBlock(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -35,12 +36,12 @@ public class InteractionFreezeBlock extends RoomItem { return; RoomItem item = null; - RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tile = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); THashSet items = room.getRoomItemManager().getItemsAt(tile); for (RoomItem i : items) { if (i instanceof InteractionFreezeTile) { - if (item == null || i.getZ() <= item.getZ()) { + if (item == null || i.getCurrentZ() <= item.getCurrentZ()) { item = i; } } @@ -58,11 +59,11 @@ public class InteractionFreezeBlock extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { - if (this.getExtradata().length() == 0) { - this.setExtradata("0"); + if (this.getExtraData().length() == 0) { + this.setExtraData("0"); } serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -74,7 +75,7 @@ public class InteractionFreezeBlock extends RoomItem { @Override public boolean isWalkable() { - return !this.getExtradata().isEmpty() && !this.getExtradata().equals("0"); + return !this.getExtraData().isEmpty() && !this.getExtraData().equals("0"); } @Override @@ -86,7 +87,7 @@ public class InteractionFreezeBlock extends RoomItem { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - if (this.getExtradata().isEmpty() || this.getExtradata().equalsIgnoreCase("0")) + if (this.getExtraData().isEmpty() || this.getExtraData().equalsIgnoreCase("0")) return; FreezeGame game = (FreezeGame) room.getGame(FreezeGame.class); @@ -105,7 +106,7 @@ public class InteractionFreezeBlock extends RoomItem { int powerUp; try { - powerUp = Integer.parseInt(this.getExtradata()) / 1000; + powerUp = Integer.parseInt(this.getExtraData()) / 1000; } catch (NumberFormatException e) { powerUp = 0; } @@ -114,7 +115,7 @@ public class InteractionFreezeBlock extends RoomItem { if (powerUp == 6 && !player.canPickupLife()) return; - this.setExtradata((powerUp + 10) * 1000 + ""); + this.setExtraData((powerUp + 10) * 1000 + ""); room.updateItem(this); @@ -126,6 +127,6 @@ public class InteractionFreezeBlock extends RoomItem { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeExitTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeExitTile.java index 52337257..62652f27 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeExitTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeExitTile.java @@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -12,17 +13,17 @@ import java.sql.SQLException; public class InteractionFreezeExitTile extends RoomItem { public InteractionFreezeExitTile(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionFreezeExitTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionFreezeExitTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } @Override @@ -43,7 +44,7 @@ public class InteractionFreezeExitTile extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java index 1f685c00..1df899dd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/InteractionFreezeTile.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import gnu.trove.set.hash.THashSet; import org.apache.commons.math3.util.Pair; @@ -18,12 +19,12 @@ import java.util.List; public class InteractionFreezeTile extends RoomItem { public InteractionFreezeTile(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionFreezeTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionFreezeTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -41,7 +42,7 @@ public class InteractionFreezeTile extends RoomItem { if (client == null) return; - if (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getY()) { + if (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getCurrentPosition().getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getCurrentPosition().getY()) { FreezeGame game = (FreezeGame) room.getGame(FreezeGame.class); if (game != null) @@ -57,14 +58,14 @@ public class InteractionFreezeTile extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java index dc044e26..1bf54566 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGate.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameGate; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -19,8 +20,8 @@ public class InteractionFreezeGate extends InteractionGameGate { super(set, baseItem, teamColor); } - public InteractionFreezeGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); + public InteractionFreezeGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateBlue.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateBlue.java index 90040250..22d10c07 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateBlue.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateBlue.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeGateBlue extends InteractionFreezeGate { super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeGateBlue(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeGateBlue(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateGreen.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateGreen.java index dd62a2eb..f99c02ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateGreen.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateGreen.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeGateGreen extends InteractionFreezeGate { super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeGateGreen(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeGateGreen(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateRed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateRed.java index 7f502050..0d28f833 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateRed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateRed.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeGateRed extends InteractionFreezeGate { super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeGateRed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeGateRed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateYellow.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateYellow.java index 418ce0ed..8b5c3add 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateYellow.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/gates/InteractionFreezeGateYellow.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.gates; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeGateYellow extends InteractionFreezeGate { super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeGateYellow(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeGateYellow(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboard.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboard.java index 66cab607..d90ca07c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboard.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboard.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameScoreboard; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -14,8 +15,8 @@ public class InteractionFreezeScoreboard extends InteractionGameScoreboard { super(set, baseItem, teamColor); } - InteractionFreezeScoreboard(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { - super(id, userId, item, extradata, limitedStack, limitedSells, teamColor); + InteractionFreezeScoreboard(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, GameTeamColors teamColor) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, teamColor); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardBlue.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardBlue.java index 9c005626..b9fda992 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardBlue.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardBlue.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeScoreboardBlue extends InteractionFreezeScoreboard super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeScoreboardBlue(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeScoreboardBlue(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardGreen.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardGreen.java index 3ce66539..9aa9ebca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardGreen.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardGreen.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeScoreboardGreen extends InteractionFreezeScoreboar super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeScoreboardGreen(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeScoreboardGreen(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardRed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardRed.java index 9846fa55..719299bd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardRed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardRed.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeScoreboardRed extends InteractionFreezeScoreboard super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeScoreboardRed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeScoreboardRed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardYellow.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardYellow.java index 1c9d94e0..59b2d384 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardYellow.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/freeze/scoreboards/InteractionFreezeScoreboardYellow.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards; import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,7 +14,7 @@ public class InteractionFreezeScoreboardYellow extends InteractionFreezeScoreboa super(set, baseItem, TEAM_COLOR); } - public InteractionFreezeScoreboardYellow(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, TEAM_COLOR); + public InteractionFreezeScoreboardYellow(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, TEAM_COLOR); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagField.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagField.java index 8020fdfe..dce84c97 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagField.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagField.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -21,8 +22,8 @@ public abstract class InteractionTagField extends RoomItem { this.gameClazz = gameClazz; } - public InteractionTagField(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells, Class gameClazz) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTagField(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, Class gameClazz) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.gameClazz = gameClazz; } @@ -75,7 +76,7 @@ public abstract class InteractionTagField extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagPole.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagPole.java index e1f04890..e07f0388 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagPole.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/InteractionTagPole.java @@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions.games.tag; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class InteractionTagPole extends RoomItem { super(set, baseItem); } - public InteractionTagPole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTagPole(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -36,13 +37,13 @@ public class InteractionTagPole extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java index 6c2f5bca..bd902eb8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunField.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -16,15 +17,15 @@ public class InteractionBunnyrunField extends InteractionTagField { super(set, baseItem, BunnyrunGame.class); } - public InteractionBunnyrunField(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, BunnyrunGame.class); + public InteractionBunnyrunField(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, BunnyrunGame.class); } @Override public void onPlace(Room room) { super.onPlace(room); - Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerId()); + Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerInfo().getId()); if (itemOwner != null) { AchievementManager.progressAchievement(itemOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RbBunnyTag")); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunPole.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunPole.java index 9c0ae732..1573f4e5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunPole.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/bunnyrun/InteractionBunnyrunPole.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.tag.bunnyrun; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionBunnyrunPole extends InteractionTagPole { super(set, baseItem); } - public InteractionBunnyrunPole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionBunnyrunPole(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java index 0e24397f..34901520 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagField.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -20,8 +21,8 @@ public class InteractionIceTagField extends InteractionTagField { super(set, baseItem, IceTagGame.class); } - public InteractionIceTagField(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, IceTagGame.class); + public InteractionIceTagField(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, IceTagGame.class); } @Override @@ -48,7 +49,7 @@ public class InteractionIceTagField extends InteractionTagField { public void onPlace(Room room) { super.onPlace(room); - Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerId()); + Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerInfo().getId()); if (itemOwner != null) { AchievementManager.progressAchievement(itemOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("TagA")); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagPole.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagPole.java index b2fe44c0..78a1c4f9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagPole.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/icetag/InteractionIceTagPole.java @@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions.games.tag.icetag; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -11,7 +12,7 @@ public class InteractionIceTagPole extends InteractionTagPole { super(set, baseItem); } - public InteractionIceTagPole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionIceTagPole(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/rollerskate/InteractionRollerskateField.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/rollerskate/InteractionRollerskateField.java index 34bd18a3..0511e567 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/rollerskate/InteractionRollerskateField.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/tag/rollerskate/InteractionRollerskateField.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -20,8 +21,8 @@ public class InteractionRollerskateField extends InteractionTagField { super(set, baseItem, RollerskateGame.class); } - public InteractionRollerskateField(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells, RollerskateGame.class); + public InteractionRollerskateField(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells, RollerskateGame.class); } @Override @@ -48,7 +49,7 @@ public class InteractionRollerskateField extends InteractionTagField { public void onPlace(Room room) { super.onPlace(room); - Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerId()); + Habbo itemOwner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.getOwnerInfo().getId()); if (itemOwner != null) { AchievementManager.progressAchievement(itemOwner, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RbTagA")); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java index b3304ea5..f4349444 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionMonsterPlantSeed.java @@ -4,8 +4,9 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import java.sql.ResultSet; @@ -15,17 +16,17 @@ public class InteractionMonsterPlantSeed extends RoomItem { public InteractionMonsterPlantSeed(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - if (this.getExtradata().isEmpty()) { - this.setExtradata("" + randomRarityLevel()); + if (this.getExtraData().isEmpty()) { + this.setExtraData("" + randomRarityLevel()); this.needsUpdate(true); } } - public InteractionMonsterPlantSeed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionMonsterPlantSeed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); - if (this.getExtradata().isEmpty()) { - this.setExtradata("" + randomRarityLevel()); + if (this.getExtraData().isEmpty()) { + this.setExtraData("" + randomRarityLevel()); this.needsUpdate(true); } } @@ -78,7 +79,7 @@ public class InteractionMonsterPlantSeed extends RoomItem { serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(1); serverMessage.appendString("rarity"); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionNest.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionNest.java index dcd7e9a7..253535ee 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionNest.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionNest.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer; @@ -20,14 +21,14 @@ public class InteractionNest extends RoomItem { super(set, baseItem); } - public InteractionNest(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionNest(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -71,10 +72,10 @@ public class InteractionNest extends RoomItem { return; pet.setTask(PetTasks.NEST); - pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY())); + pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); pet.getRoomUnit().clearStatuses(); pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE); - pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, room.getStackHeight(this.getX(), this.getY(), false) + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.LAY, room.getStackHeight(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), false) + ""); room.sendComposer(new UserUpdateComposer(roomUnit).compose()); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java index 75ec69b4..f2e18be4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetBreedingNest.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.pets.PerkAllowancesComposer; import com.eu.habbo.messages.outgoing.rooms.pets.breeding.ConfirmBreedingRequestComposer; @@ -27,8 +28,8 @@ public class InteractionPetBreedingNest extends RoomItem { super(set, baseItem); } - public InteractionPetBreedingNest(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPetBreedingNest(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -45,7 +46,7 @@ public class InteractionPetBreedingNest extends RoomItem { @Override public void serializeExtradata(ServerMessage serverMessage) { serverMessage.appendInt((this.isLimited() ? 256 : 0)); - serverMessage.appendString(this.getExtradata()); + serverMessage.appendString(this.getExtraData()); super.serializeExtradata(serverMessage); } @@ -68,7 +69,7 @@ public class InteractionPetBreedingNest extends RoomItem { if (ownerPetOne != null && ownerPetTwo != null && this.petOne.getPetData().getType() == this.petTwo.getPetData().getType() && this.petOne.getPetData().getOffspringType() != -1) { ownerPetTwo.getClient().sendResponse(new ConfirmBreedingRequestComposer(this.getId(), this.petOne.getPetData().getOffspringType(), this.petOne, ownerPetOne.getHabboInfo().getUsername(), this.petTwo, ownerPetTwo.getHabboInfo().getUsername())); - this.setExtradata("1"); + this.setExtraData("1"); room.updateItem(this); } } @@ -98,7 +99,7 @@ public class InteractionPetBreedingNest extends RoomItem { if (this.petOne != null && this.petOne.getRoomUnit() == roomUnit) this.petOne = null; if (this.petTwo != null && this.petTwo.getRoomUnit() == roomUnit) this.petTwo = null; - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); } @@ -108,7 +109,7 @@ public class InteractionPetBreedingNest extends RoomItem { } public void stopBreeding(Habbo habbo) { - this.setExtradata("0"); + this.setExtraData("0"); habbo.getRoomUnit().getRoom().updateItem(this); if (this.petOne != null) { @@ -142,7 +143,7 @@ public class InteractionPetBreedingNest extends RoomItem { public void breed(Habbo habbo, String name) { Emulator.getThreading().run(new QueryDeleteHabboItem(this.getId())); - this.setExtradata("2"); + this.setExtraData("2"); habbo.getRoomUnit().getRoom().updateItem(this); RoomItem box = this; @@ -151,8 +152,7 @@ public class InteractionPetBreedingNest extends RoomItem { Pet offspring = Emulator.getGameEnvironment().getPetManager().createPet(petOne.getPetData().getOffspringType(), (int) Math.min(Math.round(Math.max(1d, PetManager.getNormalDistributionForBreeding(petOne.getLevel(), petTwo.getLevel()).sample())), 20), name, habbo.getClient()); - - habbo.getRoomUnit().getRoom().getRoomUnitManager().placePet(offspring, habbo.getRoomUnit().getRoom(), box.getX(), box.getY(), box.getZ()); + habbo.getRoomUnit().getRoom().getRoomUnitManager().placePet(offspring, habbo.getRoomUnit().getRoom(), box.getCurrentPosition().getX(), box.getCurrentPosition().getY(), box.getCurrentZ()); offspring.setNeedsUpdate(true); offspring.run(); InteractionPetBreedingNest.this.freePets(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java index e5762342..1b6a04a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetDrink.java @@ -13,6 +13,7 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.PetClearPosture; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import org.slf4j.Logger; @@ -31,13 +32,13 @@ public class InteractionPetDrink extends InteractionDefault { super(set, baseItem); } - public InteractionPetDrink(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPetDrink(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public boolean canToggle(Habbo habbo, Room room) { - return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), habbo.getRoomUnit().getCurrentPosition()); + return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), habbo.getRoomUnit().getCurrentPosition()); } @Override @@ -47,7 +48,7 @@ public class InteractionPetDrink extends InteractionDefault { if (!this.canToggle(client.getHabbo(), room)) { RoomTile closestTile = null; - for (RoomTile tile : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) { + for (RoomTile tile : room.getLayout().getTilesAround(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()))) { if (tile.isWalkable() && (closestTile == null || closestTile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()) > tile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()))) { closestTile = tile; } @@ -68,17 +69,17 @@ public class InteractionPetDrink extends InteractionDefault { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - if (this.getExtradata() == null || this.getExtradata().isEmpty()) - this.setExtradata("0"); + if (this.getExtraData() == null || this.getExtraData().isEmpty()) + this.setExtraData("0"); Pet pet = room.getRoomUnitManager().getPetByRoomUnit(roomUnit); if (pet != null && pet.getPetData().haveDrinkItem(this) && pet.levelThirst >= 35) { pet.clearPosture(); - pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY())); + pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); pet.getRoomUnit().clearStatuses(); - pet.getRoomUnit().setStatus(RoomUnitStatus.EAT, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.EAT, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); pet.setPacketUpdate(true); Emulator.getThreading().run(() -> { @@ -102,12 +103,12 @@ public class InteractionPetDrink extends InteractionDefault { private void change(Room room, int amount) { int state = 0; - if (this.getExtradata() == null || this.getExtradata().isEmpty()) { - this.setExtradata("0"); + if (this.getExtraData() == null || this.getExtraData().isEmpty()) { + this.setExtraData("0"); } try { - state = Integer.parseInt(this.getExtradata()); + state = Integer.parseInt(this.getExtraData()); } catch (Exception e) { LOGGER.error("Caught exception", e); } @@ -121,7 +122,7 @@ public class InteractionPetDrink extends InteractionDefault { state = 0; } - this.setExtradata(state + ""); + this.setExtraData(state + ""); this.needsUpdate(true); room.updateItemState(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetFood.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetFood.java index 8b9e5388..8bdf3757 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetFood.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetFood.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer; import com.eu.habbo.threading.runnables.PetEatAction; @@ -20,16 +21,16 @@ public class InteractionPetFood extends InteractionDefault { super(set, baseItem); } - public InteractionPetFood(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPetFood(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - if (this.getExtradata().length() == 0) - this.setExtradata("0"); + if (this.getExtraData().length() == 0) + this.setExtraData("0"); Pet pet = room.getRoomUnitManager().getPetByRoomUnit(roomUnit); @@ -37,11 +38,11 @@ public class InteractionPetFood extends InteractionDefault { if (pet.getPetData().haveFoodItem(this)) { if (pet.levelHunger >= 35) { pet.setTask(PetTasks.EAT); - pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY())); + pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); pet.getRoomUnit().clearStatuses(); pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE); - pet.getRoomUnit().setStatus(RoomUnitStatus.EAT, "0"); + pet.getRoomUnit().addStatus(RoomUnitStatus.EAT, "0"); room.sendComposer(new UserUpdateComposer(roomUnit).compose()); Emulator.getThreading().run(new PetEatAction(pet, this)); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java index a3af6600..b53a95ce 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetToy.java @@ -13,6 +13,7 @@ import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.PetClearPosture; import java.sql.ResultSet; @@ -21,19 +22,19 @@ import java.sql.SQLException; public class InteractionPetToy extends InteractionDefault { public InteractionPetToy(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionPetToy(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionPetToy(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override public void onClick(GameClient client, Room room, Object[] objects) {} @Override public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) { - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); for (Pet pet : room.getRoomUnitManager().getPetsAt(oldLocation)) { @@ -43,7 +44,7 @@ public class InteractionPetToy extends InteractionDefault { } @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); for (Pet pet : room.getPetsOnItem(this)) { pet.getRoomUnit().clearStatuses(); @@ -57,28 +58,30 @@ public class InteractionPetToy extends InteractionDefault { Pet pet = room.getRoomUnitManager().getPetByRoomUnit(roomUnit); - if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoalLocation())) { - if (pet.getEnergy() <= 35) { - return; - } + if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem())) { + if (this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getTargetPosition())) { + if (pet.getEnergy() <= 35) { + return; + } - pet.setTask(PetTasks.PLAY); - pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY())); - pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); - pet.getRoomUnit().clearStatuses(); - pet.getRoomUnit().setStatus(RoomUnitStatus.PLAY, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); - pet.setPacketUpdate(true); - RoomItem item = this; - Emulator.getThreading().run(() -> { - pet.addHappiness(25); - item.setExtradata("0"); - room.updateItem(item); + pet.setTask(PetTasks.PLAY); + pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); + pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); pet.getRoomUnit().clearStatuses(); - new PetClearPosture(pet, RoomUnitStatus.PLAY, null, true).run(); + pet.getRoomUnit().addStatus(RoomUnitStatus.PLAY, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); pet.setPacketUpdate(true); - }, ((long)(Emulator.getRandom().nextInt(20) * 500) + 2500)); - this.setExtradata("1"); - room.updateItemState(this); + RoomItem item = this; + Emulator.getThreading().run(() -> { + pet.addHappiness(25); + item.setExtraData("0"); + room.updateItem(item); + pet.getRoomUnit().clearStatuses(); + new PetClearPosture(pet, RoomUnitStatus.PLAY, null, true).run(); + pet.setPacketUpdate(true); + }, ((long) (Emulator.getRandom().nextInt(20) * 500) + 2500)); + this.setExtraData("1"); + room.updateItemState(this); + } } } @@ -89,7 +92,7 @@ public class InteractionPetToy extends InteractionDefault { Pet pet = room.getRoomUnitManager().getPetByRoomUnit(roomUnit); if (pet != null) { - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); pet.getRoomUnit().clearStatuses(); pet.setPacketUpdate(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java index cadb17a2..4361f4d6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTrampoline.java @@ -11,6 +11,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.PetClearPosture; import java.sql.ResultSet; @@ -19,12 +20,12 @@ import java.sql.SQLException; public class InteractionPetTrampoline extends InteractionDefault { public InteractionPetTrampoline(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.setExtradata("0"); + this.setExtraData("0"); } - public InteractionPetTrampoline(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); - this.setExtradata("0"); + public InteractionPetTrampoline(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); + this.setExtraData("0"); } @Override @@ -32,7 +33,7 @@ public class InteractionPetTrampoline extends InteractionDefault { @Override public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) { - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); for (Pet pet : room.getRoomUnitManager().getPetsAt(oldLocation)) { @@ -43,7 +44,7 @@ public class InteractionPetTrampoline extends InteractionDefault { @Override public void onPickUp(Room room) { - this.setExtradata("0"); + this.setExtraData("0"); for (Pet pet : room.getPetsOnItem(this)) { pet.getRoomUnit().removeStatus(RoomUnitStatus.JUMP); @@ -57,24 +58,26 @@ public class InteractionPetTrampoline extends InteractionDefault { Pet pet = room.getRoomUnitManager().getPetByRoomUnit(roomUnit); - if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoalLocation())) { - if (pet.getEnergy() <= 35) { - return; - } + if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem())) { + if (this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getTargetPosition())) { + if (pet.getEnergy() <= 35) { + return; + } - pet.clearPosture(); - pet.setTask(PetTasks.JUMP); - pet.getRoomUnit().setStatus(RoomUnitStatus.JUMP, ""); - Emulator.getThreading().run(() -> { - new PetClearPosture(pet, RoomUnitStatus.JUMP, null, false); - pet.getRoomUnit().setGoalLocation(room.getRandomWalkableTile()); - this.setExtradata("0"); + pet.clearPosture(); + pet.setTask(PetTasks.JUMP); + pet.getRoomUnit().addStatus(RoomUnitStatus.JUMP, ""); + Emulator.getThreading().run(() -> { + new PetClearPosture(pet, RoomUnitStatus.JUMP, null, false); + pet.getRoomUnit().setGoalLocation(room.getRandomWalkableTile()); + this.setExtraData("0"); + room.updateItemState(this); + }, 4000); + pet.addHappiness(25); + + this.setExtraData("1"); room.updateItemState(this); - }, 4000); - pet.addHappiness(25); - - this.setExtradata("1"); - room.updateItemState(this); + } } } @@ -85,7 +88,7 @@ public class InteractionPetTrampoline extends InteractionDefault { Pet pet = room.getRoomUnitManager().getPetByRoomUnit(roomUnit); if (pet != null) { - this.setExtradata("0"); + this.setExtraData("0"); room.updateItem(this); pet.getRoomUnit().removeStatus(RoomUnitStatus.JUMP); pet.setPacketUpdate(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java index 2be0541d..1b381e01 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/pets/InteractionPetTree.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.threading.runnables.PetClearPosture; import java.sql.ResultSet; @@ -20,8 +21,8 @@ public class InteractionPetTree extends InteractionDefault { super(set, baseItem); } - public InteractionPetTree(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionPetTree(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -44,38 +45,40 @@ public class InteractionPetTree extends InteractionDefault { super.onWalkOn(roomUnit, room, objects); Pet pet = room.getRoomUnitManager().getPetByRoomUnit(roomUnit); - if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoalLocation())) { - RoomUnitStatus task = switch (pet.getTask()) { - case RING_OF_FIRE -> RoomUnitStatus.RINGOFFIRE; - case SWING -> RoomUnitStatus.SWING; - case ROLL -> RoomUnitStatus.ROLL; - default -> RoomUnitStatus.HANG; - }; - if (pet.getEnergy() >= 35 && task != RoomUnitStatus.HANG) { + if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem())) { + if (this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getTargetPosition())) { + RoomUnitStatus task = switch (pet.getTask()) { + case RING_OF_FIRE -> RoomUnitStatus.RINGOFFIRE; + case SWING -> RoomUnitStatus.SWING; + case ROLL -> RoomUnitStatus.ROLL; + default -> RoomUnitStatus.HANG; + }; + if (pet.getEnergy() >= 35 && task != RoomUnitStatus.HANG) { - pet.getRoomUnit().setCanWalk(false); - pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); - pet.getRoomUnit().clearStatuses(); - pet.getRoomUnit().setStatus(task, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); - pet.setPacketUpdate(true); - RoomUnitStatus finalTask = task; - Emulator.getThreading().run(() -> { - pet.addHappiness(25); - pet.getRoomUnit().clearStatuses(); - new PetClearPosture(pet, finalTask, null, true); - if (this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getCurrentPosition())) { - pet.getRoomUnit().setStatus(RoomUnitStatus.HANG, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); - } else { - pet.clearPosture(); - } - pet.getRoomUnit().setCanWalk(true); - pet.setPacketUpdate(true); - }, (long) 2500 + (Emulator.getRandom().nextInt(20) * 500)); - } else { - pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); - pet.getRoomUnit().clearStatuses(); - pet.getRoomUnit().setStatus(RoomUnitStatus.HANG, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); - pet.setPacketUpdate(true); + pet.getRoomUnit().setCanWalk(false); + pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); + pet.getRoomUnit().clearStatuses(); + pet.getRoomUnit().addStatus(task, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.setPacketUpdate(true); + RoomUnitStatus finalTask = task; + Emulator.getThreading().run(() -> { + pet.addHappiness(25); + pet.getRoomUnit().clearStatuses(); + new PetClearPosture(pet, finalTask, null, true); + if (this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getCurrentPosition())) { + pet.getRoomUnit().addStatus(RoomUnitStatus.HANG, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + } else { + pet.clearPosture(); + } + pet.getRoomUnit().setCanWalk(true); + pet.setPacketUpdate(true); + }, (long) 2500 + (Emulator.getRandom().nextInt(20) * 500)); + } else { + pet.getRoomUnit().setRotation(RoomRotation.values()[this.getRotation()]); + pet.getRoomUnit().clearStatuses(); + pet.getRoomUnit().addStatus(RoomUnitStatus.HANG, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.setPacketUpdate(true); + } } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java index f71e82b4..938a940f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemHead.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionDefault; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -17,14 +18,14 @@ public class InteractionTotemHead extends InteractionDefault { super(set, baseItem); } - public InteractionTotemHead(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTotemHead(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public TotemType getTotemType() { int extraData; try { - extraData = Integer.parseInt(this.getExtradata()); + extraData = Integer.parseInt(this.getExtraData()); } catch(NumberFormatException ex) { extraData = 0; } @@ -37,7 +38,7 @@ public class InteractionTotemHead extends InteractionDefault { public TotemColor getTotemColor() { int extraData; try { - extraData = Integer.parseInt(this.getExtradata()); + extraData = Integer.parseInt(this.getExtraData()); }catch(NumberFormatException ex) { extraData = 0; } @@ -51,22 +52,23 @@ public class InteractionTotemHead extends InteractionDefault { InteractionTotemLegs legs = null; for(RoomItem item : room.getRoomItemManager().getItemsAt(tile)) { - if(item instanceof InteractionTotemLegs && item.getZ() < this.getZ()) - legs = (InteractionTotemLegs)item; + if(item instanceof InteractionTotemLegs) { + if (item.getCurrentZ() < this.getCurrentZ()) legs = (InteractionTotemLegs) item; + } } if(legs == null) return; - this.setExtradata(((4 * this.getTotemType().getType()) + legs.getTotemColor().getColor()) - 1 + ""); + this.setExtraData(((4 * this.getTotemType().getType()) + legs.getTotemColor().getColor()) - 1 + ""); } public void updateTotemState(Room room) { - updateTotemState(room, room.getLayout().getTile(this.getX(), this.getY())); + updateTotemState(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); } public void updateTotemState(Room room, RoomTile tile) { - this.setExtradata(getTotemType().getType() - 1 + ""); + this.setExtraData(getTotemType().getType() - 1 + ""); update(room, tile); this.needsUpdate(true); room.updateItem(this); @@ -82,7 +84,7 @@ public class InteractionTotemHead extends InteractionDefault { newType = TotemType.TROLL; } - this.setExtradata(newType.getType() - 1 + ""); + this.setExtraData(newType.getType() - 1 + ""); updateTotemState(room); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java index 6648d9d3..db588c04 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemLegs.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionDefault; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -16,14 +17,14 @@ public class InteractionTotemLegs extends InteractionDefault { super(set, baseItem); } - public InteractionTotemLegs(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTotemLegs(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public TotemType getTotemType() { int extraData; try { - extraData = Integer.parseInt(this.getExtradata()); + extraData = Integer.parseInt(this.getExtraData()); } catch(NumberFormatException ex) { extraData = 0; } @@ -33,7 +34,7 @@ public class InteractionTotemLegs extends InteractionDefault { public TotemColor getTotemColor() { int extraData; try { - extraData = Integer.parseInt(this.getExtradata()); + extraData = Integer.parseInt(this.getExtraData()); } catch(NumberFormatException ex) { extraData = 0; } @@ -42,8 +43,9 @@ public class InteractionTotemLegs extends InteractionDefault { private void updateHead(Room room, RoomTile tile) { for(RoomItem item : room.getRoomItemManager().getItemsAt(tile)) { - if(item instanceof InteractionTotemHead && item.getZ() > this.getZ()) - ((InteractionTotemHead)item).updateTotemState(room); + if(item instanceof InteractionTotemHead) { + if (item.getCurrentZ() > this.getCurrentZ()) ((InteractionTotemHead) item).updateTotemState(room); + } } } @@ -54,7 +56,7 @@ public class InteractionTotemLegs extends InteractionDefault { if (room == null || !((client != null && room.getRoomRightsManager().hasRights(client.getHabbo())) || (objects.length >= 2 && objects[1] instanceof WiredEffectType))) return; - updateHead(room, room.getLayout().getTile(this.getX(), this.getY())); + updateHead(room, room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java index 45bd77df..fae2bab2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/totems/InteractionTotemPlanet.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionDefault; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.users.HabboInfo; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; @@ -16,14 +17,14 @@ public class InteractionTotemPlanet extends InteractionDefault { super(set, baseItem); } - public InteractionTotemPlanet(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public InteractionTotemPlanet(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public TotemPlanetType getPlanetType() { int extraData; try { - extraData = Integer.parseInt(this.getExtradata()); + extraData = Integer.parseInt(this.getExtraData()); } catch(NumberFormatException ex) { extraData = 0; } @@ -32,7 +33,7 @@ public class InteractionTotemPlanet extends InteractionDefault { @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - if(client.getHabbo().getHabboInfo().getId() != this.getOwnerId()) { + if(client.getHabbo().getHabboInfo().getId() != this.getOwnerInfo().getId()) { super.onClick(client, room, objects); return; } @@ -40,12 +41,13 @@ public class InteractionTotemPlanet extends InteractionDefault { InteractionTotemLegs legs = null; InteractionTotemHead head = null; - RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tile = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); THashSet items = room.getRoomItemManager().getItemsAt(tile); for(RoomItem item : items) { - if(item instanceof InteractionTotemLegs && item.getZ() < this.getZ()) - legs = (InteractionTotemLegs)item; + if(item instanceof InteractionTotemLegs) { + if (item.getCurrentZ() < this.getCurrentZ()) legs = (InteractionTotemLegs) item; + } } if(legs == null) { @@ -54,8 +56,9 @@ public class InteractionTotemPlanet extends InteractionDefault { } for(RoomItem item : items) { - if(item instanceof InteractionTotemHead && item.getZ() > legs.getZ()) - head = (InteractionTotemHead)item; + if(item instanceof InteractionTotemHead) { + if (item.getCurrentZ() > legs.getCurrentZ()) head = (InteractionTotemHead) item; + } } if(head == null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java index ceb229a5..ab5860ef 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionDateRangeActive.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -31,14 +32,14 @@ public class WiredConditionDateRangeActive extends InteractionWiredCondition { /** * Creates a new instance of this class. * @param id The ID of this item. - * @param userId The ID of the user that owns this item. + * @param ownerInfo The info of the user that owns this item. * @param item The item this instance is associated with. * @param extradata Additional data associated with this item. * @param limitedStack The amount of items in this stack (if this item is stackable). * @param limitedSells The amount of items that can be sold from this stack (if this item is sellable). */ - public WiredConditionDateRangeActive(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionDateRangeActive(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } /** diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java index b64aa729..cd6e7266 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveFurni.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import gnu.trove.set.hash.THashSet; @@ -18,8 +19,8 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionFurniHaveFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionFurniHaveFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -32,15 +33,21 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition { if (allFurni) { return this.getWiredSettings().getItems(room).stream().allMatch(item -> { - double minZ = item.getZ() + Item.getCurrentHeight(item); - THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - return occupiedTiles.stream().anyMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ)); + double minZ = item.getCurrentZ() + Item.getCurrentHeight(item); + THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + return occupiedTiles.stream().anyMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> { + if (matchedItem == item) return false; + return matchedItem.getCurrentZ() >= minZ; + })); }); } else { return this.getWiredSettings().getItems(room).stream().anyMatch(item -> { - double minZ = item.getZ() + Item.getCurrentHeight(item); - THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - return occupiedTiles.stream().anyMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ)); + double minZ = item.getCurrentZ() + Item.getCurrentHeight(item); + THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + return occupiedTiles.stream().anyMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> { + if (matchedItem == item) return false; + return matchedItem.getCurrentZ() >= minZ; + })); }); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveRoom.java index be439213..498f74ff 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveRoom.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import gnu.trove.set.hash.THashSet; @@ -20,8 +21,8 @@ public class WiredConditionFurniHaveRoom extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionFurniHaveRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionFurniHaveRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -35,7 +36,7 @@ public class WiredConditionFurniHaveRoom extends InteractionWiredCondition { Collection pets = room.getRoomUnitManager().getCurrentPets().values(); return this.getWiredSettings().getItems(room).stream().allMatch(item -> { - THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); return habbos.stream().anyMatch(character -> occupiedTiles.contains(character.getRoomUnit().getCurrentPosition())) || bots.stream().anyMatch(character -> occupiedTiles.contains(character.getRoomUnit().getCurrentPosition())) || pets.stream().anyMatch(character -> occupiedTiles.contains(character.getRoomUnit().getCurrentPosition())); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java index cf5f08b3..7e32cc42 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniTypeMatch.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionFurniTypeMatch(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionFurniTypeMatch(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java index 27551a22..243bc2f6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionGroupMember.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredConditionGroupMember extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionGroupMember(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionGroupMember(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java index f3de4bfe..439d7842 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionLessTimeElapsed.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionLessTimeElapsed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionLessTimeElapsed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java index d5d4c95a..148fe15e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java @@ -4,8 +4,9 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting; import lombok.Getter; @@ -26,8 +27,8 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition super(set, baseItem); } - public WiredConditionMatchStatePosition(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionMatchStatePosition(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -49,13 +50,13 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition } if(state) { - if(!item.getExtradata().equals(furniSettings.getState())) { + if(!item.getExtraData().equals(furniSettings.getState())) { return false; } } if(position) { - if (!(furniSettings.getX() == item.getX() && furniSettings.getY() == item.getY())) { + if (!(furniSettings.getX() == item.getCurrentPosition().getX() && furniSettings.getY() == item.getCurrentPosition().getY())) { return false; } } @@ -84,7 +85,7 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition List matchSettings = new ArrayList<>(); for (RoomItem item : this.getWiredSettings().getItems(room)) { - WiredMatchFurniSetting settings = new WiredMatchFurniSetting(item.getId(), item.getExtradata(), item.getRotation(), item.getX(), item.getY()); + WiredMatchFurniSetting settings = new WiredMatchFurniSetting(item.getId(), item.getExtraData(), item.getRotation(), item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); matchSettings.add(settings); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java index e22a6d4e..4b968654 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMoreTimeElapsed.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionMoreTimeElapsed(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionMoreTimeElapsed(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java index 38441142..7d6c9d76 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionType; import gnu.trove.set.hash.THashSet; @@ -19,8 +20,8 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionNotFurniHaveFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotFurniHaveFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -33,16 +34,22 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition { if(allFurni) { return this.getWiredSettings().getItems(room).stream().allMatch(item -> { - double minZ = item.getZ() + Item.getCurrentHeight(item); - THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - return occupiedTiles.stream().noneMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ)); + double minZ = item.getCurrentZ() + Item.getCurrentHeight(item); + THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + return occupiedTiles.stream().noneMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> { + if (matchedItem == item) return false; + return matchedItem.getCurrentZ() >= minZ; + })); }); } else { return this.getWiredSettings().getItems(room).stream().anyMatch(item -> { - double minZ = item.getZ() + Item.getCurrentHeight(item); - THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - return occupiedTiles.stream().noneMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ)); + double minZ = item.getCurrentZ() + Item.getCurrentHeight(item); + THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + return occupiedTiles.stream().noneMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> { + if (matchedItem == item) return false; + return matchedItem.getCurrentZ() >= minZ; + })); }); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveRoom.java index 60d9c148..bd60b14a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveRoom.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import gnu.trove.set.hash.THashSet; @@ -20,8 +21,8 @@ public class WiredConditionNotFurniHaveRoom extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionNotFurniHaveRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotFurniHaveRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -35,7 +36,7 @@ public class WiredConditionNotFurniHaveRoom extends InteractionWiredCondition { Collection pets = room.getRoomUnitManager().getCurrentPets().values(); return this.getWiredSettings().getItems(room).stream().noneMatch(item -> { - THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + THashSet occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); return habbos.stream().anyMatch(character -> occupiedTiles.contains(character.getRoomUnit().getCurrentPosition())) || bots.stream().anyMatch(character -> occupiedTiles.contains(character.getRoomUnit().getCurrentPosition())) || pets.stream().anyMatch(character -> occupiedTiles.contains(character.getRoomUnit().getCurrentPosition())); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java index 41a5c697..932842aa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniTypeMatch.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import gnu.trove.set.hash.THashSet; @@ -19,8 +20,8 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionNotFurniTypeMatch(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotFurniTypeMatch(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java index 28ea52a1..1b4450a1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInGroup.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredConditionNotInGroup extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionNotInGroup(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotInGroup(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java index 98654167..e8ada995 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotInTeam.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -19,8 +20,8 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionNotInTeam(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotInTeam(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java index 9f0378d0..b708916e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -13,8 +14,8 @@ public class WiredConditionNotMatchStatePosition extends WiredConditionMatchStat super(set, baseItem); } - public WiredConditionNotMatchStatePosition(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotMatchStatePosition(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomCount.java index 0573a042..6c9260c4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomCount.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomCount.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -13,8 +14,8 @@ public class WiredConditionNotRoomCount extends WiredConditionRoomCount { super(set, baseItem); } - public WiredConditionNotRoomCount(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotRoomCount(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomHasEffect.java index 68b0983d..185eff52 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomHasEffect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomHasEffect.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -13,8 +14,8 @@ public class WiredConditionNotRoomHasEffect extends WiredConditionRoomHasEffect super(set, baseItem); } - public WiredConditionNotRoomHasEffect(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotRoomHasEffect(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomWearsBadge.java index f95791d6..c58c97c2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomWearsBadge.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotRoomWearsBadge.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredConditionNotRoomWearsBadge extends WiredConditionRoomWearsBadg super(set, baseItem); } - public WiredConditionNotRoomWearsBadge(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotRoomWearsBadge(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java index 54fd82c7..322a82d9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredConditionNotTriggerOnFurni extends WiredConditionTriggerOnFurn super(set, baseItem); } - public WiredConditionNotTriggerOnFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionNotTriggerOnFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomCount.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomCount.java index 227e5ff0..bd80c4a8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomCount.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomCount.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredConditionRoomCount extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionRoomCount(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionRoomCount(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasEffect.java index a9dcf93d..63d97b87 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasEffect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasEffect.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredConditionRoomHasEffect extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionRoomHasEffect(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionRoomHasEffect(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasHandItem.java index 63a4f242..7cbcd262 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomHasHandItem.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import lombok.extern.slf4j.Slf4j; @@ -19,13 +20,13 @@ public class WiredConditionRoomHasHandItem extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionRoomHasHandItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionRoomHasHandItem(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - if (roomUnit == null || !(roomUnit instanceof RoomAvatar roomAvatar)) { + if (!(roomUnit instanceof RoomAvatar roomAvatar)) { return false; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomWearsBadge.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomWearsBadge.java index 24919fde..415a4c3e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomWearsBadge.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionRoomWearsBadge.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -16,8 +17,8 @@ public class WiredConditionRoomWearsBadge extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionRoomWearsBadge(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionRoomWearsBadge(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java index c88d9631..fe4763a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTeamMember.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionType; import java.sql.ResultSet; @@ -19,8 +20,8 @@ public class WiredConditionTeamMember extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionTeamMember(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionTeamMember(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java index e1601d17..92a564a3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionType; import gnu.trove.set.hash.THashSet; @@ -17,8 +18,8 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition { super(set, baseItem); } - public WiredConditionTriggerOnFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredConditionTriggerOnFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectAlert.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectAlert.java index 058b5e42..7455518f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectAlert.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectAlert.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -14,8 +15,8 @@ public class WiredEffectAlert extends WiredEffectWhisper { super(set, baseItem); } - public WiredEffectAlert(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectAlert(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java index 37718273..cef31e8d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotClothes.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredEffectBotClothes extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectBotClothes(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectBotClothes(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowRoom.java index 8954d19f..f7f29026 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotFollowRoom.java @@ -1,12 +1,15 @@ package com.eu.habbo.habbohotel.items.interactions.wired.effects; +import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; +import com.eu.habbo.threading.runnables.BotFollowHabbo; import java.sql.ResultSet; import java.sql.SQLException; @@ -19,8 +22,8 @@ public class WiredEffectBotFollowRoom extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectBotFollowRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectBotFollowRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -32,9 +35,10 @@ public class WiredEffectBotFollowRoom extends InteractionWiredEffect { Bot bot = bots.get(0); if (this.getWiredSettings().getIntegerParams().get(PARAM_MODE) == 1) { - bot.startFollowingHabbo(habbo); + bot.setFollowingHabboId(habbo.getHabboInfo().getId()); + Emulator.getThreading().run(new BotFollowHabbo(bot, habbo, habbo.getRoomUnit().getRoom())); } else { - bot.stopFollowingHabbo(); + bot.setFollowingHabboId(0); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java index cc037fbc..1bd29b60 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotGiveHandItem.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -26,8 +27,8 @@ public class WiredEffectBotGiveHandItem extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectBotGiveHandItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectBotGiveHandItem(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java index f81f59b9..8377b39c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalk.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -22,8 +23,8 @@ public class WiredEffectBotTalk extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectBotTalk(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectBotTalk(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToRoom.java index 29cc3fad..a74dd952 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTalkToRoom.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -22,8 +23,8 @@ public class WiredEffectBotTalkToRoom extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectBotTalkToRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectBotTalkToRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index a45622a4..930c2c09 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomBot; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.outgoing.rooms.users.AvatarEffectMessageComposer; @@ -26,8 +27,8 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectBotTeleport(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectBotTeleport(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -53,7 +54,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect { Room room1 = bot.getRoom(); if (item.getRoomId() == room1.getRoomInfo().getId()) { if (i == j) { - teleportUnitToTile(bot.getRoomUnit(), room.getLayout().getTile(item.getX(), item.getY())); + teleportUnitToTile(bot.getRoomUnit(), room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); return true; } else { j++; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java index 52d798df..cafd087c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotWalkToFurni.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -19,8 +20,8 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectBotWalkToFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectBotWalkToFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -55,7 +56,7 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect { if (item.getRoomId() != 0) { Room room1 = bot.getRoom(); if (item.getRoomId() == room1.getRoomInfo().getId()) { - bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY())); + bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java index 38da5f61..91e4b76a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java @@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredChangeDirectionSetting; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; @@ -44,8 +45,8 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { this.itemsSettings = new HashMap<>(); } - public WiredEffectChangeFurniDirection(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectChangeFurniDirection(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.itemsSettings = new HashMap<>(); } @@ -85,12 +86,12 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { new WiredChangeDirectionSetting(item.getId(), item.getRotation(), startDirection) ); - RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), setting.getDirection().getValue()); + RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), setting.getDirection().getValue()); int count = 1; while ((targetTile == null || targetTile.getState() == RoomTileState.INVALID || !room.getLayout().tileWalkable(targetTile) || room.getRoomItemManager().furnitureFitsAt(targetTile, item, item.getRotation(), false) != FurnitureMovementError.NONE) && count < 8) { setting.setDirection(this.nextDirection(setting.getDirection())); - RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), setting.getDirection().getValue()); + RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), setting.getDirection().getValue()); if (tile != null && tile.getState() != RoomTileState.INVALID) { targetTile = tile; } @@ -100,7 +101,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { int newDirectionValue = setting.getDirection().getValue(); - RoomTile newTargetTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), newDirectionValue); + RoomTile newTargetTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), newDirectionValue); if(item.getRotation() != setting.getRotation()) { if(room.getRoomItemManager().furnitureFitsAt(newTargetTile, item, setting.getRotation(), false) != FurnitureMovementError.NONE) @@ -124,10 +125,10 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect { if (newTargetTile != null && newTargetTile.getState() != RoomTileState.INVALID && room.getRoomItemManager().furnitureFitsAt(targetTile, item, item.getRotation(), false) == FurnitureMovementError.NONE) { if (!hasRoomUnits) { - RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY()); - double oldZ = item.getZ(); + RoomTile oldLocation = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + double oldZ = item.getCurrentZ(); if (room.getRoomItemManager().moveItemTo(item, newTargetTile, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) { - room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, targetTile, item.getZ(), 0, room).compose()); + room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, targetTile, item.getCurrentZ(), 0, room).compose()); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java index 947444e6..bbf01674 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveEffect.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,8 +14,8 @@ public class WiredEffectGiveEffect extends WiredEffectWhisper { super(set, baseItem); } - public WiredEffectGiveEffect(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveEffect(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java index bcdf33c9..52992a2d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHandItem.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.rooms.users.CarryObjectMessageComposer; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class WiredEffectGiveHandItem extends WiredEffectWhisper { super(set, baseItem); } - public WiredEffectGiveHandItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveHandItem(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java index 500c6bfb..89052f26 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewBonusRarePoints.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.hotelview.BonusRareInfoMessageComposer; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends WiredEffectWhisper super(set, baseItem); } - public WiredEffectGiveHotelviewBonusRarePoints(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveHotelviewBonusRarePoints(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java index 041c99f7..8e7db2a9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveHotelviewHofPoints.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -16,8 +17,8 @@ public class WiredEffectGiveHotelviewHofPoints extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectGiveHotelviewHofPoints(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveHotelviewHofPoints(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java index e26332f6..28d42cfe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveRespect.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectGiveRespect(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveRespect(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public WiredEffectType getType() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java index 67d46f1d..96b552bc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredGiveRewardItem; import com.eu.habbo.habbohotel.wired.WiredHandler; @@ -31,8 +32,8 @@ public class WiredEffectGiveReward extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectGiveReward(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveReward(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java index 8be92006..47f4b591 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScore.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import gnu.trove.iterator.TObjectIntIterator; import gnu.trove.map.TObjectIntMap; @@ -25,8 +26,8 @@ public class WiredEffectGiveScore extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectGiveScore(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveScore(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java index 6df99b14..7507c887 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveScoreToTeam.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import gnu.trove.map.hash.TIntIntHashMap; @@ -22,8 +23,8 @@ public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect { private final GameTeamColors DEFAULT_TEAM = GameTeamColors.RED; - public WiredEffectGiveScoreToTeam(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectGiveScoreToTeam(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } public WiredEffectGiveScoreToTeam(ResultSet set, Item baseItem) throws SQLException { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java index 7d9fd773..3b0c7695 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectJoinTeam.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -21,8 +22,8 @@ public class WiredEffectJoinTeam extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectJoinTeam(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectJoinTeam(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickRoom.java index 12523f21..fd258d8e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectKickRoom.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.outgoing.rooms.users.WhisperMessageComposer; import com.eu.habbo.threading.runnables.RoomUnitKick; @@ -21,8 +22,8 @@ public class WiredEffectKickRoom extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectKickRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectKickRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java index c85bb9b5..40d38583 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectLeaveTeam.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredEffectLeaveTeam extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectLeaveTeam(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectLeaveTeam(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index b7e72b6a..2d6b44d5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; @@ -33,8 +34,8 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int super(set, baseItem); } - public WiredEffectMatchFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectMatchFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -56,14 +57,14 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int } if (state && (this.checkForWiredResetPermission && item.allowWiredResetState())) { - if (!furniSettings.getState().equals(" ") && !item.getExtradata().equals(furniSettings.getState())) { - item.setExtradata(furniSettings.getState()); + if (!furniSettings.getState().equals(" ") && !item.getExtraData().equals(furniSettings.getState())) { + item.setExtraData(furniSettings.getState()); room.updateItemState(item); } } - RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY()); - double oldZ = item.getZ(); + RoomTile oldLocation = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + double oldZ = item.getCurrentZ(); if(rotation && !position) { if (item.getRotation() != furniSettings.getRotation() && room.getRoomItemManager().furnitureFitsAt(oldLocation, item, furniSettings.getRotation(), false) == FurnitureMovementError.NONE) { @@ -79,7 +80,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int boolean sendUpdates = !slideAnimation; if (room.getRoomItemManager().moveItemTo(item, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE) { if (slideAnimation) { - room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose()); + room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getCurrentZ(), 0, room).compose()); } } } @@ -103,7 +104,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int List matchSettings = new ArrayList<>(); for (RoomItem item : this.getWiredSettings().getItems(room)) { - WiredMatchFurniSetting settings = new WiredMatchFurniSetting(item.getId(), this.checkForWiredResetPermission && item.allowWiredResetState() ? item.getExtradata() : " ", item.getRotation(), item.getX(), item.getY()); + WiredMatchFurniSetting settings = new WiredMatchFurniSetting(item.getId(), this.checkForWiredResetPermission && item.allowWiredResetState() ? item.getExtraData() : " ", item.getRotation(), item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); matchSettings.add(settings); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java index fea4a33f..0863a048 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniAway.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -23,14 +24,14 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectMoveFurniAway(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectMoveFurniAway(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { for (RoomItem item : this.getWiredSettings().getItems(room)) { - RoomTile t = room.getLayout().getTile(item.getX(), item.getY()); + RoomTile t = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); RoomUnit target = room.getRoomUnitManager().getCurrentRoomUnits().values().stream().min(Comparator.comparingDouble(a -> a.getCurrentPosition().distance(t))).orElse(null); @@ -43,25 +44,25 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { int x = 0; int y = 0; - if (target.getCurrentPosition().getX() == item.getX()) { - if (item.getY() < target.getCurrentPosition().getY()) + if (target.getCurrentPosition().getX() == item.getCurrentPosition().getX()) { + if (item.getCurrentPosition().getY() < target.getCurrentPosition().getY()) y--; else y++; } else { - if (target.getCurrentPosition().getY() == item.getY()) { - if (item.getX() < target.getCurrentPosition().getX()) + if (target.getCurrentPosition().getY() == item.getCurrentPosition().getY()) { + if (item.getCurrentPosition().getX() < target.getCurrentPosition().getX()) x--; else x++; } else { - if (target.getCurrentPosition().getX() - item.getX() > target.getCurrentPosition().getY() - item.getY()) { - if (target.getCurrentPosition().getX() - item.getX() > 0) + if (target.getCurrentPosition().getX() - item.getCurrentPosition().getX() > target.getCurrentPosition().getY() - item.getCurrentPosition().getY()) { + if (target.getCurrentPosition().getX() - item.getCurrentPosition().getX() > 0) x--; else x++; } else { - if (target.getCurrentPosition().getY() - item.getY() > 0) + if (target.getCurrentPosition().getY() - item.getCurrentPosition().getY() > 0) y--; else y++; @@ -69,13 +70,13 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect { } } - RoomTile newLocation = room.getLayout().getTile((short) (item.getX() + x), (short) (item.getY() + y)); - RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY()); - double oldZ = item.getZ(); + RoomTile newLocation = room.getLayout().getTile((short) (item.getCurrentPosition().getX() + x), (short) (item.getCurrentPosition().getY() + y)); + RoomTile oldLocation = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + double oldZ = item.getCurrentZ(); if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && newLocation != oldLocation && room.getRoomItemManager().furnitureFitsAt(newLocation, item, item.getRotation(), true) == FurnitureMovementError.NONE) { if (room.getRoomItemManager().moveItemTo(item, newLocation, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) { - room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose()); + room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getCurrentZ(), 0, room).compose()); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java index a6bb37ee..f1a2126a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java @@ -5,8 +5,9 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import gnu.trove.set.hash.THashSet; @@ -22,8 +23,8 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectMoveFurniTo(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectMoveFurniTo(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -50,10 +51,10 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect { if (randomItem != null) { int indexOffset = 0; - RoomTile objectTile = room.getLayout().getTile(randomItem.getX(), randomItem.getY()); + RoomTile objectTile = room.getLayout().getTile(randomItem.getCurrentPosition().getX(), randomItem.getCurrentPosition().getY()); if (objectTile != null) { - THashSet refreshTiles = room.getLayout().getTilesAt(room.getLayout().getTile(((RoomItem) object).getX(), ((RoomItem) object).getY()), ((RoomItem) object).getBaseItem().getWidth(), ((RoomItem) object).getBaseItem().getLength(), ((RoomItem) object).getRotation()); + THashSet refreshTiles = room.getLayout().getTilesAt(room.getLayout().getTile(((RoomItem) object).getCurrentPosition().getX(), ((RoomItem) object).getCurrentPosition().getY()), ((RoomItem) object).getBaseItem().getWidth(), ((RoomItem) object).getBaseItem().getLength(), ((RoomItem) object).getRotation()); RoomTile tile = room.getLayout().getTileInFront(objectTile, direction, indexOffset); if (tile == null || !tile.getAllowStack()) { @@ -61,8 +62,8 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect { tile = room.getLayout().getTileInFront(objectTile, direction, indexOffset); } - room.sendComposer(new FloorItemOnRollerComposer((RoomItem) object, null, tile, tile.getStackHeight() - ((RoomItem) object).getZ(), room).compose()); - refreshTiles.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(((RoomItem) object).getX(), ((RoomItem) object).getY()), ((RoomItem) object).getBaseItem().getWidth(), ((RoomItem) object).getBaseItem().getLength(), ((RoomItem) object).getRotation())); + room.sendComposer(new FloorItemOnRollerComposer((RoomItem) object, null, tile, tile.getStackHeight() - ((RoomItem) object).getCurrentZ(), room).compose()); + refreshTiles.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(((RoomItem) object).getCurrentPosition().getX(), ((RoomItem) object).getCurrentPosition().getY()), ((RoomItem) object).getBaseItem().getWidth(), ((RoomItem) object).getBaseItem().getLength(), ((RoomItem) object).getRotation())); room.updateTiles(refreshTiles); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java index b6041ae0..dba15814 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTowards.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import com.eu.habbo.threading.runnables.WiredCollissionRunnable; @@ -32,8 +33,8 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { this.lastDirections = new THashMap<>(); } - public WiredEffectMoveFurniTowards(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectMoveFurniTowards(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.lastDirections = new THashMap<>(); } @@ -41,7 +42,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { List availableDirections = new ArrayList<>(); RoomLayout layout = room.getLayout(); - RoomTile currentTile = layout.getTile(item.getX(), item.getY()); + RoomTile currentTile = layout.getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); RoomRotation[] rotations = new RoomRotation[]{RoomRotation.NORTH, RoomRotation.EAST, RoomRotation.SOUTH, RoomRotation.WEST}; @@ -96,7 +97,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { RoomRotation[] rotations = new RoomRotation[]{RoomRotation.NORTH, RoomRotation.EAST, RoomRotation.SOUTH, RoomRotation.WEST}; for (RoomRotation rot : rotations) { - RoomTile startTile = layout.getTile(item.getX(), item.getY()); + RoomTile startTile = layout.getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); for (int ii = 0; ii <= i; ii++) { if (startTile == null) @@ -123,25 +124,25 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { continue; if (target != null) { - if (target.getCurrentPosition().getX() == item.getX()) { - if (item.getY() < target.getCurrentPosition().getY()) + if (target.getCurrentPosition().getX() == item.getCurrentPosition().getX()) { + if (item.getCurrentPosition().getY() < target.getCurrentPosition().getY()) moveDirection = RoomRotation.SOUTH; else moveDirection = RoomRotation.NORTH; } else { - if (target.getCurrentPosition().getY() == item.getY()) { - if (item.getX() < target.getCurrentPosition().getX()) + if (target.getCurrentPosition().getY() == item.getCurrentPosition().getY()) { + if (item.getCurrentPosition().getX() < target.getCurrentPosition().getX()) moveDirection = RoomRotation.EAST; else moveDirection = RoomRotation.WEST; } else { - if (target.getCurrentPosition().getX() - item.getX() > target.getCurrentPosition().getY() - item.getY()) { - if (target.getCurrentPosition().getX() - item.getX() > 0) + if (target.getCurrentPosition().getX() - item.getCurrentPosition().getX() > target.getCurrentPosition().getY() - item.getCurrentPosition().getY()) { + if (target.getCurrentPosition().getX() - item.getCurrentPosition().getX() > 0) moveDirection = RoomRotation.EAST; else moveDirection = RoomRotation.WEST; } else { - if (target.getCurrentPosition().getY() - item.getY() > 0) + if (target.getCurrentPosition().getY() - item.getCurrentPosition().getY() > 0) moveDirection = RoomRotation.SOUTH; else moveDirection = RoomRotation.NORTH; @@ -193,16 +194,16 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect { } } - RoomTile newTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getX(), item.getY()), moveDirection.getValue()); + RoomTile newTile = room.getLayout().getTileInFront(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), moveDirection.getValue()); - RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY()); - double oldZ = item.getZ(); + RoomTile oldLocation = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + double oldZ = item.getCurrentZ(); if(newTile != null) { lastDirections.put(item.getId(), moveDirection); if (newTile.getState() != RoomTileState.INVALID && newTile != oldLocation && room.getRoomItemManager().furnitureFitsAt(newTile, item, item.getRotation(), true) == FurnitureMovementError.NONE) { if (room.getRoomItemManager().moveItemTo(item, newTile, item.getRotation(), null, false, true) == FurnitureMovementError.NONE) { - room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newTile, item.getZ(), 0, room).compose()); + room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newTile, item.getCurrentZ(), 0, room).compose()); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java index 24346c91..d18fe1e1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java @@ -11,6 +11,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import gnu.trove.set.hash.THashSet; @@ -29,8 +30,8 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement super(set, baseItem); } - public WiredEffectMoveRotateFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectMoveRotateFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -52,15 +53,15 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement for (RoomItem item : this.getWiredSettings().getItems(room)) { int newRotation = rotation > 0 ? this.getNewRotation(item, rotation) : item.getRotation(); - RoomTile newLocation = room.getLayout().getTile(item.getX(), item.getY()); - RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY()); - double oldZ = item.getZ(); + RoomTile newLocation = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + RoomTile oldLocation = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + double oldZ = item.getCurrentZ(); if(direction > 0) { RoomRotation moveDirection = this.getMovementDirection(direction); newLocation = room.getLayout().getTile( - (short) (item.getX() + ((moveDirection == RoomRotation.WEST || moveDirection == RoomRotation.NORTH_WEST || moveDirection == RoomRotation.SOUTH_WEST) ? -1 : (((moveDirection == RoomRotation.EAST || moveDirection == RoomRotation.SOUTH_EAST || moveDirection == RoomRotation.NORTH_EAST) ? 1 : 0)))), - (short) (item.getY() + ((moveDirection == RoomRotation.NORTH || moveDirection == RoomRotation.NORTH_EAST || moveDirection == RoomRotation.NORTH_WEST) ? 1 : ((moveDirection == RoomRotation.SOUTH || moveDirection == RoomRotation.SOUTH_EAST || moveDirection == RoomRotation.SOUTH_WEST) ? -1 : 0))) + (short) (item.getCurrentPosition().getX() + ((moveDirection == RoomRotation.WEST || moveDirection == RoomRotation.NORTH_WEST || moveDirection == RoomRotation.SOUTH_WEST) ? -1 : (((moveDirection == RoomRotation.EAST || moveDirection == RoomRotation.SOUTH_EAST || moveDirection == RoomRotation.NORTH_EAST) ? 1 : 0)))), + (short) (item.getCurrentPosition().getY() + ((moveDirection == RoomRotation.NORTH || moveDirection == RoomRotation.NORTH_EAST || moveDirection == RoomRotation.NORTH_WEST) ? 1 : ((moveDirection == RoomRotation.SOUTH || moveDirection == RoomRotation.SOUTH_EAST || moveDirection == RoomRotation.SOUTH_WEST) ? -1 : 0))) ); } @@ -72,7 +73,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect implement boolean sendUpdates = !slideAnimation; if (room.getRoomItemManager().moveItemTo(item, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE) { if (slideAnimation) { - room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose()); + room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getCurrentZ(), 0, room).compose()); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteRoom.java index a7917d16..53c1b449 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMuteRoom.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.outgoing.rooms.users.WhisperMessageComposer; @@ -21,8 +22,8 @@ public class WiredEffectMuteRoom extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectMuteRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectMuteRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java index 85d12667..3c49cab4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectResetTimers.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.threading.runnables.WiredResetTimers; @@ -16,8 +17,8 @@ public class WiredEffectResetTimers extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectResetTimers(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectResetTimers(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java index 7f75979d..5172ea41 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.outgoing.rooms.users.AvatarEffectMessageComposer; @@ -31,8 +32,8 @@ public class WiredEffectTeleport extends InteractionWiredEffect { this.items = new ArrayList<>(); } - public WiredEffectTeleport(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectTeleport(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.items = new ArrayList<>(); } @@ -48,7 +49,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect { RoomItem randomItem = items[randomItemIndex]; - teleportUnitToTile(roomUnit, room.getLayout().getTile(randomItem.getX(), randomItem.getY())); + teleportUnitToTile(roomUnit, room.getLayout().getTile(randomItem.getCurrentPosition().getX(), randomItem.getCurrentPosition().getY())); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java index 151120d4..11ce95c7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java @@ -17,6 +17,7 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import lombok.extern.slf4j.Slf4j; @@ -73,8 +74,8 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectToggleFurni(int id, int userId, Item item, String extraData, int limitedStack, int limitedSells) { - super(id, userId, item, extraData, limitedStack, limitedSells); + public WiredEffectToggleFurni(int id, HabboInfo ownerInfo, Item item, String extraData, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extraData, limitedStack, limitedSells); } @Override @@ -98,9 +99,9 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { if (item.getBaseItem().getStateCount() > 1 || item instanceof InteractionGameTimer) { int state = 0; - if (!item.getExtradata().isEmpty()) { + if (!item.getExtraData().isEmpty()) { try { - state = Integer.parseInt(item.getExtradata()); // assumes that extradata is state, could be something else for trophies etc. + state = Integer.parseInt(item.getExtraData()); // assumes that extradata is state, could be something else for trophies etc. } catch (NumberFormatException ignored) { } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java index d5e0394a..b91a3327 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java @@ -14,8 +14,9 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField; import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole; import com.eu.habbo.habbohotel.items.interactions.pets.*; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import lombok.extern.slf4j.Slf4j; @@ -70,8 +71,8 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectToggleRandom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectToggleRandom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -82,7 +83,7 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect { } try { - item.setExtradata(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + ""); + item.setExtraData(Emulator.getRandom().nextInt(item.getBaseItem().getStateCount() + 1) + ""); room.updateItem(item); } catch (Exception e) { log.error("Caught exception", e); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java index db60860e..30923e0f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTriggerStacks.java @@ -4,8 +4,9 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import gnu.trove.set.hash.THashSet; @@ -18,8 +19,8 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectTriggerStacks(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectTriggerStacks(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -41,14 +42,14 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect { { found = false; for (RoomTile tile : usedTiles) { - if (tile.getX() == item.getX() && tile.getY() == item.getY()) { + if (tile.getX() == item.getCurrentPosition().getX() && tile.getY() == item.getCurrentPosition().getY()) { found = true; break; } } if (!found) { - usedTiles.add(room.getLayout().getTile(item.getX(), item.getY())); + usedTiles.add(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java index c810d135..4afa7d97 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessage; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -21,8 +22,8 @@ public class WiredEffectWhisper extends InteractionWiredEffect { super(set, baseItem); } - public WiredEffectWhisper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredEffectWhisper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java index 80c8ad87..3f3f1396 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java @@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionDefault; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import lombok.AllArgsConstructor; import lombok.Getter; @@ -39,8 +40,8 @@ public class WiredBlob extends InteractionDefault { this.parseCustomParams(); } - public WiredBlob(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredBlob(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); this.parseCustomParams(); } @@ -49,7 +50,7 @@ public class WiredBlob extends InteractionDefault { public void onPlace(Room room) { super.onPlace(room); - this.setExtradata(WiredBlobState.USED.getState()); + this.setExtraData(WiredBlobState.USED.getState()); room.updateItem(this); } @@ -57,7 +58,7 @@ public class WiredBlob extends InteractionDefault { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - if (!this.getExtradata().equals(WiredBlobState.ACTIVE.getState())) return; + if (!this.getExtraData().equals(WiredBlobState.ACTIVE.getState())) return; Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); @@ -73,7 +74,7 @@ public class WiredBlob extends InteractionDefault { battleBanzaiGame.refreshCounters(habbo.getHabboInfo().getGamePlayer().getTeamColor()); } - this.setExtradata(WiredBlobState.USED.getState()); + this.setExtraData(WiredBlobState.USED.getState()); room.updateItem(this); } } @@ -82,20 +83,20 @@ public class WiredBlob extends InteractionDefault { @Override public void onClick(GameClient client, Room room, Object[] objects) { if (!this.RESETS_WITH_GAME && objects != null && objects.length == 2 && objects[1].equals(WiredEffectType.TOGGLE_STATE) && room.getGames().stream().anyMatch(game -> game.getState().equals(GameState.RUNNING) || game.getState().equals(GameState.PAUSED))) { - this.setExtradata(this.getExtradata().equals(WiredBlobState.ACTIVE.getState()) ? WiredBlobState.USED.getState() : WiredBlobState.ACTIVE.getState()); + this.setExtraData(this.getExtraData().equals(WiredBlobState.ACTIVE.getState()) ? WiredBlobState.USED.getState() : WiredBlobState.ACTIVE.getState()); room.updateItem(this); } } public void onGameStart(Room room) { if (this.RESETS_WITH_GAME) { - this.setExtradata(WiredBlobState.ACTIVE.getState()); + this.setExtraData(WiredBlobState.ACTIVE.getState()); room.updateItem(this); } } public void onGameEnd(Room room) { - this.setExtradata(WiredBlobState.USED.getState()); + this.setExtraData(WiredBlobState.USED.getState()); room.updateItem(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraRandom.java index 9bf933fd..edd2321d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraRandom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraRandom.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredExtra; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import java.sql.ResultSet; import java.sql.SQLException; @@ -13,8 +14,8 @@ public class WiredExtraRandom extends InteractionWiredExtra { super(set, baseItem); } - public WiredExtraRandom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredExtraRandom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraUnseen.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraUnseen.java index d986d04f..73b05345 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraUnseen.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraUnseen.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredExtra; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import lombok.Getter; import java.sql.ResultSet; @@ -21,8 +22,8 @@ public class WiredExtraUnseen extends InteractionWiredExtra { super(set, baseItem); } - public WiredExtraUnseen(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredExtraUnseen(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java index 67369e34..6b7aade0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtSetTime.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.WiredTriggerReset; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.threading.runnables.WiredExecuteTask; @@ -21,8 +22,8 @@ public class WiredTriggerAtSetTime extends InteractionWiredTrigger implements Wi super(set, baseItem); } - public WiredTriggerAtSetTime(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerAtSetTime(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java index 270e9f98..56ad9c57 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerAtTimeLong.java @@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.WiredTriggerReset; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.threading.runnables.WiredExecuteTask; @@ -20,8 +21,8 @@ public class WiredTriggerAtTimeLong extends InteractionWiredTrigger implements W super(set, baseItem); } - public WiredTriggerAtTimeLong(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerAtTimeLong(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java index 1ff5b7ea..1776fa03 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedFurni.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import lombok.extern.slf4j.Slf4j; @@ -17,8 +18,8 @@ public class WiredTriggerBotReachedFurni extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerBotReachedFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerBotReachedFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedRoom.java index 2d469a3a..93758c00 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerBotReachedRoom.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class WiredTriggerBotReachedRoom extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerBotReachedRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerBotReachedRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java index bd6233b6..da95fec8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerCollision.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredTriggerCollision extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerCollision(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerCollision(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java index aa086241..7d8257e8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerFurniStateToggled.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -16,8 +17,8 @@ public class WiredTriggerFurniStateToggled extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerFurniStateToggled(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerFurniStateToggled(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java index 875cece9..3dca0c5f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameEnds.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class WiredTriggerGameEnds extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerGameEnds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerGameEnds(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java index 8f199f99..d563cd1c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerGameStarts.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -14,8 +15,8 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerGameStarts(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerGameStarts(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java index 183a13b7..a194425c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeater.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.WiredTriggerR import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import lombok.Setter; @@ -25,8 +26,8 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements IWi super(set, baseItem); } - public WiredTriggerRepeater(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerRepeater(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -54,7 +55,7 @@ public class WiredTriggerRepeater extends InteractionWiredTrigger implements IWi @Override public void onPickUp(Room room) { - RoomTile oldLocation = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile oldLocation = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if(room.getTriggersOnRoom().containsKey(oldLocation)) { if(room.getTriggersOnRoom().get(oldLocation).getId() == this.getId()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java index f4691557..41d05b1d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRepeaterLong.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.WiredTriggerR import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import lombok.Setter; @@ -24,8 +25,8 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements super(set, baseItem); } - public WiredTriggerRepeaterLong(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerRepeaterLong(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override @@ -53,7 +54,7 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements @Override public void onPickUp(Room room) { - RoomTile oldLocation = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile oldLocation = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if(room.getTriggersOnRoom().containsKey(oldLocation)) { if(room.getTriggersOnRoom().get(oldLocation).getId() == this.getId()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomEntersRoom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomEntersRoom.java index 5cefe33e..9fc0b6d2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomEntersRoom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomEntersRoom.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredTriggerRoomEntersRoom extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerRoomEntersRoom(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerRoomEntersRoom(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomSaysKeyword.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomSaysKeyword.java index f7d76934..1c19b48a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomSaysKeyword.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomSaysKeyword.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -17,8 +18,8 @@ public class WiredTriggerRoomSaysKeyword extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerRoomSaysKeyword(int id, int userId, Item item, String extraData, int limitedStack, int limitedSells) { - super(id, userId, item, extraData, limitedStack, limitedSells); + public WiredTriggerRoomSaysKeyword(int id, HabboInfo ownerInfo, Item item, String extraData, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extraData, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOffFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOffFurni.java index 8c944f28..42af4a53 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOffFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOffFurni.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredTriggerRoomWalkOffFurni extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerRoomWalkOffFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerRoomWalkOffFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOnFurni.java index b17b3179..da3b0c56 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerRoomWalkOnFurni.java @@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -15,8 +16,8 @@ public class WiredTriggerRoomWalkOnFurni extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerRoomWalkOnFurni(int id, int userId, Item item, String extraData, int limitedStack, int limitedSells) { - super(id, userId, item, extraData, limitedStack, limitedSells); + public WiredTriggerRoomWalkOnFurni(int id, HabboInfo ownerInfo, Item item, String extraData, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extraData, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java index a580c991..5e189abe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerScoreAchieved.java @@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -16,8 +17,8 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger { super(set, baseItem); } - public WiredTriggerScoreAchieved(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerScoreAchieved(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamLoses.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamLoses.java index feee2674..8b5521a4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamLoses.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamLoses.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -11,8 +12,8 @@ public class WiredTriggerTeamLoses extends WiredTriggerGameStarts { super(set, baseItem); } - public WiredTriggerTeamLoses(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerTeamLoses(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamWins.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamWins.java index afe8124c..ce03c230 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamWins.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerTeamWins.java @@ -1,6 +1,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import java.sql.ResultSet; @@ -11,8 +12,8 @@ public class WiredTriggerTeamWins extends WiredTriggerGameStarts { super(set, baseItem); } - public WiredTriggerTeamWins(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { - super(id, userId, item, extradata, limitedStack, limitedSells); + public WiredTriggerTeamWins(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) { + super(id, ownerInfo, item, extradata, limitedStack, limitedSells); } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java index 5f142514..ffbf0673 100644 --- a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java +++ b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.achievements.Achievement; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.outgoing.friends.UpdateFriendComposer; import com.eu.habbo.plugin.events.users.friends.UserAcceptFriendRequestEvent; import gnu.trove.map.hash.THashMap; @@ -77,7 +76,7 @@ public class Messenger { if (user != null) { habboInfo = user.getHabboInfo(); } else { - habboInfo = HabboManager.getOfflineHabboInfo(friend); + habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(friend); } if (habboInfo == null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index d298f236..7eaa80ca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomState; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.outgoing.modtool.IssueCloseNotificationMessageComposer; import com.eu.habbo.messages.outgoing.modtool.IssueInfoMessageComposer; @@ -415,7 +414,7 @@ public class ModToolManager { List bans = new ArrayList<>(); Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(targetUserId); - HabboInfo offlineInfo = target != null ? target.getHabboInfo() : HabboManager.getOfflineHabboInfo(targetUserId); + HabboInfo offlineInfo = target != null ? target.getHabboInfo() : Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(targetUserId); if (moderator.getHabboInfo().getPermissionGroup().getId() < offlineInfo.getPermissionGroup().getId()) { return bans; diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java index 2b378fa4..74079858 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java @@ -157,7 +157,7 @@ public class MonsterplantPet extends Pet implements IPetLook { } this.getRoomUnit().clearStatuses(); - this.getRoomUnit().setStatus(RoomUnitStatus.RIP, ""); + this.getRoomUnit().addStatus(RoomUnitStatus.RIP, ""); this.setPacketUpdate(true); } else { int difference = Emulator.getIntUnixTimestamp() - this.created + 1; @@ -181,7 +181,7 @@ public class MonsterplantPet extends Pet implements IPetLook { if (g > this.growthStage) { this.growthStage = g; this.getRoomUnit().clearStatuses(); - this.getRoomUnit().setStatus(RoomUnitStatus.fromString("grw" + this.growthStage), ""); + this.getRoomUnit().addStatus(RoomUnitStatus.fromString("grw" + this.growthStage), ""); this.setPacketUpdate(true); } } @@ -305,8 +305,8 @@ public class MonsterplantPet extends Pet implements IPetLook { this.room.sendComposer(new PetStatusUpdateComposer(pet).compose()); this.room.sendComposer(new PetStatusUpdateComposer(this).compose()); - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "reb"); - pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "reb"); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, "reb"); + pet.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, "reb"); this.room.sendComposer(new UserUpdateComposer(this.getRoomUnit()).compose()); this.room.sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose()); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java index 4b09df66..2425d5e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java @@ -378,7 +378,7 @@ public class Pet extends Unit implements ISerialize, Runnable { this.getRoomUnit().setCanWalk(true); this.getRoomUnit().setGoalLocation(this.room.getRandomWalkableTile()); this.task = null; - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.ENERGY.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.ENERGY.getKey()); this.gestureTickTimeout = currentTime; } } /* this is regeneration, add back if needed @@ -509,9 +509,9 @@ public class Pet extends Unit implements ISerialize, Runnable { this.getRoomUnit().clearStatuses(); - if (isDead) this.getRoomUnit().setStatus(RoomUnitStatus.RIP, ""); + if (isDead) this.getRoomUnit().addStatus(RoomUnitStatus.RIP, ""); for (Map.Entry entry : keys.entrySet()) { - this.getRoomUnit().setStatus(entry.getKey(), entry.getValue()); + this.getRoomUnit().addStatus(entry.getKey(), entry.getValue()); } if (!keys.isEmpty()) this.setPacketUpdate(true); @@ -526,26 +526,26 @@ public class Pet extends Unit implements ISerialize, Runnable { public void updateGesture(int time) { this.gestureTickTimeout = time; if (this.energy < 30) { - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.TIRED.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.TIRED.getKey()); this.findNest(); } else if (this.happiness == 100) { - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.LOVE.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.LOVE.getKey()); } else if (this.happiness >= 90) { this.randomHappyAction(); - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.HAPPY.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.HAPPY.getKey()); } else if (this.happiness <= 5) { this.randomSadAction(); - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.SAD.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.SAD.getKey()); } else if (this.levelHunger > 80) { - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.HUNGRY.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.HUNGRY.getKey()); this.eat(); } else if (this.levelThirst > 80) { - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.THIRSTY.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.THIRSTY.getKey()); this.drink(); } else if (this.idleCommandTicks > 240) { this.idleCommandTicks = 0; - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, PetGestures.QUESTION.getKey()); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, PetGestures.QUESTION.getKey()); } } @@ -578,9 +578,13 @@ public class Pet extends Unit implements ISerialize, Runnable { RoomItem item = this.petData.randomNest(this.room.getRoomSpecialTypes().getNests()); this.getRoomUnit().setCanWalk(true); if (item != null) { - this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getX(), item.getY())); + this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); } else { - this.getRoomUnit().setStatus(RoomUnitStatus.LAY, this.room.getStackHeight(this.getRoomUnit().getCurrentPosition().getX(), this.getRoomUnit().getCurrentPosition().getY(), false) + ""); + if(this instanceof HorsePet horsePet && horsePet.hasSaddle()) { + return; + } + + this.getRoomUnit().addStatus(RoomUnitStatus.LAY, this.room.getStackHeight(this.getRoomUnit().getCurrentPosition().getX(), this.getRoomUnit().getCurrentPosition().getY(), false) + ""); this.say(this.petData.randomVocal(PetVocalsType.SLEEPING)); this.task = PetTasks.DOWN; } @@ -593,13 +597,13 @@ public class Pet extends Unit implements ISerialize, Runnable { RoomItem item = this.petData.randomDrinkItem(this.room.getRoomSpecialTypes().getPetDrinks()); if (item != null) { this.getRoomUnit().setCanWalk(true); - if (this.getRoomUnit().getCurrentPosition().distance(this.room.getLayout().getTile(item.getX(), item.getY())) == 0) { + if (this.getRoomUnit().getCurrentPosition().distance(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())) == 0) { try { item.onWalkOn(this.getRoomUnit(), this.getRoom(), null); } catch (Exception ignored) { } } else { - this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getX(), item.getY())); + this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); } } return item != null; @@ -612,7 +616,7 @@ public class Pet extends Unit implements ISerialize, Runnable { RoomItem item = this.petData.randomFoodItem(this.room.getRoomSpecialTypes().getPetFoods()); if (item != null) { this.getRoomUnit().setCanWalk(true); - this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getX(), item.getY())); + this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); } } @@ -625,14 +629,14 @@ public class Pet extends Unit implements ISerialize, Runnable { RoomItem item = this.petData.randomToyItem(this.room.getRoomSpecialTypes().getPetToys()); if (item != null) { this.getRoomUnit().setCanWalk(true); - if (this.getRoomUnit().getCurrentPosition().distance(this.room.getLayout().getTile(item.getX(), item.getY())) == 0) { + if (this.getRoomUnit().getCurrentPosition().distance(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())) == 0) { try { item.onWalkOn(this.getRoomUnit(), this.getRoom(), null); } catch (Exception ignored) { } return true; } - this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getX(), item.getY())); + this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); return true; } @@ -652,14 +656,14 @@ public class Pet extends Unit implements ISerialize, Runnable { if (item != null) { this.getRoomUnit().setCanWalk(true); this.setTask(task); - if (this.getRoomUnit().getCurrentPosition().distance(this.room.getLayout().getTile(item.getX(), item.getY())) == 0) { + if (this.getRoomUnit().getCurrentPosition().distance(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())) == 0) { try { item.onWalkOn(this.getRoomUnit(), this.getRoom(), null); } catch (Exception ignored) { } return true; } - this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getX(), item.getY())); + this.getRoomUnit().setGoalLocation(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); return true; } return false; @@ -670,7 +674,7 @@ public class Pet extends Unit implements ISerialize, Runnable { */ public void randomHappyAction() { if (this.petData.getActionsHappy().length > 0) { - this.getRoomUnit().setStatus(RoomUnitStatus.fromString(this.petData.getActionsHappy()[Emulator.getRandom().nextInt(this.petData.getActionsHappy().length)]), ""); + this.getRoomUnit().addStatus(RoomUnitStatus.fromString(this.petData.getActionsHappy()[Emulator.getRandom().nextInt(this.petData.getActionsHappy().length)]), ""); } } @@ -679,7 +683,7 @@ public class Pet extends Unit implements ISerialize, Runnable { */ public void randomSadAction() { if (this.petData.getActionsTired().length > 0) { - this.getRoomUnit().setStatus(RoomUnitStatus.fromString(this.petData.getActionsTired()[Emulator.getRandom().nextInt(this.petData.getActionsTired().length)]), ""); + this.getRoomUnit().addStatus(RoomUnitStatus.fromString(this.petData.getActionsTired()[Emulator.getRandom().nextInt(this.petData.getActionsTired().length)]), ""); } } @@ -688,7 +692,7 @@ public class Pet extends Unit implements ISerialize, Runnable { */ public void randomAction() { if (this.petData.getActionsRandom().length > 0) { - this.getRoomUnit().setStatus(RoomUnitStatus.fromString(this.petData.getActionsRandom()[Emulator.getRandom().nextInt(this.petData.getActionsRandom().length)]), ""); + this.getRoomUnit().addStatus(RoomUnitStatus.fromString(this.petData.getActionsRandom()[Emulator.getRandom().nextInt(this.petData.getActionsRandom().length)]), ""); } } @@ -723,7 +727,7 @@ public class Pet extends Unit implements ISerialize, Runnable { this.level++; this.say(this.petData.randomVocal(PetVocalsType.LEVEL_UP)); this.addHappiness(100); - this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "exp"); + this.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, "exp"); this.gestureTickTimeout = Emulator.getIntUnixTimestamp(); AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.userId), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetLevelUp")); this.room.sendComposer(new PetLevelUpdatedComposer(this).compose()); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java index b09f2bf3..0639ab46 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java @@ -67,10 +67,10 @@ public class PetCommand implements Comparable { } for (RoomUnitStatus status : this.action.statusToSet) { - pet.getRoomUnit().setStatus(status, "0"); + pet.getRoomUnit().addStatus(status, "0"); } - pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, this.action.gestureToSet); + pet.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, this.action.gestureToSet); pet.getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose()); pet.addEnergy(-this.energyCost); pet.addHappiness(-this.happinessCost); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java index 1dc07ba1..38527995 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java @@ -25,7 +25,7 @@ public class ActionBreed extends PetAction { } if (nest != null) { - pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTile(nest.getX(), nest.getY())); + pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTile(nest.getCurrentPosition().getX(), nest.getCurrentPosition().getY())); return true; } else { diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionCroak.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionCroak.java index 8ae9d0d3..2f8b1f31 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionCroak.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionCroak.java @@ -15,7 +15,7 @@ public class ActionCroak extends ActionVocals { @Override public boolean apply(Pet pet, Habbo habbo, String[] data) { - pet.getRoomUnit().setStatus(RoomUnitStatus.CROAK, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.CROAK, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.CROAK, null, false), this.minimumActionDuration); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDip.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDip.java index be7df55a..eec7e92d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDip.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDip.java @@ -24,7 +24,7 @@ public class ActionDip extends PetAction { RoomItem waterPatch = (RoomItem) waterItems.toArray()[Emulator.getRandom().nextInt(waterItems.size())]; - pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTile(waterPatch.getX(), waterPatch.getY())); + pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTile(waterPatch.getCurrentPosition().getX(), waterPatch.getCurrentPosition().getY())); if (pet.getHappiness() > 70) { pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL)); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDown.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDown.java index e3cc23c2..b1edf2fe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDown.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionDown.java @@ -21,7 +21,7 @@ public class ActionDown extends PetAction { public boolean apply(Pet pet, Habbo habbo, String[] data) { if (pet.getTask() != PetTasks.DOWN && !pet.getRoomUnit().hasStatus(RoomUnitStatus.LAY)) { pet.getRoomUnit().setCmdLayEnabled(true); - pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.LAY, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(() -> { pet.getRoomUnit().setCmdLayEnabled(false); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionHang.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionHang.java index 44fcd2f1..38c17c1f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionHang.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionHang.java @@ -21,7 +21,7 @@ public class ActionHang extends PetAction { boolean findTree = pet.findPetItem(PetTasks.HANG, InteractionPetTree.class); if (!findTree && pet.getPetData().getToyItems().stream().noneMatch(item -> item.getInteractionType().getType() == InteractionPetTree.class)) { pet.getRoomUnit().setCanWalk(false); - pet.getRoomUnit().setStatus(RoomUnitStatus.HANG, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.HANG, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(() -> { pet.getRoomUnit().setCanWalk(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayDead.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayDead.java index 0a41fea3..31f6a0d7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayDead.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayDead.java @@ -18,7 +18,7 @@ public class ActionPlayDead extends PetAction { public boolean apply(Pet pet, Habbo habbo, String[] data) { pet.clearPosture(); - pet.getRoomUnit().setStatus(RoomUnitStatus.DEAD, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.DEAD, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); if (pet.getHappiness() > 50) pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL)); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java index b77523c9..2503865a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionPlayFootball.java @@ -32,7 +32,7 @@ public class ActionPlayFootball extends PetAction { if(foundBall == null) return false; - pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(foundBall.getX(), foundBall.getY())); + pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(foundBall.getCurrentPosition().getX(), foundBall.getCurrentPosition().getY())); if (pet.getHappiness() > 75) pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL)); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRelax.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRelax.java index c9eab174..8b472609 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRelax.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRelax.java @@ -21,7 +21,7 @@ public class ActionRelax extends PetAction { else pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL)); - pet.getRoomUnit().setStatus(RoomUnitStatus.RELAX, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.RELAX, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRingOfFire.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRingOfFire.java index 54278617..963b1e73 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRingOfFire.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRingOfFire.java @@ -21,7 +21,7 @@ public class ActionRingOfFire extends PetAction { boolean findTree = pet.findPetItem(PetTasks.RING_OF_FIRE, InteractionPetTree.class); if (!findTree && pet.getPetData().getToyItems().stream().noneMatch(item -> item.getInteractionType().getType() == InteractionPetTree.class)) { pet.getRoomUnit().setCanWalk(false); - pet.getRoomUnit().setStatus(RoomUnitStatus.RINGOFFIRE, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.RINGOFFIRE, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(() -> { pet.getRoomUnit().setCanWalk(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRoll.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRoll.java index e2cc9c71..31777d91 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRoll.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionRoll.java @@ -21,7 +21,7 @@ public class ActionRoll extends PetAction { boolean findTree = pet.findPetItem(PetTasks.ROLL, InteractionPetTree.class); if (!findTree && pet.getPetData().getToyItems().stream().noneMatch(item -> item.getInteractionType().getType() == InteractionPetTree.class)) { pet.getRoomUnit().setCanWalk(false); - pet.getRoomUnit().setStatus(RoomUnitStatus.ROLL, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.ROLL, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(() -> { pet.getRoomUnit().setCanWalk(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSit.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSit.java index 905a033a..6d40cea4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSit.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSit.java @@ -22,7 +22,7 @@ public class ActionSit extends PetAction { public boolean apply(Pet pet, Habbo habbo, String[] data) { if (pet.getTask() != PetTasks.SIT && !pet.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) { pet.getRoomUnit().setCmdSitEnabled(true); - pet.getRoomUnit().setStatus(RoomUnitStatus.SIT, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.SIT, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(() -> { pet.getRoomUnit().setCmdSitEnabled(false); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSwing.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSwing.java index 52c8706b..c802ce9d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSwing.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionSwing.java @@ -21,7 +21,7 @@ public class ActionSwing extends PetAction { boolean findTree = pet.findPetItem(PetTasks.SWING, InteractionPetTree.class); if (!findTree && pet.getPetData().getToyItems().stream().noneMatch(item -> item.getInteractionType().getType() == InteractionPetTree.class)) { pet.getRoomUnit().setCanWalk(false); - pet.getRoomUnit().setStatus(RoomUnitStatus.SWING, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.SWING, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(() -> { pet.getRoomUnit().setCanWalk(true); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionWave.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionWave.java index f761f6f7..3d4652a7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionWave.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionWave.java @@ -19,7 +19,7 @@ public class ActionWave extends PetAction { @Override public boolean apply(Pet pet, Habbo habbo, String[] data) { - pet.getRoomUnit().setStatus(RoomUnitStatus.WAVE, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.WAVE, pet.getRoomUnit().getCurrentPosition().getStackHeight() + ""); Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.WAVE, null, false), this.minimumActionDuration); if (pet.getHappiness() > 40) { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index b27bd14e..d227cbf9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -89,6 +89,8 @@ public class Room implements Comparable, ISerialize, Runnable { @Getter private final RoomRightsManager roomRightsManager; @Getter + private final RoomWordFilterManager roomWordFilterManager; + @Getter private RoomTraxManager roomTraxManager; private static final String CAUGHT_EXCEPTION = "Caught exception"; public static final Comparator SORT_SCORE = Comparator.comparingInt(room -> room.roomInfo.getScore()); @@ -120,8 +122,6 @@ public class Room implements Comparable, ISerialize, Runnable { @Getter private final TIntObjectMap furniOwnerNames; private final TIntIntMap furniOwnerCount; - @Getter - private final THashSet wordFilterWords; private final Object loadLock = new Object(); //Use appropriately. Could potentially cause memory leaks when used incorrectly. public volatile boolean preventUnloading = false; @@ -177,6 +177,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomUnitManager = new RoomUnitManager(this); this.roomItemManager = new RoomItemManager(this); this.roomRightsManager = new RoomRightsManager(this); + this.roomWordFilterManager = new RoomWordFilterManager(this); this.layoutName = set.getString("model"); this.bannedHabbos = new TIntObjectHashMap<>(); @@ -205,7 +206,6 @@ public class Room implements Comparable, ISerialize, Runnable { this.allowEffects = true; this.furniOwnerNames = TCollections.synchronizedMap(new TIntObjectHashMap<>(0)); this.furniOwnerCount = TCollections.synchronizedMap(new TIntIntHashMap(0)); - this.wordFilterWords = new THashSet<>(0); this.mutedHabbos = new TIntIntHashMap(); this.games = new ConcurrentSet<>(); @@ -233,7 +233,7 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomItemManager.load(connection); this.loadHeightmap(); this.roomUnitManager.load(connection); - this.loadWordFilter(connection); + this.roomWordFilterManager.load(connection); this.roomIdleCycles = 0; this.loaded = true; @@ -248,12 +248,12 @@ public class Room implements Comparable, ISerialize, Runnable { if (this.roomInfo.isJukeboxEnabled()) { this.roomTraxManager.play(0); for (RoomItem item : this.roomSpecialTypes.getItemsOfType(InteractionJukeBox.class)) { - this.updateItem(item.setExtradata("1")); + this.updateItem(item.setExtraData("1")); } } for (RoomItem item : this.roomSpecialTypes.getItemsOfType(InteractionFireworks.class)) { - this.updateItem(item.setExtradata("1")); + this.updateItem(item.setExtraData("1")); } } @@ -293,23 +293,6 @@ public class Room implements Comparable, ISerialize, Runnable { } } - private synchronized void loadWordFilter(Connection connection) { - this.wordFilterWords.clear(); - - try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_wordfilter WHERE room_id = ?")) { - statement.setInt(1, this.roomInfo.getId()); - try (ResultSet set = statement.executeQuery()) { - while (set.next()) { - this.wordFilterWords.add(set.getString("word")); - } - } - } catch (SQLException e) { - log.error(CAUGHT_SQL_EXCEPTION, e); - } catch (Exception e) { - log.error(CAUGHT_EXCEPTION, e); - } - } - public void updateTile(RoomTile tile) { if (tile != null) { tile.setStackHeight(this.getStackHeight(tile.getX(), tile.getY(), false)); @@ -349,8 +332,10 @@ public class Room implements Comparable, ISerialize, Runnable { return RoomTileState.LAY; } - if (tallestItem != null && tallestItem.getZ() + Item.getCurrentHeight(tallestItem) > item.getZ() + Item.getCurrentHeight(item)) - continue; + if (tallestItem != null) { + if (tallestItem.getCurrentZ() + Item.getCurrentHeight(tallestItem) > item.getCurrentZ() + Item.getCurrentHeight(item)) + continue; + } result = this.checkStateForItem(item, tile); tallestItem = item; @@ -388,9 +373,9 @@ public class Room implements Comparable, ISerialize, Runnable { if (item != null) { if (item.getBaseItem().allowSit()) { - roomUnit.setCurrentZ(item.getZ()); + roomUnit.setCurrentZ(item.getCurrentZ()); } else { - roomUnit.setCurrentZ(item.getZ() + Item.getCurrentHeight(item)); + roomUnit.setCurrentZ(item.getCurrentZ() + Item.getCurrentHeight(item)); } if (oldZ != roomUnit.getCurrentZ()) { @@ -408,41 +393,33 @@ public class Room implements Comparable, ISerialize, Runnable { } public void updateHabbosAt(RoomTile tile) { - this.updateHabbosAt(tile.getX(), tile.getY(), new ArrayList<>(this.roomUnitManager.getHabbosAt(tile))); - } + RoomItem item = this.roomItemManager.getTopItemAt(tile.getX(), tile.getY()); - public void updateHabbosAt(short x, short y, List habbos) { - RoomItem item = this.roomItemManager.getTopItemAt(x, y); + Collection habbos = this.roomUnitManager.getHabbosAt(tile); + + if(habbos == null || habbos.isEmpty()) { + return; + } for (Habbo habbo : habbos) { - - double oldZ = habbo.getRoomUnit().getCurrentZ(); - RoomRotation oldRotation = habbo.getRoomUnit().getBodyRotation(); double z = habbo.getRoomUnit().getCurrentPosition().getStackHeight(); - boolean updated = false; if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT) && ((item == null && !habbo.getRoomUnit().isCmdSitEnabled()) || (item != null && !item.getBaseItem().allowSit()))) { habbo.getRoomUnit().removeStatus(RoomUnitStatus.SIT); - updated = true; } if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.LAY) && ((item == null && !habbo.getRoomUnit().isCmdLayEnabled()) || (item != null && !item.getBaseItem().allowLay()))) { habbo.getRoomUnit().removeStatus(RoomUnitStatus.LAY); - updated = true; } if (item != null && (item.getBaseItem().allowSit() || item.getBaseItem().allowLay())) { - habbo.getRoomUnit().setCurrentZ(item.getZ()); - habbo.getRoomUnit().setPreviousLocationZ(item.getZ()); + habbo.getRoomUnit().setCurrentZ(item.getCurrentZ()); + habbo.getRoomUnit().setPreviousLocationZ(item.getCurrentZ()); habbo.getRoomUnit().setRotation(RoomRotation.fromValue(item.getRotation())); } else { habbo.getRoomUnit().setCurrentZ(z); habbo.getRoomUnit().setPreviousLocationZ(z); } - - if (habbo.getRoomUnit().getCurrentPosition().is(x, y) && (oldZ != z || updated || oldRotation != habbo.getRoomUnit().getBodyRotation())) { - habbo.getRoomUnit().setStatusUpdateNeeded(true); - } } } @@ -459,14 +436,14 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomUnitManager.getBotsAt(tile).forEach(bot -> { if (topItem != null) { if (topItem.getBaseItem().allowSit()) { - bot.getRoomUnit().setCurrentZ(topItem.getZ()); - bot.getRoomUnit().setPreviousLocationZ(topItem.getZ()); + bot.getRoomUnit().setCurrentZ(topItem.getCurrentZ()); + bot.getRoomUnit().setPreviousLocationZ(topItem.getCurrentZ()); bot.getRoomUnit().setRotation(RoomRotation.fromValue(topItem.getRotation())); } else { - bot.getRoomUnit().setCurrentZ(topItem.getZ() + Item.getCurrentHeight(topItem)); + bot.getRoomUnit().setCurrentZ(topItem.getCurrentZ() + Item.getCurrentHeight(topItem)); if (topItem.getBaseItem().allowLay()) { - bot.getRoomUnit().setStatus(RoomUnitStatus.LAY, String.valueOf(topItem.getZ() + topItem.getBaseItem().getHeight())); + bot.getRoomUnit().addStatus(RoomUnitStatus.LAY, String.valueOf(topItem.getCurrentZ() + topItem.getBaseItem().getHeight())); } } } else { @@ -701,7 +678,7 @@ public class Room implements Comparable, ISerialize, Runnable { RoomItem newRoller = null; - RoomTile rollerTile = this.layout.getTile(roller.getX(), roller.getY()); + RoomTile rollerTile = this.layout.getTile(roller.getCurrentPosition().getX(), roller.getCurrentPosition().getY()); if (rollerTile == null) return true; @@ -709,7 +686,7 @@ public class Room implements Comparable, ISerialize, Runnable { THashSet itemsOnRoller = new THashSet<>(); for (RoomItem item : this.roomItemManager.getItemsAt(rollerTile)) { - if (item.getZ() >= roller.getZ() + Item.getCurrentHeight(roller)) { + if (item.getCurrentZ() >= roller.getCurrentZ() + Item.getCurrentHeight(roller)) { itemsOnRoller.add(item); } } @@ -719,7 +696,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (!this.roomUnitManager.areRoomUnitsAt(rollerTile) && itemsOnRoller.isEmpty()) return true; - RoomTile tileInFront = Room.this.layout.getTileInFront(Room.this.layout.getTile(roller.getX(), roller.getY()), roller.getRotation()); + RoomTile tileInFront = Room.this.layout.getTileInFront(Room.this.layout.getTile(roller.getCurrentPosition().getX(), roller.getCurrentPosition().getY()), roller.getRotation()); if (tileInFront == null) return true; @@ -740,7 +717,7 @@ public class Room implements Comparable, ISerialize, Runnable { itemsNewTile.addAll(this.roomItemManager.getItemsAt(tileInFront)); itemsNewTile.removeAll(itemsOnRoller); - itemsOnRoller.removeIf(item -> item.getX() != roller.getX() || item.getY() != roller.getY() || rollerFurniIds.contains(item.getId())); + itemsOnRoller.removeIf(item -> item.getCurrentPosition().getX() != roller.getCurrentPosition().getX() || item.getCurrentPosition().getY() != roller.getCurrentPosition().getY() || rollerFurniIds.contains(item.getId())); RoomItem topItem = this.roomItemManager.getTopItemAt(tileInFront.getX(), tileInFront.getY()); @@ -749,14 +726,14 @@ public class Room implements Comparable, ISerialize, Runnable { boolean stackContainsRoller = false; for (RoomItem item : itemsNewTile) { - if (!(item.getBaseItem().allowWalk() || item.getBaseItem().allowSit()) && !(item instanceof InteractionGate && item.getExtradata().equals("1"))) { + if (!(item.getBaseItem().allowWalk() || item.getBaseItem().allowSit()) && !(item instanceof InteractionGate && item.getExtraData().equals("1"))) { allowUsers = false; } if (item instanceof InteractionRoller) { newRoller = item; stackContainsRoller = true; - if ((item.getZ() != roller.getZ() || (itemsNewTile.size() > 1 && item != topItem)) && !InteractionRoller.NO_RULES) { + if ((item.getCurrentZ() != roller.getCurrentZ() || (itemsNewTile.size() > 1 && item != topItem)) && !InteractionRoller.NO_RULES) { allowUsers = false; allowFurniture = false; continue; @@ -849,7 +826,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (item != null && itemsNewTile.contains(item) && !itemsOnRoller.contains(item)) { Emulator.getThreading().run(() -> { - if (roomUnit.getGoalLocation() == rollerTile) { + if (roomUnit.getTargetPosition() == rollerTile) { try { item.onWalkOn(roomUnit, this, new Object[]{rollerTile, tileInFront}); } catch (Exception e) { @@ -882,10 +859,12 @@ public class Room implements Comparable, ISerialize, Runnable { if (newRoller == null || topItem == newRoller) { List sortedItems = new ArrayList<>(itemsOnRoller); - sortedItems.sort((o1, o2) -> Double.compare(o2.getZ(), o1.getZ())); + sortedItems.sort((o1, o2) -> { + return Double.compare(o2.getCurrentZ(), o1.getCurrentZ()); + }); for (RoomItem item : sortedItems) { - if ((item.getX() == roller.getX() && item.getY() == roller.getY() && zOffset <= 0) && (item != roller)) { + if ((item.getCurrentPosition().getX() == roller.getCurrentPosition().getX() && item.getCurrentPosition().getY() == roller.getCurrentPosition().getY() && zOffset <= 0) && (item != roller)) { if (furnitureRolledEvent != null) { furnitureRolledEvent = new FurnitureRolledEvent(item, roller, tileInFront); Emulator.getPluginManager().fireEvent(furnitureRolledEvent); @@ -1137,7 +1116,7 @@ public class Room implements Comparable, ISerialize, Runnable { RoomItem object = iterator.next(); if (object instanceof InteractionBackgroundToner) { - String[] extraData = object.getExtradata().split(":"); + String[] extraData = object.getExtraData().split(":"); if (extraData.length == 4 && extraData[0].equalsIgnoreCase("1")) { return Color.getHSBColor(Integer.parseInt(extraData[1]), Integer.parseInt(extraData[2]), Integer.parseInt(extraData[3])); @@ -1292,8 +1271,8 @@ public class Room implements Comparable, ISerialize, Runnable { public THashSet getHabbosOnItem(RoomItem item) { THashSet habbos = new THashSet<>(); - for (short x = item.getX(); x < item.getX() + item.getBaseItem().getLength(); x++) { - for (short y = item.getY(); y < item.getY() + item.getBaseItem().getWidth(); y++) { + for (short x = item.getCurrentPosition().getX(); x < item.getCurrentPosition().getX() + item.getBaseItem().getLength(); x++) { + for (short y = item.getCurrentPosition().getY(); y < item.getCurrentPosition().getY() + item.getBaseItem().getWidth(); y++) { RoomTile tile = this.layout.getTile(x, y); habbos.addAll(this.roomUnitManager.getHabbosAt(tile)); } @@ -1304,8 +1283,8 @@ public class Room implements Comparable, ISerialize, Runnable { public THashSet getBotsOnItem(RoomItem item) { THashSet bots = new THashSet<>(); - for (short x = item.getX(); x < item.getX() + item.getBaseItem().getLength(); x++) { - for (short y = item.getY(); y < item.getY() + item.getBaseItem().getWidth(); y++) { + for (short x = item.getCurrentPosition().getX(); x < item.getCurrentPosition().getX() + item.getBaseItem().getLength(); x++) { + for (short y = item.getCurrentPosition().getY(); y < item.getCurrentPosition().getY() + item.getBaseItem().getWidth(); y++) { RoomTile tile = this.layout.getTile(x, y); bots.addAll(this.roomUnitManager.getBotsAt(tile)); } @@ -1316,8 +1295,8 @@ public class Room implements Comparable, ISerialize, Runnable { public THashSet getPetsOnItem(RoomItem item) { THashSet pets = new THashSet<>(); - for (short x = item.getX(); x < item.getX() + item.getBaseItem().getLength(); x++) { - for (short y = item.getY(); y < item.getY() + item.getBaseItem().getWidth(); y++) { + for (short x = item.getCurrentPosition().getX(); x < item.getCurrentPosition().getX() + item.getBaseItem().getLength(); x++) { + for (short y = item.getCurrentPosition().getY(); y < item.getCurrentPosition().getY() + item.getBaseItem().getWidth(); y++) { RoomTile tile = this.layout.getTile(x, y); pets.addAll(this.roomUnitManager.getPetsAt(tile)); } @@ -1327,7 +1306,7 @@ public class Room implements Comparable, ISerialize, Runnable { } public void teleportHabboToItem(Habbo habbo, RoomItem item) { - this.teleportRoomUnitToLocation(habbo.getRoomUnit(), item.getX(), item.getY(), item.getZ() + Item.getCurrentHeight(item)); + this.teleportRoomUnitToLocation(habbo.getRoomUnit(), item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getCurrentZ() + Item.getCurrentHeight(item)); } public void teleportRoomUnitToLocation(RoomUnit roomUnit, short x, short y, double z) { @@ -1462,8 +1441,8 @@ public class Room implements Comparable, ISerialize, Runnable { } } - if (!this.wordFilterWords.isEmpty() && !habbo.hasPermissionRight(Permission.ACC_CHAT_NO_FILTER)) { - for (String string : this.wordFilterWords) { + if (!this.roomWordFilterManager.getFilteredWords().isEmpty() && !habbo.hasPermissionRight(Permission.ACC_CHAT_NO_FILTER)) { + for (String string : this.roomWordFilterManager.getFilteredWords()) { roomChatMessage.setMessage(roomChatMessage.getMessage().replaceAll("(?i)" + Pattern.quote(string), "bobba")); } } @@ -1627,7 +1606,7 @@ public class Room implements Comparable, ISerialize, Runnable { THashSet items = this.roomSpecialTypes.getItemsOfType(InteractionTalkingFurniture.class); for (RoomItem item : items) { - if (this.layout.getTile(item.getX(), item.getY()).distance(habbo.getRoomUnit().getCurrentPosition()) <= Emulator.getConfig().getInt("furniture.talking.range")) { + if (this.layout.getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()).distance(habbo.getRoomUnit().getCurrentPosition()) <= Emulator.getConfig().getInt("furniture.talking.range")) { int count = Emulator.getConfig().getInt(item.getBaseItem().getName() + ".message.count", 0); if (count > 0) { @@ -1639,11 +1618,11 @@ public class Room implements Comparable, ISerialize, Runnable { try { item.onClick(habbo.getClient(), this, new Object[0]); - item.setExtradata("1"); + item.setExtraData("1"); updateItemState(item); Emulator.getThreading().run(() -> { - item.setExtradata("0"); + item.setExtraData("0"); updateItemState(item); }, 2000); @@ -1691,13 +1670,13 @@ public class Room implements Comparable, ISerialize, Runnable { if (item.getBaseItem().getType() != FurnitureType.FLOOR) continue; - boolean found = lockedTiles.stream().anyMatch(tile -> tile.getX() == item.getX() && tile.getY() == item.getY()); + boolean found = lockedTiles.stream().anyMatch(tile -> tile.getX() == item.getCurrentPosition().getX() && tile.getY() == item.getCurrentPosition().getY()); if (!found) { if (item.getRotation() == 0 || item.getRotation() == 4) { for (short y = 0; y < item.getBaseItem().getLength(); y++) { for (short x = 0; x < item.getBaseItem().getWidth(); x++) { - RoomTile tile = this.layout.getTile((short) (item.getX() + x), (short) (item.getY() + y)); + RoomTile tile = this.layout.getTile((short) (item.getCurrentPosition().getX() + x), (short) (item.getCurrentPosition().getY() + y)); if (tile != null) { lockedTiles.add(tile); @@ -1707,7 +1686,7 @@ public class Room implements Comparable, ISerialize, Runnable { } else { for (short y = 0; y < item.getBaseItem().getWidth(); y++) { for (short x = 0; x < item.getBaseItem().getLength(); x++) { - RoomTile tile = this.layout.getTile((short) (item.getX() + x), (short) (item.getY() + y)); + RoomTile tile = this.layout.getTile((short) (item.getCurrentPosition().getX() + x), (short) (item.getCurrentPosition().getY() + y)); if (tile != null) { lockedTiles.add(tile); @@ -1740,14 +1719,18 @@ public class Room implements Comparable, ISerialize, Runnable { for (RoomItem item : stackHelpers) { if (item == exclude) continue; - return calculateHeightmap ? item.getZ() * 256.0D : item.getZ(); + if (calculateHeightmap) { + return item.getCurrentZ() * 256.0D; + } else { + return item.getCurrentZ(); + } } RoomItem item = this.roomItemManager.getTopItemAt(x, y, exclude); if (item != null) { canStack = item.getBaseItem().allowStack(); - height = item.getZ() + (item.getBaseItem().allowSit() ? 0 : Item.getCurrentHeight(item)); + height = item.getCurrentZ() + (item.getBaseItem().allowSit() ? 0 : Item.getCurrentHeight(item)); } if (calculateHeightmap) { @@ -1796,8 +1779,10 @@ public class Room implements Comparable, ISerialize, Runnable { RoomItem tallestItem = null; for (RoomItem item : items) { - if (tallestItem != null && tallestItem.getZ() + Item.getCurrentHeight(tallestItem) > item.getZ() + Item.getCurrentHeight(item)) - continue; + if (tallestItem != null) { + if (tallestItem.getCurrentZ() + Item.getCurrentHeight(tallestItem) > item.getCurrentZ() + Item.getCurrentHeight(item)) + continue; + } tallestItem = item; } @@ -1819,7 +1804,7 @@ public class Room implements Comparable, ISerialize, Runnable { RoomItem topItem = null; for (RoomItem item : items) { - if ((topItem == null || item.getZ() > topItem.getZ())) { + if ((topItem == null || item.getCurrentZ() > topItem.getCurrentZ())) { topItem = item; } } @@ -1943,7 +1928,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (item != null && item.getRoomId() == this.roomInfo.getId() && item.getBaseItem() != null) { if (item.getBaseItem().getType() == FurnitureType.FLOOR) { this.sendComposer(new ObjectUpdateMessageComposer(item).compose()); - this.updateTiles(this.layout.getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + this.updateTiles(this.layout.getTilesAt(this.layout.getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); } else if (item.getBaseItem().getType() == FurnitureType.WALL) { this.sendComposer(new ItemUpdateMessageComposer(item).compose()); } @@ -1961,7 +1946,7 @@ public class Room implements Comparable, ISerialize, Runnable { if (item.getBaseItem().getType() == FurnitureType.FLOOR) { if (this.layout == null) return; - this.updateTiles(this.layout.getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + this.updateTiles(this.layout.getTilesAt(this.layout.getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); if (item instanceof InteractionMultiHeight interactionMultiHeight) { interactionMultiHeight.updateUnitsOnItem(this); @@ -1977,7 +1962,7 @@ public class Room implements Comparable, ISerialize, Runnable { THashSet items = new THashSet<>(); for (RoomItem item : this.roomItemManager.getCurrentItems().values()) { - if (!items.contains(item.getBaseItem()) && item.getOwnerId() == userId) items.add(item.getBaseItem()); + if (!items.contains(item.getBaseItem()) && item.getOwnerInfo().getId() == userId) items.add(item.getBaseItem()); } return items.size(); @@ -2021,39 +2006,6 @@ public class Room implements Comparable, ISerialize, Runnable { } } - public void addToWordFilter(String word) { - synchronized (this.wordFilterWords) { - if (this.wordFilterWords.contains(word)) - return; - - - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT IGNORE INTO room_wordfilter VALUES (?, ?)")) { - statement.setInt(1, this.roomInfo.getId()); - statement.setString(2, word); - statement.execute(); - } catch (SQLException e) { - log.error(CAUGHT_SQL_EXCEPTION, e); - return; - } - - this.wordFilterWords.add(word); - } - } - - public void removeFromWordFilter(String word) { - synchronized (this.wordFilterWords) { - this.wordFilterWords.remove(word); - - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_wordfilter WHERE room_id = ? AND word = ?")) { - statement.setInt(1, this.roomInfo.getId()); - statement.setString(2, word); - statement.execute(); - } catch (SQLException e) { - log.error(CAUGHT_SQL_EXCEPTION, e); - } - } - } - public void handleWordQuiz(Habbo habbo, String answer) { synchronized (this.userVotes) { if (!this.wordQuiz.isEmpty() && !this.hasVotedInWordQuiz(habbo)) { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomItemManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomItemManager.java index 67c88d87..7c9a530f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomItemManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomItemManager.java @@ -242,7 +242,7 @@ public class RoomItemManager { RoomItem rentSpace = this.currentItems.get(habbo.getHabboStats().getRentedItemId()); if (rentSpace != null) { - if (!RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(tile.getX(), tile.getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) { + if (!RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getCurrentPosition().getX(), rentSpace.getCurrentPosition().getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(tile.getX(), tile.getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) { return FurnitureMovementError.NO_RIGHTS; } else { return FurnitureMovementError.NONE; @@ -303,9 +303,8 @@ public class RoomItemManager { } } - item.setZ(height); - item.setX(tile.getX()); - item.setY(tile.getY()); + item.setCurrentPosition(tile); + item.setCurrentZ(height); item.setRotation(rotation); item.needsUpdate(true); @@ -314,7 +313,7 @@ public class RoomItemManager { item.onPlace(this.room); this.room.updateTiles(occupiedTiles); - this.room.sendComposer(new ObjectAddMessageComposer(item, this.room.getFurniOwnerName(item.getOwnerId())).compose()); + this.room.sendComposer(new ObjectAddMessageComposer(item, this.room.getFurniOwnerName(item.getOwnerInfo().getId())).compose()); for (RoomTile t : occupiedTiles) { this.room.updateHabbosAt(t); @@ -339,10 +338,10 @@ public class RoomItemManager { } item.setWallPosition(wallPosition); - if (!this.room.getFurniOwnerNames().containsKey(item.getOwnerId()) && owner != null) { - this.room.getFurniOwnerNames().put(item.getOwnerId(), owner.getHabboInfo().getUsername()); + if (!this.room.getFurniOwnerNames().containsKey(item.getOwnerInfo().getId()) && owner != null) { + this.room.getFurniOwnerNames().put(item.getOwnerInfo().getId(), owner.getHabboInfo().getUsername()); } - this.room.sendComposer(new ItemAddMessageComposer(item, this.room.getFurniOwnerName(item.getOwnerId())).compose()); + this.room.sendComposer(new ItemAddMessageComposer(item, this.room.getFurniOwnerName(item.getOwnerInfo().getId())).compose()); item.needsUpdate(true); this.addRoomItem(item); item.setRoomId(this.room.getRoomInfo().getId()); @@ -362,7 +361,7 @@ public class RoomItemManager { return error; } - RoomTile oldLocation = this.room.getLayout().getTile(item.getX(), item.getY()); + RoomTile oldLocation = this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); boolean pluginHelper = false; if (Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) { @@ -416,7 +415,7 @@ public class RoomItemManager { } } - THashSet oldOccupiedTiles = this.room.getLayout().getTilesAt(this.room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + THashSet oldOccupiedTiles = this.room.getLayout().getTilesAt(this.room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); int oldRotation = item.getRotation(); @@ -433,7 +432,7 @@ public class RoomItemManager { } } - if ((stackHelper.isEmpty() && topItem != null && topItem != item && !topItem.getBaseItem().allowStack()) || (topItem != null && topItem != item && topItem.getZ() + Item.getCurrentHeight(topItem) + Item.getCurrentHeight(item) > Room.MAXIMUM_FURNI_HEIGHT)) { + if ((stackHelper.isEmpty() && topItem != null && topItem != item && !topItem.getBaseItem().allowStack()) || (topItem != null && topItem != item && topItem.getCurrentZ() + Item.getCurrentHeight(topItem) + Item.getCurrentHeight(item) > Room.MAXIMUM_FURNI_HEIGHT)) { item.setRotation(oldRotation); return FurnitureMovementError.CANT_STACK; } @@ -445,9 +444,9 @@ public class RoomItemManager { double height; if (stackHelper.isPresent()) { - height = stackHelper.get().getExtradata().isEmpty() ? Double.parseDouble("0.0") : (Double.parseDouble(stackHelper.get().getExtradata()) / 100); + height = stackHelper.get().getExtraData().isEmpty() ? Double.parseDouble("0.0") : (Double.parseDouble(stackHelper.get().getExtraData()) / 100); } else if (item == topItem) { - height = item.getZ(); + height = item.getCurrentZ(); } else { height = this.room.getStackHeight(targetTile.getX(), targetTile.getY(), false, item); for (RoomTile til : occupiedTiles) { @@ -481,17 +480,16 @@ public class RoomItemManager { return FurnitureMovementError.CANT_STACK; //prevent furni going under the floor } - item.setX(targetTile.getX()); - item.setY(targetTile.getY()); - item.setZ(height); + item.setCurrentPosition(targetTile); + item.setCurrentZ(height); if (magicTile) { - item.setZ(targetTile.getZ()); - item.setExtradata("" + item.getZ() * 100); + item.setCurrentZ(targetTile.getZ()); + item.setExtraData(String.valueOf(item.getCurrentZ() * 100)); } - if (item.getZ() > Room.MAXIMUM_FURNI_HEIGHT) { - item.setZ(Room.MAXIMUM_FURNI_HEIGHT); + if (item.getCurrentZ() > Room.MAXIMUM_FURNI_HEIGHT) { + item.setCurrentZ(Room.MAXIMUM_FURNI_HEIGHT); } //Update Furniture @@ -512,8 +510,8 @@ public class RoomItemManager { //Update Habbos at old position for (RoomTile t : occupiedTiles) { - this.room.updateHabbosAt(t.getX(), t.getY(), new ArrayList<>(this.room.getRoomUnitManager().getHabbosAt(t))); - this.room.updateBotsAt(t.getX(), t.getY()); + this.room.updateHabbosAt(t); + this.room.updateBotsAt(t); } if (Emulator.getConfig().getBoolean("wired.place.under", false)) { @@ -552,7 +550,7 @@ public class RoomItemManager { this.room.sendComposer(new RemoveFloorItemComposer(item).compose()); THashSet updatedTiles = new THashSet<>(); - Rectangle rectangle = RoomLayout.getRectangle(item.getX(), item.getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + Rectangle rectangle = RoomLayout.getRectangle(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); for (short x = (short) rectangle.x; x < rectangle.x + rectangle.getWidth(); x++) { for (short y = (short) rectangle.y; y < rectangle.y + rectangle.getHeight(); y++) { @@ -575,7 +573,8 @@ public class RoomItemManager { this.room.sendComposer(new ItemRemoveMessageComposer(item).compose()); } - Habbo habbo = (picker != null && picker.getHabboInfo().getId() == item.getId() ? picker : Emulator.getGameServer().getGameClientManager().getHabbo(item.getOwnerId())); + Habbo habbo; + habbo = picker != null && picker.getHabboInfo().getId() == item.getId() ? (picker) : (Emulator.getGameServer().getGameClientManager().getHabbo(item.getOwnerInfo().getId())); if (habbo != null) { habbo.getInventory().getItemsComponent().addItem(item); habbo.getClient().sendResponse(new UnseenItemsComposer(item)); @@ -590,7 +589,7 @@ public class RoomItemManager { public void ejectUserFurni(int userId) { Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); - HashSet userItems = this.currentItems.values().stream().filter(item -> item.getOwnerId() == userId).collect(Collectors.toCollection(HashSet::new)); + HashSet userItems = this.currentItems.values().stream().filter(item -> item.getOwnerInfo().getId() == userId).collect(Collectors.toCollection(HashSet::new)); if (habbo != null) { habbo.getInventory().getItemsComponent().addItems(userItems); @@ -610,11 +609,11 @@ public class RoomItemManager { ConcurrentHashMap> userItemsMap = new ConcurrentHashMap<>(); for (RoomItem item : this.currentItems.values()) { - if ((habbo != null && item.getOwnerId() == habbo.getHabboInfo().getId()) || item instanceof InteractionPostIt) { + if ((habbo != null && item.getOwnerInfo().getId() == habbo.getHabboInfo().getId()) || item instanceof InteractionPostIt) { continue; } - userItemsMap.computeIfAbsent(item.getOwnerId(), k -> new HashSet<>()).add(item); + userItemsMap.computeIfAbsent(item.getOwnerInfo().getId(), k -> new HashSet<>()).add(item); } for (Map.Entry> entrySet : userItemsMap.entrySet()) { @@ -734,7 +733,7 @@ public class RoomItemManager { length = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1; } - if (!(tile.getX() >= item.getX() && tile.getX() <= item.getX() + width - 1 && tile.getY() >= item.getY() && tile.getY() <= item.getY() + length - 1)) + if (!(tile.getX() >= item.getCurrentPosition().getX() && tile.getX() <= item.getCurrentPosition().getX() + width - 1 && tile.getY() >= item.getCurrentPosition().getY() && tile.getY() <= item.getCurrentPosition().getY() + length - 1)) continue; items.add(item); @@ -755,7 +754,7 @@ public class RoomItemManager { THashSet items = new THashSet<>(); for (RoomItem item : this.getItemsAt(x, y)) { - if (item.getZ() < minZ) + if (item.getCurrentZ() < minZ) continue; items.add(item); @@ -808,8 +807,10 @@ public class RoomItemManager { if (exclude != null && exclude == item) continue; - if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item)) - continue; + if (highestItem != null) { + if (highestItem.getCurrentZ() + Item.getCurrentHeight(highestItem) > item.getCurrentZ() + Item.getCurrentHeight(item)) + continue; + } highestItem = item; } @@ -828,8 +829,10 @@ public class RoomItemManager { if (exclude != null && exclude == item) continue; - if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item)) - continue; + if (highestItem != null) { + if (highestItem.getCurrentZ() + Item.getCurrentHeight(highestItem) > item.getCurrentZ() + Item.getCurrentHeight(item)) + continue; + } highestItem = item; } @@ -841,7 +844,7 @@ public class RoomItemManager { public double getTopHeightAt(int x, int y) { RoomItem item = this.getTopItemAt(x, y); if (item != null) { - return (item.getZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0)); + return (item.getCurrentZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0)); } else { return this.room.getLayout().getHeightAtSquare(x, y); } @@ -857,8 +860,9 @@ public class RoomItemManager { if (!item.getBaseItem().allowSit()) continue; - if (lowestChair != null && lowestChair.getZ() < item.getZ()) - continue; + if (lowestChair != null) { + if (lowestChair.getCurrentZ() < item.getCurrentZ()) continue; + } lowestChair = item; } @@ -877,8 +881,10 @@ public class RoomItemManager { if (!item.getBaseItem().allowSit()) continue; - if (lowestChair != null && lowestChair.getZ() + Item.getCurrentHeight(lowestChair) > item.getZ() + Item.getCurrentHeight(item)) - continue; + if (lowestChair != null) { + if (lowestChair.getCurrentZ() + Item.getCurrentHeight(lowestChair) > item.getCurrentZ() + Item.getCurrentHeight(item)) + continue; + } lowestChair = item; } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 9fb490ef..fc8156ca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -29,7 +29,6 @@ import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.users.DanceType; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.incoming.users.NewUserExperienceScriptProceedEvent; @@ -408,10 +407,6 @@ public class RoomManager { return layout; } - public void unloadRoom(Room room) { - room.dispose(); - } - public void uncacheRoom(Room room) { this.activeRooms.remove(room.getRoomInfo().getId()); } @@ -1374,7 +1369,7 @@ public class RoomManager { name = habbo.getHabboInfo().getUsername(); } else { - HabboInfo info = HabboManager.getOfflineHabboInfo(userId); + HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(userId); if (info != null) { if (info.getPermissionGroup().hasPermissionRight(Permission.ACC_UNKICKABLE, false)) { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomRightsManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomRightsManager.java index fdc97e94..2f88a241 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomRightsManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomRightsManager.java @@ -197,7 +197,7 @@ public class RoomRightsManager { habbo.getClient().sendResponse(new YouAreControllerMessageComposer(flatCtrl)); - habbo.getRoomUnit().setStatus(RoomUnitStatus.FLAT_CONTROL, String.valueOf(flatCtrl.getLevel())); + habbo.getRoomUnit().addStatus(RoomUnitStatus.FLAT_CONTROL, String.valueOf(flatCtrl.getLevel())); habbo.getRoomUnit().setRightsLevel(flatCtrl); if (flatCtrl.equals(RoomRightLevels.MODERATOR)) { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java index c0c8c64b..8a84944a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java @@ -260,8 +260,7 @@ public class RoomSpecialTypes { for (Map.Entry> map : this.wiredTriggers.entrySet()) { for (InteractionWiredTrigger trigger : map.getValue()) { - if (trigger.getX() == x && trigger.getY() == y) - triggers.add(trigger); + if (trigger.getCurrentPosition().getX() == x && trigger.getCurrentPosition().getY() == y) triggers.add(trigger); } } @@ -324,8 +323,7 @@ public class RoomSpecialTypes { for (Map.Entry> map : this.wiredEffects.entrySet()) { for (InteractionWiredEffect effect : map.getValue()) { - if (effect.getX() == x && effect.getY() == y) - effects.add(effect); + if (effect.getCurrentPosition().getX() == x && effect.getCurrentPosition().getY() == y) effects.add(effect); } } @@ -389,7 +387,7 @@ public class RoomSpecialTypes { for (Map.Entry> map : this.wiredConditions.entrySet()) { for (InteractionWiredCondition condition : map.getValue()) { - if (condition.getX() == x && condition.getY() == y) + if (condition.getCurrentPosition().getX() == x && condition.getCurrentPosition().getY() == y) conditions.add(condition); } } @@ -435,7 +433,7 @@ public class RoomSpecialTypes { THashSet extras = new THashSet<>(); for (Map.Entry map : this.wiredExtras.entrySet()) { - if (map.getValue().getX() == x && map.getValue().getY() == y) { + if (map.getValue().getCurrentPosition().getX() == x && map.getValue().getCurrentPosition().getY() == y) { extras.add(map.getValue()); } } @@ -459,7 +457,7 @@ public class RoomSpecialTypes { public boolean hasExtraType(short x, short y, Class type) { synchronized (this.wiredExtras) { for (Map.Entry map : this.wiredExtras.entrySet()) { - if (map.getValue().getX() == x && map.getValue().getY() == y && map.getValue().getClass().isAssignableFrom(type)) { + if (map.getValue().getCurrentPosition().getX() == x && map.getValue().getCurrentPosition().getY() == y && map.getValue().getClass().isAssignableFrom(type)) { return true; } } @@ -680,7 +678,7 @@ public class RoomSpecialTypes { RoomItem i = null; synchronized (this.undefined) { for (RoomItem item : this.undefined.values()) { - if (i == null || item.getZ() < i.getZ()) { + if (i == null || item.getCurrentZ() < i.getCurrentZ()) { if (item.getClass().isAssignableFrom(type)) { i = item; } @@ -725,7 +723,7 @@ public class RoomSpecialTypes { public Rectangle tentAt(RoomTile location) { for (RoomItem item : this.getItemsOfType(InteractionTent.class)) { - Rectangle rectangle = RoomLayout.getRectangle(item.getX(), item.getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + Rectangle rectangle = RoomLayout.getRectangle(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); if (RoomLayout.tileInSquare(rectangle, location)) { return rectangle; } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java index 121e1a74..26182f8b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java @@ -20,6 +20,7 @@ public class RoomTile { @Setter @Getter private RoomTileState state; + @Getter private double stackHeight; private boolean allowStack = true; @Getter @@ -60,10 +61,6 @@ public class RoomTile { this.roomItems = tile.roomItems; } - public double getStackHeight() { - return this.stackHeight; - } - public void setStackHeight(double stackHeight) { if (this.state == RoomTileState.INVALID) { this.stackHeight = Short.MAX_VALUE; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java index 6033a796..1e29ff96 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTrade.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.rooms; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer; import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer; @@ -44,7 +45,7 @@ public class RoomTrade { protected void initializeTradeStatus() { for (RoomTradeUser roomTradeUser : this.users) { if (!roomTradeUser.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.TRADING)) { - roomTradeUser.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.TRADING, ""); + roomTradeUser.getHabbo().getRoomUnit().addStatus(RoomUnitStatus.TRADING, ""); if (!roomTradeUser.getHabbo().getRoomUnit().isWalking()) this.room.sendComposer(new UserUpdateComposer(roomTradeUser.getHabbo().getRoomUnit()).compose()); } @@ -178,35 +179,35 @@ public class RoomTrade { } } - int userOneId = userOne.getHabbo().getHabboInfo().getId(); - int userTwoId = userTwo.getHabbo().getHabboInfo().getId(); + HabboInfo userOneInfo = userOne.getHabbo().getHabboInfo(); + HabboInfo userTwoInfo = userTwo.getHabbo().getHabboInfo(); try (PreparedStatement statement = connection.prepareStatement("UPDATE items SET user_id = ? WHERE id = ? LIMIT 1")) { try (PreparedStatement stmt = connection.prepareStatement("INSERT INTO room_trade_log_items (id, item_id, user_id) VALUES (?, ?, ?)")) { for (RoomItem item : userOne.getItems()) { - item.setOwnerId(userTwoId); - statement.setInt(1, userTwoId); + item.setOwnerInfo(userTwoInfo); + statement.setInt(1, userTwoInfo.getId()); statement.setInt(2, item.getId()); statement.addBatch(); if (logTrades) { stmt.setInt(1, tradeId); stmt.setInt(2, item.getId()); - stmt.setInt(3, userOneId); + stmt.setInt(3, userOneInfo.getId()); stmt.addBatch(); } } for (RoomItem item : userTwo.getItems()) { - item.setOwnerId(userOneId); - statement.setInt(1, userOneId); + item.setOwnerInfo(userOneInfo); + statement.setInt(1, userOneInfo.getId()); statement.setInt(2, item.getId()); statement.addBatch(); if (logTrades) { stmt.setInt(1, tradeId); stmt.setInt(2, item.getId()); - stmt.setInt(3, userTwoId); + stmt.setInt(3, userTwoInfo.getId()); stmt.addBatch(); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTraxManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTraxManager.java index fff25fd9..b7f373fe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTraxManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTraxManager.java @@ -185,7 +185,7 @@ public class RoomTraxManager implements Disposable { public void play(int index, Habbo starter) { if (this.currentlyPlaying == null) { - this.jukeBox.setExtradata("1"); + this.jukeBox.setExtraData("1"); this.room.updateItem(this.jukeBox); } @@ -226,7 +226,7 @@ public class RoomTraxManager implements Disposable { this.starter = null; this.playingIndex = 0; - this.jukeBox.setExtradata("0"); + this.jukeBox.setExtraData("0"); this.room.updateItem(this.jukeBox); this.room.sendComposer(new NowPlayingMessageComposer(null, -1, 0).compose()); @@ -298,7 +298,7 @@ public class RoomTraxManager implements Disposable { musicDisc.needsUpdate(true); Emulator.getThreading().run(musicDisc); - Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getOwnerId()); + Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getOwnerInfo().getId()); if (owner != null) { owner.getInventory().getItemsComponent().addItem(musicDisc); @@ -328,7 +328,7 @@ public class RoomTraxManager implements Disposable { musicDisc.needsUpdate(true); Emulator.getThreading().run(musicDisc); - Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getOwnerId()); + Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(musicDisc.getOwnerInfo().getId()); if (owner != null) { owner.getInventory().getItemsComponent().addItem(musicDisc); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitManager.java index 26b4bd39..23ff5231 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitManager.java @@ -435,6 +435,20 @@ public class RoomUnitManager { } this.currentBots.clear(); + + Iterator petIterator = this.currentPets.values().iterator(); + + while(petIterator.hasNext()) { + try { + Pet pet = petIterator.next(); + pet.setNeedsUpdate(true); + Emulator.getThreading().run(pet); + } catch (NoSuchElementException e) { + log.error("Caught Exception", e); + break; + } + } + this.currentPets.clear(); this.currentRoomUnits.clear(); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomWordFilterManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomWordFilterManager.java new file mode 100644 index 00000000..698a9790 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomWordFilterManager.java @@ -0,0 +1,81 @@ +package com.eu.habbo.habbohotel.rooms; + +import com.eu.habbo.Emulator; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import lombok.extern.slf4j.Slf4j; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION; + +@Slf4j +@Getter +@Setter +@Accessors(chain = true) +public class RoomWordFilterManager { + private final Room room; + + private final List filteredWords; + + public RoomWordFilterManager(Room room) { + this.room = room; + this.filteredWords = new ArrayList<>(); + } + + public synchronized void load(Connection connection) { + this.filteredWords.clear(); + + try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_wordfilter WHERE room_id = ?")) { + statement.setInt(1, this.room.getRoomInfo().getId()); + try (ResultSet set = statement.executeQuery()) { + while (set.next()) { + this.filteredWords.add(set.getString("word")); + } + } + } catch (SQLException e) { + log.error(CAUGHT_SQL_EXCEPTION, e); + } catch (Exception e) { + log.error("Caught Exception", e); + } + } + + public void addWord(String word) { + synchronized (this.filteredWords) { + if (this.filteredWords.contains(word)) + return; + + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT IGNORE INTO room_wordfilter VALUES (?, ?)")) { + statement.setInt(1, this.room.getRoomInfo().getId()); + statement.setString(2, word); + statement.execute(); + } catch (SQLException e) { + log.error(CAUGHT_SQL_EXCEPTION, e); + return; + } + + this.filteredWords.add(word); + } + } + + public void removeWord(String word) { + synchronized (this.filteredWords) { + this.filteredWords.remove(word); + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_wordfilter WHERE room_id = ? AND word = ?")) { + statement.setInt(1, this.room.getRoomInfo().getId()); + statement.setString(2, word); + statement.execute(); + } catch (SQLException e) { + log.error(CAUGHT_SQL_EXCEPTION, e); + } + } + } +} diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/RoomEntity.java b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/RoomEntity.java index c4665a0b..bfa82b32 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/RoomEntity.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/RoomEntity.java @@ -23,6 +23,25 @@ public abstract class RoomEntity implements IRoomEntity { private Deque path = new LinkedList<>(); private int tilesMoved; + public boolean isAtGoal() { + if(this.currentPosition == null) { + return false; + } + + return this.currentPosition.equals(this.targetPosition); + } + + public void setPreviousLocation(RoomTile previousLocation) { + this.previousPosition = previousLocation; + this.previousZ = this.getCurrentZ(); + } + + public RoomEntity setCurrentZ(double currentZ) { + this.previousZ = this.currentZ; + this.currentZ = Math.max(-9999, Math.min(currentZ, 9999)); + return this; + } + public synchronized void incrementTilesMoved() { this.tilesMoved++; } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/items/RoomItem.java b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/items/RoomItem.java index b84f73b5..66ced663 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/items/RoomItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/items/RoomItem.java @@ -15,11 +15,13 @@ import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTileState; +import com.eu.habbo.habbohotel.rooms.entities.RoomEntity; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.users.DanceType; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; +import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -45,41 +47,23 @@ import java.util.Arrays; import java.util.List; @Slf4j -public abstract class RoomItem implements Runnable, IEventTriggers { - @Getter +@Getter +@Setter +@Accessors(chain = true) +public abstract class RoomItem extends RoomEntity implements Runnable, IEventTriggers { private final int id; - @Getter - @Setter - private int ownerId; - @Getter - @Setter + private HabboInfo ownerInfo; private int roomId; - @Getter private final Item baseItem; - @Getter - @Setter private String wallPosition; - @Setter - @Getter - private short x; - @Setter - @Getter - private short y; - @Getter - private double z; - @Getter private int rotation; - @Setter - @Getter - @Accessors(chain = true) - private String extradata; - @Getter + private String extraData; private int limitedStack; - @Getter private int limitedSells; private boolean needsUpdate = false; private boolean needsDelete = false; private boolean isFromGift = false; + @SuppressWarnings("rawtypes") private static final Class[] TOGGLING_INTERACTIONS = new Class[]{ InteractionGameTimer.class, @@ -90,54 +74,66 @@ public abstract class RoomItem implements Runnable, IEventTriggers { public RoomItem(ResultSet set, Item baseItem) throws SQLException { this.id = set.getInt("id"); - this.ownerId = set.getInt(DatabaseConstants.USER_ID); + this.ownerInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(set.getInt(DatabaseConstants.USER_ID)); this.roomId = set.getInt("room_id"); + + Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(set.getInt("room_id")); + this.setRoom(room); + this.baseItem = baseItem; this.wallPosition = set.getString("wall_pos"); - this.x = set.getShort("x"); - this.y = set.getShort("y"); - this.z = set.getDouble("z"); + + if(room != null) { + this.setCurrentPosition(room.getLayout().getTile(set.getShort("x"), set.getShort("y"))); + this.setCurrentZ(set.getDouble("z")); + } + this.rotation = set.getInt("rot"); - this.extradata = set.getString("extra_data").isEmpty() ? "0" : set.getString("extra_data"); + this.extraData = set.getString("extra_data").isEmpty() ? "0" : set.getString("extra_data"); String ltdData = set.getString("limited_data"); if (!ltdData.isEmpty()) { this.limitedStack = Integer.parseInt(set.getString("limited_data").split(":")[0]); this.limitedSells = Integer.parseInt(set.getString("limited_data").split(":")[1]); } + + this.setRoom(Emulator.getGameEnvironment().getRoomManager().getRoom(set.getInt("room_id"))); } - public RoomItem(int id, int ownerId, Item item, String extradata, int limitedStack, int limitedSells) { + public RoomItem(int id, HabboInfo ownerInfo, Item item, String extraData, int limitedStack, int limitedSells) { this.id = id; - this.ownerId = ownerId; + this.ownerInfo = ownerInfo; + + //@Deprecated RoomItem this.roomId = 0; + this.baseItem = item; this.wallPosition = ""; - this.x = 0; - this.y = 0; - this.z = 0; + this.rotation = 0; - this.extradata = extradata.isEmpty() ? "0" : extradata; + this.extraData = extraData.isEmpty() ? "0" : extraData; this.limitedSells = limitedSells; this.limitedStack = limitedStack; + + this.setRoom(null); + this.setCurrentPosition(null); + this.setCurrentZ(0); } public static RoomTile getSquareInFront(RoomLayout roomLayout, RoomItem item) { - return roomLayout.getTileInFront(roomLayout.getTile(item.getX(), item.getY()), item.getRotation()); + return roomLayout.getTileInFront(roomLayout.getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getRotation()); } public void serializeFloorData(ServerMessage serverMessage) { try { serverMessage.appendInt(this.getId()); serverMessage.appendInt(this.baseItem.getSpriteId()); - serverMessage.appendInt(this.x); - serverMessage.appendInt(this.y); + serverMessage.appendInt(this.getCurrentPosition().getX()); + serverMessage.appendInt(this.getCurrentPosition().getY()); serverMessage.appendInt(this.getRotation()); - serverMessage.appendString(Double.toString(this.z)); - - serverMessage.appendString((this.getBaseItem().getInteractionType().getType() == InteractionTrophy.class || this.getBaseItem().getInteractionType().getType() == InteractionCrackable.class || this.getBaseItem().getName().equalsIgnoreCase("gnome_box")) ? "1.0" : ((this.getBaseItem().allowWalk() || this.getBaseItem().allowSit() && this.roomId != 0) ? Item.getCurrentHeight(this) + "" : "")); - //serverMessage.appendString( ? "1.0" : ((this.getBaseItem().allowWalk() || this.getBaseItem().allowSit() && this.roomId != 0) ? Item.getCurrentHeight(this) : "")); + serverMessage.appendString(Double.toString(this.getCurrentZ())); + serverMessage.appendString((this.getBaseItem().getInteractionType().getType() == InteractionTrophy.class || this.getBaseItem().getInteractionType().getType() == InteractionCrackable.class || this.getBaseItem().getName().equalsIgnoreCase("gnome_box")) ? "1.0" : ((this.getBaseItem().allowWalk() || this.getBaseItem().allowSit() && this.roomId != 0) ? String.valueOf(Item.getCurrentHeight(this)) : "")); } catch (Exception e) { log.error("Caught exception", e); } @@ -151,17 +147,17 @@ public abstract class RoomItem implements Runnable, IEventTriggers { } public void serializeWallData(ServerMessage serverMessage) { - serverMessage.appendString(this.getId() + ""); + serverMessage.appendString(String.valueOf(this.getId())); serverMessage.appendInt(this.baseItem.getSpriteId()); serverMessage.appendString(this.wallPosition); if (this instanceof InteractionPostIt) - serverMessage.appendString(this.extradata.split(" ")[0]); + serverMessage.appendString(this.extraData.split(" ")[0]); else - serverMessage.appendString(this.extradata); + serverMessage.appendString(this.extraData); serverMessage.appendInt(-1); serverMessage.appendInt(this.isUsable()); - serverMessage.appendInt(this.getOwnerId()); + serverMessage.appendInt(this.ownerInfo.getId()); } public int getGiftAdjustedId() { @@ -170,11 +166,6 @@ public abstract class RoomItem implements Runnable, IEventTriggers { return this.id; } - public void setZ(double z) { - if (z > 9999 || z < -9999) return; - this.z = z; - } - public void setRotation(int rotation) { this.rotation = (byte) (rotation % 8); } @@ -214,12 +205,12 @@ public abstract class RoomItem implements Runnable, IEventTriggers { } } else if (this.needsUpdate) { try (PreparedStatement statement = connection.prepareStatement("UPDATE items SET user_id = ?, room_id = ?, wall_pos = ?, x = ?, y = ?, z = ?, rot = ?, extra_data = ?, limited_data = ? WHERE id = ?")) { - statement.setInt(1, this.ownerId); + statement.setInt(1, this.ownerInfo.getId()); statement.setInt(2, this.roomId); statement.setString(3, this.wallPosition); - statement.setInt(4, this.x); - statement.setInt(5, this.y); - statement.setDouble(6, Math.max(-9999, Math.min(9999, Math.round(this.z * Math.pow(10, 6)) / Math.pow(10, 6)))); + statement.setInt(4, this.getCurrentPosition().getX()); + statement.setInt(5, this.getCurrentPosition().getY()); + statement.setDouble(6, Math.max(-9999, Math.min(9999, Math.round(this.getCurrentZ() * Math.pow(10, 6)) / Math.pow(10, 6)))); statement.setInt(7, this.rotation); statement.setString(8, this instanceof InteractionGuildGate ? "" : this.getDatabaseExtraData()); statement.setString(9, this.limitedStack + ":" + this.limitedSells); @@ -257,9 +248,6 @@ public abstract class RoomItem implements Runnable, IEventTriggers { @Override public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { - /*if (objects != null && objects.length >= 1 && objects[0] instanceof InteractionWired) - return;*/ - WiredHandler.handle(WiredTriggerType.WALKS_ON_FURNI, roomUnit, room, new Object[]{this}); if(roomUnit instanceof RoomAvatar roomAvatar) { @@ -267,18 +255,35 @@ public abstract class RoomItem implements Runnable, IEventTriggers { roomAvatar.setDanceType(DanceType.NONE); room.sendComposer(new DanceMessageComposer(roomAvatar).compose()); } + + if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) { + Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomAvatar); + + if (habbo != null && habbo.getHabboInfo().getRiding() == null) { + if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) { + roomAvatar.giveEffect(this.getBaseItem().getEffectM(), -1); + return; + } + + if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) { + roomAvatar.giveEffect(this.getBaseItem().getEffectF(), -1); + } + } + } } - if (!this.getBaseItem().getClothingOnWalk().isEmpty() && roomUnit.getPreviousLocation() != roomUnit.getGoalLocation() && roomUnit.getGoalLocation() == room.getLayout().getTile(this.x, this.y)) { - Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); + if (!this.getBaseItem().getClothingOnWalk().isEmpty() && roomUnit.getPreviousPosition() != roomUnit.getTargetPosition()) { + if (this.getCurrentPosition().equals(roomUnit.getTargetPosition())) { + Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); - if (habbo != null && habbo.getClient() != null) { - String[] clothingKeys = Arrays.stream(this.getBaseItem().getClothingOnWalk().split("\\.")).map(k -> k.split("-")[0]).toArray(String[]::new); - habbo.getHabboInfo().setLook(String.join(".", Arrays.stream(habbo.getHabboInfo().getLook().split("\\.")).filter(k -> !ArrayUtils.contains(clothingKeys, k.split("-")[0])).toArray(String[]::new)) + "." + this.getBaseItem().getClothingOnWalk()); + if (habbo != null && habbo.getClient() != null) { + String[] clothingKeys = Arrays.stream(this.getBaseItem().getClothingOnWalk().split("\\.")).map(k -> k.split("-")[0]).toArray(String[]::new); + habbo.getHabboInfo().setLook(String.join(".", Arrays.stream(habbo.getHabboInfo().getLook().split("\\.")).filter(k -> !ArrayUtils.contains(clothingKeys, k.split("-")[0])).toArray(String[]::new)) + "." + this.getBaseItem().getClothingOnWalk()); - habbo.getClient().sendResponse(new FigureUpdateComposer(habbo)); - if (habbo.getRoomUnit().getRoom() != null) { - habbo.getRoomUnit().getRoom().sendComposer(new UserChangeMessageComposer(habbo).compose()); + habbo.getClient().sendResponse(new FigureUpdateComposer(habbo)); + if (habbo.getRoomUnit().getRoom() != null) { + habbo.getRoomUnit().getRoom().sendComposer(new UserChangeMessageComposer(habbo).compose()); + } } } } @@ -289,29 +294,43 @@ public abstract class RoomItem implements Runnable, IEventTriggers { if(objects != null && objects.length > 0) { WiredHandler.handle(WiredTriggerType.WALKS_OFF_FURNI, roomUnit, room, new Object[]{this}); } + + if (roomUnit instanceof RoomAvatar roomAvatar) { + + Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomAvatar); + + if (habbo != null && habbo.getHabboInfo().getRiding() == null) { + if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) { + roomAvatar.giveEffect(0, -1); + } + + if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) { + roomAvatar.giveEffect(0, -1); + } + } + } } public abstract void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception; - public void onPlace(Room room) { //TODO: IMPORTANT: MAKE THIS GENERIC. (HOLES, ICE SKATE PATCHES, BLACK HOLE, BUNNY RUN FIELD, FOOTBALL FIELD) Achievement roomDecoAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoFurniCount"); - Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getOwnerId()); + Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.ownerInfo.getId()); int furniCollecterProgress; if (owner == null) { - furniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerId(), roomDecoAchievement); + furniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.ownerInfo.getId(), roomDecoAchievement); } else { furniCollecterProgress = owner.getHabboStats().getAchievementProgress(roomDecoAchievement); } - int difference = room.getUserFurniCount(this.getOwnerId()) - furniCollecterProgress; + int difference = room.getUserFurniCount(this.ownerInfo.getId()) - furniCollecterProgress; if (difference > 0) { if (owner != null) { AchievementManager.progressAchievement(owner, roomDecoAchievement, difference); } else { - AchievementManager.progressAchievement(this.getOwnerId(), roomDecoAchievement, difference); + AchievementManager.progressAchievement(this.ownerInfo.getId(), roomDecoAchievement, difference); } } @@ -319,24 +338,24 @@ public abstract class RoomItem implements Runnable, IEventTriggers { int uniqueFurniCollecterProgress; if (owner == null) { - uniqueFurniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerId(), roomDecoUniqueAchievement); + uniqueFurniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.ownerInfo.getId(), roomDecoUniqueAchievement); } else { uniqueFurniCollecterProgress = owner.getHabboStats().getAchievementProgress(roomDecoUniqueAchievement); } - int uniqueDifference = room.getUserUniqueFurniCount(this.getOwnerId()) - uniqueFurniCollecterProgress; + int uniqueDifference = room.getUserUniqueFurniCount(this.ownerInfo.getId()) - uniqueFurniCollecterProgress; if (uniqueDifference > 0) { if (owner != null) { AchievementManager.progressAchievement(owner, roomDecoUniqueAchievement, uniqueDifference); } else { - AchievementManager.progressAchievement(this.getOwnerId(), roomDecoUniqueAchievement, uniqueDifference); + AchievementManager.progressAchievement(this.ownerInfo.getId(), roomDecoUniqueAchievement, uniqueDifference); } } } public void onPickUp(Room room) { if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) { - RoomItem topItem2 = room.getRoomItemManager().getTopItemAt(this.getX(), this.getY(), this); + RoomItem topItem2 = room.getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), this); int nextEffectM = 0; int nextEffectF = 0; @@ -355,7 +374,7 @@ public abstract class RoomItem implements Runnable, IEventTriggers { } } - RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); + RoomTile tile = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); for (Bot bot : room.getRoomUnitManager().getBotsAt(tile)) { if (this.getBaseItem().getEffectM() > 0 && bot.getGender().equals(HabboGender.M) && bot.getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) { bot.getRoomUnit().giveEffect(nextEffectM, -1); @@ -441,12 +460,12 @@ public abstract class RoomItem implements Runnable, IEventTriggers { } public String getDatabaseExtraData() { - return this.getExtradata(); + return this.getExtraData(); } @Override public String toString() { - return "ID: " + this.id + ", BaseID: " + this.getBaseItem().getId() + ", X: " + this.x + ", Y: " + this.y + ", Z: " + this.z + ", Extradata: " + this.extradata; + return "ID: " + this.id + ", BaseID: " + this.getBaseItem().getId() + ", X: " + this.getCurrentPosition().getX() + ", Y: " + this.getCurrentPosition().getY() + ", Z: " + this.getCurrentZ() + ", Extradata: " + this.extraData; } public boolean allowWiredResetState() { @@ -461,20 +480,12 @@ public abstract class RoomItem implements Runnable, IEventTriggers { return true; } - public boolean isFromGift() { - return isFromGift; - } - - public void setFromGift(boolean fromGift) { - isFromGift = fromGift; - } - public boolean invalidatesToRoomKick() { return false; } public List getOccupyingTiles(RoomLayout layout) { List tiles = new ArrayList<>(); - Rectangle rect = RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); + Rectangle rect = RoomLayout.getRectangle(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); for (int i = rect.x; i < rect.x + rect.getWidth(); i++) { for (int j = rect.y; j < rect.y + rect.getHeight(); j++) { @@ -499,8 +510,8 @@ public abstract class RoomItem implements Runnable, IEventTriggers { public Rectangle getRectangle() { return RoomLayout.getRectangle( - this.getX(), - this.getY(), + this.getCurrentPosition().getX(), + this.getCurrentPosition().getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); @@ -508,8 +519,8 @@ public abstract class RoomItem implements Runnable, IEventTriggers { public Rectangle getRectangle(int marginX, int marginY) { return RoomLayout.getRectangle( - this.getX() - marginX, - this.getY() - marginY, + this.getCurrentPosition().getX() - marginX, + this.getCurrentPosition().getY() - marginY, this.getBaseItem().getWidth() + (marginX * 2), this.getBaseItem().getLength() + (marginY * 2), this.getRotation()); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/RoomUnit.java index 9b076d29..2ff43d7e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/RoomUnit.java @@ -86,14 +86,10 @@ public abstract class RoomUnit extends RoomEntity { @Setter private RoomTile botStartLocation; @Getter - private RoomTile previousLocation; - @Getter @Setter @Accessors(chain = true) private double previousLocationZ; @Getter - private RoomTile goalLocation; - @Getter @Setter private boolean inRoom; @Getter @@ -160,8 +156,7 @@ public abstract class RoomUnit extends RoomEntity { } public void clearWalking() { - this.goalLocation = null; - this.setCurrentPosition(null); + this.setTargetPosition(null); this.startLocation = this.getCurrentPosition(); this.statuses.clear(); this.cacheable.clear(); @@ -211,13 +206,14 @@ public abstract class RoomUnit extends RoomEntity { if (goalLocation != null && !noReset) { boolean isWalking = this.hasStatus(RoomUnitStatus.MOVE); - this.goalLocation = goalLocation; + this.setTargetPosition(goalLocation); + this.findPath(); ///< Quadral: this is where we start formulating a path if (!this.getPath().isEmpty()) { this.setTilesMoved(isWalking ? this.getTilesMoved() : 0); this.setCmdSitEnabled(false); } else { - this.goalLocation = this.getCurrentPosition(); + this.setTargetPosition(this.getCurrentPosition()); } } } @@ -227,40 +223,38 @@ public abstract class RoomUnit extends RoomEntity { this.startLocation = location; this.setPreviousLocation(location); this.setCurrentPosition(location); - this.goalLocation = location; + this.setTargetPosition(location); this.botStartLocation = location; } return this; } - public void setPreviousLocation(RoomTile previousLocation) { - this.previousLocation = previousLocation; - this.previousLocationZ = this.getCurrentZ(); - } - public void findPath() { - if (this.getRoom() != null && this.getRoom().getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.getRoom().canSitOrLayAt(this.goalLocation.getX(), this.goalLocation.getY()) || this.canOverrideTile(this.goalLocation))) { - Deque newPath = this.getRoom().getLayout().findPath(this.getCurrentPosition(), this.goalLocation, this.goalLocation, this); + if (this.getRoom() != null && this.getRoom().getLayout() != null && this.getTargetPosition() != null && (this.getTargetPosition().isWalkable() || this.getRoom().canSitOrLayAt(this.getTargetPosition().getX(), this.getTargetPosition().getY()) || this.canOverrideTile(this.getTargetPosition()))) { + Deque newPath = this.getRoom().getLayout().findPath(this.getCurrentPosition(), this.getTargetPosition(), this.getTargetPosition(), this); if (newPath != null) this.setPath(newPath); } } - public boolean isAtGoal() { - if(this.getCurrentPosition() == null) { - return false; - } - - return this.getCurrentPosition().equals(this.goalLocation); - } - public boolean isWalking() { return !this.isAtGoal() && this.canWalk; } + public boolean hasStatus(RoomUnitStatus key) { + return this.statuses.containsKey(key); + } + public String getStatus(RoomUnitStatus key) { return this.statuses.get(key); } + public void addStatus(RoomUnitStatus key, String value) { + if (key != null && value != null) { + this.statuses.put(key, value); + this.statusUpdateNeeded = true; + } + } + public RoomUnit removeStatus(RoomUnitStatus key) { String statusRemoved = this.statuses.remove(key); @@ -271,11 +265,8 @@ public abstract class RoomUnit extends RoomEntity { return this; } - public void setStatus(RoomUnitStatus key, String value) { - if (key != null && value != null) { - this.statuses.put(key, value); - this.statusUpdateNeeded = true; - } + public void clearStatuses() { + this.statuses.clear(); } public void setRightsLevel(RoomRightLevels rightsLevel) { @@ -283,17 +274,13 @@ public abstract class RoomUnit extends RoomEntity { this.statusUpdateNeeded = true; } - public boolean hasStatus(RoomUnitStatus key) { - return this.statuses.containsKey(key); - } - public void makeStand() { RoomItem item = this.getRoom().getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); if (item == null || !item.getBaseItem().allowSit() || !item.getBaseItem().allowLay()) { this.setCmdStandEnabled(true); this.setBodyRotation(RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2]); this.removeStatus(RoomUnitStatus.SIT); - this.getRoom().sendComposer(new UserUpdateComposer(this).compose()); + this.instantUpdate(); } } @@ -304,36 +291,19 @@ public abstract class RoomUnit extends RoomEntity { this.setCmdSitEnabled(true); this.setBodyRotation(RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2]); - this.setStatus(RoomUnitStatus.SIT, 0.5 + ""); + this.addStatus(RoomUnitStatus.SIT, 0.5 + ""); if(this instanceof RoomAvatar roomAvatar) { roomAvatar.setDance(DanceType.NONE); } - this.getRoom().sendComposer(new UserUpdateComposer(this).compose()); - } - - public void clearStatuses() { - this.statuses.clear(); + this.instantUpdate(); } public TMap getCacheable() { return this.cacheable; } - public int getPreviousEffectId() { - return this.previousEffectId; - } - - public void setPreviousEffectId(int effectId, int endTimestamp) { - this.previousEffectId = effectId; - this.previousEffectEndTimestamp = endTimestamp; - } - - public int getPreviousEffectEndTimestamp() { - return this.previousEffectEndTimestamp; - } - public int getWalkTimeOut() { return this.walkTimeOut; } @@ -455,8 +425,8 @@ public abstract class RoomUnit extends RoomEntity { if(!this.isCmdSitEnabled()) { if(this.getCurrentPosition().getState().equals(RoomTileState.SIT) && !this.hasStatus(RoomUnitStatus.SIT)) { - this.setStatus(RoomUnitStatus.SIT, String.valueOf(Item.getCurrentHeight(topItem))); - this.setCurrentZ(topItem.getZ()); + this.addStatus(RoomUnitStatus.SIT, String.valueOf(Item.getCurrentHeight(topItem))); + this.setCurrentZ(topItem.getCurrentZ()); this.setRotation(RoomRotation.values()[topItem.getRotation()]); return true; } else if(!topItem.getBaseItem().allowSit() && this.hasStatus(RoomUnitStatus.SIT)) { @@ -476,13 +446,13 @@ public abstract class RoomUnit extends RoomEntity { if(!this.isCmdLayEnabled()) { if(this.getCurrentPosition().getState().equals(RoomTileState.LAY) && !this.hasStatus(RoomUnitStatus.LAY)) { - this.setStatus(RoomUnitStatus.LAY, String.valueOf(Item.getCurrentHeight(topItem))); + this.addStatus(RoomUnitStatus.LAY, String.valueOf(Item.getCurrentHeight(topItem))); this.setRotation(RoomRotation.values()[topItem.getRotation() % 4]); if (topItem.getRotation() == 0 || topItem.getRotation() == 4) { - this.setLocation(this.getRoom().getLayout().getTile(this.getCurrentPosition().getX(), topItem.getY())); + this.setLocation(this.getRoom().getLayout().getTile(this.getCurrentPosition().getX(), topItem.getCurrentPosition().getY())); } else { - this.setLocation(this.getRoom().getLayout().getTile(topItem.getX(), this.getCurrentPosition().getY())); + this.setLocation(this.getRoom().getLayout().getTile(topItem.getCurrentPosition().getX(), this.getCurrentPosition().getY())); } return true; } else if (!topItem.getBaseItem().allowLay() && this.hasStatus(RoomUnitStatus.LAY)) { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomAvatar.java b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomAvatar.java index a985266e..c7fbd1c7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomAvatar.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomAvatar.java @@ -104,7 +104,7 @@ public class RoomAvatar extends RoomUnit { } } - Deque peekPath = room.getLayout().findPath(this.getCurrentPosition(), this.getPath().peek(), this.getGoalLocation(), this); + Deque peekPath = room.getLayout().findPath(this.getCurrentPosition(), this.getPath().peek(), this.getTargetPosition(), this); if (peekPath == null) { peekPath = new LinkedList<>(); @@ -186,7 +186,7 @@ public class RoomAvatar extends RoomUnit { item = tallestChair; } - if (next.equals(this.getGoalLocation()) && next.getState() == RoomTileState.SIT && !overrideTile && (item == null || item.getZ() - this.getCurrentZ() > RoomLayout.MAXIMUM_STEP_HEIGHT)) { + if (next.equals(this.getTargetPosition()) && next.getState() == RoomTileState.SIT && !overrideTile && (item == null || item.getCurrentZ() - this.getCurrentZ() > RoomLayout.MAXIMUM_STEP_HEIGHT)) { this.removeStatus(RoomUnitStatus.MOVE); return false; } @@ -198,7 +198,7 @@ public class RoomAvatar extends RoomUnit { } RoomItem roomItem = room.getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); - if (roomItem != null && (roomItem != item || !RoomLayout.pointInSquare(roomItem.getX(), roomItem.getY(), roomItem.getX() + roomItem.getBaseItem().getWidth() - 1, roomItem.getY() + roomItem.getBaseItem().getLength() - 1, next.getX(), next.getY()))) + if (roomItem != null && (roomItem != item || !RoomLayout.pointInSquare(roomItem.getCurrentPosition().getX(), roomItem.getCurrentPosition().getY(), roomItem.getCurrentPosition().getX() + roomItem.getBaseItem().getWidth() - 1, roomItem.getCurrentPosition().getY() + roomItem.getBaseItem().getLength() - 1, next.getX(), next.getY()))) roomItem.onWalkOff(this, room, new Object[]{this.getCurrentPosition(), next}); @@ -208,7 +208,7 @@ public class RoomAvatar extends RoomUnit { this.setRotation(RoomRotation.values()[Rotation.Calculate(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), next.getX(), next.getY())]); if (item != null) { - if (item != roomItem || !RoomLayout.pointInSquare(item.getX(), item.getY(), item.getX() + item.getBaseItem().getWidth() - 1, item.getY() + item.getBaseItem().getLength() - 1, this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) { + if (item != roomItem || !RoomLayout.pointInSquare(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getCurrentPosition().getX() + item.getBaseItem().getWidth() - 1, item.getCurrentPosition().getY() + item.getBaseItem().getLength() - 1, this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) { if (item.canWalkOn(this, room, null)) { item.onWalkOn(this, room, new Object[]{this.getCurrentPosition(), next}); } else if (item instanceof ConditionalGate conditionalGate) { @@ -228,7 +228,7 @@ public class RoomAvatar extends RoomUnit { item.onWalk(this, room, new Object[]{this.getCurrentPosition(), next}); } - zHeight += item.getZ(); + zHeight += item.getCurrentZ(); if (!item.getBaseItem().allowSit() && !item.getBaseItem().allowLay()) { zHeight += Item.getCurrentHeight(item); @@ -239,7 +239,7 @@ public class RoomAvatar extends RoomUnit { this.setPreviousLocation(this.getCurrentPosition()); - this.setStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + zHeight); + this.addStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + zHeight); if(habbo != null) { RideablePet rideablePet = habbo.getHabboInfo().getRiding(); @@ -252,8 +252,8 @@ public class RoomAvatar extends RoomUnit { this.setCurrentZ(zHeight - 1.0); ridingUnit.setRotation(RoomRotation.values()[Rotation.Calculate(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), next.getX(), next.getY())]); ridingUnit.setPreviousLocation(this.getCurrentPosition()); - ridingUnit.setGoalLocation(this.getGoalLocation()); - ridingUnit.setStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + (zHeight - 1.0)); + ridingUnit.setGoalLocation(this.getTargetPosition()); + ridingUnit.addStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + (zHeight - 1.0)); room.sendComposer(new UserUpdateComposer(ridingUnit).compose()); } } @@ -350,6 +350,10 @@ public class RoomAvatar extends RoomUnit { return; } + if(this.getEffectId() == effectId) { + return; + } + if(this instanceof RoomHabbo) { Habbo habbo = this.getRoom().getRoomUnitManager().getHabboByRoomUnit(this); if(habbo == null || (habbo.getHabboInfo().isInGame() && !forceEffect)) { @@ -371,6 +375,11 @@ public class RoomAvatar extends RoomUnit { } } + public void setPreviousEffectId(int effectId, int endTimestamp) { + this.previousEffectId = effectId; + this.previousEffectEndTimestamp = endTimestamp; + } + @Override public void clear() { super.clear(); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomPet.java b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomPet.java index 4a704659..9607678a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomPet.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/entities/units/types/RoomPet.java @@ -68,7 +68,7 @@ public class RoomPet extends RoomUnit { } } - Deque peekPath = room.getLayout().findPath(this.getCurrentPosition(), this.getPath().peek(), this.getGoalLocation(), this); + Deque peekPath = room.getLayout().findPath(this.getCurrentPosition(), this.getPath().peek(), this.getTargetPosition(), this); if (peekPath == null) { peekPath = new LinkedList<>(); @@ -123,7 +123,7 @@ public class RoomPet extends RoomUnit { item = tallestChair; } - if (next.equals(this.getGoalLocation()) && next.getState() == RoomTileState.SIT && !overrideChecks && (item == null || item.getZ() - this.getCurrentZ() > RoomLayout.MAXIMUM_STEP_HEIGHT)) { + if (next.equals(this.getTargetPosition()) && next.getState() == RoomTileState.SIT && !overrideChecks && (item == null || item.getCurrentZ() - this.getCurrentZ() > RoomLayout.MAXIMUM_STEP_HEIGHT)) { this.removeStatus(RoomUnitStatus.MOVE); return false; } @@ -131,7 +131,7 @@ public class RoomPet extends RoomUnit { double zHeight = 0.0D; RoomItem roomItem = room.getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()); - if (roomItem != null && (roomItem != item || !RoomLayout.pointInSquare(roomItem.getX(), roomItem.getY(), roomItem.getX() + roomItem.getBaseItem().getWidth() - 1, roomItem.getY() + roomItem.getBaseItem().getLength() - 1, next.getX(), next.getY()))) + if (roomItem != null && (roomItem != item || !RoomLayout.pointInSquare(roomItem.getCurrentPosition().getX(), roomItem.getCurrentPosition().getY(), roomItem.getCurrentPosition().getX() + roomItem.getBaseItem().getWidth() - 1, roomItem.getCurrentPosition().getY() + roomItem.getBaseItem().getLength() - 1, next.getX(), next.getY()))) roomItem.onWalkOff(this, room, new Object[]{this.getCurrentPosition(), next}); @@ -140,7 +140,7 @@ public class RoomPet extends RoomUnit { RoomRotation oldRotation = this.getBodyRotation(); this.setRotation(RoomRotation.values()[Rotation.Calculate(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), next.getX(), next.getY())]); if (item != null) { - if (item != roomItem || !RoomLayout.pointInSquare(item.getX(), item.getY(), item.getX() + item.getBaseItem().getWidth() - 1, item.getY() + item.getBaseItem().getLength() - 1, this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) { + if (item != roomItem || !RoomLayout.pointInSquare(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getCurrentPosition().getX() + item.getBaseItem().getWidth() - 1, item.getCurrentPosition().getY() + item.getBaseItem().getLength() - 1, this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) { if (item.canWalkOn(this, room, null)) { item.onWalkOn(this, room, new Object[]{this.getCurrentPosition(), next}); } else if (item instanceof ConditionalGate conditionalGate) { @@ -156,7 +156,7 @@ public class RoomPet extends RoomUnit { item.onWalk(this, room, new Object[]{this.getCurrentPosition(), next}); } - zHeight += item.getZ(); + zHeight += item.getCurrentZ(); if (!item.getBaseItem().allowSit() && !item.getBaseItem().allowLay()) { zHeight += Item.getCurrentHeight(item); @@ -168,7 +168,7 @@ public class RoomPet extends RoomUnit { this.setPreviousLocation(this.getCurrentPosition()); - this.setStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + zHeight); + this.addStatus(RoomUnitStatus.MOVE, next.getX() + "," + next.getY() + "," + zHeight); this.setCurrentZ(zHeight); this.setCurrentPosition(room.getLayout().getTile(next.getX(), next.getY())); @@ -197,9 +197,9 @@ public class RoomPet extends RoomUnit { } if (!this.getCurrentPosition().equals(rider.getRoomUnit().getCurrentPosition())) { - this.setStatus(RoomUnitStatus.MOVE, rider.getRoomUnit().getCurrentPosition().getX() + "," + rider.getRoomUnit().getCurrentPosition().getY() + "," + (rider.getRoomUnit().getCurrentPosition().getStackHeight())); - this.setPreviousLocation(rider.getRoomUnit().getPreviousLocation()); - this.setPreviousLocationZ(rider.getRoomUnit().getPreviousLocation().getStackHeight()); + this.addStatus(RoomUnitStatus.MOVE, rider.getRoomUnit().getCurrentPosition().getX() + "," + rider.getRoomUnit().getCurrentPosition().getY() + "," + (rider.getRoomUnit().getCurrentPosition().getStackHeight())); + this.setPreviousLocation(rider.getRoomUnit().getPreviousPosition()); + this.setPreviousLocationZ(rider.getRoomUnit().getPreviousPosition().getStackHeight()); this.setCurrentPosition(rider.getRoomUnit().getCurrentPosition()); this.setCurrentZ(rider.getRoomUnit().getCurrentPosition().getStackHeight()); } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java index fb3a8f01..f72e7a18 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboInfo.java @@ -82,6 +82,8 @@ public class HabboInfo implements Runnable { this.loadCurrencies(); this.loadSavedSearches(); this.loadMessengerCategories(); + + Emulator.getGameEnvironment().getHabboManager().getHabboInfoCache().getData().remove(this.id); } private void loadCurrencies() { diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java index ef88b747..9a786399 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ModToolBan; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.PermissionGroup; +import com.eu.habbo.habbohotel.users.cache.HabboInfoCache; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.catalog.*; import com.eu.habbo.messages.outgoing.catalog.marketplace.MarketplaceConfigurationComposer; @@ -25,6 +26,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; @Slf4j public class HabboManager { @@ -34,16 +37,30 @@ public class HabboManager { @Getter private final ConcurrentHashMap onlineHabbos; + @Getter + private final HabboInfoCache habboInfoCache; + + public ScheduledFuture infoCacheTask; + public HabboManager() { long millis = System.currentTimeMillis(); this.onlineHabbos = new ConcurrentHashMap<>(); + this.habboInfoCache = new HabboInfoCache(); + log.info("Habbo Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); + + this.infoCacheTask = Emulator.getThreading().getService().scheduleAtFixedRate(this.habboInfoCache, 500, 5, TimeUnit.MINUTES); } - public static HabboInfo getOfflineHabboInfo(int id) { + public HabboInfo getOfflineHabboInfo(int id) { + if(this.habboInfoCache.getData().containsKey(id)) { + return this.habboInfoCache.getData().get(id).getValue(); + } + HabboInfo info = null; + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users WHERE id = ? LIMIT 1")) { statement.setInt(1, id); try (ResultSet set = statement.executeQuery()) { @@ -55,10 +72,14 @@ public class HabboManager { log.error("Caught SQL exception", e); } + if(info != null) { + this.habboInfoCache.add(info); + } + return info; } - public static HabboInfo getOfflineHabboInfo(String username) { + public HabboInfo getOfflineHabboInfo(String username) { HabboInfo info = null; try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users WHERE username = ? LIMIT 1")) { @@ -185,11 +206,7 @@ public class HabboManager { } public synchronized void dispose() { - - -// - - + this.infoCacheTask.cancel(false); log.info("Habbo Manager -> Disposed!"); } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboInfoCache.java b/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboInfoCache.java index 8eb8f3ca..9d4353fb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboInfoCache.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/cache/HabboInfoCache.java @@ -1,22 +1,48 @@ package com.eu.habbo.habbohotel.users.cache; +import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.HabboInfo; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.math3.util.Pair; import java.util.LinkedHashMap; import java.util.Map; @Slf4j @Getter -public class HabboInfoCache { - private final LinkedHashMap habboInfoCache; +public class HabboInfoCache implements Runnable { + private static final long CACHE_DURATION = 10 * 60 * 1000; + private final LinkedHashMap> data; public HabboInfoCache() { - this.habboInfoCache = new LinkedHashMap(16, 0.75f, true) { - protected boolean removeEldestEntry(Map.Entry eldest) { - return false; + this.data = new LinkedHashMap>(16, 0.75f) { + @Override + protected boolean removeEldestEntry(Map.Entry> eldest) { + return cleanEntry(eldest); } }; } + + public void add(HabboInfo habboInfo) { + long currentMillis = Emulator.getIntUnixTimestamp(); + this.data.put(habboInfo.getId(), new Pair<>(currentMillis, habboInfo)); + } + + private boolean cleanEntry(Map.Entry> entry) { + long currentMillis = Emulator.getIntUnixTimestamp(); + long entryTimestamp = entry.getValue().getKey(); + return entryTimestamp < currentMillis - CACHE_DURATION; + } + + public void verifyInfo(int userId) { + this.data.remove(userId); + } + + @Override + public void run() { + synchronized (this.data) { + this.data.entrySet().removeIf(this::cleanEntry); + } + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java index c3ce78f5..22d0aed4 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java @@ -62,7 +62,7 @@ public class WiredHandler { List triggeredTiles = new ArrayList<>(); for (InteractionWiredTrigger trigger : triggers) { - RoomTile tile = room.getLayout().getTile(trigger.getX(), trigger.getY()); + RoomTile tile = room.getLayout().getTile(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY()); if (triggeredTiles.contains(tile)) { continue; @@ -113,7 +113,7 @@ public class WiredHandler { for (InteractionWiredTrigger trigger : triggers) { if (trigger.getClass() != triggerType) continue; - RoomTile tile = room.getLayout().getTile(trigger.getX(), trigger.getY()); + RoomTile tile = room.getLayout().getTile(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY()); if (triggeredTiles.contains(tile)) continue; @@ -157,8 +157,8 @@ public class WiredHandler { //DUNNO IF YOU HAVE TO SET EXTRADATA TO 1 IN HERE (In case of Repeaters) trigger.activateBox(room, roomUnit, millis); - THashSet conditions = room.getRoomSpecialTypes().getConditions(trigger.getX(), trigger.getY()); - THashSet effects = room.getRoomSpecialTypes().getEffects(trigger.getX(), trigger.getY()); + THashSet conditions = room.getRoomSpecialTypes().getConditions(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY()); + THashSet effects = room.getRoomSpecialTypes().getEffects(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY()); if (Emulator.getPluginManager().fireEvent(new WiredStackTriggeredEvent(room, roomUnit, trigger, effects, conditions)).isCancelled()) return false; @@ -182,9 +182,9 @@ public class WiredHandler { trigger.setCooldown(millis); - boolean hasExtraRandom = room.getRoomSpecialTypes().hasExtraType(trigger.getX(), trigger.getY(), WiredExtraRandom.class); - boolean hasExtraUnseen = room.getRoomSpecialTypes().hasExtraType(trigger.getX(), trigger.getY(), WiredExtraUnseen.class); - THashSet extras = room.getRoomSpecialTypes().getExtras(trigger.getX(), trigger.getY()); + boolean hasExtraRandom = room.getRoomSpecialTypes().hasExtraType(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY(), WiredExtraRandom.class); + boolean hasExtraUnseen = room.getRoomSpecialTypes().hasExtraType(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY(), WiredExtraUnseen.class); + THashSet extras = room.getRoomSpecialTypes().getExtras(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY()); for (InteractionWiredExtra extra : extras) { extra.activateBox(room, roomUnit, millis); @@ -198,9 +198,9 @@ public class WiredHandler { if (hasExtraUnseen) { - for (InteractionWiredExtra extra : room.getRoomSpecialTypes().getExtras(trigger.getX(), trigger.getY())) { + for (InteractionWiredExtra extra : room.getRoomSpecialTypes().getExtras(trigger.getCurrentPosition().getX(), trigger.getCurrentPosition().getY())) { if (extra instanceof WiredExtraUnseen) { - extra.setExtradata(extra.getExtradata().equals("1") ? "0" : "1"); + extra.setExtraData(extra.getExtraData().equals("1") ? "0" : "1"); InteractionWiredEffect effect = ((WiredExtraUnseen) extra).getUnseenEffect(effectList); effectsToExecute.add(effect); // triggerEffect(effect, roomUnit, room, stuff, millis); break; diff --git a/src/main/java/com/eu/habbo/messages/incoming/camera/PurchasePhotoEvent.java b/src/main/java/com/eu/habbo/messages/incoming/camera/PurchasePhotoEvent.java index 91336f57..211c170a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/camera/PurchasePhotoEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/camera/PurchasePhotoEvent.java @@ -39,7 +39,7 @@ public class PurchasePhotoEvent extends MessageHandler { RoomItem photoItem = Emulator.getGameEnvironment().getItemManager().createItem(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getItemManager().getItem(Emulator.getConfig().getInt("camera.item_id")), 0, 0, this.client.getHabbo().getHabboInfo().getPhotoJSON()); if (photoItem != null) { - photoItem.setExtradata(photoItem.getExtradata().replace("%id%", photoItem.getId() + "")); + photoItem.setExtraData(photoItem.getExtraData().replace("%id%", photoItem.getId() + "")); photoItem.needsUpdate(true); this.client.getHabbo().getInventory().getItemsComponent().addItem(photoItem); diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java index c3c0995a..bc714081 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/PurchaseFromCatalogAsGiftEvent.java @@ -284,7 +284,7 @@ public class PurchaseFromCatalogAsGiftEvent extends MessageHandler { itemsList.add(hopper); } else if (baseItem.getInteractionType().getType() == InteractionGuildFurni.class || baseItem.getInteractionType().getType() == InteractionGuildGate.class) { InteractionGuildFurni habboItem = (InteractionGuildFurni) Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData); - habboItem.setExtradata(""); + habboItem.setExtraData(""); habboItem.needsUpdate(true); int guildId; try { diff --git a/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java b/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java index 14d0c0c4..e609b5bd 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/catalog/recycler/PresentOpenEvent.java @@ -37,7 +37,7 @@ public class PresentOpenEvent extends MessageHandler { Emulator.getThreading().run(new OpenGift(item, this.client.getHabbo(), room), item.getBaseItem().getName().contains("present_wrap") ? 1000 : 0); } else { - if (item.getExtradata().length() == 0) { + if (item.getExtraData().length() == 0) { this.client.sendResponse(new WhisperMessageComposer(new RoomChatMessage(Emulator.getTexts().getValue("error.recycler.box.empty"), this.client.getHabbo(), this.client.getHabbo(), RoomChatMessageBubbles.BOT))); } else { RoomItem reward = Emulator.getGameEnvironment().getItemManager().handleOpenRecycleBox(this.client.getHabbo(), item); @@ -47,7 +47,7 @@ public class PresentOpenEvent extends MessageHandler { this.client.sendResponse(new UnseenItemsComposer(reward)); this.client.sendResponse(new FurniListInvalidateComposer()); - this.client.sendResponse(new PresentOpenedMessageComposer(reward, item.getExtradata(), true)); + this.client.sendResponse(new PresentOpenedMessageComposer(reward, item.getExtraData(), true)); } } room.sendComposer(new RemoveFloorItemComposer(item).compose()); @@ -56,16 +56,16 @@ public class PresentOpenEvent extends MessageHandler { } if (item.getRoomId() == 0) { - room.updateTile(room.getLayout().getTile(item.getX(), item.getY())); + room.updateTile(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); RoomLayout roomLayout = room.getLayout(); - short z = (short)room.getStackHeight(item.getX(), item.getY(), true); + short z = (short)room.getStackHeight(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), true); if(roomLayout != null) { - RoomTile roomTile = roomLayout.getTile(item.getX(), item.getY()); + RoomTile roomTile = roomLayout.getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); if(roomTile != null) { z = roomTile.getZ(); } } - room.sendComposer(new HeightMapUpdateMessageComposer(item.getX(), item.getY(), z, room.getStackHeight(item.getX(), item.getY(), true)).compose()); + room.sendComposer(new HeightMapUpdateMessageComposer(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), z, room.getStackHeight(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), true)).compose()); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java index 08df20b8..b75b5ebf 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/floorplaneditor/UpdateFloorPropertiesEvent.java @@ -155,7 +155,7 @@ public class UpdateFloorPropertiesEvent extends MessageHandler { if (layout.getDoorTile() == null) { this.client.getHabbo().alert("Error"); ((CustomRoomLayout) layout).needsUpdate(false); - Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); + room.dispose(); return; } ((CustomRoomLayout) layout).needsUpdate(true); @@ -174,7 +174,7 @@ public class UpdateFloorPropertiesEvent extends MessageHandler { room.save(); Collection habbos = new ArrayList<>(room.getRoomUnitManager().getRoomHabbosCount()); habbos.addAll(room.getRoomUnitManager().getCurrentHabbos().values()); - Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); + room.dispose(); room = Emulator.getGameEnvironment().getRoomManager().getRoom(room.getRoomInfo().getId()); ServerMessage message = new RoomForwardMessageComposer(room.getRoomInfo().getId()).compose(); for (Habbo habbo : habbos) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java b/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java index 8f55d0e3..74c32cc7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/friends/AcceptFriendEvent.java @@ -14,8 +14,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import static com.eu.habbo.habbohotel.users.HabboManager.getOfflineHabboInfo; - @Slf4j public class AcceptFriendEvent extends MessageHandler { @@ -38,7 +36,7 @@ public class AcceptFriendEvent extends MessageHandler { Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); if(target == null) { - HabboInfo habboInfo = getOfflineHabboInfo(userId); + HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(userId); if(habboInfo == null) { this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.TARGET_NOT_FOUND)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java index 7d87c024..e1052a0f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/ApproveMembershipRequestEvent.java @@ -7,7 +7,6 @@ import com.eu.habbo.habbohotel.guilds.GuildRank; import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.guilds.GuildMemberMgmtFailedMessageComposer; import com.eu.habbo.messages.outgoing.guilds.GuildMembershipRejectedMessageComposer; @@ -26,7 +25,7 @@ public class ApproveMembershipRequestEvent extends MessageHandler { GuildMember groupMember = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); - if (habbo == null) userInfo = HabboManager.getOfflineHabboInfo(userId); + if (habbo == null) userInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(userId); else userInfo = habbo.getHabboInfo(); diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromIMEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromIMEvent.java index 895d49f8..533299ff 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromIMEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromIMEvent.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.modtool.ModToolIssue; import com.eu.habbo.habbohotel.modtool.ModToolTicketType; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.modtool.CallForHelpDisabledNotifyMessageComposer; import com.eu.habbo.threading.runnables.InsertModToolIssue; @@ -32,7 +31,7 @@ public class CallForHelpFromIMEvent extends MessageHandler { if (target != null) { info = target.getHabboInfo(); } else { - info = HabboManager.getOfflineHabboInfo(userId); + info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(userId); } if (info == null) return; diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromPhotoEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromPhotoEvent.java index 71c0de71..c0bf448c 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromPhotoEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/CallForHelpFromPhotoEvent.java @@ -40,7 +40,7 @@ public class CallForHelpFromPhotoEvent extends MessageHandler { if (!(item instanceof InteractionExternalImage)) return; - HabboInfo photoOwner = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(item.getOwnerId()); + HabboInfo photoOwner = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(item.getOwnerInfo().getId()); if (photoOwner == null) return; diff --git a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java index c7cf5143..dd684925 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/modtool/GetUserChatlogEvent.java @@ -3,7 +3,6 @@ package com.eu.habbo.messages.incoming.modtool; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.modtool.ScripterManager; import com.eu.habbo.habbohotel.permissions.Permission; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.modtool.UserChatlogComposer; @@ -12,7 +11,7 @@ public class GetUserChatlogEvent extends MessageHandler { public void handle() { if (this.client.getHabbo().hasPermissionRight(Permission.ACC_SUPPORTTOOL)) { int userId = this.packet.readInt(); - String username = HabboManager.getOfflineHabboInfo(userId).getUsername(); + String username = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(userId).getUsername(); this.client.sendResponse(new UserChatlogComposer(Emulator.getGameEnvironment().getModToolManager().getUserRoomVisitsAndChatlogs(userId), userId, username)); } else { diff --git a/src/main/java/com/eu/habbo/messages/incoming/navigator/DeleteRoomEvent.java b/src/main/java/com/eu/habbo/messages/incoming/navigator/DeleteRoomEvent.java index b4a4d7c0..7c790233 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/navigator/DeleteRoomEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/navigator/DeleteRoomEvent.java @@ -91,7 +91,7 @@ public class DeleteRoomEvent extends MessageHandler { } } - Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); + room.dispose(); try (PreparedStatement rights = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ?")) { rights.setInt(1, roomId); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java index 2f771bfd..4ad3455d 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/RequestRoomPropertySet.java @@ -28,17 +28,17 @@ public class RequestRoomPropertySet extends MessageHandler { switch (item.getBaseItem().getName()) { case "floor": - room.getRoomInfo().setFloorPaint(item.getExtradata()); + room.getRoomInfo().setFloorPaint(item.getExtraData()); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoFloor")); break; case "wallpaper": - room.getRoomInfo().setWallPaint(item.getExtradata()); + room.getRoomInfo().setWallPaint(item.getExtraData()); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoWallpaper")); break; case "landscape": - room.getRoomInfo().setLandscapePaint(item.getExtradata()); + room.getRoomInfo().setLandscapePaint(item.getExtraData()); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoLandscape")); break; @@ -48,7 +48,7 @@ public class RequestRoomPropertySet extends MessageHandler { this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item); room.setNeedsUpdate(true); - room.sendComposer(new RoomPropertyMessageComposer(item.getBaseItem().getName(), item.getExtradata()).compose()); + room.sendComposer(new RoomPropertyMessageComposer(item.getBaseItem().getName(), item.getExtraData()).compose()); item.needsDelete(true); Emulator.getThreading().run(item); this.client.sendResponse(new FurniListRemoveComposer(itemId)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java index cd81a0e0..b820bffc 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/SetRoomBackgroundColorDataEvent.java @@ -35,7 +35,7 @@ public class SetRoomBackgroundColorDataEvent extends MessageHandler { saturation = event.getSaturation() % 256; brightness = event.getBrightness() % 256; - item.setExtradata(item.getExtradata().split(":")[0] + ":" + hue + ":" + saturation + ":" + brightness); + item.setExtraData(item.getExtraData().split(":")[0] + ":" + hue + ":" + saturation + ":" + brightness); item.needsUpdate(true); Emulator.getThreading().run(item); room.updateItem(item); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/UpdateRoomFilterEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/UpdateRoomFilterEvent.java index e3b6aaf5..f9eb118e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/UpdateRoomFilterEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/UpdateRoomFilterEvent.java @@ -29,9 +29,9 @@ public class UpdateRoomFilterEvent extends MessageHandler { // Modify word filter. if (add) { - room.addToWordFilter(word); + room.getRoomWordFilterManager().addWord(word); } else { - room.removeFromWordFilter(word); + room.getRoomWordFilterManager().removeWord(word); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java index 583ddae5..f8f35f1b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/AddSpamWallPostItEvent.java @@ -37,8 +37,8 @@ public class AddSpamWallPostItEvent extends MessageHandler { Room room = this.client.getHabbo().getRoomUnit().getRoom(); RoomItem sticky = room.getRoomItemManager().getRoomItemById(itemId); - if (sticky != null && sticky.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) { - sticky.setOwnerId(room.getRoomInfo().getOwnerInfo().getId()); + if (sticky != null && sticky.getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) { + sticky.setOwnerInfo(room.getRoomInfo().getOwnerInfo()); if (color.equalsIgnoreCase(PostItColor.YELLOW.hexColor)) { color = PostItColor.randomColorNotYellow().hexColor; @@ -47,8 +47,8 @@ public class AddSpamWallPostItEvent extends MessageHandler { text = InteractionPostIt.STICKYPOLE_PREFIX_TEXT.replace("\\r", "\r").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%timestamp%", LocalDate.now().toString()) + text; } - sticky.setOwnerId(room.getRoomInfo().getOwnerInfo().getId()); - sticky.setExtradata(color + " " + text); + sticky.setOwnerInfo(room.getRoomInfo().getOwnerInfo()); + sticky.setExtraData(color + " " + text); sticky.needsUpdate(true); room.updateItem(sticky); Emulator.getThreading().run(sticky); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CreditFurniRedeemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CreditFurniRedeemEvent.java index 42183db6..2ee0e584 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CreditFurniRedeemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CreditFurniRedeemEvent.java @@ -25,7 +25,7 @@ public class CreditFurniRedeemEvent extends MessageHandler { if (room != null) { RoomItem item = room.getRoomItemManager().getRoomItemById(itemId); - if (item != null && this.client.getHabbo().getHabboInfo().getId() == item.getOwnerId()) { + if (item != null && this.client.getHabbo().getHabboInfo().getId() == item.getOwnerInfo().getId()) { boolean furnitureRedeemEventRegistered = Emulator.getPluginManager().isRegistered(FurnitureRedeemedEvent.class, true); FurnitureRedeemedEvent furniRedeemEvent = new FurnitureRedeemedEvent(item, this.client.getHabbo(), 0, FurnitureRedeemedEvent.CREDITS); @@ -98,10 +98,10 @@ public class CreditFurniRedeemEvent extends MessageHandler { room.getRoomItemManager().removeRoomItem(item); room.sendComposer(new RemoveFloorItemComposer(item).compose()); - RoomTile t = room.getLayout().getTile(item.getX(), item.getY()); - t.setStackHeight(room.getStackHeight(item.getX(), item.getY(), false)); + RoomTile t = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + t.setStackHeight(room.getStackHeight(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), false)); room.updateTile(t); - room.sendComposer(new HeightMapUpdateMessageComposer(item.getX(), item.getY(), t.getZ(), t.relativeHeight()).compose()); + room.sendComposer(new HeightMapUpdateMessageComposer(item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), t.getZ(), t.relativeHeight()).compose()); Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId())); switch (furniRedeemEvent.currencyID) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CustomizeAvatarWithFurniEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CustomizeAvatarWithFurniEvent.java index 87ce4df9..a5d0a21f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CustomizeAvatarWithFurniEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/CustomizeAvatarWithFurniEvent.java @@ -29,14 +29,14 @@ public class CustomizeAvatarWithFurniEvent extends MessageHandler { if (this.client.getHabbo().getRoomUnit().getRoom() != null && this.client.getHabbo().getRoomUnit().getRoom().getRoomRightsManager().hasRights(this.client.getHabbo())) { RoomItem item = this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getRoomItemById(itemId); - if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) { + if (item != null && item.getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) { if (item instanceof InteractionClothing) { ClothItem clothing = Emulator.getGameEnvironment().getCatalogManager().getClothing(item.getBaseItem().getName()); if (clothing != null) { if (!this.client.getHabbo().getInventory().getWardrobeComponent().getClothing().contains(clothing.getId())) { item.setRoomId(0); - RoomTile tile = this.client.getHabbo().getRoomUnit().getRoom().getLayout().getTile(item.getX(), item.getY()); + RoomTile tile = this.client.getHabbo().getRoomUnit().getRoom().getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item); this.client.getHabbo().getRoomUnit().getRoom().updateTile(tile); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new HeightMapUpdateMessageComposer(tile.getX(), tile.getY(), tile.getZ(), tile.relativeHeight()).compose()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/DiceOffEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/DiceOffEvent.java index 71379105..ed5d896b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/DiceOffEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/DiceOffEvent.java @@ -22,9 +22,9 @@ public class DiceOffEvent extends MessageHandler { if (item != null) { if (item instanceof InteractionDice) { - if (RoomLayout.tilesAdjecent(room.getLayout().getTile(item.getX(), item.getY()), this.client.getHabbo().getRoomUnit().getCurrentPosition())) { - if (!item.getExtradata().equals("-1")) { - item.setExtradata("0"); + if (RoomLayout.tilesAdjecent(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), this.client.getHabbo().getRoomUnit().getCurrentPosition())) { + if (!item.getExtraData().equals("-1")) { + item.setExtraData("0"); item.needsUpdate(true); Emulator.getThreading().run(item); room.updateItem(item); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/EnterOneWayDoorEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/EnterOneWayDoorEvent.java index ebab2d5a..ba4452ba 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/EnterOneWayDoorEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/EnterOneWayDoorEvent.java @@ -17,7 +17,7 @@ public class EnterOneWayDoorEvent extends MessageHandler { return; if (item instanceof InteractionOneWayGate) { - if (!item.getExtradata().equals("0") || this.client.getHabbo().getRoomUnit().isTeleporting()) + if (!item.getExtraData().equals("0") || this.client.getHabbo().getRoomUnit().isTeleporting()) return; item.onClick(this.client, this.client.getHabbo().getRoomUnit().getRoom(), null); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java index 87ec232e..4f6da343 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PickupObjectEvent.java @@ -24,15 +24,15 @@ public class PickupObjectEvent extends MessageHandler { return; } - if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) { + if (item.getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) { room.getRoomItemManager().pickUpItem(item, this.client.getHabbo()); } else { if (room.getRoomRightsManager().hasRights(this.client.getHabbo())) { if (this.client.getHabbo().hasPermissionRight(Permission.ACC_ANYROOMOWNER)) { - item.setOwnerId(this.client.getHabbo().getHabboInfo().getId()); + item.setOwnerInfo(this.client.getHabbo().getHabboInfo()); } else { if (!room.getRoomInfo().isRoomOwner(this.client.getHabbo())) { - if (item.getOwnerId() == room.getRoomInfo().getOwnerInfo().getId()) { + if (item.getOwnerInfo().getId() == room.getRoomInfo().getOwnerInfo().getId()) { return; } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlaceObjectEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlaceObjectEvent.java index 988fa148..776acf3e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlaceObjectEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlaceObjectEvent.java @@ -87,7 +87,7 @@ public class PlaceObjectEvent extends MessageHandler { this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode())); return; } - if (rentSpace != null && !RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) { + if (rentSpace != null && !RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getCurrentPosition().getX(), rentSpace.getCurrentPosition().getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) { this.client.sendResponse(new NotificationDialogMessageComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.getKey(), FurnitureMovementError.NO_RIGHTS.getErrorCode())); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlacePostItEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlacePostItEvent.java index b2c5a382..e5bc4c86 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlacePostItEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PlacePostItEvent.java @@ -28,10 +28,10 @@ public class PlacePostItEvent extends MessageHandler { if (item instanceof InteractionPostIt) { if (room.getPostItNotes().size() < Room.MAXIMUM_POSTITNOTES) { room.getRoomItemManager().addRoomItem(item); - item.setExtradata("FFFF33"); + item.setExtraData("FFFF33"); item.setRoomId(this.client.getHabbo().getRoomUnit().getRoom().getRoomInfo().getId()); item.setWallPosition(location); - item.setOwnerId(this.client.getHabbo().getHabboInfo().getId()); + item.setOwnerInfo(this.client.getHabbo().getHabboInfo()); item.needsUpdate(true); room.sendComposer(new ItemAddMessageComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose()); this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java index 9ba6aa6c..6841f9fa 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RemoveItemEvent.java @@ -23,7 +23,7 @@ public class RemoveItemEvent extends MessageHandler { RoomItem item = room.getRoomItemManager().getRoomItemById(itemId); if (item instanceof InteractionPostIt || item instanceof InteractionExternalImage) { - if (item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermissionRight(Permission.ACC_ANYROOMOWNER)) { + if (item.getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId() || this.client.getHabbo().hasPermissionRight(Permission.ACC_ANYROOMOWNER)) { item.setRoomId(0); room.getRoomItemManager().removeRoomItem(item); room.sendComposer(new ItemRemoveMessageComposer(item).compose()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerChangeStateEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerChangeStateEvent.java index b50d4b55..f8130a7f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerChangeStateEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerChangeStateEvent.java @@ -29,8 +29,8 @@ public class RoomDimmerChangeStateEvent extends MessageHandler { } RoomMoodlightData adjusted = RoomMoodlightData.fromString(extradata); - if (RoomMoodlightData.fromString(moodLight.getExtradata()).isEnabled()) adjusted.disable(); - moodLight.setExtradata(adjusted.toString()); + if (RoomMoodlightData.fromString(moodLight.getExtraData()).isEnabled()) adjusted.disable(); + moodLight.setExtraData(adjusted.toString()); moodLight.needsUpdate(true); room.updateItem(moodLight); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerSavePresetEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerSavePresetEvent.java index 98fc6e7d..2d75a54b 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerSavePresetEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomDimmerSavePresetEvent.java @@ -49,7 +49,7 @@ public class RoomDimmerSavePresetEvent extends MessageHandler { if (apply) data.enable(); for (RoomItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionMoodLight.class)) { - item.setExtradata(data.toString()); + item.setExtraData(data.toString()); item.needsUpdate(true); room.updateItem(item); Emulator.getThreading().run(item); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetCustomStackingHeightEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetCustomStackingHeightEvent.java index 48f1b97c..6d570d08 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetCustomStackingHeightEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetCustomStackingHeightEvent.java @@ -22,7 +22,7 @@ public class SetCustomStackingHeightEvent extends MessageHandler { if (item instanceof InteractionStackHelper) { Room room = this.client.getHabbo().getRoomUnit().getRoom(); - RoomTile itemTile = room.getLayout().getTile(item.getX(), item.getY()); + RoomTile itemTile = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); double stackerHeight = this.packet.readInt(); THashSet tiles = room.getLayout().getTilesAt(itemTile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); @@ -46,9 +46,10 @@ public class SetCustomStackingHeightEvent extends MessageHandler { tile.setStackHeight(height); } - item.setZ(height); - item.setExtradata((int) (height * 100) + ""); + item.setCurrentZ(height); + item.setExtraData(String.valueOf((int) (height * 100))); item.needsUpdate(true); + this.client.getHabbo().getRoomUnit().getRoom().updateItem(item); this.client.getHabbo().getRoomUnit().getRoom().updateTiles(tiles); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new HeightMapUpdateMessageComposer (room, tiles).compose()); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetItemDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetItemDataEvent.java index 8739eb13..03d731f4 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetItemDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetItemDataEvent.java @@ -40,7 +40,7 @@ public class SetItemDataEvent extends MessageHandler { return; if (!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.getRoomRightsManager().hasRights(this.client.getHabbo())) { - if (!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], ""))) { + if (!text.startsWith(item.getExtraData().replace(item.getExtraData().split(" ")[0], ""))) { return; } } else { @@ -51,7 +51,7 @@ public class SetItemDataEvent extends MessageHandler { if (color.isEmpty()) color = PostItColor.YELLOW.hexColor; - item.setExtradata(color + " " + text); + item.setExtraData(color + " " + text); item.needsUpdate(true); room.updateItem(item); Emulator.getThreading().run(item); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinFigureEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinFigureEvent.java index 5270f139..3f785e48 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinFigureEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinFigureEvent.java @@ -20,7 +20,7 @@ public class SetMannequinFigureEvent extends MessageHandler { if (item == null) return; - String[] data = item.getExtradata().split(":"); + String[] data = item.getExtraData().split(":"); //TODO: Only clothing not whole body part. StringBuilder look = new StringBuilder(); @@ -36,9 +36,9 @@ public class SetMannequinFigureEvent extends MessageHandler { } if (data.length == 3) { - item.setExtradata(habbo.getHabboInfo().getGender().name().toLowerCase() + ":" + look + ":" + data[2]); + item.setExtraData(habbo.getHabboInfo().getGender().name().toLowerCase() + ":" + look + ":" + data[2]); } else { - item.setExtradata(habbo.getHabboInfo().getGender().name().toLowerCase() + ":" + look + ":" + habbo.getHabboInfo().getUsername() + "'s look."); + item.setExtraData(habbo.getHabboInfo().getGender().name().toLowerCase() + ":" + look + ":" + habbo.getHabboInfo().getUsername() + "'s look."); } item.needsUpdate(true); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinNameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinNameEvent.java index 77d17e51..3be84b84 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinNameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetMannequinNameEvent.java @@ -17,7 +17,7 @@ public class SetMannequinNameEvent extends MessageHandler { if (item == null) return; - String[] data = item.getExtradata().split(":"); + String[] data = item.getExtraData().split(":"); String name = this.packet.readString(); if (name.length() < 3 || name.length() > 15) { @@ -25,9 +25,9 @@ public class SetMannequinNameEvent extends MessageHandler { } if (data.length == 3) { - item.setExtradata(this.client.getHabbo().getHabboInfo().getGender().name().toUpperCase() + ":" + data[1] + ":" + name); + item.setExtraData(this.client.getHabbo().getHabboInfo().getGender().name().toUpperCase() + ":" + data[1] + ":" + name); } else { - item.setExtradata(this.client.getHabbo().getHabboInfo().getGender().name().toUpperCase() + ":" + this.client.getHabbo().getHabboInfo().getLook() + ":" + name); + item.setExtraData(this.client.getHabbo().getHabboInfo().getGender().name().toUpperCase() + ":" + this.client.getHabbo().getHabboInfo().getLook() + ":" + name); } item.needsUpdate(true); Emulator.getThreading().run(item); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java index e15581c7..fd5873f2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetObjectDataEvent.java @@ -42,7 +42,7 @@ public class SetObjectDataEvent extends MessageHandler { ((InteractionCustomValues) item).values.put(key, value); } - item.setExtradata(((InteractionCustomValues) item).toExtraData()); + item.setExtraData(((InteractionCustomValues) item).toExtraData()); item.needsUpdate(true); Emulator.getThreading().run(item); room.updateItem(item); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ThrowDiceEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ThrowDiceEvent.java index da54a9e8..ea6ef3fa 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ThrowDiceEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/ThrowDiceEvent.java @@ -22,7 +22,7 @@ public class ThrowDiceEvent extends MessageHandler { if (item != null) { if (item instanceof InteractionDice || item instanceof InteractionSpinningBottle) { - if (RoomLayout.tilesAdjecent(room.getLayout().getTile(item.getX(), item.getY()), this.client.getHabbo().getRoomUnit().getCurrentPosition())) { + if (RoomLayout.tilesAdjecent(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), this.client.getHabbo().getRoomUnit().getCurrentPosition())) { item.onClick(this.client, room, new Object[]{}); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseFurnitureEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseFurnitureEvent.java index 298db957..67f4e111 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseFurnitureEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UseFurnitureEvent.java @@ -69,11 +69,11 @@ public class UseFurnitureEvent extends MessageHandler { boolean isRare = item.getBaseItem().getName().contains("rare"); int rarity = getRarity(item, isRare); - MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), isRare, room.getLayout().getTile(item.getX(), item.getY()), rarity); + MonsterplantPet pet = Emulator.getGameEnvironment().getPetManager().createMonsterplant(room, this.client.getHabbo(), isRare, room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), rarity); room.sendComposer(new RemoveFloorItemComposer(item, true).compose()); room.getRoomItemManager().removeRoomItem(item); - room.updateTile(room.getLayout().getTile(item.getX(), item.getY())); - room.getRoomUnitManager().placePet(pet, room, item.getX(), item.getY(), item.getZ()); + room.updateTile(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); + room.getRoomUnitManager().placePet(pet, room, item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getCurrentZ()); pet.cycle(); room.sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose()); return true; @@ -82,11 +82,11 @@ public class UseFurnitureEvent extends MessageHandler { } private int getRarity(RoomItem item, boolean isRare) { - if (item.getExtradata().isEmpty() || Integer.parseInt(item.getExtradata()) - 1 < 0) { + if (item.getExtraData().isEmpty() || Integer.parseInt(item.getExtraData()) - 1 < 0) { return isRare ? InteractionMonsterPlantSeed.randomGoldenRarityLevel() : InteractionMonsterPlantSeed.randomRarityLevel(); } else { try { - return Integer.parseInt(item.getExtradata()) - 1; + return Integer.parseInt(item.getExtraData()) - 1; } catch (Exception ignored) { return 0; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostPlantEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostPlantEvent.java index 6682fa31..db1054fe 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostPlantEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CompostPlantEvent.java @@ -32,11 +32,12 @@ public class CompostPlantEvent extends MessageHandler { Item baseItem = Emulator.getGameEnvironment().getItemManager().getItem("mnstr_compost"); if (baseItem != null) { - RoomItem compost = Emulator.getGameEnvironment().getItemManager().createItem(pet.getUserId(), baseItem, 0, 0, ""); - compost.setX(pet.getRoomUnit().getCurrentPosition().getX()); - compost.setY(pet.getRoomUnit().getCurrentPosition().getY()); - compost.setZ(pet.getRoomUnit().getCurrentZ()); + RoomItem compost = Emulator.getGameEnvironment().getItemManager().createItem(pet.getUserId(), baseItem, 0, 0, "");; + + compost.setCurrentPosition(pet.getRoomUnit().getCurrentPosition()); + compost.setCurrentZ(pet.getRoomUnit().getCurrentZ()); compost.setRotation(pet.getRoomUnit().getBodyRotation().getValue()); + room.getRoomItemManager().addRoomItem(compost); room.sendComposer(new ObjectAddMessageComposer(compost, this.client.getHabbo().getHabboInfo().getUsername()).compose()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CustomizePetWithFurniEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CustomizePetWithFurniEvent.java index 6ee20822..46737ae3 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CustomizePetWithFurniEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/CustomizePetWithFurniEvent.java @@ -93,14 +93,14 @@ public class CustomizePetWithFurniEvent extends MessageHandler { if (((MonsterplantPet) pet).isDead()) { ((MonsterplantPet) pet).setDeathTimestamp(Emulator.getIntUnixTimestamp() + MonsterplantPet.TIME_TO_LIVE); pet.getRoomUnit().clearStatuses(); - pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "rev"); + pet.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, "rev"); pet.setPacketUpdate(true); this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose()); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose()); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose()); - this.client.getHabbo().getRoomUnit().getRoom().updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + this.client.getHabbo().getRoomUnit().getRoom().updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("MonsterPlantHealer")); pet.getRoomUnit().removeStatus(RoomUnitStatus.GESTURE); Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId())); @@ -110,13 +110,13 @@ public class CustomizePetWithFurniEvent extends MessageHandler { pet.setCreated(pet.getCreated() - MonsterplantPet.GROW_TIME); pet.getRoomUnit().clearStatuses(); pet.cycle(); - pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "spd"); - pet.getRoomUnit().setStatus(RoomUnitStatus.fromString("grw" + ((MonsterplantPet) pet).getGrowthStage()), ""); + pet.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, "spd"); + pet.getRoomUnit().addStatus(RoomUnitStatus.fromString("grw" + ((MonsterplantPet) pet).getGrowthStage()), ""); this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose()); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose()); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose()); - this.client.getHabbo().getRoomUnit().getRoom().updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + this.client.getHabbo().getRoomUnit().getRoom().updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); pet.getRoomUnit().removeStatus(RoomUnitStatus.GESTURE); pet.cycle(); Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId())); @@ -132,13 +132,13 @@ public class CustomizePetWithFurniEvent extends MessageHandler { { ((MonsterplantPet) pet).setCanBreed(true); pet.getRoomUnit().clearStatuses(); - pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "reb"); + pet.getRoomUnit().addStatus(RoomUnitStatus.GESTURE, "reb"); this.client.getHabbo().getRoomUnit().getRoom().getRoomItemManager().removeRoomItem(item); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new RemoveFloorItemComposer(item).compose()); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(pet.getRoomUnit()).compose()); this.client.getHabbo().getRoomUnit().getRoom().sendComposer(new PetStatusUpdateComposer(pet).compose()); - this.client.getHabbo().getRoomUnit().getRoom().updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + this.client.getHabbo().getRoomUnit().getRoom().updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); pet.getRoomUnit().removeStatus(RoomUnitStatus.GESTURE); Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId())); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/OpenPetPackageEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/OpenPetPackageEvent.java index 4dfb082d..26a43454 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/OpenPetPackageEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/OpenPetPackageEvent.java @@ -22,7 +22,7 @@ public class OpenPetPackageEvent extends MessageHandler { if (room != null) { RoomItem item = room.getRoomItemManager().getRoomItemById(itemId); - if (item != null && item.getOwnerId() == this.client.getHabbo().getHabboInfo().getId()) { + if (item != null && item.getOwnerInfo().getId() == this.client.getHabbo().getHabboInfo().getId()) { if (!name.matches("^[a-zA-Z0-9]*$")) { this.client.sendResponse(new PerkAllowancesComposer(itemId, PerkAllowancesComposer.CONTAINS_INVALID_CHARS, name.replaceAll("^[a-zA-Z0-9]*$", ""))); return; @@ -55,18 +55,18 @@ public class OpenPetPackageEvent extends MessageHandler { } if (pet != null) { - room.getRoomUnitManager().placePet(pet, room, item.getX(), item.getY(), item.getZ()); + room.getRoomUnitManager().placePet(pet, room, item.getCurrentPosition().getX(), item.getCurrentPosition().getY(), item.getCurrentZ()); pet.setUserId(this.client.getHabbo().getHabboInfo().getId()); pet.setNeedsUpdate(true); - pet.getRoomUnit().setLocation(room.getLayout().getTile(item.getX(), item.getY())); - pet.getRoomUnit().setCurrentZ(item.getZ()); + pet.getRoomUnit().setLocation(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); + pet.getRoomUnit().setCurrentZ(item.getCurrentZ()); Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId())); room.getRoomItemManager().removeRoomItem(item); room.sendComposer(new RemoveFloorItemComposer(item).compose()); - RoomTile tile = room.getLayout().getTile(item.getX(), item.getY()); - room.updateTile(room.getLayout().getTile(item.getX(), item.getY())); + RoomTile tile = room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY()); + room.updateTile(room.getLayout().getTile(item.getCurrentPosition().getX(), item.getCurrentPosition().getY())); room.sendComposer(new HeightMapUpdateMessageComposer(tile.getX(), tile.getY(), tile.getZ(), tile.relativeHeight()).compose()); - item.setOwnerId(0); + item.setOwnerInfo(null); } else { this.client.sendResponse(new PurchaseErrorMessageComposer(PurchaseErrorMessageComposer.SERVER_ERROR)); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java index 6dab7341..8bad80f6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/PlacePetEvent.java @@ -84,7 +84,7 @@ public class PlacePetEvent extends MessageHandler { roomUnit.setLocation(tile); roomUnit.setCurrentZ(tile.getStackHeight()); - roomUnit.setStatus(RoomUnitStatus.SIT, "0"); + roomUnit.addStatus(RoomUnitStatus.SIT, "0"); roomUnit.setRoomUnitType(RoomUnitType.PET); if (playerTile != null) { roomUnit.lookAtPoint(playerTile); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/MoveAvatarEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/MoveAvatarEvent.java index 5c82f48b..9cca3aa2 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/MoveAvatarEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/MoveAvatarEvent.java @@ -102,8 +102,9 @@ public class MoveAvatarEvent extends MessageHandler { } // Don't calculate a new path if we are on a horse - if (habbo.getHabboInfo().getRiding() != null && habbo.getHabboInfo().getRiding().getTask() != null && habbo.getHabboInfo().getRiding().getTask().equals(PetTasks.JUMP)) + if (habbo.getHabboInfo().getRiding() != null && habbo.getHabboInfo().getRiding().getTask() != null && habbo.getHabboInfo().getRiding().getTask().equals(PetTasks.JUMP)) { return; + } // Reset idle status if (roomHabbo.isIdle()) { @@ -137,11 +138,12 @@ public class MoveAvatarEvent extends MessageHandler { RoomItem bed = room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY()); if (bed != null && bed.getBaseItem().allowLay()) { - room.getLayout().getTile(bed.getX(), bed.getY()); + room.getLayout().getTile(bed.getCurrentPosition().getX(), bed.getCurrentPosition().getY()); RoomTile pillow = switch (bed.getRotation()) { - case 0, 4 -> room.getLayout().getTile((short) x, bed.getY()); - case 2, 8 -> room.getLayout().getTile(bed.getX(), (short) y); - default -> room.getLayout().getTile(bed.getX(), bed.getY()); + case 0, 4 -> room.getLayout().getTile((short) x, bed.getCurrentPosition().getY()); + case 2, 8 -> room.getLayout().getTile(bed.getCurrentPosition().getX(), (short) y); + default -> + room.getLayout().getTile(bed.getCurrentPosition().getX(), bed.getCurrentPosition().getY()); }; if (pillow != null && room.canLayAt(pillow)) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/SignEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/SignEvent.java index 11885a68..55119bf7 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/SignEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/SignEvent.java @@ -22,7 +22,7 @@ public class SignEvent extends MessageHandler { UserSignEvent event = new UserSignEvent(this.client.getHabbo(), signId); if (!Emulator.getPluginManager().fireEvent(event).isCancelled()) { - this.client.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.SIGN, String.valueOf(event.getSign())); + this.client.getHabbo().getRoomUnit().addStatus(RoomUnitStatus.SIGN, String.valueOf(event.getSign())); this.client.getHabbo().getRoomUnit().unIdle(); if(signId <= 10) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/ChangeUserNameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/ChangeUserNameEvent.java index af63c7c2..0d24bd23 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/ChangeUserNameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/ChangeUserNameEvent.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.rooms.users.ChangeUserNameResultMessageEvent; import com.eu.habbo.messages.outgoing.rooms.users.UserNameChangedMessageComposer; @@ -41,7 +40,7 @@ public class ChangeUserNameEvent extends MessageHandler { } if (name.equals(this.client.getHabbo().getHabboStats().getChangeNameChecked())) { - HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(name); + HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(name); if (habboInfo == null) { synchronized (changingUsernames) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/CheckUserNameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/CheckUserNameEvent.java index ca79760b..61d5e9d9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/CheckUserNameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/CheckUserNameEvent.java @@ -1,7 +1,6 @@ package com.eu.habbo.messages.incoming.users; import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.users.CheckUserNameResultMessageComposer; @@ -25,7 +24,7 @@ public class CheckUserNameEvent extends MessageHandler { errorCode = CheckUserNameResultMessageComposer.TOO_SHORT; } else if (name.length() > 15) { errorCode = CheckUserNameResultMessageComposer.TOO_LONG; - } else if (name.equalsIgnoreCase(this.client.getHabbo().getHabboInfo().getUsername()) || HabboManager.getOfflineHabboInfo(name) != null || ChangeUserNameEvent.changingUsernames.contains(name.toLowerCase())) { + } else if (name.equalsIgnoreCase(this.client.getHabbo().getHabboInfo().getUsername()) || Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(name) != null || ChangeUserNameEvent.changingUsernames.contains(name.toLowerCase())) { errorCode = CheckUserNameResultMessageComposer.TAKEN_WITH_SUGGESTIONS; suggestions.add(name + Emulator.getRandom().nextInt(9999)); suggestions.add(name + Emulator.getRandom().nextInt(9999)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/GetExtendedProfileEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/GetExtendedProfileEvent.java index 9203d35c..369c6167 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/GetExtendedProfileEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/GetExtendedProfileEvent.java @@ -15,6 +15,6 @@ public class GetExtendedProfileEvent extends MessageHandler { if (habbo != null) this.client.sendResponse(new ExtendedProfileMessageComposer(habbo, this.client)); else - this.client.sendResponse(new ExtendedProfileMessageComposer(HabboManager.getOfflineHabboInfo(habboId), this.client)); + this.client.sendResponse(new ExtendedProfileMessageComposer(Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(habboId), this.client)); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/GetIgnoredUsersEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/GetIgnoredUsersEvent.java index a3bc41b3..653a7848 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/GetIgnoredUsersEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/GetIgnoredUsersEvent.java @@ -3,7 +3,6 @@ package com.eu.habbo.messages.incoming.users; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.unknown.IgnoredUsersMessageComposer; import gnu.trove.list.array.TIntArrayList; @@ -26,7 +25,7 @@ public class GetIgnoredUsersEvent extends MessageHandler { int userId = ignoredUsersId.iterator().next(); HabboInfo user = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId); - if(user == null) user = HabboManager.getOfflineHabboInfo(userId); + if(user == null) user = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(userId); if(user != null) ignoredUsernames.add(user.getUsername()); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/wired/ApplySnapshotEvent.java b/src/main/java/com/eu/habbo/messages/incoming/wired/ApplySnapshotEvent.java index 4daf1e0e..1d5534f5 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/wired/ApplySnapshotEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/wired/ApplySnapshotEvent.java @@ -65,13 +65,13 @@ public class ApplySnapshotEvent extends MessageHandler { RoomItem matchItem = room.getRoomItemManager().getRoomItemById(setting.getItem_id()); // Match state - if (wired.shouldMatchState() && matchItem.allowWiredResetState() && !setting.getState().equals(" ") && !matchItem.getExtradata().equals(setting.getState())) { - matchItem.setExtradata(setting.getState()); + if (wired.shouldMatchState() && matchItem.allowWiredResetState() && !setting.getState().equals(" ") && !matchItem.getExtraData().equals(setting.getState())) { + matchItem.setExtraData(setting.getState()); room.updateItemState(matchItem); } - RoomTile oldLocation = room.getLayout().getTile(matchItem.getX(), matchItem.getY()); - double oldZ = matchItem.getZ(); + RoomTile oldLocation = room.getLayout().getTile(matchItem.getCurrentPosition().getX(), matchItem.getCurrentPosition().getY()); + double oldZ = matchItem.getCurrentZ(); // Match Position & Rotation if (wired.shouldMatchRotation() && !wired.shouldMatchPosition()) { @@ -86,7 +86,7 @@ public class ApplySnapshotEvent extends MessageHandler { if (newLocation != null && newLocation.getState() != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != matchItem.getRotation()) && room.getRoomItemManager().furnitureFitsAt(newLocation, matchItem, newRotation, true) == FurnitureMovementError.NONE) { boolean sendUpdates = !slideAnimation; if (room.getRoomItemManager().moveItemTo(matchItem, newLocation, newRotation, null, sendUpdates, true) == FurnitureMovementError.NONE && slideAnimation) { - room.sendComposer(new FloorItemOnRollerComposer(matchItem, null, oldLocation, oldZ, newLocation, matchItem.getZ(), 0, room).compose()); + room.sendComposer(new FloorItemOnRollerComposer(matchItem, null, oldLocation, oldZ, newLocation, matchItem.getCurrentZ(), 0, room).compose()); } } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListAddOrUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListAddOrUpdateComposer.java index fc797a33..4ba9cb7f 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListAddOrUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListAddOrUpdateComposer.java @@ -29,13 +29,13 @@ public class FurniListAddOrUpdateComposer extends MessageComposer { if (this.roomItem.isLimited()) { this.response.appendInt(1); this.response.appendInt(256); - this.response.appendString(this.roomItem.getExtradata()); + this.response.appendString(this.roomItem.getExtraData()); this.response.appendInt(this.roomItem.getLimitedSells()); this.response.appendInt(this.roomItem.getLimitedStack()); } else { this.response.appendInt(1); this.response.appendInt(0); - this.response.appendString(this.roomItem.getExtradata()); + this.response.appendString(this.roomItem.getExtraData()); } this.response.appendBoolean(this.roomItem.getBaseItem().allowRecyle()); this.response.appendBoolean(this.roomItem.getBaseItem().allowTrade()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListComposer.java index 71f01bec..0b9e9301 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/inventory/FurniListComposer.java @@ -57,7 +57,7 @@ public class FurniListComposer extends MessageComposer implements TIntObjectProc } this.response.appendInt(0); - this.response.appendString(roomItem.getExtradata()); + this.response.appendString(roomItem.getExtraData()); } else { if (roomItem.getBaseItem().getName().equals("gnome_box")) this.response.appendInt(13); @@ -77,7 +77,7 @@ public class FurniListComposer extends MessageComposer implements TIntObjectProc if (roomItem.getBaseItem().getType() == FurnitureType.FLOOR) { this.response.appendString(""); if(roomItem.getBaseItem().getName().equals("song_disk")) { - List extraDataAsList = Arrays.asList(roomItem.getExtradata().split("\n")); + List extraDataAsList = Arrays.asList(roomItem.getExtraData().split("\n")); this.response.appendInt(Integer.valueOf(extraDataAsList.get(extraDataAsList.size() - 1))); return true; } @@ -89,7 +89,7 @@ public class FurniListComposer extends MessageComposer implements TIntObjectProc public void addExtraDataToResponse(RoomItem roomItem) { this.response.appendInt(0); - this.response.appendString(roomItem.getExtradata()); + this.response.appendString(roomItem.getExtraData()); } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterSettingsMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterSettingsMessageComposer.java index 96d0ad1c..0c808f8b 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterSettingsMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterSettingsMessageComposer.java @@ -14,9 +14,9 @@ public class RoomFilterSettingsMessageComposer extends MessageComposer { protected ServerMessage composeInternal() { this.response.init(Outgoing.roomFilterSettingsMessageComposer); - this.response.appendInt(this.room.getWordFilterWords().size()); + this.response.appendInt(this.room.getRoomWordFilterManager().getFilteredWords().size()); - for (String string : this.room.getWordFilterWords()) { + for (String string : this.room.getRoomWordFilterManager().getFilteredWords()) { this.response.appendString(string); } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java index 092a2e9c..f23c8fa7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java @@ -35,31 +35,31 @@ public class FloorItemOnRollerComposer extends MessageComposer { @Override protected ServerMessage composeInternal() { - short oldX = this.item.getX(); - short oldY = this.item.getY(); + short oldX = this.item.getCurrentPosition().getX(); + short oldY = this.item.getCurrentPosition().getY(); this.response.init(Outgoing.slideObjectBundleMessageComposer); - this.response.appendInt(this.oldLocation != null ? this.oldLocation.getX() : this.item.getX()); - this.response.appendInt(this.oldLocation != null ? this.oldLocation.getY() : this.item.getY()); + this.response.appendInt(this.oldLocation != null ? this.oldLocation.getX() : this.item.getCurrentPosition().getX()); + this.response.appendInt(this.oldLocation != null ? this.oldLocation.getY() : this.item.getCurrentPosition().getY()); this.response.appendInt(this.newLocation.getX()); this.response.appendInt(this.newLocation.getY()); this.response.appendInt(1); this.response.appendInt(this.item.getId()); - this.response.appendString(Double.toString(this.oldLocation != null ? this.oldZ : this.item.getZ())); - this.response.appendString(Double.toString(this.oldLocation != null ? this.newZ : (this.item.getZ() + this.heightOffset))); + this.response.appendString(Double.toString(this.oldLocation != null ? this.oldZ : this.item.getCurrentZ())); + this.response.appendString(Double.toString(this.oldLocation != null ? this.newZ : (this.item.getCurrentZ() + this.heightOffset))); this.response.appendInt(this.roller != null ? this.roller.getId() : -1); if(this.oldLocation == null) { - this.item.onMove(this.room, this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.newLocation); - this.item.setX(this.newLocation.getX()); - this.item.setY(this.newLocation.getY()); - this.item.setZ(this.item.getZ() + this.heightOffset); + this.item.onMove(this.room, this.room.getLayout().getTile(this.item.getCurrentPosition().getX(), this.item.getCurrentPosition().getY()), this.newLocation); + + this.item.setCurrentPosition(this.newLocation); + this.item.setCurrentZ(this.item.getCurrentZ() + this.heightOffset); this.item.needsUpdate(true); //TODO This is bad // THashSet tiles = this.room.getLayout().getTilesAt(this.room.getLayout().getTile(oldX, oldY), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation()); - tiles.addAll(this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())); + tiles.addAll(this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getCurrentPosition().getX(), this.item.getCurrentPosition().getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())); this.room.updateTiles(tiles); //this.room.sendComposer(new UpdateStackHeightComposer(oldX, oldY, this.room.getStackHeight(oldX, oldY, true)).compose()); // diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemDataUpdateMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemDataUpdateMessageComposer.java index 54962305..674093b7 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemDataUpdateMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemDataUpdateMessageComposer.java @@ -13,13 +13,13 @@ public class ItemDataUpdateMessageComposer extends MessageComposer { @Override protected ServerMessage composeInternal() { - if (this.postIt.getExtradata().isEmpty() || this.postIt.getExtradata().length() < 6) { - this.postIt.setExtradata("FFFF33"); + if (this.postIt.getExtraData().isEmpty() || this.postIt.getExtraData().length() < 6) { + this.postIt.setExtraData("FFFF33"); } this.response.init(Outgoing.itemDataUpdateMessageComposer); this.response.appendString(this.postIt.getId() + ""); - this.response.appendString(this.postIt.getExtradata()); + this.response.appendString(this.postIt.getExtraData()); return this.response; } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemRemoveMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemRemoveMessageComposer.java index 128e1ffe..dadb1f62 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemRemoveMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemRemoveMessageComposer.java @@ -14,7 +14,7 @@ public class ItemRemoveMessageComposer extends MessageComposer { protected ServerMessage composeInternal() { this.response.init(Outgoing.itemRemoveMessageComposer); this.response.appendString(this.item.getId() + ""); - this.response.appendInt(this.item.getOwnerId()); + this.response.appendInt(this.item.getOwnerInfo().getId()); return this.response; } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemUpdateMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemUpdateMessageComposer.java index 2a45013a..daedf355 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemUpdateMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ItemUpdateMessageComposer.java @@ -15,7 +15,7 @@ public class ItemUpdateMessageComposer extends MessageComposer { protected ServerMessage composeInternal() { this.response.init(Outgoing.itemUpdateMessageComposer); this.item.serializeWallData(this.response); - this.response.appendString(this.item.getOwnerId() + ""); + this.response.appendString(String.valueOf(this.item.getOwnerInfo().getId())); return this.response; } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectAddMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectAddMessageComposer.java index 527e88f1..246cd2cf 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectAddMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectAddMessageComposer.java @@ -21,7 +21,7 @@ public class ObjectAddMessageComposer extends MessageComposer { this.item.serializeExtradata(this.response); this.response.appendInt(-1); this.response.appendInt(this.item instanceof InteractionTeleport || this.item instanceof InteractionSwitch || this.item instanceof InteractionSwitchRemoteControl || this.item instanceof InteractionVendingMachine || this.item instanceof InteractionInformationTerminal || this.item instanceof InteractionPostIt || this.item instanceof InteractionSpinningBottle || this.item instanceof InteractionPuzzleBox ? 2 : this.item.isUsable() ? 1 : 0); - this.response.appendInt(this.item.getOwnerId()); + this.response.appendInt(this.item.getOwnerInfo().getId()); this.response.appendString(this.itemOwnerName); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectUpdateMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectUpdateMessageComposer.java index 54c35d29..419717bb 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectUpdateMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectUpdateMessageComposer.java @@ -21,7 +21,7 @@ public class ObjectUpdateMessageComposer extends MessageComposer { this.item.serializeExtradata(this.response); this.response.appendInt(-1); this.response.appendInt(0); - this.response.appendInt(this.item.getOwnerId()); + this.response.appendInt(this.item.getOwnerInfo().getId()); return this.response; } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectsMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectsMessageComposer.java index f8cd51b1..901e289c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectsMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/ObjectsMessageComposer.java @@ -43,7 +43,7 @@ public class ObjectsMessageComposer extends MessageComposer { item.serializeExtradata(this.response); this.response.appendInt(-1); this.response.appendInt(item instanceof InteractionTeleport || item instanceof InteractionSwitch || item instanceof InteractionSwitchRemoteControl || item instanceof InteractionVendingMachine || item instanceof InteractionInformationTerminal || item instanceof InteractionPostIt || item instanceof InteractionSpinningBottle || item instanceof InteractionPuzzleBox ? 2 : item.isUsable() ? 1 : 0); - this.response.appendInt(item.getOwnerId()); + this.response.appendInt(item.getOwnerInfo().getId()); } return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/OneWayDoorStatusMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/OneWayDoorStatusMessageComposer.java index 9ee6f7af..8f02ff06 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/OneWayDoorStatusMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/OneWayDoorStatusMessageComposer.java @@ -15,7 +15,7 @@ public class OneWayDoorStatusMessageComposer extends MessageComposer { this.response.init(Outgoing.oneWayDoorStatusMessageComposer); this.response.appendInt(this.item.getId()); try { - int state = Integer.parseInt(this.item.getExtradata()); + int state = Integer.parseInt(this.item.getExtraData()); this.response.appendInt(state); } catch (Exception e) { this.response.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java index b5674944..c9e90cdc 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/RemoveFloorItemComposer.java @@ -23,7 +23,7 @@ public class RemoveFloorItemComposer extends MessageComposer { this.response.appendString(this.item.getId() + ""); this.response.appendBoolean(false); - this.response.appendInt(this.noUser ? 0 : this.item.getOwnerId()); + this.response.appendInt(this.noUser ? 0 : this.item.getOwnerInfo().getId()); this.response.appendInt(0); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/SleepMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/SleepMessageComposer.java index 9f09e379..ef7e00d6 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/SleepMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/SleepMessageComposer.java @@ -10,7 +10,6 @@ import lombok.AllArgsConstructor; public class SleepMessageComposer extends MessageComposer { private final RoomHabbo roomHabbo; - @Override protected ServerMessage composeInternal() { this.response.init(Outgoing.sleepMessageComposer); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserUpdateComposer.java index 6df02fa0..39239c4c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/UserUpdateComposer.java @@ -41,8 +41,8 @@ public class UserUpdateComposer extends MessageComposer { this.response.appendInt(this.roomUnits.size()); for (RoomUnit roomUnit : this.roomUnits) { this.response.appendInt(roomUnit.getVirtualId()); - this.response.appendInt(roomUnit.getPreviousLocation().getX()); - this.response.appendInt(roomUnit.getPreviousLocation().getY()); + this.response.appendInt(roomUnit.getPreviousPosition().getX()); + this.response.appendInt(roomUnit.getPreviousPosition().getY()); this.response.appendString((this.overrideZ != -1 ? this.overrideZ : roomUnit.getPreviousLocationZ()) + ""); @@ -62,8 +62,8 @@ public class UserUpdateComposer extends MessageComposer { this.response.appendInt(this.habbos.size()); for (Habbo habbo : this.habbos) { this.response.appendInt(habbo.getRoomUnit().getVirtualId()); - this.response.appendInt(habbo.getRoomUnit().getPreviousLocation().getX()); - this.response.appendInt(habbo.getRoomUnit().getPreviousLocation().getY()); + this.response.appendInt(habbo.getRoomUnit().getPreviousPosition().getX()); + this.response.appendInt(habbo.getRoomUnit().getPreviousPosition().getY()); this.response.appendString(habbo.getRoomUnit().getPreviousLocationZ() + ""); diff --git a/src/main/java/com/eu/habbo/messages/rcon/ChangeRoomOwner.java b/src/main/java/com/eu/habbo/messages/rcon/ChangeRoomOwner.java index b5348e2f..d5bf751e 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/ChangeRoomOwner.java +++ b/src/main/java/com/eu/habbo/messages/rcon/ChangeRoomOwner.java @@ -27,7 +27,7 @@ public class ChangeRoomOwner extends RCONMessage { room.getRoomInfo().setOwnerInfo(newOwner.getHabboInfo()); room.setNeedsUpdate(true); room.save(); - Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); + room.dispose(); } static class JSON { diff --git a/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java b/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java index aac25f42..e8b0dece 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java +++ b/src/main/java/com/eu/habbo/messages/rcon/FriendRequest.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.messenger.Messenger; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.eu.habbo.messages.outgoing.friends.NewFriendRequestComposer; import com.google.gson.Gson; @@ -25,7 +24,7 @@ public class FriendRequest extends RCONMessage { if (from != null) { target.getClient().sendResponse(new NewFriendRequestComposer(from.getHabboInfo())); } else { - final HabboInfo info = HabboManager.getOfflineHabboInfo(json.user_id); + final HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(json.user_id); if (info != null) { target.getClient().sendResponse(new NewFriendRequestComposer(info)); diff --git a/src/main/java/com/eu/habbo/messages/rcon/SendRoomBundle.java b/src/main/java/com/eu/habbo/messages/rcon/SendRoomBundle.java index 25b276ac..074133db 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/SendRoomBundle.java +++ b/src/main/java/com/eu/habbo/messages/rcon/SendRoomBundle.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.layouts.RoomBundleLayout; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboInfo; -import com.eu.habbo.habbohotel.users.HabboManager; import com.google.gson.Gson; public class SendRoomBundle extends RCONMessage { @@ -23,7 +22,7 @@ public class SendRoomBundle extends RCONMessage { if (habbo != null) { ((RoomBundleLayout) page).buyRoom(habbo); } else { - HabboInfo info = HabboManager.getOfflineHabboInfo(json.user_id); + HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(json.user_id); if (info != null) { ((RoomBundleLayout) page).buyRoom(null, json.user_id, info.getUsername()); diff --git a/src/main/java/com/eu/habbo/threading/runnables/BackgroundAnimation.java b/src/main/java/com/eu/habbo/threading/runnables/BackgroundAnimation.java index 7ac9c258..200044e7 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/BackgroundAnimation.java +++ b/src/main/java/com/eu/habbo/threading/runnables/BackgroundAnimation.java @@ -16,7 +16,7 @@ public class BackgroundAnimation implements Runnable { @Override public void run() { if (this.room.isLoaded() && !this.room.isPreLoaded()) { - this.toner.setExtradata("1:" + this.state + ":126:126"); + this.toner.setExtraData("1:" + this.state + ":126:126"); this.state = (this.state + 1) % 256; this.room.updateItem(this.toner); diff --git a/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java b/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java index 6e66017c..8527cdb1 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java +++ b/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java @@ -21,7 +21,7 @@ public class BanzaiRandomTeleport implements Runnable { public void run() { RoomItem topItemNow = this.room.getRoomItemManager().getTopItemAt(this.habbo.getCurrentPosition().getX(), this.habbo.getCurrentPosition().getY()); RoomTile lastLocation = this.habbo.getCurrentPosition(); - RoomTile newLocation = this.room.getLayout().getTile(toItem.getX(), toItem.getY()); + RoomTile newLocation = this.room.getLayout().getTile(toItem.getCurrentPosition().getX(), toItem.getCurrentPosition().getY()); if(topItemNow != null) { try { @@ -32,14 +32,14 @@ public class BanzaiRandomTeleport implements Runnable { } Emulator.getThreading().run(() -> { - if (this.item.getExtradata().equals("1")) { - this.item.setExtradata("0"); + if (this.item.getExtraData().equals("1")) { + this.item.setExtraData("0"); this.room.updateItemState(this.item); } }, 500); - if(!this.toItem.getExtradata().equals("1")) { - this.toItem.setExtradata("1"); + if(!this.toItem.getExtraData().equals("1")) { + this.toItem.setExtraData("1"); this.room.updateItemState(this.toItem); } @@ -55,8 +55,8 @@ public class BanzaiRandomTeleport implements Runnable { } } - if (this.toItem.getExtradata().equals("1")) { - this.toItem.setExtradata("0"); + if (this.toItem.getExtraData().equals("1")) { + this.toItem.setExtraData("0"); this.room.updateItemState(this.toItem); } }, 750); diff --git a/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java b/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java index 0e4670f3..a1ebe1a2 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java +++ b/src/main/java/com/eu/habbo/threading/runnables/BattleBanzaiTilesFlicker.java @@ -33,14 +33,14 @@ public class BattleBanzaiTilesFlicker implements Runnable { } for (RoomItem item : this.items) { - item.setExtradata(state + ""); + item.setExtraData(state + ""); } this.room.sendComposer(new ItemsDataUpdateComposer(this.items).compose()); if (this.count == 9) { for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { - item.setExtradata("0"); + item.setExtraData("0"); this.room.updateItemState(item); } return; diff --git a/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java b/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java index cb2b4365..878246d7 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/CannonKickAction.java @@ -32,7 +32,7 @@ public class CannonKickAction implements Runnable { dater.put("message", "${notification.room.kick.cannonball.message}"); int rotation = this.cannon.getRotation(); - List tiles = this.room.getLayout().getTilesInFront(this.room.getLayout().getTile(this.cannon.getX(), this.cannon.getY()), rotation + 6, 3); + List tiles = this.room.getLayout().getTilesInFront(this.room.getLayout().getTile(this.cannon.getCurrentPosition().getX(), this.cannon.getCurrentPosition().getY()), rotation + 6, 3); ServerMessage message = new NotificationDialogMessageComposer("cannon.png", dater).compose(); diff --git a/src/main/java/com/eu/habbo/threading/runnables/ClearRentedSpace.java b/src/main/java/com/eu/habbo/threading/runnables/ClearRentedSpace.java index a79a48da..068122d9 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/ClearRentedSpace.java +++ b/src/main/java/com/eu/habbo/threading/runnables/ClearRentedSpace.java @@ -20,9 +20,9 @@ public class ClearRentedSpace implements Runnable { public void run() { HashSet items = new HashSet<>(); - for (RoomTile t : this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())) { + for (RoomTile t : this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getCurrentPosition().getX(), this.item.getCurrentPosition().getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())) { for (RoomItem i : this.room.getRoomItemManager().getItemsAt(t)) { - if (i.getOwnerId() == this.item.getRenterId()) { + if (i.getOwnerInfo().getId() == this.item.getRenterId()) { items.add(i); i.setRoomId(0); i.needsUpdate(true); diff --git a/src/main/java/com/eu/habbo/threading/runnables/CloseGate.java b/src/main/java/com/eu/habbo/threading/runnables/CloseGate.java index 22033b4a..775d0536 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/CloseGate.java +++ b/src/main/java/com/eu/habbo/threading/runnables/CloseGate.java @@ -14,14 +14,14 @@ public class CloseGate implements Runnable { public void run() { if (this.gate.getRoomId() == this.room.getRoomInfo().getId()) { if (this.room.isLoaded()) { - RoomTile tile = this.room.getLayout().getTile(this.gate.getX(), this.gate.getY()); + RoomTile tile = this.room.getLayout().getTile(this.gate.getCurrentPosition().getX(), this.gate.getCurrentPosition().getY()); if(tile == null) { return; } if (!this.room.getRoomUnitManager().hasHabbosAt(tile)) { - this.gate.setExtradata("0"); + this.gate.setExtraData("0"); this.room.updateItem(this.gate); this.gate.needsUpdate(true); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java b/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java index 237d4eea..614df84a 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java +++ b/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionCrackable; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer; @@ -19,8 +20,7 @@ public class CrackableExplode implements Runnable { private final InteractionCrackable habboItem; private final Habbo habbo; private final boolean toInventory; - private final short x; - private final short y; + private final RoomTile tile; @Override public void run() { @@ -40,7 +40,7 @@ public class CrackableExplode implements Runnable { Item rewardItem = Emulator.getGameEnvironment().getItemManager().getCrackableReward(this.habboItem.getBaseItem().getId()); if (rewardItem != null) { - RoomItem newItem = Emulator.getGameEnvironment().getItemManager().createItem(this.habboItem.allowAnyone() ? this.habbo.getHabboInfo().getId() : this.habboItem.getOwnerId(), rewardItem, 0, 0, ""); + RoomItem newItem = Emulator.getGameEnvironment().getItemManager().createItem(this.habboItem.allowAnyone() ? this.habbo.getHabboInfo().getId() : this.habboItem.getOwnerInfo().getId(), rewardItem, 0, 0, ""); if (newItem != null) { //Add to inventory in case if isn't possible place the item or in case is wall item @@ -49,18 +49,18 @@ public class CrackableExplode implements Runnable { this.habbo.getClient().sendResponse(new UnseenItemsComposer(newItem)); this.habbo.getClient().sendResponse(new FurniListInvalidateComposer()); } else { - newItem.setX(this.x); - newItem.setY(this.y); - newItem.setZ(this.room.getStackHeight(this.x, this.y, false)); + newItem.setCurrentPosition(this.tile); + newItem.setCurrentZ(this.room.getStackHeight(this.tile.getX(), this.tile.getY(), false)); + newItem.setRoomId(this.room.getRoomInfo().getId()); newItem.needsUpdate(true); this.room.getRoomItemManager().addRoomItem(newItem); this.room.updateItem(newItem); - this.room.sendComposer(new ObjectAddMessageComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getOwnerId())).compose()); + this.room.sendComposer(new ObjectAddMessageComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getOwnerInfo().getId())).compose()); } } } - this.room.updateTile(this.room.getLayout().getTile(this.x, this.y)); + this.room.updateTile(this.tile); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/HabboItemNewState.java b/src/main/java/com/eu/habbo/threading/runnables/HabboItemNewState.java index a2e8ed07..639d9248 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/HabboItemNewState.java +++ b/src/main/java/com/eu/habbo/threading/runnables/HabboItemNewState.java @@ -12,7 +12,7 @@ public class HabboItemNewState implements Runnable { @Override public void run() { - this.item.setExtradata(this.state); + this.item.setExtraData(this.state); if (this.item.getRoomId() == this.room.getRoomInfo().getId()) { this.room.updateItemState(this.item); diff --git a/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java b/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java index 7afad767..eb8c6e11 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/KickBallAction.java @@ -4,8 +4,8 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.items.interactions.InteractionPushable; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; -import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; +import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; @@ -36,10 +36,10 @@ public class KickBallAction implements Runnable { return; if (this.currentStep < this.totalSteps) { - RoomTile currentTile = this.room.getLayout().getTile(this.ball.getX(), this.ball.getY()); + RoomTile currentTile = this.room.getLayout().getTile(this.ball.getCurrentPosition().getX(), this.ball.getCurrentPosition().getY()); RoomTile next = this.room.getLayout().getTileInFront(currentTile, this.currentDirection.getValue()); - if (next == null || !this.ball.validMove(this.room, this.room.getLayout().getTile(this.ball.getX(), this.ball.getY()), next)) { + if (next == null || !this.ball.validMove(this.room, this.room.getLayout().getTile(this.ball.getCurrentPosition().getX(), this.ball.getCurrentPosition().getY()), next)) { RoomRotation oldDirection = this.currentDirection; if(!this.isDrag) { @@ -58,10 +58,10 @@ public class KickBallAction implements Runnable { int delay = this.ball.getNextRollDelay(this.currentStep, this.totalSteps); //Algorithm to work out the delay till next run - if (this.ball.canStillMove(this.room, this.room.getLayout().getTile(this.ball.getX(), this.ball.getY()), next, this.currentDirection, this.kicker, delay, this.currentStep, this.totalSteps)) { - this.ball.onMove(this.room, this.room.getLayout().getTile(this.ball.getX(), this.ball.getY()), next, this.currentDirection, this.kicker, delay, this.currentStep, this.totalSteps); + if (this.ball.canStillMove(this.room, this.room.getLayout().getTile(this.ball.getCurrentPosition().getX(), this.ball.getCurrentPosition().getY()), next, this.currentDirection, this.kicker, delay, this.currentStep, this.totalSteps)) { + this.ball.onMove(this.room, this.room.getLayout().getTile(this.ball.getCurrentPosition().getX(), this.ball.getCurrentPosition().getY()), next, this.currentDirection, this.kicker, delay, this.currentStep, this.totalSteps); - this.room.sendComposer(new FloorItemOnRollerComposer(this.ball, null, next, next.getStackHeight() - this.ball.getZ(), this.room).compose()); + this.room.sendComposer(new FloorItemOnRollerComposer(this.ball, null, next, next.getStackHeight() - this.ball.getCurrentZ(), this.room).compose()); Emulator.getThreading().run(this, delay); } else { diff --git a/src/main/java/com/eu/habbo/threading/runnables/OneWayGateActionOne.java b/src/main/java/com/eu/habbo/threading/runnables/OneWayGateActionOne.java index 59e0251c..0f074672 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/OneWayGateActionOne.java +++ b/src/main/java/com/eu/habbo/threading/runnables/OneWayGateActionOne.java @@ -19,17 +19,17 @@ public class OneWayGateActionOne implements Runnable { public void run() { this.room.sendComposer(new UserUpdateComposer(this.client.getHabbo().getRoomUnit()).compose()); - RoomTile t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(this.oneWayGate.getX(), this.oneWayGate.getY()), (this.oneWayGate.getRotation() + 4) % 8); + RoomTile t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(this.oneWayGate.getCurrentPosition().getX(), this.oneWayGate.getCurrentPosition().getY()), (this.oneWayGate.getRotation() + 4) % 8); if (this.client.getHabbo().getRoomUnit().isAnimateWalk()) { this.client.getHabbo().getRoomUnit().setAnimateWalk(false); } if (t.isWalkable()) { - if (this.room.getLayout().tileWalkable(t) && this.client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.oneWayGate.getX() && this.client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.oneWayGate.getY()) { + if (this.room.getLayout().tileWalkable(t) && this.client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.oneWayGate.getCurrentPosition().getX() && this.client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.oneWayGate.getCurrentPosition().getY()) { this.client.getHabbo().getRoomUnit().setGoalLocation(t); - if (!this.oneWayGate.getExtradata().equals("0")) { + if (!this.oneWayGate.getExtraData().equals("0")) { Emulator.getThreading().run(new HabboItemNewState(this.oneWayGate, this.room, "0"), 1000); } } @@ -38,7 +38,7 @@ public class OneWayGateActionOne implements Runnable { //} else { - if (!this.oneWayGate.getExtradata().equals("0")) { + if (!this.oneWayGate.getExtraData().equals("0")) { Emulator.getThreading().run(new HabboItemNewState(this.oneWayGate, this.room, "0"), 1000); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java b/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java index 710c954f..702f3e0a 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java +++ b/src/main/java/com/eu/habbo/threading/runnables/OpenGift.java @@ -33,7 +33,7 @@ public class OpenGift implements Runnable { if (inside == null) inside = i; - i.setOwnerId(this.habbo.getHabboInfo().getId()); + i.setOwnerInfo(this.habbo.getHabboInfo()); i.needsUpdate(true); i.run(); } @@ -42,7 +42,7 @@ public class OpenGift implements Runnable { this.habbo.getInventory().getItemsComponent().addItems(items); - RoomTile tile = this.room.getLayout().getTile(this.item.getX(), this.item.getY()); + RoomTile tile = this.room.getLayout().getTile(this.item.getCurrentPosition().getX(), this.item.getCurrentPosition().getY()); if (tile != null) { this.room.updateTile(tile); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/PetEatAction.java b/src/main/java/com/eu/habbo/threading/runnables/PetEatAction.java index 85e8fe8d..d068b126 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/PetEatAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/PetEatAction.java @@ -20,12 +20,12 @@ public class PetEatAction implements Runnable { @Override public void run() { if (this.pet.getRoomUnit() != null && this.pet.getRoom() != null) { - if (this.pet.levelHunger >= 20 && this.food != null && Integer.parseInt(this.food.getExtradata()) < this.food.getBaseItem().getStateCount()) { + if (this.pet.levelHunger >= 20 && this.food != null && Integer.parseInt(this.food.getExtraData()) < this.food.getBaseItem().getStateCount()) { this.pet.addHunger(-20); this.pet.setTask(PetTasks.EAT); this.pet.getRoomUnit().setCanWalk(false); - this.food.setExtradata(Integer.parseInt(this.food.getExtradata()) + 1 + ""); + this.food.setExtraData(Integer.parseInt(this.food.getExtraData()) + 1 + ""); this.pet.getRoom().updateItem(this.food); if (this.pet instanceof GnomePet) { @@ -40,7 +40,7 @@ public class PetEatAction implements Runnable { Emulator.getThreading().run(this, 1000); } else { - if (this.food != null && Integer.parseInt(this.food.getExtradata()) == this.food.getBaseItem().getStateCount()) { + if (this.food != null && Integer.parseInt(this.food.getExtraData()) == this.food.getBaseItem().getStateCount()) { Emulator.getThreading().run(new QueryDeleteHabboItem(this.food.getId()), 500); if (this.pet.getRoom() != null) { this.pet.getRoom().getRoomItemManager().removeRoomItem(this.food); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RandomDiceNumber.java b/src/main/java/com/eu/habbo/threading/runnables/RandomDiceNumber.java index 0aa18560..2e41d251 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RandomDiceNumber.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RandomDiceNumber.java @@ -30,7 +30,7 @@ public class RandomDiceNumber implements Runnable { if (this.result <= 0) this.result = (Emulator.getRandom().nextInt(this.maxNumber) + 1); - this.item.setExtradata(this.result + ""); + this.item.setExtraData(this.result + ""); this.item.needsUpdate(true); Emulator.getThreading().run(this.item); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RandomSpinningBottleNumber.java b/src/main/java/com/eu/habbo/threading/runnables/RandomSpinningBottleNumber.java index b699cda0..1a76da07 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RandomSpinningBottleNumber.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RandomSpinningBottleNumber.java @@ -29,7 +29,7 @@ public class RandomSpinningBottleNumber implements Runnable { if (this.result <= 0) this.result = Emulator.getRandom().nextInt(this.maxNumber); - this.item.setExtradata(this.result + ""); + this.item.setExtraData(this.result + ""); this.item.needsUpdate(true); Emulator.getThreading().run(this.item); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java b/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java index d7eb4e2b..26f68060 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java @@ -18,10 +18,10 @@ class RemoveFloorItemTask implements Runnable { if (this.item == null || this.room == null) return; - RoomTile tile = this.room.getLayout().getTile(this.item.getX(), this.item.getY()); + RoomTile tile = this.room.getLayout().getTile(this.item.getCurrentPosition().getX(), this.item.getCurrentPosition().getY()); this.room.getRoomItemManager().removeRoomItem(this.item); this.room.updateTile(tile); this.room.sendComposer(new RemoveFloorItemComposer(this.item, true).compose()); - this.room.sendComposer(new HeightMapUpdateMessageComposer(this.item.getX(), this.item.getY(), tile.getZ(), tile.relativeHeight()).compose()); + this.room.sendComposer(new HeightMapUpdateMessageComposer(this.item.getCurrentPosition().getX(), this.item.getCurrentPosition().getY(), tile.getZ(), tile.relativeHeight()).compose()); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitRidePet.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitRidePet.java index 79743b4b..0d7d2e59 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitRidePet.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitRidePet.java @@ -18,7 +18,7 @@ public class RoomUnitRidePet implements Runnable { @Override public void run() { - if (this.habbo.getRoomUnit() == null || this.pet.getRoomUnit() == null || this.pet.getRoom() != this.habbo.getRoomUnit().getRoom() || this.goalTile == null || this.habbo.getRoomUnit().getGoalLocation() != this.goalTile) + if (this.habbo.getRoomUnit() == null || this.pet.getRoomUnit() == null || this.pet.getRoom() != this.habbo.getRoomUnit().getRoom() || this.goalTile == null || this.habbo.getRoomUnit().getTargetPosition() != this.goalTile) return; if (habbo.getRoomUnit().getCurrentPosition().distance(pet.getRoomUnit().getCurrentPosition()) <= 1) { diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java index 2422f360..208f773e 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleportWalkToAction.java @@ -24,7 +24,7 @@ public class RoomUnitTeleportWalkToAction implements Runnable { } RoomTile tile = RoomItem.getSquareInFront(this.room.getLayout(), this.roomItem); - if (!this.habbo.getRoomUnit().getGoalLocation().equals(tile)) { + if (!this.habbo.getRoomUnit().getTargetPosition().equals(tile)) { return; } diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java index 7a333ae9..999b0b1d 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java @@ -27,7 +27,7 @@ public class RoomUnitVendingMachineAction implements Runnable { return; } - if (this.habbo.getRoomUnit().getGoalLocation().equals(tile)) { + if (this.habbo.getRoomUnit().getTargetPosition().equals(tile)) { if (this.habbo.getRoomUnit().getCurrentPosition().equals(tile)) { try { this.roomItem.onClick(this.habbo.getClient(), this.room, new Object[]{0}); diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToLocation.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToLocation.java index ed9f3467..61256ee0 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToLocation.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToLocation.java @@ -43,7 +43,7 @@ public class RoomUnitWalkToLocation implements Runnable { return; } - if (!this.walker.getGoalLocation().equals(this.goalTile) || (this.walker.getPath().isEmpty() && !this.walker.hasStatus(RoomUnitStatus.MOVE))) { + if (!this.walker.getTargetPosition().equals(this.goalTile) || (this.walker.getPath().isEmpty() && !this.walker.hasStatus(RoomUnitStatus.MOVE))) { onFail(); return; } diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToRoomUnit.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToRoomUnit.java index 193e6d1b..118f2a98 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToRoomUnit.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitWalkToRoomUnit.java @@ -38,7 +38,7 @@ public class RoomUnitWalkToRoomUnit implements Runnable { return; } - if (this.walker.getGoalLocation().equals(this.goalTile)) { // check that the action hasn't been cancelled by changing the goal + if (this.walker.getTargetPosition().equals(this.goalTile)) { // check that the action hasn't been cancelled by changing the goal if (this.walker.getCurrentPosition().distance(this.goalTile) <= this.minDistance) { for (Runnable r : this.targetReached) { Emulator.getThreading().run(r); diff --git a/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java b/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java index 2752003b..dbb92645 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/TeleportInteraction.java @@ -37,7 +37,7 @@ class TeleportInteraction extends Thread { public void run() { try { if (this.state == 5) { - this.teleportTwo.setExtradata("1"); + this.teleportTwo.setExtraData("1"); this.targetRoom.updateItem(this.teleportTwo); this.room.updateItem(this.teleportOne); RoomTile tile = RoomItem.getSquareInFront(this.room.getLayout(), this.teleportTwo); @@ -65,8 +65,8 @@ class TeleportInteraction extends Thread { this.teleportTwo = this.teleportOne; } - this.teleportOne.setExtradata("2"); - this.teleportTwo.setExtradata("2"); + this.teleportOne.setExtraData("2"); + this.teleportTwo.setExtraData("2"); if (this.room != this.targetRoom) { Emulator.getGameEnvironment().getRoomManager().logExit(this.client.getHabbo()); @@ -75,8 +75,8 @@ class TeleportInteraction extends Thread { } this.client.getHabbo().getRoomUnit().setRotation(RoomRotation.values()[this.teleportTwo.getRotation()]); - this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.teleportTwo.getX(), this.teleportTwo.getY())); - this.client.getHabbo().getRoomUnit().setCurrentZ(this.teleportTwo.getZ()); + this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.teleportTwo.getCurrentPosition().getX(), this.teleportTwo.getCurrentPosition().getY())); + this.client.getHabbo().getRoomUnit().setCurrentZ(this.teleportTwo.getCurrentZ()); this.room.sendComposer(new UserRemoveMessageComposer(this.client.getHabbo().getRoomUnit()).compose()); this.targetRoom.sendComposer(new UserRemoveMessageComposer(this.client.getHabbo().getRoomUnit()).compose()); @@ -90,14 +90,14 @@ class TeleportInteraction extends Thread { Emulator.getThreading().run(this, 500); } else if (this.state == 3) { - this.teleportOne.setExtradata("0"); + this.teleportOne.setExtraData("0"); this.room.updateItem(this.teleportOne); this.state = 4; Emulator.getThreading().run(this, 500); } else if (this.state == 2) { - this.client.getHabbo().getRoomUnit().setGoalLocation(this.room.getLayout().getTile(this.teleportOne.getX(), this.teleportOne.getY())); + this.client.getHabbo().getRoomUnit().setGoalLocation(this.room.getLayout().getTile(this.teleportOne.getCurrentPosition().getX(), this.teleportOne.getCurrentPosition().getY())); this.client.getHabbo().getRoomUnit().setRotation(RoomRotation.values()[this.newRotation(this.teleportOne.getRotation())]); - this.client.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.MOVE, this.teleportOne.getX() + "," + this.teleportOne.getY() + "," + this.teleportOne.getZ()); + this.client.getHabbo().getRoomUnit().addStatus(RoomUnitStatus.MOVE, this.teleportOne.getCurrentPosition().getX() + "," + this.teleportOne.getCurrentPosition().getY() + "," + this.teleportOne.getCurrentZ()); //room.sendComposer(new RoomUserStatusComposer(this.client.getHabbo().getRoomUnit())); this.state = 3; @@ -108,7 +108,7 @@ class TeleportInteraction extends Thread { if (this.client.getHabbo().getRoomUnit().getCurrentPosition().getX() == loc.getX()) { if (this.client.getHabbo().getRoomUnit().getCurrentPosition().getY() == loc.getY()) { - this.teleportOne.setExtradata("1"); + this.teleportOne.setExtraData("1"); this.room.updateItem(this.teleportOne); this.state = 2; diff --git a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java index 2e19b25e..1c607a74 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java +++ b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeHandleSnowballExplosion.java @@ -41,11 +41,11 @@ class FreezeHandleSnowballExplosion implements Runnable { return; if (player.nextHorizontal) { - tiles.addAll(game.affectedTilesByExplosion(this.thrownData.targetTile.getX(), this.thrownData.targetTile.getY(), this.thrownData.radius + 1)); + tiles.addAll(game.affectedTilesByExplosion(this.thrownData.targetTile.getCurrentPosition().getX(), this.thrownData.targetTile.getCurrentPosition().getY(), this.thrownData.radius + 1)); } if (player.nextDiagonal) { - tiles.addAll(game.affectedTilesByExplosionDiagonal(this.thrownData.targetTile.getX(), this.thrownData.targetTile.getY(), this.thrownData.radius + 1)); + tiles.addAll(game.affectedTilesByExplosionDiagonal(this.thrownData.targetTile.getCurrentPosition().getX(), this.thrownData.targetTile.getCurrentPosition().getY(), this.thrownData.radius + 1)); player.nextDiagonal = false; } @@ -57,20 +57,20 @@ class FreezeHandleSnowballExplosion implements Runnable { for (RoomItem freezeTile : items) { if (freezeTile instanceof InteractionFreezeTile || freezeTile instanceof InteractionFreezeBlock) { int distance = 0; - if (freezeTile.getX() != this.thrownData.targetTile.getX() && freezeTile.getY() != this.thrownData.targetTile.getY()) { - distance = Math.abs(freezeTile.getX() - this.thrownData.targetTile.getX()); + if (freezeTile.getCurrentPosition().getX() != this.thrownData.targetTile.getCurrentPosition().getX() && freezeTile.getCurrentPosition().getY() != this.thrownData.targetTile.getCurrentPosition().getY()) { + distance = Math.abs(freezeTile.getCurrentPosition().getX() - this.thrownData.targetTile.getCurrentPosition().getX()); } else { - distance = (int) Math.ceil(this.thrownData.room.getLayout().getTile(this.thrownData.targetTile.getX(), this.thrownData.targetTile.getY()).distance(roomTile)); + distance = (int) Math.ceil(this.thrownData.room.getLayout().getTile(this.thrownData.targetTile.getCurrentPosition().getX(), this.thrownData.targetTile.getCurrentPosition().getY()).distance(roomTile)); } if (freezeTile instanceof InteractionFreezeTile) { - freezeTile.setExtradata("11" + String.format("%03d", distance * 100)); //TODO Investigate this further. Probably height dependent or something. + freezeTile.setExtraData("11" + String.format("%03d", distance * 100)); //TODO Investigate this further. Probably height dependent or something. freezeTiles.add((InteractionFreezeTile) freezeTile); this.thrownData.room.updateItem(freezeTile); THashSet habbos = new THashSet<>(); - RoomTile tile = this.thrownData.room.getLayout().getTile(freezeTile.getX(), freezeTile.getY()); + RoomTile tile = this.thrownData.room.getLayout().getTile(freezeTile.getCurrentPosition().getX(), freezeTile.getCurrentPosition().getY()); habbos.addAll(this.thrownData.room.getRoomUnitManager().getHabbosAt(tile)); for (Habbo habbo : habbos) { @@ -91,7 +91,7 @@ class FreezeHandleSnowballExplosion implements Runnable { } } } else { - if (freezeTile.getExtradata().equalsIgnoreCase("0")) { + if (freezeTile.getExtraData().equalsIgnoreCase("0")) { game.explodeBox((InteractionFreezeBlock) freezeTile, distance * 100); player.addScore(FreezeGame.DESTROY_BLOCK_POINTS); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeResetExplosionTiles.java b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeResetExplosionTiles.java index 329543d1..da8426d9 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeResetExplosionTiles.java +++ b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeResetExplosionTiles.java @@ -15,7 +15,7 @@ class FreezeResetExplosionTiles implements Runnable { @Override public void run() { for (RoomItem item : this.tiles) { - item.setExtradata("0"); + item.setExtraData("0"); this.room.updateItem(item); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeThrowSnowball.java b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeThrowSnowball.java index 2c86bff4..0ed63f60 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeThrowSnowball.java +++ b/src/main/java/com/eu/habbo/threading/runnables/freeze/FreezeThrowSnowball.java @@ -24,7 +24,7 @@ public class FreezeThrowSnowball implements Runnable { @Override public void run() { ((FreezeGamePlayer) this.habbo.getHabboInfo().getGamePlayer()).takeSnowball(); - this.targetTile.setExtradata((this.radius + 1) * 1000 + ""); + this.targetTile.setExtraData((this.radius + 1) * 1000 + ""); this.room.updateItem(this.targetTile); Emulator.getThreading().run(new FreezeHandleSnowballExplosion(this), 2000); Emulator.getThreading().run(new HabboItemNewState(this.targetTile, this.room, "11000"), 2000); diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFive.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFive.java index 8f1602fe..408e82a9 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFive.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFive.java @@ -17,7 +17,7 @@ class HopperActionFive implements Runnable { @Override public void run() { this.client.getHabbo().getRoomUnit().setTeleporting(false); - RoomTile tile = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY()), this.currentTeleport.getRotation()); + RoomTile tile = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(this.currentTeleport.getCurrentPosition().getX(), this.currentTeleport.getCurrentPosition().getY()), this.currentTeleport.getRotation()); if (tile != null) { this.client.getHabbo().getRoomUnit().setGoalLocation(tile); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFour.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFour.java index 9c9c7823..a7b0f75b 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFour.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionFour.java @@ -14,7 +14,7 @@ class HopperActionFour implements Runnable { @Override public void run() { - this.currentTeleport.setExtradata("1"); + this.currentTeleport.setExtraData("1"); this.room.updateItem(this.currentTeleport); Emulator.getThreading().run(new HopperActionFive(this.currentTeleport, this.room, this.client), 500); diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java index ec1c8c4e..1b97cbd9 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java @@ -19,11 +19,11 @@ public class HopperActionOne implements Runnable { public void run() { //this.client.getHabbo().getRoomUnit().setGoalLocation(this.teleportOne.getX(), this.teleportOne.getY()); this.client.getHabbo().getRoomUnit().setRotation(RoomRotation.values()[(this.teleportOne.getRotation() + 4) % 8]); - this.client.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.MOVE, this.teleportOne.getX() + "," + this.teleportOne.getY() + "," + this.teleportOne.getZ()); + this.client.getHabbo().getRoomUnit().addStatus(RoomUnitStatus.MOVE, this.teleportOne.getCurrentPosition().getX() + "," + this.teleportOne.getCurrentPosition().getY() + "," + this.teleportOne.getCurrentZ()); this.room.scheduledComposers.add(new UserUpdateComposer(this.client.getHabbo().getRoomUnit()).compose()); - this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.teleportOne.getX(), this.teleportOne.getY())); - this.client.getHabbo().getRoomUnit().setCurrentZ(this.teleportOne.getZ()); - this.client.getHabbo().getRoomUnit().setPreviousLocationZ(this.teleportOne.getZ()); + this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.teleportOne.getCurrentPosition().getX(), this.teleportOne.getCurrentPosition().getY())); + this.client.getHabbo().getRoomUnit().setCurrentZ(this.teleportOne.getCurrentZ()); + this.client.getHabbo().getRoomUnit().setPreviousLocationZ(this.teleportOne.getCurrentZ()); Emulator.getThreading().run(() -> { HopperActionOne.this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java index 84335194..2cd4aa22 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java @@ -40,11 +40,11 @@ class HopperActionThree implements Runnable { return; } - targetTeleport.setExtradata("2"); + targetTeleport.setExtraData("2"); targetRoom.updateItem(targetTeleport); - this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(targetTeleport.getX(), targetTeleport.getY())); - this.client.getHabbo().getRoomUnit().setPreviousLocationZ(targetTeleport.getZ()); - this.client.getHabbo().getRoomUnit().setCurrentZ(targetTeleport.getZ()); + this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(targetTeleport.getCurrentPosition().getX(), targetTeleport.getCurrentPosition().getY())); + this.client.getHabbo().getRoomUnit().setPreviousLocationZ(targetTeleport.getCurrentZ()); + this.client.getHabbo().getRoomUnit().setCurrentZ(targetTeleport.getCurrentZ()); this.client.getHabbo().getRoomUnit().setRotation(RoomRotation.values()[targetTeleport.getRotation() % 8]); this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); targetRoom.sendComposer(new UserUpdateComposer(this.client.getHabbo().getRoomUnit()).compose()); diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java index 3a7c7831..545ffd68 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionTwo.java @@ -22,7 +22,7 @@ class HopperActionTwo implements Runnable { @Override public void run() { - this.teleportOne.setExtradata("2"); + this.teleportOne.setExtraData("2"); int targetRoomId = 0; int targetItemId = 0; @@ -44,7 +44,7 @@ class HopperActionTwo implements Runnable { if (targetRoomId != 0 && targetItemId != 0) { Emulator.getThreading().run(new HopperActionThree(this.teleportOne, this.room, this.client, targetRoomId, targetItemId), 500); } else { - this.teleportOne.setExtradata("0"); + this.teleportOne.setExtraData("0"); this.client.getHabbo().getRoomUnit().setCanWalk(true); this.client.getHabbo().getRoomUnit().setTeleporting(false); Emulator.getThreading().run(new HopperActionFour(this.teleportOne, this.room, this.client), 500); diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java index e60b022a..df1826e9 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java @@ -37,7 +37,7 @@ class TeleportActionFive implements Runnable { if (this.room.getLayout() == null || this.currentTeleport == null) return; - RoomTile currentLocation = this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY()); + RoomTile currentLocation = this.room.getLayout().getTile(this.currentTeleport.getCurrentPosition().getX(), this.currentTeleport.getCurrentPosition().getY()); RoomTile tile = this.room.getLayout().getTileInFront(currentLocation, this.currentTeleport.getRotation()); if (tile != null) { @@ -55,7 +55,7 @@ class TeleportActionFive implements Runnable { Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onSuccess, onSuccess)); } - this.currentTeleport.setExtradata("1"); + this.currentTeleport.setExtraData("1"); this.room.updateItem(this.currentTeleport); Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 1000); diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFour.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFour.java index 6ed4fef4..8b360570 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFour.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFour.java @@ -17,7 +17,7 @@ class TeleportActionFour implements Runnable { public void run() { if (this.client.getHabbo().getRoomUnit().getRoom() != this.room) { this.client.getHabbo().getRoomUnit().setCanWalk(true); - this.currentTeleport.setExtradata("0"); + this.currentTeleport.setExtraData("0"); this.room.updateItem(this.currentTeleport); return; } diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionOne.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionOne.java index 652b2bb1..2ab481b9 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionOne.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionOne.java @@ -27,12 +27,12 @@ public class TeleportActionOne implements Runnable { delay = 0; } - if (this.client.getHabbo().getRoomUnit().getCurrentPosition() != this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY())) { - this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY())); + if (this.client.getHabbo().getRoomUnit().getCurrentPosition() != this.room.getLayout().getTile(this.currentTeleport.getCurrentPosition().getX(), this.currentTeleport.getCurrentPosition().getY())) { + this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.currentTeleport.getCurrentPosition().getX(), this.currentTeleport.getCurrentPosition().getY())); this.client.getHabbo().getRoomUnit().setRotation(RoomRotation.values()[(this.currentTeleport.getRotation() + 4) % 8]); - this.client.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.MOVE, this.currentTeleport.getX() + "," + this.currentTeleport.getY() + "," + this.currentTeleport.getZ()); + this.client.getHabbo().getRoomUnit().addStatus(RoomUnitStatus.MOVE, this.currentTeleport.getCurrentPosition().getX() + "," + this.currentTeleport.getCurrentPosition().getY() + "," + this.currentTeleport.getCurrentZ()); this.room.scheduledComposers.add(new UserUpdateComposer(this.client.getHabbo().getRoomUnit()).compose()); - this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY())); + this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.currentTeleport.getCurrentPosition().getX(), this.currentTeleport.getCurrentPosition().getY())); } Emulator.getThreading().run(new TeleportActionTwo(this.currentTeleport, this.room, this.client), delay); diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java index 67e59b84..16400f3c 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java @@ -46,7 +46,7 @@ class TeleportActionThree implements Runnable { return; } - RoomTile teleportLocation = targetRoom.getLayout().getTile(targetTeleport.getX(), targetTeleport.getY()); + RoomTile teleportLocation = targetRoom.getLayout().getTile(targetTeleport.getCurrentPosition().getX(), targetTeleport.getCurrentPosition().getY()); if (teleportLocation == null) { Emulator.getThreading().run(new TeleportActionFive(this.currentTeleport, this.room, this.client), 0); @@ -65,7 +65,7 @@ class TeleportActionThree implements Runnable { this.client.getHabbo().getRoomUnit().setRotation(RoomRotation.values()[targetTeleport.getRotation() % 8]); - targetTeleport.setExtradata("2"); + targetTeleport.setExtraData("2"); targetRoom.updateItem(targetTeleport); //targetRoom.updateHabbo(this.client.getHabbo()); //LOGGER.info((targetTeleport.getX() + " | " + targetTeleport.getY()); diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java index fbdc1c36..f089d215 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionTwo.java @@ -77,7 +77,7 @@ class TeleportActionTwo implements Runnable { } } - this.currentTeleport.setExtradata("0"); + this.currentTeleport.setExtraData("0"); this.room.updateItem(this.currentTeleport); if (((InteractionTeleport) this.currentTeleport).getTargetRoomId() == 0) {