mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
Room.java clean-up
This commit is contained in:
parent
4d81fc9dd0
commit
b80f3da289
@ -131,7 +131,7 @@ public class BotManager {
|
||||
RoomBot roomBot = bot.getRoomUnit();
|
||||
roomBot.setRotation(RoomRotation.SOUTH);
|
||||
roomBot.setLocation(location);
|
||||
double stackHeight = room.getTopHeightAt(location.getX(), location.getY());
|
||||
double stackHeight = room.getRoomItemManager().getTopHeightAt(location.getX(), location.getY());
|
||||
roomBot.setPreviousLocationZ(stackHeight);
|
||||
roomBot.setCurrentZ(stackHeight);
|
||||
roomBot.setRoom(room);
|
||||
@ -150,7 +150,7 @@ public class BotManager {
|
||||
habbo.getClient().sendResponse(new BotRemovedFromInventoryComposer(bot));
|
||||
bot.onPlace(habbo, room);
|
||||
|
||||
RoomItem topItem = room.getTopItemAt(location.getX(), location.getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(location.getX(), location.getY());
|
||||
|
||||
if (topItem != null) {
|
||||
try {
|
||||
|
@ -26,8 +26,8 @@ public class CoordsCommand extends Command {
|
||||
"Tile State: " + gameClient.getHabbo().getRoomUnit().getRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getCurrentPosition().getX(), gameClient.getHabbo().getRoomUnit().getCurrentPosition().getY()).getState().name() + "\r" +
|
||||
"Tile Walkable: " + gameClient.getHabbo().getRoomUnit().getRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getCurrentPosition().getX(), gameClient.getHabbo().getRoomUnit().getCurrentPosition().getY()).isWalkable() + "\r" +
|
||||
"Tile relative height: " + gameClient.getHabbo().getRoomUnit().getRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getCurrentPosition().getX(), gameClient.getHabbo().getRoomUnit().getCurrentPosition().getY()).relativeHeight() + "\r" +
|
||||
"Tile stack height: " + gameClient.getHabbo().getRoomUnit().getRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getCurrentPosition().getX(), gameClient.getHabbo().getRoomUnit().getCurrentPosition().getY()).getStackHeight());
|
||||
|
||||
"Tile stack height: " + gameClient.getHabbo().getRoomUnit().getRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getCurrentPosition().getX(), gameClient.getHabbo().getRoomUnit().getCurrentPosition().getY()).getStackHeight() + "\r" +
|
||||
"Tile has Furni: " + (!gameClient.getHabbo().getRoomUnit().getRoom().getRoomItemManager().getItemsAt(gameClient.getHabbo().getRoomUnit().getCurrentPosition()).isEmpty()));
|
||||
} else {
|
||||
RoomTile tile = gameClient.getHabbo().getRoomUnit().getRoom().getLayout().getTile(Short.parseShort(params[1]), Short.parseShort(params[2]));
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class BattleBanzaiGameTeam extends GameTeam {
|
||||
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||
Room room = roomUnit.getRoom();
|
||||
if(room == null) return;
|
||||
RoomItem topItem = room.getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
int nextEffectM = 0;
|
||||
int nextEffectF = 0;
|
||||
int nextEffectDuration = -1;
|
||||
|
@ -191,7 +191,7 @@ public class FreezeGame extends Game {
|
||||
if (this.room.getRoomSpecialTypes().hasFreezeExitTile()) {
|
||||
for (Habbo habbo : this.room.getRoomUnitManager().getRoomHabbos()) {
|
||||
if (this.getTeamForHabbo(habbo) == null) {
|
||||
for (RoomItem item : this.room.getItemsAt(habbo.getRoomUnit().getCurrentPosition())) {
|
||||
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()));
|
||||
|
@ -29,7 +29,7 @@ public class FreezeGameTeam extends GameTeam {
|
||||
Room room = roomUnit.getRoom();
|
||||
if(room == null) return;
|
||||
|
||||
RoomItem topItem = room.getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
int nextEffectM = 0;
|
||||
int nextEffectF = 0;
|
||||
int nextEffectDuration = -1;
|
||||
|
@ -64,7 +64,7 @@ public abstract class TagGame extends Game {
|
||||
@EventHandler
|
||||
public static void onUserWalkEvent(UserTakeStepEvent event) {
|
||||
if (event.habbo.getHabboInfo().getCurrentGame() != null && TagGame.class.isAssignableFrom(event.habbo.getHabboInfo().getCurrentGame())) {
|
||||
THashSet<RoomItem> items = event.habbo.getRoomUnit().getRoom().getItemsAt(event.toLocation);
|
||||
THashSet<RoomItem> items = event.habbo.getRoomUnit().getRoom().getRoomItemManager().getItemsAt(event.toLocation);
|
||||
|
||||
TagGame game = (TagGame) event.habbo.getRoomUnit().getRoom().getGame(event.habbo.getHabboInfo().getCurrentGame());
|
||||
|
||||
@ -177,7 +177,7 @@ public abstract class TagGame extends Game {
|
||||
Room room = roomUnit.getRoom();
|
||||
if (room == null) return;
|
||||
|
||||
RoomItem topItem = room.getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
int nextEffectM = 0;
|
||||
int nextEffectF = 0;
|
||||
int nextEffectDuration = -1;
|
||||
|
@ -45,7 +45,7 @@ public class WiredGame extends Game {
|
||||
Room room = this.room;
|
||||
if (room == null) return;
|
||||
|
||||
RoomItem topItem = room.getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
int nextEffectM = 0;
|
||||
int nextEffectF = 0;
|
||||
int nextEffectDuration = -1;
|
||||
|
@ -78,7 +78,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
|
||||
if (!canBuild.isEmpty()) {
|
||||
for (RoomTile tile : this.tiles) {
|
||||
THashSet<RoomItem> tileItems = room.getItemsAt(tile);
|
||||
THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile);
|
||||
for (RoomItem tileItem : tileItems) {
|
||||
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) {
|
||||
room.getRoomItemManager().pickUpItem(tileItem, null);
|
||||
@ -127,7 +127,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
|
||||
if (!canBuild.isEmpty()) {
|
||||
for (RoomTile tile : this.tiles) {
|
||||
THashSet<RoomItem> tileItems = room.getItemsAt(tile);
|
||||
THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile);
|
||||
if (newTiles.contains(tile)) continue;
|
||||
for (RoomItem tileItem : tileItems) {
|
||||
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) {
|
||||
@ -202,7 +202,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
}
|
||||
if (!canBuild.isEmpty()) {
|
||||
for (RoomTile tile : oldTiles) {
|
||||
THashSet<RoomItem> tileItems = room.getItemsAt(tile);
|
||||
THashSet<RoomItem> tileItems = room.getRoomItemManager().getItemsAt(tile);
|
||||
for (RoomItem tileItem : tileItems) {
|
||||
if (canBuild.contains(tileItem.getOwnerId()) && tileItem != this) {
|
||||
room.getRoomItemManager().pickUpItem(tileItem, null);
|
||||
|
@ -52,7 +52,7 @@ public class InteractionDefault extends RoomItem {
|
||||
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
|
||||
super.onMove(room, oldLocation, newLocation);
|
||||
|
||||
if (room.getItemsAt(oldLocation).stream().noneMatch(item -> item.getClass().isAssignableFrom(InteractionRoller.class))) {
|
||||
if (room.getRoomItemManager().getItemsAt(oldLocation).stream().noneMatch(item -> item.getClass().isAssignableFrom(InteractionRoller.class))) {
|
||||
for (RoomUnit unit : room.getRoomUnitManager().getCurrentRoomUnits().values()) {
|
||||
if (!oldLocation.unitIsOnFurniOnTile(unit, this.getBaseItem()))
|
||||
continue; // If the unit was previously on the furni...
|
||||
@ -165,7 +165,8 @@ public class InteractionDefault extends RoomItem {
|
||||
|
||||
if (objects != null && objects.length == 2) {
|
||||
if (objects[0] instanceof RoomTile goalTile && objects[1] instanceof RoomTile) {
|
||||
RoomItem topItem = room.getTopItemAt(goalTile.getX(), goalTile.getY(), (objects[0] != objects[1]) ? this : null);
|
||||
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;
|
||||
|
@ -68,7 +68,7 @@ public class InteractionGymEquipment extends InteractionEffectTile implements IC
|
||||
|
||||
if (roomUnit != null) {
|
||||
Habbo habbo = room.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
|
||||
RoomItem topItem = room.getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
int nextEffectM = 0;
|
||||
int nextEffectF = 0;
|
||||
int nextEffectDuration = -1;
|
||||
|
@ -57,7 +57,7 @@ public class InteractionMultiHeight extends RoomItem {
|
||||
}
|
||||
|
||||
if (objects[0] instanceof Integer && room != null) {
|
||||
RoomItem topItem = room.getTopItemAt(this.getX(), this.getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(this.getX(), this.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;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ 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.RoomUnitStatus;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.RoomEntity;
|
||||
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;
|
||||
@ -180,25 +179,23 @@ public class InteractionObstacle extends RoomItem implements ICycleable {
|
||||
}
|
||||
|
||||
for(RoomTile tile : this.middleTiles) {
|
||||
for(RoomEntity entity : tile.getEntities()) {
|
||||
if(!(entity instanceof RoomUnit)) {
|
||||
for(RoomUnit roomUnit : tile.getRoomUnits()) {
|
||||
if(roomUnit == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RoomUnit unit = (RoomUnit) entity;
|
||||
|
||||
if(unit.getPath().size() == 0 && !unit.hasStatus(RoomUnitStatus.MOVE)) {
|
||||
if(unit.getBodyRotation().getValue() != this.getRotation() && Objects.requireNonNull(unit.getBodyRotation().getOpposite()).getValue() != this.getRotation())
|
||||
if(roomUnit.getPath().size() == 0 && !roomUnit.hasStatus(RoomUnitStatus.MOVE)) {
|
||||
if(roomUnit.getBodyRotation().getValue() != this.getRotation() && Objects.requireNonNull(roomUnit.getBodyRotation().getOpposite()).getValue() != this.getRotation())
|
||||
continue;
|
||||
|
||||
RoomTile tileInfront = room.getLayout().getTileInFront(unit.getCurrentPosition(), unit.getBodyRotation().getValue());
|
||||
RoomTile tileInfront = room.getLayout().getTileInFront(roomUnit.getCurrentPosition(), roomUnit.getBodyRotation().getValue());
|
||||
if(tileInfront.getState() != RoomTileState.INVALID && tileInfront.getState() != RoomTileState.BLOCKED && room.getRoomUnitManager().getRoomUnitsAt(tileInfront).size() == 0) {
|
||||
unit.setGoalLocation(tileInfront);
|
||||
roomUnit.setGoalLocation(tileInfront);
|
||||
}
|
||||
else {
|
||||
RoomTile tileBehind = room.getLayout().getTileInFront(unit.getCurrentPosition(), Objects.requireNonNull(unit.getBodyRotation().getOpposite()).getValue());
|
||||
RoomTile tileBehind = room.getLayout().getTileInFront(roomUnit.getCurrentPosition(), Objects.requireNonNull(roomUnit.getBodyRotation().getOpposite()).getValue());
|
||||
if(tileBehind.getState() != RoomTileState.INVALID && tileBehind.getState() != RoomTileState.BLOCKED && room.getRoomUnitManager().getRoomUnitsAt(tileBehind).size() == 0) {
|
||||
unit.setGoalLocation(tileBehind);
|
||||
roomUnit.setGoalLocation(tileBehind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,9 +64,10 @@ public class InteractionPuzzleBox extends RoomItem {
|
||||
if (!boxLocation.equals(room.getLayout().getTileInFront(client.getHabbo().getRoomUnit().getCurrentPosition(), rotation.getValue())))
|
||||
return;
|
||||
|
||||
RoomItem item = room.getTopItemAt(tile.getX(), tile.getY());
|
||||
RoomItem item = room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY());
|
||||
|
||||
if (item != null && !room.getTopItemAt(tile.getX(), tile.getY()).getBaseItem().allowStack()) return;
|
||||
if (item != null && !room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY()).getBaseItem().allowStack())
|
||||
return;
|
||||
|
||||
this.setZ(room.getStackHeight(tile.getX(), tile.getY(), false));
|
||||
this.needsUpdate(true);
|
||||
|
@ -161,7 +161,7 @@ public class InteractionRentableSpace extends RoomItem {
|
||||
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.getItemsAt(i, j, this.getZ()));
|
||||
items.addAll(room.getRoomItemManager().getItemsAt(i, j, this.getZ()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class InteractionWater extends InteractionDefault {
|
||||
}
|
||||
|
||||
private boolean isValidForMask(Room room, int x, int y, double z, boolean corner) {
|
||||
for (RoomItem item : room.getItemsAt(x, y, z)) {
|
||||
for (RoomItem item : room.getRoomItemManager().getItemsAt(x, y, z)) {
|
||||
if (item instanceof InteractionWater water) {
|
||||
|
||||
// Take out picked up water from the recalculation.
|
||||
|
@ -60,7 +60,8 @@ public class InteractionWaterItem extends InteractionMultiHeight {
|
||||
for (short x = (short) rectangle.x; x < rectangle.getWidth() + rectangle.x && foundWater; x++) {
|
||||
for (short y = (short) rectangle.y; y < rectangle.getHeight() + rectangle.y && foundWater; y++) {
|
||||
boolean tile = false;
|
||||
THashSet<RoomItem> items = room.getItemsAt(room.getLayout().getTile(x, y));
|
||||
RoomTile tile1 = room.getLayout().getTile(x, y);
|
||||
THashSet<RoomItem> items = room.getRoomItemManager().getItemsAt(tile1);
|
||||
|
||||
for (RoomItem item : items) {
|
||||
if (item instanceof InteractionWater) {
|
||||
|
@ -128,7 +128,7 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable {
|
||||
@Override
|
||||
public boolean validMove(Room room, RoomTile from, RoomTile to) {
|
||||
if (to == null) return false;
|
||||
RoomItem topItem = room.getTopItemAt(to.getX(), to.getY(), this);
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(to.getX(), to.getY(), this);
|
||||
return !(!room.getLayout().tileWalkable(to.getX(), to.getY()) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
|
||||
|
||||
//return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().setAllowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
|
||||
@ -158,7 +158,7 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable {
|
||||
if (game != null) {
|
||||
GameTeam team = game.getTeamForHabbo(habbo);
|
||||
if (team != null) {
|
||||
RoomItem item = room.getTopItemAt(to.getX(), to.getY());
|
||||
RoomItem item = room.getRoomItemManager().getTopItemAt(to.getX(), to.getY());
|
||||
try {
|
||||
item.onWalkOn(kicker, room, null);
|
||||
} catch (Exception e) {
|
||||
|
@ -149,7 +149,7 @@ public class InteractionFootball extends InteractionPushable {
|
||||
@Override
|
||||
public boolean validMove(Room room, RoomTile from, RoomTile to) {
|
||||
if (to == null || to.getState() == RoomTileState.INVALID) return false;
|
||||
RoomItem topItem = room.getTopItemAt(to.getX(), to.getY(), this);
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(to.getX(), to.getY(), this);
|
||||
|
||||
// Move is valid if there isnt any furni yet
|
||||
if (topItem == null) {
|
||||
@ -157,7 +157,7 @@ public class InteractionFootball extends InteractionPushable {
|
||||
}
|
||||
|
||||
// If any furni on tile is not stackable, move is invalid (tested on 22-03-2022)
|
||||
if (room.getItemsAt(to).stream().anyMatch(x -> !x.getBaseItem().allowStack())) {
|
||||
if (room.getRoomItemManager().getItemsAt(to).stream().anyMatch(x -> !x.getBaseItem().allowStack())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -215,8 +215,8 @@ public class InteractionFootball extends InteractionPushable {
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomItem currentTopItem = room.getTopItemAt(from.getX(), from.getY(), this);
|
||||
RoomItem topItem = room.getTopItemAt(to.getX(), to.getY(), this);
|
||||
RoomItem currentTopItem = room.getRoomItemManager().getTopItemAt(from.getX(), from.getY(), this);
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(to.getX(), to.getY(), this);
|
||||
if ((topItem != null) && ((currentTopItem == null) || (currentTopItem.getId() != topItem.getId())) && topItem instanceof InteractionFootballGoal interactionFootballGoal) {
|
||||
GameTeamColors color = interactionFootballGoal.teamColor;
|
||||
game.onScore(kicker, color);
|
||||
@ -239,7 +239,7 @@ public class InteractionFootball extends InteractionPushable {
|
||||
|
||||
@Override
|
||||
public boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps) {
|
||||
RoomItem topItem = room.getTopItemAt(from.getX(), from.getY(), this);
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(from.getX(), from.getY(), this);
|
||||
return !((Emulator.getRandom().nextInt(10) >= 3 && room.getRoomUnitManager().hasHabbosAt(to)) || (topItem != null && topItem.getBaseItem().getName().startsWith("fball_goal_") && currentStep != 1));
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.freeze.FreezeGame;
|
||||
import com.eu.habbo.habbohotel.games.freeze.FreezeGamePlayer;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -34,7 +35,8 @@ public class InteractionFreezeBlock extends RoomItem {
|
||||
return;
|
||||
|
||||
RoomItem item = null;
|
||||
THashSet<RoomItem> items = room.getItemsAt(room.getLayout().getTile(this.getX(), this.getY()));
|
||||
RoomTile tile = room.getLayout().getTile(this.getX(), this.getY());
|
||||
THashSet<RoomItem> items = room.getRoomItemManager().getItemsAt(tile);
|
||||
|
||||
for (RoomItem i : items) {
|
||||
if (i instanceof InteractionFreezeTile) {
|
||||
|
@ -50,7 +50,7 @@ public class InteractionTotemHead extends InteractionDefault {
|
||||
private void update(Room room, RoomTile tile) {
|
||||
InteractionTotemLegs legs = null;
|
||||
|
||||
for(RoomItem item : room.getItemsAt(tile)) {
|
||||
for(RoomItem item : room.getRoomItemManager().getItemsAt(tile)) {
|
||||
if(item instanceof InteractionTotemLegs && item.getZ() < this.getZ())
|
||||
legs = (InteractionTotemLegs)item;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class InteractionTotemLegs extends InteractionDefault {
|
||||
}
|
||||
|
||||
private void updateHead(Room room, RoomTile tile) {
|
||||
for(RoomItem item : room.getItemsAt(tile)) {
|
||||
for(RoomItem item : room.getRoomItemManager().getItemsAt(tile)) {
|
||||
if(item instanceof InteractionTotemHead && item.getZ() > this.getZ())
|
||||
((InteractionTotemHead)item).updateTotemState(room);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
@ -39,7 +40,8 @@ public class InteractionTotemPlanet extends InteractionDefault {
|
||||
InteractionTotemLegs legs = null;
|
||||
InteractionTotemHead head = null;
|
||||
|
||||
THashSet<RoomItem> items = room.getItemsAt(room.getLayout().getTile(this.getX(), this.getY()));
|
||||
RoomTile tile = room.getLayout().getTile(this.getX(), this.getY());
|
||||
THashSet<RoomItem> items = room.getRoomItemManager().getItemsAt(tile);
|
||||
|
||||
for(RoomItem item : items) {
|
||||
if(item instanceof InteractionTotemLegs && item.getZ() < this.getZ())
|
||||
|
@ -34,13 +34,13 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
|
||||
return this.getWiredSettings().getItems(room).stream().allMatch(item -> {
|
||||
double minZ = item.getZ() + Item.getCurrentHeight(item);
|
||||
THashSet<RoomTile> occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
||||
return occupiedTiles.stream().anyMatch(tile -> room.getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
return occupiedTiles.stream().anyMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
});
|
||||
} else {
|
||||
return this.getWiredSettings().getItems(room).stream().anyMatch(item -> {
|
||||
double minZ = item.getZ() + Item.getCurrentHeight(item);
|
||||
THashSet<RoomTile> occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
||||
return occupiedTiles.stream().anyMatch(tile -> room.getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
return occupiedTiles.stream().anyMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
|
||||
return this.getWiredSettings().getItems(room).stream().allMatch(item -> {
|
||||
double minZ = item.getZ() + Item.getCurrentHeight(item);
|
||||
THashSet<RoomTile> occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
||||
return occupiedTiles.stream().noneMatch(tile -> room.getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
return occupiedTiles.stream().noneMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
});
|
||||
}
|
||||
else {
|
||||
return this.getWiredSettings().getItems(room).stream().anyMatch(item -> {
|
||||
double minZ = item.getZ() + Item.getCurrentHeight(item);
|
||||
THashSet<RoomTile> occupiedTiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
||||
return occupiedTiles.stream().noneMatch(tile -> room.getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
return occupiedTiles.stream().noneMatch(tile -> room.getRoomItemManager().getItemsAt(tile).stream().anyMatch(matchedItem -> matchedItem != item && matchedItem.getZ() >= minZ));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
||||
return false;
|
||||
}
|
||||
|
||||
THashSet<RoomItem> itemsAtUser = room.getItemsAt(roomUnit.getCurrentPosition());
|
||||
THashSet<RoomItem> itemsAtUser = room.getRoomItemManager().getItemsAt(roomUnit.getCurrentPosition());
|
||||
return this.getWiredSettings().getItems(room).stream().anyMatch(itemsAtUser::contains);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,6 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
|
||||
return;
|
||||
}
|
||||
|
||||
roomBot.getRoom().unIdle(roomBot.getRoom().getRoomUnitManager().getHabboByRoomUnit(roomBot));
|
||||
room.sendComposer(new AvatarEffectMessageComposer(roomBot, 4).compose());
|
||||
Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomBot), (long) WiredHandler.TELEPORT_DELAY + 1000);
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
|
||||
if (room.getRoomItemManager().furnitureFitsAt(tile, item, item.getRotation(), true) == FurnitureMovementError.INVALID_MOVE)
|
||||
continue;
|
||||
|
||||
RoomItem topItem = room.getTopItemAt(tile.getX(), tile.getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY());
|
||||
if (topItem != null && !topItem.getBaseItem().allowStack())
|
||||
continue;
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
||||
|
||||
// makes a temporary effect
|
||||
|
||||
roomHabbo.getRoom().unIdle(roomHabbo.getRoom().getRoomUnitManager().getHabboByRoomUnit(roomHabbo));
|
||||
roomHabbo.unIdle();
|
||||
room.sendComposer(new AvatarEffectMessageComposer(roomHabbo, 4).compose());
|
||||
Emulator.getThreading().run(new SendRoomUnitEffectComposer(room, roomHabbo), (long) WiredHandler.TELEPORT_DELAY + 1000);
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
|
||||
Emulator.getThreading().run(() -> WiredHandler.handle(WiredTriggerType.SAY_SOMETHING, roomUnit, room, new Object[]{ msg }));
|
||||
|
||||
if (habbo.getRoomUnit().isIdle()) {
|
||||
habbo.getRoomUnit().getRoom().unIdle(habbo);
|
||||
habbo.getRoomUnit().unIdle();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.RoomEntity;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.RoomRotation;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomAvatar;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomPet;
|
||||
import com.eu.habbo.habbohotel.users.DanceType;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
@ -364,7 +364,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return RoomTileState.INVALID;
|
||||
|
||||
RoomTileState result = RoomTileState.OPEN;
|
||||
THashSet<RoomItem> items = this.getItemsAt(tile);
|
||||
THashSet<RoomItem> items = this.roomItemManager.getItemsAt(tile);
|
||||
|
||||
if (items == null) return RoomTileState.INVALID;
|
||||
|
||||
@ -426,7 +426,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public void updateRoomUnit(RoomUnit roomUnit) {
|
||||
RoomItem item = this.getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
RoomItem item = this.roomItemManager.getTopItemAt(roomUnit.getCurrentPosition().getX(), roomUnit.getCurrentPosition().getY());
|
||||
|
||||
if ((item == null && !roomUnit.isCmdSitEnabled()) || (item != null && !item.getBaseItem().allowSit()))
|
||||
roomUnit.removeStatus(RoomUnitStatus.SIT);
|
||||
@ -459,7 +459,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public void updateHabbosAt(short x, short y, List<Habbo> habbos) {
|
||||
RoomItem item = this.getTopItemAt(x, y);
|
||||
RoomItem item = this.roomItemManager.getTopItemAt(x, y);
|
||||
|
||||
for (Habbo habbo : habbos) {
|
||||
|
||||
@ -498,7 +498,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public void updateBotsAt(short x, short y) {
|
||||
RoomItem topItem = this.getTopItemAt(x, y);
|
||||
RoomItem topItem = this.roomItemManager.getTopItemAt(x, y);
|
||||
|
||||
THashSet<RoomUnit> roomUnits = new THashSet<>();
|
||||
|
||||
@ -778,8 +778,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
THashSet<RoomUnit> updatedUnit = new THashSet<>();
|
||||
ArrayList<Habbo> toKick = new ArrayList<>();
|
||||
|
||||
final Room room = this;
|
||||
|
||||
final long millis = System.currentTimeMillis();
|
||||
|
||||
for (Habbo habbo : this.roomUnitManager.getCurrentRoomHabbos().values()) {
|
||||
@ -802,14 +800,14 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
habbo.getRoomUnit().setKickCount(habbo.getRoomUnit().getKickCount() + 1);
|
||||
|
||||
if (habbo.getRoomUnit().getKickCount() >= 5) {
|
||||
this.scheduledTasks.add(() -> Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, room));
|
||||
this.scheduledTasks.add(() -> Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, this));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (Emulator.getConfig().getBoolean("hotel.rooms.auto.idle")) {
|
||||
if (!habbo.getRoomUnit().isIdle()) {
|
||||
habbo.getRoomUnit().increaseIdleTimer();
|
||||
habbo.getRoomUnit().incrementIdleTicks();
|
||||
|
||||
if (habbo.getRoomUnit().isIdle()) {
|
||||
boolean danceIsNone = (habbo.getRoomUnit().getDanceType() == DanceType.NONE);
|
||||
@ -819,7 +817,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
WiredHandler.handle(WiredTriggerType.IDLES, habbo.getRoomUnit(), this, new Object[]{habbo});
|
||||
}
|
||||
} else {
|
||||
habbo.getRoomUnit().increaseIdleTimer();
|
||||
habbo.getRoomUnit().incrementIdleTicks();
|
||||
|
||||
if (!this.getRoomInfo().isRoomOwner(habbo) && habbo.getRoomUnit().getIdleTicks() >= Room.IDLE_CYCLES_KICK) {
|
||||
UserExitRoomEvent event = new UserExitRoomEvent(habbo, UserExitRoomEvent.UserExitRoomReason.KICKED_IDLE);
|
||||
@ -947,7 +945,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
THashSet<RoomItem> itemsOnRoller = new THashSet<>();
|
||||
|
||||
for (RoomItem item : getItemsAt(rollerTile)) {
|
||||
for (RoomItem item : this.roomItemManager.getItemsAt(rollerTile)) {
|
||||
if (item.getZ() >= roller.getZ() + Item.getCurrentHeight(roller)) {
|
||||
itemsOnRoller.add(item);
|
||||
}
|
||||
@ -976,12 +974,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return true;
|
||||
|
||||
THashSet<RoomItem> itemsNewTile = new THashSet<>();
|
||||
itemsNewTile.addAll(getItemsAt(tileInFront));
|
||||
itemsNewTile.addAll(this.roomItemManager.getItemsAt(tileInFront));
|
||||
itemsNewTile.removeAll(itemsOnRoller);
|
||||
|
||||
itemsOnRoller.removeIf(item -> item.getX() != roller.getX() || item.getY() != roller.getY() || rollerFurniIds.contains(item.getId()));
|
||||
|
||||
RoomItem topItem = Room.this.getTopItemAt(tileInFront.getX(), tileInFront.getY());
|
||||
RoomItem topItem = this.roomItemManager.getTopItemAt(tileInFront.getX(), tileInFront.getY());
|
||||
|
||||
boolean allowUsers = true;
|
||||
boolean allowFurniture = true;
|
||||
@ -1027,46 +1025,34 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
roomUserRolledEvent = new UserRolledEvent(null, null, null);
|
||||
}
|
||||
|
||||
ArrayList<RoomEntity> unitsOnTile = new ArrayList<>(rollerTile.getEntities());
|
||||
ArrayList<RoomUnit> unitsOnTile = new ArrayList<>(rollerTile.getRoomUnits());
|
||||
|
||||
for (RoomEntity entity : rollerTile.getEntities()) {
|
||||
if(!(entity instanceof RoomUnit)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RoomUnit unit = (RoomUnit) entity;
|
||||
|
||||
if (unit.getRoomUnitType() == RoomUnitType.PET) {
|
||||
Pet pet = this.roomUnitManager.getPetByRoomUnit(unit);
|
||||
for (RoomUnit roomUnit : rollerTile.getRoomUnits()) {
|
||||
if (roomUnit instanceof RoomPet) {
|
||||
Pet pet = this.roomUnitManager.getPetByRoomUnit(roomUnit);
|
||||
if (pet instanceof RideablePet rideablePet && rideablePet.getRider() != null) {
|
||||
unitsOnTile.remove(unit);
|
||||
unitsOnTile.remove(roomUnit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
THashSet<Integer> usersRolledThisTile = new THashSet<>();
|
||||
|
||||
for (RoomEntity entity : unitsOnTile) {
|
||||
if(!(entity instanceof RoomUnit)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RoomUnit unit = (RoomUnit) entity;
|
||||
|
||||
if (rolledUnitIds.contains(unit.getVirtualId())) continue;
|
||||
for (RoomUnit roomUnit : unitsOnTile) {
|
||||
if (rolledUnitIds.contains(roomUnit.getVirtualId())) continue;
|
||||
|
||||
if (usersRolledThisTile.size() >= Room.ROLLERS_MAXIMUM_ROLL_AVATARS) break;
|
||||
|
||||
if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable()))
|
||||
continue;
|
||||
|
||||
if (unit.hasStatus(RoomUnitStatus.MOVE))
|
||||
if (roomUnit.hasStatus(RoomUnitStatus.MOVE))
|
||||
continue;
|
||||
|
||||
double newZ = unit.getCurrentZ() + zOffset;
|
||||
double newZ = roomUnit.getCurrentZ() + zOffset;
|
||||
|
||||
if (roomUserRolledEvent != null && unit.getRoomUnitType() == RoomUnitType.HABBO) {
|
||||
roomUserRolledEvent = new UserRolledEvent(this.getRoomUnitManager().getHabboByRoomUnit(unit), roller, tileInFront);
|
||||
if (roomUserRolledEvent != null && roomUnit.getRoomUnitType() == RoomUnitType.HABBO) {
|
||||
roomUserRolledEvent = new UserRolledEvent(this.getRoomUnitManager().getHabboByRoomUnit(roomUnit), roller, tileInFront);
|
||||
Emulator.getPluginManager().fireEvent(roomUserRolledEvent);
|
||||
|
||||
if (roomUserRolledEvent.isCancelled())
|
||||
@ -1075,8 +1061,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
// horse riding
|
||||
boolean isRiding = false;
|
||||
if (unit.getRoomUnitType() == RoomUnitType.HABBO) {
|
||||
Habbo rollingHabbo = this.getRoomUnitManager().getHabboByRoomUnit(unit);
|
||||
if (roomUnit.getRoomUnitType() == RoomUnitType.HABBO) {
|
||||
Habbo rollingHabbo = this.getRoomUnitManager().getHabboByRoomUnit(roomUnit);
|
||||
if (rollingHabbo != null && rollingHabbo.getHabboInfo() != null) {
|
||||
RideablePet riding = rollingHabbo.getHabboInfo().getRiding();
|
||||
if (riding != null) {
|
||||
@ -1084,25 +1070,25 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
newZ = ridingUnit.getCurrentZ() + zOffset;
|
||||
rolledUnitIds.add(ridingUnit.getVirtualId());
|
||||
updatedUnit.remove(ridingUnit);
|
||||
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentPosition(), ridingUnit.getCurrentZ(), tileInFront, newZ, room));
|
||||
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentPosition(), ridingUnit.getCurrentZ(), tileInFront, newZ, this));
|
||||
isRiding = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
usersRolledThisTile.add(unit.getVirtualId());
|
||||
rolledUnitIds.add(unit.getVirtualId());
|
||||
updatedUnit.remove(unit);
|
||||
messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentPosition(), unit.getCurrentZ() + (isRiding ? 1 : 0), tileInFront, newZ + (isRiding ? 1 : 0), room));
|
||||
usersRolledThisTile.add(roomUnit.getVirtualId());
|
||||
rolledUnitIds.add(roomUnit.getVirtualId());
|
||||
updatedUnit.remove(roomUnit);
|
||||
messages.add(new RoomUnitOnRollerComposer(roomUnit, roller, roomUnit.getCurrentPosition(), roomUnit.getCurrentZ() + (isRiding ? 1 : 0), tileInFront, newZ + (isRiding ? 1 : 0), this));
|
||||
|
||||
if (itemsOnRoller.isEmpty()) {
|
||||
RoomItem item = room.getTopItemAt(tileInFront.getX(), tileInFront.getY());
|
||||
RoomItem item = this.getRoomItemManager().getTopItemAt(tileInFront.getX(), tileInFront.getY());
|
||||
|
||||
if (item != null && itemsNewTile.contains(item) && !itemsOnRoller.contains(item)) {
|
||||
Emulator.getThreading().run(() -> {
|
||||
if (unit.getGoalLocation() == rollerTile) {
|
||||
if (roomUnit.getGoalLocation() == rollerTile) {
|
||||
try {
|
||||
item.onWalkOn(unit, room, new Object[]{rollerTile, tileInFront});
|
||||
item.onWalkOn(roomUnit, this, new Object[]{rollerTile, tileInFront});
|
||||
} catch (Exception e) {
|
||||
log.error(CAUGHT_EXCEPTION, e);
|
||||
}
|
||||
@ -1111,15 +1097,15 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
if (unit.hasStatus(RoomUnitStatus.SIT)) {
|
||||
unit.setSitUpdate(true);
|
||||
if (roomUnit.hasStatus(RoomUnitStatus.SIT)) {
|
||||
roomUnit.setSitUpdate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!messages.isEmpty()) {
|
||||
for (MessageComposer message : messages) {
|
||||
room.sendComposer(message.compose());
|
||||
this.sendComposer(message.compose());
|
||||
}
|
||||
messages.clear();
|
||||
}
|
||||
@ -1145,7 +1131,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
continue;
|
||||
}
|
||||
|
||||
messages.add(new FloorItemOnRollerComposer(item, roller, tileInFront, zOffset, room));
|
||||
messages.add(new FloorItemOnRollerComposer(item, roller, tileInFront, zOffset, this));
|
||||
rollerFurniIds.add(item.getId());
|
||||
}
|
||||
}
|
||||
@ -1155,7 +1141,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
if (!messages.isEmpty()) {
|
||||
for (MessageComposer message : messages) {
|
||||
room.sendComposer(message.compose());
|
||||
this.sendComposer(message.compose());
|
||||
}
|
||||
messages.clear();
|
||||
}
|
||||
@ -1233,7 +1219,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
if (!unit.isWalking() && !unit.isCmdSitEnabled()) {
|
||||
RoomTile thisTile = this.getLayout().getTile(unit.getCurrentPosition().getX(), unit.getCurrentPosition().getY());
|
||||
RoomItem topItem = this.getTallestChair(thisTile);
|
||||
RoomItem topItem = this.roomItemManager.getTallestChair(thisTile);
|
||||
|
||||
if (topItem == null || !topItem.getBaseItem().allowSit()) {
|
||||
if (unit.hasStatus(RoomUnitStatus.SIT)) {
|
||||
@ -1254,7 +1240,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
if (!unit.isWalking() && !unit.isCmdLayEnabled()) {
|
||||
RoomItem topItem = this.getTopItemAt(unit.getCurrentPosition().getX(), unit.getCurrentPosition().getY());
|
||||
RoomItem topItem = this.roomItemManager.getTopItemAt(unit.getCurrentPosition().getX(), unit.getCurrentPosition().getY());
|
||||
|
||||
if (topItem == null || !topItem.getBaseItem().allowLay()) {
|
||||
if (unit.hasStatus(RoomUnitStatus.LAY)) {
|
||||
@ -1291,12 +1277,11 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
public Color getBackgroundTonerColor() {
|
||||
Color color = new Color(0, 0, 0);
|
||||
TIntObjectIterator<RoomItem> iterator = this.roomItems.iterator();
|
||||
Iterator<RoomItem> iterator = this.roomItemManager.getCurrentItems().values().iterator();
|
||||
|
||||
for (int i = this.roomItems.size(); i > 0; i--) {
|
||||
for (int i = this.roomItemManager.getCurrentItems().size(); i > 0; i--) {
|
||||
try {
|
||||
iterator.advance();
|
||||
RoomItem object = iterator.value();
|
||||
RoomItem object = iterator.next();
|
||||
|
||||
if (object instanceof InteractionBackgroundToner) {
|
||||
String[] extraData = object.getExtradata().split(":");
|
||||
@ -1435,7 +1420,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public List<RoomItem> getPostItNotes() {
|
||||
return roomItems.valueCollection().stream().filter(i -> i.getBaseItem().getInteractionType().getType() == InteractionPostIt.class).toList();
|
||||
return this.roomItemManager.getCurrentItems().values().stream().filter(i -> i.getBaseItem().getInteractionType().getType() == InteractionPostIt.class).toList();
|
||||
}
|
||||
|
||||
public void kickHabbo(Habbo habbo, boolean alert) {
|
||||
@ -1556,7 +1541,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
RoomItem doorTileTopItem = this.getTopItemAt(habbo.getRoomUnit().getCurrentPosition().getX(), habbo.getRoomUnit().getCurrentPosition().getY());
|
||||
RoomItem doorTileTopItem = this.roomItemManager.getTopItemAt(habbo.getRoomUnit().getCurrentPosition().getX(), habbo.getRoomUnit().getCurrentPosition().getY());
|
||||
if (doorTileTopItem != null && !(doorTileTopItem instanceof InteractionTeleportTile)) {
|
||||
try {
|
||||
doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{});
|
||||
@ -1608,7 +1593,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
|
||||
if (!event.isCancelled() && !event.isIdle()) {
|
||||
this.unIdle(habbo);
|
||||
habbo.getRoomUnit().unIdle();
|
||||
}
|
||||
|
||||
this.sendComposer(new UserTypingMessageComposer(habbo.getRoomUnit(), false).compose());
|
||||
@ -1839,14 +1824,13 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
public THashSet<RoomTile> getLockedTiles() {
|
||||
THashSet<RoomTile> lockedTiles = new THashSet<>();
|
||||
|
||||
TIntObjectIterator<RoomItem> iterator = this.roomItems.iterator();
|
||||
Iterator<RoomItem> iterator = this.roomItemManager.getCurrentItems().values().iterator();
|
||||
|
||||
|
||||
for (int i = this.roomItems.size(); i-- > 0; ) {
|
||||
for (int i = this.roomItemManager.getCurrentItems().size(); i-- > 0; ) {
|
||||
RoomItem item;
|
||||
try {
|
||||
iterator.advance();
|
||||
item = iterator.value();
|
||||
item = iterator.next();
|
||||
} catch (Exception e) {
|
||||
break;
|
||||
}
|
||||
@ -1884,214 +1868,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return lockedTiles;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public THashSet<RoomItem> getItemsAt(int x, int y) {
|
||||
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (tile != null) {
|
||||
return this.getItemsAt(tile);
|
||||
}
|
||||
|
||||
return new THashSet<>(0);
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(RoomTile tile) {
|
||||
return getItemsAt(tile, false);
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(RoomTile tile, boolean returnOnFirst) {
|
||||
THashSet<RoomItem> items = new THashSet<>(0);
|
||||
|
||||
if (tile == null) {
|
||||
return items;
|
||||
}
|
||||
|
||||
if (this.loaded) {
|
||||
THashSet<RoomItem> cachedItems = this.tileCache.get(tile);
|
||||
if (cachedItems != null)
|
||||
return cachedItems;
|
||||
}
|
||||
|
||||
TIntObjectIterator<RoomItem> iterator = this.roomItems.iterator();
|
||||
|
||||
for (int i = this.roomItems.size(); i-- > 0; ) {
|
||||
RoomItem item;
|
||||
try {
|
||||
iterator.advance();
|
||||
item = iterator.value();
|
||||
} catch (Exception e) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
if (item.getBaseItem().getType() != FurnitureType.FLOOR)
|
||||
continue;
|
||||
|
||||
int width, length;
|
||||
|
||||
if (item.getRotation() != 2 && item.getRotation() != 6) {
|
||||
width = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
||||
length = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
||||
} else {
|
||||
width = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
||||
length = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
||||
}
|
||||
|
||||
if (!(tile.getX() >= item.getX() && tile.getX() <= item.getX() + width - 1 && tile.getY() >= item.getY() && tile.getY() <= item.getY() + length - 1))
|
||||
continue;
|
||||
|
||||
items.add(item);
|
||||
|
||||
if (returnOnFirst) {
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.loaded) {
|
||||
this.tileCache.put(tile, items);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(int x, int y, double minZ) {
|
||||
THashSet<RoomItem> items = new THashSet<>();
|
||||
|
||||
for (RoomItem item : this.getItemsAt(x, y)) {
|
||||
if (item.getZ() < minZ)
|
||||
continue;
|
||||
|
||||
items.add(item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(Class<? extends RoomItem> type, int x, int y) {
|
||||
THashSet<RoomItem> items = new THashSet<>();
|
||||
|
||||
for (RoomItem item : this.getItemsAt(x, y)) {
|
||||
if (!item.getClass().equals(type))
|
||||
continue;
|
||||
|
||||
items.add(item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public boolean hasItemsAt(int x, int y) {
|
||||
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (tile == null)
|
||||
return false;
|
||||
|
||||
return !this.getItemsAt(tile, true).isEmpty();
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(RoomTile tile) {
|
||||
if(tile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.getTopItemAt(tile.getX(), tile.getY(), null);
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(int x, int y) {
|
||||
return this.getTopItemAt(x, y, null);
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(int x, int y, RoomItem exclude) {
|
||||
RoomTile tile = this.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (tile == null)
|
||||
return null;
|
||||
|
||||
RoomItem highestItem = null;
|
||||
|
||||
for (RoomItem item : this.getItemsAt(x, y)) {
|
||||
if (exclude != null && exclude == item)
|
||||
continue;
|
||||
|
||||
if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item))
|
||||
continue;
|
||||
|
||||
highestItem = item;
|
||||
}
|
||||
|
||||
return highestItem;
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(THashSet<RoomTile> tiles, RoomItem exclude) {
|
||||
RoomItem highestItem = null;
|
||||
for (RoomTile tile : tiles) {
|
||||
|
||||
if (tile == null)
|
||||
continue;
|
||||
|
||||
for (RoomItem item : this.getItemsAt(tile.getX(), tile.getY())) {
|
||||
if (exclude != null && exclude == item)
|
||||
continue;
|
||||
|
||||
if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item))
|
||||
continue;
|
||||
|
||||
highestItem = item;
|
||||
}
|
||||
}
|
||||
|
||||
return highestItem;
|
||||
}
|
||||
|
||||
public double getTopHeightAt(int x, int y) {
|
||||
RoomItem item = this.getTopItemAt(x, y);
|
||||
if (item != null) {
|
||||
return (item.getZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0));
|
||||
} else {
|
||||
return this.layout.getHeightAtSquare(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
public RoomItem getLowestChair(RoomTile tile) {
|
||||
RoomItem lowestChair = null;
|
||||
|
||||
THashSet<RoomItem> items = this.getItemsAt(tile);
|
||||
if (items != null && !items.isEmpty()) {
|
||||
for (RoomItem item : items) {
|
||||
|
||||
if (!item.getBaseItem().allowSit())
|
||||
continue;
|
||||
|
||||
if (lowestChair != null && lowestChair.getZ() < item.getZ())
|
||||
continue;
|
||||
|
||||
lowestChair = item;
|
||||
}
|
||||
}
|
||||
|
||||
return lowestChair;
|
||||
}
|
||||
|
||||
public RoomItem getTallestChair(RoomTile tile) {
|
||||
RoomItem lowestChair = null;
|
||||
|
||||
THashSet<RoomItem> items = this.getItemsAt(tile);
|
||||
if (items != null && !items.isEmpty()) {
|
||||
for (RoomItem item : items) {
|
||||
|
||||
if (!item.getBaseItem().allowSit())
|
||||
continue;
|
||||
|
||||
if (lowestChair != null && lowestChair.getZ() + Item.getCurrentHeight(lowestChair) > item.getZ() + Item.getCurrentHeight(item))
|
||||
continue;
|
||||
|
||||
lowestChair = item;
|
||||
}
|
||||
}
|
||||
|
||||
return lowestChair;
|
||||
}
|
||||
|
||||
public double getStackHeight(short x, short y, boolean calculateHeightmap, RoomItem exclude) {
|
||||
|
||||
if (x < 0 || y < 0 || this.layout == null)
|
||||
@ -2107,7 +1883,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
double height = this.layout.getHeightAtSquare(x, y);
|
||||
boolean canStack = true;
|
||||
|
||||
THashSet<RoomItem> stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y);
|
||||
THashSet<RoomItem> stackHelpers = this.roomItemManager.getItemsAt(InteractionStackHelper.class, x, y);
|
||||
|
||||
|
||||
for (RoomItem item : stackHelpers) {
|
||||
@ -2116,7 +1892,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
|
||||
RoomItem item = this.getTopItemAt(x, y, exclude);
|
||||
RoomItem item = this.roomItemManager.getTopItemAt(x, y, exclude);
|
||||
if (item != null) {
|
||||
canStack = item.getBaseItem().allowStack();
|
||||
height = item.getZ() + (item.getBaseItem().allowSit() ? 0 : Item.getCurrentHeight(item));
|
||||
@ -2134,7 +1910,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public boolean hasObjectTypeAt(Class<?> type, int x, int y) {
|
||||
THashSet<RoomItem> items = this.getItemsAt(x, y);
|
||||
THashSet<RoomItem> items = this.roomItemManager.getItemsAt(x, y);
|
||||
|
||||
for (RoomItem item : items) {
|
||||
if (item.getClass() == type) {
|
||||
@ -2155,7 +1931,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
if (this.roomUnitManager.hasHabbosAt(tile))
|
||||
return false;
|
||||
|
||||
THashSet<RoomItem> items = this.getItemsAt(x, y);
|
||||
THashSet<RoomItem> items = this.roomItemManager.getItemsAt(x, y);
|
||||
|
||||
return this.canSitAt(items) || this.canLayAt(items);
|
||||
}
|
||||
@ -2170,7 +1946,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
if (this.roomUnitManager.hasHabbosAt(tile))
|
||||
return false;
|
||||
|
||||
return this.canSitAt(this.getItemsAt(x, y));
|
||||
return this.canSitAt(this.roomItemManager.getItemsAt(x, y));
|
||||
}
|
||||
|
||||
boolean canWalkAt(RoomTile roomTile) {
|
||||
@ -2183,7 +1959,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
RoomItem topItem = null;
|
||||
boolean canWalk = true;
|
||||
THashSet<RoomItem> items = this.getItemsAt(roomTile);
|
||||
THashSet<RoomItem> items = this.roomItemManager.getItemsAt(roomTile);
|
||||
if (items != null) {
|
||||
for (RoomItem item : items) {
|
||||
if (topItem == null) {
|
||||
@ -2225,7 +2001,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public boolean canLayAt(RoomTile tile) {
|
||||
return this.canLayAt(this.getItemsAt(tile));
|
||||
return this.canLayAt(this.roomItemManager.getItemsAt(tile));
|
||||
}
|
||||
|
||||
boolean canLayAt(THashSet<RoomItem> items) {
|
||||
@ -2443,24 +2219,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void idle(Habbo habbo) {
|
||||
habbo.getRoomUnit().setIdle();
|
||||
|
||||
if (habbo.getRoomUnit().getDanceType() != DanceType.NONE) {
|
||||
habbo.getRoomUnit().setDance(DanceType.NONE);
|
||||
}
|
||||
|
||||
this.sendComposer(new SleepMessageComposer(habbo.getRoomUnit()).compose());
|
||||
WiredHandler.handle(WiredTriggerType.IDLES, habbo.getRoomUnit(), this, new Object[]{habbo});
|
||||
}
|
||||
|
||||
public void unIdle(Habbo habbo) {
|
||||
if (habbo == null || habbo.getRoomUnit() == null) return;
|
||||
habbo.getRoomUnit().resetIdleTimer();
|
||||
this.sendComposer(new SleepMessageComposer(habbo.getRoomUnit()).compose());
|
||||
WiredHandler.handle(WiredTriggerType.UNIDLES, habbo.getRoomUnit(), this, new Object[]{habbo});
|
||||
}
|
||||
|
||||
public void addToWordFilter(String word) {
|
||||
synchronized (this.wordFilterWords) {
|
||||
if (this.wordFilterWords.contains(word))
|
||||
@ -2529,4 +2287,4 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
public boolean hasVotedInWordQuiz(Habbo habbo) {
|
||||
return this.userVotes.contains(habbo.getHabboInfo().getId());
|
||||
}
|
||||
}
|
||||
}
|
@ -375,7 +375,7 @@ public class RoomItemManager {
|
||||
|
||||
boolean magicTile = item instanceof InteractionStackHelper;
|
||||
|
||||
Optional<RoomItem> stackHelper = this.room.getItemsAt(targetTile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
||||
Optional<RoomItem> stackHelper = this.getItemsAt(targetTile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
||||
|
||||
//Check if can be placed at new position
|
||||
THashSet<RoomTile> occupiedTiles = this.room.getLayout().getTilesAt(targetTile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||
@ -387,12 +387,12 @@ public class RoomItemManager {
|
||||
return fits;
|
||||
}
|
||||
|
||||
RoomItem topItem = this.room.getTopItemAt(occupiedTiles, null);
|
||||
RoomItem topItem = this.getTopItemAt(occupiedTiles, null);
|
||||
|
||||
if ((stackHelper.isEmpty() && !pluginHelper) || item.getBaseItem().getInteractionType().getType() == InteractionWater.class) {
|
||||
if (oldLocation != targetTile) {
|
||||
for (RoomTile t : occupiedTiles) {
|
||||
RoomItem tileTopItem = this.room.getTopItemAt(t.getX(), t.getY());
|
||||
RoomItem tileTopItem = this.getTopItemAt(t.getX(), t.getY());
|
||||
if (!magicTile && (tileTopItem != null && tileTopItem != item ? (t.getState().equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack() ||
|
||||
(tileTopItem.getBaseItem().getInteractionType().getType() == InteractionWater.class && (item.getBaseItem().getInteractionType().getType() != InteractionWaterItem.class || item.getBaseItem().getInteractionType().getType() == InteractionWater.class))) : this.room.calculateTileState(t, item).equals(RoomTileState.INVALID)) || stackHelper.isPresent() && item.getBaseItem().getInteractionType().getType() == InteractionWater.class) {
|
||||
return FurnitureMovementError.CANT_STACK;
|
||||
@ -414,7 +414,7 @@ public class RoomItemManager {
|
||||
List<Pair<RoomTile, THashSet<RoomItem>>> tileFurniList = new ArrayList<>();
|
||||
|
||||
for (RoomTile t : occupiedTiles) {
|
||||
tileFurniList.add(Pair.create(t, this.room.getItemsAt(t)));
|
||||
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
|
||||
}
|
||||
|
||||
if (!magicTile && !item.canStackAt(tileFurniList)) {
|
||||
@ -670,14 +670,14 @@ public class RoomItemManager {
|
||||
}
|
||||
}
|
||||
|
||||
Optional<RoomItem> stackHelper = this.room.getItemsAt(targetTile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
||||
Optional<RoomItem> stackHelper = this.getItemsAt(targetTile).stream().filter(InteractionStackHelper.class::isInstance).findAny();
|
||||
|
||||
List<Pair<RoomTile, THashSet<RoomItem>>> tileFurniList = new ArrayList<>();
|
||||
|
||||
for (RoomTile t : occupiedTiles) {
|
||||
tileFurniList.add(Pair.create(t, this.room.getItemsAt(t)));
|
||||
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
|
||||
|
||||
RoomItem topItem = this.room.getTopItemAt(t.getX(), t.getY(), item);
|
||||
RoomItem topItem = this.getTopItemAt(t.getX(), t.getY(), item);
|
||||
if (topItem != null && !topItem.getBaseItem().allowStack() && !t.getAllowStack()) {
|
||||
return FurnitureMovementError.CANT_STACK;
|
||||
}
|
||||
@ -694,6 +694,211 @@ public class RoomItemManager {
|
||||
return FurnitureMovementError.NONE;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public THashSet<RoomItem> getItemsAt(int x, int y) {
|
||||
RoomTile tile = this.room.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (tile != null) {
|
||||
return this.getItemsAt(tile);
|
||||
}
|
||||
|
||||
return new THashSet<>(0);
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(RoomTile tile) {
|
||||
return getItemsAt(tile, false);
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(RoomTile tile, boolean returnOnFirst) {
|
||||
THashSet<RoomItem> items = new THashSet<>(0);
|
||||
|
||||
if (tile == null) {
|
||||
return items;
|
||||
}
|
||||
|
||||
if (this.room.isLoaded()) {
|
||||
THashSet<RoomItem> cachedItems = this.room.tileCache.get(tile);
|
||||
if (cachedItems != null)
|
||||
return cachedItems;
|
||||
}
|
||||
|
||||
Iterator<RoomItem> iterator = this.currentItems.values().iterator();
|
||||
|
||||
for (int i = this.currentItems.size(); i-- > 0; ) {
|
||||
RoomItem item;
|
||||
try {
|
||||
item = iterator.next();
|
||||
} catch (Exception e) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (item == null || item.getBaseItem().getType() != FurnitureType.FLOOR) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int width, length;
|
||||
|
||||
if (item.getRotation() != 2 && item.getRotation() != 6) {
|
||||
width = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
||||
length = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
||||
} else {
|
||||
width = item.getBaseItem().getLength() > 0 ? item.getBaseItem().getLength() : 1;
|
||||
length = item.getBaseItem().getWidth() > 0 ? item.getBaseItem().getWidth() : 1;
|
||||
}
|
||||
|
||||
if (!(tile.getX() >= item.getX() && tile.getX() <= item.getX() + width - 1 && tile.getY() >= item.getY() && tile.getY() <= item.getY() + length - 1))
|
||||
continue;
|
||||
|
||||
items.add(item);
|
||||
|
||||
if (returnOnFirst) {
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.room.isLoaded()) {
|
||||
this.room.tileCache.put(tile, items);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(int x, int y, double minZ) {
|
||||
THashSet<RoomItem> items = new THashSet<>();
|
||||
|
||||
for (RoomItem item : this.getItemsAt(x, y)) {
|
||||
if (item.getZ() < minZ)
|
||||
continue;
|
||||
|
||||
items.add(item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public THashSet<RoomItem> getItemsAt(Class<? extends RoomItem> type, int x, int y) {
|
||||
THashSet<RoomItem> items = new THashSet<>();
|
||||
|
||||
for (RoomItem item : this.getItemsAt(x, y)) {
|
||||
if (!item.getClass().equals(type))
|
||||
continue;
|
||||
|
||||
items.add(item);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public boolean hasItemsAt(int x, int y) {
|
||||
RoomTile tile = this.room.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (tile == null)
|
||||
return false;
|
||||
|
||||
return !this.getItemsAt(tile, true).isEmpty();
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(RoomTile tile) {
|
||||
if(tile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.getTopItemAt(tile.getX(), tile.getY(), null);
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(int x, int y) {
|
||||
return this.getTopItemAt(x, y, null);
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(int x, int y, RoomItem exclude) {
|
||||
RoomTile tile = this.room.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (tile == null)
|
||||
return null;
|
||||
|
||||
RoomItem highestItem = null;
|
||||
|
||||
for (RoomItem item : this.getItemsAt(x, y)) {
|
||||
if (exclude != null && exclude == item)
|
||||
continue;
|
||||
|
||||
if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item))
|
||||
continue;
|
||||
|
||||
highestItem = item;
|
||||
}
|
||||
|
||||
return highestItem;
|
||||
}
|
||||
|
||||
public RoomItem getTopItemAt(THashSet<RoomTile> tiles, RoomItem exclude) {
|
||||
RoomItem highestItem = null;
|
||||
for (RoomTile tile : tiles) {
|
||||
|
||||
if (tile == null)
|
||||
continue;
|
||||
|
||||
for (RoomItem item : this.getItemsAt(tile.getX(), tile.getY())) {
|
||||
if (exclude != null && exclude == item)
|
||||
continue;
|
||||
|
||||
if (highestItem != null && highestItem.getZ() + Item.getCurrentHeight(highestItem) > item.getZ() + Item.getCurrentHeight(item))
|
||||
continue;
|
||||
|
||||
highestItem = item;
|
||||
}
|
||||
}
|
||||
|
||||
return highestItem;
|
||||
}
|
||||
|
||||
public double getTopHeightAt(int x, int y) {
|
||||
RoomItem item = this.getTopItemAt(x, y);
|
||||
if (item != null) {
|
||||
return (item.getZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0));
|
||||
} else {
|
||||
return this.room.getLayout().getHeightAtSquare(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
public RoomItem getLowestChair(RoomTile tile) {
|
||||
RoomItem lowestChair = null;
|
||||
|
||||
THashSet<RoomItem> items = this.getItemsAt(tile);
|
||||
if (items != null && !items.isEmpty()) {
|
||||
for (RoomItem item : items) {
|
||||
|
||||
if (!item.getBaseItem().allowSit())
|
||||
continue;
|
||||
|
||||
if (lowestChair != null && lowestChair.getZ() < item.getZ())
|
||||
continue;
|
||||
|
||||
lowestChair = item;
|
||||
}
|
||||
}
|
||||
|
||||
return lowestChair;
|
||||
}
|
||||
|
||||
public RoomItem getTallestChair(RoomTile tile) {
|
||||
RoomItem lowestChair = null;
|
||||
|
||||
THashSet<RoomItem> items = this.getItemsAt(tile);
|
||||
if (items != null && !items.isEmpty()) {
|
||||
for (RoomItem item : items) {
|
||||
|
||||
if (!item.getBaseItem().allowSit())
|
||||
continue;
|
||||
|
||||
if (lowestChair != null && lowestChair.getZ() + Item.getCurrentHeight(lowestChair) > item.getZ() + Item.getCurrentHeight(item))
|
||||
continue;
|
||||
|
||||
lowestChair = item;
|
||||
}
|
||||
}
|
||||
|
||||
return lowestChair;
|
||||
}
|
||||
|
||||
public void addCycleTask(ICycleable task) {
|
||||
this.cycleTasks.add(task);
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ public class RoomManager {
|
||||
if(spawnLocation != null) {
|
||||
roomHabbo.setCanLeaveRoomByDoor(false);
|
||||
roomHabbo.setTeleporting(true);
|
||||
RoomItem topItem = room.getTopItemAt(spawnLocation);
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(spawnLocation);
|
||||
|
||||
if(topItem != null) {
|
||||
spawnDirection = RoomRotation.values()[topItem.getRotation()];
|
||||
@ -674,7 +674,7 @@ public class RoomManager {
|
||||
}
|
||||
}
|
||||
|
||||
roomHabbo.resetIdleTimer();
|
||||
roomHabbo.resetIdleTicks();
|
||||
roomHabbo.setInvisible(false);
|
||||
|
||||
room.getRoomUnitManager().addRoomUnit(habbo);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.rooms;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.RoomEntity;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.items.RoomItem;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -17,7 +17,8 @@ public class RoomTile {
|
||||
private final short y;
|
||||
@Getter
|
||||
private final short z;
|
||||
private final HashSet<RoomEntity> units;
|
||||
private final HashSet<RoomUnit> roomUnits;
|
||||
private final HashSet<RoomItem> roomItems;
|
||||
@Setter
|
||||
@Getter
|
||||
private RoomTileState state;
|
||||
@ -39,7 +40,8 @@ public class RoomTile {
|
||||
this.stackHeight = z;
|
||||
this.state = state;
|
||||
this.setAllowStack(allowStack);
|
||||
this.units = new HashSet<>();
|
||||
this.roomUnits = new HashSet<>();
|
||||
this.roomItems = new HashSet<>();
|
||||
}
|
||||
|
||||
public RoomTile(RoomTile tile) {
|
||||
@ -56,20 +58,8 @@ public class RoomTile {
|
||||
if (this.state == RoomTileState.INVALID) {
|
||||
this.allowStack = false;
|
||||
}
|
||||
this.units = tile.units;
|
||||
}
|
||||
|
||||
public RoomTile() {
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
this.stackHeight = 0;
|
||||
this.state = RoomTileState.INVALID;
|
||||
this.allowStack = false;
|
||||
this.diagonally = false;
|
||||
this.gCosts = 0;
|
||||
this.hCosts = 0;
|
||||
this.units = null;
|
||||
this.roomUnits = tile.roomUnits;
|
||||
this.roomItems = tile.roomItems;
|
||||
}
|
||||
|
||||
public double getStackHeight() {
|
||||
@ -175,36 +165,41 @@ public class RoomTile {
|
||||
return this.x == x && this.y == y;
|
||||
}
|
||||
|
||||
public List<RoomEntity> getEntities() {
|
||||
synchronized (this.units) {
|
||||
return new ArrayList<>(this.units);
|
||||
public List<RoomUnit> getRoomUnits() {
|
||||
synchronized (this.roomUnits) {
|
||||
return new ArrayList<>(this.roomUnits);
|
||||
}
|
||||
}
|
||||
|
||||
public void addUnit(RoomEntity entity) {
|
||||
synchronized (this.units) {
|
||||
if (!this.units.contains(entity)) {
|
||||
this.units.add(entity);
|
||||
public void addRoomUnit(RoomUnit roomUnit) {
|
||||
synchronized (this.roomUnits) {
|
||||
if (!this.roomUnits.contains(roomUnit)) {
|
||||
this.roomUnits.add(roomUnit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeUnit(RoomEntity entity) {
|
||||
synchronized (this.units) {
|
||||
this.units.remove(entity);
|
||||
public void removeUnit(RoomUnit roomUnit) {
|
||||
synchronized (this.roomUnits) {
|
||||
this.roomUnits.remove(roomUnit);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasUnits() {
|
||||
synchronized (this.units) {
|
||||
return this.units.size() > 0;
|
||||
synchronized (this.roomUnits) {
|
||||
return !this.roomUnits.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean unitIsOnFurniOnTile(RoomUnit unit, Item item) {
|
||||
if ((unit.getCurrentPosition().getX() < this.x || unit.getCurrentPosition().getX() >= this.x + item.getLength()))
|
||||
public boolean unitIsOnFurniOnTile(RoomUnit roomUnit, Item item) {
|
||||
if ((roomUnit.getCurrentPosition().getX() < this.x || roomUnit.getCurrentPosition().getX() >= this.x + item.getLength())) {
|
||||
return false;
|
||||
if (unit.getCurrentPosition().getY() < this.y) return false;
|
||||
return unit.getCurrentPosition().getY() < this.y + item.getWidth();
|
||||
}
|
||||
|
||||
if (roomUnit.getCurrentPosition().getY() < this.y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return roomUnit.getCurrentPosition().getY() < this.y + item.getWidth();
|
||||
}
|
||||
}
|
@ -307,7 +307,7 @@ public class RoomUnitManager {
|
||||
|
||||
roomHabbo.getRoom().sendComposer(new UserRemoveMessageComposer(roomHabbo).compose());
|
||||
|
||||
RoomItem item = roomHabbo.getRoom().getTopItemAt(roomHabbo.getCurrentPosition());
|
||||
RoomItem item = roomHabbo.getRoom().getRoomItemManager().getTopItemAt(roomHabbo.getCurrentPosition());
|
||||
|
||||
if (item != null) {
|
||||
try {
|
||||
|
@ -25,7 +25,5 @@ public interface IRoomEntity {
|
||||
double getTargetZ();
|
||||
RoomEntity setTargetZ(double targetZ);
|
||||
|
||||
void setTargetTile(short x, short y);
|
||||
|
||||
void incrementTilesMoved();
|
||||
}
|
@ -12,7 +12,7 @@ import java.util.LinkedList;
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
public class RoomEntity implements IRoomEntity {
|
||||
public abstract class RoomEntity implements IRoomEntity {
|
||||
private Room room;
|
||||
private RoomTile previousPosition;
|
||||
private double previousZ;
|
||||
@ -23,32 +23,6 @@ public class RoomEntity implements IRoomEntity {
|
||||
private Deque<RoomTile> path = new LinkedList<>();
|
||||
private int tilesMoved;
|
||||
|
||||
public RoomEntity setCurrentPosition(RoomTile tile) {
|
||||
if (this.currentPosition != null) {
|
||||
this.currentPosition.removeUnit(this);
|
||||
}
|
||||
|
||||
this.currentPosition = tile;
|
||||
|
||||
if(this.currentPosition != null) {
|
||||
tile.addUnit(this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setTargetTile(short x, short y) {
|
||||
RoomTile targetTile = this.getRoom().getLayout().getTile(x, y);
|
||||
|
||||
if(this.getCurrentPosition().equals(targetTile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetTile.isWalkable()) {
|
||||
this.setTargetPosition(targetTile);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void incrementTilesMoved() {
|
||||
this.tilesMoved++;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
|
||||
public void onPickUp(Room room) {
|
||||
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
||||
RoomItem topItem2 = room.getTopItemAt(this.getX(), this.getY(), this);
|
||||
RoomItem topItem2 = room.getRoomItemManager().getTopItemAt(this.getX(), this.getY(), this);
|
||||
int nextEffectM = 0;
|
||||
int nextEffectF = 0;
|
||||
|
||||
@ -370,7 +370,7 @@ public abstract class RoomItem implements Runnable, IEventTriggers {
|
||||
|
||||
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
|
||||
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) {
|
||||
RoomItem topItem2 = room.getTopItemAt(oldLocation.getX(), oldLocation.getY(), this);
|
||||
RoomItem topItem2 = room.getRoomItemManager().getTopItemAt(oldLocation.getX(), oldLocation.getY(), this);
|
||||
int nextEffectM = 0;
|
||||
int nextEffectF = 0;
|
||||
|
||||
|
@ -80,7 +80,6 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
private boolean sitUpdate = false;
|
||||
@Setter
|
||||
private boolean isKicked;
|
||||
@Getter
|
||||
@Setter
|
||||
private int kickCount = 0;
|
||||
@Getter
|
||||
@ -109,8 +108,6 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
private int previousEffectId;
|
||||
private int previousEffectEndTimestamp;
|
||||
private int timeInRoom;
|
||||
//RoomHabbo
|
||||
private int idleTicks;
|
||||
@Getter
|
||||
private RoomRightLevels rightsLevel = RoomRightLevels.NONE;
|
||||
private final THashSet<Integer> overridableTiles;
|
||||
@ -143,6 +140,21 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
|
||||
public abstract boolean cycle(Room room);
|
||||
|
||||
@Override
|
||||
public RoomUnit setCurrentPosition(RoomTile tile) {
|
||||
if (this.getCurrentPosition() != null) {
|
||||
this.getCurrentPosition().removeUnit(this);
|
||||
}
|
||||
|
||||
super.setCurrentPosition(tile);
|
||||
|
||||
if(this.getCurrentPosition() != null) {
|
||||
tile.addRoomUnit(this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setRotation(RoomRotation rotation) {
|
||||
this.bodyRotation = rotation;
|
||||
this.headRotation = rotation;
|
||||
@ -273,7 +285,7 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
}
|
||||
|
||||
public void makeStand() {
|
||||
RoomItem item = this.getRoom().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
RoomItem item = this.getRoom().getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
if (item == null || !item.getBaseItem().allowSit() || !item.getBaseItem().allowLay()) {
|
||||
this.setCmdStandEnabled(true);
|
||||
this.setBodyRotation(RoomRotation.values()[this.getBodyRotation().getValue() - this.getBodyRotation().getValue() % 2]);
|
||||
@ -339,22 +351,6 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
this.timeInRoom = 0;
|
||||
}
|
||||
|
||||
public void increaseIdleTimer() {
|
||||
this.idleTicks++;
|
||||
}
|
||||
|
||||
public boolean isIdle() {
|
||||
return this.idleTicks > Room.IDLE_CYCLES; //Amount of room cycles / 2 = seconds.
|
||||
}
|
||||
|
||||
public void resetIdleTimer() {
|
||||
this.idleTicks = 0;
|
||||
}
|
||||
|
||||
public void setIdle() {
|
||||
this.idleTicks = Room.IDLE_CYCLES + 1;
|
||||
}
|
||||
|
||||
public void lookAtPoint(RoomTile location) {
|
||||
if (!this.isCanRotate()) {
|
||||
return;
|
||||
@ -388,7 +384,7 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
public boolean canOverrideTile(RoomTile tile) {
|
||||
if (tile == null || this.getRoom() == null || this.getRoom().getLayout() == null) return false;
|
||||
|
||||
if (this.getRoom().getItemsAt(tile).stream().anyMatch(i -> i.canOverrideTile(this, this.getRoom(), tile)))
|
||||
if (this.getRoom().getRoomItemManager().getItemsAt(tile).stream().anyMatch(i -> i.canOverrideTile(this, this.getRoom(), tile)))
|
||||
return true;
|
||||
|
||||
int tileIndex = (tile.getX() & 0xFF) | (tile.getY() << 12);
|
||||
@ -412,7 +408,7 @@ public abstract class RoomUnit extends RoomEntity {
|
||||
public boolean canForcePosture() {
|
||||
if (this.getRoom() == null) return false;
|
||||
|
||||
RoomItem topItem = this.getRoom().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
RoomItem topItem = this.getRoom().getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
|
||||
return (!(topItem instanceof InteractionWater) && !(topItem instanceof InteractionWaterItem));
|
||||
}
|
||||
|
@ -130,13 +130,14 @@ public class RoomAvatar extends RoomUnit {
|
||||
this.removeStatus(RoomUnitStatus.DEAD);
|
||||
|
||||
if (habbo != null) {
|
||||
if (this.isIdle()) {
|
||||
UserIdleEvent event = new UserIdleEvent(habbo, UserIdleEvent.IdleReason.WALKED, false);
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
if(this instanceof RoomHabbo roomHabbo) {
|
||||
if (roomHabbo.isIdle()) {
|
||||
UserIdleEvent event = new UserIdleEvent(habbo, UserIdleEvent.IdleReason.WALKED, false);
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
|
||||
if (!event.isCancelled() && !event.isIdle()) {
|
||||
room.unIdle(habbo);
|
||||
this.resetIdleTimer();;
|
||||
if (!event.isCancelled() && !event.isIdle()) {
|
||||
roomHabbo.unIdle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +153,7 @@ public class RoomAvatar extends RoomUnit {
|
||||
}
|
||||
}
|
||||
|
||||
RoomItem item = room.getTopItemAt(next.getX(), next.getY());
|
||||
RoomItem item = room.getRoomItemManager().getTopItemAt(next.getX(), next.getY());
|
||||
|
||||
double height = next.getStackHeight() - this.getCurrentPosition().getStackHeight();
|
||||
if (!room.tileWalkable(next) || (!RoomLayout.ALLOW_FALLING && height < -RoomLayout.MAXIMUM_STEP_HEIGHT) || (next.getState() == RoomTileState.OPEN && height > RoomLayout.MAXIMUM_STEP_HEIGHT)) {
|
||||
@ -172,7 +173,7 @@ public class RoomAvatar extends RoomUnit {
|
||||
boolean canSitNextTile = room.canSitAt(next.getX(), next.getY());
|
||||
|
||||
if (canSitNextTile) {
|
||||
RoomItem tallestChair = room.getTallestChair(next);
|
||||
RoomItem tallestChair = room.getRoomItemManager().getTallestChair(next);
|
||||
|
||||
if (tallestChair != null)
|
||||
item = tallestChair;
|
||||
@ -190,7 +191,7 @@ public class RoomAvatar extends RoomUnit {
|
||||
zHeight += 1.0D;
|
||||
}
|
||||
|
||||
RoomItem roomItem = room.getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
RoomItem roomItem = room.getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
if (roomItem != null && (roomItem != item || !RoomLayout.pointInSquare(roomItem.getX(), roomItem.getY(), roomItem.getX() + roomItem.getBaseItem().getWidth() - 1, roomItem.getY() + roomItem.getBaseItem().getLength() - 1, next.getX(), next.getY())))
|
||||
roomItem.onWalkOff(this, room, new Object[]{this.getCurrentPosition(), next});
|
||||
|
||||
@ -255,10 +256,13 @@ public class RoomAvatar extends RoomUnit {
|
||||
|
||||
this.setCurrentZ(zHeight);
|
||||
this.setCurrentPosition(room.getLayout().getTile(next.getX(), next.getY()));
|
||||
this.resetIdleTimer();
|
||||
|
||||
if(this instanceof RoomHabbo roomHabbo) {
|
||||
roomHabbo.resetIdleTicks();
|
||||
}
|
||||
|
||||
if(habbo != null) {
|
||||
RoomItem topItem = room.getTopItemAt(next.getX(), next.getY());
|
||||
RoomItem topItem = room.getRoomItemManager().getTopItemAt(next.getX(), next.getY());
|
||||
|
||||
boolean isAtDoor = next.getX() == room.getLayout().getDoorX() && next.getY() == room.getLayout().getDoorY();
|
||||
boolean publicRoomKicks = !room.getRoomInfo().isPublicRoom() || Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick");
|
||||
|
@ -2,6 +2,10 @@ package com.eu.habbo.habbohotel.rooms.entities.units.types;
|
||||
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnitType;
|
||||
import com.eu.habbo.habbohotel.users.DanceType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.SleepMessageComposer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
@ -45,14 +49,42 @@ public class RoomHabbo extends RoomAvatar {
|
||||
this.kickCount++;
|
||||
}
|
||||
|
||||
public void incrementIdleTick() {
|
||||
this.idleTicks++;
|
||||
public void idle() {
|
||||
this.setIdle();
|
||||
|
||||
if (this.getDanceType() != DanceType.NONE) {
|
||||
this.setDance(DanceType.NONE);
|
||||
}
|
||||
|
||||
this.getRoom().sendComposer(new SleepMessageComposer(this).compose());
|
||||
|
||||
WiredHandler.handle(WiredTriggerType.IDLES, this, this.getRoom(), new Object[]{this});
|
||||
}
|
||||
|
||||
public void unIdle() {
|
||||
this.resetIdleTicks();
|
||||
|
||||
this.getRoom().sendComposer(new SleepMessageComposer(this).compose());
|
||||
|
||||
WiredHandler.handle(WiredTriggerType.UNIDLES, this, this.getRoom(), new Object[]{this});
|
||||
}
|
||||
|
||||
public boolean isIdle() {
|
||||
return this.idleTicks > Room.IDLE_CYCLES;
|
||||
}
|
||||
|
||||
public void setIdle() {
|
||||
this.idleTicks = Room.IDLE_CYCLES + 1;
|
||||
}
|
||||
|
||||
public void incrementIdleTicks() {
|
||||
this.idleTicks++;
|
||||
}
|
||||
|
||||
public void resetIdleTicks() {
|
||||
this.idleTicks = 0;
|
||||
}
|
||||
|
||||
public RoomUnitType getRoomUnitType() {
|
||||
return RoomUnitType.HABBO;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class RoomPet extends RoomUnit {
|
||||
|
||||
this.removeStatus(RoomUnitStatus.DEAD);
|
||||
|
||||
RoomItem item = room.getTopItemAt(next.getX(), next.getY());
|
||||
RoomItem item = room.getRoomItemManager().getTopItemAt(next.getX(), next.getY());
|
||||
|
||||
double height = next.getStackHeight() - this.getCurrentPosition().getStackHeight();
|
||||
if (!room.tileWalkable(next) || (!RoomLayout.ALLOW_FALLING && height < -RoomLayout.MAXIMUM_STEP_HEIGHT) || (next.getState() == RoomTileState.OPEN && height > RoomLayout.MAXIMUM_STEP_HEIGHT)) {
|
||||
@ -109,7 +109,7 @@ public class RoomPet extends RoomUnit {
|
||||
boolean canSitNextTile = room.canSitAt(next.getX(), next.getY());
|
||||
|
||||
if (canSitNextTile) {
|
||||
RoomItem tallestChair = room.getTallestChair(next);
|
||||
RoomItem tallestChair = room.getRoomItemManager().getTallestChair(next);
|
||||
|
||||
if (tallestChair != null)
|
||||
item = tallestChair;
|
||||
@ -123,7 +123,7 @@ public class RoomPet extends RoomUnit {
|
||||
|
||||
double zHeight = 0.0D;
|
||||
|
||||
RoomItem roomItem = room.getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
RoomItem roomItem = room.getRoomItemManager().getTopItemAt(this.getCurrentPosition().getX(), this.getCurrentPosition().getY());
|
||||
if (roomItem != null && (roomItem != item || !RoomLayout.pointInSquare(roomItem.getX(), roomItem.getY(), roomItem.getX() + roomItem.getBaseItem().getWidth() - 1, roomItem.getY() + roomItem.getBaseItem().getLength() - 1, next.getX(), next.getY())))
|
||||
roomItem.onWalkOff(this, room, new Object[]{this.getCurrentPosition(), next});
|
||||
|
||||
|
@ -460,7 +460,7 @@ public class Habbo extends Unit implements Runnable {
|
||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectGiven"));
|
||||
AchievementManager.progressAchievement(target, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned"));
|
||||
|
||||
this.client.getHabbo().getRoomUnit().getRoom().unIdle(this.client.getHabbo());
|
||||
this.client.getHabbo().getRoomUnit().unIdle();
|
||||
this.client.getHabbo().getRoomUnit().setDance(DanceType.NONE);
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ public class WiredHandler {
|
||||
public static boolean executeEffectsAtTiles(THashSet<RoomTile> tiles, final RoomUnit roomUnit, final Room room, final Object[] stuff) {
|
||||
for (RoomTile tile : tiles) {
|
||||
if (room != null) {
|
||||
THashSet<RoomItem> items = room.getItemsAt(tile);
|
||||
THashSet<RoomItem> items = room.getRoomItemManager().getItemsAt(tile);
|
||||
|
||||
long millis = room.getCycleTimestamp();
|
||||
for (final RoomItem item : items) {
|
||||
|
@ -111,7 +111,7 @@ public class UpdateFloorPropertiesEvent extends MessageHandler {
|
||||
String square = String.valueOf(mapRows[y].charAt(x));
|
||||
short height;
|
||||
|
||||
if (square.equalsIgnoreCase("x") && room.getTopItemAt(x, y) != null) {
|
||||
if (square.equalsIgnoreCase("x") && room.getRoomItemManager().getTopItemAt(x, y) != null) {
|
||||
errors.add("${notification.floorplan_editor.error.message.change_blocked_by_room_item}");
|
||||
break blockingRoomItemScan;
|
||||
} else {
|
||||
@ -124,7 +124,7 @@ public class UpdateFloorPropertiesEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (tile != null && tile.getState() != RoomTileState.INVALID && height != tile.getZ() && room.getTopItemAt(x, y) != null) {
|
||||
if (tile != null && tile.getState() != RoomTileState.INVALID && height != tile.getZ() && room.getRoomItemManager().getTopItemAt(x, y) != null) {
|
||||
errors.add("${notification.floorplan_editor.error.message.change_blocked_by_room_item}");
|
||||
break blockingRoomItemScan;
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ public class AvatarExpressionEvent extends MessageHandler {
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.isIdle()) {
|
||||
room.idle(habbo);
|
||||
habbo.getRoomUnit().idle();
|
||||
} else {
|
||||
room.unIdle(habbo);
|
||||
habbo.getRoomUnit().unIdle();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -46,7 +46,7 @@ public class AvatarExpressionEvent extends MessageHandler {
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
|
||||
if (!event.isCancelled() && !event.isIdle()) {
|
||||
room.unIdle(habbo);
|
||||
habbo.getRoomUnit().unIdle();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class ChangePostureEvent extends MessageHandler {
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (!event.isIdle()) {
|
||||
this.client.getHabbo().getRoomUnit().getRoom().unIdle(this.client.getHabbo());
|
||||
this.client.getHabbo().getRoomUnit().unIdle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class DanceEvent extends MessageHandler {
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (!event.isIdle()) {
|
||||
this.client.getHabbo().getRoomUnit().getRoom().unIdle(habbo);
|
||||
this.client.getHabbo().getRoomUnit().unIdle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ public class DropCarryItemEvent extends MessageHandler {
|
||||
Room room = this.client.getHabbo().getRoomUnit().getRoom();
|
||||
this.client.getHabbo().getRoomUnit().setHandItem(0);
|
||||
if (room != null) {
|
||||
room.unIdle(this.client.getHabbo());
|
||||
this.client.getHabbo().getRoomUnit().unIdle();
|
||||
room.sendComposer(new CarryObjectMessageComposer(this.client.getHabbo().getRoomUnit()).compose());
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package com.eu.habbo.messages.incoming.rooms.users;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
@ -26,31 +26,31 @@ public class LookToEvent extends MessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
RoomUnit roomUnit = habbo.getRoomUnit();
|
||||
RoomHabbo roomHabbo = habbo.getRoomUnit();
|
||||
|
||||
if (!roomUnit.isCanWalk())
|
||||
if (!roomHabbo.isCanWalk())
|
||||
return;
|
||||
|
||||
if (roomUnit.isWalking() || roomUnit.hasStatus(RoomUnitStatus.MOVE))
|
||||
if (roomHabbo.isWalking() || roomHabbo.hasStatus(RoomUnitStatus.MOVE))
|
||||
return;
|
||||
|
||||
if (roomUnit.isCmdLayEnabled() || roomUnit.hasStatus(RoomUnitStatus.LAY))
|
||||
if (roomHabbo.isCmdLayEnabled() || roomHabbo.hasStatus(RoomUnitStatus.LAY))
|
||||
return;
|
||||
|
||||
if (roomUnit.isIdle())
|
||||
if (roomHabbo.isIdle())
|
||||
return;
|
||||
|
||||
int x = this.packet.readInt();
|
||||
int y = this.packet.readInt();
|
||||
|
||||
if (x == roomUnit.getCurrentPosition().getX()) {
|
||||
if (y == roomUnit.getCurrentPosition().getY()) return;
|
||||
if (x == roomHabbo.getCurrentPosition().getX()) {
|
||||
if (y == roomHabbo.getCurrentPosition().getY()) return;
|
||||
}
|
||||
|
||||
RoomTile tile = habbo.getRoomUnit().getRoom().getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (tile != null) {
|
||||
roomUnit.lookAtPoint(tile);
|
||||
roomHabbo.lookAtPoint(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
||||
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.types.RoomHabbo;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitOnRollerComposer;
|
||||
@ -37,19 +37,19 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
// Get Room Habbo object (Unique GUID?)
|
||||
RoomUnit roomUnit = this.client.getHabbo().getRoomUnit();
|
||||
RoomHabbo roomHabbo = this.client.getHabbo().getRoomUnit();
|
||||
|
||||
if(roomUnit == null) {
|
||||
if(roomHabbo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If habbo is teleporting, don't calculate a new path
|
||||
if (roomUnit.isTeleporting()) {
|
||||
if (roomHabbo.isTeleporting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If habbo is being kicked don't calculate a new path
|
||||
if (roomUnit.isKicked()) {
|
||||
if (roomHabbo.isKicked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -61,13 +61,13 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
// Don't calulcate a new path if are already at the end position
|
||||
if (x == roomUnit.getCurrentPosition().getX() && y == roomUnit.getCurrentPosition().getY()) {
|
||||
if (x == roomHabbo.getCurrentPosition().getX() && y == roomHabbo.getCurrentPosition().getY()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If habbo has control (im assuming admin, do something else, but we dont care about this part here)
|
||||
if (roomUnit.getCacheable().get("control") != null) {
|
||||
habbo = (Habbo) roomUnit.getCacheable().get("control");
|
||||
if (roomHabbo.getCacheable().get("control") != null) {
|
||||
habbo = (Habbo) roomHabbo.getCacheable().get("control");
|
||||
|
||||
if (habbo.getRoomUnit().getRoom() != room) {
|
||||
habbo.getRoomUnit().getCacheable().remove("controller");
|
||||
@ -77,20 +77,20 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
// Recover roomUnit if necessary
|
||||
roomUnit = habbo.getRoomUnit();
|
||||
roomHabbo = habbo.getRoomUnit();
|
||||
|
||||
// If our room unit is not nullptr and we are in a room and we can walk, then calculate a new path
|
||||
if (roomUnit != null && roomUnit.isInRoom() && roomUnit.isCanWalk()) {
|
||||
if (roomHabbo != null && roomHabbo.isInRoom() && roomHabbo.isCanWalk()) {
|
||||
|
||||
//If teleport command is enabled
|
||||
if(roomUnit.isCmdTeleportEnabled()) {
|
||||
if(roomHabbo.isCmdTeleportEnabled()) {
|
||||
RoomTile t = room.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (habbo.getHabboInfo().getRiding() != null) {
|
||||
room.sendComposer(new RoomUnitOnRollerComposer(roomUnit, null, roomUnit.getCurrentPosition(), roomUnit.getCurrentZ(), t, t.getStackHeight() + 1.0D, room).compose());
|
||||
room.sendComposer(new RoomUnitOnRollerComposer(roomHabbo, null, roomHabbo.getCurrentPosition(), roomHabbo.getCurrentZ(), t, t.getStackHeight() + 1.0D, room).compose());
|
||||
room.sendComposer(new RoomUnitOnRollerComposer(habbo.getHabboInfo().getRiding().getRoomUnit(), t, room).compose());
|
||||
} else {
|
||||
room.sendComposer(new RoomUnitOnRollerComposer(roomUnit, t, room).compose());
|
||||
room.sendComposer(new RoomUnitOnRollerComposer(roomHabbo, t, room).compose());
|
||||
}
|
||||
|
||||
return;
|
||||
@ -101,14 +101,15 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
return;
|
||||
|
||||
// Reset idle status
|
||||
if (roomUnit.isIdle()) {
|
||||
if (roomHabbo.isIdle()) {
|
||||
UserIdleEvent event = new UserIdleEvent(habbo, UserIdleEvent.IdleReason.WALKED, false);
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (!event.isIdle()) {
|
||||
if (roomUnit.getRoom() != null) roomUnit.getRoom().unIdle(habbo);
|
||||
roomUnit.resetIdleTimer();
|
||||
if (roomHabbo.getRoom() != null) {
|
||||
roomHabbo.unIdle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,7 +129,7 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
if (room.canLayAt(tile)) {
|
||||
RoomItem bed = room.getTopItemAt(tile.getX(), tile.getY());
|
||||
RoomItem bed = room.getRoomItemManager().getTopItemAt(tile.getX(), tile.getY());
|
||||
|
||||
if (bed != null && bed.getBaseItem().allowLay()) {
|
||||
room.getLayout().getTile(bed.getX(), bed.getY());
|
||||
@ -139,17 +140,17 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
};
|
||||
|
||||
if (pillow != null && room.canLayAt(pillow)) {
|
||||
roomUnit.setGoalLocation(pillow);
|
||||
roomHabbo.setGoalLocation(pillow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
THashSet<RoomItem> items = room.getItemsAt(tile);
|
||||
THashSet<RoomItem> items = room.getRoomItemManager().getItemsAt(tile);
|
||||
|
||||
if (items.size() > 0) {
|
||||
for (RoomItem item : items) {
|
||||
RoomTile overriddenTile = item.getOverrideGoalTile(roomUnit, room, tile);
|
||||
RoomTile overriddenTile = item.getOverrideGoalTile(roomHabbo, room, tile);
|
||||
|
||||
if (overriddenTile == null) {
|
||||
return; // null cancels the entire event
|
||||
@ -164,7 +165,7 @@ public class MoveAvatarEvent extends MessageHandler {
|
||||
|
||||
// This is where we set the end location and begin finding a path
|
||||
if (tile.isWalkable() || room.canSitOrLayAt(tile.getX(), tile.getY())) {
|
||||
roomUnit.setGoalLocation(tile);
|
||||
roomHabbo.setGoalLocation(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class SignEvent extends MessageHandler {
|
||||
UserSignEvent event = new UserSignEvent(this.client.getHabbo(), signId);
|
||||
if (!Emulator.getPluginManager().fireEvent(event).isCancelled()) {
|
||||
this.client.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.SIGN, event.getSign() + "");
|
||||
this.client.getHabbo().getRoomUnit().getRoom().unIdle(this.client.getHabbo());
|
||||
this.client.getHabbo().getRoomUnit().unIdle();
|
||||
|
||||
if(signId <= 10) {
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class RoomUnitOnRollerComposer extends MessageComposer {
|
||||
this.newLocation = newLocation;
|
||||
this.newZ = newZ;
|
||||
this.room = room;
|
||||
oldTopItem = this.room.getTopItemAt(oldLocation.getX(), oldLocation.getY());
|
||||
oldTopItem = this.room.getRoomItemManager().getTopItemAt(oldLocation.getX(), oldLocation.getY());
|
||||
}
|
||||
|
||||
public RoomUnitOnRollerComposer(RoomUnit roomUnit, RoomTile newLocation, Room room) {
|
||||
@ -70,8 +70,8 @@ public class RoomUnitOnRollerComposer extends MessageComposer {
|
||||
if (this.roller != null && room.getLayout() != null) {
|
||||
Emulator.getThreading().run(() -> {
|
||||
if(!this.roomUnit.isWalking() && this.roomUnit.getCurrentPosition() == this.oldLocation) {
|
||||
RoomItem topItem = this.room.getTopItemAt(this.oldLocation.getX(), this.oldLocation.getY());
|
||||
RoomItem topItemNewLocation = this.room.getTopItemAt(this.newLocation.getX(), this.newLocation.getY());
|
||||
RoomItem topItem = this.room.getRoomItemManager().getTopItemAt(this.oldLocation.getX(), this.oldLocation.getY());
|
||||
RoomItem topItemNewLocation = this.room.getRoomItemManager().getTopItemAt(this.newLocation.getX(), this.newLocation.getY());
|
||||
|
||||
if (topItem != null && (oldTopItem == null || oldTopItem != topItemNewLocation)) {
|
||||
try {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.eu.habbo.messages.outgoing.rooms.users;
|
||||
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.rooms.entities.units.types.RoomHabbo;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||
import com.eu.habbo.messages.outgoing.Outgoing;
|
||||
@ -8,14 +8,14 @@ import lombok.AllArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class SleepMessageComposer extends MessageComposer {
|
||||
private final RoomUnit roomUnit;
|
||||
private final RoomHabbo roomHabbo;
|
||||
|
||||
|
||||
@Override
|
||||
protected ServerMessage composeInternal() {
|
||||
this.response.init(Outgoing.sleepMessageComposer);
|
||||
this.response.appendInt(this.roomUnit.getVirtualId());
|
||||
this.response.appendBoolean(this.roomUnit.isIdle());
|
||||
this.response.appendInt(this.roomHabbo.getVirtualId());
|
||||
this.response.appendBoolean(this.roomHabbo.isIdle());
|
||||
return this.response;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class BanzaiRandomTeleport implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
RoomItem topItemNow = this.room.getTopItemAt(this.habbo.getCurrentPosition().getX(), this.habbo.getCurrentPosition().getY());
|
||||
RoomItem topItemNow = this.room.getRoomItemManager().getTopItemAt(this.habbo.getCurrentPosition().getX(), this.habbo.getCurrentPosition().getY());
|
||||
RoomTile lastLocation = this.habbo.getCurrentPosition();
|
||||
RoomTile newLocation = this.room.getLayout().getTile(toItem.getX(), toItem.getY());
|
||||
|
||||
@ -45,7 +45,7 @@ public class BanzaiRandomTeleport implements Runnable {
|
||||
|
||||
Emulator.getThreading().run(() -> {
|
||||
this.habbo.setCanWalk(true);
|
||||
RoomItem topItemNext = this.room.getTopItemAt(this.habbo.getCurrentPosition().getX(), this.habbo.getCurrentPosition().getY());
|
||||
RoomItem topItemNext = this.room.getRoomItemManager().getTopItemAt(this.habbo.getCurrentPosition().getX(), this.habbo.getCurrentPosition().getY());
|
||||
|
||||
if(topItemNext != null) {
|
||||
try {
|
||||
|
@ -21,7 +21,7 @@ public class ClearRentedSpace implements Runnable {
|
||||
HashSet<RoomItem> items = new HashSet<>();
|
||||
|
||||
for (RoomTile t : this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())) {
|
||||
for (RoomItem i : this.room.getItemsAt(t)) {
|
||||
for (RoomItem i : this.room.getRoomItemManager().getItemsAt(t)) {
|
||||
if (i.getOwnerId() == this.item.getRenterId()) {
|
||||
items.add(i);
|
||||
i.setRoomId(0);
|
||||
|
@ -40,7 +40,7 @@ public class RoomTrashing implements Runnable {
|
||||
if (event.habbo.getRoomUnit().getRoom().equals(INSTANCE.room)) {
|
||||
THashSet<ServerMessage> messages = new THashSet<>();
|
||||
|
||||
THashSet<RoomItem> items = INSTANCE.room.getItemsAt(event.toLocation);
|
||||
THashSet<RoomItem> items = INSTANCE.room.getRoomItemManager().getItemsAt(event.toLocation);
|
||||
|
||||
int offset = Emulator.getRandom().nextInt(4) + 2;
|
||||
|
||||
@ -56,7 +56,7 @@ public class RoomTrashing implements Runnable {
|
||||
}
|
||||
|
||||
for (RoomItem item : items) {
|
||||
double offsetZ = (INSTANCE.room.getTopHeightAt(t.getX(), t.getY())) - item.getZ();
|
||||
double offsetZ = (INSTANCE.room.getRoomItemManager().getTopHeightAt(t.getX(), t.getY())) - item.getZ();
|
||||
|
||||
messages.add(new FloorItemOnRollerComposer(item, null, t, offsetZ, INSTANCE.room).compose());
|
||||
}
|
||||
@ -78,11 +78,11 @@ public class RoomTrashing implements Runnable {
|
||||
RoomTile s = INSTANCE.room.getLayout().getTileInFront(INSTANCE.habbo.getRoomUnit().getCurrentPosition(), INSTANCE.habbo.getRoomUnit().getBodyRotation().getValue() + 7);
|
||||
|
||||
if (s != null) {
|
||||
items = INSTANCE.room.getItemsAt(s);
|
||||
items = INSTANCE.room.getRoomItemManager().getItemsAt(s);
|
||||
}
|
||||
|
||||
for (RoomItem item : items) {
|
||||
double offsetZ = (INSTANCE.room.getTopHeightAt(t.getX(), t.getY())) - item.getZ();
|
||||
double offsetZ = (INSTANCE.room.getRoomItemManager().getTopHeightAt(t.getX(), t.getY())) - item.getZ();
|
||||
|
||||
messages.add(new FloorItemOnRollerComposer(item, null, t, offsetZ, INSTANCE.room).compose());
|
||||
}
|
||||
@ -101,10 +101,10 @@ public class RoomTrashing implements Runnable {
|
||||
}
|
||||
|
||||
s = INSTANCE.getRoom().getLayout().getTileInFront(INSTANCE.habbo.getRoomUnit().getCurrentPosition(), INSTANCE.habbo.getRoomUnit().getBodyRotation().getValue() + 1);
|
||||
items = INSTANCE.room.getItemsAt(s);
|
||||
items = INSTANCE.room.getRoomItemManager().getItemsAt(s);
|
||||
|
||||
for (RoomItem item : items) {
|
||||
double offsetZ = (INSTANCE.room.getTopHeightAt(t.getX(), t.getY())) - item.getZ();
|
||||
double offsetZ = (INSTANCE.room.getRoomItemManager().getTopHeightAt(t.getX(), t.getY())) - item.getZ();
|
||||
|
||||
messages.add(new FloorItemOnRollerComposer(item, null, t, offsetZ, INSTANCE.room).compose());
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class RoomUnitTeleport implements Runnable {
|
||||
RoomTile lastLocation = this.roomUnit.getCurrentPosition();
|
||||
RoomTile newLocation = this.room.getLayout().getTile((short) this.x, (short) this.y);
|
||||
|
||||
RoomItem topItem = this.room.getTopItemAt(this.roomUnit.getCurrentPosition().getX(), this.roomUnit.getCurrentPosition().getY());
|
||||
RoomItem topItem = this.room.getRoomItemManager().getTopItemAt(this.roomUnit.getCurrentPosition().getX(), this.roomUnit.getCurrentPosition().getY());
|
||||
if (topItem != null) {
|
||||
try {
|
||||
topItem.onWalkOff(this.roomUnit, this.room, new Object[]{this});
|
||||
@ -59,7 +59,7 @@ public class RoomUnitTeleport implements Runnable {
|
||||
this.room.updateHabbosAt(newLocation);
|
||||
this.room.updateBotsAt(newLocation.getX(), newLocation.getY());
|
||||
|
||||
topItem = room.getTopItemAt(x, y);
|
||||
topItem = room.getRoomItemManager().getTopItemAt(x, y);
|
||||
if (topItem != null && roomUnit.getCurrentPosition().equals(room.getLayout().getTile((short) x, (short) y))) {
|
||||
try {
|
||||
topItem.onWalkOn(roomUnit, room, new Object[]{ lastLocation, newLocation, this });
|
||||
|
@ -52,7 +52,7 @@ class FreezeHandleSnowballExplosion implements Runnable {
|
||||
THashSet<InteractionFreezeTile> freezeTiles = new THashSet<>();
|
||||
|
||||
for (RoomTile roomTile : tiles) {
|
||||
THashSet<RoomItem> items = this.thrownData.room.getItemsAt(roomTile);
|
||||
THashSet<RoomItem> items = this.thrownData.room.getRoomItemManager().getItemsAt(roomTile);
|
||||
|
||||
for (RoomItem freezeTile : items) {
|
||||
if (freezeTile instanceof InteractionFreezeTile || freezeTile instanceof InteractionFreezeBlock) {
|
||||
|
@ -60,7 +60,7 @@ class TeleportActionFive implements Runnable {
|
||||
|
||||
Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 1000);
|
||||
|
||||
RoomItem teleportTile = this.room.getTopItemAt(unit.getCurrentPosition().getX(), unit.getCurrentPosition().getY());
|
||||
RoomItem teleportTile = this.room.getRoomItemManager().getTopItemAt(unit.getCurrentPosition().getX(), unit.getCurrentPosition().getY());
|
||||
|
||||
if (teleportTile instanceof InteractionTeleportTile && teleportTile != this.currentTeleport) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user