diff --git a/Emulator/pom.xml b/Emulator/pom.xml
index 360458bf..62e8f0ee 100644
--- a/Emulator/pom.xml
+++ b/Emulator/pom.xml
@@ -6,7 +6,7 @@
com.eu.habbo
Habbo
- 3.6.0
+ 4.0.1
UTF-8
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
index a6c2bae3..41453538 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
@@ -13,8 +13,8 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredGiveRewardItem;
-import com.eu.habbo.habbohotel.wired.core.WiredManager;
import com.eu.habbo.habbohotel.wired.core.WiredContext;
+import com.eu.habbo.habbohotel.wired.core.WiredManager;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
import com.eu.habbo.messages.outgoing.generic.alerts.UpdateFailedComposer;
@@ -34,12 +34,12 @@ public class WiredEffectGiveReward extends InteractionWiredEffect {
public static final WiredEffectType type = WiredEffectType.GIVE_REWARD;
- private int limit;
- private int limitationInterval;
- private int given;
- private int rewardTime;
- private boolean uniqueRewards;
- private THashSet rewardItems = new THashSet<>();
+ public int limit;
+ public int limitationInterval;
+ public int given;
+ public int rewardTime;
+ public boolean uniqueRewards;
+ public THashSet rewardItems = new THashSet<>();
public WiredEffectGiveReward(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssueChatlogType.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssueChatlogType.java
index c4b67582..35db44b7 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssueChatlogType.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssueChatlogType.java
@@ -9,7 +9,7 @@ public enum ModToolIssueChatlogType {
SELFIE(5),
PHOTO(6);
- private final int type;
+ private int type;
ModToolIssueChatlogType(int type) {
this.type = type;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java
index ceeeba49..aa485c59 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java
@@ -1,27 +1,5 @@
package com.eu.habbo.habbohotel.rooms;
-import java.awt.Color;
-import java.awt.Rectangle;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.games.Game;
@@ -29,11 +7,7 @@ import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.GuildMember;
import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item;
-import com.eu.habbo.habbohotel.items.interactions.InteractionBackgroundToner;
-import com.eu.habbo.habbohotel.items.interactions.InteractionFireworks;
-import com.eu.habbo.habbohotel.items.interactions.InteractionGuildFurni;
-import com.eu.habbo.habbohotel.items.interactions.InteractionJukeBox;
-import com.eu.habbo.habbohotel.items.interactions.InteractionMultiHeight;
+import com.eu.habbo.habbohotel.items.interactions.*;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.pets.Pet;
@@ -49,19 +23,13 @@ import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import com.eu.habbo.messages.outgoing.rooms.HideDoorbellComposer;
import com.eu.habbo.messages.outgoing.rooms.UpdateStackHeightComposer;
-import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer;
-import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
-import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
-import com.eu.habbo.messages.outgoing.rooms.items.RemoveWallItemComposer;
-import com.eu.habbo.messages.outgoing.rooms.items.RoomFloorItemsComposer;
-import com.eu.habbo.messages.outgoing.rooms.items.WallItemUpdateComposer;
+import com.eu.habbo.messages.outgoing.rooms.items.*;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.plugin.Event;
import com.eu.habbo.plugin.events.furniture.FurniturePickedUpEvent;
import com.eu.habbo.plugin.events.rooms.RoomLoadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent;
-
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntIntMap;
@@ -70,6 +38,20 @@ import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.awt.*;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.*;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
public class Room implements Comparable, ISerialize, Runnable {
@@ -2436,6 +2418,8 @@ public class Room implements Comparable, ISerialize, Runnable {
return this.itemManager.slideFurniTo(item, tile, rotation);
}
+
+
public THashSet getRoomUnits() {
return this.unitManager.getRoomUnits();
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
index 3ea45086..ebd915b7 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
@@ -53,6 +53,8 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
this.bubble = RoomChatMessageBubbles.NORMAL;
}
+ this.RoomChatColour = message.packet.readString();
+
if (!message.client.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
for (Integer i : RoomChatMessage.BANNED_BUBBLES) {
if (i == this.bubble.getType()) {
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitEffect.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitEffect.java
index 5ddebbbc..3be40d28 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitEffect.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitEffect.java
@@ -204,7 +204,7 @@ public enum RoomUnitEffect {
YELLOWDUCK(198),
FLYNGTURTLE(199);
- private final int id;
+ private int id;
RoomUnitEffect(int id) {
this.id = id;
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java
index 851f336b..73191762 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnitStatus.java
@@ -52,12 +52,6 @@ public enum RoomUnitStatus {
GROW_6("grw6"),
GROW_7("grw7"),
- SNOWWAR_DIE_BACK("swdieback", true),
- SNOWWAR_DIE_FRONT("swdiefront", true),
- SNOWWAR_PICK("swpick", true),
- SNOWWAR_RUN("swrun", true),
- SNOWWAR_THROW("swthrow", true),
-
KICK("kck"),
WAG_TAIL("wag"),
DANCE("dan"),
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java
index 870fdcdc..ee85190c 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java
@@ -12,8 +12,7 @@ import com.eu.habbo.habbohotel.items.interactions.*;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
-import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.habbohotel.wired.WiredTriggerType;
+import com.eu.habbo.habbohotel.wired.core.WiredManager;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDanceComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
@@ -37,17 +36,17 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
private static final Logger LOGGER = LoggerFactory.getLogger(HabboItem.class);
- private static final Class>[] TOGGLING_INTERACTIONS = new Class[]{
+ private static Class>[] TOGGLING_INTERACTIONS = new Class>[]{
InteractionGameTimer.class,
InteractionWired.class,
InteractionWiredHighscore.class,
InteractionMultiHeight.class
};
- private final int id;
+ private int id;
private int userId;
private int roomId;
- private final Item baseItem;
+ private Item baseItem;
private String wallPosition;
private short x;
private short y;
@@ -271,7 +270,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
statement.execute();
} catch (SQLException e) {
LOGGER.error("Caught SQL exception", e);
- LOGGER.error("SQLException trying to save HabboItem: {}", this);
+ LOGGER.error("SQLException trying to save HabboItem: {}", this.toString());
}
this.needsUpdate = false;
@@ -296,7 +295,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
}
if ((this.getBaseItem().getStateCount() > 1 && !(this instanceof InteractionDice)) || Arrays.asList(HabboItem.TOGGLING_INTERACTIONS).contains(this.getClass()) || (objects != null && objects.length == 1 && objects[0].equals("TOGGLE_OVERRIDE"))) {
- WiredHandler.handle(WiredTriggerType.STATE_CHANGED, client.getHabbo().getRoomUnit(), room, new Object[]{this});
+ WiredManager.triggerFurniStateChanged(room, client.getHabbo().getRoomUnit(), this);
}
}
}
@@ -306,7 +305,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
/*if (objects != null && objects.length >= 1 && objects[0] instanceof InteractionWired)
return;*/
- WiredHandler.handle(WiredTriggerType.WALKS_ON_FURNI, roomUnit, room, new Object[]{this});
+ WiredManager.triggerUserWalksOn(room, roomUnit, this);
if ((this.getBaseItem().allowSit() || this.getBaseItem().allowLay()) && !roomUnit.getDanceType().equals(DanceType.NONE)) {
roomUnit.setDanceType(DanceType.NONE);
@@ -331,7 +330,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
if(objects != null && objects.length > 0) {
- WiredHandler.handle(WiredTriggerType.WALKS_OFF_FURNI, roomUnit, room, new Object[]{this});
+ WiredManager.triggerUserWalksOff(room, roomUnit, this);
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java
index 83e6e270..cd806c24 100644
--- a/Emulator/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java
+++ b/Emulator/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java
@@ -83,7 +83,7 @@ public class WardrobeComponent {
}
public class WardrobeItem implements Runnable {
- private final int slotId;
+ private int slotId;
private HabboGender gender;
private Habbo habbo;
private String look;
diff --git a/Emulator/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java b/Emulator/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java
index a06f17d5..b6e439ce 100644
--- a/Emulator/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java
+++ b/Emulator/src/main/java/com/eu/habbo/messages/incoming/catalog/CatalogBuyItemEvent.java
@@ -20,7 +20,7 @@ import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
import com.eu.habbo.messages.outgoing.generic.alerts.HotelWillCloseInMinutesComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import com.eu.habbo.messages.outgoing.navigator.CanCreateRoomComposer;
-import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer;
+import com.eu.habbo.messages.outgoing.users.*;
import com.eu.habbo.threading.runnables.ShutdownEmulator;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TObjectProcedure;
@@ -130,10 +130,6 @@ public class CatalogBuyItemEvent extends MessageHandler {
}
});
- if (badgeFound[0]) {
- this.client.getHabbo().getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
- }
-
return;
}
}
diff --git a/Emulator/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewRequestSecondsUntilEvent.java b/Emulator/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewRequestSecondsUntilEvent.java
index c084060b..c7a6be24 100644
--- a/Emulator/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewRequestSecondsUntilEvent.java
+++ b/Emulator/src/main/java/com/eu/habbo/messages/incoming/hotelview/HotelViewRequestSecondsUntilEvent.java
@@ -8,7 +8,7 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class HotelViewRequestSecondsUntilEvent extends MessageHandler {
- private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm");
+ private static DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm");
@Override
public void handle() throws Exception {
diff --git a/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UpdateFurniturePositionEvent.java b/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UpdateFurniturePositionEvent.java
index 3f1cf619..abc30221 100644
--- a/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UpdateFurniturePositionEvent.java
+++ b/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/items/UpdateFurniturePositionEvent.java
@@ -23,7 +23,7 @@ public class UpdateFurniturePositionEvent extends MessageHandler {
int rotation = this.packet.readInt();
RoomTile tile = room.getLayout().getTile((short) x, (short) y);
- room.moveFurniTo(item, tile, rotation, z, this.client.getHabbo(), true, true);
+ room.moveFurniTo(item, tile, rotation, this.client.getHabbo(), true, true);
this.client.sendResponse(new FloorItemUpdateComposer(item));
}
}
\ No newline at end of file
diff --git a/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java b/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java
index 9bd33f37..473b362c 100644
--- a/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java
+++ b/Emulator/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserLookAtPoint.java
@@ -31,21 +31,12 @@ public class RoomUserLookAtPoint extends MessageHandler {
if (!roomUnit.canWalk())
return;
- if (roomUnit.isWalking() || roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_RUN))
- return;
-
if (roomUnit.isWalking() || roomUnit.hasStatus(RoomUnitStatus.MOVE))
return;
if (roomUnit.cmdLay || roomUnit.hasStatus(RoomUnitStatus.LAY))
return;
- if (roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_DIE_BACK) || roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_DIE_FRONT))
- return;
-
- if (roomUnit.hasStatus(RoomUnitStatus.SNOWWAR_PICK))
- return;
-
if (roomUnit.isIdle())
return;
diff --git a/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java b/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java
index 3b333195..0b18fd4a 100644
--- a/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java
+++ b/Emulator/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUsersComposer.java
@@ -40,10 +40,10 @@ public class RoomUsersComposer extends MessageComposer {
this.response.appendInt(this.habbo.getHabboInfo().getId());
this.response.appendString(this.habbo.getHabboInfo().getUsername());
this.response.appendString(this.habbo.getHabboInfo().getMotto());
- this.response.appendInt(this.habbo.getHabboInfo().getInfostandBg());
+ this.response.appendString(this.habbo.getHabboInfo().getLook());
+ this.response.appendInt(this.habbo.getHabboInfo().getInfostandBg());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandStand());
this.response.appendInt(this.habbo.getHabboInfo().getInfostandOverlay());
- this.response.appendString(this.habbo.getHabboInfo().getLook());
this.response.appendInt(this.habbo.getRoomUnit().getId()); //Room Unit ID
this.response.appendInt(this.habbo.getRoomUnit().getX());
this.response.appendInt(this.habbo.getRoomUnit().getY());
@@ -73,7 +73,7 @@ public class RoomUsersComposer extends MessageComposer {
this.response.appendInt(habbo.getHabboInfo().getId());
this.response.appendString(habbo.getHabboInfo().getUsername());
this.response.appendString(habbo.getHabboInfo().getMotto());
- this.response.appendInt(habbo.getHabboInfo().getInfostandBg());
+ this.response.appendInt(habbo.getHabboInfo().getInfostandBg());
this.response.appendInt(habbo.getHabboInfo().getInfostandStand());
this.response.appendInt(habbo.getHabboInfo().getInfostandOverlay());
this.response.appendString(habbo.getHabboInfo().getLook());
@@ -101,10 +101,10 @@ public class RoomUsersComposer extends MessageComposer {
}
} else if (this.bot != null) {
this.response.appendInt(1);
- this.response.appendInt(-this.bot.getId());
+ this.response.appendInt(0 - this.bot.getId());
this.response.appendString(this.bot.getName());
this.response.appendString(this.bot.getMotto());
- this.response.appendInt(0);
+ this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendInt(0);
this.response.appendString(this.bot.getFigure());
@@ -131,12 +131,12 @@ public class RoomUsersComposer extends MessageComposer {
} else if (this.bots != null) {
this.response.appendInt(this.bots.size());
for (Bot bot : this.bots) {
- this.response.appendInt(-bot.getId());
+ this.response.appendInt(0 - bot.getId());
this.response.appendString(bot.getName());
this.response.appendString(bot.getMotto());
- this.response.appendInt(0);
- this.response.appendInt(0);
- this.response.appendInt(0);
+ this.response.appendInt(0);
+ this.response.appendInt(0);
+ this.response.appendInt(0);
this.response.appendString(bot.getFigure());
this.response.appendInt(bot.getRoomUnit().getId());
this.response.appendInt(bot.getRoomUnit().getX());
@@ -162,4 +162,20 @@ public class RoomUsersComposer extends MessageComposer {
}
return this.response;
}
+
+ public Habbo getHabbo() {
+ return habbo;
+ }
+
+ public Collection getHabbos() {
+ return habbos;
+ }
+
+ public Bot getBot() {
+ return bot;
+ }
+
+ public Collection getBots() {
+ return bots;
+ }
}
diff --git a/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java b/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java
index c974699b..d559daed 100644
--- a/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java
+++ b/Emulator/src/main/java/com/eu/habbo/threading/runnables/BanzaiRandomTeleport.java
@@ -1,127 +1,74 @@
package com.eu.habbo.threading.runnables;
import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.rooms.*;
-import com.eu.habbo.habbohotel.users.Habbo;
+import com.eu.habbo.habbohotel.rooms.Room;
+import com.eu.habbo.habbohotel.rooms.RoomTile;
+import com.eu.habbo.habbohotel.rooms.RoomUnit;
+import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.HabboItem;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BanzaiRandomTeleport implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(BanzaiRandomTeleport.class);
-
- private final HabboItem initialTeleporter;
- private final HabboItem targetTeleporter;
- private final RoomUnit roomUnit;
+ private final HabboItem item;
+ private final HabboItem toItem;
+ private final RoomUnit habbo;
private final Room room;
- private final RoomUserRotation newRotation;
- public BanzaiRandomTeleport(HabboItem initialTeleporter, HabboItem targetTeleporter, RoomUnit roomUnit, Room room) {
- this(initialTeleporter, targetTeleporter, roomUnit, room, getRandomRotation());
- }
-
- public BanzaiRandomTeleport(HabboItem initialTeleporter, HabboItem targetTeleporter, RoomUnit roomUnit, Room room, RoomUserRotation newRotation) {
- this.initialTeleporter = initialTeleporter;
- this.targetTeleporter = targetTeleporter;
- this.roomUnit = roomUnit;
+ public BanzaiRandomTeleport(HabboItem item, HabboItem toItem, RoomUnit habbo, Room room) {
+ this.item = item;
+ this.toItem = toItem;
+ this.habbo = habbo;
this.room = room;
- this.newRotation = newRotation;
- }
-
- private static RoomUserRotation getRandomRotation() {
- RoomUserRotation[] rotations = RoomUserRotation.values();
- return rotations[Emulator.getRandom().nextInt(rotations.length)];
}
@Override
public void run() {
- if (roomUnit == null || room == null || roomUnit.getCurrentLocation() == null) {
- LOGGER.warn("RoomUnit or Room reference is null, teleport aborted.");
- return;
+ HabboItem topItemNow = this.room.getTopItemAt(this.habbo.getX(), this.habbo.getY());
+ RoomTile lastLocation = this.habbo.getCurrentLocation();
+ RoomTile newLocation = this.room.getLayout().getTile(toItem.getX(), toItem.getY());
+
+ if(topItemNow != null) {
+ try {
+ topItemNow.onWalkOff(this.habbo, this.room, new Object[] { lastLocation, newLocation, this });
+ } catch (Exception e) {
+ LoggerFactory.getLogger(BanzaiRandomTeleport.class).error("BanzaiRandomTeleport exception", e);
+ }
}
- final RoomTile teleporterTile = room.getLayout().getTile(initialTeleporter.getX(), initialTeleporter.getY());
- final RoomTile newLocation = room.getLayout().getTile(targetTeleporter.getX(), targetTeleporter.getY());
-
- // Determine if the user is riding a pet
- final boolean isRiding = isUserRiding();
- final Habbo rider = isRiding ? room.getHabbo(roomUnit) : null;
- final RoomUnit petUnit = isRiding && rider != null ? rider.getHabboInfo().getRiding().getRoomUnit() : null;
-
- // Move the pet onto the teleport tile before teleporting
- if (petUnit != null) {
- // Temporarily override the pet's movement logic to force it onto the teleport tile
- petUnit.setCanWalk(true); // Ensure the pet can walk
- petUnit.setGoalLocation(teleporterTile); // Set the goal location
- petUnit.setCurrentLocation(teleporterTile); // Force the pet to the teleport tile
- petUnit.setZ(teleporterTile.getStackHeight()); // Set the correct Z-height
-
- // Ensure both pet and rider face the same direction
- roomUnit.setRotation(this.newRotation);
- petUnit.setRotation(this.newRotation);
-
- // Get correct Z-height
- final double baseZ = targetTeleporter.getZ();
- final double finalPetZ = baseZ;
- final double finalRiderZ = baseZ + 1; // Rider stays above pet if riding
-
- // Delay to ensure the pet has reached the teleport tile
- Emulator.getThreading().run(() -> {
- room.teleportRoomUnitToLocation(petUnit, newLocation.x, newLocation.y, finalPetZ);
- petUnit.setZ(finalPetZ);
-
- room.teleportRoomUnitToLocation(roomUnit, newLocation.x, newLocation.y, finalRiderZ);
- roomUnit.setZ(finalRiderZ);
-
- // Synchronize rotations after teleportation
- petUnit.setRotation(roomUnit.getBodyRotation());
- petUnit.setBodyRotation(roomUnit.getBodyRotation());
- petUnit.setHeadRotation(roomUnit.getHeadRotation());
-
- // Re-enable walking after teleportation
- enableWalkingAndUpdateTeleporters(roomUnit, petUnit, 650);
- }, 1000); // Increased delay to ensure pet reaches the teleport tile
- } else {
- // If not riding, proceed with teleportation for the rider only
- roomUnit.setRotation(this.newRotation);
-
- final double baseZ = targetTeleporter.getZ();
- final double finalRiderZ = baseZ;
-
- Emulator.getThreading().run(() -> {
- room.teleportRoomUnitToLocation(roomUnit, newLocation.x, newLocation.y, finalRiderZ);
- roomUnit.setZ(finalRiderZ);
-
- enableWalkingAndUpdateTeleporters(roomUnit, null, 650);
- }, 700); // Standard delay for non-ridden teleportation
- }
- }
-
- private boolean isUserRiding() {
- if (roomUnit.getRoomUnitType() != RoomUnitType.USER) {
- return false;
- }
- Habbo habbo = room.getHabbo(roomUnit);
- return habbo != null && habbo.getHabboInfo().getRiding() != null;
- }
-
- private void enableWalkingAndUpdateTeleporters(RoomUnit roomUnit, RoomUnit petUnit, int delay) {
Emulator.getThreading().run(() -> {
- roomUnit.setCanWalk(true);
- if (petUnit != null) {
- petUnit.setCanWalk(true);
+ if (this.item.getExtradata().equals("1")) {
+ this.item.setExtradata("0");
+ this.room.updateItemState(this.item);
+ }
+ }, 500);
+
+ if(!this.toItem.getExtradata().equals("1")) {
+ this.toItem.setExtradata("1");
+ this.room.updateItemState(this.toItem);
+ }
+
+ Emulator.getThreading().run(() -> {
+ this.habbo.setCanWalk(true);
+ HabboItem topItemNext = this.room.getTopItemAt(this.habbo.getX(), this.habbo.getY());
+
+ if(topItemNext != null) {
+ try {
+ topItemNext.onWalkOn(this.habbo, this.room, new Object[] { lastLocation, newLocation, this });
+ } catch (Exception e) {
+ LoggerFactory.getLogger(BanzaiRandomTeleport.class).error("BanzaiRandomTeleport exception", e);
+ }
}
- // Update teleporter states
- if ("1".equals(initialTeleporter.getExtradata())) {
- initialTeleporter.setExtradata("0");
- room.updateItemState(initialTeleporter);
+ if (this.toItem.getExtradata().equals("1")) {
+ this.toItem.setExtradata("0");
+ this.room.updateItemState(this.toItem);
}
+ }, 750);
+
+ Emulator.getThreading().run(() -> {
+ this.habbo.setRotation(RoomUserRotation.fromValue(Emulator.getRandom().nextInt(8)));
+ this.room.teleportRoomUnitToLocation(this.habbo, newLocation.x, newLocation.y, newLocation.getStackHeight());
+ }, 250);
- if ("1".equals(targetTeleporter.getExtradata())) {
- targetTeleporter.setExtradata("0");
- room.updateItemState(targetTeleporter);
- }
- }, delay);
}
-}
\ No newline at end of file
+}
diff --git a/Emulator/src/main/java/com/eu/habbo/threading/runnables/WiredExecuteTask.java b/Emulator/src/main/java/com/eu/habbo/threading/runnables/WiredExecuteTask.java
deleted file mode 100644
index a7479cfa..00000000
--- a/Emulator/src/main/java/com/eu/habbo/threading/runnables/WiredExecuteTask.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.eu.habbo.threading.runnables;
-
-import com.eu.habbo.Emulator;
-import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
-import com.eu.habbo.habbohotel.items.interactions.wired.triggers.WiredTriggerAtSetTime;
-import com.eu.habbo.habbohotel.items.interactions.wired.triggers.WiredTriggerAtTimeLong;
-import com.eu.habbo.habbohotel.rooms.Room;
-import com.eu.habbo.habbohotel.wired.WiredHandler;
-
-public class WiredExecuteTask implements Runnable {
- private final InteractionWiredTrigger task;
- private final Room room;
- private int taskId;
-
- public WiredExecuteTask(InteractionWiredTrigger trigger, Room room) {
- this.task = trigger;
- this.room = room;
-
- if (this.task instanceof WiredTriggerAtSetTime)
- this.taskId = ((WiredTriggerAtSetTime) this.task).taskId;
-
- if (this.task instanceof WiredTriggerAtTimeLong)
- this.taskId = ((WiredTriggerAtTimeLong) this.task).taskId;
- }
-
- @Override
- public void run() {
- if (!Emulator.isShuttingDown && Emulator.isReady) {
- if (this.room != null && this.room.getId() == this.task.getRoomId()) {
- if (this.task instanceof WiredTriggerAtSetTime) {
- if (((WiredTriggerAtSetTime) this.task).taskId != this.taskId)
- return;
- }
- if (this.task instanceof WiredTriggerAtTimeLong) {
- if (((WiredTriggerAtTimeLong) this.task).taskId != this.taskId)
- return;
- }
- WiredHandler.handle(this.task, null, this.room, null);
- }
- }
- }
-}
diff --git a/Emulator/src/main/java/com/eu/habbo/threading/runnables/games/GameTimer.java b/Emulator/src/main/java/com/eu/habbo/threading/runnables/games/GameTimer.java
index f1e903e7..a4b8f1a8 100644
--- a/Emulator/src/main/java/com/eu/habbo/threading/runnables/games/GameTimer.java
+++ b/Emulator/src/main/java/com/eu/habbo/threading/runnables/games/GameTimer.java
@@ -3,8 +3,7 @@ package com.eu.habbo.threading.runnables.games;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
import com.eu.habbo.habbohotel.rooms.Room;
-import com.eu.habbo.habbohotel.wired.WiredHandler;
-import com.eu.habbo.habbohotel.wired.WiredTriggerType;
+import com.eu.habbo.habbohotel.wired.core.WiredManager;
public class GameTimer implements Runnable {
@@ -38,7 +37,7 @@ public class GameTimer implements Runnable {
timer.setThreadActive(false);
timer.setTimeNow(0);
timer.endGame(room);
- WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{});
+ WiredManager.triggerGameEnds(room);
}
room.updateItem(timer);
diff --git a/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar b/Latest_Compiled_Version/Habbo-4.0.1-jar-with-dependencies.jar
similarity index 92%
rename from Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar
rename to Latest_Compiled_Version/Habbo-4.0.1-jar-with-dependencies.jar
index 20d61548..94104c3a 100644
Binary files a/Latest_Compiled_Version/Habbo-3.6.0-jar-with-dependencies.jar and b/Latest_Compiled_Version/Habbo-4.0.1-jar-with-dependencies.jar differ