RoomItem refactor

This commit is contained in:
Stankman 2023-07-29 14:16:18 -05:00
parent 3c771a1dd4
commit 81f45ba4b7
378 changed files with 2212 additions and 2036 deletions

View File

@ -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.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) > [`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`](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.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) > [`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) > [`HabboInfo`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java)

View File

@ -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.BotShoutEvent;
import com.eu.habbo.plugin.events.bots.BotTalkEvent; import com.eu.habbo.plugin.events.bots.BotTalkEvent;
import com.eu.habbo.plugin.events.bots.BotWhisperEvent; import com.eu.habbo.plugin.events.bots.BotWhisperEvent;
import com.eu.habbo.threading.runnables.BotFollowHabbo;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -64,13 +63,16 @@ public class Bot extends Unit implements Runnable {
@Getter @Getter
@Setter @Setter
private short lastChatIndex; private short lastChatIndex;
private final int bubble; @Getter
private final int bubbleId;
@Getter @Getter
private final String type; private final String type;
@Getter @Getter
private int effect; private int effect;
private transient boolean canWalk = true; private transient boolean canWalk = true;
private boolean needsUpdate; private boolean needsUpdate;
@Getter
@Setter
private transient int followingHabboId; private transient int followingHabboId;
@Getter @Getter
@Setter @Setter
@ -95,7 +97,7 @@ public class Bot extends Unit implements Runnable {
this.chatLines = new ArrayList<>(); this.chatLines = new ArrayList<>();
this.type = "generic_bot"; this.type = "generic_bot";
this.room = null; this.room = null;
this.bubble = RoomChatMessageBubbles.BOT_RENTABLE.getType(); this.bubbleId = RoomChatMessageBubbles.BOT_RENTABLE.getType();
} }
public Bot(ResultSet set) throws SQLException { public Bot(ResultSet set) throws SQLException {
@ -116,7 +118,7 @@ public class Bot extends Unit implements Runnable {
this.room = null; this.room = null;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay; this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
this.needsUpdate = false; this.needsUpdate = false;
this.bubble = set.getInt("bubble_id"); this.bubbleId = set.getInt("bubble_id");
this.roomUnit = new RoomBot(); 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.chatLines = new ArrayList<>(List.of("Default Message :D"));
this.type = bot.getType(); this.type = bot.getType();
this.effect = bot.getEffect(); this.effect = bot.getEffect();
this.bubble = bot.getBubbleId(); this.bubbleId = bot.getBubbleId();
this.needsUpdate = false; this.needsUpdate = false;
} }
@ -177,7 +179,7 @@ public class Bot extends Unit implements Runnable {
statement.setString(12, this.chatRandom ? "1" : "0"); statement.setString(12, this.chatRandom ? "1" : "0");
statement.setInt(13, this.chatDelay); statement.setInt(13, this.chatDelay);
statement.setInt(14, this.effect); statement.setInt(14, this.effect);
statement.setInt(15, this.bubble); statement.setInt(15, this.bubbleId);
statement.setInt(16, this.id); statement.setInt(16, this.id);
statement.execute(); statement.execute();
this.needsUpdate = false; 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() { public int getBubbleId() {
return bubble; return bubbleId;
} }
public void setName(String name) { 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() { public boolean canWalk() {
return this.canWalk; return this.canWalk;
} }
@ -441,7 +427,7 @@ public class Bot extends Unit implements Runnable {
statement.setString(15, this.chatRandom ? "1" : "0"); statement.setString(15, this.chatRandom ? "1" : "0");
statement.setInt(16, this.chatDelay); statement.setInt(16, this.chatDelay);
statement.setInt(17, this.effect); statement.setInt(17, this.effect);
statement.setInt(18, this.bubble); statement.setInt(18, this.bubbleId);
statement.setInt(19, this.id); statement.setInt(19, this.id);
statement.execute(); statement.execute();
} catch (SQLException e) { } catch (SQLException e) {

View File

@ -190,7 +190,7 @@ public class BotManager {
bot.onPickUp(habbo, room); bot.onPickUp(habbo, room);
room.getRoomUnitManager().removeBot(bot); room.getRoomUnitManager().removeBot(bot);
bot.stopFollowingHabbo(); bot.setFollowingHabboId(0);
bot.setOwnerId(botOwnerInfo.getId()); bot.setOwnerId(botOwnerInfo.getId());
bot.setOwnerName(botOwnerInfo.getUsername()); bot.setOwnerName(botOwnerInfo.getUsername());
bot.needsUpdate(true); bot.needsUpdate(true);

View File

@ -1005,7 +1005,7 @@ public class CatalogManager {
if (guild != null && Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo) != null) { 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); InteractionGuildFurni habboItem = (InteractionGuildFurni) Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata);
habboItem.setExtradata(""); habboItem.setExtraData("");
habboItem.needsUpdate(true); habboItem.needsUpdate(true);
Emulator.getThreading().run(habboItem); Emulator.getThreading().run(habboItem);

View File

@ -281,7 +281,7 @@ public class MarketPlace {
} }
event.price = calculateCommision(event.price); event.price = calculateCommision(event.price);
item.setOwnerId(client.getHabbo().getHabboInfo().getId()); item.setOwnerInfo(client.getHabbo().getHabboInfo());
item.needsUpdate(true); item.needsUpdate(true);
Emulator.getThreading().run(item); Emulator.getThreading().run(item);
@ -362,7 +362,7 @@ public class MarketPlace {
MarketPlaceOffer offer = new MarketPlaceOffer(event.getItem(), event.getPrice(), client.getHabbo()); MarketPlaceOffer offer = new MarketPlaceOffer(event.getItem(), event.getPrice(), client.getHabbo());
client.getHabbo().getInventory().addMarketplaceOffer(offer); client.getHabbo().getInventory().addMarketplaceOffer(offer);
client.getHabbo().getInventory().getItemsComponent().removeHabboItem(event.getItem()); client.getHabbo().getInventory().getItemsComponent().removeHabboItem(event.getItem());
item.setOwnerId(-1); item.setOwnerInfo(null);
item.needsUpdate(true); item.needsUpdate(true);
Emulator.getThreading().run(item); Emulator.getThreading().run(item);

View File

@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.PermissionGroup; import com.eu.habbo.habbohotel.permissions.PermissionGroup;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
public class GiveRankCommand extends Command { public class GiveRankCommand extends Command {
@ -40,7 +39,7 @@ public class GiveRankCommand extends Command {
return true; return true;
} }
HabboInfo habbo = HabboManager.getOfflineHabboInfo(params[1]); HabboInfo habbo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]);
if (habbo != null) { if (habbo != null) {
if (habbo.getPermissionGroup().getId() > gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) { if (habbo.getPermissionGroup().getId() > gameClient.getHabbo().getHabboInfo().getPermissionGroup().getId()) {

View File

@ -35,7 +35,7 @@ public class LayCommand extends Command {
return false; 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()); gameClient.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(gameClient.getHabbo().getRoomUnit()).compose());
return true; return true;
} }

View File

@ -30,7 +30,7 @@ public class RedeemCommand extends Command {
TIntIntMap points = new TIntIntHashMap(); TIntIntMap points = new TIntIntHashMap();
for (RoomItem item : gameClient.getHabbo().getInventory().getItemsComponent().getItemsAsValueCollection()) { 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); items.add(item);
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) { if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) {
try { try {

View File

@ -22,7 +22,7 @@ public class ReloadRoomCommand extends Command {
Room room = gameClient.getHabbo().getRoomUnit().getRoom(); Room room = gameClient.getHabbo().getRoomUnit().getRoom();
if (room != null) { if (room != null) {
Collection<Habbo> habbos = new ArrayList<>(room.getRoomUnitManager().getCurrentHabbos().values()); Collection<Habbo> habbos = new ArrayList<>(room.getRoomUnitManager().getCurrentHabbos().values());
Emulator.getGameEnvironment().getRoomManager().unloadRoom(room); room.dispose();
room = Emulator.getGameEnvironment().getRoomManager().getRoom(room.getRoomInfo().getId()); room = Emulator.getGameEnvironment().getRoomManager().getRoom(room.getRoomInfo().getId());
ServerMessage message = new RoomForwardMessageComposer(room.getRoomInfo().getId()).compose(); ServerMessage message = new RoomForwardMessageComposer(room.getRoomInfo().getId()).compose();
habbos.forEach(habbo -> habbo.getClient().sendResponse(message)); habbos.forEach(habbo -> habbo.getClient().sendResponse(message));

View File

@ -10,8 +10,10 @@ public class StandCommand extends Command {
@Override @Override
public boolean handle(GameClient gameClient, String[] params) { public boolean handle(GameClient gameClient, String[] params) {
if (gameClient.getHabbo().getHabboInfo().getRiding() == null) if (gameClient.getHabbo().getHabboInfo().getRiding() == null) {
gameClient.getHabbo().getRoomUnit().makeStand(); gameClient.getHabbo().getRoomUnit().makeStand();
}
return true; return true;
} }
} }

View File

@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.HabboInfo; 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.HabboStats;
import com.eu.habbo.habbohotel.users.subscriptions.Subscription; 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); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_subscription.invalid_params", "Invalid command format"), RoomChatMessageBubbles.ALERT);
return true; return true;
} }
HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]); HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]);
if (info == null) { if (info == null) {
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.user_not_found", "%user% was not found"), params[1]), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.user_not_found", "%user% was not found"), params[1]), RoomChatMessageBubbles.ALERT);

View File

@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import gnu.trove.iterator.TIntIntIterator; import gnu.trove.iterator.TIntIntIterator;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -30,7 +29,7 @@ public class UserInfoCommand extends Command {
HabboInfo habbo = (onlineHabbo != null ? onlineHabbo.getHabboInfo() : null); HabboInfo habbo = (onlineHabbo != null ? onlineHabbo.getHabboInfo() : null);
if (habbo == null) { if (habbo == null) {
habbo = HabboManager.getOfflineHabboInfo(params[1]); habbo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]);
} }
if (habbo == null) { if (habbo == null) {

View File

@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.sql.Connection; import java.sql.Connection;
@ -42,7 +41,7 @@ public class BadgeCommand extends BaseBadgeCommand {
return true; return true;
} else { } else {
HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(params[1]); HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]);
if (habboInfo == null) { if (habboInfo == null) {
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_badge.unknown_user"), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_badge.unknown_user"), RoomChatMessageBubbles.ALERT);

View File

@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.HabboBadge;
import com.eu.habbo.habbohotel.users.HabboInfo; 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.habbohotel.users.inventory.BadgesComponent;
import com.eu.habbo.messages.outgoing.inventory.BadgesComposer; import com.eu.habbo.messages.outgoing.inventory.BadgesComposer;
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer; import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
@ -51,7 +50,7 @@ public class TakeBadgeCommand extends BaseBadgeCommand {
if (habbo != null) if (habbo != null)
userId = habbo.getHabboInfo().getId(); userId = habbo.getHabboInfo().getId();
else { else {
HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(username); HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(username);
if (habboInfo != null) if (habboInfo != null)
userId = habboInfo.getId(); userId = habboInfo.getId();
} }

View File

@ -8,7 +8,6 @@ import com.eu.habbo.habbohotel.modtool.ModToolBanType;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
@ -54,7 +53,7 @@ public class BanCommand extends Command {
if (t != null) { if (t != null) {
target = t.getHabboInfo(); target = t.getHabboInfo();
} else { } else {
target = HabboManager.getOfflineHabboInfo(params[1]); target = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]);
} }
if (target == null) { if (target == null) {

View File

@ -1,10 +1,10 @@
package com.eu.habbo.habbohotel.commands.list.bans; 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.commands.Command;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
@ -43,7 +43,7 @@ public abstract class BaseBanCommand extends Command {
if (h != null) { if (h != null) {
return h.getHabboInfo(); return h.getHabboInfo();
} else { } else {
return HabboManager.getOfflineHabboInfo(params[1]); return Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]);
} }
} }
return null; return null;

View File

@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.HabboManager;
public class CreditsCommand extends BaseCreditsCommand { public class CreditsCommand extends BaseCreditsCommand {
private static final String INVALID_AMOUNT = "commands.error.cmd_credits.invalid_amount"; private static final String INVALID_AMOUNT = "commands.error.cmd_credits.invalid_amount";
@ -17,7 +16,7 @@ public class CreditsCommand extends BaseCreditsCommand {
@Override @Override
public boolean handle(GameClient gameClient, String[] params) { public boolean handle(GameClient gameClient, String[] params) {
if (params.length == 3) { if (params.length == 3) {
HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]); HabboInfo info = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(params[1]);
if (info != null) { if (info != null) {
Habbo habbo = getHabbo(params[1]); Habbo habbo = getHabbo(params[1]);

View File

@ -4,10 +4,9 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; 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.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; 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.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer; import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer; import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
@ -46,7 +45,7 @@ public class GiftCommand extends BaseGiftCommand {
return true; return true;
} }
HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(username); HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(username);
if (habboInfo == null) { if (habboInfo == null) {
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_gift.user_not_found"), username), RoomChatMessageBubbles.ALERT); gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_gift.user_not_found"), username), RoomChatMessageBubbles.ALERT);

View File

@ -70,7 +70,7 @@ public class BattleBanzaiGame extends Game {
} }
for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) {
item.setExtradata("1"); item.setExtraData("1");
this.room.updateItemState(item); this.room.updateItemState(item);
} }
@ -105,12 +105,12 @@ public class BattleBanzaiGame extends Game {
if (this.countDown == 0) { if (this.countDown == 0) {
for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) {
item.setExtradata("1"); item.setExtraData("1");
this.room.updateItemState(item); this.room.updateItemState(item);
if(this.countDown2 > 0) { if(this.countDown2 > 0) {
this.countDown2--; this.countDown2--;
if(this.countDown2 == 0) { if(this.countDown2 == 0) {
item.setExtradata("2"); item.setExtraData("2");
this.room.updateItemState(item); this.room.updateItemState(item);
} }
} }
@ -147,7 +147,7 @@ public class BattleBanzaiGame extends Game {
if (highestScore != null) { if (highestScore != null) {
for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { 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); this.room.updateItemState(item);
} }
} }
@ -195,7 +195,7 @@ public class BattleBanzaiGame extends Game {
} }
for (RoomItem item : this.room.getRoomSpecialTypes().getItemsOfType(InteractionBattleBanzaiSphere.class)) { 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); this.room.updateItemState(item);
} }
synchronized (this.lockedTiles) { synchronized (this.lockedTiles) {
@ -213,8 +213,8 @@ public class BattleBanzaiGame extends Game {
this.refreshGates(); this.refreshGates();
for (RoomItem tile : this.gameTiles.values()) { for (RoomItem tile : this.gameTiles.values()) {
if (tile.getExtradata().equals("1")) { if (tile.getExtraData().equals("1")) {
tile.setExtradata("0"); tile.setExtraData("0");
this.room.updateItem(tile); this.room.updateItem(tile);
} }
} }
@ -228,14 +228,14 @@ public class BattleBanzaiGame extends Game {
this.tileCount = 0; this.tileCount = 0;
for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) { for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) {
if (item instanceof InteractionBattleBanzaiTile) { if (item instanceof InteractionBattleBanzaiTile) {
item.setExtradata("1"); item.setExtraData("1");
this.room.updateItemState(item); this.room.updateItemState(item);
this.tileCount++; this.tileCount++;
this.gameTiles.put(item.getId(), item); this.gameTiles.put(item.getId(), item);
} }
if (item instanceof InteractionBattleBanzaiScoreboard) { if (item instanceof InteractionBattleBanzaiScoreboard) {
item.setExtradata("0"); item.setExtraData("0");
this.room.updateItemState(item); this.room.updateItemState(item);
} }
} }
@ -262,8 +262,8 @@ public class BattleBanzaiGame extends Game {
if (doNotCheckFill) return; if (doNotCheckFill) return;
final int x = item.getX(); final int x = item.getCurrentPosition().getX();
final int y = item.getY(); final int y = item.getCurrentPosition().getY();
final List<List<RoomTile>> filledAreas = new ArrayList<>(); final List<List<RoomTile>> filledAreas = new ArrayList<>();
final THashSet<RoomItem> lockedTiles = new THashSet<>(this.lockedTiles.get(teamColor)); final THashSet<RoomItem> lockedTiles = new THashSet<>(this.lockedTiles.get(teamColor));
@ -278,12 +278,12 @@ public class BattleBanzaiGame extends Game {
if (largestAreaOfAll.isPresent()) { if (largestAreaOfAll.isPresent()) {
for (RoomTile tile : largestAreaOfAll.get()) { for (RoomTile tile : largestAreaOfAll.get()) {
Optional<RoomItem> tileItem = this.gameTiles.values().stream().filter(i -> i.getX() == tile.getX() && i.getY() == tile.getY() && i instanceof InteractionBattleBanzaiTile).findAny(); Optional<RoomItem> tileItem = this.gameTiles.values().stream().filter(i -> i.getCurrentPosition().getX() == tile.getX() && i.getCurrentPosition().getY() == tile.getY() && i instanceof InteractionBattleBanzaiTile).findAny();
tileItem.ifPresent(habboItem -> { tileItem.ifPresent(habboItem -> {
this.tileLocked(teamColor, habboItem, habbo, true); this.tileLocked(teamColor, habboItem, habbo, true);
habboItem.setExtradata((2 + (teamColor.type * 3)) + ""); habboItem.setExtraData((2 + (teamColor.type * 3)) + "");
this.room.updateItem(habboItem); this.room.updateItem(habboItem);
}); });
} }
@ -322,7 +322,7 @@ public class BattleBanzaiGame extends Game {
private boolean hasLockedTileAtCoordinates(int x, int y, THashSet<RoomItem> lockedTiles) { private boolean hasLockedTileAtCoordinates(int x, int y, THashSet<RoomItem> lockedTiles) {
for (RoomItem item : 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; return false;
@ -330,7 +330,7 @@ public class BattleBanzaiGame extends Game {
private boolean isOutOfBounds(int x, int y) { private boolean isOutOfBounds(int x, int y) {
for (RoomItem item : this.gameTiles.values()) { 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; return true;
@ -341,7 +341,7 @@ public class BattleBanzaiGame extends Game {
if (lockedTilesForColor.getKey() == color) continue; if (lockedTilesForColor.getKey() == color) continue;
for (RoomItem item : lockedTilesForColor.getValue()) { 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<Integer, InteractionBattleBanzaiScoreboard> scoreBoards = this.room.getRoomSpecialTypes().getBattleBanzaiScoreboards(teamColors); THashMap<Integer, InteractionBattleBanzaiScoreboard> scoreBoards = this.room.getRoomSpecialTypes().getBattleBanzaiScoreboards(teamColors);
for (InteractionBattleBanzaiScoreboard scoreboard : scoreBoards.values()) { for (InteractionBattleBanzaiScoreboard scoreboard : scoreBoards.values()) {
if (scoreboard.getExtradata().isEmpty()) { if (scoreboard.getExtraData().isEmpty()) {
scoreboard.setExtradata("0"); scoreboard.setExtraData("0");
} }
int oldScore = Integer.parseInt(scoreboard.getExtradata()); int oldScore = Integer.parseInt(scoreboard.getExtraData());
if (oldScore == totalScore) if (oldScore == totalScore)
continue; continue;
scoreboard.setExtradata(totalScore + ""); scoreboard.setExtraData(totalScore + "");
this.room.updateItemState(scoreboard); this.room.updateItemState(scoreboard);
} }
} }
@ -384,7 +384,7 @@ public class BattleBanzaiGame extends Game {
Collection<InteractionBattleBanzaiGate> gates = this.room.getRoomSpecialTypes().getBattleBanzaiGates().values(); Collection<InteractionBattleBanzaiGate> gates = this.room.getRoomSpecialTypes().getBattleBanzaiGates().values();
THashSet<RoomTile> tilesToUpdate = new THashSet<>(gates.size()); THashSet<RoomTile> tilesToUpdate = new THashSet<>(gates.size());
for (RoomItem item : gates) { 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); this.room.updateTiles(tilesToUpdate);
@ -410,7 +410,7 @@ public class BattleBanzaiGame extends Game {
} }
this.refreshCounters(habbo.getHabboInfo().getGamePlayer().getTeamColor()); this.refreshCounters(habbo.getHabboInfo().getGamePlayer().getTeamColor());
tile.setExtradata(state + ""); tile.setExtraData(state + "");
this.room.updateItem(tile); this.room.updateItem(tile);
} }
} }

View File

@ -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.items.interactions.games.InteractionGameGate;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.rooms.entities.units.types.RoomHabbo;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
@ -38,10 +37,10 @@ public class BattleBanzaiGameTeam extends GameTeam {
Habbo habbo = gamePlayer.getHabbo(); Habbo habbo = gamePlayer.getHabbo();
Game game = habbo.getRoomUnit().getRoom().getGame(FreezeGame.class); Game game = habbo.getRoomUnit().getRoom().getGame(FreezeGame.class);
RoomUnit roomUnit = habbo.getRoomUnit(); RoomHabbo roomHabbo = habbo.getRoomUnit();
Room room = roomUnit.getRoom(); Room room = roomHabbo.getRoom();
if(room == null) return; 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 nextEffectM = 0;
int nextEffectF = 0; int nextEffectF = 0;
int nextEffectDuration = -1; int nextEffectDuration = -1;
@ -49,10 +48,10 @@ public class BattleBanzaiGameTeam extends GameTeam {
if (topItem != null) { if (topItem != null) {
nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectM = topItem.getBaseItem().getEffectM();
nextEffectF = topItem.getBaseItem().getEffectF(); nextEffectF = topItem.getBaseItem().getEffectF();
} else if (roomUnit.getPreviousEffectId() > 0) { } else if (roomHabbo.getPreviousEffectId() > 0) {
nextEffectF = roomUnit.getPreviousEffectId(); nextEffectF = roomHabbo.getPreviousEffectId();
nextEffectM = roomUnit.getPreviousEffectId(); nextEffectM = roomHabbo.getPreviousEffectId();
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp();
} }
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
@ -64,7 +63,7 @@ public class BattleBanzaiGameTeam extends GameTeam {
habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration, true); habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration, true);
} }
roomUnit.setCanWalk(true); roomHabbo.setCanWalk(true);
if (room.getRoomSpecialTypes() != null) { if (room.getRoomSpecialTypes() != null) {

View File

@ -80,7 +80,7 @@ public class FreezeGame extends Game {
synchronized void resetMap() { synchronized void resetMap() {
for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) { for (RoomItem item : this.room.getRoomItemManager().getFloorItems().values()) {
if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeScoreboard) { if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeScoreboard) {
item.setExtradata("0"); item.setExtraData("0");
this.room.updateItemState(item); 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()) if (!this.state.equals(GameState.RUNNING) || !habbo.getHabboInfo().isInGame() || habbo.getHabboInfo().getCurrentGame() != this.getClass())
return; return;
if (!item.getExtradata().equalsIgnoreCase("0") && !item.getExtradata().isEmpty()) if (!item.getExtraData().equalsIgnoreCase("0") && !item.getExtraData().isEmpty())
return; 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()) { if (((FreezeGamePlayer) habbo.getHabboInfo().getGamePlayer()).canThrowSnowball()) {
Emulator.getThreading().run(new FreezeThrowSnowball(habbo, item, this.room)); Emulator.getThreading().run(new FreezeThrowSnowball(habbo, item, this.room));
} }
@ -147,7 +147,7 @@ public class FreezeGame extends Game {
powerUp += Emulator.getRandom().nextInt(6) + 1; 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); this.room.updateItemState(block);
} }
@ -173,7 +173,7 @@ public class FreezeGame extends Game {
Emulator.getThreading().run(new FreezeClearEffects(player.getHabbo()), 1000); Emulator.getThreading().run(new FreezeClearEffects(player.getHabbo()), 1000);
if (this.room.getRoomSpecialTypes().hasFreezeExitTile()) { if (this.room.getRoomSpecialTypes().hasFreezeExitTile()) {
InteractionFreezeExitTile tile = this.room.getRoomSpecialTypes().getRandomFreezeExitTile(); InteractionFreezeExitTile tile = this.room.getRoomSpecialTypes().getRandomFreezeExitTile();
tile.setExtradata("1"); tile.setExtraData("1");
this.room.updateItemState(tile); this.room.updateItemState(tile);
this.room.teleportHabboToItem(player.getHabbo(), 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())) { for (RoomItem item : this.room.getRoomItemManager().getItemsAt(habbo.getRoomUnit().getCurrentPosition())) {
if (item instanceof InteractionFreezeTile) { if (item instanceof InteractionFreezeTile) {
RoomItem exitTile = this.room.getRoomSpecialTypes().getRandomFreezeExitTile(); 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<Integer, InteractionFreezeScoreboard> scoreBoards = this.room.getRoomSpecialTypes().getFreezeScoreboards(team.teamColor); THashMap<Integer, InteractionFreezeScoreboard> scoreBoards = this.room.getRoomSpecialTypes().getFreezeScoreboards(team.teamColor);
for (InteractionFreezeScoreboard scoreboard : scoreBoards.values()) { for (InteractionFreezeScoreboard scoreboard : scoreBoards.values()) {
if (scoreboard.getExtradata().isEmpty()) { if (scoreboard.getExtraData().isEmpty()) {
scoreboard.setExtradata("0"); scoreboard.setExtraData("0");
} }
int oldScore = Integer.parseInt(scoreboard.getExtradata()); int oldScore = Integer.parseInt(scoreboard.getExtraData());
if (oldScore == totalScore) if (oldScore == totalScore)
continue; continue;
scoreboard.setExtradata(totalScore + ""); scoreboard.setExtraData(totalScore + "");
this.room.updateItemState(scoreboard); this.room.updateItemState(scoreboard);
} }
} }
@ -282,7 +282,7 @@ public class FreezeGame extends Game {
for (Map.Entry<Integer, InteractionFreezeGate> set : this.room.getRoomSpecialTypes().getFreezeGates().entrySet()) { for (Map.Entry<Integer, InteractionFreezeGate> set : this.room.getRoomSpecialTypes().getFreezeGates().entrySet()) {
if (teamMemberCount.containsKey(set.getValue().teamColor)) { if (teamMemberCount.containsKey(set.getValue().teamColor)) {
int amount = Math.min(teamMemberCount.get(set.getValue().teamColor), 5); 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); teamMemberCount.put(set.getValue().teamColor, teamMemberCount.get(set.getValue().teamColor) - amount);
this.room.updateItemState(set.getValue()); this.room.updateItemState(set.getValue());
} }
@ -295,7 +295,7 @@ public class FreezeGame extends Game {
public void setFreezeTileState(String state) { public void setFreezeTileState(String state) {
this.room.getRoomSpecialTypes().getFreezeExitTiles().forEachValue(object -> { this.room.getRoomSpecialTypes().getFreezeExitTiles().forEachValue(object -> {
object.setExtradata(state); object.setExtraData(state);
FreezeGame.this.room.updateItemState(object); FreezeGame.this.room.updateItemState(object);
return true; return true;
}); });
@ -305,7 +305,7 @@ public class FreezeGame extends Game {
private void refreshGates() { private void refreshGates() {
THashSet<RoomTile> tilesToUpdate = new THashSet<>(); THashSet<RoomTile> tilesToUpdate = new THashSet<>();
for (RoomItem item : this.room.getRoomSpecialTypes().getFreezeGates().values()) { 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); this.room.updateTiles(tilesToUpdate);

View File

@ -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.items.interactions.games.InteractionGameGate;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.rooms.entities.units.types.RoomHabbo;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
@ -25,11 +24,11 @@ public class FreezeGameTeam extends GameTeam {
Habbo habbo = gamePlayer.getHabbo(); Habbo habbo = gamePlayer.getHabbo();
Game game = habbo.getRoomUnit().getRoom().getGame(FreezeGame.class); Game game = habbo.getRoomUnit().getRoom().getGame(FreezeGame.class);
RoomUnit roomUnit = habbo.getRoomUnit(); RoomHabbo roomHabbo = habbo.getRoomUnit();
Room room = roomUnit.getRoom(); Room room = roomHabbo.getRoom();
if(room == null) return; 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 nextEffectM = 0;
int nextEffectF = 0; int nextEffectF = 0;
int nextEffectDuration = -1; int nextEffectDuration = -1;
@ -37,10 +36,10 @@ public class FreezeGameTeam extends GameTeam {
if (topItem != null) { if (topItem != null) {
nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectM = topItem.getBaseItem().getEffectM();
nextEffectF = topItem.getBaseItem().getEffectF(); nextEffectF = topItem.getBaseItem().getEffectF();
} else if (roomUnit.getPreviousEffectId() > 0) { } else if (roomHabbo.getPreviousEffectId() > 0) {
nextEffectF = roomUnit.getPreviousEffectId(); nextEffectF = roomHabbo.getPreviousEffectId();
nextEffectM = roomUnit.getPreviousEffectId(); nextEffectM = roomHabbo.getPreviousEffectId();
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp();
} }
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
@ -52,7 +51,7 @@ public class FreezeGameTeam extends GameTeam {
habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration, true); habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration, true);
} }
roomUnit.setCanWalk(true); roomHabbo.setCanWalk(true);
if (room.getRoomSpecialTypes() != null) { if (room.getRoomSpecialTypes() != null) {
for (InteractionGameGate gate : room.getRoomSpecialTypes().getFreezeGates().values()) { for (InteractionGameGate gate : room.getRoomSpecialTypes().getFreezeGates().values()) {

View File

@ -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.Room;
import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.rooms.entities.units.types.RoomHabbo;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
@ -121,7 +120,7 @@ public abstract class TagGame extends Game {
} }
if (pole != null) { if (pole != null) {
pole.setExtradata("1"); pole.setExtraData("1");
room.updateItemState(pole); room.updateItemState(pole);
Emulator.getThreading().run(new HabboItemNewState(pole, room, "0"), 1000); Emulator.getThreading().run(new HabboItemNewState(pole, room, "0"), 1000);
} }
@ -173,11 +172,11 @@ public abstract class TagGame extends Game {
super.removeHabbo(habbo); super.removeHabbo(habbo);
this.taggers.remove(habbo); this.taggers.remove(habbo);
RoomUnit roomUnit = habbo.getRoomUnit(); RoomHabbo roomHabbo = habbo.getRoomUnit();
Room room = roomUnit.getRoom(); Room room = roomHabbo.getRoom();
if (room == null) return; 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 nextEffectM = 0;
int nextEffectF = 0; int nextEffectF = 0;
int nextEffectDuration = -1; int nextEffectDuration = -1;
@ -185,10 +184,10 @@ public abstract class TagGame extends Game {
if (topItem != null) { if (topItem != null) {
nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectM = topItem.getBaseItem().getEffectM();
nextEffectF = topItem.getBaseItem().getEffectF(); nextEffectF = topItem.getBaseItem().getEffectF();
} else if (roomUnit.getPreviousEffectId() > 0) { } else if (roomHabbo.getPreviousEffectId() > 0) {
nextEffectF = roomUnit.getPreviousEffectId(); nextEffectF = roomHabbo.getPreviousEffectId();
nextEffectM = roomUnit.getPreviousEffectId(); nextEffectM = roomHabbo.getPreviousEffectId();
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp();
} }
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {

View File

@ -41,11 +41,11 @@ public class WiredGame extends Game {
@Override @Override
public void removeHabbo(Habbo habbo) { public void removeHabbo(Habbo habbo) {
super.removeHabbo(habbo); super.removeHabbo(habbo);
RoomHabbo roomUnit = habbo.getRoomUnit(); RoomHabbo roomHabbo = habbo.getRoomUnit();
Room room = this.room; Room room = this.room;
if (room == null) return; 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 nextEffectM = 0;
int nextEffectF = 0; int nextEffectF = 0;
int nextEffectDuration = -1; int nextEffectDuration = -1;
@ -53,19 +53,19 @@ public class WiredGame extends Game {
if (topItem != null) { if (topItem != null) {
nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectM = topItem.getBaseItem().getEffectM();
nextEffectF = topItem.getBaseItem().getEffectF(); nextEffectF = topItem.getBaseItem().getEffectF();
} else if (roomUnit.getPreviousEffectId() > 0) { } else if (roomHabbo.getPreviousEffectId() > 0) {
nextEffectF = roomUnit.getPreviousEffectId(); nextEffectF = roomHabbo.getPreviousEffectId();
nextEffectM = roomUnit.getPreviousEffectId(); nextEffectM = roomHabbo.getPreviousEffectId();
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); nextEffectDuration = roomHabbo.getPreviousEffectEndTimestamp();
} }
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
roomUnit.giveEffect(nextEffectM, nextEffectDuration, true); roomHabbo.giveEffect(nextEffectM, nextEffectDuration, true);
return; return;
} }
if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) { if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) {
roomUnit.giveEffect(nextEffectF, nextEffectDuration, true); roomHabbo.giveEffect(nextEffectF, nextEffectDuration, true);
} }
} }

View File

@ -66,13 +66,13 @@ public class Item implements ISerialize {
public static double getCurrentHeight(RoomItem item) { public static double getCurrentHeight(RoomItem item) {
if (item instanceof InteractionMultiHeight && item.getBaseItem().getMultiHeights().length > 0) { if (item instanceof InteractionMultiHeight && item.getBaseItem().getMultiHeights().length > 0) {
if (item.getExtradata().isEmpty()) { if (item.getExtraData().isEmpty()) {
item.setExtradata("0"); item.setExtraData("0");
} }
try { try {
int index = Integer.parseInt(item.getExtradata()) % (item.getBaseItem().getMultiHeights().length); int index = Integer.parseInt(item.getExtraData()) % (item.getBaseItem().getMultiHeights().length);
return item.getBaseItem().getMultiHeights()[(item.getExtradata().isEmpty() ? 0 : index)]; return item.getBaseItem().getMultiHeights()[(item.getExtraData().isEmpty() ? 0 : index)];
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
} }

View File

@ -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.WiredExtraRandom;
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraUnseen; import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredExtraUnseen;
import com.eu.habbo.habbohotel.items.interactions.wired.triggers.*; 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.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.habbohotel.wired.highscores.WiredHighscoreManager;
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer; import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.plugin.events.emulator.EmulatorLoadItemsManagerEvent; import com.eu.habbo.plugin.events.emulator.EmulatorLoadItemsManagerEvent;
@ -488,13 +489,14 @@ public class ItemManager {
try (ResultSet set = statement.getGeneratedKeys()) { try (ResultSet set = statement.getGeneratedKeys()) {
if (set.next()) { if (set.next()) {
Class<? extends RoomItem> itemClass = item.getInteractionType().getType(); Class<? extends RoomItem> itemClass = item.getInteractionType().getType();
HabboInfo userInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(habboId);
if (itemClass != null) { if (itemClass != null) {
try { 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) { } catch (Exception e) {
log.error("Caught 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(1, set.getInt(1));
preparedStatement.setInt(2, Integer.parseInt(itemId)); preparedStatement.setInt(2, Integer.parseInt(itemId));
preparedStatement.addBatch(); 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(); preparedStatement.executeBatch();

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.modtool.ScripterManager;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.BackgroundAnimation; import com.eu.habbo.threading.runnables.BackgroundAnimation;
@ -18,16 +19,16 @@ public class InteractionBackgroundToner extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionBackgroundToner(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionBackgroundToner(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt(5 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(5 + (this.isLimited() ? 256 : 0));
serverMessage.appendInt(4); serverMessage.appendInt(4);
if (this.getExtradata().split(":").length == 4) { if (this.getExtraData().split(":").length == 4) {
String[] colorData = this.getExtradata().split(":"); String[] colorData = this.getExtraData().split(":");
serverMessage.appendInt(Integer.parseInt(colorData[0])); serverMessage.appendInt(Integer.parseInt(colorData[0]));
serverMessage.appendInt(Integer.parseInt(colorData[1])); serverMessage.appendInt(Integer.parseInt(colorData[1]));
serverMessage.appendInt(Integer.parseInt(colorData[2])); serverMessage.appendInt(Integer.parseInt(colorData[2]));
@ -37,7 +38,7 @@ public class InteractionBackgroundToner extends RoomItem {
serverMessage.appendInt(126); serverMessage.appendInt(126);
serverMessage.appendInt(126); serverMessage.appendInt(126);
serverMessage.appendInt(126); serverMessage.appendInt(126);
this.setExtradata("0:126:126:126"); this.setExtraData("0:126:126:126");
this.needsUpdate(true); this.needsUpdate(true);
Emulator.getThreading().run(this); Emulator.getThreading().run(this);
} }
@ -77,12 +78,12 @@ public class InteractionBackgroundToner extends RoomItem {
} }
} }
if (this.getExtradata().split(":").length == 4) { if (this.getExtraData().split(":").length == 4) {
String[] data = this.getExtradata().split(":"); String[] data = this.getExtraData().split(":");
this.setExtradata((data[0].equals("0") ? "1" : "0") + ":" + data[1] + ":" + data[2] + ":" + data[3]); this.setExtraData((data[0].equals("0") ? "1" : "0") + ":" + data[1] + ":" + data[2] + ":" + data[3]);
room.updateItem(this); room.updateItem(this);
} else { } else {
this.setExtradata("0:126:126:126"); this.setExtraData("0:126:126:126");
room.updateItem(this); room.updateItem(this);
} }
this.needsUpdate(true); this.needsUpdate(true);

View File

@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -15,8 +16,8 @@ public class InteractionBadgeDisplay extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionBadgeDisplay(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionBadgeDisplay(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -24,13 +25,13 @@ public class InteractionBadgeDisplay extends RoomItem {
serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0));
serverMessage.appendInt(4); serverMessage.appendInt(4);
serverMessage.appendString("0"); serverMessage.appendString("0");
String[] data = this.getExtradata().split((char) 9 + ""); String[] data = this.getExtraData().split((char) 9 + "");
if (data.length == 3) { if (data.length == 3) {
serverMessage.appendString(data[2]); serverMessage.appendString(data[2]);
serverMessage.appendString(data[1]); serverMessage.appendString(data[1]);
serverMessage.appendString(data[0]); serverMessage.appendString(data[0]);
} else { } else {
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
serverMessage.appendString("Unknown User"); serverMessage.appendString("Unknown User");
serverMessage.appendString("Unknown Date"); serverMessage.appendString("Unknown Date");
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -15,8 +16,8 @@ public class InteractionBlackHole extends InteractionGate {
super(set, baseItem); super(set, baseItem);
} }
public InteractionBlackHole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionBlackHole(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -24,10 +25,10 @@ public class InteractionBlackHole extends InteractionGate {
Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount"); Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount");
int holesCountProgress = 0; int holesCountProgress = 0;
Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getOwnerId()); Habbo owner = room.getRoomUnitManager().getRoomHabboById(this.getOwnerInfo().getId());
if (owner == null) { if (owner == null) {
holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerId(), holeCountAchievement); holesCountProgress = AchievementManager.getAchievementProgressForHabbo(this.getOwnerInfo().getId(), holeCountAchievement);
} else { } else {
holesCountProgress = owner.getHabboStats().getAchievementProgress(holeCountAchievement); holesCountProgress = owner.getHabboStats().getAchievementProgress(holeCountAchievement);
} }
@ -37,7 +38,7 @@ public class InteractionBlackHole extends InteractionGate {
if (owner != null) { if (owner != null) {
AchievementManager.progressAchievement(owner, holeCountAchievement, holeDifference); AchievementManager.progressAchievement(owner, holeCountAchievement, holeDifference);
} else { } else {
AchievementManager.progressAchievement(this.getOwnerId(), holeCountAchievement, holeDifference); AchievementManager.progressAchievement(this.getOwnerInfo().getId(), holeCountAchievement, holeDifference);
} }
} }

View File

@ -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.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo; 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.ObjectsMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import gnu.trove.TCollections; import gnu.trove.TCollections;
@ -39,8 +38,8 @@ public class InteractionBuildArea extends InteractionCustomValues {
tiles = new THashSet<>(); tiles = new THashSet<>();
} }
public InteractionBuildArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionBuildArea(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues);
defaultValues.put("tilesLeft", "0"); defaultValues.put("tilesLeft", "0");
defaultValues.put("tilesRight", "0"); defaultValues.put("tilesRight", "0");
defaultValues.put("tilesFront", "0"); defaultValues.put("tilesFront", "0");
@ -69,7 +68,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
if (builder != null) { if (builder != null) {
builderInfo = builder.getHabboInfo(); builderInfo = builder.getHabboInfo();
} else { } else {
builderInfo = HabboManager.getOfflineHabboInfo(builderName); builderInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(builderName);
} }
if (builderInfo != null) { if (builderInfo != null) {
canBuild.add(builderInfo.getId()); canBuild.add(builderInfo.getId());
@ -80,7 +79,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
for (RoomTile tile : this.tiles) { for (RoomTile tile : this.tiles) {
THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile); THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile);
for (RoomItem tileItem : tileItems) { for (RoomItem tileItem : tileItems) {
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) { if (canBuild.contains(tileItem.getOwnerInfo().getId()) && tileItem != this) {
room.getRoomItemManager().pickUpItem(tileItem, null); room.getRoomItemManager().pickUpItem(tileItem, null);
} }
} }
@ -103,7 +102,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
if (builder != null) { if (builder != null) {
builderInfo = builder.getHabboInfo(); builderInfo = builder.getHabboInfo();
} else { } else {
builderInfo = HabboManager.getOfflineHabboInfo(builderName); builderInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(builderName);
} }
if (builderInfo != null) { if (builderInfo != null) {
canBuild.add(builderInfo.getId()); canBuild.add(builderInfo.getId());
@ -130,7 +129,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile); THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile);
if (newTiles.contains(tile)) continue; if (newTiles.contains(tile)) continue;
for (RoomItem tileItem : tileItems) { for (RoomItem tileItem : tileItems) {
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) { if (canBuild.contains(tileItem.getOwnerInfo().getId()) && tileItem != this) {
room.getRoomItemManager().pickUpItem(tileItem, null); room.getRoomItemManager().pickUpItem(tileItem, null);
} }
} }
@ -151,10 +150,10 @@ public class InteractionBuildArea extends InteractionCustomValues {
} }
private void regenAffectedTiles(Room room) { private void regenAffectedTiles(Room room) {
int minX = Math.max(0, this.getX() - Integer.parseInt(this.values.get("tilesBack"))); int minX = Math.max(0, this.getCurrentPosition().getX() - Integer.parseInt(this.values.get("tilesBack")));
int minY = Math.max(0, this.getY() - Integer.parseInt(this.values.get("tilesRight"))); int minY = Math.max(0, this.getCurrentPosition().getY() - Integer.parseInt(this.values.get("tilesRight")));
int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(this.values.get("tilesFront"))); int maxX = Math.min(room.getLayout().getMapSizeX(), this.getCurrentPosition().getX() + Integer.parseInt(this.values.get("tilesFront")));
int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(this.values.get("tilesLeft"))); int maxY = Math.min(room.getLayout().getMapSizeY(), this.getCurrentPosition().getY() + Integer.parseInt(this.values.get("tilesLeft")));
this.tiles.clear(); this.tiles.clear();
@ -179,7 +178,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
if (builder != null) { if (builder != null) {
builderInfo = builder.getHabboInfo(); builderInfo = builder.getHabboInfo();
} else { } else {
builderInfo = HabboManager.getOfflineHabboInfo(builderName); builderInfo = Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo(builderName);
} }
if (builderInfo != null) { if (builderInfo != null) {
canBuild.add(builderInfo.getId()); canBuild.add(builderInfo.getId());
@ -188,10 +187,10 @@ public class InteractionBuildArea extends InteractionCustomValues {
THashSet<RoomTile> oldTiles = new THashSet<>(); THashSet<RoomTile> oldTiles = new THashSet<>();
int minX = Math.max(0, this.getX() - Integer.parseInt(oldValues.get("tilesBack"))); int minX = Math.max(0, this.getCurrentPosition().getX() - Integer.parseInt(oldValues.get("tilesBack")));
int minY = Math.max(0, this.getY() - Integer.parseInt(oldValues.get("tilesRight"))); int minY = Math.max(0, this.getCurrentPosition().getY() - Integer.parseInt(oldValues.get("tilesRight")));
int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(oldValues.get("tilesFront"))); int maxX = Math.min(room.getLayout().getMapSizeX(), this.getCurrentPosition().getX() + Integer.parseInt(oldValues.get("tilesFront")));
int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(oldValues.get("tilesLeft"))); int maxY = Math.min(room.getLayout().getMapSizeY(), this.getCurrentPosition().getY() + Integer.parseInt(oldValues.get("tilesLeft")));
for (int x = minX; x <= maxX; x++) { for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) { for (int y = minY; y <= maxY; y++) {
@ -204,7 +203,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
for (RoomTile tile : oldTiles) { for (RoomTile tile : oldTiles) {
THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile); THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile);
for (RoomItem tileItem : tileItems) { for (RoomItem tileItem : tileItems) {
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) { if (canBuild.contains(tileItem.getOwnerInfo().getId()) && tileItem != this) {
room.getRoomItemManager().pickUpItem(tileItem, null); room.getRoomItemManager().pickUpItem(tileItem, null);
} }
} }
@ -222,10 +221,10 @@ public class InteractionBuildArea extends InteractionCustomValues {
int id = 0; int id = 0;
for (RoomTile tile : this.tiles) { for (RoomTile tile : this.tiles) {
id--; id--;
RoomItem item = new InteractionDefault(id, -1, effectItem, "1", 0, 0); RoomItem item = new InteractionDefault(id, null, effectItem, "1", 0, 0);
item.setX(tile.getX());
item.setY(tile.getY()); item.setCurrentPosition(tile);
item.setZ(tile.relativeHeight()); item.setCurrentZ(tile.relativeHeight());
items.add(item); items.add(item);
} }

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.CannonKickAction; import com.eu.habbo.threading.runnables.CannonKickAction;
import com.eu.habbo.threading.runnables.CannonResetCooldownAction; import com.eu.habbo.threading.runnables.CannonResetCooldownAction;
@ -20,18 +21,18 @@ public class InteractionCannon extends RoomItem {
public InteractionCannon(ResultSet set, Item baseItem) throws SQLException { public InteractionCannon(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionCannon(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionCannon(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -55,7 +56,7 @@ public class InteractionCannon extends RoomItem {
if (room == null) if (room == null)
return; 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); RoomTile fuseTile = this.getRotation() >= 4 ? tile : room.getLayout().getTileInFront(tile, ((this.getRotation() % 2) + 2) % 8);
List<RoomTile> tiles = room.getLayout().getTilesAround(fuseTile); List<RoomTile> tiles = room.getLayout().getTilesAround(fuseTile);
tiles.remove(room.getLayout().getTileInFront(tile, (this.getRotation() + (this.getRotation() >= 4 ? -1 : 0)) % 8)); 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.cooldown = true;
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1"); this.setExtraData(this.getExtraData().equals("1") ? "0" : "1");
room.updateItemState(this); room.updateItemState(this);
Emulator.getThreading().run(new CannonKickAction(this, room, client), 750); Emulator.getThreading().run(new CannonKickAction(this, room, client), 750);
Emulator.getThreading().run(new CannonResetCooldownAction(this), 2000); Emulator.getThreading().run(new CannonResetCooldownAction(this), 2000);
@ -94,7 +95,7 @@ public class InteractionCannon extends RoomItem {
@Override @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
this.setExtradata("0"); this.setExtraData("0");
} }

View File

@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -14,8 +15,8 @@ public class InteractionClothing extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionClothing(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionClothing(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -15,8 +16,8 @@ public class InteractionColorPlate extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionColorPlate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionColorPlate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -36,12 +37,12 @@ public class InteractionColorPlate extends InteractionDefault {
private void change(Room room, int amount) { private void change(Room room, int amount) {
int state = 0; int state = 0;
if (this.getExtradata() == null || this.getExtradata().isEmpty()) { if (this.getExtraData() == null || this.getExtraData().isEmpty()) {
this.setExtradata("0"); this.setExtraData("0");
} }
try { try {
state = Integer.parseInt(this.getExtradata()); state = Integer.parseInt(this.getExtraData());
} catch (Exception e) { } catch (Exception e) {
log.error("Caught exception", e); log.error("Caught exception", e);
} }
@ -55,7 +56,7 @@ public class InteractionColorPlate extends InteractionDefault {
state = 0; state = 0;
} }
this.setExtradata(state + ""); this.setExtraData(state + "");
this.needsUpdate(true); this.needsUpdate(true);
room.updateItemState(this); room.updateItemState(this);
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.ItemUpdateMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.ItemUpdateMessageComposer;
import com.eu.habbo.threading.runnables.RandomDiceNumber; import com.eu.habbo.threading.runnables.RandomDiceNumber;
@ -20,14 +21,14 @@ public class InteractionColorWheel extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionColorWheel(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionColorWheel(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -49,8 +50,8 @@ public class InteractionColorWheel extends RoomItem {
if (!room.getRoomRightsManager().hasRights(client.getHabbo())) if (!room.getRoomRightsManager().hasRights(client.getHabbo()))
return; return;
if (this.rollTaks == null && !this.getExtradata().equalsIgnoreCase("-1")) { if (this.rollTaks == null && !this.getExtraData().equalsIgnoreCase("-1")) {
this.setExtradata("-1"); this.setExtraData("-1");
room.sendComposer(new ItemUpdateMessageComposer(this).compose()); room.sendComposer(new ItemUpdateMessageComposer(this).compose());
Emulator.getThreading().run(this); Emulator.getThreading().run(this);
Emulator.getThreading().run(new RandomDiceNumber(this, room, this.getBaseItem().getStateCount()), 3000); Emulator.getThreading().run(new RandomDiceNumber(this, room, this.getBaseItem().getStateCount()), 3000);

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer; import com.eu.habbo.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -13,8 +14,8 @@ public class InteractionCostumeHopper extends InteractionHopper {
super(set, baseItem); super(set, baseItem);
} }
public InteractionCostumeHopper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionCostumeHopper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -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.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; 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.habbohotel.users.subscriptions.SubscriptionHabboClub;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.CrackableExplode; import com.eu.habbo.threading.runnables.CrackableExplode;
@ -27,19 +28,19 @@ public class InteractionCrackable extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionCrackable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionCrackable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
if (this.getExtradata().length() == 0) if (this.getExtraData().length() == 0)
this.setExtradata("0"); this.setExtraData("0");
serverMessage.appendInt(7 + (this.isLimited() ? 256 : 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.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(Integer.parseInt(this.getExtraData()));
serverMessage.appendInt(Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())); serverMessage.appendInt(Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()));
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
@ -69,13 +70,13 @@ public class InteractionCrackable extends RoomItem {
if (this.cracked) if (this.cracked)
return; return;
if (this.userRequiredToBeAdjacent() && client.getHabbo().getRoomUnit().getCurrentPosition().distance(room.getLayout().getTile(this.getX(), this.getY())) > 1.5) { 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.getX(), this.getY()), Rotation.Calculate(client.getHabbo().getRoomUnit().getCurrentPosition().getX(), client.getHabbo().getRoomUnit().getCurrentPosition().getY(), this.getX(), this.getY()))); 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; return;
} }
if (this.getExtradata().length() == 0) if (this.getExtraData().length() == 0)
this.setExtradata("0"); this.setExtraData("0");
if (this.getBaseItem().getEffectF() > 0) if (this.getBaseItem().getEffectF() > 0)
if (client.getHabbo().getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() == client.getHabbo().getRoomUnit().getEffectId()) 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) { public void onTick(Habbo habbo, Room room) {
if (this.cracked) return; 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()); CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId());
if (rewardData != null) { if (rewardData != null) {
@ -102,10 +103,10 @@ public class InteractionCrackable extends RoomItem {
if(this.ticks < 1) 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. // 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.ticks++;
this.setExtradata("" + (this.ticks)); this.setExtraData("" + (this.ticks));
this.needsUpdate(true); this.needsUpdate(true);
room.updateItem(this); room.updateItem(this);
@ -114,7 +115,7 @@ public class InteractionCrackable extends RoomItem {
} }
if (!this.cracked && this.ticks == Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())) { if (!this.cracked && this.ticks == Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())) {
this.cracked = true; 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()) { if (!rewardData.getAchievementCracked().isEmpty()) {
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.getAchievementCracked())); AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.getAchievementCracked()));
@ -168,7 +169,7 @@ public class InteractionCrackable extends RoomItem {
public void reset(Room room) { public void reset(Room room) {
this.cracked = false; this.cracked = false;
this.ticks = 0; this.ticks = 0;
this.setExtradata("0"); this.setExtraData("0");
room.updateItem(this); room.updateItem(this);
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,8 +11,8 @@ public class InteractionCrackableMaster extends InteractionCrackable {
super(set, baseItem); super(set, baseItem);
} }
public InteractionCrackableMaster(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionCrackableMaster(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.ServerMessage;
import gnu.trove.map.hash.THashMap; 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<String, String> defaultValues) { public InteractionCustomValues(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells, THashMap<String, String> defaultValues) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.values.putAll(defaultValues); this.values.putAll(defaultValues);
} }
@ -52,7 +53,7 @@ public abstract class InteractionCustomValues extends RoomItem {
@Override @Override
public void run() { public void run() {
this.setExtradata(this.toExtraData()); this.setExtraData(this.toExtraData());
super.run(); super.run();
} }

View File

@ -1,6 +1,5 @@
package com.eu.habbo.habbohotel.items.interactions; 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.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.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.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.WiredEffectType;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -26,14 +22,14 @@ public class InteractionDefault extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionDefault(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionDefault(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -79,19 +75,19 @@ public class InteractionDefault extends RoomItem {
if (objects != null && objects.length > 0) { if (objects != null && objects.length > 0) {
if (objects[0] instanceof Integer) { if (objects[0] instanceof Integer) {
if (this.getExtradata().length() == 0) if (this.getExtraData().length() == 0)
this.setExtradata("0"); this.setExtraData("0");
if (this.getBaseItem().getStateCount() > 0) { if (this.getBaseItem().getStateCount() > 0) {
int currentState = 0; int currentState = 0;
try { try {
currentState = Integer.parseInt(this.getExtradata()); currentState = Integer.parseInt(this.getExtraData());
} catch (NumberFormatException e) { } 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); this.needsUpdate(true);
room.updateItemState(this); room.updateItemState(this);
@ -109,115 +105,11 @@ public class InteractionDefault extends RoomItem {
@Override @Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects); 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 @Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOff(roomUnit, room, objects); 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) { public boolean canToggle(Habbo habbo, Room room) {
@ -227,7 +119,7 @@ public class InteractionDefault extends RoomItem {
RoomItem rentSpace = room.getRoomItemManager().getRoomItemById(habbo.getHabboStats().getRentedItemId()); 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()));
} }

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.plugin.events.furniture.FurnitureDiceRolledEvent; import com.eu.habbo.plugin.events.furniture.FurnitureDiceRolledEvent;
import com.eu.habbo.threading.runnables.RandomDiceNumber; import com.eu.habbo.threading.runnables.RandomDiceNumber;
@ -15,8 +16,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionDice extends RoomItem { public class InteractionDice extends RoomItem {
public InteractionDice(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionDice(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
public InteractionDice(ResultSet set, Item baseItem) throws SQLException { public InteractionDice(ResultSet set, Item baseItem) throws SQLException {
@ -26,7 +27,7 @@ public class InteractionDice extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -46,14 +47,14 @@ public class InteractionDice extends RoomItem {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if (client != null) { if (client != null) {
if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) { if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) {
if (!this.getExtradata().equalsIgnoreCase("-1")) { if (!this.getExtraData().equalsIgnoreCase("-1")) {
FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1)); FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1));
if (event.isCancelled()) if (event.isCancelled())
return; return;
this.setExtradata("-1"); this.setExtraData("-1");
room.updateItemState(this); room.updateItemState(this);
Emulator.getThreading().run(this); Emulator.getThreading().run(this);
@ -74,7 +75,7 @@ public class InteractionDice extends RoomItem {
@Override @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override

View File

@ -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.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; 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 com.eu.habbo.threading.runnables.CloseGate;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -29,12 +30,12 @@ public class InteractionEffectGate extends InteractionDefault implements Conditi
public InteractionEffectGate(ResultSet set, Item baseItem) throws SQLException { public InteractionEffectGate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionEffectGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionEffectGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
@ -61,7 +62,7 @@ public class InteractionEffectGate extends InteractionDefault implements Conditi
super.onWalkOn(roomUnit, room, objects); super.onWalkOn(roomUnit, room, objects);
if (this.canWalkOn(roomUnit, room, objects)) { if (this.canWalkOn(roomUnit, room, objects)) {
this.setExtradata("1"); this.setExtraData("1");
room.updateItemState(this); room.updateItemState(this);
} }
} }

View File

@ -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.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -15,28 +16,28 @@ import java.sql.SQLException;
public class InteractionEffectGiver extends InteractionDefault { public class InteractionEffectGiver extends InteractionDefault {
public InteractionEffectGiver(ResultSet set, Item baseItem) throws SQLException { public InteractionEffectGiver(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionEffectGiver(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionEffectGiver(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects); super.onClick(client, room, objects);
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())) ||
(client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getY())) { (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getCurrentPosition().getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getCurrentPosition().getY())) {
this.handle(room, client.getHabbo().getRoomUnit()); this.handle(room, client.getHabbo().getRoomUnit());
} }
} }
protected void handle(Room room, RoomUnit roomUnit) { 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; RoomItem instance = this;
@ -45,11 +46,11 @@ public class InteractionEffectGiver extends InteractionDefault {
} }
if (this.getBaseItem().getStateCount() > 1) { if (this.getBaseItem().getStateCount() > 1) {
this.setExtradata("1"); this.setExtraData("1");
room.updateItem(this); room.updateItem(this);
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
InteractionEffectGiver.this.setExtradata("0"); InteractionEffectGiver.this.setExtraData("0");
room.updateItem(instance); room.updateItem(instance);
}, 500); }, 500);
} }

View File

@ -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.rooms.entities.units.types.RoomAvatar;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; 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.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
@ -20,8 +21,8 @@ public class InteractionEffectTile extends InteractionPressurePlate {
super(set, baseItem); super(set, baseItem);
} }
public InteractionEffectTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionEffectTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -13,19 +14,19 @@ public class InteractionEffectToggle extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionEffectToggle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionEffectToggle(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
if (this.getExtradata().isEmpty()) { if (this.getExtraData().isEmpty()) {
this.setExtradata("0"); this.setExtraData("0");
} }
if (client != null) { if (client != null) {
if (room.getRoomRightsManager().hasRights(client.getHabbo())) { 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()) || 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())) { (client.getHabbo().getHabboInfo().getGender() == HabboGender.F && client.getHabbo().getRoomUnit().getEffectId() == this.getBaseItem().getEffectF())) {
super.onClick(client, room, objects); super.onClick(client, room, objects);

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,12 +11,12 @@ import java.sql.SQLException;
public class InteractionEffectVendingMachine extends InteractionVendingMachine { public class InteractionEffectVendingMachine extends InteractionVendingMachine {
public InteractionEffectVendingMachine(ResultSet set, Item baseItem) throws SQLException { public InteractionEffectVendingMachine(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionEffectVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionEffectVendingMachine(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
import com.eu.habbo.habbohotel.users.HabboInfo;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -12,12 +13,12 @@ import java.sql.SQLException;
public class InteractionEffectVendingMachineNoSides extends InteractionVendingMachine { public class InteractionEffectVendingMachineNoSides extends InteractionVendingMachine {
public InteractionEffectVendingMachineNoSides(ResultSet set, Item baseItem) throws SQLException { public InteractionEffectVendingMachineNoSides(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionEffectVendingMachineNoSides(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionEffectVendingMachineNoSides(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
@ -31,7 +32,7 @@ public class InteractionEffectVendingMachineNoSides extends InteractionVendingMa
THashSet<RoomTile> tiles = new THashSet<>(); THashSet<RoomTile> tiles = new THashSet<>();
for(int x = -1; x <= 1; x++) { for(int x = -1; x <= 1; x++) {
for(int y = -1; y <= 1; y++) { 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) { if(tile != null) {
tiles.add(tile); tiles.add(tile);
} }

View File

@ -3,8 +3,9 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -15,8 +16,8 @@ public class InteractionExternalImage extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionExternalImage(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionExternalImage(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -37,7 +38,7 @@ public class InteractionExternalImage extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.users.HabboGender; 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.messages.outgoing.rooms.items.RemoveFloorItemComposer;
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
@ -18,15 +19,15 @@ public class InteractionFXBox extends InteractionDefault {
// this.setExtradata("0"); // this.setExtradata("0");
} }
public InteractionFXBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionFXBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
// this.setExtradata("0"); // this.setExtradata("0");
} }
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) { public void onClick(GameClient client, Room room, Object[] objects) {
if (client != null && this.getOwnerId() == client.getHabbo().getHabboInfo().getId()) { if (client != null && this.getOwnerInfo().getId() == client.getHabbo().getHabboInfo().getId()) {
if(this.getExtradata().equals("1")) if (this.getExtraData().equals("1"))
return; return;
int effectId = -1; int effectId = -1;
@ -43,23 +44,23 @@ public class InteractionFXBox extends InteractionDefault {
} }
} }
if(effectId < 0) if (effectId < 0)
return; return;
if(client.getHabbo().getInventory().getEffectsComponent().ownsEffect(effectId)) if (client.getHabbo().getInventory().getEffectsComponent().ownsEffect(effectId))
return; return;
client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0); client.getHabbo().getInventory().getEffectsComponent().createEffect(effectId, 0);
client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId); client.getHabbo().getInventory().getEffectsComponent().enableEffect(effectId);
this.setExtradata("1"); this.setExtraData("1");
room.updateItemState(this); room.updateItemState(this);
room.getRoomItemManager().removeRoomItem(this); room.getRoomItemManager().removeRoomItem(this);
RoomItem item = this; RoomItem item = this;
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
new QueryDeleteHabboItem(item.getId()).run(); new QueryDeleteHabboItem(item.getId()).run();
room.sendComposer(new RemoveFloorItemComposer(item).compose()); 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); }, 500);
} }
} }

View File

@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; 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.WiredEffectType;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -30,8 +31,8 @@ public class InteractionFireworks extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionFireworks(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionFireworks(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -53,10 +54,10 @@ public class InteractionFireworks extends InteractionDefault {
// Wireds can always detonate fireworks if charged // Wireds can always detonate fireworks if charged
if (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE) { 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); super.onClick(client, room, objects);
if (this.getExtradata().equalsIgnoreCase(STATE_EXPLOSION)) { if (this.getExtraData().equalsIgnoreCase(STATE_EXPLOSION)) {
this.reCharge(room); 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 // Habbos without rights have to walk to an adjecent tile to be able to detonate the fireworks
if (!this.canToggle(client.getHabbo(), room)) { if (!this.canToggle(client.getHabbo(), room)) {
RoomTile closestTile = null; 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()))) { if (tile.isWalkable() && (closestTile == null || closestTile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()) > tile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()))) {
closestTile = tile; 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); super.onClick(client, room, objects);
if (this.getExtradata().equalsIgnoreCase(STATE_EXPLOSION)) if (this.getExtraData().equalsIgnoreCase(STATE_EXPLOSION))
{ {
this.reCharge(room); this.reCharge(room);
AchievementManager.progressAchievement(client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("FireworksCharger")); AchievementManager.progressAchievement(client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("FireworksCharger"));
@ -110,13 +111,13 @@ public class InteractionFireworks extends InteractionDefault {
@Override @Override
public void onPlace(Room room) { public void onPlace(Room room) {
super.onPlace(room); super.onPlace(room);
this.setExtradata(STATE_CHARGED); this.setExtraData(STATE_CHARGED);
} }
@Override @Override
public boolean canToggle(Habbo habbo, Room room) { public boolean canToggle(Habbo habbo, Room room) {
return room.getRoomRightsManager().hasRights(habbo) || RoomLayout.tilesAdjecent( 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() habbo.getRoomUnit().getCurrentPosition()
); );
} }
@ -133,7 +134,7 @@ public class InteractionFireworks extends InteractionDefault {
} }
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
this.setExtradata(STATE_CHARGED); this.setExtraData(STATE_CHARGED);
this.needsUpdate(true); this.needsUpdate(true);
room.updateItemState(this); room.updateItemState(this);
}, explodeDuration); }, explodeDuration);

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
@ -17,14 +18,14 @@ public class InteractionGate extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -34,7 +35,7 @@ public class InteractionGate extends RoomItem {
} }
public boolean isWalkable() { public boolean isWalkable() {
return this.getExtradata().equals("1"); return this.getExtraData().equals("1");
} }
@Override @Override
@ -44,16 +45,16 @@ public class InteractionGate extends RoomItem {
if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !executedByWired) return; 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 // 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)) if (room.getRoomUnitManager().hasHabbosAt(tile))
return; return;
// Gate closed = 0, open = 1 // Gate closed = 0, open = 1
if (this.getExtradata().length() == 0) if (this.getExtraData().length() == 0)
this.setExtradata("0"); this.setExtraData("0");
this.setExtradata((Integer.parseInt(this.getExtradata()) + 1) % 2 + ""); this.setExtraData((Integer.parseInt(this.getExtraData()) + 1) % 2 + "");
room.updateTile(room.getLayout().getTile(this.getX(), this.getY())); room.updateTile(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()));
this.needsUpdate(true); this.needsUpdate(true);
room.updateItemState(this); room.updateItemState(this);

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j; 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) { public InteractionGift(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
try { try {
this.loadData(); this.loadData();
@ -91,8 +92,8 @@ public class InteractionGift extends RoomItem {
private void loadData() throws NumberFormatException { private void loadData() throws NumberFormatException {
String[] data = null; String[] data = null;
if (this.getExtradata().contains("\t")) if (this.getExtraData().contains("\t"))
data = this.getExtradata().split("\t"); data = this.getExtraData().split("\t");
if (data != null && data.length >= 5) { if (data != null && data.length >= 5) {
int count = Integer.parseInt(data[0]); int count = Integer.parseInt(data[0]);

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,8 +11,8 @@ public class InteractionGroupEffectTile extends InteractionEffectTile {
super(set, baseItem); super(set, baseItem);
} }
public InteractionGroupEffectTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionGroupEffectTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,8 +11,8 @@ public class InteractionGroupPressurePlate extends InteractionPressurePlate {
super(set, baseItem); super(set, baseItem);
} }
public InteractionGroupPressurePlate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionGroupPressurePlate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; 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.ServerMessage;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
@ -23,8 +24,8 @@ public class InteractionGuildFurni extends InteractionDefault {
this.guildId = set.getInt("guild_id"); this.guildId = set.getInt("guild_id");
} }
public InteractionGuildFurni(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionGuildFurni(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.guildId = 0; this.guildId = 0;
} }
@ -43,14 +44,14 @@ public class InteractionGuildFurni extends InteractionDefault {
if (guild != null) { if (guild != null) {
serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0));
serverMessage.appendInt(5); serverMessage.appendInt(5);
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
serverMessage.appendString(guild.getId() + ""); serverMessage.appendString(guild.getId() + "");
serverMessage.appendString(guild.getBadge()); serverMessage.appendString(guild.getBadge());
serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getSymbolColor(guild.getColorOne()).getValueA()); serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getSymbolColor(guild.getColorOne()).getValueA());
serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getBackgroundColor(guild.getColorTwo()).getValueA()); serverMessage.appendString(Emulator.getGameEnvironment().getGuildManager().getBackgroundColor(guild.getColorTwo()).getValueA());
} else { } else {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
} }
if (this.isLimited()) { if (this.isLimited()) {

View File

@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.threading.runnables.CloseGate; import com.eu.habbo.threading.runnables.CloseGate;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -17,12 +18,12 @@ import java.sql.SQLException;
public class InteractionGuildGate extends InteractionGuildFurni implements ConditionalGate { public class InteractionGuildGate extends InteractionGuildFurni implements ConditionalGate {
public InteractionGuildGate(ResultSet set, Item baseItem) throws SQLException { public InteractionGuildGate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionGuildGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionGuildGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
@ -45,7 +46,7 @@ public class InteractionGuildGate extends InteractionGuildFurni implements Condi
super.onWalkOn(roomUnit, room, objects); super.onWalkOn(roomUnit, room, objects);
if (this.canWalkOn(roomUnit, room, objects)) { if (this.canWalkOn(roomUnit, room, objects)) {
this.setExtradata("1"); this.setExtraData("1");
room.updateItemState(this); room.updateItemState(this);
} }
} }
@ -59,7 +60,7 @@ public class InteractionGuildGate extends InteractionGuildFurni implements Condi
@Override @Override
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) { public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
this.setExtradata("0"); this.setExtraData("0");
room.updateItemState(this); room.updateItemState(this);
} }

View File

@ -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.rooms.entities.units.types.RoomAvatar;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -25,8 +26,8 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC
super(set, baseItem); super(set, baseItem);
} }
public InteractionGymEquipment(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionGymEquipment(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -66,9 +67,9 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC
this.reset(room); this.reset(room);
if (roomUnit != null) { if (roomUnit instanceof RoomAvatar roomAvatar) {
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomAvatar);
RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY()); RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomAvatar.getCurrentPosition().getX(), roomAvatar.getCurrentPosition().getY());
int nextEffectM = 0; int nextEffectM = 0;
int nextEffectF = 0; int nextEffectF = 0;
int nextEffectDuration = -1; int nextEffectDuration = -1;
@ -76,23 +77,23 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC
if (topItem != null) { if (topItem != null) {
nextEffectM = topItem.getBaseItem().getEffectM(); nextEffectM = topItem.getBaseItem().getEffectM();
nextEffectF = topItem.getBaseItem().getEffectF(); nextEffectF = topItem.getBaseItem().getEffectF();
} else if (roomUnit.getPreviousEffectId() > 0) { } else if (roomAvatar.getPreviousEffectId() > 0) {
nextEffectF = roomUnit.getPreviousEffectId(); nextEffectF = roomAvatar.getPreviousEffectId();
nextEffectM = roomUnit.getPreviousEffectId(); nextEffectM = roomAvatar.getPreviousEffectId();
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp(); nextEffectDuration = roomAvatar.getPreviousEffectEndTimestamp();
} }
if (this.forceRotation()) { if (this.forceRotation()) {
roomUnit.setCanRotate(true); roomAvatar.setCanRotate(true);
} }
if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) { if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) {
habbo.getRoomUnit().giveEffect(nextEffectM, nextEffectDuration, true); roomAvatar.giveEffect(nextEffectM, nextEffectDuration, true);
return; return;
} }
if (habbo.getHabboInfo().getGender().equals(HabboGender.F)) { 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) { private void reset(Room room) {
this.roomUnitId = -1; this.roomUnitId = -1;
this.startTime = 0; this.startTime = 0;
this.setExtradata("0"); this.setExtraData("0");
room.updateItem(this); room.updateItem(this);
} }

View File

@ -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.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; 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 com.eu.habbo.messages.outgoing.rooms.users.CarryObjectMessageComposer;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -18,24 +19,24 @@ public class InteractionHanditem extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionHanditem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionHanditem(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects); super.onClick(client, room, objects);
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())) ||
(client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getY())) { (client.getHabbo().getRoomUnit().getCurrentPosition().getX() == this.getCurrentPosition().getX() && client.getHabbo().getRoomUnit().getCurrentPosition().getY() == this.getCurrentPosition().getY())) {
this.handle(room, client.getHabbo().getRoomUnit()); this.handle(room, client.getHabbo().getRoomUnit());
} }
} }
protected void handle(Room room, RoomUnit roomUnit) { 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)) { if(!(roomUnit instanceof RoomAvatar roomAvatar)) {
return; return;
@ -46,11 +47,11 @@ public class InteractionHanditem extends InteractionDefault {
room.sendComposer(new CarryObjectMessageComposer(roomAvatar).compose()); room.sendComposer(new CarryObjectMessageComposer(roomAvatar).compose());
if (this.getBaseItem().getStateCount() > 1) { if (this.getBaseItem().getStateCount() > 1) {
this.setExtradata("1"); this.setExtraData("1");
room.updateItem(this); room.updateItem(this);
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
InteractionHanditem.this.setExtradata("0"); InteractionHanditem.this.setExtraData("0");
room.updateItem(instance); room.updateItem(instance);
}, 500); }, 500);
} }

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -13,15 +14,15 @@ public class InteractionHanditemTile extends InteractionHanditem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionHanditemTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionHanditemTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
InteractionHanditemTile instance = this; InteractionHanditemTile instance = this;
Emulator.getThreading().run(() -> { 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); instance.handle(room, roomUnit);
} }
}, 3000); }, 3000);

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.hopper.HopperActionOne; import com.eu.habbo.threading.runnables.hopper.HopperActionOne;
@ -16,18 +17,18 @@ import java.sql.SQLException;
public class InteractionHopper extends RoomItem { public class InteractionHopper extends RoomItem {
public InteractionHopper(ResultSet set, Item baseItem) throws SQLException { public InteractionHopper(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionHopper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionHopper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -56,7 +57,7 @@ public class InteractionHopper extends RoomItem {
if (loc != null) { if (loc != null) {
if (this.canUseTeleport(client, loc, room)) { if (this.canUseTeleport(client, loc, room)) {
client.getHabbo().getRoomUnit().setTeleporting(true); client.getHabbo().getRoomUnit().setTeleporting(true);
this.setExtradata("1"); this.setExtraData("1");
room.updateItemState(this); room.updateItemState(this);
Emulator.getThreading().run(new HopperActionOne(this, room, client), 500); Emulator.getThreading().run(new HopperActionOne(this, room, client), 500);
@ -69,13 +70,13 @@ public class InteractionHopper extends RoomItem {
@Override @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
public void run() { public void run() {
if (!this.getExtradata().equals("0")) { if (!this.getExtraData().equals("0")) {
this.setExtradata("0"); this.setExtraData("0");
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId());
if (room != null) { if (room != null) {
@ -95,7 +96,7 @@ public class InteractionHopper extends RoomItem {
if (client.getHabbo().getRoomUnit().isTeleporting()) if (client.getHabbo().getRoomUnit().isTeleporting())
return false; 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) { if(tile == null) {
return false; return false;
@ -104,6 +105,6 @@ public class InteractionHopper extends RoomItem {
if (room.getRoomUnitManager().hasHabbosAt(tile)) if (room.getRoomUnitManager().hasHabbosAt(tile))
return false; return false;
return this.getExtradata().equals("0"); return this.getExtraData().equals("0");
} }
} }

View File

@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.outgoing.habboway.nux.InClientLinkMessageComposer; import com.eu.habbo.messages.outgoing.habboway.nux.InClientLinkMessageComposer;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
@ -22,8 +23,8 @@ public class InteractionInformationTerminal extends InteractionCustomValues {
super(set, baseItem, defaultValues); super(set, baseItem, defaultValues);
} }
public InteractionInformationTerminal(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionInformationTerminal(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues);
} }
@Override @Override

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -15,14 +16,14 @@ public class InteractionJukeBox extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionJukeBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionJukeBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -60,7 +61,7 @@ public class InteractionJukeBox extends RoomItem {
@Override @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
super.onPickUp(room); super.onPickUp(room);
this.setExtradata("0"); this.setExtraData("0");
room.getRoomTraxManager().removeTraxOnRoom(this); room.getRoomTraxManager().removeTraxOnRoom(this);
} }
@ -69,7 +70,7 @@ public class InteractionJukeBox extends RoomItem {
super.onPlace(room); super.onPlace(room);
room.getRoomTraxManager().addTraxOnRoom(this); room.getRoomTraxManager().addTraxOnRoom(this);
if (room.getRoomTraxManager().isPlaying()) { if (room.getRoomTraxManager().isPlaying()) {
this.setExtradata("1"); this.setExtraData("1");
} }
} }
} }

View File

@ -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.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; 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.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.lovelock.FriendFurniStartConfirmationMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.lovelock.FriendFurniStartConfirmationMessageComposer;
@ -24,8 +25,8 @@ public class InteractionLoveLock extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionLoveLock(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionLoveLock(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -33,7 +34,7 @@ public class InteractionLoveLock extends RoomItem {
serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(2 + (this.isLimited() ? 256 : 0));
serverMessage.appendInt(6); serverMessage.appendInt(6);
String[] data = this.getExtradata().split("\t"); String[] data = this.getExtraData().split("\t");
if (data.length == 6) { if (data.length == 6) {
serverMessage.appendString("1"); serverMessage.appendString("1");
@ -71,13 +72,13 @@ public class InteractionLoveLock extends RoomItem {
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) { public void onClick(GameClient client, Room room, Object[] objects) {
if (this.getExtradata().contains("\t")) if (this.getExtraData().contains("\t"))
return; return;
if (client == null) if (client == null)
return; 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) { if (this.userOneId == 0) {
this.userOneId = client.getHabbo().getHabboInfo().getId(); this.userOneId = client.getHabbo().getHabboInfo().getId();
client.sendResponse(new FriendFurniStartConfirmationMessageComposer(this)); client.sendResponse(new FriendFurniStartConfirmationMessageComposer(this));
@ -95,7 +96,7 @@ public class InteractionLoveLock extends RoomItem {
} }
public boolean lock(Habbo userOne, Habbo userTwo, Room room) { 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)) { if (RoomLayout.tilesAdjecent(userOne.getRoomUnit().getCurrentPosition(), tile) && RoomLayout.tilesAdjecent(userTwo.getRoomUnit().getCurrentPosition(), tile)) {
String data = "1"; String data = "1";
data += "\t"; data += "\t";
@ -109,7 +110,7 @@ public class InteractionLoveLock extends RoomItem {
data += "\t"; data += "\t";
data += Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR); 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); this.needsUpdate(true);
Emulator.getThreading().run(this); Emulator.getThreading().run(this);
room.updateItem(this); room.updateItem(this);

View File

@ -4,8 +4,9 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.habbohotel.users.clothingvalidation.ClothingValidationManager;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer; import com.eu.habbo.messages.outgoing.rooms.users.UserChangeMessageComposer;
@ -19,8 +20,8 @@ public class InteractionMannequin extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionMannequin(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionMannequin(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -32,8 +33,8 @@ public class InteractionMannequin extends RoomItem {
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0));
serverMessage.appendInt(3); serverMessage.appendInt(3);
if (this.getExtradata().split(":").length >= 2) { if (this.getExtraData().split(":").length >= 2) {
String[] data = this.getExtradata().split(":"); String[] data = this.getExtraData().split(":");
serverMessage.appendString("GENDER"); serverMessage.appendString("GENDER");
serverMessage.appendString(data[0].toLowerCase()); serverMessage.appendString(data[0].toLowerCase());
serverMessage.appendString("FIGURE"); serverMessage.appendString("FIGURE");
@ -47,7 +48,7 @@ public class InteractionMannequin extends RoomItem {
serverMessage.appendString(""); serverMessage.appendString("");
serverMessage.appendString("OUTFIT_NAME"); serverMessage.appendString("OUTFIT_NAME");
serverMessage.appendString("My Look"); serverMessage.appendString("My Look");
this.setExtradata("m: :My look"); this.setExtraData("m: :My look");
this.needsUpdate(true); this.needsUpdate(true);
Emulator.getThreading().run(this); Emulator.getThreading().run(this);
} }
@ -66,7 +67,7 @@ public class InteractionMannequin extends RoomItem {
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) { public void onClick(GameClient client, Room room, Object[] objects) {
String[] data = this.getExtradata().split(":"); String[] data = this.getExtraData().split(":");
if(data.length < 2) if(data.length < 2)
return; return;

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.ICycleable;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -18,8 +19,8 @@ public class InteractionMonsterCrackable extends InteractionCrackable implements
super(set, baseItem); super(set, baseItem);
} }
public InteractionMonsterCrackable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionMonsterCrackable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -46,9 +47,10 @@ public class InteractionMonsterCrackable extends InteractionCrackable implements
@Override @Override
public void reset(Room room) { public void reset(Room room) {
RoomTile tile = room.getRandomWalkableTile(); RoomTile tile = room.getRandomWalkableTile();
this.setX(tile.getX());
this.setY(tile.getY()); this.setCurrentPosition(tile);
this.setZ(room.getStackHeight(tile.getX(), tile.getY(), false)); this.setCurrentZ(room.getStackHeight(tile.getX(), tile.getY(), false));
super.reset(room); super.reset(room);
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomMoodlightData; import com.eu.habbo.habbohotel.rooms.RoomMoodlightData;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.map.TIntObjectMap; import gnu.trove.map.TIntObjectMap;
@ -17,14 +18,14 @@ public class InteractionMoodLight extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionMoodLight(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionMoodLight(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -49,7 +50,7 @@ public class InteractionMoodLight extends RoomItem {
if (room != null) { if (room != null) {
for (RoomMoodlightData data : ((TIntObjectMap<RoomMoodlightData>) room.getRoomInfo().getMoodLightData()).valueCollection()) { for (RoomMoodlightData data : ((TIntObjectMap<RoomMoodlightData>) room.getRoomInfo().getMoodLightData()).valueCollection()) {
if (data.isEnabled()) { if (data.isEnabled()) {
this.setExtradata(data.toString()); this.setExtraData(data.toString());
this.needsUpdate(true); this.needsUpdate(true);
room.updateItem(this); room.updateItem(this);
Emulator.getThreading().run(this); Emulator.getThreading().run(this);

View File

@ -7,9 +7,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType; import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
@ -19,8 +17,8 @@ import java.sql.SQLException;
import java.util.Collection; import java.util.Collection;
public class InteractionMultiHeight extends RoomItem { public class InteractionMultiHeight extends RoomItem {
public InteractionMultiHeight(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionMultiHeight(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
public InteractionMultiHeight(ResultSet set, Item baseItem) throws SQLException { public InteractionMultiHeight(ResultSet set, Item baseItem) throws SQLException {
@ -30,7 +28,7 @@ public class InteractionMultiHeight extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -49,42 +47,47 @@ public class InteractionMultiHeight extends RoomItem {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects); 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; return;
}
if (objects.length <= 0) { if (objects.length == 0) {
return; return;
} }
if (objects[0] instanceof Integer && room != null) { 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 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; return;
} }
this.needsUpdate(true); this.needsUpdate(true);
if (this.getExtradata().length() == 0) if (this.getExtraData().length() == 0) {
this.setExtradata("0"); this.setExtraData("0");
}
if (this.getBaseItem().getMultiHeights().length > 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); 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); room.updateItemState(this);
} }
} }
} }
public void updateUnitsOnItem(Room room) { public void updateUnitsOnItem(Room room) {
THashSet<RoomTile> occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); THashSet<RoomTile> 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) { for(RoomTile tile : occupiedTiles) {
Collection<RoomUnit> unitsOnItem = room.getRoomUnitManager().getRoomUnitsAt(room.getLayout().getTile(tile.getX(), tile.getY())); Collection<RoomUnit> unitsOnItem = room.getRoomUnitManager().getRoomUnitsAt(room.getLayout().getTile(tile.getX(), tile.getY()));
for (RoomUnit unit : unitsOnItem) { for (RoomUnit unit : unitsOnItem) {
if (unit.hasStatus(RoomUnitStatus.MOVE) && unit.getGoalLocation() != tile) { if (unit.hasStatus(RoomUnitStatus.MOVE)) {
continue; if (unit.getTargetPosition() != tile) {
continue;
}
} }
if (this.getBaseItem().allowSit() || unit.hasStatus(RoomUnitStatus.SIT)) { if (this.getBaseItem().allowSit() || unit.hasStatus(RoomUnitStatus.SIT)) {
@ -92,8 +95,6 @@ public class InteractionMultiHeight extends RoomItem {
unit.setStatusUpdateNeeded(true); unit.setStatusUpdateNeeded(true);
} else { } else {
unit.setCurrentZ(unit.getCurrentPosition().getStackHeight()); unit.setCurrentZ(unit.getCurrentPosition().getStackHeight());
unit.setPreviousLocationZ(unit.getCurrentZ());
unit.setStatusUpdateNeeded(true);
} }
} }
} }
@ -107,45 +108,11 @@ public class InteractionMultiHeight extends RoomItem {
@Override @Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects); 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 @Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOff(roomUnit, room, objects); 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 @Override

View File

@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -18,7 +19,7 @@ public class InteractionMusicDisc extends RoomItem {
public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException { public InteractionMusicDisc(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
String[] stuff = this.getExtradata().split("\n"); String[] stuff = this.getExtraData().split("\n");
if (stuff.length >= 7 && !stuff[6].isEmpty()) { if (stuff.length >= 7 && !stuff[6].isEmpty()) {
try { try {
@ -29,10 +30,10 @@ public class InteractionMusicDisc extends RoomItem {
} }
} }
public InteractionMusicDisc(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionMusicDisc(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, 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()) { if (stuff.length >= 7 && !stuff[6].isEmpty()) {
try { try {
@ -46,7 +47,7 @@ public class InteractionMusicDisc extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState; import com.eu.habbo.habbohotel.rooms.RoomTileState;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.outgoing.rooms.items.ObjectDataUpdateMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.ObjectDataUpdateMessageComposer;
import com.eu.habbo.messages.outgoing.rooms.items.ObjectsMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.ObjectsMessageComposer;
@ -39,8 +40,8 @@ public class InteractionMuteArea extends InteractionCustomValues {
tiles = new THashSet<>(); tiles = new THashSet<>();
} }
public InteractionMuteArea(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionMuteArea(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues);
tiles = new THashSet<>(); tiles = new THashSet<>();
} }
@ -96,10 +97,10 @@ public class InteractionMuteArea extends InteractionCustomValues {
} }
private void regenAffectedTiles(Room room) { private void regenAffectedTiles(Room room) {
int minX = Math.max(0, this.getX() - Integer.parseInt(this.values.get("tilesBack"))); int minX = Math.max(0, this.getCurrentPosition().getX() - Integer.parseInt(this.values.get("tilesBack")));
int minY = Math.max(0, this.getY() - Integer.parseInt(this.values.get("tilesRight"))); int minY = Math.max(0, this.getCurrentPosition().getY() - Integer.parseInt(this.values.get("tilesRight")));
int maxX = Math.min(room.getLayout().getMapSizeX(), this.getX() + Integer.parseInt(this.values.get("tilesFront"))); int maxX = Math.min(room.getLayout().getMapSizeX(), this.getCurrentPosition().getX() + Integer.parseInt(this.values.get("tilesFront")));
int maxY = Math.min(room.getLayout().getMapSizeY(), this.getY() + Integer.parseInt(this.values.get("tilesLeft"))); int maxY = Math.min(room.getLayout().getMapSizeY(), this.getCurrentPosition().getY() + Integer.parseInt(this.values.get("tilesLeft")));
this.tiles.clear(); this.tiles.clear();
@ -129,10 +130,10 @@ public class InteractionMuteArea extends InteractionCustomValues {
int id = 0; int id = 0;
for(RoomTile tile : this.tiles) { for(RoomTile tile : this.tiles) {
id--; id--;
RoomItem item = new InteractionDefault(id, -1, effectItem, "1", 0, 0); RoomItem item = new InteractionDefault(id, null, effectItem, "1", 0, 0);
item.setX(tile.getX());
item.setY(tile.getY()); item.setCurrentPosition(tile);
item.setZ(tile.relativeHeight()); item.setCurrentZ(tile.relativeHeight());
items.add(item); items.add(item);
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.users.HabboInfo;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -13,8 +14,8 @@ public class InteractionNoSidesVendingMachine extends InteractionVendingMachine
super(set, baseItem); super(set, baseItem);
} }
public InteractionNoSidesVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionNoSidesVendingMachine(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -23,7 +24,7 @@ public class InteractionNoSidesVendingMachine extends InteractionVendingMachine
THashSet<RoomTile> tiles = new THashSet<>(); THashSet<RoomTile> tiles = new THashSet<>();
for(int x = -1; x <= 1; x++) { for(int x = -1; x <= 1; x++) {
for(int y = -1; y <= 1; y++) { 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) { if(tile != null) {
tiles.add(tile); tiles.add(tile);
} }

View File

@ -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.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; 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.ServerMessage;
import gnu.trove.set.hash.THashSet; 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 { public InteractionObstacle(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
this.middleTiles = new THashSet<>(); this.middleTiles = new THashSet<>();
} }
public InteractionObstacle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionObstacle(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
this.middleTiles = new THashSet<>(); this.middleTiles = new THashSet<>();
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -155,12 +156,12 @@ public class InteractionObstacle extends RoomItem implements ICycleable {
middleTiles.clear(); middleTiles.clear();
if(this.getRotation() == 2) { if(this.getRotation() == 2) {
middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), this.getY())); middleTiles.add(room.getLayout().getTile((short)(this.getCurrentPosition().getX() + 1), this.getCurrentPosition().getY()));
middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), (short)(this.getY() + 1))); middleTiles.add(room.getLayout().getTile((short)(this.getCurrentPosition().getX() + 1), (short)(this.getCurrentPosition().getY() + 1)));
} }
else if(this.getRotation() == 4) { else if(this.getRotation() == 4) {
middleTiles.add(room.getLayout().getTile(this.getX(), (short)(this.getY() + 1))); middleTiles.add(room.getLayout().getTile(this.getCurrentPosition().getX(), (short)(this.getCurrentPosition().getY() + 1)));
middleTiles.add(room.getLayout().getTile((short)(this.getX() + 1), (short)(this.getY() + 1))); middleTiles.add(room.getLayout().getTile((short)(this.getCurrentPosition().getX() + 1), (short)(this.getCurrentPosition().getY() + 1)));
} }
} }

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
@ -23,12 +24,12 @@ public class InteractionOneWayGate extends RoomItem {
public InteractionOneWayGate(ResultSet set, Item baseItem) throws SQLException { public InteractionOneWayGate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionOneWayGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionOneWayGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
@ -48,13 +49,13 @@ public class InteractionOneWayGate extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
if (this.getExtradata().length() == 0) { if (this.getExtraData().length() == 0) {
this.setExtradata("0"); this.setExtraData("0");
this.needsUpdate(true); this.needsUpdate(true);
} }
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -64,11 +65,11 @@ public class InteractionOneWayGate extends RoomItem {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if (client != null) { 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) if (tileInfront == null)
return; return;
RoomTile currentLocation = room.getLayout().getTile(this.getX(), this.getY()); RoomTile currentLocation = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
if (currentLocation == null) if (currentLocation == null)
return; return;
@ -83,7 +84,7 @@ public class InteractionOneWayGate extends RoomItem {
onSuccess.add(() -> { onSuccess.add(() -> {
unit.setCanLeaveRoomByDoor(false); unit.setCanLeaveRoomByDoor(false);
walkable = this.getBaseItem().allowWalk(); 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); unit.setGoalLocation(tile);
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onFail, onFail)); Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onFail, onFail));
@ -122,14 +123,14 @@ public class InteractionOneWayGate extends RoomItem {
} }
private void refresh(Room room) { private void refresh(Room room) {
this.setExtradata("0"); this.setExtraData("0");
room.sendComposer(new DiceValueMessageComposer(this.getId(), 0).compose()); 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 @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
this.setExtradata("0"); this.setExtraData("0");
this.refresh(room); this.refresh(room);
} }

View File

@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -16,8 +17,8 @@ public class InteractionPostIt extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionPostIt(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionPostIt(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -38,7 +39,7 @@ public class InteractionPostIt extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata().replace(((char) 9) + "", "")); serverMessage.appendString(this.getExtraData().replace(((char) 9) + "", ""));
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }

View File

@ -2,16 +2,17 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionPoster extends RoomItem { public class InteractionPoster extends RoomItem {
public InteractionPoster(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionPoster(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
public InteractionPoster(ResultSet set, Item baseItem) throws SQLException { public InteractionPoster(ResultSet set, Item baseItem) throws SQLException {
@ -36,7 +37,7 @@ public class InteractionPoster extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -15,12 +16,12 @@ import java.util.HashSet;
public class InteractionPressurePlate extends InteractionDefault { public class InteractionPressurePlate extends InteractionDefault {
public InteractionPressurePlate(ResultSet set, Item baseItem) throws SQLException { public InteractionPressurePlate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionPressurePlate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionPressurePlate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
@ -66,7 +67,7 @@ public class InteractionPressurePlate extends InteractionDefault {
@Override @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
this.setExtradata("0"); this.setExtraData("0");
} }
public void updateState(Room room) { public void updateState(Room room) {
@ -74,7 +75,7 @@ public class InteractionPressurePlate extends InteractionDefault {
if (room == null || room.getLayout() == null || this.getBaseItem() == null) return; 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; 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); room.updateItemState(this);
} }

View File

@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.RoomRotation; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.threading.runnables.KickBallAction; import com.eu.habbo.threading.runnables.KickBallAction;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -21,12 +22,12 @@ public abstract class InteractionPushable extends InteractionDefault {
public InteractionPushable(ResultSet set, Item baseItem) throws SQLException { public InteractionPushable(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionPushable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionPushable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
@ -64,7 +65,7 @@ public abstract class InteractionPushable extends InteractionDefault {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if (client == null) 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()))) {
int velocity = this.getTackleVelocity(client.getHabbo().getRoomUnit(), room); int velocity = this.getTackleVelocity(client.getHabbo().getRoomUnit(), room);
RoomRotation direction = this.getWalkOnDirection(client.getHabbo().getRoomUnit(), room); RoomRotation direction = this.getWalkOnDirection(client.getHabbo().getRoomUnit(), room);
this.onTackle(room, client.getHabbo().getRoomUnit(), velocity, direction); this.onTackle(room, client.getHabbo().getRoomUnit(), velocity, direction);
@ -87,7 +88,7 @@ public abstract class InteractionPushable extends InteractionDefault {
boolean isDrag = false; boolean isDrag = false;
RoomRotation direction; 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); velocity = this.getWalkOnVelocity(roomUnit, room);
direction = this.getWalkOnDirection(roomUnit, room); direction = this.getWalkOnDirection(roomUnit, room);

View File

@ -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.RoomRotation;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
@ -19,35 +20,35 @@ public class InteractionPuzzleBox extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionPuzzleBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionPuzzleBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { 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; RoomRotation rotation = null;
if (this.getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX()) { if (this.getCurrentPosition().getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX()) {
if (this.getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() + 1) { if (this.getCurrentPosition().getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() + 1) {
rotation = RoomRotation.SOUTH; rotation = RoomRotation.SOUTH;
} else { } else {
if (this.getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() - 1) { if (this.getCurrentPosition().getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY() - 1) {
rotation = RoomRotation.NORTH; rotation = RoomRotation.NORTH;
} }
} }
} else { } else {
if (this.getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY()) { if (this.getCurrentPosition().getY() == client.getHabbo().getRoomUnit().getCurrentPosition().getY()) {
if (this.getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX() + 1) { if (this.getCurrentPosition().getX() == client.getHabbo().getRoomUnit().getCurrentPosition().getX() + 1) {
rotation = RoomRotation.EAST; 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; rotation = RoomRotation.WEST;
} }
} }
} }
if (rotation == null) { 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); if (nearestTile != null) client.getHabbo().getRoomUnit().setGoalLocation(nearestTile);
return; return;
@ -55,7 +56,7 @@ public class InteractionPuzzleBox extends RoomItem {
super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"}); 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)) { if (tile == null || tile.getState() == RoomTileState.INVALID || room.getRoomUnitManager().hasHabbosAt(tile)) {
return; return;
@ -69,8 +70,9 @@ public class InteractionPuzzleBox extends RoomItem {
if (item != null && !room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY()).getBaseItem().allowStack()) if (item != null && !room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY()).getBaseItem().allowStack())
return; return;
this.setZ(room.getStackHeight(tile.getX(), tile.getY(), false)); this.setCurrentZ(room.getStackHeight(tile.getX(), tile.getY(), false));
this.needsUpdate(true); this.needsUpdate(true);
room.updateItem(this); room.updateItem(this);
room.scheduledComposers.add(new FloorItemOnRollerComposer(this, null, tile, 0, room).compose()); room.scheduledComposers.add(new FloorItemOnRollerComposer(this, null, tile, 0, room).compose());
@ -85,7 +87,7 @@ public class InteractionPuzzleBox extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -16,26 +17,26 @@ public class InteractionPyramid extends InteractionGate {
super(set, baseItem); super(set, baseItem);
} }
public InteractionPyramid(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionPyramid(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
public void change(Room room) { public void change(Room room) {
if (!(this.getExtradata().equals("0") || this.getExtradata().equals("1"))) if (!(this.getExtraData().equals("0") || this.getExtraData().equals("1")))
this.setExtradata("0"); this.setExtraData("0");
if (room != null) { 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) { if(tile == null) {
return; return;
} }
if (!room.getRoomUnitManager().hasHabbosAt(tile)) { if (!room.getRoomUnitManager().hasHabbosAt(tile)) {
int state = Integer.parseInt(this.getExtradata()); int state = Integer.parseInt(this.getExtraData());
state = Math.abs(state - 1); state = Math.abs(state - 1);
this.setExtradata(state + ""); this.setExtraData(state + "");
room.updateItemState(this); room.updateItemState(this);
this.nextChange = Emulator.getIntUnixTimestamp() + 1 + (Emulator.getRandom().nextInt(Emulator.getConfig().getInt("pyramids.max.delay"))); this.nextChange = Emulator.getIntUnixTimestamp() + 1 + (Emulator.getRandom().nextInt(Emulator.getConfig().getInt("pyramids.max.delay")));

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.RandomStateParams; import com.eu.habbo.habbohotel.items.RandomStateParams;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -13,28 +14,28 @@ public class InteractionRandomState extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionRandomState(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRandomState(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void onPlace(Room room) { public void onPlace(Room room) {
super.onPlace(room); super.onPlace(room);
this.setExtradata(""); this.setExtraData("");
room.updateItemState(this); room.updateItemState(this);
} }
public void onRandomStateClick(Room room) throws Exception { public void onRandomStateClick(Room room) throws Exception {
RandomStateParams params = new RandomStateParams(this.getBaseItem().getCustomParams()); RandomStateParams params = new RandomStateParams(this.getBaseItem().getCustomParams());
this.setExtradata(""); this.setExtraData("");
room.updateItemState(this); room.updateItemState(this);
int randomState = Emulator.getRandom().nextInt(params.getStates()) + 1; int randomState = Emulator.getRandom().nextInt(params.getStates()) + 1;
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
this.setExtradata(randomState + ""); this.setExtraData(randomState + "");
room.updateItemState(this); room.updateItemState(this);
}, params.getDelay()); }, params.getDelay());
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,8 +11,8 @@ public class InteractionRedeemableSubscriptionBox extends InteractionCrackable {
super(set, baseItem); super(set, baseItem);
} }
public InteractionRedeemableSubscriptionBox(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRedeemableSubscriptionBox(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
public boolean userRequiredToBeAdjacent() { public boolean userRequiredToBeAdjacent() {

View File

@ -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.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; 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.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceStatusMessageComposer; import com.eu.habbo.messages.outgoing.rooms.items.rentablespaces.RentableSpaceStatusMessageComposer;
import com.eu.habbo.threading.runnables.ClearRentedSpace; 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) { public InteractionRentableSpace(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.renterName = ""; this.renterName = "";
} }
@Override @Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
if (this.getExtradata().isEmpty()) if (this.getExtraData().isEmpty())
return false; return false;
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit); Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
@ -109,8 +110,8 @@ public class InteractionRentableSpace extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
if (this.getExtradata().isEmpty()) if (this.getExtraData().isEmpty())
this.setExtradata("0:0"); this.setExtraData("0:0");
serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0)); serverMessage.appendInt(1 + (this.isLimited() ? 256 : 0));
@ -156,17 +157,17 @@ public class InteractionRentableSpace extends RoomItem {
if (room == null) if (room == null)
return; 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<RoomItem> items = new THashSet<>(); THashSet<RoomItem> items = new THashSet<>();
for (int i = rect.x; i < rect.x + rect.getWidth(); i++) { for (int i = rect.x; i < rect.x + rect.getWidth(); i++) {
for (int j = rect.y; j < rect.y + rect.getHeight(); j++) { 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) { for (RoomItem item : items) {
if (item.getOwnerId() == this.renterId) { if (item.getOwnerInfo().getId() == this.renterId) {
room.getRoomItemManager().pickUpItem(item, null); room.getRoomItemManager().pickUpItem(item, null);
} }
} }
@ -196,7 +197,7 @@ public class InteractionRentableSpace extends RoomItem {
} }
@Override @Override
public String getExtradata() { public String getExtraData() {
return this.renterId + ":" + this.endTimestamp; return this.renterId + ":" + this.endTimestamp;
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.apache.commons.math3.util.Pair; import org.apache.commons.math3.util.Pair;
@ -20,18 +21,18 @@ public class InteractionRoller extends RoomItem {
public InteractionRoller(ResultSet set, Item baseItem) throws SQLException { public InteractionRoller(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionRoller(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRoller(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -22,8 +23,8 @@ public class InteractionRoomAds extends InteractionCustomValues {
super(set, baseItem, defaultValues); super(set, baseItem, defaultValues);
} }
public InteractionRoomAds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRoomAds(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues);
} }
@Override @Override

View File

@ -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.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; 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.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer;
import com.eu.habbo.threading.runnables.CloseGate; import com.eu.habbo.threading.runnables.CloseGate;
@ -16,12 +17,12 @@ import java.sql.SQLException;
public class InteractionRoomClubGate extends InteractionDefault implements ConditionalGate { public class InteractionRoomClubGate extends InteractionDefault implements ConditionalGate {
public InteractionRoomClubGate(ResultSet set, Item baseItem) throws SQLException { public InteractionRoomClubGate(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionRoomClubGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRoomClubGate(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
@ -41,7 +42,7 @@ public class InteractionRoomClubGate extends InteractionDefault implements Condi
super.onWalkOn(roomUnit, room, objects); super.onWalkOn(roomUnit, room, objects);
if (this.canWalkOn(roomUnit, room, objects)) { if (this.canWalkOn(roomUnit, room, objects)) {
this.setExtradata("1"); this.setExtraData("1");
room.updateItemState(this); room.updateItemState(this);
} }
} }

View File

@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer; import com.eu.habbo.messages.outgoing.generic.alerts.CustomUserNotificationMessageComposer;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -14,8 +15,8 @@ public class InteractionRoomClubHopper extends InteractionHopper {
super(set, baseItem); super(set, baseItem);
} }
public InteractionRoomClubHopper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRoomClubHopper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -14,8 +15,8 @@ public class InteractionRoomClubTeleportTile extends InteractionTeleportTile {
super(set, baseItem); super(set, baseItem);
} }
public InteractionRoomClubTeleportTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRoomClubTeleportTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.outgoing.navigator.NoOwnedRoomsAlertMessageComposer; import com.eu.habbo.messages.outgoing.navigator.NoOwnedRoomsAlertMessageComposer;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -13,8 +14,8 @@ public class InteractionRoomOMatic extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionRoomOMatic(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionRoomOMatic(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -9,8 +9,8 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import java.awt.*; import java.awt.*;
@ -18,8 +18,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionSnowboardSlope extends InteractionMultiHeight { public class InteractionSnowboardSlope extends InteractionMultiHeight {
public InteractionSnowboardSlope(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionSnowboardSlope(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
public InteractionSnowboardSlope(ResultSet set, Item baseItem) throws SQLException { public InteractionSnowboardSlope(ResultSet set, Item baseItem) throws SQLException {
@ -27,19 +27,13 @@ public class InteractionSnowboardSlope extends InteractionMultiHeight {
} }
@Override @Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
if(roomUnit instanceof RoomAvatar roomAvatar) { super.onWalkOn(roomUnit, room, objects);
roomAvatar.giveEffect(97, -1);
}
} }
@Override @Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOff(roomUnit, room, objects); super.onWalkOff(roomUnit, room, objects);
if (roomUnit instanceof RoomAvatar roomAvatar && roomAvatar.getEffectId() == 97) {
roomAvatar.giveEffect(0, -1);
}
} }
@Override @Override

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem; 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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.plugin.events.furniture.FurnitureDiceRolledEvent; import com.eu.habbo.plugin.events.furniture.FurnitureDiceRolledEvent;
import com.eu.habbo.threading.runnables.RandomSpinningBottleNumber; import com.eu.habbo.threading.runnables.RandomSpinningBottleNumber;
@ -15,8 +16,8 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionSpinningBottle extends RoomItem { public class InteractionSpinningBottle extends RoomItem {
public InteractionSpinningBottle(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionSpinningBottle(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
public InteractionSpinningBottle(ResultSet set, Item baseItem) throws SQLException { public InteractionSpinningBottle(ResultSet set, Item baseItem) throws SQLException {
@ -26,7 +27,7 @@ public class InteractionSpinningBottle extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -46,14 +47,14 @@ public class InteractionSpinningBottle extends RoomItem {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if (client != null) { if (client != null) {
if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) { if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), client.getHabbo().getRoomUnit().getCurrentPosition())) {
if (!this.getExtradata().equalsIgnoreCase("-1")) { if (!this.getExtraData().equalsIgnoreCase("-1")) {
FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1)); FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1));
if (event.isCancelled()) if (event.isCancelled())
return; return;
this.setExtradata("-1"); this.setExtraData("-1");
room.updateItemState(this); room.updateItemState(this);
Emulator.getThreading().run(this); Emulator.getThreading().run(this);
@ -74,7 +75,7 @@ public class InteractionSpinningBottle extends RoomItem {
@Override @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override

View File

@ -2,8 +2,9 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; 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.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.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -14,8 +15,8 @@ public class InteractionStackHelper extends RoomItem {
super(set, baseItem); super(set, baseItem);
} }
public InteractionStackHelper(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionStackHelper(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
@ -36,7 +37,7 @@ public class InteractionStackHelper extends RoomItem {
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,7 +11,7 @@ public class InteractionStickyPole extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionStickyPole(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionStickyPole(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
} }

View File

@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -19,13 +20,13 @@ public class InteractionSwitch extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionSwitch(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionSwitch(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public boolean canToggle(Habbo habbo, Room room) { 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 @Override
@ -45,7 +46,7 @@ public class InteractionSwitch extends InteractionDefault {
if (!this.canToggle(client.getHabbo(), room)) { if (!this.canToggle(client.getHabbo(), room)) {
RoomTile closestTile = null; 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()))) { if (tile.isWalkable() && (closestTile == null || closestTile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()) > tile.distance(client.getHabbo().getRoomUnit().getCurrentPosition()))) {
closestTile = tile; closestTile = tile;
} }

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -16,13 +17,13 @@ public class InteractionSwitchRemoteControl extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionSwitchRemoteControl(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionSwitchRemoteControl(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public boolean canToggle(Habbo habbo, Room room) { 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 @Override
@ -40,19 +41,19 @@ public class InteractionSwitchRemoteControl extends InteractionDefault {
if (room != null) { if (room != null) {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if (this.getExtradata().length() == 0) if (this.getExtraData().length() == 0)
this.setExtradata("0"); this.setExtraData("0");
if (this.getBaseItem().getStateCount() > 0) { if (this.getBaseItem().getStateCount() > 0) {
int currentState = 0; int currentState = 0;
try { try {
currentState = Integer.parseInt(this.getExtradata()); currentState = Integer.parseInt(this.getExtraData());
} catch (NumberFormatException e) { } 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); this.needsUpdate(true);
room.updateItemState(this); room.updateItemState(this);

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,7 +11,7 @@ public class InteractionTalkingFurniture extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionTalkingFurniture(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionTalkingFurniture(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
} }

View File

@ -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.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo;
import com.eu.habbo.habbohotel.users.Habbo; 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.ServerMessage;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import com.eu.habbo.threading.runnables.teleport.TeleportActionOne; 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 { public InteractionTeleport(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
walkable = baseItem.allowWalk(); walkable = baseItem.allowWalk();
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionTeleport(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionTeleport(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
walkable = item.allowWalk(); walkable = item.allowWalk();
this.setExtradata("0"); this.setExtraData("0");
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -73,7 +74,7 @@ public class InteractionTeleport extends RoomItem {
return; return;
} }
RoomTile currentItemLocation = room.getLayout().getTile(this.getX(), this.getY()); RoomTile currentItemLocation = room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
if (currentItemLocation == null) { if (currentItemLocation == null) {
return; return;
@ -97,7 +98,7 @@ public class InteractionTeleport extends RoomItem {
} else if (roomHabbo.getCurrentPosition().equals(currentItemLocation) || roomHabbo.getCurrentPosition().equals(inFrontTile)) { } else if (roomHabbo.getCurrentPosition().equals(currentItemLocation) || roomHabbo.getCurrentPosition().equals(inFrontTile)) {
// set state 1 and walk on item // set state 1 and walk on item
this.roomUnitID = roomHabbo.getVirtualId(); this.roomUnitID = roomHabbo.getVirtualId();
this.setExtradata("1"); this.setExtraData("1");
room.updateItemState(this); room.updateItemState(this);
roomHabbo.setGoalLocation(inFrontTile); roomHabbo.setGoalLocation(inFrontTile);
@ -115,7 +116,7 @@ public class InteractionTeleport extends RoomItem {
onFail.add(() -> { onFail.add(() -> {
this.walkable = this.getBaseItem().allowWalk(); this.walkable = this.getBaseItem().allowWalk();
room.updateTile(currentItemLocation); room.updateTile(currentItemLocation);
this.setExtradata("0"); this.setExtraData("0");
room.updateItemState(this); room.updateItemState(this);
this.roomUnitID = -1; this.roomUnitID = -1;
roomHabbo.removeOverrideTile(currentItemLocation); roomHabbo.removeOverrideTile(currentItemLocation);
@ -155,8 +156,8 @@ public class InteractionTeleport extends RoomItem {
@Override @Override
public void run() { public void run() {
if (!this.getExtradata().equals("0")) { if (!this.getExtraData().equals("0")) {
this.setExtradata("0"); this.setExtraData("0");
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId());
if (room != null) { if (room != null) {
@ -171,7 +172,7 @@ public class InteractionTeleport extends RoomItem {
this.targetId = 0; this.targetId = 0;
this.targetRoomId = 0; this.targetRoomId = 0;
this.roomUnitID = -1; this.roomUnitID = -1;
this.setExtradata("0"); this.setExtraData("0");
} }
public int getTargetId() { public int getTargetId() {

View File

@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -13,8 +14,8 @@ public class InteractionTeleportTile extends InteractionTeleport {
super(set, baseItem); super(set, baseItem);
} }
public InteractionTeleportTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionTeleportTile(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -12,8 +13,8 @@ public class InteractionTent extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionTent(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionTent(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit; import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -20,8 +21,8 @@ public class InteractionTileEffectProvider extends InteractionCustomValues {
super(set, baseItem, defaultValues); super(set, baseItem, defaultValues);
} }
public InteractionTileEffectProvider(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionTileEffectProvider(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells, defaultValues); super(id, ownerInfo, item, extradata, limitedStack, limitedSells, defaultValues);
} }
@Override @Override

View File

@ -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.rooms.entities.units.types.RoomHabbo;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -16,13 +17,13 @@ public class InteractionTrap extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionTrap(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionTrap(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { 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); Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId(); int effect = habbo.getClient().getHabbo().getRoomUnit().getEffectId();

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions; package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -10,8 +11,8 @@ public class InteractionTrophy extends InteractionDefault {
super(set, baseItem); super(set, baseItem);
} }
public InteractionTrophy(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionTrophy(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
} }
@Override @Override

View File

@ -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.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar; import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem; import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation; import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
@ -26,12 +27,12 @@ import java.util.List;
public class InteractionVendingMachine extends RoomItem { public class InteractionVendingMachine extends RoomItem {
public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException { public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
this.setExtradata("0"); this.setExtraData("0");
} }
public InteractionVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionVendingMachine(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtradata("0"); this.setExtraData("0");
} }
public THashSet<RoomTile> getActivatorTiles(Room room) { public THashSet<RoomTile> getActivatorTiles(Room room) {
@ -41,14 +42,14 @@ public class InteractionVendingMachine extends RoomItem {
if (tileInFront != null) if (tileInFront != null)
tiles.add(tileInFront); 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; return tiles;
} }
@Override @Override
public void serializeExtradata(ServerMessage serverMessage) { public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0)); serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata()); serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@ -77,7 +78,7 @@ public class InteractionVendingMachine extends RoomItem {
return; return;
} }
this.setExtradata("1"); this.setExtraData("1");
room.updateItem(this); room.updateItem(this);
try { try {
@ -159,8 +160,8 @@ public class InteractionVendingMachine extends RoomItem {
@Override @Override
public void run() { public void run() {
super.run(); super.run();
if (this.getExtradata().equals("1")) { if (this.getExtraData().equals("1")) {
this.setExtradata("0"); this.setExtraData("0");
Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId()); Room room = Emulator.getGameEnvironment().getRoomManager().getActiveRoomById(this.getRoomId());
if (room != null) { if (room != null) {
room.updateItem(this); room.updateItem(this);
@ -184,7 +185,7 @@ public class InteractionVendingMachine extends RoomItem {
} }
private void rotateToMachine(RoomUnit unit) { 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) { if(Math.abs(unit.getBodyRotation().getValue() - rotation.getValue()) > 1) {
unit.setRotation(rotation); unit.setRotation(rotation);

Some files were not shown because too many files have changed in this diff Show More