updated to 1.14 decompiled.

This commit is contained in:
capheus 2018-11-17 13:28:00 +00:00
parent cbd721c198
commit 35876a2596
93 changed files with 760 additions and 641 deletions

View File

@ -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

39
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>com.eu.habbo</groupId>
<artifactId>Habbo</artifactId>
<version>1.13.0</version>
<version>1.14.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -70,6 +70,7 @@
<version>3.0.0</version>
<configuration>
<additionalOptions><additionalOption>-Xdoclint:none</additionalOption></additionalOptions>
<show>public</show>
</configuration>
</plugin>
</plugins>
@ -87,27 +88,27 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.15.Final</version>
<version>4.1.24.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.1.15.Final</version>
<version>4.1.24.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
<version>4.1.15.Final</version>
<version>4.1.24.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.15.Final</version>
<version>4.1.24.Final</version>
<scope>compile</scope>
</dependency>
@ -115,14 +116,14 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
<version>2.8.4</version>
</dependency>
<!-- MySQL Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
<version>5.1.46</version>
<scope>runtime</scope>
</dependency>
@ -134,56 +135,50 @@
<scope>compile</scope>
</dependency>
<!-- HikariCP -->
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.6.0</version>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
<version>3.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
<version>1.11.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.5</version>
<version>2.9.9</version>
</dependency>
</dependencies>

View File

@ -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:<br/>badge: BADGE CODE<br/>Credits: credits#amount<br/>Pixels: pixels#amount<br/>Points: points#amount<br/>Respect: respect#amount<br/>Furniture: furni#FurnitureID<br/>Catalog Item: cata#CatalogItemID<br/>' 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

View File

@ -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;

View File

@ -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;
}

View File

@ -25,6 +25,8 @@ import java.util.Map;
public class AchievementManager
{
public static boolean TALENTTRACK_ENABLED = false;
private final THashMap<String, Achievement> achievements;
@ -219,6 +221,8 @@ public class AchievementManager
AchievementLevel newLevel = achievement.getLevelForProgress(currentProgress + amount);
if (AchievementManager.TALENTTRACK_ENABLED)
{
for (TalentTrackType type : TalentTrackType.values())
{
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type))
@ -233,6 +237,7 @@ public class AchievementManager
}
}
}
}
if(newLevel == null || (oldLevel.level == newLevel.level && newLevel.level < achievement.levels.size()))
{

View File

@ -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)));
}
}

View File

@ -64,6 +64,9 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
protected boolean needsUpdate;
protected int orderNumber;
protected HashMap<Integer, Integer> bundle;
public CatalogItem(ResultSet set) throws SQLException
@ -94,6 +97,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
this.clubOnly = set.getBoolean("club_only");
this.haveOffer = set.getBoolean("have_offer");
this.offerId = set.getInt("offer_id");
this.orderNumber = set.getInt("order_number");
this.bundle = new HashMap<>();
this.loadBundle();
@ -209,6 +213,12 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
}
public int getOrderNumber()
{
return this.orderNumber;
}
public synchronized void sellRare()
{
this.limitedSells++;
@ -436,9 +446,17 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
@SuppressWarnings("NullableProblems")
@Override
public int compareTo(CatalogItem catalogItem) {
public int compareTo(CatalogItem catalogItem)
{
if (CatalogManager.SORT_USING_ORDERNUM)
{
return this.getOrderNumber() - catalogItem.getOrderNumber();
}
else
{
return this.getId() - catalogItem.getId();
}
}
public static boolean haveOffer(CatalogItem item)

View File

@ -88,6 +88,9 @@ public class CatalogManager
public static int PURCHASE_COOLDOWN = 3;
public static boolean SORT_USING_ORDERNUM = false;
public final THashMap<Integer, CalendarRewardObject> calendarRewards;

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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<RoomTile> 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);
}
}

View File

@ -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<RoomTile> 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);
}
}

View File

@ -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<GuildForumThread> 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<GuildForumThread>()
{
@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)

View File

@ -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<GuildForumComment> comments;
public final List<GuildForumComment> comments;
public final ConcurrentHashMap<Integer, GuildForumComment> 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<GuildForumComment>();
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
{
@ -111,8 +106,6 @@ public class GuildForumThread implements ISerialize, Runnable
}
public void addComment(GuildForumComment comment)
{
synchronized (this.comments)
{
if (comment.getIndex() == -1)
{
@ -127,8 +120,7 @@ public class GuildForumThread implements ISerialize, Runnable
}
}
this.comments.add(comment);
}
this.comments.put(comment.getId(), comment);
this.lastAuthorId = comment.getUserId();
this.lastAuthorName = comment.getUserName();
@ -183,10 +175,11 @@ public class GuildForumThread implements ISerialize, Runnable
public List<GuildForumComment> 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()

View File

@ -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<NewsWidget> newsWidgets;
private final ArrayList<NewsWidget> newsWidgets;
public NewsList()
{
this.newsWidgets = new THashSet<>();
this.newsWidgets = new ArrayList<>();
this.reload();
}
@ -39,7 +39,7 @@ public class NewsList
}
public THashSet<NewsWidget> getNewsWidgets()
public ArrayList<NewsWidget> getNewsWidgets()
{
return newsWidgets;
}

View File

@ -37,11 +37,20 @@ public class InteractionEffectTile extends InteractionPressurePlate
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{
super.onWalkOff(roomUnit, room, objects);
}
@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.getRoomUnit().getEffectId() == 0)
{
if (habbo.getHabboInfo().getGender().equals(HabboGender.M))
{
room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectM());
@ -50,22 +59,6 @@ public class InteractionEffectTile extends InteractionPressurePlate
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
{
}
@Override
public boolean isUsable()

View File

@ -22,8 +22,6 @@ public class InteractionGift extends HabboItem
private String sender = "";
private String look = "";
public THashSet<HabboItem> 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<HabboItem> loadItems()
{
THashSet<HabboItem> items = new THashSet<>();
for (int anItemId : itemId)
{
if (anItemId == 0)
continue;
items.add(Emulator.getGameEnvironment().getItemManager().loadHabboItem(anItemId));
}
return items;
}
}

View File

@ -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

View File

@ -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()
{
setExtradata("0");
this.roomUnitID = -1;
room.sendComposer(new ItemStateComposer2(getId(), 0).compose());
}
}, 500);
room.updateTile(room.getLayout().getTile(this.getX(), this.getY()));
}
@Override

View File

@ -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;
}

View File

@ -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());

View File

@ -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,6 +39,29 @@ public class InteractionTrap extends InteractionPressurePlate
delay = 3000;
}
if (roomUnit != null)
{
if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0)
{
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()
{
@ -44,6 +73,10 @@ public class InteractionTrap extends InteractionPressurePlate
}
}, delay);
}
}
}
}
}
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception

View File

@ -123,6 +123,12 @@ public abstract class InteractionWired extends HabboItem
return true;
}
@Override
public boolean allowWiredResetState()
{
return false;
}
@Override
public boolean isUsable()
{

View File

@ -208,4 +208,10 @@ public abstract class InteractionGameTimer extends HabboItem
}
public abstract Class<? extends Game> getGameType();
@Override
public boolean allowWiredResetState()
{
return true;
}
}

View File

@ -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

View File

@ -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())));
}

View File

@ -44,25 +44,16 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition
for(HabboItem item : this.items)
{
THashSet<HabboItem> things = room.getItemsAt(room.getLayout().getTile(item.getX(), item.getY()));
for(HabboItem i : things)
{
if(i == item)
continue;
if(i.getZ() >= item.getZ())
THashSet<HabboItem> things = room.getItemsAt(item.getX(), item.getY(), item.getZ());
if (!things.isEmpty())
{
if (this.all)
return false;
}
else
{
if(!this.all)
continue;
}
return true;
}
}
}
return false;
}

View File

@ -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());

View File

@ -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;
}
}

View File

@ -49,6 +49,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
{
THashSet<RoomTile> 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()));
}
}

View File

@ -122,7 +122,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect
THashSet<RoomTile> 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);

View File

@ -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,24 +157,28 @@ 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();
offset = Math.max(room.getStackHeight(newTile.x, newTile.y, false, item) - item.getZ(), offset);
}
}
}
room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose());
}
}
}
}
}
}
}
}
return true;
}
@ -330,6 +331,6 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect
@Override
protected long requiredCooldown()
{
return 495;
return 0;
}
}

View File

@ -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());

View File

@ -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<Integer, MessengerBuddy> map : this.friends.entrySet())
{
if(map.getValue().getUsername().contains(username))
if(StringUtils.containsIgnoreCase(map.getValue().getUsername(), username))
{
users.add(map.getValue());
}

View File

@ -0,0 +1,7 @@
package com.eu.habbo.habbohotel.navigation;
public enum DisplayOrder
{
ORDER_NUM,
ACTIVITY
}

View File

@ -23,7 +23,7 @@ public class NavigatorFavoriteFilter extends NavigatorFilter
List<SearchResultList> resultLists = new ArrayList<>();
List<Room> 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;
}
}

View File

@ -25,7 +25,7 @@ public class NavigatorHotelFilter extends NavigatorFilter
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List<SearchResultList> 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<Integer, List<Room>> 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++;
}
}

View File

@ -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<Integer, NavigatorPublicCategory> publicCategories = new THashMap<>();
public final ConcurrentHashMap<String, NavigatorFilterField> filterSettings = new ConcurrentHashMap<>();
public final THashMap<String, NavigatorFilter> 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!");
}
}
}
}

View File

@ -13,13 +13,14 @@ public class NavigatorPublicCategory
public final String name;
public final List<Room> 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<>();
}

View File

@ -22,13 +22,13 @@ public class NavigatorPublicFilter extends NavigatorFilter
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List<SearchResultList> 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++;
}
}

View File

@ -21,7 +21,7 @@ public class NavigatorRoomAdsFilter extends NavigatorFilter
{
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List<SearchResultList> 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;
}
}

View File

@ -24,7 +24,7 @@ public class NavigatorUserFilter extends NavigatorFilter
List<SearchResultList> resultLists = new ArrayList<>();
List<Room> 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<Room> 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<Room> 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<Room> 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<Room> 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++;
}

View File

@ -20,8 +20,10 @@ public class SearchResultList implements ISerialize, Comparable<SearchResultList
public final List<Room> 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<Room> rooms, boolean filter, boolean showInvisible)
public SearchResultList(int order, String code, String query, SearchAction action, ListMode mode, DisplayMode hidden, List<Room> 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<SearchResultList
this.hidden = hidden;
this.filter = filter;
this.showInvisible = showInvisible;
this.displayOrder = displayOrder;
this.categoryOrder = categoryOrder;
}
@Override
@ -71,6 +75,8 @@ public class SearchResultList implements ISerialize, Comparable<SearchResultList
@Override
public int compareTo(SearchResultList o)
{
if (this.displayOrder == DisplayOrder.ACTIVITY)
{
if (this.code.equalsIgnoreCase("popular"))
{
@ -79,4 +85,6 @@ public class SearchResultList implements ISerialize, Comparable<SearchResultList
return this.rooms.size() - o.rooms.size();
}
return this.categoryOrder - o.categoryOrder;
}
}

View File

@ -216,7 +216,16 @@ public class PetManager
{
if (this.petData.containsKey(set.getInt("pet_id")))
{
this.petData.get(set.getInt("pet_id")).petVocals.get(PetVocalsType.valueOf(set.getString("type").toUpperCase())).add(new PetVocal(set.getString("message")));
PetVocalsType petVocalsType = PetVocalsType.valueOf(set.getString("type").toUpperCase());
if (petVocalsType != null)
{
this.petData.get(set.getInt("pet_id")).petVocals.get(petVocalsType).add(new PetVocal(set.getString("message")));
}
else
{
Emulator.getLogging().logErrorLine("Unknown pet vocal type " + set.getString("type"));
}
}
else
{

View File

@ -615,7 +615,8 @@ public class Room implements Comparable<Room>, 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<Room>, 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<Room>, 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<Room>, 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<Room>, ISerialize, Runnable
HabboItem newRoller = null;
THashSet<Habbo> habbosOnRoller = getHabbosAt(roller.getX(), roller.getY());
THashSet<HabboItem> itemsOnRoller = getItemsAt(roller.getX(), roller.getY(), roller.getZ() + roller.getBaseItem().getHeight());
THashSet<HabboItem> itemsOnRoller = new THashSet<HabboItem>(getItemsAt(roller.getX(), roller.getY()));
itemsOnRoller.remove(roller);
@ -1327,21 +1401,21 @@ public class Room implements Comparable<Room>, 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<HabboItem> itemsNewTile = getItemsAt(roomTile);
THashSet<HabboItem> itemsNewTile = new THashSet<HabboItem>(getItemsAt(tileInFront.x, tileInFront.y));
itemsNewTile.removeAll(itemsOnRoller);
List<HabboItem> toRemove = new ArrayList<>();
for (HabboItem item : itemsOnRoller)
@ -1352,7 +1426,7 @@ public class Room implements Comparable<Room>, 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<Room>, 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<Room>, 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<Room>, 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<Room>, 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<Room>, 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<Room>, 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<Room>, ISerialize, Runnable
}
catch (Exception e)
{
e.printStackTrace();
break;
}
@ -4132,7 +4213,7 @@ public class Room implements Comparable<Room>, 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<Room>, 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;

View File

@ -16,6 +16,7 @@ public class RoomCategory implements Comparable<RoomCategory> {
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<RoomCategory> {
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<RoomCategory> {
return this.displayMode;
}
public int getOrder()
{
return this.order;
}
@Override
public int compareTo(RoomCategory o) {
return o.getId() - this.getId();

View File

@ -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)
{

View File

@ -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),

View File

@ -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<RoomTile> findPath(RoomTile oldTile, RoomTile newTile)
public final Deque<RoomTile> findPath(RoomTile oldTile, RoomTile newTile, RoomTile goalLocation)
{
LinkedList<RoomTile> 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<RoomTile> closedList = new LinkedList();
@ -284,23 +284,37 @@ public class RoomLayout
return calcPath(findTile(openList, oldTile.x, oldTile.y), current);
}
List<RoomTile> adjacentNodes = getAdjacent(openList, current, newTile.x, newTile.y);
List<RoomTile> 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<RoomTile> getAdjacent(List<RoomTile> closedList, RoomTile node, int newX, int newY)
private List<RoomTile> getAdjacent(List<RoomTile> closedList, RoomTile node, RoomTile nextTile)
{
short x = node.x;
short y = node.y;
List<RoomTile> 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);

View File

@ -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());
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");

View File

@ -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)

View File

@ -3,6 +3,18 @@ package com.eu.habbo.habbohotel.rooms;
public enum RoomTileState
{
OPEN,
BLOCKED
BLOCKED,
INVALID,
SIT,
LAY
}

View File

@ -151,7 +151,7 @@ public class RoomUnit
}
}
Deque<RoomTile> peekPath = room.getLayout().findPath(this.currentLocation, this.path.peek());
Deque<RoomTile> 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);
}
}

View File

@ -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)

View File

@ -51,9 +51,14 @@ public abstract class HabboItem implements Runnable, IEventTriggers
this.z = set.getDouble("z");
this.rotation = set.getInt("rot");
this.extradata = set.getString("extra_data");
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());
}

View File

@ -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)

View File

@ -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;
}

View File

@ -0,0 +1,8 @@
package com.eu.habbo.messages;
import com.eu.habbo.messages.incoming.MessageHandler;
public interface ICallable
{
public void call(MessageHandler handler);
}

View File

@ -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<Integer, Class<? extends MessageHandler>> incoming;
private final THashMap<Integer, Map.Entry<Object, Method>> callables;
private final THashMap<Integer, List<ICallable>> callables;
private static final List<Integer> 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,15 +125,31 @@ public class PacketManager
this.incoming.putIfAbsent(header, handler);
}
public void registerCallable(Integer header, Map.Entry<Object, Method> objectMethodEntry)
public void registerCallable(Integer header, ICallable callable)
{
this.callables.put(header, objectMethodEntry);
this.callables.putIfAbsent(header, new ArrayList<>());
this.callables.get(header).add(callable);
}
public void unregisterCallable(Integer header)
public void unregisterCallables(Integer header, ICallable callable)
{
this.callables.remove(header);
if (this.callables.containsKey(header))
{
this.callables.get(header).remove(callable);
}
}
public void unregisterCallables(Integer header)
{
if (this.callables.containsKey(header))
{
this.callables.clear();
}
}
public void handlePacket(GameClient client, ClientMessage packet)
{
@ -161,11 +178,9 @@ public class PacketManager
if (this.callables.containsKey(packet.getMessageId()))
{
Map.Entry<Object, Method> entry = this.callables.get(packet.getMessageId());
if (entry.getKey() != null)
for (ICallable callable : this.callables.get(packet.getMessageId()))
{
entry.getValue().invoke(entry.getKey(), handler);
callable.call(handler);
}
}
@ -509,7 +524,16 @@ public class PacketManager
this.registerHandler(Incoming.GuildConfirmRemoveMemberEvent, GuildConfirmRemoveMemberEvent.class);
this.registerHandler(Incoming.GuildRemoveFavoriteEvent, GuildRemoveFavoriteEvent.class);
this.registerHandler(Incoming.GuildDeleteEvent, GuildDeleteEvent.class);
//this.registerHandler(Incoming.GetHabboGuildBadgesMessageEvent, GetHabboGuildBadgesMessageEvent.class);
this.registerHandler(Incoming.GetHabboGuildBadgesMessageEvent, GetHabboGuildBadgesMessageEvent.class);
this.registerHandler(Incoming.GuildForumDataEvent, GuildForumDataEvent.class);
this.registerHandler(Incoming.GuildForumListEvent, GuildForumListEvent.class);
}
void registerPets() throws Exception

View File

@ -13,7 +13,7 @@ public class Incoming
public static final int PickNewUserGiftEvent = 1822;
public static final int FootballGateSaveLookEvent = 924;
public static final int MannequinSaveLookEvent = 2209;
public static final int RequestCatalogPageEvent = 412; //PRODUCTION-201611291003-338511768
public static final int RequestCatalogPageEvent = 412;
public static final int RequestWearingBadgesEvent = 2091;
public static final int BotPickupEvent = 3323;
public static final int HorseRideEvent = 1036;
@ -344,6 +344,17 @@ public class Incoming
public static final int PurchaseTargetOfferEvent = 1826;
public static final int TargetOfferStateEvent = 2041;
public static final int GuildForumDataEvent = 3149;
public static final int UNKNOWN_GUILD_FORUMS_EVENT2 = 3900;
public static final int UNKNOWN_GUILD_FORUMS_EVENT3 = 873;
public static final int GuildForumListEvent = 436;
public static final int UNKNOWN_GUILD_FORUMS_EVENT5 = 232;
public static final int UNKNOWN_GUILD_FORUMS_EVENT6 = 2214;
public static final int UNKNOWN_GUILD_FORUMS_EVENT7 = 3529;
public static final int UNKNOWN_GUILD_FORUMS_EVENT8 = 1397;
public static final int UNKNOWN_GUILD_FORUMS_EVENT9 = 3045;
public static final int UNKNOWN_GUILD_FORUMS_EVENT10 = 286;
public static final int UNKNOWN_SNOWSTORM_6000 = 6000;
public static final int UNKNOWN_SNOWSTORM_6001 = 6001;

View File

@ -152,8 +152,6 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler
CatalogItem item = page.getCatalogItem(itemId);
Item cBaseItem = null;
if (item == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
@ -286,7 +284,6 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler
for (int k = 0; k < item.getItemAmount(baseItem.getId()); k++)
{
cBaseItem = baseItem;
if (!baseItem.getName().contains("avatar_effect"))
{
if (baseItem.getType() == FurnitureType.BADGE)

View File

@ -86,7 +86,7 @@ public class CraftingCraftSecretEvent extends MessageHandler
if (!this.client.getHabbo().getHabboStats().hasRecipe(recipe.getId()))
{
this.client.getHabbo().getHabboStats().addRecipe(recipe.getId());
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("ACH_AtcgSecret"));
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("AtcgSecret"));
}
this.client.getHabbo().getInventory().getItemsComponent().addItem(rewardItem);
this.client.sendResponse(new AddHabboItemComposer(rewardItem));

View File

@ -81,7 +81,7 @@ public class FriendRequestEvent extends MessageHandler
return;
}
if(this.client.getHabbo().getMessenger().getFriends().values().size() >= Messenger.MAXIMUM_FRIENDS)
if(this.client.getHabbo().getMessenger().getFriends().values().size() >= Messenger.MAXIMUM_FRIENDS && !this.client.getHabbo().hasPermission("acc_infinite_friends"))
{
this.client.sendResponse(new FriendRequestErrorComposer(FriendRequestErrorComposer.FRIEND_LIST_OWN_FULL));
return;

View File

@ -3,10 +3,7 @@ package com.eu.habbo.messages.incoming.guilds.forums;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.forums.GuildForum;
import com.eu.habbo.habbohotel.guilds.forums.GuildForumComment;
import com.eu.habbo.habbohotel.guilds.forums.GuildForumThread;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.forums.UnknownGuildForumComposer6;
public class GuildForumModerateMessageEvent extends MessageHandler
@ -24,21 +21,21 @@ public class GuildForumModerateMessageEvent extends MessageHandler
return;
GuildForum forum = Emulator.getGameEnvironment().getGuildForumManager().getGuildForum(guildId);
GuildForumThread thread = forum.getThread(threadId);
if (thread != null)
{
GuildForumComment comment = thread.getComment(messageId);
comment.setState(GuildForum.ThreadState.fromValue(state));
comment.setAdminId(this.client.getHabbo().getHabboInfo().getId());
comment.setAdminName(this.client.getHabbo().getHabboInfo().getUsername());
Emulator.getThreading().run(comment);
//
//
//
this.client.sendResponse(new UnknownGuildForumComposer6(guildId, threadId, comment));
} else
{
}
}
}

View File

@ -3,9 +3,7 @@ package com.eu.habbo.messages.incoming.guilds.forums;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.forums.GuildForum;
import com.eu.habbo.habbohotel.guilds.forums.GuildForumThread;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumThreadMessagesComposer;
public class GuildForumModerateThreadEvent extends MessageHandler
@ -22,12 +20,12 @@ public class GuildForumModerateThreadEvent extends MessageHandler
return;
GuildForum forum = Emulator.getGameEnvironment().getGuildForumManager().getGuildForum(guildId);
GuildForumThread thread = forum.getThread(threadId);
thread.setState(GuildForum.ThreadState.fromValue(state));
thread.setAdminId(this.client.getHabbo().getHabboInfo().getId());
thread.setAdminName(this.client.getHabbo().getHabboInfo().getUsername());
Emulator.getThreading().run(thread);
this.client.sendResponse(new GuildForumThreadMessagesComposer(thread));
//
}
}

View File

@ -1,12 +1,6 @@
package com.eu.habbo.messages.incoming.guilds.forums;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.forums.GuildForum;
import com.eu.habbo.habbohotel.guilds.forums.GuildForumComment;
import com.eu.habbo.habbohotel.guilds.forums.GuildForumThread;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumAddCommentComposer;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumThreadMessagesComposer;
public class GuildForumPostThreadEvent extends MessageHandler
@ -22,35 +16,35 @@ public class GuildForumPostThreadEvent extends MessageHandler
//TODO: Add check if user has guild
//TODO: Add check if threads can be posted.
final GuildForum forum = Emulator.getGameEnvironment().getGuildForumManager().getGuildForum(guildId);
final GuildForumThread thread;
if (forum != null)
{
if (threadId == 0)
{
thread = forum.createThread(this.client.getHabbo(), subject, message);
//
//
//
//
GuildForumComment comment = new GuildForumComment(guildId, threadId, this.client.getHabbo().getHabboInfo().getId(),
this.client.getHabbo().getHabboInfo().getUsername(), this.client.getHabbo().getHabboInfo().getLook(), message);
thread.addComment(comment);
this.client.sendResponse(new GuildForumThreadMessagesComposer(thread));
}
else
{
thread = forum.getThread(threadId);
GuildForumComment comment = thread.addComment(this.client.getHabbo(), message);
if (comment != null)
{
this.client.sendResponse(new GuildForumAddCommentComposer(comment));
}
else
{
//TODO Display error
}
}
}
}
}

View File

@ -3,11 +3,7 @@ package com.eu.habbo.messages.incoming.guilds.forums;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.guilds.Guild;
import com.eu.habbo.habbohotel.guilds.forums.GuildForum;
import com.eu.habbo.habbohotel.guilds.forums.GuildForumThread;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumCommentsComposer;
import com.eu.habbo.messages.outgoing.guilds.forums.GuildForumDataComposer;
public class GuildForumThreadsMessagesEvent extends MessageHandler
{
@ -24,17 +20,17 @@ public class GuildForumThreadsMessagesEvent extends MessageHandler
return;
GuildForum forum = Emulator.getGameEnvironment().getGuildForumManager().getGuildForum(guildId);
GuildForumThread thread = forum.getThread(threadId);
//
//
if (thread.getState() == GuildForum.ThreadState.HIDDEN_BY_ADMIN && guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId())
{
this.client.sendResponse(new BubbleAlertComposer("forums.error.access_denied"));
} else
{
this.client.sendResponse(new GuildForumCommentsComposer(guildId, threadId, index, thread.getComments(index, limit)));
}
this.client.sendResponse(new GuildForumDataComposer(Emulator.getGameEnvironment().getGuildForumManager().getGuildForum(guildId), this.client.getHabbo()));
//
}
}

View File

@ -21,6 +21,7 @@ import com.eu.habbo.messages.outgoing.navigator.*;
import com.eu.habbo.messages.outgoing.unknown.BuildersClubExpiredComposer;
import com.eu.habbo.messages.outgoing.unknown.NewUserIdentityComposer;
import com.eu.habbo.messages.outgoing.users.*;
import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent;
import com.eu.habbo.plugin.events.users.UserLoginEvent;
import java.util.ArrayList;
@ -37,6 +38,8 @@ public class SecureLoginEvent extends MessageHandler
String sso = this.packet.readString().replace(" ", "");
if (Emulator.getPluginManager().fireEvent(new SSOAuthenticationEvent(sso)).isCancelled()) return;
if (sso == null || sso.isEmpty())
{
this.client.getChannel().close();

View File

@ -1,5 +1,6 @@
package com.eu.habbo.messages.incoming.helper;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.TalentTrackType;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.achievements.talenttrack.TalentTrackComposer;
@ -8,7 +9,10 @@ public class RequestTalentTrackEvent extends MessageHandler
{
@Override
public void handle() throws Exception
{
if (Emulator.getConfig().getBoolean("hotel.talentrack.enabled"))
{
this.client.sendResponse(new TalentTrackComposer(this.client.getHabbo(), TalentTrackType.valueOf(this.packet.readString().toUpperCase())));
}
}
}

View File

@ -16,145 +16,6 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler
@Override
public void handle() throws Exception
{
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
String view = this.packet.readString();
String query = this.packet.readString();
@ -196,6 +57,7 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler
return;
List<SearchResultList> resultLists = filter.getResult(this.client.getHabbo());
Collections.sort(resultLists);
this.client.sendResponse(new NewNavigatorSearchResultsComposer(view, query, resultLists));
return;
}
@ -219,10 +81,6 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler
resultLists = new ArrayList<>();
}
filter.filter(field.field, part, resultLists);
Collections.sort(resultLists);
@ -232,25 +90,6 @@ public class RequestNewNavigatorRoomsEvent extends MessageHandler
{
Emulator.getLogging().logErrorLine(e);
}
//
//
//
//
//
}
private void filter(List<SearchResultList> resultLists, NavigatorFilter filter, String part)

View File

@ -72,7 +72,7 @@ public class PetPlaceEvent extends MessageHandler
tile = room.getLayout().getTile((short) x, (short) y);
}
if(tile == null || !tile.isWalkable() || !tile.allowStack())
if(tile == null || !tile.isWalkable() || !tile.getAllowStack())
{
this.client.sendResponse(new PetErrorComposer(PetErrorComposer.ROOM_ERROR_PETS_SELECTED_TILE_NOT_FREE));
return;

View File

@ -9,6 +9,7 @@ import com.eu.habbo.messages.outgoing.rooms.users.ChangeNameUpdatedComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserNameChangedComposer;
import com.eu.habbo.messages.outgoing.users.ChangeNameCheckResultComposer;
import com.eu.habbo.messages.outgoing.users.UserDataComposer;
import com.eu.habbo.plugin.events.users.UserNameChangedEvent;
import java.sql.Connection;
import java.sql.PreparedStatement;
@ -56,6 +57,7 @@ public class ConfirmChangeNameEvent extends MessageHandler
this.client.getHabbo().getHabboInfo().setUsername(name);
this.client.getHabbo().getHabboInfo().run();
Emulator.getPluginManager().fireEvent(new UserNameChangedEvent(this.client.getHabbo(), oldName));
for (Room room : Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(this.client.getHabbo()))
{
room.setOwnerName(name);

View File

@ -21,7 +21,7 @@ public class MessengerInitComposer extends MessageComposer
this.response.appendInt(300);
this.response.appendInt(1337);
if (this.habbo.hasPermission("acc_inifnite_friends"))
if (this.habbo.hasPermission("acc_infinite_friends"))
{
this.response.appendInt(10000);
}

View File

@ -5,8 +5,6 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class NewNavigatorSearchResultsComposer extends MessageComposer
@ -29,15 +27,6 @@ public class NewNavigatorSearchResultsComposer extends MessageComposer
this.response.appendString(this.searchCode);
this.response.appendString(this.searchQuery);
Collections.sort(this.resultList, new Comparator<SearchResultList>()
{
@Override
public int compare(SearchResultList o1, SearchResultList o2)
{
return o1.order - o2.order;
}
});
this.response.appendInt(this.resultList.size()); //Count
for (SearchResultList item : resultList)

View File

@ -26,7 +26,7 @@ public class AddFloorItemComposer extends MessageComposer
this.response.appendInt(this.item instanceof InteractionGift ? ((((InteractionGift) this.item).getColorId() * 1000) + ((InteractionGift) this.item).getRibbonId()) : (this.item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) this.item).getSongId() : 1));
this.item.serializeExtradata(this.response);
this.response.appendInt(-1);
this.response.appendInt(this.item.isUsable() ? 1 : 0);
this.response.appendInt(this.item.isUsable());
this.response.appendInt(this.item.getUserId());
this.response.appendString(this.itemOwnerName);
return this.response;

View File

@ -24,7 +24,7 @@ public class FloorItemUpdateComposer extends MessageComposer
this.response.appendInt(this.item instanceof InteractionGift ? ((((InteractionGift) this.item).getColorId() * 1000) + ((InteractionGift) this.item).getRibbonId()) : (this.item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) this.item).getSongId() : 1));
this.item.serializeExtradata(this.response);
this.response.appendInt(-1);
this.response.appendInt(this.item.isUsable() ? 1 : 0);
this.response.appendInt(this.item.isUsable());
this.response.appendInt(this.item.getUserId());
return this.response;
}

View File

@ -1,6 +1,5 @@
package com.eu.habbo.messages.outgoing.rooms.items;
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -55,7 +54,7 @@ public class RoomFloorItemsComposer extends MessageComposer
this.response.appendInt(item instanceof InteractionGift ? ((((InteractionGift) item).getColorId() * 1000) + ((InteractionGift) item).getRibbonId()) : (item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) item).getSongId() : 1));
item.serializeExtradata(this.response);
this.response.appendInt(-1);
this.response.appendInt(item.getBaseItem().getStateCount() > 1 && item.getClass().isAssignableFrom(InteractionDefault.class) ? 1 : 0);
this.response.appendInt(item.isUsable() ? 1 : 0);
this.response.appendInt(item.getUserId());
}
return this.response;

View File

@ -2,6 +2,7 @@ package com.eu.habbo.messages.rcon;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
import com.eu.habbo.messages.outgoing.users.MeMenuSettingsComposer;
import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer;
import com.google.gson.Gson;
@ -57,9 +58,10 @@ public class UpdateUser extends RCONMessage<UpdateUser.JSON>
if (!json.look.isEmpty())
{
habbo.getHabboInfo().setLook(json.look);
habbo.getHabboInfo().getCurrentRoom().sendComposer(new UpdateUserLookComposer(habbo).compose());
if (habbo.getHabboInfo().getCurrentRoom() != null)
{
habbo.getHabboInfo().getCurrentRoom().sendComposer(new UpdateUserLookComposer(habbo).compose());
habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(habbo).compose());
}
}

View File

@ -2,6 +2,7 @@ package com.eu.habbo.plugin;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.Easter;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.BotManager;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.catalog.TargetOffer;
@ -352,6 +353,7 @@ public class PluginManager
WiredHandler.MAXIMUM_FURNI_SELECTION = Emulator.getConfig().getInt("hotel.wired.furni.selection.count");
WiredHandler.TELEPORT_DELAY = Emulator.getConfig().getInt("wired.effect.teleport.delay", 500);
NavigatorManager.MAXIMUM_RESULTS_PER_PAGE = Emulator.getConfig().getInt("hotel.navigator.search.maxresults");
NavigatorManager.CATEGORY_SORT_USING_ORDER_NUM = Emulator.getConfig().getBoolean("hotel.navigator.sort.ordernum");
RoomChatMessage.MAXIMUM_LENGTH = Emulator.getConfig().getInt("hotel.chat.max.length");
String[] bannedBubbles = Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";");
@ -380,6 +382,7 @@ public class PluginManager
TargetOffer.ACTIVE_TARGET_OFFER_ID = Emulator.getConfig().getInt("hotel.targetoffer.id");
WordFilter.DEFAULT_REPLACEMENT = Emulator.getConfig().getValue("hotel.wordfilter.replacement");
CatalogManager.PURCHASE_COOLDOWN = Emulator.getConfig().getInt("hotel.catalog.purchase.cooldown");
CatalogManager.SORT_USING_ORDERNUM = Emulator.getConfig().getBoolean("hotel.catalog.items.display.ordernum");
AchievementManager.TALENTTRACK_ENABLED = Emulator.getConfig().getBoolean("hotel.talenttrack.enabled");
}
}

View File

@ -0,0 +1,13 @@
package com.eu.habbo.plugin.events.emulator;
import com.eu.habbo.plugin.Event;
public class SSOAuthenticationEvent extends Event
{
public final String sso;
public SSOAuthenticationEvent(String sso)
{
this.sso = sso;
}
}

View File

@ -8,7 +8,8 @@ public class UserExitRoomEvent extends UserEvent
{
DOOR(false),
KICKED_HABBO(false),
KICKED_IDLE(true);
KICKED_IDLE(true),
TELEPORT(false);
public final boolean cancellable;

View File

@ -0,0 +1,15 @@
package com.eu.habbo.plugin.events.users;
import com.eu.habbo.habbohotel.users.Habbo;
public class UserNameChangedEvent extends UserEvent
{
private final String oldName;
public UserNameChangedEvent(Habbo habbo, String oldName)
{
super(habbo);
this.oldName = oldName;
}
}

View File

@ -0,0 +1,12 @@
package com.eu.habbo.plugin.events.users;
import com.eu.habbo.habbohotel.users.Habbo;
public class UserRankChangedEvent extends UserEvent
{
public UserRankChangedEvent(Habbo habbo)
{
super(habbo);
}
}

View File

@ -25,15 +25,18 @@ public class ChannelReadHandler implements Runnable
int length = m.readInt();
short header = m.readShort();
GameClient client = ctx.attr(GameClientManager.CLIENT).get();
int count = 0;
if (client != null)
{
if (Emulator.getIntUnixTimestamp() - client.lastPacketCounterCleared > 1)
{
client.incomingPacketCounter.clear();
}
else
} else
{
count = client.incomingPacketCounter.getOrDefault(header, 0);
}
}
if (count <= 10)
{
client.incomingPacketCounter.put((int) header, count++);

View File

@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import com.eu.habbo.messages.outgoing.rooms.items.PresentItemOpenedComposer;
import gnu.trove.set.hash.THashSet;
public class OpenGift implements Runnable
{
@ -30,7 +31,8 @@ public class OpenGift implements Runnable
{
HabboItem inside = null;
for (HabboItem i : ((InteractionGift) item).items)
THashSet<HabboItem> items = ((InteractionGift) item).loadItems();
for (HabboItem i : items)
{
if(inside == null)
inside = i;
@ -40,14 +42,14 @@ public class OpenGift implements Runnable
i.run();
}
this.habbo.getInventory().getItemsComponent().addItems(((InteractionGift) this.item).items);
this.habbo.getInventory().getItemsComponent().addItems(items);
RoomTile tile = this.room.getLayout().getTile(this.item.getX(), this.item.getY());
if (tile != null)
{
this.room.updateTile(tile);
}
this.habbo.getClient().sendResponse(new AddHabboItemComposer(((InteractionGift) this.item).items));
this.habbo.getClient().sendResponse(new AddHabboItemComposer(items));
this.habbo.getClient().sendResponse(new InventoryRefreshComposer());

View File

@ -39,11 +39,11 @@ public class PetEatAction implements Runnable
{
if (this.pet.getPetData().getType() == 26)
{
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.pet.getUserId()), Emulator.getGameEnvironment().getAchievementManager().getAchievement("GnomeFeedingFeeding"), 20);
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.pet.getUserId()), Emulator.getGameEnvironment().getAchievementManager().getAchievement("GnomeFeeding"), 20);
}
else
{
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.pet.getUserId()), Emulator.getGameEnvironment().getAchievementManager().getAchievement("LeprechaunFeedingFeeding"), 20);
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.pet.getUserId()), Emulator.getGameEnvironment().getAchievementManager().getAchievement("LeprechaunFeeding"), 20);
}
}
else

View File

@ -36,7 +36,7 @@ class HopperActionThree implements Runnable
if(this.teleportOne.getRoomId() != targetRoomId)
{
Emulator.getGameEnvironment().getRoomManager().leaveRoom(this.client.getHabbo(), this.room);
Emulator.getGameEnvironment().getRoomManager().leaveRoom(this.client.getHabbo(), this.room, false);
targetRoom = Emulator.getGameEnvironment().getRoomManager().loadRoom(this.targetRoomId);
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), targetRoom.getId(), "", false);
}

View File

@ -42,6 +42,6 @@ class TeleportActionFive implements Runnable
this.currentTeleport.setExtradata("1");
room.updateItem(this.currentTeleport);
Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, room, "0"), 1500);
Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, room, "0"), 1000);
}
}

View File

@ -30,8 +30,8 @@ class TeleportActionFour implements Runnable
return;
}
this.currentTeleport.setExtradata("0");
this.room.updateItem(this.currentTeleport);
Emulator.getThreading().run(new TeleportActionFive(this.currentTeleport, this.room, this.client), 500);
}

View File

@ -28,7 +28,7 @@ public class TeleportActionOne implements Runnable
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != this.room)
return;
int delay = 1000;
int delay = 500;
if (this.currentTeleport instanceof InteractionTeleportTile)
{

View File

@ -48,6 +48,7 @@ class TeleportActionThree implements Runnable
this.client.getHabbo().getRoomUnit().setLocation(targetRoom.getLayout().getTile(targetTeleport.getX(), targetTeleport.getY()));
this.client.getHabbo().getRoomUnit().setZ(targetTeleport.getZ());
this.client.getHabbo().getRoomUnit().setPreviousLocationZ(targetTeleport.getZ());
this.client.getHabbo().getRoomUnit().setRotation(RoomUserRotation.values()[targetTeleport.getRotation() % 8]);
this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
@ -63,7 +64,7 @@ class TeleportActionThree implements Runnable
this.client.getHabbo().getHabboInfo().setCurrentRoom(targetRoom);
//Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 500);
Emulator.getThreading().run(new TeleportActionFour(targetTeleport, targetRoom, this.client), this.currentTeleport instanceof InteractionTeleportTile ? 500 : 1000);
Emulator.getThreading().run(new TeleportActionFour(targetTeleport, targetRoom, this.client), this.currentTeleport instanceof InteractionTeleportTile ? 0 : 500);
}
}

View File

@ -95,6 +95,9 @@ class TeleportActionTwo implements Runnable
}
}
this.currentTeleport.setExtradata("1");
this.room.updateItem(this.currentTeleport);
if(((InteractionTeleport) this.currentTeleport).getTargetRoomId() == 0)
{
//Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, room, "1"), 0);
@ -102,11 +105,8 @@ class TeleportActionTwo implements Runnable
return;
}
this.currentTeleport.setExtradata("0");
this.room.updateItem(this.currentTeleport);
Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, room, "2"), delayOffset);
Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, room, "0"), delayOffset + 1000);
Emulator.getThreading().run(new TeleportActionThree(this.currentTeleport, this.room, this.client), delayOffset + 500);
Emulator.getThreading().run(new TeleportActionThree(this.currentTeleport, this.room, this.client), delayOffset + 0);
}
}