Updated to 1.15.2 decompiled.

This commit is contained in:
capheus 2019-03-18 01:22:00 +00:00
parent 71acca7ebb
commit bc572ce79a
680 changed files with 3805 additions and 4084 deletions

View File

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

View File

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

View File

@ -1,3 +1,5 @@
#DATABASE UPDATE: 1.14.0 -> 1.15.0
ALTER TABLE `pet_commands_data` ADD PRIMARY KEY(`command_id`);
INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '1');
@ -68,3 +70,5 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.tile.not.exists',
ALTER TABLE `items` CHANGE `z` `z` DOUBLE(10,6) NOT NULL DEFAULT '0.000000';
ALTER TABLE `items_base` ADD `customparams` VARCHAR(256) NOT NULL DEFAULT '' AFTER `multiheight`;
#END DATABASE UPDATE: 1.14.0 -> 1.15.0

View File

@ -0,0 +1,5 @@
CREATE INDEX room_enter_log_room_id ON room_enter_log (room_id);
CREATE INDEX room_enter_log_user_entry ON room_enter_log (user_id, timestamp);
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.messenger.search.maxresults', '50');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.alert.oldstyle', '0');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.navigator.staffpicks.categoryid', '1'); #NOTE THIS IS navigator_publiccats

View File

@ -36,7 +36,7 @@ public final class Emulator
public final static int MINOR = 15;
public final static int BUILD = 0;
public final static int BUILD = 2;
public static final String version = "Version: " + MAJOR + "." + MINOR + "." + BUILD;

View File

@ -72,7 +72,7 @@ public class CleanerThread implements Runnable {
public CleanerThread()
{
databaseCleanup();
this.databaseCleanup();
Emulator.getThreading().run(this, DELAY);
Emulator.getThreading().run(new AchievementUpdater());
@ -132,13 +132,13 @@ public class CleanerThread implements Runnable {
if (time - LAST_DAILY_REFILL > Emulator.getConfig().getInt("hotel.refill.daily"))
{
refillDailyRespects();
this.refillDailyRespects();
LAST_DAILY_REFILL = time;
}
if (time - LAST_HABBO_CACHE_CLEARED > CLEAR_CACHED_VALUES)
{
clearCachedValues();
this.clearCachedValues();
LAST_HABBO_CACHE_CLEARED = time;
}
@ -149,7 +149,7 @@ public class CleanerThread implements Runnable {
void databaseCleanup()
{
refillDailyRespects();
this.refillDailyRespects();
int time = Emulator.getIntUnixTimestamp();
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
@ -206,7 +206,7 @@ public class CleanerThread implements Runnable {
private void clearCachedValues()
{
Habbo habbo = null;
Habbo habbo;
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
{
habbo = map.getValue();

View File

@ -8,7 +8,7 @@ import java.sql.SQLException;
public class CommandLog implements Loggable
{
public static String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
public static final String insertQuery = "INSERT INTO commandlogs (`user_id`, `timestamp`, `command`, `params`, `succes`) VALUES (?, ?, ?, ?, ?)";
private final int userId;
private final int timestamp = Emulator.getIntUnixTimestamp();

View File

@ -22,39 +22,51 @@ public class ConfigurationManager
private final Properties properties;
public ConfigurationManager(String path) throws Exception
private final String configurationPath;
public ConfigurationManager(String configurationPath) throws Exception
{
this.properties = new Properties();
this.configurationPath = configurationPath;
this.reload();
}
public void reload() throws Exception
public void reload()
{
this.isLoading = true;
this.properties.clear();
InputStream input = null;
try {
File f = new File("config.ini");
try
{
File f = new File(this.configurationPath);
input = new FileInputStream(f);
this.properties.load(input);
} catch (IOException ex) {
Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG.INI FILE!");
} finally {
if (input != null) {
try {
}
catch (IOException ex)
{
Emulator.getLogging().logErrorLine("[CRITICAL] FAILED TO LOAD CONFIG FILE! (" + this.configurationPath + ")");
ex.printStackTrace();
}
finally
{
if (input != null)
{
try
{
input.close();
} catch (IOException e) {
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
if(loaded)
if(this.loaded)
{
this.loadFromDatabase();
}
@ -115,7 +127,7 @@ public class ConfigurationManager
public String getValue(String key)
{
return getValue(key, "");
return this.getValue(key, "");
}
@ -133,7 +145,7 @@ public class ConfigurationManager
public boolean getBoolean(String key)
{
return getBoolean(key, false);
return this.getBoolean(key, false);
}
@ -144,11 +156,11 @@ public class ConfigurationManager
try
{
return (getValue(key, "0").equals("1")) || (getValue(key, "false").equals("true"));
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + getValue(key) + " to type boolean.");
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type boolean.");
}
return defaultValue;
}
@ -156,7 +168,7 @@ public class ConfigurationManager
public int getInt(String key)
{
return getInt(key, 0);
return this.getInt(key, 0);
}
@ -167,10 +179,10 @@ public class ConfigurationManager
try
{
return Integer.parseInt(getValue(key, defaultValue.toString()));
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
} catch (Exception e)
{
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + getValue(key) + " to type integer.");
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type integer.");
}
return defaultValue;
}
@ -178,7 +190,7 @@ public class ConfigurationManager
public double getDouble(String key)
{
return getDouble(key, 0.0);
return this.getDouble(key, 0.0);
}
@ -189,11 +201,11 @@ public class ConfigurationManager
try
{
return Double.parseDouble(getValue(key, defaultValue.toString()));
return Double.parseDouble(this.getValue(key, defaultValue.toString()));
}
catch (Exception e)
{
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + getValue(key) + " to type double.");
Emulator.getLogging().logErrorLine("Failed to parse key " + key + " with value " + this.getValue(key) + " to type double.");
}
return defaultValue;

View File

@ -65,7 +65,7 @@ public class CreditsScheduler extends Scheduler
public boolean isDisposed()
{
return disposed;
return this.disposed;
}
public void setDisposed(boolean disposed)

View File

@ -2,6 +2,6 @@ package com.eu.habbo.core;
public interface Disposable
{
public void dispose();
public boolean disposed();
void dispose();
boolean disposed();
}

View File

@ -17,23 +17,6 @@ import java.sql.SQLException;
public class Logging
{
private static File packets;
private static File packetsUndefined;
private static File errorsPackets;
private static File errorsSQL;
private static File errorsRuntime;
private static File debugFile;
private static PrintWriter packetsWriter;
private static PrintWriter packetsUndefinedWriter;
private static PrintWriter errorsPacketsWriter;
@ -63,21 +46,27 @@ public class Logging
public static final String ANSI_WHITE = "\u001B[37m";
private final THashSet<Loggable> errorLogs = new THashSet<>();
private final THashSet<Loggable> errorLogs = new THashSet<>(100);
private final THashSet<Loggable> commandLogs = new THashSet<>();
private final THashSet<Loggable> commandLogs = new THashSet<>(100);
private ConcurrentSet<Loggable> chatLogs = new ConcurrentSet<>();
public Logging()
{
packets = new File("logging//packets//defined.txt");
packetsUndefined = new File("logging//packets//packets.txt");
errorsPackets = new File("logging//errors//packets.txt");
errorsSQL = new File("logging//errors//sql.txt");
errorsRuntime = new File("logging//errors//runtime.txt");
debugFile = new File("logging//debug.txt");
File packets = new File("logging//packets//defined.txt");
File packetsUndefined = new File("logging//packets//packets.txt");
File errorsPackets = new File("logging//errors//packets.txt");
File errorsSQL = new File("logging//errors//sql.txt");
File errorsRuntime = new File("logging//errors//runtime.txt");
File debugFile = new File("logging//debug.txt");
try
{
@ -172,7 +161,7 @@ public class Logging
{
if(Emulator.getConfig().getBoolean("logging.debug"))
{
write(debugFileWriter, line.toString());
this.write(debugFileWriter, line.toString());
}
System.out.println("[" + Logging.ANSI_BRIGHT + Logging.ANSI_GREEN + "SHUTDOWN" + Logging.ANSI_RESET + "] " + line.toString());
}
@ -181,7 +170,7 @@ public class Logging
{
if(Emulator.getConfig().getBoolean("logging.debug"))
{
write(debugFileWriter, line.toString());
this.write(debugFileWriter, line.toString());
}
if (Emulator.getConfig().getBoolean("debug.show.users"))
@ -194,7 +183,7 @@ public class Logging
{
if (line instanceof Throwable)
{
logErrorLine(line);
this.logErrorLine(line);
return;
}
if (Emulator.getConfig().getBoolean("debug.mode")) {
@ -203,7 +192,7 @@ public class Logging
if(Emulator.getConfig().getBoolean("logging.debug"))
{
write(debugFileWriter, line.toString());
this.write(debugFileWriter, line.toString());
}
}
@ -215,7 +204,7 @@ public class Logging
if(Emulator.getConfig().getBoolean("logging.packets"))
{
write(packetsWriter, line.toString());
this.write(packetsWriter, line.toString());
}
}
@ -228,7 +217,7 @@ public class Logging
if (Emulator.getConfig().getBoolean("logging.packets.undefined"))
{
write(packetsUndefinedWriter, line.toString());
this.write(packetsUndefinedWriter, line.toString());
}
}
@ -241,7 +230,7 @@ public class Logging
if (Emulator.getConfig().loaded && Emulator.getConfig().getBoolean("logging.errors.runtime"))
{
write(errorsRuntimeWriter, line);
this.write(errorsRuntimeWriter, line);
}
if(line instanceof Throwable)
@ -267,7 +256,7 @@ public class Logging
if(Emulator.getConfig().getBoolean("logging.errors.sql"))
{
e.printStackTrace();
write(errorsSQLWriter, e);
this.write(errorsSQLWriter, e);
Emulator.getThreading().run(new HTTPPostError(e));
}
@ -280,7 +269,7 @@ public class Logging
if(e instanceof Throwable)
((Exception) e).printStackTrace();
write(errorsPacketsWriter, e);
this.write(errorsPacketsWriter, e);
}
if(e instanceof Throwable)

View File

@ -38,7 +38,7 @@ public class PixelScheduler extends Scheduler
{
super.run();
Habbo habbo = null;
Habbo habbo;
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
{
habbo = map.getValue();
@ -95,7 +95,7 @@ public class PixelScheduler extends Scheduler
public boolean isDisposed()
{
return disposed;
return this.disposed;
}
public void setDisposed(boolean disposed)

View File

@ -38,7 +38,7 @@ public class PointsScheduler extends Scheduler
{
super.run();
Habbo habbo = null;
Habbo habbo;
for(Map.Entry<Integer, Habbo> map : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet())
{
habbo = map.getValue();
@ -95,7 +95,7 @@ public class PointsScheduler extends Scheduler
public boolean isDisposed()
{
return disposed;
return this.disposed;
}
public void setDisposed(boolean disposed)

View File

@ -29,11 +29,11 @@ public class RoomUserPetComposer extends MessageComposer
this.response.appendString(this.habbo.getHabboInfo().getUsername());
this.response.appendString("");
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().getX());
this.response.appendInt(habbo.getRoomUnit().getY());
this.response.appendString(habbo.getRoomUnit().getZ() + "");
this.response.appendInt(habbo.getRoomUnit().getBodyRotation().getValue());
this.response.appendInt(this.habbo.getRoomUnit().getId());
this.response.appendInt(this.habbo.getRoomUnit().getX());
this.response.appendInt(this.habbo.getRoomUnit().getY());
this.response.appendString(this.habbo.getRoomUnit().getZ() + "");
this.response.appendInt(this.habbo.getRoomUnit().getBodyRotation().getValue());
this.response.appendInt(2);
this.response.appendInt(this.petType);
this.response.appendInt(this.habbo.getHabboInfo().getId());

View File

@ -55,7 +55,7 @@ public class TextsManager
public String getValue(String key)
{
return getValue(key, "");
return this.getValue(key, "");
}
@ -70,7 +70,7 @@ public class TextsManager
public boolean getBoolean(String key)
{
return getBoolean(key, false);
return this.getBoolean(key, false);
}
@ -78,7 +78,7 @@ public class TextsManager
{
try
{
return (getValue(key, "0").equals("1")) || (getValue(key, "false").equals("true"));
return (this.getValue(key, "0").equals("1")) || (this.getValue(key, "false").equals("true"));
}
catch (Exception e)
{
@ -90,7 +90,7 @@ public class TextsManager
public int getInt(String key)
{
return getInt(key, 0);
return this.getInt(key, 0);
}
@ -98,7 +98,7 @@ public class TextsManager
{
try
{
return Integer.parseInt(getValue(key, defaultValue.toString()));
return Integer.parseInt(this.getValue(key, defaultValue.toString()));
}
catch (Exception e)
{

View File

@ -1,11 +1,12 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
import gnu.trove.map.hash.THashMap;
public abstract class ConsoleCommand
{
private static THashMap<String, ConsoleCommand> commands = new THashMap<>();
private static final THashMap<String, ConsoleCommand> commands = new THashMap<>();
public final String key;
@ -28,6 +29,7 @@ public abstract class ConsoleCommand
addCommand(new ConsoleTestCommand());
addCommand(new ConsoleReconnectCameraCommand());
addCommand(new ShowInteractionsCommand());
addCommand(new ShowRCONCommands());
}
@ -63,7 +65,7 @@ public abstract class ConsoleCommand
}
catch (Exception e)
{
e.printStackTrace();
Emulator.getLogging().logErrorLine(e);
}
}
else

View File

@ -0,0 +1,20 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
public class ShowRCONCommands extends ConsoleCommand
{
public ShowRCONCommands()
{
super("rconcommands", "Show a list of all RCON commands");
}
@Override
public void handle(String[] args) throws Exception
{
for (String command : Emulator.getRconServer().getCommands())
{
System.out.println(command);
}
}
}

View File

@ -48,7 +48,7 @@ public class GameEnvironment
public PixelScheduler pixelScheduler;
public PointsScheduler pointsScheduler;
public void load()
public void load() throws Exception
{
Emulator.getLogging().logStart("GameEnvironment -> Loading...");

View File

@ -22,9 +22,9 @@ public class Achievement
public Achievement(ResultSet set) throws SQLException
{
levels = new THashMap<>();
this.levels = new THashMap<>();
id = set.getInt("id");
this.id = set.getInt("id");
this.name = set.getString("name");
this.category = AchievementCategories.valueOf(set.getString("category").toUpperCase());

View File

@ -189,13 +189,11 @@ public class AchievementManager
int currentProgress = habbo.getHabboStats().getAchievementProgress(achievement);
boolean created = false;
if(currentProgress == -1)
{
currentProgress = 0;
createUserEntry(habbo, achievement);
habbo.getHabboStats().setProgress(achievement, 0);
created = true;
}
if(Emulator.getPluginManager().isRegistered(UserAchievementProgressEvent.class, true))
@ -209,11 +207,6 @@ public class AchievementManager
AchievementLevel oldLevel = achievement.getLevelForProgress(currentProgress);
if(oldLevel != null && (oldLevel.level == achievement.levels.size() && currentProgress >= oldLevel.progress)) //Maximum achievement gotten.
return;
@ -325,12 +318,7 @@ public class AchievementManager
AchievementLevel nextLevel = achievement.levels.get(level.level + 1);
if (nextLevel == null && currentProgress >= level.progress)
{
return true;
}
return false;
return nextLevel == null && currentProgress >= level.progress;
}

View File

@ -64,7 +64,7 @@ public class TalentTrackLevel
if (item != null)
{
items.add(item);
this.items.add(item);
}
else
{

View File

@ -6,7 +6,10 @@ import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
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.rooms.users.RoomUsersComposer;
import com.eu.habbo.plugin.events.bots.BotChatEvent;
import com.eu.habbo.plugin.events.bots.BotShoutEvent;
import com.eu.habbo.plugin.events.bots.BotTalkEvent;
@ -24,7 +27,7 @@ public class Bot implements Runnable
{
public static final String NO_CHAT_SET = "${bot.skill.chatter.configuration.text.placeholder}";
private int id;
private transient int id;
private String name;
@ -63,6 +66,9 @@ public class Bot implements Runnable
private int chatTimeOut;
private int chatTimestamp;
private final ArrayList<String> chatLines;
@ -74,13 +80,13 @@ public class Bot implements Runnable
private int effect;
private boolean canWalk = true;
private transient boolean canWalk = true;
private boolean needsUpdate;
private int followingHabboId;
private transient int followingHabboId;
public Bot(int id, String name, String motto, String figure, HabboGender gender, int ownerId, String ownerName)
{
@ -119,7 +125,6 @@ public class Bot implements Runnable
this.roomUnit = null;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
this.needsUpdate = false;
this.lastChatIndex = 0;
}
public Bot(Bot bot)
@ -134,12 +139,9 @@ public class Bot implements Runnable
this.chatRandom = false;
this.chatDelay = 10;
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
this.chatLines = new ArrayList<>(Arrays.asList(new String[] {"Default Message :D"}));
this.chatLines = new ArrayList<>(Arrays.asList("Default Message :D"));
this.type = bot.getType();
this.effect = bot.getEffect();
this.room = null;
this.roomUnit = null;
this.lastChatIndex = 0;
this.needsUpdate = false;
}
@ -175,12 +177,12 @@ public class Bot implements Runnable
statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue());
statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType());
statement.setString(12, this.canWalk ? "1" : "0");
String text = "";
StringBuilder text = new StringBuilder();
for(String s : this.chatLines)
{
text += s + "\r";
text.append(s).append("\r");
}
statement.setString(13, text);
statement.setString(13, text.toString());
statement.setString(14, this.chatAuto ? "1" : "0");
statement.setString(15, this.chatRandom ? "1" : "0");
statement.setInt(16, this.chatDelay);
@ -214,7 +216,7 @@ public class Bot implements Runnable
{
for (RoomTile t : this.room.getLayout().getTilesAround(this.room.getLayout().getTile(this.getRoomUnit().getX(), this.getRoomUnit().getY())))
{
WiredHandler.handle(WiredTriggerType.BOT_REACHED_STF, this.roomUnit, this.room, room.getItemsAt(t).toArray());
WiredHandler.handle(WiredTriggerType.BOT_REACHED_STF, this.roomUnit, this.room, this.room.getItemsAt(t).toArray());
}
}
}
@ -252,6 +254,7 @@ public class Bot implements Runnable
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
this.chatTimestamp = Emulator.getIntUnixTimestamp();
this.room.botChat(new RoomUserTalkComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)).compose());
}
}
@ -265,6 +268,7 @@ public class Bot implements Runnable
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
this.chatTimestamp = Emulator.getIntUnixTimestamp();
this.room.botChat(new RoomUserShoutComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)).compose());
}
}
@ -278,6 +282,7 @@ public class Bot implements Runnable
if(Emulator.getPluginManager().fireEvent(event).isCancelled())
return;
this.chatTimestamp = Emulator.getIntUnixTimestamp();
event.target.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(event.message, this.roomUnit, RoomChatMessageBubbles.BOT_RENTABLE)));
}
}
@ -476,6 +481,11 @@ public class Bot implements Runnable
}
public int getChatTimestamp()
{
return this.chatTimestamp;
}
public void clearChat()
{
synchronized (this.chatLines)
@ -498,18 +508,16 @@ public class Bot implements Runnable
}
public void setEffect(int effect)
public void setEffect(int effect, int duration)
{
this.effect = effect;
this.needsUpdate = true;
if (this.roomUnit != null)
{
this.roomUnit.setEffectId(this.effect);
if (this.room != null)
{
this.room.sendComposer(new RoomUserEffectComposer(this.roomUnit).compose());
this.room.giveEffect(this.roomUnit, this.effect, duration);
}
}
}

View File

@ -22,8 +22,6 @@ import java.util.Map;
public class BotManager
{
//Configuration. Loaded from database & updated accordingly.
public static int MINIMUM_CHAT_SPEED = 7;
@ -33,18 +31,19 @@ public class BotManager
public static int MAXIMUM_CHAT_LENGTH = 120;
public static int MAXIMUM_NAME_LENGTH = 15;
final private static THashMap<String, Class<? extends Bot>> botDefenitions = new THashMap<>();
public BotManager()
public BotManager() throws Exception
{
long millis = System.currentTimeMillis();
botDefenitions.put("generic", Bot.class);
botDefenitions.put("bartender", ButlerBot.class);
botDefenitions.put("visitor_log", VisitorBot.class);
addBotDefinition("generic", Bot.class);
addBotDefinition("bartender", ButlerBot.class);
addBotDefinition("visitor_log", VisitorBot.class);
this.reload();

View File

@ -14,6 +14,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -45,10 +46,7 @@ public class ButlerBot extends Bot
{
String[] keys = set.getString("keys").split(";");
THashSet<String> ks = new THashSet<>();
for(String key : keys)
{
ks.add(key);
}
Collections.addAll(ks, keys);
serveItems.put(ks, set.getInt("item"));
}
}

View File

@ -13,9 +13,9 @@ import java.util.Date;
public class VisitorBot extends Bot
{
private static SimpleDateFormat formatDate;
private static SimpleDateFormat DATE_FORMAT;
private boolean showedLog = false;
private THashSet<ModToolRoomVisit> visits = new THashSet<>();
private THashSet<ModToolRoomVisit> visits = new THashSet<>(3);
public VisitorBot(ResultSet set) throws SQLException
{
@ -38,16 +38,16 @@ public class VisitorBot extends Bot
String visitMessage = Emulator.getTexts().getValue("bots.visitor.list").replace("%count%", this.visits.size() + "");
String list = "";
StringBuilder list = new StringBuilder();
for(ModToolRoomVisit visit : this.visits)
{
list += "\r";
list += visit.roomName + " ";
list += Emulator.getTexts().getValue("generic.time.at") + " ";
list += formatDate.format(new Date((visit.timestamp * 1000L)));
list.append("\r");
list.append(visit.roomName).append(" ");
list.append(Emulator.getTexts().getValue("generic.time.at")).append(" ");
list.append(DATE_FORMAT.format(new Date((visit.timestamp * 1000L))));
}
visitMessage = visitMessage.replace("%list%", list);
visitMessage = visitMessage.replace("%list%", list.toString());
this.talk(visitMessage);
@ -78,7 +78,7 @@ public class VisitorBot extends Bot
public static void initialise()
{
formatDate = new SimpleDateFormat(Emulator.getConfig().getValue("bots.visitor.dateformat"));
DATE_FORMAT = new SimpleDateFormat(Emulator.getConfig().getValue("bots.visitor.dateformat"));
}
}

View File

@ -16,58 +16,58 @@ import java.util.HashMap;
public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem>
{
protected int id;
int id;
protected int pageId;
private int pageId;
protected String itemId;
private String itemId;
protected String name;
private String name;
protected int credits;
private int credits;
protected int points;
private int points;
protected short pointsType;
private short pointsType;
protected int amount;
private int amount;
protected boolean allowGift = false;
private boolean allowGift = false;
protected int limitedStack;
int limitedStack;
protected int limitedSells;
private int limitedSells;
protected String extradata;
private String extradata;
protected boolean clubOnly;
private boolean clubOnly;
protected boolean haveOffer;
private boolean haveOffer;
protected int offerId;
private int offerId;
protected boolean needsUpdate;
private boolean needsUpdate;
protected int orderNumber;
private int orderNumber;
protected HashMap<Integer, Integer> bundle;
private HashMap<Integer, Integer> bundle;
public CatalogItem(ResultSet set) throws SQLException
{
@ -213,7 +213,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
}
public int getOrderNumber()
private int getOrderNumber()
{
return this.orderNumber;
}
@ -252,7 +252,7 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
itemId = itemId.split(":")[0];
}
int identifier = 0;
int identifier;
try
{
@ -320,10 +320,11 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
}
}
}
} catch (Exception e)
}
catch (Exception e)
{
Emulator.getLogging().logDebugLine("Failed to load " + itemId);
e.printStackTrace();
Emulator.getLogging().logDebugLine("Failed to load " + this.itemId);
Emulator.getLogging().logErrorLine(e);
}
}
else
@ -482,9 +483,6 @@ public class CatalogItem implements ISerialize, Runnable, Comparable<CatalogItem
return false;
}
if(item.getName().toLowerCase().startsWith("rentable_bot_"))
return false;
return true;
return !item.getName().toLowerCase().startsWith("rentable_bot_");
}
}

View File

@ -31,7 +31,7 @@ public class CatalogLimitedConfiguration implements Runnable
int num = this.limitedNumbers.pop();
if(this.limitedNumbers.isEmpty())
{
Emulator.getGameEnvironment().getCatalogManager().moveCatalogItem(Emulator.getGameEnvironment().getCatalogManager().getCatalogItem(itemId), Emulator.getConfig().getInt("catalog.ltd.page.soldout"));
Emulator.getGameEnvironment().getCatalogManager().moveCatalogItem(Emulator.getGameEnvironment().getCatalogManager().getCatalogItem(this.itemId), Emulator.getConfig().getInt("catalog.ltd.page.soldout"));
}
return num;
}

View File

@ -94,51 +94,88 @@ public class CatalogManager
public final THashMap<Integer, CalendarRewardObject> calendarRewards;
public static final THashMap<String, Class<? extends CatalogPage>> pageDefinitions = new THashMap<String, Class<? extends CatalogPage>>()
public static final THashMap<String, Class<? extends CatalogPage>> pageDefinitions = new THashMap<String, Class<? extends CatalogPage>>(CatalogPageLayouts.values().length)
{
{
for (CatalogPageLayouts layout : CatalogPageLayouts.values())
{
switch(layout)
{
case frontpage: put(layout.name().toLowerCase(), FrontpageLayout.class); break;
case badge_display: put(layout.name().toLowerCase(), BadgeDisplayLayout.class); break;
case spaces_new: put(layout.name().toLowerCase(), SpacesLayout.class); break;
case trophies: put(layout.name().toLowerCase(), TrophiesLayout.class); break;
case bots: put(layout.name().toLowerCase(), BotsLayout.class); break;
case club_buy: put(layout.name().toLowerCase(), ClubBuyLayout.class); break;
case club_gift: put(layout.name().toLowerCase(), ClubGiftsLayout.class); break;
case sold_ltd_items: put(layout.name().toLowerCase(), SoldLTDItemsLayout.class); break;
case single_bundle: put(layout.name().toLowerCase(), SingleBundle.class); break;
case roomads: put(layout.name().toLowerCase(), RoomAdsLayout.class); break;
case recycler: if (Emulator.getConfig().getBoolean("hotel.ecotron.enabled")) put(layout.name().toLowerCase(), RecyclerLayout.class); break;
case recycler_info: if (Emulator.getConfig().getBoolean("hotel.ecotron.enabled")) put(layout.name().toLowerCase(), RecyclerInfoLayout.class);
case recycler_prizes: if (Emulator.getConfig().getBoolean("hotel.ecotron.enabled")) put(layout.name().toLowerCase(), RecyclerPrizesLayout.class); break;
case marketplace: if (Emulator.getConfig().getBoolean("hotel.marketplace.enabled")) put(layout.name().toLowerCase(), MarketplaceLayout.class); break;
case marketplace_own_items: if (Emulator.getConfig().getBoolean("hotel.marketplace.enabled")) put(layout.name().toLowerCase(), MarketplaceOwnItems.class); break;
case info_duckets: put(layout.name().toLowerCase(), InfoDucketsLayout.class); break;
case info_pets: put(layout.name().toLowerCase(), InfoPetsLayout.class); break;
case info_rentables: put(layout.name().toLowerCase(), InfoRentablesLayout.class); break;
case info_loyalty: put(layout.name().toLowerCase(), InfoLoyaltyLayout.class); break;
case loyalty_vip_buy: put(layout.name().toLowerCase(), LoyaltyVipBuyLayout.class); break;
case guilds: put(layout.name().toLowerCase(), GuildFrontpageLayout.class); break;
case guild_furni: put(layout.name().toLowerCase(), GuildFurnitureLayout.class); break;
case guild_forum: put(layout.name().toLowerCase(), GuildForumLayout.class); break;
case pets: put(layout.name().toLowerCase(), PetsLayout.class); break;
case pets2: put(layout.name().toLowerCase(), Pets2Layout.class); break;
case pets3: put(layout.name().toLowerCase(), Pets3Layout.class); break;
case soundmachine: put(layout.name().toLowerCase(), TraxLayout.class); break;
case default_3x3_color_grouping: put(layout.name().toLowerCase(), ColorGroupingLayout.class); break;
case recent_purchases: put(layout.name().toLowerCase(), RecentPurchasesLayout.class); break;
case room_bundle: put(layout.name().toLowerCase(), RoomBundleLayout.class); break;
case petcustomization: put(layout.name().toLowerCase(), PetCustomizationLayout.class); break;
case vip_buy: put(layout.name().toLowerCase(), VipBuyLayout.class); break;
case frontpage_featured: put(layout.name().toLowerCase(), FrontPageFeaturedLayout.class); break;
case builders_club_addons: put(layout.name().toLowerCase(), BuildersClubAddonsLayout.class); break;
case builders_club_frontpage: put(layout.name().toLowerCase(), BuildersClubFrontPageLayout.class); break;
case builders_club_loyalty: put(layout.name().toLowerCase(), BuildersClubLoyaltyLayout.class); break;
case frontpage:
this.put(layout.name().toLowerCase(), FrontpageLayout.class); break;
case badge_display:
this.put(layout.name().toLowerCase(), BadgeDisplayLayout.class); break;
case spaces_new:
this.put(layout.name().toLowerCase(), SpacesLayout.class); break;
case trophies:
this.put(layout.name().toLowerCase(), TrophiesLayout.class); break;
case bots:
this.put(layout.name().toLowerCase(), BotsLayout.class); break;
case club_buy:
this.put(layout.name().toLowerCase(), ClubBuyLayout.class); break;
case club_gift:
this.put(layout.name().toLowerCase(), ClubGiftsLayout.class); break;
case sold_ltd_items:
this.put(layout.name().toLowerCase(), SoldLTDItemsLayout.class); break;
case single_bundle:
this.put(layout.name().toLowerCase(), SingleBundle.class); break;
case roomads:
this.put(layout.name().toLowerCase(), RoomAdsLayout.class); break;
case recycler: if (Emulator.getConfig().getBoolean("hotel.ecotron.enabled"))
this.put(layout.name().toLowerCase(), RecyclerLayout.class); break;
case recycler_info: if (Emulator.getConfig().getBoolean("hotel.ecotron.enabled"))
this.put(layout.name().toLowerCase(), RecyclerInfoLayout.class);
case recycler_prizes: if (Emulator.getConfig().getBoolean("hotel.ecotron.enabled"))
this.put(layout.name().toLowerCase(), RecyclerPrizesLayout.class); break;
case marketplace: if (Emulator.getConfig().getBoolean("hotel.marketplace.enabled"))
this.put(layout.name().toLowerCase(), MarketplaceLayout.class); break;
case marketplace_own_items: if (Emulator.getConfig().getBoolean("hotel.marketplace.enabled"))
this.put(layout.name().toLowerCase(), MarketplaceOwnItems.class); break;
case info_duckets:
this.put(layout.name().toLowerCase(), InfoDucketsLayout.class); break;
case info_pets:
this.put(layout.name().toLowerCase(), InfoPetsLayout.class); break;
case info_rentables:
this.put(layout.name().toLowerCase(), InfoRentablesLayout.class); break;
case info_loyalty:
this.put(layout.name().toLowerCase(), InfoLoyaltyLayout.class); break;
case loyalty_vip_buy:
this.put(layout.name().toLowerCase(), LoyaltyVipBuyLayout.class); break;
case guilds:
this.put(layout.name().toLowerCase(), GuildFrontpageLayout.class); break;
case guild_furni:
this.put(layout.name().toLowerCase(), GuildFurnitureLayout.class); break;
case guild_forum:
this.put(layout.name().toLowerCase(), GuildForumLayout.class); break;
case pets:
this.put(layout.name().toLowerCase(), PetsLayout.class); break;
case pets2:
this.put(layout.name().toLowerCase(), Pets2Layout.class); break;
case pets3:
this.put(layout.name().toLowerCase(), Pets3Layout.class); break;
case soundmachine:
this.put(layout.name().toLowerCase(), TraxLayout.class); break;
case default_3x3_color_grouping:
this.put(layout.name().toLowerCase(), ColorGroupingLayout.class); break;
case recent_purchases:
this.put(layout.name().toLowerCase(), RecentPurchasesLayout.class); break;
case room_bundle:
this.put(layout.name().toLowerCase(), RoomBundleLayout.class); break;
case petcustomization:
this.put(layout.name().toLowerCase(), PetCustomizationLayout.class); break;
case vip_buy:
this.put(layout.name().toLowerCase(), VipBuyLayout.class); break;
case frontpage_featured:
this.put(layout.name().toLowerCase(), FrontPageFeaturedLayout.class); break;
case builders_club_addons:
this.put(layout.name().toLowerCase(), BuildersClubAddonsLayout.class); break;
case builders_club_frontpage:
this.put(layout.name().toLowerCase(), BuildersClubFrontPageLayout.class); break;
case builders_club_loyalty:
this.put(layout.name().toLowerCase(), BuildersClubLoyaltyLayout.class); break;
case default_3x3:
default: put("default_3x3", Default_3x3Layout.class); break;
default:
this.put("default_3x3", Default_3x3Layout.class); break;
}
}
}
@ -175,17 +212,17 @@ public class CatalogManager
try
{
loadLimitedNumbers();
loadCatalogPages();
loadCatalogFeaturedPages();
loadCatalogItems();
loadClubOffers();
loadTargetOffers();
loadVouchers();
loadClothing();
loadRecycler();
loadGiftWrappers();
loadCalendarRewards();
this.loadLimitedNumbers();
this.loadCatalogPages();
this.loadCatalogFeaturedPages();
this.loadCatalogItems();
this.loadClubOffers();
this.loadTargetOffers();
this.loadVouchers();
this.loadClothing();
this.loadRecycler();
this.loadGiftWrappers();
this.loadCalendarRewards();
}
catch(SQLException e)
{
@ -237,16 +274,10 @@ public class CatalogManager
final THashMap<Integer, CatalogPage> pages = new THashMap<>();
pages.put(-1, new CatalogRootLayout(null));
ResultSet set = null;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM catalog_pages ORDER BY parent_id, id"))
{
set = statement.executeQuery();
}
catch (SQLException e)
try (ResultSet set = statement.executeQuery())
{
Emulator.getLogging().logSQLException(e);
}
while(set.next())
{
Class<? extends CatalogPage> pageClazz = pageDefinitions.get(set.getString("page_layout"));
@ -267,8 +298,12 @@ public class CatalogManager
Emulator.getLogging().logErrorLine("Failed to load layout: " + set.getString("page_layout"));
}
}
set.close();
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);
}
pages.forEachValue(new TObjectProcedure<CatalogPage>()
{
@ -1001,7 +1036,7 @@ public class CatalogManager
{
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.alert("Whoops! You tried to buy this " + (amount * item.getAmount()) + " times. This must've been a mistake.");
habbo.getClient().sendResponse(new AlertPurchaseUnavailableComposer(AlertPurchaseUnavailableComposer.ILLEGAL));
return;
}
@ -1059,11 +1094,11 @@ public class CatalogManager
{
for (int k = 0; k < item.getItemAmount(baseItem.getId()); k++)
{
cBaseItem = baseItem;
if (baseItem.getName().startsWith("rentable_bot_") || baseItem.getName().startsWith("bot_"))
{
String type = item.getName().replace("rentable_bot_", "");
type = type.replace("bot_", "");
type = type.replace("visitor_logger", "visitor_log");
THashMap<String, String> data = new THashMap<>();

View File

@ -34,10 +34,10 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
protected String textTwo;
protected String textDetails;
protected String textTeaser;
protected TIntArrayList offerIds = new TIntArrayList();
protected THashMap<Integer, CatalogPage> childPages = new THashMap<>();;
private TIntObjectMap<CatalogItem> catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>());
private ArrayList<Integer> included = new ArrayList<>();
protected final TIntArrayList offerIds = new TIntArrayList();
protected final THashMap<Integer, CatalogPage> childPages = new THashMap<>();
private final TIntObjectMap<CatalogItem> catalogItems = TCollections.synchronizedMap(new TIntObjectHashMap<>());
private final ArrayList<Integer> included = new ArrayList<>();
public CatalogPage(ResultSet set) throws SQLException
{

View File

@ -6,7 +6,7 @@ import java.sql.SQLException;
public class Voucher
{
private final int id;
public final int id;
public final String code;

View File

@ -18,9 +18,9 @@ public class InfoDucketsLayout extends CatalogPage
{
message.appendString("info_duckets");
message.appendInt(1);
message.appendString(getHeaderImage());
message.appendString(this.getHeaderImage());
message.appendInt(1);
message.appendString(getTextOne());
message.appendString(this.getTextOne());
message.appendInt(0);
}
}

View File

@ -18,9 +18,9 @@ public class InfoLoyaltyLayout extends CatalogPage
{
message.appendString("info_loyalty");
message.appendInt(1);
message.appendString(getHeaderImage());
message.appendString(this.getHeaderImage());
message.appendInt(1);
message.appendString(getTextOne());
message.appendString(this.getTextOne());
message.appendInt(0);
}
}

View File

@ -18,12 +18,12 @@ public class InfoPetsLayout extends CatalogPage
{
message.appendString("info_pets");
message.appendInt(2);
message.appendString(getHeaderImage());
message.appendString(getTeaserImage());
message.appendString(this.getHeaderImage());
message.appendString(this.getTeaserImage());
message.appendInt(3);
message.appendString(getTextOne());
message.appendString(this.getTextOne());
message.appendString("");
message.appendString(getTextTeaser());
message.appendString(this.getTextTeaser());
message.appendInt(0);
}
}

View File

@ -16,10 +16,10 @@ public class InfoRentablesLayout extends CatalogPage
@Override
public void serialize(ServerMessage message)
{
String[] data = getTextOne().split("\\|\\|");
String[] data = this.getTextOne().split("\\|\\|");
message.appendString("info_rentables");
message.appendInt(1);
message.appendString(getHeaderImage());
message.appendString(this.getHeaderImage());
message.appendInt(data.length);
for (String d : data) {
message.appendString(d);

View File

@ -19,7 +19,7 @@ import java.util.Map;
public class RoomBundleLayout extends SingleBundle
{
public int roomId = 0;
public int roomId;
public Room room;
private int lastUpdate = 0;
private boolean loaded = false;
@ -106,14 +106,14 @@ public class RoomBundleLayout extends SingleBundle
items.put(Emulator.getGameEnvironment().getItemManager().getItem(Integer.valueOf(item[0].getExtradata())), 1);
}
String data = "";
StringBuilder data = new StringBuilder();
for(Map.Entry<Item, Integer> set : items.entrySet())
{
data += set.getKey().getId() + ":" + set.getValue() + ";";
data.append(set.getKey().getId()).append(":").append(set.getValue()).append(";");
}
item[0].setItemId(data);
item[0].setItemId(data.toString());
item[0].loadBundle();
}
@ -237,12 +237,12 @@ public class RoomBundleLayout extends SingleBundle
statement.setInt(7, bot.getRoomUnit().getX());
statement.setInt(8, bot.getRoomUnit().getY());
statement.setDouble(9, bot.getRoomUnit().getZ());
String text = "";
StringBuilder text = new StringBuilder();
for (String s : bot.getChatLines())
{
text += s + "\r";
text.append(s).append("\r");
}
statement.setString(10, text);
statement.setString(10, text.toString());
statement.setString(11, bot.isChatAuto() ? "1" : "0");
statement.setString(12, bot.isChatRandom() ? "1" : "0");
statement.setInt(13, bot.getChatDelay());

View File

@ -191,16 +191,6 @@ public class MarketPlace
query += " ORDER BY minPrice DESC";
break;
}
if (sort == 3)
{
}
if (sort == 2)
{
}
else
{
}
query += ")";
@ -444,11 +434,7 @@ public class MarketPlace
try
{
MarketPlaceOffer offer = new MarketPlaceOffer(event.item, event.price, client.getHabbo());
if(offer != null)
{
client.getHabbo().getInventory().addMarketplaceOffer(offer);
client.getHabbo().getInventory().getItemsComponent().removeHabboItem(event.item);
client.sendResponse(new RemoveHabboItemComposer(event.item.getId()));
client.sendResponse(new InventoryRefreshComposer());
@ -456,7 +442,6 @@ public class MarketPlace
item.needsUpdate(true);
Emulator.getThreading().run(item);
}
}
catch (SQLException e)
{
Emulator.getLogging().logSQLException(e);

View File

@ -47,7 +47,7 @@ public class AboutCommand extends Command
"<b>Thanks for using Arcturus. Report issues on the forums. http://arcturus.pw \r\r" +
" - The General";
gameClient.sendResponse(new GenericAlertComposer(message));
gameClient.getHabbo().alert(message);
return true;
}

View File

@ -28,17 +28,17 @@ public class AlertCommand extends Command {
}
String targetUsername = params[1];
String message = "";
StringBuilder message = new StringBuilder();
for(int i = 2; i < params.length; i++)
{
message += (params[i] + " ");
message.append(params[i]).append(" ");
}
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(targetUsername);
if (habbo != null) {
habbo.getClient().sendResponse(new GenericAlertComposer(message + "\r\n -" + gameClient.getHabbo().getHabboInfo().getUsername()));
habbo.alert(message + "\r\n -" + gameClient.getHabbo().getHabboInfo().getUsername());
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_alert.message_send").replace("%user%", targetUsername), RoomChatMessageBubbles.ALERT);
} else {
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_alert.user_offline").replace("%user%", targetUsername), RoomChatMessageBubbles.ALERT);

View File

@ -46,7 +46,7 @@ public class AllowTradingCommand extends Command
}
else
{
boolean found = false;
boolean found;
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ? WHERE users.username LIKE ?"))
{
statement.setString(1, enabled ? "1" : "0");

View File

@ -68,7 +68,7 @@ public class BadgeCommand extends Command
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection())
{
boolean found = false;
boolean found;
try (PreparedStatement statement = connection.prepareStatement("SELECT COUNT(slot_id) FROM users_badges INNER JOIN users ON users.id = user_id WHERE users.username = ? AND badge_code = ? LIMIT 1"))
{

View File

@ -56,7 +56,7 @@ public class BanCommand extends Command
Habbo t = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
HabboInfo target = null;
HabboInfo target;
if (t != null)
{
target = t.getHabboInfo();
@ -79,17 +79,17 @@ public class BanCommand extends Command
}
String reason = "";
StringBuilder reason = new StringBuilder();
if(params.length > 3)
{
for(int i = 3; i < params.length; i++)
{
reason += params[i] + " ";
reason.append(params[i]).append(" ");
}
}
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().ban(target.getId(), gameClient.getHabbo(), reason, banTime, ModToolBanType.ACCOUNT, -1).get(0);
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().ban(target.getId(), gameClient.getHabbo(), reason.toString(), banTime, ModToolBanType.ACCOUNT, -1).get(0);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_ban.ban_issued").replace("%user%", target.getUsername()).replace("%time%", ban.expireDate - Emulator.getIntUnixTimestamp() + "").replace("%reason%", ban.reason), RoomChatMessageBubbles.ALERT);
return true;

View File

@ -18,18 +18,18 @@ public class BotsCommand extends Command
if(gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null || !gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo()))
return false;
String data = Emulator.getTexts().getValue("total") + ": " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().values().length;
StringBuilder data = new StringBuilder(Emulator.getTexts().getValue("total") + ": " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().values().length);
for(Object bot : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().values())
{
if(bot instanceof Bot)
{
data += "\r";
data += "<b>" + Emulator.getTexts().getValue("generic.bot.name") + "</b>: " + ((Bot) bot).getName() + " <b>" + Emulator.getTexts().getValue("generic.bot.id") + "</b>: " + ((Bot) bot).getId();
data.append("\r");
data.append("<b>").append(Emulator.getTexts().getValue("generic.bot.name")).append("</b>: ").append(((Bot) bot).getName()).append(" <b>").append(Emulator.getTexts().getValue("generic.bot.id")).append("</b>: ").append(((Bot) bot).getId());
}
}
gameClient.sendResponse(new GenericAlertComposer(data));
gameClient.getHabbo().alert(data.toString());
return true;
}

View File

@ -24,7 +24,7 @@ public class CommandHandler
public CommandHandler()
{
long millis = System.currentTimeMillis();
reloadCommands();
this.reloadCommands();
Emulator.getLogging().logStart("Command Handler -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}
@ -205,7 +205,7 @@ public class CommandHandler
}
catch (Exception e)
{
e.printStackTrace();
Emulator.getLogging().logErrorLine(e);
}
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands())
@ -249,22 +249,22 @@ public class CommandHandler
Pet pet = petIterator.value();
if (pet instanceof Pet)
if (pet != null)
{
if (pet.getName().equalsIgnoreCase(args[0]))
{
String s = "";
StringBuilder s = new StringBuilder();
for (int i = 1; i < args.length; i++)
{
s += args[i] + " ";
s.append(args[i]).append(" ");
}
s = s.substring(0, s.length() - 1);
s = new StringBuilder(s.substring(0, s.length() - 1));
for (PetCommand command : pet.getPetData().getPetCommands())
{
if (command.key.equalsIgnoreCase(s))
if (command.key.equalsIgnoreCase(s.toString()))
{
if (command.level <= pet.getLevel())
pet.handleCommand(command, gameClient.getHabbo(), args);
@ -303,7 +303,7 @@ public class CommandHandler
}
}
Collections.sort(allowedCommands, CommandHandler.ALPHABETICAL_ORDER);
allowedCommands.sort(CommandHandler.ALPHABETICAL_ORDER);
return allowedCommands;
}

View File

@ -15,16 +15,16 @@ public class CommandsCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
String message = "Your Commands";
StringBuilder message = new StringBuilder("Your Commands");
List<Command> commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId());
message += "(" + commands.size() + "):\r\n";
message.append("(").append(commands.size()).append("):\r\n");
for(Command c : commands)
{
message += Emulator.getTexts().getValue("commands.description." + c.permission, "commands.description." + c.permission) + "\r";
message.append(Emulator.getTexts().getValue("commands.description." + c.permission, "commands.description." + c.permission)).append("\r");
}
gameClient.getHabbo().alert(new String[]{message});
gameClient.getHabbo().alert(new String[]{message.toString()});
return true;
}

View File

@ -21,7 +21,7 @@ public class CoordsCommand extends Command {
if (params.length == 1)
{
gameClient.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
"x: " + gameClient.getHabbo().getRoomUnit().getX() + "\r" +
"y: " + gameClient.getHabbo().getRoomUnit().getY() + "\r" +
"z: " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? gameClient.getHabbo().getRoomUnit().getStatus(RoomUnitStatus.SIT) : gameClient.getHabbo().getRoomUnit().getZ()) + "\r" +
@ -31,7 +31,7 @@ public class CoordsCommand extends Command {
"Tile State: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).state.name() + "\r" +
"Tile Walkable: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).isWalkable() + "\r" +
"Tile relative height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).relativeHeight() + "\r" +
"Tile stack height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).getStackHeight()));
"Tile stack height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).getStackHeight());
}
else
@ -40,14 +40,14 @@ public class CoordsCommand extends Command {
if (tile != null)
{
gameClient.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
"x: " + tile.x + "\r" +
"y: " + tile.y + "\r" +
"z: " + tile.z + "\r" +
"Tile State: " + tile.state.name() + "\r" +
"Tile Relative Height: " + tile.relativeHeight() + "\r" +
"Tile Stack Height: " + tile.getStackHeight() + "\r" +
"Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r"));
"Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r");
}
else
{

View File

@ -25,7 +25,7 @@ public class CreditsCommand extends Command
{
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(params[1]);
int credits = 0;
int credits;
try
{
credits = Integer.parseInt(params[2]);
@ -42,7 +42,7 @@ public class CreditsCommand extends Command
if (habbo.getHabboInfo().getCurrentRoom() != null)
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_credits.received").replace("%amount%", Integer.parseInt(params[2]) + ""), RoomChatMessageBubbles.ALERT);
else
habbo.getClient().sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.generic.cmd_credits.received").replace("%amount%", Integer.parseInt(params[2]) + "")));
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_credits.received").replace("%amount%", Integer.parseInt(params[2]) + ""));
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_credits.send").replace("%amount%", Integer.parseInt(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);

View File

@ -27,7 +27,7 @@ public class EmptyBotsInventoryCommand extends Command
{
if(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10)
{
gameClient.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes"))));
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")));
}
else
{

View File

@ -29,7 +29,7 @@ public class EmptyInventoryCommand extends Command
{
if(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10)
{
gameClient.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.succes.cmd_empty.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes"))));
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.succes.cmd_empty.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")));
}
else
{

View File

@ -27,7 +27,7 @@ public class EmptyPetsInventoryCommand extends Command
{
if(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10)
{
gameClient.sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes"))));
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")));
}
else
{

View File

@ -17,7 +17,7 @@ public class EnableCommand extends Command
{
if(params.length >= 2)
{
int effectId = 0;
int effectId;
try
{
effectId = Integer.parseInt(params[1]);
@ -48,13 +48,13 @@ public class EnableCommand extends Command
return true;
}
target.getHabboInfo().getCurrentRoom().giveEffect(target, effectId);
target.getHabboInfo().getCurrentRoom().giveEffect(target, effectId, -1);
}
}
}
catch (Exception e)
{
e.printStackTrace();
Emulator.getLogging().logErrorLine(e);
}
}
}

View File

@ -23,12 +23,12 @@ public class EventCommand extends Command
{
if (params.length >= 2)
{
String message = "";
StringBuilder message = new StringBuilder();
for (int i = 1; i < params.length; i++)
{
message += params[i];
message += " ";
message.append(params[i]);
message.append(" ");
}
THashMap<String, String> codes = new THashMap<>();
@ -37,7 +37,7 @@ public class EventCommand extends Command
codes.put("USERNAME", gameClient.getHabbo().getHabboInfo().getUsername());
codes.put("LOOK", gameClient.getHabbo().getHabboInfo().getLook());
codes.put("TIME", Emulator.getDate().toString());
codes.put("MESSAGE", message);
codes.put("MESSAGE", message.toString());
ServerMessage msg = new BubbleAlertComposer("hotel.event", codes).compose();

View File

@ -25,12 +25,20 @@ public class GiftCommand extends Command
{
if(params.length >= 3)
{
String username = params[1];
int itemId;
try
{
String username = params[1];
int itemId = Integer.valueOf(params[2]);
itemId = Integer.valueOf(params[2]);
}
catch (Exception e)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
}
if(itemId < 0)
if(itemId <= 0)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
@ -52,17 +60,17 @@ public class GiftCommand extends Command
return true;
}
String message = "";
StringBuilder message = new StringBuilder();
if(params.length > 3)
{
for (int i = 3; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
}
final String finalMessage = message;
final String finalMessage = message.toString();
HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, "");
@ -89,13 +97,6 @@ public class GiftCommand extends Command
}
return true;
}
catch (Exception e)
{
e.printStackTrace();
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
}
}
return false;
}

View File

@ -16,7 +16,7 @@ public class HabnamCommand extends Command
{
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null)
{
gameClient.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gameClient.getHabbo(), 140);
gameClient.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gameClient.getHabbo(), 140, 30);
return true;
}
}

View File

@ -20,9 +20,9 @@ public class HotelAlertCommand extends Command {
public boolean handle(GameClient gameClient, String[] params)
{
if(params.length > 1) {
String message = "";
StringBuilder message = new StringBuilder();
for (int i = 1; i < params.length; i++) {
message += params[i] + " ";
message.append(params[i]).append(" ");
}
ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose();

View File

@ -20,16 +20,16 @@ public class HotelAlertLinkCommand extends Command
}
String url = params[1];
String message = "";
StringBuilder message = new StringBuilder();
for (int i = 2; i < params.length; i++)
{
message += params[i];
message += " ";
message.append(params[i]);
message.append(" ");
}
message += "\r\r-<b>" + gameClient.getHabbo().getHabboInfo().getUsername() + "</b>";
message.append("\r\r-<b>").append(gameClient.getHabbo().getHabboInfo().getUsername()).append("</b>");
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new StaffAlertWithLinkComposer(message, url).compose());
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new StaffAlertWithLinkComposer(message.toString(), url).compose());
return true;
}
}

View File

@ -19,8 +19,8 @@ public class IPBanCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
HabboInfo habbo = null;
String reason = "";
HabboInfo habbo;
StringBuilder reason = new StringBuilder();
if (params.length >= 2)
{
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
@ -43,8 +43,8 @@ public class IPBanCommand extends Command
{
for (int i = 2; i < params.length; i++)
{
reason += params[i];
reason += " ";
reason.append(params[i]);
reason.append(" ");
}
}
@ -63,14 +63,14 @@ public class IPBanCommand extends Command
return true;
}
Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason, TEN_YEARS, ModToolBanType.IP, -1);
Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason.toString(), TEN_YEARS, ModToolBanType.IP, -1);
count++;
for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithIP(habbo.getIpLogin()))
{
if (h != null)
{
count++;
Emulator.getGameEnvironment().getModToolManager().ban(h.getHabboInfo().getId(), gameClient.getHabbo(), reason, TEN_YEARS, ModToolBanType.IP, -1);
Emulator.getGameEnvironment().getModToolManager().ban(h.getHabboInfo().getId(), gameClient.getHabbo(), reason.toString(), TEN_YEARS, ModToolBanType.IP, -1);
}
}
}

View File

@ -19,7 +19,7 @@ public class MachineBanCommand extends Command
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
HabboInfo habbo = null;
String reason = "";
StringBuilder reason = new StringBuilder();
if (params.length >= 2)
{
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
@ -38,12 +38,12 @@ public class MachineBanCommand extends Command
{
for (int i = 2; i < params.length; i++)
{
reason += params[i];
reason += " ";
reason.append(params[i]);
reason.append(" ");
}
}
int count = 0;
int count;
if (habbo != null)
{
if (habbo == gameClient.getHabbo().getHabboInfo())
@ -58,7 +58,7 @@ public class MachineBanCommand extends Command
return true;
}
count = Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason, IPBanCommand.TEN_YEARS, ModToolBanType.MACHINE, -1).size();
count = Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason.toString(), IPBanCommand.TEN_YEARS, ModToolBanType.MACHINE, -1).size();

View File

@ -26,11 +26,19 @@ public class MassGiftCommand extends Command
{
if(params.length >= 2)
{
int itemId;
try
{
int itemId = Integer.valueOf(params[1]);
itemId = Integer.valueOf(params[1]);
}
catch (Exception e)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
}
if(itemId < 0)
if(itemId <= 0)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
@ -44,17 +52,17 @@ public class MassGiftCommand extends Command
return true;
}
String message = "";
StringBuilder message = new StringBuilder();
if(params.length > 2)
{
for (int i = 2; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
}
final String finalMessage = message;
final String finalMessage = message.toString();
THashMap<String, String> keys = new THashMap<>();
keys.put("display", "BUBBLE");
@ -89,13 +97,6 @@ public class MassGiftCommand extends Command
return true;
}
catch (Exception e)
{
e.printStackTrace();
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
}
}
return false;
}

View File

@ -19,7 +19,7 @@ public class MassPointsCommand extends Command
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
int type = Emulator.getConfig().getInt("seasonal.primary.type");
String amountString = "";
String amountString;
if(params.length == 3)
{
amountString = params[1];
@ -83,7 +83,7 @@ public class MassPointsCommand extends Command
if(habbo.getHabboInfo().getCurrentRoom() != null)
habbo.whisper(message, RoomChatMessageBubbles.ALERT);
else
habbo.getClient().sendResponse(new GenericAlertComposer(message));
habbo.alert(message);
}
}
return true;

View File

@ -2,7 +2,6 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserEffectComposer;
public class MoonwalkCommand extends Command
{
@ -16,16 +15,11 @@ public class MoonwalkCommand extends Command
{
if(gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboStats().hasActiveClub())
{
if (gameClient.getHabbo().getRoomUnit().getEffectId() != 136)
{
gameClient.getHabbo().getRoomUnit().setEffectId(136);
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserEffectComposer(gameClient.getHabbo().getRoomUnit()).compose());
}
else
{
gameClient.getHabbo().getRoomUnit().setEffectId(0);
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserEffectComposer(gameClient.getHabbo().getRoomUnit()).compose());
}
int effect = 136;
if (gameClient.getHabbo().getRoomUnit().getEffectId() == 136)
effect = 0;
gameClient.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gameClient.getHabbo(), effect, -1);
return true;
}

View File

@ -32,10 +32,7 @@ public class PetInfoCommand extends Command
{
if(pet.getName().equalsIgnoreCase(name))
{
if(!(pet instanceof Pet))
return true;
gameClient.sendResponse(new GenericAlertComposer("" +
gameClient.getHabbo().alert("" +
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
Emulator.getTexts().getValue("generic.pet.id") + ": " + pet.getId() + "\r" +
Emulator.getTexts().getValue("generic.pet.name") + ": " + pet.getName() + "\r" +
@ -50,7 +47,7 @@ public class PetInfoCommand extends Command
Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
Emulator.getTexts().getValue("generic.pet.current_action") + ": " + (pet.getTask() == null ? Emulator.getTexts().getValue("generic.nothing") : pet.getTask().name()) + "\r" +
Emulator.getTexts().getValue("generic.can.walk") + ": " + (pet.getRoomUnit().canWalk() ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + ""
));
);
}
return true;

View File

@ -30,7 +30,7 @@ public class PixelCommand extends Command
if(habbo.getHabboInfo().getCurrentRoom() != null)
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.valueOf(params[2]) + ""), RoomChatMessageBubbles.ALERT);
else
habbo.getClient().sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.valueOf(params[2]) + "")));
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.valueOf(params[2]) + ""));
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_duckets.send").replace("%amount%", Integer.valueOf(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);

View File

@ -15,14 +15,14 @@ public class PluginsCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
String message = "Plugins (" + Emulator.getPluginManager().getPlugins().size() + ")\r";
StringBuilder message = new StringBuilder("Plugins (" + Emulator.getPluginManager().getPlugins().size() + ")\r");
for (HabboPlugin plugin : Emulator.getPluginManager().getPlugins())
{
message += "\r" + plugin.configuration.name + " By " + plugin.configuration.author;
message.append("\r").append(plugin.configuration.name).append(" By ").append(plugin.configuration.author);
}
gameClient.sendResponse(new GenericAlertComposer(message));
gameClient.getHabbo().alert(message.toString());
return true;
}

View File

@ -40,7 +40,7 @@ public class PointsCommand extends Command
}
}
int amount = 0;
int amount;
try
{
@ -59,7 +59,7 @@ public class PointsCommand extends Command
if(habbo.getHabboInfo().getCurrentRoom() != null)
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)), RoomChatMessageBubbles.ALERT);
else
habbo.getClient().sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type))));
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)));
habbo.getClient().sendResponse(new UserPointsComposer(habbo.getHabboInfo().getCurrencyAmount(type), amount, type));

View File

@ -5,7 +5,7 @@ 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 com.eu.habbo.messages.outgoing.catalog.TargetedOfferComposer;
import gnu.trove.map.hash.THashMap;
import java.util.ArrayList;
@ -36,11 +36,11 @@ public class PromoteTargetOfferCommand extends Command
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>();
List<String> message = new ArrayList<>();
for (int i = 0; i < textConfig.length; i++)
for (String pair : textConfig)
{
if (textConfig[i].contains("%list%"))
if (pair.contains("%list%"))
{
for (TargetOffer offer : targetOffers.values())
{
@ -49,7 +49,7 @@ public class PromoteTargetOfferCommand extends Command
}
else
{
message.add(textConfig[i]);
message.add(pair);
}
}

View File

@ -58,8 +58,8 @@ public class RedeemCommand extends Command
}
} else if (item.getBaseItem().getName().startsWith("DF_"))
{
int pointsType = 0;
int pointsAmount = 0;
int pointsType;
int pointsAmount;
pointsType = Integer.valueOf(item.getBaseItem().getName().split("_")[1]);
pointsAmount = Integer.valueOf(item.getBaseItem().getName().split("_")[2]);

View File

@ -16,16 +16,16 @@ public class RoomAlertCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
String message = "";
StringBuilder message = new StringBuilder();
if (params.length >= 2)
{
for (int i = 1; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
if (message.isEmpty())
if (message.length() == 0)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomalert.empty"), RoomChatMessageBubbles.ALERT);
return true;
@ -35,7 +35,7 @@ public class RoomAlertCommand extends Command
if (room != null)
{
room.sendComposer(new ModToolIssueHandledComposer(message).compose());
room.sendComposer(new ModToolIssueHandledComposer(message.toString()).compose());
return true;
}
}

View File

@ -32,10 +32,9 @@ public class RoomCreditsCommand extends Command
if(amount != 0)
{
final String message = Emulator.getTexts().getValue("commands.generic.cmd_credits.received").replace("%amount%", amount + "");
final int finalAmount = amount;
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
{
habbo.giveCredits(finalAmount);
habbo.giveCredits(amount);
habbo.whisper(message, RoomChatMessageBubbles.ALERT);
}
}

View File

@ -2,9 +2,9 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserEffectComposer;
public class RoomEffectCommand extends Command
{
@ -28,10 +28,10 @@ public class RoomEffectCommand extends Command
if(effectId >= 0)
{
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
for (Habbo habbo : room.getHabbos())
{
habbo.getRoomUnit().setEffectId(effectId);
habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserEffectComposer(habbo.getRoomUnit()).compose());
room.giveEffect(habbo, effectId, -1);
}
return true;

View File

@ -6,7 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.generic.alerts.WiredRewardAlertComposer;
import com.eu.habbo.messages.outgoing.wired.WiredRewardAlertComposer;
import com.eu.habbo.messages.outgoing.inventory.InventoryRefreshComposer;
public class RoomGiftCommand extends Command
@ -21,11 +21,19 @@ public class RoomGiftCommand extends Command
{
if(params.length >= 2)
{
int itemId;
try
{
int itemId = Integer.valueOf(params[1]);
itemId = Integer.valueOf(params[1]);
}
catch (Exception e)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
}
if(itemId < 0)
if(itemId <= 0)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
@ -39,17 +47,17 @@ public class RoomGiftCommand extends Command
return true;
}
String message = "";
StringBuilder message = new StringBuilder();
if(params.length > 2)
{
for (int i = 2; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
}
final String finalMessage = message;
final String finalMessage = message.toString();
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
{
@ -69,13 +77,6 @@ public class RoomGiftCommand extends Command
return true;
}
catch (Exception e)
{
e.printStackTrace();
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
return true;
}
}
return false;
}

View File

@ -22,10 +22,10 @@ public class RoomKickCommand extends Command
{
if(params.length > 1)
{
String message = "";
StringBuilder message = new StringBuilder();
for (int i = 1; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
room.sendComposer(new GenericAlertComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername()).compose());
}

View File

@ -32,10 +32,9 @@ public class RoomPixelsCommand extends Command
if(amount != 0)
{
final String message = Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", amount + "");
final int finalAmount = amount;
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
{
habbo.givePixels(finalAmount);
habbo.givePixels(amount);
habbo.whisper(message, RoomChatMessageBubbles.ALERT);
}
}

View File

@ -16,7 +16,7 @@ public class RoomPointsCommand extends Command
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
int type = Emulator.getConfig().getInt("seasonal.primary.type");
String amountString = "";
String amountString;
if(params.length == 3)
{
try
@ -72,11 +72,9 @@ public class RoomPointsCommand extends Command
{
final String message = Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type));
final int finalType = type;
final int finalAmount = amount;
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
{
habbo.givePoints(finalType, finalAmount);
habbo.givePoints(type, amount);
habbo.whisper(message, RoomChatMessageBubbles.ALERT);
}
}

View File

@ -21,18 +21,15 @@ public class SayAllCommand extends Command
return true;
}
String message = "";
if(params.length > 1)
{
StringBuilder message = new StringBuilder();
for(int i = 1; i < params.length; i++)
{
message += params[i] + " ";
}
message.append(params[i]).append(" ");
}
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
{
habbo.talk(message);
habbo.talk(message.toString());
}
return true;

View File

@ -39,17 +39,17 @@ public class SayCommand extends Command
}
}
String message = "";
StringBuilder message = new StringBuilder();
if(params.length > 2)
{
for(int i = 2; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
}
target.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserTalkComposer(new RoomChatMessage(message, target, RoomChatMessageBubbles.NORMAL)).compose());
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_say").replace("%user%", params[1]).replace("%message%", message), RoomChatMessageBubbles.ALERT);
target.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserTalkComposer(new RoomChatMessage(message.toString(), target, RoomChatMessageBubbles.NORMAL)).compose());
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_say").replace("%user%", params[1]).replace("%message%", message.toString()), RoomChatMessageBubbles.ALERT);
return true;
}
}

View File

@ -16,7 +16,7 @@ public class SetMaxCommand extends Command
{
if (params.length >= 2)
{
int max = 0;
int max;
try
{
max = Integer.valueOf(params[1]);

View File

@ -21,18 +21,15 @@ public class ShoutAllCommand extends Command
return true;
}
String message = "";
if(params.length > 1)
{
StringBuilder message = new StringBuilder();
for(int i = 1; i < params.length; i++)
{
message += params[i] + " ";
}
message.append(params[i]).append(" ");
}
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
{
habbo.shout(message);
habbo.shout(message.toString());
}
return true;

View File

@ -41,17 +41,17 @@ public class ShoutCommand extends Command
}
}
String message = "";
StringBuilder message = new StringBuilder();
if(params.length > 2)
{
for(int i = 2; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
}
target.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserShoutComposer(new RoomChatMessage(message, target, RoomChatMessageBubbles.NORMAL)).compose());
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_shout").replace("%user%", params[1]).replace("%message%", message), RoomChatMessageBubbles.ALERT);
target.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserShoutComposer(new RoomChatMessage(message.toString(), target, RoomChatMessageBubbles.NORMAL)).compose());
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_shout").replace("%user%", params[1]).replace("%message%", message.toString()), RoomChatMessageBubbles.ALERT);
return true;
}
}

View File

@ -18,14 +18,14 @@ public class ShutdownCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
String reason = "-";
StringBuilder reason = new StringBuilder("-");
int minutes = 0;
if(params.length > 2)
{
reason = "";
reason = new StringBuilder();
for(int i = 1; i < params.length; i++)
{
reason += params[i] + " ";
reason.append(params[i]).append(" ");
}
}
else
@ -38,13 +38,13 @@ public class ShutdownCommand extends Command
}
catch (Exception e)
{
reason = params[1];
reason = new StringBuilder(params[1]);
}
}
}
ServerMessage message = null;
if (!reason.equals("-"))
ServerMessage message;
if (!reason.toString().equals("-"))
{
message = new GenericAlertComposer("<b>" + Emulator.getTexts().getValue("generic.warning") + "</b> \r\n" +
Emulator.getTexts().getValue("generic.shutdown").replace("%minutes%", minutes + "") + "\r\n" +

View File

@ -18,14 +18,14 @@ public class StaffAlertCommand extends Command
{
if(params.length > 1)
{
String message = "";
StringBuilder message = new StringBuilder();
for (int i = 1; i < params.length; i++)
{
message += params[i] + " ";
message.append(params[i]).append(" ");
}
Emulator.getGameEnvironment().getHabboManager().staffAlert(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername());
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new FriendChatMessageComposer(new Message(gameClient.getHabbo().getHabboInfo().getId(), -1, message)).compose(), "acc_staff_chat", gameClient);
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new FriendChatMessageComposer(new Message(gameClient.getHabbo().getHabboInfo().getId(), -1, message.toString())).compose(), "acc_staff_chat", gameClient);
}
else
{

View File

@ -58,7 +58,7 @@ public class StaffOnlineCommand extends Command
}
}
Collections.sort(staffs, new Comparator<Habbo>()
staffs.sort(new Comparator<Habbo>()
{
@Override
public int compare(Habbo o1, Habbo o2)
@ -67,18 +67,18 @@ public class StaffOnlineCommand extends Command
}
});
String message = Emulator.getTexts().getValue("commands.generic.cmd_staffonline.staffs");
message += "\r\n";
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("commands.generic.cmd_staffonline.staffs"));
message.append("\r\n");
for(Habbo habbo : staffs)
{
message += habbo.getHabboInfo().getUsername();
message += ": ";
message += habbo.getHabboInfo().getRank().getName();
message += "\r";
message.append(habbo.getHabboInfo().getUsername());
message.append(": ");
message.append(habbo.getHabboInfo().getRank().getName());
message.append("\r");
}
gameClient.sendResponse(new GenericAlertComposer(message));
gameClient.getHabbo().alert(message.toString());
}
return true;

View File

@ -61,7 +61,7 @@ public class SummonCommand extends Command
habbo.getRoomUnit().setGoalLocation(t);
}
habbo.getClient().sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("commands.generic.cmd_summon.been_summoned").replace("%user%", gameClient.getHabbo().getHabboInfo().getUsername())));
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_summon.been_summoned").replace("%user%", gameClient.getHabbo().getHabboInfo().getUsername()));
return true;
}

View File

@ -18,7 +18,7 @@ public class SummonRankCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
int minRank = 1;
int minRank;
if(params.length >= 2)
{

View File

@ -19,7 +19,7 @@ public class SuperbanCommand extends Command
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
HabboInfo habbo = null;
String reason = "";
StringBuilder reason = new StringBuilder();
if (params.length >= 2)
{
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
@ -38,12 +38,12 @@ public class SuperbanCommand extends Command
{
for (int i = 2; i < params.length; i++)
{
reason += params[i];
reason += " ";
reason.append(params[i]);
reason.append(" ");
}
}
int count = 0;
int count;
if (habbo != null)
{
if (habbo == gameClient.getHabbo().getHabboInfo())
@ -58,7 +58,7 @@ public class SuperbanCommand extends Command
return true;
}
count = Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason, IPBanCommand.TEN_YEARS, ModToolBanType.SUPER, -1).size();
count = Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason.toString(), IPBanCommand.TEN_YEARS, ModToolBanType.SUPER, -1).size();
}
else
{

View File

@ -91,7 +91,7 @@ public class TestCommand extends Command
if (params[1].equals("ach"))
{
AchievementManager.progressAchievement(gameClient.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("Jogger"), 1);
AchievementManager.progressAchievement(gameClient.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("Jogger"), 1000);
return true;
}
@ -125,28 +125,26 @@ public class TestCommand extends Command
if(params[1].equals("units"))
{
String s = "";
StringBuilder s = new StringBuilder();
for(Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos())
{
s += "Habbo ID: " + habbo.getHabboInfo().getId() + ", RoomUnit ID: " + habbo.getRoomUnit().getId() + "\r";
s.append("Habbo ID: ").append(habbo.getHabboInfo().getId()).append(", RoomUnit ID: ").append(habbo.getRoomUnit().getId()).append("\r");
}
for (Pet pet : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().valueCollection())
{
s += "Pet ID: " + pet.getId() + ", RoomUnit ID: " + pet.getRoomUnit().getId() + ", Name: " + pet.getName();
s.append("Pet ID: ").append(pet.getId()).append(", RoomUnit ID: ").append(pet.getRoomUnit().getId()).append(", Name: ").append(pet.getName());
if (pet instanceof MonsterplantPet)
{
s += ", B:" + (((MonsterplantPet) pet).canBreed() ? "Y" : "N") +
", PB: " + (((MonsterplantPet)pet).isPubliclyBreedable() ? "Y" : "N" ) +
", D: " + (((MonsterplantPet) pet).isDead() ? "Y" : "N");
s.append(", B:").append(((MonsterplantPet) pet).canBreed() ? "Y" : "N").append(", PB: ").append(((MonsterplantPet) pet).isPubliclyBreedable() ? "Y" : "N").append(", D: ").append(((MonsterplantPet) pet).isDead() ? "Y" : "N");
}
s += "\r";
s.append("\r");
}
gameClient.sendResponse(new MessagesForYouComposer(new String[]{s}));
gameClient.sendResponse(new MessagesForYouComposer(new String[]{s.toString()}));
return true;
}
@ -168,14 +166,14 @@ public class TestCommand extends Command
if (params[1].equalsIgnoreCase("bots"))
{
String message = "";
StringBuilder message = new StringBuilder();
for (Bot bot : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().valueCollection())
{
message += "Name: " + bot.getName() + ", ID: " + bot.getId() + ", RID: " + bot.getRoomUnit().getId() + ", Rot: " + bot.getRoomUnit().getBodyRotation() + "\r";
message.append("Name: ").append(bot.getName()).append(", ID: ").append(bot.getId()).append(", RID: ").append(bot.getRoomUnit().getId()).append(", Rot: ").append(bot.getRoomUnit().getBodyRotation()).append("\r");
}
gameClient.sendResponse(new MessagesForYouComposer(new String[]{message}));
gameClient.sendResponse(new MessagesForYouComposer(new String[]{message.toString()}));
return true;
}
@ -220,9 +218,9 @@ public class TestCommand extends Command
{
Pet pet = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getPet(Integer.valueOf(params[2]));
if(pet instanceof Pet)
if(pet != null)
{
String a = "";
String a;
String b = "";
String c = "";
if(params[3] != null)
@ -267,14 +265,14 @@ public class TestCommand extends Command
results.put(random, results.get(random) + 1);
}
String result = "Results : " + params[2] + "<br/><br/>";
StringBuilder result = new StringBuilder("Results : " + params[2] + "<br/><br/>");
for (Map.Entry<Integer, Integer> set : results.entrySet())
{
result += set.getKey() + " -> " + set.getValue() + "<br/>";
result.append(set.getKey()).append(" -> ").append(set.getValue()).append("<br/>");
}
gameClient.sendResponse(new GenericAlertComposer(result));
gameClient.sendResponse(new GenericAlertComposer(result.toString()));
}
else if (params[1].equalsIgnoreCase("threads"))
{
@ -403,7 +401,7 @@ public class TestCommand extends Command
}
else if (params[1].equals("datb"))
{
long millis = 1;
long millis;
long diff = 1;
try(Connection conn = Emulator.getDatabase().getDataSource().getConnection())
{

View File

@ -24,18 +24,18 @@ public class TransformCommand extends Command
{
if (params.length == 1)
{
String petNames = "";
petNames += (Emulator.getTexts().getValue("commands.generic.cmd_transform.title"));
petNames += "\r------------------------------------------------------------------------------\r";
StringBuilder petNames = new StringBuilder();
petNames.append(Emulator.getTexts().getValue("commands.generic.cmd_transform.title"));
petNames.append("\r------------------------------------------------------------------------------\r");
ArrayList<PetData> petData = new ArrayList<>(Emulator.getGameEnvironment().getPetManager().getPetData());
Collections.sort(petData);
String line = Emulator.getTexts().getValue("commands.generic.cmd_transform.line");
for (PetData p : petData)
{
petNames += (line.replace("%id%", p.getType() + "").replace("%name%", p.getName())) + "\r";
petNames.append(line.replace("%id%", p.getType() + "").replace("%name%", p.getName())).append("\r");
}
gameClient.sendResponse(new MessagesForYouComposer(new String[]{petNames}));
gameClient.sendResponse(new MessagesForYouComposer(new String[]{petNames.toString()}));
return true;
}
else

View File

@ -43,29 +43,29 @@ public class UserInfoCommand extends Command
return true;
}
String message = Emulator.getTexts().getValue("command.cmd_userinfo.userinfo") + ": " + " <b>" + habbo.getUsername() + "</b> (<b>" + habbo.getId() + "</b>)\r" +
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("command.cmd_userinfo.userinfo") + ": " + " <b>" + habbo.getUsername() + "</b> (<b>" + habbo.getId() + "</b>)\r" +
Emulator.getTexts().getValue("command.cmd_userinfo.user_id") + ": " + habbo.getId() + "\r" +
Emulator.getTexts().getValue("command.cmd_userinfo.user_name") + ": " + habbo.getUsername() + "\r" +
Emulator.getTexts().getValue("command.cmd_userinfo.motto") + ": " + habbo.getMotto().replace("<", "[").replace(">", "]") + "\r" +
Emulator.getTexts().getValue("command.cmd_userinfo.rank") + ": " +habbo.getRank().getName() + " (" + habbo.getRank().getId() + ") \r" +
Emulator.getTexts().getValue("command.cmd_userinfo.rank") + ": " + habbo.getRank().getName() + " (" + habbo.getRank().getId() + ") \r" +
Emulator.getTexts().getValue("command.cmd_userinfo.online") + ": " + (onlineHabbo == null ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" +
Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r" +
((habbo.getRank().hasPermission("acc_hide_ip", true))?"" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": "+ habbo.getIpRegister() + "\r") +
((habbo.getRank().hasPermission("acc_hide_ip", true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") +
((habbo.getRank().hasPermission("acc_hide_ip", true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getClient().getChannel().remoteAddress().toString() + "\r") +
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().achievementScore + "\r": "");
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().achievementScore + "\r" : ""));
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().checkForBan(habbo.getId());
message += Emulator.getTexts().getValue("command.cmd_userinfo.total_bans") + ": " + Emulator.getGameEnvironment().getModToolManager().totalBans(habbo.getId()) + "\r";
message += Emulator.getTexts().getValue("command.cmd_userinfo.banned") + ": " + Emulator.getTexts().getValue(ban != null ? "generic.yes" : "generic.no") + "\r\r";
message.append(Emulator.getTexts().getValue("command.cmd_userinfo.total_bans")).append(": ").append(Emulator.getGameEnvironment().getModToolManager().totalBans(habbo.getId())).append("\r");
message.append(Emulator.getTexts().getValue("command.cmd_userinfo.banned")).append(": ").append(Emulator.getTexts().getValue(ban != null ? "generic.yes" : "generic.no")).append("\r\r");
if (ban != null)
{
message += "<b>" + Emulator.getTexts().getValue("command.cmd_userinfo.ban_info") + "</b>\r";
message += ban.listInfo() + "\r";
message.append("<b>").append(Emulator.getTexts().getValue("command.cmd_userinfo.ban_info")).append("</b>\r");
message.append(ban.listInfo()).append("\r");
}
message += "<b>" + Emulator.getTexts().getValue("command.cmd_userinfo.currencies") + "</b>\r";
message += Emulator.getTexts().getValue("command.cmd_userinfo.credits") + ": " + habbo.getCredits() + "\r";
message.append("<b>").append(Emulator.getTexts().getValue("command.cmd_userinfo.currencies")).append("</b>\r");
message.append(Emulator.getTexts().getValue("command.cmd_userinfo.credits")).append(": ").append(habbo.getCredits()).append("\r");
TIntIntIterator iterator = habbo.getCurrencies().iterator();
for(int i = habbo.getCurrencies().size(); i-- > 0;)
@ -79,36 +79,27 @@ public class UserInfoCommand extends Command
break;
}
message += (Emulator.getTexts().getValue("seasonal.name." + iterator.key()) + ": " + iterator.value() + "\r");
message.append(Emulator.getTexts().getValue("seasonal.name." + iterator.key())).append(": ").append(iterator.value()).append("\r");
}
message += "\r" +
(onlineHabbo != null ? "<b>" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "</b>\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.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_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" : "");
message.append("\r").append(onlineHabbo != null ? "<b>" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "</b>\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-") : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().respectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().petRespectPointsToGive + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().blockFollowing) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "").append(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" : "");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Map.Entry<Integer, String>> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);
if (!nameChanges.isEmpty())
{
message += "\r<b>Latest name changes:<b><br/>";
message.append("\r<b>Latest name changes:<b><br/>");
for (Map.Entry<Integer, String> entry : nameChanges)
{
message += format.format(new Date((long)entry.getKey() * 1000L)) + " : " + entry.getValue() + "<br/>";
message.append(format.format(new Date((long) entry.getKey() * 1000L))).append(" : ").append(entry.getValue()).append("<br/>");
}
}
if(onlineHabbo != null)
{
message += "\r" +
"<b>Other accounts (";
message.append("\r" + "<b>Other accounts (");
ArrayList<HabboInfo> users = Emulator.getGameEnvironment().getHabboManager().getCloneAccounts(onlineHabbo, 10);
Collections.sort(users, new Comparator<HabboInfo>()
users.sort(new Comparator<HabboInfo>()
{
@Override
public int compare(HabboInfo o1, HabboInfo o2)
@ -117,17 +108,17 @@ public class UserInfoCommand extends Command
}
});
message += users.size() + "):</b>\r";
message.append(users.size()).append("):</b>\r");
message += "<b>Username,\tID,\tDate register,\tDate last online</b>\r";
message.append("<b>Username,\tID,\tDate register,\tDate last online</b>\r");
for(HabboInfo info : users)
{
message += info.getUsername() + ",\t" + info.getId() + ",\t" + format.format(new Date((long)info.getAccountCreated() * 1000L)) + ",\t" + format.format(new Date((long)info.getLastOnline() * 1000L)) + "\r";
message.append(info.getUsername()).append(",\t").append(info.getId()).append(",\t").append(format.format(new Date((long) info.getAccountCreated() * 1000L))).append(",\t").append(format.format(new Date((long) info.getLastOnline() * 1000L))).append("\r");
}
}
gameClient.sendResponse(new GenericAlertComposer(message));
gameClient.getHabbo().alert(message.toString());
return true;
}

View File

@ -15,14 +15,14 @@ public class WordQuizCommand extends Command
{
if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasActiveWordQuiz())
{
String question = "";
StringBuilder question = new StringBuilder();
int duration = 60;
if (params.length > 2)
{
for (int i = 1; i < params.length - 1; i++)
{
question += " " + params[i];
question.append(" ").append(params[i]);
}
try
@ -31,15 +31,15 @@ public class WordQuizCommand extends Command
}
catch (Exception e)
{
question += " " + params[params.length -1];
question.append(" ").append(params[params.length - 1]);
}
}
else
{
question = params[1];
question = new StringBuilder(params[1]);
}
gameClient.getHabbo().getHabboInfo().getCurrentRoom().startWordQuiz(question, duration * 1000);
gameClient.getHabbo().getHabboInfo().getCurrentRoom().startWordQuiz(question.toString(), duration * 1000);
}
return true;
}

View File

@ -20,8 +20,8 @@ public class CraftingAltar
{
this.baseItem = baseItem;
this.ingredients = new THashSet<>();
this.recipes = new THashMap<>();
this.ingredients = new THashSet<>(1);
this.recipes = new THashMap<>(1);
}
public void addIngredient(Item item)
@ -36,12 +36,12 @@ public class CraftingAltar
public Map<CraftingRecipe, Boolean> matchRecipes(Map<Item, Integer> amountMap)
{
THashMap<CraftingRecipe, Boolean> foundRecepies = new THashMap<>();
THashMap<CraftingRecipe, Boolean> foundRecepies = new THashMap<>(Math.max(1, this.recipes.size() / 3));
for (Map.Entry<Integer, CraftingRecipe> set : this.recipes.entrySet())
{
boolean contains = true;
boolean equals = true;
boolean equals;
if (set.getValue().isLimited() && !set.getValue().canBeCrafted())
{
@ -73,38 +73,6 @@ public class CraftingAltar
}
}
//
//
if (contains)
{
foundRecepies.put(set.getValue(), equals);

View File

@ -105,7 +105,7 @@ public class CraftingManager
public CraftingRecipe getRecipe(String recipeName)
{
CraftingRecipe recipe = null;
CraftingRecipe recipe;
for (CraftingAltar altar : this.altars.values())
{
recipe = altar.getRecipe(recipeName);

View File

@ -27,7 +27,7 @@ public class GameClient
private String machineId = "";
public ConcurrentHashMap<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
public final ConcurrentHashMap<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp();
public GameClient(Channel channel)
@ -43,7 +43,7 @@ public class GameClient
try
{
ServerMessage msg = composer.compose();
sendResponse(msg);
this.sendResponse(msg);
} catch (Exception e)
{
Emulator.getLogging().logPacketError(e);

View File

@ -22,34 +22,12 @@ public class GameClientManager
this.clients = new ConcurrentHashMap<>();
}
public ConcurrentMap<ChannelId, GameClient> getSessions()
{
return this.clients;
}
public boolean containsClient(Channel channel)
{
return this.clients.containsKey(channel.id());
}
public GameClient getClient(Channel channel)
{
if (this.clients.containsKey(channel.id())) {
return this.clients.get(channel.id());
}
return null;
}
public GameClient getClient(Habbo habbo)
{
for(GameClient client : this.clients.values())
{
if(client.getHabbo() == habbo)
return client;
}
return null;
}
public boolean addClient(ChannelHandlerContext ctx)
{
@ -59,19 +37,20 @@ public class GameClientManager
@Override
public void operationComplete(ChannelFuture channelFuture) throws Exception
{
disposeClient(ctx.channel());
GameClientManager.this.disposeClient(ctx.channel());
}
});
ctx.attr(CLIENT).set(client);
ctx.channel().attr(CLIENT).set(client);
ctx.fireChannelRegistered();
return this.clients.putIfAbsent(ctx.channel().id(), client) == null;
}
public void disposeClient(GameClient client)
{
client.getChannel().close();
this.disposeClient(client.getChannel());
}
private void disposeClient(Channel channel)
@ -89,6 +68,7 @@ public class GameClientManager
this.clients.remove(channel.id());
}
public boolean containsHabbo(Integer id)
{
if (!this.clients.isEmpty())
@ -108,6 +88,7 @@ public class GameClientManager
return false;
}
public Habbo getHabbo(int id)
{
for(GameClient client : this.clients.values())
@ -122,6 +103,7 @@ public class GameClientManager
return null;
}
public Habbo getHabbo(String username)
{
for(GameClient client : this.clients.values())
@ -136,6 +118,7 @@ public class GameClientManager
return null;
}
public List<Habbo> getHabbosWithIP(String ip)
{
List<Habbo> habbos = new ArrayList<>();
@ -154,6 +137,7 @@ public class GameClientManager
return habbos;
}
public List<Habbo> getHabbosWithMachineId(String machineId)
{
List<Habbo> habbos = new ArrayList<>();
@ -169,28 +153,35 @@ public class GameClientManager
return habbos;
}
public void sendBroadcastResponse(MessageComposer composer)
{
sendBroadcastResponse(composer.compose());
this.sendBroadcastResponse(composer.compose());
}
public void sendBroadcastResponse(ServerMessage msg)
public void sendBroadcastResponse(ServerMessage message)
{
for (GameClient client : this.clients.values()) {
client.sendResponse(msg);
for (GameClient client : this.clients.values())
{
client.sendResponse(message);
}
}
public void sendBroadcastResponse(ServerMessage msg, GameClient exclude)
public void sendBroadcastResponse(ServerMessage message, GameClient exclude)
{
for (GameClient client : this.clients.values())
{
for (GameClient client : this.clients.values()) {
if(client.equals(exclude))
continue;
client.sendResponse(msg);
client.sendResponse(message);
}
}
public void sendBroadcastResponse(ServerMessage message, String minPermission, GameClient exclude)
{
for (GameClient client : this.clients.values())

View File

@ -31,19 +31,22 @@ public abstract class Game implements Runnable
protected final THashMap<GameTeamColors, GameTeam> teams = new THashMap<>();
protected Room room;
protected final Room room;
protected boolean countsAchievements;
protected final boolean countsAchievements;
protected int startTime;
protected int pauseTime;
protected int endTime;
public boolean isRunning;
public GameState state = GameState.IDLE;
public Game(Class<? extends GameTeam> gameTeamClazz, Class<? extends GamePlayer> gamePlayerClazz, Room room, boolean countsAchievements)
{
@ -137,14 +140,14 @@ public abstract class Game implements Runnable
if (deleteGame)
{
room.deleteGame(this);
this.room.deleteGame(this);
}
}
public void start()
{
this.isRunning = true;
this.state = GameState.RUNNING;
this.startTime = Emulator.getIntUnixTimestamp();
if(Emulator.getPluginManager().isRegistered(GameStartedEvent.class, true))
@ -158,17 +161,34 @@ public abstract class Game implements Runnable
for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(WiredBlob.class))
{
item.setExtradata("0");
room.updateItem(item);
this.room.updateItem(item);
}
}
public abstract void run();
public void pause()
{
if (this.state.equals(GameState.RUNNING))
{
this.state = GameState.PAUSED;
this.pauseTime = Emulator.getIntUnixTimestamp();
}
}
public void unpause()
{
if (this.state.equals(GameState.PAUSED))
{
this.state = GameState.RUNNING;
this.endTime = Emulator.getIntUnixTimestamp() + (this.endTime - this.pauseTime);
}
}
public void stop()
{
this.isRunning = false;
this.state = GameState.IDLE;
this.endTime = Emulator.getIntUnixTimestamp();
this.saveScores();

View File

@ -7,7 +7,7 @@ import com.eu.habbo.habbohotel.wired.WiredTriggerType;
public class GamePlayer
{
private Habbo habbo;
private final Habbo habbo;
private GameTeamColors teamColor;

View File

@ -0,0 +1,8 @@
package com.eu.habbo.habbohotel.games;
public enum GameState
{
IDLE,
RUNNING,
PAUSED
}

View File

@ -2,10 +2,7 @@ package com.eu.habbo.habbohotel.games.battlebanzai;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.GamePlayer;
import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.games.*;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiSphere;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTile;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.InteractionBattleBanzaiTimer;
@ -13,19 +10,15 @@ import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.Inter
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboards.InteractionBattleBanzaiScoreboard;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.plugin.EventHandler;
import com.eu.habbo.plugin.EventPriority;
import com.eu.habbo.plugin.events.users.UserTakeStepEvent;
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
import java.util.Collection;
import java.util.Map;
public class BattleBanzaiGame extends Game
@ -51,11 +44,14 @@ public class BattleBanzaiGame extends Game
private final THashMap<GameTeamColors, THashSet<HabboItem>> lockedTiles;
private final THashMap<Integer, HabboItem> gameTiles;
public BattleBanzaiGame(Room room)
{
super(BattleBanzaiGameTeam.class, BattleBanzaiGamePlayer.class, room, true);
this.lockedTiles = new THashMap<>();
this.gameTiles = new THashMap<>();
room.setAllowEffects(true);
}
@ -63,7 +59,7 @@ public class BattleBanzaiGame extends Game
@Override
public void initialise()
{
if(this.isRunning)
if(!this.state.equals(GameState.IDLE))
return;
int highestTime = 0;
@ -115,7 +111,7 @@ public class BattleBanzaiGame extends Game
@Override
public void start()
{
if(this.isRunning)
if(!this.state.equals(GameState.IDLE))
return;
super.start();
@ -130,7 +126,7 @@ public class BattleBanzaiGame extends Game
{
try
{
if (!this.isRunning)
if (this.state.equals(GameState.IDLE))
return;
if(this.countDown > 0)
@ -158,11 +154,13 @@ public class BattleBanzaiGame extends Game
{
Emulator.getThreading().run(this, 1000);
if (this.state.equals(GameState.PAUSED)) return;
this.timeLeft--;
for (Map.Entry<Integer, InteractionBattleBanzaiTimer> set : this.room.getRoomSpecialTypes().getBattleBanzaiTimers().entrySet())
{
set.getValue().setExtradata(timeLeft + "");
set.getValue().setExtradata(this.timeLeft + "");
this.room.updateItemState(set.getValue());
}
@ -225,8 +223,6 @@ public class BattleBanzaiGame extends Game
}
if (winningTeam != null)
{
synchronized (winningTeam)
{
for (GamePlayer player : winningTeam.getMembers())
{
@ -245,16 +241,13 @@ public class BattleBanzaiGame extends Game
Emulator.getThreading().run(new BattleBanzaiTilesFlicker(this.lockedTiles.get(winningTeam.teamColor), winningTeam.teamColor, this.room));
}
}
this.stop();
this.isRunning = false;
}
}
catch (Exception e)
{
e.printStackTrace();
Emulator.getLogging().logErrorLine(e);
}
}
@ -265,23 +258,21 @@ public class BattleBanzaiGame extends Game
this.timeLeft = 0;
//Think on Habbo the counters and tiles stay as is untill the game restarts.
this.refreshGates();
for (HabboItem tile : this.gameTiles.values())
{
if (tile.getExtradata().equals("1"))
{
tile.setExtradata("0");
this.room.updateItemState(tile);
}
}
this.lockedTiles.clear();
}
protected synchronized void resetMap()
private synchronized void resetMap()
{
for (HabboItem item : this.room.getFloorItems())
{
@ -290,6 +281,7 @@ public class BattleBanzaiGame extends Game
item.setExtradata("1");
this.room.updateItemState(item);
this.tileCount++;
this.gameTiles.put(item.getId(), item);
}
if (item instanceof InteractionBattleBanzaiScoreboard)
@ -316,25 +308,6 @@ public class BattleBanzaiGame extends Game
}
}
@EventHandler(priority = EventPriority.HIGH)
public static void onUserWalkEvent(UserTakeStepEvent event)
{
if(event.habbo.getHabboInfo().getCurrentGame() == BattleBanzaiGame.class)
{
BattleBanzaiGame game = (BattleBanzaiGame) event.habbo.getHabboInfo().getCurrentRoom().getGame(BattleBanzaiGame.class);
if (game != null && game.isRunning)
{
if(!event.habbo.getHabboInfo().getCurrentRoom().hasObjectTypeAt(InteractionBattleBanzaiTile.class, event.toLocation.x, event.toLocation.y))
{
event.setCancelled(true);
event.habbo.getRoomUnit().setGoalLocation(event.habbo.getRoomUnit().getCurrentLocation());
event.habbo.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
game.room.sendComposer(new RoomUserStatusComposer(event.habbo.getRoomUnit()).compose());
}
}
}
}
public void tileLocked(GameTeamColors teamColor, HabboItem item, Habbo habbo)
{
@ -392,12 +365,44 @@ public class BattleBanzaiGame extends Game
private void refreshGates()
{
THashSet<RoomTile> tilesToUpdate = new THashSet<>();
for (HabboItem item : this.room.getRoomSpecialTypes().getBattleBanzaiGates().values())
Collection<InteractionBattleBanzaiGate> gates = this.room.getRoomSpecialTypes().getBattleBanzaiGates().values();
THashSet<RoomTile> tilesToUpdate = new THashSet<>(gates.size());
for (HabboItem item : gates)
{
tilesToUpdate.add(this.room.getLayout().getTile(item.getX(), item.getY()));
}
this.room.updateTiles(tilesToUpdate);
}
public void markTile(Habbo habbo, InteractionBattleBanzaiTile tile, int state)
{
if (!this.gameTiles.contains(tile.getId())) return;
int check = state - (habbo.getHabboInfo().getGamePlayer().getTeamColor().type * 3);
if(check == 3 || check == 4)
{
state++;
if(state % 3 == 2)
{
habbo.getHabboInfo().getGamePlayer().addScore(BattleBanzaiGame.POINTS_LOCK_TILE);
this.tileLocked(habbo.getHabboInfo().getGamePlayer().getTeamColor(), tile, habbo);
}
else
{
habbo.getHabboInfo().getGamePlayer().addScore(BattleBanzaiGame.POINTS_FILL_TILE);
}
}
else
{
state = (habbo.getHabboInfo().getGamePlayer().getTeamColor().type * 3) + 3;
habbo.getHabboInfo().getGamePlayer().addScore(BattleBanzaiGame.POINTS_HIJACK_TILE);
}
this.refreshCounters(habbo.getHabboInfo().getGamePlayer().getTeamColor());
tile.setExtradata(state + "");
this.room.updateItem(tile);
}
}

View File

@ -17,19 +17,19 @@ public class BattleBanzaiGameTeam extends GameTeam
{
super.addMember(gamePlayer);
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), BattleBanzaiGame.effectId + this.teamColor.type);
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), BattleBanzaiGame.effectId + this.teamColor.type, -1);
}
@Override
public void removeMember(GamePlayer gamePlayer)
{
Game game = gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().getGame(gamePlayer.getHabbo().getHabboInfo().getCurrentGame());
if(game != null && game instanceof BattleBanzaiGame)
if(game instanceof BattleBanzaiGame)
{
((BattleBanzaiGame) game).addPositionToGate(gamePlayer.getTeamColor());
}
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), 0);
gamePlayer.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gamePlayer.getHabbo(), 0, -1);
gamePlayer.getHabbo().getRoomUnit().setCanWalk(true);
super.removeMember(gamePlayer);

View File

@ -40,16 +40,15 @@ public class FootballGame extends Game
if(this.room == null || !this.room.isLoaded())
return;
Habbo habbo = room.getHabbo(kicker);
Habbo habbo = this.room.getHabbo(kicker);
if(habbo != null)
{
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("FootballGoalScored"));
}
if (habbo.getHabboInfo().getId() != this.room.getOwnerId())
{
AchievementManager.progressAchievement(this.room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("FootballGoalScoredInRoom"));
}
}
this.room.sendComposer(new RoomUserActionComposer(kicker, RoomUserAction.WAVE).compose());
@ -58,5 +57,4 @@ public class FootballGame extends Game
scoreBoard.getValue().changeScore(1);
}
}
}

View File

@ -2,26 +2,24 @@ package com.eu.habbo.habbohotel.games.freeze;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.GamePlayer;
import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.games.*;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeBlock;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeExitTile;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeTile;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeTimer;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGate;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards.InteractionFreezeScoreboard;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.plugin.EventHandler;
import com.eu.habbo.plugin.events.emulator.EmulatorConfigUpdatedEvent;
import com.eu.habbo.plugin.events.users.UserTakeStepEvent;
import com.eu.habbo.threading.runnables.freeze.FreezeClearEffects;
import com.eu.habbo.threading.runnables.freeze.FreezeThrowSnowball;
import gnu.trove.map.hash.THashMap;
@ -34,6 +32,7 @@ import java.util.Map;
public class FreezeGame extends Game
{
public static final int effectId = 40;
public static int POWER_UP_POINTS;
public static int POWER_UP_CHANCE;
public static int POWER_UP_PROTECT_TIME;
@ -57,7 +56,7 @@ public class FreezeGame extends Game
@Override
public synchronized void initialise()
{
if(this.isRunning)
if(this.state == GameState.RUNNING)
return;
int highestTime = 0;
@ -86,7 +85,7 @@ public class FreezeGame extends Game
{
if (this.getTeamForHabbo(habbo) == null)
{
for (HabboItem item : room.getItemsAt(habbo.getRoomUnit().getCurrentLocation()))
for (HabboItem item : this.room.getItemsAt(habbo.getRoomUnit().getCurrentLocation()))
{
if (item instanceof InteractionFreezeTile)
{
@ -136,13 +135,13 @@ public class FreezeGame extends Game
public void throwBall(Habbo habbo, InteractionFreezeTile item)
{
if (!this.isRunning || !habbo.getHabboInfo().isInGame() || habbo.getHabboInfo().getCurrentGame() != this.getClass())
if (!this.state.equals(GameState.RUNNING) || !habbo.getHabboInfo().isInGame() || habbo.getHabboInfo().getCurrentGame() != this.getClass())
return;
if (!item.getExtradata().equalsIgnoreCase("0") && !item.getExtradata().isEmpty())
return;
if (RoomLayout.tilesAdjecent(habbo.getRoomUnit().getCurrentLocation(), room.getLayout().getTile(item.getX(), item.getY())))
if (RoomLayout.tilesAdjecent(habbo.getRoomUnit().getCurrentLocation(), this.room.getLayout().getTile(item.getX(), item.getY())))
{
if(((FreezeGamePlayer)habbo.getHabboInfo().getGamePlayer()).canThrowSnowball())
{
@ -158,14 +157,15 @@ public class FreezeGame extends Game
RoomTile t = this.room.getLayout().getTile(x, y);
tiles.add(t);
for(int i = 0; i < 4; i++)
for(int rotatation = 0; rotatation < 8; rotatation += 2)
{
for(int j = 0; j < radius; j++)
{
t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(x, y), i * 2, (short) radius);
t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(x, y), rotatation, j);
if(t == null || t.x < 0 || t.y < 0 || t.x >= this.room.getLayout().getMapSizeX() || t.y >= this.room.getLayout().getMapSizeY())
continue;
tiles.add(t);
}
}
@ -177,13 +177,13 @@ public class FreezeGame extends Game
{
THashSet<RoomTile> tiles = new THashSet<>();
for(int i = 0; i < 4; i++)
for(int rotation = 1; rotation < 9; rotation += 2)
{
RoomTile t = room.getLayout().getTile(x, y);
RoomTile t = this.room.getLayout().getTile(x, y);
for(int j = 0; j < radius; j++)
{
t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(x, y), (i * 2) + 1, (short) radius);
t = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(x, y), rotation, j);
if (t != null)
{
@ -198,7 +198,7 @@ public class FreezeGame extends Game
return tiles;
}
public synchronized void explodeBox(InteractionFreezeBlock block)
public synchronized void explodeBox(InteractionFreezeBlock block, int delay)
{
int powerUp = 0;
if(Emulator.getRandom().nextInt(100) + 1 <= FreezeGame.POWER_UP_CHANCE)
@ -206,7 +206,7 @@ public class FreezeGame extends Game
powerUp += Emulator.getRandom().nextInt(6) + 1;
}
block.setExtradata((powerUp + 1) * 1000 + "");
block.setExtradata((powerUp + 1) + String.format("%3d", delay));
this.room.updateItemState(block);
}
@ -273,7 +273,7 @@ public class FreezeGame extends Game
@Override
public void start()
{
if (this.isRunning)
if (this.state != GameState.IDLE)
{
return;
}
@ -292,13 +292,15 @@ public class FreezeGame extends Game
{
try
{
if (!this.isRunning)
if (this.state.equals(GameState.IDLE))
return;
if (timeLeft > 0)
if (this.timeLeft > 0)
{
Emulator.getThreading().run(this, 1000);
if (this.state.equals(GameState.PAUSED)) return;
this.timeLeft--;
for (GameTeam team : this.teams.values())
@ -331,7 +333,7 @@ public class FreezeGame extends Game
for (Map.Entry<Integer, InteractionFreezeTimer> set : this.room.getRoomSpecialTypes().getFreezeTimers().entrySet())
{
set.getValue().setExtradata(timeLeft + "");
set.getValue().setExtradata(this.timeLeft + "");
this.room.updateItemState(set.getValue());
}
} else
@ -341,7 +343,7 @@ public class FreezeGame extends Game
}
catch (Exception e)
{
e.printStackTrace();
Emulator.getLogging().logErrorLine(e);
}
}
@ -391,7 +393,7 @@ public class FreezeGame extends Game
for (Map.Entry<Integer, InteractionFreezeGate> set : this.room.getRoomSpecialTypes().getFreezeGates().entrySet())
{
if (teamMemberCount.containsKey(set.getValue()))
if (teamMemberCount.containsKey(set.getValue().teamColor))
{
int amount = Math.min(teamMemberCount.get(set.getValue().teamColor), 5);
set.getValue().setExtradata(amount + "");
@ -413,32 +415,13 @@ public class FreezeGame extends Game
public boolean execute(InteractionFreezeExitTile object)
{
object.setExtradata(state);
room.updateItemState(object);
FreezeGame.this.room.updateItemState(object);
return true;
}
});
}
@EventHandler
public static void onUserWalkEvent(UserTakeStepEvent event)
{
if(event.habbo.getHabboInfo().getCurrentGame() == FreezeGame.class)
{
FreezeGame game = (FreezeGame) event.habbo.getHabboInfo().getCurrentRoom().getGame(FreezeGame.class);
if (game != null && game.isRunning)
{
if (!game.room.hasObjectTypeAt(InteractionFreezeTile.class, event.toLocation.x, event.toLocation.y))
{
event.setCancelled(true);
event.habbo.getRoomUnit().setGoalLocation(event.habbo.getRoomUnit().getCurrentLocation());
event.habbo.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
game.room.sendComposer(new RoomUserStatusComposer(event.habbo.getRoomUnit()).compose());
}
}
}
}
@EventHandler
public static void onConfigurationUpdated(EmulatorConfigUpdatedEvent event)
{

View File

@ -74,7 +74,6 @@ public class FreezeGamePlayer extends GamePlayer
{
game.playerDies(this);
}
return;
}
else
{
@ -114,13 +113,7 @@ public class FreezeGamePlayer extends GamePlayer
public boolean canThrowSnowball()
{
if(this.snowBalls > 0)
{
if(!this.isFrozen())
return true;
}
return false;
return this.snowBalls > 0 && !this.isFrozen();
}
public void freeze()
@ -220,7 +213,7 @@ public class FreezeGamePlayer extends GamePlayer
{
this.frozenTime--;
if(frozenTime <= 0)
if(this.frozenTime <= 0)
{
super.getHabbo().getRoomUnit().setCanWalk(true);
needsEffectUpdate = true;
@ -260,6 +253,6 @@ public class FreezeGamePlayer extends GamePlayer
if(this.dead)
return;
super.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(super.getHabbo(), this.correctEffectId());
super.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(super.getHabbo(), this.correctEffectId(), -1);
}
}

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