From 35876a259677f39eb8b2193a702ec4a56d878715 Mon Sep 17 00:00:00 2001
From: capheus <20739601+capheus@users.noreply.github.com>
Date: Sat, 17 Nov 2018 13:28:00 +0000
Subject: [PATCH] updated to 1.14 decompiled.
---
README.md | 2 +-
pom.xml | 39 ++---
sqlupdates/1_13_0_TO_1_14_0.sql | 21 +++
src/main/java/com/eu/habbo/Emulator.java | 2 +-
.../java/com/eu/habbo/database/Database.java | 2 +-
.../achievements/AchievementManager.java | 17 +-
.../com/eu/habbo/habbohotel/bots/Bot.java | 6 +-
.../habbo/habbohotel/catalog/CatalogItem.java | 22 ++-
.../habbohotel/catalog/CatalogManager.java | 3 +
.../habbo/habbohotel/catalog/TargetOffer.java | 2 +-
.../commands/ConnectCameraCommand.java | 6 +-
.../games/battlebanzai/BattleBanzaiGame.java | 33 +++-
.../habbohotel/games/freeze/FreezeGame.java | 16 ++
.../habbohotel/guilds/forums/GuildForum.java | 81 ++-------
.../guilds/forums/GuildForumThread.java | 39 ++---
.../habbo/habbohotel/hotelview/NewsList.java | 8 +-
.../interactions/InteractionEffectTile.java | 37 ++--
.../items/interactions/InteractionGift.java | 25 +--
.../interactions/InteractionMultiHeight.java | 2 +-
.../interactions/InteractionOneWayGate.java | 36 +---
.../interactions/InteractionPuzzleBox.java | 2 +-
.../interactions/InteractionTeleport.java | 2 -
.../items/interactions/InteractionTrap.java | 49 +++++-
.../items/interactions/InteractionWired.java | 6 +
.../games/InteractionGameTimer.java | 6 +
.../InteractionBattleBanzaiPuck.java | 2 +-
.../games/football/InteractionFootball.java | 1 +
.../WiredConditionNotFurniHaveFurni.java | 21 +--
.../WiredEffectChangeFurniDirection.java | 2 +-
.../wired/effects/WiredEffectGiveReward.java | 8 +-
.../wired/effects/WiredEffectMatchFurni.java | 2 +
.../wired/effects/WiredEffectMoveFurniTo.java | 2 +-
.../effects/WiredEffectMoveRotateFurni.java | 19 +-
.../interactions/wired/extra/WiredBlob.java | 2 +-
.../habbo/habbohotel/messenger/Messenger.java | 3 +-
.../habbohotel/navigation/DisplayOrder.java | 7 +
.../navigation/NavigatorFavoriteFilter.java | 2 +-
.../navigation/NavigatorHotelFilter.java | 6 +-
.../navigation/NavigatorManager.java | 15 +-
.../navigation/NavigatorPublicCategory.java | 3 +-
.../navigation/NavigatorPublicFilter.java | 4 +-
.../navigation/NavigatorRoomAdsFilter.java | 2 +-
.../navigation/NavigatorUserFilter.java | 10 +-
.../navigation/SearchResultList.java | 18 +-
.../eu/habbo/habbohotel/pets/PetManager.java | 11 +-
.../com/eu/habbo/habbohotel/rooms/Room.java | 125 +++++++++++---
.../habbo/habbohotel/rooms/RoomCategory.java | 7 +
.../habbohotel/rooms/RoomChatMessage.java | 4 +-
.../rooms/RoomChatMessageBubbles.java | 6 +-
.../eu/habbo/habbohotel/rooms/RoomLayout.java | 61 ++++---
.../habbo/habbohotel/rooms/RoomManager.java | 15 +-
.../eu/habbo/habbohotel/rooms/RoomTile.java | 39 ++---
.../habbo/habbohotel/rooms/RoomTileState.java | 14 +-
.../eu/habbo/habbohotel/rooms/RoomUnit.java | 6 +-
.../com/eu/habbo/habbohotel/users/Habbo.java | 2 +-
.../eu/habbo/habbohotel/users/HabboItem.java | 11 +-
.../habbo/habbohotel/users/HabboManager.java | 4 +-
.../eu/habbo/habbohotel/users/HabboStats.java | 8 +-
.../java/com/eu/habbo/messages/ICallable.java | 8 +
.../com/eu/habbo/messages/PacketManager.java | 48 ++++--
.../eu/habbo/messages/incoming/Incoming.java | 13 +-
.../catalog/CatalogBuyItemAsGiftEvent.java | 3 -
.../crafting/CraftingCraftSecretEvent.java | 2 +-
.../incoming/friends/FriendRequestEvent.java | 4 +-
.../GuildForumModerateMessageEvent.java | 27 ++-
.../forums/GuildForumModerateThreadEvent.java | 14 +-
.../forums/GuildForumPostThreadEvent.java | 58 +++----
.../GuildForumThreadsMessagesEvent.java | 22 +--
.../incoming/handshake/SecureLoginEvent.java | 3 +
.../helper/RequestTalentTrackEvent.java | 6 +-
.../RequestNewNavigatorRoomsEvent.java | 163 +-----------------
.../incoming/rooms/pets/PetPlaceEvent.java | 2 +-
.../users/ConfirmChangeNameEvent.java | 2 +
.../friends/MessengerInitComposer.java | 2 +-
.../NewNavigatorSearchResultsComposer.java | 11 --
.../rooms/items/AddFloorItemComposer.java | 2 +-
.../rooms/items/FloorItemUpdateComposer.java | 2 +-
.../rooms/items/RoomFloorItemsComposer.java | 3 +-
.../eu/habbo/messages/rcon/UpdateUser.java | 4 +-
.../com/eu/habbo/plugin/PluginManager.java | 5 +-
.../emulator/SSOAuthenticationEvent.java | 13 ++
.../events/users/UserExitRoomEvent.java | 3 +-
.../events/users/UserNameChangedEvent.java | 15 ++
.../events/users/UserRankChangedEvent.java | 12 ++
.../runnables/ChannelReadHandler.java | 15 +-
.../habbo/threading/runnables/OpenGift.java | 8 +-
.../threading/runnables/PetEatAction.java | 4 +-
.../runnables/hopper/HopperActionThree.java | 2 +-
.../teleport/TeleportActionFive.java | 2 +-
.../teleport/TeleportActionFour.java | 4 +-
.../runnables/teleport/TeleportActionOne.java | 2 +-
.../teleport/TeleportActionThree.java | 3 +-
.../runnables/teleport/TeleportActionTwo.java | 8 +-
93 files changed, 760 insertions(+), 641 deletions(-)
create mode 100644 sqlupdates/1_13_0_TO_1_14_0.sql
create mode 100644 src/main/java/com/eu/habbo/habbohotel/navigation/DisplayOrder.java
create mode 100644 src/main/java/com/eu/habbo/messages/ICallable.java
create mode 100644 src/main/java/com/eu/habbo/plugin/events/emulator/SSOAuthenticationEvent.java
create mode 100644 src/main/java/com/eu/habbo/plugin/events/users/UserNameChangedEvent.java
create mode 100644 src/main/java/com/eu/habbo/plugin/events/users/UserRankChangedEvent.java
diff --git a/README.md b/README.md
index 3d1c13cd..46c8ac0f 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
## **To Get The Camera To Work Visit http://arcturus.wf and register.** ##
## **TUTORIAL FOR PLUGINS http://arcturus.wf/thread-2415.html** ##
# **DO NOT EDIT THE SOURCE. USE THE PLUGIN API.** #
-## Current Stable Version: 1.13.0 ##
+## Current Stable Version: 1.14.0 ##
Arcturus Morningstar is a Habbo emulator written in Java aiming to be an exact clone of the offical server, based on Arcturus Emulator by TheGeneral.
Targeting PRODUCTION-201611291003-338511768
diff --git a/pom.xml b/pom.xml
index 1b7cf782..b654c226 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.eu.habbo
Habbo
- 1.13.0
+ 1.14.0
UTF-8
@@ -70,6 +70,7 @@
3.0.0
-Xdoclint:none
+ public
@@ -87,27 +88,27 @@
io.netty
netty-all
- 4.1.15.Final
+ 4.1.24.Final
io.netty
netty-codec-http
- 4.1.15.Final
+ 4.1.24.Final
compile
io.netty
netty-codec-http2
- 4.1.15.Final
+ 4.1.24.Final
compile
io.netty
netty-handler
- 4.1.15.Final
+ 4.1.24.Final
compile
@@ -115,14 +116,14 @@
com.google.code.gson
gson
- 2.3.1
+ 2.8.4
mysql
mysql-connector-java
- 5.1.37
+ 5.1.46
runtime
@@ -134,56 +135,50 @@
compile
-
+
com.zaxxer
HikariCP
- 2.6.0
+ 3.1.0
compile
org.apache.commons
commons-lang3
- 3.4
+ 3.7
compile
org.apache.commons
- commons-math
- 2.2
+ commons-math3
+ 3.6.1
compile
org.jsoup
jsoup
- 1.8.3
+ 1.11.3
compile
-
- mysql
- mysql-connector-java
- 5.1.32
-
-
org.slf4j
slf4j-api
- 1.7.21
+ 1.7.25
org.slf4j
slf4j-simple
- 1.7.21
+ 1.7.25
joda-time
joda-time
- 2.5
+ 2.9.9
diff --git a/sqlupdates/1_13_0_TO_1_14_0.sql b/sqlupdates/1_13_0_TO_1_14_0.sql
new file mode 100644
index 00000000..27a8bfeb
--- /dev/null
+++ b/sqlupdates/1_13_0_TO_1_14_0.sql
@@ -0,0 +1,21 @@
+#DATABASE UPDATE: 1.13.0 -> 1.14.0
+
+#Defines if you are sorting the catalog items using the catalog_items.order_number column or using the regular IDs.
+INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.catalog.items.display.ordernum', '0');
+
+#Enables / Disables the talenttrack. If set to false, trading does not require the perk (even if 'hotel.trading.requires.perk' is set to 1)
+INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.talenttrack.enabled', '1');
+
+#Sort using the navigator_flatcats and navigator_publiccats order_num If false use activity as sorting.
+INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.navigator.sort.ordernum', '1');
+
+ALTER TABLE `catalog_items` ADD `order_number` TINYINT(2) NOT NULL DEFAULT '0' AFTER `offer_id`;
+
+ALTER TABLE `permissions` CHANGE `acc_inifnite_friends` `acc_infinite_friends` ENUM('0','1') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0';
+
+UPDATE `emulator_texts` SET `value` = 'Superwired Usage Information. Possible reward types:
badge: BADGE CODE
Credits: credits#amount
Pixels: pixels#amount
Points: points#amount
Respect: respect#amount
Furniture: furni#FurnitureID
Catalog Item: cata#CatalogItemID
' WHERE `emulator_texts`.`key` = 'hotel.wired.superwired.info';
+ALTER TABLE `navigator_publiccats` ADD `order_num` INT(3) NOT NULL DEFAULT '0' AFTER `visible`;
+ALTER TABLE `navigator_flatcats` ADD `order_num` INT(3) NOT NULL DEFAULT '0' AFTER `list_type`;
+
+INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.wordfilter.automute', '1');
+#DATABASE UPDATE: 1.13.0 -> 1.14.0
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java
index 4fed1d10..4088c0f2 100644
--- a/src/main/java/com/eu/habbo/Emulator.java
+++ b/src/main/java/com/eu/habbo/Emulator.java
@@ -33,7 +33,7 @@ public final class Emulator
public final static int MAJOR = 1;
- public final static int MINOR = 13;
+ public final static int MINOR = 14;
public final static int BUILD = 0;
diff --git a/src/main/java/com/eu/habbo/database/Database.java b/src/main/java/com/eu/habbo/database/Database.java
index d40858f5..2c7e8593 100644
--- a/src/main/java/com/eu/habbo/database/Database.java
+++ b/src/main/java/com/eu/habbo/database/Database.java
@@ -24,7 +24,7 @@ public class Database
this.databasePool = new DatabasePool();
if (!this.databasePool.getStoragePooling(config))
{
- Emulator.getLogging().logStart("Failed to connect to the database. Shutting down...");
+ Emulator.getLogging().logStart("Failed to connect to the database. Please check config.ini and make sure the MySQL process is running. Shutting down...");
SQLException = true;
return;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
index 02912f17..3dd5db5e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java
@@ -25,6 +25,8 @@ import java.util.Map;
public class AchievementManager
{
+ public static boolean TALENTTRACK_ENABLED = false;
+
private final THashMap achievements;
@@ -219,16 +221,19 @@ public class AchievementManager
AchievementLevel newLevel = achievement.getLevelForProgress(currentProgress + amount);
- for (TalentTrackType type : TalentTrackType.values())
+ if (AchievementManager.TALENTTRACK_ENABLED)
{
- if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type))
+ for (TalentTrackType type : TalentTrackType.values())
{
- for (Map.Entry entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet())
+ if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type))
{
- if (entry.getValue().achievements.containsKey(achievement))
+ for (Map.Entry entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet())
{
- Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type, achievement);
- break;
+ if (entry.getValue().achievements.containsKey(achievement))
+ {
+ Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type, achievement);
+ break;
+ }
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
index 5e5689c2..af27864a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
+++ b/src/main/java/com/eu/habbo/habbohotel/bots/Bot.java
@@ -252,7 +252,7 @@ public class Bot implements Runnable
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
- this.room.botChat(new RoomUserTalkComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)).compose());
+ this.room.botChat(new RoomUserTalkComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)).compose());
}
}
@@ -265,7 +265,7 @@ public class Bot implements Runnable
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
- this.room.botChat(new RoomUserShoutComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)).compose());
+ this.room.botChat(new RoomUserShoutComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)).compose());
}
}
@@ -278,7 +278,7 @@ public class Bot implements Runnable
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
- event.target.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT)));
+ event.target.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)));
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
index 9c42a2f6..56c7880a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogItem.java
@@ -64,6 +64,9 @@ public class CatalogItem implements ISerialize, Runnable, Comparable bundle;
public CatalogItem(ResultSet set) throws SQLException
@@ -94,6 +97,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable();
this.loadBundle();
@@ -209,6 +213,12 @@ public class CatalogItem implements ISerialize, Runnable, Comparable calendarRewards;
diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java b/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java
index ac457fd6..0a7879c7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java
+++ b/src/main/java/com/eu/habbo/habbohotel/catalog/TargetOffer.java
@@ -53,7 +53,7 @@ public class TargetOffer
message.appendInt(this.priceInActivityPoints);
message.appendInt(this.activityPointsType);
message.appendInt(Math.max(this.purchaseLimit - purchase.getAmount(), 0));
- message.appendInt(Math.max(Emulator.getIntUnixTimestamp() - this.expirationTime, 0));
+ message.appendInt(Math.max(this.expirationTime - Emulator.getIntUnixTimestamp(), 0));
message.appendString(this.title);
message.appendString(this.description);
message.appendString(this.imageUrl);
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/ConnectCameraCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/ConnectCameraCommand.java
index 6c569886..6ed6ddd8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/ConnectCameraCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/ConnectCameraCommand.java
@@ -2,8 +2,6 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
-import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
-import com.eu.habbo.networking.camera.CameraClient;
public class ConnectCameraCommand extends Command
{
@@ -15,8 +13,6 @@ public class ConnectCameraCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
- CameraClient.attemptReconnect = true;
- gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_alert.cmd_connect_camera"), RoomChatMessageBubbles.ALERT);
- return true;
+ return false;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
index df4603cf..4a568a91 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/battlebanzai/BattleBanzaiGame.java
@@ -12,6 +12,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.Interaction
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGate;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboards.InteractionBattleBanzaiScoreboard;
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.RoomUserAction;
import com.eu.habbo.habbohotel.users.Habbo;
@@ -119,6 +120,8 @@ public class BattleBanzaiGame extends Game
super.start();
+ this.refreshGates();
+
Emulator.getThreading().run(this, 0);
}
@@ -262,14 +265,17 @@ public class BattleBanzaiGame extends Game
this.timeLeft = 0;
- for (HabboItem item : this.room.getFloorItems())
- {
- if (item instanceof InteractionBattleBanzaiTile || item instanceof InteractionBattleBanzaiScoreboard)
- {
- item.setExtradata("0");
- this.room.updateItemState(item);
- }
- }
+ //Think on Habbo the counters and tiles stay as is untill the game restarts.
+
+
+
+
+
+
+
+
+
+ this.refreshGates();
this.lockedTiles.clear();
}
@@ -383,4 +389,15 @@ public class BattleBanzaiGame extends Game
this.room.updateItemState(scoreboard);
}
}
+
+ private void refreshGates()
+ {
+ THashSet tilesToUpdate = new THashSet<>();
+ for (HabboItem item : this.room.getRoomSpecialTypes().getBattleBanzaiGates().values())
+ {
+ tilesToUpdate.add(this.room.getLayout().getTile(item.getX(), item.getY()));
+ }
+
+ this.room.updateTiles(tilesToUpdate);
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
index ea17524e..c5a42cda 100644
--- a/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
+++ b/src/main/java/com/eu/habbo/habbohotel/games/freeze/FreezeGame.java
@@ -280,6 +280,8 @@ public class FreezeGame extends Game
super.start();
+ this.refreshGates();
+
WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, this.room, null);
this.setFreezeTileState("1");
this.run();
@@ -398,6 +400,8 @@ public class FreezeGame extends Game
}
}
+ this.refreshGates();
+
this.setFreezeTileState("0");
}
@@ -450,4 +454,16 @@ public class FreezeGame extends Game
FREEZE_LOOSE_POINTS = Emulator.getConfig().getInt("hotel.freeze.points.freeze");
POWERUP_STACK = Emulator.getConfig().getBoolean("hotel.freeze.powerup.protection.stack");
}
+
+
+ private void refreshGates()
+ {
+ THashSet tilesToUpdate = new THashSet<>();
+ for (HabboItem item : this.room.getRoomSpecialTypes().getFreezeGates().values())
+ {
+ tilesToUpdate.add(this.room.getLayout().getTile(item.getX(), item.getY()));
+ }
+
+ this.room.updateTiles(tilesToUpdate);
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForum.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForum.java
index 950bdf9d..2c097af7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForum.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForum.java
@@ -3,50 +3,19 @@ package com.eu.habbo.habbohotel.guilds.forums;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.users.Habbo;
-import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage;
-import gnu.trove.map.hash.TIntObjectHashMap;
-import gnu.trove.procedure.TObjectProcedure;
import java.sql.*;
-public class GuildForum implements ISerialize
+public class GuildForum
{
private final int guild;
- private int totalThreads;
- private GuildForumComment lastComment = null;
- private final TIntObjectHashMap threads;
private int lastRequested = Emulator.getIntUnixTimestamp();
+ private GuildForumComment lastComment = null;
public GuildForum(int guild)
{
this.guild = guild;
-
- this.threads = new TIntObjectHashMap<>();
-
- try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT author.username as author_name, author.look as look, COALESCE(admin.username, '') as admin_name, guilds_forums.id as thread_id, 0 as row_number, guilds_forums.* FROM guilds_forums " +
- "INNER JOIN users AS author ON author.id = user_id " +
- "LEFT JOIN users AS admin ON guilds_forums.admin_id = admin.id " +
- "WHERE guild_id = ?"))
- {
- statement.setInt(1, this.guild);
- try (ResultSet set = statement.executeQuery())
- {
- while (set.next())
- {
- this.threads.put(set.getInt("id"), new GuildForumThread(set));
- }
- }
- }
- catch (SQLException e)
- {
- Emulator.getLogging().logSQLException(e);
- }
- }
-
- public GuildForumThread getThread(int threadId)
- {
- return threads.get(threadId);
}
public GuildForumThread createThread(Habbo habbo, String subject, String message)
@@ -66,9 +35,7 @@ public class GuildForum implements ISerialize
{
if (set.next())
{
- thread = new GuildForumThread(habbo, set.getInt(1), this.guild, subject, message, timestamp);
- this.threads.put(set.getInt(1), //Thread id
- thread);
+ return thread = new GuildForumThread(habbo, set.getInt(1), this.guild, subject, message, timestamp);
}
}
}
@@ -80,13 +47,6 @@ public class GuildForum implements ISerialize
return thread;
}
- //TODO:
-
- public void hideThread(int threadId)
- {
- this.threads.get(threadId).setState(ThreadState.HIDDEN_BY_ADMIN);
- }
-
public int getGuild()
{
return this.guild;
@@ -97,36 +57,23 @@ public class GuildForum implements ISerialize
return this.lastRequested;
}
- @Override
- public void serialize(ServerMessage message)
- {
-
- }
-
public void serializeThreads(final ServerMessage message)
{
- synchronized (this.threads)
- {
- message.appendInt(this.threads.size());
- this.threads.forEachValue(new TObjectProcedure()
- {
- @Override
- public boolean execute(GuildForumThread thread)
- {
- thread.serialize(message);
- return true;
- }
- });
- }
+
+
+
+
}
public int threadSize()
{
- synchronized (this.threads)
- {
- return this.threads.size();
- }
+
+
+
+
+
+ return 0;
}
public void updateLastRequested()
@@ -173,7 +120,7 @@ public class GuildForum implements ISerialize
response.appendString(guild.getBadge()); //k._icon = _arg_2.readString(); = icon
response.appendInt(0); //k._SafeStr_11338 = _arg_2._SafeStr_5878(); (?)
response.appendInt(0); //k._SafeStr_19191 = _arg_2._SafeStr_5878(); = rating
- response.appendInt(this.totalThreads); //k._SafeStr_11328 = _arg_2._SafeStr_5878(); = total_messages
+ response.appendInt(0); //k._SafeStr_11328 = _arg_2._SafeStr_5878(); = total_messages
response.appendInt(0); //k._SafeStr_19192 = _arg_2._SafeStr_5878(); = new_messages
if (this.lastComment != null)
diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForumThread.java b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForumThread.java
index 87923f05..d4ecf19f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForumThread.java
+++ b/src/main/java/com/eu/habbo/habbohotel/guilds/forums/GuildForumThread.java
@@ -8,6 +8,7 @@ import com.eu.habbo.messages.ServerMessage;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
public class GuildForumThread implements ISerialize, Runnable
{
@@ -28,8 +29,7 @@ public class GuildForumThread implements ISerialize, Runnable
private int adminId;
private String adminName = "";
- //public final TIntObjectHashMap comments;
- public final List comments;
+ public final ConcurrentHashMap comments = new ConcurrentHashMap<>();
public GuildForumThread(Habbo habbo, int threadId, int guildId, String subject, String message, int timestamp)
{
@@ -44,9 +44,6 @@ public class GuildForumThread implements ISerialize, Runnable
this.lastAuthorId = this.authorId;
this.lastAuthorName = this.authorName;
this.lastCommentTimestamp = this.timestamp;
-
- //this.comments = new TIntObjectHashMap();
- this.comments = new ArrayList<>();
}
//Via de database inladen;
@@ -70,10 +67,8 @@ public class GuildForumThread implements ISerialize, Runnable
this.lastAuthorName = this.authorName;
this.lastCommentTimestamp = this.timestamp;
- this.comments = new ArrayList<>();
this.addComment(new GuildForumComment(set, 0));
-
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT " +
"author.username AS author_name, " +
"COALESCE(admin.username, '') as admin_name, " +
@@ -93,7 +88,7 @@ public class GuildForumThread implements ISerialize, Runnable
{
if (!commentSet.isLast())
{
- this.comments.add(new GuildForumComment(commentSet, index));
+ this.comments.put(set.getInt("id"), new GuildForumComment(commentSet, index));
}
else
{
@@ -112,24 +107,21 @@ public class GuildForumThread implements ISerialize, Runnable
public void addComment(GuildForumComment comment)
{
- synchronized (this.comments)
+ if (comment.getIndex() == -1)
{
- if (comment.getIndex() == -1)
+ if (!this.comments.isEmpty())
{
- if (!this.comments.isEmpty())
- {
- GuildForumComment previousComment = this.comments.get(this.comments.size() - 1);
+ GuildForumComment previousComment = this.comments.get(this.comments.size() - 1);
- if (previousComment != null)
- {
- comment.setIndex(previousComment.getIndex() + 1);
- }
+ if (previousComment != null)
+ {
+ comment.setIndex(previousComment.getIndex() + 1);
}
}
-
- this.comments.add(comment);
}
+ this.comments.put(comment.getId(), comment);
+
this.lastAuthorId = comment.getUserId();
this.lastAuthorName = comment.getUserName();
this.lastCommentTimestamp = comment.getTimestamp();
@@ -183,10 +175,11 @@ public class GuildForumThread implements ISerialize, Runnable
public List getComments(int page, int limit)
{
- synchronized (this.comments)
- {
- return this.comments.subList(page, (page + limit) > this.comments.size() ? this.comments.size() : (page + limit));
- }
+ return new ArrayList<>();
+
+
+
+
}
public int getId()
diff --git a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
index 16e8dcdf..d0026c40 100644
--- a/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
+++ b/src/main/java/com/eu/habbo/habbohotel/hotelview/NewsList.java
@@ -1,20 +1,20 @@
package com.eu.habbo.habbohotel.hotelview;
import com.eu.habbo.Emulator;
-import gnu.trove.set.hash.THashSet;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.ArrayList;
public class NewsList
{
- private final THashSet newsWidgets;
+ private final ArrayList newsWidgets;
public NewsList()
{
- this.newsWidgets = new THashSet<>();
+ this.newsWidgets = new ArrayList<>();
this.reload();
}
@@ -39,7 +39,7 @@ public class NewsList
}
- public THashSet getNewsWidgets()
+ public ArrayList getNewsWidgets()
{
return newsWidgets;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java
index f50abef0..56798478 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java
@@ -37,34 +37,27 @@ public class InteractionEffectTile extends InteractionPressurePlate
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{
super.onWalkOff(roomUnit, room, objects);
-
- Habbo habbo = room.getHabbo(roomUnit);
-
- if (habbo.getRoomUnit().getEffectId() == 0)
- {
- if (habbo.getHabboInfo().getGender().equals(HabboGender.M))
- {
- room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectM());
- } else
- {
- room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectF());
- }
- }
- else
- {
- if ((habbo.getHabboInfo().getGender().equals(HabboGender.M) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) ||
- habbo.getHabboInfo().getGender().equals(HabboGender.F) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectF()
- )
- {
- room.giveEffect(habbo.getRoomUnit(), 0);
- }
- }
}
@Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{
+ super.onWalk(roomUnit, room, objects);
+ }
+ @Override
+ public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
+ {
+ super.onWalkOn(roomUnit, room, objects);
+ Habbo habbo = room.getHabbo(roomUnit);
+
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.M))
+ {
+ room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectM());
+ } else
+ {
+ room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectF());
+ }
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
index 368e6f06..3f6ff6ab 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGift.java
@@ -22,8 +22,6 @@ public class InteractionGift extends HabboItem
private String sender = "";
private String look = "";
- public THashSet items = new THashSet<>();
-
public boolean explode = false;
public InteractionGift(ResultSet set, Item baseItem) throws SQLException
@@ -136,15 +134,6 @@ public class InteractionGift extends HabboItem
this.showSender = false;
this.message = "Please delete this present. Thanks!";
}
-
- this.items.clear();
- for (int anItemId : itemId)
- {
- if (anItemId == 0)
- continue;
-
- this.items.add(Emulator.getGameEnvironment().getItemManager().loadHabboItem(anItemId));
- }
}
public int getColorId()
@@ -156,4 +145,18 @@ public class InteractionGift extends HabboItem
{
return ribbonId;
}
+
+ public THashSet loadItems()
+ {
+ THashSet items = new THashSet<>();
+ for (int anItemId : itemId)
+ {
+ if (anItemId == 0)
+ continue;
+
+ items.add(Emulator.getGameEnvironment().getItemManager().loadHabboItem(anItemId));
+ }
+
+ return items;
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java
index ab380c12..79db227d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java
@@ -48,7 +48,7 @@ public class InteractionMultiHeight extends HabboItem
@Override
public boolean isWalkable()
{
- return this.getBaseItem().allowWalk() || this.getBaseItem().allowSit();
+ return this.getBaseItem().allowWalk();
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java
index b63b9ea7..8b4b730e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionOneWayGate.java
@@ -1,6 +1,5 @@
package com.eu.habbo.habbohotel.items.interactions;
-import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
@@ -15,7 +14,7 @@ import java.sql.SQLException;
public class InteractionOneWayGate extends HabboItem
{
- private int roomUnitID = 0;
+ private int roomUnitID = -1;
public InteractionOneWayGate(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
@@ -29,13 +28,13 @@ public class InteractionOneWayGate extends HabboItem
@Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects)
{
- return roomUnit.getId() == roomUnitID;
+ return roomUnit.getId() == this.roomUnitID;
}
@Override
public boolean isWalkable()
{
- return this.roomUnitID != 0;
+ return this.roomUnitID != -1;
}
@Override
@@ -71,28 +70,18 @@ public class InteractionOneWayGate extends HabboItem
if (tile != null && tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation()))
{
- if (!room.hasHabbosAt(this.getX(), this.getY()) && roomUnitID == 0)
+ InteractionOneWayGate gate = this;
+ if (!room.hasHabbosAt(this.getX(), this.getY()) && gate.roomUnitID == -1)
{
- HabboItem item = this;
-
room.scheduledTasks.add(new Runnable()
{
@Override
public void run()
{
- roomUnitID = client.getHabbo().getRoomUnit().getId();
+ gate.roomUnitID = client.getHabbo().getRoomUnit().getId();
room.updateTile(gatePosition);
room.sendComposer(new ItemStateComposer2(getId(), 1).compose());
client.getHabbo().getRoomUnit().setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(getX(), getY()), getRotation() + 4));
-
- room.scheduledTasks.add(new Runnable()
- {
- @Override
- public void run()
- {
- refresh(room);
- }
- });
}
});
}
@@ -102,16 +91,9 @@ public class InteractionOneWayGate extends HabboItem
private void refresh(Room room)
{
- this.setExtradata("0");
- this.roomUnitID = 0;
- Emulator.getThreading().run(new Runnable()
- {
- @Override
- public void run()
- {
- room.sendComposer(new ItemStateComposer2(getId(), 0).compose());
- }
- }, 500);
+ setExtradata("0");
+ this.roomUnitID = -1;
+ room.sendComposer(new ItemStateComposer2(getId(), 0).compose());
room.updateTile(room.getLayout().getTile(this.getX(), this.getY()));
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java
index 0ddf3d22..91f187d1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPuzzleBox.java
@@ -48,7 +48,7 @@ public class InteractionPuzzleBox extends HabboItem
RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), client.getHabbo().getRoomUnit().getBodyRotation().getValue());
- if (tile == null || !room.tileWalkable(tile))
+ if (tile == null || !room.tileWalkable(tile) || room.hasHabbosAt(tile.x, tile.y))
{
return;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java
index c182f326..aa27e652 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java
@@ -59,8 +59,6 @@ public class InteractionTeleport extends HabboItem
if(room != null && client != null && objects.length <= 1)
{
-
-
RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation());
RoomTile teleportPosition = room.getLayout().getTile(getX(), getY());
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
index 9ce0b241..7035761e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTrap.java
@@ -4,11 +4,14 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
+import com.eu.habbo.habbohotel.rooms.RoomUnitType;
+import com.eu.habbo.habbohotel.users.Habbo;
+import com.eu.habbo.habbohotel.users.HabboGender;
import java.sql.ResultSet;
import java.sql.SQLException;
-public class InteractionTrap extends InteractionPressurePlate
+public class InteractionTrap extends InteractionDefault
{
public InteractionTrap(ResultSet set, Item baseItem) throws SQLException
{
@@ -25,6 +28,9 @@ public class InteractionTrap extends InteractionPressurePlate
{
super.onWalkOn(roomUnit, room, objects);
+ if (!this.getExtradata().equals("1"))
+ return;
+
int delay = Emulator.getConfig().getInt("hotel.item.trap." + this.getBaseItem().getName());
if (delay == 0)
@@ -33,16 +39,43 @@ public class InteractionTrap extends InteractionPressurePlate
delay = 3000;
}
- roomUnit.setCanWalk(false);
- Emulator.getThreading().run(new Runnable()
+ if (roomUnit != null)
{
- @Override
- public void run()
+ if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0)
{
- room.giveEffect(roomUnit, 0);
- roomUnit.setCanWalk(true);
+ if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER))
+ {
+ Habbo habbo = room.getHabbo(roomUnit);
+
+ if (habbo != null)
+ {
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM())
+ {
+ room.giveEffect(habbo, this.getBaseItem().getEffectM());
+ return;
+ }
+
+ if (habbo.getHabboInfo().getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF())
+ {
+ room.giveEffect(habbo, this.getBaseItem().getEffectF());
+ return;
+ }
+
+
+ roomUnit.setCanWalk(false);
+ Emulator.getThreading().run(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ room.giveEffect(roomUnit, 0);
+ roomUnit.setCanWalk(true);
+ }
+ }, delay);
+ }
+ }
}
- }, delay);
+ }
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
index a618bf83..61d2fb05 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java
@@ -123,6 +123,12 @@ public abstract class InteractionWired extends HabboItem
return true;
}
+ @Override
+ public boolean allowWiredResetState()
+ {
+ return false;
+ }
+
@Override
public boolean isUsable()
{
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
index ed26803c..c202e6c6 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/InteractionGameTimer.java
@@ -208,4 +208,10 @@ public abstract class InteractionGameTimer extends HabboItem
}
public abstract Class extends Game> getGameType();
+
+ @Override
+ public boolean allowWiredResetState()
+ {
+ return true;
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java
index b7806efc..59c2d198 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiPuck.java
@@ -142,7 +142,7 @@ public class InteractionBattleBanzaiPuck extends InteractionPushable
{
HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
return topItem != null && topItem instanceof InteractionBattleBanzaiTile;
- //return !(!room.getLayout().tileWalkable(to.x, to.y) || (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())));
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java
index 788b5d0b..719ef251 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java
@@ -155,6 +155,7 @@ public class InteractionFootball extends InteractionPushable
@Override
public boolean validMove(Room room, RoomTile from, RoomTile to)
{
+ if (to == null) return false;
HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
index c0979699..8d466c97 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveFurni.java
@@ -44,24 +44,15 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition
for(HabboItem item : this.items)
{
- THashSet things = room.getItemsAt(room.getLayout().getTile(item.getX(), item.getY()));
-
- for(HabboItem i : things)
+ THashSet things = room.getItemsAt(item.getX(), item.getY(), item.getZ());
+ if (!things.isEmpty())
{
- if(i == item)
- continue;
-
- if(i.getZ() >= item.getZ())
- {
- if(this.all)
- return false;
- }
+ if (this.all)
+ return false;
else
- {
- if(!this.all)
- return true;
- }
+ continue;
}
+ return true;
}
return false;
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
index 441688be..12a04a25 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectChangeFurniDirection.java
@@ -67,7 +67,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect
RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
int count = 1;
- while ((targetTile == null || !targetTile.allowStack() || targetTile.state == RoomTileState.BLOCKED) && count < 8)
+ while ((targetTile == null || !targetTile.getAllowStack() || targetTile.state == RoomTileState.INVALID) && count < 8)
{
entry.setValue(nextRotation(entry.getValue()));
targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
index d07e22bb..692ddf29 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectGiveReward.java
@@ -137,7 +137,7 @@ public class WiredEffectGiveReward extends InteractionWiredEffect
if (client.getHabbo().hasPermission("acc_superwired"))
{
- client.getHabbo().whisper(Emulator.getTexts().getValue("hotel.wired.superwired.info"), RoomChatMessageBubbles.ALERT);
+ client.getHabbo().whisper(Emulator.getTexts().getValue("hotel.wired.superwired.info"), RoomChatMessageBubbles.BOT);
}
}
@@ -246,4 +246,10 @@ public class WiredEffectGiveReward extends InteractionWiredEffect
{
return true;
}
+
+ @Override
+ protected long requiredCooldown()
+ {
+ return 0;
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
index 79aadc6b..5a4300c7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java
@@ -49,6 +49,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
{
THashSet tilesToUpdate = new THashSet<>(this.settings.size());
//this.refresh();
+
for(WiredMatchFurniSetting setting : this.settings)
{
HabboItem item = room.getHabboItem(setting.itemId);
@@ -59,6 +60,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
if(!setting.state.equals(" "))
{
item.setExtradata(setting.state);
+ tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
index 7b4d4893..697c7a24 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java
@@ -122,7 +122,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect
THashSet refreshTiles = room.getLayout().getTilesAt(room.getLayout().getTile(((HabboItem) object).getX(), ((HabboItem) object).getY()), ((HabboItem) object).getBaseItem().getWidth(), ((HabboItem) object).getBaseItem().getLength(), ((HabboItem) object).getRotation());
RoomTile tile = room.getLayout().getTileInFront(objectTile, this.direction, indexOffset);
- if (tile == null || !tile.allowStack())
+ if (tile == null || !tile.getAllowStack())
{
indexOffset = 0;
tile = room.getLayout().getTileInFront(objectTile, this.direction, indexOffset);
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
index 371671e4..2ee904cf 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java
@@ -4,10 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
-import com.eu.habbo.habbohotel.rooms.Room;
-import com.eu.habbo.habbohotel.rooms.RoomTile;
-import com.eu.habbo.habbohotel.rooms.RoomUnit;
-import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
+import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
@@ -160,19 +157,23 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect
item.getBaseItem().getWidth(),
item.getBaseItem().getLength());
- for (int x = rectangle.x; x < rectangle.x + rectangle.getWidth(); x++)
+ double offset = 0;
+ for (short x = (short)rectangle.x; x < rectangle.x + rectangle.getWidth(); x++)
{
- for (int y = rectangle.y; y < rectangle.y + rectangle.getHeight(); y++)
+ for (short y = (short)rectangle.y; y < rectangle.y + rectangle.getHeight(); y++)
{
+ RoomTile tile = room.getLayout().getTile(x, y);
+ if (tile.state == RoomTileState.INVALID) continue;
+
HabboItem i = room.getTopItemAt(x, y, item);
if (i == null || i == item || i.getBaseItem().allowStack())
{
- double offset = room.getStackHeight(newTile.x, newTile.y, false) - item.getZ();
- room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose());
+ offset = Math.max(room.getStackHeight(newTile.x, newTile.y, false, item) - item.getZ(), offset);
}
}
}
+ room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose());
}
}
}
@@ -330,6 +331,6 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect
@Override
protected long requiredCooldown()
{
- return 495;
+ return 0;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
index 133b3949..ee1675f0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
+++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredBlob.java
@@ -34,7 +34,7 @@ public class WiredBlob extends InteractionDefault
{
Habbo habbo = room.getHabbo(roomUnit);
- if (habbo != null)
+ if (habbo != null && habbo.getHabboInfo().getCurrentGame() != null)
{
int points = Emulator.getConfig().getInt("hotel.item.wiredblob." + this.getBaseItem().getName());
diff --git a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java
index 5d49ba77..43d5d665 100644
--- a/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java
+++ b/src/main/java/com/eu/habbo/habbohotel/messenger/Messenger.java
@@ -8,6 +8,7 @@ import com.eu.habbo.messages.outgoing.friends.UpdateFriendComposer;
import com.eu.habbo.plugin.events.users.friends.UserAcceptFriendRequestEvent;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
+import org.apache.commons.lang3.StringUtils;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -142,7 +143,7 @@ public class Messenger
for(Map.Entry map : this.friends.entrySet())
{
- if(map.getValue().getUsername().contains(username))
+ if(StringUtils.containsIgnoreCase(map.getValue().getUsername(), username))
{
users.add(map.getValue());
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/DisplayOrder.java b/src/main/java/com/eu/habbo/habbohotel/navigation/DisplayOrder.java
new file mode 100644
index 00000000..af0fd588
--- /dev/null
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/DisplayOrder.java
@@ -0,0 +1,7 @@
+package com.eu.habbo.habbohotel.navigation;
+
+public enum DisplayOrder
+{
+ ORDER_NUM,
+ ACTIVITY
+}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorFavoriteFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorFavoriteFilter.java
index 8c13bbfe..c8894f7e 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorFavoriteFilter.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorFavoriteFilter.java
@@ -23,7 +23,7 @@ public class NavigatorFavoriteFilter extends NavigatorFilter
List resultLists = new ArrayList<>();
List rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsFavourite(habbo);
Collections.sort(rooms);
- resultLists.add(new SearchResultList(0, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular", DisplayMode.VISIBLE), rooms, true, true));
+ resultLists.add(new SearchResultList(0, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular", DisplayMode.VISIBLE), rooms, true, true, DisplayOrder.ACTIVITY, -1));
return resultLists;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java
index 1942f478..03135abf 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java
@@ -25,7 +25,7 @@ public class NavigatorHotelFilter extends NavigatorFilter
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List resultLists = new ArrayList<>();
int i = 0;
- resultLists.add(new SearchResultList(i, "popular", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("popular", ListMode.fromType(Emulator.getConfig().getInt("hotel.navigator.popular.listtype"))), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular"), Emulator.getGameEnvironment().getRoomManager().getPopularRooms(Emulator.getConfig().getInt("hotel.navigator.popular.amount")), false, showInvisible));
+ resultLists.add(new SearchResultList(i, "popular", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("popular", ListMode.fromType(Emulator.getConfig().getInt("hotel.navigator.popular.listtype"))), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular"), Emulator.getGameEnvironment().getRoomManager().getPopularRooms(Emulator.getConfig().getInt("hotel.navigator.popular.amount")), false, showInvisible, DisplayOrder.ORDER_NUM, -1));
i++;
for (Map.Entry> set : Emulator.getGameEnvironment().getRoomManager().getPopularRoomsByCategory(Emulator.getConfig().getInt("hotel.navigator.popular.category.maxresults")).entrySet())
@@ -33,7 +33,7 @@ public class NavigatorHotelFilter extends NavigatorFilter
if (!set.getValue().isEmpty())
{
RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(set.getKey());
- resultLists.add(new SearchResultList(i, category.getCaption(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible));
+ resultLists.add(new SearchResultList(i, category.getCaption(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible, DisplayOrder.ORDER_NUM, category.getOrder()));
i++;
}
}
@@ -55,7 +55,7 @@ public class NavigatorHotelFilter extends NavigatorFilter
if (!set.getValue().isEmpty())
{
RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(set.getKey());
- resultLists.add(new SearchResultList(i, category.getCaptionSave(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible));
+ resultLists.add(new SearchResultList(i, category.getCaptionSave(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible, DisplayOrder.ACTIVITY, category.getOrder()));
i++;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java
index 1f89f110..d032a31b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java
@@ -14,8 +14,12 @@ import java.util.concurrent.ConcurrentHashMap;
public class NavigatorManager
{
+
public static int MAXIMUM_RESULTS_PER_PAGE = 10;
+
+ public static boolean CATEGORY_SORT_USING_ORDER_NUM = false;
+
public final THashMap publicCategories = new THashMap<>();
public final ConcurrentHashMap filterSettings = new ConcurrentHashMap<>();
public final THashMap filters = new THashMap<>();
@@ -62,7 +66,16 @@ public class NavigatorManager
if (category != null)
{
- category.addRoom(Emulator.getGameEnvironment().getRoomManager().loadRoom(set.getInt("room_id")));
+ Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(set.getInt("room_id"));
+
+ if (room != null)
+ {
+ category.addRoom(room);
+ }
+ else
+ {
+ Emulator.getLogging().logErrorLine("Public room defined in navigator_publics does not exist!");
+ }
}
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicCategory.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicCategory.java
index 1c7f9b72..c524afbd 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicCategory.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicCategory.java
@@ -13,13 +13,14 @@ public class NavigatorPublicCategory
public final String name;
public final List rooms;
public final ListMode image;
+ public final int order;
public NavigatorPublicCategory(ResultSet set) throws SQLException
{
this.id = set.getInt("id");
this.name = set.getString("name");
this.image = set.getString("image").equals("1") ? ListMode.THUMBNAILS : ListMode.LIST;
-
+ this.order = set.getInt("order_num");
this.rooms = new ArrayList<>();
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java
index dcf6e97e..1f71258d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorPublicFilter.java
@@ -22,13 +22,13 @@ public class NavigatorPublicFilter extends NavigatorFilter
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List resultLists = new ArrayList<>();
int i = 0;
- resultLists.add(new SearchResultList(i, "official-root", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("official-root", ListMode.THUMBNAILS), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root"), Emulator.getGameEnvironment().getRoomManager().getPublicRooms(), false, showInvisible));
+ resultLists.add(new SearchResultList(i, "official-root", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("official-root", ListMode.THUMBNAILS), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root"), Emulator.getGameEnvironment().getRoomManager().getPublicRooms(), false, showInvisible, DisplayOrder.ORDER_NUM, -1));
i++;
for (NavigatorPublicCategory category : Emulator.getGameEnvironment().getNavigatorManager().publicCategories.values())
{
if (!category.rooms.isEmpty())
{
- resultLists.add(new SearchResultList(i, "", category.name, SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.name, category.image), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.name), category.rooms, true, showInvisible));
+ resultLists.add(new SearchResultList(i, "", category.name, SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.name, category.image), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.name), category.rooms, true, showInvisible, DisplayOrder.ACTIVITY, category.order));
i++;
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java
index 221a643b..0c21bdf0 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorRoomAdsFilter.java
@@ -21,7 +21,7 @@ public class NavigatorRoomAdsFilter extends NavigatorFilter
{
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List resultList = new ArrayList<>();
- resultList.add(new SearchResultList(0, "categories", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("categories", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root", DisplayMode.VISIBLE), Emulator.getGameEnvironment().getRoomManager().getRoomsPromoted(), false, showInvisible));
+ resultList.add(new SearchResultList(0, "categories", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("categories", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root", DisplayMode.VISIBLE), Emulator.getGameEnvironment().getRoomManager().getRoomsPromoted(), false, showInvisible, DisplayOrder.ACTIVITY, 0));
return resultList;
}
}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java
index 384b7655..0fe7fc8d 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java
@@ -24,7 +24,7 @@ public class NavigatorUserFilter extends NavigatorFilter
List resultLists = new ArrayList<>();
List rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(habbo);
Collections.sort(rooms);
- resultLists.add(new SearchResultList(i, "my", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my"), rooms, true, true));
+ resultLists.add(new SearchResultList(i, "my", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my"), rooms, true, true, DisplayOrder.ACTIVITY, -1));
i++;
List favoriteRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsFavourite(habbo);
@@ -32,28 +32,28 @@ public class NavigatorUserFilter extends NavigatorFilter
if (!favoriteRooms.isEmpty())
{
Collections.sort(favoriteRooms);
- resultLists.add(new SearchResultList(1, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("favorites"), favoriteRooms, true, true));
+ resultLists.add(new SearchResultList(1, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("favorites"), favoriteRooms, true, true, DisplayOrder.ACTIVITY, -1));
i++;
}
List frequentlyVisited = Emulator.getGameEnvironment().getRoomManager().getRoomsVisited(habbo, false, 10);
if (!frequentlyVisited.isEmpty())
{
- resultLists.add(new SearchResultList(1, "history_freq", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("history_freq"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("history_freq"), frequentlyVisited, true, true));
+ resultLists.add(new SearchResultList(1, "history_freq", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("history_freq"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("history_freq"), frequentlyVisited, true, true, DisplayOrder.ACTIVITY, -1));
i++;
}
List groupRooms = Emulator.getGameEnvironment().getRoomManager().getGroupRooms(habbo, 25);
if (!groupRooms.isEmpty())
{
- resultLists.add(new SearchResultList(1, "my_groups", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my_groups"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my_groups"), groupRooms, true, true));
+ resultLists.add(new SearchResultList(1, "my_groups", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my_groups"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my_groups"), groupRooms, true, true, DisplayOrder.ACTIVITY, -1));
i++;
}
List rightRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithRights(habbo);
if (!rightRooms.isEmpty())
{
- resultLists.add(new SearchResultList(1, "with_rights", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_rights"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_rights"), rightRooms, true, true));
+ resultLists.add(new SearchResultList(1, "with_rights", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_rights"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_rights"), rightRooms, true, true, DisplayOrder.ACTIVITY, -1));
i++;
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/SearchResultList.java b/src/main/java/com/eu/habbo/habbohotel/navigation/SearchResultList.java
index ff6d2e09..424cb7c7 100644
--- a/src/main/java/com/eu/habbo/habbohotel/navigation/SearchResultList.java
+++ b/src/main/java/com/eu/habbo/habbohotel/navigation/SearchResultList.java
@@ -20,8 +20,10 @@ public class SearchResultList implements ISerialize, Comparable rooms;
public final boolean filter;
public final boolean showInvisible;
+ public final DisplayOrder displayOrder;
+ public final int categoryOrder;
- public SearchResultList(int order, String code, String query, SearchAction action, ListMode mode, DisplayMode hidden, List rooms, boolean filter, boolean showInvisible)
+ public SearchResultList(int order, String code, String query, SearchAction action, ListMode mode, DisplayMode hidden, List rooms, boolean filter, boolean showInvisible, DisplayOrder displayOrder, int categoryOrder)
{
this.order = order;
this.code = code;
@@ -32,6 +34,8 @@ public class SearchResultList implements ISerialize, Comparable, ISerialize, Runnable
if (tile != null)
{
tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false));
- tile.setWalkable(this.canWalkAt(tile) || this.canSitAt(tile.x, tile.y));
+
+ tile.setState(this.calculateTileState(tile));
}
}
@@ -625,12 +626,84 @@ public class Room implements Comparable, ISerialize, Runnable
{
this.tileCache.remove(tile);
tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false));
- tile.setWalkable(this.canWalkAt(tile) || this.canSitAt(tile.x, tile.y));
+ tile.setState(this.calculateTileState(tile));
}
this.sendComposer(new UpdateStackHeightComposer(tiles).compose());
}
+ private RoomTileState calculateTileState(RoomTile tile)
+ {
+ if (tile.state == RoomTileState.INVALID)
+ return RoomTileState.INVALID;
+
+ if (tile.x == 2)
+ {
+ if (tile.y == 23)
+ {
+ boolean test = true;
+ }
+ }
+ RoomTileState result = RoomTileState.OPEN;
+ HabboItem lowestItem = null;
+ HabboItem lowestChair = null;
+ for (HabboItem item : this.getItemsAt(tile))
+ {
+ if (lowestChair != null && item.getZ() > lowestChair.getZ() + 1.5)
+ {
+ continue;
+ }
+
+ if (lowestItem == null || lowestItem.getZ() < item.getZ())
+ {
+ lowestItem = item;
+
+ result = checkStateForItem(lowestItem);
+ }
+ else if (lowestItem.getZ() == item.getZ())
+ {
+ if (result == RoomTileState.OPEN)
+ {
+ result = checkStateForItem(item);
+ }
+ }
+ else
+ {
+ if (item.getBaseItem().allowSit())
+ {
+ lowestChair = item;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private RoomTileState checkStateForItem(HabboItem item)
+ {
+ RoomTileState result = RoomTileState.BLOCKED;
+
+ if (item.isWalkable())
+ {
+ result = RoomTileState.OPEN;
+ }
+ else
+ {
+ result = RoomTileState.BLOCKED;
+ }
+
+ if (item.getBaseItem().allowSit())
+ {
+ result = RoomTileState.SIT;
+ }
+
+ if (item.getBaseItem().allowLay())
+ {
+ result = RoomTileState.LAY;
+ }
+
+ return result;
+ }
public boolean tileWalkable(RoomTile t)
{
return this.tileWalkable(t.x, t.y);
@@ -749,6 +822,7 @@ public class Room implements Comparable, ISerialize, Runnable
Habbo habbo = (picker != null && picker.getHabboInfo().getId() == item.getId() ? picker : Emulator.getGameServer().getGameClientManager().getHabbo(item.getUserId()));
if (habbo != null) {
habbo.getInventory().getItemsComponent().addItem(item);
+ habbo.getClient().sendResponse(new AddHabboItemComposer(item));
habbo.getClient().sendResponse(new InventoryRefreshComposer());
}
Emulator.getThreading().run(item);
@@ -1263,13 +1337,13 @@ public class Room implements Comparable, ISerialize, Runnable
{
final boolean[] foundRightHolder = {false};
- this.tileCache.clear();
boolean loaded = false;
synchronized (this.loadLock)
{
loaded = this.loaded;
}
+ this.tileCache.clear();
if(loaded)
{
if (!this.scheduledTasks.isEmpty())
@@ -1317,7 +1391,7 @@ public class Room implements Comparable, ISerialize, Runnable
HabboItem newRoller = null;
THashSet habbosOnRoller = getHabbosAt(roller.getX(), roller.getY());
- THashSet itemsOnRoller = getItemsAt(roller.getX(), roller.getY(), roller.getZ() + roller.getBaseItem().getHeight());
+ THashSet itemsOnRoller = new THashSet(getItemsAt(roller.getX(), roller.getY()));
itemsOnRoller.remove(roller);
@@ -1327,21 +1401,21 @@ public class Room implements Comparable, ISerialize, Runnable
return true;
}
- RoomTile roomTile = layout.getTileInFront(layout.getTile(roller.getX(), roller.getY()), roller.getRotation());
+ RoomTile tileInFront = layout.getTileInFront(layout.getTile(roller.getX(), roller.getY()), roller.getRotation());
- if (roomTile == null)
+ if (tileInFront == null)
return true;
- if(!layout.tileExists(roomTile.x, roomTile.y))
+ if(!layout.tileExists(tileInFront.x, tileInFront.y))
return true;
- if (roomTile.state == RoomTileState.BLOCKED)
+ if (tileInFront.state == RoomTileState.INVALID)
return true;
- if (!getHabbosAt(roomTile.x, roomTile.y).isEmpty())
+ if (hasHabbosAt(tileInFront.x, tileInFront.y))
return true;
- THashSet itemsNewTile = getItemsAt(roomTile);
+ THashSet itemsNewTile = new THashSet(getItemsAt(tileInFront.x, tileInFront.y));
itemsNewTile.removeAll(itemsOnRoller);
List toRemove = new ArrayList<>();
for (HabboItem item : itemsOnRoller)
@@ -1352,7 +1426,7 @@ public class Room implements Comparable, ISerialize, Runnable
}
}
itemsOnRoller.removeAll(toRemove);
- HabboItem topItem = getTopItemAt(roomTile.x, roomTile.y);
+ HabboItem topItem = getTopItemAt(tileInFront.x, tileInFront.y);
boolean allowUsers = true;
boolean allowFurniture = true;
@@ -1385,14 +1459,20 @@ public class Room implements Comparable, ISerialize, Runnable
}
double zOffset = 0;
- if(newRoller == null)
+ if(newRoller != null)
+ {
+ if (!itemsNewTile.isEmpty() && (newRoller == null || itemsNewTile.size() > 1))
+ {
+ return true;
+ }
+ }
+ else
{
zOffset = -roller.getBaseItem().getHeight();
}
if (allowFurniture || (!allowFurniture && !stackContainsRoller))
{
-
Event furnitureRolledEvent = null;
if (Emulator.getPluginManager().isRegistered(FurnitureRolledEvent.class, true))
@@ -1400,15 +1480,15 @@ public class Room implements Comparable, ISerialize, Runnable
furnitureRolledEvent = new FurnitureRolledEvent(null, null, null);
}
- //if (newRoller == null || topItem == newRoller)
+ if (newRoller == null || topItem == newRoller)
{
for (HabboItem item : itemsOnRoller)
{
- //if (item.getX() == roller.getX() && item.getY() == roller.getY())
+ if (item.getX() == roller.getX() && item.getY() == roller.getY())
{
if (furnitureRolledEvent != null)
{
- furnitureRolledEvent = new FurnitureRolledEvent(item, roller, roomTile);
+ furnitureRolledEvent = new FurnitureRolledEvent(item, roller, tileInFront);
Emulator.getPluginManager().fireEvent(furnitureRolledEvent);
if (furnitureRolledEvent.isCancelled())
@@ -1416,7 +1496,7 @@ public class Room implements Comparable, ISerialize, Runnable
}
if (item != roller)
- messages.add(new FloorItemOnRollerComposer(item, roller, roomTile, zOffset, room));
+ messages.add(new FloorItemOnRollerComposer(item, roller, tileInFront, zOffset, room));
}
}
}
@@ -1438,7 +1518,7 @@ public class Room implements Comparable, ISerialize, Runnable
if (!habbo.getRoomUnit().hasStatus(RoomUnitStatus.MOVE))
{
- RoomTile tile = roomTile.copy();
+ RoomTile tile = tileInFront.copy();
tile.setStackHeight(habbo.getRoomUnit().getZ() + zOffset);
if(roomUserRolledEvent != null)
{
@@ -1502,7 +1582,6 @@ public class Room implements Comparable, ISerialize, Runnable
if (habbo.getRoomUnit().kickCount >= 5)
{
- System.out.println("KICKED");
this.scheduledTasks.add(new Runnable()
{
@Override
@@ -3301,6 +3380,7 @@ public class Room implements Comparable, ISerialize, Runnable
habbo.getRoomUnit().setLocation(tile);
habbo.getRoomUnit().setGoalLocation(tile);
habbo.getRoomUnit().setZ(z);
+ habbo.getRoomUnit().setPreviousLocationZ(z);
this.updateHabbo(habbo);
}
}
@@ -3725,6 +3805,7 @@ public class Room implements Comparable, ISerialize, Runnable
}
catch (Exception e)
{
+ e.printStackTrace();
break;
}
@@ -4132,7 +4213,7 @@ public class Room implements Comparable, ISerialize, Runnable
return false;
}
- if (roomTile.state == RoomTileState.BLOCKED)
+ if (roomTile.state == RoomTileState.INVALID)
return false;
HabboItem topItem = null;
@@ -4797,12 +4878,10 @@ public class Room implements Comparable, ISerialize, Runnable
}
catch (Exception e)
{
+ e.printStackTrace();
break;
}
- if (iterator.value().getUserId() != this.ownerId)
- continue;
-
if (habbo != null && iterator.value().getUserId() == habbo.getHabboInfo().getId())
continue;
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomCategory.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomCategory.java
index cb95129a..06e6669f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomCategory.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomCategory.java
@@ -16,6 +16,7 @@ public class RoomCategory implements Comparable {
private int maxUserCount;
private boolean official;
private ListMode displayMode;
+ private int order;
public RoomCategory(ResultSet set) throws SQLException
{
@@ -27,6 +28,7 @@ public class RoomCategory implements Comparable {
this.maxUserCount = set.getInt("max_user_count");
this.official = set.getString("public").equals("1");
this.displayMode = ListMode.fromType(set.getInt("list_type"));
+ this.order = set.getInt("order_num");
}
public int getId() {
@@ -66,6 +68,11 @@ public class RoomCategory implements Comparable {
return this.displayMode;
}
+ public int getOrder()
+ {
+ return this.order;
+ }
+
@Override
public int compareTo(RoomCategory o) {
return o.getId() - this.getId();
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
index d0dc8b6f..999726d8 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java
@@ -24,6 +24,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable
private int roomUnitId;
private String message;
private String unfilteredMessage;
+ private int timestamp = 0;
private RoomChatMessageBubbles bubble;
private final Habbo habbo;
public int roomId;
@@ -68,6 +69,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable
this.unfilteredMessage = this.message;
this.habbo = message.client.getHabbo();
this.roomUnitId = habbo.getRoomUnit().getId();
+ this.timestamp = Emulator.getIntUnixTimestamp();
this.checkEmotion();
@@ -280,7 +282,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable
statement.setInt(2, 0);
statement.setString(3, this.unfilteredMessage);
- statement.setInt(4, Emulator.getIntUnixTimestamp());
+ statement.setInt(4, this.timestamp);
if(this.habbo.getHabboInfo().getCurrentRoom() != null)
{
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java
index 0aa0b1ae..bde22022 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java
@@ -32,15 +32,15 @@ public enum RoomChatMessageBubbles
THUNDER(27, "", true),
PARROT(28, "", false),
PIRATE(29, "", false),
- BOT_LIGHT_BLUE(30, "", true),
- BOT_LIGHT_GRAY(31, "", true),
+ BOT_GUIDE(30, "", true),
+ BOT_RENTABLE(31, "", true),
SCARY_THING(32, "", true),
FRANK(33, "", true),
WIRED(34, "", false),
GOAT(35, "", true),
SANTA(36, "", true),
AMBASSADOR(37, "acc_ambassador", false),
- UNKNOWN_38(38, "", true),
+ RADIO(38, "", true),
UNKNOWN_39(39, "", true),
UNKNOWN_40(40, "", true),
UNKNOWN_41(41, "", true),
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java
index 8ada83de..7919ce26 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java
@@ -80,7 +80,7 @@ public class RoomLayout
short height = 0;
if (square.equalsIgnoreCase("x"))
{
- state = RoomTileState.BLOCKED;
+ state = RoomTileState.INVALID;
}
else
{
@@ -98,7 +98,7 @@ public class RoomLayout
}
this.mapSize += 1;
- this.roomTiles[x][y] = new RoomTile(x, y, height, state, true, true);
+ this.roomTiles[x][y] = new RoomTile(x, y, height, state, true);
}
}
@@ -106,12 +106,12 @@ public class RoomLayout
if (this.doorTile != null)
{
- this.doorTile.allowStack(false);
+ this.doorTile.setAllowStack(false);
RoomTile doorFrontTile = this.getTileInFront(this.doorTile, this.doorDirection);
if (doorFrontTile != null && this.tileExists(doorFrontTile.x, doorFrontTile.y))
{
- if (this.roomTiles[doorFrontTile.x][doorFrontTile.y].state != RoomTileState.BLOCKED)
+ if (this.roomTiles[doorFrontTile.x][doorFrontTile.y].state != RoomTileState.INVALID)
{
if (this.doorZ != this.roomTiles[doorFrontTile.x][doorFrontTile.y].z || this.roomTiles[this.doorX][this.doorY].state != this.roomTiles[doorFrontTile.x][doorFrontTile.y].state)
{
@@ -255,12 +255,12 @@ public class RoomLayout
return this.heightmap.replace("\r\n", "\r").substring(0, this.heightmap.replace("\r\n", "\r").length());
}
- public final Deque findPath(RoomTile oldTile, RoomTile newTile)
+ public final Deque findPath(RoomTile oldTile, RoomTile newTile, RoomTile goalLocation)
{
LinkedList openList = new LinkedList();
try
{
- if (this.room == null || !this.room.isLoaded() || oldTile == null || newTile == null || oldTile.equals(newTile) || (!newTile.isWalkable() && !this.room.canSitOrLayAt(newTile.x, newTile.y)))
+ if (this.room == null || !this.room.isLoaded() || oldTile == null || newTile == null || oldTile.equals(newTile) || newTile.state == RoomTileState.INVALID)
return openList;
List closedList = new LinkedList();
@@ -284,23 +284,37 @@ public class RoomLayout
return calcPath(findTile(openList, oldTile.x, oldTile.y), current);
}
- List adjacentNodes = getAdjacent(openList, current, newTile.x, newTile.y);
+ List adjacentNodes = getAdjacent(openList, current, newTile);
for (RoomTile currentAdj : adjacentNodes)
{
- if (!currentAdj.isWalkable() && !(currentAdj.equals(newTile) && room.canSitOrLayAt(currentAdj.x, currentAdj.y))){ closedList.add(currentAdj); openList.remove(currentAdj); continue;}
- //if (!room.getLayout().tileWalkable((short) currentAdj.x, (short) currentAdj.y)) continue;
+ //if (closedList.contains(currentAdj)) continue;
- double height = (room.getLayout().getStackHeightAtSquare(currentAdj.x, currentAdj.y) - room.getLayout().getStackHeightAtSquare(current.x, current.y));
-
- if ((!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) || ((!room.canSitAt(currentAdj.x, currentAdj.y) && height > MAXIMUM_STEP_HEIGHT) && !room.canLayAt(currentAdj.x, currentAdj.y)))
+ //If the tile is sitable or layable and its not our goal tile, we cannot walk over it.
+ if (
+ (currentAdj.state == RoomTileState.BLOCKED) ||
+ ((currentAdj.state == RoomTileState.SIT || currentAdj.state == RoomTileState.LAY) && !currentAdj.equals(goalLocation)))
+ {
+ closedList.add(currentAdj); openList.remove(currentAdj);
continue;
+ }
+ ////if (!room.getLayout().tileWalkable((short) currentAdj.x, (short) currentAdj.y)) continue;
- if (!this.room.isAllowWalkthrough() && room.hasHabbosAt(currentAdj.x, currentAdj.y)) continue;
+ //Height difference.
+ double height = currentAdj.getStackHeight() - current.getStackHeight();
+
+ //If we are not allowed to fall and the height difference is bigger than the maximum stepheight, continue.
+ if (!ALLOW_FALLING && height < - MAXIMUM_STEP_HEIGHT) continue;
+
+ //If the step difference is bigger than the maximum step height, continue.
+ if (height > MAXIMUM_STEP_HEIGHT) continue;
+
+ //Check if the tile has habbos.
+ if (!this.room.isAllowWalkthrough() && room.hasHabbosAt(currentAdj.x, currentAdj.y)) { closedList.add(currentAdj); openList.remove(currentAdj); continue;}
//if (room.hasPetsAt(currentAdj.x, currentAdj.y)) continue;
- if (!openList.contains(currentAdj) || (currentAdj.x == newTile.x && currentAdj.y == newTile.y && (room.canSitOrLayAt(newTile.x, newTile.y) && !room.hasHabbosAt(newTile.x, newTile.y))))
+ if (!openList.contains(currentAdj))
{
currentAdj.setPrevious(current);
currentAdj.sethCosts(findTile(openList, newTile.x, newTile.y));
@@ -379,16 +393,15 @@ public class RoomLayout
return cheapest;
}
- private List getAdjacent(List closedList, RoomTile node, int newX, int newY)
+ private List getAdjacent(List closedList, RoomTile node, RoomTile nextTile)
{
short x = node.x;
short y = node.y;
List adj = new LinkedList<>();
- boolean canSitOrLayAt = room.canSitOrLayAt(newX, newY);
if (x > 0)
{
RoomTile temp = findTile(adj, (short) (x - 1), y);
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(false);
adj.add(temp);
@@ -397,7 +410,7 @@ public class RoomLayout
if (x < this.mapSizeX)
{
RoomTile temp = findTile(closedList, (short) (x + 1), y);
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(false);
adj.add(temp);
@@ -406,7 +419,7 @@ public class RoomLayout
if (y > 0)
{
RoomTile temp = findTile(closedList, x, (short) (y - 1));
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(false);
adj.add(temp);
@@ -415,7 +428,7 @@ public class RoomLayout
if (y < this.mapSizeY)
{
RoomTile temp = findTile(closedList, x, (short) (y + 1));
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(false);
adj.add(temp);
@@ -426,7 +439,7 @@ public class RoomLayout
if ((x < this.mapSizeX) && (y < this.mapSizeY))
{
RoomTile temp = findTile(closedList, (short) (x + 1), (short) (y + 1));
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(true);
adj.add(temp);
@@ -435,7 +448,7 @@ public class RoomLayout
if ((x > 0) && (y > 0))
{
RoomTile temp = findTile(closedList, (short) (x - 1), (short) (y - 1));
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(true);
adj.add(temp);
@@ -444,7 +457,7 @@ public class RoomLayout
if ((x > 0) && (y < this.mapSizeY))
{
RoomTile temp = findTile(closedList, (short) (x - 1), (short) (y + 1));
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(true);
adj.add(temp);
@@ -453,7 +466,7 @@ public class RoomLayout
if ((x < this.mapSizeX) && (y > 0))
{
RoomTile temp = findTile(closedList, (short) (x + 1), (short) (y - 1));
- if (temp != null && (((temp.isWalkable()) && (!closedList.contains(temp))) || (temp.x == newX && temp.y == newY && canSitOrLayAt)))
+ if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID)
{
temp.isDiagonally(true);
adj.add(temp);
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java
index 67291b23..769377cc 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java
@@ -35,6 +35,7 @@ import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer;
import com.eu.habbo.plugin.events.navigator.NavigatorRoomCreatedEvent;
import com.eu.habbo.plugin.events.rooms.RoomUncachedEvent;
import com.eu.habbo.plugin.events.users.UserEnterRoomEvent;
+import com.eu.habbo.plugin.events.users.UserExitRoomEvent;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.hash.THashMap;
import gnu.trove.procedure.TIntProcedure;
@@ -741,6 +742,8 @@ public class RoomManager
habbo.getClient().sendResponse(new RoomScoreComposer(room.getScore(), !this.hasVotedForRoom(habbo, room)));
+ habbo.getRoomUnit().setFastWalk(habbo.getRoomUnit().isFastWalk() && habbo.hasPermission("cmd_fastwalk", room.hasRights(habbo)));
+
if (room.isPromoted())
{
habbo.getClient().sendResponse(new RoomPromotionMessageComposer(room, room.getPromotion()));
@@ -1052,6 +1055,11 @@ public class RoomManager
}
public void leaveRoom(Habbo habbo, Room room)
+ {
+ leaveRoom(habbo, room, true);
+ }
+
+ public void leaveRoom(Habbo habbo, Room room, boolean redirectToHotelView)
{
if(habbo.getHabboInfo().getCurrentRoom() != null && habbo.getHabboInfo().getCurrentRoom() == room)
{
@@ -1073,8 +1081,12 @@ public class RoomManager
}
this.logExit(habbo);
room.removeHabbo(habbo);
+
room.sendComposer(new RoomUserRemoveComposer(habbo.getRoomUnit()).compose());
- habbo.getClient().sendResponse(new HotelViewComposer());
+ if (redirectToHotelView)
+ {
+ habbo.getClient().sendResponse(new HotelViewComposer());
+ }
habbo.getHabboInfo().setCurrentRoom(null);
habbo.getRoomUnit().isKicked = false;
@@ -1086,6 +1098,7 @@ public class RoomManager
}
public void logExit(Habbo habbo)
{
+ Emulator.getPluginManager().fireEvent(new UserExitRoomEvent(habbo, UserExitRoomEvent.UserExitRoomReason.DOOR));
if(habbo.getRoomUnit().getCacheable().containsKey("control"))
{
Habbo control = (Habbo)habbo.getRoomUnit().getCacheable().remove("control");
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java
index 258ecbea..aca68c27 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java
@@ -9,7 +9,6 @@ public class RoomTile
private double stackHeight = 0;
private boolean allowStack = true;
- private boolean walkable = true;
private RoomTile previous = null;
@@ -19,22 +18,14 @@ public class RoomTile
private short hCosts;
- public RoomTile(short x, short y, short z, RoomTileState state, boolean walkable, boolean allowStack)
+ public RoomTile(short x, short y, short z, RoomTileState state, boolean allowStack)
{
this.x = x;
this.y = y;
this.z = z;
this.stackHeight = z;
-
this.state = state;
-
- this.walkable = walkable;
- this.allowStack = allowStack;
- if (this.state == RoomTileState.BLOCKED)
- {
- this.allowStack = false;
- this.walkable = false;
- }
+ this.setAllowStack(allowStack);
}
public RoomTile(RoomTile tile)
@@ -44,16 +35,14 @@ public class RoomTile
this.z = tile.z;
this.stackHeight = tile.stackHeight;
this.state = tile.state;
- this.walkable = tile.walkable;
this.allowStack = tile.allowStack;
this.diagonally = tile.diagonally;
this.gCosts = tile.gCosts;
this.hCosts = tile.hCosts;
- if (this.state == RoomTileState.BLOCKED)
+ if (this.state == RoomTileState.INVALID)
{
this.allowStack = false;
- this.walkable = false;
}
}
@@ -76,19 +65,24 @@ public class RoomTile
}
}
- public boolean allowStack()
+ public boolean getAllowStack()
{
return this.allowStack;
}
- public void allowStack(boolean allowStack)
+ public void setAllowStack(boolean allowStack)
{
this.allowStack = allowStack;
+
+ if (this.state == RoomTileState.INVALID)
+ {
+ this.allowStack = false;
+ }
}
public short relativeHeight()
{
- if (this.state == RoomTileState.BLOCKED || !allowStack)
+ if (this.state == RoomTileState.INVALID || !allowStack)
{
return Short.MAX_VALUE;
}
@@ -203,12 +197,17 @@ public class RoomTile
public boolean isWalkable()
{
- return this.walkable && this.state != RoomTileState.BLOCKED;
+ return this.state == RoomTileState.OPEN;
}
- public void setWalkable(boolean walkable)
+ public RoomTileState getState()
{
- this.walkable = walkable;
+ return this.state;
+ }
+
+ public void setState(RoomTileState state)
+ {
+ this.state = state;
}
public boolean is(short x, short y)
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTileState.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTileState.java
index b52f58d8..955b9f91 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTileState.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTileState.java
@@ -3,6 +3,18 @@ package com.eu.habbo.habbohotel.rooms;
public enum RoomTileState
{
+
OPEN,
- BLOCKED
+
+
+ BLOCKED,
+
+
+ INVALID,
+
+
+ SIT,
+
+
+ LAY
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java
index 9ebd2e77..29ab029b 100644
--- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java
+++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java
@@ -151,7 +151,7 @@ public class RoomUnit
}
}
- Deque peekPath = room.getLayout().findPath(this.currentLocation, this.path.peek());
+ Deque peekPath = room.getLayout().findPath(this.currentLocation, this.path.peek(), this.goalLocation);
if (peekPath.size() >= 3)
{
peekPath.pop(); //Start
@@ -467,7 +467,7 @@ public class RoomUnit
{
if (goalLocation != null)
{
- if (goalLocation.state == RoomTileState.OPEN)
+ if (goalLocation.state != RoomTileState.INVALID)
{
this.setGoalLocation(goalLocation, false);
}
@@ -552,7 +552,7 @@ public class RoomUnit
{
if (this.room != null && this.room.getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.room.canSitOrLayAt(this.goalLocation.x, this.goalLocation.y)))
{
- this.path = this.room.getLayout().findPath(this.currentLocation, this.goalLocation);
+ this.path = this.room.getLayout().findPath(this.currentLocation, this.goalLocation, this.goalLocation);
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java
index bc19360c..6679b3df 100644
--- a/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java
+++ b/src/main/java/com/eu/habbo/habbohotel/users/Habbo.java
@@ -149,7 +149,7 @@ public class Habbo implements Runnable
{
if (!Emulator.isShuttingDown)
{
- Emulator.getPluginManager().fireEvent(new UserDisconnectEvent(this));
+ if(Emulator.getPluginManager().fireEvent(new UserDisconnectEvent(this)).isCancelled()) return;
}
if (this.disconnected || this.disconnecting)
diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java
index ee21784d..bef41862 100644
--- a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java
+++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java
@@ -51,8 +51,13 @@ public abstract class HabboItem implements Runnable, IEventTriggers
this.z = set.getDouble("z");
this.rotation = set.getInt("rot");
this.extradata = set.getString("extra_data");
- this.limitedStack = Integer.parseInt(set.getString("limited_data").split(":")[0]);
- this.limitedSells = Integer.parseInt(set.getString("limited_data").split(":")[1]);
+
+ String ltdData = set.getString("limited_data");
+ if (!ltdData.isEmpty())
+ {
+ this.limitedStack = Integer.parseInt(set.getString("limited_data").split(":")[0]);
+ this.limitedSells = Integer.parseInt(set.getString("limited_data").split(":")[1]);
+ }
}
public HabboItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
@@ -112,7 +117,7 @@ public abstract class HabboItem implements Runnable, IEventTriggers
else
serverMessage.appendString(this.extradata);
serverMessage.appendInt(-1);
- serverMessage.appendInt(this.getBaseItem().getStateCount() > 1 || this instanceof InteractionCrackable || this instanceof InteractionMultiHeight ? 1 : 0);
+ serverMessage.appendInt(this.isUsable());
serverMessage.appendInt(this.getUserId());
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java
index 21e4c203..cbf3fefd 100644
--- a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java
@@ -11,6 +11,7 @@ import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
import com.eu.habbo.messages.outgoing.modtool.ModToolComposer;
import com.eu.habbo.messages.outgoing.users.UserPerksComposer;
import com.eu.habbo.messages.outgoing.users.UserPermissionsComposer;
+import com.eu.habbo.plugin.events.users.UserRankChangedEvent;
import com.eu.habbo.plugin.events.users.UserRegisteredEvent;
import java.sql.Connection;
@@ -326,7 +327,6 @@ public class HabboManager
{
throw new Exception("Rank ID (" + rankId + ") does not exist");
}
-
Rank rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId);
if(habbo != null && habbo.getHabboStats() != null)
@@ -362,6 +362,8 @@ public class HabboManager
Emulator.getLogging().logSQLException(e);
}
}
+
+ Emulator.getPluginManager().fireEvent(new UserRankChangedEvent(habbo));
}
public void giveCredits(int userId, int credits)
diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java
index 4b99d355..7e021fe5 100644
--- a/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java
+++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboStats.java
@@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.users;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.Achievement;
+import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.achievements.TalentTrackType;
import com.eu.habbo.habbohotel.catalog.CatalogItem;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@@ -263,7 +264,7 @@ public class HabboStats implements Runnable
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{
- try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ? WHERE user_id = ? LIMIT 1"))
+ try (PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET achievement_score = ?, respects_received = ?, respects_given = ?, daily_respect_points = ?, block_following = ?, block_friendrequests = ?, online_time = online_time + ?, guild_id = ?, daily_pet_respect_points = ?, club_expire_timestamp = ?, login_streak = ?, rent_space_id = ?, rent_space_endtime = ?, volume_system = ?, volume_furni = ?, volume_trax = ?, block_roominvites = ?, old_chat = ?, block_camera_follow = ?, chat_color = ?, hof_points = ?, block_alerts = ?, talent_track_citizenship_level = ?, talent_track_helpers_level = ?, ignore_bots = ?, ignore_pets = ?, nux = ?, mute_end_timestamp = ?, allow_name_change = ?, perk_trade = ?, can_trade = ? WHERE user_id = ? LIMIT 1"))
{
statement.setInt(1, this.achievementScore);
statement.setInt(2, this.respectPointsReceived);
@@ -295,7 +296,8 @@ public class HabboStats implements Runnable
statement.setInt(28, this.muteEndTime);
statement.setString(29, this.allowNameChange ? "1" : "0");
statement.setString(30, this.perkTrade ? "1" : "0");
- statement.setInt(31, this.habbo.getHabboInfo().getId());
+ statement.setString(31, this.allowTrade ? "1" : "0");
+ statement.setInt(32, this.habbo.getHabboInfo().getId());
statement.executeUpdate();
}
@@ -759,7 +761,7 @@ public class HabboStats implements Runnable
public boolean allowTrade()
{
- if (RoomTrade.TRADING_REQUIRES_PERK)
+ if (AchievementManager.TALENTTRACK_ENABLED && RoomTrade.TRADING_REQUIRES_PERK)
return this.perkTrade && this.allowTrade;
else return this.allowTrade;
}
diff --git a/src/main/java/com/eu/habbo/messages/ICallable.java b/src/main/java/com/eu/habbo/messages/ICallable.java
new file mode 100644
index 00000000..a2da1712
--- /dev/null
+++ b/src/main/java/com/eu/habbo/messages/ICallable.java
@@ -0,0 +1,8 @@
+package com.eu.habbo.messages;
+
+import com.eu.habbo.messages.incoming.MessageHandler;
+
+public interface ICallable
+{
+ public void call(MessageHandler handler);
+}
\ No newline at end of file
diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java
index 7bec0797..4d50853d 100644
--- a/src/main/java/com/eu/habbo/messages/PacketManager.java
+++ b/src/main/java/com/eu/habbo/messages/PacketManager.java
@@ -29,6 +29,8 @@ import com.eu.habbo.messages.incoming.guardians.GuardianNoUpdatesWantedEvent;
import com.eu.habbo.messages.incoming.guardians.GuardianVoteEvent;
import com.eu.habbo.messages.incoming.guides.*;
import com.eu.habbo.messages.incoming.guilds.*;
+import com.eu.habbo.messages.incoming.guilds.forums.GuildForumDataEvent;
+import com.eu.habbo.messages.incoming.guilds.forums.GuildForumListEvent;
import com.eu.habbo.messages.incoming.handshake.*;
import com.eu.habbo.messages.incoming.helper.RequestTalentTrackEvent;
import com.eu.habbo.messages.incoming.hotelview.*;
@@ -70,15 +72,13 @@ import com.eu.habbo.plugin.EventHandler;
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import gnu.trove.map.hash.THashMap;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
public class PacketManager
{
private final THashMap> incoming;
- private final THashMap> callables;
+ private final THashMap> callables;
private static final List logList = new ArrayList<>();
public PacketManager() throws Exception
@@ -111,6 +111,7 @@ public class PacketManager
this.registerGameCenter();
}
+
public void registerHandler(Integer header, Class extends MessageHandler> handler) throws Exception
{
if (header < 0)
@@ -124,16 +125,32 @@ public class PacketManager
this.incoming.putIfAbsent(header, handler);
}
- public void registerCallable(Integer header, Map.Entry