updated to 1.13 decompiled.

This commit is contained in:
capheus 2018-10-06 22:28:00 +00:00
parent 2fb1143952
commit cbd721c198
163 changed files with 4366 additions and 2657 deletions

7
.gitignore vendored
View File

@ -1,3 +1,4 @@
logging/
*.iml *.iml
.idea/ .idea/
target/** target/**
@ -6,9 +7,9 @@ packet.pkt
plugins/** plugins/**
src/main/resources/ src/main/resources/
src/test/ src/test/
logging/
target/ target/
config.ini config.ini
*.txt *.txt
logging/** *.jar
logging/ *.log
*.zip

View File

@ -5,7 +5,7 @@
## **To Get The Camera To Work Visit http://arcturus.wf and register.** ## ## **To Get The Camera To Work Visit http://arcturus.wf and register.** ##
## **TUTORIAL FOR PLUGINS http://arcturus.wf/thread-2415.html** ## ## **TUTORIAL FOR PLUGINS http://arcturus.wf/thread-2415.html** ##
# **DO NOT EDIT THE SOURCE. USE THE PLUGIN API.** # # **DO NOT EDIT THE SOURCE. USE THE PLUGIN API.** #
## Current Stable Version: 1.12.0 ## ## Current Stable Version: 1.13.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. 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 Targeting PRODUCTION-201611291003-338511768

View File

@ -6,7 +6,7 @@
<groupId>com.eu.habbo</groupId> <groupId>com.eu.habbo</groupId>
<artifactId>Habbo</artifactId> <artifactId>Habbo</artifactId>
<version>1.12.0</version> <version>1.13.0</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -0,0 +1,78 @@
#DATABASE UPDATE: 1.12.0 -> 1.13.0
#IF YOU ARE NOT USING HTTPS RUN:
#UPDATE emulator_settings SET `value` = '0' WHERE `key` LIKE 'camera.use.https';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES
('hotel.view.ltdcountdown.enabled', '1'),
('hotel.view.ltdcountdown.timestamp', '1519496132'),
('hotel.view.ltdcountdown.itemid', '10388'),
('hotel.view.ltdcountdown.pageid', '13'),
('hotel.view.ltdcountdown.itename', 'trophy_netsafety_0');
CREATE TABLE `users_ignored` (
`user_id` int(11) NOT NULL,
`target_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `users_ignored`
ADD KEY `user_id` (`user_id`,`target_id`);
COMMIT;
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('io.client.multithreaded.handler', '1');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.room.stickypole.prefix', '%timestamp%, %username%:\\r');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('support.ticket.picked.failed', 'Picking issue failedd: <br>Ticket already picked or does not exist!');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('camera.error.creation', 'Failed to create your picture. *sadpanda*');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('scripter.warning.sticky.size', '%username% tried to create a sticky with %amount% characters where %limit% characters are allowed!');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.trading.requires.perk', '1');
ALTER TABLE `users_settings` ADD `perk_trade` ENUM('0','1') NOT NULL DEFAULT '0' COMMENT 'Defines if a player has obtained the perk TRADE. When hotel.trading.requires.perk is set to 1, this perk is required in order to trade. Perk is obtained from the talen track.' AFTER `allow_name_change`;
UPDATE users_settings SET perk_trade = '1' WHERE talent_track_citizenship_level >= (SELECT `level` FROM achievements_talents WHERE reward_perks LIKE '%TRADE%' ORDER BY level ASC LIMIT 1);
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.targetoffer.id', '1');
CREATE TABLE `catalog_target_offers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`offer_code` varchar(32) NOT NULL,
`title` varchar(128) NOT NULL DEFAULT '',
`description` varchar(2048) NOT NULL DEFAULT '',
`image` varchar(128) NOT NULL,
`icon` varchar(128) NOT NULL,
`end_timestamp` int(11) NOT NULL,
`credits` int(5) NOT NULL DEFAULT '10',
`points` int(5) NOT NULL DEFAULT '10',
`points_type` int(3) NOT NULL DEFAULT '5',
`purchase_limit` int(2) NOT NULL DEFAULT '5',
`catalog_item` int(11) NOT NULL,
`vars` varchar(1024) NOT NULL DEFAULT '' COMMENT 'List of strings seperated by a ;',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
CREATE TABLE `users_target_offer_purchases` (
`user_id` int(11) NOT NULL,
`offer_id` int(11) NOT NULL,
`state` int(11) NOT NULL DEFAULT '0',
`amount` int(11) NOT NULL DEFAULT '0',
`last_purchase` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `use_id` (`user_id`,`offer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `permissions` ADD `cmd_promote_offer` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `cmd_points`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_promote_offer', 'promoteoffer;promotetargetoffer;promote_offer'), ('commands.description.cmd_promote_offer', ':promoteoffer <offer_id> [info]');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.cmd_promote_offer.info', 'info'), ('commands.error.cmd_promote_offer.not_found', 'The offer could not be found. Use :promoteoffer info to see a list of active offers.');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.cmd_promote_offer.list', 'All available offers (%amount%):<br>%list%');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.cmd_promote_offer.list.entry', '%id%: %title% %description%');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_promote_offer', 'The promoted offer has been changed to %id%: %title%');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.wordfilter.replacement', 'bobba');
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_filterword', 'filter;banword;filterword'),
('commands.error.cmd_filterword.missing_word', 'Please specify the word to filter, with an optional replacement.'),
('commands.error.cmd_filterword.error', 'Failed to add the word to the wordfilter. Possible duplicate?'),
('commands.succes.cmd_filterword.added', 'Wordfilter word %word% has been added with replacement %replacement%!'),
('commands.description.cmd_filterword', ':filter <word> [replacement]');
ALTER TABLE `permissions` ADD `cmd_filterword` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `cmd_fastwalk`;
INSERT IGNORE INTO `emulator_settings` (`key`, `value`) VALUES ('debug.show.headers', '');
UPDATE `navigator_filter` SET `database_query` = 'SELECT * FROM rooms WHERE tags LIKE CONCAT(?, \";%\") ' WHERE `navigator_filter`.`key` = 'tag';
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.catalog.purchase.cooldown', '3');
#DATABASE UPDATE: 1.12.0 -> 1.13.0

View File

@ -33,7 +33,7 @@ public final class Emulator
public final static int MAJOR = 1; public final static int MAJOR = 1;
public final static int MINOR = 12; public final static int MINOR = 13;
public final static int BUILD = 0; public final static int BUILD = 0;
@ -121,9 +121,9 @@ public final class Emulator
Emulator.rconServer = new RCONServer(getConfig().getValue("rcon.host", "127.0.0.1"), getConfig().getInt("rcon.port", 30001)); Emulator.rconServer = new RCONServer(getConfig().getValue("rcon.host", "127.0.0.1"), getConfig().getInt("rcon.port", 30001));
Emulator.gameEnvironment = new GameEnvironment(); Emulator.gameEnvironment = new GameEnvironment();
Emulator.gameEnvironment.load(); Emulator.gameEnvironment.load();
Emulator.gameServer.initialise(); Emulator.gameServer.initializePipeline();
Emulator.gameServer.connect(); Emulator.gameServer.connect();
Emulator.rconServer.initialise(); Emulator.rconServer.initializePipeline();
Emulator.rconServer.connect(); Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager(); Emulator.badgeImager = new BadgeImager();
if (Emulator.getConfig().getBoolean("camera.enabled")) if (Emulator.getConfig().getBoolean("camera.enabled"))
@ -154,7 +154,7 @@ public final class Emulator
if (Emulator.getConfig().getValue("username").isEmpty()) if (Emulator.getConfig().getValue("username").isEmpty())
{ {
Emulator.getLogging().logErrorLine("No account has been found in config.ini Please create an account on Arcturus.pw and edit the config.ini in order to maximize usage of Arcturus! http://arcturus.wf"); Emulator.getLogging().logErrorLine("No account has been found in config.ini Please create an account on Arcturus.pw and edit the config.ini in order to maximize usage of Arcturus! http://arcturus.pw");
} }
Emulator.getThreading().run(new Runnable() Emulator.getThreading().run(new Runnable()

View File

@ -12,6 +12,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.Map;
public class CleanerThread implements Runnable { public class CleanerThread implements Runnable {
@ -37,6 +38,9 @@ public class CleanerThread implements Runnable {
public static final int SAVE_ERROR_LOGS = 30; public static final int SAVE_ERROR_LOGS = 30;
public static final int CLEAR_CACHED_VALUES = 60 * 60;
private static final int CALLBACK_TIME = 60*15; private static final int CALLBACK_TIME = 60*15;
@ -63,6 +67,9 @@ public class CleanerThread implements Runnable {
private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp(); private static int LAST_CALLBACK = Emulator.getIntUnixTimestamp();
private static int LAST_HABBO_CACHE_CLEARED = Emulator.getIntUnixTimestamp();
public CleanerThread() public CleanerThread()
{ {
databaseCleanup(); databaseCleanup();
@ -129,6 +136,12 @@ public class CleanerThread implements Runnable {
LAST_DAILY_REFILL = time; LAST_DAILY_REFILL = time;
} }
if (time - LAST_HABBO_CACHE_CLEARED > CLEAR_CACHED_VALUES)
{
clearCachedValues();
LAST_HABBO_CACHE_CLEARED = time;
}
SearchRoomsEvent.cachedResults.clear(); SearchRoomsEvent.cachedResults.clear();
SearchUserEvent.cachedResults.clear(); SearchUserEvent.cachedResults.clear();
} }
@ -190,4 +203,25 @@ public class CleanerThread implements Runnable {
} }
} }
} }
private void clearCachedValues()
{
Habbo habbo = null;
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
{
habbo = map.getValue();
try
{
if (habbo != null)
{
habbo.clearCaches();
}
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
}
}
} }

View File

@ -1,8 +1,10 @@
package com.eu.habbo.core; package com.eu.habbo.core;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.util.callback.HTTPPostError; import com.eu.habbo.util.callback.HTTPPostError;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import io.netty.util.internal.ConcurrentSet;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@ -66,6 +68,8 @@ public class Logging
private final THashSet<Loggable> commandLogs = new THashSet<>(); private final THashSet<Loggable> commandLogs = new THashSet<>();
private ConcurrentSet<Loggable> chatLogs = new ConcurrentSet<>();
public Logging() public Logging()
{ {
packets = new File("logging//packets//defined.txt"); packets = new File("logging//packets//defined.txt");
@ -332,11 +336,16 @@ public class Logging
} }
} }
public void addChatLog(Loggable chatLog)
{
this.chatLogs.add(chatLog);
}
public void saveLogs() public void saveLogs()
{ {
if (Emulator.getDatabase() != null && Emulator.getDatabase().getDataSource() != null) if (Emulator.getDatabase() != null && Emulator.getDatabase().getDataSource() != null)
{ {
if (!this.errorLogs.isEmpty() || !this.commandLogs.isEmpty()) if (!this.errorLogs.isEmpty() || !this.commandLogs.isEmpty() || !this.chatLogs.isEmpty())
{ {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{ {
@ -372,6 +381,23 @@ public class Logging
this.commandLogs.clear(); this.commandLogs.clear();
} }
} }
if (!this.chatLogs.isEmpty())
{
ConcurrentSet<Loggable> chatLogs = this.chatLogs;
this.chatLogs = new ConcurrentSet<>();
try (PreparedStatement statement = connection.prepareStatement(RoomChatMessage.insertQuery))
{
for (Loggable log : chatLogs)
{
log.log(statement);
}
statement.executeBatch();
}
chatLogs.clear();
}
} }
catch (SQLException e) catch (SQLException e)
{ {

View File

@ -30,8 +30,8 @@ public class RoomUserPetComposer extends MessageComposer
this.response.appendString(""); this.response.appendString("");
this.response.appendString(this.petType + " " + this.race + " " + this.color + " 2 2 -1 0 3 -1 0"); this.response.appendString(this.petType + " " + this.race + " " + this.color + " 2 2 -1 0 3 -1 0");
this.response.appendInt(habbo.getRoomUnit().getId()); this.response.appendInt(habbo.getRoomUnit().getId());
this.response.appendInt32(habbo.getRoomUnit().getX()); this.response.appendInt(habbo.getRoomUnit().getX());
this.response.appendInt32(habbo.getRoomUnit().getY()); this.response.appendInt(habbo.getRoomUnit().getY());
this.response.appendString(habbo.getRoomUnit().getZ() + ""); this.response.appendString(habbo.getRoomUnit().getZ() + "");
this.response.appendInt(habbo.getRoomUnit().getBodyRotation().getValue()); this.response.appendInt(habbo.getRoomUnit().getBodyRotation().getValue());
this.response.appendInt(2); this.response.appendInt(2);

View File

@ -9,6 +9,7 @@ import com.eu.habbo.messages.outgoing.achievements.AchievementProgressComposer;
import com.eu.habbo.messages.outgoing.achievements.AchievementUnlockedComposer; import com.eu.habbo.messages.outgoing.achievements.AchievementUnlockedComposer;
import com.eu.habbo.messages.outgoing.achievements.talenttrack.TalentLevelUpdateComposer; import com.eu.habbo.messages.outgoing.achievements.talenttrack.TalentLevelUpdateComposer;
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer; import com.eu.habbo.messages.outgoing.users.AddUserBadgeComposer;
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer; import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
@ -218,6 +219,21 @@ public class AchievementManager
AchievementLevel newLevel = achievement.getLevelForProgress(currentProgress + amount); AchievementLevel newLevel = achievement.getLevelForProgress(currentProgress + amount);
for (TalentTrackType type : TalentTrackType.values())
{
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type))
{
for (Map.Entry<Integer, TalentTrackLevel> entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet())
{
if (entry.getValue().achievements.containsKey(achievement))
{
Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type, achievement);
break;
}
}
}
}
if(newLevel == null || (oldLevel.level == newLevel.level && newLevel.level < achievement.levels.size())) if(newLevel == null || (oldLevel.level == newLevel.level && newLevel.level < achievement.levels.size()))
{ {
habbo.getClient().sendResponse(new AchievementProgressComposer(habbo, achievement)); habbo.getClient().sendResponse(new AchievementProgressComposer(habbo, achievement));
@ -279,20 +295,6 @@ public class AchievementManager
{ {
habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(habbo).compose()); habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(habbo).compose());
} }
for (TalentTrackType type : TalentTrackType.values())
{
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type))
{
for (Map.Entry<Integer, TalentTrackLevel> entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet())
{
if (entry.getValue().achievements.containsKey(achievement))
{
Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type, achievement);
}
}
}
}
} }
} }
@ -403,39 +405,49 @@ public class AchievementManager
{ {
TalentTrackLevel currentLevel = this.calculateTalenTrackLevel(habbo, type); TalentTrackLevel currentLevel = this.calculateTalenTrackLevel(habbo, type);
if (currentLevel.level > habbo.getHabboStats().talentTrackLevel(type)) if (currentLevel != null)
{ {
for (int i = habbo.getHabboStats().talentTrackLevel(type); i <= currentLevel.level; i++) if (currentLevel.level > habbo.getHabboStats().talentTrackLevel(type))
{ {
TalentTrackLevel level = this.getTalentTrackLevel(type, i); for (int i = habbo.getHabboStats().talentTrackLevel(type); i <= currentLevel.level; i++)
if (level != null)
{ {
for (Item item : level.items) TalentTrackLevel level = this.getTalentTrackLevel(type, i);
{
HabboItem rewardItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getHabboInfo().getId(), item, 0, 0, "");
habbo.getInventory().getItemsComponent().addItem(rewardItem);
habbo.getClient().sendResponse(new AddHabboItemComposer(rewardItem));
}
for (String badge : level.badges) if (level != null)
{ {
if (!badge.isEmpty()) for (Item item : level.items)
{ {
HabboBadge b = new HabboBadge(0, badge, 0, habbo); HabboItem rewardItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getHabboInfo().getId(), item, 0, 0, "");
Emulator.getThreading().run(b); habbo.getInventory().getItemsComponent().addItem(rewardItem);
habbo.getInventory().getBadgesComponent().addBadge(b); habbo.getClient().sendResponse(new AddHabboItemComposer(rewardItem));
habbo.getClient().sendResponse(new AddUserBadgeComposer(b)); habbo.getClient().sendResponse(new InventoryRefreshComposer());
} }
}
habbo.getClient().sendResponse(new TalentLevelUpdateComposer(type, level)); for (String badge : level.badges)
{
if (!badge.isEmpty())
{
HabboBadge b = new HabboBadge(0, badge, 0, habbo);
Emulator.getThreading().run(b);
habbo.getInventory().getBadgesComponent().addBadge(b);
habbo.getClient().sendResponse(new AddUserBadgeComposer(b));
}
}
for (String perk : level.perks)
{
if (perk.equalsIgnoreCase("TRADE"))
{
habbo.getHabboStats().perkTrade = true;
}
}
habbo.getClient().sendResponse(new TalentLevelUpdateComposer(type, level));
}
} }
} }
habbo.getHabboStats().setTalentLevel(type, currentLevel.level);
} }
habbo.getHabboStats().setTalentLevel(type, currentLevel.level);
} }
public TalentTrackLevel getTalentTrackLevel(TalentTrackType type, int level) public TalentTrackLevel getTalentTrackLevel(TalentTrackType type, int level)

View File

@ -74,6 +74,8 @@ public class Bot implements Runnable
private int effect; private int effect;
private boolean canWalk = true;
private boolean needsUpdate; private boolean needsUpdate;
@ -112,6 +114,7 @@ public class Bot implements Runnable
this.chatLines = new ArrayList<>(Arrays.asList(set.getString("chat_lines").split("\r"))); this.chatLines = new ArrayList<>(Arrays.asList(set.getString("chat_lines").split("\r")));
this.type = set.getString("type"); this.type = set.getString("type");
this.effect = set.getInt("effect"); this.effect = set.getInt("effect");
this.canWalk = set.getString("freeroam").equals("1");
this.room = null; this.room = null;
this.roomUnit = null; this.roomUnit = null;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay; this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
@ -171,7 +174,7 @@ public class Bot implements Runnable
statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ()); statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ());
statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue()); statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue());
statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType()); statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType());
statement.setString(12, this.roomUnit == null ? "0" : this.roomUnit.canWalk() ? "1" : "0"); statement.setString(12, this.canWalk ? "1" : "0");
String text = ""; String text = "";
for(String s : this.chatLines) for(String s : this.chatLines)
{ {
@ -193,11 +196,11 @@ public class Bot implements Runnable
} }
public void cycle(boolean canWalk) public void cycle(boolean allowBotsWalk)
{ {
if(this.roomUnit != null) if(this.roomUnit != null)
{ {
if(canWalk && this.getRoomUnit().canWalk()) if(allowBotsWalk && this.canWalk)
{ {
if (!this.roomUnit.isWalking()) if (!this.roomUnit.isWalking())
{ {
@ -567,4 +570,14 @@ public class Bot implements Runnable
{ {
} }
public boolean canWalk()
{
return this.canWalk;
}
public void setCanWalk(boolean canWalk)
{
this.canWalk = canWalk;
}
} }

View File

@ -407,7 +407,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
} }
} }
message.appendInt32(this.clubOnly); message.appendInt(this.clubOnly);
message.appendBoolean(haveOffer(this)); message.appendBoolean(haveOffer(this));
message.appendBoolean(false); //unknown message.appendBoolean(false); //unknown
message.appendString(this.name + ".png"); message.appendString(this.name + ".png");

View File

@ -65,6 +65,9 @@ public class CatalogManager
public final THashMap<Integer, ClubOffer> clubOffers; public final THashMap<Integer, ClubOffer> clubOffers;
public final THashMap<Integer, TargetOffer> targetOffers;
public final THashMap<Integer, ClothItem> clothing; public final THashMap<Integer, ClothItem> clothing;
@ -82,6 +85,9 @@ public class CatalogManager
public static int catalogItemAmount; public static int catalogItemAmount;
public static int PURCHASE_COOLDOWN = 3;
public final THashMap<Integer, CalendarRewardObject> calendarRewards; public final THashMap<Integer, CalendarRewardObject> calendarRewards;
@ -145,6 +151,7 @@ public class CatalogManager
this.giftFurnis = new THashMap<>(); this.giftFurnis = new THashMap<>();
this.clubItems = new THashSet<>(); this.clubItems = new THashSet<>();
this.clubOffers = new THashMap<>(); this.clubOffers = new THashMap<>();
targetOffers = new THashMap<>();
this.clothing = new THashMap<>(); this.clothing = new THashMap<>();
this.offerDefs = new TIntIntHashMap(); this.offerDefs = new TIntIntHashMap();
this.vouchers = new ArrayList<>(); this.vouchers = new ArrayList<>();
@ -170,6 +177,7 @@ public class CatalogManager
loadCatalogFeaturedPages(); loadCatalogFeaturedPages();
loadCatalogItems(); loadCatalogItems();
loadClubOffers(); loadClubOffers();
loadTargetOffers();
loadVouchers(); loadVouchers();
loadClothing(); loadClothing();
loadRecycler(); loadRecycler();
@ -403,6 +411,26 @@ public class CatalogManager
} }
} }
private void loadTargetOffers() throws SQLException
{
synchronized (this.targetOffers)
{
this.targetOffers.clear();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM catalog_target_offers WHERE end_timestamp > ?"))
{
statement.setInt(1, Emulator.getIntUnixTimestamp());
try (ResultSet set = statement.executeQuery())
{
while (set.next())
{
this.targetOffers.put(set.getInt("id"), new TargetOffer(set));
}
}
}
}
}
private void loadVouchers() throws SQLException private void loadVouchers() throws SQLException
{ {
@ -910,135 +938,138 @@ public class CatalogManager
{ {
Item cBaseItem = null; Item cBaseItem = null;
if(item == null) if(item == null || habbo.getHabboStats().isPurchasingFurniture)
{ {
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return; return;
} }
if(item.isClubOnly() && !habbo.getClient().getHabbo().getHabboStats().hasActiveClub()) habbo.getHabboStats().isPurchasingFurniture = true;
{
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.REQUIRES_CLUB));
return;
}
if (amount <= 0)
{
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
try try
{ {
CatalogLimitedConfiguration limitedConfiguration = null; if (item.isClubOnly() && !habbo.getClient().getHabbo().getHabboStats().hasActiveClub())
int limitedStack = 0;
int limitedNumber = 0;
if (item.isLimited())
{ {
amount = 1; habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.REQUIRES_CLUB));
if (this.getLimitedConfig(item).available() == 0) return;
{
habbo.getClient().sendResponse(new AlertLimitedSoldOutComposer());
return;
}
if (Emulator.getConfig().getBoolean("hotel.catalog.ltd.limit.enabled"))
{
int ltdLimit = Emulator.getConfig().getInt("hotel.purchase.ltd.limit.daily.total");
if (habbo.getHabboStats().totalLtds() >= ltdLimit)
{
habbo.alert(Emulator.getTexts().getValue("error.catalog.buy.limited.daily.total").replace("%itemname%", item.getBaseItems().iterator().next().getFullName()).replace("%limit%", ltdLimit + ""));
return;
}
ltdLimit = Emulator.getConfig().getInt("hotel.purchase.ltd.limit.daily.item");
if (habbo.getHabboStats().totalLtds(item.id) >= ltdLimit)
{
habbo.alert(Emulator.getTexts().getValue("error.catalog.buy.limited.daily.item").replace("%itemname%", item.getBaseItems().iterator().next().getFullName()).replace("%limit%", ltdLimit + ""));
return;
}
}
} }
if(amount > 1) if (amount <= 0)
{ {
if(amount == item.getAmount())
{
amount = 1;
}
else
{
if(amount * item.getAmount() > 100)
{
habbo.getClient().sendResponse(new GenericAlertComposer("Whoops! You tried to buy this " + (amount * item.getAmount()) + " times. This must've been a mistake."));
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
}
}
int totalCredits = 0;
int totalPoints = 0;
THashSet<HabboItem> itemsList = new THashSet<>();
if(amount > 1 && !CatalogItem.haveOffer(item))
{
String message = Emulator.getTexts().getValue("scripter.warning.catalog.amount").replace("%username%", habbo.getHabboInfo().getUsername()).replace("%itemname%", item.getName()).replace("%pagename%", page.getCaption());
Emulator.getGameEnvironment().getModToolManager().quickTicket(habbo.getClient().getHabbo(), "Scripter", message);
Emulator.getLogging().logUserLine(message);
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL)); habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return; return;
} }
if (item.isLimited()) try
{ {
limitedConfiguration = this.getLimitedConfig(item); CatalogLimitedConfiguration limitedConfiguration = null;
int limitedStack = 0;
if (limitedConfiguration == null) int limitedNumber = 0;
if (item.isLimited())
{ {
limitedConfiguration = this.createOrUpdateLimitedConfig(item); amount = 1;
} if (this.getLimitedConfig(item).available() == 0)
limitedNumber = limitedConfiguration.getNumber();
limitedStack = limitedConfiguration.getTotalSet();
}
List<String> badges = new ArrayList<>();
boolean badgeFound = false;
for(int i = 0; i < amount; i++)
{
if (free || (item.getCredits() <= habbo.getClient().getHabbo().getHabboInfo().getCredits() - totalCredits))
{
if(free ||
item.getPoints() <= habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) - totalPoints)
{ {
if (((i + 1) % 6 != 0 && CatalogItem.haveOffer(item)) || !CatalogItem.haveOffer(item)) habbo.getClient().sendResponse(new AlertLimitedSoldOutComposer());
return;
}
if (Emulator.getConfig().getBoolean("hotel.catalog.ltd.limit.enabled"))
{
int ltdLimit = Emulator.getConfig().getInt("hotel.purchase.ltd.limit.daily.total");
if (habbo.getHabboStats().totalLtds() >= ltdLimit)
{ {
totalCredits += item.getCredits(); habbo.alert(Emulator.getTexts().getValue("error.catalog.buy.limited.daily.total").replace("%itemname%", item.getBaseItems().iterator().next().getFullName()).replace("%limit%", ltdLimit + ""));
totalPoints += item.getPoints(); return;
} }
habbo.getHabboStats().addLtdLog(item.getId(), Emulator.getIntUnixTimestamp()); ltdLimit = Emulator.getConfig().getInt("hotel.purchase.ltd.limit.daily.item");
if (habbo.getHabboStats().totalLtds(item.id) >= ltdLimit)
{
habbo.alert(Emulator.getTexts().getValue("error.catalog.buy.limited.daily.item").replace("%itemname%", item.getBaseItems().iterator().next().getFullName()).replace("%limit%", ltdLimit + ""));
return;
}
}
}
//for (int j = 0; j < item.getAmount(); j++) if (amount > 1)
//{ {
if (amount == item.getAmount())
{
amount = 1;
} else
{
if (amount * item.getAmount() > 100)
{
habbo.getClient().sendResponse(new GenericAlertComposer("Whoops! You tried to buy this " + (amount * item.getAmount()) + " times. This must've been a mistake."));
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
}
}
int totalCredits = 0;
int totalPoints = 0;
THashSet<HabboItem> itemsList = new THashSet<>();
if (amount > 1 && !CatalogItem.haveOffer(item))
{
String message = Emulator.getTexts().getValue("scripter.warning.catalog.amount").replace("%username%", habbo.getHabboInfo().getUsername()).replace("%itemname%", item.getName()).replace("%pagename%", page.getCaption());
Emulator.getGameEnvironment().getModToolManager().quickTicket(habbo.getClient().getHabbo(), "Scripter", message);
Emulator.getLogging().logUserLine(message);
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
if (item.isLimited())
{
limitedConfiguration = this.getLimitedConfig(item);
if (limitedConfiguration == null)
{
limitedConfiguration = this.createOrUpdateLimitedConfig(item);
}
limitedNumber = limitedConfiguration.getNumber();
limitedStack = limitedConfiguration.getTotalSet();
}
List<String> badges = new ArrayList<>();
boolean badgeFound = false;
for (int i = 0; i < amount; i++)
{
if (free || (item.getCredits() <= habbo.getClient().getHabbo().getHabboInfo().getCredits() - totalCredits))
{
if (free ||
item.getPoints() <= habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) - totalPoints)
{
if (((i + 1) % 6 != 0 && CatalogItem.haveOffer(item)) || !CatalogItem.haveOffer(item))
{
totalCredits += item.getCredits();
totalPoints += item.getPoints();
}
habbo.getHabboStats().addLtdLog(item.getId(), Emulator.getIntUnixTimestamp());
//for (int j = 0; j < item.getAmount(); j++)
//{
for (Item baseItem : item.getBaseItems()) for (Item baseItem : item.getBaseItems())
{ {
for(int k = 0; k < item.getItemAmount(baseItem.getId()); k++) for (int k = 0; k < item.getItemAmount(baseItem.getId()); k++)
{ {
cBaseItem = baseItem; cBaseItem = baseItem;
if(baseItem.getName().startsWith("rentable_bot_") || baseItem.getName().startsWith("bot_")) if (baseItem.getName().startsWith("rentable_bot_") || baseItem.getName().startsWith("bot_"))
{ {
String type = item.getName().replace("rentable_bot_", ""); String type = item.getName().replace("rentable_bot_", "");
type = type.replace("bot_", ""); type = type.replace("bot_", "");
THashMap<String, String> data = new THashMap<>(); THashMap<String, String> data = new THashMap<>();
for(String s : item.getExtradata().split(";")) for (String s : item.getExtradata().split(";"))
{ {
if(s.contains(":")) if (s.contains(":"))
{ {
data.put(s.split(":")[0], s.split(":")[1]); data.put(s.split(":")[0], s.split(":")[1]);
} }
@ -1046,7 +1077,7 @@ public class CatalogManager
Bot bot = Emulator.getGameEnvironment().getBotManager().createBot(data, type); Bot bot = Emulator.getGameEnvironment().getBotManager().createBot(data, type);
if(bot != null) if (bot != null)
{ {
bot.setOwnerId(habbo.getClient().getHabbo().getHabboInfo().getId()); bot.setOwnerId(habbo.getClient().getHabbo().getHabboInfo().getId());
bot.setOwnerName(habbo.getClient().getHabbo().getHabboInfo().getUsername()); bot.setOwnerName(habbo.getClient().getHabbo().getHabboInfo().getUsername());
@ -1054,13 +1085,11 @@ public class CatalogManager
Emulator.getThreading().run(bot); Emulator.getThreading().run(bot);
habbo.getClient().getHabbo().getInventory().getBotsComponent().addBot(bot); habbo.getClient().getHabbo().getInventory().getBotsComponent().addBot(bot);
habbo.getClient().sendResponse(new AddBotComposer(bot)); habbo.getClient().sendResponse(new AddBotComposer(bot));
} } else
else
{ {
throw new Exception("Failed to create bot of type: " + type); throw new Exception("Failed to create bot of type: " + type);
} }
} } else if (baseItem.getType() == FurnitureType.EFFECT)
else if (baseItem.getType() == FurnitureType.EFFECT)
{ {
int effectId = baseItem.getEffectM(); int effectId = baseItem.getEffectM();
@ -1073,8 +1102,7 @@ public class CatalogManager
{ {
habbo.getInventory().getEffectsComponent().createEffect(effectId); habbo.getInventory().getEffectsComponent().createEffect(effectId);
} }
} } else if (Item.isPet(baseItem))
else if(Item.isPet(baseItem))
{ {
String[] data = extradata.split("\n"); String[] data = extradata.split("\n");
@ -1088,14 +1116,13 @@ public class CatalogManager
try try
{ {
pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient()); pet = Emulator.getGameEnvironment().getPetManager().createPet(baseItem, data[0], data[1], data[2], habbo.getClient());
} } catch (Exception e)
catch (Exception e)
{ {
Emulator.getLogging().logErrorLine(e); Emulator.getLogging().logErrorLine(e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
} }
if(pet == null) if (pet == null)
{ {
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
@ -1106,32 +1133,29 @@ public class CatalogManager
habbo.getClient().sendResponse(new PetBoughtNotificationComposer(pet, false)); habbo.getClient().sendResponse(new PetBoughtNotificationComposer(pet, false));
AchievementManager.progressAchievement(habbo.getClient().getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetLover")); AchievementManager.progressAchievement(habbo.getClient().getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetLover"));
} } else if (baseItem.getType() == FurnitureType.BADGE)
else if (baseItem.getType() == FurnitureType.BADGE)
{ {
if(!habbo.getInventory().getBadgesComponent().hasBadge(baseItem.getName())) if (!habbo.getInventory().getBadgesComponent().hasBadge(baseItem.getName()))
{ {
if (!badges.contains(baseItem.getName())) if (!badges.contains(baseItem.getName()))
{ {
badges.add(baseItem.getName()); badges.add(baseItem.getName());
} }
} } else
else
{ {
badgeFound = true; badgeFound = true;
} }
} } else
else
{ {
if (baseItem.getInteractionType().getType() == InteractionTrophy.class || baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class) if (baseItem.getInteractionType().getType() == InteractionTrophy.class || baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class)
{ {
if(baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class && !habbo.getClient().getHabbo().getInventory().getBadgesComponent().hasBadge(extradata)) if (baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class && !habbo.getClient().getHabbo().getInventory().getBadgesComponent().hasBadge(extradata))
{ {
Emulator.getGameEnvironment().getModToolManager().quickTicket(habbo.getClient().getHabbo(), "Scripter", Emulator.getTexts().getValue("scripter.warning.catalog.badge_display").replace("%username%", habbo.getClient().getHabbo().getHabboInfo().getUsername()).replace("%badge%", extradata)); Emulator.getGameEnvironment().getModToolManager().quickTicket(habbo.getClient().getHabbo(), "Scripter", Emulator.getTexts().getValue("scripter.warning.catalog.badge_display").replace("%username%", habbo.getClient().getHabbo().getHabboInfo().getUsername()).replace("%badge%", extradata));
extradata = "UMAD"; extradata = "UMAD";
} }
extradata = habbo.getClient().getHabbo().getHabboInfo().getUsername() + (char) 9 + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR) + (char) 9 + Emulator.getGameEnvironment().getWordFilter().filter(extradata, habbo); extradata = habbo.getClient().getHabbo().getHabboInfo().getUsername() + (char) 9 + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR) + (char) 9 + Emulator.getGameEnvironment().getWordFilter().filter(extradata.replace(((char)9) + "", ""), habbo);
} }
if (InteractionTeleport.class.isAssignableFrom(baseItem.getInteractionType().getType())) if (InteractionTeleport.class.isAssignableFrom(baseItem.getInteractionType().getType()))
@ -1141,54 +1165,49 @@ public class CatalogManager
Emulator.getGameEnvironment().getItemManager().insertTeleportPair(teleportOne.getId(), teleportTwo.getId()); Emulator.getGameEnvironment().getItemManager().insertTeleportPair(teleportOne.getId(), teleportTwo.getId());
itemsList.add(teleportOne); itemsList.add(teleportOne);
itemsList.add(teleportTwo); itemsList.add(teleportTwo);
} } else if (baseItem.getInteractionType().getType() == InteractionHopper.class)
else if(baseItem.getInteractionType().getType() == InteractionHopper.class)
{ {
HabboItem hopper = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata); HabboItem hopper = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata);
Emulator.getGameEnvironment().getItemManager().insertHopper(hopper); Emulator.getGameEnvironment().getItemManager().insertHopper(hopper);
itemsList.add(hopper); itemsList.add(hopper);
} } else if (baseItem.getInteractionType().getType() == InteractionGuildFurni.class || baseItem.getInteractionType().getType() == InteractionGuildGate.class)
else if(baseItem.getInteractionType().getType() == InteractionGuildFurni.class || baseItem.getInteractionType().getType() == InteractionGuildGate.class)
{ {
int guildId; int guildId;
try try
{ {
guildId = Integer.parseInt(extradata); guildId = Integer.parseInt(extradata);
} } catch (Exception e)
catch (Exception e)
{ {
Emulator.getLogging().logErrorLine(e); Emulator.getLogging().logErrorLine(e);
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
} }
InteractionGuildFurni habboItem = (InteractionGuildFurni)Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata); InteractionGuildFurni habboItem = (InteractionGuildFurni) Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata);
habboItem.setExtradata(""); habboItem.setExtradata("");
habboItem.needsUpdate(true); habboItem.needsUpdate(true);
Emulator.getThreading().run(habboItem); Emulator.getThreading().run(habboItem);
Emulator.getGameEnvironment().getGuildManager().setGuild(habboItem, guildId); Emulator.getGameEnvironment().getGuildManager().setGuild(habboItem, guildId);
itemsList.add(habboItem); itemsList.add(habboItem);
} } else if (baseItem.getInteractionType().getType() == InteractionMusicDisc.class)
else if(baseItem.getInteractionType().getType() == InteractionMusicDisc.class)
{ {
SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(item.getExtradata()); SoundTrack track = Emulator.getGameEnvironment().getItemManager().getSoundTrack(item.getExtradata());
if(track == null) if (track == null)
{ {
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
} }
InteractionMusicDisc habboItem = (InteractionMusicDisc)Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, habbo.getClient().getHabbo().getHabboInfo().getUsername() + "\n" + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "\n" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "\n" + Calendar.getInstance().get(Calendar.YEAR) + "\n" + track.getLength() + "\n" + track.getName() + "\n" + track.getId()); InteractionMusicDisc habboItem = (InteractionMusicDisc) Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, habbo.getClient().getHabbo().getHabboInfo().getUsername() + "\n" + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "\n" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "\n" + Calendar.getInstance().get(Calendar.YEAR) + "\n" + track.getLength() + "\n" + track.getName() + "\n" + track.getId());
habboItem.needsUpdate(true); habboItem.needsUpdate(true);
Emulator.getThreading().run(habboItem); Emulator.getThreading().run(habboItem);
itemsList.add(habboItem); itemsList.add(habboItem);
} } else
else
{ {
HabboItem habboItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata); HabboItem habboItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata);
itemsList.add(habboItem); itemsList.add(habboItem);
@ -1196,79 +1215,83 @@ public class CatalogManager
} }
} }
} }
//} //}
}
} }
} }
}
UserCatalogItemPurchasedEvent purchasedEvent = new UserCatalogItemPurchasedEvent(habbo, item, itemsList, totalCredits, totalPoints, badges); UserCatalogItemPurchasedEvent purchasedEvent = new UserCatalogItemPurchasedEvent(habbo, item, itemsList, totalCredits, totalPoints, badges);
Emulator.getPluginManager().fireEvent(purchasedEvent); Emulator.getPluginManager().fireEvent(purchasedEvent);
if (badgeFound) if (badgeFound)
{
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
if (item.getBaseItems().size() == 1)
{ {
return; habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
}
}
if(!free && !habbo.getClient().getHabbo().hasPermission("acc_infinite_credits")) if (item.getBaseItems().size() == 1)
{
if (purchasedEvent.totalCredits > 0)
{
habbo.getClient().getHabbo().getHabboInfo().addCredits(-purchasedEvent.totalCredits);
habbo.getClient().sendResponse(new UserCreditsComposer(habbo.getClient().getHabbo()));
}
}
if(!free && !habbo.getClient().getHabbo().hasPermission("acc_infinite_points"))
{
if (purchasedEvent.totalPoints > 0)
{
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -purchasedEvent.totalPoints);
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -purchasedEvent.totalPoints, item.getPointsType()));
}
}
if (purchasedEvent.itemsList != null)
{
habbo.getClient().sendResponse(new AddHabboItemComposer(purchasedEvent.itemsList));
habbo.getClient().getHabbo().getInventory().getItemsComponent().addItems(purchasedEvent.itemsList);
habbo.getClient().sendResponse(new PurchaseOKComposer(purchasedEvent.catalogItem));
habbo.getClient().sendResponse(new InventoryRefreshComposer());
Emulator.getPluginManager().fireEvent(new UserCatalogFurnitureBoughtEvent(habbo, item, purchasedEvent.itemsList));
if (limitedConfiguration != null)
{
for (HabboItem itm : purchasedEvent.itemsList)
{ {
limitedConfiguration.limitedSold(item.getId(), habbo, itm); return;
} }
} }
}
for (String b : purchasedEvent.badges) if (!free && !habbo.getClient().getHabbo().hasPermission("acc_infinite_credits"))
{
if (purchasedEvent.totalCredits > 0)
{
habbo.getClient().getHabbo().getHabboInfo().addCredits(-purchasedEvent.totalCredits);
habbo.getClient().sendResponse(new UserCreditsComposer(habbo.getClient().getHabbo()));
}
}
if (!free && !habbo.getClient().getHabbo().hasPermission("acc_infinite_points"))
{
if (purchasedEvent.totalPoints > 0)
{
habbo.getClient().getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -purchasedEvent.totalPoints);
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getClient().getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -purchasedEvent.totalPoints, item.getPointsType()));
}
}
if (purchasedEvent.itemsList != null)
{
habbo.getClient().sendResponse(new AddHabboItemComposer(purchasedEvent.itemsList));
habbo.getClient().getHabbo().getInventory().getItemsComponent().addItems(purchasedEvent.itemsList);
habbo.getClient().sendResponse(new PurchaseOKComposer(purchasedEvent.catalogItem));
habbo.getClient().sendResponse(new InventoryRefreshComposer());
Emulator.getPluginManager().fireEvent(new UserCatalogFurnitureBoughtEvent(habbo, item, purchasedEvent.itemsList));
if (limitedConfiguration != null)
{
for (HabboItem itm : purchasedEvent.itemsList)
{
limitedConfiguration.limitedSold(item.getId(), habbo, itm);
}
}
}
for (String b : purchasedEvent.badges)
{
HabboBadge badge = new HabboBadge(0, b, 0, habbo);
Emulator.getThreading().run(badge);
habbo.getInventory().getBadgesComponent().addBadge(badge);
habbo.getClient().sendResponse(new AddUserBadgeComposer(badge));
THashMap<String, String> keys = new THashMap<>();
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
}
habbo.getClient().getHabbo().getHabboStats().addPurchase(purchasedEvent.catalogItem);
} catch (Exception e)
{ {
HabboBadge badge = new HabboBadge(0, b, 0, habbo); Emulator.getLogging().logPacketError(e);
Emulator.getThreading().run(badge); habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
habbo.getInventory().getBadgesComponent().addBadge(badge);
habbo.getClient().sendResponse(new AddUserBadgeComposer(badge));
THashMap<String, String> keys = new THashMap<>();
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
} }
habbo.getClient().getHabbo().getHabboStats().addPurchase(purchasedEvent.catalogItem);
} }
catch(Exception e) finally
{ {
Emulator.getLogging().logPacketError(e); habbo.getHabboStats().isPurchasingFurniture = false;
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
} }
} }
@ -1316,4 +1339,9 @@ public class CatalogManager
} }
} }
public TargetOffer getTargetOffer(int offerId)
{
return this.targetOffers.get(offerId);
}
} }

View File

@ -1,17 +1,20 @@
package com.eu.habbo.habbohotel.catalog; package com.eu.habbo.habbohotel.catalog;
import com.eu.habbo.messages.ISerialize; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import java.util.List; import java.sql.ResultSet;
import java.sql.SQLException;
public class TargetOffer implements ISerialize public class TargetOffer
{ {
private final int unknownInt1; public static int ACTIVE_TARGET_OFFER_ID = 0;
private final int id; private final int id;
private final int catalogItem;
private final String identifier; private final String identifier;
private final String unknownString1;
private final int priceInCredits; private final int priceInCredits;
private final int priceInActivityPoints; private final int priceInActivityPoints;
private final int activityPointsType; private final int activityPointsType;
@ -20,50 +23,111 @@ public class TargetOffer implements ISerialize
private final String title; private final String title;
private final String description; private final String description;
private final String imageUrl; private final String imageUrl;
private final String unknownString2; private final String icon;
private final int type; private final String[] vars;
private final List<String> unknownStringList;
public TargetOffer(int unknownInt1, int id, String identifier, String unknownString1, int priceInCredits, int priceInActivityPoints, int activityPointsType, int purchaseLimit, int expirationTime, String title, String description, String imageUrl, String unknownString2, int type, List<String> unknownStringList) public TargetOffer(ResultSet set) throws SQLException
{ {
this.unknownInt1 = unknownInt1; this.id = set.getInt("id");
this.id = id; this.identifier = set.getString("offer_code");
this.identifier = identifier; this.priceInCredits = set.getInt("credits");
this.unknownString1 = unknownString1; this.priceInActivityPoints = set.getInt("points");
this.priceInCredits = priceInCredits; this.activityPointsType = set.getInt("points_type");
this.priceInActivityPoints = priceInActivityPoints; this.title = set.getString("title");
this.activityPointsType = activityPointsType; this.description = set.getString("description");
this.purchaseLimit = purchaseLimit; this.imageUrl = set.getString("image");
this.expirationTime = expirationTime; this.icon = set.getString("icon");
this.title = title; this.purchaseLimit = set.getInt("purchase_limit");
this.description = description; this.expirationTime = set.getInt("end_timestamp");
this.imageUrl = imageUrl; this.vars = set.getString("vars").split(";");
this.unknownString2 = unknownString2; this.catalogItem = set.getInt("catalog_item");
this.type = type;
this.unknownStringList = unknownStringList;
} }
@Override public void serialize(ServerMessage message, HabboOfferPurchase purchase)
public void serialize(ServerMessage message)
{ {
message.appendInt(this.unknownInt1); message.appendInt(purchase.getState());
message.appendInt(this.id); message.appendInt(this.id);
message.appendString(this.identifier); message.appendString(this.identifier);
message.appendString(this.unknownString1); message.appendString(this.identifier);
message.appendInt(this.priceInCredits); message.appendInt(this.priceInCredits);
message.appendInt(this.priceInActivityPoints); message.appendInt(this.priceInActivityPoints);
message.appendInt(this.activityPointsType); message.appendInt(this.activityPointsType);
message.appendInt(this.purchaseLimit); message.appendInt(Math.max(this.purchaseLimit - purchase.getAmount(), 0));
message.appendInt(this.expirationTime); message.appendInt(Math.max(Emulator.getIntUnixTimestamp() - this.expirationTime, 0));
message.appendString(this.title); message.appendString(this.title);
message.appendString(this.description); message.appendString(this.description);
message.appendString(this.imageUrl); message.appendString(this.imageUrl);
message.appendString(this.unknownString2); message.appendString(this.icon);
message.appendInt(this.type); message.appendInt(0);
message.appendInt(this.unknownStringList.size()); message.appendInt(this.vars.length);
for (String s : this.unknownStringList) for (String variable : this.vars)
{ {
message.appendString(s); message.appendString(variable);
} }
} }
public int getId()
{
return this.id;
}
public String getIdentifier()
{
return this.identifier;
}
public int getPriceInCredits()
{
return this.priceInCredits;
}
public int getPriceInActivityPoints()
{
return this.priceInActivityPoints;
}
public int getActivityPointsType()
{
return this.activityPointsType;
}
public int getPurchaseLimit()
{
return this.purchaseLimit;
}
public int getExpirationTime()
{
return this.expirationTime;
}
public String getTitle()
{
return this.title;
}
public String getDescription()
{
return this.description;
}
public String getImageUrl()
{
return this.imageUrl;
}
public String getIcon()
{
return this.icon;
}
public String[] getVars()
{
return this.vars;
}
public int getCatalogItem()
{
return this.catalogItem;
}
} }

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.users.UserPerksComposer;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -38,8 +39,9 @@ public class AllowTradingCommand extends Command
if (habbo != null) if (habbo != null)
{ {
habbo.getHabboStats().allowTrade = enabled; habbo.getHabboStats().setAllowTrade(enabled);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1])); gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1]));
habbo.getClient().sendResponse(new UserPerksComposer(habbo));
return true; return true;
} }
else else

View File

@ -56,6 +56,7 @@ public class CommandHandler
addCommand(new EventCommand()); addCommand(new EventCommand());
addCommand(new FacelessCommand()); addCommand(new FacelessCommand());
addCommand(new FastwalkCommand()); addCommand(new FastwalkCommand());
addCommand(new FilterWordCommand());
addCommand(new FreezeBotsCommand()); addCommand(new FreezeBotsCommand());
addCommand(new FreezeCommand()); addCommand(new FreezeCommand());
addCommand(new GiftCommand()); addCommand(new GiftCommand());
@ -86,6 +87,7 @@ public class CommandHandler
addCommand(new PixelCommand()); addCommand(new PixelCommand());
addCommand(new PluginsCommand()); addCommand(new PluginsCommand());
addCommand(new PointsCommand()); addCommand(new PointsCommand());
addCommand(new PromoteTargetOfferCommand());
addCommand(new PullCommand()); addCommand(new PullCommand());
addCommand(new PushCommand()); addCommand(new PushCommand());
addCommand(new RedeemCommand()); addCommand(new RedeemCommand());

View File

@ -23,7 +23,7 @@ public class EmptyInventoryCommand extends Command
@Override @Override
public boolean handle(GameClient gameClient, String[] params) throws Exception public boolean handle(GameClient gameClient, String[] params) throws Exception
{ {
if(params.length == 1 || (params.length >= 2 && !params[1].equals(Emulator.getTexts().getValue("generic.yes")))) if(params.length == 1 || (params.length == 2 && !params[1].equals(Emulator.getTexts().getValue("generic.yes"))))
{ {
if(gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) if(gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null)
{ {

View File

@ -0,0 +1,56 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.modtool.WordFilter;
import com.eu.habbo.habbohotel.modtool.WordFilterWord;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class FilterWordCommand extends Command
{
public FilterWordCommand()
{
super("cmd_filterword", Emulator.getTexts().getValue("commands.keys.cmd_filterword").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
if (params.length < 2)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.missing_word"));
return true;
}
String word = params[1];
String replacement = WordFilter.DEFAULT_REPLACEMENT;
if (params.length == 3)
{
replacement = params[2];
}
WordFilterWord wordFilterWord = new WordFilterWord(word, replacement);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO wordfilter (`key`, `replacement`) VALUES (?, ?)"))
{
statement.setString(1, word);
statement.setString(2, replacement);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error"));
return true;
}
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_filterword.added").replace("%word%", word).replace("%replacement%", replacement));
Emulator.getGameEnvironment().getWordFilter().addWord(wordFilterWord);
return true;
}
}

View File

@ -40,7 +40,18 @@ public class PointsCommand extends Command
} }
} }
int amount = Integer.valueOf(params[2]); int amount = 0;
try
{
amount = Integer.valueOf(params[2]);
}
catch (Exception e)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
return true;
}
if (amount != 0) if (amount != 0)
{ {
habbo.givePoints(type, amount); habbo.givePoints(type, amount);

View File

@ -0,0 +1,93 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.TargetOffer;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
import com.eu.habbo.messages.outgoing.unknown.TargetedOfferComposer;
import gnu.trove.map.hash.THashMap;
import java.util.ArrayList;
import java.util.List;
public class PromoteTargetOfferCommand extends Command
{
public PromoteTargetOfferCommand()
{
super("cmd_promote_offer", Emulator.getTexts().getValue("commands.keys.cmd_promote_offer").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
if (params.length <= 1)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_promote_offer.not_found"));
return true;
}
String offerKey = params[1];
if (offerKey.equalsIgnoreCase(Emulator.getTexts().getValue("commands.cmd_promote_offer.info")))
{
THashMap<Integer, TargetOffer> targetOffers = Emulator.getGameEnvironment().getCatalogManager().targetOffers;
String[] textConfig = Emulator.getTexts().getValue("commands.cmd_promote_offer.list").replace("%amount%", targetOffers.size() + "").split("<br>");
String entryConfig = Emulator.getTexts().getValue("commands.cmd_promote_offer.list.entry");
List<String> message = new ArrayList<String>();
for (int i = 0; i < textConfig.length; i++)
{
if (textConfig[i].contains("%list%"))
{
for (TargetOffer offer : targetOffers.values())
{
message.add(entryConfig.replace("%id%", offer.getId() + "").replace("%title%", offer.getTitle()).replace("%description%", offer.getDescription().substring(0, 25)));
}
}
else
{
message.add(textConfig[i]);
}
}
gameClient.sendResponse(new MessagesForYouComposer(message));
}
else
{
int offerId = 0;
try
{
offerId = Integer.valueOf(offerKey);
}
catch (Exception e)
{
}
if (offerId > 0)
{
TargetOffer offer = Emulator.getGameEnvironment().getCatalogManager().getTargetOffer(offerId);
if (offer != null)
{
TargetOffer.ACTIVE_TARGET_OFFER_ID = offer.getId();
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_promote_offer").replace("%id%", offerKey).replace("%title%", offer.getTitle()));
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values())
{
habbo.getClient().sendResponse(new TargetedOfferComposer(habbo, offer));
}
}
}
else
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_promote_offer.not_found"));
return true;
}
}
return true;
}
}

View File

@ -23,6 +23,8 @@ public class RedeemCommand extends Command
@Override @Override
public boolean handle(final GameClient gameClient, String[] params) throws Exception public boolean handle(final GameClient gameClient, String[] params) throws Exception
{ {
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getActiveTradeForHabbo(gameClient.getHabbo()) != null)
return false;
ArrayList<HabboItem> items = new ArrayList<>(); ArrayList<HabboItem> items = new ArrayList<>();
int credits = 0; int credits = 0;
@ -30,48 +32,48 @@ public class RedeemCommand extends Command
TIntIntMap points = new TIntIntHashMap(); TIntIntMap points = new TIntIntHashMap();
for(HabboItem item : gameClient.getHabbo().getInventory().getItemsComponent().getItemsAsValueCollection()) for(HabboItem item : gameClient.getHabbo().getInventory().getItemsComponent().getItemsAsValueCollection())
{ {
if (item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_")) if (item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_"))
{ {
items.add(item); if (item.getUserId() == gameClient.getHabbo().getHabboInfo().getId())
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_"))
{ {
try items.add(item);
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_"))
{ {
credits += Integer.valueOf(item.getBaseItem().getName().split("_")[1]); try
} catch (Exception e) {
{ credits += Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
} } catch (Exception e)
{
}
} else if (item.getBaseItem().getName().startsWith("PF_")) } else if (item.getBaseItem().getName().startsWith("PF_"))
{
try
{ {
pixels += Integer.valueOf(item.getBaseItem().getName().split("_")[1]); try
} catch (Exception e) {
pixels += Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
} catch (Exception e)
{
}
} else if (item.getBaseItem().getName().startsWith("DF_"))
{ {
} int pointsType = 0;
} else if (item.getBaseItem().getName().startsWith("DF_")) int pointsAmount = 0;
{
int pointsType = 0;
int pointsAmount = 0;
pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]); pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]); pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount); points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
} } else if (item.getBaseItem().getName().startsWith("CF_diamond_"))
else if (item.getBaseItem().getName().startsWith("CF_diamond_"))
{
try
{
int amount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
points.adjustOrPutValue(5, amount, amount);
}
catch (Exception e)
{ {
try
{
int amount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);
points.adjustOrPutValue(5, amount, amount);
} catch (Exception e)
{
}
} }
} }
} }

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomTrade;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.HotelWillCloseInMinutesComposer; import com.eu.habbo.messages.outgoing.generic.alerts.HotelWillCloseInMinutesComposer;
@ -55,6 +56,7 @@ public class ShutdownCommand extends Command
{ {
message = new HotelWillCloseInMinutesComposer(minutes).compose(); message = new HotelWillCloseInMinutesComposer(minutes).compose();
} }
RoomTrade.TRADING_ENABLED = false;
ShutdownEmulator.timestamp = Emulator.getIntUnixTimestamp() + (60 * minutes); ShutdownEmulator.timestamp = Emulator.getIntUnixTimestamp() + (60 * minutes);
Emulator.getThreading().run(new ShutdownEmulator(message), minutes * 60 * 1000); Emulator.getThreading().run(new ShutdownEmulator(message), minutes * 60 * 1000);
return true; return true;

View File

@ -87,7 +87,7 @@ public class UserInfoCommand extends Command
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-" ): "") + (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-" ): "") +
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().respectPointsToGive + "\r" : "") + (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().respectPointsToGive + "\r" : "") +
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().petRespectPointsToGive + "\r" : "") + (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().petRespectPointsToGive + "\r" : "") +
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "") + (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "") +
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().blockFollowing) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "") + (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().blockFollowing) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "") +
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().blockFriendRequests) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : ""); (onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().blockFriendRequests) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "");

View File

@ -14,6 +14,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
public class GameClient public class GameClient
{ {
@ -26,6 +27,9 @@ public class GameClient
private String machineId = ""; private String machineId = "";
public ConcurrentHashMap<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp();
public GameClient(Channel channel) public GameClient(Channel channel)
{ {
this.channel = channel; this.channel = channel;

View File

@ -201,7 +201,6 @@ public class BattleBanzaiGame extends Game
} }
else else
{ {
this.stop();
GameTeam winningTeam = null; GameTeam winningTeam = null;
@ -244,6 +243,8 @@ public class BattleBanzaiGame extends Game
Emulator.getThreading().run(new BattleBanzaiTilesFlicker(this.lockedTiles.get(winningTeam.teamColor), winningTeam.teamColor, this.room)); Emulator.getThreading().run(new BattleBanzaiTilesFlicker(this.lockedTiles.get(winningTeam.teamColor), winningTeam.teamColor, this.room));
} }
} }
this.stop();
this.isRunning = false; this.isRunning = false;
} }

View File

@ -2,10 +2,7 @@ package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.*; import com.eu.habbo.habbohotel.items.interactions.*;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiSphere; import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.*;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTeleporter;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTile;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTimer;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateBlue; import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateBlue;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateGreen; import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateGreen;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateRed; import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGateRed;
@ -225,6 +222,7 @@ public class ItemManager
this.interactionsList.add(new ItemInteraction("wf_act_give_respect", WiredEffectGiveRespect.class)); this.interactionsList.add(new ItemInteraction("wf_act_give_respect", WiredEffectGiveRespect.class));
this.interactionsList.add(new ItemInteraction("wf_act_alert", WiredEffectAlert.class)); this.interactionsList.add(new ItemInteraction("wf_act_alert", WiredEffectAlert.class));
this.interactionsList.add(new ItemInteraction("wf_act_give_handitem", WiredEffectGiveHandItem.class)); this.interactionsList.add(new ItemInteraction("wf_act_give_handitem", WiredEffectGiveHandItem.class));
this.interactionsList.add(new ItemInteraction("wf_act_match_to_sshot2", WiredEffectMatchFurniStaff.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_has_furni_on", WiredConditionFurniHaveFurni.class)); this.interactionsList.add(new ItemInteraction("wf_cnd_has_furni_on", WiredConditionFurniHaveFurni.class));
@ -283,6 +281,7 @@ public class ItemManager
this.interactionsList.add(new ItemInteraction("battlebanzai_tile", InteractionBattleBanzaiTile.class)); this.interactionsList.add(new ItemInteraction("battlebanzai_tile", InteractionBattleBanzaiTile.class));
this.interactionsList.add(new ItemInteraction("battlebanzai_random_teleport", InteractionBattleBanzaiTeleporter.class)); this.interactionsList.add(new ItemInteraction("battlebanzai_random_teleport", InteractionBattleBanzaiTeleporter.class));
this.interactionsList.add(new ItemInteraction("battlebanzai_sphere", InteractionBattleBanzaiSphere.class)); this.interactionsList.add(new ItemInteraction("battlebanzai_sphere", InteractionBattleBanzaiSphere.class));
this.interactionsList.add(new ItemInteraction("battlebanzai_puck", InteractionBattleBanzaiPuck.class));
this.interactionsList.add(new ItemInteraction("battlebanzai_gate_blue", InteractionBattleBanzaiGateBlue.class)); this.interactionsList.add(new ItemInteraction("battlebanzai_gate_blue", InteractionBattleBanzaiGateBlue.class));

View File

@ -1,5 +1,7 @@
package com.eu.habbo.habbohotel.items; package com.eu.habbo.habbohotel.items;
import com.eu.habbo.Emulator;
public enum PostItColor public enum PostItColor
{ {
@ -32,4 +34,9 @@ public enum PostItColor
return true; return true;
} }
public static PostItColor randomColorNotYellow()
{
return PostItColor.values()[Emulator.getRandom().nextInt(3)];
}
} }

View File

@ -106,4 +106,10 @@ public class InteractionBackgroundToner extends HabboItem
{ {
super.onWalkOff(roomUnit, room, objects); super.onWalkOff(roomUnit, room, objects);
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -13,6 +13,7 @@ import com.eu.habbo.threading.runnables.CannonResetCooldownAction;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List;
public class InteractionCannon extends HabboItem public class InteractionCannon extends HabboItem
{ {
@ -61,13 +62,22 @@ public class InteractionCannon extends HabboItem
return; return;
RoomTile tile = room.getLayout().getTile(this.getX(), this.getY()); RoomTile tile = room.getLayout().getTile(this.getX(), this.getY());
RoomTile fuseTile = this.getRotation() >= 4 ? tile : room.getLayout().getTileInFront(tile, ((this.getRotation() % 2) + 2) % 8);
if ((client == null || tile.distance(client.getHabbo().getRoomUnit().getCurrentLocation()) <= 2) && !this.cooldown) List<RoomTile> tiles = room.getLayout().getTilesAround(fuseTile);
tiles.remove(room.getLayout().getTileInFront(tile, (this.getRotation() + (this.getRotation() >= 4 ? -1 : 0)) % 8));
tiles.remove(room.getLayout().getTileInFront(tile, (this.getRotation() + (this.getRotation() >= 4 ? 5 : 4)) % 8));
if ((client == null || tiles.contains(client.getHabbo().getRoomUnit().getCurrentLocation())) && !this.cooldown &&
client.getHabbo().getRoomUnit().canWalk())
{ {
client.getHabbo().getRoomUnit().setCanWalk(false);
client.getHabbo().getRoomUnit().setGoalLocation(client.getHabbo().getRoomUnit().getCurrentLocation());
this.cooldown = true; this.cooldown = true;
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1"); this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
room.updateItemState(this); room.updateItemState(this);
Emulator.getThreading().run(new CannonKickAction(this, room), 750); client.getHabbo().getRoomUnit().lookAtPoint(fuseTile);
client.getHabbo().getRoomUnit().statusUpdate(true);
Emulator.getThreading().run(new CannonKickAction(this, room, client), 750);
Emulator.getThreading().run(new CannonResetCooldownAction(this), 2000); Emulator.getThreading().run(new CannonResetCooldownAction(this), 2000);
} }
} }
@ -95,4 +105,11 @@ public class InteractionCannon extends HabboItem
{ {
this.setExtradata("0"); this.setExtradata("0");
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -166,4 +166,10 @@ public class InteractionCrackable extends HabboItem
this.setExtradata("0"); this.setExtradata("0");
room.updateItem(this); room.updateItem(this);
} }
@Override
public boolean isUsable()
{
return false;
}
} }

View File

@ -97,4 +97,10 @@ public class InteractionDice extends HabboItem
{ {
return false; return false;
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -3,11 +3,13 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionEffectTile extends InteractionDefault public class InteractionEffectTile extends InteractionPressurePlate
{ {
public InteractionEffectTile(ResultSet set, Item baseItem) throws SQLException public InteractionEffectTile(ResultSet set, Item baseItem) throws SQLException
{ {
@ -19,8 +21,55 @@ public class InteractionEffectTile extends InteractionDefault
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, userId, item, extradata, limitedStack, limitedSells);
} }
@Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects)
{
return true;
}
@Override
public boolean isWalkable()
{
return true;
}
@Override @Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{ {
super.onWalkOff(roomUnit, room, objects);
Habbo habbo = room.getHabbo(roomUnit);
if (habbo.getRoomUnit().getEffectId() == 0)
{
if (habbo.getHabboInfo().getGender().equals(HabboGender.M))
{
room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectM());
} else
{
room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectF());
}
}
else
{
if ((habbo.getHabboInfo().getGender().equals(HabboGender.M) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) ||
habbo.getHabboInfo().getGender().equals(HabboGender.F) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectF()
)
{
room.giveEffect(habbo.getRoomUnit(), 0);
}
}
}
@Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{
}
@Override
public boolean isUsable()
{
return false;
} }
} }

View File

@ -84,4 +84,10 @@ public class InteractionGate extends HabboItem
{ {
return true; return true;
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@ -26,7 +25,7 @@ public class InteractionMonsterPlantSeed extends HabboItem
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception public void onClick(GameClient client, Room room, Object[] objects) throws Exception
{ {
client.sendResponse(new GenericAlertComposer("We're in the progress of implementing monster plants.\r\n Stay tuned!\r-Arcturus Emulator")); //client.sendResponse(new GenericAlertComposer("We're in the progress of implementing monster plants.\r\n Stay tuned!\r-Arcturus Emulator"));
} }
@Override @Override

View File

@ -67,4 +67,10 @@ public class InteractionMoodLight extends HabboItem
} }
} }
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -75,6 +75,7 @@ public class InteractionMultiHeight extends HabboItem
{ {
this.setExtradata("" + (Integer.valueOf(this.getExtradata()) + 1) % (this.getBaseItem().getMultiHeights().length)); this.setExtradata("" + (Integer.valueOf(this.getExtradata()) + 1) % (this.getBaseItem().getMultiHeights().length));
this.needsUpdate(true); this.needsUpdate(true);
room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()));
room.updateItemState(this); room.updateItemState(this);
room.sendComposer(new UpdateStackHeightComposer(this.getX(), this.getY(), this.getBaseItem().getMultiHeights()[Integer.valueOf(this.getExtradata())] * 256.0D).compose()); room.sendComposer(new UpdateStackHeightComposer(this.getX(), this.getY(), this.getBaseItem().getMultiHeights()[Integer.valueOf(this.getExtradata())] * 256.0D).compose());
} }
@ -100,6 +101,7 @@ public class InteractionMultiHeight extends HabboItem
else else
{ {
habbo.getRoomUnit().setZ(this.getZ() + this.getBaseItem().getMultiHeights()[(this.getExtradata().isEmpty() ? 0 : Integer.valueOf(this.getExtradata()) % (this.getBaseItem().getMultiHeights().length))]); habbo.getRoomUnit().setZ(this.getZ() + this.getBaseItem().getMultiHeights()[(this.getExtradata().isEmpty() ? 0 : Integer.valueOf(this.getExtradata()) % (this.getBaseItem().getMultiHeights().length))]);
habbo.getRoomUnit().setPreviousLocationZ(habbo.getRoomUnit().getZ());
} }
} }

View File

@ -11,6 +11,8 @@ import java.sql.SQLException;
public class InteractionPostIt extends HabboItem public class InteractionPostIt extends HabboItem
{ {
public static String STICKYPOLE_PREFIX_TEXT = "";
public InteractionPostIt(ResultSet set, Item baseItem) throws SQLException public InteractionPostIt(ResultSet set, Item baseItem) throws SQLException
{ {
super(set, baseItem); super(set, baseItem);

View File

@ -5,11 +5,13 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionPressurePlate extends InteractionDefault public class InteractionPressurePlate extends HabboItem
{ {
public InteractionPressurePlate(ResultSet set, Item baseItem) throws SQLException public InteractionPressurePlate(ResultSet set, Item baseItem) throws SQLException
{ {
@ -39,6 +41,15 @@ public class InteractionPressurePlate extends InteractionDefault
super.onClick(client, room, objects); super.onClick(client, room, objects);
} }
@Override
public void serializeExtradata(ServerMessage serverMessage)
{
serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata());
super.serializeExtradata(serverMessage);
}
@Override @Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{ {
@ -51,12 +62,16 @@ public class InteractionPressurePlate extends InteractionDefault
super.onWalkOn(roomUnit, room, objects); super.onWalkOn(roomUnit, room, objects);
this.setExtradata("1"); this.setExtradata("1");
for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()))
if (this.getBaseItem().getWidth() > 1 || this.getBaseItem().getLength() > 1)
{ {
if (!room.hasHabbosAt(tile.x, tile.y) && !roomUnit.getGoal().is(tile.x, tile.y)) for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()))
{ {
this.setExtradata("0"); if (!room.hasHabbosAt(tile.x, tile.y) && !roomUnit.getGoal().is(tile.x, tile.y))
break; {
this.setExtradata("0");
break;
}
} }
} }

View File

@ -9,11 +9,12 @@ import com.eu.habbo.threading.runnables.KickBallAction;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public abstract class InteractionPushable extends InteractionDefault
{ public abstract class InteractionPushable extends InteractionDefault {
private KickBallAction currentThread; private KickBallAction currentThread;
public InteractionPushable(ResultSet set, Item baseItem) throws SQLException public InteractionPushable(ResultSet set, Item baseItem) throws SQLException
{ {
super(set, baseItem); super(set, baseItem);
@ -23,7 +24,7 @@ public abstract class InteractionPushable extends InteractionDefault
{ {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, userId, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects)
{ {
@ -35,62 +36,59 @@ public abstract class InteractionPushable extends InteractionDefault
{ {
return true; return true;
} }
@Override @Override
public void onWalkOff(RoomUnit roomUnit, final Room room, Object[] objects) throws Exception public void onWalkOff(RoomUnit roomUnit, final Room room, Object[] objects) throws Exception
{ {
super.onWalkOff(roomUnit, room, objects); super.onWalkOff(roomUnit, room, objects);
if(!(currentThread == null || currentThread.dead)) if(!(currentThread == null || currentThread.dead))
{
currentThread = null;
return; return;
}
int velocity = this.getWalkOffVelocity(roomUnit, room); int velocity = this.getWalkOffVelocity(roomUnit, room);
RoomUserRotation direction = this.getWalkOffDirection(roomUnit, room); RoomUserRotation direction = this.getWalkOffDirection(roomUnit, room);
this.onKick(room, roomUnit, velocity, direction); this.onKick(room, roomUnit, velocity, direction);
if(velocity > 0) if(velocity > 0)
{ {
if(currentThread != null) if(currentThread != null)
currentThread.dead = true; currentThread.dead = true;
currentThread = new KickBallAction(this, room, roomUnit, direction, velocity); currentThread = new KickBallAction(this, room, roomUnit, direction, velocity);
Emulator.getThreading().run(currentThread, 0); Emulator.getThreading().run(currentThread, 0);
} }
} }
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception public void onClick(GameClient client, Room room, Object[] objects) throws Exception
{ {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if(RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentLocation(), room.getLayout().getTile(this.getX(), this.getY()))) if(RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentLocation(), room.getLayout().getTile(this.getX(), this.getY())))
{ {
int velocity = this.getTackleVelocity(client.getHabbo().getRoomUnit(), room); int velocity = this.getTackleVelocity(client.getHabbo().getRoomUnit(), room);
RoomUserRotation direction = this.getWalkOnDirection(client.getHabbo().getRoomUnit(), room); RoomUserRotation direction = this.getWalkOnDirection(client.getHabbo().getRoomUnit(), room);
this.onTackle(room, client.getHabbo().getRoomUnit(), velocity, direction); this.onTackle(room, client.getHabbo().getRoomUnit(), velocity, direction);
if(velocity > 0) if(velocity > 0)
{ {
if(currentThread != null) if(currentThread != null)
currentThread.dead = true; currentThread.dead = true;
currentThread = new KickBallAction(this, room, client.getHabbo().getRoomUnit(), direction, velocity); currentThread = new KickBallAction(this, room, client.getHabbo().getRoomUnit(), direction, velocity);
Emulator.getThreading().run(currentThread, 0); Emulator.getThreading().run(currentThread, 0);
} }
} }
} }
@Override @Override
public void onWalkOn(RoomUnit roomUnit, final Room room, Object[] objects) throws Exception public void onWalkOn(RoomUnit roomUnit, final Room room, Object[] objects) throws Exception
{ {
super.onWalkOn(roomUnit, room, objects); super.onWalkOn(roomUnit, room, objects);
int velocity; int velocity;
RoomUserRotation direction; RoomUserRotation direction;
if(this.getX() == roomUnit.getGoal().x && this.getY() == roomUnit.getGoal().y) //User clicked on the tile the ball is on, they want to kick it if(this.getX() == roomUnit.getGoal().x && this.getY() == roomUnit.getGoal().y) //User clicked on the tile the ball is on, they want to kick it
{ {
velocity = this.getWalkOnVelocity(roomUnit, room); velocity = this.getWalkOnVelocity(roomUnit, room);
@ -103,12 +101,12 @@ public abstract class InteractionPushable extends InteractionDefault
direction = this.getDragDirection(roomUnit, room); direction = this.getDragDirection(roomUnit, room);
this.onDrag(room, roomUnit, velocity, direction); this.onDrag(room, roomUnit, velocity, direction);
} }
if(velocity > 0) if(velocity > 0)
{ {
if(currentThread != null) if(currentThread != null)
currentThread.dead = true; currentThread.dead = true;
currentThread = new KickBallAction(this, room, roomUnit, direction, velocity); currentThread = new KickBallAction(this, room, roomUnit, direction, velocity);
Emulator.getThreading().run(currentThread, 0); Emulator.getThreading().run(currentThread, 0);
} }
@ -116,55 +114,56 @@ public abstract class InteractionPushable extends InteractionDefault
public abstract int getWalkOnVelocity(RoomUnit roomUnit, Room room); public abstract int getWalkOnVelocity(RoomUnit roomUnit, Room room);
public abstract RoomUserRotation getWalkOnDirection(RoomUnit roomUnit, Room room); public abstract RoomUserRotation getWalkOnDirection(RoomUnit roomUnit, Room room);
public abstract int getWalkOffVelocity(RoomUnit roomUnit, Room room); public abstract int getWalkOffVelocity(RoomUnit roomUnit, Room room);
public abstract RoomUserRotation getWalkOffDirection(RoomUnit roomUnit, Room room); public abstract RoomUserRotation getWalkOffDirection(RoomUnit roomUnit, Room room);
public abstract int getDragVelocity(RoomUnit roomUnit, Room room); public abstract int getDragVelocity(RoomUnit roomUnit, Room room);
public abstract RoomUserRotation getDragDirection(RoomUnit roomUnit, Room room); public abstract RoomUserRotation getDragDirection(RoomUnit roomUnit, Room room);
public abstract int getTackleVelocity(RoomUnit roomUnit, Room room); public abstract int getTackleVelocity(RoomUnit roomUnit, Room room);
public abstract RoomUserRotation getTackleDirection(RoomUnit roomUnit, Room room); public abstract RoomUserRotation getTackleDirection(RoomUnit roomUnit, Room room);
public abstract int getNextRollDelay(int currentStep, int totalSteps); //The length in milliseconds when the ball should next roll public abstract int getNextRollDelay(int currentStep, int totalSteps); //The length in milliseconds when the ball should next roll
public abstract RoomUserRotation getBounceDirection(Room room, RoomUserRotation currentDirection); //Returns the new direction to move the ball when the ball cannot move public abstract RoomUserRotation getBounceDirection(Room room, RoomUserRotation currentDirection); //Returns the new direction to move the ball when the ball cannot move
public abstract boolean validMove(Room room, RoomTile from, RoomTile to); //Checks if the next move is valid public abstract boolean validMove(Room room, RoomTile from, RoomTile to); //Checks if the next move is valid
public abstract void onDrag(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction); public abstract void onDrag(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction);
public abstract void onKick(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction); public abstract void onKick(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction);
public abstract void onTackle(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction); public abstract void onTackle(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction);
public abstract void onMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps); public abstract void onMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps);
public abstract void onBounce(Room room, RoomUserRotation oldDirection, RoomUserRotation newDirection, RoomUnit kicker); public abstract void onBounce(Room room, RoomUserRotation oldDirection, RoomUserRotation newDirection, RoomUnit kicker);
public abstract void onStop(Room room, RoomUnit kicker, int currentStep, int totalSteps); public abstract void onStop(Room room, RoomUnit kicker, int currentStep, int totalSteps);
public abstract boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps); public abstract boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps);
}
}

View File

@ -51,4 +51,10 @@ public class InteractionPyramid extends InteractionGate
public void onClick(GameClient client, Room room, Object[] objects) throws Exception public void onClick(GameClient client, Room room, Object[] objects) throws Exception
{ {
} }
@Override
public boolean isUsable()
{
return false;
}
} }

View File

@ -47,4 +47,10 @@ public class InteractionStackHelper extends HabboItem
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -31,4 +31,10 @@ public class InteractionSwitch extends InteractionDefault
{ {
return true; return true;
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -192,4 +192,9 @@ public class InteractionTeleport extends HabboItem
} }
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -129,4 +129,10 @@ public class InteractionVendingMachine extends HabboItem
super.serializeExtradata(serverMessage); super.serializeExtradata(serverMessage);
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -122,4 +122,10 @@ public abstract class InteractionWired extends HabboItem
this.cooldown = newMillis; this.cooldown = newMillis;
return true; return true;
} }
@Override
public boolean isUsable()
{
return true;
}
} }

View File

@ -0,0 +1,218 @@
package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.battlebanzai.BattleBanzaiGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionPushable;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionBattleBanzaiPuck extends InteractionPushable
{
public InteractionBattleBanzaiPuck(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public InteractionBattleBanzaiPuck(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public int getWalkOnVelocity(RoomUnit roomUnit, Room room)
{
return 6;
}
@Override
public RoomUserRotation getWalkOnDirection(RoomUnit roomUnit, Room room)
{
return roomUnit.getBodyRotation();
}
@Override
public int getWalkOffVelocity(RoomUnit roomUnit, Room room)
{
return 0;
}
@Override
public RoomUserRotation getWalkOffDirection(RoomUnit roomUnit, Room room)
{
return roomUnit.getBodyRotation();
}
@Override
public int getDragVelocity(RoomUnit roomUnit, Room room)
{
return 1;
}
@Override
public RoomUserRotation getDragDirection(RoomUnit roomUnit, Room room)
{
return roomUnit.getBodyRotation();
}
@Override
public int getTackleVelocity(RoomUnit roomUnit, Room room)
{
return 6;
}
@Override
public RoomUserRotation getTackleDirection(RoomUnit roomUnit, Room room)
{
return roomUnit.getBodyRotation();
}
@Override
public int getNextRollDelay(int currentStep, int totalSteps)
{
int t = 2500;
return (totalSteps == 1) ? 500 : 100*((t=t/t-1)*t*t*t*t + 1) + (currentStep * 100);
}
@Override
public RoomUserRotation getBounceDirection(Room room, RoomUserRotation currentDirection)
{
switch(currentDirection)
{
default:
case NORTH:
return RoomUserRotation.SOUTH;
case NORTH_EAST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_WEST.getValue())))
return RoomUserRotation.NORTH_WEST;
else if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_EAST.getValue())))
return RoomUserRotation.SOUTH_EAST;
else
return RoomUserRotation.SOUTH_WEST;
case EAST:
return RoomUserRotation.WEST;
case SOUTH_EAST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_WEST.getValue())))
return RoomUserRotation.SOUTH_WEST;
else if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_EAST.getValue())))
return RoomUserRotation.NORTH_EAST;
else
return RoomUserRotation.NORTH_WEST;
case SOUTH:
return RoomUserRotation.NORTH;
case SOUTH_WEST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_EAST.getValue())))
return RoomUserRotation.SOUTH_EAST;
else if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_WEST.getValue())))
return RoomUserRotation.NORTH_WEST;
else
return RoomUserRotation.NORTH_EAST;
case WEST:
return RoomUserRotation.EAST;
case NORTH_WEST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_EAST.getValue())))
return RoomUserRotation.NORTH_EAST;
else if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_WEST.getValue())))
return RoomUserRotation.SOUTH_WEST;
else
return RoomUserRotation.SOUTH_EAST;
}
}
@Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception
{
super.onClick(client, room, objects);
}
@Override
public boolean validMove(Room room, RoomTile from, RoomTile to)
{
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())));
}
@Override
public void onDrag(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction)
{
}
@Override
public void onKick(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction)
{
}
@Override
public void onTackle(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction)
{
}
@Override
public void onMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps)
{
Habbo habbo = room.getHabbo(kicker);
if (habbo != null)
{
BattleBanzaiGame game = (BattleBanzaiGame)room.getGame(BattleBanzaiGame.class);
if (game != null)
{
GameTeam team = game.getTeamForHabbo(habbo);
if (team != null)
{
HabboItem item = room.getTopItemAt(to.x, to.y);
if (item instanceof InteractionBattleBanzaiTile)
{
try
{
item.onWalkOn(kicker, room, null);
} catch (Exception e)
{
return;
}
}
this.setExtradata(team.teamColor.type + 1 + "");
room.updateItemState(this);
}
}
}
//TODO Implement point counting logic.
}
@Override
public void onBounce(Room room, RoomUserRotation oldDirection, RoomUserRotation newDirection, RoomUnit kicker)
{
}
@Override
public void onStop(Room room, RoomUnit kicker, int currentStep, int totalSteps)
{
}
@Override
public boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps)
{
HabboItem topItem = room.getTopItemAt(to.x, to.y);
return topItem != null && to.state == RoomTileState.OPEN && to.isWalkable() && topItem instanceof InteractionBattleBanzaiTile;
}
}

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
@ -67,6 +68,7 @@ public class InteractionBattleBanzaiTeleporter extends HabboItem
if (habbo != null) if (habbo != null)
{ {
this.setExtradata("1"); this.setExtradata("1");
roomUnit.removeStatus(RoomUnitStatus.MOVE);
HabboItem target = room.getRoomSpecialTypes().getRandomTeleporter(); HabboItem target = room.getRoomSpecialTypes().getRandomTeleporter();
while (target == this && room.getRoomSpecialTypes().getBanzaiTeleporters().size() > 1) while (target == this && room.getRoomSpecialTypes().getBanzaiTeleporters().size() > 1)

View File

@ -6,7 +6,10 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionPushable; import com.eu.habbo.habbohotel.items.interactions.InteractionPushable;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem;
import com.eu.habbo.habbohotel.items.interactions.games.football.goals.InteractionFootballGoal; import com.eu.habbo.habbohotel.items.interactions.games.football.goals.InteractionFootballGoal;
import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer; import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import com.eu.habbo.util.pathfinding.Rotation; import com.eu.habbo.util.pathfinding.Rotation;
@ -14,8 +17,10 @@ import com.eu.habbo.util.pathfinding.Rotation;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public class InteractionFootball extends InteractionPushable public class InteractionFootball extends InteractionPushable
{ {
public InteractionFootball(ResultSet set, Item baseItem) throws SQLException public InteractionFootball(ResultSet set, Item baseItem) throws SQLException
{ {
super(set, baseItem); super(set, baseItem);
@ -25,86 +30,74 @@ public class InteractionFootball extends InteractionPushable
{ {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, userId, item, extradata, limitedStack, limitedSells);
} }
@Override @Override
public int getWalkOnVelocity(RoomUnit roomUnit, Room room) public int getWalkOnVelocity(RoomUnit roomUnit, Room room)
{ {
if(roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2) if(roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2)
return 0; return 0;
return 6; return 6;
} }
@Override @Override
public int getWalkOffVelocity(RoomUnit roomUnit, Room room) public int getWalkOffVelocity(RoomUnit roomUnit, Room room)
{ {
return 6; return 6;
} }
@Override @Override
public int getDragVelocity(RoomUnit roomUnit, Room room) public int getDragVelocity(RoomUnit roomUnit, Room room)
{ {
if(roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2) if(roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2)
return 0; return 0;
return 1; return 1;
} }
@Override @Override
public int getTackleVelocity(RoomUnit roomUnit, Room room) public int getTackleVelocity(RoomUnit roomUnit, Room room)
{ {
return 2; return 4;
} }
@Override @Override
public RoomUserRotation getWalkOnDirection(RoomUnit roomUnit, Room room) public RoomUserRotation getWalkOnDirection(RoomUnit roomUnit, Room room)
{ {
return roomUnit.getBodyRotation(); return roomUnit.getBodyRotation();
} }
@Override @Override
public RoomUserRotation getWalkOffDirection(RoomUnit roomUnit, Room room) public RoomUserRotation getWalkOffDirection(RoomUnit roomUnit, Room room)
{ {
RoomTile nextWalkTile = roomUnit.getPath().peek(); RoomTile peek = roomUnit.getPath().peek();
RoomTile nextWalkTile = peek != null ? room.getLayout().getTile(peek.x, peek.y) : roomUnit.getGoal();
if (nextWalkTile == null) return RoomUserRotation.values()[(RoomUserRotation.values().length + Rotation.Calculate(roomUnit.getX(), roomUnit.getY(), nextWalkTile.x, nextWalkTile.y) + 4) % 8];
{
nextWalkTile = roomUnit.getGoal();
}
if (nextWalkTile != null)
{
return RoomUserRotation.values()[(RoomUserRotation.values().length + Rotation.Calculate(roomUnit.getX(), roomUnit.getY(), nextWalkTile.x, nextWalkTile.y) + 4) % 8];
}
else
{
return RoomUserRotation.values()[(roomUnit.getBodyRotation().getValue() + 4) % RoomUserRotation.values().length];
}
} }
public RoomUserRotation getDragDirection(RoomUnit roomUnit, Room room) public RoomUserRotation getDragDirection(RoomUnit roomUnit, Room room)
{ {
return roomUnit.getBodyRotation(); return roomUnit.getBodyRotation();
} }
public RoomUserRotation getTackleDirection(RoomUnit roomUnit, Room room) public RoomUserRotation getTackleDirection(RoomUnit roomUnit, Room room)
{ {
return roomUnit.getBodyRotation(); return roomUnit.getBodyRotation();
} }
@Override @Override
public int getNextRollDelay(int currentStep, int totalSteps) public int getNextRollDelay(int currentStep, int totalSteps)
{ {
int t = 2500; int t = 2500;
return (totalSteps == 1) ? 500 : 100*((t=t/t-1)*t*t*t*t + 1) + (currentStep * 100); return (totalSteps == 1) ? 500 : 100*((t=t/t-1)*t*t*t*t + 1) + (currentStep * 100);
} }
@Override @Override
public RoomUserRotation getBounceDirection(Room room, RoomUserRotation currentDirection) public RoomUserRotation getBounceDirection(Room room, RoomUserRotation currentDirection)
{ {
@ -113,7 +106,7 @@ public class InteractionFootball extends InteractionPushable
default: default:
case NORTH: case NORTH:
return RoomUserRotation.SOUTH; return RoomUserRotation.SOUTH;
case NORTH_EAST: case NORTH_EAST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_WEST.getValue()))) if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_WEST.getValue())))
return RoomUserRotation.NORTH_WEST; return RoomUserRotation.NORTH_WEST;
@ -121,10 +114,10 @@ public class InteractionFootball extends InteractionPushable
return RoomUserRotation.SOUTH_EAST; return RoomUserRotation.SOUTH_EAST;
else else
return RoomUserRotation.SOUTH_WEST; return RoomUserRotation.SOUTH_WEST;
case EAST: case EAST:
return RoomUserRotation.WEST; return RoomUserRotation.WEST;
case SOUTH_EAST: case SOUTH_EAST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_WEST.getValue()))) if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_WEST.getValue())))
return RoomUserRotation.SOUTH_WEST; return RoomUserRotation.SOUTH_WEST;
@ -132,10 +125,10 @@ public class InteractionFootball extends InteractionPushable
return RoomUserRotation.NORTH_EAST; return RoomUserRotation.NORTH_EAST;
else else
return RoomUserRotation.NORTH_WEST; return RoomUserRotation.NORTH_WEST;
case SOUTH: case SOUTH:
return RoomUserRotation.NORTH; return RoomUserRotation.NORTH;
case SOUTH_WEST: case SOUTH_WEST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_EAST.getValue()))) if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.SOUTH_EAST.getValue())))
return RoomUserRotation.SOUTH_EAST; return RoomUserRotation.SOUTH_EAST;
@ -143,10 +136,10 @@ public class InteractionFootball extends InteractionPushable
return RoomUserRotation.NORTH_WEST; return RoomUserRotation.NORTH_WEST;
else else
return RoomUserRotation.NORTH_EAST; return RoomUserRotation.NORTH_EAST;
case WEST: case WEST:
return RoomUserRotation.EAST; return RoomUserRotation.EAST;
case NORTH_WEST: case NORTH_WEST:
if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_EAST.getValue()))) if(this.validMove(room, room.getLayout().getTile(this.getX(), this.getY()), room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), RoomUserRotation.NORTH_EAST.getValue())))
return RoomUserRotation.NORTH_EAST; return RoomUserRotation.NORTH_EAST;
@ -156,95 +149,87 @@ public class InteractionFootball extends InteractionPushable
return RoomUserRotation.SOUTH_EAST; return RoomUserRotation.SOUTH_EAST;
} }
} }
@Override @Override
public boolean validMove(Room room, RoomTile from, RoomTile to) public boolean validMove(Room room, RoomTile from, RoomTile to)
{ {
if (to == null || to.state == RoomTileState.BLOCKED)
return false;
HabboItem topItem = room.getTopItemAt(to.x, to.y, this); 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()))); return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay())));
} }
//Events //Events
@Override @Override
public void onDrag(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction) public void onDrag(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction)
{ {
} }
@Override @Override
public void onKick(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction) public void onKick(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction)
{ {
} }
@Override @Override
public void onTackle(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction) public void onTackle(Room room, RoomUnit roomUnit, int velocity, RoomUserRotation direction)
{ {
} }
@Override @Override
public void onMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps) public void onMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps)
{ {
FootballGame game = (FootballGame)room.getGame(FootballGame.class); FootballGame game = (FootballGame)room.getGame(FootballGame.class);
if (game == null) if (game == null) {
{
try try
{ {
game = FootballGame.class.getDeclaredConstructor(Room.class).newInstance(room); game = FootballGame.class.getDeclaredConstructor(new Class[] { Room.class }).newInstance(new Object[] { room });
room.addGame(game); room.addGame(game);
} }
catch(Exception e) catch (Exception e)
{ {
return; return;
} }
} }
HabboItem currentTopItem = room.getTopItemAt(from.x, from.y, this); HabboItem currentTopItem = room.getTopItemAt(from.x, from.y, this);
HabboItem topItem = room.getTopItemAt(to.x, to.y, this); HabboItem topItem = room.getTopItemAt(to.x, to.y, this);
if ((game != null) && (topItem != null) && ((currentTopItem == null) || (currentTopItem.getId() != topItem.getId())) && ((topItem instanceof InteractionFootballGoal)))
if(game != null && topItem != null && (currentTopItem == null || currentTopItem.getId() != topItem.getId()) && topItem instanceof InteractionFootballGoal)
{ {
GameTeamColors color = ((InteractionGameTeamItem) topItem).teamColor; GameTeamColors color = ((InteractionGameTeamItem)topItem).teamColor;
game.onScore(kicker, color); game.onScore(kicker, color);
} }
this.setExtradata(nextRoll <= 200 ? "8" : (nextRoll <= 250 ? "7" : (nextRoll <= 300 ? "6" : (nextRoll <= 350 ? "5" : (nextRoll <= 400 ? "4" : (nextRoll <= 450 ? "3" : (nextRoll <= 500 ? "2" : "1"))))))); this.setExtradata(nextRoll <= 200 ? "8" : (nextRoll <= 250 ? "7" : (nextRoll <= 300 ? "6" : (nextRoll <= 350 ? "5" : (nextRoll <= 400 ? "4" : (nextRoll <= 450 ? "3" : (nextRoll <= 500 ? "2" : "1")))))));
room.sendComposer(new ItemStateComposer(this).compose()); room.sendComposer(new ItemStateComposer(this).compose());
} }
@Override @Override
public void onBounce(Room room, RoomUserRotation oldDirection, RoomUserRotation newDirection, RoomUnit kicker) public void onBounce(Room room, RoomUserRotation oldDirection, RoomUserRotation newDirection, RoomUnit kicker)
{ {
} }
@Override @Override
public void onStop(Room room, RoomUnit kicker, int currentStep, int totalSteps) public void onStop(Room room, RoomUnit kicker, int currentStep, int totalSteps)
{ {
this.setExtradata("0"); this.setExtradata("0");
room.sendComposer(new ItemStateComposer(this).compose()); room.sendComposer(new ItemStateComposer(this).compose());
} }
@Override @Override
public boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps) public boolean canStillMove(Room room, RoomTile from, RoomTile to, RoomUserRotation direction, RoomUnit kicker, int nextRoll, int currentStep, int totalSteps)
{ {
if (from == null || to == null)
return false;
HabboItem topItem = room.getTopItemAt(from.x, from.y, this); HabboItem topItem = room.getTopItemAt(from.x, from.y, this);
return !(room.hasHabbosAt(to.x, to.y) || (topItem != null && topItem.getBaseItem().getName().startsWith("fball_goal_") && currentStep != 1)); return !(room.hasHabbosAt(to.x, to.y) || (topItem != null && topItem.getBaseItem().getName().startsWith("fball_goal_") && currentStep != 1));
} }
@Override @Override
public void onPickUp(Room room) public void onPickUp(Room room)
{ {
this.setExtradata("0"); this.setExtradata("0");
} }
}
}

View File

@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.games.freeze.FreezeGamePlayer;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
@ -101,7 +102,12 @@ public class InteractionFreezeBlock extends HabboItem
if(game == null || !game.isRunning) if(game == null || !game.isRunning)
return; return;
FreezeGamePlayer player = (FreezeGamePlayer)room.getHabbo(roomUnit).getHabboInfo().getGamePlayer(); Habbo habbo = room.getHabbo(roomUnit);
if (habbo == null || habbo.getHabboInfo().getCurrentGame() != FreezeGame.class)
return;
FreezeGamePlayer player = (FreezeGamePlayer)habbo.getHabboInfo().getGamePlayer();
if(player == null) if(player == null)
return; return;

View File

@ -188,6 +188,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect
@Override @Override
public boolean saveData(ClientMessage packet, GameClient gameClient) public boolean saveData(ClientMessage packet, GameClient gameClient)
{ {
this.items.clear();
packet.readInt(); packet.readInt();
this.startRotation = RoomUserRotation.fromValue(packet.readInt()); this.startRotation = RoomUserRotation.fromValue(packet.readInt());
this.rotateAction = packet.readInt(); this.rotateAction = packet.readInt();

View File

@ -158,10 +158,10 @@ public class WiredEffectGiveReward extends InteractionWiredEffect
message.appendString(s); message.appendString(s);
message.appendInt(4); message.appendInt(4);
message.appendInt(this.rewardTime); message.appendInt(this.rewardTime);
message.appendInt32(this.uniqueRewards); message.appendInt(this.uniqueRewards);
message.appendInt(this.limit); message.appendInt(this.limit);
message.appendInt(this.limitationInterval); message.appendInt(this.limitationInterval);
message.appendInt32(this.limit > 0); message.appendInt(this.limit > 0);
message.appendInt(this.getType().code); message.appendInt(this.getType().code);
message.appendInt(this.getDelay()); message.appendInt(this.getDelay());

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomTileState;
import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
@ -29,6 +30,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
private boolean state = false; private boolean state = false;
private boolean direction = false; private boolean direction = false;
private boolean position = false; private boolean position = false;
public boolean checkForWiredResetPermission = true;
public WiredEffectMatchFurni(ResultSet set, Item baseItem) throws SQLException public WiredEffectMatchFurni(ResultSet set, Item baseItem) throws SQLException
{ {
@ -52,7 +54,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
HabboItem item = room.getHabboItem(setting.itemId); HabboItem item = room.getHabboItem(setting.itemId);
if(item != null) if(item != null)
{ {
if(this.state && item.allowWiredResetState()) if(this.state && (this.checkForWiredResetPermission && item.allowWiredResetState()))
{ {
if(!setting.state.equals(" ")) if(!setting.state.equals(" "))
{ {
@ -73,14 +75,17 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
{ {
RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y); RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y);
if (!room.hasHabbosAt(t.x, t.y)) if (t.state == RoomTileState.OPEN)
{ {
tilesToUpdate.addAll(room.getLayout().getTilesAt(t, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation)); if (!room.hasHabbosAt(t.x, t.y))
{
tilesToUpdate.addAll(room.getLayout().getTilesAt(t, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation));
double offsetZ = setting.z - item.getZ(); double offsetZ = setting.z - item.getZ();
room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose()); room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose());
tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation)); tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation));
}
} }
} }
@ -118,7 +123,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
if (i != null) if (i != null)
{ {
data += item.toString(i.allowWiredResetState()) + ";"; data += item.toString(this.checkForWiredResetPermission && i.allowWiredResetState()) + ";";
} }
} }
} }
@ -232,7 +237,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
HabboItem item = room.getHabboItem(itemId); HabboItem item = room.getHabboItem(itemId);
if (item != null) if (item != null)
this.settings.add(new WiredMatchFurniSetting(item.getId(), item.allowWiredResetState() ? item.getExtradata() : " ", item.getRotation(), item.getX(), item.getY(), item.getZ())); this.settings.add(new WiredMatchFurniSetting(item.getId(), this.checkForWiredResetPermission && item.allowWiredResetState() ? item.getExtradata() : " ", item.getRotation(), item.getX(), item.getY(), item.getZ()));
} }
this.setDelay(packet.readInt()); this.setDelay(packet.readInt());

View File

@ -0,0 +1,21 @@
package com.eu.habbo.habbohotel.items.interactions.wired.effects;
import com.eu.habbo.habbohotel.items.Item;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredEffectMatchFurniStaff extends WiredEffectMatchFurni
{
public WiredEffectMatchFurniStaff(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
this.checkForWiredResetPermission = false;
}
public WiredEffectMatchFurniStaff(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
this.checkForWiredResetPermission = false;
}
}

View File

@ -30,46 +30,48 @@ public class WiredBlob extends InteractionDefault
{ {
super.onWalkOn(roomUnit, room, objects); super.onWalkOn(roomUnit, room, objects);
Habbo habbo = room.getHabbo(roomUnit); if (this.getExtradata().equals("0"))
if (habbo != null)
{ {
int points = Emulator.getConfig().getInt("hotel.item.wiredblob." + this.getBaseItem().getName()); Habbo habbo = room.getHabbo(roomUnit);
if (points == 0) if (habbo != null)
{ {
Emulator.getConfig().register("hotel.item.wiredblob." + this.getBaseItem().getName(), "3000"); int points = Emulator.getConfig().getInt("hotel.item.wiredblob." + this.getBaseItem().getName());
points = 1;
}
boolean triggered = false; if (points == 0)
Game game = room.getGame(habbo.getHabboInfo().getCurrentGame());
if (game != null)
{
GameTeam team = game.getTeamForHabbo(habbo);
if (team != null)
{ {
team.addTeamScore(points); Emulator.getConfig().register("hotel.item.wiredblob." + this.getBaseItem().getName(), "3000");
triggered = true; points = 1;
} }
else
{
GamePlayer player = habbo.getHabboInfo().getGamePlayer();
if (player != null) boolean triggered = false;
Game game = room.getGame(habbo.getHabboInfo().getCurrentGame());
if (game != null)
{
GameTeam team = game.getTeamForHabbo(habbo);
if (team != null)
{ {
player.addScore(points); team.addTeamScore(points);
triggered = true; triggered = true;
} else
{
GamePlayer player = habbo.getHabboInfo().getGamePlayer();
if (player != null)
{
player.addScore(points);
triggered = true;
}
} }
} }
}
if (triggered) if (triggered)
{ {
this.setExtradata("1"); this.setExtradata("1");
room.updateItem(this); room.updateItem(this);
}
} }
} }
} }

View File

@ -12,10 +12,7 @@ import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.outgoing.modtool.ModToolIssueHandledComposer; import com.eu.habbo.messages.outgoing.modtool.ModToolIssueHandledComposer;
import com.eu.habbo.messages.outgoing.modtool.ModToolIssueInfoComposer; import com.eu.habbo.messages.outgoing.modtool.ModToolIssueInfoComposer;
import com.eu.habbo.messages.outgoing.modtool.ModToolUserInfoComposer; import com.eu.habbo.messages.outgoing.modtool.ModToolUserInfoComposer;
import com.eu.habbo.plugin.events.support.SupportRoomActionEvent; import com.eu.habbo.plugin.events.support.*;
import com.eu.habbo.plugin.events.support.SupportTicketEvent;
import com.eu.habbo.plugin.events.support.SupportUserAlertedEvent;
import com.eu.habbo.plugin.events.support.SupportUserBannedEvent;
import com.eu.habbo.threading.runnables.InsertModToolIssue; import com.eu.habbo.threading.runnables.InsertModToolIssue;
import gnu.trove.TCollections; import gnu.trove.TCollections;
import gnu.trove.map.TIntObjectMap; import gnu.trove.map.TIntObjectMap;
@ -693,7 +690,12 @@ public class ModToolManager
public void updateTicketToMods(ModToolIssue issue) public void updateTicketToMods(ModToolIssue issue)
{ {
Emulator.getGameEnvironment().getHabboManager().sendPacketToHabbosWithPermission(new ModToolIssueInfoComposer(issue).compose(), Permission.ACC_SUPPORTTOOL); SupportTicketStatusChangedEvent event = new SupportTicketStatusChangedEvent(null, issue);
if (!Emulator.getPluginManager().fireEvent(event).isCancelled())
{
Emulator.getGameEnvironment().getHabboManager().sendPacketToHabbosWithPermission(new ModToolIssueInfoComposer(issue).compose(), Permission.ACC_SUPPORTTOOL);
}
} }
public void addTicket(ModToolIssue issue) public void addTicket(ModToolIssue issue)

View File

@ -15,15 +15,17 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.text.Normalizer; import java.text.Normalizer;
import java.util.regex.Pattern;
public class WordFilter public class WordFilter
{ {
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean ENABLED_FRIENDCHAT = true; public static boolean ENABLED_FRIENDCHAT = true;
public static String DEFAULT_REPLACEMENT = "bobba";
THashSet<WordFilterWord> autoReportWords = new THashSet<>(); protected THashSet<WordFilterWord> autoReportWords = new THashSet<>();
THashSet<WordFilterWord> hideMessageWords = new THashSet<>(); protected THashSet<WordFilterWord> hideMessageWords = new THashSet<>();
THashSet<WordFilterWord> words = new THashSet<>(); protected THashSet<WordFilterWord> words = new THashSet<>();
public WordFilter() public WordFilter()
{ {
@ -77,8 +79,8 @@ public class WordFilter
public String normalise(String message) public String normalise(String message)
{ {
return Normalizer.normalize(message, Normalizer.Form.NFD) return DIACRITICS_AND_FRIENDS.matcher(Normalizer.normalize(StringUtils.stripAccents(message), Normalizer.Form.NFKD).replaceAll("[,.;:'\"]", "").replace("I", "l")
.replaceAll("[^\\p{ASCII}]", "").replaceAll("\\p{M}", "").replace("1", "i").replace("2", "z").replace("3", "e").replace("4","a").replace("5", "s").replace("8", "b").replace("0", "o"); .replaceAll("[^\\p{ASCII}*$]", "").replaceAll("\\p{M}", "").replaceAll("^\\p{M}*$]", "").replaceAll("[1|]", "i").replace("2", "z").replace("3", "e").replace("4","a").replace("5", "s").replace("8", "b").replace("0", "o").replace(" ", "").replace("$", "s").replace("ß", "b").trim()).replaceAll("");
} }
@ -192,7 +194,7 @@ public class WordFilter
{ {
WordFilterWord word = (WordFilterWord) iterator.next(); WordFilterWord word = (WordFilterWord) iterator.next();
if(message.contains(word.key)) if(StringUtils.containsIgnoreCase(message, word.key))
{ {
if(habbo != null) if(habbo != null)
{ {
@ -210,4 +212,17 @@ public class WordFilter
roomChatMessage.setMessage(message); roomChatMessage.setMessage(message);
} }
} }
private static final Pattern DIACRITICS_AND_FRIENDS = Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+");
private static String stripDiacritics(String str) {
str = Normalizer.normalize(str, Normalizer.Form.NFD);
str = DIACRITICS_AND_FRIENDS.matcher(str).replaceAll("");
return str;
}
public void addWord(WordFilterWord word)
{
this.words.add(word);
}
} }

View File

@ -50,7 +50,7 @@ public class NavigatorHotelFilter extends NavigatorFilter
List<SearchResultList> resultLists = new ArrayList<>(); List<SearchResultList> resultLists = new ArrayList<>();
int i = 0; int i = 0;
for (Map.Entry<Integer, List<Room>> set : Emulator.getGameEnvironment().getRoomManager().findRooms(filterField, value, roomCategory).entrySet()) for (Map.Entry<Integer, List<Room>> set : Emulator.getGameEnvironment().getRoomManager().findRooms(filterField, value, roomCategory, showInvisible).entrySet())
{ {
if (!set.getValue().isEmpty()) if (!set.getValue().isEmpty())
{ {

View File

@ -238,6 +238,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
this.layoutName = set.getString("model"); this.layoutName = set.getString("model");
this.promoted = set.getString("promoted").equals("1"); this.promoted = set.getString("promoted").equals("1");
this.jukeboxActive = set.getString("jukebox_active").equals("1"); this.jukeboxActive = set.getString("jukebox_active").equals("1");
this.hideWired = set.getString("hidewired").equals("1");
this.bannedHabbos = new TIntObjectHashMap<>(); this.bannedHabbos = new TIntObjectHashMap<>();
this.traxItems = new TIntArrayList(); this.traxItems = new TIntArrayList();
@ -536,7 +537,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
} }
b.getRoomUnit().setRoomUnitType(RoomUnitType.BOT); b.getRoomUnit().setRoomUnitType(RoomUnitType.BOT);
b.getRoomUnit().setDanceType(DanceType.values()[set.getInt("dance")]); b.getRoomUnit().setDanceType(DanceType.values()[set.getInt("dance")]);
b.getRoomUnit().setCanWalk(set.getBoolean("freeroam")); //b.getRoomUnit().setCanWalk(set.getBoolean("freeroam"));
b.getRoomUnit().setInRoom(true); b.getRoomUnit().setInRoom(true);
this.addBot(b); this.addBot(b);
} }
@ -614,7 +615,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
if (tile != null) if (tile != null)
{ {
tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false)); tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false));
tile.setWalkable(this.canWalkAt(tile)); tile.setWalkable(this.canWalkAt(tile) || this.canSitAt(tile.x, tile.y));
} }
} }
@ -624,7 +625,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
{ {
this.tileCache.remove(tile); this.tileCache.remove(tile);
tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false)); tile.setStackHeight(this.getStackHeight(tile.x, tile.y, false));
tile.setWalkable(this.canWalkAt(tile)); tile.setWalkable(this.canWalkAt(tile) || this.canSitAt(tile.x, tile.y));
} }
this.sendComposer(new UpdateStackHeightComposer(tiles).compose()); this.sendComposer(new UpdateStackHeightComposer(tiles).compose());
@ -870,6 +871,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
{ {
this.activeTrades.add(trade); this.activeTrades.add(trade);
} }
trade.start();
} }
public void stopTrade(RoomTrade trade) public void stopTrade(RoomTrade trade)
@ -1366,7 +1369,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
newRoller = item; newRoller = item;
stackContainsRoller = true; stackContainsRoller = true;
if (itemsNewTile.size() > 1 && item != topItem) if (item.getZ() != roller.getZ() || (itemsNewTile.size() > 1 && item != topItem))
{ {
allowUsers = false; allowUsers = false;
allowFurniture = false; allowFurniture = false;
@ -1493,6 +1496,25 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
giveHandItem(habbo, 0); giveHandItem(habbo, 0);
} }
if (habbo.getRoomUnit().isKicked)
{
habbo.getRoomUnit().kickCount++;
if (habbo.getRoomUnit().kickCount >= 5)
{
System.out.println("KICKED");
this.scheduledTasks.add(new Runnable()
{
@Override
public void run()
{
Emulator.getGameEnvironment().getRoomManager().leaveRoom(habbo, room);
}
});
continue;
}
}
if (Emulator.getConfig().getBoolean("hotel.rooms.auto.idle")) if (Emulator.getConfig().getBoolean("hotel.rooms.auto.idle"))
{ {
if (!habbo.getRoomUnit().isIdle()) if (!habbo.getRoomUnit().isIdle())
@ -1786,6 +1808,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
if (!unit.hasStatus(RoomUnitStatus.SIT) || unit.sitUpdate) if (!unit.hasStatus(RoomUnitStatus.SIT) || unit.sitUpdate)
{ {
dance(unit, DanceType.NONE); dance(unit, DanceType.NONE);
int tileHeight = layout.getTile(topItem.getX(), topItem.getY()).z;
if (topItem instanceof InteractionMultiHeight) if (topItem instanceof InteractionMultiHeight)
{ {
unit.setStatus(RoomUnitStatus.SIT, (Item.getCurrentHeight(topItem) * 1.0D) + ""); unit.setStatus(RoomUnitStatus.SIT, (Item.getCurrentHeight(topItem) * 1.0D) + "");
@ -1794,10 +1817,11 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
{ {
unit.setStatus(RoomUnitStatus.SIT, (topItem.getBaseItem().getHeight() * 1.0D) + ""); unit.setStatus(RoomUnitStatus.SIT, (topItem.getBaseItem().getHeight() * 1.0D) + "");
} }
unit.setZ(topItem.getZ()); unit.setPreviousLocationZ(topItem.getZ());
unit.setRotation(RoomUserRotation.values()[topItem.getRotation()]); unit.setRotation(RoomUserRotation.values()[topItem.getRotation()]);
update = true; update = true;
unit.sitUpdate = false; unit.sitUpdate = false;
return true;
} }
} }
} }
@ -3166,10 +3190,13 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
pet.setRoomUnit(new RoomUnit()); pet.setRoomUnit(new RoomUnit());
pet.setRoom(this); pet.setRoom(this);
pet.getRoomUnit().setGoalLocation(tile);
pet.getRoomUnit().setLocation(tile); pet.getRoomUnit().setLocation(tile);
pet.getRoomUnit().setRoomUnitType(RoomUnitType.PET); pet.getRoomUnit().setRoomUnitType(RoomUnitType.PET);
pet.getRoomUnit().setCanWalk(true); pet.getRoomUnit().setCanWalk(true);
pet.getRoomUnit().setPathFinderRoom(this); pet.getRoomUnit().setPathFinderRoom(this);
pet.getRoomUnit().setPreviousLocationZ(z);
pet.getRoomUnit().setZ(z);
if (pet.getRoomUnit().getCurrentLocation() == null) if (pet.getRoomUnit().getCurrentLocation() == null)
{ {
pet.getRoomUnit().setLocation(this.getLayout().getDoorTile()); pet.getRoomUnit().setLocation(this.getLayout().getDoorTile());
@ -3464,7 +3491,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
{ {
if (h == roomChatMessage.getTargetHabbo() || h == habbo) if (h == roomChatMessage.getTargetHabbo() || h == habbo)
{ {
if (!h.getHabboStats().ignoredUsers.contains(habbo.getHabboInfo().getId())) if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()))
{ {
if (prefixMessage != null) if (prefixMessage != null)
{ {
@ -3501,7 +3528,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
this.hasRights(h) || this.hasRights(h) ||
noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation())))
{ {
if (!h.getHabboStats().ignoredUsers.contains(habbo.getHabboInfo().getId())) if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()))
{ {
if (prefixMessage != null) if (prefixMessage != null)
{ {
@ -3522,7 +3549,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
for (Habbo h : this.getHabbos()) for (Habbo h : this.getHabbos())
{ {
if (!h.getHabboStats().ignoredUsers.contains(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation())))
{ {
if (prefixMessage != null){ h.getClient().sendResponse(prefixMessage); } if (prefixMessage != null){ h.getClient().sendResponse(prefixMessage); }
h.getClient().sendResponse(message); h.getClient().sendResponse(message);
@ -4153,16 +4180,19 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
if((lowestSitItem == null || lowestSitItem.getZ() > item.getZ()) && item.getBaseItem().allowSit()) if((lowestSitItem == null || lowestSitItem.getZ() > item.getZ()) && item.getBaseItem().allowSit())
{ {
lowestSitItem = item; lowestSitItem = item;
canSitUnder = true;
} }
if(lowestSitItem != null) if(lowestSitItem != null && canSitUnder)
{ {
if(item.getZ() > lowestSitItem.getZ()) if (item != lowestSitItem)
{ {
if(item.getZ() - lowestSitItem.getZ() > 0.8) double distance = item.getZ() - lowestSitItem.getZ();
canSitUnder = true;
else if (distance >= 0 && distance < 0.8)
{
canSitUnder = false; canSitUnder = false;
}
} }
} }
@ -4213,7 +4243,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
RoomTile tile = this.layout.getTile((short) (Math.random() * this.layout.getMapSizeX()), (short) (Math.random() * this.layout.getMapSizeY())); RoomTile tile = this.layout.getTile((short) (Math.random() * this.layout.getMapSizeX()), (short) (Math.random() * this.layout.getMapSizeY()));
if (tile.isWalkable() || this.canSitAt(tile.x, tile.y)) if (tile.isWalkable())
{ {
return tile; return tile;
} }

View File

@ -1,31 +1,33 @@
package com.eu.habbo.habbohotel.rooms; package com.eu.habbo.habbohotel.rooms;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.core.Loggable;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.Incoming; import com.eu.habbo.messages.incoming.Incoming;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class RoomChatMessage implements Runnable, ISerialize public class RoomChatMessage implements Runnable, ISerialize, Loggable
{ {
public static String insertQuery = "INSERT INTO chatlogs_room (user_from_id, user_to_id, message, timestamp, room_id) VALUES (?, ?, ?, ?, ?)";
public static int MAXIMUM_LENGTH = 100; public static int MAXIMUM_LENGTH = 100;
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean SAVE_ROOM_CHATS = false; public static boolean SAVE_ROOM_CHATS = false;
public static int[] BANNED_BUBBLES = {}; public static int[] BANNED_BUBBLES = {};
private int roomUnitId;
private String message; private String message;
private String unfilteredMessage; private String unfilteredMessage;
private RoomChatMessageBubbles bubble; private RoomChatMessageBubbles bubble;
private final Habbo habbo; private final Habbo habbo;
public int roomId;
private Habbo targetHabbo; private Habbo targetHabbo;
private final RoomUnit roomUnit;
private byte emotion; private byte emotion;
public boolean isCommand = false; public boolean isCommand = false;
public boolean filtered = false; public boolean filtered = false;
@ -65,7 +67,7 @@ public class RoomChatMessage implements Runnable, ISerialize
this.unfilteredMessage = this.message; this.unfilteredMessage = this.message;
this.habbo = message.client.getHabbo(); this.habbo = message.client.getHabbo();
this.roomUnit = habbo.getRoomUnit(); this.roomUnitId = habbo.getRoomUnit().getId();
this.checkEmotion(); this.checkEmotion();
@ -79,7 +81,7 @@ public class RoomChatMessage implements Runnable, ISerialize
this.habbo = chatMessage.getHabbo(); this.habbo = chatMessage.getHabbo();
this.targetHabbo = chatMessage.getTargetHabbo(); this.targetHabbo = chatMessage.getTargetHabbo();
this.bubble = chatMessage.getBubble(); this.bubble = chatMessage.getBubble();
this.roomUnit = chatMessage.roomUnit; this.roomUnitId = chatMessage.roomUnitId;
this.emotion = (byte)chatMessage.getEmotion(); this.emotion = (byte)chatMessage.getEmotion();
} }
@ -89,7 +91,7 @@ public class RoomChatMessage implements Runnable, ISerialize
this.unfilteredMessage = message; this.unfilteredMessage = message;
this.habbo = null; this.habbo = null;
this.bubble = bubble; this.bubble = bubble;
this.roomUnit = roomUnit; this.roomUnitId = roomUnit.getId();
} }
public RoomChatMessage(String message, Habbo habbo, RoomChatMessageBubbles bubble) public RoomChatMessage(String message, Habbo habbo, RoomChatMessageBubbles bubble)
@ -99,7 +101,7 @@ public class RoomChatMessage implements Runnable, ISerialize
this.habbo = habbo; this.habbo = habbo;
this.bubble = bubble; this.bubble = bubble;
this.checkEmotion(); this.checkEmotion();
this.roomUnit = habbo.getRoomUnit(); this.roomUnitId = habbo.getRoomUnit().getId();
this.message = this.message.replace("\r", "").replace("\n", ""); this.message = this.message.replace("\r", "").replace("\n", "");
if(this.bubble.isOverridable() && this.getHabbo().getHabboStats().chatColor != RoomChatMessageBubbles.NORMAL) if(this.bubble.isOverridable() && this.getHabbo().getHabboStats().chatColor != RoomChatMessageBubbles.NORMAL)
@ -114,7 +116,7 @@ public class RoomChatMessage implements Runnable, ISerialize
this.targetHabbo = targetHabbo; this.targetHabbo = targetHabbo;
this.bubble = bubble; this.bubble = bubble;
this.checkEmotion(); this.checkEmotion();
this.roomUnit = this.habbo.getRoomUnit(); this.roomUnitId = this.habbo.getRoomUnit().getId();
this.message = this.message.replace("\r", "").replace("\n", ""); this.message = this.message.replace("\r", "").replace("\n", "");
if(this.bubble.isOverridable() && this.getHabbo().getHabboStats().chatColor != RoomChatMessageBubbles.NORMAL) if(this.bubble.isOverridable() && this.getHabbo().getHabboStats().chatColor != RoomChatMessageBubbles.NORMAL)
@ -147,48 +149,18 @@ public class RoomChatMessage implements Runnable, ISerialize
if(habbo == null) if(habbo == null)
return; return;
if(SAVE_ROOM_CHATS) if(this.message.length() > RoomChatMessage.MAXIMUM_LENGTH)
{ {
if(this.message.length() > 255) try
{ {
try this.message = this.message.substring(0, RoomChatMessage.MAXIMUM_LENGTH-1);
{
this.message = this.message.substring(0, 254);
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
}
} }
catch (Exception e)
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO chatlogs_room (user_from_id, user_to_id, message, timestamp, room_id) VALUES (?, ?, ?, ?, ?)"))
{ {
statement.setInt(1,this.habbo.getHabboInfo().getId()); Emulator.getLogging().logErrorLine(e);
if(this.targetHabbo != null)
statement.setInt(2, this.targetHabbo.getHabboInfo().getId());
else
statement.setInt(2, 0);
statement.setString(3, this.unfilteredMessage);
statement.setInt(4, Emulator.getIntUnixTimestamp());
if(this.habbo.getHabboInfo().getCurrentRoom() != null)
{
statement.setInt(5, this.habbo.getHabboInfo().getCurrentRoom().getId());
}
else
{
statement.setInt(5, 0);
}
statement.executeUpdate();
}
catch(SQLException e)
{
Emulator.getLogging().logSQLException(e);
} }
} }
Emulator.getLogging().addChatLog(this);
} }
public String getMessage() public String getMessage()
@ -253,7 +225,7 @@ public class RoomChatMessage implements Runnable, ISerialize
try try
{ {
message.appendInt(this.roomUnit.getId()); message.appendInt(this.roomUnitId);
message.appendString(this.getMessage()); message.appendString(this.getMessage());
message.appendInt(this.getEmotion()); message.appendInt(this.getEmotion());
message.appendInt(this.getBubble().getType()); message.appendInt(this.getBubble().getType());
@ -296,4 +268,29 @@ public class RoomChatMessage implements Runnable, ISerialize
} }
} }
} }
@Override
public void log(PreparedStatement statement) throws SQLException
{
statement.setInt(1,this.habbo.getHabboInfo().getId());
if(this.targetHabbo != null)
statement.setInt(2, this.targetHabbo.getHabboInfo().getId());
else
statement.setInt(2, 0);
statement.setString(3, this.unfilteredMessage);
statement.setInt(4, Emulator.getIntUnixTimestamp());
if(this.habbo.getHabboInfo().getCurrentRoom() != null)
{
statement.setInt(5, this.habbo.getHabboInfo().getCurrentRoom().getId());
}
else
{
statement.setInt(5, 0);
}
statement.addBatch();
}
} }

View File

@ -293,7 +293,7 @@ public class RoomLayout
double height = (room.getLayout().getStackHeightAtSquare(currentAdj.x, currentAdj.y) - room.getLayout().getStackHeightAtSquare(current.x, current.y)); double height = (room.getLayout().getStackHeightAtSquare(currentAdj.x, currentAdj.y) - room.getLayout().getStackHeightAtSquare(current.x, current.y));
if ((!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) || (height - (room.canSitAt(currentAdj.x, currentAdj.y) ? 0.5 : 0) > MAXIMUM_STEP_HEIGHT && !room.canLayAt(currentAdj.x, currentAdj.y))) if ((!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) || ((!room.canSitAt(currentAdj.x, currentAdj.y) && height > MAXIMUM_STEP_HEIGHT) && !room.canLayAt(currentAdj.x, currentAdj.y)))
continue; continue;
if (!this.room.isAllowWalkthrough() && room.hasHabbosAt(currentAdj.x, currentAdj.y)) continue; if (!this.room.isAllowWalkthrough() && room.hasHabbosAt(currentAdj.x, currentAdj.y)) continue;

View File

@ -86,7 +86,7 @@ public class RoomManager
public CustomRoomLayout loadCustomLayout(Room room) public CustomRoomLayout loadCustomLayout(Room room)
{ {
RoomLayout layout = null; CustomRoomLayout layout = null;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_models_custom WHERE id = ? LIMIT 1")) try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM room_models_custom WHERE id = ? LIMIT 1"))
{ {
statement.setInt(1, room.getId()); statement.setInt(1, room.getId());
@ -103,7 +103,7 @@ public class RoomManager
Emulator.getLogging().logSQLException(e); Emulator.getLogging().logSQLException(e);
} }
return (CustomRoomLayout) layout; return layout;
} }
private void loadRoomCategories() private void loadRoomCategories()
@ -146,10 +146,10 @@ public class RoomManager
} }
private static final int page = 0; private static final int page = 0;
public THashMap<Integer, List<Room>> findRooms(NavigatorFilterField filterField, String value, int category) public THashMap<Integer, List<Room>> findRooms(NavigatorFilterField filterField, String value, int category, boolean showInvisible)
{ {
THashMap<Integer, List<Room>> rooms = new THashMap<>(); THashMap<Integer, List<Room>> rooms = new THashMap<>();
String query = filterField.databaseQuery + " AND rooms.state != 'invisible' " + (category >= 0 ? "AND rooms.category = '" + category + "'" : "") + " ORDER BY rooms.users, rooms.id DESC LIMIT " + (page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + "" + ((page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + NavigatorManager.MAXIMUM_RESULTS_PER_PAGE); String query = filterField.databaseQuery + " AND rooms.state NOT LIKE " + (showInvisible ? "''" : "'invisible'") + (category >= 0 ? "AND rooms.category = '" + category + "'" : "") + " ORDER BY rooms.users, rooms.id DESC LIMIT " + (page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + "" + ((page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + NavigatorManager.MAXIMUM_RESULTS_PER_PAGE);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query))
{ {
statement.setString(1, (filterField.comparator == NavigatorFilterComparator.EQUALS ? value : "%" + value + "%")); statement.setString(1, (filterField.comparator == NavigatorFilterComparator.EQUALS ? value : "%" + value + "%"));
@ -951,7 +951,7 @@ public class RoomManager
habbo.getClient().sendResponse(new RoomUnitIdleComposer(roomHabbo.getRoomUnit())); habbo.getClient().sendResponse(new RoomUnitIdleComposer(roomHabbo.getRoomUnit()));
} }
if (roomHabbo.getHabboStats().ignoredUsers.contains(habbo.getHabboInfo().getId())) if (roomHabbo.getHabboStats().userIgnored(habbo.getHabboInfo().getId()))
{ {
roomHabbo.getClient().sendResponse(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.IGNORED)); roomHabbo.getClient().sendResponse(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.IGNORED));
} }
@ -960,7 +960,7 @@ public class RoomManager
{ {
habbo.getClient().sendResponse(new RoomUserIgnoredComposer(roomHabbo, RoomUserIgnoredComposer.MUTED)); habbo.getClient().sendResponse(new RoomUserIgnoredComposer(roomHabbo, RoomUserIgnoredComposer.MUTED));
} }
else if (habbo.getHabboStats().ignoredUsers.contains(roomHabbo.getHabboInfo().getId())) else if (habbo.getHabboStats().userIgnored(roomHabbo.getHabboInfo().getId()))
{ {
habbo.getClient().sendResponse(new RoomUserIgnoredComposer(roomHabbo, RoomUserIgnoredComposer.IGNORED)); habbo.getClient().sendResponse(new RoomUserIgnoredComposer(roomHabbo, RoomUserIgnoredComposer.IGNORED));
} }
@ -1029,7 +1029,7 @@ public class RoomManager
WiredHandler.handle(WiredTriggerType.ENTER_ROOM, habbo.getRoomUnit(), room, null); WiredHandler.handle(WiredTriggerType.ENTER_ROOM, habbo.getRoomUnit(), room, null);
room.habboEntered(habbo); room.habboEntered(habbo);
if (!habbo.getHabboStats().nux && room.isOwner(habbo)) if (!habbo.getHabboStats().nux && (room.isOwner(habbo) || room.isPublicRoom()))
{ {
UserNuxEvent.handle(habbo); UserNuxEvent.handle(habbo);
} }

View File

@ -18,6 +18,7 @@ public class RoomTrade
{ {
//Configuration. Loaded from database & updated accordingly. //Configuration. Loaded from database & updated accordingly.
public static boolean TRADING_ENABLED = true; public static boolean TRADING_ENABLED = true;
public static boolean TRADING_REQUIRES_PERK = true;
private final List<RoomTradeUser> users; private final List<RoomTradeUser> users;
private boolean tradeCompleted; private boolean tradeCompleted;
@ -31,8 +32,16 @@ public class RoomTrade
this.users.add(new RoomTradeUser(userOne)); this.users.add(new RoomTradeUser(userOne));
this.users.add(new RoomTradeUser(userTwo)); this.users.add(new RoomTradeUser(userTwo));
this.room = room; this.room = room;
}
public void start()
{
this.initializeTradeStatus();
this.openTrade();
}
protected void initializeTradeStatus()
{
for(RoomTradeUser roomTradeUser : this.users) for(RoomTradeUser roomTradeUser : this.users)
{ {
if(!roomTradeUser.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.TRADING)) if(!roomTradeUser.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.TRADING))
@ -42,7 +51,10 @@ public class RoomTrade
room.sendComposer(new RoomUserStatusComposer(roomTradeUser.getHabbo().getRoomUnit()).compose()); room.sendComposer(new RoomUserStatusComposer(roomTradeUser.getHabbo().getRoomUnit()).compose());
} }
} }
}
protected void openTrade()
{
sendMessageToUsers(new TradeStartComposer(this)); sendMessageToUsers(new TradeStartComposer(this));
} }
@ -53,6 +65,7 @@ public class RoomTrade
if(user.getItems().contains(item)) if(user.getItems().contains(item))
return; return;
habbo.getInventory().getItemsComponent().removeHabboItem(item);
user.getItems().add(item); user.getItems().add(item);
clearAccepted(); clearAccepted();
@ -67,6 +80,7 @@ public class RoomTrade
{ {
if(!user.getItems().contains(item)) if(!user.getItems().contains(item))
{ {
habbo.getInventory().getItemsComponent().removeHabboItem(item);
user.getItems().add(item); user.getItems().add(item);
} }
} }
@ -82,6 +96,7 @@ public class RoomTrade
if(!user.getItems().contains(item)) if(!user.getItems().contains(item))
return; return;
habbo.getInventory().getItemsComponent().addItem(item);
user.getItems().remove(item); user.getItems().remove(item);
clearAccepted(); clearAccepted();
@ -103,7 +118,7 @@ public class RoomTrade
} }
if(accepted) if(accepted)
{ {
sendMessageToUsers(new TradingWaitingConfirmComposer()); this.sendMessageToUsers(new TradingWaitingConfirmComposer());
} }
} }
@ -113,7 +128,7 @@ public class RoomTrade
user.confirm(); user.confirm();
sendMessageToUsers(new TradeAcceptedComposer(user)); this.sendMessageToUsers(new TradeAcceptedComposer(user));
boolean accepted = true; boolean accepted = true;
for(RoomTradeUser roomTradeUser : this.users) for(RoomTradeUser roomTradeUser : this.users)
{ {
@ -124,9 +139,10 @@ public class RoomTrade
{ {
if (tradeItems()) if (tradeItems())
{ {
closeWindow(); this.closeWindow();
sendMessageToUsers(new TradeCompleteComposer()); this.sendMessageToUsers(new TradeCompleteComposer());
} }
this.room.stopTrade(this); this.room.stopTrade(this);
} }
} }
@ -137,9 +153,9 @@ public class RoomTrade
{ {
for(HabboItem item : roomTradeUser.getItems()) for(HabboItem item : roomTradeUser.getItems())
{ {
if(roomTradeUser.getHabbo().getInventory().getItemsComponent().getHabboItem(item.getId()) == null) if(roomTradeUser.getHabbo().getInventory().getItemsComponent().getHabboItem(item.getId()) != null)
{ {
sendMessageToUsers(new TradeClosedComposer(roomTradeUser.getHabbo().getRoomUnit().getId(), TradeClosedComposer.ITEMS_NOT_FOUND)); this.sendMessageToUsers(new TradeClosedComposer(roomTradeUser.getHabbo().getRoomUnit().getId(), TradeClosedComposer.ITEMS_NOT_FOUND));
return false; return false;
} }
} }
@ -188,8 +204,6 @@ public class RoomTrade
item.setUserId(userTwoId); item.setUserId(userTwoId);
statement.setInt(1, userTwoId); statement.setInt(1, userTwoId);
statement.setInt(2, item.getId()); statement.setInt(2, item.getId());
userOne.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
userTwo.getHabbo().getInventory().getItemsComponent().addItem(item);
statement.addBatch(); statement.addBatch();
if (logTrades) if (logTrades)
@ -206,8 +220,6 @@ public class RoomTrade
item.setUserId(userOneId); item.setUserId(userOneId);
statement.setInt(1, userOneId); statement.setInt(1, userOneId);
statement.setInt(2, item.getId()); statement.setInt(2, item.getId());
userTwo.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
userOne.getHabbo().getInventory().getItemsComponent().addItem(item);
statement.addBatch(); statement.addBatch();
if (logTrades) if (logTrades)
@ -233,15 +245,24 @@ public class RoomTrade
Emulator.getLogging().logSQLException(e); Emulator.getLogging().logSQLException(e);
} }
userOne.getHabbo().getClient().sendResponse(new AddHabboItemComposer(userTwo.getItems())); THashSet<HabboItem> itemsUserOne = new THashSet<>(userOne.getItems());
userTwo.getHabbo().getClient().sendResponse(new AddHabboItemComposer(userOne.getItems())); THashSet<HabboItem> itemsUserTwo = new THashSet<>(userTwo.getItems());
userOne.clearItems();
userTwo.clearItems();
userOne.getHabbo().getInventory().getItemsComponent().addItems(itemsUserTwo);
userTwo.getHabbo().getInventory().getItemsComponent().addItems(itemsUserOne);
userOne.getHabbo().getClient().sendResponse(new AddHabboItemComposer(itemsUserTwo));
userTwo.getHabbo().getClient().sendResponse(new AddHabboItemComposer(itemsUserOne));
userOne.getHabbo().getClient().sendResponse(new InventoryRefreshComposer()); userOne.getHabbo().getClient().sendResponse(new InventoryRefreshComposer());
userTwo.getHabbo().getClient().sendResponse(new InventoryRefreshComposer()); userTwo.getHabbo().getClient().sendResponse(new InventoryRefreshComposer());
return true; return true;
} }
void clearAccepted() protected void clearAccepted()
{ {
for(RoomTradeUser user : this.users) for(RoomTradeUser user : this.users)
{ {
@ -249,15 +270,21 @@ public class RoomTrade
} }
} }
void updateWindow() protected void updateWindow()
{ {
this.sendMessageToUsers(new TradeUpdateComposer(this)); this.sendMessageToUsers(new TradeUpdateComposer(this));
} }
private void returnItems()
{
for (RoomTradeUser user : this.users)
{
user.putItemsIntoInventory();
}
}
private void closeWindow() private void closeWindow()
{ {
removeStatusses(); removeStatusses();
sendMessageToUsers(new TradeCloseWindowComposer()); sendMessageToUsers(new TradeCloseWindowComposer());
} }
@ -265,6 +292,7 @@ public class RoomTrade
{ {
this.removeStatusses(); this.removeStatusses();
this.clearAccepted(); this.clearAccepted();
this.returnItems();
for (RoomTradeUser user : this.users) for (RoomTradeUser user : this.users)
{ {
user.clearItems(); user.clearItems();
@ -298,7 +326,7 @@ public class RoomTrade
return null; return null;
} }
void sendMessageToUsers(MessageComposer message) public void sendMessageToUsers(MessageComposer message)
{ {
for(RoomTradeUser roomTradeUser : this.users) for(RoomTradeUser roomTradeUser : this.users)
{ {

View File

@ -6,6 +6,7 @@ import gnu.trove.set.hash.THashSet;
public class RoomTradeUser public class RoomTradeUser
{ {
private int userId;
private final Habbo habbo; private final Habbo habbo;
private boolean accepted; private boolean accepted;
private boolean confirmed; private boolean confirmed;
@ -14,11 +15,27 @@ public class RoomTradeUser
public RoomTradeUser(Habbo habbo) public RoomTradeUser(Habbo habbo)
{ {
this.habbo = habbo; this.habbo = habbo;
if (this.habbo != null)
{
this.userId = this.habbo.getHabboInfo().getId();
}
this.accepted = false; this.accepted = false;
this.confirmed = false; this.confirmed = false;
this.items = new THashSet<>(); this.items = new THashSet<>();
} }
public int getUserId()
{
return this.userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
public Habbo getHabbo() public Habbo getHabbo()
{ {
return this.habbo; return this.habbo;
@ -49,11 +66,29 @@ public class RoomTradeUser
this.items.add(item); this.items.add(item);
} }
public HabboItem getItem(int itemId)
{
for (HabboItem item : this.items)
{
if (item.getId() == itemId)
{
return item;
}
}
return null;
}
public THashSet<HabboItem> getItems() public THashSet<HabboItem> getItems()
{ {
return this.items; return this.items;
} }
public void putItemsIntoInventory()
{
this.habbo.getInventory().getItemsComponent().addItems(this.items);
}
public void clearItems() public void clearItems()
{ {
this.items.clear(); this.items.clear();

View File

@ -30,6 +30,7 @@ public class RoomUnit
private int id; private int id;
private RoomTile startLocation; private RoomTile startLocation;
private RoomTile previousLocation; private RoomTile previousLocation;
private double previousLocationZ;
private RoomTile currentLocation; private RoomTile currentLocation;
private RoomTile goalLocation; private RoomTile goalLocation;
@ -47,6 +48,7 @@ public class RoomUnit
public boolean sitUpdate = false; public boolean sitUpdate = false;
public boolean isTeleporting = false; public boolean isTeleporting = false;
public boolean isKicked = false; public boolean isKicked = false;
public int kickCount = 0;
private boolean statusUpdate = false; private boolean statusUpdate = false;
private boolean invisible = false; private boolean invisible = false;
@ -143,7 +145,7 @@ public class RoomUnit
{ {
this.sitUpdate = true; this.sitUpdate = true;
if (room.hasHabbosAt(next.x, next.y)) if ( room.hasHabbosAt(next.x, next.y))
{ {
return false; return false;
} }
@ -305,7 +307,9 @@ public class RoomUnit
zHeight += room.getLayout().getHeightAtSquare(next.x, next.y); zHeight += room.getLayout().getHeightAtSquare(next.x, next.y);
} }
this.previousLocation = this.currentLocation;
this.setPreviousLocation(this.getCurrentLocation());
this.setStatus(RoomUnitStatus.MOVE, next.x + "," + next.y + "," + zHeight); this.setStatus(RoomUnitStatus.MOVE, next.x + "," + next.y + "," + zHeight);
if (habbo != null) if (habbo != null)
{ {
@ -523,9 +527,20 @@ public class RoomUnit
return this.previousLocation; return this.previousLocation;
} }
public double getPreviousLocationZ()
{
return this.previousLocationZ;
}
public void setPreviousLocationZ(double z)
{
this.previousLocationZ = z;
}
public void setPreviousLocation(RoomTile previousLocation) public void setPreviousLocation(RoomTile previousLocation)
{ {
this.previousLocation = previousLocation; this.previousLocation = previousLocation;
this.previousLocationZ = this.z;
} }
public void setPathFinderRoom(Room room) public void setPathFinderRoom(Room room)
@ -556,8 +571,6 @@ public class RoomUnit
return !isAtGoal() && this.canWalk; return !isAtGoal() && this.canWalk;
} }
public String getStatus(RoomUnitStatus key) public String getStatus(RoomUnitStatus key)
{ {
return this.status.get(key); return this.status.get(key);

View File

@ -14,18 +14,19 @@ import com.eu.habbo.messages.outgoing.generic.alerts.StaffAlertWithLinkComposer;
import com.eu.habbo.messages.outgoing.inventory.*; import com.eu.habbo.messages.outgoing.inventory.*;
import com.eu.habbo.messages.outgoing.rooms.FloodCounterComposer; import com.eu.habbo.messages.outgoing.rooms.FloodCounterComposer;
import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer; import com.eu.habbo.messages.outgoing.rooms.ForwardToRoomComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserIgnoredComposer; import com.eu.habbo.messages.outgoing.rooms.users.*;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserShoutComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserTalkComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
import com.eu.habbo.messages.outgoing.users.*; import com.eu.habbo.messages.outgoing.users.*;
import com.eu.habbo.plugin.events.users.UserCreditsEvent; import com.eu.habbo.plugin.events.users.UserCreditsEvent;
import com.eu.habbo.plugin.events.users.UserDisconnectEvent; import com.eu.habbo.plugin.events.users.UserDisconnectEvent;
import com.eu.habbo.plugin.events.users.UserPointsEvent; import com.eu.habbo.plugin.events.users.UserPointsEvent;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Habbo implements Runnable public class Habbo implements Runnable
{ {
@ -151,7 +152,7 @@ public class Habbo implements Runnable
Emulator.getPluginManager().fireEvent(new UserDisconnectEvent(this)); Emulator.getPluginManager().fireEvent(new UserDisconnectEvent(this));
} }
if(this.disconnected || this.disconnecting) if (this.disconnected || this.disconnecting)
return; return;
this.disconnecting = true; this.disconnecting = true;
@ -171,8 +172,7 @@ public class Habbo implements Runnable
room.removeFromQueue(this); room.removeFromQueue(this);
} }
} }
} } catch (Exception e)
catch (Exception e)
{ {
Emulator.getLogging().logErrorLine(e); Emulator.getLogging().logErrorLine(e);
} }
@ -190,13 +190,11 @@ public class Habbo implements Runnable
AchievementManager.saveAchievements(this); AchievementManager.saveAchievements(this);
this.habboStats.dispose(); this.habboStats.dispose();
} } catch (Exception e)
catch (Exception e)
{ {
Emulator.getLogging().logErrorLine(e); Emulator.getLogging().logErrorLine(e);
return; return;
} } finally
finally
{ {
Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this); Emulator.getGameEnvironment().getRoomManager().unloadRoomsForHabbo(this);
Emulator.getGameEnvironment().getHabboManager().removeHabbo(this); Emulator.getGameEnvironment().getHabboManager().removeHabbo(this);
@ -204,10 +202,11 @@ public class Habbo implements Runnable
Emulator.getLogging().logUserLine(this.habboInfo.getUsername() + " disconnected."); Emulator.getLogging().logUserLine(this.habboInfo.getUsername() + " disconnected.");
this.client = null; this.client = null;
} }
@Override @Override
public void run() public void run()
{ {
if(this.needsUpdate()) if (this.needsUpdate())
{ {
this.habboInfo.run(); this.habboInfo.run();
this.needsUpdate(false); this.needsUpdate(false);
@ -472,4 +471,46 @@ public class Habbo implements Runnable
return 0; return 0;
} }
public void clearCaches()
{
int timestamp = Emulator.getIntUnixTimestamp();
THashMap<Integer, List<Integer>> newLog = new THashMap<>();
for (Map.Entry<Integer, List<Integer>> ltdLog : this.habboStats.ltdPurchaseLog.entrySet())
{
for (Integer time : ltdLog.getValue())
{
if (time > timestamp)
{
if (!newLog.containsKey(ltdLog.getKey()))
{
newLog.put(ltdLog.getKey(), new ArrayList<Integer>());
}
newLog.get(ltdLog.getKey()).add(time);
}
}
}
this.habboStats.ltdPurchaseLog = newLog;
}
public void respect(Habbo target)
{
if(target != null && target != this.client.getHabbo())
{
target.getHabboStats().respectPointsReceived++;
this.client.getHabbo().getHabboStats().respectPointsGiven++;
this.client.getHabbo().getHabboStats().respectPointsToGive--;
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserRespectComposer(target).compose());
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserActionComposer(this.client.getHabbo().getRoomUnit(), RoomUserAction.THUMB_UP).compose());
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectGiven"));
AchievementManager.progressAchievement(target, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned"));
this.client.getHabbo().getHabboInfo().getCurrentRoom().unIdle(this.client.getHabbo());
}
}
} }

View File

@ -77,8 +77,8 @@ public abstract class HabboItem implements Runnable, IEventTriggers
{ {
serverMessage.appendInt(this.getId()); serverMessage.appendInt(this.getId());
serverMessage.appendInt(this.baseItem.getSpriteId()); serverMessage.appendInt(this.baseItem.getSpriteId());
serverMessage.appendInt32(this.x); serverMessage.appendInt(this.x);
serverMessage.appendInt32(this.y); serverMessage.appendInt(this.y);
serverMessage.appendInt(getRotation()); serverMessage.appendInt(getRotation());
serverMessage.appendString(Double.toString(this.z)); serverMessage.appendString(Double.toString(this.z));
@ -423,4 +423,9 @@ public abstract class HabboItem implements Runnable, IEventTriggers
{ {
return false; return false;
} }
public boolean isUsable()
{
return this.baseItem.getStateCount() > 1;
}
} }

View File

@ -5,8 +5,12 @@ import com.eu.habbo.habbohotel.achievements.Achievement;
import com.eu.habbo.habbohotel.achievements.TalentTrackType; import com.eu.habbo.habbohotel.achievements.TalentTrackType;
import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogItem;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.rooms.RoomTrade;
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
import gnu.trove.list.array.TIntArrayList; import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.stack.array.TIntArrayStack; import gnu.trove.stack.array.TIntArrayStack;
import java.sql.Connection; import java.sql.Connection;
@ -35,7 +39,7 @@ public class HabboStats implements Runnable
public boolean blockFriendRequests; public boolean blockFriendRequests;
public boolean blockRoomInvites; public boolean blockRoomInvites;
public boolean blockStaffAlerts; public boolean blockStaffAlerts;
public boolean allowTrade; private boolean allowTrade;
public boolean preferOldChat; public boolean preferOldChat;
public boolean blockCameraFollow; public boolean blockCameraFollow;
public RoomChatMessageBubbles chatColor; public RoomChatMessageBubbles chatColor;
@ -63,11 +67,12 @@ public class HabboStats implements Runnable
private final THashMap<Achievement, Integer> achievementCache; private final THashMap<Achievement, Integer> achievementCache;
private final THashMap<Integer, CatalogItem> recentPurchases; private final THashMap<Integer, CatalogItem> recentPurchases;
private final TIntArrayList favoriteRooms; private final TIntArrayList favoriteRooms;
public final TIntArrayList ignoredUsers; private final TIntArrayList ignoredUsers;
public final TIntArrayList secretRecipes; public final TIntArrayList secretRecipes;
public int citizenshipLevel = -1; public int citizenshipLevel = -1;
public int helpersLevel = -1; public int helpersLevel = -1;
public boolean perkTrade = false;
public final HabboNavigatorWindowSettings navigatorWindowSettings; public final HabboNavigatorWindowSettings navigatorWindowSettings;
public final THashMap<String, Object> cache; public final THashMap<String, Object> cache;
@ -88,8 +93,13 @@ public class HabboStats implements Runnable
public TIntArrayList calendarRewardsClaimed; public TIntArrayList calendarRewardsClaimed;
public boolean allowNameChange = false; public boolean allowNameChange = false;
public boolean isPurchasingFurniture = false;
public THashMap<Integer, List<Integer>> ltdPurchaseLog = new THashMap<>(0); public THashMap<Integer, List<Integer>> ltdPurchaseLog = new THashMap<>(0);
public long lastTradeTimestamp = Emulator.getIntUnixTimestamp();
public long lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
public long lastGiftTimestamp = Emulator.getIntUnixTimestamp();
public TIntObjectMap<HabboOfferPurchase> offerCache = new TIntObjectHashMap<>();
private HabboStats(ResultSet set, Habbo habbo) throws SQLException private HabboStats(ResultSet set, Habbo habbo) throws SQLException
{ {
@ -136,6 +146,7 @@ public class HabboStats implements Runnable
this.nux = set.getString("nux").equals("1"); this.nux = set.getString("nux").equals("1");
this.muteEndTime = set.getInt("mute_end_timestamp"); this.muteEndTime = set.getInt("mute_end_timestamp");
this.allowNameChange = set.getString("allow_name_change").equalsIgnoreCase("1"); this.allowNameChange = set.getString("allow_name_change").equalsIgnoreCase("1");
this.perkTrade = set.getString("perk_trade").equalsIgnoreCase("1");
this.nuxReward = nux; this.nuxReward = nux;
try (PreparedStatement statement = set.getStatement().getConnection().prepareStatement("SELECT * FROM user_window_settings WHERE user_id = ? LIMIT 1")) try (PreparedStatement statement = set.getStatement().getConnection().prepareStatement("SELECT * FROM user_window_settings WHERE user_id = ? LIMIT 1"))
@ -221,6 +232,30 @@ public class HabboStats implements Runnable
} }
} }
} }
try (PreparedStatement ignoredPlayersStatement = set.getStatement().getConnection().prepareStatement("SELECT target_id FROM users_ignored WHERE user_id = ?"))
{
ignoredPlayersStatement.setInt(1, this.habbo.getHabboInfo().getId());
try (ResultSet ignoredSet = ignoredPlayersStatement.executeQuery())
{
while (ignoredSet.next())
{
this.ignoredUsers.add(ignoredSet.getInt(1));
}
}
}
try (PreparedStatement loadOfferPurchaseStatement = set.getStatement().getConnection().prepareStatement("SELECT * FROM users_target_offer_purchases WHERE user_id = ?"))
{
loadOfferPurchaseStatement.setInt(1, this.habbo.getHabboInfo().getId());
try (ResultSet offerSet = loadOfferPurchaseStatement.executeQuery())
{
while (offerSet.next())
{
this.offerCache.put(offerSet.getInt("offer_id"), new HabboOfferPurchase(offerSet));
}
}
}
} }
@Override @Override
@ -228,7 +263,7 @@ public class HabboStats implements Runnable
{ {
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) 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 = ? 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 = ? WHERE user_id = ? LIMIT 1"))
{ {
statement.setInt(1, this.achievementScore); statement.setInt(1, this.achievementScore);
statement.setInt(2, this.respectPointsReceived); statement.setInt(2, this.respectPointsReceived);
@ -259,7 +294,8 @@ public class HabboStats implements Runnable
statement.setString(27, this.nux ? "1" : "0"); statement.setString(27, this.nux ? "1" : "0");
statement.setInt(28, this.muteEndTime); statement.setInt(28, this.muteEndTime);
statement.setString(29, this.allowNameChange ? "1" : "0"); statement.setString(29, this.allowNameChange ? "1" : "0");
statement.setInt(30, this.habbo.getHabboInfo().getId()); statement.setString(30, this.perkTrade ? "1" : "0");
statement.setInt(31, this.habbo.getHabboInfo().getId());
statement.executeUpdate(); statement.executeUpdate();
} }
@ -274,6 +310,24 @@ public class HabboStats implements Runnable
statement.executeUpdate(); statement.executeUpdate();
} }
if (!this.offerCache.isEmpty())
{
try (PreparedStatement statement = connection.prepareStatement("UPDATE users_target_offer_purchases SET state = ?, amount = ?, last_purchase = ? WHERE user_id = ? AND offer_id = ?"))
{
for (HabboOfferPurchase purchase : this.offerCache.valueCollection())
{
if (!purchase.needsUpdate()) continue;
statement.setInt(1, purchase.getState());
statement.setInt(2, purchase.getAmount());
statement.setInt(3, purchase.getLastPurchaseTimestamp());
statement.setInt(4, this.habbo.getHabboInfo().getId());
statement.setInt(5, purchase.getOfferId());
statement.execute();
}
}
}
this.navigatorWindowSettings.save(connection); this.navigatorWindowSettings.save(connection);
} }
catch (SQLException e) catch (SQLException e)
@ -657,4 +711,71 @@ public class HabboStats implements Runnable
return 0; return 0;
} }
public void ignoreUser(int userId)
{
if (!this.userIgnored(userId))
{
this.ignoredUsers.add(userId);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement("INSERT INTO users_ignored (user_id, target_id) VALUES (?, ?)"))
{
statement.setInt(1, this.habbo.getHabboInfo().getId());
statement.setInt(2, userId);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
public void unignoreUser(int userId)
{
if (this.userIgnored(userId))
{
this.ignoredUsers.remove(userId);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement("DELETE FROM users_ignored WHERE user_id = ? AND target_id = ?"))
{
statement.setInt(1, this.habbo.getHabboInfo().getId());
statement.setInt(2, userId);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
}
}
public boolean userIgnored(int userId)
{
return this.ignoredUsers.contains(userId);
}
public boolean allowTrade()
{
if (RoomTrade.TRADING_REQUIRES_PERK)
return this.perkTrade && this.allowTrade;
else return this.allowTrade;
}
public void setAllowTrade(boolean allowTrade)
{
this.allowTrade = allowTrade;
}
public HabboOfferPurchase getHabboOfferPurchase(int offerId)
{
return this.offerCache.get(offerId);
}
public void addHabboOfferPurchase(HabboOfferPurchase offerPurchase)
{
this.offerCache.put(offerPurchase.getOfferId(), offerPurchase);
}
} }

View File

@ -0,0 +1,109 @@
package com.eu.habbo.habbohotel.users.cache;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class HabboOfferPurchase
{
private final int userId;
private final int offerId;
private int state;
private int amount;
private int lastPurchaseTimestamp;
private boolean needsUpdate = false;
public HabboOfferPurchase(ResultSet set) throws SQLException
{
this.userId = set.getInt("user_id");
this.offerId = set.getInt("offer_id");
this.state = set.getInt("state");
this.amount = set.getInt("amount");
this.lastPurchaseTimestamp = set.getInt("last_purchase");
}
private HabboOfferPurchase(int userId, int offerId)
{
this.userId = userId;
this.offerId = offerId;
}
public int getOfferId()
{
return this.offerId;
}
public int getState()
{
return this.state;
}
public void setState(int state)
{
this.state = state;
this.needsUpdate = true;
}
public int getAmount()
{
return this.amount;
}
public void incrementAmount(int amount)
{
this.amount += amount;
this.needsUpdate = true;
}
public int getLastPurchaseTimestamp()
{
return this.lastPurchaseTimestamp;
}
public void setLastPurchaseTimestamp(int timestamp)
{
this.lastPurchaseTimestamp = timestamp;
this.needsUpdate = true;
}
public void update(int amount, int timestamp)
{
this.amount += amount;
this.lastPurchaseTimestamp = timestamp;
this.needsUpdate = true;
}
public boolean needsUpdate()
{
return this.needsUpdate;
}
public static HabboOfferPurchase getOrCreate(Habbo habbo, int offerId)
{
HabboOfferPurchase purchase = habbo.getHabboStats().getHabboOfferPurchase(offerId);
if (purchase == null)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO users_target_offer_purchases (user_id, offer_id) VALUES (?, ?)"))
{
statement.setInt(1, habbo.getHabboInfo().getId());
statement.setInt(2, offerId);
statement.execute();
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
return null;
}
purchase = new HabboOfferPurchase(habbo.getHabboInfo().getId(), offerId);
habbo.getHabboStats().addHabboOfferPurchase(purchase);
}
return purchase;
}
}

View File

@ -281,10 +281,14 @@ public class WiredHandler
int pixels = Integer.valueOf(rewardReceived.value); int pixels = Integer.valueOf(rewardReceived.value);
habbo.givePixels(pixels); habbo.givePixels(pixels);
} }
else if(rewardReceived.type.equalsIgnoreCase("points")) else if(rewardReceived.type.startsWith("points"))
{ {
int points = Integer.valueOf(rewardReceived.value); int points = Integer.valueOf(rewardReceived.value);
habbo.givePoints(points); int type = 5;
try { type = Integer.valueOf(rewardReceived.type.replace("points", "")); } catch ( Exception e) {}
habbo.givePoints(type, points);
} }
else if(rewardReceived.type.equalsIgnoreCase("furni")) else if(rewardReceived.type.equalsIgnoreCase("furni"))
{ {

View File

@ -225,6 +225,8 @@ public class PacketManager
this.registerHandler(Incoming.GetClubDataEvent, RequestClubDataEvent.class); this.registerHandler(Incoming.GetClubDataEvent, RequestClubDataEvent.class);
this.registerHandler(Incoming.RequestClubGiftsEvent, RequestClubGiftsEvent.class); this.registerHandler(Incoming.RequestClubGiftsEvent, RequestClubGiftsEvent.class);
this.registerHandler(Incoming.CatalogSearchedItemEvent, CatalogSearchedItemEvent.class); this.registerHandler(Incoming.CatalogSearchedItemEvent, CatalogSearchedItemEvent.class);
this.registerHandler(Incoming.PurchaseTargetOfferEvent, PurchaseTargetOfferEvent.class);
this.registerHandler(Incoming.TargetOfferStateEvent, TargetOfferStateEvent.class);
} }
private void registerEvent() throws Exception private void registerEvent() throws Exception
@ -327,6 +329,7 @@ public class PacketManager
this.registerHandler(Incoming.HotelViewDataEvent, HotelViewDataEvent.class); this.registerHandler(Incoming.HotelViewDataEvent, HotelViewDataEvent.class);
this.registerHandler(Incoming.HotelViewRequestBadgeRewardEvent, HotelViewRequestBadgeRewardEvent.class); this.registerHandler(Incoming.HotelViewRequestBadgeRewardEvent, HotelViewRequestBadgeRewardEvent.class);
this.registerHandler(Incoming.HotelViewClaimBadgeRewardEvent, HotelViewClaimBadgeRewardEvent.class); this.registerHandler(Incoming.HotelViewClaimBadgeRewardEvent, HotelViewClaimBadgeRewardEvent.class);
this.registerHandler(Incoming.HotelViewRequestLTDAvailabilityEvent, HotelViewRequestLTDAvailabilityEvent.class);
} }
private void registerInventory() throws Exception private void registerInventory() throws Exception
@ -619,4 +622,5 @@ public class PacketManager
} }
public static boolean DEBUG_SHOW_PACKETS = false; public static boolean DEBUG_SHOW_PACKETS = false;
public static boolean MULTI_THREADED_PACKET_HANDLING = false;
} }

View File

@ -110,19 +110,6 @@ public class ServerMessage
} }
} }
@Deprecated
public void appendInt32(Integer obj)
{
try
{
this.stream.writeInt(obj.intValue());
}
catch(IOException e)
{
Emulator.getLogging().logPacketError(e);
}
}
public void appendInt(Integer obj) public void appendInt(Integer obj)
{ {
try try
@ -135,13 +122,13 @@ public class ServerMessage
} }
} }
public void appendInt32(Short obj) public void appendInt(Short obj)
{ {
this.appendShort(0); this.appendShort(0);
this.appendShort(obj); this.appendShort(obj);
} }
public void appendInt32(Byte obj) public void appendInt(Byte obj)
{ {
try try
{ {
@ -153,7 +140,7 @@ public class ServerMessage
} }
} }
public void appendInt32(Boolean obj) public void appendInt(Boolean obj)
{ {
try try
{ {

View File

@ -340,6 +340,10 @@ public class Incoming
public static final int ChangeChatBubbleEvent = 1030; public static final int ChangeChatBubbleEvent = 1030;
public static final int LoveLockStartConfirmEvent = 3775; public static final int LoveLockStartConfirmEvent = 3775;
public static final int HotelViewRequestLTDAvailabilityEvent = 410;
public static final int PurchaseTargetOfferEvent = 1826;
public static final int TargetOfferStateEvent = 2041;
public static final int UNKNOWN_SNOWSTORM_6000 = 6000; public static final int UNKNOWN_SNOWSTORM_6000 = 6000;
public static final int UNKNOWN_SNOWSTORM_6001 = 6001; public static final int UNKNOWN_SNOWSTORM_6001 = 6001;

View File

@ -5,7 +5,6 @@ public class Incoming_1006
//public static final int RequestAchievementsEvent = 2562;
@ -31,194 +30,195 @@ public class Incoming_1006
public static final int MannequinSaveLookEvent = 3770;//1804 //Updated
public static final int RequestCatalogPageEvent = 2914;//1754 //Updated public static final int MannequinSaveLookEvent = 3770;
public static final int RequestWearingBadgesEvent = 3466;//3968 //Updated public static final int RequestCatalogPageEvent = 2914;
public static final int BotPickupEvent = 665;//2865 //Updated public static final int RequestWearingBadgesEvent = 3466;
public static final int HorseRideEvent = 1027;//3268 //Updated public static final int BotPickupEvent = 665;
public static final int CreateRoomEvent = 238;//3524 //Updated public static final int HorseRideEvent = 1027;
public static final int SaveMottoEvent = 1037;//2832 //Updated public static final int CreateRoomEvent = 238;
public static final int GenerateSecretKeyEvent = -1;//3575 public static final int SaveMottoEvent = 1037;
public static final int ModToolAlertEvent = 2890;//1980 //Updated public static final int GenerateSecretKeyEvent = -1;
public static final int TradeAcceptEvent = 368;//1062 //Updated public static final int ModToolAlertEvent = 2890;
public static final int RequestCatalogModeEvent = 2711;//3406 //Updated public static final int TradeAcceptEvent = 368;
public static final int RequestUserCreditsEvent = 2845;//938 //Updated public static final int RequestCatalogModeEvent = 2711;
public static final int FriendPrivateMessageEvent = 3710;//1527 //Updated public static final int RequestUserCreditsEvent = 2845;
public static final int CloseDiceEvent = 57;//1739 //Updated public static final int FriendPrivateMessageEvent = 3710;
public static final int RoomUserRemoveRightsEvent = 1599;//3639 //Updated public static final int CloseDiceEvent = 57;
public static final int GuildDeclineMembershipEvent = 1328;//1320 //Updated public static final int RoomUserRemoveRightsEvent = 1599;
public static final int AnswerPollEvent = 2135;//1847 //Updated public static final int GuildDeclineMembershipEvent = 1328;
public static final int UserWearBadgeEvent = 741;//2473 //Updated public static final int AnswerPollEvent = 2135;
public static final int RoomVoteEvent = -242;//242 public static final int UserWearBadgeEvent = 741;
public static final int RoomUserSignEvent = 2065;//2189 //Updated public static final int RoomVoteEvent = -242;
public static final int RequestUserDataEvent = 882;//112 //Updated public static final int RoomUserSignEvent = 2065;
public static final int RoomUserShoutEvent = 1788;//936 //Updated public static final int RequestUserDataEvent = 882;
public static final int ScratchPetEvent = 965;//3464 //Updated public static final int RoomUserShoutEvent = 1788;
public static final int RoomUserWalkEvent = 3690;//951 //Updated public static final int ScratchPetEvent = 965;
public static final int RequestUserTagsEvent = 3430;//3102 //Updated public static final int RoomUserWalkEvent = 3690;
public static final int RequestTagsEvent = 753;//1337 //Updated public static final int RequestUserTagsEvent = 3430;
public static final int GetMarketplaceConfigEvent = 3774;//1952 //Updated public static final int RequestTagsEvent = 753;
public static final int RequestHeightmapEvent = 859;//308 //Updated public static final int GetMarketplaceConfigEvent = 3774;
public static final int TradeCloseEvent = 3012;//3387 //Updated public static final int RequestHeightmapEvent = 859;
public static final int CatalogBuyItemEvent = 3964;//2967 //Updated public static final int TradeCloseEvent = 3012;
public static final int RequestGuildMembersEvent = 3204;//2382 //Updated public static final int CatalogBuyItemEvent = 3964;
public static final int RequestPetInformationEvent = 2827;//777 //Updated public static final int RequestGuildMembersEvent = 3204;
public static final int RoomUserWhisperEvent = 3908;//1362 //Updated public static final int RequestPetInformationEvent = 2827;
public static final int ModToolRequestUserInfoEvent = 607;//3077 //Updated public static final int RoomUserWhisperEvent = 3908;
public static final int RotateMoveItemEvent = 1219;//194 //Updated public static final int ModToolRequestUserInfoEvent = 607;
public static final int CancelPollEvent = 1628;//276 //Updated public static final int RotateMoveItemEvent = 1219;
public static final int RequestRoomLoadEvent = 1988;//3751 //2086 //2144 //Updated public static final int CancelPollEvent = 1628;
public static final int RequestGuildPartsEvent = 1902;//2344 //Updated public static final int RequestRoomLoadEvent = 1988;
public static final int RoomPlacePaintEvent = 1892;//874 //Updated public static final int RequestGuildPartsEvent = 1902;
public static final int RequestPopularRoomsEvent = 464;//2346;//235 //Updated public static final int RoomPlacePaintEvent = 1892;
public static final int ModToolRequestRoomInfoEvent = 1450;//225 //Updated public static final int RequestPopularRoomsEvent = 464;
public static final int FriendRequestEvent = 2791;//3765 //Updated public static final int ModToolRequestRoomInfoEvent = 1450;
public static final int RecycleEvent = 3277;//2318 //Updated public static final int FriendRequestEvent = 2791;
public static final int RequestRoomCategoriesEvent = 3498;//1431 //Updated public static final int RecycleEvent = 3277;
public static final int ToggleWallItemEvent = 3050;//2650 //Updated public static final int RequestRoomCategoriesEvent = 3498;
public static final int RoomUserTalkEvent = 104;//3349 //Updated public static final int ToggleWallItemEvent = 3050;
public static final int HotelViewDataEvent = 2507;//595 //Updated //2269 public static final int RoomUserTalkEvent = 104;
public static final int RoomUserDanceEvent = 649;//1139 //Updated public static final int HotelViewDataEvent = 2507;
public static final int RequestUserProfileEvent = 1389;//532 //Updated public static final int RoomUserDanceEvent = 649;
public static final int SearchRoomsFriendsNowEvent = 1082;//3306 //Updated public static final int RequestUserProfileEvent = 1389;
public static final int SetStackHelperHeightEvent = 2790;//2540 //Updated public static final int SearchRoomsFriendsNowEvent = 1082;
public static final int RedeemVoucherEvent = 3024;//1571 //Updated public static final int SetStackHelperHeightEvent = 2790;
public static final int HorseUseItemEvent = 2590;//1616 //Updated public static final int RedeemVoucherEvent = 3024;
public static final int BuyItemEvent = 2847;//3878 //Updated public static final int HorseUseItemEvent = 2590;
public static final int AdvertisingSaveEvent = 1829;//68 //Updated public static final int BuyItemEvent = 2847;
public static final int RequestPetTrainingPanelEvent = 2251;//2476 //Updated public static final int AdvertisingSaveEvent = 1829;
public static final int RoomBackgroundEvent = 2496;//2715 //Updated public static final int RequestPetTrainingPanelEvent = 2251;
public static final int RequestNewsListEvent = 1134;//896 //Updated public static final int RoomBackgroundEvent = 2496;
public static final int RequestPromotedRoomsEvent = 1558;//3030 //Updated public static final int RequestNewsListEvent = 1134;
public static final int GuildSetAdminEvent = 3704;//2957 //Updated public static final int RequestPromotedRoomsEvent = 1558;
public static final int GetClubDataEvent = 3240;//1608 //Updated public static final int GuildSetAdminEvent = 3704;
public static final int RequestMeMenuSettingsEvent = 2169;//671 //Updated public static final int GetClubDataEvent = 3240;
public static final int MannequinSaveNameEvent = 1289;//2098 //Updated public static final int RequestMeMenuSettingsEvent = 2169;
public static final int SellItemEvent = 1522;//172 //Updated public static final int MannequinSaveNameEvent = 1289;
public static final int GuildAcceptMembershipEvent = 538;//1066 //Updated public static final int SellItemEvent = 1522;
public static final int RequestBannerToken = -1;//2619 public static final int GuildAcceptMembershipEvent = 538;
public static final int RequestRecylerLogicEvent = 1170;//1077 //Updated public static final int RequestBannerToken = -1;
public static final int RequestGuildJoinEvent = 794;//77 //Updated public static final int RequestRecylerLogicEvent = 1170;
public static final int RequestCatalogIndexEvent = 2806;//81 //Updated public static final int RequestGuildJoinEvent = 794;
public static final int RequestInventoryPetsEvent = 3760;//1900 //Updated public static final int RequestCatalogIndexEvent = 2806;
public static final int ModToolRequestRoomVisitsEvent = 2287;//2549 //Updated public static final int RequestInventoryPetsEvent = 3760;
public static final int ModToolWarnEvent = 2890;//3763 //Updated public static final int ModToolRequestRoomVisitsEvent = 2287;
public static final int RequestItemInfoEvent = 2042;//36 //Updated public static final int ModToolWarnEvent = 2890;
public static final int ModToolRequestRoomChatlogEvent = 3209;//1903 //Updated public static final int RequestItemInfoEvent = 2042;
public static final int UserSaveLookEvent = 2242;//2404 //Updated public static final int ModToolRequestRoomChatlogEvent = 3209;
public static final int ToggleFloorItemEvent = 2693;//120 //Updated public static final int UserSaveLookEvent = 2242;
public static final int TradeUnAcceptEvent = 126;//1131 //Updated public static final int ToggleFloorItemEvent = 2693;
public static final int WiredTriggerSaveDataEvent = 3593;//3201 //Updated public static final int TradeUnAcceptEvent = 126;
public static final int RoomRemoveAllRightsEvent = 3764;//405 //Updated public static final int WiredTriggerSaveDataEvent = 3593;
public static final int TakeBackItemEvent = 1455;//2910 //Updated public static final int RoomRemoveAllRightsEvent = 3764;
public static final int OpenRecycleBoxEvent = 0x0F00;//3977 //Updated public static final int TakeBackItemEvent = 1455;
public static final int GuildChangeNameDescEvent = 1485;//3232 //Updated public static final int OpenRecycleBoxEvent = 0x0F00;
public static final int RequestSellItemEvent = 876;//2087 //Updated public static final int GuildChangeNameDescEvent = 1485;
public static final int ModToolChangeRoomSettingsEvent = 3244;//2530 //Updated public static final int RequestSellItemEvent = 876;
public static final int ModToolRequestUserChatlogEvent = 3209;//203 //Updated public static final int ModToolChangeRoomSettingsEvent = 3244;
public static final int GuildChangeSettingsEvent = 2258;//2156 //Updated public static final int ModToolRequestUserChatlogEvent = 3209;
public static final int RoomUserDropHandItemEvent = 1108;//157 //Updated public static final int GuildChangeSettingsEvent = 2258;
public static final int RequestProfileFriendsEvent = 3701;//3925 //Updated public static final int RoomUserDropHandItemEvent = 1108;
public static final int TradeCancelOfferItemEvent = 2170;//373 //Updated public static final int RequestProfileFriendsEvent = 3701;
public static final int TriggerDiceEvent = 386;//987 //Updated public static final int TradeCancelOfferItemEvent = 2170;
public static final int GetPollDataEvent = 2263;//1960 //Updated public static final int TriggerDiceEvent = 386;
public static final int MachineIDEvent = 686;//512 public static final int GetPollDataEvent = 2263;
public static final int RequestDiscountEvent = 1995;//3794 //Updated public static final int MachineIDEvent = 686;
public static final int RequestFriendRequestEvent = 3739;//275 //Updated public static final int RequestDiscountEvent = 1995;
public static final int RoomSettingsSaveEvent = 1290;//2384 //Updated public static final int RequestFriendRequestEvent = 3739;
public static final int AcceptFriendRequest = 3383;//333 //Updated public static final int RoomSettingsSaveEvent = 1290;
public static final int ReleaseVersionEvent = 4000;//4000 //Updated public static final int AcceptFriendRequest = 3383;
public static final int SearchRoomsMyFavoriteEvent = 3124;//1532 //Updated public static final int ReleaseVersionEvent = 4000;
public static final int TradeStartEvent = 3304;//466 //Updated public static final int SearchRoomsMyFavoriteEvent = 3124;
public static final int ChangeRelationEvent = 2632;//2521 //Updated public static final int TradeStartEvent = 3304;
public static final int RoomUserSitEvent = 272;//484 //Updated public static final int ChangeRelationEvent = 2632;
public static final int RequestCanCreateRoomEvent = 3903;//3844 //Updated //unsure public static final int RoomUserSitEvent = 272;
public static final int ModToolKickEvent = 1459;//3418 //Updated public static final int RequestCanCreateRoomEvent = 3903;
public static final int MoveWallItemEvent = 3455;//1029 //Updated public static final int ModToolKickEvent = 1459;
public static final int SearchRoomsEvent = 3844;//3551 //Updated public static final int MoveWallItemEvent = 3455;
public static final int RequestHighestScoreRoomsEvent = 1814;//1728 //Updaed public static final int SearchRoomsEvent = 3844;
public static final int CatalogBuyItemAsGiftEvent = 1066;//2474 //Updated public static final int RequestHighestScoreRoomsEvent = 1814;
public static final int RoomUserGiveRespectEvent = 3121;//2041 //Updated public static final int CatalogBuyItemAsGiftEvent = 1066;
public static final int RemoveFriendEvent = 1535;//2786 //Updated public static final int RoomUserGiveRespectEvent = 3121;
public static final int SearchRoomsFriendsOwnEvent = 725;//3478 //Updated public static final int RemoveFriendEvent = 1535;
public static final int GuildSetFavoriteEvent = 2754;//1463 //Updated public static final int SearchRoomsFriendsOwnEvent = 725;
public static final int PetPlaceEvent = 1961;//3711 //Updated public static final int GuildSetFavoriteEvent = 2754;
public static final int BotSettingsEvent = 3292;//3098 //Updated public static final int PetPlaceEvent = 1961;
public static final int StalkFriendEvent = 1925;//3394 //Updated public static final int BotSettingsEvent = 3292;
public static final int RoomPickupItemEvent = 2463;//152 //Updated public static final int StalkFriendEvent = 1925;
public static final int RedeemItemEvent = 1242;//3599 //Updated public static final int RoomPickupItemEvent = 2463;
public static final int RequestFriendsEvent = 1904;//776 //Updated public static final int RedeemItemEvent = 1242;
public static final int RequestAchievementsEvent = 2697;//2562 //Updated public static final int RequestFriendsEvent = 1904;
public static final int GuildChangeColorsEvent = 3873;//463 //Updated public static final int RequestAchievementsEvent = 2697;
public static final int RequestInventoryBadgesEvent = 2450;//3072 //Updated public static final int GuildChangeColorsEvent = 3873;
public static final int RequestPetBreedsEvent = 2828;//1064 //Updated public static final int RequestInventoryBadgesEvent = 2450;
public static final int GuildChangeBadgeEvent = 838;//1475 //Updated public static final int RequestPetBreedsEvent = 2828;
public static final int ModToolBanEvent = 701;//2930 //Updated public static final int GuildChangeBadgeEvent = 838;
public static final int SaveWardrobeEvent = 2921;//637 //Updated public static final int ModToolBanEvent = 701;
public static final int HotelViewEvent = 3603;//3266 //Updated public static final int SaveWardrobeEvent = 2921;
public static final int ModToolPickTicketEvent = 2980;//3975 //Updated public static final int HotelViewEvent = 3603;
public static final int ModToolReleaseTicketEvent = 3905; //Updated public static final int ModToolPickTicketEvent = 2980;
public static final int ModToolCloseTicketEvent = 3904; //Updated public static final int ModToolReleaseTicketEvent = 3905;
public static final int TriggerColorWheelEvent = 2556;//2367 //Updated public static final int ModToolCloseTicketEvent = 3904;
public static final int SearchRoomsByTagEvent = 3844;//1956 //Updated public static final int TriggerColorWheelEvent = 2556;
public static final int RequestPublicRoomsEvent = 2057;//3735 //UPDATED OLD 3178 //Updated public static final int SearchRoomsByTagEvent = 3844;
public static final int RequestResolutionEvent = 305;//1854 //Updated public static final int RequestPublicRoomsEvent = 2057;
public static final int RequestInventoryItemsEvent = 2194;//372 //Updated public static final int RequestResolutionEvent = 305;
public static final int ModToolRoomAlertEvent = 2550;//295 //Updated public static final int RequestInventoryItemsEvent = 2194;
public static final int WiredEffectSaveDataEvent = 2856;//3006 //Updated public static final int ModToolRoomAlertEvent = 2550;
public static final int CheckPetNameEvent = 3699;//678 //Updated public static final int WiredEffectSaveDataEvent = 2856;
public static final int SecureLoginEvent = 2243;//1309 //Updated public static final int CheckPetNameEvent = 3699;
public static final int BotSaveSettingsEvent = 1607;//1384 //Updated public static final int SecureLoginEvent = 2243;
public static final int RequestGuildBuyEvent = 569;//872 //Updated public static final int BotSaveSettingsEvent = 1607;
public static final int SearchUserEvent = 3576;//1267 //Updated public static final int RequestGuildBuyEvent = 569;
public static final int SearchUserEvent = 3576;
public static final int GuildConfirmRemoveMemberEvent = 3394; public static final int GuildConfirmRemoveMemberEvent = 3394;
public static final int GuildRemoveMemberEvent = 1764;//3002 //Updated public static final int GuildRemoveMemberEvent = 1764;
public static final int WiredConditionSaveDataEvent = 3268;//1041 //Updated public static final int WiredConditionSaveDataEvent = 3268;
public static final int RoomUserLookAtPoint = 2283;//1365 //Updated public static final int RoomUserLookAtPoint = 2283;
public static final int MoodLightTurnOnEvent = 3924;//1181 //Updated public static final int MoodLightTurnOnEvent = 3924;
public static final int MoodLightSettingsEvent = 2821;//2468 //Updated public static final int MoodLightSettingsEvent = 2821;
public static final int RequestMyRoomsEvent = 948;//2676 //Updated public static final int RequestMyRoomsEvent = 948;
public static final int RequestCreditsEvent = 3896;//2138 //Updated public static final int RequestCreditsEvent = 3896;
public static final int SearchRoomsInGroupEvent = 2851;//1160 //Updated public static final int SearchRoomsInGroupEvent = 2851;
public static final int HorseRideSettingsEvent = 427;//2448 //Updated public static final int HorseRideSettingsEvent = 427;
public static final int KnockKnockResponseEvent = 853; //Updated public static final int KnockKnockResponseEvent = 853;
public static final int RoomUserKickEvent = 313;//1874 //Updated public static final int RoomUserKickEvent = 313;
public static final int RoomPlaceItemEvent = 3571;//474 //Updated public static final int RoomPlaceItemEvent = 3571;
public static final int RequestInventoryBotsEvent = 1343;//1351 //Updated public static final int RequestInventoryBotsEvent = 1343;
public static final int RequestUserWardrobeEvent = 2976;//1251 //Updated public static final int RequestUserWardrobeEvent = 2976;
public static final int RequestRoomRightsEvent = 63;//2928 //Updated public static final int RequestRoomRightsEvent = 63;
public static final int RequestGuildBuyRoomsEvent = 2945;//701 //Updated public static final int RequestGuildBuyRoomsEvent = 2945;
public static final int BotPlaceEvent = 3906;//148 //Updated public static final int BotPlaceEvent = 3906;
public static final int SearchRoomsWithRightsEvent = 1699;//3785 //Updated public static final int SearchRoomsWithRightsEvent = 1699;
public static final int HotelViewRequestBonusRareEvent = 1521;//1199 //Updated public static final int HotelViewRequestBonusRareEvent = 1521;
public static final int GuildRemoveAdminEvent = 904;//3264 //Updated public static final int GuildRemoveAdminEvent = 904;
public static final int RequestRoomSettingsEvent = 1794;//3741 //Updated public static final int RequestRoomSettingsEvent = 1794;
public static final int RequestOffersEvent = 100;//541 //Updated public static final int RequestOffersEvent = 100;
public static final int RequestUserCitizinShipEvent = 3556;//3096 //Updated public static final int RequestUserCitizinShipEvent = 3556;
public static final int RoomUserStopTypingEvent = 1712;//2005 //Updated public static final int RoomUserStopTypingEvent = 1712;
public static final int RoomUserStartTypingEvent = 3128;//3684 //Updated public static final int RoomUserStartTypingEvent = 3128;
public static final int RequestGuildManageEvent = 3931;//2418 //Updated public static final int RequestGuildManageEvent = 3931;
public static final int RequestUserClubEvent = 675;//3874 //Updated public static final int RequestUserClubEvent = 675;
public static final int PetPickupEvent = 1294;//863 //Updated public static final int PetPickupEvent = 1294;
public static final int RequestOwnGuildsEvent = 2690;//2240 //Updated public static final int RequestOwnGuildsEvent = 2690;
public static final int SearchRoomsVisitedEvent = 3561;//589 //Updated public static final int SearchRoomsVisitedEvent = 3561;
public static final int TradeOfferItemEvent = 2090;//2223 //Updated public static final int TradeOfferItemEvent = 2090;
public static final int TradeConfirmEvent = 1503;//1144 //Updated public static final int TradeConfirmEvent = 1503;
public static final int RoomUserGiveRightsEvent = 503;//2221 //Updated public static final int RoomUserGiveRightsEvent = 503;
public static final int RequestGuildInfoEvent = 844;//2079 //Updated public static final int RequestGuildInfoEvent = 844;
public static final int ReloadRecyclerEvent = 3895;//2779 //Updated public static final int ReloadRecyclerEvent = 3895;
public static final int RoomUserActionEvent = 2522;//475 //Updated public static final int RoomUserActionEvent = 2522;
public static final int RequestGiftConfigurationEvent = 756;//382 //Updated public static final int RequestGiftConfigurationEvent = 756;
public static final int RequestRoomDataEvent = 2022;//183 //Updated public static final int RequestRoomDataEvent = 2022;
public static final int RequestRoomHeightmapEvent = 3936; //Updated public static final int RequestRoomHeightmapEvent = 3936;
public static final int RequestGuildFurniWidgetEvent = 54;//3031 //Updated public static final int RequestGuildFurniWidgetEvent = 54;
public static final int RequestOwnItemsEvent = 1816;//829 //Updated public static final int RequestOwnItemsEvent = 1816;
public static final int RequestReportRoomEvent = 2842; //Updated public static final int RequestReportRoomEvent = 2842;
public static final int ReportEvent = 2073; //Updated public static final int ReportEvent = 2073;
public static final int TriggerOneWayGateEvent = 3752; //Updated public static final int TriggerOneWayGateEvent = 3752;
public static final int FloorPlanEditorSaveEvent = 3509; //Updated public static final int FloorPlanEditorSaveEvent = 3509;
public static final int FloorPlanEditorRequestDoorSettingsEvent = 2691; //Updated public static final int FloorPlanEditorRequestDoorSettingsEvent = 2691;
public static final int FloorPlanEditorRequestBlockedTilesEvent = 2246; //Updated public static final int FloorPlanEditorRequestBlockedTilesEvent = 2246;
public static final int UnknownEvent1 = 3365; public static final int UnknownEvent1 = 3365;
public static final int RequestTalenTrackEvent = 1741; public static final int RequestTalenTrackEvent = 1741;
public static final int RequestNewNavigatorDataEvent = 1192; public static final int RequestNewNavigatorDataEvent = 1192;

View File

@ -2,196 +2,196 @@ package com.eu.habbo.messages.incoming;
public class Incoming_20160101 public class Incoming_20160101
{ {
public static final int MannequinSaveLookEvent = 3936;//1804 public static final int MannequinSaveLookEvent = 3936;
public static final int RequestCatalogPageEvent = 39;//1754 public static final int RequestCatalogPageEvent = 39;
public static final int RequestWearingBadgesEvent = 2226;//3968 public static final int RequestWearingBadgesEvent = 2226;
public static final int BotPickupEvent = 644;//2865 public static final int BotPickupEvent = 644;
public static final int HorseRideEvent = 1440;//3268 public static final int HorseRideEvent = 1440;
public static final int RequestCreateRoomEvent = 3077;//3524 public static final int RequestCreateRoomEvent = 3077;
public static final int SaveMottoEvent = 3515;//2832 //1037 public static final int SaveMottoEvent = 3515;
public static final int GenerateSecretKeyEvent = -1;//3575 public static final int GenerateSecretKeyEvent = -1;
public static final int ModToolAlertEvent = 2375;//1980 public static final int ModToolAlertEvent = 2375;
public static final int TradeAcceptEvent = 3374;//1062 public static final int TradeAcceptEvent = 3374;
public static final int RequestCatalogModeEvent = 2267;//3406 public static final int RequestCatalogModeEvent = 2267;
public static final int RequestUserCreditsEvent = 3697;//938 //Updated public static final int RequestUserCreditsEvent = 3697;
public static final int FriendPrivateMessageEvent = 1981;//1527 public static final int FriendPrivateMessageEvent = 1981;
public static final int CloseDiceEvent = 191;//1739 public static final int CloseDiceEvent = 191;
public static final int RoomUserRemoveRightsEvent = 40;//3639 public static final int RoomUserRemoveRightsEvent = 40;
public static final int RoomRemoveRightsEvent = 879; public static final int RoomRemoveRightsEvent = 879;
public static final int GuildDeclineMembershipEvent = 403;//1320 public static final int GuildDeclineMembershipEvent = 403;
public static final int AnswerPollEvent = 3757;//1847 public static final int AnswerPollEvent = 3757;
public static final int UserWearBadgeEvent = 2752;//2473 public static final int UserWearBadgeEvent = 2752;
public static final int RoomVoteEvent = 336;//242 public static final int RoomVoteEvent = 336;
public static final int RoomUserSignEvent = 2966;//2189 public static final int RoomUserSignEvent = 2966;
public static final int RequestUserDataEvent = 186;//112 //Updated public static final int RequestUserDataEvent = 186;
public static final int RoomUserShoutEvent = 2101;//936 public static final int RoomUserShoutEvent = 2101;
public static final int ScratchPetEvent = 1618;//3464 public static final int ScratchPetEvent = 1618;
public static final int RoomUserWalkEvent = 1737;//951 public static final int RoomUserWalkEvent = 1737;
public static final int RequestUserTagsEvent = 1722;//3102 public static final int RequestUserTagsEvent = 1722;
public static final int RequestTagsEvent = 1685;//1337 public static final int RequestTagsEvent = 1685;
public static final int GetMarketplaceConfigEvent = 1604;//1952 public static final int GetMarketplaceConfigEvent = 1604;
public static final int RequestHeightmapEvent = 2125;//308 public static final int RequestHeightmapEvent = 2125;
public static final int TradeCloseEvent = 2967;//3387 public static final int TradeCloseEvent = 2967;
public static final int CatalogBuyItemEvent = 2830;//2967 public static final int CatalogBuyItemEvent = 2830;
public static final int RequestGuildMembersEvent = 205;//2382 public static final int RequestGuildMembersEvent = 205;
public static final int RequestPetInformationEvent = 2232;//777 public static final int RequestPetInformationEvent = 2232;
public static final int RoomUserWhisperEvent = 878;//1362 public static final int RoomUserWhisperEvent = 878;
public static final int ModToolRequestUserInfoEvent = 2984;//3077 public static final int ModToolRequestUserInfoEvent = 2984;
public static final int RotateMoveItemEvent = 1781;//194 public static final int RotateMoveItemEvent = 1781;
public static final int CancelPollEvent = 2538;//276 public static final int CancelPollEvent = 2538;
public static final int RequestRoomLoadEvent = 407;//3751 //2086 //2144 public static final int RequestRoomLoadEvent = 407;
public static final int RequestGuildPartsEvent = 1670;//2344 public static final int RequestGuildPartsEvent = 1670;
public static final int RoomPlacePaintEvent = 728;//874 public static final int RoomPlacePaintEvent = 728;
public static final int RequestPopularRoomsEvent = 3022;//2346;//235 public static final int RequestPopularRoomsEvent = 3022;
public static final int ModToolRequestRoomInfoEvent = 182;//225 public static final int ModToolRequestRoomInfoEvent = 182;
public static final int FriendRequestEvent = 3775;//3765 public static final int FriendRequestEvent = 3775;
public static final int RecycleEvent = 2920;//2318 public static final int RecycleEvent = 2920;
public static final int RequestRoomCategoriesEvent = 2506;//1431 //Updated public static final int RequestRoomCategoriesEvent = 2506;
public static final int ToggleWallItemEvent = 3396;//2650 public static final int ToggleWallItemEvent = 3396;
public static final int RoomUserTalkEvent = 670;//3349 public static final int RoomUserTalkEvent = 670;
public static final int HotelViewDataEvent = 3544;//595 //2269 //Updated public static final int HotelViewDataEvent = 3544;
public static final int HotelViewRequestBadgeRewardEvent = 2318; public static final int HotelViewRequestBadgeRewardEvent = 2318;
public static final int HotelViewClaimBadgeRewardEvent = 2388; public static final int HotelViewClaimBadgeRewardEvent = 2388;
public static final int RoomUserDanceEvent = 645;//1139 public static final int RoomUserDanceEvent = 645;
public static final int RequestUserProfileEvent = 3591;//532 public static final int RequestUserProfileEvent = 3591;
public static final int SearchRoomsFriendsNowEvent = 3281;//3306 public static final int SearchRoomsFriendsNowEvent = 3281;
public static final int SetStackHelperHeightEvent = 1248;//2540 public static final int SetStackHelperHeightEvent = 1248;
public static final int RedeemVoucherEvent = 489;//1571 public static final int RedeemVoucherEvent = 489;
public static final int HorseUseItemEvent = 870;//1616 public static final int HorseUseItemEvent = 870;
public static final int BuyItemEvent = 3699;//3878 public static final int BuyItemEvent = 3699;
public static final int AdvertisingSaveEvent = 3156;//68 public static final int AdvertisingSaveEvent = 3156;
public static final int RequestPetTrainingPanelEvent = 2088;//2476 public static final int RequestPetTrainingPanelEvent = 2088;
public static final int RoomBackgroundEvent = 1061;//2715 public static final int RoomBackgroundEvent = 1061;
public static final int RequestNewsListEvent = 3895;//896 public static final int RequestNewsListEvent = 3895;
public static final int RequestPromotedRoomsEvent = 1812;//3030 //Updated public static final int RequestPromotedRoomsEvent = 1812;
public static final int GuildSetAdminEvent = 465;//2957 public static final int GuildSetAdminEvent = 465;
public static final int GetClubDataEvent = 715;//1608 public static final int GetClubDataEvent = 715;
public static final int RequestMeMenuSettingsEvent = 3906;//671 //Updated public static final int RequestMeMenuSettingsEvent = 3906;
public static final int MannequinSaveNameEvent = 2406;//2098 public static final int MannequinSaveNameEvent = 2406;
public static final int SellItemEvent = 0xFF;//172 public static final int SellItemEvent = 0xFF;
public static final int GuildAcceptMembershipEvent = 2259;//1066 //Updated public static final int GuildAcceptMembershipEvent = 2259;
public static final int RequestBannerToken = -1;//2619 public static final int RequestBannerToken = -1;
public static final int RequestRecylerLogicEvent = 3258;//1077 public static final int RequestRecylerLogicEvent = 3258;
public static final int RequestGuildJoinEvent = 2615;//77 public static final int RequestGuildJoinEvent = 2615;
public static final int RequestCatalogIndexEvent = 2511;//81 public static final int RequestCatalogIndexEvent = 2511;
public static final int RequestInventoryPetsEvent = 263;//1900 public static final int RequestInventoryPetsEvent = 263;
public static final int ModToolRequestRoomVisitsEvent = 730;//2549 public static final int ModToolRequestRoomVisitsEvent = 730;
public static final int ModToolWarnEvent = -1;//3763 public static final int ModToolWarnEvent = -1;
public static final int RequestItemInfoEvent = 1203;//36 public static final int RequestItemInfoEvent = 1203;
public static final int ModToolRequestRoomChatlogEvent = 2312;//1903 public static final int ModToolRequestRoomChatlogEvent = 2312;
public static final int UserSaveLookEvent = 0x0A00;//2404 public static final int UserSaveLookEvent = 0x0A00;
public static final int ToggleFloorItemEvent = 3846;//120 public static final int ToggleFloorItemEvent = 3846;
public static final int TradeUnAcceptEvent = 1153;//1131 public static final int TradeUnAcceptEvent = 1153;
public static final int WiredTriggerSaveDataEvent = 1897;//3201 public static final int WiredTriggerSaveDataEvent = 1897;
public static final int RoomRemoveAllRightsEvent = 1404;//405 public static final int RoomRemoveAllRightsEvent = 1404;
public static final int TakeBackItemEvent = 1862;//2910 public static final int TakeBackItemEvent = 1862;
public static final int OpenRecycleBoxEvent = 1515;//3977 public static final int OpenRecycleBoxEvent = 1515;
public static final int GuildChangeNameDescEvent = 1062;//3232 public static final int GuildChangeNameDescEvent = 1062;
public static final int RequestSellItemEvent = 1647;//2087 public static final int RequestSellItemEvent = 1647;
public static final int ModToolChangeRoomSettingsEvent = 3458;//2530 public static final int ModToolChangeRoomSettingsEvent = 3458;
public static final int ModToolRequestUserChatlogEvent = -1;//203 public static final int ModToolRequestUserChatlogEvent = -1;
public static final int GuildChangeSettingsEvent = 3180;//2156 public static final int GuildChangeSettingsEvent = 3180;
public static final int RoomUserDropHandItemEvent = 1751;//157 public static final int RoomUserDropHandItemEvent = 1751;
public static final int RequestProfileFriendsEvent = 866;//3925 public static final int RequestProfileFriendsEvent = 866;
public static final int TradeCancelOfferItemEvent = 1033;//373 public static final int TradeCancelOfferItemEvent = 1033;
public static final int TriggerDiceEvent = 1182;//987 public static final int TriggerDiceEvent = 1182;
public static final int GetPollDataEvent = 2580;//1960 public static final int GetPollDataEvent = 2580;
public static final int MachineIDEvent = 1471;//512 public static final int MachineIDEvent = 1471;
public static final int RequestDiscountEvent = 1294;//3794 public static final int RequestDiscountEvent = 1294;
public static final int RequestFriendRequestEvent = 2485;//275 public static final int RequestFriendRequestEvent = 2485;
public static final int RoomSettingsSaveEvent = 2074;//2384 public static final int RoomSettingsSaveEvent = 2074;
public static final int AcceptFriendRequest = 45;//333 public static final int AcceptFriendRequest = 45;
public static final int DeclineFriendRequest = 835; public static final int DeclineFriendRequest = 835;
public static final int ReleaseVersionEvent = 4000;//4000 public static final int ReleaseVersionEvent = 4000;
public static final int SearchRoomsMyFavoriteEvent = 1346;//1532 public static final int SearchRoomsMyFavoriteEvent = 1346;
public static final int TradeStartEvent = 3313;//466 public static final int TradeStartEvent = 3313;
public static final int RequestTargetOfferEvent = 3446; //New In Production20160101 public static final int RequestTargetOfferEvent = 3446;
public static final int ClientActionsMessageEvent = 2386; //New In Production20160101 public static final int ClientActionsMessageEvent = 2386;
public static final int UknownMessageEventSomethingSomething = 3895; //New In Production20160101 public static final int UknownMessageEventSomethingSomething = 3895;
public static final int ChangeRelationEvent = 2112;//2521 public static final int ChangeRelationEvent = 2112;
public static final int RoomUserSitEvent = 1565;//484 public static final int RoomUserSitEvent = 1565;
public static final int RequestCanCreateRoomEvent = 361;//3844 //unsure public static final int RequestCanCreateRoomEvent = 361;
public static final int ModToolKickEvent = 3589;//3418 public static final int ModToolKickEvent = 3589;
public static final int MoveWallItemEvent = 609;//1029 public static final int MoveWallItemEvent = 609;
public static final int SearchRoomsEvent = 898;//3551 public static final int SearchRoomsEvent = 898;
public static final int RequestHighestScoreRoomsEvent = 2031;//1728 public static final int RequestHighestScoreRoomsEvent = 2031;
public static final int CatalogBuyItemAsGiftEvent = 21;//2474 public static final int CatalogBuyItemAsGiftEvent = 21;
public static final int RoomUserGiveRespectEvent = 1955;//2041 public static final int RoomUserGiveRespectEvent = 1955;
public static final int RemoveFriendEvent = 698;//2786 public static final int RemoveFriendEvent = 698;
public static final int SearchRoomsFriendsOwnEvent = 642;//3478 public static final int SearchRoomsFriendsOwnEvent = 642;
public static final int GuildSetFavoriteEvent = 2625;//1463 public static final int GuildSetFavoriteEvent = 2625;
public static final int PetPlaceEvent = 223;//3711 public static final int PetPlaceEvent = 223;
public static final int BotSettingsEvent = 2544;//3098 public static final int BotSettingsEvent = 2544;
public static final int StalkFriendEvent = 2280;//3394 public static final int StalkFriendEvent = 2280;
public static final int RoomPickupItemEvent = 636;//152 public static final int RoomPickupItemEvent = 636;
public static final int RedeemItemEvent = 1676;//3599 public static final int RedeemItemEvent = 1676;
public static final int RequestFriendsEvent = 2349;//776 //Updated public static final int RequestFriendsEvent = 2349;
public static final int RequestAchievementsEvent = 2931;//2562 public static final int RequestAchievementsEvent = 2931;
public static final int GuildChangeColorsEvent = 1443;//463 <--- Updated till here. public static final int GuildChangeColorsEvent = 1443;
public static final int RequestInventoryBadgesEvent = 166;//3072 public static final int RequestInventoryBadgesEvent = 166;
public static final int TestInventoryEvent = 2740; public static final int TestInventoryEvent = 2740;
public static final int RequestPetBreedsEvent = 2505;//1064 public static final int RequestPetBreedsEvent = 2505;
public static final int GuildChangeBadgeEvent = 2959;//1475 public static final int GuildChangeBadgeEvent = 2959;
public static final int ModToolBanEvent = 2595;//2930 public static final int ModToolBanEvent = 2595;
public static final int SaveWardrobeEvent = 55;//637 public static final int SaveWardrobeEvent = 55;
public static final int HotelViewEvent = 3576;//3266 public static final int HotelViewEvent = 3576;
public static final int ModToolPickTicketEvent = 3973;//3975 public static final int ModToolPickTicketEvent = 3973;
public static final int ModToolReleaseTicketEvent = 3800; public static final int ModToolReleaseTicketEvent = 3800;
public static final int ModToolCloseTicketEvent = 50; public static final int ModToolCloseTicketEvent = 50;
public static final int TriggerColorWheelEvent = 2651;//2367 public static final int TriggerColorWheelEvent = 2651;
public static final int SearchRoomsByTagEvent = -1;//1956 public static final int SearchRoomsByTagEvent = -1;
public static final int RequestPublicRoomsEvent = 1336;//3735 OLD 3178 public static final int RequestPublicRoomsEvent = 1336;
public static final int RequestResolutionEvent = 542;//1854 public static final int RequestResolutionEvent = 542;
public static final int RequestInventoryItemsEvent = 352;//372 public static final int RequestInventoryItemsEvent = 352;
public static final int ModToolRoomAlertEvent = 781;//295 public static final int ModToolRoomAlertEvent = 781;
public static final int WiredEffectSaveDataEvent = 3431;//3006 public static final int WiredEffectSaveDataEvent = 3431;
public static final int CheckPetNameEvent = 159;//678 public static final int CheckPetNameEvent = 159;
public static final int SecureLoginEvent = 1778;//1309 //Updated public static final int SecureLoginEvent = 1778;
public static final int BotSaveSettingsEvent = 678;//1384 public static final int BotSaveSettingsEvent = 678;
public static final int RequestGuildBuyEvent = 2546;//872 public static final int RequestGuildBuyEvent = 2546;
public static final int SearchUserEvent = 3375;//1267 public static final int SearchUserEvent = 3375;
public static final int GuildConfirmRemoveMemberEvent = 649; public static final int GuildConfirmRemoveMemberEvent = 649;
public static final int GuildRemoveMemberEvent = 714;//3002 public static final int GuildRemoveMemberEvent = 714;
public static final int WiredConditionSaveDataEvent = 488;//1041 //3620 incorrect header? public static final int WiredConditionSaveDataEvent = 488;
public static final int RoomUserLookAtPoint = 3744;//1365 public static final int RoomUserLookAtPoint = 3744;
public static final int MoodLightTurnOnEvent = 1826;//1181 public static final int MoodLightTurnOnEvent = 1826;
public static final int MoodLightSettingsEvent = 3472;//2468 public static final int MoodLightSettingsEvent = 3472;
public static final int RequestMyRoomsEvent = 2955;//2676 public static final int RequestMyRoomsEvent = 2955;
public static final int RequestCreditsEvent = 1207;//2138 public static final int RequestCreditsEvent = 1207;
public static final int SearchRoomsInGroupEvent = 2002;//1160 public static final int SearchRoomsInGroupEvent = 2002;
public static final int HorseRideSettingsEvent = 1993;//2448 public static final int HorseRideSettingsEvent = 1993;
public static final int HandleDoorbellEvent = 2356; public static final int HandleDoorbellEvent = 2356;
public static final int RoomUserKickEvent = 3929;//1874 public static final int RoomUserKickEvent = 3929;
public static final int RoomPlaceItemEvent = 579;//474 public static final int RoomPlaceItemEvent = 579;
public static final int RequestInventoryBotsEvent = 363;//1351 public static final int RequestInventoryBotsEvent = 363;
public static final int RequestUserWardrobeEvent = 765;//1251 public static final int RequestUserWardrobeEvent = 765;
public static final int RequestRoomRightsEvent = 2734;//2928 public static final int RequestRoomRightsEvent = 2734;
public static final int RequestGuildBuyRoomsEvent = 468;//701 public static final int RequestGuildBuyRoomsEvent = 468;
public static final int BotPlaceEvent = 2321;//148 //Updated <--- Updated till here public static final int BotPlaceEvent = 2321;
public static final int SearchRoomsWithRightsEvent = 1272;//3785 public static final int SearchRoomsWithRightsEvent = 1272;
public static final int HotelViewRequestBonusRareEvent = 538;//1199 //Updated public static final int HotelViewRequestBonusRareEvent = 538;
public static final int GuildRemoveAdminEvent = 2725;//3264 public static final int GuildRemoveAdminEvent = 2725;
public static final int RequestRoomSettingsEvent = 1014;//3741 public static final int RequestRoomSettingsEvent = 1014;
public static final int RequestOffersEvent = 442;//541 public static final int RequestOffersEvent = 442;
public static final int RequestUserCitizinShipEvent = 1605;//3096 public static final int RequestUserCitizinShipEvent = 1605;
public static final int RoomUserStopTypingEvent = 1114;//2005 public static final int RoomUserStopTypingEvent = 1114;
public static final int RoomUserStartTypingEvent = 3362;//3684 public static final int RoomUserStartTypingEvent = 3362;
public static final int RequestGuildManageEvent = 2547;//2418 public static final int RequestGuildManageEvent = 2547;
public static final int RequestUserClubEvent = 12;//3874 //Updated public static final int RequestUserClubEvent = 12;
public static final int PetPickupEvent = 2342;//863 public static final int PetPickupEvent = 2342;
public static final int RequestOwnGuildsEvent = 3046;//2240 public static final int RequestOwnGuildsEvent = 3046;
public static final int SearchRoomsVisitedEvent = 1475;//589 public static final int SearchRoomsVisitedEvent = 1475;
public static final int TradeOfferItemEvent = 114;//2223 public static final int TradeOfferItemEvent = 114;
public static final int TradeConfirmEvent = 2399;//1144 public static final int TradeConfirmEvent = 2399;
public static final int RoomUserGiveRightsEvent = 3574;//2221 public static final int RoomUserGiveRightsEvent = 3574;
public static final int RequestGuildInfoEvent = 3211;//2079 public static final int RequestGuildInfoEvent = 3211;
public static final int ReloadRecyclerEvent = 1715;//2779 //Updated public static final int ReloadRecyclerEvent = 1715;
public static final int RoomUserActionEvent = 3639;//475 public static final int RoomUserActionEvent = 3639;
public static final int RequestGiftConfigurationEvent = 1928;//382 public static final int RequestGiftConfigurationEvent = 1928;
public static final int RequestRoomDataEvent = 1164;//183 //Updated public static final int RequestRoomDataEvent = 1164;
public static final int RequestRoomHeightmapEvent = 2768; public static final int RequestRoomHeightmapEvent = 2768;
public static final int RequestGuildFurniWidgetEvent = 41;//3031 public static final int RequestGuildFurniWidgetEvent = 41;
public static final int RequestOwnItemsEvent = 3829;//829 public static final int RequestOwnItemsEvent = 3829;
public static final int RequestReportRoomEvent = 1839; public static final int RequestReportRoomEvent = 1839;
public static final int ReportEvent = 963; public static final int ReportEvent = 963;
public static final int TriggerOneWayGateEvent = 0x0B00; public static final int TriggerOneWayGateEvent = 0x0B00;
@ -200,7 +200,7 @@ public class Incoming_20160101
public static final int FloorPlanEditorRequestBlockedTilesEvent = 24; public static final int FloorPlanEditorRequestBlockedTilesEvent = 24;
public static final int UnknownEvent1 = 3672; public static final int UnknownEvent1 = 3672;
public static final int RequestTalenTrackEvent = 1284; public static final int RequestTalenTrackEvent = 1284;
public static final int RequestNewNavigatorDataEvent = 882; //Updated public static final int RequestNewNavigatorDataEvent = 882;
public static final int RequestNewNavigatorRoomsEvent = 2722; public static final int RequestNewNavigatorRoomsEvent = 2722;
public static final int RedeemClothingEvent = 818; public static final int RedeemClothingEvent = 818;
public static final int NewNavigatorActionEvent = 1874; public static final int NewNavigatorActionEvent = 1874;
@ -215,9 +215,9 @@ public class Incoming_20160101
public static final int RequestClubGiftsEvent = 3302; public static final int RequestClubGiftsEvent = 3302;
public static final int RentSpaceEvent = 3486; public static final int RentSpaceEvent = 3486;
public static final int RentSpaceCancelEvent = 1314; public static final int RentSpaceCancelEvent = 1314;
public static final int RequestInitFriendsEvent = 2151; //Updated public static final int RequestInitFriendsEvent = 2151;
public static final int RequestCameraConfigurationEvent = 1341; public static final int RequestCameraConfigurationEvent = 1341;
public static final int PingEvent = 1789; //Updated public static final int PingEvent = 1789;
public static final int FindNewFriendsEvent = 1264; public static final int FindNewFriendsEvent = 1264;
public static final int InviteFriendsEvent = 2694; public static final int InviteFriendsEvent = 2694;
public static final int GuildRemoveFavoriteEvent = 1412; public static final int GuildRemoveFavoriteEvent = 1412;
@ -244,7 +244,7 @@ public class Incoming_20160101
public static final int JukeBoxEventOne = 1042; public static final int JukeBoxEventOne = 1042;
public static final int JukeBoxEventTwo = 815; public static final int JukeBoxEventTwo = 815;
public static final int RoomUserMuteEvent = 2997; public static final int RoomUserMuteEvent = 2997;
//public static final int JukeBoxEventThree = 3846;
public static final int RequestDeleteRoomEvent = 722; public static final int RequestDeleteRoomEvent = 722;
public static final int RequestPromotionRoomsEvent = 3616; public static final int RequestPromotionRoomsEvent = 3616;
public static final int BuyRoomPromotionEvent = 3078; public static final int BuyRoomPromotionEvent = 3078;
@ -262,8 +262,8 @@ public class Incoming_20160101
public static final int GuardianNoUpdatesWantedEvent = 1006; public static final int GuardianNoUpdatesWantedEvent = 1006;
public static final int GuardianVoteEvent = 1913; public static final int GuardianVoteEvent = 1913;
public static final int GuardianAcceptRequestEvent = 3668; public static final int GuardianAcceptRequestEvent = 3668;
public static final int RequestGameConfigurationsEvent = 2993; //Updated public static final int RequestGameConfigurationsEvent = 2993;
public static final int RequestAchievementConfigurationEvent = 751; //Updated public static final int RequestAchievementConfigurationEvent = 751;
public static final int RequestReportUserBullyingEvent = 2973; public static final int RequestReportUserBullyingEvent = 2973;
public static final int ReportBullyEvent = 1803; public static final int ReportBullyEvent = 1803;
public static final int CameraRoomPictureEvent = 2274; public static final int CameraRoomPictureEvent = 2274;

View File

@ -5,7 +5,6 @@ public class Incoming_Back
//public static final int RequestAchievementsEvent = 2562;
@ -31,194 +30,195 @@ public class Incoming_Back
public static final int MannequinSaveLookEvent = 3770;//1804 //Updated
public static final int RequestCatalogPageEvent = 2914;//1754 //Updated public static final int MannequinSaveLookEvent = 3770;
public static final int RequestWearingBadgesEvent = 3466;//3968 //Updated public static final int RequestCatalogPageEvent = 2914;
public static final int BotPickupEvent = 665;//2865 //Updated public static final int RequestWearingBadgesEvent = 3466;
public static final int HorseRideEvent = 1027;//3268 //Updated public static final int BotPickupEvent = 665;
public static final int RequestCreateRoomEvent = 238;//3524 //Updated public static final int HorseRideEvent = 1027;
public static final int SaveMottoEvent = 289;//2832 //Updated //1037 public static final int RequestCreateRoomEvent = 238;
public static final int GenerateSecretKeyEvent = -1;//3575 public static final int SaveMottoEvent = 289;
public static final int ModToolAlertEvent = 2890;//1980 //Updated public static final int GenerateSecretKeyEvent = -1;
public static final int TradeAcceptEvent = 368;//1062 //Updated public static final int ModToolAlertEvent = 2890;
public static final int RequestCatalogModeEvent = 2711;//3406 //Updated public static final int TradeAcceptEvent = 368;
public static final int RequestUserCreditsEvent = 2845;//938 //Updated public static final int RequestCatalogModeEvent = 2711;
public static final int FriendPrivateMessageEvent = 3710;//1527 //Updated public static final int RequestUserCreditsEvent = 2845;
public static final int CloseDiceEvent = 57;//1739 //Updated public static final int FriendPrivateMessageEvent = 3710;
public static final int RoomUserRemoveRightsEvent = 1599;//3639 //Updated public static final int CloseDiceEvent = 57;
public static final int GuildDeclineMembershipEvent = 1328;//1320 //Updated public static final int RoomUserRemoveRightsEvent = 1599;
public static final int AnswerPollEvent = 2135;//1847 //Updated public static final int GuildDeclineMembershipEvent = 1328;
public static final int UserWearBadgeEvent = 741;//2473 //Updated public static final int AnswerPollEvent = 2135;
public static final int RoomVoteEvent = -242;//242 public static final int UserWearBadgeEvent = 741;
public static final int RoomUserSignEvent = 2065;//2189 //Updated public static final int RoomVoteEvent = -242;
public static final int RequestUserDataEvent = 882;//112 //Updated public static final int RoomUserSignEvent = 2065;
public static final int RoomUserShoutEvent = 1788;//936 //Updated public static final int RequestUserDataEvent = 882;
public static final int ScratchPetEvent = 965;//3464 //Updated public static final int RoomUserShoutEvent = 1788;
public static final int RoomUserWalkEvent = 3690;//951 //Updated public static final int ScratchPetEvent = 965;
public static final int RequestUserTagsEvent = 3430;//3102 //Updated public static final int RoomUserWalkEvent = 3690;
public static final int RequestTagsEvent = 753;//1337 //Updated public static final int RequestUserTagsEvent = 3430;
public static final int GetMarketplaceConfigEvent = 3774;//1952 //Updated public static final int RequestTagsEvent = 753;
public static final int RequestHeightmapEvent = 859;//308 //Updated public static final int GetMarketplaceConfigEvent = 3774;
public static final int TradeCloseEvent = 3012;//3387 //Updated public static final int RequestHeightmapEvent = 859;
public static final int CatalogBuyItemEvent = 3964;//2967 //Updated public static final int TradeCloseEvent = 3012;
public static final int RequestGuildMembersEvent = 3204;//2382 //Updated public static final int CatalogBuyItemEvent = 3964;
public static final int RequestPetInformationEvent = 2827;//777 //Updated public static final int RequestGuildMembersEvent = 3204;
public static final int RoomUserWhisperEvent = 3908;//1362 //Updated public static final int RequestPetInformationEvent = 2827;
public static final int ModToolRequestUserInfoEvent = 607;//3077 //Updated public static final int RoomUserWhisperEvent = 3908;
public static final int RotateMoveItemEvent = 1219;//194 //Updated public static final int ModToolRequestUserInfoEvent = 607;
public static final int CancelPollEvent = 1628;//276 //Updated public static final int RotateMoveItemEvent = 1219;
public static final int RequestRoomLoadEvent = 1988;//3751 //2086 //2144 //Updated public static final int CancelPollEvent = 1628;
public static final int RequestGuildPartsEvent = 1902;//2344 //Updated public static final int RequestRoomLoadEvent = 1988;
public static final int RoomPlacePaintEvent = 1892;//874 //Updated public static final int RequestGuildPartsEvent = 1902;
public static final int RequestPopularRoomsEvent = 464;//2346;//235 //Updated public static final int RoomPlacePaintEvent = 1892;
public static final int ModToolRequestRoomInfoEvent = 1450;//225 //Updated public static final int RequestPopularRoomsEvent = 464;
public static final int FriendRequestEvent = 2791;//3765 //Updated public static final int ModToolRequestRoomInfoEvent = 1450;
public static final int RecycleEvent = 3277;//2318 //Updated public static final int FriendRequestEvent = 2791;
public static final int RequestRoomCategoriesEvent = 3498;//1431 //Updated public static final int RecycleEvent = 3277;
public static final int ToggleWallItemEvent = 3050;//2650 //Updated public static final int RequestRoomCategoriesEvent = 3498;
public static final int RoomUserTalkEvent = 104;//3349 //Updated public static final int ToggleWallItemEvent = 3050;
public static final int HotelViewDataEvent = 2507;//595 //Updated //2269 public static final int RoomUserTalkEvent = 104;
public static final int RoomUserDanceEvent = 649;//1139 //Updated public static final int HotelViewDataEvent = 2507;
public static final int RequestUserProfileEvent = 1389;//532 //Updated public static final int RoomUserDanceEvent = 649;
public static final int SearchRoomsFriendsNowEvent = 1082;//3306 //Updated public static final int RequestUserProfileEvent = 1389;
public static final int SetStackHelperHeightEvent = 2790;//2540 //Updated public static final int SearchRoomsFriendsNowEvent = 1082;
public static final int RedeemVoucherEvent = 3024;//1571 //Updated public static final int SetStackHelperHeightEvent = 2790;
public static final int HorseUseItemEvent = 2590;//1616 //Updated public static final int RedeemVoucherEvent = 3024;
public static final int BuyItemEvent = 2847;//3878 //Updated public static final int HorseUseItemEvent = 2590;
public static final int AdvertisingSaveEvent = 1829;//68 //Updated public static final int BuyItemEvent = 2847;
public static final int RequestPetTrainingPanelEvent = 2251;//2476 //Updated public static final int AdvertisingSaveEvent = 1829;
public static final int RoomBackgroundEvent = 2496;//2715 //Updated public static final int RequestPetTrainingPanelEvent = 2251;
public static final int RequestNewsListEvent = 1134;//896 //Updated public static final int RoomBackgroundEvent = 2496;
public static final int RequestPromotedRoomsEvent = 1558;//3030 //Updated public static final int RequestNewsListEvent = 1134;
public static final int GuildSetAdminEvent = 3704;//2957 //Updated public static final int RequestPromotedRoomsEvent = 1558;
public static final int GetClubDataEvent = 3240;//1608 //Updated public static final int GuildSetAdminEvent = 3704;
public static final int RequestMeMenuSettingsEvent = 2169;//671 //Updated public static final int GetClubDataEvent = 3240;
public static final int MannequinSaveNameEvent = 1289;//2098 //Updated public static final int RequestMeMenuSettingsEvent = 2169;
public static final int SellItemEvent = 1522;//172 //Updated public static final int MannequinSaveNameEvent = 1289;
public static final int GuildAcceptMembershipEvent = 538;//1066 //Updated public static final int SellItemEvent = 1522;
public static final int RequestBannerToken = -1;//2619 public static final int GuildAcceptMembershipEvent = 538;
public static final int RequestRecylerLogicEvent = 1170;//1077 //Updated public static final int RequestBannerToken = -1;
public static final int RequestGuildJoinEvent = 794;//77 //Updated public static final int RequestRecylerLogicEvent = 1170;
public static final int RequestCatalogIndexEvent = 2806;//81 //Updated public static final int RequestGuildJoinEvent = 794;
public static final int RequestInventoryPetsEvent = 3760;//1900 //Updated public static final int RequestCatalogIndexEvent = 2806;
public static final int ModToolRequestRoomVisitsEvent = 2287;//2549 //Updated public static final int RequestInventoryPetsEvent = 3760;
public static final int ModToolWarnEvent = 2890;//3763 //Updated public static final int ModToolRequestRoomVisitsEvent = 2287;
public static final int RequestItemInfoEvent = 2042;//36 //Updated public static final int ModToolWarnEvent = 2890;
public static final int ModToolRequestRoomChatlogEvent = 3209;//1903 //Updated public static final int RequestItemInfoEvent = 2042;
public static final int UserSaveLookEvent = 2242;//2404 //Updated public static final int ModToolRequestRoomChatlogEvent = 3209;
public static final int ToggleFloorItemEvent = 2693;//120 //Updated public static final int UserSaveLookEvent = 2242;
public static final int TradeUnAcceptEvent = 126;//1131 //Updated public static final int ToggleFloorItemEvent = 2693;
public static final int WiredTriggerSaveDataEvent = 3593;//3201 //Updated public static final int TradeUnAcceptEvent = 126;
public static final int RoomRemoveAllRightsEvent = 3764;//405 //Updated public static final int WiredTriggerSaveDataEvent = 3593;
public static final int TakeBackItemEvent = 1455;//2910 //Updated public static final int RoomRemoveAllRightsEvent = 3764;
public static final int OpenRecycleBoxEvent = 0x0F00;//3977 //Updated public static final int TakeBackItemEvent = 1455;
public static final int GuildChangeNameDescEvent = 1485;//3232 //Updated public static final int OpenRecycleBoxEvent = 0x0F00;
public static final int RequestSellItemEvent = 876;//2087 //Updated public static final int GuildChangeNameDescEvent = 1485;
public static final int ModToolChangeRoomSettingsEvent = 3244;//2530 //Updated public static final int RequestSellItemEvent = 876;
public static final int ModToolRequestUserChatlogEvent = 3209;//203 //Updated public static final int ModToolChangeRoomSettingsEvent = 3244;
public static final int GuildChangeSettingsEvent = 2258;//2156 //Updated public static final int ModToolRequestUserChatlogEvent = 3209;
public static final int RoomUserDropHandItemEvent = 1108;//157 //Updated public static final int GuildChangeSettingsEvent = 2258;
public static final int RequestProfileFriendsEvent = 3701;//3925 //Updated public static final int RoomUserDropHandItemEvent = 1108;
public static final int TradeCancelOfferItemEvent = 2170;//373 //Updated public static final int RequestProfileFriendsEvent = 3701;
public static final int TriggerDiceEvent = 386;//987 //Updated public static final int TradeCancelOfferItemEvent = 2170;
public static final int GetPollDataEvent = 2263;//1960 //Updated public static final int TriggerDiceEvent = 386;
public static final int MachineIDEvent = 686;//512 public static final int GetPollDataEvent = 2263;
public static final int RequestDiscountEvent = 1995;//3794 //Updated public static final int MachineIDEvent = 686;
public static final int RequestFriendRequestEvent = 3739;//275 //Updated public static final int RequestDiscountEvent = 1995;
public static final int RoomSettingsSaveEvent = 1290;//2384 //Updated public static final int RequestFriendRequestEvent = 3739;
public static final int AcceptFriendRequest = 3383;//333 //Updated public static final int RoomSettingsSaveEvent = 1290;
public static final int ReleaseVersionEvent = 4000;//4000 //Updated public static final int AcceptFriendRequest = 3383;
public static final int SearchRoomsMyFavoriteEvent = 3124;//1532 //Updated public static final int ReleaseVersionEvent = 4000;
public static final int TradeStartEvent = 3304;//466 //Updated public static final int SearchRoomsMyFavoriteEvent = 3124;
public static final int ChangeRelationEvent = 2632;//2521 //Updated public static final int TradeStartEvent = 3304;
public static final int RoomUserSitEvent = 272;//484 //Updated public static final int ChangeRelationEvent = 2632;
public static final int RequestCanCreateRoomEvent = 3903;//3844 //Updated //unsure public static final int RoomUserSitEvent = 272;
public static final int ModToolKickEvent = 1459;//3418 //Updated public static final int RequestCanCreateRoomEvent = 3903;
public static final int MoveWallItemEvent = 3455;//1029 //Updated public static final int ModToolKickEvent = 1459;
public static final int SearchRoomsEvent = 3844;//3551 //Updated public static final int MoveWallItemEvent = 3455;
public static final int RequestHighestScoreRoomsEvent = 1814;//1728 //Updaed public static final int SearchRoomsEvent = 3844;
public static final int CatalogBuyItemAsGiftEvent = 1066;//2474 //Updated public static final int RequestHighestScoreRoomsEvent = 1814;
public static final int RoomUserGiveRespectEvent = 3121;//2041 //Updated public static final int CatalogBuyItemAsGiftEvent = 1066;
public static final int RemoveFriendEvent = 1535;//2786 //Updated public static final int RoomUserGiveRespectEvent = 3121;
public static final int SearchRoomsFriendsOwnEvent = 725;//3478 //Updated public static final int RemoveFriendEvent = 1535;
public static final int GuildSetFavoriteEvent = 2754;//1463 //Updated public static final int SearchRoomsFriendsOwnEvent = 725;
public static final int PetPlaceEvent = 1961;//3711 //Updated public static final int GuildSetFavoriteEvent = 2754;
public static final int BotSettingsEvent = 3292;//3098 //Updated public static final int PetPlaceEvent = 1961;
public static final int StalkFriendEvent = 1925;//3394 //Updated public static final int BotSettingsEvent = 3292;
public static final int RoomPickupItemEvent = 2463;//152 //Updated public static final int StalkFriendEvent = 1925;
public static final int RedeemItemEvent = 1242;//3599 //Updated public static final int RoomPickupItemEvent = 2463;
public static final int RequestFriendsEvent = 1904;//776 //Updated public static final int RedeemItemEvent = 1242;
public static final int RequestAchievementsEvent = 2697;//2562 //Updated public static final int RequestFriendsEvent = 1904;
public static final int GuildChangeColorsEvent = 3873;//463 //Updated public static final int RequestAchievementsEvent = 2697;
public static final int RequestInventoryBadgesEvent = 2450;//3072 //Updated public static final int GuildChangeColorsEvent = 3873;
public static final int RequestPetBreedsEvent = 2828;//1064 //Updated public static final int RequestInventoryBadgesEvent = 2450;
public static final int GuildChangeBadgeEvent = 838;//1475 //Updated public static final int RequestPetBreedsEvent = 2828;
public static final int ModToolBanEvent = 701;//2930 //Updated public static final int GuildChangeBadgeEvent = 838;
public static final int SaveWardrobeEvent = 2921;//637 //Updated public static final int ModToolBanEvent = 701;
public static final int HotelViewEvent = 3603;//3266 //Updated public static final int SaveWardrobeEvent = 2921;
public static final int ModToolPickTicketEvent = 2980;//3975 //Updated public static final int HotelViewEvent = 3603;
public static final int ModToolReleaseTicketEvent = 3905; //Updated public static final int ModToolPickTicketEvent = 2980;
public static final int ModToolCloseTicketEvent = 3904; //Updated public static final int ModToolReleaseTicketEvent = 3905;
public static final int TriggerColorWheelEvent = 2556;//2367 //Updated public static final int ModToolCloseTicketEvent = 3904;
public static final int SearchRoomsByTagEvent = 3844;//1956 //Updated public static final int TriggerColorWheelEvent = 2556;
public static final int RequestPublicRoomsEvent = 2057;//3735 //UPDATED OLD 3178 //Updated public static final int SearchRoomsByTagEvent = 3844;
public static final int RequestResolutionEvent = 305;//1854 //Updated public static final int RequestPublicRoomsEvent = 2057;
public static final int RequestInventoryItemsEvent = 2194;//372 //Updated public static final int RequestResolutionEvent = 305;
public static final int ModToolRoomAlertEvent = 2550;//295 //Updated public static final int RequestInventoryItemsEvent = 2194;
public static final int WiredEffectSaveDataEvent = 2856;//3006 //Updated public static final int ModToolRoomAlertEvent = 2550;
public static final int CheckPetNameEvent = 3699;//678 //Updated public static final int WiredEffectSaveDataEvent = 2856;
public static final int SecureLoginEvent = 2243;//1309 //Updated public static final int CheckPetNameEvent = 3699;
public static final int BotSaveSettingsEvent = 1607;//1384 //Updated public static final int SecureLoginEvent = 2243;
public static final int RequestGuildBuyEvent = 569;//872 //Updated public static final int BotSaveSettingsEvent = 1607;
public static final int SearchUserEvent = 3576;//1267 //Updated public static final int RequestGuildBuyEvent = 569;
public static final int SearchUserEvent = 3576;
public static final int GuildConfirmRemoveMemberEvent = 3394; public static final int GuildConfirmRemoveMemberEvent = 3394;
public static final int GuildRemoveMemberEvent = 1764;//3002 //Updated public static final int GuildRemoveMemberEvent = 1764;
public static final int WiredConditionSaveDataEvent = 3268;//1041 //Updated public static final int WiredConditionSaveDataEvent = 3268;
public static final int RoomUserLookAtPoint = 2283;//1365 //Updated public static final int RoomUserLookAtPoint = 2283;
public static final int MoodLightTurnOnEvent = 3924;//1181 //Updated public static final int MoodLightTurnOnEvent = 3924;
public static final int MoodLightSettingsEvent = 2821;//2468 //Updated public static final int MoodLightSettingsEvent = 2821;
public static final int RequestMyRoomsEvent = 948;//2676 //Updated public static final int RequestMyRoomsEvent = 948;
public static final int RequestCreditsEvent = 3896;//2138 //Updated public static final int RequestCreditsEvent = 3896;
public static final int SearchRoomsInGroupEvent = 2851;//1160 //Updated public static final int SearchRoomsInGroupEvent = 2851;
public static final int HorseRideSettingsEvent = 427;//2448 //Updated public static final int HorseRideSettingsEvent = 427;
public static final int KnockKnockResponseEvent = 853; //Updated public static final int KnockKnockResponseEvent = 853;
public static final int RoomUserKickEvent = 313;//1874 //Updated public static final int RoomUserKickEvent = 313;
public static final int RoomPlaceItemEvent = 3571;//474 //Updated public static final int RoomPlaceItemEvent = 3571;
public static final int RequestInventoryBotsEvent = 1343;//1351 //Updated public static final int RequestInventoryBotsEvent = 1343;
public static final int RequestUserWardrobeEvent = 2976;//1251 //Updated public static final int RequestUserWardrobeEvent = 2976;
public static final int RequestRoomRightsEvent = 63;//2928 //Updated public static final int RequestRoomRightsEvent = 63;
public static final int RequestGuildBuyRoomsEvent = 2945;//701 //Updated public static final int RequestGuildBuyRoomsEvent = 2945;
public static final int BotPlaceEvent = 3906;//148 //Updated public static final int BotPlaceEvent = 3906;
public static final int SearchRoomsWithRightsEvent = 1699;//3785 //Updated public static final int SearchRoomsWithRightsEvent = 1699;
public static final int HotelViewRequestBonusRareEvent = 1521;//1199 //Updated public static final int HotelViewRequestBonusRareEvent = 1521;
public static final int GuildRemoveAdminEvent = 904;//3264 //Updated public static final int GuildRemoveAdminEvent = 904;
public static final int RequestRoomSettingsEvent = 1794;//3741 //Updated public static final int RequestRoomSettingsEvent = 1794;
public static final int RequestOffersEvent = 100;//541 //Updated public static final int RequestOffersEvent = 100;
public static final int RequestUserCitizinShipEvent = 3556;//3096 //Updated public static final int RequestUserCitizinShipEvent = 3556;
public static final int RoomUserStopTypingEvent = 1712;//2005 //Updated public static final int RoomUserStopTypingEvent = 1712;
public static final int RoomUserStartTypingEvent = 3128;//3684 //Updated public static final int RoomUserStartTypingEvent = 3128;
public static final int RequestGuildManageEvent = 3931;//2418 //Updated public static final int RequestGuildManageEvent = 3931;
public static final int RequestUserClubEvent = 675;//3874 //Updated public static final int RequestUserClubEvent = 675;
public static final int PetPickupEvent = 1294;//863 //Updated public static final int PetPickupEvent = 1294;
public static final int RequestOwnGuildsEvent = 2690;//2240 //Updated public static final int RequestOwnGuildsEvent = 2690;
public static final int SearchRoomsVisitedEvent = 3561;//589 //Updated public static final int SearchRoomsVisitedEvent = 3561;
public static final int TradeOfferItemEvent = 2090;//2223 //Updated public static final int TradeOfferItemEvent = 2090;
public static final int TradeConfirmEvent = 1503;//1144 //Updated public static final int TradeConfirmEvent = 1503;
public static final int RoomUserGiveRightsEvent = 503;//2221 //Updated public static final int RoomUserGiveRightsEvent = 503;
public static final int RequestGuildInfoEvent = 844;//2079 //Updated public static final int RequestGuildInfoEvent = 844;
public static final int ReloadRecyclerEvent = 3895;//2779 //Updated public static final int ReloadRecyclerEvent = 3895;
public static final int RoomUserActionEvent = 2522;//475 //Updated public static final int RoomUserActionEvent = 2522;
public static final int RequestGiftConfigurationEvent = 756;//382 //Updated public static final int RequestGiftConfigurationEvent = 756;
public static final int RequestRoomDataEvent = 2022;//183 //Updated public static final int RequestRoomDataEvent = 2022;
public static final int RequestRoomHeightmapEvent = 3936; //Updated public static final int RequestRoomHeightmapEvent = 3936;
public static final int RequestGuildFurniWidgetEvent = 54;//3031 //Updated public static final int RequestGuildFurniWidgetEvent = 54;
public static final int RequestOwnItemsEvent = 1816;//829 //Updated public static final int RequestOwnItemsEvent = 1816;
public static final int RequestReportRoomEvent = 2842; //Updated public static final int RequestReportRoomEvent = 2842;
public static final int ReportEvent = 2073; //Updated public static final int ReportEvent = 2073;
public static final int TriggerOneWayGateEvent = 3752; //Updated public static final int TriggerOneWayGateEvent = 3752;
public static final int FloorPlanEditorSaveEvent = 3509; //Updated public static final int FloorPlanEditorSaveEvent = 3509;
public static final int FloorPlanEditorRequestDoorSettingsEvent = 2691; //Updated public static final int FloorPlanEditorRequestDoorSettingsEvent = 2691;
public static final int FloorPlanEditorRequestBlockedTilesEvent = 2246; //Updated public static final int FloorPlanEditorRequestBlockedTilesEvent = 2246;
public static final int UnknownEvent1 = 3365; public static final int UnknownEvent1 = 3365;
public static final int RequestTalenTrackEvent = 1741; public static final int RequestTalenTrackEvent = 1741;
public static final int RequestNewNavigatorDataEvent = 1192; public static final int RequestNewNavigatorDataEvent = 1192;

View File

@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogItem;
import com.eu.habbo.habbohotel.catalog.CatalogLimitedConfiguration; import com.eu.habbo.habbohotel.catalog.CatalogLimitedConfiguration;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
@ -35,403 +36,416 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler
@Override @Override
public void handle() throws Exception public void handle() throws Exception
{ {
if (ShutdownEmulator.timestamp > 0) if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastGiftTimestamp >= CatalogManager.PURCHASE_COOLDOWN)
{ {
this.client.sendResponse(new HotelWillCloseInMinutesComposer((ShutdownEmulator.timestamp - Emulator.getIntUnixTimestamp()) / 60)); this.client.getHabbo().getHabboStats().lastGiftTimestamp = Emulator.getIntUnixTimestamp();
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); if (ShutdownEmulator.timestamp > 0)
return;
}
int pageId = this.packet.readInt();
int itemId = this.packet.readInt();
String extraData = this.packet.readString();
String username = this.packet.readString();
String message = this.packet.readString();
int spriteId = this.packet.readInt();
int color = this.packet.readInt();
int ribbonId = this.packet.readInt();
boolean showName = this.packet.readBoolean();
int count = 1;
int userId = 0;
if(!Emulator.getGameEnvironment().getCatalogManager().giftWrappers.containsKey(spriteId) && !Emulator.getGameEnvironment().getCatalogManager().giftFurnis.containsKey(spriteId))
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
Emulator.getGameEnvironment();
Emulator.getGameEnvironment().getItemManager();
Integer iItemId = Emulator.getGameEnvironment().getCatalogManager().giftWrappers.get(spriteId);
if(iItemId == null)
iItemId = Emulator.getGameEnvironment().getCatalogManager().giftFurnis.get(spriteId);
if(iItemId == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem(iItemId);
if(giftItem == null)
{
giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer)Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]);
if(giftItem == null)
{ {
this.client.sendResponse(new HotelWillCloseInMinutesComposer((ShutdownEmulator.timestamp - Emulator.getIntUnixTimestamp()) / 60));
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return; return;
} }
}
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) if (this.client.getHabbo().getHabboStats().isPurchasingFurniture)
{
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username);
if(habbo == null)
{ {
try (PreparedStatement statement = connection.prepareStatement("SELECT id FROM users WHERE username = ?")) this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
{ return;
statement.setString(1, username); } else
{
this.client.getHabbo().getHabboStats().isPurchasingFurniture = true;
}
try (ResultSet set = statement.executeQuery()) try
{
int pageId = this.packet.readInt();
int itemId = this.packet.readInt();
String extraData = this.packet.readString();
String username = this.packet.readString();
String message = this.packet.readString();
int spriteId = this.packet.readInt();
int color = this.packet.readInt();
int ribbonId = this.packet.readInt();
boolean showName = this.packet.readBoolean();
int count = 1;
int userId = 0;
if (!Emulator.getGameEnvironment().getCatalogManager().giftWrappers.containsKey(spriteId) && !Emulator.getGameEnvironment().getCatalogManager().giftFurnis.containsKey(spriteId))
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
Emulator.getGameEnvironment();
Emulator.getGameEnvironment().getItemManager();
Integer iItemId = Emulator.getGameEnvironment().getCatalogManager().giftWrappers.get(spriteId);
if (iItemId == null)
iItemId = Emulator.getGameEnvironment().getCatalogManager().giftFurnis.get(spriteId);
if (iItemId == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem(iItemId);
if (giftItem == null)
{
giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]);
if (giftItem == null)
{ {
if (set.next()) this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
{ return;
userId = set.getInt(1);
}
} }
} }
catch (SQLException e)
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{ {
Emulator.getLogging().logSQLException(e); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username);
}
}
else
{
userId = habbo.getHabboInfo().getId();
}
if(userId == 0) if (habbo == null)
{
this.client.sendResponse(new GiftReceiverNotFoundComposer());
return;
}
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().catalogPages.get(pageId);
if(page == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
if(page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId() || !page.isEnabled() || !page.isVisible())
{
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
CatalogItem item = page.getCatalogItem(itemId);
Item cBaseItem = null;
if(item == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
if(item.isClubOnly() && !this.client.getHabbo().getHabboStats().hasActiveClub())
{
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.REQUIRES_CLUB));
return;
}
for(Item baseItem : item.getBaseItems())
{
if(!baseItem.allowGift())
{
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
}
if (item.isLimited())
{
if (item.getLimitedStack() == item.getLimitedSells())
{
this.client.sendResponse(new AlertLimitedSoldOutComposer());
return;
}
item.sellRare();
}
int totalCredits = 0;
int totalPoints = 0;
CatalogLimitedConfiguration limitedConfiguration = null;
int limitedStack = 0;
int limitedNumber = 0;
if (item.isLimited())
{
count = 1;
if (Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(item).available() == 0)
{
habbo.getClient().sendResponse(new AlertLimitedSoldOutComposer());
return;
}
limitedConfiguration = Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(item);
if (limitedConfiguration == null)
{
limitedConfiguration = Emulator.getGameEnvironment().getCatalogManager().createOrUpdateLimitedConfig(item);
}
limitedNumber = limitedConfiguration.getNumber();
limitedStack = limitedConfiguration.getTotalSet();
}
THashSet<HabboItem> itemsList = new THashSet<>();
boolean badgeFound = false;
for (Item baseItem : item.getBaseItems())
{
if (baseItem.getType() == FurnitureType.BADGE)
{
if (habbo != null)
{ {
if(habbo.getInventory().getBadgesComponent().hasBadge(baseItem.getName())) try (PreparedStatement statement = connection.prepareStatement("SELECT id FROM users WHERE username = ?"))
{ {
badgeFound = true; statement.setString(1, username);
}
} try (ResultSet set = statement.executeQuery())
else
{
int c = 0;
try (PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) as c FROM users_badges WHERE user_id = ? AND badge_code LIKE ?"))
{
statement.setInt(1, userId);
statement.setString(2, baseItem.getName());
try (ResultSet rSet = statement.executeQuery())
{ {
if (rSet.next()) if (set.next())
{ {
c = rSet.getInt("c"); userId = set.getInt(1);
}
}
} catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
} else
{
userId = habbo.getHabboInfo().getId();
}
if (userId == 0)
{
this.client.sendResponse(new GiftReceiverNotFoundComposer());
return;
}
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().catalogPages.get(pageId);
if (page == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId() || !page.isEnabled() || !page.isVisible())
{
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
CatalogItem item = page.getCatalogItem(itemId);
Item cBaseItem = null;
if (item == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
if (item.isClubOnly() && !this.client.getHabbo().getHabboStats().hasActiveClub())
{
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.REQUIRES_CLUB));
return;
}
for (Item baseItem : item.getBaseItems())
{
if (!baseItem.allowGift())
{
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
}
if (item.isLimited())
{
if (item.getLimitedStack() == item.getLimitedSells())
{
this.client.sendResponse(new AlertLimitedSoldOutComposer());
return;
}
item.sellRare();
}
int totalCredits = 0;
int totalPoints = 0;
CatalogLimitedConfiguration limitedConfiguration = null;
int limitedStack = 0;
int limitedNumber = 0;
if (item.isLimited())
{
count = 1;
if (Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(item).available() == 0)
{
habbo.getClient().sendResponse(new AlertLimitedSoldOutComposer());
return;
}
limitedConfiguration = Emulator.getGameEnvironment().getCatalogManager().getLimitedConfig(item);
if (limitedConfiguration == null)
{
limitedConfiguration = Emulator.getGameEnvironment().getCatalogManager().createOrUpdateLimitedConfig(item);
}
limitedNumber = limitedConfiguration.getNumber();
limitedStack = limitedConfiguration.getTotalSet();
}
THashSet<HabboItem> itemsList = new THashSet<>();
boolean badgeFound = false;
for (Item baseItem : item.getBaseItems())
{
if (baseItem.getType() == FurnitureType.BADGE)
{
if (habbo != null)
{
if (habbo.getInventory().getBadgesComponent().hasBadge(baseItem.getName()))
{
badgeFound = true;
}
} else
{
int c = 0;
try (PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) as c FROM users_badges WHERE user_id = ? AND badge_code LIKE ?"))
{
statement.setInt(1, userId);
statement.setString(2, baseItem.getName());
try (ResultSet rSet = statement.executeQuery())
{
if (rSet.next())
{
c = rSet.getInt("c");
}
}
}
if (c != 0)
{
badgeFound = true;
} }
} }
} }
if (c != 0)
{
badgeFound = true;
}
} }
}
}
if (badgeFound) if (badgeFound)
{ {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE)); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
return; return;
} }
for(int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
if (item.getCredits() <= this.client.getHabbo().getHabboInfo().getCredits() - totalCredits) if (item.getCredits() <= this.client.getHabbo().getHabboInfo().getCredits() - totalCredits)
{ {
if( if (
item.getPoints() <= this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) - totalPoints) item.getPoints() <= this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) - totalPoints)
//item.getPointsType() == 0 && item.getPoints() <= this.client.getHabbo().getHabboInfo().getPixels() - totalPoints || //item.getPointsType() == 0 && item.getPoints() <= this.client.getHabbo().getHabboInfo().getPixels() - totalPoints ||
{
if (((i + 1) % 6 != 0 && CatalogItem.haveOffer(item)) || !CatalogItem.haveOffer(item))
{
totalCredits += item.getCredits();
totalPoints += item.getPoints();
}
for (int j = 0; j < item.getAmount(); j++)
{
if (item.getAmount() > 1 || item.getBaseItems().size() > 1)
{ {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); if (((i + 1) % 6 != 0 && CatalogItem.haveOffer(item)) || !CatalogItem.haveOffer(item))
return;
}
for (Item baseItem : item.getBaseItems())
{
if (item.getItemAmount(baseItem.getId()) > 1)
{ {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); totalCredits += item.getCredits();
return; totalPoints += item.getPoints();
} }
for(int k = 0; k < item.getItemAmount(baseItem.getId()); k++) for (int j = 0; j < item.getAmount(); j++)
{ {
cBaseItem = baseItem; if (item.getAmount() > 1 || item.getBaseItems().size() > 1)
if (!baseItem.getName().contains("avatar_effect"))
{ {
if (baseItem.getType() == FurnitureType.BADGE) this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
for (Item baseItem : item.getBaseItems())
{
if (item.getItemAmount(baseItem.getId()) > 1)
{ {
if (!badgeFound) this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
for (int k = 0; k < item.getItemAmount(baseItem.getId()); k++)
{
cBaseItem = baseItem;
if (!baseItem.getName().contains("avatar_effect"))
{ {
if (habbo != null) if (baseItem.getType() == FurnitureType.BADGE)
{ {
HabboBadge badge = new HabboBadge(0, baseItem.getName(), 0, habbo); if (!badgeFound)
Emulator.getThreading().run(badge);
habbo.getInventory().getBadgesComponent().addBadge(badge);
}
else
{
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (user_id, badge_code) VALUES (?, ?)"))
{ {
statement.setInt(1, userId); if (habbo != null)
statement.setString(2, baseItem.getName()); {
statement.execute(); HabboBadge badge = new HabboBadge(0, baseItem.getName(), 0, habbo);
Emulator.getThreading().run(badge);
habbo.getInventory().getBadgesComponent().addBadge(badge);
} else
{
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (user_id, badge_code) VALUES (?, ?)"))
{
statement.setInt(1, userId);
statement.setString(2, baseItem.getName());
statement.execute();
}
}
badgeFound = true;
}
} else if (item.getName().startsWith("rentable_bot_"))
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
} else if (Item.isPet(baseItem))
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
} else
{
if (baseItem.getInteractionType().getType() == InteractionTrophy.class || baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class)
{
extraData = this.client.getHabbo().getHabboInfo().getUsername() + (char) 9 + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR) + (char) 9 + extraData;
}
if (baseItem.getInteractionType().getType() == InteractionTeleport.class || baseItem.getInteractionType().getType() == InteractionTeleportTile.class)
{
HabboItem teleportOne = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
HabboItem teleportTwo = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
Emulator.getGameEnvironment().getItemManager().insertTeleportPair(teleportOne.getId(), teleportTwo.getId());
itemsList.add(teleportOne);
itemsList.add(teleportTwo);
} else if (baseItem.getInteractionType().getType() == InteractionHopper.class)
{
HabboItem hopper = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedNumber, limitedNumber, extraData);
Emulator.getGameEnvironment().getItemManager().insertHopper(hopper);
itemsList.add(hopper);
} else if (baseItem.getInteractionType().getType() == InteractionGuildFurni.class || baseItem.getInteractionType().getType() == InteractionGuildGate.class)
{
InteractionGuildFurni habboItem = (InteractionGuildFurni) Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
habboItem.setExtradata("");
habboItem.needsUpdate(true);
int guildId;
try
{
guildId = Integer.parseInt(extraData);
} catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
}
Emulator.getThreading().run(habboItem);
Emulator.getGameEnvironment().getGuildManager().setGuild(habboItem, guildId);
itemsList.add(habboItem);
} else
{
HabboItem habboItem = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
itemsList.add(habboItem);
} }
} }
} else
badgeFound = true; {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("error.catalog.buy.not_yet")));
return;
} }
} }
else if(item.getName().startsWith("rentable_bot_"))
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
else if(Item.isPet(baseItem))
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
else
{
if (baseItem.getInteractionType().getType() == InteractionTrophy.class || baseItem.getInteractionType().getType() == InteractionBadgeDisplay.class)
{
extraData = this.client.getHabbo().getHabboInfo().getUsername() + (char) 9 + Calendar.getInstance().get(Calendar.DAY_OF_MONTH) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1) + "-" + Calendar.getInstance().get(Calendar.YEAR) + (char) 9 + extraData;
}
if (baseItem.getInteractionType().getType() == InteractionTeleport.class || baseItem.getInteractionType().getType() == InteractionTeleportTile.class)
{
HabboItem teleportOne = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
HabboItem teleportTwo = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
Emulator.getGameEnvironment().getItemManager().insertTeleportPair(teleportOne.getId(), teleportTwo.getId());
itemsList.add(teleportOne);
itemsList.add(teleportTwo);
}
else if(baseItem.getInteractionType().getType() == InteractionHopper.class)
{
HabboItem hopper = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedNumber, limitedNumber, extraData);
Emulator.getGameEnvironment().getItemManager().insertHopper(hopper);
itemsList.add(hopper);
}
else if(baseItem.getInteractionType().getType() == InteractionGuildFurni.class || baseItem.getInteractionType().getType() == InteractionGuildGate.class)
{
InteractionGuildFurni habboItem = (InteractionGuildFurni)Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
habboItem.setExtradata("");
habboItem.needsUpdate(true);
int guildId;
try
{
guildId = Integer.parseInt(extraData);
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine(e);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
}
Emulator.getThreading().run(habboItem);
Emulator.getGameEnvironment().getGuildManager().setGuild(habboItem, guildId);
itemsList.add(habboItem);
}
else
{
HabboItem habboItem = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, limitedStack, limitedNumber, extraData);
itemsList.add(habboItem);
}
}
}
else
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("error.catalog.buy.not_yet")));
return;
} }
} }
} }
} }
} }
}
}
String giftData = itemsList.size() + "\t"; String giftData = itemsList.size() + "\t";
for(HabboItem i : itemsList) for (HabboItem i : itemsList)
{ {
giftData += i.getId() + "\t"; giftData += i.getId() + "\t";
} }
giftData += color + "\t" + ribbonId + "\t" + (showName ? "1" : "0") + "\t" + (message.replace("\t", "")) + "\t" + this.client.getHabbo().getHabboInfo().getUsername() + "\t" + this.client.getHabbo().getHabboInfo().getLook(); giftData += color + "\t" + ribbonId + "\t" + (showName ? "1" : "0") + "\t" + (message.replace("\t", "")) + "\t" + this.client.getHabbo().getHabboInfo().getUsername() + "\t" + this.client.getHabbo().getHabboInfo().getLook();
HabboItem gift = Emulator.getGameEnvironment().getItemManager().createGift(username, giftItem, giftData, 0, 0); HabboItem gift = Emulator.getGameEnvironment().getItemManager().createGift(username, giftItem, giftData, 0, 0);
if(gift == null) if (gift == null)
{ {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return; return;
} }
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftGiver")); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftGiver"));
if(habbo != null) if (habbo != null)
{ {
habbo.getClient().sendResponse(new AddHabboItemComposer(gift)); habbo.getClient().sendResponse(new AddHabboItemComposer(gift));
habbo.getClient().getHabbo().getInventory().getItemsComponent().addItem(gift); habbo.getClient().getHabbo().getInventory().getItemsComponent().addItem(gift);
habbo.getClient().sendResponse(new InventoryRefreshComposer()); habbo.getClient().sendResponse(new InventoryRefreshComposer());
THashMap<String, String> keys = new THashMap<>(); THashMap<String, String> keys = new THashMap<>();
keys.put("display", "BUBBLE"); keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}notifications/gift.gif"); keys.put("image", "${image.library.url}notifications/gift.gif");
keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous")); keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous"));
if (showName) if (showName)
{
keys.put("message", Emulator.getTexts().getValue("generic.gift.received").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()));
}
habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys));
}
AchievementManager.progressAchievement(userId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftReceiver"));
if (!this.client.getHabbo().hasPermission("acc_infinite_credits"))
{
if (totalCredits > 0)
{
this.client.getHabbo().giveCredits(-totalCredits);
}
}
if (totalPoints > 0)
{
if (item.getPointsType() == 0 && !this.client.getHabbo().hasPermission("acc_infinite_pixels"))
{
this.client.getHabbo().getHabboInfo().addPixels(-totalPoints);
} else if (!this.client.getHabbo().hasPermission("acc_infinite_points"))
{
this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalPoints);
}
this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -totalPoints, item.getPointsType()));
}
this.client.sendResponse(new PurchaseOKComposer(item));
} catch (Exception e)
{ {
keys.put("message", Emulator.getTexts().getValue("generic.gift.received").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername())); Emulator.getLogging().logPacketError(e);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
} }
habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys)); } finally
}
AchievementManager.progressAchievement(userId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftReceiver"));
if(!this.client.getHabbo().hasPermission("acc_infinite_credits"))
{ {
if (totalCredits > 0) this.client.getHabbo().getHabboStats().isPurchasingFurniture = false;
{
this.client.getHabbo().giveCredits(-totalCredits);
}
} }
if(totalPoints > 0)
{
if(item.getPointsType() == 0 && !this.client.getHabbo().hasPermission("acc_infinite_pixels")) {
this.client.getHabbo().getHabboInfo().addPixels(-totalPoints);
}else if(!this.client.getHabbo().hasPermission("acc_infinite_points")) {
this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalPoints);
}
this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()), -totalPoints, item.getPointsType()));
}
this.client.sendResponse(new PurchaseOKComposer(item));
} }
catch(Exception e) else
{ {
Emulator.getLogging().logPacketError(e);
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
} }
} }
} }

View File

@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.catalog;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogItem; import com.eu.habbo.habbohotel.catalog.CatalogItem;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.catalog.CatalogPage; import com.eu.habbo.habbohotel.catalog.CatalogPage;
import com.eu.habbo.habbohotel.catalog.ClubOffer; import com.eu.habbo.habbohotel.catalog.ClubOffer;
import com.eu.habbo.habbohotel.catalog.layouts.ClubBuyLayout; import com.eu.habbo.habbohotel.catalog.layouts.ClubBuyLayout;
@ -30,213 +31,198 @@ public class CatalogBuyItemEvent extends MessageHandler
@Override @Override
public void handle() throws Exception public void handle() throws Exception
{ {
if (ShutdownEmulator.timestamp > 0) if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp >= CatalogManager.PURCHASE_COOLDOWN)
{ {
this.client.sendResponse(new HotelWillCloseInMinutesComposer((ShutdownEmulator.timestamp - Emulator.getIntUnixTimestamp()) / 60)); this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
return; if (ShutdownEmulator.timestamp > 0)
}
int pageId = this.packet.readInt();
int itemId = this.packet.readInt();
String extraData = this.packet.readString();
int count = this.packet.readInt();
try
{
if (this.client.getHabbo().getInventory().getItemsComponent().itemCount() > HabboInventory.MAXIMUM_ITEMS)
{ {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); this.client.sendResponse(new HotelWillCloseInMinutesComposer((ShutdownEmulator.timestamp - Emulator.getIntUnixTimestamp()) / 60));
this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("inventory.full")));
return; return;
} }
}
catch (Exception e)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
}
CatalogPage page = null; int pageId = this.packet.readInt();
int itemId = this.packet.readInt();
String extraData = this.packet.readString();
int count = this.packet.readInt();
if(pageId == -12345678 || pageId == -1) try
{
CatalogItem searchedItem = Emulator.getGameEnvironment().getCatalogManager().getCatalogItem(itemId);
if (searchedItem.getOfferId() > 0)
{ {
page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(searchedItem.getPageId()); if (this.client.getHabbo().getInventory().getItemsComponent().itemCount() > HabboInventory.MAXIMUM_ITEMS)
if (page.getCatalogItem(itemId).getOfferId() <= 0)
{ {
page = null; this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("inventory.full")));
return;
} }
else } catch (Exception e)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
}
CatalogPage page = null;
if (pageId == -12345678 || pageId == -1)
{
CatalogItem searchedItem = Emulator.getGameEnvironment().getCatalogManager().getCatalogItem(itemId);
if (searchedItem.getOfferId() > 0)
{ {
if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId()) page = Emulator.getGameEnvironment().getCatalogManager().getCatalogPage(searchedItem.getPageId());
if (page.getCatalogItem(itemId).getOfferId() <= 0)
{ {
page = null; page = null;
} else
{
if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId())
{
page = null;
}
} }
} }
} } else
}
else
{
page = Emulator.getGameEnvironment().getCatalogManager().catalogPages.get(pageId);
if(page instanceof RoomBundleLayout)
{ {
final CatalogItem[] item = new CatalogItem[1]; page = Emulator.getGameEnvironment().getCatalogManager().catalogPages.get(pageId);
page.getCatalogItems().forEachValue(new TObjectProcedure<CatalogItem>()
{
@Override
public boolean execute(CatalogItem object)
{
item[0] = object;
return false;
}
});
if(item[0] == null || item[0].getCredits() > this.client.getHabbo().getHabboInfo().getCredits() || item[0].getPoints() > this.client.getHabbo().getHabboInfo().getCurrencyAmount(item[0].getPointsType())) if (page instanceof RoomBundleLayout)
{ {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR)); final CatalogItem[] item = new CatalogItem[1];
page.getCatalogItems().forEachValue(new TObjectProcedure<CatalogItem>()
{
@Override
public boolean execute(CatalogItem object)
{
item[0] = object;
return false;
}
});
if (item[0] == null || item[0].getCredits() > this.client.getHabbo().getHabboInfo().getCredits() || item[0].getPoints() > this.client.getHabbo().getHabboInfo().getCurrencyAmount(item[0].getPointsType()))
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
}
((RoomBundleLayout) page).buyRoom(this.client.getHabbo());
if (!this.client.getHabbo().hasPermission("acc_infinite_credits"))
{
this.client.getHabbo().getHabboInfo().addCredits(-item[0].getCredits());
}
if (!this.client.getHabbo().hasPermission("acc_inifinte_points"))
{
this.client.getHabbo().getHabboInfo().addCurrencyAmount(item[0].getPointsType(), -item[0].getPoints());
}
this.client.sendResponse(new PurchaseOKComposer());
final boolean[] badgeFound = {false};
item[0].getBaseItems().stream().filter(i -> i.getType() == FurnitureType.BADGE).forEach(i -> {
if (!this.client.getHabbo().getInventory().getBadgesComponent().hasBadge(i.getName()))
{
HabboBadge badge = new HabboBadge(0, i.getName(), 0, this.client.getHabbo());
Emulator.getThreading().run(badge);
this.client.getHabbo().getInventory().getBadgesComponent().addBadge(badge);
this.client.sendResponse(new AddUserBadgeComposer(badge));
THashMap<String, String> keys = new THashMap<>();
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys)); //:test 1992 s:npc.gift.received i:2 s:npc_name s:Admin s:image s:${image.library.url}album1584/ADM.gif);
} else
{
badgeFound[0] = true;
}
});
if (badgeFound[0])
{
this.client.getHabbo().getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
}
return; return;
} }
((RoomBundleLayout)page).buyRoom(this.client.getHabbo());
if (!this.client.getHabbo().hasPermission("acc_infinite_credits"))
{
this.client.getHabbo().getHabboInfo().addCredits(-item[0].getCredits());
}
if (!this.client.getHabbo().hasPermission("acc_inifinte_points"))
{
this.client.getHabbo().getHabboInfo().addCurrencyAmount(item[0].getPointsType(), -item[0].getPoints());
}
this.client.sendResponse(new PurchaseOKComposer());
final boolean[] badgeFound = {false};
item[0].getBaseItems().stream().filter(i -> i.getType() == FurnitureType.BADGE).forEach(i -> {
if (!this.client.getHabbo().getInventory().getBadgesComponent().hasBadge(i.getName()))
{
HabboBadge badge = new HabboBadge(0, i.getName(), 0, this.client.getHabbo());
Emulator.getThreading().run(badge);
this.client.getHabbo().getInventory().getBadgesComponent().addBadge(badge);
this.client.sendResponse(new AddUserBadgeComposer(badge));
THashMap<String, String> keys = new THashMap<>();
keys.put("display", "BUBBLE");
keys.put("image", "${image.library.url}album1584/" + badge.getCode() + ".gif");
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys)); //:test 1992 s:npc.gift.received i:2 s:npc_name s:Admin s:image s:${image.library.url}album1584/ADM.gif);
}
else
{
badgeFound[0] = true;
}
});
if (badgeFound[0])
{
this.client.getHabbo().getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
}
return;
} }
}
if(page == null) if (page == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return;
}
if(page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId())
{
this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
if(page instanceof ClubBuyLayout || page instanceof VipBuyLayout)
{
ClubOffer item = Emulator.getGameEnvironment().getCatalogManager().clubOffers.get(itemId);
if(item == null)
{ {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose()); this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return; return;
} }
int totalDays = 0; if (page.getRank() > this.client.getHabbo().getHabboInfo().getRank().getId())
int totalCredits = 0;
int totalDuckets = 0;
for(int i = 0; i < count; i++)
{ {
totalDays += item.getDays(); this.client.sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
totalCredits += item.getCredits(); return;
totalDuckets += item.getPoints();
} }
if(totalDays > 0) if (page instanceof ClubBuyLayout || page instanceof VipBuyLayout)
{ {
if(this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) < totalDuckets) ClubOffer item = Emulator.getGameEnvironment().getCatalogManager().clubOffers.get(itemId);
if (item == null)
{
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
return; return;
}
if (this.client.getHabbo().getHabboInfo().getCredits() < totalCredits) int totalDays = 0;
return; int totalCredits = 0;
int totalDuckets = 0;
if (!this.client.getHabbo().hasPermission("acc_infinite_credits")) for (int i = 0; i < count; i++)
this.client.getHabbo().getHabboInfo().addCredits(-totalCredits); {
totalDays += item.getDays();
totalCredits += item.getCredits();
totalDuckets += item.getPoints();
}
if (!this.client.getHabbo().hasPermission("acc_infinite_points")) if (totalDays > 0)
this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalDuckets); {
if (this.client.getHabbo().getHabboInfo().getCurrencyAmount(item.getPointsType()) < totalDuckets)
return;
if(this.client.getHabbo().getHabboStats().getClubExpireTimestamp() <= Emulator.getIntUnixTimestamp()) if (this.client.getHabbo().getHabboInfo().getCredits() < totalCredits)
this.client.getHabbo().getHabboStats().setClubExpireTimestamp(Emulator.getIntUnixTimestamp()); return;
this.client.getHabbo().getHabboStats().setClubExpireTimestamp(this.client.getHabbo().getHabboStats().getClubExpireTimestamp() + (totalDays * 86400)); if (!this.client.getHabbo().hasPermission("acc_infinite_credits"))
this.client.sendResponse(new UserPermissionsComposer(this.client.getHabbo())); this.client.getHabbo().getHabboInfo().addCredits(-totalCredits);
this.client.sendResponse(new UserClubComposer(this.client.getHabbo()));
if (totalCredits > 0) if (!this.client.getHabbo().hasPermission("acc_infinite_points"))
this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo())); this.client.getHabbo().getHabboInfo().addCurrencyAmount(item.getPointsType(), -totalDuckets);
if (totalDuckets > 0) if (this.client.getHabbo().getHabboStats().getClubExpireTimestamp() <= Emulator.getIntUnixTimestamp())
this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo())); this.client.getHabbo().getHabboStats().setClubExpireTimestamp(Emulator.getIntUnixTimestamp());
this.client.sendResponse(new PurchaseOKComposer(null)); this.client.getHabbo().getHabboStats().setClubExpireTimestamp(this.client.getHabbo().getHabboStats().getClubExpireTimestamp() + (totalDays * 86400));
this.client.sendResponse(new InventoryRefreshComposer()); this.client.sendResponse(new UserPermissionsComposer(this.client.getHabbo()));
this.client.sendResponse(new UserClubComposer(this.client.getHabbo()));
if (totalCredits > 0)
this.client.sendResponse(new UserCreditsComposer(this.client.getHabbo()));
if (totalDuckets > 0)
this.client.sendResponse(new UserCurrencyComposer(this.client.getHabbo()));
this.client.sendResponse(new PurchaseOKComposer(null));
this.client.sendResponse(new InventoryRefreshComposer());
}
return;
} }
return;
CatalogItem item;
if (page instanceof RecentPurchasesLayout)
item = this.client.getHabbo().getHabboStats().getRecentPurchases().get(itemId);
else
item = page.getCatalogItem(itemId);
Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false);
} }
CatalogItem item;
if(page instanceof RecentPurchasesLayout)
item = this.client.getHabbo().getHabboStats().getRecentPurchases().get(itemId);
else else
item = page.getCatalogItem(itemId); {
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR).compose());
Emulator.getGameEnvironment().getCatalogManager().purchaseItem(page, item, this.client.getHabbo(), count, extraData, false); }
} }
} }

View File

@ -0,0 +1,48 @@
package com.eu.habbo.messages.incoming.catalog;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.catalog.CatalogItem;
import com.eu.habbo.habbohotel.catalog.CatalogManager;
import com.eu.habbo.habbohotel.catalog.TargetOffer;
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
import com.eu.habbo.messages.incoming.MessageHandler;
public class PurchaseTargetOfferEvent extends MessageHandler
{
@Override
public void handle() throws Exception
{
int offerId = this.packet.readInt();
int amount = this.packet.readInt();
if (amount <= 0) return;
if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastPurchaseTimestamp >= CatalogManager.PURCHASE_COOLDOWN)
{
this.client.getHabbo().getHabboStats().lastPurchaseTimestamp = Emulator.getIntUnixTimestamp();
TargetOffer offer = Emulator.getGameEnvironment().getCatalogManager().getTargetOffer(offerId);
HabboOfferPurchase purchase = HabboOfferPurchase.getOrCreate(this.client.getHabbo(), offerId);
if (purchase != null)
{
amount = Math.min(offer.getPurchaseLimit() - purchase.getAmount(), amount);
int now = Emulator.getIntUnixTimestamp();
if (offer.getExpirationTime() > now)
{
purchase.update(amount, now);
CatalogItem item = Emulator.getGameEnvironment().getCatalogManager().getCatalogItem(offer.getCatalogItem());
if (item.isLimited())
{
amount = 1;
}
Emulator.getGameEnvironment().getCatalogManager().purchaseItem(null, item, this.client.getHabbo(), amount, "", false);
}
}
}
}
}

View File

@ -0,0 +1,20 @@
package com.eu.habbo.messages.incoming.catalog;
import com.eu.habbo.habbohotel.users.cache.HabboOfferPurchase;
import com.eu.habbo.messages.incoming.MessageHandler;
public class TargetOfferStateEvent extends MessageHandler
{
@Override
public void handle() throws Exception
{
int id = this.packet.readInt();
int state = this.packet.readInt();
HabboOfferPurchase purchase = this.client.getHabbo().getHabboStats().getHabboOfferPurchase(id);
if (purchase != null)
{
purchase.setState(state);
}
}
}

View File

@ -2,9 +2,11 @@ package com.eu.habbo.messages.incoming.handshake;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.catalog.TargetOffer;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer; import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer;
import com.eu.habbo.messages.outgoing.unknown.NuxAlertComposer; import com.eu.habbo.messages.outgoing.unknown.NuxAlertComposer;
import com.eu.habbo.messages.outgoing.unknown.TargetedOfferComposer;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -108,6 +110,15 @@ public class UsernameEvent extends MessageHandler
this.client.sendResponse(new NuxAlertComposer("openView/calendar")); this.client.sendResponse(new NuxAlertComposer("openView/calendar"));
} }
if (TargetOffer.ACTIVE_TARGET_OFFER_ID > 0)
{
TargetOffer offer = Emulator.getGameEnvironment().getCatalogManager().getTargetOffer(TargetOffer.ACTIVE_TARGET_OFFER_ID);
if (offer != null)
{
this.client.sendResponse(new TargetedOfferComposer(this.client.getHabbo(), offer));
}
}
this.client.getHabbo().getHabboInfo().setLastOnline(Emulator.getIntUnixTimestamp()); this.client.getHabbo().getHabboInfo().setLastOnline(Emulator.getIntUnixTimestamp());
} }

View File

@ -0,0 +1,28 @@
package com.eu.habbo.messages.incoming.hotelview;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.hotelview.HotelViewNextLTDAvailableComposer;
public class HotelViewRequestLTDAvailabilityEvent extends MessageHandler
{
public static boolean ENABLED = false;
public static int TIMESTAMP;
public static int ITEM_ID;
public static int PAGE_ID;
public static String ITEM_NAME;
@Override
public void handle() throws Exception
{
if (ENABLED)
{
int timeremaining = Math.max(TIMESTAMP - Emulator.getIntUnixTimestamp(), 0);
this.client.sendResponse(new HotelViewNextLTDAvailableComposer(
timeremaining,
timeremaining > 0 ? - 1 : ITEM_ID,
timeremaining > 0 ? - 1 : PAGE_ID,
timeremaining > 0 ? "" : ITEM_NAME));
}
}
}

View File

@ -8,6 +8,6 @@ public class TestInventoryEvent extends MessageHandler
@Override @Override
public void handle() throws Exception public void handle() throws Exception
{ {
//this.client.sendResponse(new InventoryItemsComposer(this.client.getHabbo(), items));
} }
} }

View File

@ -24,7 +24,7 @@ public class ModToolPickTicketEvent extends MessageHandler
if(issue.state == ModToolTicketState.PICKED) if(issue.state == ModToolTicketState.PICKED)
{ {
this.client.sendResponse(new ModToolIssueInfoComposer(issue)); this.client.sendResponse(new ModToolIssueInfoComposer(issue));
this.client.sendResponse(new GenericAlertComposer("Picking issue failedd: \rTicket already picked or does not exist!")); this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("support.ticket.picked.failed")));
return; return;
} }
@ -34,7 +34,7 @@ public class ModToolPickTicketEvent extends MessageHandler
} }
else else
{ {
this.client.sendResponse(new GenericAlertComposer("Picking issue failed: \rTicket already picked or does not exist!")); this.client.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("support.ticket.picked.failed")));
} }
} }
else else

View File

@ -22,7 +22,7 @@ public class ModToolSanctionTradeLockEvent extends MessageHandler
if (habbo != null) if (habbo != null)
{ {
habbo.getHabboStats().allowTrade = false; habbo.getHabboStats().setAllowTrade(false);
habbo.alert(message); habbo.alert(message);
} }
else else

View File

@ -92,7 +92,7 @@ public class ReportEvent extends MessageHandler
{ {
if (cfhTopic.action == CfhActionType.AUTO_IGNORE) if (cfhTopic.action == CfhActionType.AUTO_IGNORE)
{ {
client.getHabbo().getHabboStats().ignoredUsers.add(reported.getHabboInfo().getId()); client.getHabbo().getHabboStats().ignoreUser(reported.getHabboInfo().getId());
client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED)); client.sendResponse(new RoomUserIgnoredComposer(reported, RoomUserIgnoredComposer.IGNORED));
} }
@ -129,7 +129,7 @@ public class ReportEvent extends MessageHandler
{ {
if(cfhTopic.action == CfhActionType.AUTO_IGNORE) if(cfhTopic.action == CfhActionType.AUTO_IGNORE)
{ {
client.getHabbo().getHabboStats().ignoredUsers.add(issue.reportedId); client.getHabbo().getHabboStats().ignoreUser(issue.reportedId);
Habbo reported = Emulator.getGameEnvironment().getHabboManager().getHabbo(issue.reportedId); Habbo reported = Emulator.getGameEnvironment().getHabboManager().getHabbo(issue.reportedId);
if (reported != null) if (reported != null)
{ {

View File

@ -127,7 +127,7 @@ public class BotSaveSettingsEvent extends MessageHandler
break; break;
case 3: case 3:
bot.getRoomUnit().setCanWalk(!bot.getRoomUnit().canWalk()); bot.setCanWalk(!bot.canWalk());
bot.needsUpdate(true); bot.needsUpdate(true);
break; break;

View File

@ -1,6 +1,7 @@
package com.eu.habbo.messages.incoming.rooms.items; package com.eu.habbo.messages.incoming.rooms.items;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
@ -21,12 +22,18 @@ public class PostItDeleteEvent extends MessageHandler
HabboItem item = room.getHabboItem(itemId); HabboItem item = room.getHabboItem(itemId);
if(item == null || item.getUserId() != this.client.getHabbo().getHabboInfo().getId()) if (item instanceof InteractionPostIt)
return; {
if (item == null)
return;
item.setRoomId(0); if (item.getUserId() == this.client.getHabbo().getHabboInfo().getId() || room.isOwner(this.client.getHabbo()))
room.removeHabboItem(item); {
room.sendComposer(new RemoveWallItemComposer(item).compose()); item.setRoomId(0);
Emulator.getThreading().run(new QueryDeleteHabboItem(item)); room.removeHabboItem(item);
room.sendComposer(new RemoveWallItemComposer(item).compose());
Emulator.getThreading().run(new QueryDeleteHabboItem(item));
}
}
} }
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.messages.incoming.rooms.items; package com.eu.habbo.messages.incoming.rooms.items;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt; import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
import com.eu.habbo.habbohotel.items.interactions.InteractionStickyPole; import com.eu.habbo.habbohotel.items.interactions.InteractionStickyPole;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
@ -8,6 +9,7 @@ import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer; import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer;
import com.eu.habbo.messages.outgoing.rooms.items.AddWallItemComposer; import com.eu.habbo.messages.outgoing.rooms.items.AddWallItemComposer;
import com.eu.habbo.messages.outgoing.rooms.items.PostItStickyPoleOpenComposer;
public class PostItPlaceEvent extends MessageHandler public class PostItPlaceEvent extends MessageHandler
{ {
@ -37,6 +39,14 @@ public class PostItPlaceEvent extends MessageHandler
this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item); this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
this.client.sendResponse(new RemoveHabboItemComposer(item.getId())); this.client.sendResponse(new RemoveHabboItemComposer(item.getId()));
Emulator.getThreading().run(item); Emulator.getThreading().run(item);
if (room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId())
{
AchievementManager.progressAchievement(room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesReceived"));
AchievementManager.progressAchievement(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesLeft"));
}
this.client.sendResponse(new PostItStickyPoleOpenComposer(item));
} }
} }
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.messages.incoming.rooms.items; package com.eu.habbo.messages.incoming.rooms.items;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.PostItColor;
import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt; import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
@ -15,6 +16,17 @@ public class PostItSaveDataEvent extends MessageHandler
String color = this.packet.readString(); String color = this.packet.readString();
String text = this.packet.readString(); String text = this.packet.readString();
if (text.length() > 366)
{
Emulator.getGameEnvironment().getModToolManager().quickTicket(this.client.getHabbo(), "Scripter", Emulator.getTexts().getValue("scripter.warning.sticky.size").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%amount%", text.length() + "").replace("%limit%", "366"));
if (text.length() >= 400)
{
this.client.getHabbo().alert("8=====D~~~~~<br><br>Computer Says:<b><u>NO</u></b>");
}
return;
}
text = text.replace(((char) 9) + "", ""); text = text.replace(((char) 9) + "", "");
if(text.startsWith("#") || text.startsWith(" #")) if(text.startsWith("#") || text.startsWith(" #"))
{ {
@ -37,7 +49,7 @@ public class PostItSaveDataEvent extends MessageHandler
if(item == null || !(item instanceof InteractionPostIt)) if(item == null || !(item instanceof InteractionPostIt))
return; return;
if(!color.equalsIgnoreCase("FFFF33") && !room.hasRights(this.client.getHabbo())&& item.getUserId() != this.client.getHabbo().getHabboInfo().getId()) if(!color.equalsIgnoreCase(PostItColor.YELLOW.hexColor) && !room.hasRights(this.client.getHabbo())&& item.getUserId() != this.client.getHabbo().getHabboInfo().getId())
{ {
if(!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], ""))) if(!text.startsWith(item.getExtradata().replace(item.getExtradata().split(" ")[0], "")))
{ {
@ -51,8 +63,9 @@ public class PostItSaveDataEvent extends MessageHandler
} }
if(color.isEmpty()) if(color.isEmpty())
color = "FFFF33"; color = PostItColor.YELLOW.hexColor;
item.setUserId(room.getOwnerId());
item.setExtradata(color + " " + text); item.setExtradata(color + " " + text);
item.needsUpdate(true); item.needsUpdate(true);
room.updateItem(item); room.updateItem(item);

View File

@ -162,9 +162,9 @@ public class RoomPlaceItemEvent extends MessageHandler
} }
} }
double checkStackHeight = room.getStackHeight(x, y, true); double checkStackHeight = room.getStackHeight(x, y, false);
if (checkStackHeight > 0 && item instanceof InteractionRoller) if (checkStackHeight != (double)room.getLayout().getTile(x, y).z && item instanceof InteractionRoller)
{ {
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}"));
return; return;

View File

@ -116,8 +116,13 @@ public class RotateMoveItemEvent extends MessageHandler
//room.removeHabboItem(item.getId()); //room.removeHabboItem(item.getId());
double checkStackHeight = item.getZ(); double checkStackHeight = item.getZ();
Rectangle newSquare = RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); Rectangle newSquare = RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
if (room.getStackHeight(x, y, false, item) != (double)room.getLayout().getTile((short)x, (short)y).z && item instanceof InteractionRoller)
{
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}"));
this.client.sendResponse(new FloorItemUpdateComposer(item));
return;
}
//if (x != item.getX() || y != item.getY() || item.getRotation() != rotation) //if (x != item.getX() || y != item.getY() || item.getRotation() != rotation)
if (hasStackHelper == null) if (hasStackHelper == null)
@ -130,8 +135,7 @@ public class RotateMoveItemEvent extends MessageHandler
double testheight = room.getStackHeight(i, j, false, item); double testheight = room.getStackHeight(i, j, false, item);
if ( if (
(checkStackHeight != testheight && !(item instanceof InteractionStackHelper)) || (checkStackHeight != testheight && !(item instanceof InteractionStackHelper)) ||
(!room.getHabbosAt(i, j).isEmpty() && !(oldX == x && oldY == y) && !(item instanceof InteractionStackHelper)) || (!room.getHabbosAt(i, j).isEmpty() && !(oldX == x && oldY == y) && !(item instanceof InteractionStackHelper))
(checkStackHeight > 0 && item instanceof InteractionRoller)
) )
{ {
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}"));

View File

@ -2,8 +2,14 @@ package com.eu.habbo.messages.incoming.rooms.items;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.CommandHandler; import com.eu.habbo.habbohotel.commands.CommandHandler;
import com.eu.habbo.habbohotel.items.PostItColor;
import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import java.time.LocalDate;
public class SavePostItStickyPoleEvent extends MessageHandler public class SavePostItStickyPoleEvent extends MessageHandler
{ {
@Override @Override
@ -11,10 +17,10 @@ public class SavePostItStickyPoleEvent extends MessageHandler
{ {
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
this.packet.readString();
String color = this.packet.readString();
if(itemId == -1234) if(itemId == -1234)
{ {
this.packet.readString();
this.packet.readString();
if(this.client.getHabbo().hasPermission("cmd_multi")) if(this.client.getHabbo().hasPermission("cmd_multi"))
{ {
String[] commands = this.packet.readString().split("\r"); String[] commands = this.packet.readString().split("\r");
@ -30,5 +36,35 @@ public class SavePostItStickyPoleEvent extends MessageHandler
Emulator.getLogging().logUserLine("Scripter Alert! " + this.client.getHabbo().getHabboInfo().getUsername() + " | " + this.packet.readString()); Emulator.getLogging().logUserLine("Scripter Alert! " + this.client.getHabbo().getHabboInfo().getUsername() + " | " + this.packet.readString());
} }
} }
else
{
String text = this.packet.readString();
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
HabboItem sticky = room.getHabboItem(itemId);
if (sticky != null)
{
if (sticky.getUserId() == this.client.getHabbo().getHabboInfo().getId())
{
sticky.setUserId(room.getOwnerId());
if (color.equalsIgnoreCase(PostItColor.YELLOW.hexColor))
{
color = PostItColor.randomColorNotYellow().hexColor;
}
if (!InteractionPostIt.STICKYPOLE_PREFIX_TEXT.isEmpty())
{
text = InteractionPostIt.STICKYPOLE_PREFIX_TEXT.replace("\\r", "\r").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%timestamp%", LocalDate.now().toString()) + text;
}
sticky.setUserId(room.getOwnerId());
sticky.setExtradata(color + " " + text);
sticky.needsUpdate(true);
room.updateItem(sticky);
Emulator.getThreading().run(sticky);
}
}
}
} }
} }

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.rooms.UpdateStackHeightComposer; import com.eu.habbo.messages.outgoing.rooms.UpdateStackHeightComposer;
import com.eu.habbo.messages.outgoing.rooms.items.UpdateStackHeightTileHeightComposer;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
public class SetStackHelperHeightEvent extends MessageHandler public class SetStackHelperHeightEvent extends MessageHandler
@ -24,39 +25,18 @@ public class SetStackHelperHeightEvent extends MessageHandler
if(item instanceof InteractionStackHelper) if(item instanceof InteractionStackHelper)
{ {
int stackerHeight = this.packet.readInt();
item.setExtradata(stackerHeight + "");
double height = 0;
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
THashSet<RoomTile> tiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); RoomTile itemTile = room.getLayout().getTile(item.getX(), item.getY());
int stackerHeight = Math.min(Math.max(this.packet.readInt(), itemTile.z * 100), 4000);
THashSet<RoomTile> tiles = room.getLayout().getTilesAt(itemTile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
double height = 0;
if(stackerHeight >= 0) if(stackerHeight >= 0)
{ {
height = stackerHeight / 100.0D; height = stackerHeight / 100.0D;
} }
else
{
for (RoomTile tile : tiles)
{
double tileHeight = this.client.getHabbo().getHabboInfo().getCurrentRoom().getTopHeightAt(tile.x, tile.y);
if (tileHeight > height)
{
height = tileHeight;
}
}
}
for (RoomTile tile : tiles)
{
if (height < tile.z)
{
height = tile.z;
}
}
for (RoomTile tile : tiles) for (RoomTile tile : tiles)
{ {
@ -69,6 +49,7 @@ public class SetStackHelperHeightEvent extends MessageHandler
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateItem(item); this.client.getHabbo().getHabboInfo().getCurrentRoom().updateItem(item);
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTiles(tiles); this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTiles(tiles);
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(tiles).compose()); this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(tiles).compose());
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightTileHeightComposer(item, (int)((height) * 100)).compose());
} }
} }
} }

View File

@ -28,7 +28,9 @@ public class MovePetEvent extends MessageHandler
if (tile != null) if (tile != null)
{ {
pet.getRoomUnit().setLocation(tile); pet.getRoomUnit().setLocation(tile);
pet.getRoomUnit().setZ(this.packet.readInt()); pet.getRoomUnit().setPreviousLocation(tile);
pet.getRoomUnit().setZ(this.packet.readInt() + tile.z);
pet.getRoomUnit().setPreviousLocationZ(pet.getRoomUnit().getZ());
room.sendComposer(new RoomUserStatusComposer(pet.getRoomUnit()).compose()); room.sendComposer(new RoomUserStatusComposer(pet.getRoomUnit()).compose());
pet.needsUpdate = true; pet.needsUpdate = true;
} }

View File

@ -26,7 +26,7 @@ public class IgnoreRoomUserEvent extends MessageHandler
return; return;
{ {
this.client.getHabbo().getHabboStats().ignoredUsers.add(habbo.getHabboInfo().getId()); this.client.getHabbo().getHabboStats().ignoreUser(habbo.getHabboInfo().getId());
this.client.sendResponse(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.IGNORED)); this.client.sendResponse(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.IGNORED));
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModIgnoreSeen")); AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModIgnoreSeen"));
} }

View File

@ -1,12 +1,7 @@
package com.eu.habbo.messages.incoming.rooms.users; package com.eu.habbo.messages.incoming.rooms.users;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.incoming.MessageHandler;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserRespectComposer;
public class RoomUserGiveRespectEvent extends MessageHandler public class RoomUserGiveRespectEvent extends MessageHandler
{ {
@ -19,19 +14,7 @@ public class RoomUserGiveRespectEvent extends MessageHandler
{ {
Habbo target = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(userId); Habbo target = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(userId);
if(target != null && target != this.client.getHabbo()) this.client.getHabbo().respect(target);
{
target.getHabboStats().respectPointsReceived++;
this.client.getHabbo().getHabboStats().respectPointsGiven++;
this.client.getHabbo().getHabboStats().respectPointsToGive--;
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserRespectComposer(target).compose());
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserActionComposer(this.client.getHabbo().getRoomUnit(), RoomUserAction.THUMB_UP).compose());
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectGiven"));
AchievementManager.progressAchievement(target, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned"));
this.client.getHabbo().getHabboInfo().getCurrentRoom().unIdle(this.client.getHabbo());
}
} }
} }
} }

View File

@ -1,6 +1,7 @@
package com.eu.habbo.messages.incoming.rooms.users; package com.eu.habbo.messages.incoming.rooms.users;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
import com.eu.habbo.habbohotel.permissions.Permission; import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.Habbo;
@ -23,9 +24,21 @@ public class RoomUserGiveRightsEvent extends MessageHandler
{ {
Habbo target = room.getHabbo(userId); Habbo target = room.getHabbo(userId);
if(!Emulator.getPluginManager().fireEvent(new UserRightsGivenEvent(this.client.getHabbo(), target)).isCancelled()) if (target != null)
{ {
room.giveRights(target); if (!Emulator.getPluginManager().fireEvent(new UserRightsGivenEvent(this.client.getHabbo(), target)).isCancelled())
{
room.giveRights(target);
}
}
else
{
MessengerBuddy buddy = this.client.getHabbo().getMessenger().getFriend(userId);
if (buddy != null)
{
room.giveRights(userId);
}
} }
} }
} }

View File

@ -22,7 +22,7 @@ public class UnIgnoreRoomUserEvent extends MessageHandler
{ {
if(habbo.getHabboStats().allowTalk()) if(habbo.getHabboStats().allowTalk())
{ {
this.client.getHabbo().getHabboStats().ignoredUsers.remove(habbo.getHabboInfo().getId()); this.client.getHabbo().getHabboStats().unignoreUser(habbo.getHabboInfo().getId());
this.client.sendResponse(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED)); this.client.sendResponse(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED));
} }
} }

View File

@ -12,7 +12,7 @@ public class TradeCancelOfferItemEvent extends MessageHandler
int itemId = this.packet.readInt(); int itemId = this.packet.readInt();
RoomTrade trade = this.client.getHabbo().getHabboInfo().getCurrentRoom().getActiveTradeForHabbo(this.client.getHabbo()); RoomTrade trade = this.client.getHabbo().getHabboInfo().getCurrentRoom().getActiveTradeForHabbo(this.client.getHabbo());
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId); HabboItem item = trade.getRoomTradeUserForHabbo(this.client.getHabbo()).getItem(itemId);
if(trade == null || trade.getRoomTradeUserForHabbo(this.client.getHabbo()).getAccepted() || item == null) if(trade == null || trade.getRoomTradeUserForHabbo(this.client.getHabbo()).getAccepted() || item == null)
{ {

View File

@ -1,5 +1,6 @@
package com.eu.habbo.messages.incoming.trading; package com.eu.habbo.messages.incoming.trading;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTrade; import com.eu.habbo.habbohotel.rooms.RoomTrade;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
@ -12,59 +13,59 @@ public class TradeStartEvent extends MessageHandler
@Override @Override
public void handle() throws Exception public void handle() throws Exception
{ {
int userId = this.packet.readInt(); if (Emulator.getIntUnixTimestamp() - this.client.getHabbo().getHabboStats().lastTradeTimestamp > 10)
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
if (room != null)
{ {
if (userId >= 0 && userId != this.client.getHabbo().getRoomUnit().getId()) this.client.getHabbo().getHabboStats().lastTradeTimestamp = Emulator.getIntUnixTimestamp();
int userId = this.packet.readInt();
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
if (room != null)
{ {
Habbo targetUser = room.getHabboByRoomUnitId(userId); if (userId >= 0 && userId != this.client.getHabbo().getRoomUnit().getId())
boolean tradeAnywhere = this.client.getHabbo().hasPermission("acc_trade_anywhere");
if (!RoomTrade.TRADING_ENABLED && !tradeAnywhere)
{ {
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.HOTEL_TRADING_NOT_ALLOWED)); Habbo targetUser = room.getHabboByRoomUnitId(userId);
return;
}
if ((room.getTradeMode() == 0 || (room.getTradeMode() == 1 && this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId())) && !tradeAnywhere) boolean tradeAnywhere = this.client.getHabbo().hasPermission("acc_trade_anywhere");
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.ROOM_TRADING_NOT_ALLOWED));
return;
}
if (targetUser != null) if (!RoomTrade.TRADING_ENABLED && !tradeAnywhere)
{
if (!this.client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.TRADING))
{ {
if (this.client.getHabbo().getHabboStats().allowTrade) this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.HOTEL_TRADING_NOT_ALLOWED));
{ return;
if (!targetUser.getRoomUnit().hasStatus(RoomUnitStatus.TRADING))
{
if (targetUser.getHabboStats().allowTrade)
{
room.startTrade(this.client.getHabbo(), targetUser);
}
else
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_TRADING_NOT_ALLOWED, targetUser.getHabboInfo().getUsername()));
}
}
else
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_ALREADY_TRADING, targetUser.getHabboInfo().getUsername()));
}
}
else
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_TRADING_OFF));
}
} }
else
if ((room.getTradeMode() == 0 || (room.getTradeMode() == 1 && this.client.getHabbo().getHabboInfo().getId() != room.getOwnerId())) && !tradeAnywhere)
{ {
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_ALREADY_TRADING)); this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.ROOM_TRADING_NOT_ALLOWED));
return;
}
if (targetUser != null)
{
if (!this.client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.TRADING))
{
if (this.client.getHabbo().getHabboStats().allowTrade())
{
if (!targetUser.getRoomUnit().hasStatus(RoomUnitStatus.TRADING))
{
if (targetUser.getHabboStats().allowTrade())
{
room.startTrade(this.client.getHabbo(), targetUser);
} else
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_TRADING_NOT_ALLOWED, targetUser.getHabboInfo().getUsername()));
}
} else
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.TARGET_ALREADY_TRADING, targetUser.getHabboInfo().getUsername()));
}
} else
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_TRADING_OFF));
}
} else
{
this.client.sendResponse(new TradeStartFailComposer(TradeStartFailComposer.YOU_ALREADY_TRADING));
}
} }
} }
} }

View File

@ -312,7 +312,6 @@ public class Outgoing
public final static int UpdateUserLookComposer = 2429; public final static int UpdateUserLookComposer = 2429;
public final static int RoomUserIgnoredComposer = 207; public final static int RoomUserIgnoredComposer = 207;
public final static int PetBreedingFailedComposer = 1625; public final static int PetBreedingFailedComposer = 1625;
public final static int HabboNameChangedComposer = 118;
public final static int RoomUserNameChangedComposer = 2182; public final static int RoomUserNameChangedComposer = 2182;
public final static int LoveLockFurniStartComposer = 3753; public final static int LoveLockFurniStartComposer = 3753;
public final static int LoveLockFurniFriendConfirmedComposer = 382; public final static int LoveLockFurniFriendConfirmedComposer = 382;

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