From 71acca7ebb5c36375c8a748f831efac0bf107b86 Mon Sep 17 00:00:00 2001 From: capheus <20739601+capheus@users.noreply.github.com> Date: Sat, 22 Dec 2018 10:39:00 +0000 Subject: [PATCH] Updated to 1.15 decompiled. --- README.md | 2 +- pom.xml | 2 +- sqlupdates/1_14_0_TO_1_15_0.sql | 70 ++ src/main/java/com/eu/habbo/Emulator.java | 17 +- .../core/consolecommands/ConsoleCommand.java | 5 +- .../consolecommands/ConsoleInfoCommand.java | 2 +- .../ConsoleReconnectCameraCommand.java | 2 +- .../ConsoleShutdownCommand.java | 2 +- .../consolecommands/ConsoleTestCommand.java | 13 +- .../ShowInteractionsCommand.java | 20 + .../achievements/AchievementManager.java | 94 +- .../achievements/TalentTrackLevel.java | 11 +- .../eu/habbo/habbohotel/bots/BotManager.java | 24 +- .../habbohotel/catalog/CatalogManager.java | 33 +- .../habbohotel/commands/CalendarCommand.java | 2 +- .../habbohotel/commands/CoordsCommand.java | 4 + .../commands/HotelAlertCommand.java | 4 +- .../habbohotel/commands/RoomAlertCommand.java | 4 +- .../habbohotel/commands/TakeBadgeCommand.java | 5 + .../habbohotel/commands/TestCommand.java | 35 +- .../habbohotel/commands/UnmuteCommand.java | 6 - .../habbohotel/crafting/CraftingManager.java | 163 ++-- .../gameclients/GameClientManager.java | 14 +- .../habbo/habbohotel/guilds/GuildManager.java | 13 + .../habbohotel/items/CrackableReward.java | 2 + .../com/eu/habbo/habbohotel/items/Item.java | 60 +- .../habbo/habbohotel/items/ItemManager.java | 26 +- .../interactions/InteractionBlackHole.java | 37 + .../interactions/InteractionCrackable.java | 36 +- .../interactions/InteractionDefault.java | 54 ++ .../interactions/InteractionEffectGiver.java | 63 ++ .../interactions/InteractionEffectTile.java | 31 +- .../InteractionEffectVendingMachine.java | 89 ++ .../InteractionExternalImage.java | 2 +- .../items/interactions/InteractionGate.java | 5 +- .../interactions/InteractionGymEquipment.java | 191 +++++ .../interactions/InteractionHanditem.java | 63 ++ .../interactions/InteractionHanditemTile.java | 39 + .../InteractionInformationTerminal.java | 2 +- .../InteractionMonsterCrackable.java | 79 ++ .../interactions/InteractionMultiHeight.java | 5 +- .../InteractionPetBreedingNest.java | 104 ++- .../InteractionPressurePlate.java | 11 +- .../items/interactions/InteractionRoller.java | 28 + .../interactions/InteractionRoomAds.java | 4 +- .../InteractionSnowboardSlope.java | 104 +++ .../interactions/InteractionStackHelper.java | 4 +- .../items/interactions/InteractionSwitch.java | 25 + .../interactions/InteractionTeleport.java | 2 +- .../InteractionVendingMachine.java | 8 +- .../items/interactions/InteractionWater.java | 109 ++- .../interactions/InteractionWaterItem.java | 36 +- .../items/interactions/InteractionWired.java | 6 +- .../InteractionWiredCondition.java | 6 + .../InteractionBattleBanzaiTile.java | 2 +- .../WiredConditionFurniHaveHabbo.java | 52 +- .../WiredConditionHabboHasRank.java | 9 +- .../WiredConditionHabboNotRank.java | 9 +- .../WiredConditionMatchStatePosition.java | 8 +- .../WiredConditionMottoContains.java | 7 + .../WiredConditionNotFurniHaveHabbo.java | 77 +- .../WiredConditionNotMatchStatePosition.java | 8 +- .../WiredConditionNotTriggerOnFurni.java | 6 - .../WiredConditionTriggerOnFurni.java | 13 +- .../wired/effects/WiredEffectBotTeleport.java | 2 +- .../wired/effects/WiredEffectMatchFurni.java | 52 +- .../wired/effects/WiredEffectMoveFurniTo.java | 193 ++--- .../effects/WiredEffectMoveRotateFurni.java | 401 ++++----- .../wired/effects/WiredEffectTeleport.java | 21 +- .../wired/effects/WiredEffectToggleFurni.java | 267 +++--- .../effects/WiredEffectToggleRandom.java | 27 +- .../wired/effects/WiredEffectWhisper.java | 4 + .../wired/triggers/WiredTriggerHabboIdle.java | 87 ++ .../triggers/WiredTriggerHabboUnidle.java | 87 ++ .../WiredTriggerHabboWalkOffFurni.java | 26 +- .../WiredTriggerHabboWalkOnFurni.java | 26 +- .../habbohotel/modtool/ModToolManager.java | 14 +- .../navigation/NavigatorHotelFilter.java | 11 +- .../navigation/NavigatorManager.java | 2 +- .../navigation/NavigatorUserFilter.java | 10 +- .../habbohotel/pets/MonsterplantPet.java | 8 + .../com/eu/habbo/habbohotel/pets/Pet.java | 79 +- .../eu/habbo/habbohotel/pets/PetAction.java | 11 + .../habbohotel/pets/PetBreedingReward.java | 5 + .../eu/habbo/habbohotel/pets/PetCommand.java | 13 + .../com/eu/habbo/habbohotel/pets/PetData.java | 106 ++- .../eu/habbo/habbohotel/pets/PetManager.java | 53 +- .../com/eu/habbo/habbohotel/pets/PetRace.java | 9 + .../habbohotel/pets/actions/ActionBreed.java | 3 +- .../com/eu/habbo/habbohotel/polls/Poll.java | 38 +- .../habbo/habbohotel/polls/PollManager.java | 5 +- .../habbo/habbohotel/polls/PollQuestion.java | 53 +- .../habbohotel/rooms/CustomRoomLayout.java | 6 +- .../rooms/FurnitureMovementError.java | 24 + .../com/eu/habbo/habbohotel/rooms/Room.java | 811 ++++++++++++++---- .../eu/habbo/habbohotel/rooms/RoomBan.java | 9 + .../habbohotel/rooms/RoomChatMessage.java | 2 +- .../rooms/RoomChatMessageBubbles.java | 100 ++- .../eu/habbo/habbohotel/rooms/RoomLayout.java | 118 ++- .../habbo/habbohotel/rooms/RoomManager.java | 4 +- .../habbohotel/rooms/RoomSpecialTypes.java | 15 + .../eu/habbo/habbohotel/rooms/RoomTile.java | 19 +- .../eu/habbo/habbohotel/rooms/RoomUnit.java | 14 +- .../habbohotel/rooms/RoomUserRotation.java | 4 +- .../eu/habbo/habbohotel/users/HabboItem.java | 85 +- .../habbo/habbohotel/users/HabboManager.java | 2 +- .../users/inventory/WardrobeComponent.java | 16 +- .../wired/WiredConditionOperator.java | 7 + .../habbo/habbohotel/wired/WiredHandler.java | 32 +- .../wired/WiredMatchFurniSetting.java | 6 +- .../habbohotel/wired/WiredTriggerType.java | 4 +- .../com/eu/habbo/messages/PacketManager.java | 4 +- .../eu/habbo/messages/incoming/Incoming.java | 4 +- .../messages/incoming/Incoming_1006.java | 266 ------ .../messages/incoming/Incoming_20160101.java | 299 ------- .../messages/incoming/Incoming_Back.java | 308 ------- .../RequestCraftingRecipesAvailableEvent.java | 8 + .../handshake/IsFirstLoginOfDayComposer.java | 23 + .../incoming/handshake/MachineIDEvent.java | 8 - .../incoming/handshake/SecureLoginEvent.java | 31 +- .../handshake/SecureLoginEvent_BACKUP.java | 2 +- .../incoming/handshake/UnknownComposer4.java | 16 - .../incoming/handshake/UsernameEvent.java | 2 +- .../helper/RequestTalentTrackEvent.java | 2 +- .../inventory/TestInventoryEvent.java | 13 - .../incoming/polls/AnswerPollEvent.java | 6 +- .../rooms/items/MoveWallItemEvent.java | 3 +- .../rooms/items/PostItPlaceEvent.java | 3 +- .../rooms/items/RedeemClothingEvent.java | 6 +- .../rooms/items/RoomPickupItemEvent.java | 12 - .../rooms/items/RoomPlaceItemEvent.java | 188 +--- .../rooms/items/RotateMoveItemEvent.java | 360 ++++---- .../items/SetStackHelperHeightEvent.java | 20 +- ...vent.java => BreedMonsterplantsEvent.java} | 2 +- .../rooms/pets/ConfirmPetBreedingEvent.java | 25 + .../rooms/pets/StopBreedingEvent.java | 21 + .../incoming/unknown/UnknownEvent1.java | 4 +- .../incoming/users/RequestUserDataEvent.java | 2 +- .../messages/incoming/users/UserNuxEvent.java | 2 +- .../eu/habbo/messages/outgoing/Outgoing.java | 18 +- .../messages/outgoing/Outgoing_1006.java | 432 ---------- .../messages/outgoing/Outgoing_Back.java | 435 ---------- .../habbo/messages/outgoing/TestComposer.java | 18 - .../TalentLevelUpdateComposer.java | 14 +- .../talenttrack/TalentTrackComposer.java | 4 +- .../crafting/CraftingResultComposer.java | 10 +- .../generic/alerts/BubbleAlertKeys.java | 2 +- .../alerts}/HotelClosedAndOpensComposer.java | 2 +- .../nux}/NewUserGiftComposer.java | 2 +- .../nux}/NewUserIdentityComposer.java | 2 +- .../nux}/NuxAlertComposer.java | 2 +- .../modtool/ModToolUserInfoComposer.java | 40 +- .../outgoing/polls/PollQuestionsComposer.java | 6 +- .../outgoing/polls/PollStartComposer.java | 8 +- .../BotForceOpenContextMenuComposer.java | 23 + .../rooms/RoomFilterWordsComposer.java | 13 +- .../rooms/RoomQueueStatusMessage.java | 24 + .../rooms/items/AddFloorItemComposer.java | 2 +- .../items/FloorItemOnRollerComposer.java | 9 +- .../pets}/PetLevelUpdatedComposer.java | 8 +- .../pets/breeding/PetBreedingCompleted.java | 14 +- .../breeding/PetBreedingResultComposer.java | 85 +- .../rooms/users/RoomUnitOnRollerComposer.java | 20 +- .../eu/habbo/messages/outgoing/trading.zip | Bin 3385 -> 0 bytes ... => GuildMembershipRequestedComposer.java} | 7 +- .../HotelViewNextLTDAvailableComposer.java | 32 - ...mposer6.java => IgnoredUsersComposer.java} | 4 +- .../outgoing/unknown/QuestComposer.java | 23 + .../outgoing/unknown/QuestsComposer.java | 94 ++ .../unknown/RoomUnknown2Composer.java | 26 - .../outgoing/unknown/UnknownComposer4.java | 2 +- .../unknown/UnknownWiredComposer.java | 2 +- .../unknown/UserClassificationComposer.java | 32 + .../habbo/messages/rcon/DisconnectUser.java | 2 +- .../habbo/messages/rcon/ImageAlertUser.java | 88 ++ .../habbo/messages/rcon/ImageHotelAlert.java | 51 +- .../com/eu/habbo/messages/rcon/MuteUser.java | 4 +- .../com/eu/habbo/messages/rcon/SetMotto.java | 55 ++ .../gameserver/GameByteDecoder.java | 1 - .../networking/rconserver/RCONServer.java | 2 + .../com/eu/habbo/plugin/PluginManager.java | 2 +- .../threading/runnables/CrackableExplode.java | 49 +- .../runnables/RemoveFloorItemTask.java | 5 +- .../threading/runnables/RoomUnitTeleport.java | 15 +- .../RoomUnitVendingMachineAction.java | 2 +- .../runnables/hopper/HopperActionOne.java | 1 + .../runnables/hopper/HopperActionThree.java | 1 + .../teleport/TeleportActionFive.java | 2 +- .../teleport/TeleportActionThree.java | 3 +- 189 files changed, 4619 insertions(+), 3579 deletions(-) create mode 100644 sqlupdates/1_14_0_TO_1_15_0.sql create mode 100644 src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java create mode 100644 src/main/java/com/eu/habbo/habbohotel/wired/WiredConditionOperator.java delete mode 100644 src/main/java/com/eu/habbo/messages/incoming/Incoming_1006.java delete mode 100644 src/main/java/com/eu/habbo/messages/incoming/Incoming_20160101.java delete mode 100644 src/main/java/com/eu/habbo/messages/incoming/Incoming_Back.java create mode 100644 src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java delete mode 100644 src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer4.java delete mode 100644 src/main/java/com/eu/habbo/messages/incoming/inventory/TestInventoryEvent.java rename src/main/java/com/eu/habbo/messages/incoming/rooms/pets/{BreedPetsEvent.java => BreedMonsterplantsEvent.java} (94%) create mode 100644 src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ConfirmPetBreedingEvent.java create mode 100644 src/main/java/com/eu/habbo/messages/incoming/rooms/pets/StopBreedingEvent.java delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/Outgoing_1006.java delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/Outgoing_Back.java delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/TestComposer.java rename src/main/java/com/eu/habbo/messages/outgoing/{unknown => generic/alerts}/HotelClosedAndOpensComposer.java (92%) rename src/main/java/com/eu/habbo/messages/outgoing/{unknown => habboway/nux}/NewUserGiftComposer.java (94%) rename src/main/java/com/eu/habbo/messages/outgoing/{unknown => habboway/nux}/NewUserIdentityComposer.java (91%) rename src/main/java/com/eu/habbo/messages/outgoing/{unknown => habboway/nux}/NuxAlertComposer.java (90%) create mode 100644 src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java create mode 100644 src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java rename src/main/java/com/eu/habbo/messages/outgoing/{unknown => rooms/pets}/PetLevelUpdatedComposer.java (74%) delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/trading.zip rename src/main/java/com/eu/habbo/messages/outgoing/unknown/{UnknownGuildComposer.java => GuildMembershipRequestedComposer.java} (71%) delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/unknown/HotelViewNextLTDAvailableComposer.java rename src/main/java/com/eu/habbo/messages/outgoing/unknown/{UnknownComposer6.java => IgnoredUsersComposer.java} (73%) create mode 100644 src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestComposer.java create mode 100644 src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestsComposer.java delete mode 100644 src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown2Composer.java create mode 100644 src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java create mode 100644 src/main/java/com/eu/habbo/messages/rcon/ImageAlertUser.java create mode 100644 src/main/java/com/eu/habbo/messages/rcon/SetMotto.java diff --git a/README.md b/README.md index 46c8ac0f..e88fe203 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## **To Get The Camera To Work Visit http://arcturus.wf and register.** ## ## **TUTORIAL FOR PLUGINS http://arcturus.wf/thread-2415.html** ## # **DO NOT EDIT THE SOURCE. USE THE PLUGIN API.** # -## Current Stable Version: 1.14.0 ## +## Current Stable Version: 1.15.0 ## Arcturus Morningstar is a Habbo emulator written in Java aiming to be an exact clone of the offical server, based on Arcturus Emulator by TheGeneral. Targeting PRODUCTION-201611291003-338511768 diff --git a/pom.xml b/pom.xml index b654c226..05bab2fe 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.eu.habbo Habbo - 1.14.0 + 1.15.0 UTF-8 diff --git a/sqlupdates/1_14_0_TO_1_15_0.sql b/sqlupdates/1_14_0_TO_1_15_0.sql new file mode 100644 index 00000000..b30fc336 --- /dev/null +++ b/sqlupdates/1_14_0_TO_1_15_0.sql @@ -0,0 +1,70 @@ +ALTER TABLE `pet_commands_data` ADD PRIMARY KEY(`command_id`); + +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '1'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '2'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '3'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '4'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '5'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '6'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '1', '7'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '2', '8'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '2', '9'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '2', '10'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '2', '11'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '2', '12'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '2', '13'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '3', '14'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '3', '15'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '3', '16'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '3', '17'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '4', '18'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '4', '19'); +INSERT INTO `pet_breeding_races` (`pet_type`, `rarity_level`, `breed`) VALUES ('28', '4', '20'); + +ALTER TABLE `pet_actions` ADD `offspring_type` INT(3) NOT NULL DEFAULT '-1' AFTER `pet_name`; + +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '1', '10', '0', '10', '1'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '2', '20', '0', '20', '10'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '3', '30', '0', '30', '30'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '4', '40', '0', '40', '60'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '5', '50', '0', '50', '120'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '6', '60', '0', '60', '240'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '7', '70', '0', '70', '600'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '8', '80', '0', '80', '1200'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '9', '90', '0', '90', '2400'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Trampolinist', 'games', '10', '100', '0', '100', '4800'); + +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '1', '10', '0', '10', '1'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '2', '20', '0', '20', '10'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '3', '30', '0', '30', '30'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '4', '40', '0', '40', '60'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '5', '50', '0', '50', '120'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '6', '60', '0', '60', '240'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '7', '70', '0', '70', '600'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '8', '80', '0', '80', '1200'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '9', '90', '0', '90', '2400'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'CrossTrainer', 'games', '10', '100', '0', '100', '4800'); + +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '1', '10', '0', '10', '1'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '2', '20', '0', '20', '10'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '3', '30', '0', '30', '30'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '4', '40', '0', '40', '60'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '5', '50', '0', '50', '120'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '6', '60', '0', '60', '240'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '7', '70', '0', '70', '600'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '8', '80', '0', '80', '1200'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '9', '90', '0', '90', '2400'); +INSERT INTO `achievements` (`id`, `name`, `category`, `level`, `reward_amount`, `reward_type`, `points`, `progress_needed`) VALUES (NULL, 'Jogger', 'games', '10', '100', '0', '100', '4800'); + +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.furni.gym.achievement.olympics_c16_trampoline', 'Trampolinist'), ('hotel.furni.gym.achievement.olympics_c16_crosstrainer', 'CrossTrainer'), ('hotel.furni.gym.achievement.olympics_c16_treadmill', 'Jogger'); +INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.furni.gym.forcerot.olympics_c16_trampoline', '0'), ('hotel.furni.gym.forcerot.olympics_c16_crosstrainer', '1'), ('hotel.furni.gym.forcerot.olympics_c16_treadmill', '1'); +UPDATE emulator_settings SET `key` = 'hotel.view.ltdcountdown.itemname' WHERE `key` = 'hotel.view.ltdcountdown.itename'; +INSERT IGNORE INTO `emulator_texts` (`key`, `value`) VALUES ('commands.keys.cmd_empty_pets', 'emptypets;empty_pets'); +INSERT IGNORE INTO `emulator_texts` (`key`, `value`) VALUES ('debug.show.headers', ''); + +ALTER TABLE `items_crackable` ADD PRIMARY KEY(`item_id`); +ALTER TABLE `items_crackable` ADD `required_effect` INT(3) NOT NULL DEFAULT '0' AFTER `achievement_cracked`; +INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('generic.tile.not.exists', 'Tile does not exist!'); +ALTER TABLE `items` CHANGE `z` `z` DOUBLE(10,6) NOT NULL DEFAULT '0.000000'; + +ALTER TABLE `items_base` ADD `customparams` VARCHAR(256) NOT NULL DEFAULT '' AFTER `multiheight`; diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 4088c0f2..b8109ada 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -33,7 +33,7 @@ public final class Emulator public final static int MAJOR = 1; - public final static int MINOR = 14; + public final static int MINOR = 15; public final static int BUILD = 0; @@ -70,7 +70,7 @@ public final class Emulator private static PluginManager pluginManager; private static Random random; private static BadgeImager badgeImager; - + static { Thread hook = new Thread(new Runnable() @@ -164,6 +164,7 @@ public final class Emulator { Emulator.getLogging().logStart("Thanks for using Arcturus. Contact: Skype: wesley.jabbo Discord: TheGeneral#0063"); Emulator.getLogging().logStart("-The General"); + System.out.println("Waiting for command: "); } }, 3500); @@ -173,12 +174,14 @@ public final class Emulator { try { + String line = reader.readLine(); if (line != null) { ConsoleCommand.handle(line); } + System.out.println("Waiting for command: "); } catch (Exception e) { @@ -355,12 +358,12 @@ public final class Emulator { cameraClient = client; } - + public static int getTimeStarted() { return timeStarted; } - + public static void prepareShutdown() { System.exit(0); @@ -393,7 +396,7 @@ public final class Emulator } return res; } - + public static Timestamp dateToTimeStamp(Date date) { return new Timestamp(date.getTime()); @@ -408,12 +411,12 @@ public final class Emulator { return dateToUnixTimestamp(getDate()); } - + public static int getIntUnixTimestamp() { return (int) (System.currentTimeMillis() / 1000); } - + public static boolean isNumeric(String string) throws IllegalArgumentException { diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java index bbe215ce..36692245 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleCommand.java @@ -5,7 +5,7 @@ import gnu.trove.map.hash.THashMap; public abstract class ConsoleCommand { - public static THashMap commands = new THashMap<>(); + private static THashMap commands = new THashMap<>(); public final String key; @@ -27,6 +27,7 @@ public abstract class ConsoleCommand addCommand(new ConsoleInfoCommand()); addCommand(new ConsoleTestCommand()); addCommand(new ConsoleReconnectCameraCommand()); + addCommand(new ShowInteractionsCommand()); } @@ -72,7 +73,7 @@ public abstract class ConsoleCommand for (ConsoleCommand c : commands.values()) { - System.out.println(c.key + " " + c.usage); + System.out.println(c.key + " - " + c.usage); } } } diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java index b93bb3a4..806b95d5 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleInfoCommand.java @@ -9,7 +9,7 @@ public class ConsoleInfoCommand extends ConsoleCommand { public ConsoleInfoCommand() { - super("info", ""); + super("info", "Show current statistics."); } @Override diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java index c2c5c9f2..f7247a3c 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleReconnectCameraCommand.java @@ -6,7 +6,7 @@ public class ConsoleReconnectCameraCommand extends ConsoleCommand { public ConsoleReconnectCameraCommand() { - super("camera", ""); + super("camera", "Attempt to reconnect to the camera server."); } @Override diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java index 684816bc..345f3687 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleShutdownCommand.java @@ -6,7 +6,7 @@ public class ConsoleShutdownCommand extends ConsoleCommand { public ConsoleShutdownCommand() { - super("stop", ""); + super("stop", "Stop the emulator."); } @Override diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java index f5c6f11c..213f81de 100644 --- a/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java +++ b/src/main/java/com/eu/habbo/core/consolecommands/ConsoleTestCommand.java @@ -8,19 +8,22 @@ public class ConsoleTestCommand extends ConsoleCommand { public ConsoleTestCommand() { - super("test", "test"); + super("test", "This is just a test."); } @Override public void handle(String[] args) throws Exception { - System.out.println("This is a test command for live debugging."); + if (Emulator.debugging) + { + System.out.println("This is a test command for live debugging."); - //AchievementManager.progressAchievement(4, Emulator.getGameEnvironment().getAchievementManager().getAchievement("AllTimeHotelPresence"), 30); - Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(1); - habbo.getHabboInfo().getMachineID(); + //AchievementManager.progressAchievement(4, Emulator.getGameEnvironment().getAchievementManager().getAchievement("AllTimeHotelPresence"), 30); + Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(1); + habbo.getHabboInfo().getMachineID(); + } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java new file mode 100644 index 00000000..bd621909 --- /dev/null +++ b/src/main/java/com/eu/habbo/core/consolecommands/ShowInteractionsCommand.java @@ -0,0 +1,20 @@ +package com.eu.habbo.core.consolecommands; + +import com.eu.habbo.Emulator; + +public class ShowInteractionsCommand extends ConsoleCommand +{ + public ShowInteractionsCommand() + { + super("interactions", "Show a list of available furniture interactions."); + } + + @Override + public void handle(String[] args) throws Exception + { + for (String interaction : Emulator.getGameEnvironment().getItemManager().getInteractionList()) + { + System.out.println(interaction); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java index 3dd5db5e..c5220069 100644 --- a/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/achievements/AchievementManager.java @@ -209,12 +209,12 @@ public class AchievementManager AchievementLevel oldLevel = achievement.getLevelForProgress(currentProgress); - if(oldLevel == null) - { - oldLevel = achievement.firstLevel(); - } - if(oldLevel.level == achievement.levels.size() && currentProgress >= oldLevel.progress) //Maximum achievement gotten. + + + + + if(oldLevel != null && (oldLevel.level == achievement.levels.size() && currentProgress >= oldLevel.progress)) //Maximum achievement gotten. return; habbo.getHabboStats().setProgress(achievement, currentProgress + amount); @@ -239,7 +239,8 @@ public class AchievementManager } } - if(newLevel == null || (oldLevel.level == newLevel.level && newLevel.level < achievement.levels.size())) + if(newLevel == null || + (oldLevel != null &&(oldLevel.level == newLevel.level && newLevel.level < achievement.levels.size()))) { habbo.getClient().sendResponse(new AchievementProgressComposer(habbo, achievement)); } @@ -261,13 +262,17 @@ public class AchievementManager //The achievement is then progressed but the user is already disposed so fetching //the badge would result in an nullpointer exception. This is normal behaviour. HabboBadge badge = null; - try + + if (oldLevel != null) { - badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase()); - } - catch (Exception e) - { - return; + try + { + badge = habbo.getInventory().getBadgesComponent().getBadge(("ACH_" + achievement.name + oldLevel.level).toLowerCase()); + } catch (Exception e) + { + Emulator.getLogging().logErrorLine(e); + return; + } } if (badge != null) @@ -364,6 +369,28 @@ public class AchievementManager } } + public static int getAchievementProgressForHabbo(int userId, Achievement achievement) + { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT progress FROM users_achievements WHERE user_id = ? AND achievement_name = ? LIMIT 1")) + { + statement.setInt(1, userId); + statement.setString(2, achievement.name); + try (ResultSet set = statement.executeQuery()) + { + if (set.next()) + { + return set.getInt("progress"); + } + } + } + catch (SQLException e) + { + Emulator.getLogging().logSQLException(e); + } + + return 0; + } + public LinkedHashMap getTalenTrackLevels(TalentTrackType type) { return this.talentTrackLevels.get(type); @@ -420,30 +447,39 @@ public class AchievementManager if (level != null) { - for (Item item : level.items) + if (level.items != null && !level.items.isEmpty()) { - HabboItem rewardItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getHabboInfo().getId(), item, 0, 0, ""); - habbo.getInventory().getItemsComponent().addItem(rewardItem); - habbo.getClient().sendResponse(new AddHabboItemComposer(rewardItem)); - habbo.getClient().sendResponse(new InventoryRefreshComposer()); - } - - for (String badge : level.badges) - { - if (!badge.isEmpty()) + for (Item item : level.items) { - HabboBadge b = new HabboBadge(0, badge, 0, habbo); - Emulator.getThreading().run(b); - habbo.getInventory().getBadgesComponent().addBadge(b); - habbo.getClient().sendResponse(new AddUserBadgeComposer(b)); + HabboItem rewardItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getHabboInfo().getId(), item, 0, 0, ""); + habbo.getInventory().getItemsComponent().addItem(rewardItem); + habbo.getClient().sendResponse(new AddHabboItemComposer(rewardItem)); + habbo.getClient().sendResponse(new InventoryRefreshComposer()); } } - for (String perk : level.perks) + if (level.badges != null && level.badges.length > 0 ) { - if (perk.equalsIgnoreCase("TRADE")) + for (String badge : level.badges) { - habbo.getHabboStats().perkTrade = true; + if (!badge.isEmpty()) + { + HabboBadge b = new HabboBadge(0, badge, 0, habbo); + Emulator.getThreading().run(b); + habbo.getInventory().getBadgesComponent().addBadge(b); + habbo.getClient().sendResponse(new AddUserBadgeComposer(b)); + } + } + } + + if (level.perks != null && level.perks.length > 0 ) + { + for (String perk : level.perks) + { + if (perk.equalsIgnoreCase("TRADE")) + { + habbo.getHabboStats().perkTrade = true; + } } } habbo.getClient().sendResponse(new TalentLevelUpdateComposer(type, level)); diff --git a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java index f1f41d78..4bbc7045 100644 --- a/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java +++ b/src/main/java/com/eu/habbo/habbohotel/achievements/TalentTrackLevel.java @@ -72,7 +72,14 @@ public class TalentTrackLevel } } - this.perks = set.getString("reward_perks").split(","); - this.badges = set.getString("reward_badges").split(","); + if (!set.getString("reward_perks").isEmpty()) + { + this.perks = set.getString("reward_perks").split(","); + } + + if (!set.getString("reward_badges").isEmpty()) + { + this.badges = set.getString("reward_badges").split(","); + } } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 8be6bc0b..40807638 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -1,9 +1,11 @@ package com.eu.habbo.habbohotel.bots; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.permissions.Permission; 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.outgoing.generic.alerts.BotErrorComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; @@ -136,13 +138,18 @@ public class BotManager return; } - if (!room.tileWalkable(location.x, location.y)) + if (!room.hasHabbosAt(location.x, location.y) && !location.isWalkable() && location.state != RoomTileState.SIT) return; RoomUnit roomUnit = new RoomUnit(); roomUnit.setRotation(RoomUserRotation.SOUTH); roomUnit.setLocation(location); - roomUnit.setZ(room.getStackHeight(location.x, location.y, false)); + HabboItem topItem = room.getTopItemAt(location.x, location.y); + if (topItem != null) + { + roomUnit.setZ(topItem.getZ() + Item.getCurrentHeight(topItem)); + } + roomUnit.setPreviousLocationZ(roomUnit.getZ()); roomUnit.setPathFinderRoom(room); roomUnit.setRoomUnitType(RoomUnitType.BOT); roomUnit.setCanWalk(room.isAllowBotsWalk()); @@ -155,11 +162,22 @@ public class BotManager habbo.getInventory().getBotsComponent().removeBot(bot); habbo.getClient().sendResponse(new RemoveBotComposer(bot)); bot.onPlace(habbo, room); + + if (topItem != null) + { + try + { + topItem.onWalkOn(bot.getRoomUnit(), room, null); + } catch (Exception e) + { + Emulator.getLogging().logErrorLine(e); + } + } bot.cycle(false); } else { - habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); + habbo.getClient().sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java index 78bc62b1..09e59250 100644 --- a/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/catalog/CatalogManager.java @@ -86,7 +86,7 @@ public class CatalogManager public static int catalogItemAmount; - public static int PURCHASE_COOLDOWN = 3; + public static int PURCHASE_COOLDOWN = 1; public static boolean SORT_USING_ORDERNUM = false; @@ -154,7 +154,7 @@ public class CatalogManager this.giftFurnis = new THashMap<>(); this.clubItems = new THashSet<>(); this.clubOffers = new THashMap<>(); - targetOffers = new THashMap<>(); + this.targetOffers = new THashMap<>(); this.clothing = new THashMap<>(); this.offerDefs = new TIntIntHashMap(); this.vouchers = new ArrayList<>(); @@ -396,22 +396,19 @@ public class CatalogManager private void loadClubOffers() throws SQLException { - synchronized (this.clubOffers) - { - this.clubOffers.clear(); + this.clubOffers.clear(); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM catalog_club_offers WHERE enabled = ?")) - { - statement.setString(1, "1"); - try (ResultSet set = statement.executeQuery()) - { - while (set.next()) - { - this.clubOffers.put(set.getInt("id"), new ClubOffer(set)); - } - } - } - } + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM catalog_club_offers WHERE enabled = ?")) + { + statement.setString(1, "1"); + try (ResultSet set = statement.executeQuery()) + { + while (set.next()) + { + this.clubOffers.put(set.getInt("id"), new ClubOffer(set)); + } + } + } } private void loadTargetOffers() throws SQLException @@ -1210,6 +1207,8 @@ public class CatalogManager Emulator.getThreading().run(habboItem); itemsList.add(habboItem); + + AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("MusicCollector")); } else { HabboItem habboItem = Emulator.getGameEnvironment().getItemManager().createItem(habbo.getClient().getHabbo().getHabboInfo().getId(), baseItem, limitedStack, limitedNumber, extradata); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java index b6fd105b..005dc212 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/CalendarCommand.java @@ -3,7 +3,7 @@ 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; +import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer; public class CalendarCommand extends Command { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java index cae665a0..04f42b8c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/CoordsCommand.java @@ -49,6 +49,10 @@ public class CoordsCommand extends Command { "Tile Stack Height: " + tile.getStackHeight() + "\r" + "Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r")); } + else + { + gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.tile.not.exists")); + } } return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java index 30498773..d2f64db6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/HotelAlertCommand.java @@ -5,7 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; +import com.eu.habbo.messages.outgoing.generic.alerts.StaffAlertWithLinkComposer; import java.util.Map; @@ -25,7 +25,7 @@ public class HotelAlertCommand extends Command { message += params[i] + " "; } - ServerMessage msg = new GenericAlertComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername()).compose(); + ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose(); for(Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/RoomAlertCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/RoomAlertCommand.java index 719d5bfc..aaf4655f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/RoomAlertCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/RoomAlertCommand.java @@ -4,7 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; -import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; +import com.eu.habbo.messages.outgoing.modtool.ModToolIssueHandledComposer; public class RoomAlertCommand extends Command { @@ -35,7 +35,7 @@ public class RoomAlertCommand extends Command if (room != null) { - room.sendComposer(new GenericAlertComposer(message).compose()); + room.sendComposer(new ModToolIssueHandledComposer(message).compose()); return true; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TakeBadgeCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/TakeBadgeCommand.java index 39f498e8..4990075f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/TakeBadgeCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/TakeBadgeCommand.java @@ -7,6 +7,7 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboBadge; import com.eu.habbo.habbohotel.users.inventory.BadgesComponent; import com.eu.habbo.messages.outgoing.inventory.InventoryBadgesComposer; +import com.eu.habbo.messages.outgoing.users.UserBadgesComposer; public class TakeBadgeCommand extends Command { @@ -47,6 +48,10 @@ public class TakeBadgeCommand extends Command } habbo.getClient().sendResponse(new InventoryBadgesComposer(habbo)); + if (habbo.getHabboInfo().getCurrentRoom() != null) + { + habbo.getHabboInfo().getCurrentRoom().sendComposer(new UserBadgesComposer(habbo.getInventory().getBadgesComponent().getWearingBadges(), habbo.getHabboInfo().getId()).compose()); + } } gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_take_badge"), RoomChatMessageBubbles.ALERT); diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java index 4ebd6eeb..a788bf80 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/TestCommand.java @@ -22,6 +22,7 @@ import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer; +import com.eu.habbo.messages.outgoing.rooms.RoomQueueStatusMessage; import com.eu.habbo.messages.outgoing.rooms.pets.PetInformationComposer; import com.eu.habbo.messages.outgoing.rooms.pets.PetStatusUpdateComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; @@ -56,9 +57,41 @@ public class TestCommand extends Command public boolean handle(GameClient gameClient, String[] params) throws Exception { + if (params[1].equalsIgnoreCase("ut")) + { + RoomTile tile = gameClient.getHabbo().getRoomUnit().getCurrentLocation(); + gameClient.getHabbo().getHabboInfo().getCurrentRoom().updateTile(tile); + return true; + } + + if (params[1].equalsIgnoreCase("clients")) + { + System.out.println(Emulator.getGameServer().getGameClientManager().getSessions().size()); + } + + if (params[1].equalsIgnoreCase("queue")) + { + gameClient.sendResponse(new RoomQueueStatusMessage()); + return true; + } + if (params[1].equalsIgnoreCase("public")) + { + gameClient.getHabbo().getHabboInfo().getCurrentRoom().setPublicRoom(true); + return true; + } + + if (params[1].equalsIgnoreCase("randtel")) + { + RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getRandomWalkableTile(); + gameClient.getHabbo().getRoomUnit().setCurrentLocation(tile); + gameClient.getHabbo().getHabboInfo().getCurrentRoom().updateHabbo(gameClient.getHabbo()); + gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserStatusComposer(gameClient.getHabbo().getRoomUnit()).compose()); + return true; + } + if (params[1].equals("ach")) { - AchievementManager.progressAchievement(gameClient.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("GiftGiver"), 100); + AchievementManager.progressAchievement(gameClient.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("Jogger"), 1); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/UnmuteCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/UnmuteCommand.java index 1f3016b0..7be27bfa 100644 --- a/src/main/java/com/eu/habbo/habbohotel/commands/UnmuteCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/commands/UnmuteCommand.java @@ -4,7 +4,6 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles; import com.eu.habbo.habbohotel.users.Habbo; -import com.eu.habbo.messages.outgoing.rooms.users.RoomUserIgnoredComposer; public class UnmuteCommand extends Command { @@ -43,11 +42,6 @@ public class UnmuteCommand extends Command habbo.getHabboInfo().getCurrentRoom().muteHabbo(habbo, 1); } - if (habbo.getHabboInfo().getCurrentRoom() != null) - { - habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose()); - } - gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_unmute").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT); } else diff --git a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java index cdc81dcc..7086e71f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/crafting/CraftingManager.java @@ -26,61 +26,57 @@ public class CraftingManager { this.dispose(); - synchronized (this.altars) - { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM crafting_altars_recipes " + + "INNER JOIN crafting_recipes ON crafting_altars_recipes.recipe_id = crafting_recipes.id " + + "INNER JOIN crafting_recipes_ingredients ON crafting_recipes.id = crafting_recipes_ingredients.recipe_id " + + "WHERE crafting_recipes.enabled = ? ORDER BY altar_id ASC")) + { + statement.setString(1, "1"); + try (ResultSet set = statement.executeQuery()) + { + while (set.next()) + { + Item item = Emulator.getGameEnvironment().getItemManager().getItem(set.getInt("altar_id")); - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM crafting_altars_recipes " + - "INNER JOIN crafting_recipes ON crafting_altars_recipes.recipe_id = crafting_recipes.id " + - "INNER JOIN crafting_recipes_ingredients ON crafting_recipes.id = crafting_recipes_ingredients.recipe_id " + - "WHERE crafting_recipes.enabled = ? ORDER BY altar_id ASC")) - { - statement.setString(1, "1"); - try (ResultSet set = statement.executeQuery()) - { - while (set.next()) - { - Item item = Emulator.getGameEnvironment().getItemManager().getItem(set.getInt("altar_id")); + if (item != null) + { + if (!this.altars.containsKey(item)) + { + this.altars.put(item, new CraftingAltar(item)); + } - if (item != null) - { - if (!this.altars.containsKey(item)) - { - this.altars.put(item, new CraftingAltar(item)); - } + CraftingAltar altar = this.altars.get(item); - CraftingAltar altar = this.altars.get(item); + if (altar != null) + { + CraftingRecipe recipe = altar.getRecipe(set.getInt("crafting_recipes_ingredients.recipe_id")); - if (altar != null) - { - CraftingRecipe recipe = altar.getRecipe(set.getInt("crafting_recipes_ingredients.recipe_id")); + if (recipe == null) + { + recipe = new CraftingRecipe(set); + altar.addRecipe(recipe); + } - if (recipe == null) - { - recipe = new CraftingRecipe(set); - altar.addRecipe(recipe); - } + Item ingredientItem = Emulator.getGameEnvironment().getItemManager().getItem(set.getInt("crafting_recipes_ingredients.item_id")); - Item ingredientItem = Emulator.getGameEnvironment().getItemManager().getItem(set.getInt("crafting_recipes_ingredients.item_id")); - - if (ingredientItem != null) - { - recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount")); - altar.addIngredient(ingredientItem); - } - else - { - Emulator.getLogging().logErrorLine("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id")); - } - } - } - } - } - } - catch (SQLException e) - { - Emulator.getLogging().logSQLException(e); - } - } + if (ingredientItem != null) + { + recipe.addIngredient(ingredientItem, set.getInt("crafting_recipes_ingredients.amount")); + altar.addIngredient(ingredientItem); + } + else + { + Emulator.getLogging().logErrorLine("Unknown ingredient item " + set.getInt("crafting_recipes_ingredients.item_id")); + } + } + } + } + } + } + catch (SQLException e) + { + Emulator.getLogging().logSQLException(e); + } } public int getRecipesWithItemCount(final Item item) @@ -109,57 +105,48 @@ public class CraftingManager public CraftingRecipe getRecipe(String recipeName) { - synchronized (this.altars) - { - CraftingRecipe recipe = null; - for (CraftingAltar altar : this.altars.values()) - { - recipe = altar.getRecipe(recipeName); + CraftingRecipe recipe = null; + for (CraftingAltar altar : this.altars.values()) + { + recipe = altar.getRecipe(recipeName); - if (recipe != null) - { - return recipe; - } - } - } + if (recipe != null) + { + return recipe; + } + } return null; } public CraftingAltar getAltar(Item item) { - synchronized (this.altars) - { - return this.altars.get(item); - } + return this.altars.get(item); } public void dispose() { - synchronized (this.altars) - { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE crafting_recipes SET remaining = ? WHERE id = ? LIMIT 1")) - { - for (CraftingAltar altar : this.altars.values()) - { - for (CraftingRecipe recipe : altar.getRecipes()) - { - if (recipe.isLimited()) - { - statement.setInt(1, recipe.getRemaining()); - statement.setInt(2, recipe.getId()); + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE crafting_recipes SET remaining = ? WHERE id = ? LIMIT 1")) + { + for (CraftingAltar altar : this.altars.values()) + { + for (CraftingRecipe recipe : altar.getRecipes()) + { + if (recipe.isLimited()) + { + statement.setInt(1, recipe.getRemaining()); + statement.setInt(2, recipe.getId()); - statement.addBatch(); - } - } - } - statement.executeBatch(); - } - catch (SQLException e) - { - Emulator.getLogging().logSQLException(e); - } - } + statement.addBatch(); + } + } + } + statement.executeBatch(); + } + catch (SQLException e) + { + Emulator.getLogging().logSQLException(e); + } this.altars.clear(); } diff --git a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java index 99b1dd97..191bbb16 100644 --- a/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/gameclients/GameClientManager.java @@ -68,18 +68,22 @@ public class GameClientManager return this.clients.putIfAbsent(ctx.channel().id(), client) == null; } - - public void disposeClient(Channel channel) + + public void disposeClient(GameClient client) { - GameClient client = this.getClient(channel); + client.getChannel().close(); + } + + private void disposeClient(Channel channel) + { + GameClient client = channel.attr(CLIENT).get(); if (client != null) { client.dispose(); } - - channel.attr(CLIENT).set(null); channel.deregister(); + channel.attr(CLIENT).set(null); channel.closeFuture(); channel.close(); this.clients.remove(channel.id()); diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java index 85188473..4d056777 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildManager.java @@ -5,7 +5,9 @@ import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.interactions.InteractionGuildFurni; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.guilds.GuildJoinErrorComposer; +import com.eu.habbo.messages.outgoing.unknown.GuildMembershipRequestedComposer; import gnu.trove.TCollections; import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.map.TIntObjectMap; @@ -317,7 +319,18 @@ public class GuildManager if(userId == 0 && !error) { if (guild.getState() == GuildState.LOCKED) + { guild.increaseRequestCount(); + ServerMessage membershipRequestMessage = new GuildMembershipRequestedComposer(guild.getId(), client.getHabbo().getHabboInfo().getId()).compose(); + for (GuildMember member : this.getOnlyAdmins(guild).values()) + { + Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(member.getUserId()); + if (habbo != null) + { + habbo.getClient().sendResponse(membershipRequestMessage); + } + } + } else { guild.increaseMemberCount(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java index 9285c2b7..4cb60102 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/CrackableReward.java @@ -16,6 +16,7 @@ public class CrackableReward public int totalChance; public final String achievementTick; public final String achievementCracked; + public final int requiredEffect; public CrackableReward(ResultSet set) throws SQLException { @@ -23,6 +24,7 @@ public class CrackableReward this.count = set.getInt("count"); this.achievementTick = set.getString("achievement_tick"); this.achievementCracked = set.getString("achievement_cracked"); + this.requiredEffect = set.getInt("required_effect"); String[] data = set.getString("prizes").split(";"); this.prizes = new HashMap<>(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/Item.java b/src/main/java/com/eu/habbo/habbohotel/items/Item.java index 6c459aa2..06b61a31 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/Item.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/Item.java @@ -32,6 +32,7 @@ public class Item { private short effectF; private TIntArrayList vendingItems; private double[] multiHeights; + private String customParams; private ItemInteraction interactionType; @@ -55,6 +56,10 @@ public class Item { this.width = set.getShort("width"); this.length = set.getShort("length"); this.height = set.getDouble("stack_height"); + if (this.height == 0) + { + this.height = 1e-6; + } this.allowStack = set.getBoolean("allow_stack"); this.allowWalk = set.getBoolean("allow_walk"); this.allowSit = set.getBoolean("allow_sit"); @@ -70,7 +75,7 @@ public class Item { this.stateCount = set.getShort("interaction_modes_count"); this.effectM = set.getShort("effect_id_male"); this.effectF = set.getShort("effect_id_female"); - + this.customParams = set.getString("customparams"); if(!set.getString("vending_ids").isEmpty()) { this.vendingItems = new TIntArrayList(); @@ -81,7 +86,7 @@ public class Item { } } - if(this.interactionType.getType() == InteractionMultiHeight.class) + //if(this.interactionType.getType() == InteractionMultiHeight.class || this.interactionType.getType().isAssignableFrom(InteractionMultiHeight.class)) { if(set.getString("multiheight").contains(";")) { @@ -100,15 +105,18 @@ public class Item { } } - public int getId() { + public int getId() + { return this.id; } - public int getSpriteId() { + public int getSpriteId() + { return this.spriteId; } - public String getName() { + public String getName() + { return this.name; } @@ -122,47 +130,58 @@ public class Item { return this.type; } - public int getWidth() { + public int getWidth() + { return this.width; } - public int getLength() { + public int getLength() + { return this.length; } - public double getHeight() { + public double getHeight() + { return this.height; } - public boolean allowStack() { + public boolean allowStack() + { return this.allowStack; } - public boolean allowWalk() { + public boolean allowWalk() + { return this.allowWalk; } - public boolean allowSit() { + public boolean allowSit() + { return this.allowSit; } - public boolean allowLay() { + public boolean allowLay() + { return this.allowLay; } - public boolean allowRecyle() { + public boolean allowRecyle() + { return this.allowRecyle; } - public boolean allowTrade() { + public boolean allowTrade() + { return this.allowTrade; } - public boolean allowMarketplace() { + public boolean allowMarketplace() + { return this.allowMarketplace; } - public boolean allowGift() { + public boolean allowGift() + { return this.allowGift; } @@ -171,15 +190,18 @@ public class Item { return this.allowInventoryStack; } - public int getStateCount() { + public int getStateCount() + { return this.stateCount; } - public int getEffectM() { + public int getEffectM() + { return this.effectM; } - public int getEffectF() { + public int getEffectF() + { return this.effectF; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java index 768f372d..6fbea2fb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/ItemManager.java @@ -164,6 +164,13 @@ public class ItemManager this.interactionsList.add(new ItemInteraction("sticky_pole", InteractionStickyPole.class)); this.interactionsList.add(new ItemInteraction("trap", InteractionTrap.class)); this.interactionsList.add(new ItemInteraction("tent", InteractionTent.class)); + this.interactionsList.add(new ItemInteraction("gym_equipment", InteractionGymEquipment.class)); + this.interactionsList.add(new ItemInteraction("handitem", InteractionHanditem.class)); + this.interactionsList.add(new ItemInteraction("handitem_tile", InteractionHanditemTile.class)); + this.interactionsList.add(new ItemInteraction("effect_giver", InteractionEffectGiver.class)); + this.interactionsList.add(new ItemInteraction("effect_vendingmachine", InteractionEffectVendingMachine.class)); + this.interactionsList.add(new ItemInteraction("crackable_monster", InteractionMonsterCrackable.class)); + this.interactionsList.add(new ItemInteraction("snowboard_slope", InteractionSnowboardSlope.class)); @@ -183,6 +190,8 @@ public class ItemManager this.interactionsList.add(new ItemInteraction("wf_trg_bot_reached_avtr", WiredTriggerBotReachedHabbo.class)); this.interactionsList.add(new ItemInteraction("wf_trg_says_command", WiredTriggerHabboSaysCommand.class)); this.interactionsList.add(new ItemInteraction("wf_trg_score_achieved", WiredTriggerScoreAchieved.class)); + this.interactionsList.add(new ItemInteraction("wf_trg_idles", WiredTriggerHabboIdle.class)); + this.interactionsList.add(new ItemInteraction("wf_trg_unidles", WiredTriggerHabboUnidle.class)); this.interactionsList.add(new ItemInteraction("wf_act_toggle_state", WiredEffectToggleFurni.class)); @@ -422,14 +431,17 @@ public class ItemManager { while(set.next()) { + CrackableReward reward = null; try { - this.crackableRewards.put(set.getInt("item_id"), new CrackableReward(set)); + reward = new CrackableReward(set); } catch (Exception e) { Emulator.getLogging().logErrorLine("Failed to load items_crackable item_id = " + set.getInt("ïtem_id")); + continue; } + this.crackableRewards.put(set.getInt("item_id"), reward); } } catch (SQLException e) @@ -913,4 +925,16 @@ public class ItemManager Emulator.getLogging().logShutdownLine("Item Manager -> Disposed!"); } + public List getInteractionList() + { + List interactions = new ArrayList<>(); + + for (ItemInteraction interaction : this.interactionsList) + { + interactions.add(interaction.getName()); + } + + Collections.sort(interactions); + return interactions; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java index 20db14e7..babcf1e6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionBlackHole.java @@ -1,6 +1,11 @@ package com.eu.habbo.habbohotel.items.interactions; +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.achievements.Achievement; +import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.users.Habbo; import java.sql.ResultSet; import java.sql.SQLException; @@ -16,4 +21,36 @@ public class InteractionBlackHole extends InteractionGate { super(id, userId, item, extradata, limitedStack, limitedSells); } + + @Override + public void onPlace(Room room) + { + Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount"); + + int holesCountProgress = 0; + Habbo owner = room.getHabbo(this.getUserId()); + + int furniCollecterProgress = 0; + if (owner == null) + { + furniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), holeCountAchievement); + } + else + { + furniCollecterProgress = owner.getHabboStats().getAchievementProgress(holeCountAchievement); + } + int holeDifference = room.getRoomSpecialTypes().getItemsOfType(InteractionBlackHole.class).size() - holesCountProgress; + + if (holeDifference > 0) + { + if (owner != null) + { + AchievementManager.progressAchievement(owner, holeCountAchievement, holeDifference); + } + else + { + AchievementManager.progressAchievement(this.getUserId(), holeCountAchievement, holeDifference); + } + } + } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java index 15eae350..76e3293f 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionCrackable.java @@ -20,6 +20,7 @@ import java.sql.SQLException; public class InteractionCrackable extends HabboItem { public boolean cracked = false; + protected int ticks = 0; private final Object lock = new Object(); public InteractionCrackable(ResultSet set, Item baseItem) throws SQLException @@ -102,26 +103,34 @@ public class InteractionCrackable extends HabboItem public void onTick(Habbo habbo, Room room) { + if (this.cracked) return; + if (this.allowAnyone() || this.getUserId() == habbo.getHabboInfo().getId()) { - this.setExtradata(Integer.valueOf(this.getExtradata()) + 1 + ""); + CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId()); + + if (rewardData.requiredEffect > 0 && habbo.getRoomUnit().getEffectId() != rewardData.requiredEffect) return; + + this.ticks++; + this.setExtradata("" + (this.ticks)); this.needsUpdate(true); room.updateItem(this); - CrackableReward rewardData = Emulator.getGameEnvironment().getItemManager().getCrackableData(this.getBaseItem().getId()); - - if (rewardData != null && !rewardData.achievementTick.isEmpty()) + if (rewardData != null) { - AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.achievementTick)); - } - if (!this.cracked && Integer.valueOf(this.getExtradata()) == Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())) - { - this.cracked = true; - Emulator.getThreading().run(new CrackableExplode(room, this, habbo, !this.placeInRoom()), 1500); - - if (rewardData != null && !rewardData.achievementCracked.isEmpty()) + if (!rewardData.achievementTick.isEmpty()) { - AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.achievementCracked)); + AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.achievementTick)); + } + if (!this.cracked && this.ticks == Emulator.getGameEnvironment().getItemManager().getCrackableCount(this.getBaseItem().getId())) + { + this.cracked = true; + Emulator.getThreading().run(new CrackableExplode(room, this, habbo, !this.placeInRoom(), this.getX(), this.getY()), 1500); + + if (!rewardData.achievementCracked.isEmpty()) + { + AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(rewardData.achievementCracked)); + } } } } @@ -163,6 +172,7 @@ public class InteractionCrackable extends HabboItem public void reset(Room room) { this.cracked = false; + this.ticks = 0; this.setExtradata("0"); room.updateItem(this); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java index c6523e25..ca09e65a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionDefault.java @@ -1,9 +1,11 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.bots.Bot; 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.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.rooms.RoomUnitType; import com.eu.habbo.habbohotel.users.Habbo; @@ -119,6 +121,24 @@ public class InteractionDefault extends HabboItem } } } + else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) + { + Bot bot = room.getBot(roomUnit); + + if (bot != null) + { + if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectM()) + { + room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectM()); + return; + } + if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0 && roomUnit.getEffectId() != this.getBaseItem().getEffectF()) + { + room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectF()); + return; + } + } + } } } } @@ -132,12 +152,27 @@ public class InteractionDefault extends HabboItem { if (this.getBaseItem().getEffectF() > 0 || this.getBaseItem().getEffectM() > 0) { + if (objects != null && objects.length == 2) + { + if (objects[0] instanceof RoomTile && objects[1] instanceof RoomTile) + { + RoomTile goalTile = (RoomTile) objects[1]; + HabboItem topItem = room.getTopItemAt(goalTile.x, goalTile.y); + + if (topItem != null && (topItem.getBaseItem().getEffectM() == this.getBaseItem().getEffectM() || topItem.getBaseItem().getEffectF() == this.getBaseItem().getEffectF())) + { + return; + } + } + } + if (roomUnit.getRoomUnitType().equals(RoomUnitType.USER)) { Habbo habbo = room.getHabbo(roomUnit); if (habbo != null) { + if (habbo.getHabboInfo().getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) { room.giveEffect(habbo, 0); @@ -151,6 +186,25 @@ public class InteractionDefault extends HabboItem } } } + else if (roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)) + { + Bot bot = room.getBot(roomUnit); + + if (bot != null) + { + if (bot.getGender().equals(HabboGender.M) && this.getBaseItem().getEffectM() > 0) + { + room.giveEffect(roomUnit, 0); + return; + } + + if (bot.getGender().equals(HabboGender.F) && this.getBaseItem().getEffectF() > 0) + { + room.giveEffect(roomUnit, 0); + return; + } + } + } } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java new file mode 100644 index 00000000..002e4711 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectGiver.java @@ -0,0 +1,63 @@ +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.RoomLayout; +import com.eu.habbo.habbohotel.rooms.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboItem; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionEffectGiver extends InteractionDefault +{ + public InteractionEffectGiver(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + public InteractionEffectGiver(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) + { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + @Override + public void onClick(GameClient client, Room room, Object[] objects) throws Exception + { + super.onClick(client, room, objects); + + if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentLocation(), room.getLayout().getTile(this.getX(), this.getY())) || + (client.getHabbo().getRoomUnit().getCurrentLocation().x == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().y == this.getY())) + { + this.handle(room, client.getHabbo().getRoomUnit()); + } + } + + protected void handle(Room room, RoomUnit roomUnit) + { + if (this.getExtradata().isEmpty()) this.setExtradata("0"); + + if (!this.getExtradata().equals("0")) return; + + HabboItem instance = this; + room.giveEffect(roomUnit, this.getBaseItem().getRandomVendingItem()); + + if (this.getBaseItem().getStateCount() > 1) + { + this.setExtradata("1"); + room.updateItem(this); + + Emulator.getThreading().run(new Runnable() + { + @Override + public void run() + { + setExtradata("0"); + room.updateItem(instance); + } + }, 500); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java index 56798478..3b70a62a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectTile.java @@ -1,8 +1,10 @@ package com.eu.habbo.habbohotel.items.interactions; +import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomUnit; +import com.eu.habbo.habbohotel.rooms.RoomUnitType; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboGender; @@ -49,14 +51,35 @@ public class InteractionEffectTile extends InteractionPressurePlate public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { super.onWalkOn(roomUnit, room, objects); - Habbo habbo = room.getHabbo(roomUnit); - if (habbo.getHabboInfo().getGender().equals(HabboGender.M)) + if (roomUnit.getRoomUnitType() == RoomUnitType.USER) { - room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectM()); + Habbo habbo = room.getHabbo(roomUnit); + + if (habbo != null) + { + giveEffect(room, roomUnit, habbo.getHabboInfo().getGender()); + } + } + else if (roomUnit.getRoomUnitType() == RoomUnitType.BOT) + { + Bot bot = room.getBot(roomUnit); + + if (bot != null) + { + giveEffect(room, roomUnit, bot.getGender()); + } + } + } + + private void giveEffect(Room room, RoomUnit roomUnit, HabboGender gender) + { + if (gender.equals(HabboGender.M)) + { + room.giveEffect(roomUnit, this.getBaseItem().getEffectM()); } else { - room.giveEffect(habbo.getRoomUnit(), this.getBaseItem().getEffectF()); + room.giveEffect(roomUnit, this.getBaseItem().getEffectF()); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java new file mode 100644 index 00000000..9c8f8825 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionEffectVendingMachine.java @@ -0,0 +1,89 @@ +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.RoomTile; +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.outgoing.rooms.items.FloorItemUpdateComposer; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; +import com.eu.habbo.threading.runnables.RoomUnitVendingMachineAction; +import com.eu.habbo.util.pathfinding.Rotation; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionEffectVendingMachine extends InteractionDefault +{ + public InteractionEffectVendingMachine(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + this.setExtradata("0"); + } + + public InteractionEffectVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) + { + super(id, userId, item, extradata, limitedStack, limitedSells); + this.setExtradata("0"); + } + + @Override + public void onClick(GameClient client, Room room, Object[] objects) throws Exception + { + super.onClick(client, room, objects); + + if (client != null) + { + RoomTile tile = getSquareInFront(room.getLayout(), this); + + if (tile != null) + { + if (tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) + { + if (this.getExtradata().equals("0") || this.getExtradata().length() == 0) + { + room.updateHabbo(client.getHabbo()); + 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().removeStatus(RoomUnitStatus.MOVE); + room.scheduledComposers.add(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose()); + } + this.setExtradata("1"); + room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); + Emulator.getThreading().run(this, 1000); + HabboItem instance = this; + Emulator.getThreading().run(new Runnable() + { + @Override + public void run() + { + room.giveEffect(client.getHabbo().getRoomUnit(), instance.getBaseItem().getRandomVendingItem()); + } + }); + } + } + else + { + if (!tile.isWalkable()) + { + for (RoomTile t : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) + { + if (t != null && t.isWalkable()) + { + tile = t; + break; + } + } + } + client.getHabbo().getRoomUnit().setGoalLocation(tile); + Emulator.getThreading().run(new RoomUnitVendingMachineAction(client.getHabbo(), this, room), client.getHabbo().getRoomUnit().getPath().size() + 2 * 510); + } + } + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java index a2696b3c..127286fc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionExternalImage.java @@ -54,5 +54,5 @@ public class InteractionExternalImage extends HabboItem { } - //{"t":10000000, "u":"http://arcturus.wf/camera/", "m":"idk", "s":1, "w":"http://arcturus.wf/camera/image.png"} + //{"t":10000000, "u":"http://arcturus.pw/camera/", "m":"idk", "s":1, "w":"http://arcturus.pw/camera/image.png"} } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java index 6abd167f..57bceec2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGate.java @@ -47,10 +47,11 @@ public class InteractionGate extends HabboItem { super.onClick(client, room, objects); - if (client != null && !room.hasRights(client.getHabbo()) && !(objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE)) + boolean isWired = (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE); + if (client != null && !room.hasRights(client.getHabbo()) && !isWired) return; - if(!room.getHabbosAt(this.getX(), this.getY()).isEmpty()) + if(!isWired && !room.getHabbosAt(this.getX(), this.getY()).isEmpty()) return; if(this.getExtradata().length() == 0) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java new file mode 100644 index 00000000..6e063f05 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionGymEquipment.java @@ -0,0 +1,191 @@ +package com.eu.habbo.habbohotel.items.interactions; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.achievements.AchievementManager; +import com.eu.habbo.habbohotel.bots.Bot; +import com.eu.habbo.habbohotel.items.ICycleable; +import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.rooms.*; +import com.eu.habbo.habbohotel.users.Habbo; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionGymEquipment extends InteractionEffectTile implements ICycleable +{ + private int startTime = 0; + private int roomUnitId = -1; + + public InteractionGymEquipment(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + public InteractionGymEquipment(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) + { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + @Override + public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) + { + return this.roomUnitId == -1 && super.canWalkOn(roomUnit, room, objects) && (roomUnit.getRoomUnitType().equals(RoomUnitType.USER) || roomUnit.getRoomUnitType().equals(RoomUnitType.BOT)); + } + + @Override + public boolean isWalkable() + { + return this.roomUnitId == -1; + } + + @Override + public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception + { + super.onWalkOn(roomUnit, room, objects); + + if (this.forceRotation()) + { + roomUnit.setRotation(RoomUserRotation.fromValue(this.getRotation())); + roomUnit.canRotate = false; + } + this.roomUnitId = roomUnit.getId(); + + if (roomUnit.getRoomUnitType() == RoomUnitType.USER) + { + Habbo habbo = room.getHabbo(roomUnit); + + if (habbo != null) + { + this.startTime = Emulator.getIntUnixTimestamp(); + } + } + } + + @Override + public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception + { + super.onWalkOff(roomUnit, room, objects); + room.giveEffect(roomUnit, 0); + + if (this.forceRotation()) + { + roomUnit.canRotate = true; + } + + this.reset(room); + } + + public String achievementName() + { + return Emulator.getConfig().getValue("hotel.furni.gym.achievement." + this.getBaseItem().getName(), ""); + } + + public boolean forceRotation() + { + return Emulator.getConfig().getBoolean("hotel.furni.gym.forcerot." + this.getBaseItem().getName(), true); + } + + @Override + public void cycle(Room room) + { + if (this.roomUnitId != -1) + { + Habbo habbo = room.getHabboByRoomUnitId(this.roomUnitId); + + if (habbo != null) + { + int timestamp = Emulator.getIntUnixTimestamp(); + if (timestamp - this.startTime >= 120) + { + String achievement = achievementName(); + + if (!achievement.isEmpty()) + { + AchievementManager.progressAchievement(habbo.getHabboInfo().getId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement(achievement)); + } + + this.startTime = timestamp; + } + } + } + } + + @Override + public void setRotation(int rotation) + { + super.setRotation(rotation); + + if (this.forceRotation() && this.roomUnitId != -1) + { + Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); + if (room != null) + { + RoomUnit roomUnit = getCurrentRoomUnit(room); + + if (roomUnit != null) + { + roomUnit.setRotation(RoomUserRotation.fromValue(rotation)); + room.updateRoomUnit(roomUnit); + } + } + } + } + + @Override + public void onPickUp(Room room) + { + super.onPickUp(room); + + if (this.roomUnitId != -1) + { + this.setEffect(room, 0); + } + + this.reset(room); + } + + @Override + public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) + { + super.onMove(room, oldLocation, newLocation); + if (!oldLocation.equals(newLocation)) + { + this.setEffect(room, 0); + this.reset(room); + } + } + + private void setEffect(Room room, int effectId) + { + if (this.roomUnitId == -1) return; + + room.giveEffect(getCurrentRoomUnit(room), effectId); + } + + private void reset(Room room) + { + this.roomUnitId = -1; + this.startTime = 0; + this.setExtradata("0"); + room.updateItem(this); + } + + private RoomUnit getCurrentRoomUnit(Room room) + { + Habbo habbo = room.getHabboByRoomUnitId(this.roomUnitId); + if (habbo != null) + { + return habbo.getRoomUnit(); + } + else + { + Bot bot = room.getBotByRoomUnitId(this.roomUnitId); + if (bot != null) + { + return bot.getRoomUnit(); + } + } + + return null; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java new file mode 100644 index 00000000..713e269c --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditem.java @@ -0,0 +1,63 @@ +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.RoomLayout; +import com.eu.habbo.habbohotel.rooms.RoomUnit; +import com.eu.habbo.habbohotel.users.HabboItem; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionHanditem extends InteractionDefault +{ + public InteractionHanditem(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + public InteractionHanditem(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) + { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + @Override + public void onClick(GameClient client, Room room, Object[] objects) throws Exception + { + super.onClick(client, room, objects); + + if (RoomLayout.tilesAdjecent(client.getHabbo().getRoomUnit().getCurrentLocation(), room.getLayout().getTile(this.getX(), this.getY())) || + (client.getHabbo().getRoomUnit().getCurrentLocation().x == this.getX() && client.getHabbo().getRoomUnit().getCurrentLocation().y == this.getY())) + { + this.handle(room, client.getHabbo().getRoomUnit()); + } + } + + protected void handle(Room room, RoomUnit roomUnit) + { + if (this.getExtradata().isEmpty()) this.setExtradata("0"); + + if (!this.getExtradata().equals("0")) return; + + HabboItem instance = this; + room.giveHandItem(roomUnit, this.getBaseItem().getRandomVendingItem()); + + if (this.getBaseItem().getStateCount() > 1) + { + this.setExtradata("1"); + room.updateItem(this); + + Emulator.getThreading().run(new Runnable() + { + @Override + public void run() + { + setExtradata("0"); + room.updateItem(instance); + } + }, 500); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java new file mode 100644 index 00000000..0f7ee8b8 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionHanditemTile.java @@ -0,0 +1,39 @@ +package com.eu.habbo.habbohotel.items.interactions; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomUnit; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionHanditemTile extends InteractionHanditem +{ + public InteractionHanditemTile(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + public InteractionHanditemTile(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) + { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + @Override + public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception + { + InteractionHanditemTile instance = this; + Emulator.getThreading().run(new Runnable() + { + @Override + public void run() + { + if (roomUnit.getCurrentLocation().x == instance.getX() && roomUnit.getCurrentLocation().y == instance.getY()) + { + instance.handle(room, roomUnit); + } + } + }, 3000); + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java index 5ed9c405..f9465fc8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionInformationTerminal.java @@ -11,7 +11,7 @@ public class InteractionInformationTerminal extends InteractionCustomValues { public static THashMap defaultValues = new THashMap() { - {put("internalLink", "http://arcturus.wf");} + {put("internalLink", "http://arcturus.pw");} }; public InteractionInformationTerminal(ResultSet set, Item baseItem) throws SQLException diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java new file mode 100644 index 00000000..8ea6e5c7 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMonsterCrackable.java @@ -0,0 +1,79 @@ +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.ICycleable; +import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomTile; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionMonsterCrackable extends InteractionCrackable implements ICycleable +{ + private int lastHealthChange = 0; + private boolean respawn = false; + public InteractionMonsterCrackable(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + public InteractionMonsterCrackable(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) + { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + @Override + public void cycle(Room room) + { + if (this.ticks > 0 && Emulator.getIntUnixTimestamp() - lastHealthChange > 30) + { + lastHealthChange = Emulator.getIntUnixTimestamp(); + this.ticks--; + room.updateItem(this); + } + } + + @Override + public void onClick(GameClient client, Room room, Object[] objects) throws Exception + { + if (room.isPublicRoom()) respawn = true; + + super.onClick(client, room, objects); + } + + @Override + public boolean resetable() + { + return this.respawn; + } + + @Override + public void reset(Room room) + { + RoomTile tile = room.getRandomWalkableTile(); + this.setX(tile.x); + this.setY(tile.y); + this.setZ(room.getStackHeight(tile.x, tile.y, false)); + super.reset(room); + } + + @Override + public boolean allowAnyone() + { + return this.respawn; + } + + @Override + public boolean isUsable() + { + return true; + } + + @Override + protected boolean placeInRoom() + { + return this.respawn; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java index 79db227d..e6b9c062 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMultiHeight.java @@ -11,7 +11,6 @@ import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.rooms.UpdateStackHeightComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; import gnu.trove.set.hash.THashSet; @@ -77,7 +76,7 @@ public class InteractionMultiHeight extends HabboItem this.needsUpdate(true); room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())); room.updateItemState(this); - room.sendComposer(new UpdateStackHeightComposer(this.getX(), this.getY(), this.getBaseItem().getMultiHeights()[Integer.valueOf(this.getExtradata())] * 256.0D).compose()); + //room.sendComposer(new UpdateStackHeightComposer(this.getX(), this.getY(), this.getBaseItem().getMultiHeights()[Integer.valueOf(this.getExtradata())] * 256.0D).compose()); } if(this.isWalkable()) @@ -100,7 +99,7 @@ public class InteractionMultiHeight extends HabboItem } else { - habbo.getRoomUnit().setZ(this.getZ() + this.getBaseItem().getMultiHeights()[(this.getExtradata().isEmpty() ? 0 : Integer.valueOf(this.getExtradata()) % (this.getBaseItem().getMultiHeights().length))]); + habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight()); habbo.getRoomUnit().setPreviousLocationZ(habbo.getRoomUnit().getZ()); } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPetBreedingNest.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPetBreedingNest.java index 7cd7a057..361b2c5d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPetBreedingNest.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPetBreedingNest.java @@ -1,13 +1,20 @@ package com.eu.habbo.habbohotel.items.interactions; +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.pets.Pet; +import com.eu.habbo.habbohotel.pets.PetManager; +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.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.rooms.pets.PetPackageNameValidationComposer; +import com.eu.habbo.messages.outgoing.rooms.pets.breeding.PetBreedingCompleted; import com.eu.habbo.messages.outgoing.rooms.pets.breeding.PetBreedingResultComposer; +import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; import java.sql.ResultSet; import java.sql.SQLException; @@ -68,12 +75,14 @@ public class InteractionPetBreedingNest extends HabboItem if (boxFull()) { - Habbo ownerPetOne = room.getHabbo(petOne.getUserId()); - Habbo ownerPetTwo = room.getHabbo(petTwo.getUserId()); + Habbo ownerPetOne = room.getHabbo(this.petOne.getUserId()); + Habbo ownerPetTwo = room.getHabbo(this.petTwo.getUserId()); - if (ownerPetOne != null && ownerPetTwo != null) + if (ownerPetOne != null && ownerPetTwo != null && this.petOne.getPetData().getType() == this.petTwo.getPetData().getType() && this.petOne.getPetData().getOffspringType() != -1) { - ownerPetTwo.getClient().sendResponse(new PetBreedingResultComposer(0, this.petOne, ownerPetOne.getHabboInfo().getUsername(), this.petTwo, ownerPetTwo.getHabboInfo().getUsername())); + ownerPetTwo.getClient().sendResponse(new PetBreedingResultComposer(this.getId(), this.petOne.getPetData().getOffspringType(), this.petOne, ownerPetOne.getHabboInfo().getUsername(), this.petTwo, ownerPetTwo.getHabboInfo().getUsername())); + this.setExtradata("1"); + room.updateItem(this); } } } @@ -85,11 +94,13 @@ public class InteractionPetBreedingNest extends HabboItem if (this.petOne == null) { this.petOne = pet; + this.petOne.getRoomUnit().setCanWalk(false); return true; } else if (this.petTwo == null && this.petOne != pet) { this.petTwo = pet; + this.petTwo.getRoomUnit().setCanWalk(false); return true; } @@ -101,9 +112,94 @@ public class InteractionPetBreedingNest extends HabboItem return this.petOne != null && this.petTwo != null; } + @Override + public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception + { + if (this.petOne != null && this.petOne.getRoomUnit() == roomUnit) this.petOne = null; + if (this.petTwo != null && this.petTwo.getRoomUnit() == roomUnit) this.petTwo = null; + + this.setExtradata("0"); + room.updateItem(this); + } + @Override public boolean allowWiredResetState() { return false; } + + public void stopBreeding(Habbo habbo) + { + this.setExtradata("0"); + habbo.getHabboInfo().getCurrentRoom().updateItem(this); + + if (this.petOne != null) + { + habbo.getClient().sendResponse(new PetPackageNameValidationComposer(this.getId(), PetPackageNameValidationComposer.CLOSE_WIDGET, "")); + } + if (this.petTwo.getUserId() != habbo.getHabboInfo().getId()) + { + Habbo owner = this.petTwo.getRoom().getHabbo(this.petTwo.getUserId()); + if (owner != null) + { + owner.getClient().sendResponse(new PetPackageNameValidationComposer(this.getId(), PetPackageNameValidationComposer.CLOSE_WIDGET, "")); + } + } + + this.freePets(); + + } + + private void freePets() + { + if (this.petOne != null) + { + this.petOne.getRoomUnit().setCanWalk(true); + this.petOne.setTask(PetTasks.FREE); + this.petOne = null; + } + + if (this.petTwo != null) + { + this.petTwo.getRoomUnit().setCanWalk(true); + this.petTwo.setTask(PetTasks.FREE); + this.petTwo = null; + } + } + + public void breed(Habbo habbo, String name, int petOneId, int petTwoId) + { + Emulator.getThreading().run(new QueryDeleteHabboItem(this)); + + this.setExtradata("2"); + habbo.getHabboInfo().getCurrentRoom().updateItem(this); + + HabboItem box = this; + Pet petOne = this.petOne; + Pet petTwo = this.petTwo; + Emulator.getThreading().run(new Runnable() + { + @Override + public void run() + { + Pet offspring = Emulator.getGameEnvironment().getPetManager().createPet(petOne.getPetData().getOffspringType(), (int) Math.min(Math.round(Math.max(1d, PetManager.getNormalDistributionForBreeding(petOne.getLevel(), petTwo.getLevel()).sample())), 20), name, habbo.getClient()); + + //habbo.getClient().sendResponse(new PetPackageNameValidationComposer(box.getId(), PetPackageNameValidationComposer.CLOSE_WIDGET, "")); + habbo.getHabboInfo().getCurrentRoom().placePet(offspring, box.getX(), box.getY(), box.getZ(), box.getRotation()); + offspring.needsUpdate = true; + offspring.run(); + freePets(); + habbo.getHabboInfo().getCurrentRoom().removeHabboItem(box); + habbo.getClient().sendResponse(new PetBreedingCompleted(offspring.getId(), Emulator.getGameEnvironment().getPetManager().getRarityForOffspring(offspring))); + + if (box.getBaseItem().getName().startsWith("pet_breeding_")) + { + String boxType = box.getBaseItem().getName().replace("pet_breeding_", ""); + String achievement = boxType.substring(0, 1).toUpperCase() + boxType.substring(1) + "Breeder"; + AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement(achievement)); + } + } + }, 2000); + + } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java index 016e1450..4e387760 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionPressurePlate.java @@ -90,8 +90,13 @@ public class InteractionPressurePlate extends HabboItem @Override public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) { - this.setExtradata("0"); - room.updateItemState(this); + super.onMove(room, oldLocation, newLocation); + + if (oldLocation != newLocation && oldLocation.getStackHeight() != newLocation.getStackHeight() && !room.hasHabbosAt(newLocation.x, newLocation.y)) + { + this.setExtradata("0"); + room.updateItemState(this); + } } @Override @@ -99,4 +104,6 @@ public class InteractionPressurePlate extends HabboItem { return true; } + + } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java index f9698b63..dcdab8a3 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoller.java @@ -3,12 +3,16 @@ 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.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; +import gnu.trove.set.hash.THashSet; +import org.apache.commons.math3.util.Pair; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.List; public class InteractionRoller extends HabboItem { @@ -66,4 +70,28 @@ public class InteractionRoller extends HabboItem { super.onWalkOff(roomUnit, room, objects); } + + + @Override + public boolean canStackAt(Room room, List>> itemsAtLocation) + { + if (itemsAtLocation.isEmpty()) return false; + + for (Pair> set : itemsAtLocation) + { + if (!set.getValue().isEmpty()) + { + if (set.getValue().size() > 1) + { + return false; + } + else if (!set.getValue().contains(this)) + { + return false; + } + } + } + + return true; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java index 861bcc15..54f38ae0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionRoomAds.java @@ -12,8 +12,8 @@ public class InteractionRoomAds extends InteractionCustomValues { public final static THashMap defaultValues = new THashMap() { - {put("imageUrl", "http://arcturus.wf/ads_background.png");} - {put("clickUrl", "http://arcturus.wf");} + {put("imageUrl", "http://arcturus.pw/ads_background.png");} + {put("clickUrl", "http://arcturus.pw");} {put("offsetX", "0");} {put("offsetY", "0");} {put("offsetZ", "0");} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java new file mode 100644 index 00000000..f531baf8 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSnowboardSlope.java @@ -0,0 +1,104 @@ +package com.eu.habbo.habbohotel.items.interactions; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.achievements.Achievement; +import com.eu.habbo.habbohotel.achievements.AchievementManager; +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.users.Habbo; +import com.eu.habbo.habbohotel.users.HabboItem; +import gnu.trove.set.hash.THashSet; + +import java.awt.*; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class InteractionSnowboardSlope extends InteractionMultiHeight +{ + public InteractionSnowboardSlope(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) + { + super(id, userId, item, extradata, limitedStack, limitedSells); + } + + public InteractionSnowboardSlope(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + @Override + public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception + { + room.giveEffect(roomUnit, 97); + } + + @Override + public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception + { + super.onWalkOff(roomUnit, room, objects); + + if (roomUnit.getEffectId() == 97) + { + room.giveEffect(roomUnit, 0); + } + } + + @Override + public void onPlace(Room room) + { + super.onPlace(room); + THashSet items = room.getRoomSpecialTypes().getItemsOfType(InteractionSnowboardSlope.class); + + Achievement snowboardBuild = Emulator.getGameEnvironment().getAchievementManager().getAchievement("snowBoardBuild"); + + if (snowboardBuild == null) return; + int progress = 0; + Habbo habbo = room.getHabbo(room.getOwnerId()); + + if (habbo != null) + { + progress = habbo.getHabboStats().getAchievementProgress(snowboardBuild); + + + } + else + { + progress = AchievementManager.getAchievementProgressForHabbo(room.getOwnerId(), snowboardBuild); + } + + progress = Math.max(items.size() - progress, 0); + + if (progress > 0) + { + AchievementManager.progressAchievement(room.getOwnerId(), snowboardBuild); + } + } + + @Override + public void onPickUp(Room room) + { + for (Habbo habbo : room.getHabbosOnItem(this)) + { + if (habbo.getRoomUnit().getEffectId() == 97) + { + room.giveEffect(habbo, 0); + } + } + } + + @Override + public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) + { + Rectangle newRect = RoomLayout.getRectangle(newLocation.x, newLocation.y, this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); + + for (Habbo habbo : room.getHabbosOnItem(this)) + { + if (habbo.getRoomUnit().getEffectId() == 97 && !newRect.contains(habbo.getRoomUnit().getCurrentLocation().x, habbo.getRoomUnit().getCurrentLocation().y)) + { + room.giveEffect(habbo, 0); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java index 135e565a..53b8c623 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionStackHelper.java @@ -24,13 +24,13 @@ public class InteractionStackHelper extends HabboItem @Override public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) { - return true; + return false; } @Override public boolean isWalkable() { - return true; + return false; } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java index 93c5fd5a..5a82e972 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionSwitch.java @@ -1,8 +1,10 @@ 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.users.Habbo; import java.sql.ResultSet; @@ -37,4 +39,27 @@ public class InteractionSwitch extends InteractionDefault { return true; } + + @Override + public void onClick(GameClient client, Room room, Object[] objects) throws Exception + { + if (!this.canToggle(client.getHabbo(), room)) + { + RoomTile closestTile = null; + for (RoomTile tile : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) + { + if (tile.isWalkable() && (closestTile == null || closestTile.distance(client.getHabbo().getRoomUnit().getCurrentLocation()) > tile.distance(client.getHabbo().getRoomUnit().getCurrentLocation()))) + { + closestTile = client.getHabbo().getRoomUnit().getCurrentLocation(); + } + } + + if (closestTile != null) + { + client.getHabbo().getRoomUnit().setGoalLocation(closestTile); + } + } + + super.onClick(client, room, objects); + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java index aa27e652..4b68bbb2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionTeleport.java @@ -79,7 +79,7 @@ public class InteractionTeleport extends HabboItem }); } } - else if (teleportPosition.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) + else if (teleportPosition.equals(client.getHabbo().getRoomUnit().getCurrentLocation()) && tile != null && tile.isWalkable()) { startTeleport(room, client.getHabbo()); } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java index 897281c2..dcd24dfe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionVendingMachine.java @@ -4,6 +4,7 @@ import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.rooms.*; +import com.eu.habbo.habbohotel.users.HabboGender; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer; @@ -20,11 +21,13 @@ public class InteractionVendingMachine extends HabboItem public InteractionVendingMachine(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); + this.setExtradata("0"); } public InteractionVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { super(id, userId, item, extradata, limitedStack, limitedSells); + this.setExtradata("0"); } @Override @@ -65,11 +68,14 @@ public class InteractionVendingMachine extends HabboItem room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose()); Emulator.getThreading().run(this, 1000); Emulator.getThreading().run(new RoomUnitGiveHanditem(client.getHabbo().getRoomUnit(), room, this.getBaseItem().getRandomVendingItem())); + + if (this.getBaseItem().getEffectM() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.M) room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM()); + if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F) room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF()); } } else { - if (!tile.isWalkable()) + if (!tile.isWalkable() && tile.state != RoomTileState.SIT && tile.state != RoomTileState.LAY) { for (RoomTile t : room.getLayout().getTilesAround(room.getLayout().getTile(this.getX(), this.getY()))) { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java index 046b684e..957aebfe 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWater.java @@ -1,18 +1,23 @@ package com.eu.habbo.habbohotel.items.interactions; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; 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.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import gnu.trove.list.array.TIntArrayList; import gnu.trove.map.hash.THashMap; +import gnu.trove.set.hash.THashSet; +import org.apache.commons.math3.util.Pair; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.List; public class InteractionWater extends InteractionDefault { @@ -36,6 +41,28 @@ public class InteractionWater extends InteractionDefault public void onPickUp(Room room) { this.recalculate(room); + + Object[] empty = new Object[]{}; + for (Habbo habbo : room.getHabbosOnItem(this)) + { + try + { + this.onWalkOff(habbo.getRoomUnit(), room, empty); + } catch (Exception e) + { + + } + } + + for (Bot bot : room.getBotsOnItem(this)) + { + try + { + this.onWalkOff(bot.getRoomUnit(), room, empty); + } + catch (Exception e) + {} + } } @Override @@ -69,27 +96,46 @@ public class InteractionWater extends InteractionDefault ((InteractionWaterItem) item).update(); } - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() - 1)) _1 = 1; - if (room.waterTiles.containsKey(this.getX() ) && room.waterTiles.get(this.getX() ).contains(this.getY() - 1)) _2 = 1; - if (room.waterTiles.containsKey(this.getX() + 1) && room.waterTiles.get(this.getX() + 1).contains(this.getY() - 1)) _3 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() - 1)) _4 = 1; - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() )) _5 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() )) _6 = 1; - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() + 1)) _7 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() + 1)) _8 = 1; - if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() + 2)) _9 = 1; - if (room.waterTiles.containsKey(this.getX() ) && room.waterTiles.get(this.getX() ).contains(this.getY() + 2)) _10 = 1; - if (room.waterTiles.containsKey(this.getX() + 1) && room.waterTiles.get(this.getX() + 1).contains(this.getY() + 2)) _11 = 1; - if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() + 2)) _12 = 1; + if (!this.getBaseItem().getName().equalsIgnoreCase("bw_water_2")) + { + if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() - 1)) + _1 = 1; + if (room.waterTiles.containsKey(this.getX()) && room.waterTiles.get(this.getX()).contains(this.getY() - 1)) + _2 = 1; + if (room.waterTiles.containsKey(this.getX() + 1) && room.waterTiles.get(this.getX() + 1).contains(this.getY() - 1)) + _3 = 1; + if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() - 1)) + _4 = 1; + if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY())) + _5 = 1; + if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY())) + _6 = 1; + if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() + 1)) + _7 = 1; + if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() + 1)) + _8 = 1; + if (room.waterTiles.containsKey(this.getX() - 1) && room.waterTiles.get(this.getX() - 1).contains(this.getY() + 2)) + _9 = 1; + if (room.waterTiles.containsKey(this.getX()) && room.waterTiles.get(this.getX()).contains(this.getY() + 2)) + _10 = 1; + if (room.waterTiles.containsKey(this.getX() + 1) && room.waterTiles.get(this.getX() + 1).contains(this.getY() + 2)) + _11 = 1; + if (room.waterTiles.containsKey(this.getX() + 2) && room.waterTiles.get(this.getX() + 2).contains(this.getY() + 2)) + _12 = 1; + } - if (_2 == 0 && !room.getLayout().tileWalkable(this.getX() , (short) (this.getY() - 1))) _2 = 1; - if (_3 == 0 && !room.getLayout().tileWalkable((short) (this.getX() + 1), (short) (this.getY() - 1))) _3 = 1; - if (_5 == 0 && !room.getLayout().tileWalkable((short) (this.getX() - 1), this.getY() )) _5 = 1; - if (_6 == 0 && !room.getLayout().tileWalkable((short) (this.getX() + 2), this.getY() )) _6 = 1; - if (_7 == 0 && !room.getLayout().tileWalkable((short) (this.getX() - 1), (short) (this.getY() + 1))) _7 = 1; - if (_8 == 0 && !room.getLayout().tileWalkable((short) (this.getX() + 2), (short) (this.getY() + 1))) _8 = 1; - if (_10 == 0 && !room.getLayout().tileWalkable(this.getX() , (short) (this.getY() + 2))) _10 = 1; - if (_11 == 0 && !room.getLayout().tileWalkable((short) (this.getX() + 1), (short) (this.getY() + 2))) _11 = 1; + //if (_1 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() -1))) _1 = 1; + if (_2 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() - 1))) _2 = 1; + if (_3 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() - 1))) _3 = 1; + //if (_4 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() - 1))) _4 = 1; + if (_5 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), this.getY())) _5 = 1; + if (_6 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), this.getY())) _6 = 1; + if (_7 == 0 && room.getLayout().isVoidTile((short) (this.getX() - 1), (short) (this.getY() + 1))) _7 = 1; + if (_8 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 1))) _8 = 1; + //if (_9 == 0 && room.getLayout().isVoidTile((short)(this.getX() -1), (short) (this.getY() + 2))) _9 = 1; + if (_10 == 0 && room.getLayout().isVoidTile(this.getX(), (short) (this.getY() + 2))) _10 = 1; + if (_11 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 1), (short) (this.getY() + 2))) _11 = 1; + //if (_12 == 0 && room.getLayout().isVoidTile((short) (this.getX() + 2), (short) (this.getY() + 2))) _12 = 1; int result = 0; result |= _1 << 11; @@ -157,4 +203,27 @@ public class InteractionWater extends InteractionDefault { return false; } + + @Override + public boolean canToggle(Habbo habbo, Room room) + { + return false; + } + + @Override + public boolean canStackAt(Room room, List>> itemsAtLocation) + { + for (Pair> set : itemsAtLocation) + { + for (HabboItem item : set.getValue()) + { + if (!(item instanceof InteractionWater)) + { + return false; + } + } + } + + return super.canStackAt(room, itemsAtLocation); + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java index 9a73e86f..cae6d5ba 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWaterItem.java @@ -5,6 +5,7 @@ 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.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import gnu.trove.set.hash.THashSet; @@ -52,25 +53,40 @@ public class InteractionWaterItem extends InteractionDefault Rectangle rectangle = RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()); - for(int x = rectangle.x; x < rectangle.getWidth() + rectangle.x; x++) + boolean foundWater = true; + for(short x = (short)rectangle.x; x < rectangle.getWidth() + rectangle.x && foundWater; x++) { - for(int y = rectangle.y; y < rectangle.getHeight() + rectangle.y; y++) + for(short y = (short)rectangle.y; y < rectangle.getHeight() + rectangle.y && foundWater; y++) { - THashSet items = room.getItemsAt(room.getLayout().getTile(this.getX(), this.getY())); + boolean tile = false; + THashSet items = room.getItemsAt(room.getLayout().getTile(x, y)); for(HabboItem item : items) { - if(item instanceof InteractionWater) + if (item instanceof InteractionWater) { - this.setExtradata("1"); - room.updateItem(this); - return; + tile = true; + break; } } + + if (!tile) + { + foundWater = false; + } } } + if (foundWater) + { + this.setExtradata("1"); + this.needsUpdate(true); + room.updateItem(this); + return; + } + this.setExtradata("0"); + this.needsUpdate(true); room.updateItem(this); } @@ -79,4 +95,10 @@ public class InteractionWaterItem extends InteractionDefault { return false; } + + @Override + public boolean canToggle(Habbo habbo, Room room) + { + return false; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java index 61d2fb05..fa2f2872 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWired.java @@ -118,11 +118,13 @@ public abstract class InteractionWired extends HabboItem { return false; } - - this.cooldown = newMillis; return true; } + public void setCooldown(long newMillis) + { + this.cooldown = newMillis; + } @Override public boolean allowWiredResetState() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java index 6fd30412..dd1241d9 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionWiredCondition.java @@ -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.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.outgoing.wired.WiredConditionDataComposer; @@ -70,4 +71,9 @@ public abstract class InteractionWiredCondition extends InteractionWired public abstract boolean saveData(ClientMessage packet); + public WiredConditionOperator operator() + { + return WiredConditionOperator.AND; + } + } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java index a676cd45..ce52f5e1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/battlebanzai/InteractionBattleBanzaiTile.java @@ -41,7 +41,7 @@ public class InteractionBattleBanzaiTile extends HabboItem @Override public boolean isWalkable() { - return false; + return true; } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java index f7442f3e..c9417e04 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionFurniHaveHabbo.java @@ -1,9 +1,12 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; +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.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; @@ -11,17 +14,20 @@ import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; +import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Collection; +import java.util.Map; public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition { public static final WiredConditionType type = WiredConditionType.FURNI_HAVE_HABBO; - private boolean all; - private THashSet items; + protected boolean all; + protected THashSet items; public WiredConditionFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException { @@ -50,14 +56,50 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition if(this.items.isEmpty()) return true; + THashMap> tiles = new THashMap<>(); for(HabboItem item : this.items) { - THashSet habbos = room.getHabbosOnItem(item); + tiles.put(item, room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + } - if(habbos.isEmpty()) + Collection habbos = room.getHabbos(); + Collection bots = room.getCurrentBots().valueCollection(); + Collection pets = room.getCurrentPets().valueCollection(); + + for (Map.Entry> set : tiles.entrySet()) + { + boolean found = false; + for (Habbo habbo : habbos) { - return false; + if (set.getValue().contains(habbo.getRoomUnit().getCurrentLocation())) + { + found = true; + } } + + if (!found) + { + for (Bot bot : bots) + { + if (set.getValue().contains(bot.getRoomUnit().getCurrentLocation())) + { + found = true; + } + } + } + + if (!found) + { + for (Pet pet : pets) + { + if (set.getValue().contains(pet.getRoomUnit().getCurrentLocation())) + { + found = true; + } + } + } + + if (!found) return false; } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java index 21620097..0af8f0a2 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboHasRank.java @@ -4,6 +4,7 @@ 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.wired.WiredConditionOperator; import java.sql.ResultSet; import java.sql.SQLException; @@ -29,7 +30,7 @@ public class WiredConditionHabboHasRank extends WiredConditionHabboWearsBadge { try { - return habbo.getHabboInfo().getRank().getId() >= Integer.valueOf(this.badge); + return habbo.getHabboInfo().getRank().getId() == Integer.valueOf(this.badge); } catch (Exception e) { @@ -39,4 +40,10 @@ public class WiredConditionHabboHasRank extends WiredConditionHabboWearsBadge return false; } + + @Override + public WiredConditionOperator operator() + { + return WiredConditionOperator.OR; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java index edabdf21..718de140 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionHabboNotRank.java @@ -4,6 +4,7 @@ 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.wired.WiredConditionOperator; import java.sql.ResultSet; import java.sql.SQLException; @@ -29,7 +30,7 @@ public class WiredConditionHabboNotRank extends WiredConditionHabboWearsBadge { try { - return habbo.getHabboInfo().getRank().getId() < Integer.valueOf(this.badge); + return habbo.getHabboInfo().getRank().getId() != Integer.valueOf(this.badge); } catch (Exception e) { @@ -39,4 +40,10 @@ public class WiredConditionHabboNotRank extends WiredConditionHabboWearsBadge return false; } + + @Override + public WiredConditionOperator operator() + { + return WiredConditionOperator.OR; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java index ba456573..33a97a7c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMatchStatePosition.java @@ -97,7 +97,7 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition HabboItem item = room.getHabboItem(itemId); if (item != null) - this.settings.add(new WiredMatchFurniSetting(item.getId(), item.getExtradata(), item.getRotation(), item.getX(), item.getY(), item.getZ())); + this.settings.add(new WiredMatchFurniSetting(item.getId(), item.getExtradata(), item.getRotation(), item.getX(), item.getY())); } return true; @@ -125,7 +125,7 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition if(this.position) { - if(!(setting.x == item.getX() && setting.y == item.getY() && setting.z == item.getZ())) + if(!(setting.x == item.getX() && setting.y == item.getY())) return false; } @@ -185,8 +185,8 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition { String[] stuff = items[i].split("-"); - if(stuff.length == 6) - this.settings.add(new WiredMatchFurniSetting(Integer.valueOf(stuff[0]), stuff[1], Integer.valueOf(stuff[2]), Integer.valueOf(stuff[3]), Integer.valueOf(stuff[4]), Double.valueOf(stuff[5]))); + if(stuff.length >= 5) + this.settings.add(new WiredMatchFurniSetting(Integer.valueOf(stuff[0]), stuff[1], Integer.valueOf(stuff[2]), Integer.valueOf(stuff[3]), Integer.valueOf(stuff[4]))); } this.state = data[2].equals("1"); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java index 70608d7f..33946237 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionMottoContains.java @@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; 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.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; @@ -91,4 +92,10 @@ public class WiredConditionMottoContains extends InteractionWiredCondition return true; } + + @Override + public WiredConditionOperator operator() + { + return WiredConditionOperator.OR; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java index 7eb86a8b..d2402dbb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotFurniHaveHabbo.java @@ -1,9 +1,12 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; +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.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; @@ -11,28 +14,38 @@ import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; import com.eu.habbo.messages.ServerMessage; +import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.Collection; +import java.util.Map; public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition { public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_HABBO; - private boolean all; - private THashSet items; + protected boolean all; + protected THashSet items; public WiredConditionNotFurniHaveHabbo(ResultSet set, Item baseItem) throws SQLException { super(set, baseItem); - this.items = new THashSet<>(); + items = new THashSet<>(); } public WiredConditionNotFurniHaveHabbo(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { super(id, userId, item, extradata, limitedStack, limitedSells); - this.items = new THashSet<>(); + items = new THashSet<>(); + } + + @Override + public void onPickUp() + { + this.items.clear(); + this.all = false; } @Override @@ -43,15 +56,54 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition if(this.items.isEmpty()) return true; + THashMap> tiles = new THashMap<>(); for(HabboItem item : this.items) { - THashSet habbos = room.getHabbosOnItem(item); - - if(habbos.isEmpty()) - return true; + tiles.put(item, room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); } - return false; + Collection habbos = room.getHabbos(); + Collection bots = room.getCurrentBots().valueCollection(); + Collection pets = room.getCurrentPets().valueCollection(); + + for (Map.Entry> set : tiles.entrySet()) + { + if (!habbos.isEmpty()) + { + for (Habbo habbo : habbos) + { + if (set.getValue().contains(habbo.getRoomUnit().getCurrentLocation())) + { + return false; + } + } + } + + if (!bots.isEmpty()) + { + for (Bot bot : bots) + { + if (set.getValue().contains(bot.getRoomUnit().getCurrentLocation())) + { + return false; + } + } + } + + if (!pets.isEmpty()) + { + for (Pet pet : pets) + { + if (set.getValue().contains(pet.getRoomUnit().getCurrentLocation())) + { + return false; + } + } + } + + } + + return true; } @Override @@ -95,13 +147,6 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition } } - @Override - public void onPickUp() - { - this.items.clear(); - this.all = false; - } - @Override public WiredConditionType getType() { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java index 7dce8551..9c0b7c59 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotMatchStatePosition.java @@ -60,7 +60,7 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi if(this.position) { - if((setting.x == item.getX() && setting.y == item.getY() && setting.z == item.getZ())) + if((setting.x == item.getX() && setting.y == item.getY())) return false; } @@ -120,8 +120,8 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi { String[] stuff = items[i].split("-"); - if(stuff.length == 6) - this.settings.add(new WiredMatchFurniSetting(Integer.valueOf(stuff[0]), stuff[1], Integer.valueOf(stuff[2]), Integer.valueOf(stuff[3]), Integer.valueOf(stuff[4]), Double.valueOf(stuff[5]))); + if(stuff.length >= 5) + this.settings.add(new WiredMatchFurniSetting(Integer.valueOf(stuff[0]), stuff[1], Integer.valueOf(stuff[2]), Integer.valueOf(stuff[3]), Integer.valueOf(stuff[4]))); } this.state = data[2].equals("1"); @@ -197,7 +197,7 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi HabboItem item = room.getHabboItem(itemId); if (item != null) - this.settings.add(new WiredMatchFurniSetting(item.getId(), item.getExtradata(), item.getRotation(), item.getX(), item.getY(), item.getZ())); + this.settings.add(new WiredMatchFurniSetting(item.getId(), item.getExtradata(), item.getRotation(), item.getX(), item.getY())); } return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java index 2d90550f..4e9563d0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionNotTriggerOnFurni.java @@ -6,7 +6,6 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredHandler; @@ -41,11 +40,6 @@ public class WiredConditionNotTriggerOnFurni extends InteractionWiredCondition if(this.items.isEmpty()) return true; - Habbo habbo = room.getHabbo(roomUnit); - - if(habbo == null) - return true; - for(HabboItem item : this.items) { if(RoomLayout.getRectangle(item.getX(), item.getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()).contains(roomUnit.getX(), roomUnit.getY())) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java index e0fe56ab..f81f620b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/conditions/WiredConditionTriggerOnFurni.java @@ -6,8 +6,8 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.habbohotel.wired.WiredConditionOperator; import com.eu.habbo.habbohotel.wired.WiredConditionType; import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.messages.ClientMessage; @@ -41,11 +41,6 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition if(this.items.isEmpty()) return true; - Habbo habbo = room.getHabbo(roomUnit); - - if(habbo == null) - return true; - for(HabboItem item : this.items) { if(RoomLayout.getRectangle(item.getX(), item.getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()).contains(roomUnit.getX(), roomUnit.getY())) @@ -170,4 +165,10 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition this.items.removeAll(items); } + + @Override + public WiredConditionOperator operator() + { + return WiredConditionOperator.OR; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java index 103c79bf..02d56028 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectBotTeleport.java @@ -120,7 +120,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect int currentEffect = bot.getRoomUnit().getEffectId(); room.giveEffect(bot.getRoomUnit(), 4); - Emulator.getThreading().run(new RoomUnitTeleport(bot.getRoomUnit(), room, item.getX(), item.getY(), item.getZ() + (item.getBaseItem().allowSit() ? item.getBaseItem().getHeight() - 0.50 : 0D), currentEffect)); + Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, item.getX(), item.getY(), item.getZ() + item.getBaseItem().getHeight() + (item.getBaseItem().allowSit() ? - 0.50 : 0D), currentEffect), WiredHandler.TELEPORT_DELAY); break; } else { diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index 5a4300c7..de47a13b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.effects; 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.InteractionRoller; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; @@ -77,16 +78,45 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y); - if (t.state == RoomTileState.OPEN) + if (t != null) { - if (!room.hasHabbosAt(t.x, t.y)) + if (t.state != RoomTileState.INVALID) { - tilesToUpdate.addAll(room.getLayout().getTilesAt(t, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation)); + if (!room.hasHabbosAt(t.x, t.y)) + { + THashSet tiles = room.getLayout().getTilesAt(t, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), setting.rotation); + double highestZ = -1d; + for (RoomTile tile : tiles) + { + if (tile.state == RoomTileState.INVALID) + { + highestZ = -1d; + break; + } - double offsetZ = setting.z - item.getZ(); + if (item instanceof InteractionRoller && room.hasItemsAt(tile.x, tile.y)) + { + highestZ = -1d; + break; + } - room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose()); - tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation)); + double stackHeight = room.getStackHeight(tile.x, tile.y, false, item); + if (stackHeight > highestZ) + { + highestZ = stackHeight; + } + } + + if (highestZ != -1d) + { + tilesToUpdate.addAll(tiles); + + double offsetZ = highestZ - item.getZ(); + + tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation)); + room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose()); + } + } } } } @@ -152,8 +182,10 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect String[] stuff = items[i].split("-"); - if (stuff.length == 6) - this.settings.add(new WiredMatchFurniSetting(Integer.valueOf(stuff[0]), stuff[1], Integer.valueOf(stuff[2]), Integer.valueOf(stuff[3]), Integer.valueOf(stuff[4]), Double.valueOf(stuff[5]))); + if (stuff.length >= 5) + { + this.settings.add(new WiredMatchFurniSetting(Integer.valueOf(stuff[0]), stuff[1], Integer.valueOf(stuff[2]), Integer.valueOf(stuff[3]), Integer.valueOf(stuff[4]))); + } } catch (Exception e) @@ -239,7 +271,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect HabboItem item = room.getHabboItem(itemId); if (item != null) - this.settings.add(new WiredMatchFurniSetting(item.getId(), this.checkForWiredResetPermission && item.allowWiredResetState() ? item.getExtradata() : " ", item.getRotation(), item.getX(), item.getY(), item.getZ())); + this.settings.add(new WiredMatchFurniSetting(item.getId(), this.checkForWiredResetPermission && item.allowWiredResetState() ? item.getExtradata() : " ", item.getRotation(), item.getX(), item.getY())); } this.setDelay(packet.readInt()); @@ -251,7 +283,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); - if(room != null) + if(room != null && room.isLoaded()) { THashSet remove = new THashSet<>(); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java index 697c7a24..573cc067 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveFurniTo.java @@ -79,65 +79,62 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect { List items = new ArrayList<>(); - synchronized (this.items) - { - for (HabboItem item : this.items) - { - if (Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) - items.add(item); - } + for (HabboItem item : this.items) + { + if (Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) + items.add(item); + } - for (HabboItem item : items) - { - this.items.remove(item); - } + for (HabboItem item : items) + { + this.items.remove(item); + } - if (this.items.isEmpty()) - return false; + if (this.items.isEmpty()) + return false; - if (stuff != null && stuff.length > 0) - { - for (Object object : stuff) - { - if (object instanceof HabboItem) - { - HabboItem targetItem = this.items.get(Emulator.getRandom().nextInt(this.items.size())); + if (stuff != null && stuff.length > 0) + { + for (Object object : stuff) + { + if (object instanceof HabboItem) + { + HabboItem targetItem = this.items.get(Emulator.getRandom().nextInt(this.items.size())); - if (targetItem != null) - { - int indexOffset = 0; - if (!this.indexOffset.containsKey(targetItem.getId())) - { - this.indexOffset.put(targetItem.getId(), indexOffset); - } - else - { - indexOffset = this.indexOffset.get(targetItem.getId()) + spacing; - } + if (targetItem != null) + { + int indexOffset = 0; + if (!this.indexOffset.containsKey(targetItem.getId())) + { + this.indexOffset.put(targetItem.getId(), indexOffset); + } + else + { + indexOffset = this.indexOffset.get(targetItem.getId()) + spacing; + } - RoomTile objectTile = room.getLayout().getTile(targetItem.getX(), targetItem.getY()); + RoomTile objectTile = room.getLayout().getTile(targetItem.getX(), targetItem.getY()); - if (objectTile != null) - { - THashSet refreshTiles = room.getLayout().getTilesAt(room.getLayout().getTile(((HabboItem) object).getX(), ((HabboItem) object).getY()), ((HabboItem) object).getBaseItem().getWidth(), ((HabboItem) object).getBaseItem().getLength(), ((HabboItem) object).getRotation()); + if (objectTile != null) + { + THashSet refreshTiles = room.getLayout().getTilesAt(room.getLayout().getTile(((HabboItem) object).getX(), ((HabboItem) object).getY()), ((HabboItem) object).getBaseItem().getWidth(), ((HabboItem) object).getBaseItem().getLength(), ((HabboItem) object).getRotation()); - RoomTile tile = room.getLayout().getTileInFront(objectTile, this.direction, indexOffset); - if (tile == null || !tile.getAllowStack()) - { - indexOffset = 0; - tile = room.getLayout().getTileInFront(objectTile, this.direction, indexOffset); - } + RoomTile tile = room.getLayout().getTileInFront(objectTile, this.direction, indexOffset); + if (tile == null || !tile.getAllowStack()) + { + indexOffset = 0; + tile = room.getLayout().getTileInFront(objectTile, this.direction, indexOffset); + } - room.sendComposer(new FloorItemOnRollerComposer((HabboItem) object, null, tile, tile.getStackHeight() - ((HabboItem) object).getZ(), room).compose()); - refreshTiles.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(((HabboItem) object).getX(), ((HabboItem) object).getY()), ((HabboItem) object).getBaseItem().getWidth(), ((HabboItem) object).getBaseItem().getLength(), ((HabboItem) object).getRotation())); - room.updateTiles(refreshTiles); - this.indexOffset.put(targetItem.getId(), indexOffset); - } - } - } - } - } - } + room.sendComposer(new FloorItemOnRollerComposer((HabboItem) object, null, tile, tile.getStackHeight() - ((HabboItem) object).getZ(), room).compose()); + refreshTiles.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(((HabboItem) object).getX(), ((HabboItem) object).getY()), ((HabboItem) object).getBaseItem().getWidth(), ((HabboItem) object).getBaseItem().getLength(), ((HabboItem) object).getRotation())); + room.updateTiles(refreshTiles); + this.indexOffset.put(targetItem.getId(), indexOffset); + } + } + } + } + } return true; } @@ -173,67 +170,61 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect { THashSet items = new THashSet<>(); - synchronized (this.items) - { - for (HabboItem item : this.items) - { - if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) - items.add(item); - } + for (HabboItem item : this.items) + { + if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) + items.add(item); + } - for (HabboItem item : items) - { - this.items.remove(item); - } + for (HabboItem item : items) + { + this.items.remove(item); + } - message.appendBoolean(false); - message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); - message.appendInt(this.items.size()); - for (HabboItem item : this.items) - message.appendInt(item.getId()); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(2); - message.appendInt(this.direction); - message.appendInt(this.spacing); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(this.getDelay()); - message.appendInt(0); - } + message.appendBoolean(false); + message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); + message.appendInt(this.items.size()); + for (HabboItem item : this.items) + message.appendInt(item.getId()); + message.appendInt(this.getBaseItem().getSpriteId()); + message.appendInt(this.getId()); + message.appendString(""); + message.appendInt(2); + message.appendInt(this.direction); + message.appendInt(this.spacing); + message.appendInt(0); + message.appendInt(this.getType().code); + message.appendInt(this.getDelay()); + message.appendInt(0); } @Override public void loadWiredData(ResultSet set, Room room) throws SQLException { - synchronized (this.items) - { - this.items.clear(); + this.items.clear(); - String[] data = set.getString("wired_data").split("\t"); + String[] data = set.getString("wired_data").split("\t"); - if (data.length == 4) - { - try - { - this.direction = Integer.valueOf(data[0]); - this.spacing = Integer.valueOf(data[1]); - this.setDelay(Integer.valueOf(data[2])); - } - catch (Exception e) - { - } + if (data.length == 4) + { + try + { + this.direction = Integer.valueOf(data[0]); + this.spacing = Integer.valueOf(data[1]); + this.setDelay(Integer.valueOf(data[2])); + } + catch (Exception e) + { + } - for (String s : data[3].split("\r")) - { - HabboItem item = room.getHabboItem(Integer.valueOf(s)); + for (String s : data[3].split("\r")) + { + HabboItem item = room.getHabboItem(Integer.valueOf(s)); - if (item != null) - this.items.add(item); - } - } - } + if (item != null) + this.items.add(item); + } + } } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java index 2ee904cf..2bef6b6e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMoveRotateFurni.java @@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions.wired.effects; 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.InteractionRoller; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect; import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.Habbo; @@ -42,142 +43,166 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { THashSet items = new THashSet<>(); + THashSet tilesToUpdate = new THashSet<>(); + + for (HabboItem item : this.items) + { + if (Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) + items.add(item); + } - synchronized (this.items) + for (HabboItem item : items) + { + this.items.remove(item); + } + + for (HabboItem item : this.items) + { + if (this.rotation > 0) + { + tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + if (this.rotation == 1) + { + item.setRotation(item.getRotation() + 2); + } + else if (this.rotation == 2) + { + item.setRotation(item.getRotation() + 6); + } + else if (this.rotation == 3) + { + if (Emulator.getRandom().nextInt(2) == 1) + { + item.setRotation(item.getRotation() + 2); + } + else + { + item.setRotation(item.getRotation() + 6); + } + } + + if (this.direction == 0) + { + tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); + room.sendComposer(new FloorItemUpdateComposer(item).compose()); + } + } + + if (this.direction > 0) + { + RoomUserRotation moveDirection = RoomUserRotation.NORTH; + + if (this.direction == 1) + { + moveDirection = RoomUserRotation.values()[Emulator.getRandom().nextInt(RoomUserRotation.values().length)]; + } + else if (this.direction == 2) + { + if (Emulator.getRandom().nextInt(2) == 1) + { + moveDirection = RoomUserRotation.EAST; + } + else + { + moveDirection = RoomUserRotation.WEST; + } + } + else if (this.direction == 3) + { + if (Emulator.getRandom().nextInt(2) == 1) + { + moveDirection = RoomUserRotation.NORTH; + } + else + { + moveDirection = RoomUserRotation.SOUTH; + } + } + else if (this.direction == 4) + { + moveDirection = RoomUserRotation.SOUTH; + } + else if (this.direction == 5) + { + moveDirection = RoomUserRotation.EAST; + } + else if (this.direction == 6) + { + moveDirection = RoomUserRotation.NORTH; + } + else if (this.direction == 7) + { + moveDirection = RoomUserRotation.WEST; + } + + RoomTile newTile = room.getLayout().getTile( + (short) (item.getX() + ((moveDirection == RoomUserRotation.WEST || moveDirection == RoomUserRotation.NORTH_WEST || moveDirection == RoomUserRotation.SOUTH_WEST) ? -1 : (((moveDirection == RoomUserRotation.EAST || moveDirection == RoomUserRotation.SOUTH_EAST || moveDirection == RoomUserRotation.NORTH_EAST) ? 1 : 0)))), + (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) + { + boolean hasHabbos = false; + for (Habbo habbo : room.getHabbosAt(newTile)) + { + hasHabbos = true; + WiredHandler.handle(WiredTriggerType.COLLISION, habbo.getRoomUnit(), room, new Object[]{item}); + } + + if (!hasHabbos && room.getStackHeight(newTile.x, newTile.y, true, item) != Short.MAX_VALUE) + { + Rectangle rectangle = new Rectangle(newTile.x, + newTile.y, + item.getBaseItem().getWidth(), + item.getBaseItem().getLength()); + + double offset = -Short.MAX_VALUE; + boolean validMove = true; + for (short x = (short)rectangle.x; x < rectangle.x + rectangle.getWidth(); x++) + { + for (short y = (short)rectangle.y; y < rectangle.y + rectangle.getHeight(); y++) + { + RoomTile tile = room.getLayout().getTile(x, y); + + if (tile.state == RoomTileState.INVALID || !tile.getAllowStack()) + { + validMove = false; + break; + } + + if (item instanceof InteractionRoller && room.hasItemsAt(tile.x, tile.y)) + { + validMove = false; + break; + } + + HabboItem i = room.getTopItemAt(x, y, item); + + if (i == null || i == item || i.getBaseItem().allowStack()) + { + offset = Math.max(room.getStackHeight(newTile.x, newTile.y, false, item) - item.getZ(), offset); + } + + tilesToUpdate.add(tile); + } + } + if (item.getZ() + offset > 40) + { + offset = 40 - item.getZ(); + } + + if (validMove) + { + room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose()); + } + } + } + } + } + + if (!tilesToUpdate.isEmpty()) { - for (HabboItem item : this.items) - { - if (Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) - items.add(item); - } - - for (HabboItem item : items) - { - this.items.remove(item); - } - - for (HabboItem item : this.items) - { - if (this.rotation > 0) - { - THashSet tiles = room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - if (this.rotation == 1) - { - item.setRotation(item.getRotation() + 2); - } - else if (this.rotation == 2) - { - item.setRotation(item.getRotation() + 6); - } - else if (this.rotation == 3) - { - if (Emulator.getRandom().nextInt(2) == 1) - { - item.setRotation(item.getRotation() + 2); - } - else - { - item.setRotation(item.getRotation() + 6); - } - } - - if (this.direction == 0) - { - tiles.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation())); - room.updateTiles(tiles); - room.sendComposer(new FloorItemUpdateComposer(item).compose()); - } - } - - if (this.direction > 0) - { - RoomUserRotation moveDirection = RoomUserRotation.NORTH; - - if (this.direction == 1) - { - moveDirection = RoomUserRotation.values()[Emulator.getRandom().nextInt(RoomUserRotation.values().length)]; - } - else if (this.direction == 2) - { - if (Emulator.getRandom().nextInt(2) == 1) - { - moveDirection = RoomUserRotation.EAST; - } - else - { - moveDirection = RoomUserRotation.WEST; - } - } - else if (this.direction == 3) - { - if (Emulator.getRandom().nextInt(2) == 1) - { - moveDirection = RoomUserRotation.NORTH; - } - else - { - moveDirection = RoomUserRotation.SOUTH; - } - } - else if (this.direction == 4) - { - moveDirection = RoomUserRotation.SOUTH; - } - else if (this.direction == 5) - { - moveDirection = RoomUserRotation.EAST; - } - else if (this.direction == 6) - { - moveDirection = RoomUserRotation.NORTH; - } - else if (this.direction == 7) - { - moveDirection = RoomUserRotation.WEST; - } - - RoomTile newTile = room.getLayout().getTile( - (short) (item.getX() + ((moveDirection == RoomUserRotation.WEST || moveDirection == RoomUserRotation.NORTH_WEST || moveDirection == RoomUserRotation.SOUTH_WEST) ? -1 : (((moveDirection == RoomUserRotation.EAST || moveDirection == RoomUserRotation.SOUTH_EAST || moveDirection == RoomUserRotation.NORTH_EAST) ? 1 : 0)))), - (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) - { - boolean hasHabbos = false; - for (Habbo habbo : room.getHabbosAt(newTile)) - { - hasHabbos = true; - WiredHandler.handle(WiredTriggerType.COLLISION, habbo.getRoomUnit(), room, new Object[]{item}); - } - - if (!hasHabbos && room.tileWalkable(newTile)) - { - Rectangle rectangle = new Rectangle(newTile.x, - newTile.y, - item.getBaseItem().getWidth(), - item.getBaseItem().getLength()); - - double offset = 0; - for (short x = (short)rectangle.x; x < rectangle.x + rectangle.getWidth(); x++) - { - for (short y = (short)rectangle.y; y < rectangle.y + rectangle.getHeight(); y++) - { - RoomTile tile = room.getLayout().getTile(x, y); - if (tile.state == RoomTileState.INVALID) continue; - - HabboItem i = room.getTopItemAt(x, y, item); - - if (i == null || i == item || i.getBaseItem().allowStack()) - { - offset = Math.max(room.getStackHeight(newTile.x, newTile.y, false, item) - item.getZ(), offset); - } - } - } - room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose()); - } - } - } - } + room.updateTiles(tilesToUpdate); } return true; @@ -188,7 +213,6 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { THashSet items = new THashSet<>(); - this.items.remove(null); Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()); for(HabboItem item : this.items) @@ -217,33 +241,30 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect @Override public void loadWiredData(ResultSet set, Room room) throws SQLException { - synchronized (this.items) - { - this.items.clear(); + this.items.clear(); - String[] data = set.getString("wired_data").split("\t"); + String[] data = set.getString("wired_data").split("\t"); - if (data.length == 4) - { - try - { - this.direction = Integer.valueOf(data[0]); - this.rotation = Integer.valueOf(data[1]); - this.setDelay(Integer.valueOf(data[2])); - } - catch (Exception e) - { - } + if (data.length == 4) + { + try + { + this.direction = Integer.valueOf(data[0]); + this.rotation = Integer.valueOf(data[1]); + this.setDelay(Integer.valueOf(data[2])); + } + catch (Exception e) + { + } - for (String s : data[3].split("\r")) - { - HabboItem item = room.getHabboItem(Integer.valueOf(s)); + for (String s : data[3].split("\r")) + { + HabboItem item = room.getHabboItem(Integer.valueOf(s)); - if (item != null) - this.items.add(item); - } - } - } + if (item != null) + this.items.add(item); + } + } } @Override @@ -266,35 +287,32 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect { THashSet items = new THashSet<>(); - synchronized (this.items) - { - for (HabboItem item : this.items) - { - if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) - items.add(item); - } + for (HabboItem item : this.items) + { + if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) + items.add(item); + } - for (HabboItem item : items) - { - this.items.remove(item); - } + for (HabboItem item : items) + { + this.items.remove(item); + } - message.appendBoolean(false); - message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); - message.appendInt(this.items.size()); - for (HabboItem item : this.items) - message.appendInt(item.getId()); - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(2); - message.appendInt(this.direction); - message.appendInt(this.rotation); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(this.getDelay()); - message.appendInt(0); - } + message.appendBoolean(false); + message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); + message.appendInt(this.items.size()); + for (HabboItem item : this.items) + message.appendInt(item.getId()); + message.appendInt(this.getBaseItem().getSpriteId()); + message.appendInt(this.getId()); + message.appendString(""); + message.appendInt(2); + message.appendInt(this.direction); + message.appendInt(this.rotation); + message.appendInt(0); + message.appendInt(this.getType().code); + message.appendInt(this.getDelay()); + message.appendInt(0); } @Override @@ -314,14 +332,11 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect int count = packet.readInt(); - synchronized (this.items) - { - this.items.clear(); - for (int i = 0; i < count; i++) - { - this.items.add(room.getHabboItem(packet.readInt())); - } - } + this.items.clear(); + for (int i = 0; i < count; i++) + { + this.items.add(room.getHabboItem(packet.readInt())); + } this.setDelay(packet.readInt()); diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java index 37ca5988..d4fb0720 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectTeleport.java @@ -7,7 +7,6 @@ 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.RoomUnit; -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; @@ -118,11 +117,17 @@ public class WiredEffectTeleport extends InteractionWiredEffect @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - Habbo habbo = room.getHabbo(roomUnit); + THashSet items = new THashSet<>(); - if(habbo == null) + for(HabboItem item : this.items) { - return false; + if(item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) + items.add(item); + } + + for(HabboItem item : items) + { + this.items.remove(item); } if(!this.items.isEmpty()) @@ -134,11 +139,11 @@ public class WiredEffectTeleport extends InteractionWiredEffect { if (i == j) { - int currentEffect = habbo.getRoomUnit().getEffectId(); + int currentEffect = roomUnit.getEffectId(); - room.giveEffect(habbo, 4); + room.giveEffect(roomUnit, 4); final WiredEffectTeleport teleportWired = this; - Emulator.getThreading().run(new RoomUnitTeleport(habbo.getRoomUnit(), room, item.getX(), item.getY(), item.getZ() + (item.getBaseItem().allowSit() ? item.getBaseItem().getHeight() - 0.50 : 0D), currentEffect), WiredHandler.TELEPORT_DELAY); + Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, item.getX(), item.getY(), item.getZ() + item.getBaseItem().getHeight() + (item.getBaseItem().allowSit() ? - 0.50 : 0D), currentEffect), WiredHandler.TELEPORT_DELAY); Emulator.getThreading().run(new Runnable() { @Override @@ -146,7 +151,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect { try { - item.onWalkOn(habbo.getRoomUnit(), room, new Object[]{teleportWired}); + item.onWalkOn(roomUnit, room, new Object[]{teleportWired}); } catch (Exception e) {} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java index 6fc53530..d51cfb06 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleFurni.java @@ -47,62 +47,59 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect @Override public void serializeWiredData(ServerMessage message, Room room) { - synchronized (this.items) - { - THashSet items = new THashSet<>(); + THashSet items = new THashSet<>(); - for (HabboItem item : this.items) - { - if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) - items.add(item); - } + for (HabboItem item : this.items) + { + if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null) + items.add(item); + } - for (HabboItem item : items) - { - this.items.remove(item); - } + for (HabboItem item : items) + { + this.items.remove(item); + } - message.appendBoolean(false); - message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); - message.appendInt(this.items.size()); - for (HabboItem item : this.items) - { - message.appendInt(item.getId()); - } - message.appendInt(this.getBaseItem().getSpriteId()); - message.appendInt(this.getId()); - message.appendString(""); - message.appendInt(0); - message.appendInt(0); - message.appendInt(this.getType().code); - message.appendInt(this.getDelay()); + message.appendBoolean(false); + message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); + message.appendInt(this.items.size()); + for (HabboItem item : this.items) + { + message.appendInt(item.getId()); + } + message.appendInt(this.getBaseItem().getSpriteId()); + message.appendInt(this.getId()); + message.appendString(""); + message.appendInt(0); + message.appendInt(0); + message.appendInt(this.getType().code); + message.appendInt(this.getDelay()); - if (this.requiresTriggeringUser()) - { - List invalidTriggers = new ArrayList<>(); - room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() - { - @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 (this.requiresTriggeringUser()) + { + List invalidTriggers = new ArrayList<>(); + room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure() + { + @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); + } } @Override @@ -111,22 +108,19 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect packet.readInt(); packet.readString(); - synchronized (this.items) - { - this.items.clear(); + this.items.clear(); - int count = packet.readInt(); + int count = packet.readInt(); - for (int i = 0; i < count; i++) - { - HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()); + for (int i = 0; i < count; i++) + { + HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()); - if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile || item instanceof InteractionCrackable) - continue; + if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile || item instanceof InteractionCrackable) + continue; - this.items.add(item); - } - } + this.items.add(item); + } this.setDelay(packet.readInt()); @@ -136,58 +130,51 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect @Override public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) { - synchronized (this.items) - { - Habbo habbo = room.getHabbo(roomUnit); + Habbo habbo = room.getHabbo(roomUnit); - HabboItem triggerItem = null; + HabboItem triggerItem = null; - if (stuff != null && stuff.length > 0) - { - if (stuff[0] instanceof HabboItem) - { - triggerItem = (HabboItem) stuff[0]; - } - } + if (stuff != null && stuff.length > 0) + { + if (stuff[0] instanceof HabboItem) + { + triggerItem = (HabboItem) stuff[0]; + } + } - THashSet itemsToRemove = new THashSet<>(); - for (HabboItem item : this.items) - { - if (item == null || item.getRoomId() == 0 || item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile) - { - itemsToRemove.add(item); - continue; - } + THashSet itemsToRemove = new THashSet<>(); + for (HabboItem item : this.items) + { + if (item == null || item.getRoomId() == 0 || item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile) + { + itemsToRemove.add(item); + continue; + } - if (triggerItem == null && roomUnit == null) - { - continue; - } + try + { + if (item.getBaseItem().getStateCount() > 1 || item instanceof InteractionGameTimer) + { + if (item instanceof InteractionGameTimer) + { + Game game = room.getGame(((InteractionGameTimer)item).getGameType()); + if (game == null || game.isRunning) + { + continue; + } + } - try - { - if (item.getBaseItem().getStateCount() > 1 || item instanceof InteractionGameTimer) - { - if (item instanceof InteractionGameTimer) - { - Game game = room.getGame(((InteractionGameTimer)item).getGameType()); - if (game == null || game.isRunning) - { - continue; - } - } + item.onClick(habbo != null ? habbo.getClient() : null, room, new Object[]{item.getExtradata().length() == 0 ? 0 : Integer.valueOf(item.getExtradata()), this.getType()}); + } + } + catch (Exception e) + { + Emulator.getLogging().logErrorLine(e); + } + } - item.onClick(habbo != null ? habbo.getClient() : null, room, new Object[]{item.getExtradata().length() == 0 ? 0 : Integer.valueOf(item.getExtradata()), this.getType()}); - } - } - catch (Exception e) - { - Emulator.getLogging().logErrorLine(e); - } - } - - this.items.removeAll(itemsToRemove); - } + this.items.removeAll(itemsToRemove); + return true; } @@ -196,16 +183,13 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect { String wiredData = this.getDelay() + "\t"; - synchronized (this.items) - { - if(items != null && !items.isEmpty()) - { - for (HabboItem item : this.items) - { - wiredData += item.getId() + ";"; - } - } - } + if(items != null && !items.isEmpty()) + { + for (HabboItem item : this.items) + { + wiredData += item.getId() + ";"; + } + } return wiredData; } @@ -213,32 +197,29 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect @Override public void loadWiredData(ResultSet set, Room room) throws SQLException { - synchronized (this.items) - { - this.items.clear(); - String[] wiredData = set.getString("wired_data").split("\t"); + this.items.clear(); + String[] wiredData = set.getString("wired_data").split("\t"); - if (wiredData.length >= 1) - { - this.setDelay(Integer.valueOf(wiredData[0])); - } - if (wiredData.length == 2) - { - if (wiredData[1].contains(";")) - { - for (String s : wiredData[1].split(";")) - { - HabboItem item = room.getHabboItem(Integer.valueOf(s)); + if (wiredData.length >= 1) + { + this.setDelay(Integer.valueOf(wiredData[0])); + } + if (wiredData.length == 2) + { + if (wiredData[1].contains(";")) + { + for (String s : wiredData[1].split(";")) + { + HabboItem item = room.getHabboItem(Integer.valueOf(s)); - if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile || item instanceof InteractionCrackable) - continue; + if (item instanceof InteractionFreezeBlock || item instanceof InteractionFreezeTile || item instanceof InteractionCrackable) + continue; - if (item != null) - this.items.add(item); - } - } - } - } + if (item != null) + this.items.add(item); + } + } + } } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java index cd1c4e4f..f240d18a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectToggleRandom.java @@ -100,27 +100,24 @@ public class WiredEffectToggleRandom extends InteractionWiredEffect @Override public boolean saveData(ClientMessage packet, GameClient gameClient) { - synchronized (this.items) - { - packet.readInt(); - packet.readString(); + packet.readInt(); + packet.readString(); - this.items.clear(); + this.items.clear(); - int count = packet.readInt(); + int count = packet.readInt(); - for (int i = 0; i < count; i++) - { - HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()); + for (int i = 0; i < count; i++) + { + HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()); - if (item instanceof InteractionFreezeBlock || item instanceof InteractionGameTimer || item instanceof InteractionCrackable) - continue; + if (item instanceof InteractionFreezeBlock || item instanceof InteractionGameTimer || item instanceof InteractionCrackable) + continue; - this.items.add(item); - } + this.items.add(item); + } - this.setDelay(packet.readInt()); - } + this.setDelay(packet.readInt()); return true; } diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java index 5beb408d..0f6650a6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectWhisper.java @@ -84,6 +84,10 @@ public class WiredEffectWhisper extends InteractionWiredEffect packet.readInt(); this.message = Emulator.getGameEnvironment().getWordFilter().filter(packet.readString(), null); + if (this.message.length() > 100) + { + this.message = ""; + } packet.readInt(); this.setDelay(packet.readInt()); return true; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java new file mode 100644 index 00000000..297fbd5f --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboIdle.java @@ -0,0 +1,87 @@ +package com.eu.habbo.habbohotel.items.interactions.wired.triggers; + +import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; +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.wired.WiredHandler; +import com.eu.habbo.habbohotel.wired.WiredTriggerType; +import com.eu.habbo.messages.ClientMessage; +import com.eu.habbo.messages.ServerMessage; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class WiredTriggerHabboIdle extends InteractionWiredTrigger +{ + private static final WiredTriggerType type = WiredTriggerType.IDLES; + + public WiredTriggerHabboIdle(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + public WiredTriggerHabboIdle(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) + { + return stuff.length > 0 && stuff[0] instanceof Habbo; + } + + @Override + public String getWiredData() + { + return ""; + } + + @Override + public void loadWiredData(ResultSet set, Room room) throws SQLException + { + + } + + @Override + public void onPickUp() + { + + } + + @Override + public WiredTriggerType getType() + { + return type; + } + + @Override + public void serializeWiredData(ServerMessage message, Room room) + { + message.appendBoolean(false); + message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); + message.appendInt(0); + message.appendInt(this.getBaseItem().getSpriteId()); + message.appendInt(this.getId()); + message.appendString(""); + message.appendInt(0); + message.appendInt(0); + message.appendInt(type.code); + message.appendInt(0); + message.appendInt(0); + } + + @Override + public boolean saveData(ClientMessage packet) + { + return true; + } + + @Override + public boolean isTriggeredByRoomUnit() + { + return true; + } +} diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java new file mode 100644 index 00000000..f93f9388 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboUnidle.java @@ -0,0 +1,87 @@ +package com.eu.habbo.habbohotel.items.interactions.wired.triggers; + +import com.eu.habbo.habbohotel.items.Item; +import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; +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.wired.WiredHandler; +import com.eu.habbo.habbohotel.wired.WiredTriggerType; +import com.eu.habbo.messages.ClientMessage; +import com.eu.habbo.messages.ServerMessage; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class WiredTriggerHabboUnidle extends InteractionWiredTrigger +{ + private static final WiredTriggerType type = WiredTriggerType.IDLES; + + public WiredTriggerHabboUnidle(ResultSet set, Item baseItem) throws SQLException + { + super(set, baseItem); + } + + public WiredTriggerHabboUnidle(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) + { + return stuff.length > 0 && stuff[0] instanceof Habbo; + } + + @Override + public String getWiredData() + { + return ""; + } + + @Override + public void loadWiredData(ResultSet set, Room room) throws SQLException + { + + } + + @Override + public void onPickUp() + { + + } + + @Override + public WiredTriggerType getType() + { + return type; + } + + @Override + public void serializeWiredData(ServerMessage message, Room room) + { + message.appendBoolean(false); + message.appendInt(WiredHandler.MAXIMUM_FURNI_SELECTION); + message.appendInt(0); + message.appendInt(this.getBaseItem().getSpriteId()); + message.appendInt(this.getId()); + message.appendString(""); + message.appendInt(0); + message.appendInt(0); + message.appendInt(type.code); + message.appendInt(0); + message.appendInt(0); + } + + @Override + public boolean saveData(ClientMessage packet) + { + return true; + } + + @Override + public boolean isTriggeredByRoomUnit() + { + return true; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java index 2799638d..84f4c72d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOffFurni.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -15,6 +14,8 @@ import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger { @@ -40,16 +41,11 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger { if(stuff.length >= 1) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) + if (stuff[0] instanceof HabboItem) { - if (stuff[0] instanceof HabboItem) + if(items.contains(stuff[0])) { - if(items.contains(stuff[0])) - { - return true; - } + return true; } } } @@ -63,10 +59,20 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger if(!items.isEmpty()) { + List toRemove = new ArrayList<>(0); for (HabboItem item : this.items) { - wiredData += item.getId() + ";"; + if (item.getRoomId() == this.getRoomId()) + { + wiredData += item.getId() + ";"; + } + else + { + toRemove.add(item); + } } + + this.items.removeAll(toRemove); } else wiredData += "\t"; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java index 388f9469..a4f3d7dc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/triggers/WiredTriggerHabboWalkOnFurni.java @@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger; 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.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; @@ -15,6 +14,8 @@ import gnu.trove.set.hash.THashSet; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger { @@ -40,16 +41,11 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger { if(stuff.length >= 1) { - Habbo habbo = room.getHabbo(roomUnit); - - if (habbo != null) + if (stuff[0] instanceof HabboItem) { - if (stuff[0] instanceof HabboItem) + if(items.contains(stuff[0])) { - if(items.contains(stuff[0])) - { - return true; - } + return true; } } } @@ -127,10 +123,20 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger if(!items.isEmpty()) { + List toRemove = new ArrayList<>(0); for (HabboItem item : this.items) { - wiredData += item.getId() + ";"; + if (item.getRoomId() == this.getRoomId()) + { + wiredData += item.getId() + ";"; + } + else + { + toRemove.add(item); + } } + + this.items.removeAll(toRemove); } else wiredData += "\t"; diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java index d3a35c2d..cceaf07b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolManager.java @@ -198,7 +198,7 @@ public class ModToolManager if(userId <= 0) return; - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM users INNER JOIN users_settings ON users.id = users_settings.user_id WHERE users.id = ? LIMIT 1")) + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT users.*, users_settings.*, permissions.rank_name, permissions.id as rank_id FROM users INNER JOIN users_settings ON users.id = users_settings.user_id INNER JOIN permissions ON permissions.id = users.rank WHERE users.id = ? LIMIT 1")) { statement.setInt(1, userId); try (ResultSet set = statement.executeQuery()) @@ -516,18 +516,20 @@ public class ModToolManager if (target != null) { - Emulator.getGameServer().getGameClientManager().disposeClient(target.getClient().getChannel()); + Emulator.getGameServer().getGameClientManager().disposeClient(target.getClient()); } if ((type == ModToolBanType.IP || type == ModToolBanType.SUPER) && target != null && !ban.ip.equals("offline")) { for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithIP(ban.ip)) { + if (h.getHabboInfo().getRank().getId() >= moderator.getHabboInfo().getRank().getId()) continue; + ban = new ModToolBan(h.getHabboInfo().getId(), h != null ? h.getHabboInfo().getIpLogin() : "offline", h != null ? h.getClient().getMachineId() : "offline", moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic); Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, h, ban)); Emulator.getThreading().run(ban); bans.add(ban); - Emulator.getGameServer().getGameClientManager().disposeClient(h.getClient().getChannel()); + Emulator.getGameServer().getGameClientManager().disposeClient(h.getClient()); } } @@ -535,11 +537,13 @@ public class ModToolManager { for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithMachineId(ban.machineId)) { + if (h.getHabboInfo().getRank().getId() >= moderator.getHabboInfo().getRank().getId()) continue; + ban = new ModToolBan(h.getHabboInfo().getId(), h != null ? h.getHabboInfo().getIpLogin() : "offline", h != null ? h.getClient().getMachineId() : "offline", moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic); Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, h, ban)); Emulator.getThreading().run(ban); bans.add(ban); - Emulator.getGameServer().getGameClientManager().disposeClient(h.getClient().getChannel()); + Emulator.getGameServer().getGameClientManager().disposeClient(h.getClient()); } } @@ -662,7 +666,7 @@ public class ModToolManager public boolean unban(String username) { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bans INNER JOIN users ON bans.user_id = users.id SET ban_expire = ?, ban_reason = CONCAT('" + Emulator.getTexts().getValue("unbanned") + ": ', ban_reason) WHERE users.username = ? AND ban_expire > ?")) + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bans INNER JOIN users ON bans.user_id = users.id SET ban_expire = ?, ban_reason = CONCAT('" + Emulator.getTexts().getValue("unbanned") + ": ', ban_reason) WHERE users.username LIKE ? AND ban_expire > ?")) { statement.setInt(1, Emulator.getIntUnixTimestamp()); statement.setString(2, username); diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java index 03135abf..07451675 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorHotelFilter.java @@ -33,7 +33,10 @@ public class NavigatorHotelFilter extends NavigatorFilter if (!set.getValue().isEmpty()) { RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(set.getKey()); - resultLists.add(new SearchResultList(i, category.getCaption(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible, DisplayOrder.ORDER_NUM, category.getOrder())); + if (category != null) + { + resultLists.add(new SearchResultList(i, category.getCaption(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible, DisplayOrder.ORDER_NUM, category.getOrder())); + } i++; } } @@ -55,7 +58,11 @@ public class NavigatorHotelFilter extends NavigatorFilter if (!set.getValue().isEmpty()) { RoomCategory category = Emulator.getGameEnvironment().getRoomManager().getCategory(set.getKey()); - resultLists.add(new SearchResultList(i, category.getCaptionSave(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible, DisplayOrder.ACTIVITY, category.getOrder())); + + if (category != null) + { + resultLists.add(new SearchResultList(i, category.getCaptionSave(), category.getCaption(), SearchAction.MORE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory(category.getCaptionSave()), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory(category.getCaptionSave()), set.getValue(), true, showInvisible, DisplayOrder.ACTIVITY, category.getOrder())); + } i++; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java index d032a31b..d5df7bb7 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorManager.java @@ -74,7 +74,7 @@ public class NavigatorManager } else { - Emulator.getLogging().logErrorLine("Public room defined in navigator_publics does not exist!"); + Emulator.getLogging().logErrorLine("Public room (ID: " + set.getInt("room_id") + " defined in navigator_publics does not exist!"); } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java index 0fe7fc8d..0585ba17 100644 --- a/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java +++ b/src/main/java/com/eu/habbo/habbohotel/navigation/NavigatorUserFilter.java @@ -24,7 +24,7 @@ public class NavigatorUserFilter extends NavigatorFilter List resultLists = new ArrayList<>(); List rooms = Emulator.getGameEnvironment().getRoomManager().getRoomsForHabbo(habbo); Collections.sort(rooms); - resultLists.add(new SearchResultList(i, "my", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my"), rooms, true, true, DisplayOrder.ACTIVITY, -1)); + resultLists.add(new SearchResultList(i, "my", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my"), rooms, true, true, DisplayOrder.ORDER_NUM, i)); i++; List favoriteRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsFavourite(habbo); @@ -32,28 +32,28 @@ public class NavigatorUserFilter extends NavigatorFilter if (!favoriteRooms.isEmpty()) { Collections.sort(favoriteRooms); - resultLists.add(new SearchResultList(1, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("favorites"), favoriteRooms, true, true, DisplayOrder.ACTIVITY, -1)); + resultLists.add(new SearchResultList(i, "favorites", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("favorites"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("favorites"), favoriteRooms, true, true, DisplayOrder.ORDER_NUM, i)); i++; } List frequentlyVisited = Emulator.getGameEnvironment().getRoomManager().getRoomsVisited(habbo, false, 10); if (!frequentlyVisited.isEmpty()) { - resultLists.add(new SearchResultList(1, "history_freq", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("history_freq"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("history_freq"), frequentlyVisited, true, true, DisplayOrder.ACTIVITY, -1)); + resultLists.add(new SearchResultList(i, "history_freq", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("history_freq"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("history_freq"), frequentlyVisited, true, true, DisplayOrder.ORDER_NUM, i)); i++; } List groupRooms = Emulator.getGameEnvironment().getRoomManager().getGroupRooms(habbo, 25); if (!groupRooms.isEmpty()) { - resultLists.add(new SearchResultList(1, "my_groups", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my_groups"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my_groups"), groupRooms, true, true, DisplayOrder.ACTIVITY, -1)); + resultLists.add(new SearchResultList(i, "my_groups", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("my_groups"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("my_groups"), groupRooms, true, true, DisplayOrder.ORDER_NUM, i)); i++; } List rightRooms = Emulator.getGameEnvironment().getRoomManager().getRoomsWithRights(habbo); if (!rightRooms.isEmpty()) { - resultLists.add(new SearchResultList(1, "with_rights", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_rights"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_rights"), rightRooms, true, true, DisplayOrder.ACTIVITY, -1)); + resultLists.add(new SearchResultList(i, "with_rights", "", SearchAction.NONE, habbo.getHabboStats().navigatorWindowSettings.getListModeForCategory("with_rights"), habbo.getHabboStats().navigatorWindowSettings.getDisplayModeForCategory("with_rights"), rightRooms, true, true, DisplayOrder.ORDER_NUM, i)); i++; } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java index 4546e977..b7d4fa08 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/MonsterplantPet.java @@ -219,6 +219,8 @@ public class MonsterplantPet extends Pet implements IPetLook } } } + + super.cycle(); } public int getType() @@ -428,4 +430,10 @@ public class MonsterplantPet extends Pet implements IPetLook this.room.sendComposer(new PetStatusUpdateComposer(this).compose()); this.room.sendComposer(new RoomPetRespectComposer(this, RoomPetRespectComposer.PET_TREATED).compose()); } + + @Override + public boolean canWalk() + { + return false; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java index 950228bc..52de1816 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/Pet.java @@ -8,6 +8,7 @@ import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.rooms.pets.PetLevelUpdatedComposer; import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetExperienceComposer; import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetRespectComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserTalkComposer; @@ -21,25 +22,55 @@ import java.util.TimeZone; public class Pet 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; + + + public int levelThirst; + + + public int levelHunger; + + protected int experience; + + protected int energy; + + protected int respect; + + protected int created; + + protected int level; + public boolean needsUpdate = false; private int chatTimeout; RoomUnit roomUnit; - public int levelThirst; - public int levelHunger; public boolean packetUpdate = false; @@ -105,7 +136,8 @@ public class Pet implements ISerialize, Runnable this.level = 1; } - void say(String message) + + protected void say(String message) { if(this.roomUnit != null && this.room != null && !message.isEmpty()) { @@ -118,13 +150,15 @@ public class Pet implements ISerialize, Runnable } } + public void say(PetVocal vocal) { if(vocal != null) this.say(vocal.message); } - public synchronized void addEnergy(int amount) + + public void addEnergy(int amount) { this.energy += amount; @@ -135,7 +169,8 @@ public class Pet implements ISerialize, Runnable this.energy = 0; } - public synchronized void addHappyness(int amount) + + public void addHappyness(int amount) { this.happyness += amount; @@ -156,11 +191,13 @@ public class Pet implements ISerialize, Runnable this.respect++; } + public int daysAlive() { return (Emulator.getIntUnixTimestamp() - this.created) / 86400; } + public String bornDate() { @@ -250,7 +287,7 @@ public class Pet implements ISerialize, Runnable if(time - this.postureTimeout > 1 && this.task == null) { this.clearPosture(); - this.postureTimeout = time; + this.postureTimeout = time + 120; } if (this.freeCommandTicks > 0) @@ -376,6 +413,7 @@ public class Pet implements ISerialize, Runnable } } + public void handleCommand(PetCommand command, Habbo habbo, String[] data) { this.idleCommandTicks = 0; @@ -430,7 +468,13 @@ public class Pet implements ISerialize, Runnable if(this.task == null) { + boolean isDead = false; + if (this.roomUnit.hasStatus(RoomUnitStatus.RIP)) + isDead = true; + this.roomUnit.clearStatus(); + + if (isDead) this.roomUnit.setStatus(RoomUnitStatus.RIP, ""); for (Map.Entry entry : keys.entrySet()) { this.roomUnit.setStatus(entry.getKey(), entry.getValue()); @@ -495,6 +539,7 @@ public class Pet implements ISerialize, Runnable message.appendInt(0); } + public void findNest() { HabboItem item = this.petData.randomNest(this.room.getRoomSpecialTypes().getNests()); @@ -511,6 +556,7 @@ public class Pet implements ISerialize, Runnable } } + public void drink() { HabboItem item = this.petData.randomDrinkItem(this.room.getRoomSpecialTypes().getPetDrinks()); @@ -521,6 +567,7 @@ public class Pet implements ISerialize, Runnable } } + public void eat() { HabboItem item = this.petData.randomFoodItem(this.room.getRoomSpecialTypes().getPetFoods()); @@ -533,6 +580,7 @@ public class Pet implements ISerialize, Runnable } } + public void findToy() { HabboItem item = this.petData.randomToyItem(this.room.getRoomSpecialTypes().getPetToys()); @@ -545,21 +593,25 @@ public class Pet implements ISerialize, Runnable } } + public void randomHappyAction() { this.roomUnit.setStatus(RoomUnitStatus.fromString(this.petData.actionsHappy[Emulator.getRandom().nextInt(this.petData.actionsHappy.length)]), ""); } + public void randomSadAction() { this.roomUnit.setStatus(RoomUnitStatus.fromString(this.petData.actionsTired[Emulator.getRandom().nextInt(this.petData.actionsTired.length)]), ""); } + public void randomAction() { this.roomUnit.setStatus(RoomUnitStatus.fromString(this.petData.actionsRandom[Emulator.getRandom().nextInt(this.petData.actionsRandom.length)]), ""); } - + + public void addExperience(int amount) { this.experience += amount; @@ -575,16 +627,26 @@ public class Pet implements ISerialize, Runnable } } + protected void levelUp() { + if (this.level >= PetManager.experiences.length) + return; + this.level++; + if (this.experience < PetManager.experiences[this.level]) + { + this.experience = PetManager.experiences[this.level]; + } this.say(this.petData.randomVocal(PetVocalsType.LEVEL_UP)); this.addHappyness(100); this.roomUnit.setStatus(RoomUnitStatus.GESTURE, "exp"); this.gestureTickTimeout = Emulator.getIntUnixTimestamp(); AchievementManager.progressAchievement(Emulator.getGameEnvironment().getHabboManager().getHabbo(this.userId), Emulator.getGameEnvironment().getAchievementManager().getAchievement("PetLevelUp")); + this.room.sendComposer(new PetLevelUpdatedComposer(this).compose()); } + public void addThirst(int amount) { this.levelThirst += amount; @@ -596,6 +658,7 @@ public class Pet implements ISerialize, Runnable this.levelThirst = 0; } + public void addHunger(int amount) { this.levelHunger += amount; @@ -607,6 +670,7 @@ public class Pet implements ISerialize, Runnable this.levelHunger = 0; } + public void freeCommand() { this.task = null; @@ -616,6 +680,7 @@ public class Pet implements ISerialize, Runnable this.say(this.petData.randomVocal(PetVocalsType.GENERIC_NEUTRAL)); } + public void scratched(Habbo habbo) { this.addExperience(10); diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetAction.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetAction.java index 73a19e6f..1e418ad6 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetAction.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetAction.java @@ -8,12 +8,22 @@ import java.util.List; public abstract class PetAction { + public int minimumActionDuration = 500; + public final PetTasks petTask; + + public final boolean stopsPetWalking; + + public final List statusToRemove = new ArrayList<>(); + + public String gestureToSet = null; + + public final List statusToSet = new ArrayList<>(); protected PetAction(PetTasks petTask, boolean stopsPetWalking) @@ -22,5 +32,6 @@ public abstract class PetAction this.stopsPetWalking = stopsPetWalking; } + public abstract boolean apply(Pet pet, Habbo habbo, String[] data); } diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetBreedingReward.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetBreedingReward.java index a0d8b2f9..38c216fc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetBreedingReward.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetBreedingReward.java @@ -5,8 +5,13 @@ import java.sql.SQLException; public class PetBreedingReward { + public final int petType; + + public final int rarityLevel; + + public final int breed; public PetBreedingReward(ResultSet set) throws SQLException diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java index 90a46bf5..da071b43 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetCommand.java @@ -9,12 +9,25 @@ import java.sql.SQLException; public class PetCommand implements Comparable { + public final int id; + + public final String key; + + public final int level; + + public final int xp; + + public final int energyCost; + + public final int happynessCost; + + public final PetAction action; public PetCommand(ResultSet set, PetAction action) throws SQLException diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetData.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetData.java index 4dc0343c..e83a06ac 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetData.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetData.java @@ -18,33 +18,67 @@ import java.util.List; public class PetData implements Comparable { + private int type; + + private String name; + public static final String BLINK = "eyb"; + + public static final String SPEAK = "spk"; + + public static final String EAT = "eat"; public static final String PLAYFUL = "pla"; + public String[] actionsHappy; + + public String[] actionsTired; + + public String[] actionsRandom; + private List petCommands; + private List nestItems; + + private List foodItems; + + private List drinkItems; + + private List toyItems; + public static final List generalDrinkItems = new ArrayList<>(); + + public static final List generalFoodItems = new ArrayList<>(); + + public static final List generalNestItems = new ArrayList<>(); + + public static final List generalToyItems = new ArrayList<>(); + public THashMap> petVocals; + + public static final THashMap> generalPetVocals = new THashMap<>(); + + private int offspringType; + public PetData(ResultSet set) throws SQLException { this.load(set); @@ -54,6 +88,7 @@ public class PetData implements Comparable { this.type = set.getInt("pet_type"); this.name = set.getString("pet_name"); + this.offspringType = set.getInt("offspring_type"); this.actionsHappy = set.getString("happy_actions").split(";"); this.actionsTired = set.getString("tired_actions").split(";"); this.actionsRandom = set.getString("random_actions").split(";"); @@ -90,37 +125,50 @@ public class PetData implements Comparable return this.petCommands; } + public int getType() { return this.type; } + public String getName() { return this.name; } - public void addNest(Item item) + + public int getOffspringType() { - if(item != null) - this.nestItems.add(item); + return this.offspringType; } + + public void addNest(Item nest) + { + if(nest != null) + this.nestItems.add(nest); + } + + public List getNests() { return this.nestItems; } - public boolean haveNest(HabboItem item) + + public boolean haveNest(HabboItem nest) { - return this.haveNest(item.getBaseItem()); + return this.haveNest(nest.getBaseItem()); } - boolean haveNest(Item item) + + boolean haveNest(Item nest) { - return PetData.generalNestItems.contains(item) || this.nestItems.contains(item); + return PetData.generalNestItems.contains(nest) || this.nestItems.contains(nest); } + public HabboItem randomNest(THashSet items) { List nestList = new ArrayList<>(); @@ -143,26 +191,31 @@ public class PetData implements Comparable return null; } - public void addFoodItem(Item item) + + public void addFoodItem(Item food) { - this.foodItems.add(item); + this.foodItems.add(food); } + public List getFoodItems() { return this.foodItems; } - public boolean haveFoodItem(HabboItem item) + + public boolean haveFoodItem(HabboItem food) { - return this.haveFoodItem(item.getBaseItem()); + return this.haveFoodItem(food.getBaseItem()); } - boolean haveFoodItem(Item item) + + boolean haveFoodItem(Item food) { - return this.foodItems.contains(item) || PetData.generalFoodItems.contains(item); + return this.foodItems.contains(food) || PetData.generalFoodItems.contains(food); } + public HabboItem randomFoodItem(THashSet items) { List foodList = new ArrayList<>(); @@ -184,26 +237,31 @@ public class PetData implements Comparable return null; } + public void addDrinkItem(Item item) { this.drinkItems.add(item); } + public List getDrinkItems() { return this.drinkItems; } + public boolean haveDrinkItem(HabboItem item) { return this.haveDrinkItem(item.getBaseItem()); } + boolean haveDrinkItem(Item item) { return this.drinkItems.contains(item) || PetData.generalDrinkItems.contains(item); } + public HabboItem randomDrinkItem(THashSet items) { List drinkList = new ArrayList<>(); @@ -225,31 +283,36 @@ public class PetData implements Comparable return null; } - public void addToyItem(Item item) + + public void addToyItem(Item toy) { - this.toyItems.add(item); + this.toyItems.add(toy); } + public List getToyItems() { return this.toyItems; } - public boolean haveToyItem(HabboItem item) + + public boolean haveToyItem(HabboItem toy) { - return this.haveToyItem(item.getBaseItem()); + return this.haveToyItem(toy.getBaseItem()); } - public boolean haveToyItem(Item item) + + public boolean haveToyItem(Item toy) { - return this.toyItems.contains(item) || PetData.generalToyItems.contains(item); + return this.toyItems.contains(toy) || PetData.generalToyItems.contains(toy); } - public HabboItem randomToyItem(THashSet items) + + public HabboItem randomToyItem(THashSet toys) { List toyList = new ArrayList<>(); - for(InteractionPetToy toy : items) + for(InteractionPetToy toy : toys) { if(this.haveToyItem(toy)) { @@ -266,6 +329,7 @@ public class PetData implements Comparable return null; } + public PetVocal randomVocal(PetVocalsType type) { //TODO: Remove this useless copying. diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java index ec8faee2..08de6e9d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetManager.java @@ -16,7 +16,9 @@ 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.procedure.TIntObjectProcedure; import gnu.trove.set.hash.THashSet; +import org.apache.commons.math3.distribution.NormalDistribution; import java.sql.*; import java.util.ArrayList; @@ -63,6 +65,7 @@ public class PetManager put(36, new ActionBreatheFire()); put(38, new ActionTorch()); put(43, new ActionEat()); + put(46, new ActionBreed()); } }; @@ -81,6 +84,7 @@ public class PetManager this.loadRaces(connection); this.loadPetData(connection); this.loadPetCommands(connection); + this.loadPetBreeding(connection); } catch (SQLException e) { @@ -92,6 +96,7 @@ public class PetManager Emulator.getLogging().logStart("Pet Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)"); } + public void reloadPetData() { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) @@ -319,6 +324,35 @@ public class PetManager return null; } + public TIntObjectHashMap> getBreedingRewards(int petType) + { + return this.breedingReward.get(petType); + } + + public int getRarityForOffspring(Pet pet) + { + final int[] rarityLevel = {0}; + + TIntObjectHashMap> offspringList = this.breedingReward.get(pet.getPetData().getType()); + + offspringList.forEachEntry(new TIntObjectProcedure>() + { + @Override + public boolean execute(int i, ArrayList petBreedingRewards) + { + if (petBreedingRewards.contains(pet.getRace())) + { + rarityLevel[0] = i; + return false; + } + + return true; + } + }); + + return 4 - rarityLevel[0]; + } + public static int getLevel(int experience) { int index = 0; @@ -433,10 +467,15 @@ public class PetManager } public Pet createPet(int type, String name, GameClient client) + { + return this.createPet(type, Emulator.getRandom().nextInt(this.petRaces.get(type).size() + 1), name, client); + } + + public Pet createPet(int type, int race, String name, GameClient client) { if (this.petData.containsKey(type)) { - Pet pet = new Pet(type, Emulator.getRandom().nextInt(this.petRaces.get(type).size() + 1), "FFFFFF", name, client.getHabbo().getHabboInfo().getId()); + Pet pet = new Pet(type, race, "FFFFFF", name, client.getHabbo().getHabboInfo().getId()); pet.needsUpdate = true; pet.run(); return pet; @@ -594,4 +633,14 @@ public class PetManager return false; } -} + + public static NormalDistribution getNormalDistributionForBreeding(int levelOne, int levelTwo) + { + return getNormalDistributionForBreeding((levelOne + levelTwo) / 2); + } + + public static NormalDistribution getNormalDistributionForBreeding(double avgLevel) + { + return new NormalDistribution(avgLevel, (20 - (avgLevel / 2)) / 2); + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/PetRace.java b/src/main/java/com/eu/habbo/habbohotel/pets/PetRace.java index 296edf17..f7935cca 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/PetRace.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/PetRace.java @@ -5,10 +5,19 @@ import java.sql.SQLException; public class PetRace { + public final int race; + + public final int colorOne; + + public final int colorTwo; + + public final boolean hasColorOne; + + public final boolean hasColorTwo; public PetRace(ResultSet set) throws SQLException diff --git a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java index 870dfc55..7ddef52e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java +++ b/src/main/java/com/eu/habbo/habbohotel/pets/actions/ActionBreed.java @@ -7,6 +7,7 @@ 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; +import org.apache.commons.lang3.StringUtils; public class ActionBreed extends PetAction { @@ -21,7 +22,7 @@ public class ActionBreed extends PetAction InteractionPetBreedingNest nest = null; for (HabboItem item : pet.getRoom().getRoomSpecialTypes().getItemsOfType(InteractionPetBreedingNest.class)) { - if (item.getBaseItem().getName().contains(pet.getPetData().getName())) + if (StringUtils.containsIgnoreCase(item.getBaseItem().getName(), pet.getPetData().getName())) { if (!((InteractionPetBreedingNest)item).boxFull()) { diff --git a/src/main/java/com/eu/habbo/habbohotel/polls/Poll.java b/src/main/java/com/eu/habbo/habbohotel/polls/Poll.java index ead82380..f58a09b5 100644 --- a/src/main/java/com/eu/habbo/habbohotel/polls/Poll.java +++ b/src/main/java/com/eu/habbo/habbohotel/polls/Poll.java @@ -7,10 +7,18 @@ import java.util.Collections; public class Poll { - private int id; - private String title; - private String thanksMessage; - private String badgeReward; + + public final int id; + + + public final String title; + + + public final String thanksMessage; + + + public final String badgeReward; + public int lastQuestionId; private ArrayList questions; @@ -24,26 +32,6 @@ public class Poll this.questions = new ArrayList<>(); } - public int getId() - { - return this.id; - } - - public String getTitle() - { - return this.title; - } - - public String getThanksMessage() - { - return this.thanksMessage; - } - - public String getBadgeReward() - { - return this.badgeReward; - } - public ArrayList getQuestions() { return this.questions; @@ -53,7 +41,7 @@ public class Poll { for (PollQuestion q : this.questions) { - if (q.getId() == id) + if (q.id == id) { return q; } diff --git a/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java b/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java index 7fb84a5c..18e03a54 100644 --- a/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/polls/PollManager.java @@ -15,6 +15,7 @@ public class PollManager this.loadPolls(); } + public void loadPolls() { synchronized (this.activePolls) @@ -57,7 +58,7 @@ public class PollManager } } - poll.lastQuestionId = question.getId(); + poll.lastQuestionId = question.id; } } } @@ -70,11 +71,13 @@ public class PollManager } } + public Poll getPoll(int pollId) { return this.activePolls.get(pollId); } + public static boolean donePoll(Habbo habbo, int pollId) { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT NULL FROM polls_answers WHERE poll_id = ? AND user_id = ? LIMIT 1")) diff --git a/src/main/java/com/eu/habbo/habbohotel/polls/PollQuestion.java b/src/main/java/com/eu/habbo/habbohotel/polls/PollQuestion.java index 30b3695b..fb600e7d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/polls/PollQuestion.java +++ b/src/main/java/com/eu/habbo/habbohotel/polls/PollQuestion.java @@ -12,14 +12,28 @@ import java.util.Map; public class PollQuestion implements ISerialize, Comparable { - private int id; - private int parentId; - private int type; - private String question; - private THashMap options; + + public final int id; + + + public final int parentId; + + + public final int type; + + + public final String question; + + + public final THashMap options; + + + public final int minSelections; + + + public final int order; + private ArrayList subQuestions; - private int minSelections; - private int order; public PollQuestion(ResultSet set) throws SQLException { @@ -44,31 +58,6 @@ public class PollQuestion implements ISerialize, Comparable } } - public int getId() - { - return this.id; - } - - public int getType() - { - return this.type; - } - - public String getQuestion() - { - return this.question; - } - - public THashMap getOptions() - { - return this.options; - } - - public int getMinSelections() - { - return this.minSelections; - } - public void addSubQuestion(PollQuestion pollQuestion) { this.subQuestions.add(pollQuestion); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java index 44452c3a..77e1bf63 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/CustomRoomLayout.java @@ -10,13 +10,13 @@ import java.sql.SQLException; public class CustomRoomLayout extends RoomLayout implements Runnable { private boolean needsUpdate; - private Room room; + private final int roomId; public CustomRoomLayout(ResultSet set, Room room) throws SQLException { super(set, room); - this.room = room; + this.roomId = room.getId(); } @Override @@ -32,7 +32,7 @@ public class CustomRoomLayout extends RoomLayout implements Runnable statement.setInt(2, this.getDoorY()); statement.setInt(3, this.getDoorDirection()); statement.setString(4, this.getHeightmap()); - statement.setInt(5, this.room.getId()); + statement.setInt(5, this.roomId); statement.execute(); } catch (SQLException e) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java b/src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java new file mode 100644 index 00000000..00674246 --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/FurnitureMovementError.java @@ -0,0 +1,24 @@ +package com.eu.habbo.habbohotel.rooms; + +public enum FurnitureMovementError +{ + NONE(""), + NO_RIGHTS("${room.error.cant_set_not_owner}"), + INVALID_MOVE("${room.error.cant_set_item}"), + CANT_STACK("${room.error.cant_set_item}"), + CANCEL_PLUGIN_PLACE("${room.error.plugin_place}"), + CANCEL_PLUGIN_MOVE("${room.error.plugin_move}"), + CANCEL_PLUGIN_ROTATE("${room.error.plugin_rotate}"), + TILE_HAS_HABBOS("${room.error.cant_set_item}"), + TILE_HAS_PETS("${room.error.cant_set_item}"), + TILE_HAS_BOTS("${room.error.cant_set_item}"), + MAX_DIMMERS("${room.error.max_dimmers}"), + MAX_SOUNDFURNI("${room.errors.max_soundfurni}"); + + FurnitureMovementError(String errorCode) + { + this.errorCode = errorCode; + } + + public final String errorCode; +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java index c12ef1b1..124e498b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/Room.java @@ -46,8 +46,7 @@ import com.eu.habbo.messages.outgoing.rooms.pets.RoomPetComposer; import com.eu.habbo.messages.outgoing.rooms.users.*; import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer; import com.eu.habbo.plugin.Event; -import com.eu.habbo.plugin.events.furniture.FurniturePickedUpEvent; -import com.eu.habbo.plugin.events.furniture.FurnitureRolledEvent; +import com.eu.habbo.plugin.events.furniture.*; import com.eu.habbo.plugin.events.rooms.RoomLoadedEvent; import com.eu.habbo.plugin.events.rooms.RoomUnloadedEvent; import com.eu.habbo.plugin.events.rooms.RoomUnloadingEvent; @@ -68,6 +67,7 @@ import gnu.trove.procedure.TIntObjectProcedure; import gnu.trove.procedure.TObjectProcedure; import gnu.trove.set.hash.THashSet; import io.netty.util.internal.ConcurrentSet; +import org.apache.commons.math3.util.Pair; import java.awt.*; import java.sql.Connection; @@ -646,7 +646,7 @@ public class Room implements Comparable, ISerialize, Runnable } RoomTileState result = RoomTileState.OPEN; HabboItem lowestItem = null; - HabboItem lowestChair = null; + HabboItem lowestChair = this.getLowestChair(tile); for (HabboItem item : this.getItemsAt(tile)) { if (lowestChair != null && item.getZ() > lowestChair.getZ() + 1.5) @@ -667,15 +667,10 @@ public class Room implements Comparable, ISerialize, Runnable result = checkStateForItem(item); } } - else - { - if (item.getBaseItem().allowSit()) - { - lowestChair = item; - } - } } + if (lowestChair != null) return RoomTileState.SIT; + return result; } @@ -841,25 +836,29 @@ public class Room implements Comparable, ISerialize, Runnable public void updateHabbo(Habbo habbo) { - HabboItem item = this.getTopItemAt(habbo.getRoomUnit().getX(), habbo.getRoomUnit().getY()); + updateRoomUnit(habbo.getRoomUnit()); + } + public void updateRoomUnit(RoomUnit roomUnit) + { + HabboItem item = this.getTopItemAt(roomUnit.getX(), roomUnit.getY()); - if((item == null && !habbo.getRoomUnit().cmdSit) || (item != null && !item.getBaseItem().allowSit())) - habbo.getRoomUnit().removeStatus(RoomUnitStatus.SIT); + if((item == null && !roomUnit.cmdSit) || (item != null && !item.getBaseItem().allowSit())) + roomUnit.removeStatus(RoomUnitStatus.SIT); if(item != null) { if(item.getBaseItem().allowSit()) { - habbo.getRoomUnit().setZ(item.getZ()); + roomUnit.setZ(item.getZ()); } else { - habbo.getRoomUnit().setZ(item.getZ() + item.getBaseItem().getHeight()); + roomUnit.setZ(item.getZ() + item.getBaseItem().getHeight()); } } - this.sendComposer(new RoomUserStatusComposer(habbo.getRoomUnit()).compose()); + this.sendComposer(new RoomUserStatusComposer(roomUnit).compose()); } public void updateHabbosAt(short x, short y) @@ -882,6 +881,8 @@ public class Room implements Comparable, ISerialize, Runnable if(item.getBaseItem().allowSit()) { habbo.getRoomUnit().setZ(item.getZ()); + habbo.getRoomUnit().setPreviousLocationZ(item.getZ()); + habbo.getRoomUnit().setRotation(RoomUserRotation.fromValue(item.getRotation())); } else { @@ -1378,6 +1379,11 @@ public class Room implements Comparable, ISerialize, Runnable THashSet messages = new THashSet<>(); + //Find alternative for this. + //Reason is that tile gets updated after every roller. + List rollerFurniIds = new ArrayList<>(); + List rolledUnitIds = new ArrayList<>(); + this.roomSpecialTypes.getRollers().forEachValue(new TObjectProcedure() { @Override @@ -1406,12 +1412,21 @@ public class Room implements Comparable, ISerialize, Runnable if (tileInFront == null) return true; - if(!layout.tileExists(tileInFront.x, tileInFront.y)) + if (roller.getZ() != 0) + return true; + + if (!layout.tileExists(tileInFront.x, tileInFront.y)) return true; if (tileInFront.state == RoomTileState.INVALID) return true; + if (!tileInFront.getAllowStack() && !(tileInFront.isWalkable() || tileInFront.state == RoomTileState.SIT || tileInFront.state == RoomTileState.LAY)) + return true; + + if (tileInFront.getStackHeight() > Item.getCurrentHeight(roller)) + return true; + if (hasHabbosAt(tileInFront.x, tileInFront.y)) return true; @@ -1420,7 +1435,7 @@ public class Room implements Comparable, ISerialize, Runnable List toRemove = new ArrayList<>(); for (HabboItem item : itemsOnRoller) { - if (item.getX() != roller.getX() || item.getY() != roller.getY()) + if (item.getX() != roller.getX() || item.getY() != roller.getY() || rollerFurniIds.contains(item.getId())) { toRemove.add(item); } @@ -1451,24 +1466,111 @@ public class Room implements Comparable, ISerialize, Runnable } break; - } - else + } else { allowFurniture = false; } } + if (allowFurniture) + { + allowFurniture = tileInFront.getAllowStack(); + } + double zOffset = 0; - if(newRoller != null) + if (newRoller != null) { if (!itemsNewTile.isEmpty() && (newRoller == null || itemsNewTile.size() > 1)) { return true; } - } - else + } else { - zOffset = -roller.getBaseItem().getHeight(); + zOffset = -roller.getBaseItem().getHeight() + tileInFront.getStackHeight(); + } + + + + if (allowUsers) + { + Event roomUserRolledEvent = null; + + if (Emulator.getPluginManager().isRegistered(UserRolledEvent.class, true)) + { + roomUserRolledEvent = new UserRolledEvent(null, null, null); + } + + for (Habbo habbo : habbosOnRoller) + { + if (rolledUnitIds.contains(habbo.getRoomUnit().getId())) continue; + + rolledUnitIds.add(habbo.getRoomUnit().getId()); + + if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable())) + continue; + + if (!habbo.getRoomUnit().hasStatus(RoomUnitStatus.MOVE)) + { + RoomTile tile = tileInFront.copy(); + tile.setStackHeight(habbo.getRoomUnit().getZ() + zOffset); + if (roomUserRolledEvent != null) + { + roomUserRolledEvent = new UserRolledEvent(habbo, roller, tile); + Emulator.getPluginManager().fireEvent(roomUserRolledEvent); + + if (roomUserRolledEvent.isCancelled()) + continue; + } + + messages.add(new RoomUnitOnRollerComposer(habbo.getRoomUnit(), roller, tile, room)); + + if (itemsOnRoller.isEmpty()) + { + HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y); + + if (item != null && itemsNewTile.contains(item)) + { + try + { + item.onWalkOn(habbo.getRoomUnit(), room, null); + } catch (Exception e) + { + Emulator.getLogging().logErrorLine(e); + } + } + } + + + + + +// + +// + + + + + + + + + } + + if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) + habbo.getRoomUnit().sitUpdate = true; + + break; + } + } + + if (!messages.isEmpty()) + { + for (MessageComposer message : messages) + { + room.sendComposer(message.compose()); + } + messages.clear(); } if (allowFurniture || (!allowFurniture && !stackContainsRoller)) @@ -1482,69 +1584,53 @@ public class Room implements Comparable, ISerialize, Runnable if (newRoller == null || topItem == newRoller) { - for (HabboItem item : itemsOnRoller) + List sortedItems = new ArrayList(itemsOnRoller); + Collections.sort(sortedItems, new Comparator() { - if (item.getX() == roller.getX() && item.getY() == roller.getY()) + @Override + public int compare(HabboItem o1, HabboItem o2) { - if (furnitureRolledEvent != null) - { - furnitureRolledEvent = new FurnitureRolledEvent(item, roller, tileInFront); - Emulator.getPluginManager().fireEvent(furnitureRolledEvent); - - if (furnitureRolledEvent.isCancelled()) - continue; - } + return o1.getZ() > o2.getZ() ? -1 : 1; + } + }); + for (HabboItem item : sortedItems) + { + if (item.getX() == roller.getX() && item.getY() == roller.getY() && zOffset <= 0) + { if (item != roller) + { + if (furnitureRolledEvent != null) + { + furnitureRolledEvent = new FurnitureRolledEvent(item, roller, tileInFront); + Emulator.getPluginManager().fireEvent(furnitureRolledEvent); + + if (furnitureRolledEvent.isCancelled()) + continue; + } + messages.add(new FloorItemOnRollerComposer(item, roller, tileInFront, zOffset, room)); + rollerFurniIds.add(item.getId()); + } } } } } - if (allowUsers) + + if (!messages.isEmpty()) { - Event roomUserRolledEvent = null; - - if(Emulator.getPluginManager().isRegistered(UserRolledEvent.class, true)) + for (MessageComposer message : messages) { - roomUserRolledEvent = new UserRolledEvent(null, null, null); - } - - for (Habbo habbo : habbosOnRoller) - { - if (stackContainsRoller && !allowFurniture && !(topItem != null && topItem.isWalkable())) - continue; - - if (!habbo.getRoomUnit().hasStatus(RoomUnitStatus.MOVE)) - { - RoomTile tile = tileInFront.copy(); - tile.setStackHeight(habbo.getRoomUnit().getZ() + zOffset); - if(roomUserRolledEvent != null) - { - roomUserRolledEvent = new UserRolledEvent(habbo, roller, tile); - Emulator.getPluginManager().fireEvent(roomUserRolledEvent); - - if(roomUserRolledEvent.isCancelled()) - continue; - } - - messages.add(new RoomUnitOnRollerComposer(habbo.getRoomUnit(), roller, tile, room)); - } - - if(habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) - habbo.getRoomUnit().sitUpdate = true; + room.sendComposer(message.compose()); } + messages.clear(); } return true; } }); - for (MessageComposer message : messages) - { - this.sendComposer(message.compose()); - } for(HabboItem pyramid : this.roomSpecialTypes.getItemsOfType(InteractionPyramid.class)) { @@ -2127,6 +2213,12 @@ public class Room implements Comparable, ISerialize, Runnable return this.publicRoom; } + + public void setPublicRoom(boolean publicRoom) + { + this.publicRoom = publicRoom; + } + public boolean isStaffPromotedRoom() { return this.staffPromotedRoom; @@ -2794,6 +2886,10 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomSpecialTypes.addUndefined(item); } + else if (item instanceof InteractionSnowboardSlope) + { + this.roomSpecialTypes.addUndefined(item); + } } } @@ -3004,6 +3100,10 @@ public class Room implements Comparable, ISerialize, Runnable { this.roomSpecialTypes.removeUndefined(item); } + else if (item instanceof InteractionSnowboardSlope) + { + this.roomSpecialTypes.removeUndefined(item); + } } } } @@ -3157,6 +3257,58 @@ public class Room implements Comparable, ISerialize, Runnable return this.currentBots.get(botId); } + public Bot getBot(RoomUnit roomUnit) + { + synchronized (this.currentBots) + { + TIntObjectIterator iterator = this.currentBots.iterator(); + + for(int i = this.currentBots.size(); i-- > 0;) + { + try + { + iterator.advance(); + } + catch (NoSuchElementException e) + { + Emulator.getLogging().logErrorLine(e); + break; + } + + if (iterator.value().getRoomUnit() == roomUnit) + return iterator.value(); + } + } + + return null; + } + + public Bot getBotByRoomUnitId(int id) + { + synchronized (this.currentBots) + { + TIntObjectIterator iterator = this.currentBots.iterator(); + + for(int i = this.currentBots.size(); i-- > 0;) + { + try + { + iterator.advance(); + } + catch (NoSuchElementException e) + { + Emulator.getLogging().logErrorLine(e); + break; + } + + if (iterator.value().getRoomUnit().getId() == id) + return iterator.value(); + } + } + + return null; + } + public List getBots(String name) { List bots = new ArrayList<>(); @@ -3330,6 +3482,34 @@ public class Room implements Comparable, ISerialize, Runnable return false; } + public THashSet getBotsAt(RoomTile tile) + { + THashSet bots = new THashSet<>(); + synchronized (this.currentBots) + { + TIntObjectIterator botIterator = this.currentBots.iterator(); + + for (int i = this.currentBots.size(); i-- > 0; ) + { + try + { + botIterator.advance(); + + if (botIterator.value().getRoomUnit().getCurrentLocation().equals(tile)) + { + bots.add(botIterator.value()); + } + } + catch (Exception e) + { + break; + } + } + } + + return bots; + } + public THashSet getHabbosAt(short x, short y) { return getHabbosAt(this.layout.getTile(x, y)); @@ -3362,6 +3542,20 @@ public class Room implements Comparable, ISerialize, Runnable return habbos; } + public THashSet getBotsOnItem(HabboItem item) + { + THashSet bots = new THashSet<>(); + for(short x = item.getX(); x < item.getX() + item.getBaseItem().getLength(); x++) + { + for(short y = item.getY(); y < item.getY() + item.getBaseItem().getWidth(); y++) + { + bots.addAll(getBotsAt(this.getLayout().getTile(x, y))); + } + } + + return bots; + } + public void teleportHabboToItem(Habbo habbo, HabboItem item) { this.teleportHabboToLocation(habbo, item.getX(), item.getY(), item.getZ() + item.getBaseItem().getHeight()); @@ -3442,6 +3636,18 @@ public class Room implements Comparable, ISerialize, Runnable } } } + + HabboItem doorTileTopItem = this.getTopItemAt(habbo.getRoomUnit().getX(), habbo.getRoomUnit().getY()); + if (doorTileTopItem != null) + { + try + { + doorTileTopItem.onWalkOn(habbo.getRoomUnit(), this, new Object[]{}); + } catch (Exception e) + { + Emulator.getLogging().logErrorLine(e); + } + } } public void floodMuteHabbo(Habbo habbo, int timeOut) @@ -3600,7 +3806,6 @@ public class Room implements Comparable, ISerialize, Runnable ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose(); boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit"); - for (Habbo h : this.getHabbos()) { if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance || @@ -3610,12 +3815,12 @@ public class Room implements Comparable, ISerialize, Runnable { if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) { - if (prefixMessage != null) + if (prefixMessage != null && !h.getHabboStats().preferOldChat) { h.getClient().sendResponse(prefixMessage); } h.getClient().sendResponse(message); - if (clearPrefixMessage != null) + if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) { h.getClient().sendResponse(clearPrefixMessage); } @@ -3631,9 +3836,9 @@ public class Room implements Comparable, ISerialize, Runnable { if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) { - if (prefixMessage != null){ h.getClient().sendResponse(prefixMessage); } + if (prefixMessage != null && !h.getHabboStats().preferOldChat){ h.getClient().sendResponse(prefixMessage); } h.getClient().sendResponse(message); - if (clearPrefixMessage != null){ h.getClient().sendResponse(clearPrefixMessage); } + if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat){ h.getClient().sendResponse(clearPrefixMessage); } } } } @@ -3661,39 +3866,37 @@ public class Room implements Comparable, ISerialize, Runnable } } - if(roomChatMessage.getBubble()!= RoomChatMessageBubbles.PARROT && - roomChatMessage.getBubble() != RoomChatMessageBubbles.FORTUNE_TELLER) + if(roomChatMessage.getBubble().triggersTalkingFurniture()) { - synchronized (this.roomSpecialTypes) + THashSet items = this.roomSpecialTypes.getItemsOfType(InteractionTalkingFurniture.class); + + for (HabboItem item : items) { - THashSet items = this.roomSpecialTypes.getItemsOfType(InteractionTalkingFurniture.class); - - for (HabboItem item : items) + if (this.layout.getTile(item.getX(), item.getY()).distance(habbo.getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("furniture.talking.range")) { - if (this.layout.getTile(item.getX(), item.getY()).distance(habbo.getRoomUnit().getCurrentLocation()) <= Emulator.getConfig().getInt("furniture.talking.range")) + int count = Emulator.getConfig().getInt(item.getBaseItem().getName() + ".message.count", 0); + + if (count > 0) { - int count = Emulator.getConfig().getInt(item.getBaseItem().getName() + ".message.count", 0); + int randomValue = Emulator.getRandom().nextInt(count + 1); - if (count > 0) + RoomChatMessage itemMessage = new RoomChatMessage(Emulator.getTexts().getValue(item.getBaseItem().getName() + ".message." + randomValue, item.getBaseItem().getName() + ".message." + randomValue + " not found!"), habbo, RoomChatMessageBubbles.getBubble(Emulator.getConfig().getInt(item.getBaseItem().getName() + ".message.bubble", RoomChatMessageBubbles.PARROT.getType()))); + + this.sendComposer(new RoomUserShoutComposer(itemMessage).compose()); + + try { - int randomValue = Emulator.getRandom().nextInt(count + 1); - - RoomChatMessage itemMessage = new RoomChatMessage(Emulator.getTexts().getValue(item.getBaseItem().getName() + ".message." + randomValue, item.getBaseItem().getName() + ".message." + randomValue + " not found!"), habbo, RoomChatMessageBubbles.getBubble(Emulator.getConfig().getInt(item.getBaseItem().getName() + ".message.bubble"))); - - this.talk(habbo, itemMessage, chatType); - - try - { - item.onClick(habbo.getClient(), this, new Object[0]); - } - catch (Exception e) - { - Emulator.getLogging().logErrorLine(e); - } + item.onClick(habbo.getClient(), this, new Object[0]); + break; + } + catch (Exception e) + { + Emulator.getLogging().logErrorLine(e); } } } } + } } } @@ -3906,6 +4109,28 @@ public class Room implements Comparable, ISerialize, Runnable return items; } + public boolean hasItemsAt(int x, int y) + { + TIntObjectIterator iterator = this.roomItems.iterator(); + + for (int i = this.roomItems.size(); i-- > 0; ) + { + HabboItem habboItem; + try + { + iterator.advance(); + habboItem = iterator.value(); + } catch (Exception e) + { + break; + } + + if (habboItem.getX() == x && habboItem.getY() == y) return true; + } + + return false; + } + public HabboItem getTopItemAt(int x, int y) { return this.getTopItemAt(x, y, null); @@ -4045,20 +4270,21 @@ public class Room implements Comparable, ISerialize, Runnable return null; } - public double getStackHeight(int x, int y, boolean calculateHeightmap) + public double getStackHeight(short x, short y, boolean calculateHeightmap, HabboItem exclude) { if(x < 0 || y < 0) - return 0.0; + return calculateHeightmap ? Short.MAX_VALUE : 0.0; double height = this.layout.getHeightAtSquare(x, y); boolean canStack = true; boolean stackHelper = false; THashSet items = this.getItemsAt(x, y); - if (items != null) { for (HabboItem item : items) { + if (item == exclude) continue; + if (item instanceof InteractionStackHelper) { stackHelper = true; @@ -4069,41 +4295,48 @@ public class Room implements Comparable, ISerialize, Runnable if (!stackHelper) { - for (HabboItem item : items) + HabboItem item = this.getTopItemAt(x, y, exclude); + if (canStack) { - if (item.getBaseItem().allowSit()) + if (item != null) { canStack = item.getBaseItem().allowStack(); - if (!canStack) - { - height = -1.0D; - break; - } - } - - if (!item.getBaseItem().allowStack()) - { - canStack = false; - height = -1.0D; - break; - } - - double itemHeight = item.getBaseItem().getHeight() + item.getZ(); - - if (item instanceof InteractionMultiHeight) - { - if (item.getExtradata().length() == 0) - { - item.setExtradata("0"); - } - itemHeight += Item.getCurrentHeight(item); - } - - if (itemHeight > height) - { - height = itemHeight; + height = item.getZ() + Item.getCurrentHeight(item); } } + + + + + + + + + + + +// + + + + + +// +// + + + + + + + + +// + + + + + } } @@ -4112,66 +4345,68 @@ public class Room implements Comparable, ISerialize, Runnable return (canStack ? height * 256.0D : Short.MAX_VALUE); } - return height; + return canStack ? height : -1; } - public double getStackHeight(int x, int y, boolean calculateHeightmap, HabboItem exclude) + public double getStackHeight(short x, short y, boolean calculateHeightmap) { - if(x < 0 || y < 0) - return 0.0; - - double height = this.layout.getHeightAtSquare(x, y); - boolean canStack = true; - - THashSet items = this.getItemsAt(x, y); - if (items != null && !items.isEmpty()) - { - for (HabboItem item : items) - { - if (item == exclude) - continue; + return this.getStackHeight(x, y, calculateHeightmap, null); +// - if (item.getBaseItem().allowSit()) - { - canStack = item.getBaseItem().allowStack(); - if (!canStack) - { - height = 0.0D; - break; - } - } +// - if (!item.getBaseItem().allowStack()) - { - canStack = false; - break; - } - double itemHeight = item.getBaseItem().getHeight() + item.getZ(); +// - if (item instanceof InteractionMultiHeight) - { - if (item.getExtradata().length() == 0) - { - item.setExtradata("0"); - } - itemHeight += Item.getCurrentHeight(item); - } - if (itemHeight > height) - { - height = itemHeight; - } - } - } - if(calculateHeightmap) - { - return (canStack ? height * 256.0D : 65535.0D); - } - return height; + + + +// +// + + + + + + + + + +// + + + + + +// + +// + + + + + + + + +// + + + + + + +// + + + + +// + } public boolean hasObjectTypeAt(Class type, int x, int y) @@ -4380,7 +4615,6 @@ public class Room implements Comparable, ISerialize, Runnable public void sendComposerToHabbosWithRights(ServerMessage message) { for (Habbo habbo : this.getHabbos()) - { if (hasRights(habbo)) { @@ -4734,7 +4968,7 @@ public class Room implements Comparable, ISerialize, Runnable public void giveEffect(RoomUnit roomUnit, int effectId) { - if (this.allowEffects) + if (this.allowEffects && roomUnit != null) { roomUnit.setEffectId(effectId); this.sendComposer(new RoomUserEffectComposer(roomUnit).compose()); @@ -4743,8 +4977,13 @@ public class Room implements Comparable, ISerialize, Runnable public void giveHandItem(Habbo habbo, int handItem) { - habbo.getRoomUnit().setHandItem(handItem); - this.sendComposer(new RoomUserHandItemComposer(habbo.getRoomUnit()).compose()); + giveHandItem(habbo.getRoomUnit(), handItem); + } + + public void giveHandItem(RoomUnit roomUnit, int handItem) + { + roomUnit.setHandItem(handItem); + this.sendComposer(new RoomUserHandItemComposer(roomUnit).compose()); } public void updateItem(HabboItem item) @@ -4974,12 +5213,14 @@ public class Room implements Comparable, ISerialize, Runnable { habbo.getRoomUnit().setIdle(); this.sendComposer(new RoomUnitIdleComposer(habbo.getRoomUnit()).compose()); + WiredHandler.handle(WiredTriggerType.IDLES, habbo.getRoomUnit(), this, new Object[]{habbo}); } public void unIdle(Habbo habbo) { habbo.getRoomUnit().resetIdleTimer(); this.sendComposer(new RoomUnitIdleComposer(habbo.getRoomUnit()).compose()); + WiredHandler.handle(WiredTriggerType.UNIDLES, habbo.getRoomUnit(), this, new Object[]{habbo}); } public void dance(Habbo habbo, DanceType danceType) @@ -5231,6 +5472,11 @@ public class Room implements Comparable, ISerialize, Runnable + this.sendComposer(new RemoveFloorItemComposer(item).compose()); + } + + for (HabboItem item : this.roomSpecialTypes.getExtras()) + { this.sendComposer(new RemoveFloorItemComposer(item).compose()); } } @@ -5239,6 +5485,207 @@ public class Room implements Comparable, ISerialize, Runnable this.sendComposer(new RoomFloorItemsComposer(this.furniOwnerNames, this.roomSpecialTypes.getTriggers()).compose()); this.sendComposer(new RoomFloorItemsComposer(this.furniOwnerNames, this.roomSpecialTypes.getEffects()).compose()); this.sendComposer(new RoomFloorItemsComposer(this.furniOwnerNames, this.roomSpecialTypes.getConditions()).compose()); + this.sendComposer(new RoomFloorItemsComposer(this.furniOwnerNames, this.roomSpecialTypes.getExtras()).compose()); } } + + public FurnitureMovementError canPlaceFurnitureAt(HabboItem item, Habbo habbo, RoomTile tile, int rotation) + { + if (this.hasRights(habbo) || this.guildRightLevel(habbo) >= 2) + { + return FurnitureMovementError.NONE; + } + + if(!habbo.getHabboStats().canRentSpace()) + { + HabboItem rentSpace = this.getHabboItem(habbo.getHabboStats().rentedItemId); + + if (rentSpace != null) + { + if(!RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(tile.x, tile.y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) + { + return FurnitureMovementError.NO_RIGHTS; + } + else + { + return FurnitureMovementError.NONE; + } + } + } + + return FurnitureMovementError.NO_RIGHTS; + } + + public FurnitureMovementError placeFloorFurniAt(HabboItem item, RoomTile tile, int rotation, Habbo owner) throws Exception + { + if(Emulator.getPluginManager().isRegistered(FurniturePlacedEvent.class, true)) + { + Event furniturePlacedEvent = new FurniturePlacedEvent(item, owner, tile); + Emulator.getPluginManager().fireEvent(furniturePlacedEvent); + + if(furniturePlacedEvent.isCancelled()) + return FurnitureMovementError.CANCEL_PLUGIN_PLACE; + } + + THashSet occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); + + //if (!item.getBaseItem().allowSit() && !item.getBaseItem().allowLay()) + { + for (RoomTile t : occupiedTiles) + { + if (this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS; + if (this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS; + if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS; + } + } + + List>> tileFurniList = new ArrayList<>(); + for (RoomTile t : occupiedTiles) + { + tileFurniList.add(Pair.create(t, this.getItemsAt(t))); + } + + if (!item.canStackAt(this, tileFurniList)) + { + return FurnitureMovementError.CANT_STACK; + } + + item.setZ(tile.getStackHeight()); + item.setX(tile.x); + item.setY(tile.y); + item.setRotation(rotation); + if (!this.furniOwnerNames.containsKey(item.getUserId()) && owner != null) + { + this.furniOwnerNames.put(item.getUserId(), owner.getHabboInfo().getUsername()); + } + + item.needsUpdate(true); + this.addHabboItem(item); + item.setRoomId(this.id); + item.onPlace(this); + this.updateTiles(occupiedTiles); + this.sendComposer(new AddFloorItemComposer(item, this.getFurniOwnerName(item.getUserId())).compose()); + + for (RoomTile t : occupiedTiles) + { + this.updateHabbosAt(t.x, t.y); + } + + Emulator.getThreading().run(item); + return FurnitureMovementError.NONE; + } + + public FurnitureMovementError placeWallFurniAt(HabboItem item, String wallPosition, Habbo owner) + { + if(Emulator.getPluginManager().isRegistered(FurniturePlacedEvent.class, true)) + { + Event furniturePlacedEvent = new FurniturePlacedEvent(item, owner, null); + Emulator.getPluginManager().fireEvent(furniturePlacedEvent); + + if(furniturePlacedEvent.isCancelled()) + return FurnitureMovementError.CANCEL_PLUGIN_PLACE; + } + + item.setWallPosition(wallPosition); + if (!this.furniOwnerNames.containsKey(item.getUserId()) && owner != null) + { + this.furniOwnerNames.put(item.getUserId(), owner.getHabboInfo().getUsername()); + } + this.sendComposer(new AddWallItemComposer(item, this.getFurniOwnerName(item.getUserId())).compose()); + item.needsUpdate(true); + this.addHabboItem(item); + item.setRoomId(this.id); + item.onPlace(this); + Emulator.getThreading().run(item); + return FurnitureMovementError.NONE; + } + + public FurnitureMovementError moveFurniTo(HabboItem item, RoomTile tile, int rotation, Habbo actor) + { + RoomTile oldLocation = this.layout.getTile(item.getX(), item.getY()); + if(Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) + { + if (Emulator.getPluginManager().fireEvent(new FurnitureMovedEvent(item, actor, oldLocation, tile)).isCancelled()) + return FurnitureMovementError.CANCEL_PLUGIN_MOVE; + } + + HabboItem topItem = this.getTopItemAt(tile.x, tile.y); + + //Check if can be placed at new position + THashSet occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); + if (topItem != item) + { + for (RoomTile t : occupiedTiles) + { + if (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack()) + return FurnitureMovementError.CANT_STACK; + if (this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS; + if (this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS; + if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS; + } + } + + List>> tileFurniList = new ArrayList<>(); + for (RoomTile t : occupiedTiles) + { + tileFurniList.add(Pair.create(t, this.getItemsAt(t))); + } + + if (!item.canStackAt(this, tileFurniList)) + { + return FurnitureMovementError.CANT_STACK; + } + + THashSet oldOccupiedTiles = this.layout.getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + + int oldRotation = item.getRotation(); + item.setRotation(rotation); + if(Emulator.getPluginManager().isRegistered(FurnitureRotatedEvent.class, true)) + { + Event furnitureRotatedEvent = new FurnitureRotatedEvent(item, actor, oldRotation); + Emulator.getPluginManager().fireEvent(furnitureRotatedEvent); + + if(furnitureRotatedEvent.isCancelled()) + { + item.setRotation(oldRotation); + return FurnitureMovementError.CANCEL_PLUGIN_ROTATE; + } + } + //Place at new position + item.setX(tile.x); + item.setY(tile.y); + item.setZ(this.getStackHeight(tile.x, tile.y, false, item)); + if (item.getZ() > 40d) + { + item.setZ(40); + } + + //Update old & new tiles + occupiedTiles.removeAll(oldOccupiedTiles); + + this.updateTiles(oldOccupiedTiles); + this.updateTiles(occupiedTiles); + + //Update Habbos at old position + for (RoomTile t : occupiedTiles) + { + this.updateHabbosAt(t.x, t.y); + } + + //Update Habbos at new position + for (RoomTile t : oldOccupiedTiles) + { + this.updateHabbosAt(t.x, t.y); + } + + //Update Furniture + item.onMove(this, oldLocation, tile); + item.needsUpdate(true); + Emulator.getThreading().run(item); + + this.sendComposer(new FloorItemUpdateComposer(item).compose()); + return FurnitureMovementError.NONE; + } + + } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java index 14de5f4c..895076dd 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomBan.java @@ -9,9 +9,16 @@ import java.sql.SQLException; public class RoomBan { + public final int roomId; + + public final int userId; + + public final String username; + + public final int endTimestamp; public RoomBan(int roomId, int userId, String username, int endTimestamp) @@ -30,6 +37,7 @@ public class RoomBan this.endTimestamp = set.getInt("ends"); } + public void insert() { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO room_bans (room_id, user_id, ends) VALUES (?, ?, ?)")) @@ -45,6 +53,7 @@ public class RoomBan } } + public void delete() { try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_bans WHERE room_id = ? AND user_id = ?")) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java index 999726d8..f1476b96 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessage.java @@ -146,7 +146,7 @@ public class RoomChatMessage implements Runnable, ISerialize, Loggable } @Override - public synchronized void run() + public void run() { if(habbo == null) return; diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java index bde22022..42086bef 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomChatMessageBubbles.java @@ -2,62 +2,64 @@ package com.eu.habbo.habbohotel.rooms; public enum RoomChatMessageBubbles { - NORMAL(0, "", true), - ALERT(1, "", true), - BOT(2, "", true), - RED(3, "", true), - BLUE(4, "", true), - YELLOW(5, "", true), - GREEN(6, "", true), - BLACK(7, "", true), - FORTUNE_TELLER(8, "", false), - ZOMBIE_ARM(9, "", true), - SKELETON(10, "", true), - LIGHT_BLUE(11, "", true), - PINK(12, "", true), - PURPLE(13, "", true), - DARK_YEWLLOW(14, "", true), - DARK_BLUE(15, "", true), - HEARTS(16, "", true), - ROSES(17, "", true), - UNUSED(18, "", true), //? - PIG(19, "", true), - DOG(20, "", true), - BLAZE_IT(21, "", true), - DRAGON(22, "", true), - STAFF(23, "", false), - BATS(24, "", true), - MESSENGER(25, "", true), - STEAMPUNK(26, "", true), - THUNDER(27, "", true), - PARROT(28, "", false), - PIRATE(29, "", false), - BOT_GUIDE(30, "", true), - BOT_RENTABLE(31, "", true), - SCARY_THING(32, "", true), - FRANK(33, "", true), - WIRED(34, "", false), - GOAT(35, "", true), - SANTA(36, "", true), - AMBASSADOR(37, "acc_ambassador", false), - RADIO(38, "", true), - UNKNOWN_39(39, "", true), - UNKNOWN_40(40, "", true), - UNKNOWN_41(41, "", true), - UNKNOWN_42(42, "", true), - UNKNOWN_43(43, "", true), - UNKNOWN_44(44, "", true), - UNKNOWN_45(45, "", true); + NORMAL(0, "", true, true), + ALERT(1, "", true, true), + BOT(2, "", true, true), + RED(3, "", true, true), + BLUE(4, "", true, true), + YELLOW(5, "", true, true), + GREEN(6, "", true, true), + BLACK(7, "", true, true), + FORTUNE_TELLER(8, "", false, false), + ZOMBIE_ARM(9, "", true, false), + SKELETON(10, "", true, false), + LIGHT_BLUE(11, "", true, true), + PINK(12, "", true, true), + PURPLE(13, "", true, true), + DARK_YEWLLOW(14, "", true, true), + DARK_BLUE(15, "", true, true), + HEARTS(16, "", true, true), + ROSES(17, "", true, true), + UNUSED(18, "", true, true), //? + PIG(19, "", true, true), + DOG(20, "", true, true), + BLAZE_IT(21, "", true, true), + DRAGON(22, "", true, true), + STAFF(23, "", false, true), + BATS(24, "", true, false), + MESSENGER(25, "", true, false), + STEAMPUNK(26, "", true, false), + THUNDER(27, "", true, true), + PARROT(28, "", false, false), + PIRATE(29, "", false, false), + BOT_GUIDE(30, "", true, true), + BOT_RENTABLE(31, "", true, true), + SCARY_THING(32, "", true, false), + FRANK(33, "", true, false), + WIRED(34, "", false, true), + GOAT(35, "", true, false), + SANTA(36, "", true, false), + AMBASSADOR(37, "acc_ambassador", false, true), + RADIO(38, "", true, false), + UNKNOWN_39(39, "", true, false), + UNKNOWN_40(40, "", true, false), + UNKNOWN_41(41, "", true, false), + UNKNOWN_42(42, "", true, false), + UNKNOWN_43(43, "", true, false), + UNKNOWN_44(44, "", true, false), + UNKNOWN_45(45, "", true, false); private final int type; private final String permission; private final boolean overridable; + private final boolean triggersTalkingFurniture; - RoomChatMessageBubbles(int type, String permission, boolean overridable) + RoomChatMessageBubbles(int type, String permission, boolean overridable, boolean triggersTalkingFurniture) { this.type = type; this.permission = permission; this.overridable = overridable; + this.triggersTalkingFurniture = triggersTalkingFurniture; } public int getType() @@ -75,6 +77,10 @@ public enum RoomChatMessageBubbles return this.overridable; } + public boolean triggersTalkingFurniture() + { + return this.triggersTalkingFurniture; + } public static RoomChatMessageBubbles getBubble(int bubbleId) { try diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java index 7919ce26..2c7de486 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java @@ -246,6 +246,12 @@ public class RoomLayout return this.tileExists(x, y) && this.roomTiles[x][y].state == RoomTileState.OPEN && this.roomTiles[x][y].isWalkable(); } + public boolean isVoidTile(short x, short y) + { + if (!tileExists(x, y)) return true; + return this.roomTiles[x][y].state == RoomTileState.INVALID; + } + public RoomTileState getStateAt(short x, short y) { return this.roomTiles[x][y].state; @@ -307,7 +313,7 @@ public class RoomLayout if (!ALLOW_FALLING && height < - MAXIMUM_STEP_HEIGHT) continue; //If the step difference is bigger than the maximum step height, continue. - if (height > MAXIMUM_STEP_HEIGHT) continue; + if (height > MAXIMUM_STEP_HEIGHT && currentAdj.state == RoomTileState.OPEN) continue; //Check if the tile has habbos. if (!this.room.isAllowWalkthrough() && room.hasHabbosAt(currentAdj.x, currentAdj.y)) { closedList.add(currentAdj); openList.remove(currentAdj); continue;} @@ -393,83 +399,135 @@ public class RoomLayout return cheapest; } - private List getAdjacent(List closedList, RoomTile node, RoomTile nextTile) + private List getAdjacent(List openList, RoomTile node, RoomTile nextTile) { short x = node.x; short y = node.y; List adj = new LinkedList<>(); if (x > 0) { - RoomTile temp = findTile(adj, (short) (x - 1), y); + RoomTile temp = findTile(openList, (short) (x - 1), y); if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) { - temp.isDiagonally(false); - adj.add(temp); + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(false); + if (!adj.contains(temp)) + adj.add(temp); + } } } if (x < this.mapSizeX) { - RoomTile temp = findTile(closedList, (short) (x + 1), y); + RoomTile temp = findTile(openList, (short) (x + 1), y); if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) { - temp.isDiagonally(false); - adj.add(temp); + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(false); + if (!adj.contains(temp)) + adj.add(temp); + } } } if (y > 0) { - RoomTile temp = findTile(closedList, x, (short) (y - 1)); + RoomTile temp = findTile(openList, x, (short) (y - 1)); if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) { - temp.isDiagonally(false); - adj.add(temp); + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(false); + if (!adj.contains(temp)) + adj.add(temp); + } } } if (y < this.mapSizeY) { - RoomTile temp = findTile(closedList, x, (short) (y + 1)); + RoomTile temp = findTile(openList, x, (short) (y + 1)); if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) { - temp.isDiagonally(false); - adj.add(temp); + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(false); + if (!adj.contains(temp)) + adj.add(temp); + } } } if (CANMOVEDIAGONALY) { if ((x < this.mapSizeX) && (y < this.mapSizeY)) { - RoomTile temp = findTile(closedList, (short) (x + 1), (short) (y + 1)); - if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + RoomTile offX = findTile(openList, (short) (x + 1), y); + RoomTile offY = findTile(openList, x, (short) (y+1)); + if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) { - temp.isDiagonally(true); - adj.add(temp); + RoomTile temp = findTile(openList, (short) (x + 1), (short) (y + 1)); + if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + { + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(true); + if (!adj.contains(temp)) + adj.add(temp); + } + } } } if ((x > 0) && (y > 0)) { - RoomTile temp = findTile(closedList, (short) (x - 1), (short) (y - 1)); - if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + RoomTile offX = findTile(openList, (short) (x - 1), y); + RoomTile offY = findTile(openList, x, (short) (y - 1)); + if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) { - temp.isDiagonally(true); - adj.add(temp); + RoomTile temp = findTile(openList, (short) (x - 1), (short) (y - 1)); + if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + { + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(true); + if (!adj.contains(temp)) + adj.add(temp); + } + } } } if ((x > 0) && (y < this.mapSizeY)) { - RoomTile temp = findTile(closedList, (short) (x - 1), (short) (y + 1)); - if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + RoomTile offX = findTile(openList, (short) (x - 1), y); + RoomTile offY = findTile(openList, x, (short) (y+1)); + if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) { - temp.isDiagonally(true); - adj.add(temp); + RoomTile temp = findTile(openList, (short) (x - 1), (short) (y + 1)); + if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + { + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(true); + if (!adj.contains(temp)) + adj.add(temp); + } + } } } if ((x < this.mapSizeX) && (y > 0)) { - RoomTile temp = findTile(closedList, (short) (x + 1), (short) (y - 1)); - if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + RoomTile offX = findTile(openList, (short) (x + 1), y); + RoomTile offY = findTile(openList, x, (short) (y - 1)); + if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) { - temp.isDiagonally(true); - adj.add(temp); + RoomTile temp = findTile(openList, (short) (x + 1), (short) (y - 1)); + if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) + { + if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) + { + temp.isDiagonally(true); + if (!adj.contains(temp)) + adj.add(temp); + } + } } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java index 769377cc..c7e6e1bb 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomManager.java @@ -453,9 +453,9 @@ public class RoomManager for(Room room : roomsToDispose) { + room.dispose(); if(room.getUserCount() == 0) this.activeRooms.remove(room.getId()); - room.dispose(); } } @@ -1464,7 +1464,7 @@ public class RoomManager { if (guild.getOwnerId() != habbo.getHabboInfo().getId()) { - Room room = this.loadRoom(guild.getRoomId()); + Room room = this.getRoom(guild.getRoomId()); if (room != null) { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java index 95fbba78..7c24e635 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomSpecialTypes.java @@ -491,6 +491,21 @@ public class RoomSpecialTypes } + public THashSet getExtras() + { + synchronized (this.wiredExtras) + { + THashSet conditions = new THashSet<>(); + + for (Map.Entry map : this.wiredExtras.entrySet()) + { + conditions.add(map.getValue()); + } + + return conditions; + } + } + public THashSet getExtras(int x, int y) { synchronized (this.wiredExtras) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java index aca68c27..b41f94f8 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java @@ -53,7 +53,14 @@ public class RoomTile public void setStackHeight(double stackHeight) { - if (stackHeight >= 0) + if (this.state == RoomTileState.INVALID) + { + this.stackHeight = Short.MAX_VALUE; + this.allowStack = false; + return; + } + + if (stackHeight >= 0 && stackHeight != Short.MAX_VALUE) { this.stackHeight = stackHeight; this.allowStack = true; @@ -67,17 +74,17 @@ public class RoomTile public boolean getAllowStack() { + if (this.state == RoomTileState.INVALID) + { + return false; + } + return this.allowStack; } public void setAllowStack(boolean allowStack) { this.allowStack = allowStack; - - if (this.state == RoomTileState.INVALID) - { - this.allowStack = false; - } } public short relativeHeight() diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index 29ab029b..e3cd3520 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -40,6 +40,7 @@ public class RoomUnit private boolean inRoom; private boolean canWalk; + public boolean canRotate = true; private boolean fastWalk = false; public boolean animateWalk = false; public boolean cmdTeleport = false; @@ -238,6 +239,15 @@ public class RoomUnit item = lowestChair; } + if (next.equals(this.goalLocation) && next.state == RoomTileState.SIT) + { + if (item == null || item.getZ() - this.getZ() > RoomLayout.MAXIMUM_STEP_HEIGHT) + { + this.status.remove(RoomUnitStatus.MOVE); + return false; + } + } + double zHeight = 0.0D; if (habbo != null) @@ -252,7 +262,7 @@ public class RoomUnit if (habboItem != null) { if (habboItem != item || !RoomLayout.pointInSquare(habboItem.getX(), habboItem.getY(), habboItem.getX() + habboItem.getBaseItem().getWidth() - 1, habboItem.getY() + habboItem.getBaseItem().getLength() - 1, next.x, next.y)) - habboItem.onWalkOff(this, room, null); + habboItem.onWalkOff(this, room, new Object[]{this.getCurrentLocation(), next}); } this.tilesWalked++; @@ -682,6 +692,8 @@ public class RoomUnit public void lookAtPoint(RoomTile location) { + if (!this.canRotate) return; + if(Emulator.getPluginManager().isRegistered(RoomUnitLookAtPointEvent.class, false)) { Event lookAtPointEvent = new RoomUnitLookAtPointEvent(this.room, this, location); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUserRotation.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUserRotation.java index f6dbe326..2b558fa1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUserRotation.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUserRotation.java @@ -1,7 +1,7 @@ package com.eu.habbo.habbohotel.rooms; - -public enum RoomUserRotation { +public enum RoomUserRotation +{ NORTH(0), NORTH_EAST(1), EAST(2), diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java index bef41862..4f64228e 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java @@ -1,6 +1,9 @@ package com.eu.habbo.habbohotel.users; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.achievements.Achievement; +import com.eu.habbo.habbohotel.achievements.AchievementManager; +import com.eu.habbo.habbohotel.bots.Bot; import com.eu.habbo.habbohotel.gameclients.GameClient; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.IEventTriggers; @@ -14,6 +17,8 @@ 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.ServerMessage; +import gnu.trove.set.hash.THashSet; +import org.apache.commons.math3.util.Pair; import java.sql.Connection; import java.sql.PreparedStatement; @@ -338,7 +343,32 @@ public abstract class HabboItem implements Runnable, IEventTriggers public void onPlace(Room room) { + //TODO: IMPORTANT: MAKE THIS GENERIC. (HOLES, ICE SKATE PATCHES, BLACK HOLE, BUNNY RUN FIELD, FOOTBALL FIELD) + Achievement roomDecoAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoFurniCount"); + Habbo owner = room.getHabbo(this.getUserId()); + int furniCollecterProgress = 0; + if (owner == null) + { + furniCollecterProgress = AchievementManager.getAchievementProgressForHabbo(this.getUserId(), roomDecoAchievement); + } + else + { + furniCollecterProgress = owner.getHabboStats().getAchievementProgress(roomDecoAchievement); + } + + int difference = room.getUserFurniCount(this.getUserId()) - furniCollecterProgress; + if (difference > 0) + { + if (owner != null) + { + AchievementManager.progressAchievement(owner, roomDecoAchievement, difference); + } + else + { + AchievementManager.progressAchievement(this.getUserId(), roomDecoAchievement, difference); + } + } } public void onPickUp(Room room) @@ -350,13 +380,24 @@ public abstract class HabboItem implements Runnable, IEventTriggers if (this.getBaseItem().getEffectM() > 0 && habbo.getHabboInfo().getGender().equals(HabboGender.M) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) { room.giveEffect(habbo, 0); - return; } if (this.getBaseItem().getEffectF() > 0 && habbo.getHabboInfo().getGender().equals(HabboGender.F) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectF()) { room.giveEffect(habbo, 0); - return; + } + } + + for (Bot bot : room.getBotsAt(room.getLayout().getTile(this.getX(), this.getY()))) + { + if (this.getBaseItem().getEffectM() > 0 && bot.getGender().equals(HabboGender.M) && bot.getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) + { + room.giveEffect(bot.getRoomUnit(), 0); + } + + if (this.getBaseItem().getEffectF() > 0 && bot.getGender().equals(HabboGender.F) && bot.getRoomUnit().getEffectId() == this.getBaseItem().getEffectF()) + { + room.giveEffect(bot.getRoomUnit(), 0); } } } @@ -368,31 +409,34 @@ public abstract class HabboItem implements Runnable, IEventTriggers { List oldHabbos = new ArrayList<>(); List newHabbos = new ArrayList<>(); + List oldBots = new ArrayList<>(); + List newBots = new ArrayList<>(); for (RoomTile tile : room.getLayout().getTilesAt(oldLocation, this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) { oldHabbos.addAll(room.getHabbosAt(tile)); + oldBots.addAll(room.getBotsAt(tile)); } for (RoomTile tile : room.getLayout().getTilesAt(oldLocation, this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation())) { newHabbos.addAll(room.getHabbosAt(tile)); + newBots.addAll(room.getBotsAt(tile)); } oldHabbos.removeAll(newHabbos); + oldBots.removeAll(newBots); for (Habbo habbo : oldHabbos) { if (this.getBaseItem().getEffectM() > 0 && habbo.getHabboInfo().getGender().equals(HabboGender.M) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) { room.giveEffect(habbo, 0); - return; } if (this.getBaseItem().getEffectF() > 0 && habbo.getHabboInfo().getGender().equals(HabboGender.F) && habbo.getRoomUnit().getEffectId() == this.getBaseItem().getEffectF()) { room.giveEffect(habbo, 0); - return; } } @@ -401,13 +445,37 @@ public abstract class HabboItem implements Runnable, IEventTriggers if (this.getBaseItem().getEffectM() > 0 && habbo.getHabboInfo().getGender().equals(HabboGender.M) && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) { room.giveEffect(habbo, this.getBaseItem().getEffectM()); - return; } if (this.getBaseItem().getEffectF() > 0 && habbo.getHabboInfo().getGender().equals(HabboGender.F) && habbo.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) { room.giveEffect(habbo, this.getBaseItem().getEffectF()); - return; + } + } + + for (Bot bot : oldBots) + { + if (this.getBaseItem().getEffectM() > 0 && bot.getGender().equals(HabboGender.M) && bot.getRoomUnit().getEffectId() == this.getBaseItem().getEffectM()) + { + room.giveEffect(bot.getRoomUnit(), 0); + } + + if (this.getBaseItem().getEffectF() > 0 && bot.getGender().equals(HabboGender.F) && bot.getRoomUnit().getEffectId() == this.getBaseItem().getEffectF()) + { + room.giveEffect(bot.getRoomUnit(), 0); + } + } + + for (Bot bot : newBots) + { + if (this.getBaseItem().getEffectM() > 0 && bot.getGender().equals(HabboGender.M) && bot.getRoomUnit().getEffectId() != this.getBaseItem().getEffectM()) + { + room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectM()); + } + + if (this.getBaseItem().getEffectF() > 0 && bot.getGender().equals(HabboGender.F) && bot.getRoomUnit().getEffectId() != this.getBaseItem().getEffectF()) + { + room.giveEffect(bot.getRoomUnit(), this.getBaseItem().getEffectF()); } } } @@ -433,4 +501,9 @@ public abstract class HabboItem implements Runnable, IEventTriggers { return this.baseItem.getStateCount() > 1; } + + public boolean canStackAt(Room room, List>> itemsAtLocation) + { + return true; + } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java index cbf3fefd..1997a7dc 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboManager.java @@ -99,7 +99,7 @@ public class HabboManager if (habbo != null) { habbo.getClient().sendResponse(new GenericAlertComposer(Emulator.getTexts().getValue("loggedin.elsewhere"))); - Emulator.getGameServer().getGameClientManager().disposeClient(habbo.getClient().getChannel()); + Emulator.getGameServer().getGameClientManager().disposeClient(habbo.getClient()); habbo = null; } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java index d7c3a2b0..36731a86 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/WardrobeComponent.java @@ -109,19 +109,19 @@ public class WardrobeComponent this.habbo = habbo; } - public synchronized HabboGender getGender() + public HabboGender getGender() { - return gender; + return this.gender; } - public synchronized void setGender(HabboGender gender) + public void setGender(HabboGender gender) { this.gender = gender; } public Habbo getHabbo() { - return habbo; + return this.habbo; } public void setHabbo(Habbo habbo) @@ -129,12 +129,12 @@ public class WardrobeComponent this.habbo = habbo; } - public synchronized String getLook() + public String getLook() { - return look; + return this.look; } - public synchronized void setLook(String look) + public void setLook(String look) { this.look = look; } @@ -151,7 +151,7 @@ public class WardrobeComponent public int getSlotId() { - return slotId; + return this.slotId; } @Override diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredConditionOperator.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredConditionOperator.java new file mode 100644 index 00000000..7b6fde3a --- /dev/null +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredConditionOperator.java @@ -0,0 +1,7 @@ +package com.eu.habbo.habbohotel.wired; + +public enum WiredConditionOperator +{ + AND, + OR; +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java index 70cd6be4..0f641d80 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredHandler.java @@ -46,6 +46,9 @@ public class WiredHandler { boolean talked = false; + if (!Emulator.isReady) + return false; + if (room == null) return false; @@ -83,26 +86,39 @@ public class WiredHandler public static boolean handle(InteractionWiredTrigger trigger, final RoomUnit roomUnit, final Room room, final Object[] stuff) { long millis = System.currentTimeMillis(); - if(trigger.canExecute(millis) && trigger.execute(roomUnit, room, stuff)) + if(Emulator.isReady && trigger.canExecute(millis) && trigger.execute(roomUnit, room, stuff)) { + trigger.setCooldown(millis); trigger.activateBox(room); THashSet conditions = room.getRoomSpecialTypes().getConditions(trigger.getX(), trigger.getY()); THashSet effects = room.getRoomSpecialTypes().getEffects(trigger.getX(), trigger.getY()); - if(Emulator.getPluginManager().fireEvent(new WiredStackTriggeredEvent(room, roomUnit, trigger, effects, conditions)).isCancelled()) return false; - for(InteractionWiredCondition condition : conditions) + if (!conditions.isEmpty()) { - if(condition.execute(roomUnit, room, stuff)) + ArrayList matchedConditions = new ArrayList<>(conditions.size()); + for (InteractionWiredCondition searchMatched : conditions) { - condition.activateBox(room); + if (!matchedConditions.contains(searchMatched.getType()) && searchMatched.operator() == WiredConditionOperator.OR && searchMatched.execute(roomUnit, room, stuff)) + { + matchedConditions.add(searchMatched.getType()); + } } - else + + for (InteractionWiredCondition condition : conditions) { - if(!Emulator.getPluginManager().fireEvent(new WiredConditionFailedEvent(room, roomUnit, trigger, condition)).isCancelled()) - return false; + if ((condition.operator() == WiredConditionOperator.OR && matchedConditions.contains(condition.getType())) || + (condition.operator() == WiredConditionOperator.AND && condition.execute(roomUnit, room, stuff))) + { + condition.activateBox(room); + } + else + { + if (!Emulator.getPluginManager().fireEvent(new WiredConditionFailedEvent(room, roomUnit, trigger, condition)).isCancelled()) + return false; + } } } diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredMatchFurniSetting.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredMatchFurniSetting.java index a981713a..db8ea970 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/WiredMatchFurniSetting.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredMatchFurniSetting.java @@ -7,16 +7,14 @@ public class WiredMatchFurniSetting public final int rotation; public final int x; public final int y; - public final double z; - public WiredMatchFurniSetting(int itemId, String state, int rotation, int x, int y, double z) + public WiredMatchFurniSetting(int itemId, String state, int rotation, int x, int y) { this.itemId = itemId; this.state = state.replace("\t\t\t", " "); this.rotation = rotation; this.x = x; this.y = y; - this.z = z; } @Override @@ -27,7 +25,7 @@ public class WiredMatchFurniSetting public String toString(boolean includeState) { - return itemId + "-" + (state.isEmpty() || !includeState ? " " : state) + "-" + rotation + "-" + x + "-" + y + "-" + z; + return itemId + "-" + (state.isEmpty() || !includeState ? " " : state) + "-" + rotation + "-" + x + "-" + y; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/wired/WiredTriggerType.java b/src/main/java/com/eu/habbo/habbohotel/wired/WiredTriggerType.java index 8bd9a339..5b733096 100644 --- a/src/main/java/com/eu/habbo/habbohotel/wired/WiredTriggerType.java +++ b/src/main/java/com/eu/habbo/habbohotel/wired/WiredTriggerType.java @@ -16,7 +16,9 @@ public enum WiredTriggerType PERIODICALLY_LONG(12), BOT_REACHED_STF(13), BOT_REACHED_AVTR(14), - SAY_COMMAND(0); + SAY_COMMAND(0), + IDLES(11), + UNIDLES(12); public final int code; diff --git a/src/main/java/com/eu/habbo/messages/PacketManager.java b/src/main/java/com/eu/habbo/messages/PacketManager.java index 4d50853d..84c37d36 100644 --- a/src/main/java/com/eu/habbo/messages/PacketManager.java +++ b/src/main/java/com/eu/habbo/messages/PacketManager.java @@ -547,9 +547,11 @@ public class PacketManager this.registerHandler(Incoming.HorseRideEvent, HorseRideEvent.class); this.registerHandler(Incoming.ToggleMonsterplantBreedableEvent, ToggleMonsterplantBreedableEvent.class); this.registerHandler(Incoming.CompostMonsterplantEvent, CompostMonsterplantEvent.class); - this.registerHandler(Incoming.BreedPetsEvent, BreedPetsEvent.class); + this.registerHandler(Incoming.BreedMonsterplantsEvent, BreedMonsterplantsEvent.class); this.registerHandler(Incoming.MovePetEvent, MovePetEvent.class); this.registerHandler(Incoming.PetPackageNameEvent, PetPackageNameEvent.class); + this.registerHandler(Incoming.StopBreedingEvent, StopBreedingEvent.class); + this.registerHandler(Incoming.ConfirmPetBreedingEvent, ConfirmPetBreedingEvent.class); } void registerWired() throws Exception diff --git a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java index b84bc999..c8f17bed 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/Incoming.java +++ b/src/main/java/com/eu/habbo/messages/incoming/Incoming.java @@ -312,7 +312,7 @@ public class Incoming public static final int JukeBoxRemoveSoundTrackEvent = 3050; public static final int ToggleMonsterplantBreedableEvent = 3379; public static final int CompostMonsterplantEvent = 3835; - public static final int BreedPetsEvent = 1638; + public static final int BreedMonsterplantsEvent = 1638; public static final int MovePetEvent = 3449; public static final int PetPackageNameEvent = 3698; @@ -343,6 +343,8 @@ public class Incoming public static final int HotelViewRequestLTDAvailabilityEvent = 410; public static final int PurchaseTargetOfferEvent = 1826; public static final int TargetOfferStateEvent = 2041; + public static final int StopBreedingEvent = 2713; + public static final int ConfirmPetBreedingEvent = 3382; public static final int GuildForumDataEvent = 3149; public static final int UNKNOWN_GUILD_FORUMS_EVENT2 = 3900; diff --git a/src/main/java/com/eu/habbo/messages/incoming/Incoming_1006.java b/src/main/java/com/eu/habbo/messages/incoming/Incoming_1006.java deleted file mode 100644 index d8a5f3f2..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/Incoming_1006.java +++ /dev/null @@ -1,266 +0,0 @@ -package com.eu.habbo.messages.incoming; - -public class Incoming_1006 -{ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static final int MannequinSaveLookEvent = 3770; - public static final int RequestCatalogPageEvent = 2914; - public static final int RequestWearingBadgesEvent = 3466; - public static final int BotPickupEvent = 665; - public static final int HorseRideEvent = 1027; - public static final int CreateRoomEvent = 238; - public static final int SaveMottoEvent = 1037; - public static final int GenerateSecretKeyEvent = -1; - public static final int ModToolAlertEvent = 2890; - public static final int TradeAcceptEvent = 368; - public static final int RequestCatalogModeEvent = 2711; - public static final int RequestUserCreditsEvent = 2845; - public static final int FriendPrivateMessageEvent = 3710; - public static final int CloseDiceEvent = 57; - public static final int RoomUserRemoveRightsEvent = 1599; - public static final int GuildDeclineMembershipEvent = 1328; - public static final int AnswerPollEvent = 2135; - public static final int UserWearBadgeEvent = 741; - public static final int RoomVoteEvent = -242; - public static final int RoomUserSignEvent = 2065; - public static final int RequestUserDataEvent = 882; - public static final int RoomUserShoutEvent = 1788; - public static final int ScratchPetEvent = 965; - public static final int RoomUserWalkEvent = 3690; - public static final int RequestUserTagsEvent = 3430; - public static final int RequestTagsEvent = 753; - public static final int GetMarketplaceConfigEvent = 3774; - public static final int RequestHeightmapEvent = 859; - public static final int TradeCloseEvent = 3012; - public static final int CatalogBuyItemEvent = 3964; - public static final int RequestGuildMembersEvent = 3204; - public static final int RequestPetInformationEvent = 2827; - public static final int RoomUserWhisperEvent = 3908; - public static final int ModToolRequestUserInfoEvent = 607; - public static final int RotateMoveItemEvent = 1219; - public static final int CancelPollEvent = 1628; - public static final int RequestRoomLoadEvent = 1988; - public static final int RequestGuildPartsEvent = 1902; - public static final int RoomPlacePaintEvent = 1892; - public static final int RequestPopularRoomsEvent = 464; - public static final int ModToolRequestRoomInfoEvent = 1450; - public static final int FriendRequestEvent = 2791; - public static final int RecycleEvent = 3277; - public static final int RequestRoomCategoriesEvent = 3498; - public static final int ToggleWallItemEvent = 3050; - public static final int RoomUserTalkEvent = 104; - public static final int HotelViewDataEvent = 2507; - public static final int RoomUserDanceEvent = 649; - public static final int RequestUserProfileEvent = 1389; - public static final int SearchRoomsFriendsNowEvent = 1082; - public static final int SetStackHelperHeightEvent = 2790; - public static final int RedeemVoucherEvent = 3024; - public static final int HorseUseItemEvent = 2590; - public static final int BuyItemEvent = 2847; - public static final int AdvertisingSaveEvent = 1829; - public static final int RequestPetTrainingPanelEvent = 2251; - public static final int RoomBackgroundEvent = 2496; - public static final int RequestNewsListEvent = 1134; - public static final int RequestPromotedRoomsEvent = 1558; - public static final int GuildSetAdminEvent = 3704; - public static final int GetClubDataEvent = 3240; - public static final int RequestMeMenuSettingsEvent = 2169; - public static final int MannequinSaveNameEvent = 1289; - public static final int SellItemEvent = 1522; - public static final int GuildAcceptMembershipEvent = 538; - public static final int RequestBannerToken = -1; - public static final int RequestRecylerLogicEvent = 1170; - public static final int RequestGuildJoinEvent = 794; - public static final int RequestCatalogIndexEvent = 2806; - public static final int RequestInventoryPetsEvent = 3760; - public static final int ModToolRequestRoomVisitsEvent = 2287; - public static final int ModToolWarnEvent = 2890; - public static final int RequestItemInfoEvent = 2042; - public static final int ModToolRequestRoomChatlogEvent = 3209; - public static final int UserSaveLookEvent = 2242; - public static final int ToggleFloorItemEvent = 2693; - public static final int TradeUnAcceptEvent = 126; - public static final int WiredTriggerSaveDataEvent = 3593; - public static final int RoomRemoveAllRightsEvent = 3764; - public static final int TakeBackItemEvent = 1455; - public static final int OpenRecycleBoxEvent = 0x0F00; - public static final int GuildChangeNameDescEvent = 1485; - public static final int RequestSellItemEvent = 876; - public static final int ModToolChangeRoomSettingsEvent = 3244; - public static final int ModToolRequestUserChatlogEvent = 3209; - public static final int GuildChangeSettingsEvent = 2258; - public static final int RoomUserDropHandItemEvent = 1108; - public static final int RequestProfileFriendsEvent = 3701; - public static final int TradeCancelOfferItemEvent = 2170; - public static final int TriggerDiceEvent = 386; - public static final int GetPollDataEvent = 2263; - public static final int MachineIDEvent = 686; - public static final int RequestDiscountEvent = 1995; - public static final int RequestFriendRequestEvent = 3739; - public static final int RoomSettingsSaveEvent = 1290; - public static final int AcceptFriendRequest = 3383; - public static final int ReleaseVersionEvent = 4000; - public static final int SearchRoomsMyFavoriteEvent = 3124; - public static final int TradeStartEvent = 3304; - public static final int ChangeRelationEvent = 2632; - public static final int RoomUserSitEvent = 272; - public static final int RequestCanCreateRoomEvent = 3903; - public static final int ModToolKickEvent = 1459; - public static final int MoveWallItemEvent = 3455; - public static final int SearchRoomsEvent = 3844; - public static final int RequestHighestScoreRoomsEvent = 1814; - public static final int CatalogBuyItemAsGiftEvent = 1066; - public static final int RoomUserGiveRespectEvent = 3121; - public static final int RemoveFriendEvent = 1535; - public static final int SearchRoomsFriendsOwnEvent = 725; - public static final int GuildSetFavoriteEvent = 2754; - public static final int PetPlaceEvent = 1961; - public static final int BotSettingsEvent = 3292; - public static final int StalkFriendEvent = 1925; - public static final int RoomPickupItemEvent = 2463; - public static final int RedeemItemEvent = 1242; - public static final int RequestFriendsEvent = 1904; - public static final int RequestAchievementsEvent = 2697; - public static final int GuildChangeColorsEvent = 3873; - public static final int RequestInventoryBadgesEvent = 2450; - public static final int RequestPetBreedsEvent = 2828; - public static final int GuildChangeBadgeEvent = 838; - public static final int ModToolBanEvent = 701; - public static final int SaveWardrobeEvent = 2921; - public static final int HotelViewEvent = 3603; - public static final int ModToolPickTicketEvent = 2980; - public static final int ModToolReleaseTicketEvent = 3905; - public static final int ModToolCloseTicketEvent = 3904; - public static final int TriggerColorWheelEvent = 2556; - public static final int SearchRoomsByTagEvent = 3844; - public static final int RequestPublicRoomsEvent = 2057; - public static final int RequestResolutionEvent = 305; - public static final int RequestInventoryItemsEvent = 2194; - public static final int ModToolRoomAlertEvent = 2550; - public static final int WiredEffectSaveDataEvent = 2856; - public static final int CheckPetNameEvent = 3699; - public static final int SecureLoginEvent = 2243; - public static final int BotSaveSettingsEvent = 1607; - public static final int RequestGuildBuyEvent = 569; - public static final int SearchUserEvent = 3576; - public static final int GuildConfirmRemoveMemberEvent = 3394; - public static final int GuildRemoveMemberEvent = 1764; - public static final int WiredConditionSaveDataEvent = 3268; - public static final int RoomUserLookAtPoint = 2283; - public static final int MoodLightTurnOnEvent = 3924; - public static final int MoodLightSettingsEvent = 2821; - public static final int RequestMyRoomsEvent = 948; - public static final int RequestCreditsEvent = 3896; - public static final int SearchRoomsInGroupEvent = 2851; - public static final int HorseRideSettingsEvent = 427; - public static final int KnockKnockResponseEvent = 853; - public static final int RoomUserKickEvent = 313; - public static final int RoomPlaceItemEvent = 3571; - public static final int RequestInventoryBotsEvent = 1343; - public static final int RequestUserWardrobeEvent = 2976; - public static final int RequestRoomRightsEvent = 63; - public static final int RequestGuildBuyRoomsEvent = 2945; - public static final int BotPlaceEvent = 3906; - public static final int SearchRoomsWithRightsEvent = 1699; - public static final int HotelViewRequestBonusRareEvent = 1521; - public static final int GuildRemoveAdminEvent = 904; - public static final int RequestRoomSettingsEvent = 1794; - public static final int RequestOffersEvent = 100; - public static final int RequestUserCitizinShipEvent = 3556; - public static final int RoomUserStopTypingEvent = 1712; - public static final int RoomUserStartTypingEvent = 3128; - public static final int RequestGuildManageEvent = 3931; - public static final int RequestUserClubEvent = 675; - public static final int PetPickupEvent = 1294; - public static final int RequestOwnGuildsEvent = 2690; - public static final int SearchRoomsVisitedEvent = 3561; - public static final int TradeOfferItemEvent = 2090; - public static final int TradeConfirmEvent = 1503; - public static final int RoomUserGiveRightsEvent = 503; - public static final int RequestGuildInfoEvent = 844; - public static final int ReloadRecyclerEvent = 3895; - public static final int RoomUserActionEvent = 2522; - public static final int RequestGiftConfigurationEvent = 756; - public static final int RequestRoomDataEvent = 2022; - public static final int RequestRoomHeightmapEvent = 3936; - public static final int RequestGuildFurniWidgetEvent = 54; - public static final int RequestOwnItemsEvent = 1816; - public static final int RequestReportRoomEvent = 2842; - public static final int ReportEvent = 2073; - public static final int TriggerOneWayGateEvent = 3752; - public static final int FloorPlanEditorSaveEvent = 3509; - public static final int FloorPlanEditorRequestDoorSettingsEvent = 2691; - public static final int FloorPlanEditorRequestBlockedTilesEvent = 2246; - public static final int UnknownEvent1 = 3365; - public static final int RequestTalenTrackEvent = 1741; - public static final int RequestNewNavigatorDataEvent = 1192; - public static final int RequestNewNavigatorRoomsEvent = 3669; - public static final int RedeemClothingEvent = 2536; - public static final int NewNavigatorActionEvent = 1344; - public static final int PostItPlaceEvent = 1688; - public static final int PostItRequestDataEvent = 3702; - public static final int PostItSaveDataEvent = 3504; - public static final int PostItDeleteEvent = 779; - public static final int MoodLightSaveSettingsEvent = 900; - public static final int ModToolRequestIssueChatlogEvent = 620; - public static final int ModToolRequestRoomUserChatlogEvent = 1352; - public static final int UsernameEvent = 820; - public static final int RequestClubGiftsEvent = 425; - public static final int RentSpaceEvent = 1382; - public static final int RentSpaceCancelEvent = 3038; - public static final int RequestInitFriendsEvent = 3503; - public static final int RequestCameraConfigurationEvent = 2257; - public static final int PingEvent = 862; - public static final int FindNewFriendsEvent = 3421; - public static final int InviteFriendsEvent = 370; - public static final int GuildeRemoveFavoriteEvent = 3259; - public static final int GuildDeleteEvent = 1581; - public static final int SetHomeRoomEvent = 1772; - public static final int RoomUserGiveHandItemEvent = 2797; - public static final int AmbassadorVisitCommandEvent = 487; - public static final int AmbassadorAlertCommandEvent = 3992; - public static final int SaveUserVolumesEvent = 1914; - public static final int SavePreferOldChatEvent = 3131; - public static final int SaveIgnoreRoomInvitesEvent = 542; - public static final int SaveBlockCameraFollowEvent = 2477; - public static final int RoomMuteEvent = 2571; - public static final int RequestRoomWordFilterEvent = 3305; - public static final int RoomWordFilterModifyEvent = 3415; - public static final int CatalogSearchedItemEvent = 346; - public static final int JukeBoxRequestTrackCodeEvent = 716; - public static final int JukeBoxRequestTrackDataEvent = 3453; - public static final int RoomStaffPickEvent = 3139; - public static final int RoomRequestBannedUsersEvent = 2226; - public static final int JukeBoxRequestPlayListEvent = 68; - public static final int JukeBoxEventOne = 3448; - public static final int JukeBoxEventTwo = 2457; - public static final int JukeBoxEventThree = 2693; -} diff --git a/src/main/java/com/eu/habbo/messages/incoming/Incoming_20160101.java b/src/main/java/com/eu/habbo/messages/incoming/Incoming_20160101.java deleted file mode 100644 index 9b623c24..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/Incoming_20160101.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.eu.habbo.messages.incoming; - -public class Incoming_20160101 -{ - public static final int MannequinSaveLookEvent = 3936; - public static final int RequestCatalogPageEvent = 39; - public static final int RequestWearingBadgesEvent = 2226; - public static final int BotPickupEvent = 644; - public static final int HorseRideEvent = 1440; - public static final int RequestCreateRoomEvent = 3077; - public static final int SaveMottoEvent = 3515; - public static final int GenerateSecretKeyEvent = -1; - public static final int ModToolAlertEvent = 2375; - public static final int TradeAcceptEvent = 3374; - public static final int RequestCatalogModeEvent = 2267; - public static final int RequestUserCreditsEvent = 3697; - public static final int FriendPrivateMessageEvent = 1981; - public static final int CloseDiceEvent = 191; - public static final int RoomUserRemoveRightsEvent = 40; - public static final int RoomRemoveRightsEvent = 879; - public static final int GuildDeclineMembershipEvent = 403; - public static final int AnswerPollEvent = 3757; - public static final int UserWearBadgeEvent = 2752; - public static final int RoomVoteEvent = 336; - public static final int RoomUserSignEvent = 2966; - public static final int RequestUserDataEvent = 186; - public static final int RoomUserShoutEvent = 2101; - public static final int ScratchPetEvent = 1618; - public static final int RoomUserWalkEvent = 1737; - public static final int RequestUserTagsEvent = 1722; - public static final int RequestTagsEvent = 1685; - public static final int GetMarketplaceConfigEvent = 1604; - public static final int RequestHeightmapEvent = 2125; - public static final int TradeCloseEvent = 2967; - public static final int CatalogBuyItemEvent = 2830; - public static final int RequestGuildMembersEvent = 205; - public static final int RequestPetInformationEvent = 2232; - public static final int RoomUserWhisperEvent = 878; - public static final int ModToolRequestUserInfoEvent = 2984; - public static final int RotateMoveItemEvent = 1781; - public static final int CancelPollEvent = 2538; - public static final int RequestRoomLoadEvent = 407; - public static final int RequestGuildPartsEvent = 1670; - public static final int RoomPlacePaintEvent = 728; - public static final int RequestPopularRoomsEvent = 3022; - public static final int ModToolRequestRoomInfoEvent = 182; - public static final int FriendRequestEvent = 3775; - public static final int RecycleEvent = 2920; - public static final int RequestRoomCategoriesEvent = 2506; - public static final int ToggleWallItemEvent = 3396; - public static final int RoomUserTalkEvent = 670; - public static final int HotelViewDataEvent = 3544; - public static final int HotelViewRequestBadgeRewardEvent = 2318; - public static final int HotelViewClaimBadgeRewardEvent = 2388; - public static final int RoomUserDanceEvent = 645; - public static final int RequestUserProfileEvent = 3591; - public static final int SearchRoomsFriendsNowEvent = 3281; - public static final int SetStackHelperHeightEvent = 1248; - public static final int RedeemVoucherEvent = 489; - public static final int HorseUseItemEvent = 870; - public static final int BuyItemEvent = 3699; - public static final int AdvertisingSaveEvent = 3156; - public static final int RequestPetTrainingPanelEvent = 2088; - public static final int RoomBackgroundEvent = 1061; - public static final int RequestNewsListEvent = 3895; - public static final int RequestPromotedRoomsEvent = 1812; - public static final int GuildSetAdminEvent = 465; - public static final int GetClubDataEvent = 715; - public static final int RequestMeMenuSettingsEvent = 3906; - public static final int MannequinSaveNameEvent = 2406; - public static final int SellItemEvent = 0xFF; - public static final int GuildAcceptMembershipEvent = 2259; - public static final int RequestBannerToken = -1; - public static final int RequestRecylerLogicEvent = 3258; - public static final int RequestGuildJoinEvent = 2615; - public static final int RequestCatalogIndexEvent = 2511; - public static final int RequestInventoryPetsEvent = 263; - public static final int ModToolRequestRoomVisitsEvent = 730; - public static final int ModToolWarnEvent = -1; - public static final int RequestItemInfoEvent = 1203; - public static final int ModToolRequestRoomChatlogEvent = 2312; - public static final int UserSaveLookEvent = 0x0A00; - public static final int ToggleFloorItemEvent = 3846; - public static final int TradeUnAcceptEvent = 1153; - public static final int WiredTriggerSaveDataEvent = 1897; - public static final int RoomRemoveAllRightsEvent = 1404; - public static final int TakeBackItemEvent = 1862; - public static final int OpenRecycleBoxEvent = 1515; - public static final int GuildChangeNameDescEvent = 1062; - public static final int RequestSellItemEvent = 1647; - public static final int ModToolChangeRoomSettingsEvent = 3458; - public static final int ModToolRequestUserChatlogEvent = -1; - public static final int GuildChangeSettingsEvent = 3180; - public static final int RoomUserDropHandItemEvent = 1751; - public static final int RequestProfileFriendsEvent = 866; - public static final int TradeCancelOfferItemEvent = 1033; - public static final int TriggerDiceEvent = 1182; - public static final int GetPollDataEvent = 2580; - public static final int MachineIDEvent = 1471; - public static final int RequestDiscountEvent = 1294; - public static final int RequestFriendRequestEvent = 2485; - public static final int RoomSettingsSaveEvent = 2074; - public static final int AcceptFriendRequest = 45; - public static final int DeclineFriendRequest = 835; - public static final int ReleaseVersionEvent = 4000; - public static final int SearchRoomsMyFavoriteEvent = 1346; - public static final int TradeStartEvent = 3313; - public static final int RequestTargetOfferEvent = 3446; - public static final int ClientActionsMessageEvent = 2386; - public static final int UknownMessageEventSomethingSomething = 3895; - public static final int ChangeRelationEvent = 2112; - public static final int RoomUserSitEvent = 1565; - public static final int RequestCanCreateRoomEvent = 361; - public static final int ModToolKickEvent = 3589; - public static final int MoveWallItemEvent = 609; - public static final int SearchRoomsEvent = 898; - public static final int RequestHighestScoreRoomsEvent = 2031; - public static final int CatalogBuyItemAsGiftEvent = 21; - public static final int RoomUserGiveRespectEvent = 1955; - public static final int RemoveFriendEvent = 698; - public static final int SearchRoomsFriendsOwnEvent = 642; - public static final int GuildSetFavoriteEvent = 2625; - public static final int PetPlaceEvent = 223; - public static final int BotSettingsEvent = 2544; - public static final int StalkFriendEvent = 2280; - public static final int RoomPickupItemEvent = 636; - public static final int RedeemItemEvent = 1676; - public static final int RequestFriendsEvent = 2349; - public static final int RequestAchievementsEvent = 2931; - public static final int GuildChangeColorsEvent = 1443; - public static final int RequestInventoryBadgesEvent = 166; - public static final int TestInventoryEvent = 2740; - public static final int RequestPetBreedsEvent = 2505; - public static final int GuildChangeBadgeEvent = 2959; - public static final int ModToolBanEvent = 2595; - public static final int SaveWardrobeEvent = 55; - public static final int HotelViewEvent = 3576; - public static final int ModToolPickTicketEvent = 3973; - public static final int ModToolReleaseTicketEvent = 3800; - public static final int ModToolCloseTicketEvent = 50; - public static final int TriggerColorWheelEvent = 2651; - public static final int SearchRoomsByTagEvent = -1; - public static final int RequestPublicRoomsEvent = 1336; - public static final int RequestResolutionEvent = 542; - public static final int RequestInventoryItemsEvent = 352; - public static final int ModToolRoomAlertEvent = 781; - public static final int WiredEffectSaveDataEvent = 3431; - public static final int CheckPetNameEvent = 159; - public static final int SecureLoginEvent = 1778; - public static final int BotSaveSettingsEvent = 678; - public static final int RequestGuildBuyEvent = 2546; - public static final int SearchUserEvent = 3375; - public static final int GuildConfirmRemoveMemberEvent = 649; - public static final int GuildRemoveMemberEvent = 714; - public static final int WiredConditionSaveDataEvent = 488; - public static final int RoomUserLookAtPoint = 3744; - public static final int MoodLightTurnOnEvent = 1826; - public static final int MoodLightSettingsEvent = 3472; - public static final int RequestMyRoomsEvent = 2955; - public static final int RequestCreditsEvent = 1207; - public static final int SearchRoomsInGroupEvent = 2002; - public static final int HorseRideSettingsEvent = 1993; - public static final int HandleDoorbellEvent = 2356; - public static final int RoomUserKickEvent = 3929; - public static final int RoomPlaceItemEvent = 579; - public static final int RequestInventoryBotsEvent = 363; - public static final int RequestUserWardrobeEvent = 765; - public static final int RequestRoomRightsEvent = 2734; - public static final int RequestGuildBuyRoomsEvent = 468; - public static final int BotPlaceEvent = 2321; - public static final int SearchRoomsWithRightsEvent = 1272; - public static final int HotelViewRequestBonusRareEvent = 538; - public static final int GuildRemoveAdminEvent = 2725; - public static final int RequestRoomSettingsEvent = 1014; - public static final int RequestOffersEvent = 442; - public static final int RequestUserCitizinShipEvent = 1605; - public static final int RoomUserStopTypingEvent = 1114; - public static final int RoomUserStartTypingEvent = 3362; - public static final int RequestGuildManageEvent = 2547; - public static final int RequestUserClubEvent = 12; - public static final int PetPickupEvent = 2342; - public static final int RequestOwnGuildsEvent = 3046; - public static final int SearchRoomsVisitedEvent = 1475; - public static final int TradeOfferItemEvent = 114; - public static final int TradeConfirmEvent = 2399; - public static final int RoomUserGiveRightsEvent = 3574; - public static final int RequestGuildInfoEvent = 3211; - public static final int ReloadRecyclerEvent = 1715; - public static final int RoomUserActionEvent = 3639; - public static final int RequestGiftConfigurationEvent = 1928; - public static final int RequestRoomDataEvent = 1164; - public static final int RequestRoomHeightmapEvent = 2768; - public static final int RequestGuildFurniWidgetEvent = 41; - public static final int RequestOwnItemsEvent = 3829; - public static final int RequestReportRoomEvent = 1839; - public static final int ReportEvent = 963; - public static final int TriggerOneWayGateEvent = 0x0B00; - public static final int FloorPlanEditorSaveEvent = 1287; - public static final int FloorPlanEditorRequestDoorSettingsEvent = 2623; - public static final int FloorPlanEditorRequestBlockedTilesEvent = 24; - public static final int UnknownEvent1 = 3672; - public static final int RequestTalenTrackEvent = 1284; - public static final int RequestNewNavigatorDataEvent = 882; - public static final int RequestNewNavigatorRoomsEvent = 2722; - public static final int RedeemClothingEvent = 818; - public static final int NewNavigatorActionEvent = 1874; - public static final int PostItPlaceEvent = 425; - public static final int PostItRequestDataEvent = 2796; - public static final int PostItSaveDataEvent = 342; - public static final int PostItDeleteEvent = 2777; - public static final int MoodLightSaveSettingsEvent = 856; - public static final int ModToolRequestIssueChatlogEvent = 3484; - public static final int ModToolRequestRoomUserChatlogEvent = 695; - public static final int UsernameEvent = 2577; - public static final int RequestClubGiftsEvent = 3302; - public static final int RentSpaceEvent = 3486; - public static final int RentSpaceCancelEvent = 1314; - public static final int RequestInitFriendsEvent = 2151; - public static final int RequestCameraConfigurationEvent = 1341; - public static final int PingEvent = 1789; - public static final int FindNewFriendsEvent = 1264; - public static final int InviteFriendsEvent = 2694; - public static final int GuildRemoveFavoriteEvent = 1412; - public static final int GuildDeleteEvent = 747; - public static final int SetHomeRoomEvent = 2501; - public static final int RoomUserGiveHandItemEvent = 3315; - public static final int AmbassadorVisitCommandEvent = 1098; - public static final int AmbassadorAlertCommandEvent = 1068; - public static final int SaveUserVolumesEvent = 3820; - public static final int SavePreferOldChatEvent = 2006; - public static final int SaveIgnoreRoomInvitesEvent = 1379; - public static final int SaveBlockCameraFollowEvent = 526; - public static final int RoomMuteEvent = 2462; - public static final int RequestRoomWordFilterEvent = 1348; - public static final int RoomWordFilterModifyEvent = 0x0100; - public static final int RequestRoomUserTagsEvent = 1722; - public static final int CatalogSearchedItemEvent = 2180; - public static final int JukeBoxRequestTrackCodeEvent = 3585; - public static final int JukeBoxRequestTrackDataEvent = 3418; - public static final int JukeBoxAddSoundTrackEvent = 1878; - public static final int RoomStaffPickEvent = 510; - public static final int RoomRequestBannedUsersEvent = 581; - public static final int JukeBoxRequestPlayListEvent = 2541; - public static final int JukeBoxEventOne = 1042; - public static final int JukeBoxEventTwo = 815; - public static final int RoomUserMuteEvent = 2997; - - public static final int RequestDeleteRoomEvent = 722; - public static final int RequestPromotionRoomsEvent = 3616; - public static final int BuyRoomPromotionEvent = 3078; - public static final int RequestGuideToolEvent = 3716; - public static final int RequestGuideAssistanceEvent = 491; - public static final int GuideUserTypingEvent = 3333; - public static final int GuideReportHelperEvent = 121; - public static final int GuideRecommendHelperEvent = 116; - public static final int GuideUserMessageEvent = 3392; - public static final int GuideCancelHelpRequestEvent = 3530; - public static final int GuideHandleHelpRequestEvent = 2975; - public static final int GuideVisitUserEvent = 3325; - public static final int GuideInviteUserEvent = 918; - public static final int GuideCloseHelpRequestEvent = 1100; - public static final int GuardianNoUpdatesWantedEvent = 1006; - public static final int GuardianVoteEvent = 1913; - public static final int GuardianAcceptRequestEvent = 3668; - public static final int RequestGameConfigurationsEvent = 2993; - public static final int RequestAchievementConfigurationEvent = 751; - public static final int RequestReportUserBullyingEvent = 2973; - public static final int ReportBullyEvent = 1803; - public static final int CameraRoomPictureEvent = 2274; - public static final int CameraRoomThumbnailEvent = 1366; - public static final int SavePostItStickyPoleEvent = 3155; - public static final int HotelViewRequestCommunityGoalEvent = 2059; - public static final int HotelViewRequestConcurrentUsersEvent = 484; - public static final int HotelViewConcurrentUsersButtonEvent = 2295; - public static final int IgnoreRoomUserEvent = 2394; - public static final int UnIgnoreRoomUserEvent = 3023; - public static final int UnbanRoomUserEvent = 3060; - public static final int RoomUserBanEvent = 3940; - public static final int RequestNavigatorSettingsEvent = 1086; - public static final int SaveWindowSettingsEvent = 272; - public static final int GetHabboGuildBadgesMessageEvent = 301; - public static final int EditRoomPromotionMessageEvent = 3707; - - public static final int RequestCraftingRecipesEvent = 426; - public static final int RequestCraftingRecipesAvailableEvent = 1653; - public static final int CraftingAddRecipeEvent = 3654; - public static final int CraftingCraftItemEvent = 2934; - public static final int CraftingCraftSecretEvent = 1622; - - public static final int AdventCalendarOpenDayEvent = 724; - public static final int AdventCalendarForceOpenEvent = 2879; - public static final int CameraPurchaseEvent = 1903; - public static final int RoomFavoriteEvent = 3092; - - public static final int YoutubeRequestPlayListEvent = 3517; - public static final int YoutubeRequestNextVideoEvent = 1843; - public static final int YoutubeRequestVideoDataEvent = 890; - public static final int StartSafetyQuizEvent = 2652; -} diff --git a/src/main/java/com/eu/habbo/messages/incoming/Incoming_Back.java b/src/main/java/com/eu/habbo/messages/incoming/Incoming_Back.java deleted file mode 100644 index aece2171..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/Incoming_Back.java +++ /dev/null @@ -1,308 +0,0 @@ -package com.eu.habbo.messages.incoming; - -public class Incoming_Back -{ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static final int MannequinSaveLookEvent = 3770; - public static final int RequestCatalogPageEvent = 2914; - public static final int RequestWearingBadgesEvent = 3466; - public static final int BotPickupEvent = 665; - public static final int HorseRideEvent = 1027; - public static final int RequestCreateRoomEvent = 238; - public static final int SaveMottoEvent = 289; - public static final int GenerateSecretKeyEvent = -1; - public static final int ModToolAlertEvent = 2890; - public static final int TradeAcceptEvent = 368; - public static final int RequestCatalogModeEvent = 2711; - public static final int RequestUserCreditsEvent = 2845; - public static final int FriendPrivateMessageEvent = 3710; - public static final int CloseDiceEvent = 57; - public static final int RoomUserRemoveRightsEvent = 1599; - public static final int GuildDeclineMembershipEvent = 1328; - public static final int AnswerPollEvent = 2135; - public static final int UserWearBadgeEvent = 741; - public static final int RoomVoteEvent = -242; - public static final int RoomUserSignEvent = 2065; - public static final int RequestUserDataEvent = 882; - public static final int RoomUserShoutEvent = 1788; - public static final int ScratchPetEvent = 965; - public static final int RoomUserWalkEvent = 3690; - public static final int RequestUserTagsEvent = 3430; - public static final int RequestTagsEvent = 753; - public static final int GetMarketplaceConfigEvent = 3774; - public static final int RequestHeightmapEvent = 859; - public static final int TradeCloseEvent = 3012; - public static final int CatalogBuyItemEvent = 3964; - public static final int RequestGuildMembersEvent = 3204; - public static final int RequestPetInformationEvent = 2827; - public static final int RoomUserWhisperEvent = 3908; - public static final int ModToolRequestUserInfoEvent = 607; - public static final int RotateMoveItemEvent = 1219; - public static final int CancelPollEvent = 1628; - public static final int RequestRoomLoadEvent = 1988; - public static final int RequestGuildPartsEvent = 1902; - public static final int RoomPlacePaintEvent = 1892; - public static final int RequestPopularRoomsEvent = 464; - public static final int ModToolRequestRoomInfoEvent = 1450; - public static final int FriendRequestEvent = 2791; - public static final int RecycleEvent = 3277; - public static final int RequestRoomCategoriesEvent = 3498; - public static final int ToggleWallItemEvent = 3050; - public static final int RoomUserTalkEvent = 104; - public static final int HotelViewDataEvent = 2507; - public static final int RoomUserDanceEvent = 649; - public static final int RequestUserProfileEvent = 1389; - public static final int SearchRoomsFriendsNowEvent = 1082; - public static final int SetStackHelperHeightEvent = 2790; - public static final int RedeemVoucherEvent = 3024; - public static final int HorseUseItemEvent = 2590; - public static final int BuyItemEvent = 2847; - public static final int AdvertisingSaveEvent = 1829; - public static final int RequestPetTrainingPanelEvent = 2251; - public static final int RoomBackgroundEvent = 2496; - public static final int RequestNewsListEvent = 1134; - public static final int RequestPromotedRoomsEvent = 1558; - public static final int GuildSetAdminEvent = 3704; - public static final int GetClubDataEvent = 3240; - public static final int RequestMeMenuSettingsEvent = 2169; - public static final int MannequinSaveNameEvent = 1289; - public static final int SellItemEvent = 1522; - public static final int GuildAcceptMembershipEvent = 538; - public static final int RequestBannerToken = -1; - public static final int RequestRecylerLogicEvent = 1170; - public static final int RequestGuildJoinEvent = 794; - public static final int RequestCatalogIndexEvent = 2806; - public static final int RequestInventoryPetsEvent = 3760; - public static final int ModToolRequestRoomVisitsEvent = 2287; - public static final int ModToolWarnEvent = 2890; - public static final int RequestItemInfoEvent = 2042; - public static final int ModToolRequestRoomChatlogEvent = 3209; - public static final int UserSaveLookEvent = 2242; - public static final int ToggleFloorItemEvent = 2693; - public static final int TradeUnAcceptEvent = 126; - public static final int WiredTriggerSaveDataEvent = 3593; - public static final int RoomRemoveAllRightsEvent = 3764; - public static final int TakeBackItemEvent = 1455; - public static final int OpenRecycleBoxEvent = 0x0F00; - public static final int GuildChangeNameDescEvent = 1485; - public static final int RequestSellItemEvent = 876; - public static final int ModToolChangeRoomSettingsEvent = 3244; - public static final int ModToolRequestUserChatlogEvent = 3209; - public static final int GuildChangeSettingsEvent = 2258; - public static final int RoomUserDropHandItemEvent = 1108; - public static final int RequestProfileFriendsEvent = 3701; - public static final int TradeCancelOfferItemEvent = 2170; - public static final int TriggerDiceEvent = 386; - public static final int GetPollDataEvent = 2263; - public static final int MachineIDEvent = 686; - public static final int RequestDiscountEvent = 1995; - public static final int RequestFriendRequestEvent = 3739; - public static final int RoomSettingsSaveEvent = 1290; - public static final int AcceptFriendRequest = 3383; - public static final int ReleaseVersionEvent = 4000; - public static final int SearchRoomsMyFavoriteEvent = 3124; - public static final int TradeStartEvent = 3304; - public static final int ChangeRelationEvent = 2632; - public static final int RoomUserSitEvent = 272; - public static final int RequestCanCreateRoomEvent = 3903; - public static final int ModToolKickEvent = 1459; - public static final int MoveWallItemEvent = 3455; - public static final int SearchRoomsEvent = 3844; - public static final int RequestHighestScoreRoomsEvent = 1814; - public static final int CatalogBuyItemAsGiftEvent = 1066; - public static final int RoomUserGiveRespectEvent = 3121; - public static final int RemoveFriendEvent = 1535; - public static final int SearchRoomsFriendsOwnEvent = 725; - public static final int GuildSetFavoriteEvent = 2754; - public static final int PetPlaceEvent = 1961; - public static final int BotSettingsEvent = 3292; - public static final int StalkFriendEvent = 1925; - public static final int RoomPickupItemEvent = 2463; - public static final int RedeemItemEvent = 1242; - public static final int RequestFriendsEvent = 1904; - public static final int RequestAchievementsEvent = 2697; - public static final int GuildChangeColorsEvent = 3873; - public static final int RequestInventoryBadgesEvent = 2450; - public static final int RequestPetBreedsEvent = 2828; - public static final int GuildChangeBadgeEvent = 838; - public static final int ModToolBanEvent = 701; - public static final int SaveWardrobeEvent = 2921; - public static final int HotelViewEvent = 3603; - public static final int ModToolPickTicketEvent = 2980; - public static final int ModToolReleaseTicketEvent = 3905; - public static final int ModToolCloseTicketEvent = 3904; - public static final int TriggerColorWheelEvent = 2556; - public static final int SearchRoomsByTagEvent = 3844; - public static final int RequestPublicRoomsEvent = 2057; - public static final int RequestResolutionEvent = 305; - public static final int RequestInventoryItemsEvent = 2194; - public static final int ModToolRoomAlertEvent = 2550; - public static final int WiredEffectSaveDataEvent = 2856; - public static final int CheckPetNameEvent = 3699; - public static final int SecureLoginEvent = 2243; - public static final int BotSaveSettingsEvent = 1607; - public static final int RequestGuildBuyEvent = 569; - public static final int SearchUserEvent = 3576; - public static final int GuildConfirmRemoveMemberEvent = 3394; - public static final int GuildRemoveMemberEvent = 1764; - public static final int WiredConditionSaveDataEvent = 3268; - public static final int RoomUserLookAtPoint = 2283; - public static final int MoodLightTurnOnEvent = 3924; - public static final int MoodLightSettingsEvent = 2821; - public static final int RequestMyRoomsEvent = 948; - public static final int RequestCreditsEvent = 3896; - public static final int SearchRoomsInGroupEvent = 2851; - public static final int HorseRideSettingsEvent = 427; - public static final int KnockKnockResponseEvent = 853; - public static final int RoomUserKickEvent = 313; - public static final int RoomPlaceItemEvent = 3571; - public static final int RequestInventoryBotsEvent = 1343; - public static final int RequestUserWardrobeEvent = 2976; - public static final int RequestRoomRightsEvent = 63; - public static final int RequestGuildBuyRoomsEvent = 2945; - public static final int BotPlaceEvent = 3906; - public static final int SearchRoomsWithRightsEvent = 1699; - public static final int HotelViewRequestBonusRareEvent = 1521; - public static final int GuildRemoveAdminEvent = 904; - public static final int RequestRoomSettingsEvent = 1794; - public static final int RequestOffersEvent = 100; - public static final int RequestUserCitizinShipEvent = 3556; - public static final int RoomUserStopTypingEvent = 1712; - public static final int RoomUserStartTypingEvent = 3128; - public static final int RequestGuildManageEvent = 3931; - public static final int RequestUserClubEvent = 675; - public static final int PetPickupEvent = 1294; - public static final int RequestOwnGuildsEvent = 2690; - public static final int SearchRoomsVisitedEvent = 3561; - public static final int TradeOfferItemEvent = 2090; - public static final int TradeConfirmEvent = 1503; - public static final int RoomUserGiveRightsEvent = 503; - public static final int RequestGuildInfoEvent = 844; - public static final int ReloadRecyclerEvent = 3895; - public static final int RoomUserActionEvent = 2522; - public static final int RequestGiftConfigurationEvent = 756; - public static final int RequestRoomDataEvent = 2022; - public static final int RequestRoomHeightmapEvent = 3936; - public static final int RequestGuildFurniWidgetEvent = 54; - public static final int RequestOwnItemsEvent = 1816; - public static final int RequestReportRoomEvent = 2842; - public static final int ReportEvent = 2073; - public static final int TriggerOneWayGateEvent = 3752; - public static final int FloorPlanEditorSaveEvent = 3509; - public static final int FloorPlanEditorRequestDoorSettingsEvent = 2691; - public static final int FloorPlanEditorRequestBlockedTilesEvent = 2246; - public static final int UnknownEvent1 = 3365; - public static final int RequestTalenTrackEvent = 1741; - public static final int RequestNewNavigatorDataEvent = 1192; - public static final int RequestNewNavigatorRoomsEvent = 3669; - public static final int RedeemClothingEvent = 2536; - public static final int NewNavigatorActionEvent = 1344; - public static final int PostItPlaceEvent = 1688; - public static final int PostItRequestDataEvent = 3702; - public static final int PostItSaveDataEvent = 3504; - public static final int PostItDeleteEvent = 779; - public static final int MoodLightSaveSettingsEvent = 900; - public static final int ModToolRequestIssueChatlogEvent = 620; - public static final int ModToolRequestRoomUserChatlogEvent = 1352; - public static final int UsernameEvent = 820; - public static final int RequestClubGiftsEvent = 425; - public static final int RentSpaceEvent = 1382; - public static final int RentSpaceCancelEvent = 3038; - public static final int RequestInitFriendsEvent = 3503; - public static final int RequestCameraConfigurationEvent = 2257; - public static final int PingEvent = 862; - public static final int FindNewFriendsEvent = 3421; - public static final int InviteFriendsEvent = 370; - public static final int GuildeRemoveFavoriteEvent = 3259; - public static final int GuildDeleteEvent = 1581; - public static final int SetHomeRoomEvent = 1772; - public static final int RoomUserGiveHandItemEvent = 2797; - public static final int AmbassadorVisitCommandEvent = 487; - public static final int AmbassadorAlertCommandEvent = 3992; - public static final int SaveUserVolumesEvent = 1914; - public static final int SavePreferOldChatEvent = 3131; - public static final int SaveIgnoreRoomInvitesEvent = 542; - public static final int SaveBlockCameraFollowEvent = 2477; - public static final int RoomMuteEvent = 2571; - public static final int RequestRoomWordFilterEvent = 3305; - public static final int RoomWordFilterModifyEvent = 3415; - public static final int RequestRoomUserTagsEvent = 3430; - public static final int CatalogSearchedItemEvent = 346; - public static final int JukeBoxRequestTrackCodeEvent = 716; - public static final int JukeBoxRequestTrackDataEvent = 3453; - public static final int RoomStaffPickEvent = 3139; - public static final int RoomRequestBannedUsersEvent = 2226; - public static final int JukeBoxRequestPlayListEvent = 68; - public static final int JukeBoxEventOne = 3448; - public static final int JukeBoxEventTwo = 2457; - public static final int JukeBoxEventThree = 2693; - public static final int RequestDeleteRoomEvent = 3071; - public static final int RequestPromotionRoomsEvent = 2730; - public static final int BuyRoomPromotionEvent = 2363; - - - public static final int RequestGuideToolEvent = 3003; - public static final int RequestGuideAssistanceEvent = 2158; - public static final int GuideUserTypingEvent = 705; - public static final int GuideReportHelperEvent = 393; - public static final int GuideRecommendHelperEvent = 151; - public static final int GuideUserMessageEvent = 721; - public static final int GuideCancelHelpRequestEvent = 1166; - public static final int GuideHandleHelpRequestEvent = 459; - public static final int GuideVisitUserEvent = 2776; - public static final int GuideInviteUserEvent = 409; - public static final int GuideCloseHelpRequestEvent = 2751; - - public static final int GuardianNoUpdatesWantedEvent = 1929; - public static final int GuardianVoteEvent = 1371; - public static final int GuardianAcceptRequestEvent = 1278; - - public static final int RequestGameConfigurationsEvent = 2994; - public static final int RequestAchievementConfigurationEvent = 3160; - - public static final int RequestReportUserBullyingEvent = 62; - public static final int ReportBullyEvent = 3061; - - public static final int CameraParserShit = 3800; - public static final int SavePostItStickyPoleEvent = 2637; - - public static final int HotelViewClaimBadgeEvent = 1298; - public static final int HotelViewRequestCommunityGoalEvent = 1204; - public static final int HotelViewRequestConcurrentUsersEvent = 3489; - public static final int HotelViewConcurrentUsersButtonEvent = 984; - - public static final int IgnoreRoomUserEvent = 3546; - public static final int UnIgnoreRoomUserEvent = 3909; - public static final int UnbanRoomUserEvent = 2374; - - public static final int RequestNavigatorSettingsEvent = 3202; - public static final int SaveWindowSettingsEvent = 2276; -} diff --git a/src/main/java/com/eu/habbo/messages/incoming/crafting/RequestCraftingRecipesAvailableEvent.java b/src/main/java/com/eu/habbo/messages/incoming/crafting/RequestCraftingRecipesAvailableEvent.java index f9635622..98cc83c9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/crafting/RequestCraftingRecipesAvailableEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/crafting/RequestCraftingRecipesAvailableEvent.java @@ -42,6 +42,14 @@ public class RequestCraftingRecipesAvailableEvent extends MessageHandler } } + CraftingRecipe equalsRecipe = altar.getRecipe(items); + if (equalsRecipe != null && this.client.getHabbo().getHabboStats().hasRecipe(equalsRecipe.getId())) + { + //this.client.sendResponse(new CraftingRecipesAvailableComposer(-1, true)); + //this.client.sendResponse(new CraftingRecipeComposer(equalsRecipe)); + //this.client.sendResponse(new CraftingResultComposer(equalsRecipe, true)); + return; + } Map recipes = altar.matchRecipes(items); boolean found = false; diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java new file mode 100644 index 00000000..9e2b4438 --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/IsFirstLoginOfDayComposer.java @@ -0,0 +1,23 @@ +package com.eu.habbo.messages.incoming.handshake; + +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; + +public class IsFirstLoginOfDayComposer extends MessageComposer +{ + private final boolean isFirstLoginOfDay; + + public IsFirstLoginOfDayComposer(boolean isFirstLoginOfDay) + { + this.isFirstLoginOfDay = isFirstLoginOfDay; + } + + @Override + public ServerMessage compose() + { + this.response.init(Outgoing.IsFirstLoginOfDayComposer); + this.response.appendBoolean(this.isFirstLoginOfDay); + return this.response; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java index 5a655e5e..fd50c886 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/MachineIDEvent.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages.incoming.handshake; -import com.eu.habbo.Emulator; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.handshake.MachineIDComposer; @@ -10,13 +9,6 @@ public class MachineIDEvent extends MessageHandler { public void handle() throws Exception { String unknown = this.packet.readString(); this.client.setMachineId(this.packet.readString()); - - if (Emulator.getGameEnvironment().getModToolManager().hasMACBan(this.client)) - { - this.client.getChannel().close(); - return; - } - this.client.sendResponse(new MachineIDComposer(this.client)); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java index a8e3b9d8..5c8d3260 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent.java @@ -19,7 +19,7 @@ import com.eu.habbo.messages.outgoing.modtool.CfhTopicsMessageComposer; import com.eu.habbo.messages.outgoing.modtool.ModToolComposer; import com.eu.habbo.messages.outgoing.navigator.*; import com.eu.habbo.messages.outgoing.unknown.BuildersClubExpiredComposer; -import com.eu.habbo.messages.outgoing.unknown.NewUserIdentityComposer; +import com.eu.habbo.messages.outgoing.habboway.nux.NewUserIdentityComposer; import com.eu.habbo.messages.outgoing.users.*; import com.eu.habbo.plugin.events.emulator.SSOAuthenticationEvent; import com.eu.habbo.plugin.events.users.UserLoginEvent; @@ -33,26 +33,33 @@ public class SecureLoginEvent extends MessageHandler @Override public void handle() throws Exception { + if (!this.client.getChannel().isOpen()) return; + if(!Emulator.isReady) return; + if (Emulator.getGameEnvironment().getModToolManager().hasMACBan(this.client)) + { + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); + return; + } + if (Emulator.getGameEnvironment().getModToolManager().hasIPBan(this.client.getChannel())) + { + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); + return; + } + String sso = this.packet.readString().replace(" ", ""); if (Emulator.getPluginManager().fireEvent(new SSOAuthenticationEvent(sso)).isCancelled()) return; if (sso == null || sso.isEmpty()) { - this.client.getChannel().close(); + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); } if(this.client.getHabbo() == null) { - if (Emulator.getGameEnvironment().getModToolManager().hasIPBan(this.client.getChannel())) - { - this.client.getChannel().close(); - return; - } - Habbo habbo = null; synchronized (this.client.getChannel()) { @@ -68,7 +75,7 @@ public class SecureLoginEvent extends MessageHandler if (this.client.getHabbo().getHabboInfo() == null) { - Emulator.getGameServer().getGameClientManager().disposeClient(this.client.getChannel()); + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); return; } Emulator.getThreading().run(habbo); @@ -77,7 +84,7 @@ public class SecureLoginEvent extends MessageHandler catch (Exception e) { e.printStackTrace(); - Emulator.getGameServer().getGameClientManager().disposeClient(this.client.getChannel()); + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); return; } ArrayList messages = new ArrayList<>(); @@ -92,7 +99,7 @@ public class SecureLoginEvent extends MessageHandler messages.add(new SomeConnectionComposer().compose()); messages.add(new DebugConsoleComposer().compose()); messages.add(new UserAchievementScoreComposer(this.client.getHabbo()).compose()); - messages.add(new UnknownComposer4().compose()); + messages.add(new IsFirstLoginOfDayComposer(true).compose()); messages.add(new UnknownComposer5().compose()); messages.add(new BuildersClubExpiredComposer().compose()); messages.add(new CfhTopicsMessageComposer().compose()); @@ -147,7 +154,7 @@ public class SecureLoginEvent extends MessageHandler } else { - this.client.getChannel().close(); + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java index 740bea6a..35b1db8a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/SecureLoginEvent_BACKUP.java @@ -12,7 +12,7 @@ import com.eu.habbo.messages.outgoing.handshake.SecureLoginOKComposer; import com.eu.habbo.messages.outgoing.handshake.SessionRightsComposer; import com.eu.habbo.messages.outgoing.modtool.ModToolComposer; import com.eu.habbo.messages.outgoing.navigator.*; -import com.eu.habbo.messages.outgoing.unknown.NewUserIdentityComposer; +import com.eu.habbo.messages.outgoing.habboway.nux.NewUserIdentityComposer; import com.eu.habbo.messages.outgoing.users.*; import com.eu.habbo.plugin.events.users.UserLoginEvent; diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer4.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer4.java deleted file mode 100644 index 69d92501..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/UnknownComposer4.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.eu.habbo.messages.incoming.handshake; - -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.Outgoing; - -public class UnknownComposer4 extends MessageComposer -{ - @Override - public ServerMessage compose() - { - this.response.init(Outgoing.UnknownComposer4); - this.response.appendBoolean(true); - return this.response; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/handshake/UsernameEvent.java b/src/main/java/com/eu/habbo/messages/incoming/handshake/UsernameEvent.java index 82a9182d..19e745be 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/handshake/UsernameEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/handshake/UsernameEvent.java @@ -5,7 +5,7 @@ import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.catalog.TargetOffer; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.events.calendar.AdventCalendarDataComposer; -import com.eu.habbo.messages.outgoing.unknown.NuxAlertComposer; +import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer; import com.eu.habbo.messages.outgoing.unknown.TargetedOfferComposer; import java.sql.Connection; diff --git a/src/main/java/com/eu/habbo/messages/incoming/helper/RequestTalentTrackEvent.java b/src/main/java/com/eu/habbo/messages/incoming/helper/RequestTalentTrackEvent.java index 98d0f0e7..05166e0e 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/helper/RequestTalentTrackEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/helper/RequestTalentTrackEvent.java @@ -10,7 +10,7 @@ public class RequestTalentTrackEvent extends MessageHandler @Override public void handle() throws Exception { - if (Emulator.getConfig().getBoolean("hotel.talentrack.enabled")) + if (Emulator.getConfig().getBoolean("hotel.talenttrack.enabled")) { this.client.sendResponse(new TalentTrackComposer(this.client.getHabbo(), TalentTrackType.valueOf(this.packet.readString().toUpperCase()))); } diff --git a/src/main/java/com/eu/habbo/messages/incoming/inventory/TestInventoryEvent.java b/src/main/java/com/eu/habbo/messages/incoming/inventory/TestInventoryEvent.java deleted file mode 100644 index 21f6a004..00000000 --- a/src/main/java/com/eu/habbo/messages/incoming/inventory/TestInventoryEvent.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.eu.habbo.messages.incoming.inventory; - -import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.inventory.InventoryItemsComposer; - -public class TestInventoryEvent extends MessageHandler -{ - @Override - public void handle() throws Exception - { - - } -} diff --git a/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java b/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java index c99a6360..7865a2a0 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/polls/AnswerPollEvent.java @@ -53,11 +53,11 @@ public class AnswerPollEvent extends MessageHandler if(poll.lastQuestionId == questionId) { - if(poll.getBadgeReward().length() > 0) + if(poll.badgeReward.length() > 0) { - if(this.client.getHabbo().getInventory().getBadgesComponent().getBadge(poll.getBadgeReward()) == null) + if(this.client.getHabbo().getInventory().getBadgesComponent().getBadge(poll.badgeReward) == null) { - HabboBadge badge = new HabboBadge(0, poll.getBadgeReward(), 0, this.client.getHabbo()); + HabboBadge badge = new HabboBadge(0, poll.badgeReward, 0, this.client.getHabbo()); Emulator.getThreading().run(badge); this.client.getHabbo().getInventory().getBadgesComponent().addBadge(badge); this.client.sendResponse(new AddUserBadgeComposer(badge)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java index 4cfb7c60..c1aee0b6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/MoveWallItemEvent.java @@ -1,5 +1,6 @@ package com.eu.habbo.messages.incoming.rooms.items; +import com.eu.habbo.habbohotel.rooms.FurnitureMovementError; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; @@ -18,7 +19,7 @@ public class MoveWallItemEvent extends MessageHandler if(!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission("acc_placefurni") && !(room.getGuildId() > 0 && room.guildRightLevel(this.client.getHabbo()) >= 2)) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); return; } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java index 0192ac59..20e4958a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/PostItPlaceEvent.java @@ -9,7 +9,6 @@ import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer; import com.eu.habbo.messages.outgoing.rooms.items.AddWallItemComposer; -import com.eu.habbo.messages.outgoing.rooms.items.PostItStickyPoleOpenComposer; public class PostItPlaceEvent extends MessageHandler { @@ -46,7 +45,7 @@ public class PostItPlaceEvent extends MessageHandler AchievementManager.progressAchievement(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesLeft")); } - this.client.sendResponse(new PostItStickyPoleOpenComposer(item)); + //this.client.sendResponse(new PostItStickyPoleOpenComposer(item)); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java index c7d88927..179b4923 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RedeemClothingEvent.java @@ -3,10 +3,12 @@ package com.eu.habbo.messages.incoming.rooms.items; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.catalog.ClothItem; import com.eu.habbo.habbohotel.items.interactions.InteractionClothing; +import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; +import com.eu.habbo.messages.outgoing.rooms.UpdateStackHeightComposer; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; import com.eu.habbo.messages.outgoing.users.UserClothesComposer; import com.eu.habbo.threading.runnables.QueryDeleteHabboItem; @@ -38,8 +40,10 @@ public class RedeemClothingEvent extends MessageHandler if (!this.client.getHabbo().getInventory().getWardrobeComponent().getClothing().contains(clothing.id)) { item.setRoomId(0); + RoomTile tile = this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(item.getX(), item.getY()); this.client.getHabbo().getHabboInfo().getCurrentRoom().removeHabboItem(item); - this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTile(this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(item.getX(), item.getY())); + this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTile(tile); + this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(tile.x, tile.y, tile.relativeHeight()).compose()); this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RemoveFloorItemComposer(item, true).compose()); Emulator.getThreading().run(new QueryDeleteHabboItem(item)); diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPickupItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPickupItemEvent.java index c91a7885..cbc3215a 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPickupItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPickupItemEvent.java @@ -44,17 +44,5 @@ public class RoomPickupItemEvent extends MessageHandler room.ejectUserItem(item); } } - - - - - -// - - - - - - } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPlaceItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPlaceItemEvent.java index 0e135370..298493a9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPlaceItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RoomPlaceItemEvent.java @@ -1,10 +1,8 @@ package com.eu.habbo.messages.incoming.rooms.items; -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.achievements.Achievement; -import com.eu.habbo.habbohotel.achievements.AchievementManager; import com.eu.habbo.habbohotel.items.FurnitureType; import com.eu.habbo.habbohotel.items.interactions.*; +import com.eu.habbo.habbohotel.rooms.FurnitureMovementError; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomTile; @@ -13,15 +11,8 @@ import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer; -import com.eu.habbo.messages.outgoing.rooms.items.AddFloorItemComposer; -import com.eu.habbo.messages.outgoing.rooms.items.AddWallItemComposer; -import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer; -import com.eu.habbo.plugin.Event; -import com.eu.habbo.plugin.events.furniture.FurniturePlacedEvent; import gnu.trove.set.hash.THashSet; -import java.awt.*; - public class RoomPlaceItemEvent extends MessageHandler { @Override @@ -29,15 +20,16 @@ public class RoomPlaceItemEvent extends MessageHandler { String[] values = this.packet.readString().split(" "); - if(values.length < 1) + int itemId = Integer.valueOf(values[0]); + if(values.length < 1 || itemId < 0) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_item")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.INVALID_MOVE.errorCode)); return; } if(!this.client.getHabbo().getRoomUnit().isInRoom()) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); return; } @@ -75,193 +67,89 @@ public class RoomPlaceItemEvent extends MessageHandler } else { - HabboItem sp = room.getHabboItem(this.client.getHabbo().getHabboStats().rentedItemId); - if(sp != null && sp instanceof InteractionRentableSpace) - { - if(((InteractionRentableSpace)sp).getRenterId() == this.client.getHabbo().getHabboInfo().getId()) - { - ((InteractionRentableSpace)sp).endRent(); - } - } - - if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission("acc_placefurni") && !(room.getGuildId() > 0 && room.guildRightLevel(this.client.getHabbo()) >= 2) && this.client.getHabbo().getHabboStats().canRentSpace()) - { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); - return; - } } - int itemId = Integer.valueOf(values[0]); - if(itemId <= 0) - return; HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId); - if(item == null) + if(item == null || item.getBaseItem().getInteractionType().getType() == InteractionPostIt.class) return; if(room.getId() != item.getRoomId() && item.getRoomId() != 0) return; + //TODO move this to canStackAt() though find a way to handle the different bubble alert keys if(item instanceof InteractionMoodLight && !room.getRoomSpecialTypes().getItemsOfType(InteractionMoodLight.class).isEmpty()) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "max_dimmers")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.MAX_DIMMERS.errorCode)); return; } - if (item instanceof InteractionJukeBox && !room.getRoomSpecialTypes().getItemsOfType(InteractionJukeBox.class).isEmpty()) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "max_soundfurni")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.MAX_SOUNDFURNI.errorCode)); return; } THashSet updatedTiles = new THashSet<>(); - if(item.getBaseItem().getType() == FurnitureType.FLOOR) + + if (item.getBaseItem().getType() == FurnitureType.FLOOR) { short x = Short.valueOf(values[1]); short y = Short.valueOf(values[2]); int rotation = Integer.valueOf(values[3]); - - if(x < 0 || y < 0 || rotation < 0) + if (rentSpace != null && !room.hasRights(this.client.getHabbo())) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); - return; - } - - if(rentSpace != null && !room.hasRights(this.client.getHabbo())) - { - if(item instanceof InteractionRoller || + if (item instanceof InteractionRoller || item instanceof InteractionStackHelper || item instanceof InteractionWired || item instanceof InteractionBackgroundToner || item instanceof InteractionRoomAds || item instanceof InteractionCannon || - item instanceof InteractionPuzzleBox) + item instanceof InteractionPuzzleBox || + item.getBaseItem().getType() == FurnitureType.WALL) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); return; } - } - if(Emulator.getPluginManager().isRegistered(FurniturePlacedEvent.class, true)) - { - Event furniturePlacedEvent = new FurniturePlacedEvent(item, this.client.getHabbo(), room.getLayout().getTile(x, y)); - Emulator.getPluginManager().fireEvent(furniturePlacedEvent); - - if(furniturePlacedEvent.isCancelled()) - return; - } - - if(rentSpace != null) - { - if(!RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) + if (!RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode)); return; } - } - double checkStackHeight = room.getStackHeight(x, y, false); - - if (checkStackHeight != (double)room.getLayout().getTile(x, y).z && item instanceof InteractionRoller) - { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); return; } - HabboItem stackHelper = room.getStackHelper(x, y); + RoomTile tile = room.getLayout().getTile(x, y); + FurnitureMovementError error = room.canPlaceFurnitureAt(item, this.client.getHabbo(), tile, rotation); - Rectangle newSquare = RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); - - //if (x != item.getX() || y != item.getY() || item.getRotation() != rotation) - if (stackHelper == null) + if (!error.equals(FurnitureMovementError.NONE)) { - checkStackHeight = room.getStackHeight(x, y, false, item); - for (short i = (short) newSquare.x; i < newSquare.x + newSquare.getWidth(); i++) - { - for (short j = (short) newSquare.y; j < newSquare.y + newSquare.getHeight(); j++) - { - double testheight = room.getStackHeight(i, j, false, item); - if (checkStackHeight != testheight && !(item instanceof InteractionStackHelper)) - { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); - this.client.sendResponse(new FloorItemUpdateComposer(item)); - return; - } - - if (!room.getHabbosAt(i, j).isEmpty() && !(item instanceof InteractionStackHelper || item.getBaseItem().allowSit())) - { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); - this.client.sendResponse(new FloorItemUpdateComposer(item)); - return; - } - - boolean found = false; - for (RoomTile tile : updatedTiles) - { - if (tile.x == i && tile.y == j) - { - found = true; - } - } - - if (!found) - { - RoomTile t = room.getLayout().getTile(i, j); - if (t != null) - updatedTiles.add(t); - } - } - } + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, error.errorCode)); + return; } - item.setZ(stackHelper == null ? room.getStackHeight(x, y, false) : (stackHelper.getExtradata().isEmpty() ? room.getLayout().getHeightAtSquare(x, y) : (double) Integer.valueOf(stackHelper.getExtradata()) / 100)); - item.setX(x); - item.setY(y); - item.setRotation(rotation); - room.sendComposer(new AddFloorItemComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose()); + error = room.placeFloorFurniAt(item, tile, rotation, this.client.getHabbo()); + if (!error.equals(FurnitureMovementError.NONE)) + { + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, error.errorCode)); + return; + } } else { - if(Emulator.getPluginManager().isRegistered(FurniturePlacedEvent.class, true)) + FurnitureMovementError error = room.placeWallFurniAt(item, values[1] + " " + values[2] + " " + values[3], this.client.getHabbo()); + if (!error.equals(FurnitureMovementError.NONE)) { - Event furniturePlacedEvent = new FurniturePlacedEvent(item, this.client.getHabbo(), null); - Emulator.getPluginManager().fireEvent(furniturePlacedEvent); - - if(furniturePlacedEvent.isCancelled()) - return; - } - - item.setWallPosition(values[1] + " " + values[2] + " " + values[3]); - room.sendComposer(new AddWallItemComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose()); - } - - Achievement roomDecoAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoFurniCount"); - int furniCollecterProgress = this.client.getHabbo().getHabboStats().getAchievementProgress(roomDecoAchievement); - int difference = room.getUserFurniCount(this.client.getHabbo().getHabboInfo().getId()) - furniCollecterProgress; - if (difference > 0) - { - AchievementManager.progressAchievement(this.client.getHabbo(), roomDecoAchievement, difference); - } - - if (item instanceof InteractionBlackHole) - { - Achievement holeCountAchievement = Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHoleFurniCount"); - int holesCountProgress = this.client.getHabbo().getHabboStats().getAchievementProgress(holeCountAchievement); - int holeDifference = room.getRoomSpecialTypes().getItemsOfType(InteractionBlackHole.class).size() - holesCountProgress; - - if (holeDifference > 0) - { - AchievementManager.progressAchievement(this.client.getHabbo(), holeCountAchievement, holeDifference); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, error.errorCode)); + return; } } this.client.sendResponse(new RemoveHabboItemComposer(item.getId())); - item.needsUpdate(true); this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item.getId()); - room.addHabboItem(item); - item.setRoomId(room.getId()); @@ -271,13 +159,9 @@ public class RoomPlaceItemEvent extends MessageHandler - room.updateTiles(updatedTiles); - for (RoomTile tile : updatedTiles) - { - room.updateHabbosAt(tile.x, tile.y); - } - Emulator.getThreading().run(item); - item.onPlace(room); + +// + } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RotateMoveItemEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RotateMoveItemEvent.java index 65ebad9f..855c9a5f 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RotateMoveItemEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/RotateMoveItemEvent.java @@ -1,22 +1,13 @@ package com.eu.habbo.messages.incoming.rooms.items; -import com.eu.habbo.Emulator; -import com.eu.habbo.habbohotel.items.interactions.InteractionRoller; -import com.eu.habbo.habbohotel.items.interactions.InteractionStackHelper; -import com.eu.habbo.habbohotel.rooms.*; -import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.habbohotel.rooms.FurnitureMovementError; +import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.incoming.MessageHandler; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer; import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys; import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer; -import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; -import com.eu.habbo.plugin.Event; -import com.eu.habbo.plugin.events.furniture.FurnitureMovedEvent; -import com.eu.habbo.plugin.events.furniture.FurnitureRotatedEvent; -import gnu.trove.set.hash.THashSet; - -import java.awt.*; public class RotateMoveItemEvent extends MessageHandler { @@ -30,80 +21,38 @@ public class RotateMoveItemEvent extends MessageHandler int furniId = this.packet.readInt(); HabboItem item = room.getHabboItem(furniId); - - HabboItem rentSpace = null; - if(!this.client.getHabbo().getHabboStats().canRentSpace()) - { - rentSpace = room.getHabboItem(this.client.getHabbo().getHabboStats().rentedItemId); - } - else - { - if (item == null || (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission("acc_placefurni") && !(room.getGuildId() > 0 && room.guildRightLevel(this.client.getHabbo()) >= 2))) - { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); - - if (item != null) - { - this.client.sendResponse(new FloorItemUpdateComposer(item)); - } - return; - } - } + if (item == null) return; int x = this.packet.readInt(); int y = this.packet.readInt(); int rotation = this.packet.readInt(); + RoomTile tile = room.getLayout().getTile((short) x, (short) y); - if(x < 0 || y < 0 || rotation < 0) + FurnitureMovementError error = room.canPlaceFurnitureAt(item, this.client.getHabbo(), tile, rotation); + if (!error.equals(FurnitureMovementError.NONE)) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); - return; - } + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, error.errorCode)); - short oldX = item.getX(); - short oldY = item.getY(); - int oldRotation = item.getRotation(); - - RoomTile oldLocation = room.getLayout().getTile(oldX, oldY); - - if(rentSpace != null) - { - if(!RoomLayout.squareInSquare(RoomLayout.getRectangle(rentSpace.getX(), rentSpace.getY(), rentSpace.getBaseItem().getWidth(), rentSpace.getBaseItem().getLength(), rentSpace.getRotation()), RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))) + if (item != null) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "cant_set_not_owner")); this.client.sendResponse(new FloorItemUpdateComposer(item)); - return; } + + return; } - HabboItem hasStackHelper = room.getStackHelper(x, y); - HabboItem topItem = null; - if(hasStackHelper == null) - topItem = room.getTopItemAt(x, y); - - if (topItem != null && topItem != item && !topItem.getBaseItem().allowStack() && !(item instanceof InteractionStackHelper)) + error = room.moveFurniTo(item, tile, rotation, this.client.getHabbo()); + if (!error.equals(FurnitureMovementError.NONE)) { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); + this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, error.errorCode)); this.client.sendResponse(new FloorItemUpdateComposer(item)); return; } - THashSet updatedTiles = new THashSet<>(); - Rectangle currentSquare = RoomLayout.getRectangle(item.getX(), item.getY(), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); - for (short i = (short) currentSquare.x; i < currentSquare.x + currentSquare.getWidth(); i++) - { - for (short j = (short) currentSquare.y; j < currentSquare.y + currentSquare.getHeight(); j++) - { - RoomTile tile = room.getLayout().getTile(i, j); - if (tile != null) - { - updatedTiles.add(tile); - } - } - } +// @@ -113,140 +62,189 @@ public class RotateMoveItemEvent extends MessageHandler - //room.removeHabboItem(item.getId()); - double checkStackHeight = item.getZ(); - Rectangle newSquare = RoomLayout.getRectangle(x, y, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation); - if (room.getStackHeight(x, y, false, item) != (double)room.getLayout().getTile((short)x, (short)y).z && item instanceof InteractionRoller) - { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); - this.client.sendResponse(new FloorItemUpdateComposer(item)); - return; - } - //if (x != item.getX() || y != item.getY() || item.getRotation() != rotation) - if (hasStackHelper == null) - { - checkStackHeight = room.getStackHeight(x, y, false, item); - for (short i = (short) newSquare.x; i < newSquare.x + newSquare.getWidth(); i++) - { - for (short j = (short) newSquare.y; j < newSquare.y + newSquare.getHeight(); j++) - { - double testheight = room.getStackHeight(i, j, false, item); - if ( - (checkStackHeight != testheight && !(item instanceof InteractionStackHelper)) || - (!room.getHabbosAt(i, j).isEmpty() && !(oldX == x && oldY == y) && !(item instanceof InteractionStackHelper)) - ) - { - this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNI_PLACE_EMENT_ERROR.key, "${room.error.cant_set_item}")); - this.client.sendResponse(new FloorItemUpdateComposer(item)); - return; - } +// - boolean found = false; - for (RoomTile tile : updatedTiles) - { - if (tile != null) - { - if (tile.x == i && tile.y == j) - { - found = true; - } - } - } - if (!found) - { - RoomTile t = room.getLayout().getTile(i, j); - if (t != null) - updatedTiles.add(t); - } - } - } - } - if(topItem == null || (topItem != item && topItem.getBaseItem().allowStack())) { - item.setZ(topItem == null && hasStackHelper != null ? hasStackHelper.getExtradata().isEmpty() ? Double.valueOf("0.0") : Double.valueOf(hasStackHelper.getExtradata()) / 100.0D : checkStackHeight); - } - if(item.getBaseItem().allowSit()) - { - THashSet habbos = room.getHabbosAt(oldX, oldY); - THashSet updatedUnits = new THashSet<>(); - for (Habbo habbo : habbos) - { - habbo.getRoomUnit().removeStatus(RoomUnitStatus.SIT); - } - room.sendComposer(new RoomUserStatusComposer(updatedUnits, false).compose()); - } +// - if (item.getBaseItem().allowLay()) - { - THashSet habbos = room.getHabbosAt(oldX, oldY); - THashSet updatedUnits = new THashSet<>(); - for (Habbo habbo : habbos) - { - habbo.getRoomUnit().removeStatus(RoomUnitStatus.LAY); - } - room.sendComposer(new RoomUserStatusComposer(updatedUnits, false).compose()); - } - item.setX((short) x); - item.setY((short) y); - if(item.getRotation() != rotation) - { - item.setRotation(rotation); - if(Emulator.getPluginManager().isRegistered(FurnitureRotatedEvent.class, true)) - { - Event furnitureRotatedEvent = new FurnitureRotatedEvent(item, this.client.getHabbo(), oldRotation); - Emulator.getPluginManager().fireEvent(furnitureRotatedEvent); - if(furnitureRotatedEvent.isCancelled()) - { - item.setRotation(oldRotation); - } - } - } - RoomTile newLocation = room.getLayout().getTile(item.getX(), item.getY()); - item.onMove(room, oldLocation, newLocation); +// - if(Emulator.getPluginManager().isRegistered(FurnitureMovedEvent.class, true)) - { - Event furnitureMovedEvent = new FurnitureMovedEvent(item, this.client.getHabbo(), oldLocation, newLocation); - Emulator.getPluginManager().fireEvent(furnitureMovedEvent); - if(furnitureMovedEvent.isCancelled()) - return; - } - if (item instanceof InteractionStackHelper) - { - try - { - item.setZ(Double.valueOf(item.getExtradata()) / 100.0); - } - catch (Exception e) - {} - } - room.updateTiles(updatedTiles); - for(RoomTile t : updatedTiles) - { - //t.setStackHeight(room.getStackHeight(t.x, t.y, false)); - if(oldX != t.x || oldY != t.y) - room.updateHabbosAt(t.x, t.y); - } +// + + + + + + +// + +// + +// + + + + + +// + + + + + + +// +// +// +// +// +// +// +// +// + +// + + +// + + + + + + + + + + + + + + + + + + +// + + + + + + + + + + + +// + + + + + + + + + +// + + + +// + + + + + + + + + + +// + + + + + + + + + + +// + + +// + + + +// + + + + +// + + + + + + +// + + + +// + + + + +// + + + +// + + + + + + + + + +// + +// + + + +// + + + +// + + +// + - if(oldX != x || oldY != y) - room.updateHabbosAt(oldX, oldY); - room.sendComposer(new FloorItemUpdateComposer(item).compose()); - item.needsUpdate(true); - Emulator.getThreading().run(item); } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetStackHelperHeightEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetStackHelperHeightEvent.java index a4a39036..2ca3ff24 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetStackHelperHeightEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/items/SetStackHelperHeightEvent.java @@ -25,12 +25,26 @@ public class SetStackHelperHeightEvent extends MessageHandler if(item instanceof InteractionStackHelper) { - - Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom(); RoomTile itemTile = room.getLayout().getTile(item.getX(), item.getY()); - int stackerHeight = Math.min(Math.max(this.packet.readInt(), itemTile.z * 100), 4000); + double stackerHeight = this.packet.readInt(); + THashSet tiles = room.getLayout().getTilesAt(itemTile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()); + if (stackerHeight == -100) + { + for (RoomTile tile : tiles) + { + double stackheight = room.getStackHeight(tile.x, tile.y, false, item) * 100; + if (stackheight > stackerHeight) + { + stackerHeight = stackheight; + } + } + } + else + { + stackerHeight = Math.min(Math.max(stackerHeight, itemTile.z * 100), 4000); + } double height = 0; if(stackerHeight >= 0) diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/BreedPetsEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/BreedMonsterplantsEvent.java similarity index 94% rename from src/main/java/com/eu/habbo/messages/incoming/rooms/pets/BreedPetsEvent.java rename to src/main/java/com/eu/habbo/messages/incoming/rooms/pets/BreedMonsterplantsEvent.java index 4da2742f..19977bd1 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/BreedPetsEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/BreedMonsterplantsEvent.java @@ -4,7 +4,7 @@ import com.eu.habbo.habbohotel.pets.MonsterplantPet; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.messages.incoming.MessageHandler; -public class BreedPetsEvent extends MessageHandler +public class BreedMonsterplantsEvent extends MessageHandler { @Override public void handle() throws Exception diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ConfirmPetBreedingEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ConfirmPetBreedingEvent.java new file mode 100644 index 00000000..2e785c27 --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/ConfirmPetBreedingEvent.java @@ -0,0 +1,25 @@ +package com.eu.habbo.messages.incoming.rooms.pets; + +import com.eu.habbo.habbohotel.items.interactions.InteractionPetBreedingNest; +import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.messages.incoming.MessageHandler; + +public class ConfirmPetBreedingEvent extends MessageHandler +{ + + @Override + public void handle() throws Exception + { + int itemId = this.packet.readInt(); + String name = this.packet.readString(); + int petOneId = this.packet.readInt(); + int petTwoId = this.packet.readInt(); + + HabboItem item = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabboItem(itemId); + + if (item != null && item instanceof InteractionPetBreedingNest) + { + ((InteractionPetBreedingNest)item).breed(this.client.getHabbo(), name, petOneId, petTwoId); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/StopBreedingEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/StopBreedingEvent.java new file mode 100644 index 00000000..facd857c --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/pets/StopBreedingEvent.java @@ -0,0 +1,21 @@ +package com.eu.habbo.messages.incoming.rooms.pets; + +import com.eu.habbo.habbohotel.items.interactions.InteractionPetBreedingNest; +import com.eu.habbo.habbohotel.users.HabboItem; +import com.eu.habbo.messages.incoming.MessageHandler; + +public class StopBreedingEvent extends MessageHandler +{ + @Override + public void handle() throws Exception + { + int itemId = this.packet.readInt(); + + HabboItem item = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabboItem(itemId); + + if (item != null && item instanceof InteractionPetBreedingNest) + { + ((InteractionPetBreedingNest) item).stopBreeding(this.client.getHabbo()); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/incoming/unknown/UnknownEvent1.java b/src/main/java/com/eu/habbo/messages/incoming/unknown/UnknownEvent1.java index a7a91c20..cc23a0f9 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/unknown/UnknownEvent1.java +++ b/src/main/java/com/eu/habbo/messages/incoming/unknown/UnknownEvent1.java @@ -1,13 +1,13 @@ package com.eu.habbo.messages.incoming.unknown; import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.unknown.UnknownComposer6; +import com.eu.habbo.messages.outgoing.unknown.IgnoredUsersComposer; public class UnknownEvent1 extends MessageHandler { @Override public void handle() throws Exception { - this.client.sendResponse(new UnknownComposer6()); + this.client.sendResponse(new IgnoredUsersComposer()); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java index 832c4d9f..455104d4 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/RequestUserDataEvent.java @@ -107,7 +107,7 @@ public class RequestUserDataEvent extends MessageHandler else { Emulator.getLogging().logDebugLine("Habbo is NULL!"); - this.client.getChannel().close(); + Emulator.getGameServer().getGameClientManager().disposeClient(this.client); } } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/users/UserNuxEvent.java b/src/main/java/com/eu/habbo/messages/incoming/users/UserNuxEvent.java index 631c633e..f3a5d116 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/users/UserNuxEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/users/UserNuxEvent.java @@ -3,7 +3,7 @@ package com.eu.habbo.messages.incoming.users; import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.incoming.MessageHandler; -import com.eu.habbo.messages.outgoing.unknown.NuxAlertComposer; +import com.eu.habbo.messages.outgoing.habboway.nux.NuxAlertComposer; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java index 3aa37f86..b38ba848 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing.java @@ -212,9 +212,9 @@ public class Outgoing public final static int ModToolIssueHandlerDimensionsComposer = 1576; //Uknown but work - public final static int UnknownComposer4 = 793; + public final static int IsFirstLoginOfDayComposer = 793; public final static int UnknownComposer5 = 2833; - public final static int UnknownComposer6 = 126; + public final static int IgnoredUsersComposer = 126; public final static int NewNavigatorMetaDataComposer = 3052; public final static int NewNavigatorSearchResultsComposer = 2690; public final static int MysticBoxStartOpenComposer = 3201; @@ -242,7 +242,7 @@ public class Outgoing public final static int TalentTrackEmailFailedComposer = 1815; public final static int UnknownAvatarEditorComposer = 3473; - public final static int UnknownGuildComposer = 1180; + public final static int GuildMembershipRequestedComposer = 1180; public final static int GuildForumsUnreadMessagesCountComposer = 2379; public final static int GuildForumThreadMessagesComposer = 1862; @@ -274,7 +274,7 @@ public class Outgoing public final static int RoomMutedComposer = 2533; public final static int HideDoorbellComposer = 3783; - public final static int RoomUnknown2Composer = 2208; + public final static int RoomQueueStatusMessage = 2208; public final static int RoomUnknown3Composer = 1033; public final static int EffectsListRemoveComposer = 2228; @@ -375,14 +375,14 @@ public class Outgoing public final static int PetBreedingCompleted = 2527; public final static int RoomUserUnbannedComposer = 3429; public final static int HotelViewCommunityGoalComposer = 2525; - public final static int UnknownRoomVisitsComposer = 966; + public final static int UserClassificationComposer = 966; public final static int CanCreateEventComposer = 2599; public final static int UnknownGuild2Composer = 1459; public final static int YoutubeDisplayListComposer = 1112; public final static int YoutubeMessageComposer2 = 1411; public final static int YoutubeMessageComposer3 = 1554; public final static int RoomCategoryUpdateMessageComposer = 3896; - public final static int UnknownQuestComposer2 = 3625; + public final static int QuestsComposer = 3625; public final static int GiftReceiverNotFoundComposer = 1517; public final static int ConvertedForwardToRoomComposer = 1331; public final static int FavoriteRoomChangedComposer = 2524; @@ -393,7 +393,7 @@ public class Outgoing public final static int HotelViewHideCommunityVoteButtonComposer = 1435; public final static int CatalogSearchResultComposer = 3388; public final static int FriendFindingRoomComposer = 1210; - public final static int UnknownQuestComposer1 = 230; + public final static int QuestComposer = 230; public final static int ModToolSanctionDataComposer = 2782; public final static int RoomEventMessageComposer = 2274; @@ -419,7 +419,7 @@ public class Outgoing public final static int UnknownComposer_100 = 1553; public final static int UnknownComposer_1031 = 1001; public final static int ConnectionErrorComposer = 1004; - public final static int UnknownComposer_111 = 296; + public final static int BotForceOpenContextMenuComposer = 296; public final static int UnknownComposer_1111 = 1551; public final static int Game2WeeklyLeaderboardComposer = 2196; public final static int UnknownComposer_1165 = 904; @@ -514,7 +514,7 @@ public class Outgoing public final static int SimplePollAnswersComposer = 1066; public final static int UnknownFurniModelComposer = 1501; public final static int UnknownAdManagerComposer = 1808; - public final static int UnknownWiredComposer = 1830; + public final static int WiredOpenComposer = 1830; public final static int UnknownCatalogPageOfferComposer = 1889; public final static int NuxAlertComposer = 2023; public final static int HotelViewExpiringCatalogPageCommposer = 2515; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing_1006.java b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing_1006.java deleted file mode 100644 index bca9efe3..00000000 --- a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing_1006.java +++ /dev/null @@ -1,432 +0,0 @@ -package com.eu.habbo.messages.outgoing; - -public class Outgoing_1006 -{ - - - - - - - - - - - - - - - - - - - - - - - - - public static final int PetStatusUpdateComposer = 3566; - - - - - public final static int FavoriteRoomsCountComposer = 235; - public final static int UserCurrencyComposer = 3574; - public final static int RedeemVoucherOKComposer = 391; - public final static int RoomUserShoutComposer = 59; - public final static int RoomUserStatusComposer = 12; - public final static int RoomUserDataComposer = 2421; - public final static int RoomAddRightsListComposer = 2589; - public final static int RoomRemoveRightsListComposer = 3258; - public final static int RoomRightsListComposer = 1964; - public final static int RoomUserHandItemComposer = 2479; - public final static int RoomUsersComposer = 1018; - public final static int FriendRequestComposer = 2725; - public final static int GuildBoughtComposer = 2244; - public final static int AddUserBadgeComposer = 3489; - public final static int RecyclerCompleteComposer = 899; - public final static int GuildBuyRoomsComposer = 575; - public final static int FriendsComposer = 7; - public final static int StalkErrorComposer = 1543; - public final static int TradeCloseWindowComposer = 1850; - public final static int RemoveFloorItemComposer = 2658; - public final static int InventoryPetsComposer = 3249; - public final static int UserCreditsComposer = 1557; - public final static int WiredTriggerDataComposer = 951; - public final static int TradeStoppedComposer = 3869; - public final static int ModToolUserChatlogComposer = 342; - public final static int GuildInfoComposer = 3198; - public final static int UserPermissionsComposer = 3409; - public final static int PetNameErrorComposer = 1991; - public final static int TradeStartFailComposer = 283; - public final static int AddHabboItemComposer = 3454; - public final static int InventoryBotsComposer = 307; - public final static int CanCreateRoomComposer = 2877; - public final static int MarketplaceBuyErrorComposer = 1299; - public final static int BonusRareComposer = 2261; - public final static int HotelViewComposer = 0x0404; - public final static int UpdateFriendComposer = 3525; - public final static int FloorItemUpdateComposer = 2277; - public final static int RoomAccessDeniedComposer = 2897; - public final static int GuildFurniWidgetComposer = 1875; - public final static int GiftConfigurationComposer = 1715; - public final static int UserClubComposer = 2018; - public final static int InventoryBadgesComposer = 399; - public final static int RoomUserTypingComposer = 2327; - public final static int GuildJoinErrorComposer = 1761; - public final static int RoomCategoriesComposer = 1824; - public final static int InventoryAchievementsComposer = 2539; - public final static int MarketplaceItemInfoComposer = 894; - public final static int RoomRelativeMapComposer = 3287; - public final static int ModToolComposerTwo = 1890; - public final static int ModToolComposerOne = 1722; - public final static int RoomRightsComposer = 1421; - public final static int ObjectOnRollerComposer = 450; - public final static int PollStartComposer = 3206; - public final static int GuildRefreshMembersListComposer = 1661; - public final static int UserPerksComposer = 3281; - public final static int UserCitizinShipComposer = 3285; - public final static int PublicRoomsComposer = 972; - public final static int MarketplaceOffersComposer = 2440; - public final static int ModToolComposer = 3087; - public final static int UserBadgesComposer = 2442; - public final static int GuildManageComposer = 2129; - public final static int RemoveFriendComposer = -1106; - public final static int BannerTokenComposer = -3033; - public final static int UserDataComposer = 558; - public final static int UserSearchResultComposer = 1590; - public final static int ModToolUserRoomVisitsComposer = 520; - public final static int RoomUserRespectComposer = 3137; - public final static int RoomChatSettingsComposer = 901; - public final static int RemoveHabboItemComposer = 2368; - public final static int RoomUserRemoveComposer = 364; - public final static int RoomHeightMapComposer = 3491; - public final static int RoomPetHorseFigureComposer = 3140; - public final static int PetErrorComposer = 3013; - public final static int TradeUpdateComposer = 1649; - public final static int PrivateRoomsComposer = 2523; - public final static int RoomModelComposer = 1186; - public final static int RoomScoreComposer = 1781; - public final static int KnockKnockComposer = 2988; - public final static int SecureLoginOKComposer = 1992; - public final static int SessionRightsComposer = 2934; - public final static int GuildMemberUpdateComposer = 3641; - public final static int RoomFloorItemsComposer = 144; - public final static int InventoryItemsComposer = 1559; - public final static int RoomUserTalkComposer = 874; - public final static int TradeStartComposer = 833; - public final static int InventoryItemUpdateComposer = 2204; - public final static int ModToolIssueUpdateComposer = 471; - public final static int MeMenuSettingsComposer = 3437; - public final static int ModToolRoomInfoComposer = 1328; - public final static int GuildListComposer = 3082; - public final static int RecyclerLogicComposer = 1527; - public final static int UserHomeRoomComposer = 3876; - public final static int RoomUserDanceComposer = 2184; - public final static int RoomSettingsUpdatedComposer = 1069; - public final static int AlertPurchaseFailedComposer = 2663; - public final static int RoomDataComposer = 624; - public final static int TagsComposer = 456; - public final static int InventoryRefreshComposer = 2352; - public final static int RemovePetComposer = 775; - public final static int RemoveWallItemComposer = 1980; - public final static int TradeCompleteComposer = 1668; - public final static int NewsWidgetsComposer = 3958; - public final static int WiredEffectDataComposer = 2101; - public final static int BubbleAlertComposer = 1569; - public final static int ReloadRecyclerComposer = 3704; - public final static int MoodLightDataComposer = 2780; - public final static int WiredRewardAlertComposer = 1539; - public final static int CatalogPageComposer = 1384; - public final static int CatalogModeComposer = 3408; - public final static int RoomUserUpdateNameComposer = 1263; - public final static int AddFloorItemComposer = 2502; - public final static int DebugConsoleComposer = 1003; - public final static int HallOfFameComposer = 3736; - public final static int WiredSavedComposer = 598; - public final static int RoomPaintComposer = 2225; - public final static int MarketplaceConfigComposer = 739; - public final static int AddBotComposer = 1771; - public final static int FriendRequestErrorComposer = 3601; - public final static int GuildMembersComposer = 1788; - public final static int RoomOpenComposer = 2266; - public final static int ModToolRoomChatlogComposer = 1633; - public final static int DiscountComposer = 3254; - public final static int MarketplaceCancelSaleComposer = 751; - public final static int RoomPetRespectComposer = 2348; - public final static int RoomSettingsComposer = 3622; - public final static int TalentTrackComposer = 3235; - public final static int CatalogPagesListComposer = 402; - public final static int AlertLimitedSoldOutComposer = 3467; - public final static int CatalogUpdatedComposer = 2452; - public final static int PurchaseOKComposer = 2316; - public final static int WallItemUpdateComposer = 21; - public final static int TradeAcceptedComposer = 3042; - public final static int AddWallItemComposer = 706; - public final static int ModToolRoomEntryInfoComposer = 381; - public final static int HotelViewDataComposer = 3810; - public final static int PresentItemOpenedComposer = 2004; - public final static int RoomUserRemoveRightsComposer = 61; - public final static int UserBCLimitsComposer = 3408; - public final static int PetTrainingPanelComposer = 1897; - public final static int RoomPaneComposer = 381; - public final static int RedeemVoucherErrorComposer = 1809; - public final static int RoomCreatedComposer = 3168; - public final static int GenericAlertComposer = 1406; - public final static int GroupPartsComposer = 3569; - public final static int ModToolIssueInfoComposer = 3928; - public final static int RoomUserWhisperComposer = 2945; - public final static int BotErrorComposer = 1932; - public final static int FreezeLivesComposer = 3985; - public final static int LoadFriendRequestsComposer = 683; - public final static int MarketplaceSellItemComposer = 92; - public final static int ClubDataComposer = 2273; - public final static int ProfileFriendsComposer = 2231; - public final static int MarketplaceOwnItemsComposer = 311; - public final static int RoomOwnerComposer = 3608; - public final static int WiredConditionDataComposer = 3969; - public final static int ModToolUserInfoComposer = 828; - public final static int UserWardrobeComposer = 406; - public final static int RoomPetExperienceComposer = 3711; - public final static int FriendChatMessageComposer = 3957; - public final static int PetInformationComposer = 64; - public final static int RoomThicknessComposer = 2145; - public final static int AddPetComposer = 2194; - public final static int UpdateStackHeightComposer = 597; - public final static int RemoveBotComposer = 3691; - public final static int RoomEnterErrorComposer = 817; - public final static int PollQuestionsComposer = 1143; - public final static int GenericErrorMessages = 1169; - public final static int RoomWallItemsComposer = 3524; - public final static int RoomUserEffectComposer = 579; - public final static int PetBreedsComposer = 1947; - public final static int ModToolIssueChatlogComposer = 3053; - public final static int RoomUserActionComposer = 3741; - public final static int BotSettingsComposer = 3092; - public final static int UserProfileComposer = 3049; - public final static int MinimailCountComposer = 761; - public final static int UserAchievementScoreComposer = 3681; - public final static int PetLevelUpComposer = 3100; - public final static int UserPointsComposer = 1439; - public final static int ReportRoomFormComposer = 2573; - public final static int ModToolIssueHandledComposer = 1297; - public final static int FloodCounterComposer = 2106; - public final static int UpdateFailedComposer = 3006; - public final static int FloorPlanEditorDoorSettingsComposer = 1988; - public final static int FloorPlanEditorBlockedTilesComposer = 3388; - public final static int BuildersClubExpiredComposer = 25; - public final static int RoomSettingsSavedComposer = 2769; - public final static int MessengerInitComposer = 3682; - public final static int UserClothesComposer = 2651; - public final static int UserEffectsListComposer = 1348; - public final static int NewUserIdentityComposer = 1733; - public final static int NewNavigatorEventCategoriesComposer = 1391; - public final static int NewNavigatorCollapsedCategoriesComposer = 3110; - public final static int NewNavigatorLiftedRoomsComposer = 2469; - public final static int NewNavigatorSavedSearchesComposer = 3349; - public final static int RoomUnitUpdateUsernameComposer = 2063; - public final static int PostItDataComposer = 3443; - public final static int ModToolReportReceivedAlertComposer = 3453; - public final static int ModToolIssueResponseAlertComposer = 971; - public final static int AchievementListComposer = 1417; - public final static int AchievementProgressComposer = 1550; - public final static int AchievementUnlockedComposer = 1335; - public final static int ClubGiftsComposer = 197; - public final static int MachineIDComposer = 3609; - public final static int PongComposer = 1349; - - - public final static int UnknownComposer4 = 1411; - public final static int UnknownComposer5 = 568; - public final static int UnknownComposer6 = 32; - public final static int NewNavigatorMetaDataComposer = 1129; - public final static int NewNavigatorSearchResultsComposer = 3203; - public final static int MysticBoxStartOpenComposer = 3513; - public final static int MysticBoxCloseComposer = 2581; - public final static int MysticBoxPrizeComposer = 3040; - public final static int RentableSpaceInfoComposer = 194; - public final static int RentableSpaceUnknownComposer = 2051; - public final static int RentableSpaceUnknown2Composer = 1075; - public final static int GuildConfirmRemoveMemberComposer = 3940; - - public final static int LandingViewGetBadgeButtonConfig = 940; - public final static int EpicPopupFrameComposer = 916; - public final static int BaseJumpLoadGameURL = 871; - public final static int RoomUserTagsComposer = 799; - public final static int RoomInviteErrorCodeComposer = 76; - public final static int PostItStickyPoleOpenComposer = 753; - public final static int NewYearResolutionProgressComposer = 741; - public final static int ClubGiftReceivedComposer = 735; - public final static int ItemStateComposer = 664; - public final static int ItemExtraDataComposer = 654; - - - public final static int QuestionInfoComposer = 3047; - public final static int TalentTrackEmailVerifiedComposer = 866; - public final static int TalentTrackEmailFailedComposer = 369; - public final static int UnknownAvatarEditorComposer = 72; - - public final static int UnknownGuildComposer = 588; - - public final static int UnknownGuildForumComposer1 = 600; - public final static int UnknownGuildForumComposer2 = 1291; - public final static int UnknownGuildForumComposer3 = 1147; - public final static int UnknownGuildForumComposer4 = 3420; - public final static int UnknownGuildForumComposer5 = 324; - public final static int UnknownGuildForumComposer6 = 2161; - public final static int UnknownGuildForumComposer7 = 3853; - public final static int UnknownGuildForumComposer8 = 2695; - public final static int UnknownGuildForumComposer9 = 3077; - - public final static int GuideSessionAttachedComposer = 3549; - public final static int GuideSessionDetachedComposer = 2987; - public final static int GuideSessionStartedComposer = 3048; - public final static int GuideSessionEndedComposer = 3222; - public final static int GuideSessionErrorComposer = 978; - public final static int GuideSessionMessageComposer = 1860; - public final static int GuideSessionRequesterRoomComposer = 1861; - public final static int GuideSessionInvitedToGuideRoomComposer = 2959; - public final static int GuideSessionPartnerIsTypingComposer = 2955; - - public final static int GuideToolsComposer = 117; - public final static int GuardianNewReportReceivedComposer = 3123; - public final static int GuardianVotingRequestedComposer = 2331; - public final static int GuardianVotingVotesComposer = 3107; - public final static int GuardianVotingResultComposer = 91; - public final static int GuardianVotingTimeEnded = 556; - - public final static int RoomMutedComposer = 554; - - public final static int RoomUnknown1Composer = 1241; - public final static int RoomUnknown2Composer = 535; - public final static int RoomUnknown3Composer = 2342; - - public final static int UnknownEffectsComposer = 53; - - public final static int OldPublicRoomsComposer = 580; - public final static int ItemStateComposer2 = 569; - - public final static int HotelWillCloseInMinutesComposer = 518; - public final static int HotelWillCloseInMinutesAndBackInComposer = 2860; - public final static int HotelClosesAndWillOpenAtComposer = 2168; - public final static int HotelClosedAndOpensComposer = 888; - public final static int StaffAlertAndOpenHabboWayComposer = 1035; - public final static int StaffAlertWithLinkComposer = 1189; - public final static int StaffAlertWIthLinkAndOpenHabboWayComposer = 3964; - - public final static int RoomMessagesPostedCountComposer = 1520; - public final static int CantScratchPetNotOldComposer = 118; - public final static int PetBoughtNotificationComposer = 1040; - public final static int MessagesForYouComposer = 2506; - public final static int UnknownStatusComposer = 1648; - public final static int CloseWebPageComposer = 320; - public final static int PickMonthlyClubGiftNotificationComposer = 2786; - public final static int RemoveGuildFromRoomComposer = 514; - public final static int RoomBannedUsersComposer = 504; - public final static int OpenRoomCreationWindowComposer = 497; - public final static int ItemsDataUpdateComposer = 466; - public final static int WelcomeGiftComposer = 445; - public final static int SimpleRoomPollStartComposer = 3047; - public final static int RoomNoRightsComposer = 3929; - public final static int GuildEditFailComposer = 3918; - public final static int MinimailNewMessageComposer = 3903; - public final static int RoomFilterWordsComposer = 3889; - public final static int VerifyMobileNumberComposer = 3872; - public final static int NewUserGiftComposer = 3098; - public final static int UpdateUserLookComposer = 3864; - public final static int UserIgnoredComposer = 3858; - public final static int PetBreedingFailedComposer = 3851; - public final static int HabboNameChangedComposer = 3849; - public final static int RoomUserNameChangedComposer = 2063; - public final static int LoveLockFurniStartComposer = 2883; - public final static int LoveLockFurniFriendConfirmedComposer = 2746; - public final static int LoveLockFurniFinishedComposer = 3825; - public final static int OpenPetPackageNameValidationComposer = 38; - public final static int GameCenterFeaturedPlayersComposer = 3788; - public final static int HabboMallComposer = 3770; - public final static int TargetedOfferComposer = 1495; - public final static int LeprechaunStarterBundleComposer = 3766; - public final static int VerifyMobilePhoneWindowComposer = 3695; - public final static int VerifyMobilePhoneCodeWindowComposer = 2160; - public final static int VerifyMobilePhoneDoneComposer = 3109; - public final static int RoomUserReceivedHandItemComposer = 3673; - public final static int MutedWhisperComposer = 3326; - public final static int UnknownHintComposer = 3484; - public final static int BullyReportHandled = 3401; - public final static int PromoteRoomsComposer = 3376; - public final static int NotEnoughPointsTypeComposer = 334; - public final static int WatchAndEarnRewardComposer = 3325; - public final static int NewYearResolutionComposer = 327; - public final static int WelcomeGiftErrorComposer = 3268; - public final static int RentableItemBuyOutPriceComposer = 3264; - public final static int VipTutorialsStartComposer = 3217; - public final static int NewNavigatorCategoryUserCountComposer = 3166; - public final static int RoomThumbnailSavedComposer = 3117; - public final static int RoomEditSettingsErrorComposer = 3094; - public final static int GuildAcceptMemberErrorComposer = 305; - public final static int MostUselessErrorAlertComposer = 2944; - public final static int GameAchievementsComposer = 2937; - public final static int PetBreedingResultComposer = 2907; - public final static int RoomUserQuestionAnsweredComposer = 2866; - public final static int PetBreedingStartComposer = 285; - public final static int CustomNotificationComposer = 2835; - public final static int UpdateStackHeightTileHeightComposer = 2830; - public final static int MarketplaceItemPostedComposer = 2797; - public final static int UnknownHabboQuizComposer = 2750; - public final static int GuildFavoriteRoomUserUpdateComposer = 275; - public final static int RoomAdErrorComposer = 2692; - public final static int NewNavigatorDimensionsComposer = 2617; - public final static int CameraPublishWaitMessageComposer = 2612; - public final static int RoomInviteComposer = 2608; - public final static int HelperRequestFailedComposer = 1917; - public final static int UnknownHelperComposer = 2544; - public final static int HelperRequestDisabledComposer = 1125; - public final static int RoomUnitIdleComposer = 2462; - public final static int QuestCompletedComposer = 2459; - public final static int UnkownPetPackegeComposer = 2417; - public final static int ForwardToRoomComposer = 2382; - public final static int EffectsListEffectEnableComposer = 2381; - public final static int CompetitionEntrySubmitResultComposer = 2308; - public final static int ExtendClubMessageComposer = 2304; - public final static int InventoryAddEffectComposer = 215; - public final static int TalentLevelUpdateComposer = 1956; - public final static int BullyReportMessageComposer = 1858; - public final static int UnknownQuestComposer3 = 1851; - public final static int FriendToolbarNotificationComposer = 1839; - public final static int MessengerErrorComposer = 1838; - public final static int CameraPriceComposer = 1676; - public final static int PetBreedingCompleted = 1628; - public final static int RoomUserUnbannedComposer = 1625; - public final static int CommunityGoalComposer = 1579; - public final static int UnknownRoomVisitsComposer = 155; - public final static int CanCreateEventComposer = 1542; - public final static int UnknownGroupComposer = 1507; - public final static int YoutubeMessageComposer1 = 1477; - public final static int YoutubeMessageComposer2 = 1475; - public final static int RoomCategoryUpdateMessageComposer = 1433; - public final static int UnknownQuestComposer2 = 1415; - public final static int GiftReceiverNotFoundComposer = 1374; - public final static int ConvertedForwardToRoomComposer = 1323; - public final static int FavoriteRoomChangedComposer = 1317; - public final static int AlertPurchaseUnavailableComposer = 1303; - public final static int PetBreedingStartFailedComposer = 1252; - public final static int DailyQuestComposer = 1244; - public final static int NewNavigatorRoomEventComposer = 1162; - public final static int HotelViewHideCommunityVoteButtonComposer = 115; - public final static int CatalogSearchResultComposer = 1142 ; - public final static int FriendFindingRoomComposer = 1037; - public final static int UnknownQuestComposer1 = 1010; - - - public final static int JukeBoxMySongsComposer = 2224; - public final static int JukeBoxNowPlayingMessageComposer = 2197; - public final static int JukeBoxPlaylistFullComposer = 2732; - public final static int JukeBoxPlayListUpdatedComposer = 2858; - public final static int JukeBoxPlayListAddSongComposer = 1558; - public final static int JukeBoxPlayListComposer = 3011; - public final static int JukeBoxTrackDataComposer = 442; - public final static int JukeBoxTrackCodeComposer = 3588; - - -} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing_Back.java b/src/main/java/com/eu/habbo/messages/outgoing/Outgoing_Back.java deleted file mode 100644 index 50efa178..00000000 --- a/src/main/java/com/eu/habbo/messages/outgoing/Outgoing_Back.java +++ /dev/null @@ -1,435 +0,0 @@ -package com.eu.habbo.messages.outgoing; - -public class Outgoing_Back -{ - - - - - - - - - - - - - - - - - - - - - - - - - public static final int PetStatusUpdateComposer = 3566; - - - - - public final static int FavoriteRoomsCountComposer = 235; - public final static int UserCurrencyComposer = 3574; - public final static int RedeemVoucherOKComposer = 391; - public final static int RoomUserShoutComposer = 59; - public final static int RoomUserStatusComposer = 12; - public final static int RoomUserDataComposer = 2421; - public final static int RoomAddRightsListComposer = 2589; - public final static int RoomRemoveRightsListComposer = 3258; - public final static int RoomRightsListComposer = 1964; - public final static int RoomUserHandItemComposer = 2479; - public final static int RoomUsersComposer = 1018; - public final static int FriendRequestComposer = 2725; - public final static int GuildBoughtComposer = 2244; - public final static int AddUserBadgeComposer = 3489; - public final static int RecyclerCompleteComposer = 899; - public final static int GuildBuyRoomsComposer = 575; - public final static int FriendsComposer = 7; - public final static int StalkErrorComposer = 1543; - public final static int TradeCloseWindowComposer = 1850; - public final static int RemoveFloorItemComposer = 2658; - public final static int InventoryPetsComposer = 3249; - public final static int UserCreditsComposer = 1557; - public final static int WiredTriggerDataComposer = 951; - public final static int TradeStoppedComposer = 3869; - public final static int ModToolUserChatlogComposer = 342; - public final static int GuildInfoComposer = 3198; - public final static int UserPermissionsComposer = 3409; - public final static int PetNameErrorComposer = 1991; - public final static int TradeStartFailComposer = 283; - public final static int AddHabboItemComposer = 3454; - public final static int InventoryBotsComposer = 307; - public final static int CanCreateRoomComposer = 2877; - public final static int MarketplaceBuyErrorComposer = 1299; - public final static int BonusRareComposer = 2261; - public final static int HotelViewComposer = 0x0404; - public final static int UpdateFriendComposer = 3525; - public final static int FloorItemUpdateComposer = 2277; - public final static int RoomAccessDeniedComposer = 2897; - public final static int GuildFurniWidgetComposer = 1875; - public final static int GiftConfigurationComposer = 1715; - public final static int UserClubComposer = 2018; - public final static int InventoryBadgesComposer = 399; - public final static int RoomUserTypingComposer = 2327; - public final static int GuildJoinErrorComposer = 1761; - public final static int RoomCategoriesComposer = 1824; - public final static int InventoryAchievementsComposer = 2539; - public final static int MarketplaceItemInfoComposer = 894; - public final static int RoomRelativeMapComposer = 3287; - public final static int ModToolComposerTwo = 1890; - public final static int ModToolComposerOne = 1722; - public final static int RoomRightsComposer = 1421; - public final static int ObjectOnRollerComposer = 450; - public final static int PollStartComposer = 3206; - public final static int GuildRefreshMembersListComposer = 1661; - public final static int UserPerksComposer = 3281; - public final static int UserCitizinShipComposer = 3285; - public final static int PublicRoomsComposer = 972; - public final static int MarketplaceOffersComposer = 2440; - public final static int ModToolComposer = 3087; - public final static int UserBadgesComposer = 2442; - public final static int GuildManageComposer = 2129; - public final static int RemoveFriendComposer = -1106; - public final static int BannerTokenComposer = -3033; - public final static int UserDataComposer = 558; - public final static int UserSearchResultComposer = 1590; - public final static int ModToolUserRoomVisitsComposer = 520; - public final static int RoomUserRespectComposer = 3137; - public final static int RoomChatSettingsComposer = 901; - public final static int RemoveHabboItemComposer = 2368; - public final static int RoomUserRemoveComposer = 364; - public final static int RoomHeightMapComposer = 3491; - public final static int RoomPetHorseFigureComposer = 3140; - public final static int PetErrorComposer = 3013; - public final static int TradeUpdateComposer = 1649; - public final static int PrivateRoomsComposer = 2523; - public final static int RoomModelComposer = 1186; - public final static int RoomScoreComposer = 1781; - public final static int KnockKnockComposer = 2988; - public final static int SecureLoginOKComposer = 1992; - public final static int SessionRightsComposer = 2934; - public final static int GuildMemberUpdateComposer = 3641; - public final static int RoomFloorItemsComposer = 144; - public final static int InventoryItemsComposer = 1559; - public final static int RoomUserTalkComposer = 874; - public final static int TradeStartComposer = 833; - public final static int InventoryItemUpdateComposer = 2204; - public final static int ModToolIssueUpdateComposer = 471; - public final static int MeMenuSettingsComposer = 3437; - public final static int ModToolRoomInfoComposer = 1328; - public final static int GuildListComposer = 3082; - public final static int RecyclerLogicComposer = 1527; - public final static int UserHomeRoomComposer = 3876; - public final static int RoomUserDanceComposer = 2184; - public final static int RoomSettingsUpdatedComposer = 1069; - public final static int AlertPurchaseFailedComposer = 2663; - public final static int RoomDataComposer = 624; - public final static int TagsComposer = 456; - public final static int InventoryRefreshComposer = 2352; - public final static int RemovePetComposer = 775; - public final static int RemoveWallItemComposer = 1980; - public final static int TradeCompleteComposer = 1668; - public final static int NewsWidgetsComposer = 3958; - public final static int WiredEffectDataComposer = 2101; - public final static int BubbleAlertComposer = 1569; - public final static int ReloadRecyclerComposer = 3704; - public final static int MoodLightDataComposer = 2780; - public final static int WiredRewardAlertComposer = 1539; - public final static int CatalogPageComposer = 1384; - public final static int CatalogModeComposer = 3408; - public final static int RoomUserUpdateNameComposer = 1263; - public final static int AddFloorItemComposer = 2502; - public final static int DebugConsoleComposer = 1003; - public final static int HallOfFameComposer = 3736; - public final static int WiredSavedComposer = 598; - public final static int RoomPaintComposer = 2225; - public final static int MarketplaceConfigComposer = 739; - public final static int AddBotComposer = 1771; - public final static int FriendRequestErrorComposer = 3601; - public final static int GuildMembersComposer = 1788; - public final static int RoomOpenComposer = 2266; - public final static int ModToolRoomChatlogComposer = 1633; - public final static int DiscountComposer = 3254; - public final static int MarketplaceCancelSaleComposer = 751; - public final static int RoomPetRespectComposer = 2348; - public final static int RoomSettingsComposer = 3622; - public final static int TalentTrackComposer = 3235; - public final static int CatalogPagesListComposer = 402; - public final static int AlertLimitedSoldOutComposer = 3467; - public final static int CatalogUpdatedComposer = 2452; - public final static int PurchaseOKComposer = 2316; - public final static int WallItemUpdateComposer = 21; - public final static int TradeAcceptedComposer = 3042; - public final static int AddWallItemComposer = 706; - public final static int ModToolRoomEntryInfoComposer = 381; - public final static int HotelViewDataComposer = 3810; - public final static int PresentItemOpenedComposer = 2004; - public final static int RoomUserRemoveRightsComposer = 61; - public final static int UserBCLimitsComposer = 3408; - public final static int PetTrainingPanelComposer = 1897; - public final static int RoomPaneComposer = 381; - public final static int RedeemVoucherErrorComposer = 1809; - public final static int RoomCreatedComposer = 3168; - public final static int GenericAlertComposer = 1406; - public final static int GroupPartsComposer = 3569; - public final static int ModToolIssueInfoComposer = 3928; - public final static int RoomUserWhisperComposer = 2945; - public final static int BotErrorComposer = 1932; - public final static int FreezeLivesComposer = 3985; - public final static int LoadFriendRequestsComposer = 683; - public final static int MarketplaceSellItemComposer = 92; - public final static int ClubDataComposer = 2273; - public final static int ProfileFriendsComposer = 2231; - public final static int MarketplaceOwnItemsComposer = 311; - public final static int RoomOwnerComposer = 3608; - public final static int WiredConditionDataComposer = 3969; - public final static int ModToolUserInfoComposer = 828; - public final static int UserWardrobeComposer = 406; - public final static int RoomPetExperienceComposer = 3711; - public final static int FriendChatMessageComposer = 3957; - public final static int PetInformationComposer = 64; - public final static int RoomThicknessComposer = 2145; - public final static int AddPetComposer = 2194; - public final static int UpdateStackHeightComposer = 597; - public final static int RemoveBotComposer = 3691; - public final static int RoomEnterErrorComposer = 817; - public final static int PollQuestionsComposer = 1143; - public final static int GenericErrorMessages = 1169; - public final static int RoomWallItemsComposer = 3524; - public final static int RoomUserEffectComposer = 579; - public final static int PetBreedsComposer = 1947; - public final static int ModToolIssueChatlogComposer = 3053; - public final static int RoomUserActionComposer = 3741; - public final static int BotSettingsComposer = 3092; - public final static int UserProfileComposer = 3049; - public final static int MinimailCountComposer = 761; - public final static int UserAchievementScoreComposer = 3681; - public final static int PetLevelUpComposer = 3100; - public final static int UserPointsComposer = 1439; - public final static int ReportRoomFormComposer = 2573; - public final static int ModToolIssueHandledComposer = 1297; - public final static int FloodCounterComposer = 2106; - public final static int UpdateFailedComposer = 3006; - public final static int FloorPlanEditorDoorSettingsComposer = 1988; - public final static int FloorPlanEditorBlockedTilesComposer = 3388; - public final static int BuildersClubExpiredComposer = 25; - public final static int RoomSettingsSavedComposer = 2769; - public final static int MessengerInitComposer = 3682; - public final static int UserClothesComposer = 2651; - public final static int UserEffectsListComposer = 1348; - public final static int NewUserIdentityComposer = 1733; - public final static int NewNavigatorEventCategoriesComposer = 1391; - public final static int NewNavigatorCollapsedCategoriesComposer = 3110; - public final static int NewNavigatorLiftedRoomsComposer = 2469; - public final static int NewNavigatorSavedSearchesComposer = 3349; - public final static int RoomUnitUpdateUsernameComposer = 2063; - public final static int PostItDataComposer = 3443; - public final static int ModToolReportReceivedAlertComposer = 3453; - public final static int ModToolIssueResponseAlertComposer = 971; - public final static int AchievementListComposer = 1417; - public final static int AchievementProgressComposer = 1550; - public final static int AchievementUnlockedComposer = 1335; - public final static int ClubGiftsComposer = 197; - public final static int MachineIDComposer = 3609; - public final static int PongComposer = 1349; - - - public final static int UnknownComposer4 = 1411; - public final static int UnknownComposer5 = 568; - public final static int UnknownComposer6 = 32; - public final static int NewNavigatorMetaDataComposer = 1129; - public final static int NewNavigatorSearchResultsComposer = 3203; - public final static int MysticBoxStartOpenComposer = 3513; - public final static int MysticBoxCloseComposer = 2581; - public final static int MysticBoxPrizeComposer = 3040; - public final static int RentableSpaceInfoComposer = 194; - public final static int RentableSpaceUnknownComposer = 2051; - public final static int RentableSpaceUnknown2Composer = 1075; - public final static int GuildConfirmRemoveMemberComposer = 3940; - - public final static int LandingViewGetBadgeButtonConfig = 940; - public final static int EpicPopupFrameComposer = 916; - public final static int BaseJumpLoadGameURL = 871; - public final static int RoomUserTagsComposer = 799; - public final static int RoomInviteErrorCodeComposer = 76; - public final static int PostItStickyPoleOpenComposer = 753; - public final static int NewYearResolutionProgressComposer = 741; - public final static int ClubGiftReceivedComposer = 735; - public final static int ItemStateComposer = 664; - public final static int ItemExtraDataComposer = 654; - - - public final static int QuestionInfoComposer = 3047; - public final static int TalentTrackEmailVerifiedComposer = 866; - public final static int TalentTrackEmailFailedComposer = 369; - public final static int UnknownAvatarEditorComposer = 72; - - public final static int UnknownGuildComposer = 588; - - public final static int UnknownGuildForumComposer1 = 600; - public final static int UnknownGuildForumComposer2 = 1291; - public final static int UnknownGuildForumComposer3 = 1147; - public final static int UnknownGuildForumComposer4 = 3420; - public final static int UnknownGuildForumComposer5 = 324; - public final static int UnknownGuildForumComposer6 = 2161; - public final static int UnknownGuildForumComposer7 = 3853; - public final static int UnknownGuildForumComposer8 = 2695; - public final static int UnknownGuildForumComposer9 = 3077; - - public final static int GuideSessionAttachedComposer = 3549; - public final static int GuideSessionDetachedComposer = 2987; - public final static int GuideSessionStartedComposer = 3048; - public final static int GuideSessionEndedComposer = 3222; - public final static int GuideSessionErrorComposer = 978; - public final static int GuideSessionMessageComposer = 1860; - public final static int GuideSessionRequesterRoomComposer = 1861; - public final static int GuideSessionInvitedToGuideRoomComposer = 2959; - public final static int GuideSessionPartnerIsTypingComposer = 2955; - - public final static int GuideToolsComposer = 117; - public final static int GuardianNewReportReceivedComposer = 3123; - public final static int GuardianVotingRequestedComposer = 2331; - public final static int GuardianVotingVotesComposer = 3107; - public final static int GuardianVotingResultComposer = 91; - public final static int GuardianVotingTimeEnded = 556; - - public final static int RoomMutedComposer = 554; - - public final static int RoomUnknown1Composer = 1241; - public final static int RoomUnknown2Composer = 535; - public final static int RoomUnknown3Composer = 2342; - - public final static int UnknownEffectsComposer = 53; - - public final static int OldPublicRoomsComposer = 580; - public final static int ItemStateComposer2 = 569; - - public final static int HotelWillCloseInMinutesComposer = 518; - public final static int HotelWillCloseInMinutesAndBackInComposer = 2860; - public final static int HotelClosesAndWillOpenAtComposer = 2168; - public final static int HotelClosedAndOpensComposer = 888; - public final static int StaffAlertAndOpenHabboWayComposer = 1035; - public final static int StaffAlertWithLinkComposer = 1189; - public final static int StaffAlertWIthLinkAndOpenHabboWayComposer = 3964; - - public final static int RoomMessagesPostedCountComposer = 1520; - public final static int CantScratchPetNotOldEnoughComposer = 118; - public final static int PetBoughtNotificationComposer = 1040; - public final static int MessagesForYouComposer = 2506; - public final static int UnknownStatusComposer = 1648; - public final static int CloseWebPageComposer = 320; - public final static int PickMonthlyClubGiftNotificationComposer = 2786; - public final static int RemoveGuildFromRoomComposer = 514; - public final static int RoomBannedUsersComposer = 504; - public final static int OpenRoomCreationWindowComposer = 497; - public final static int ItemsDataUpdateComposer = 466; - public final static int WelcomeGiftComposer = 445; - public final static int SimplePollStartComposer = 3047; - public final static int RoomNoRightsComposer = 3929; - public final static int GuildEditFailComposer = 3918; - public final static int MinimailNewMessageComposer = 3903; - public final static int RoomFilterWordsComposer = 3889; - public final static int VerifyMobileNumberComposer = 3872; - public final static int NewUserGiftComposer = 3098; - public final static int UpdateUserLookComposer = 3864; - public final static int RoomUserIgnoredComposer = 3858; - public final static int PetBreedingFailedComposer = 3851; - public final static int HabboNameChangedComposer = 3849; - public final static int RoomUserNameChangedComposer = 2063; - public final static int LoveLockFurniStartComposer = 2883; - public final static int LoveLockFurniFriendConfirmedComposer = 2746; - public final static int LoveLockFurniFinishedComposer = 3825; - public final static int OpenPetPackageNameValidationComposer = 38; - public final static int GameCenterFeaturedPlayersComposer = 3788; - public final static int HabboMallComposer = 3770; - public final static int TargetedOfferComposer = 1495; - public final static int LeprechaunStarterBundleComposer = 3766; - public final static int VerifyMobilePhoneWindowComposer = 3695; - public final static int VerifyMobilePhoneCodeWindowComposer = 2160; - public final static int VerifyMobilePhoneDoneComposer = 3109; - public final static int RoomUserReceivedHandItemComposer = 3673; - public final static int MutedWhisperComposer = 3326; - public final static int UnknownHintComposer = 3484; - public final static int BullyReportClosedComposer = 3401; - public final static int PromoteOwnRoomsListComposer = 3376; - public final static int NotEnoughPointsTypeComposer = 334; - public final static int WatchAndEarnRewardComposer = 3325; - public final static int NewYearResolutionComposer = 327; - public final static int WelcomeGiftErrorComposer = 3268; - public final static int RentableItemBuyOutPriceComposer = 3264; - public final static int VipTutorialsStartComposer = 3217; - public final static int NewNavigatorCategoryUserCountComposer = 3166; - public final static int RoomThumbnailSavedComposer = 3117; - public final static int RoomEditSettingsErrorComposer = 3094; - public final static int GuildAcceptMemberErrorComposer = 305; - public final static int MostUselessErrorAlertComposer = 2944; - public final static int AchievementsConfigurationComposer = 2937; - public final static int PetBreedingResultComposer = 2907; - public final static int RoomUserQuestionAnsweredComposer = 2866; - public final static int PetBreedingStartComposer = 285; - public final static int CustomNotificationComposer = 2835; - public final static int UpdateStackHeightTileHeightComposer = 2830; - public final static int HotelViewCustomTimerComposer = 2828; - public final static int MarketplaceItemPostedComposer = 2797; - public final static int UnknownHabboQuizComposer = 2750; - public final static int GuildFavoriteRoomUserUpdateComposer = 275; - public final static int RoomAdErrorComposer = 2692; - public final static int NewNavigatorSettingsComposer = 2617; - public final static int CameraPublishWaitMessageComposer = 2612; - public final static int RoomInviteComposer = 2608; - public final static int BullyReportRequestComposer = 1917; - public final static int UnknownHelperComposer = 2544; - public final static int HelperRequestDisabledComposer = 1125; - public final static int RoomUnitIdleComposer = 2462; - public final static int QuestCompletedComposer = 2459; - public final static int UnkownPetPackegeComposer = 2417; - public final static int ForwardToRoomComposer = 2382; - public final static int EffectsListEffectEnableComposer = 2381; - public final static int CompetitionEntrySubmitResultComposer = 2308; - public final static int ExtendClubMessageComposer = 2304; - public final static int HotelViewConcurrentUsersComposer = 2286; - public final static int InventoryAddEffectComposer = 215; - public final static int TalentLevelUpdateComposer = 1956; - public final static int BullyReportedMessageComposer = 1858; - public final static int UnknownQuestComposer3 = 1851; - public final static int FriendToolbarNotificationComposer = 1839; - public final static int MessengerErrorComposer = 1838; - public final static int CameraPriceComposer = 1676; - public final static int PetBreedingCompleted = 1628; - public final static int RoomUserUnbannedComposer = 1625; - public final static int HotelViewCommunityGoalComposer = 1579; - public final static int UnknownRoomVisitsComposer = 155; - public final static int CanCreateEventComposer = 1542; - public final static int UnknownGroupComposer = 1507; - public final static int YoutubeMessageComposer1 = 1477; - public final static int YoutubeMessageComposer2 = 1475; - public final static int RoomCategoryUpdateMessageComposer = 1433; - public final static int UnknownQuestComposer2 = 1415; - public final static int GiftReceiverNotFoundComposer = 1374; - public final static int ConvertedForwardToRoomComposer = 1323; - public final static int FavoriteRoomChangedComposer = 1317; - public final static int AlertPurchaseUnavailableComposer = 1303; - public final static int PetBreedingStartFailedComposer = 1252; - public final static int DailyQuestComposer = 1244; - public final static int NewNavigatorRoomEventComposer = 1162; - public final static int HotelViewHideCommunityVoteButtonComposer = 115; - public final static int CatalogSearchResultComposer = 1142 ; - public final static int FriendFindingRoomComposer = 1037; - public final static int UnknownQuestComposer1 = 1010; - - - - public final static int JukeBoxMySongsComposer = 2224; - public final static int JukeBoxNowPlayingMessageComposer = 2197; - public final static int JukeBoxPlaylistFullComposer = 2732; - public final static int JukeBoxPlayListUpdatedComposer = 2858; - public final static int JukeBoxPlayListAddSongComposer = 1558; - public final static int JukeBoxPlayListComposer = 3011; - public final static int JukeBoxTrackDataComposer = 442; - public final static int JukeBoxTrackCodeComposer = 3588; - - -} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/TestComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/TestComposer.java deleted file mode 100644 index e9b3f110..00000000 --- a/src/main/java/com/eu/habbo/messages/outgoing/TestComposer.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.eu.habbo.messages.outgoing; - -import com.eu.habbo.messages.ServerMessage; - -public class TestComposer extends MessageComposer -{ - @Override - public ServerMessage compose() - { - - this.response.init(3662); - this.response.appendBoolean(true); - this.response.appendString("LOL"); - - return this.response; - - } -} diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java index 2f341ee8..e1f95656 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentLevelUpdateComposer.java @@ -24,10 +24,18 @@ public class TalentLevelUpdateComposer extends MessageComposer this.response.init(Outgoing.TalentLevelUpdateComposer); this.response.appendString(this.talentTrackType.name()); this.response.appendInt(this.talentTrackLevel.level); - this.response.appendInt(this.talentTrackLevel.perks.length); - for (String s : this.talentTrackLevel.perks) + + if (this.talentTrackLevel.perks != null) { - this.response.appendString(s); + this.response.appendInt(this.talentTrackLevel.perks.length); + for (String s : this.talentTrackLevel.perks) + { + this.response.appendString(s); + } + } + else + { + this.response.appendInt(0); } this.response.appendInt(this.talentTrackLevel.items.size()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java index 37362f50..6a7f3e81 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/achievements/talenttrack/TalentTrackComposer.java @@ -87,7 +87,7 @@ public class TalentTrackComposer extends MessageComposer response.appendInt(achievement.id); //TODO Move this to TalenTrackLevel class - response.appendInt(1); //idk + response.appendInt(b); //idk response.appendString("ACH_" + achievement.name + b); int progress = habbo.getHabboStats().getAchievementProgress(achievement); @@ -128,7 +128,7 @@ public class TalentTrackComposer extends MessageComposer }); - if (level.perks.length > 0) + if (level.perks != null && level.perks.length > 0) { this.response.appendInt(level.perks.length); for (String perk : level.perks) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java index 80799420..77abbbc2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftingResultComposer.java @@ -8,10 +8,18 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class CraftingResultComposer extends MessageComposer { private final CraftingRecipe recipe; + private final boolean succes; public CraftingResultComposer(CraftingRecipe recipe) { this.recipe = recipe; + this.succes = this.recipe != null; + } + + public CraftingResultComposer(CraftingRecipe recipe, boolean success) + { + this.recipe = recipe; + this.succes = success; } @Override @@ -19,7 +27,7 @@ public class CraftingResultComposer extends MessageComposer { this.response.init(Outgoing.CraftingResultComposer); - this.response.appendBoolean(this.recipe != null); //succes + this.response.appendBoolean(this.succes); //succes if(this.recipe != null) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertKeys.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertKeys.java index 9499a743..5c9da1db 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertKeys.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/BubbleAlertKeys.java @@ -26,7 +26,7 @@ public enum BubbleAlertKeys FORUMS_THREAD_RESTORED("forums.thread.restored"), FORUMS_THREAD_UNLOCKED("forums.thread.unlocked"), FORUMS_THREAD_UNPINNED("forums.thread.unpinned"), - FURNI_PLACE_EMENT_ERROR("furni_placement_error"), + FURNITURE_PLACEMENT_ERROR("furni_placement_error"), GIFTING_VALENTINE("gifting.valentine"), NUX_POPUP("nux.popup"), PURCHASING_ROOM("purchasing.room"), diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/HotelClosedAndOpensComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosedAndOpensComposer.java similarity index 92% rename from src/main/java/com/eu/habbo/messages/outgoing/unknown/HotelClosedAndOpensComposer.java rename to src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosedAndOpensComposer.java index 5ae39503..576b12b9 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/HotelClosedAndOpensComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/generic/alerts/HotelClosedAndOpensComposer.java @@ -1,4 +1,4 @@ -package com.eu.habbo.messages.outgoing.unknown; +package com.eu.habbo.messages.outgoing.generic.alerts; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/NewUserGiftComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserGiftComposer.java similarity index 94% rename from src/main/java/com/eu/habbo/messages/outgoing/unknown/NewUserGiftComposer.java rename to src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserGiftComposer.java index 5d43157c..7c59fc11 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/NewUserGiftComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserGiftComposer.java @@ -1,4 +1,4 @@ -package com.eu.habbo.messages.outgoing.unknown; +package com.eu.habbo.messages.outgoing.habboway.nux; import com.eu.habbo.habbohotel.items.NewUserGift; import com.eu.habbo.messages.ServerMessage; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/NewUserIdentityComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserIdentityComposer.java similarity index 91% rename from src/main/java/com/eu/habbo/messages/outgoing/unknown/NewUserIdentityComposer.java rename to src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserIdentityComposer.java index 9d76cce9..67f9f4df 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/NewUserIdentityComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NewUserIdentityComposer.java @@ -1,4 +1,4 @@ -package com.eu.habbo.messages.outgoing.unknown; +package com.eu.habbo.messages.outgoing.habboway.nux; import com.eu.habbo.habbohotel.users.Habbo; import com.eu.habbo.messages.ServerMessage; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/NuxAlertComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NuxAlertComposer.java similarity index 90% rename from src/main/java/com/eu/habbo/messages/outgoing/unknown/NuxAlertComposer.java rename to src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NuxAlertComposer.java index 5f14beb1..a88f8289 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/NuxAlertComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/habboway/nux/NuxAlertComposer.java @@ -1,4 +1,4 @@ -package com.eu.habbo.messages.outgoing.unknown; +package com.eu.habbo.messages.outgoing.habboway.nux; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java index 897dcf61..f75f036c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/modtool/ModToolUserInfoComposer.java @@ -23,23 +23,29 @@ public class ModToolUserInfoComposer extends MessageComposer this.response.init(Outgoing.ModToolUserInfoComposer); try { - this.response.appendInt(set.getInt("user_id")); - this.response.appendString(set.getString("username")); - this.response.appendString(set.getString("look")); - this.response.appendInt(set.getInt("account_created")); - this.response.appendInt(set.getInt("online") == 1 ? 0 : set.getInt("last_online")); - this.response.appendBoolean(set.getInt("online") == 1); - this.response.appendInt(set.getInt("cfh_send")); - this.response.appendInt(set.getInt("cfh_abusive")); - this.response.appendInt(set.getInt("cfh_warnings")); - this.response.appendInt(set.getInt("cfh_bans")); - this.response.appendInt(Emulator.getIntUnixTimestamp() - set.getInt("account_created")); - this.response.appendString(""); - this.response.appendString(""); - this.response.appendInt(0); - this.response.appendInt(0); - this.response.appendString(set.getString("mail")); - this.response.appendString(""); + this.response.appendInt(this.set.getInt("user_id")); + this.response.appendString(this.set.getString("username")); + this.response.appendString(this.set.getString("look")); + this.response.appendInt((Emulator.getIntUnixTimestamp() - this.set.getInt("account_created")) / 60); + this.response.appendInt((this.set.getInt("online") == 1 ? 0 : Emulator.getIntUnixTimestamp() - this.set.getInt("last_online")) / 60); + this.response.appendBoolean(this.set.getInt("online") == 1); + this.response.appendInt(this.set.getInt("cfh_send")); + this.response.appendInt(this.set.getInt("cfh_abusive")); + this.response.appendInt(this.set.getInt("cfh_warnings")); + this.response.appendInt(this.set.getInt("cfh_bans")); + this.response.appendInt(0); //Trading lock count + this.response.appendString(""); //Trading lock expiry timestamp + this.response.appendString(""); //Last Purchase Timestamp + this.response.appendInt(this.set.getInt("user_id")); //Personal Identification # + this.response.appendInt(0); //Number of bans + this.response.appendString(this.set.getString("mail")); + this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt + + if (false) //has sanction + { + this.response.appendString("SOME SANCTION"); + this.response.appendInt(31); + } return this.response; } catch (SQLException e) diff --git a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java index d732a097..0739d4d3 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollQuestionsComposer.java @@ -20,9 +20,9 @@ public class PollQuestionsComposer extends MessageComposer { this.response.init(Outgoing.PollQuestionsComposer); - this.response.appendInt(this.poll.getId()); - this.response.appendString(this.poll.getTitle()); - this.response.appendString(this.poll.getThanksMessage()); + this.response.appendInt(this.poll.id); + this.response.appendString(this.poll.title); + this.response.appendString(this.poll.thanksMessage); this.response.appendInt(this.poll.getQuestions().size()); for (PollQuestion question : this.poll.getQuestions()) { diff --git a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java index b6fd8d5b..aa6352d5 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/polls/PollStartComposer.java @@ -18,10 +18,10 @@ public class PollStartComposer extends MessageComposer public ServerMessage compose() { this.response.init(Outgoing.PollStartComposer); - this.response.appendInt(this.poll.getId()); - this.response.appendString(this.poll.getTitle()); - this.response.appendString(this.poll.getThanksMessage()); - this.response.appendString(this.poll.getTitle()); + this.response.appendInt(this.poll.id); + this.response.appendString(this.poll.title); + this.response.appendString(this.poll.thanksMessage); + this.response.appendString(this.poll.title); return this.response; } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java new file mode 100644 index 00000000..6472d68e --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/BotForceOpenContextMenuComposer.java @@ -0,0 +1,23 @@ +package com.eu.habbo.messages.outgoing.rooms; + +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; + +public class BotForceOpenContextMenuComposer extends MessageComposer +{ + private final int botId; + + public BotForceOpenContextMenuComposer(int botId) + { + this.botId = botId; + } + + @Override + public ServerMessage compose() + { + this.response.init(Outgoing.BotForceOpenContextMenuComposer); + this.response.appendInt(this.botId); + return this.response; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java index 234a0eb5..5e1d1dff 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomFilterWordsComposer.java @@ -19,15 +19,12 @@ public class RoomFilterWordsComposer extends MessageComposer { this.response.init(Outgoing.RoomFilterWordsComposer); - synchronized (this.room.getWordFilterWords()) - { - this.response.appendInt(this.room.getWordFilterWords().size()); + this.response.appendInt(this.room.getWordFilterWords().size()); - for (String string : this.room.getWordFilterWords()) - { - this.response.appendString(string); - } - } + for (String string : this.room.getWordFilterWords()) + { + this.response.appendString(string); + } return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java new file mode 100644 index 00000000..a5c14a5c --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/RoomQueueStatusMessage.java @@ -0,0 +1,24 @@ +package com.eu.habbo.messages.outgoing.rooms; + +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; + +public class RoomQueueStatusMessage extends MessageComposer +{ + @Override + public ServerMessage compose() + { + this.response.init(Outgoing.RoomQueueStatusMessage); + this.response.appendInt(1); //Count + { + this.response.appendString("TEST"); //Name + this.response.appendInt(94); //Target + + this.response.appendInt(1); //Count + this.response.appendString("d"); + this.response.appendInt(1); + } + return this.response; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java index 3dacb7d1..6f59f401 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/AddFloorItemComposer.java @@ -15,7 +15,7 @@ public class AddFloorItemComposer extends MessageComposer public AddFloorItemComposer(HabboItem item, String itemOwnerName) { this.item = item; - this.itemOwnerName = itemOwnerName; + this.itemOwnerName = itemOwnerName == null ? "" : itemOwnerName; } @Override diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java index f655d7f8..1c3a624d 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java @@ -1,7 +1,6 @@ package com.eu.habbo.messages.outgoing.rooms.items; 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.users.HabboItem; import com.eu.habbo.messages.ServerMessage; @@ -49,13 +48,15 @@ public class FloorItemOnRollerComposer extends MessageComposer this.item.setY(this.newLocation.y); this.item.setZ(this.item.getZ() + this.heightOffset); this.item.needsUpdate(true); + + //TODO This is bad + // THashSet tiles = this.room.getLayout().getTilesAt(this.room.getLayout().getTile(oldX, oldY), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation()); tiles.addAll(this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())); this.room.updateTiles(tiles); - this.room.sendComposer(new UpdateStackHeightComposer(oldX, oldY, this.room.getStackHeight(oldX, oldY, true)).compose()); - - this.room.updateHabbosAt(RoomLayout.getRectangle(this.item.getX(), this.item.getY(), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())); + // + //this.room.updateHabbosAt(RoomLayout.getRectangle(this.item.getX(), this.item.getY(), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation())); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/PetLevelUpdatedComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpdatedComposer.java similarity index 74% rename from src/main/java/com/eu/habbo/messages/outgoing/unknown/PetLevelUpdatedComposer.java rename to src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpdatedComposer.java index cfb9301b..ee5f9181 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/PetLevelUpdatedComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/PetLevelUpdatedComposer.java @@ -1,4 +1,4 @@ -package com.eu.habbo.messages.outgoing.unknown; +package com.eu.habbo.messages.outgoing.rooms.pets; import com.eu.habbo.habbohotel.pets.Pet; import com.eu.habbo.messages.ServerMessage; @@ -8,12 +8,10 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class PetLevelUpdatedComposer extends MessageComposer { private final Pet pet; - private final int level; - public PetLevelUpdatedComposer(Pet pet, int level) + public PetLevelUpdatedComposer(Pet pet) { this.pet = pet; - this.level = level; } @Override @@ -22,7 +20,7 @@ public class PetLevelUpdatedComposer extends MessageComposer this.response.init(Outgoing.PetLevelUpdatedComposer); this.response.appendInt(this.pet.getRoomUnit().getId()); this.response.appendInt(this.pet.getId()); - this.response.appendInt(this.level); + this.response.appendInt(this.pet.getLevel()); return this.response; } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java index b6e5a671..551eaa57 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingCompleted.java @@ -6,21 +6,21 @@ import com.eu.habbo.messages.outgoing.Outgoing; public class PetBreedingCompleted extends MessageComposer { - public final int anInt1; - public final int anInt2; + public final int type; + public final int race; - public PetBreedingCompleted(int anInt1, int anInt2) + public PetBreedingCompleted(int type, int race) { - this.anInt1 = anInt1; - this.anInt2 = anInt2; + this.type = type; + this.race = race; } @Override public ServerMessage compose() { this.response.init(Outgoing.PetBreedingCompleted); - this.response.appendInt(this.anInt1); - this.response.appendInt(this.anInt2); + this.response.appendInt(this.type); + this.response.appendInt(this.race); return this.response; } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java index e576f9d0..d18d9b71 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/pets/breeding/PetBreedingResultComposer.java @@ -1,20 +1,29 @@ package com.eu.habbo.messages.outgoing.rooms.pets.breeding; +import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.pets.Pet; +import com.eu.habbo.habbohotel.pets.PetBreedingReward; +import com.eu.habbo.habbohotel.pets.PetManager; import com.eu.habbo.messages.ISerialize; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; +import gnu.trove.map.hash.TIntObjectHashMap; +import org.apache.commons.math3.distribution.NormalDistribution; + +import java.util.ArrayList; public class PetBreedingResultComposer extends MessageComposer { - public final int anInt1; + public final int boxId; + public final int petType; public final PetBreedingPet petOne; public final PetBreedingPet petTwo; - public PetBreedingResultComposer(int anInt1, Pet petOne, String ownerPetOne, Pet petTwo, String ownerPetTwo) + public PetBreedingResultComposer(int boxId, int petType, Pet petOne, String ownerPetOne, Pet petTwo, String ownerPetTwo) { - this.anInt1 = anInt1; + this.boxId = boxId; + this.petType = petType; this.petOne = new PetBreedingPet(petOne, ownerPetOne); this.petTwo = new PetBreedingPet(petTwo, ownerPetTwo); } @@ -23,35 +32,75 @@ public class PetBreedingResultComposer extends MessageComposer public ServerMessage compose() { this.response.init(Outgoing.PetBreedingResultComposer); - this.response.appendInt(this.anInt1); + this.response.appendInt(this.boxId); this.petOne.serialize(this.response); this.petTwo.serialize(this.response); - this.response.appendInt(5); //Levels + double avgLevel = (this.petOne.pet.getLevel() + this.petTwo.pet.getLevel()) / 2; + NormalDistribution normalDistribution = PetManager.getNormalDistributionForBreeding(avgLevel); + + + + + + TIntObjectHashMap> rewardBreeds = Emulator.getGameEnvironment().getPetManager().getBreedingRewards(this.petType); + + this.response.appendInt(4); //Levels { - this.response.appendInt(1); //Percentage - this.response.appendInt(1); //Count + int percentage1 = (int)(normalDistribution.cumulativeProbability(10) * 100); + int percentage2 = (int)(normalDistribution.cumulativeProbability(15) * 100) - percentage1; + int percentage3 = (int)(normalDistribution.cumulativeProbability(18) * 100) - percentage1 - percentage2; + int percentage4 = (int)(normalDistribution.cumulativeProbability(20) * 100) - percentage1 - percentage2 - percentage3; + + int dPercentage = 100 - (percentage1 + percentage2 + percentage3 + percentage4); + if (dPercentage > 0) { - this.response.appendInt(1); //Breed + percentage1 += dPercentage; } - this.response.appendInt(1); //Percentage - this.response.appendInt(1); //Count + else { - this.response.appendInt(1); //Breed + percentage4 -= dPercentage; } - this.response.appendInt(1); //Percentage - this.response.appendInt(1); //Count + + this.response.appendInt(percentage4); //Percentage + this.response.appendInt(rewardBreeds.get(4).size()); //Count { - this.response.appendInt(1); //Breed + for (PetBreedingReward reward : rewardBreeds.get(4)) + { + this.response.appendInt(reward.breed); + } } - this.response.appendInt(1); //Percentage - this.response.appendInt(1); //Count + + this.response.appendInt(percentage3); //Percentage + this.response.appendInt(rewardBreeds.get(3).size()); //Count { - this.response.appendInt(1); //Breed + for (PetBreedingReward reward : rewardBreeds.get(3)) + { + this.response.appendInt(reward.breed); + } } + + this.response.appendInt(percentage2); //Percentage + this.response.appendInt(rewardBreeds.get(2).size()); //Count + { + for (PetBreedingReward reward : rewardBreeds.get(2)) + { + this.response.appendInt(reward.breed); + } + } + + this.response.appendInt(percentage1); //Percentage + this.response.appendInt(rewardBreeds.get(1).size()); //Count + { + for (PetBreedingReward reward : rewardBreeds.get(1)) + { + this.response.appendInt(reward.breed); + } + } + } - this.response.appendInt(0); //Race type + this.response.appendInt(this.petType); //Race type return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java index 0f972999..9132410a 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/users/RoomUnitOnRollerComposer.java @@ -1,6 +1,5 @@ package com.eu.habbo.messages.outgoing.rooms.users; -import com.eu.habbo.Emulator; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomUnit; @@ -50,24 +49,11 @@ public class RoomUnitOnRollerComposer extends MessageComposer this.response.appendString(this.roomUnit.getZ() + ""); this.response.appendString(this.newLocation.getStackHeight() + ""); - this.roomUnit.setLocation(room.getLayout().getTile(this.newLocation.x, this.newLocation.y)); + this.roomUnit.setLocation(this.newLocation); + this.roomUnit.setPreviousLocationZ(this.newLocation.getStackHeight()); + this.roomUnit.setZ(this.newLocation.getStackHeight()); - try - { - if(roller != null) - { - this.roller.onWalkOff(this.roomUnit, this.room, new Object[]{this.roller}); - HabboItem item = this.room.getTopItemAt(this.newLocation.x, this.newLocation.y); - - if(item != null) - item.onWalkOn(this.roomUnit, this.room, new Object[]{this.roller}); - } - } - catch (Exception e) - { - Emulator.getLogging().logErrorLine(e); - } this.roomUnit.sitUpdate = true; return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/trading.zip b/src/main/java/com/eu/habbo/messages/outgoing/trading.zip deleted file mode 100644 index bbdc1e57a3f44d42dc22218587ef6523f9dfc9f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3385 zcmai$c{G%7AI3)-G$d&($y#R0K9aR8!z5-ZlYNb8#=h^eWsk@*QY2gU?I(l~VhB;T zhzthv3n5t|jJ(r%{}6f4`#gW#=YIb9Jm*~3eP7oXjiNmY1^@sIfX87u>hOH;21ObG zK$#W*I7|KN;fBH4I$2BTQddhj7HjF^VTn_7c64!ew{#P?!+2rR5=QO9U@Q?!zzK}F z-mt@%nN1(TkVnEyw*=iddyI3!%&^` z+z6@>YCM|pG;-)s$TFVuDq}sgamKGCLG`pjUr!Ru@Dv1*-I<-1QOaO`sR(!b5+)s; zhE{wQ*96p(KECXS$=(H|c-+SfC|mJdZKOZBz@{AvWMDQZmb>jJKE=~IIzI-P`}V2v z{Ah`lJXv~>Yb$^3UwNbmmk7XLs)O;kvhZqycPfFoaJW;O)FD^eT+YxfTNyDc<-*P; z8cC@1AbApWuP4s&I&q^pzDuq+ov1$cfNhqPHtsRxMX?CZMx&agS>L7{Q_t>PIMssF zyq^0~CXeVK8*HK^)JODoJl%`W{0+KQ@jfsEy-$3(<%do< zs`xHc@%aymujW9Ne82Qbcr*J@7-#qra92&-(P-c^vkWwpZ9embe!;r2cEG2I5d_|l z4!aw$oE`YclMk+OY38o`O@ArYrUb>zWIjpqPZh7rv2pylzb;7j45sT;wsVi0E{~C+IDJiS-SLf`na6hHvI%@#970>^ncc-KJ+CWr5 z^uh>Xfth0)JJ7LWhQxyN5lHY?8&cjDk?gM&;tdo{m~DAt>pu(f{RqrCi_|K6lmNb! z*DLc~CgHMq{WuEj^o8++;`69gsY<2>J(kiPnD2Vcd^mLB;>}J5-+m*7uco7h&<|CP zEFp|f&i6hph~0ta4i44N5kf(w1a>u^g4QJcGYcs;)n`ma>XbmuGb0}o%SP3DkNSS| zHPfN2wPbp>MF3JZ6#09-n zwI~Ui3^it8FB_c#8`by`RZU7Cj1iQ=Xufcv~G0w z9A0l0%k!*EPY^qhjuHsBuUA>7nU3^;e~xqfMgQ|!U<-#p*6F#4*94DOo5t2D;CMLP z=BzOT?`;F)vh<8Ky0tE^>_M10s_%#8v~U3zfyr5ji~WZ0#@O96N>-tsC|P7*oR;3ZI7qtzK#$ zq1u#AF^;!dnIw2t`o;pk5EiyRG2{QTx4isVC}h52X2aJY%}fp5#%%j0QKT!9Co1P! zvz*PT02}nk;GB3#`CIP*+)ntiDn*@gC9aK+R7?p`ZVh9fy0;pOlG^-il_DMA9NZ~1 z$U;kWUh#LY>Dq{2;`2Ts_pN4VO>JZgR5TRz#{PlK4iSHw2hboAZcIv*vRA^Z7v*Cg zbT;PQH3d8O$9=ihZ>NZ5|6=I75^}x2oj**;$IR?GDK2nGr-d<1lb*Roxb5|?m(Vnc zKLnyCZ9L}aOKqw+nbgb9ckn3bcwpQ-_NkMkZEoKJW4R}>c9~qx7E}BUQ^`cv*nMB1 zdy%$v-GSi1iZ5o0mO1mP;4qX+PgGI)K9m>t`KlJa;{ zFj%^4@o5B{^E*=Wq1szlaY#$7osfvy!~(@hGyd0;?-&(xfz8)LnH!nrsf*?o=7?x> zjp)Ya)>VB+my*DXT;VjQ6T;~t;!g>65acx94%Cy=1uHk#66#hpISYI%r%!i!b#uCj zIzGHU-I@M|Bc$WFJW7PAu{4MWx!O?0-zbIHc>4JcR~+icEQdbP#rUr53v$Gk`^qI3 zmmsyuD`gJ#(mfcG!Ykk>#0DOr@5@nP!ZXkcu0KtxalBB@*~&vp0>_Ujn!- zZh+g!t_Y!;)mMQL07aMgIA z@}3>Pi%-i(s5FskNBvO%;M}2hsAFs$_F0mvV@94Qt)t&^6_ku!$90g)0xx}6@IhC_~%?}cN zETTROLdL3kn$+dlmtYy(N~NqW;u%wZ*Rz0M3|5J2mP^IAis!frf_d9D zrdVL0I?sU;S?BjMFq0GBJjtzR>e$=5jvrHb0apc>Cq-DZy2>MPiAI2*W_P$i=ofkR zd`Lu^u9}A6;1A@5&j3}3kK0ag<#)w;<@8u~oloY&vD1xATcnf8LrcWk?PpSBlW57O z5T=QBb=qCkIRAxZOsdsa&ll8Zty=}*0Lb=U2d z4XUrJQy7~1$VXBfM>a&nfS8U!`a9M^>1FxGmy#-PfeTAd>x|fOZHqtQKd}f~@$wIK z7scMxGHOQ-t^)Twg;PDEYHz*)EprZxcRcU-98pRZda(&4kK0Ez)4{buszxY}aVuwkR=L`DSUmo2;Tnh+{L*2bGwUG@ra>6J!5S%t%AFHVY1xFy_^I zdZ{a%_;K{=0|6^*#_e-)&=j_NS*)O3f8bN+PzL22o$*Lkw-fz8u)`@&c;8t^)_TyT z4x^V|0he-wy9ZL=#w6<~f8>L?J5Bmbu8M_s_x7)>(_a9x2ot^*y diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuildComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/GuildMembershipRequestedComposer.java similarity index 71% rename from src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuildComposer.java rename to src/main/java/com/eu/habbo/messages/outgoing/unknown/GuildMembershipRequestedComposer.java index 44e81d79..c18f107c 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownGuildComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/GuildMembershipRequestedComposer.java @@ -4,13 +4,12 @@ import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; -public class UnknownGuildComposer extends MessageComposer +public class GuildMembershipRequestedComposer extends MessageComposer { private final int guildId; private final int requester; - //Related to membership requess? - public UnknownGuildComposer(int guildId, int requester) + public GuildMembershipRequestedComposer(int guildId, int requester) { this.guildId = guildId; this.requester = requester; @@ -19,7 +18,7 @@ public class UnknownGuildComposer extends MessageComposer @Override public ServerMessage compose() { - this.response.init(Outgoing.UnknownGuildComposer); + this.response.init(Outgoing.GuildMembershipRequestedComposer); this.response.appendInt(this.guildId); this.response.appendInt(this.requester); return this.response; diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/HotelViewNextLTDAvailableComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/HotelViewNextLTDAvailableComposer.java deleted file mode 100644 index 2e13e386..00000000 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/HotelViewNextLTDAvailableComposer.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.eu.habbo.messages.outgoing.unknown; - -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.Outgoing; - -public class HotelViewNextLTDAvailableComposer extends MessageComposer -{ - private final int unknownInt1; - private final int pageId; - private final int unknownInt2; - private final String unknownString1; - - public HotelViewNextLTDAvailableComposer(int unknownInt1, int pageId, int unknownInt2, String unknownString1) - { - this.unknownInt1 = unknownInt1; - this.pageId = pageId; - this.unknownInt2 = unknownInt2; - this.unknownString1 = unknownString1; - } - - @Override - public ServerMessage compose() - { - this.response.init(Outgoing.HotelViewNextLTDAvailableComposer); - this.response.appendInt(this.unknownInt1); - this.response.appendInt(this.pageId); - this.response.appendInt(this.unknownInt2); - this.response.appendString(this.unknownString1); - return this.response; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer6.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java similarity index 73% rename from src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer6.java rename to src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java index 0010491e..b3edba09 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer6.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/IgnoredUsersComposer.java @@ -4,12 +4,12 @@ import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.Outgoing; -public class UnknownComposer6 extends MessageComposer +public class IgnoredUsersComposer extends MessageComposer { @Override public ServerMessage compose() { - this.response.init(Outgoing.UnknownComposer6); + this.response.init(Outgoing.IgnoredUsersComposer); this.response.appendInt(0); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestComposer.java new file mode 100644 index 00000000..3c3d5d07 --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestComposer.java @@ -0,0 +1,23 @@ +package com.eu.habbo.messages.outgoing.unknown; + +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; + +public class QuestComposer extends MessageComposer +{ + private final QuestsComposer.Quest quest; + + public QuestComposer(QuestsComposer.Quest quest) + { + this.quest = quest; + } + + @Override + public ServerMessage compose() + { + this.response.init(Outgoing.QuestComposer); + this.response.append(quest); + return this.response; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestsComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestsComposer.java new file mode 100644 index 00000000..cff97ffe --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/QuestsComposer.java @@ -0,0 +1,94 @@ +package com.eu.habbo.messages.outgoing.unknown; + +import com.eu.habbo.messages.ISerialize; +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; + +import java.util.List; + +public class QuestsComposer extends MessageComposer +{ + private final List quests; + private final boolean unknownBoolean; + + public QuestsComposer(List quests, boolean unknownBoolean) + { + this.quests = quests; + this.unknownBoolean = unknownBoolean; + } + + @Override + public ServerMessage compose() + { + this.response.init(Outgoing.QuestsComposer); + this.response.appendInt(this.quests.size()); + for (Quest quest : this.quests) + { + this.response.append(quest); + } + this.response.appendBoolean(this.unknownBoolean); + return this.response; + } + + public static class Quest implements ISerialize + { + private final String campaignCode; + private final int completedQuestsInCampaign; + private final int questCountInCampaign; + private final int activityPointType; + private final int id; + private final boolean accepted; + private final String type; + private final String imageVersion; + private final int rewardCurrencyAmount; + private final String localizationCode; + private final int completedSteps; + private final int totalSteps; + private final int sortOrder; + private final String catalogPageName; + private final String chainCode; + private final boolean easy; + + public Quest(String campaignCode, int completedQuestsInCampaign, int questCountInCampaign, int activityPointType, int id, boolean accepted, String type, String imageVersion, int rewardCurrencyAmount, String localizationCode, int completedSteps, int totalSteps, int sortOrder, String catalogPageName, String chainCode, boolean easy) + { + this.campaignCode = campaignCode; + this.completedQuestsInCampaign = completedQuestsInCampaign; + this.questCountInCampaign = questCountInCampaign; + this.activityPointType = activityPointType; + this.id = id; + this.accepted = accepted; + this.type = type; + this.imageVersion = imageVersion; + this.rewardCurrencyAmount = rewardCurrencyAmount; + this.localizationCode = localizationCode; + this.completedSteps = completedSteps; + this.totalSteps = totalSteps; + this.sortOrder = sortOrder; + this.catalogPageName = catalogPageName; + this.chainCode = chainCode; + this.easy = easy; + } + + @Override + public void serialize(ServerMessage message) + { + message.appendString(this.campaignCode); + message.appendInt(this.completedQuestsInCampaign); + message.appendInt(this.questCountInCampaign); + message.appendInt(this.activityPointType); + message.appendInt(this.id); + message.appendBoolean(this.accepted); + message.appendString(this.type); + message.appendString(this.imageVersion); + message.appendInt(this.rewardCurrencyAmount); + message.appendString(this.localizationCode); + message.appendInt(this.completedSteps); + message.appendInt(this.totalSteps); + message.appendInt(this.sortOrder); + message.appendString(this.catalogPageName); + message.appendString(this.chainCode); + message.appendBoolean(this.easy); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown2Composer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown2Composer.java deleted file mode 100644 index 9817fce2..00000000 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/RoomUnknown2Composer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.eu.habbo.messages.outgoing.unknown; - -import com.eu.habbo.messages.ServerMessage; -import com.eu.habbo.messages.outgoing.MessageComposer; -import com.eu.habbo.messages.outgoing.Outgoing; - -public class RoomUnknown2Composer extends MessageComposer -{ - @Override - public ServerMessage compose() - { - this.response.init(Outgoing.RoomUnknown2Composer); - this.response.appendInt(0); //Count - { - this.response.appendString(""); //Name - this.response.appendInt(0); //Target - - this.response.appendInt(0); //Count - {//Part of previous object (string, int) - this.response.appendString(""); - this.response.appendInt(0); - } - } - return this.response; - } -} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java index 0052a297..bee208a2 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownComposer4.java @@ -9,7 +9,7 @@ public class UnknownComposer4 extends MessageComposer @Override public ServerMessage compose() { - this.response.init(Outgoing.UnknownComposer4); + this.response.init(Outgoing.IsFirstLoginOfDayComposer); this.response.appendBoolean(false); //Think something related to promo. Not sure though. return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownWiredComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownWiredComposer.java index d00f2998..eaf91dee 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownWiredComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UnknownWiredComposer.java @@ -17,7 +17,7 @@ public class UnknownWiredComposer extends MessageComposer @Override public ServerMessage compose() { - this.response.init(Outgoing.UnknownWiredComposer); + this.response.init(Outgoing.WiredOpenComposer); this.response.appendInt(this.item.getId()); return this.response; } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java new file mode 100644 index 00000000..e5b8d98c --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/outgoing/unknown/UserClassificationComposer.java @@ -0,0 +1,32 @@ +package com.eu.habbo.messages.outgoing.unknown; + +import com.eu.habbo.messages.ServerMessage; +import com.eu.habbo.messages.outgoing.MessageComposer; +import com.eu.habbo.messages.outgoing.Outgoing; +import org.apache.commons.math3.util.Pair; + +import java.util.List; + +public class UserClassificationComposer extends MessageComposer +{ + private final List>> info; + + public UserClassificationComposer(List>> info) + { + this.info = info; + } + + @Override + public ServerMessage compose() + { + this.response.init(Outgoing.UserClassificationComposer); + this.response.appendInt(this.info.size()); + for (Pair> set : info) + { + this.response.appendInt(set.getKey()); + this.response.appendString(set.getValue().getKey()); + this.response.appendString(set.getValue().getValue()); + } + return this.response; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/rcon/DisconnectUser.java b/src/main/java/com/eu/habbo/messages/rcon/DisconnectUser.java index 3b368ea5..ae62ea2f 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/DisconnectUser.java +++ b/src/main/java/com/eu/habbo/messages/rcon/DisconnectUser.java @@ -38,7 +38,7 @@ public class DisconnectUser extends RCONMessage +{ + public ImageAlertUser() + { + super(ImageAlertUser.JSON.class); + } + + @Override + public void handle(Gson gson, JSON json) + { + Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(json.user_id); + + if (habbo == null) + { + this.status = HABBO_NOT_FOUND; + return; + } + + THashMap keys = new THashMap<>(); + + if (!json.message.isEmpty()) + { + keys.put("message", json.message); + } + + if (!json.url.isEmpty()) + { + keys.put("linkUrl", json.url); + } + + if (!json.url_message.isEmpty()) + { + keys.put("linkTitle", json.url_message); + } + + if (!json.title.isEmpty()) + { + keys.put("title", json.title); + } + + if (!json.display_type.isEmpty()) + { + keys.put("display", json.display_type); + } + + if (!json.image.isEmpty()) + { + keys.put("image", json.image); + } + + habbo.getClient().sendResponse(new BubbleAlertComposer(json.bubble_key, keys)); + } + + public static class JSON + { + + public int user_id; + + + public String bubble_key = ""; + + + public String message = ""; + + + public String url = ""; + + + public String url_message = ""; + + + public String title = ""; + + + public String display_type = ""; + + + public String image = ""; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java b/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java index 4fbb8cc1..094fb4a8 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java +++ b/src/main/java/com/eu/habbo/messages/rcon/ImageHotelAlert.java @@ -20,10 +20,37 @@ public class ImageHotelAlert extends RCONMessage public void handle(Gson gson, JSON json) { THashMap keys = new THashMap<>(); - keys.put("message", json.message); - keys.put("linkUrl", json.url); - keys.put("linkTitle", json.url_message); - keys.put("title", json.title); + + if (!json.message.isEmpty()) + { + keys.put("message", json.message); + } + + if (!json.url.isEmpty()) + { + keys.put("linkUrl", json.url); + } + + if (!json.url_message.isEmpty()) + { + keys.put("linkTitle", json.url_message); + } + + if (!json.title.isEmpty()) + { + keys.put("title", json.title); + } + + if (!json.display_type.isEmpty()) + { + keys.put("display", json.display_type); + } + + if (!json.image.isEmpty()) + { + keys.put("image", json.image); + } + ServerMessage message = new BubbleAlertComposer(json.bubble_key, keys).compose(); for(Map.Entry set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { @@ -38,18 +65,24 @@ public class ImageHotelAlert extends RCONMessage public static class JSON { - public String bubble_key; + public String bubble_key = ""; - public String message; + public String message = ""; - public String url; + public String url = ""; - public String url_message; + public String url_message = ""; - public String title; + public String title = ""; + + + public String display_type = ""; + + + public String image = ""; } } \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java b/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java index a5484170..6011930a 100644 --- a/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java +++ b/src/main/java/com/eu/habbo/messages/rcon/MuteUser.java @@ -10,9 +10,9 @@ import java.sql.SQLException; public class MuteUser extends RCONMessage { - public MuteUser(Class type) + public MuteUser() { - super(type); + super(MuteUser.JSON.class); } @Override diff --git a/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java b/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java new file mode 100644 index 00000000..6fad0242 --- /dev/null +++ b/src/main/java/com/eu/habbo/messages/rcon/SetMotto.java @@ -0,0 +1,55 @@ +package com.eu.habbo.messages.rcon; + +import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.users.Habbo; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; +import com.google.gson.Gson; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class SetMotto extends RCONMessage +{ + public SetMotto() + { + super(SetMottoJSON.class); + } + + @Override + public void handle(Gson gson, SetMottoJSON json) + { + Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(json.user_id); + + if (habbo != null) + { + habbo.getHabboInfo().setMotto(json.motto); + habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(habbo).compose()); + } + else + { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection()) + { + try (PreparedStatement statement = connection.prepareStatement("UPDATE users SET motto = ? WHERE id = ? LIMIT 1")) + { + statement.setString(1, json.motto); + statement.setInt(2, json.user_id); + statement.execute(); + } + } + catch (SQLException e) + { + Emulator.getLogging().logErrorLine(e); + } + } + } + + public class SetMottoJSON + { + + public int user_id; + + + public String motto; + } +} \ No newline at end of file diff --git a/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java b/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java index cafaaf54..ee055ad1 100644 --- a/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java +++ b/src/main/java/com/eu/habbo/networking/gameserver/GameByteDecoder.java @@ -41,7 +41,6 @@ public class GameByteDecoder extends ByteToMessageDecoder " \n" + " " + (char) 0, CharsetUtil.UTF_8)); - f.channel().close(); ctx.channel().close(); return; } diff --git a/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java b/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java index 93ecafe7..a63469f0 100644 --- a/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java +++ b/src/main/java/com/eu/habbo/networking/rconserver/RCONServer.java @@ -50,6 +50,7 @@ public class RCONServer extends Server this.addRCONMessage("updateuser", UpdateUser.class); this.addRCONMessage("friendrequest", FriendRequest.class); this.addRCONMessage("imagehotelalert", ImageHotelAlert.class); + this.addRCONMessage("imagealertuser", ImageAlertUser.class); this.addRCONMessage("stalkuser", StalkUser.class); this.addRCONMessage("staffalert", StaffAlert.class); this.addRCONMessage("modticket", CreateModToolTicket.class); @@ -58,6 +59,7 @@ public class RCONServer extends Server this.addRCONMessage("muteuser", MuteUser.class); this.addRCONMessage("giverespect", GiveRespect.class); this.addRCONMessage("ignoreuser", IgnoreUser.class); + this.addRCONMessage("setmotto", SetMotto.class); for (String ip : Emulator.getConfig().getValue("rcon.allowed", "127.0.0.1").split(";")) { diff --git a/src/main/java/com/eu/habbo/plugin/PluginManager.java b/src/main/java/com/eu/habbo/plugin/PluginManager.java index 6cb16aa0..52f48f85 100644 --- a/src/main/java/com/eu/habbo/plugin/PluginManager.java +++ b/src/main/java/com/eu/habbo/plugin/PluginManager.java @@ -377,7 +377,7 @@ public class PluginManager HotelViewRequestLTDAvailabilityEvent.TIMESTAMP = Emulator.getConfig().getInt("hotel.view.ltdcountdown.timestamp"); HotelViewRequestLTDAvailabilityEvent.ITEM_ID = Emulator.getConfig().getInt("hotel.view.ltdcountdown.itemid"); HotelViewRequestLTDAvailabilityEvent.PAGE_ID = Emulator.getConfig().getInt("hotel.view.ltdcountdown.pageid"); - HotelViewRequestLTDAvailabilityEvent.ITEM_NAME = Emulator.getConfig().getValue("hotel.view.ltdcountdown.itename"); + HotelViewRequestLTDAvailabilityEvent.ITEM_NAME = Emulator.getConfig().getValue("hotel.view.ltdcountdown.itemname"); InteractionPostIt.STICKYPOLE_PREFIX_TEXT = Emulator.getConfig().getValue("hotel.room.stickypole.prefix"); TargetOffer.ACTIVE_TARGET_OFFER_ID = Emulator.getConfig().getInt("hotel.targetoffer.id"); WordFilter.DEFAULT_REPLACEMENT = Emulator.getConfig().getValue("hotel.wordfilter.replacement"); diff --git a/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java b/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java index aa6a13f5..241049a6 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java +++ b/src/main/java/com/eu/habbo/threading/runnables/CrackableExplode.java @@ -1,6 +1,7 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.Emulator; +import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionCrackable; import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.users.Habbo; @@ -16,13 +17,18 @@ public class CrackableExplode implements Runnable private final InteractionCrackable habboItem; private final Habbo habbo; private final boolean toInventory; + private short x; + private short y; - public CrackableExplode(Room room, InteractionCrackable item, Habbo habbo, boolean toInventory) + public CrackableExplode(Room room, InteractionCrackable item, Habbo habbo, boolean toInventory, short x, short y) { this.room = room; this.habboItem = item; this.habbo = habbo; this.toInventory = toInventory; + + this.x = x; + this.y = y; } @Override @@ -32,7 +38,7 @@ public class CrackableExplode implements Runnable { return; } - +//MAKING DINNER BRB if (!this.habboItem.resetable()) { this.room.removeHabboItem(this.habboItem); @@ -44,26 +50,33 @@ public class CrackableExplode implements Runnable { this.habboItem.reset(this.room); } - HabboItem newItem = Emulator.getGameEnvironment().getItemManager().createItem(this.habboItem.allowAnyone() ? habbo.getHabboInfo().getId() : this.habboItem.getUserId(), Emulator.getGameEnvironment().getItemManager().getCrackableReward(this.habboItem.getBaseItem().getId()), 0, 0, ""); + Item rewardItem = Emulator.getGameEnvironment().getItemManager().getCrackableReward(this.habboItem.getBaseItem().getId()); - if (newItem != null) + if (rewardItem != null) { - if (this.toInventory) + HabboItem newItem = Emulator.getGameEnvironment().getItemManager().createItem(this.habboItem.allowAnyone() ? habbo.getHabboInfo().getId() : this.habboItem.getUserId(), rewardItem, 0, 0, ""); + + if (newItem != null) { - habbo.getInventory().getItemsComponent().addItem(newItem); - habbo.getClient().sendResponse(new AddHabboItemComposer(newItem)); - habbo.getClient().sendResponse(new InventoryRefreshComposer()); - } - else - { - newItem.setX(this.habboItem.getX()); - newItem.setY(this.habboItem.getY()); - newItem.setZ(this.habboItem.getZ()); - newItem.setRoomId(this.room.getId()); - newItem.needsUpdate(true); - this.room.addHabboItem(newItem); - this.room.sendComposer(new AddFloorItemComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getUserId())).compose()); + if (this.toInventory) + { + habbo.getInventory().getItemsComponent().addItem(newItem); + habbo.getClient().sendResponse(new AddHabboItemComposer(newItem)); + habbo.getClient().sendResponse(new InventoryRefreshComposer()); + } else + { + newItem.setX(this.x); + newItem.setY(this.y); + newItem.setZ(room.getStackHeight(this.x, this.y, false)); + newItem.setRoomId(this.room.getId()); + newItem.needsUpdate(true); + this.room.addHabboItem(newItem); + this.room.sendComposer(new AddFloorItemComposer(newItem, this.room.getFurniOwnerNames().get(newItem.getUserId())).compose()); + } } } + + + this.room.updateTile(room.getLayout().getTile(this.x, this.y)); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java b/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java index 628210f4..da912d5d 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RemoveFloorItemTask.java @@ -1,6 +1,7 @@ package com.eu.habbo.threading.runnables; import com.eu.habbo.habbohotel.rooms.Room; +import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.rooms.UpdateStackHeightComposer; import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer; @@ -19,8 +20,10 @@ class RemoveFloorItemTask implements Runnable @Override public void run() { + RoomTile tile = this.room.getLayout().getTile(this.item.getX(), this.item.getY()); this.room.removeHabboItem(this.item); + this.room.updateTile(tile); this.room.sendComposer(new RemoveFloorItemComposer(this.item, true).compose()); - this.room.sendComposer(new UpdateStackHeightComposer(this.item.getX(), this.item.getY(), this.room.getStackHeight(this.item.getX(), this.item.getY(), false)).compose()); + this.room.sendComposer(new UpdateStackHeightComposer(this.item.getX(), this.item.getY(), tile.relativeHeight()).compose()); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java index 8e69dcf4..cba65990 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitTeleport.java @@ -8,6 +8,8 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitOnRollerComposer; +import java.util.LinkedList; + public class RoomUnitTeleport implements Runnable { private RoomUnit roomUnit; @@ -45,10 +47,21 @@ public class RoomUnitTeleport implements Runnable Emulator.getLogging().logErrorLine(e); } } + this.roomUnit.setPath(new LinkedList<>()); this.roomUnit.setCurrentLocation(t); + this.roomUnit.setPreviousLocation(t); + this.roomUnit.setZ(this.z); + this.roomUnit.setPreviousLocationZ(this.z); this.roomUnit.removeStatus(RoomUnitStatus.MOVE); this.room.sendComposer(new RoomUnitOnRollerComposer(this.roomUnit, null, t, this.room).compose()); - this.room.giveEffect(this.roomUnit, this.newEffect); + Emulator.getThreading().run(new Runnable() + { + @Override + public void run() + { + room.giveEffect(roomUnit, newEffect); + } + }, 1000); this.room.updateHabbosAt(t.x, t.y); } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java index 6e3d5431..88ef4828 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java +++ b/src/main/java/com/eu/habbo/threading/runnables/RoomUnitVendingMachineAction.java @@ -39,7 +39,7 @@ public class RoomUnitVendingMachineAction implements Runnable } catch (Exception e) { - e.printStackTrace(); + Emulator.getLogging().logErrorLine(e); } } else diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java index 324e67be..970e3cdb 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionOne.java @@ -30,6 +30,7 @@ public class HopperActionOne implements Runnable this.room.scheduledComposers.add(new RoomUserStatusComposer(this.client.getHabbo().getRoomUnit()).compose()); this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(this.teleportOne.getX(), this.teleportOne.getY())); this.client.getHabbo().getRoomUnit().setZ(this.teleportOne.getZ()); + this.client.getHabbo().getRoomUnit().setPreviousLocationZ(this.teleportOne.getZ()); Emulator.getThreading().run(new Runnable() { diff --git a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java index 822d454f..08e20ff9 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java +++ b/src/main/java/com/eu/habbo/threading/runnables/hopper/HopperActionThree.java @@ -53,6 +53,7 @@ class HopperActionThree implements Runnable targetTeleport.setExtradata("2"); targetRoom.updateItem(targetTeleport); this.client.getHabbo().getRoomUnit().setLocation(this.room.getLayout().getTile(targetTeleport.getX(), targetTeleport.getY())); + this.client.getHabbo().getRoomUnit().setPreviousLocationZ(targetTeleport.getZ()); this.client.getHabbo().getRoomUnit().setZ(targetTeleport.getZ()); this.client.getHabbo().getRoomUnit().setRotation(RoomUserRotation.values()[targetTeleport.getRotation() % 8]); this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE); diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java index 046d0362..39b147e6 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionFive.java @@ -33,7 +33,7 @@ class TeleportActionFive implements Runnable { RoomTile tile = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY()), this.currentTeleport.getRotation()); - if (tile != null && tile.isWalkable()) + if (tile != null) { this.client.getHabbo().getRoomUnit().setGoalLocation(tile); } diff --git a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java index 128cfeda..6b8d9824 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java +++ b/src/main/java/com/eu/habbo/threading/runnables/teleport/TeleportActionThree.java @@ -9,7 +9,6 @@ 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.outgoing.rooms.users.RoomUserRemoveComposer; -import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer; class TeleportActionThree implements Runnable { @@ -60,7 +59,7 @@ class TeleportActionThree implements Runnable targetTeleport.setExtradata("2"); targetRoom.updateItem(targetTeleport); - targetRoom.sendComposer(new RoomUserStatusComposer(this.client.getHabbo().getRoomUnit()).compose()); + //targetRoom.sendComposer(new RoomUserStatusComposer(this.client.getHabbo().getRoomUnit()).compose()); this.client.getHabbo().getHabboInfo().setCurrentRoom(targetRoom); //Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 500);