Updated to 1.11 decompiled.

This commit is contained in:
capheus 2018-09-12 16:45:00 +00:00
parent 4619f7fec0
commit 406beb9bc2
209 changed files with 3126 additions and 1691 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.10.0 ##
## Current Stable Version: 1.11.0 ##
Arcturus Morningstar is a Habbo emulator written in Java aiming to be an exact clone of the offical server, based on Arcturus Emulator by TheGeneral.
Targeting PRODUCTION-201611291003-338511768

View File

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

View File

@ -0,0 +1,34 @@
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('hotel.wired.superwired.info', 'Superwired Usage Information. Possible reward types:<br/>badge: BADGE CODE<br/>Credits: credits#amount</br>Pixels: pixels#amount</br>Points: points#amount</br>Respect: respect#amount<br/>Furniture: furni#FurnitureID<br/>Catalog Item: cata#CatalogItemID<br/>');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.calendar.enabled', '0');
ALTER TABLE `permissions` ADD `acc_inifnite_friends` ENUM( '0', '1' ) NOT NULL DEFAULT '0';
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('hotel.wired.kickexception.unkickable', 'Wired Kick Exception: Unkickable'), ('hotel.wired.kickexception.owner', 'Wired Kick Exception: Room Owner');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('images.gamecenter.snowwar', 'c_images/gamecenter_snowwar/'), ('images.gamecenter.basejump', 'c_images/gamecenter_basejump/');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES
('hotel.purchase.ltd.limit.daily.total', '10'), #Amount of LTDs you can buy per day.
('hotel.purchase.ltd.limit.daily.item', '3'); #Amount of LTDs you can buy of a specific item per day.
CREATE INDEX user_timestamp_index ON catalog_items_limited (user_id, timestamp);
INSERT INTO `emulator_texts` (`key`, `value`) VALUES
('error.catalog.buy.limited.daily.item', 'You cannot purchase any limited %itemname% for today as you have reached the limt of %limit%. Come back tomorrow.'),
('error.catalog.buy.limited.daily.total', 'You cannot purchase any limited furniture as you have reached the limited of %limit% for today. Come back tomorrow.');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.catalog.ltd.limit.enabled', '1');
INSERT INTO `emulator_settings` (`key` ,`value`) VALUES ('hotel.welcome.alert.oldstyle', '0'); #Set to 1 to use the old Black MOTD Style (Same as commands window)
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.welcome.alert.delay', '10000');
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.calendar.starttimestamp', '1512238152');
ALTER TABLE `permissions` ADD `cmd_calendar` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `cmd_bundle`;
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_calendar', 'calendar'), ('commands.description.cmd_calendar', ':calendar');
ALTER TABLE `pet_actions` CHANGE `pet_name` `pet_name` VARCHAR(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `pet_actions` CHANGE `happy_actions` `happy_actions` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';
ALTER TABLE `pet_actions` CHANGE `tired_actions` `tired_actions` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '', CHANGE `random_actions` `random_actions` VARCHAR(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';

View File

@ -33,7 +33,7 @@ public final class Emulator
public final static int MAJOR = 1;
public final static int MINOR = 10;
public final static int MINOR = 11;
public final static int BUILD = 0;
@ -157,6 +157,16 @@ public final class Emulator
Emulator.getLogging().logErrorLine("No account has been found in config.ini Please create an account on Arcturus.wf and edit the config.ini in order to maximize usage of Arcturus! http://arcturus.wf");
}
Emulator.getThreading().run(new Runnable()
{
@Override
public void run()
{
Emulator.getLogging().logStart("Thanks for using Arcturus. Contact: Skype: wesley.jabbo Discord: TheGeneral#0063");
Emulator.getLogging().logStart("-The General");
}
}, 3500);
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (!isShuttingDown && isReady)

View File

@ -1,6 +1,9 @@
package com.eu.habbo.core.consolecommands;
import com.eu.habbo.Emulator;
import com.eu.habbo.messages.PacketManager;
public class ConsoleTestCommand extends ConsoleCommand
{
public ConsoleTestCommand()
@ -13,7 +16,8 @@ public class ConsoleTestCommand extends ConsoleCommand
{
System.out.println("This is a test command for live debugging.");
PacketManager.DEBUG_SHOW_PACKETS = true;
Emulator.getConfig().update("debug.show.packets", "1");
}
}

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.bots;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.generic.alerts.BotErrorComposer;
@ -117,7 +118,7 @@ public class BotManager
if(room != null && bot != null && habbo != null)
{
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission("acc_anyroomowner") || habbo.hasPermission("acc_placefurni"))
if (room.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER) || habbo.hasPermission("acc_placefurni"))
{
if (room.getCurrentBots().size() >= Room.MAXIMUM_BOTS && !habbo.hasPermission("acc_unlimited_bots"))
{
@ -173,7 +174,7 @@ public class BotManager
if(pickedUpEvent.isCancelled())
return;
if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission("acc_anyroomowner"))
if (bot.getOwnerId() == habbo.getHabboInfo().getId() || habbo.hasPermission(Permission.ACC_ANYROOMOWNER))
{
if (!habbo.hasPermission("acc_unlimited_bots") && habbo.getInventory().getBotsComponent().getBots().size() >= 15)
return;

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.bots;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.plugin.events.bots.BotServerItemEvent;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitWalkToRoomUnit;
@ -62,7 +63,7 @@ public class ButlerBot extends Bot
@Override
public void onUserSay(final RoomChatMessage message)
{
if(this.getRoomUnit().isWalking())
if(this.getRoomUnit().hasStatus(RoomUnitStatus.MOVE))
return;
if (this.getRoomUnit().getCurrentLocation().distance(message.getHabbo().getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("hotel.bot.butler.servedistance"))

View File

@ -943,6 +943,23 @@ public class CatalogManager
habbo.getClient().sendResponse(new AlertLimitedSoldOutComposer());
return;
}
if (Emulator.getConfig().getBoolean("hotel.catalog.ltd.limit.enabled"))
{
int ltdLimit = Emulator.getConfig().getInt("hotel.purchase.ltd.limit.daily.total");
if (habbo.getHabboStats().totalLtds() >= ltdLimit)
{
habbo.alert(Emulator.getTexts().getValue("error.catalog.buy.limited.daily.total").replace("%itemname%", item.getBaseItems().iterator().next().getFullName()).replace("%limit%", ltdLimit + ""));
return;
}
ltdLimit = Emulator.getConfig().getInt("hotel.purchase.ltd.limit.daily.item");
if (habbo.getHabboStats().totalLtds(item.id) >= ltdLimit)
{
habbo.alert(Emulator.getTexts().getValue("error.catalog.buy.limited.daily.item").replace("%itemname%", item.getBaseItems().iterator().next().getFullName()).replace("%limit%", ltdLimit + ""));
return;
}
}
}
if(amount > 1)
@ -1005,6 +1022,8 @@ public class CatalogManager
totalPoints += item.getPoints();
}
habbo.getHabboStats().addLtdLog(item.getId(), Emulator.getIntUnixTimestamp());
//for (int j = 0; j < item.getAmount(); j++)
//{
for (Item baseItem : item.getBaseItems())
@ -1132,9 +1151,6 @@ public class CatalogManager
}
else if(baseItem.getInteractionType().getType() == InteractionGuildFurni.class || baseItem.getInteractionType().getType() == InteractionGuildGate.class)
{
InteractionGuildFurni habboItem = (InteractionGuildFurni)Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata);
habboItem.setExtradata("");
habboItem.needsUpdate(true);
int guildId;
try
{
@ -1146,6 +1162,11 @@ public class CatalogManager
habbo.getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
return;
}
InteractionGuildFurni habboItem = (InteractionGuildFurni)Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata);
habboItem.setExtradata("");
habboItem.needsUpdate(true);
Emulator.getThreading().run(habboItem);
Emulator.getGameEnvironment().getGuildManager().setGuild(habboItem, guildId);
itemsList.add(habboItem);

View File

@ -87,8 +87,6 @@ public class MarketPlace
return;
}
habbo.getInventory().removeMarketplaceOffer(offer);
try (PreparedStatement statement = connection.prepareStatement("DELETE FROM marketplace_items WHERE id = ? AND state != 2"))
{
statement.setInt(1, offer.getOfferId());
@ -96,6 +94,7 @@ public class MarketPlace
if (count != 0)
{
habbo.getInventory().removeMarketplaceOffer(offer);
try (PreparedStatement updateItems = connection.prepareStatement("UPDATE items SET user_id = ? WHERE id = ? LIMIT 1"))
{
updateItems.setInt(1, habbo.getHabboInfo().getId());
@ -209,8 +208,6 @@ public class MarketPlace
query += " LIMIT 100";
System.out.println(query);
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query))
{
statement.setInt(1, Emulator.getIntUnixTimestamp() - 172800);

View File

@ -25,7 +25,7 @@ public class AlertCommand extends Command {
}
if(params.length < 3)
{
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_alert.forgot_username"), RoomChatMessageBubbles.ALERT);
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_alert.forgot_message"), RoomChatMessageBubbles.ALERT);
return true;
}

View File

@ -0,0 +1,26 @@
package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer;
import com.eu.habbo.messages.outgoing.unknown.NuxAlertComposer;
public class CalendarCommand extends Command
{
public CalendarCommand()
{
super("cmd_calendar", Emulator.getTexts().getValue("commands.keys.cmd_calendar").split(";"));
}
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
if (Emulator.getConfig().getBoolean("hotel.calendar.enabled"))
{
gameClient.sendResponse(new AdventCalendarDataComposer("xmas11", Emulator.getGameEnvironment().getCatalogManager().calendarRewards.size(), (int)Math.floor((Emulator.getIntUnixTimestamp() - Emulator.getConfig().getInt("hotel.calendar.starttimestamp")) / 86400) , gameClient.getHabbo().getHabboStats().calendarRewardsClaimed, true));
gameClient.sendResponse(new NuxAlertComposer("openView/calendar"));
}
return true;
}
}

View File

@ -3,7 +3,9 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.core.CommandLog;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.permissions.PermissionSetting;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetCommand;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
@ -38,6 +40,7 @@ public class CommandHandler
addCommand(new BanCommand());
addCommand(new BlockAlertCommand());
addCommand(new BotsCommand());
addCommand(new CalendarCommand());
addCommand(new ChangeNameCommand());
addCommand(new ChatTypeCommand());
addCommand(new CommandsCommand());
@ -203,7 +206,7 @@ public class CommandHandler
e.printStackTrace();
}
if (gameClient.getHabbo().hasPermission("log_commands"))
if (gameClient.getHabbo().getHabboInfo().getRank().isLogCommands())
{
Emulator.getLogging().addLog(new CommandLog(gameClient.getHabbo().getHabboInfo().getId(), command, commandLine, succes));
}
@ -229,7 +232,7 @@ public class CommandHandler
if (room.getCurrentPets().isEmpty())
return false;
TIntObjectIterator<AbstractPet> petIterator = room.getCurrentPets().iterator();
TIntObjectIterator<Pet> petIterator = room.getCurrentPets().iterator();
for (int j = room.getCurrentPets().size(); j-- > 0; )
{
@ -242,7 +245,7 @@ public class CommandHandler
break;
}
AbstractPet pet = petIterator.value();
Pet pet = petIterator.value();
if (pet instanceof Pet)
{
@ -262,7 +265,7 @@ public class CommandHandler
if (command.key.equalsIgnoreCase(s))
{
if (command.level <= pet.getLevel())
((Pet) pet).handleCommand(command, gameClient.getHabbo());
((Pet) pet).handleCommand(command, gameClient.getHabbo(), args);
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.UNKNOWN_COMMAND));
@ -284,14 +287,14 @@ public class CommandHandler
List<Command> allowedCommands = new ArrayList<Command>();
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId))
{
Collection<String> permissions = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId).getPermissions().keySet();
THashMap<String, Permission> permissions = Emulator.getGameEnvironment().getPermissionsManager().getRank(rankId).getPermissions();
for (Command command : commands.values())
{
if (allowedCommands.contains(command))
continue;
if (permissions.contains(command.permission))
if (permissions.contains(command.permission) && permissions.get(command.permission).setting != PermissionSetting.DISALLOWED)
{
allowedCommands.add(command);
}

View File

@ -3,6 +3,7 @@
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
public class CoordsCommand extends Command {
@ -23,10 +24,10 @@ public class CoordsCommand extends Command {
gameClient.sendResponse(new GenericAlertComposer(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().getStatus().containsKey("sit") ? gameClient.getHabbo().getRoomUnit().getStatus().get("sit") : gameClient.getHabbo().getRoomUnit().getZ()) + "\r" +
"z: " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? gameClient.getHabbo().getRoomUnit().getStatus(RoomUnitStatus.SIT) : gameClient.getHabbo().getRoomUnit().getZ()) + "\r" +
Emulator.getTexts().getValue("generic.rotation.head") + ": " + gameClient.getHabbo().getRoomUnit().getHeadRotation() + "-" + gameClient.getHabbo().getRoomUnit().getHeadRotation().getValue() + "\r" +
Emulator.getTexts().getValue("generic.rotation.body") + ": " + gameClient.getHabbo().getRoomUnit().getBodyRotation() + "-" + gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue() + "\r" +
Emulator.getTexts().getValue("generic.sitting") + ": " + (gameClient.getHabbo().getRoomUnit().getStatus().containsKey("sit") ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" +
Emulator.getTexts().getValue("generic.sitting") + ": " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" +
"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" +

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
@ -42,7 +43,7 @@ public class EmptyBotsInventoryCommand extends Command
if(params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")))
{
Habbo habbo = gameClient.getHabbo();
if (params.length == 3 && gameClient.getHabbo().hasPermission("acc_empty_others"))
if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS))
{
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
}

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
@ -44,7 +45,7 @@ public class EmptyInventoryCommand extends Command
if(params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")))
{
Habbo habbo = gameClient.getHabbo();
if (params.length == 3 && gameClient.getHabbo().hasPermission("acc_empty_others"))
if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS))
{
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
}

View File

@ -2,7 +2,8 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.users.Habbo;
@ -42,20 +43,20 @@ public class EmptyPetsInventoryCommand extends Command
if(params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")))
{
Habbo habbo = gameClient.getHabbo();
if (params.length == 3 && gameClient.getHabbo().hasPermission("acc_empty_others"))
if (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS))
{
habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]);
}
if (habbo != null)
{
TIntObjectHashMap<AbstractPet> pets = new TIntObjectHashMap<>();
TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>();
pets.putAll(habbo.getInventory().getPetsComponent().getPets());
habbo.getInventory().getPetsComponent().getPets().clear();
pets.forEachValue(new TObjectProcedure<AbstractPet>()
pets.forEachValue(new TObjectProcedure<Pet>()
{
@Override
public boolean execute(AbstractPet object)
public boolean execute(Pet object)
{
Emulator.getGameEnvironment().getPetManager().deletePet(object);
return true;

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserWhisperComposer;
@ -18,7 +19,7 @@ public class FreezeBotsCommand extends Command
{
if(gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null)
{
if(gameClient.getHabbo().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId() || gameClient.getHabbo().hasPermission("acc_anyroomowner"))
if(gameClient.getHabbo().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId() || gameClient.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER))
{
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setAllowBotsWalk(!gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk());
gameClient.getHabbo().whisper(gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk() ? Emulator.getTexts().getValue("commands.succes.cmd_freeze_bots.unfrozen") : Emulator.getTexts().getValue("commands.succes.cmd_freeze_bots.frozen"), RoomChatMessageBubbles.ALERT);

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
@ -36,7 +37,7 @@ public class LayCommand extends Command
}
}
gameClient.getHabbo().getRoomUnit().getStatus().put("lay", 0.5 + "");
gameClient.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.LAY, 0.5 + "");
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserStatusComposer(gameClient.getHabbo().getRoomUnit()).compose());
return true;
}

View File

@ -2,7 +2,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetManager;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
@ -28,10 +28,10 @@ public class PetInfoCommand extends Command
String name = params[1];
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry(new TIntObjectProcedure<AbstractPet>()
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry(new TIntObjectProcedure<Pet>()
{
@Override
public boolean execute(int a, AbstractPet pet)
public boolean execute(int a, Pet pet)
{
if(pet.getName().equalsIgnoreCase(name))
{

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
@ -33,7 +34,7 @@ public class RoomKickCommand extends Command
for (Habbo habbo : room.getHabbos())
{
if (!(habbo.hasPermission("acc_unkickable") || habbo.hasPermission("acc_supporttool") || room.isOwner(habbo)))
if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo)))
{
room.kickHabbo(habbo, true);
}

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.iterator.TIntObjectIterator;
import gnu.trove.map.TIntObjectMap;
@ -23,7 +24,7 @@ public class SitDownCommand extends Command
{
habbo.getRoomUnit().stopWalking();
}
else if(habbo.getRoomUnit().getStatus().containsKey("sit"))
else if(habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT))
{
continue;
}

View File

@ -4,14 +4,11 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.bots.Bot;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetManager;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
@ -61,8 +58,6 @@ public class TestCommand extends Command
@Override
public boolean handle(GameClient gameClient, String[] params) throws Exception
{
// if (true)
// return false;
if (params[1].equals("ach"))
{
@ -107,7 +102,7 @@ public class TestCommand extends Command
s += "Habbo ID: " + habbo.getHabboInfo().getId() + ", RoomUnit ID: " + habbo.getRoomUnit().getId() + "\r";
}
for (AbstractPet pet : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().valueCollection())
for (Pet pet : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().valueCollection())
{
s += "Pet ID: " + pet.getId() + ", RoomUnit ID: " + pet.getRoomUnit().getId() + ", Name: " + pet.getName();
@ -127,7 +122,7 @@ public class TestCommand extends Command
if (params[1].equalsIgnoreCase("rebr"))
{
for (AbstractPet pet : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().valueCollection())
for (Pet pet : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().valueCollection())
{
if (pet instanceof MonsterplantPet)
{
@ -193,7 +188,7 @@ public class TestCommand extends Command
}
else if(params[1].equalsIgnoreCase("pet"))
{
AbstractPet pet = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getPet(Integer.valueOf(params[2]));
Pet pet = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getPet(Integer.valueOf(params[2]));
if(pet instanceof Pet)
{
@ -211,18 +206,18 @@ public class TestCommand extends Command
{
c = params[5];
}
pet.getRoomUnit().getStatus().put(a, b + " " + c);
pet.getRoomUnit().setStatus(RoomUnitStatus.fromString(a), b + " " + c);
gameClient.sendResponse(new RoomUserStatusComposer(pet.getRoomUnit()));
}
}
}
else if (params[1].equalsIgnoreCase("petc"))
{
AbstractPet pet = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getPet(Integer.valueOf(params[2]));
Pet pet = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getPet(Integer.valueOf(params[2]));
if (pet != null)
{
pet.getRoomUnit().getStatus().clear();
pet.getRoomUnit().clearStatus();
gameClient.sendResponse(new RoomUserStatusComposer(pet.getRoomUnit()));
}
}
@ -291,10 +286,10 @@ public class TestCommand extends Command
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
List<RoomTile> tiles = room.getLayout().getTilesAround(gameClient.getHabbo().getRoomUnit().getCurrentLocation());
room.getCurrentPets().forEachValue(new TObjectProcedure<AbstractPet>()
room.getCurrentPets().forEachValue(new TObjectProcedure<Pet>()
{
@Override
public boolean execute(AbstractPet object)
public boolean execute(Pet object)
{
Emulator.getThreading().run(new Runnable()
{
@ -310,7 +305,7 @@ public class TestCommand extends Command
}
else if(params[1].equalsIgnoreCase("st"))
{
gameClient.getHabbo().getRoomUnit().getStatus().put(params[2], params[3]);
gameClient.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.fromString(params[2]), params[3]);
gameClient.sendResponse(new RoomUserStatusComposer(gameClient.getHabbo().getRoomUnit()));
}
else if (params[1].equalsIgnoreCase("filt"))

View File

@ -12,6 +12,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.Interaction
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates.InteractionBattleBanzaiGate;
import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.scoreboards.InteractionBattleBanzaiScoreboard;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUserAction;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -323,7 +324,7 @@ public class BattleBanzaiGame extends Game
{
event.setCancelled(true);
event.habbo.getRoomUnit().setGoalLocation(event.habbo.getRoomUnit().getCurrentLocation());
event.habbo.getRoomUnit().getStatus().remove("mv");
event.habbo.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
game.room.sendComposer(new RoomUserStatusComposer(event.habbo.getRoomUnit()).compose());
}
}

View File

@ -12,10 +12,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreeze
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.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.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
@ -433,7 +430,7 @@ public class FreezeGame extends Game
{
event.setCancelled(true);
event.habbo.getRoomUnit().setGoalLocation(event.habbo.getRoomUnit().getCurrentLocation());
event.habbo.getRoomUnit().getStatus().remove("mv");
event.habbo.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
game.room.sendComposer(new RoomUserStatusComposer(event.habbo.getRoomUnit()).compose());
}
}

View File

@ -70,8 +70,9 @@ public class WiredGame extends Game
}
@Override
public synchronized void removeHabbo(Habbo habbo)
public void removeHabbo(Habbo habbo)
{
super.removeHabbo(habbo);
this.room.giveEffect(habbo, 0);
}
}

View File

@ -202,6 +202,7 @@ public class ItemManager
this.interactionsList.add(new ItemInteraction("wf_act_lower_furni", WiredEffectLowerFurni.class));
this.interactionsList.add(new ItemInteraction("wf_act_give_respect", WiredEffectGiveRespect.class));
this.interactionsList.add(new ItemInteraction("wf_act_alert", WiredEffectAlert.class));
this.interactionsList.add(new ItemInteraction("wf_act_give_handitem", WiredEffectGiveHandItem.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_has_furni_on", WiredConditionFurniHaveFurni.class));
@ -233,6 +234,14 @@ public class ItemManager
this.interactionsList.add(new ItemInteraction("wf_cnd_not_battlebanzai", WiredConditionNotBattleBanzaiGameActive.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_freeze", WiredConditionFreezeGameActive.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_not_freeze", WiredConditionNotFreezeGameActive.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_rank", WiredConditionHabboHasRank.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_not_rank", WiredConditionHabboNotRank.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_diamonds", WiredConditionHabboHasDiamonds.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_credits", WiredConditionHabboHasCredits.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_habbo_has_duckets", WiredConditionHabboHasDuckets.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_has_diamonds", WiredConditionNotHabboHasDiamonds.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_has_credits", WiredConditionNotHabboHasCredits.class));
this.interactionsList.add(new ItemInteraction("wf_cnd_not_habbo_has_duckets", WiredConditionNotHabboHasDuckets.class));
this.interactionsList.add(new ItemInteraction("wf_xtra_random", WiredExtraRandom.class));

View File

@ -94,7 +94,7 @@ public class InteractionCrackable extends HabboItem
this.setExtradata(Integer.valueOf(this.getExtradata()) + 1 + "");
this.needsUpdate(true);
room.updateItemState(this);
room.updateItem(this);
CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId());

View File

@ -4,6 +4,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUnitType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
@ -87,14 +88,14 @@ public class InteractionMultiHeight extends HabboItem
if(habbo.getRoomUnit() == null)
continue;
if(habbo.getRoomUnit().getStatus().containsKey("mv"))
if(habbo.getRoomUnit().hasStatus(RoomUnitStatus.MOVE))
continue;
if (this.getBaseItem().getMultiHeights().length >= 0)
{
if (this.getBaseItem().allowSit())
{
habbo.getRoomUnit().getStatus().put("sit", this.getBaseItem().getMultiHeights()[(this.getExtradata().isEmpty() ? 0 : Integer.valueOf(this.getExtradata()) % (this.getBaseItem().getMultiHeights().length))] * 1.0D + "");
habbo.getRoomUnit().setStatus(RoomUnitStatus.SIT, this.getBaseItem().getMultiHeights()[(this.getExtradata().isEmpty() ? 0 : Integer.valueOf(this.getExtradata()) % (this.getBaseItem().getMultiHeights().length))] * 1.0D + "");
}
else
{

View File

@ -2,12 +2,12 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.HorsePet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
@ -65,7 +65,7 @@ public class InteractionNest extends HabboItem
{
super.onWalkOn(roomUnit, room, objects);
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if(pet != null && pet instanceof Pet)
{
@ -81,9 +81,9 @@ public class InteractionNest extends HabboItem
{
((Pet) pet).setTask(PetTasks.NEST);
pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY()));
pet.getRoomUnit().getStatus().clear();
pet.getRoomUnit().getStatus().remove("mv");
pet.getRoomUnit().getStatus().put("lay", room.getStackHeight(this.getX(), this.getY(), false) + "");
pet.getRoomUnit().clearStatus();
pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, room.getStackHeight(this.getX(), this.getY(), false) + "");
room.sendComposer(new RoomUserStatusComposer(roomUnit).compose());
}
}

View File

@ -4,11 +4,12 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.HorsePet;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
@ -42,7 +43,7 @@ public class InteractionObstacle extends HabboItem
@Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects)
{
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if (pet != null && pet instanceof HorsePet)
{
@ -85,15 +86,15 @@ public class InteractionObstacle extends HabboItem
if(habbo == null)
{
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if(pet != null && pet instanceof HorsePet && ((HorsePet) pet).getRider() != null)
{
if (((HorsePet) pet).getTask() != null && ((HorsePet) pet).getTask().equals(PetTasks.RIDE))
{
if (pet.getRoomUnit().getStatus().containsKey("jmp"))
if (pet.getRoomUnit().hasStatus(RoomUnitStatus.JUMP))
{
pet.getRoomUnit().getStatus().remove("jmp");
pet.getRoomUnit().removeStatus(RoomUnitStatus.JUMP);
Emulator.getThreading().run(new HabboItemNewState(this, room, "0"), 2000);
} else
{
@ -107,7 +108,7 @@ public class InteractionObstacle extends HabboItem
}
this.setExtradata(state + "");
pet.getRoomUnit().getStatus().put("jmp", "0");
pet.getRoomUnit().setStatus(RoomUnitStatus.JUMP, "0");
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseConsecutiveJumpsCount"));
AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HorseJumping"));
@ -128,7 +129,7 @@ public class InteractionObstacle extends HabboItem
if(habbo == null)
{
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if(pet != null && pet instanceof HorsePet && ((HorsePet) pet).getRider() != null)
{
@ -170,11 +171,11 @@ public class InteractionObstacle extends HabboItem
if(habbo == null)
{
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if(pet != null && pet instanceof HorsePet && ((HorsePet) pet).getRider() != null)
{
pet.getRoomUnit().getStatus().remove("jmp");
pet.getRoomUnit().removeStatus(RoomUnitStatus.JUMP);
}
}
}

View File

@ -79,7 +79,6 @@ public class InteractionOneWayGate extends HabboItem
{
HabboItem item = this;
room.sendComposer(new ItemStateComposer2(getId(), 1).compose());
room.scheduledTasks.add(new Runnable()
{
@Override
@ -87,7 +86,17 @@ public class InteractionOneWayGate extends HabboItem
{
roomUnitID = client.getHabbo().getRoomUnit().getId();
room.updateTile(gatePosition);
room.sendComposer(new ItemStateComposer2(getId(), 1).compose());
client.getHabbo().getRoomUnit().setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(getX(), getY()), getRotation() + 4));
room.scheduledTasks.add(new Runnable()
{
@Override
public void run()
{
refresh(room);
}
});
}
});
}

View File

@ -1,7 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
@ -14,8 +14,8 @@ import java.sql.SQLException;
public class InteractionPetBreedingNest extends HabboItem
{
public AbstractPet petOne = null;
public AbstractPet petTwo = null;
public Pet petOne = null;
public Pet petTwo = null;
public InteractionPetBreedingNest(ResultSet set, Item baseItem) throws SQLException
{
@ -58,7 +58,7 @@ public class InteractionPetBreedingNest extends HabboItem
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if (pet != null)
{
@ -80,7 +80,7 @@ public class InteractionPetBreedingNest extends HabboItem
}
}
public boolean addPet(AbstractPet pet)
public boolean addPet(Pet pet)
{
if (this.petOne == null)
{

View File

@ -4,11 +4,12 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
@ -68,7 +69,7 @@ public class InteractionPetDrink extends HabboItem
{
super.onWalkOn(client, room, objects);
AbstractPet pet = room.getPet(client);
Pet pet = room.getPet(client);
if(pet != null && pet instanceof Pet)
{
@ -79,12 +80,12 @@ public class InteractionPetDrink extends HabboItem
((Pet) pet).setTask(PetTasks.EAT);
pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY()));
pet.getRoomUnit().setRotation(RoomUserRotation.values()[this.getRotation()]);
pet.getRoomUnit().getStatus().clear();
pet.getRoomUnit().getStatus().remove("mv");
pet.getRoomUnit().getStatus().put("eat", "0");
pet.getRoomUnit().clearStatus();
pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
pet.getRoomUnit().setStatus(RoomUnitStatus.EAT, "0");
((Pet) pet).addThirst(-75);
room.sendComposer(new RoomUserStatusComposer(client).compose());
Emulator.getThreading().run(new PetClearPosture((Pet)pet, "eat", null, true), 500);
Emulator.getThreading().run(new PetClearPosture((Pet)pet, RoomUnitStatus.EAT, null, true), 500);
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId()), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetFeeding"), 75);
}

View File

@ -3,11 +3,12 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
@ -70,7 +71,7 @@ public class InteractionPetFood extends HabboItem
if(this.getExtradata().length() == 0)
this.setExtradata("0");
AbstractPet pet = room.getPet(client);
Pet pet = room.getPet(client);
if(pet != null && pet instanceof Pet)
{
@ -81,9 +82,9 @@ public class InteractionPetFood extends HabboItem
((Pet) pet).setTask(PetTasks.EAT);
pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY()));
pet.getRoomUnit().setRotation(RoomUserRotation.values()[this.getRotation()]);
pet.getRoomUnit().getStatus().clear();
pet.getRoomUnit().getStatus().remove("mv");
pet.getRoomUnit().getStatus().put("eat", "0");
pet.getRoomUnit().clearStatus();
pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
pet.getRoomUnit().setStatus(RoomUnitStatus.EAT, "0");
room.sendComposer(new RoomUserStatusComposer(client).compose());
Emulator.getThreading().run(new PetEatAction((Pet) pet, this));
}

View File

@ -2,11 +2,12 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
@ -59,7 +60,7 @@ public class InteractionPetToy extends HabboItem
{
super.onWalkOn(client, room, objects);
AbstractPet pet = room.getPet(client);
Pet pet = room.getPet(client);
if(pet != null && pet instanceof Pet)
{
@ -71,9 +72,9 @@ public class InteractionPetToy extends HabboItem
((Pet) pet).setTask(PetTasks.PLAY);
pet.getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY()));
pet.getRoomUnit().setRotation(RoomUserRotation.values()[this.getRotation()]);
pet.getRoomUnit().getStatus().clear();
pet.getRoomUnit().getStatus().remove("mv");
pet.getRoomUnit().getStatus().put("pla", "0");
pet.getRoomUnit().clearStatus();
pet.getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
pet.getRoomUnit().setStatus(RoomUnitStatus.PLAY, "0");
((Pet) pet).packetUpdate = true;
HabboItem item = this;
Emulator.getThreading().run(new Runnable()
@ -84,7 +85,7 @@ public class InteractionPetToy extends HabboItem
pet.addHappyness(25);
item.setExtradata("0");
room.updateItem(item);
new PetClearPosture((Pet)pet, "pla", null, true).run();;
new PetClearPosture((Pet)pet, RoomUnitStatus.PLAY, null, true).run();;
}
}, 2500 + (Emulator.getRandom().nextInt(20) * 500));
this.setExtradata("1");
@ -97,7 +98,7 @@ public class InteractionPetToy extends HabboItem
{
super.onWalkOff(roomUnit, room, objects);
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if (pet != null && pet instanceof Pet)
{

View File

@ -2,10 +2,7 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
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.RoomUnit;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
@ -29,7 +26,7 @@ public class InteractionPuzzleBox extends HabboItem
@Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception
{
if(client.getHabbo().getRoomUnit().getStatus().containsKey("mv"))
if(client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.MOVE))
return;
if(!RoomLayout.tilesAdjecent(room.getLayout().getTile(super.getX(), super.getY()), client.getHabbo().getRoomUnit().getCurrentLocation()))

View File

@ -12,7 +12,7 @@ public class InteractionRoomAds extends InteractionCustomValues
{
public final static THashMap<String, String> defaultValues = new THashMap<String, String>()
{
{put("imageUrl", "http://arcturus.wf");}
{put("imageUrl", "http://arcturus.wf/ads_background.png");}
{put("clickUrl", "http://arcturus.wf");}
{put("offsetX", "0");}
{put("offsetY", "0");}

View File

@ -63,8 +63,6 @@ public class InteractionTeleport extends HabboItem
{
super.onClick(client, room, objects);
RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation());
RoomTile teleportPosition = room.getLayout().getTile(getX(), getY());
@ -143,7 +141,7 @@ public class InteractionTeleport extends HabboItem
this.setExtradata("0");
}
private boolean canUseTeleport(GameClient client, Room room)
protected boolean canUseTeleport(GameClient client, Room room)
{
if(!this.getExtradata().equals("0"))
return false;

View File

@ -1,15 +1,10 @@
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.threading.runnables.teleport.TeleportActionOne;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -31,4 +26,36 @@ public class InteractionTeleportTile extends InteractionTeleport
{
return true;
}
@Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{
if (roomUnit != null)
{
if (roomUnit.getGoal().is(this.getX(), this.getY()) && canWalkOn(roomUnit, room, objects))
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
if (!habbo.getRoomUnit().isTeleporting)
{
this.startTeleport(room, habbo);
}
}
}
}
}
@Override
protected boolean canUseTeleport(GameClient client, Room room)
{
if(client.getHabbo().getRoomUnit().isTeleporting)
return false;
if (client.getHabbo().getRoomUnit().getCurrentLocation().is(this.getX(), this.getY()))
return true;
return true;
}
}

View File

@ -1,16 +1,13 @@
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer;
import com.eu.habbo.threading.runnables.RoomUnitGiveHanditem;
import com.eu.habbo.threading.runnables.RoomUnitVendingMachineAction;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
import com.eu.habbo.util.pathfinding.Rotation;
@ -58,10 +55,10 @@ public class InteractionVendingMachine extends HabboItem
if (this.getExtradata().equals("0") || this.getExtradata().length() == 0)
{
room.updateHabbo(client.getHabbo());
if (!client.getHabbo().getRoomUnit().getStatus().containsKey("sit"))
if (!client.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT))
{
client.getHabbo().getRoomUnit().setRotation(RoomUserRotation.values()[Rotation.Calculate(client.getHabbo().getRoomUnit().getX(), client.getHabbo().getRoomUnit().getY(), this.getX(), this.getY())]);
client.getHabbo().getRoomUnit().getStatus().remove("mv");
client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
room.scheduledComposers.add(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose());
}
this.setExtradata("1");

View File

@ -2,11 +2,12 @@ package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.pets.AbstractPet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.HabboItem;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.hash.THashMap;
@ -113,13 +114,13 @@ public class InteractionWater extends InteractionDefault
@Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{
AbstractPet pet = room.getPet(roomUnit);
Pet pet = room.getPet(roomUnit);
if (pet != null)
{
if(pet instanceof Pet)
{
pet.getRoomUnit().getStatus().put("dip", "0");
pet.getRoomUnit().setStatus(RoomUnitStatus.DIP, "0");
}
}
}

View File

@ -107,7 +107,7 @@ public abstract class InteractionWired extends HabboItem
protected long requiredCooldown()
{
return 500;
return 100;
}
@ -116,7 +116,6 @@ public abstract class InteractionWired extends HabboItem
{
if (newMillis - this.cooldown < this.requiredCooldown())
{
this.cooldown = newMillis;
return false;
}

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.wired.WiredGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
@ -67,7 +68,7 @@ public abstract class InteractionGameTimer extends HabboItem
{
if (client != null)
{
if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasPermission("acc_anyroomowner")))
if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)))
return;
}

View File

@ -0,0 +1,42 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionHabboHasCredits extends WiredConditionHabboWearsBadge
{
public WiredConditionHabboHasCredits(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionHabboHasCredits(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
try
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
return habbo.getHabboInfo().getCredits() >= Integer.valueOf(this.badge);
}
} catch (Exception e)
{
} finally
{
return false;
}
}
}

View File

@ -0,0 +1,43 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionHabboHasDiamonds extends WiredConditionHabboWearsBadge
{
public WiredConditionHabboHasDiamonds(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionHabboHasDiamonds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
try
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
return habbo.getHabboInfo().getCurrencyAmount(5) >= Integer.valueOf(this.badge);
}
} catch (Exception e)
{
} finally
{
return false;
}
}
}

View File

@ -0,0 +1,42 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionHabboHasDuckets extends WiredConditionHabboWearsBadge
{
public WiredConditionHabboHasDuckets(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionHabboHasDuckets(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
try
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
return habbo.getHabboInfo().getPixels() >= Integer.valueOf(this.badge);
}
} catch (Exception e)
{
} finally
{
return false;
}
}
}

View File

@ -15,7 +15,7 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition
{
public static final WiredConditionType type = WiredConditionType.ACTOR_WEARS_EFFECT;
private int effectId = 0;
protected int effectId = 0;
public WiredConditionHabboHasEffect(ResultSet set, Item baseItem) throws SQLException
{
@ -60,7 +60,7 @@ public class WiredConditionHabboHasEffect extends InteractionWiredCondition
@Override
public void serializeWiredData(ServerMessage message, Room room)
{
message.appendBoolean(false);
message.appendBoolean(true);
message.appendInt(5);
message.appendInt(0);
message.appendInt(this.getBaseItem().getSpriteId());

View File

@ -0,0 +1,42 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionHabboHasRank extends WiredConditionHabboWearsBadge
{
public WiredConditionHabboHasRank(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionHabboHasRank(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
try
{
return habbo.getHabboInfo().getRank().getId() >= Integer.valueOf(this.badge);
}
catch (Exception e)
{
return false;
}
}
return false;
}
}

View File

@ -0,0 +1,42 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionHabboNotRank extends WiredConditionHabboWearsBadge
{
public WiredConditionHabboNotRank(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionHabboNotRank(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
try
{
return habbo.getHabboInfo().getRank().getId() < Integer.valueOf(this.badge);
}
catch (Exception e)
{
return false;
}
}
return false;
}
}

View File

@ -17,7 +17,7 @@ public class WiredConditionHabboWearsBadge extends InteractionWiredCondition
{
public static final WiredConditionType type = WiredConditionType.ACTOR_WEARS_BADGE;
private String badge = "";
protected String badge = "";
public WiredConditionHabboWearsBadge(ResultSet set, Item baseItem) throws SQLException
{

View File

@ -0,0 +1,44 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionNotHabboHasCredits extends WiredConditionNotHabboWearsBadge
{
public WiredConditionNotHabboHasCredits(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionNotHabboHasCredits(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
try
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
return habbo.getHabboInfo().getCredits() < Integer.valueOf(this.badge);
}
}
catch (Exception e)
{
}
finally
{
return false;
}
}
}

View File

@ -0,0 +1,44 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionNotHabboHasDiamonds extends WiredConditionNotHabboWearsBadge
{
public WiredConditionNotHabboHasDiamonds(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionNotHabboHasDiamonds(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
try
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
return habbo.getHabboInfo().getCurrencyAmount(5) < Integer.valueOf(this.badge);
}
}
catch (Exception e)
{
}
finally
{
return false;
}
}
}

View File

@ -0,0 +1,44 @@
package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredConditionNotHabboHasDuckets extends WiredConditionNotHabboWearsBadge
{
public WiredConditionNotHabboHasDuckets(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredConditionNotHabboHasDuckets(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
try
{
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
return habbo.getHabboInfo().getPixels() < Integer.valueOf(this.badge);
}
}
catch (Exception e)
{
}
finally
{
return false;
}
}
}

View File

@ -15,7 +15,7 @@ public class WiredConditionNotHabboHasEffect extends InteractionWiredCondition
{
private static final WiredConditionType type = WiredConditionType.NOT_ACTOR_WEARS_EFFECT;
private int effectId;
protected int effectId;
public WiredConditionNotHabboHasEffect(ResultSet set, Item baseItem) throws SQLException
{

View File

@ -17,7 +17,7 @@ public class WiredConditionNotHabboWearsBadge extends InteractionWiredCondition
{
public static final WiredConditionType type = WiredConditionType.NOT_ACTOR_WEARS_BADGE;
private String badge = "";
protected String badge = "";
public WiredConditionNotHabboWearsBadge(ResultSet set, Item baseItem) throws SQLException
{

View File

@ -38,12 +38,12 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition
{
if(habbo.getHabboInfo().getGamePlayer() != null)
{
if(habbo.getHabboInfo().getGamePlayer().getTeamColor().equals(this.teamColor))
return false;
if(!habbo.getHabboInfo().getGamePlayer().getTeamColor().equals(this.teamColor))
return true;
}
}
return true;
return false;
}
@Override
@ -90,7 +90,7 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition
message.appendInt(this.getId());
message.appendString("");
message.appendInt(1);
message.appendInt(this.teamColor.type);
message.appendInt(this.teamColor.type + 1);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@ -102,7 +102,7 @@ public class WiredConditionNotInTeam extends InteractionWiredCondition
{
packet.readInt();
this.teamColor = GameTeamColors.values()[packet.readInt()];
this.teamColor = GameTeamColors.values()[packet.readInt() - 1];
return true;
}

View File

@ -90,7 +90,7 @@ public class WiredConditionTeamMember extends InteractionWiredCondition
message.appendInt(this.getId());
message.appendString("");
message.appendInt(1);
message.appendInt(this.teamColor.type);
message.appendInt(this.teamColor.type + 1);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(0);
@ -102,7 +102,7 @@ public class WiredConditionTeamMember extends InteractionWiredCondition
{
packet.readInt();
this.teamColor = GameTeamColors.values()[packet.readInt()];
this.teamColor = GameTeamColors.values()[packet.readInt() - 1];
return true;
}

View File

@ -4,14 +4,18 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import com.eu.habbo.util.pathfinding.Rotation;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -19,10 +23,19 @@ import java.util.Map;
public class WiredEffectChangeFurniDirection extends InteractionWiredEffect
{
public static final int ACTION_WAIT = 0;
public static final int ACTION_TURN_RIGHT_45 = 1;
public static final int ACTION_TURN_RIGHT_90 = 2;
public static final int ACTION_TURN_LEFT_45 = 3;
public static final int ACTION_TURN_LEFT_90 = 4;
public static final int ACTION_TURN_BACK = 5;
public static final int ACTION_TURN_RANDOM = 6;
public static final WiredEffectType type = WiredEffectType.MOVE_DIRECTION;
private final THashMap<HabboItem, Integer> items = new THashMap<HabboItem, Integer>();
private final THashMap<HabboItem, RoomUserRotation> items = new THashMap<HabboItem, RoomUserRotation>(0);
private RoomUserRotation startRotation = RoomUserRotation.NORTH;
private int rotateAction = 0;
public WiredEffectChangeFurniDirection(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
@ -36,19 +49,104 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
THashSet<HabboItem> items = new THashSet<HabboItem>();
for (HabboItem item : this.items.keySet())
{
if (Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null)
items.add(item);
}
for (HabboItem item : items)
{
this.items.remove(item);
}
for (Map.Entry<HabboItem, RoomUserRotation> entry : this.items.entrySet())
{
RoomUserRotation currentRotation = entry.getValue();
RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
int count = 1;
while ((targetTile == null || !targetTile.allowStack() || targetTile.state == RoomTileState.BLOCKED) && count < 8)
{
entry.setValue(nextRotation(entry.getValue()));
targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
count++;
}
if (targetTile != null && targetTile.state == RoomTileState.OPEN)
{
boolean hasHabbos = false;
for (Habbo habbo : room.getHabbosAt(targetTile))
{
hasHabbos = true;
Emulator.getThreading().run(new Runnable()
{
@Override
public void run()
{
WiredHandler.handle(WiredTriggerType.COLLISION, habbo.getRoomUnit(), room, new Object[]{entry.getKey()});
}
});
}
if (!hasHabbos)
{
THashSet<RoomTile> refreshTiles = room.getLayout().getTilesAt(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getKey().getBaseItem().getWidth(), entry.getKey().getBaseItem().getLength(), entry.getKey().getRotation());
room.sendComposer(new FloorItemOnRollerComposer(entry.getKey(), null, targetTile, targetTile.getStackHeight() - entry.getKey().getZ(), room).compose());
room.getLayout().getTilesAt(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getKey().getBaseItem().getWidth(), entry.getKey().getBaseItem().getLength(), entry.getKey().getRotation());
room.updateTiles(refreshTiles);
}
}
}
return false;
}
@Override
public String getWiredData()
{
return "";
String data = this.startRotation.getValue() + "\t" + this.rotateAction + "\t" + this.items.size();
for (Map.Entry<HabboItem, RoomUserRotation> entry : this.items.entrySet())
{
data += "\t" + entry.getKey().getId() + ":" + entry.getValue().getValue();
}
return data;
}
@Override
public void loadWiredData(ResultSet set, Room room) throws SQLException
{
String[] data = set.getString("wired_data").split("\t");
if (data.length >= 3)
{
this.startRotation = RoomUserRotation.fromValue(Integer.valueOf(data[0]));
this.rotateAction = Integer.valueOf(data[1]);
int itemCount = Integer.valueOf(data[2]);
if (itemCount > 0)
{
for (int i = 3; i < data.length; i++)
{
String[] subData = data[i].split(":");
if (subData.length == 2)
{
HabboItem item = room.getHabboItem(Integer.valueOf(subData[0]));
if (item != null)
{
this.items.put(item, RoomUserRotation.fromValue(Integer.valueOf(subData[1])));
}
}
}
}
}
}
@Override
@ -56,12 +154,14 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect
{
this.setDelay(0);
this.items.clear();
this.rotateAction = 0;
this.startRotation = RoomUserRotation.NORTH;
}
@Override
public WiredEffectType getType()
{
return type;
return this.type;
}
@Override
@ -70,14 +170,16 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect
message.appendBoolean(false);
message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION);
message.appendInt(this.items.size());
for (Map.Entry<HabboItem, Integer> item : this.items.entrySet())
for (Map.Entry<HabboItem, RoomUserRotation> item : this.items.entrySet())
{
message.appendInt(item.getKey().getId());
}
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString("");
message.appendInt(0);
message.appendInt(2);
message.appendInt(this.startRotation.getValue());
message.appendInt(this.rotateAction);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(this.getDelay());
@ -87,6 +189,52 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect
@Override
public boolean saveData(ClientMessage packet, GameClient gameClient)
{
return false;
packet.readInt();
this.startRotation = RoomUserRotation.fromValue(packet.readInt());
this.rotateAction = packet.readInt();
packet.readString();
int furniCount = packet.readInt();
for (int i = 0; i < furniCount; i++)
{
HabboItem item = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabboItem(packet.readInt());
if (item != null)
{
this.items.put(item, this.startRotation);
}
}
return true;
}
private RoomUserRotation nextRotation(RoomUserRotation currentRotation)
{
switch (this.rotateAction)
{
case ACTION_TURN_BACK:
return RoomUserRotation.fromValue(currentRotation.getValue() + 4);
case ACTION_TURN_LEFT_45:
return RoomUserRotation.counterClockwise(currentRotation);
case ACTION_TURN_LEFT_90:
return RoomUserRotation.counterClockwise(RoomUserRotation.counterClockwise(currentRotation));
case ACTION_TURN_RIGHT_45:
return RoomUserRotation.clockwise(currentRotation);
case ACTION_TURN_RIGHT_90:
return RoomUserRotation.clockwise(RoomUserRotation.clockwise(currentRotation));
case ACTION_TURN_RANDOM:
return RoomUserRotation.fromValue(Emulator.getRandom().nextInt(8));
case ACTION_WAIT:
default:
return currentRotation;
}
}
@Override
protected long requiredCooldown()
{
return 495;
}
}

View File

@ -18,11 +18,8 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class WiredEffectForwardToRoom extends InteractionWiredEffect
public class WiredEffectForwardToRoom extends WiredEffectWhisper
{
public static final WiredEffectType type = WiredEffectType.SHOW_MESSAGE;
private int roomId = 0;
public WiredEffectForwardToRoom(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
@ -34,121 +31,27 @@ public class WiredEffectForwardToRoom extends InteractionWiredEffect
}
@Override
public void serializeWiredData(ServerMessage message, Room room)
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
message.appendBoolean(false);
message.appendInt(0);
message.appendInt(0);
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString(this.roomId + "");
message.appendInt(0);
message.appendInt(0);
message.appendInt(type.code);
message.appendInt(this.getDelay());
Habbo habbo = room.getHabbo(roomUnit);
if (this.requiresTriggeringUser())
{
List<Integer> invalidTriggers = new ArrayList<>();
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredTrigger>()
{
@Override
public boolean execute(InteractionWiredTrigger object)
{
if (!object.isTriggeredByRoomUnit())
{
invalidTriggers.add(object.getBaseItem().getSpriteId());
}
return true;
}
});
message.appendInt(invalidTriggers.size());
for (Integer i : invalidTriggers)
{
message.appendInt(i);
}
}
else
{
message.appendInt(0);
}
}
if (habbo == null)
return false;
@Override
public boolean saveData(ClientMessage packet, GameClient gameClient)
{
packet.readInt();
int roomId = 0;
try
{
this.roomId = Integer.valueOf(packet.readString());
roomId = Integer.valueOf(this.message);
}
catch (Exception e)
{
return false;
}
packet.readInt();
this.setDelay(packet.readInt());
if(roomId > 0)
habbo.getClient().sendResponse(new ForwardToRoomComposer(roomId));
return true;
}
@Override
public WiredEffectType getType()
{
return type;
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
Habbo habbo = room.getHabbo(roomUnit);
if(habbo == null)
return false;
if(this.roomId > 0)
habbo.getClient().sendResponse(new ForwardToRoomComposer(this.roomId));
return true;
}
@Override
protected String getWiredData()
{
return this.getDelay() + "\t" + this.roomId;
}
@Override
public void loadWiredData(ResultSet set, Room room) throws SQLException
{
String wireData = set.getString("wired_data");
this.roomId = 0;
if(wireData.split("\t").length >= 2)
{
super.setDelay(Integer.valueOf(wireData.split("\t")[0]));
try
{
this.roomId = Integer.valueOf(getWiredData().split("\t")[1]);
}
catch (Exception e)
{}
}
}
@Override
public void onPickUp()
{
this.roomId = 0;
this.setDelay(0);
}
@Override
public boolean requiresTriggeringUser()
{
return true;
}
}

View File

@ -0,0 +1,42 @@
package com.eu.habbo.habbohotel.items.interactions.wired.effects;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredEffectGiveHandItem extends WiredEffectWhisper
{
public WiredEffectGiveHandItem(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
public WiredEffectGiveHandItem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
try
{
int itemId = Integer.valueOf(this.message);
Habbo habbo = room.getHabbo(roomUnit);
if (habbo != null)
{
room.giveHandItem(habbo, itemId);
}
}
catch (Exception e)
{
}
return false;
}
}

View File

@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
@ -133,6 +134,17 @@ public class WiredEffectGiveReward extends InteractionWiredEffect
return type;
}
@Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception
{
super.onClick(client, room, objects);
if (client.getHabbo().hasPermission("acc_superwired"))
{
client.getHabbo().whisper(Emulator.getTexts().getValue("hotel.wired.superwired.info"), RoomChatMessageBubbles.ALERT);
}
}
@Override
public void serializeWiredData(ServerMessage message, Room room)
{
@ -187,44 +199,50 @@ public class WiredEffectGiveReward extends InteractionWiredEffect
@Override
public boolean saveData(ClientMessage packet, GameClient gameClient)
{
packet.readInt();
this.rewardTime = packet.readInt();
this.uniqueRewards = packet.readInt() == 1;
this.limit = packet.readInt();
this.limitationInterval = packet.readInt();
this.given = 0;
String data = packet.readString();
String[] items = data.split(";");
this.rewardItems.clear();
int i = 1;
for(String s : items)
if (gameClient.getHabbo().hasPermission("acc_superwired"))
{
String[] d = s.split(",");
packet.readInt();
if(d.length == 3)
this.rewardTime = packet.readInt();
this.uniqueRewards = packet.readInt() == 1;
this.limit = packet.readInt();
this.limitationInterval = packet.readInt();
this.given = 0;
String data = packet.readString();
String[] items = data.split(";");
this.rewardItems.clear();
int i = 1;
for (String s : items)
{
if (!(d[1].contains(":") || d[1].contains(";")))
String[] d = s.split(",");
if (d.length == 3)
{
this.rewardItems.add(new WiredGiveRewardItem(i, d[0].equalsIgnoreCase("0"), d[1], Integer.valueOf(d[2])));
continue;
if (!(d[1].contains(":") || d[1].contains(";")))
{
this.rewardItems.add(new WiredGiveRewardItem(i, d[0].equalsIgnoreCase("0"), d[1], Integer.valueOf(d[2])));
continue;
}
}
gameClient.sendResponse(new UpdateFailedComposer(Emulator.getTexts().getValue("alert.superwired.invalid")));
return false;
}
gameClient.sendResponse(new UpdateFailedComposer(Emulator.getTexts().getValue("alert.superwired.invalid")));
return false;
WiredHandler.dropRewards(this.getId());
packet.readString();
packet.readInt();
this.setDelay(packet.readInt());
return true;
}
WiredHandler.dropRewards(this.getId());
packet.readString();
packet.readInt();
this.setDelay(packet.readInt());
return true;
gameClient.getHabbo().whisper("U cannot do this.", RoomChatMessageBubbles.ALERT);
return false;
}
@Override

View File

@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
@ -48,17 +49,26 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect
if(habbo != null)
{
if(!habbo.hasPermission("acc_unkickable") && habbo.getHabboInfo().getId() != room.getOwnerId())
if (habbo.hasPermission(Permission.ACC_UNKICKABLE))
{
room.giveEffect(habbo, 4);
if(!this.message.isEmpty())
habbo.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(this.message, habbo, habbo, RoomChatMessageBubbles.ALERT)));
Emulator.getThreading().run(new RoomUnitKick(habbo, room, true), 2000);
habbo.whisper(Emulator.getTexts().getValue("hotel.wired.kickexception.unkickable"));
return true;
}
if (habbo.getHabboInfo().getId() == room.getOwnerId())
{
habbo.whisper(Emulator.getTexts().getValue("hotel.wired.kickexception.owner"));
return true;
}
room.giveEffect(habbo, 4);
if(!this.message.isEmpty())
habbo.getClient().sendResponse(new RoomUserWhisperComposer(new RoomChatMessage(this.message, habbo, habbo, RoomChatMessageBubbles.ALERT)));
Emulator.getThreading().run(new RoomUnitKick(habbo, room, true), 2000);
return true;
}
return false;

View File

@ -109,7 +109,9 @@ public class WiredEffectLowerFurni extends InteractionWiredEffect
z = minZ;
}
room.sendComposer(new FloorItemOnRollerComposer(item, null, room.getLayout().getTile(item.getX(), item.getY()), z, room).compose());
room.sendComposer(new FloorItemOnRollerComposer(item, null, room.getLayout().getTile(item.getX(), item.getY()), -z, room).compose());
room.updateHabbosAt(item.getX(), item.getY());
}
}

View File

@ -75,14 +75,17 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect
if(this.position)
{
RoomTile t = room.getLayout().getTile((short)setting.x, (short)setting.y);
RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y);
tilesToUpdate.addAll(room.getLayout().getTilesAt(t, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation));
if (!room.hasHabbosAt(t.x, t.y))
{
tilesToUpdate.addAll(room.getLayout().getTilesAt(t, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation));
double offsetZ = setting.z - item.getZ();
double offsetZ = setting.z - item.getZ();
room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose());
tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile((short) item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation));
room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose());
tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile((short) item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation));
}
}
item.needsUpdate(true);

View File

@ -241,4 +241,10 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect
return true;
}
@Override
protected long requiredCooldown()
{
return 495;
}
}

View File

@ -245,4 +245,10 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect
this.spacing = 0;
this.indexOffset.clear();
}
@Override
protected long requiredCooldown()
{
return 495;
}
}

View File

@ -70,7 +70,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect
if(target != null)
{
if(RoomLayout.tilesAdjecent(target.getRoomUnit().getCurrentLocation(), room.getLayout().getTile(this.getX(), this.getY())) && (target.getRoomUnit().getX() == item.getX() || target.getRoomUnit().getY() == item.getY()))
if(room.getLayout().getTile(this.getX(), this.getY()).distance(target.getRoomUnit().getCurrentLocation()) == 1)
{
final Habbo finalTarget = target;
Emulator.getThreading().run(new Runnable()
@ -246,4 +246,10 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect
return true;
}
@Override
protected long requiredCooldown()
{
return 495;
}
}

View File

@ -8,9 +8,11 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
@ -142,23 +144,33 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect
(short) (item.getY() + ((moveDirection == RoomUserRotation.NORTH || moveDirection == RoomUserRotation.NORTH_EAST || moveDirection == RoomUserRotation.NORTH_WEST) ? 1 : ((moveDirection == RoomUserRotation.SOUTH || moveDirection == RoomUserRotation.SOUTH_EAST || moveDirection == RoomUserRotation.SOUTH_WEST) ? -1 : 0)))
);
if (newTile != null && room.tileWalkable(newTile))
if (newTile != null)
{
Rectangle rectangle = new Rectangle(newTile.x,
newTile.y,
item.getBaseItem().getWidth(),
item.getBaseItem().getLength());
for (int x = rectangle.x; x < rectangle.x + rectangle.getWidth(); x++)
boolean hasHabbos = false;
for (Habbo habbo : room.getHabbosAt(newTile))
{
for (int y = rectangle.y; y < rectangle.y + rectangle.getHeight(); y++)
{
HabboItem i = room.getTopItemAt(x, y, item);
hasHabbos = true;
WiredHandler.handle(WiredTriggerType.COLLISION, habbo.getRoomUnit(), room, new Object[]{item});
}
if (i == null || i == item || i.getBaseItem().allowStack())
if (!hasHabbos && room.tileWalkable(newTile))
{
Rectangle rectangle = new Rectangle(newTile.x,
newTile.y,
item.getBaseItem().getWidth(),
item.getBaseItem().getLength());
for (int x = rectangle.x; x < rectangle.x + rectangle.getWidth(); x++)
{
for (int y = rectangle.y; y < rectangle.y + rectangle.getHeight(); y++)
{
double offset = room.getStackHeight(newTile.x, newTile.y, false) - item.getZ();
room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose());
HabboItem i = room.getTopItemAt(x, y, item);
if (i == null || i == item || i.getBaseItem().allowStack())
{
double offset = room.getStackHeight(newTile.x, newTile.y, false) - item.getZ();
room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose());
}
}
}
}
@ -314,4 +326,10 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect
return true;
}
@Override
protected long requiredCooldown()
{
return 495;
}
}

View File

@ -100,8 +100,9 @@ public class WiredEffectRaiseFurni extends InteractionWiredEffect
if(item.getRoomId() == 0)
continue;
double offsetZ = (item.getZ() + ((0.1) * offset)) % 127;
double offsetZ = (((0.1) * offset)) % 127;
room.sendComposer(new FloorItemOnRollerComposer(item, null, room.getLayout().getTile(item.getX(), item.getY()), offsetZ, room).compose());
room.updateHabbosAt(item.getX(), item.getY());
}
return true;
@ -140,14 +141,17 @@ public class WiredEffectRaiseFurni extends InteractionWiredEffect
catch (Exception e)
{}
if (data[1].contains(";"))
if (data.length >= 2)
{
for (String s : data[1].split(";"))
if (data[1].contains(";"))
{
HabboItem item = room.getHabboItem(Integer.valueOf(s));
for (String s : data[1].split(";"))
{
HabboItem item = room.getHabboItem(Integer.valueOf(s));
if (item != null)
this.items.add(item);
if (item != null)
this.items.add(item);
}
}
}
}

View File

@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.modtool;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomState;
import com.eu.habbo.habbohotel.users.Habbo;
@ -469,7 +470,7 @@ public class ModToolManager
public void alert(Habbo moderator, Habbo target, String message)
{
if(moderator.hasPermission("acc_supporttool"))
if(moderator.hasPermission(Permission.ACC_SUPPORTTOOL))
{
SupportUserAlertedEvent alertedEvent = new SupportUserAlertedEvent(moderator, target, message);
if (Emulator.getPluginManager().fireEvent(alertedEvent).isCancelled())
@ -569,7 +570,7 @@ public class ModToolManager
{
for (Habbo habbo : room.getHabbos())
{
if (!(habbo.hasPermission("acc_unkickable") || habbo.hasPermission("acc_supporttool") || room.isOwner(habbo)))
if (!(habbo.hasPermission(Permission.ACC_UNKICKABLE) || habbo.hasPermission(Permission.ACC_SUPPORTTOOL) || room.isOwner(habbo)))
{
room.kickHabbo(habbo, false);
}
@ -692,7 +693,7 @@ public class ModToolManager
public void updateTicketToMods(ModToolIssue issue)
{
Emulator.getGameEnvironment().getHabboManager().sendPacketToHabbosWithPermission(new ModToolIssueInfoComposer(issue).compose(), "acc_supporttool");
Emulator.getGameEnvironment().getHabboManager().sendPacketToHabbosWithPermission(new ModToolIssueInfoComposer(issue).compose(), Permission.ACC_SUPPORTTOOL);
}
public void addTicket(ModToolIssue issue)

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.navigation;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomCategory;
import com.eu.habbo.habbohotel.users.Habbo;
@ -21,7 +22,7 @@ public class NavigatorHotelFilter extends NavigatorFilter
@Override
public List<SearchResultList> getResult(Habbo habbo)
{
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission("acc_anyroomowner");
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List<SearchResultList> resultLists = new ArrayList<SearchResultList>();
int i = 0;
resultLists.add(new SearchResultList(i, "popular", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("popular", ListMode.fromType(Emulator.getConfig().getInt("hotel.navigator.popular.listtype"))), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("popular"), Emulator.getGameEnvironment().getRoomManager().getPopularRooms(Emulator.getConfig().getInt("hotel.navigator.popular.amount")), false, showInvisible));
@ -43,7 +44,7 @@ public class NavigatorHotelFilter extends NavigatorFilter
@Override
public List<SearchResultList> getResult(Habbo habbo, NavigatorFilterField filterField, String value, int roomCategory)
{
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission("acc_anyroomowner");
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
if (!filterField.databaseQuery.isEmpty())
{
List<SearchResultList> resultLists = new ArrayList<SearchResultList>();

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.navigation;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.users.Habbo;
import java.util.ArrayList;
@ -18,7 +19,7 @@ public class NavigatorPublicFilter extends NavigatorFilter
@Override
public List<SearchResultList> getResult(Habbo habbo)
{
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission("acc_anyroomowner");
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List<SearchResultList> resultLists = new ArrayList<SearchResultList>();
int i = 0;
resultLists.add(new SearchResultList(i, "official-root", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("official-root", ListMode.THUMBNAILS), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root"), Emulator.getGameEnvironment().getRoomManager().getPublicRooms(), false, showInvisible));

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.navigation;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.permissions.Permission;
import com.eu.habbo.habbohotel.users.Habbo;
import java.util.ArrayList;
@ -18,7 +19,7 @@ public class NavigatorRoomAdsFilter extends NavigatorFilter
@Override
public List<SearchResultList> getResult(Habbo habbo)
{
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission("acc_anyroomowner");
boolean showInvisible = habbo.hasPermission("acc_enter_anyroom") || habbo.hasPermission(Permission.ACC_ANYROOMOWNER);
List<SearchResultList> resultList = new ArrayList<SearchResultList>();
resultList.add(new SearchResultList(0, "categories", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("categories", ListMode.LIST), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("official-root", DisplayMode.VISIBLE), Emulator.getGameEnvironment().getRoomManager().getRoomsPromoted(), false, showInvisible));
return resultList;

View File

@ -10,4 +10,50 @@ public class Permission
this.key = key;
this.setting = setting;
}
public static String ACC_ANYCHATCOLOR = "acc_anychatcolor";
public static String ACC_ANYROOMOWNER = "acc_anyroomowner";
public static String ACC_EMPTY_OTHERS = "acc_empty_others";
public static String ACC_ENABLE_OTHERS = "acc_enable_others";
public static String ACC_SEE_WHISPERS = "acc_see_whispers";
public static String ACC_SUPERWIRED = "acc_superwired";
public static String ACC_SUPPORTTOOL = "acc_supporttool";
public static String ACC_UNKICKABLE = "acc_unkickable";
public static String ACC_GUILDGATE = "acc_guildgate";
public static String ACC_MOVEROTATE = "acc_moverotate";
public static String ACC_PLACEFURNI = "acc_placefurni";
public static String ACC_UNLIMITED_BOTS = "acc_unlimited_bots";
public static String ACC_UNLIMITED_PETS = "acc_unlimited_pets";
public static String ACC_HIDE_IP = "acc_hide_ip";
public static String ACC_NOT_MIMICED = "acc_not_mimiced";
public static String ACC_CHAT_NO_FLOOD = "acc_chat_no_flood";
public static String ACC_STAFF_CHAT = "acc_staff_chat";
public static String ACC_STAFF_PICK = "acc_staff_pick";
public static String ACC_ENTERANYROOM = "acc_enteranyroom";
public static String ACC_FULLROOMS = "acc_fullrooms";
public static String ACC_INFINITE_CREDITS = "acc_infinite_credits";
public static String ACC_INFINITE_PIXELS = "acc_infinite_pixels";
public static String ACC_INFINITE_POINTS = "acc_infinite_points";
public static String ACC_AMBASSADOR = "acc_ambassador";
public static String ACC_DEBUG = "acc_debug";
public static String ACC_CHAT_NO_LIMIT = "acc_chat_no_limit";
public static String ACC_CHAT_NO_FILTER = "acc_chat_no_filter";
public static String ACC_NOMUTE = "acc_nomute";
public static String ACC_GUILD_ADMIN = "acc_guild_admin";
public static String ACC_CATALOG_IDS = "acc_catalog_ids";
public static String ACC_MODTOOL_TICKET_Q = "acc_modtool_ticket_q";
public static String ACC_MODTOOL_USER_LOGS = "acc_modtool_user_logs";
public static String ACC_MODTOOL_USER_ALERT = "acc_modtool_user_alert";
public static String ACC_MODTOOL_USER_KICK = "acc_modtool_user_kick";
public static String ACC_MODTOOL_USER_BAN = "acc_modtool_user_ban";
public static String ACC_MODTOOL_ROOM_INFO = "acc_modtool_room_info";
public static String ACC_MODTOOL_ROOM_LOGS = "acc_modtool_room_logs";
public static String ACC_TRADE_ANYWHERE = "acc_trade_anywhere";
public static String ACC_UPDATE_NOTIFICATIONS = "acc_update_notifications";
public static String ACC_HELPER_USE_GUIDE_TOOL = "acc_helper_use_guide_tool";
public static String ACC_HELPER_GIVE_GUIDE_TOURS = "acc_helper_give_guide_tours";
public static String ACC_HELPER_JUDGE_CHAT_REVIEWS = "acc_helper_judge_chat_reviews";
public static String ACC_FLOORPLAN_EDITOR = "acc_floorplan_editor";
public static String ACC_CAMERA = "acc_camera";
}

View File

@ -43,14 +43,11 @@ public class Rank
String columnName = meta.getColumnName(i);
if (columnName.startsWith("cmd_") || columnName.startsWith("acc_"))
{
if (set.getString(i).equals("1") || set.getString(i).equals("2"))
{
this.permissions.put(meta.getColumnName(i), new Permission(columnName, PermissionSetting.fromString(set.getString(i))));
}
this.permissions.put(meta.getColumnName(i), new Permission(columnName, PermissionSetting.fromString(set.getString(i))));
}
else
{
variables.put(meta.getColumnName(i), set.getString(i));
this.variables.put(meta.getColumnName(i), set.getString(i));
}
}
}

View File

@ -1,238 +0,0 @@
package com.eu.habbo.habbohotel.pets;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.messages.ISerialize;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserTalkComposer;
import com.eu.habbo.plugin.events.pets.PetTalkEvent;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
public abstract class AbstractPet implements ISerialize, Runnable
{
protected int id;
protected int userId;
protected Room room;
protected String name;
protected PetData petData;
protected int race;
protected String color;
protected int happyness;
protected int experience;
protected int energy;
protected int respect;
protected int created;
protected int level;
public boolean needsUpdate = false;
RoomUnit roomUnit;
int chatTimeout;
void say(String message)
{
if(this.roomUnit != null && this.room != null && !message.isEmpty())
{
RoomChatMessage chatMessage = new RoomChatMessage(message, this.roomUnit, RoomChatMessageBubbles.NORMAL);
PetTalkEvent talkEvent = new PetTalkEvent(this, chatMessage);
if (!Emulator.getPluginManager().fireEvent(talkEvent).isCancelled())
{
this.room.petChat(new RoomUserTalkComposer(chatMessage).compose());
}
}
}
public void say(PetVocal vocal)
{
if (true)
return;
if(vocal != null)
this.say(vocal.message);
}
public int getId()
{
return id;
}
public int getUserId()
{
return userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
public Room getRoom()
{
return room;
}
public void setRoom(Room room)
{
this.room = room;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public PetData getPetData()
{
return this.petData;
}
public void setPetData(PetData petData)
{
this.petData = petData;
}
public int getRace()
{
return race;
}
public void setRace(int race)
{
this.race = race;
}
public String getColor()
{
return this.color;
}
public void setColor(String color)
{
this.color = color;
}
public int getHappyness()
{
return happyness;
}
public void setHappyness(int happyness)
{
this.happyness = happyness;
}
public int getExperience()
{
return experience;
}
public void setExperience(int experience)
{
this.experience = experience;
}
public synchronized void addExperience(int amount)
{
this.experience += amount;
}
public int getEnergy()
{
return energy;
}
public int getMaxEnergy()
{
return this.level * 100;
}
public synchronized void setEnergy(int energy)
{
this.energy = energy;
}
public synchronized void addEnergy(int amount)
{
this.energy += amount;
if(this.energy > PetManager.maxEnergy(this.level))
this.energy = PetManager.maxEnergy(this.level);
if(this.energy < 0)
this.energy = 0;
}
public synchronized void addHappyness(int amount)
{
this.happyness += amount;
if(this.happyness > 100)
this.happyness = 100;
if(this.happyness < 0)
this.happyness = 0;
}
public int getRespect()
{
return respect;
}
public synchronized void addRespect()
{
this.respect++;
}
public int getCreated()
{
return created;
}
public void setCreated(int created)
{
this.created = created;
}
public int daysAlive()
{
return (Emulator.getIntUnixTimestamp() - this.created) / 86400;
}
public String bornDate()
{
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
cal.setTime(new Date(this.created));
return cal.get(Calendar.DAY_OF_MONTH) + "/" + cal.get(Calendar.MONTH) + "/" + cal.get(Calendar.YEAR);
}
public int getLevel()
{
return level;
}
public void setLevel(int level)
{
this.level = level;
}
public RoomUnit getRoomUnit()
{
return roomUnit;
}
public void setRoomUnit(RoomUnit roomUnit)
{
this.roomUnit = roomUnit;
}
}

View File

@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.pets;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.achievements.AchievementManager;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
@ -166,18 +167,16 @@ public class MonsterplantPet extends Pet implements IPetLook
{
if (isDead())
{
this.roomUnit.getStatus().remove("gst");
this.roomUnit.removeStatus(RoomUnitStatus.GESTURE);
if (!this.roomUnit.getStatus().containsKey("rip"))
if (!this.roomUnit.hasStatus(RoomUnitStatus.RIP))
{
AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.userId), Emulator.getGameEnvironment().getAchievementManager().getAchievement("MonsterPlantGardenOfDeath"));
}
if (this.roomUnit.getStatus().size() != 1)
{
this.roomUnit.getStatus().clear();
this.roomUnit.getStatus().put("rip", "");
this.packetUpdate = true;
}
this.roomUnit.clearStatus();
this.roomUnit.setStatus(RoomUnitStatus.RIP, "");
this.packetUpdate = true;
}
else
{
@ -186,9 +185,9 @@ public class MonsterplantPet extends Pet implements IPetLook
{
this.growthStage = 7;
boolean clear = false;
for (String s : roomUnit.getStatus().keySet())
for (RoomUnitStatus s : roomUnit.getStatusMap().keySet())
{
if (s.startsWith("grw"))
if (s.equals(RoomUnitStatus.GROW))
{
clear = true;
}
@ -196,7 +195,7 @@ public class MonsterplantPet extends Pet implements IPetLook
if (clear)
{
roomUnit.getStatus().clear();
roomUnit.clearStatus();
packetUpdate = true;
}
}
@ -207,8 +206,8 @@ public class MonsterplantPet extends Pet implements IPetLook
if (g > this.growthStage)
{
this.growthStage = g;
roomUnit.getStatus().clear();
roomUnit.getStatus().put("grw" + this.growthStage, "");
roomUnit.clearStatus();
roomUnit.setStatus(RoomUnitStatus.fromString("grw" + this.growthStage), "");
packetUpdate = true;
}
}
@ -352,14 +351,14 @@ public class MonsterplantPet extends Pet implements IPetLook
this.room.sendComposer(new PetStatusUpdateComposer((Pet) pet).compose());
this.room.sendComposer(new PetStatusUpdateComposer(this).compose());
this.getRoomUnit().getStatus().put("gst", "reb");
pet.getRoomUnit().getStatus().put("gst", "reb");
this.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "reb");
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, "reb");
this.room.sendComposer(new RoomUserStatusComposer(this.getRoomUnit()).compose());
this.room.sendComposer(new RoomUserStatusComposer(pet.getRoomUnit()).compose());
this.getRoomUnit().getStatus().remove("gst");
pet.getRoomUnit().getStatus().remove("gst");
this.getRoomUnit().removeStatus(RoomUnitStatus.GESTURE);
pet.getRoomUnit().removeStatus(RoomUnitStatus.GESTURE);
Habbo ownerOne = this.room.getHabbo(this.getUserId());
Habbo ownerTwo = null;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
package com.eu.habbo.habbohotel.pets;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public abstract class PetAction
{
public int minimumActionDuration = 500;
public final PetTasks petTask;
public final boolean stopsPetWalking;
public final List<RoomUnitStatus> statusToRemove = new ArrayList<>();
public String gestureToSet = null;
public final List<RoomUnitStatus> statusToSet = new ArrayList<>();
protected PetAction(PetTasks petTask, boolean stopsPetWalking)
{
this.petTask = petTask;
this.stopsPetWalking = stopsPetWalking;
}
public abstract boolean apply(Pet pet, Habbo habbo, String[] data);
}

View File

@ -1,5 +1,9 @@
package com.eu.habbo.habbohotel.pets;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -11,15 +15,17 @@ public class PetCommand implements Comparable<PetCommand>
public final int xp;
public final int energyCost;
public final int happynessCost;
public final PetAction action;
public PetCommand(ResultSet set) throws SQLException
public PetCommand(ResultSet set, PetAction action) throws SQLException
{
this.id = set.getInt("command_id");
this.key = set.getString("text");
this.level = set.getInt("required_level");
this.xp = set.getInt("reward_xp");
this.energyCost = set.getInt("cost_energy");
this.happynessCost = set.getInt("cost_happyness");
this.id = set.getInt("command_id");
this.key = set.getString("text");
this.level = set.getInt("required_level");
this.xp = set.getInt("reward_xp");
this.energyCost = set.getInt("cost_energy");
this.happynessCost = set.getInt("cost_happyness");
this.action = action;
}
@Override
@ -27,4 +33,42 @@ public class PetCommand implements Comparable<PetCommand>
{
return this.level - o.level;
}
public void handle(Pet pet, Habbo habbo, String[] data)
{
if(Emulator.getRandom().nextInt((pet.level - this.level <= 0 ? 2 : pet.level - this.level) + 2) == 0)
{
pet.say(pet.petData.randomVocal(PetVocalsType.DISOBEY));
return;
}
if (this.action != null)
{
if (this.action.petTask != pet.getTask())
{
if (this.action.stopsPetWalking)
{
pet.getRoomUnit().setGoalLocation(pet.getRoomUnit().getCurrentLocation());
}
if (this.action.apply(pet, habbo, data))
{
for (RoomUnitStatus status : this.action.statusToRemove)
{
pet.getRoomUnit().removeStatus(status);
}
for (RoomUnitStatus status : this.action.statusToSet)
{
pet.getRoomUnit().setStatus(status, "0");
}
pet.getRoomUnit().setStatus(RoomUnitStatus.GESTURE, this.action.gestureToSet);
pet.addEnergy(-this.energyCost);
pet.addHappyness(-this.happynessCost);
pet.addExperience(this.xp);
}
}
}
}
}

View File

@ -46,6 +46,11 @@ public class PetData implements Comparable<PetData>
public static final THashMap<PetVocalsType, THashSet<PetVocal>> generalPetVocals = new THashMap<PetVocalsType, THashSet<PetVocal>>();
public PetData(ResultSet set) throws SQLException
{
this.load(set);
}
public void load(ResultSet set) throws SQLException
{
this.type = set.getInt("pet_type");
this.name = set.getString("pet_name");
@ -278,14 +283,6 @@ public class PetData implements Comparable<PetData>
return vocals.get(Emulator.getRandom().nextInt(vocals.size()));
}
public void update(ResultSet set) throws SQLException
{
this.type = set.getInt("pet_type");
this.actionsHappy = set.getString("happy_actions").split(";");
this.actionsTired = set.getString("tired_actions").split(";");
this.actionsRandom = set.getString("random_actions").split(";");
}
@Override
public int compareTo(PetData o)
{

View File

@ -7,23 +7,20 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionNest;
import com.eu.habbo.habbohotel.items.interactions.InteractionPetDrink;
import com.eu.habbo.habbohotel.items.interactions.InteractionPetFood;
import com.eu.habbo.habbohotel.items.interactions.InteractionPetToy;
import com.eu.habbo.habbohotel.pets.actions.*;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.TIntIntMap;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.set.hash.THashSet;
import javafx.util.Pair;
import org.apache.commons.math.distribution.ExponentialDistribution;
import java.sql.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
public class PetManager
@ -34,6 +31,41 @@ public class PetManager
private final THashMap<Integer, PetData> petData;
private final TIntIntMap breedingPetType;
private final THashMap<Integer, TIntObjectHashMap<ArrayList<PetBreedingReward>>> breedingReward;
public final THashMap<Integer, PetAction> petActions = new THashMap<Integer, PetAction>()
{
{
put(0, new ActionFree());
put(1, new ActionSit());
put(2, new ActionDown());
put(3, new ActionHere());
put(4, new ActionBeg());
put(5, new ActionPlayDead());
put(6, new ActionStay());
put(7, new ActionFollow());
put(8, new ActionStand());
put(9, new ActionJump());
put(10, new ActionSpeak());
put(11, new ActionPlay());
put(12, new ActionSilent());
put(13, new ActionNest());
put(14, new ActionDrink());
put(15, new ActionFollowLeft());
put(16, new ActionFollowRight());
put(17, new ActionPlayFootball());
put(24, new ActionMoveForward());
put(25, new ActionTurnLeft());
put(26, new ActionTurnRight());
put(27, new ActionRelax());
put(28, new ActionCroak());
put(29, new ActionDip());
put(30, new ActionWave());
put(35, new ActionWings());
put(36, new ActionBreatheFire());
put(38, new ActionTorch());
put(43, new ActionEat());
}
};
public PetManager()
{
@ -74,7 +106,7 @@ public class PetManager
if (petData != null)
{
petData.update(set);
petData.load(set);
}
else
{
@ -150,7 +182,7 @@ public class PetManager
if(baseItem != null)
{
if(set.getInt("pet_id") == 0)
if(set.getInt("pet_id") == -1)
{
if(baseItem.getInteractionType().getType() == InteractionNest.class) PetData.generalNestItems.add(baseItem);
else if(baseItem.getInteractionType().getType() == InteractionPetFood.class) PetData.generalFoodItems.add(baseItem);
@ -180,9 +212,16 @@ public class PetManager
{
while(set.next())
{
if(set.getInt("pet_id") > 0)
if(set.getInt("pet_id") >= 0)
{
this.petData.get(set.getInt("pet_id")).petVocals.get(PetVocalsType.valueOf(set.getString("type").toUpperCase())).add(new PetVocal(set.getString("message")));
if (this.petData.containsKey(set.getInt("pet_id")))
{
this.petData.get(set.getInt("pet_id")).petVocals.get(PetVocalsType.valueOf(set.getString("type").toUpperCase())).add(new PetVocal(set.getString("message")));
}
else
{
Emulator.getLogging().logErrorLine("Missing pet_actions table entry for pet id " + set.getInt("pet_id"));
}
}
else
{
@ -202,7 +241,7 @@ public class PetManager
{
while(set.next())
{
commandsList.put(set.getInt("command_id"), new PetCommand(set));
commandsList.put(set.getInt("command_id"), new PetCommand(set, this.petActions.get(set.getInt("command_id"))));
}
}
@ -524,7 +563,7 @@ public class PetManager
}
public boolean deletePet(AbstractPet pet)
public boolean deletePet(Pet pet)
{
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM users_pets WHERE id = ? LIMIT 1"))
{

View File

@ -11,7 +11,7 @@ public enum PetTasks
PLAY_DEAD("ded"),
STAY(""),
FOLLOW(""),
STAND(""),
STAND("std"),
JUMP("jmp"),
SPEAK("spk"),
PLAY(""),

View File

@ -0,0 +1,30 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionBeg extends PetAction
{
public ActionBeg()
{
super(PetTasks.BEG, true);
this.statusToSet.add(RoomUnitStatus.BEG);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.clearPosture();
if(pet.getHappyness() > 90)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}
}

View File

@ -0,0 +1,30 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetClearPosture;
public class ActionBreatheFire extends PetAction
{
public ActionBreatheFire()
{
super(null, true);
this.minimumActionDuration = 1000;
this.statusToSet.add(RoomUnitStatus.FLAME);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.FLAME, null, false), this.minimumActionDuration);
if(pet.getHappyness() > 50)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
return true;
}
}

View File

@ -0,0 +1,47 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.items.interactions.InteractionPetBreedingNest;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.pets.breeding.PetBreedingStartFailedComposer;
public class ActionBreed extends PetAction
{
public ActionBreed()
{
super(PetTasks.BREED, true);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
InteractionPetBreedingNest nest = null;
for (HabboItem item : pet.getRoom().getRoomSpecialTypes().getItemsOfType(InteractionPetBreedingNest.class))
{
if (item.getBaseItem().getName().contains(pet.getPetData().getName()))
{
if (!((InteractionPetBreedingNest)item).boxFull())
{
nest = (InteractionPetBreedingNest) item;
break;
}
}
}
if (nest != null)
{
pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTile(nest.getX(), nest.getY()));
return true;
}
else
{
habbo.getClient().sendResponse(new PetBreedingStartFailedComposer(PetBreedingStartFailedComposer.NO_NESTS));
}
return false;
}
}

View File

@ -0,0 +1,32 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetClearPosture;
public class ActionCroak extends PetAction
{
public ActionCroak()
{
super(PetTasks.SPEAK, false);
this.minimumActionDuration = 2000;
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.getRoomUnit().setStatus(RoomUnitStatus.CROAK, "0");
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.CROAK, null, false), 2000);
if(pet.getHappyness() > 80)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
return true;
}
}

View File

@ -0,0 +1,33 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.items.interactions.InteractionWater;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboItem;
import gnu.trove.set.hash.THashSet;
public class ActionDip extends PetAction
{
public ActionDip()
{
super(null, true);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
THashSet<HabboItem> waterItems = pet.getRoom().getRoomSpecialTypes().getItemsOfType(InteractionWater.class);
if (waterItems.isEmpty())
return false;
HabboItem waterPatch = (HabboItem) waterItems.toArray()[Emulator.getRandom().nextInt(waterItems.size())];
pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTile(waterPatch.getX(), waterPatch.getY()));
return true;
}
}

View File

@ -0,0 +1,31 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionDown extends PetAction
{
public ActionDown()
{
super(PetTasks.DOWN, true);
this.statusToRemove.add(RoomUnitStatus.MOVE);
this.statusToRemove.add(RoomUnitStatus.SIT);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.getRoomUnit().setStatus(RoomUnitStatus.LAY, pet.getRoom().getStackHeight(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), false) + "");
if(pet.getHappyness() > 50)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}
}

View File

@ -0,0 +1,35 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionDrink extends PetAction
{
public ActionDrink()
{
super(null, false);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
if(pet.getLevelThirst() > 40)
{
pet.drink();
if(pet.getLevelThirst() > 65)
pet.say(pet.getPetData().randomVocal(PetVocalsType.THIRSTY));
return true;
}
else
{
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
}
return false;
}
}

View File

@ -0,0 +1,40 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetClearPosture;
public class ActionEat extends PetAction
{
public ActionEat()
{
super(null, true);
this.statusToSet.add(RoomUnitStatus.EAT);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
//Eat
if(pet.getLevelHunger() > 40)
{
pet.say(pet.getPetData().randomVocal(PetVocalsType.HUNGRY));
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.EAT, null, false), 500);
pet.eat();
return true;
}
else
{
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
return false;
}
}
}

View File

@ -0,0 +1,36 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetFollowHabbo;
public class ActionFollow extends PetAction
{
public ActionFollow()
{
super(PetTasks.FOLLOW, true);
this.statusToRemove.add(RoomUnitStatus.MOVE);
this.statusToRemove.add(RoomUnitStatus.LAY);
this.statusToRemove.add(RoomUnitStatus.DEAD);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.clearPosture();
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, 0));
if(pet.getHappyness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}
}

View File

@ -0,0 +1,33 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetFollowHabbo;
public class ActionFollowLeft extends PetAction
{
public ActionFollowLeft()
{
super(PetTasks.FOLLOW, true);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
//Follow left.
pet.clearPosture();
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, - 2));
if(pet.getHappyness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}
}

View File

@ -0,0 +1,33 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetFollowHabbo;
public class ActionFollowRight extends PetAction
{
public ActionFollowRight()
{
super(PetTasks.FOLLOW, true);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
//Follow right.
pet.clearPosture();
Emulator.getThreading().run(new PetFollowHabbo(pet, habbo, + 2));
if(pet.getHappyness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}
}

View File

@ -0,0 +1,22 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionFree extends PetAction
{
public ActionFree()
{
super(PetTasks.FREE, false);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.freeCommand();
return true;
}
}

View File

@ -0,0 +1,32 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionHere extends PetAction
{
public ActionHere()
{
super(PetTasks.HERE, false);
this.statusToRemove.add(RoomUnitStatus.DEAD);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTileInFront(habbo.getRoomUnit().getCurrentLocation(), habbo.getRoomUnit().getBodyRotation().getValue()));
pet.getRoomUnit().setCanWalk(true);
if(pet.getHappyness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}
}

View File

@ -0,0 +1,35 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.threading.runnables.PetClearPosture;
public class ActionJump extends PetAction
{
public ActionJump()
{
super(PetTasks.JUMP, true);
this.minimumActionDuration = 2000;
this.statusToSet.add(RoomUnitStatus.JUMP);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.clearPosture();
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.JUMP, null, false), 2000);
if(pet.getHappyness() > 60)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return true;
}
}

View File

@ -0,0 +1,27 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionMoveForward extends PetAction
{
public ActionMoveForward()
{
super(null, true);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
pet.getRoomUnit().setGoalLocation(pet.getRoom().getLayout().getTileInFront(pet.getRoomUnit().getCurrentLocation(), pet.getRoomUnit().getBodyRotation().getValue()));
pet.getRoomUnit().setCanWalk(true);
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_NEUTRAL));
return false;
}
}

View File

@ -0,0 +1,35 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetTasks;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionNest extends PetAction
{
public ActionNest()
{
super(null, false);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
if(pet.getEnergy() < 65)
{
pet.findNest();
if (pet.getEnergy() < 30)
pet.say(pet.getPetData().randomVocal(PetVocalsType.TIRED));
return true;
}
else
{
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
}
return false;
}
}

View File

@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.pets.actions;
import com.eu.habbo.habbohotel.pets.Pet;
import com.eu.habbo.habbohotel.pets.PetAction;
import com.eu.habbo.habbohotel.pets.PetVocalsType;
import com.eu.habbo.habbohotel.users.Habbo;
public class ActionPlay extends PetAction
{
public ActionPlay()
{
super(null, false);
}
@Override
public boolean apply(Pet pet, Habbo habbo, String[] data)
{
//Play
//TODO Implement playing for pets. For example; go to ball, toy etc.
if(pet.getHappyness() > 75)
pet.say(pet.getPetData().randomVocal(PetVocalsType.PLAYFUL));
else
{
pet.say(pet.getPetData().randomVocal(PetVocalsType.DISOBEY));
}
return true;
}
}

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