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.getRoomUnit()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java#L102)
> [`HabboManager`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java)
> [`HabboManager.getOfflineHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L47)
> [`Emulator.getGameEnvironment().getHabboManager().getOfflineHabboInfo()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L47)
> [`HabboManager.getCloneAccounts()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L203)
> [`HabboManager.setRank()`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java#L243)
> [`HabboInfo`](https://git.krews.org/morningstar/Arcturus-Community/-/blob/dev/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java)

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

View File

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

View File

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

View File

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

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

View File

@ -35,7 +35,7 @@ public class LayCommand extends Command {
return false;
}
gameClient.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.LAY, 0.5 + "");
gameClient.getHabbo().getRoomUnit().addStatus(RoomUnitStatus.LAY, 0.5 + "");
gameClient.getHabbo().getRoomUnit().getRoom().sendComposer(new UserUpdateComposer(gameClient.getHabbo().getRoomUnit()).compose());
return true;
}

View File

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

View File

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

View File

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

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

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

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

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

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

View File

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

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

View File

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

View File

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

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

View File

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

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

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

View File

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

View File

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

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.WiredExtraUnseen;
import com.eu.habbo.habbohotel.items.interactions.wired.triggers.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager;
import com.eu.habbo.messages.outgoing.inventory.UnseenItemsComposer;
import com.eu.habbo.plugin.events.emulator.EmulatorLoadItemsManagerEvent;
@ -488,13 +489,14 @@ public class ItemManager {
try (ResultSet set = statement.getGeneratedKeys()) {
if (set.next()) {
Class<? extends RoomItem> itemClass = item.getInteractionType().getType();
HabboInfo userInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(habboId);
if (itemClass != null) {
try {
return itemClass.getDeclaredConstructor(int.class, int.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
return itemClass.getDeclaredConstructor(int.class, HabboInfo.class, Item.class, String.class, int.class, int.class).newInstance(set.getInt(1), userInfo, item, extraData, limitedStack, limitedSells);
} catch (Exception e) {
log.error("Caught exception", e);
return new InteractionDefault(set.getInt(1), habboId, item, extraData, limitedStack, limitedSells);
return new InteractionDefault(set.getInt(1), userInfo, item, extraData, limitedStack, limitedSells);
}
}
}
@ -562,7 +564,7 @@ public class ItemManager {
preparedStatement.setInt(1, set.getInt(1));
preparedStatement.setInt(2, Integer.parseInt(itemId));
preparedStatement.addBatch();
item = new InteractionDefault(set.getInt(1), habbo.getHabboInfo().getId(), Emulator.getGameEnvironment().getCatalogManager().ecotronItem, extradata, 0, 0);
item = new InteractionDefault(set.getInt(1), habbo.getHabboInfo(), Emulator.getGameEnvironment().getCatalogManager().ecotronItem, extradata, 0, 0);
}
preparedStatement.executeBatch();

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

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

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

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

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

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

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

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

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

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.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.threading.runnables.CrackableExplode;
@ -27,19 +28,19 @@ public class InteractionCrackable extends RoomItem {
super(set, baseItem);
}
public InteractionCrackable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
public InteractionCrackable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
}
@Override
public void serializeExtradata(ServerMessage serverMessage) {
if (this.getExtradata().length() == 0)
this.setExtradata("0");
if (this.getExtraData().length() == 0)
this.setExtraData("0");
serverMessage.appendInt(7 + (this.isLimited() ? 256 : 0));
serverMessage.appendString(Emulator.getGameEnvironment().getItemManager().calculateCrackState(Integer.parseInt(this.getExtradata()), Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()), this.getBaseItem()) + "");
serverMessage.appendInt(Integer.parseInt(this.getExtradata()));
serverMessage.appendString(Emulator.getGameEnvironment().getItemManager().calculateCrackState(Integer.parseInt(this.getExtraData()), Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()), this.getBaseItem()) + "");
serverMessage.appendInt(Integer.parseInt(this.getExtraData()));
serverMessage.appendInt(Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId()));
super.serializeExtradata(serverMessage);
@ -69,13 +70,13 @@ public class InteractionCrackable extends RoomItem {
if (this.cracked)
return;
if (this.userRequiredToBeAdjacent() && client.getHabbo().getRoomUnit().getCurrentPosition().distance(room.getLayout().getTile(this.getX(), this.getY())) > 1.5) {
client.getHabbo().getRoomUnit().setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), Rotation.Calculate(client.getHabbo().getRoomUnit().getCurrentPosition().getX(), client.getHabbo().getRoomUnit().getCurrentPosition().getY(), this.getX(), this.getY())));
if (this.userRequiredToBeAdjacent() && client.getHabbo().getRoomUnit().getCurrentPosition().distance(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY())) > 1.5) {
client.getHabbo().getRoomUnit().setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), Rotation.Calculate(client.getHabbo().getRoomUnit().getCurrentPosition().getX(), client.getHabbo().getRoomUnit().getCurrentPosition().getY(), this.getCurrentPosition().getX(), this.getCurrentPosition().getY())));
return;
}
if (this.getExtradata().length() == 0)
this.setExtradata("0");
if (this.getExtraData().length() == 0)
this.setExtraData("0");
if (this.getBaseItem().getEffectF() > 0)
if (client.getHabbo().getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() == client.getHabbo().getRoomUnit().getEffectId())
@ -92,7 +93,7 @@ public class InteractionCrackable extends RoomItem {
public void onTick(Habbo habbo, Room room) {
if (this.cracked) return;
if (this.allowAnyone() || this.getOwnerId() == habbo.getHabboInfo().getId()) {
if (this.allowAnyone() || this.getOwnerInfo().getId() == habbo.getHabboInfo().getId()) {
CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId());
if (rewardData != null) {
@ -102,10 +103,10 @@ public class InteractionCrackable extends RoomItem {
if(this.ticks < 1)
{
// If there are no ticks (for example because the room has been reloaded), check the current extradata of the item and update the ticks.
this.ticks = Integer.parseInt(this.getExtradata());
this.ticks = Integer.parseInt(this.getExtraData());
}
this.ticks++;
this.setExtradata("" + (this.ticks));
this.setExtraData("" + (this.ticks));
this.needsUpdate(true);
room.updateItem(this);
@ -114,7 +115,7 @@ public class InteractionCrackable extends RoomItem {
}
if (!this.cracked && this.ticks == Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())) {
this.cracked = true;
Emulator.getThreading().run(new CrackableExplode(room, this, habbo, !this.placeInRoom(), this.getX(), this.getY()), 1500);
Emulator.getThreading().run(new CrackableExplode(room, this, habbo, !this.placeInRoom(), this.getCurrentPosition()), 1500);
if (!rewardData.getAchievementCracked().isEmpty()) {
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.getAchievementCracked()));
@ -168,7 +169,7 @@ public class InteractionCrackable extends RoomItem {
public void reset(Room room) {
this.cracked = false;
this.ticks = 0;
this.setExtradata("0");
this.setExtraData("0");
room.updateItem(this);
}

View File

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

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

View File

@ -1,6 +1,5 @@
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
@ -8,11 +7,8 @@ import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomBot;
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage;
import lombok.extern.slf4j.Slf4j;
@ -26,14 +22,14 @@ public class InteractionDefault extends RoomItem {
super(set, baseItem);
}
public InteractionDefault(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
public InteractionDefault(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
}
@Override
public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata());
serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage);
}
@ -79,19 +75,19 @@ public class InteractionDefault extends RoomItem {
if (objects != null && objects.length > 0) {
if (objects[0] instanceof Integer) {
if (this.getExtradata().length() == 0)
this.setExtradata("0");
if (this.getExtraData().length() == 0)
this.setExtraData("0");
if (this.getBaseItem().getStateCount() > 0) {
int currentState = 0;
try {
currentState = Integer.parseInt(this.getExtradata());
currentState = Integer.parseInt(this.getExtraData());
} catch (NumberFormatException e) {
log.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
log.error("Incorrect extradata (" + this.getExtraData() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
}
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());
this.setExtraData("" + (currentState + 1) % this.getBaseItem().getStateCount());
this.needsUpdate(true);
room.updateItemState(this);
@ -109,115 +105,11 @@ public class InteractionDefault extends RoomItem {
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects);
if (roomUnit == null || (this.getBaseItem().getEffectF() == 0 && this.getBaseItem().getEffectM() == 0)) {
return;
}
if (roomUnit instanceof RoomHabbo roomHabbo) {
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomHabbo);
if (habbo == null) return;
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomHabbo.getEffectId() != this.getBaseItem().getEffectM()) {
if (roomHabbo.getEffectId() > 0) {
roomHabbo.setPreviousEffectId(roomHabbo.getEffectId(), roomHabbo.getPreviousEffectEndTimestamp());
}
roomHabbo.giveEffect(this.getBaseItem().getEffectM(), -1);
return;
}
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomHabbo.getEffectId() != this.getBaseItem().getEffectF()) {
if (roomHabbo.getEffectId() > 0) {
roomHabbo.setPreviousEffectId(roomHabbo.getEffectId(), roomHabbo.getPreviousEffectEndTimestamp());
}
roomHabbo.giveEffect(this.getBaseItem().getEffectF(), -1);
}
} else if (roomUnit instanceof RoomBot roomBot) {
Bot bot = room.getRoomUnitManager().getBotByRoomUnit(roomBot);
if (bot == null) return;
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomBot.getEffectId() != this.getBaseItem().getEffectM()) {
if (roomBot.getEffectId() > 0) {
roomBot.setPreviousEffectId(roomBot.getEffectId(), roomBot.getPreviousEffectEndTimestamp());
}
roomBot.giveEffect(this.getBaseItem().getEffectM(), -1);
return;
}
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomBot.getEffectId() != this.getBaseItem().getEffectF()) {
if (roomBot.getEffectId() > 0) {
roomUnit.setPreviousEffectId(roomBot.getEffectId(), roomBot.getPreviousEffectEndTimestamp());
}
roomBot.giveEffect(this.getBaseItem().getEffectF(), -1);
}
}
}
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOff(roomUnit, room, objects);
if (roomUnit != null) {
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
int nextEffectM = 0;
int nextEffectF = 0;
int nextEffectDuration = -1;
if (objects != null && objects.length == 2) {
if (objects[0] instanceof RoomTile goalTile && objects[1] instanceof RoomTile) {
RoomItem exclude = (objects[0] != objects[1]) ? this : null;
RoomItem topItem = room.getRoomItemManager().getTopItemAt(goalTile.getX(), goalTile.getY(), exclude);
if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) {
return;
}
if (topItem != null) {
nextEffectM = topItem.getBaseItem().getEffectM();
nextEffectF = topItem.getBaseItem().getEffectF();
} else if (roomUnit.getPreviousEffectId() > 0) {
nextEffectF = roomUnit.getPreviousEffectId();
nextEffectM = roomUnit.getPreviousEffectId();
nextEffectDuration = roomUnit.getPreviousEffectEndTimestamp();
}
}
}
if (roomUnit.getRoomUnitType().equals(RoomUnitType.HABBO)) {
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
if (habbo != null) {
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
habbo.getRoomUnit().giveEffect(nextEffectM, nextEffectDuration);
return;
}
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
habbo.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration);
}
}
} else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) {
Bot bot = room.getRoomUnitManager().getRoomBotById(roomUnit.getVirtualId());
if (bot != null) {
if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
bot.getRoomUnit().giveEffect(nextEffectM, nextEffectDuration);
return;
}
if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
bot.getRoomUnit().giveEffect(nextEffectF, nextEffectDuration);
}
}
}
}
}
}
public boolean canToggle(Habbo habbo, Room room) {
@ -227,7 +119,7 @@ public class InteractionDefault extends RoomItem {
RoomItem rentSpace = room.getRoomItemManager().getRoomItemById(habbo.getHabboStats().getRentedItemId());
return rentSpace != null && RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
return rentSpace != null && RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getCurrentPosition().getX(), rentSpace.getCurrentPosition().getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(this.getCurrentPosition().getX(), this.getCurrentPosition().getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
}

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

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

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

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

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

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

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

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

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

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

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

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

View File

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

View File

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

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

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

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

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

View File

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

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

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

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

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

View File

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

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

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

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.entities.items.RoomItem;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet;
@ -19,8 +17,8 @@ import java.sql.SQLException;
import java.util.Collection;
public class InteractionMultiHeight extends RoomItem {
public InteractionMultiHeight(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
public InteractionMultiHeight(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
}
public InteractionMultiHeight(ResultSet set, Item baseItem) throws SQLException {
@ -30,7 +28,7 @@ public class InteractionMultiHeight extends RoomItem {
@Override
public void serializeExtradata(ServerMessage serverMessage) {
serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata());
serverMessage.appendString(this.getExtraData());
super.serializeExtradata(serverMessage);
}
@ -49,42 +47,47 @@ public class InteractionMultiHeight extends RoomItem {
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !(objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE))
if (client != null && !room.getRoomRightsManager().hasRights(client.getHabbo()) && !(objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE)) {
return;
}
if (objects.length <= 0) {
if (objects.length == 0) {
return;
}
if (objects[0] instanceof Integer && room != null) {
RoomItem topItem = room.getRoomItemManager().getTopItemAt(this.getX(), this.getY());
RoomItem topItem = room.getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
if (topItem != null && !topItem.equals(this)) { // multiheight items cannot change height even if there is a stackable item on top - no items allowed on top
return;
}
this.needsUpdate(true);
if (this.getExtradata().length() == 0)
this.setExtradata("0");
if (this.getExtraData().length() == 0) {
this.setExtraData("0");
}
if (this.getBaseItem().getMultiHeights().length > 0) {
this.setExtradata("" + (Integer.parseInt(this.getExtradata()) + 1) % (this.getBaseItem().getMultiHeights().length));
this.setExtraData(String.valueOf((Integer.parseInt(this.getExtraData()) + 1) % (this.getBaseItem().getMultiHeights().length)));
this.needsUpdate(true);
room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
room.updateItemState(this);
}
}
}
public void updateUnitsOnItem(Room room) {
THashSet<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) {
Collection<RoomUnit> unitsOnItem = room.getRoomUnitManager().getRoomUnitsAt(room.getLayout().getTile(tile.getX(), tile.getY()));
for (RoomUnit unit : unitsOnItem) {
if (unit.hasStatus(RoomUnitStatus.MOVE) && unit.getGoalLocation() != tile) {
continue;
if (unit.hasStatus(RoomUnitStatus.MOVE)) {
if (unit.getTargetPosition() != tile) {
continue;
}
}
if (this.getBaseItem().allowSit() || unit.hasStatus(RoomUnitStatus.SIT)) {
@ -92,8 +95,6 @@ public class InteractionMultiHeight extends RoomItem {
unit.setStatusUpdateNeeded(true);
} else {
unit.setCurrentZ(unit.getCurrentPosition().getStackHeight());
unit.setPreviousLocationZ(unit.getCurrentZ());
unit.setStatusUpdateNeeded(true);
}
}
}
@ -107,45 +108,11 @@ public class InteractionMultiHeight extends RoomItem {
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects);
if (roomUnit != null
&& (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0)
&& roomUnit.getRoomUnitType().equals(RoomUnitType.HABBO)) {
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
if (habbo != null) {
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) {
habbo.getRoomUnit().giveEffect(this.getBaseItem().getEffectM(), -1);
return;
}
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) {
habbo.getRoomUnit().giveEffect(this.getBaseItem().getEffectF(), -1);
}
}
}
}
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOff(roomUnit, room, objects);
if (roomUnit != null
&& (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0)
&& roomUnit.getRoomUnitType().equals(RoomUnitType.HABBO)) {
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
if (habbo != null) {
if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) {
habbo.getRoomUnit().giveEffect(0, -1);
return;
}
if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) {
habbo.getRoomUnit().giveEffect(0, -1);
}
}
}
}
@Override

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

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

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

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

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

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

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

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

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.entities.RoomRotation;
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboInfo;
import com.eu.habbo.threading.runnables.KickBallAction;
import java.sql.ResultSet;
@ -21,12 +22,12 @@ public abstract class InteractionPushable extends InteractionDefault {
public InteractionPushable(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
this.setExtradata("0");
this.setExtraData("0");
}
public InteractionPushable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
this.setExtradata("0");
public InteractionPushable(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
this.setExtraData("0");
}
@Override
@ -64,7 +65,7 @@ public abstract class InteractionPushable extends InteractionDefault {
super.onClick(client, room, objects);
if (client == null) return;
if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getX(), this.getY()))) {
if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentPosition(), room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()))) {
int velocity = this.getTackleVelocity(client.getHabbo().getRoomUnit(), room);
RoomRotation direction = this.getWalkOnDirection(client.getHabbo().getRoomUnit(), room);
this.onTackle(room, client.getHabbo().getRoomUnit(), velocity, direction);
@ -87,7 +88,7 @@ public abstract class InteractionPushable extends InteractionDefault {
boolean isDrag = false;
RoomRotation direction;
if (this.getX() == roomUnit.getGoalLocation().getX() && this.getY() == roomUnit.getGoalLocation().getY()) //User clicked on the tile the ball is on, they want to kick it
if (this.getCurrentPosition().getX() == roomUnit.getTargetPosition().getX() && this.getCurrentPosition().getY() == roomUnit.getTargetPosition().getY()) //User clicked on the tile the ball is on, they want to kick it
{
velocity = this.getWalkOnVelocity(roomUnit, room);
direction = this.getWalkOnDirection(roomUnit, room);

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

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

View File

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

View File

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

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

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

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

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

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

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

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

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

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

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

View File

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

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

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.RoomLayout;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboInfo;
import lombok.extern.slf4j.Slf4j;
import java.sql.ResultSet;
@ -16,13 +17,13 @@ public class InteractionSwitchRemoteControl extends InteractionDefault {
super(set, baseItem);
}
public InteractionSwitchRemoteControl(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
public InteractionSwitchRemoteControl(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean canToggle(Habbo habbo, Room room) {
return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), habbo.getRoomUnit().getCurrentPosition());
return RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getCurrentPosition().getX(), this.getCurrentPosition().getY()), habbo.getRoomUnit().getCurrentPosition());
}
@Override
@ -40,19 +41,19 @@ public class InteractionSwitchRemoteControl extends InteractionDefault {
if (room != null) {
super.onClick(client, room, objects);
if (this.getExtradata().length() == 0)
this.setExtradata("0");
if (this.getExtraData().length() == 0)
this.setExtraData("0");
if (this.getBaseItem().getStateCount() > 0) {
int currentState = 0;
try {
currentState = Integer.parseInt(this.getExtradata());
currentState = Integer.parseInt(this.getExtraData());
} catch (NumberFormatException e) {
log.error("Incorrect extradata (" + this.getExtradata() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
log.error("Incorrect extradata (" + this.getExtraData() + ") for item ID (" + this.getId() + ") of type (" + this.getBaseItem().getName() + ")");
}
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());
this.setExtraData("" + (currentState + 1) % this.getBaseItem().getStateCount());
this.needsUpdate(true);
room.updateItemState(this);

View File

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

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

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

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.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboInfo;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -12,8 +13,8 @@ public class InteractionTent extends InteractionDefault {
super(set, baseItem);
}
public InteractionTent(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
public InteractionTent(int id, HabboInfo ownerInfo, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, ownerInfo, item, extradata, limitedStack, limitedSells);
}
@Override

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

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

View File

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

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

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