From cf8182d4713d0533933a6540c7d7aa492ea3425a Mon Sep 17 00:00:00 2001 From: Bill Date: Sun, 30 Jun 2024 20:57:15 -0400 Subject: [PATCH] Start area selector --- packages/api/src/nitro/room/IRoomCreator.ts | 1 + packages/api/src/nitro/room/IRoomEngine.ts | 14 +- .../api/src/nitro/room/IRoomEngineServices.ts | 6 +- .../nitro/room/object/RoomObjectLogicType.ts | 3 +- .../nitro/room/object/RoomObjectVariable.ts | 7 + .../room/utils/IRoomAreaSelectionManager.ts | 12 + packages/api/src/nitro/room/utils/index.ts | 1 + .../object/visualization/IRoomObjectSprite.ts | 1 + packages/communication/src/NitroMessages.ts | 9 +- .../src/messages/incoming/IncomingHeader.ts | 4 + .../room/furniture/AreaHideMessageEvent.ts | 16 + .../messages/incoming/room/furniture/index.ts | 5 +- .../src/messages/outgoing/OutgoingHeader.ts | 3 + .../room/engine/ClickFurniMessageComposer.ts | 21 + .../messages/outgoing/room/engine/index.ts | 1 + .../parser/room/engine/AreaHideMessageData.ts | 58 + .../src/messages/parser/room/engine/index.ts | 1 + .../room/furniture/AreaHideMessageParser.ts | 28 + .../messages/parser/room/furniture/index.ts | 5 +- .../src/room/RoomEngineAreaHideStateEvent.ts | 20 + .../src/room/RoomEngineTriggerWidgetEvent.ts | 1 + .../src/room/RoomObjectWidgetRequestEvent.ts | 1 + packages/events/src/room/index.ts | 1 + packages/room/src/RoomEngine.ts | 114 +- packages/room/src/RoomMessageHandler.ts | 13 +- packages/room/src/RoomObjectEventHandler.ts | 77 +- packages/room/src/RoomObjectLogicFactory.ts | 5 +- .../ObjectRoomFloorHoleUpdateMessage.ts | 9 +- packages/room/src/object/RoomMapData.ts | 4 +- packages/room/src/object/RoomPlaneParser.ts | 1165 +++++++++-------- packages/room/src/object/logic/RoomLogic.ts | 4 +- .../logic/furniture/FurnitureAreaHideLogic.ts | 96 ++ .../room/src/object/logic/furniture/index.ts | 1 + .../object/visualization/RoomObjectSprite.ts | 11 + .../furniture/FurnitureVisualization.ts | 25 +- .../object/visualization/room/RoomPlane.ts | 19 +- .../visualization/room/RoomVisualization.ts | 87 +- .../room/src/renderer/RoomSpriteCanvas.ts | 95 +- .../room/src/renderer/utils/ExtendedSprite.ts | 13 +- .../src/utils/RoomAreaSelectionManager.ts | 233 ++++ 40 files changed, 1563 insertions(+), 627 deletions(-) create mode 100644 packages/api/src/nitro/room/utils/IRoomAreaSelectionManager.ts create mode 100644 packages/communication/src/messages/incoming/room/furniture/AreaHideMessageEvent.ts create mode 100644 packages/communication/src/messages/outgoing/room/engine/ClickFurniMessageComposer.ts create mode 100644 packages/communication/src/messages/parser/room/engine/AreaHideMessageData.ts create mode 100644 packages/communication/src/messages/parser/room/furniture/AreaHideMessageParser.ts create mode 100644 packages/events/src/room/RoomEngineAreaHideStateEvent.ts create mode 100644 packages/room/src/object/logic/furniture/FurnitureAreaHideLogic.ts create mode 100644 packages/room/src/utils/RoomAreaSelectionManager.ts diff --git a/packages/api/src/nitro/room/IRoomCreator.ts b/packages/api/src/nitro/room/IRoomCreator.ts index e342bce9..4cc3b071 100644 --- a/packages/api/src/nitro/room/IRoomCreator.ts +++ b/packages/api/src/nitro/room/IRoomCreator.ts @@ -10,6 +10,7 @@ export interface IRoomCreator updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean; updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean; updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean; + updateAreaHide(roomId: number, furniId: number, on: boolean, rootX: number, rootY: number, width: number, length: number, invert: boolean): boolean; removeRoomInstance(roomId: number): void; createRoomInstance(roomId: number, roomMap: IRoomMapData): void; setRoomSessionOwnUser(roomId: number, objectId: number): void; diff --git a/packages/api/src/nitro/room/IRoomEngine.ts b/packages/api/src/nitro/room/IRoomEngine.ts index 3aa3df49..ceb7084d 100644 --- a/packages/api/src/nitro/room/IRoomEngine.ts +++ b/packages/api/src/nitro/room/IRoomEngine.ts @@ -24,6 +24,7 @@ export interface IRoomEngine updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean; updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean; updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean; + updateAreaHide(roomId: number, furniId: number, on: boolean, rootX: number, rootY: number, width: number, length: number, invert: boolean): boolean; updateObjectRoomColor(k: number, _arg_2: number, _arg_3: number, _arg_4: boolean): boolean; getRoomInstanceGeometry(roomId: number, canvasId?: number): IRoomGeometry; getRoomInstanceVariable(roomId: number, key: string): T; @@ -81,9 +82,12 @@ export interface IRoomEngine saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail?: boolean): Promise; saveBase64AsScreenshot(base64: string, saveAsThumbnail?: boolean): void; deleteRoomObject(objectId: number, objectCategory: number): boolean; - roomManager: IRoomManager; - objectEventHandler: IRoomObjectEventManager; - activeRoomId: number; - selectedAvatarId: number; - isDecorating: boolean; + readonly roomManager: IRoomManager; + readonly objectEventHandler: IRoomObjectEventManager; + readonly activeRoomId: number; + readonly selectedAvatarId: number; + readonly isDecorating: boolean; + moveBlocked: boolean; + isAreaSelectionMode(): boolean; + whereYouClickIsWhereYouGo(): boolean; } diff --git a/packages/api/src/nitro/room/IRoomEngineServices.ts b/packages/api/src/nitro/room/IRoomEngineServices.ts index 563467e6..40df0ac2 100644 --- a/packages/api/src/nitro/room/IRoomEngineServices.ts +++ b/packages/api/src/nitro/room/IRoomEngineServices.ts @@ -2,7 +2,7 @@ import { IRoomInstance, IRoomObjectController, IRoomRenderingCanvas } from '../. import { IVector3D } from '../../utils'; import { ISelectedRoomObjectData } from './ISelectedRoomObjectData'; import { IObjectData } from './object'; -import { IFurnitureStackingHeightMap, ILegacyWallGeometry, ITileObjectMap } from './utils'; +import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IRoomAreaSelectionManager, ITileObjectMap } from './utils'; export interface IRoomEngineServices { @@ -38,4 +38,8 @@ export interface IRoomEngineServices isPlayingGame(): boolean; activeRoomId: number; isDecorating: boolean; + moveBlocked: boolean; + isAreaSelectionMode(): boolean; + whereYouClickIsWhereYouGo(): boolean; + areaSelectionManager: IRoomAreaSelectionManager; } diff --git a/packages/api/src/nitro/room/object/RoomObjectLogicType.ts b/packages/api/src/nitro/room/object/RoomObjectLogicType.ts index bb16bef2..5394e1c5 100644 --- a/packages/api/src/nitro/room/object/RoomObjectLogicType.ts +++ b/packages/api/src/nitro/room/object/RoomObjectLogicType.ts @@ -62,6 +62,7 @@ export class RoomObjectLogicType public static FURNITURE_EDITABLE_INTERNAL_LINK = 'furniture_editable_internal_link'; public static FURNITURE_EDITABLE_ROOM_LINK = 'furniture_editable_room_link'; public static FURNITURE_CRAFTING_GIZMO = 'furniture_crafting_gizmo'; + public static FURNITURE_AREA_HIDE = 'furniture_area_hide'; public static ROOM = 'room'; public static USER = 'user'; public static BOT = 'bot'; @@ -71,4 +72,4 @@ export class RoomObjectLogicType public static SELECTION_ARROW = 'selection_arrow'; public static GAME_SNOWBALL = 'game_snowball'; public static GAME_SNOWSPLASH = 'game_snowsplash'; -} \ No newline at end of file +} diff --git a/packages/api/src/nitro/room/object/RoomObjectVariable.ts b/packages/api/src/nitro/room/object/RoomObjectVariable.ts index 3819ca58..b1adc6a5 100644 --- a/packages/api/src/nitro/room/object/RoomObjectVariable.ts +++ b/packages/api/src/nitro/room/object/RoomObjectVariable.ts @@ -85,6 +85,13 @@ export class RoomObjectVariable public static FURNITURE_ROOM_BACKGROUND_COLOR_HUE: string = 'furniture_room_background_color_hue'; public static FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION: string = 'furniture_room_background_color_saturation'; public static FURNITURE_ROOM_BACKGROUND_COLOR_LIGHTNESS: string = 'furniture_room_background_color_lightness'; + public static FURNITURE_AREA_HIDE_ROOT_X: string = 'furniture_area_hide_root_x'; + public static FURNITURE_AREA_HIDE_ROOT_Y: string = 'furniture_area_hide_root_y'; + public static FURNITURE_AREA_HIDE_WIDTH: string = 'furniture_area_hide_width'; + public static FURNITURE_AREA_HIDE_LENGTH: string = 'furniture_area_hide_length'; + public static FURNITURE_AREA_HIDE_INVISIBILITY: string = 'furniture_area_hide_invisibility'; + public static FURNITURE_AREA_HIDE_WALL_ITEMS: string = 'furniture_area_hide_wall_items'; + public static FURNITURE_AREA_HIDE_INVERT: string = 'furniture_area_hide_invert'; public static FURNITURE_USES_PLANE_MASK: string = 'furniture_uses_plane_mask'; public static FURNITURE_PLANE_MASK_TYPE: string = 'furniture_plane_mask_type'; public static FURNITURE_IS_VARIABLE_HEIGHT: string = 'furniture_is_variable_height'; diff --git a/packages/api/src/nitro/room/utils/IRoomAreaSelectionManager.ts b/packages/api/src/nitro/room/utils/IRoomAreaSelectionManager.ts new file mode 100644 index 00000000..88caf85b --- /dev/null +++ b/packages/api/src/nitro/room/utils/IRoomAreaSelectionManager.ts @@ -0,0 +1,12 @@ +import { INitroEvent } from '../../../common'; + +export interface IRoomAreaSelectionManager +{ + startSelecting(): void; + handleTileMouseEvent(event: INitroEvent): void; + finishSelecting(): boolean; + activate(callback: (rootX: number, rootY: number, width: number, height: number) => void, highlightType: string): boolean; + deactivate(): void; + setHighlight(rootX: number, rootY: number, width: number, height: number): void; + readonly areaSelectionState: number; +} diff --git a/packages/api/src/nitro/room/utils/index.ts b/packages/api/src/nitro/room/utils/index.ts index e8d16689..feb0610a 100644 --- a/packages/api/src/nitro/room/utils/index.ts +++ b/packages/api/src/nitro/room/utils/index.ts @@ -1,4 +1,5 @@ export * from './IFurnitureStackingHeightMap'; export * from './ILegacyWallGeometry'; +export * from './IRoomAreaSelectionManager'; export * from './ITileObjectMap'; export * from './ObjectRolling'; diff --git a/packages/api/src/room/object/visualization/IRoomObjectSprite.ts b/packages/api/src/room/object/visualization/IRoomObjectSprite.ts index 64900442..d5342d80 100644 --- a/packages/api/src/room/object/visualization/IRoomObjectSprite.ts +++ b/packages/api/src/room/object/visualization/IRoomObjectSprite.ts @@ -29,4 +29,5 @@ export interface IRoomObjectSprite alphaTolerance: number; filters: Filter[]; updateCounter: number; + skipMouseHandling: boolean; } diff --git a/packages/communication/src/NitroMessages.ts b/packages/communication/src/NitroMessages.ts index 7b405173..98220393 100644 --- a/packages/communication/src/NitroMessages.ts +++ b/packages/communication/src/NitroMessages.ts @@ -1,5 +1,5 @@ import { IMessageConfiguration } from '@nitrots/api'; -import { AcceptFriendMessageComposer, AcceptFriendResultEvent, AcceptGameInviteMessageComposer, AcceptQuestMessageComposer, AccountSafetyLockStatusChangeMessageEvent, AchievementEvent, AchievementNotificationMessageEvent, AchievementResolutionCompletedMessageEvent, AchievementResolutionProgressMessageEvent, AchievementResolutionsMessageEvent, AchievementsEvent, AchievementsScoreEvent, ActivateQuestMessageComposer, ActivityPointNotificationMessageEvent, AddFavouriteRoomMessageComposer, AddJukeboxDiskComposer, AddSpamWallPostItMessageComposer, ApplySnapshotMessageComposer, ApplyTonerComposer, ApproveAllMembershipRequestsMessageComposer, ApproveNameMessageComposer, ApproveNameMessageEvent, AuthenticatedEvent, AuthenticationMessageComposer, AvailabilityStatusMessageEvent, AvailabilityTimeMessageEvent, AvatarEffectActivatedComposer, AvatarEffectActivatedEvent, AvatarEffectAddedEvent, AvatarEffectExpiredEvent, AvatarEffectSelectedComposer, AvatarEffectSelectedEvent, AvatarEffectsEvent, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BannedUsersFromRoomEvent, BonusRareInfoMessageEvent, BotAddedToInventoryEvent, BotCommandConfigurationEvent, BotErrorEvent, BotForceOpenContextMenuEvent, BotInventoryMessageEvent, BotPlaceComposer, BotReceivedMessageEvent, BotRemoveComposer, BotRemovedFromInventoryEvent, BotSkillListUpdateEvent, BotSkillSaveComposer, BreedPetsMessageComposer, BuildersClubFurniCountMessageEvent, BuildersClubPlaceRoomItemMessageComposer, BuildersClubPlaceWallItemMessageComposer, BuildersClubQueryFurniCountMessageComposer, BuildersClubSubscriptionStatusMessageEvent, BundleDiscountRulesetMessageEvent, BuyMarketplaceOfferMessageComposer, BuyMarketplaceTokensMessageComposer, CallForHelpDisabledNotifyMessageEvent, CallForHelpFromForumMessageMessageComposer, CallForHelpFromForumThreadMessageComposer, CallForHelpFromIMMessageComposer, CallForHelpFromPhotoMessageComposer, CallForHelpFromSelfieMessageComposer, CallForHelpMessageComposer, CallForHelpPendingCallsDeletedMessageEvent, CallForHelpPendingCallsMessageEvent, CallForHelpReplyMessageEvent, CallForHelpResultMessageEvent, CameraPublishStatusMessageEvent, CameraPurchaseOKMessageEvent, CameraSnapshotMessageEvent, CameraStorageUrlMessageEvent, CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent, CanCreateRoomEvent, CanCreateRoomEventEvent, CanCreateRoomMessageComposer, CancelEventMessageComposer, CancelMarketplaceOfferMessageComposer, CancelMysteryBoxWaitMessageEvent, CancelPetBreedingComposer, CancelQuestMessageComposer, CatalogGroupsComposer, CatalogPageExpirationEvent, CatalogPageMessageEvent, CatalogPageWithEarliestExpiryMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, CategoriesWithVisitorCountEvent, CfhChatlogEvent, CfhSanctionMessageEvent, CfhTopicsInitEvent, ChangeEmailComposer, ChangeEmailResultEvent, ChangeQueueMessageComposer, ChangeUserNameMessageComposer, ChangeUserNameResultMessageEvent, ChatReviewGuideDecidesOnOfferMessageComposer, ChatReviewGuideDetachedMessageComposer, ChatReviewGuideVoteMessageComposer, ChatReviewSessionCreateMessageComposer, ChatReviewSessionDetachedMessageEvent, ChatReviewSessionOfferedToGuideMessageEvent, ChatReviewSessionResultsMessageEvent, ChatReviewSessionStartedMessageEvent, ChatReviewSessionVotingStatusMessageEvent, CheckUserNameMessageComposer, CheckUserNameResultMessageEvent, ClientHelloMessageComposer, ClientPingEvent, CloseIssueDefaultActionMessageComposer, CloseIssuesMessageComposer, ClubGiftInfoEvent, ClubGiftNotificationEvent, ClubGiftSelectedEvent, CommunityGoalEarnedPrizesMessageEvent, CommunityGoalHallOfFameMessageEvent, CommunityGoalProgressMessageEvent, CommunityGoalVoteMessageComposer, CommunityGoalVoteMessageEvent, CompetitionEntrySubmitResultEvent, CompetitionRoomsDataMessageEvent, CompetitionRoomsSearchMessageComposer, CompetitionStatusMessageEvent, CompetitionVotingInfoMessageEvent, CompleteDiffieHandshakeEvent, CompleteDiffieHandshakeMessageComposer, CompostPlantMessageComposer, ConcurrentUsersGoalProgressMessageEvent, ConfirmPetBreedingComposer, ConnectionErrorEvent, ControlYoutubeDisplayPlaybackMessageComposer, ConvertGlobalRoomIdMessageComposer, ConvertedRoomIdEvent, CraftComposer, CraftSecretComposer, CraftableProductsEvent, CraftingRecipeEvent, CraftingRecipesAvailableEvent, CraftingResultEvent, CreateFlatMessageComposer, CurrentTimingCodeMessageEvent, CustomUserNotificationMessageEvent, DeclineFriendMessageComposer, DefaultSanctionMessageComposer, DeleteFavouriteRoomMessageComposer, DeletePendingCallsForHelpMessageComposer, DesktopViewComposer, DesktopViewEvent, DiceValueMessageEvent, DirectSMSClubBuyAvailableMessageEvent, DisconnectMessageComposer, DisconnectReasonEvent, DoorbellMessageEvent, EditEventMessageComposer, ElementPointerMessageEvent, EmailStatusResultEvent, EpicPopupMessageEvent, ExtendRentOrBuyoutFurniMessageComposer, ExtendRentOrBuyoutStripItemMessageComposer, ExtendedProfileChangedMessageEvent, FavoriteMembershipUpdateMessageEvent, FavouriteChangedEvent, FavouritesEvent, FigureSetIdsMessageEvent, FigureUpdateEvent, FindFriendsProcessResultEvent, FindNewFriendsMessageComposer, FireworkChargeDataEvent, FlatAccessDeniedMessageEvent, FlatControllerAddedEvent, FlatControllerRemovedEvent, FlatControllersEvent, FlatCreatedEvent, FloodControlEvent, FloorHeightMapEvent, FollowFriendFailedEvent, FollowFriendMessageComposer, ForumDataMessageEvent, ForumsListMessageEvent, ForwardToACompetitionRoomMessageComposer, ForwardToARandomPromotedRoomMessageComposer, ForwardToASubmittableRoomMessageComposer, ForwardToRandomCompetitionRoomMessageComposer, ForwardToSomeRoomMessageComposer, FriendFurniConfirmLockMessageComposer, FriendListFragmentEvent, FriendListUpdateComposer, FriendListUpdateEvent, FriendNotificationEvent, FriendRequestQuestCompleteMessageComposer, FriendRequestsEvent, FurniRentOrBuyoutOfferMessageEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureColorWheelComposer, FurnitureDataEvent, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureExchangeComposer, FurnitureFloorAddEvent, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateComposer, FurnitureFloorUpdateEvent, FurnitureGroupInfoComposer, FurnitureListAddOrUpdateEvent, FurnitureListComposer, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListRemovedEvent, FurnitureMannequinSaveLookComposer, FurnitureMannequinSaveNameComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePlacePaintComposer, FurniturePostItPlaceComposer, FurniturePostItPlacedEvent, FurnitureRandomStateComposer, FurnitureStackHeightComposer, FurnitureStackHeightEvent, FurnitureWallAddEvent, FurnitureWallEvent, FurnitureWallMultiStateComposer, FurnitureWallRemoveEvent, FurnitureWallUpdateComposer, FurnitureWallUpdateEvent, Game2AccountGameStatusMessageEvent, Game2CheckGameDirectoryStatusMessageComposer, Game2ExitGameMessageComposer, Game2GameChatMessageComposer, Game2GameDirectoryStatusMessageEvent, Game2GetAccountGameStatusMessageComposer, Game2GetWeeklyFriendsLeaderboardComposer, Game2GetWeeklyLeaderboardComposer, Game2InArenaQueueMessageEvent, Game2JoiningGameFailedMessageEvent, Game2LoadStageReadyMessageComposer, Game2PlayAgainMessageComposer, Game2RequestFullStatusUpdateMessageComposer, Game2StartingGameFailedMessageEvent, Game2StopCounterMessageEvent, Game2UserLeftGameMessageEvent, Game2WeeklyFriendsLeaderboardEvent, Game2WeeklyLeaderboardEvent, GameAchievementsMessageEvent, GameInviteMessageEvent, GameListMessageEvent, GameStatusMessageEvent, GameUnloadedMessageComposer, GenericErrorEvent, GetBadgePointLimitsComposer, GetBonusRareInfoMessageComposer, GetBotInventoryComposer, GetBundleDiscountRulesetComposer, GetCatalogIndexComposer, GetCatalogPageComposer, GetCatalogPageExpirationComposer, GetCatalogPageWithEarliestExpiryComposer, GetCategoriesWithUserCountMessageComposer, GetCfhChatlogMessageComposer, GetCfhStatusMessageComposer, GetClubGiftInfo, GetClubOffersMessageComposer, GetCommunityGoalEarnedPrizesMessageComposer, GetCommunityGoalHallOfFameMessageComposer, GetCommunityGoalProgressMessageComposer, GetConcurrentUsersGoalProgressMessageComposer, GetConcurrentUsersRewardMessageComposer, GetCraftableProductsComposer, GetCraftingRecipeComposer, GetCraftingRecipesAvailableComposer, GetCurrentTimingCodeMessageComposer, GetCustomRoomFilterMessageComposer, GetDailyQuestMessageComposer, GetDirectClubBuyAvailableComposer, GetEmailStatusComposer, GetExtendedProfileByNameMessageComposer, GetFaqCategoryMessageComposer, GetFaqTextMessageComposer, GetForumStatsMessageComposer, GetForumsListMessageComposer, GetFriendRequestsComposer, GetGameAchievementsMessageComposer, GetGameListMessageComposer, GetGameStatusMessageComposer, GetGiftMessageComposer, GetGiftWrappingConfigurationComposer, GetGuestRoomMessageComposer, GetGuestRoomResultEvent, GetGuideReportingStatusMessageComposer, GetHabboBasicMembershipExtendOfferComposer, GetHabboClubExtendOfferMessageComposer, GetHabboGroupBadgesMessageComposer, GetIgnoredUsersComposer, GetInterstitialMessageComposer, GetIsBadgeRequestFulfilledComposer, GetIsOfferGiftableComposer, GetIsUserPartOfCompetitionMessageComposer, GetItemDataComposer, GetJukeboxPlayListMessageComposer, GetLimitedOfferAppearingNextComposer, GetMarketplaceCanMakeOfferComposer, GetMarketplaceConfigurationMessageComposer, GetMarketplaceItemStatsComposer, GetMarketplaceOffersMessageComposer, GetMarketplaceOwnOffersMessageComposer, GetMessagesMessageComposer, GetModeratorRoomInfoMessageComposer, GetModeratorUserInfoMessageComposer, GetNextTargetedOfferComposer, GetNowPlayingMessageComposer, GetOccupiedTilesMessageComposer, GetOfficialRoomsMessageComposer, GetOfficialSongIdMessageComposer, GetPendingCallsForHelpMessageComposer, GetPetCommandsComposer, GetPopularRoomTagsMessageComposer, GetProductOfferComposer, GetPromoArticlesComposer, GetQuestsMessageComposer, GetQuizQuestionsComposer, GetRecyclerStatusMessageComposer, GetRentOrBuyoutOfferMessageComposer, GetResolutionAchievementsMessageComposer, GetRoomAdPurchaseInfoComposer, GetRoomChatlogMessageComposer, GetRoomEntryDataMessageComposer, GetRoomEntryTileMessageComposer, GetRoomVisitsMessageComposer, GetSeasonalCalendarDailyOfferComposer, GetSeasonalQuestsOnlyMessageComposer, GetSecondsUntilMessageComposer, GetSellablePetPalettesComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetSoundSettingsComposer, GetTalentTrackLevelMessageComposer, GetTargetedOfferComposer, GetThreadMessageComposer, GetThreadsMessageComposer, GetUnreadForumsCountMessageComposer, GetUserChatlogMessageComposer, GetUserEventCatsMessageComposer, GetUserFlatCatsMessageComposer, GetUserGameAchievementsMessageComposer, GetUserSongDisksMessageComposer, GetUserTagsComposer, GetWardrobeMessageComposer, GetWeeklyGameRewardComposer, GetWeeklyGameRewardWinnersComposer, GetYoutubeDisplayStatusMessageComposer, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, GoToFlatMessageComposer, GotMysteryBoxPrizeMessageEvent, GroupAdminGiveComposer, GroupAdminTakeComposer, GroupBadgePartsComposer, GroupBadgePartsEvent, GroupBuyComposer, GroupBuyDataComposer, GroupBuyDataEvent, GroupConfirmMemberRemoveEvent, GroupConfirmRemoveMemberComposer, GroupDeleteComposer, GroupDetailsChangedMessageEvent, GroupFavoriteComposer, GroupFurniContextMenuInfoMessageEvent, GroupInformationComposer, GroupInformationEvent, GroupJoinComposer, GroupMembersComposer, GroupMembersEvent, GroupMembershipAcceptComposer, GroupMembershipDeclineComposer, GroupMembershipRequestedMessageEvent, GroupPurchasedEvent, GroupRemoveMemberComposer, GroupSaveBadgeComposer, GroupSaveColorsComposer, GroupSaveInformationComposer, GroupSavePreferencesComposer, GroupSettingsComposer, GroupSettingsEvent, GroupUnfavoriteComposer, GuestRoomSearchResultEvent, GuideOnDutyStatusMessageEvent, GuideReportingStatusMessageEvent, GuideSessionAttachedMessageEvent, GuideSessionCreateMessageComposer, GuideSessionDetachedMessageEvent, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionFeedbackMessageComposer, GuideSessionGetRequesterRoomMessageComposer, GuideSessionGuideDecidesMessageComposer, GuideSessionInviteRequesterMessageComposer, GuideSessionInvitedToGuideRoomMessageEvent, GuideSessionIsTypingMessageComposer, GuideSessionMessageMessageComposer, GuideSessionMessageMessageEvent, GuideSessionOnDutyUpdateMessageComposer, GuideSessionPartnerIsTypingMessageEvent, GuideSessionReportMessageComposer, GuideSessionRequesterCancelsMessageComposer, GuideSessionRequesterRoomMessageEvent, GuideSessionResolvedMessageComposer, GuideSessionStartedMessageEvent, GuideTicketCreationResultMessageEvent, GuideTicketResolutionMessageEvent, GuildBaseSearchMessageComposer, GuildEditFailedMessageEvent, GuildForumThreadsEvent, GuildMemberMgmtFailedMessageEvent, GuildMembershipsMessageEvent, HabboBroadcastMessageEvent, HabboClubExtendOfferMessageEvent, HabboClubOffersMessageEvent, HabboGroupBadgesMessageEvent, HabboGroupDeactivatedMessageEvent, HabboGroupJoinFailedMessageEvent, HabboSearchComposer, HabboSearchResultEvent, HarvestPetMessageComposer, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelMergeNameChangeEvent, HotelWillCloseInMinutesEvent, IdentityAccountsEvent, IgnoreResultEvent, IgnoreUserComposer, IgnoreUserIdComposer, IgnoredUsersEvent, InClientLinkEvent, IncomingHeader, InfoFeedEnableMessageEvent, InfoRetrieveMessageComposer, InitCameraMessageEvent, InitDiffieHandshakeEvent, InitDiffieHandshakeMessageComposer, InstantMessageErrorEvent, InterstitialMessageEvent, InterstitialShownMessageComposer, IsBadgeRequestFulfilledEvent, IsOfferGiftableMessageEvent, IsUserPartOfCompetitionMessageEvent, IssueCloseNotificationMessageEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ItemDataUpdateMessageEvent, JoinQueueMessageComposer, JoinedQueueMessageEvent, JoiningQueueFailedMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, LagWarningReportMessageComposer, LeaveQueueMessageComposer, LeftQueueMessageEvent, LimitedEditionSoldOutEvent, LimitedOfferAppearingNextMessageEvent, LoadGameMessageEvent, LoadGameUrlEvent, LoveLockFurniFinishedEvent, LoveLockFurniFriendConfirmedEvent, LoveLockFurniStartEvent, MOTDNotificationEvent, MaintenanceStatusMessageEvent, MakeOfferMessageComposer, MarkCatalogNewAdditionsPageOpenedComposer, MarketPlaceOffersEvent, MarketplaceBuyOfferResultEvent, MarketplaceCanMakeOfferResult, MarketplaceCancelOfferResultEvent, MarketplaceConfigurationEvent, MarketplaceItemStatsEvent, MarketplaceMakeOfferResult, MarketplaceOwnOffersEvent, MessageErrorEvent, MessengerInitComposer, MessengerInitEvent, MiniMailNewMessageEvent, MiniMailUnreadCountEvent, ModAlertMessageComposer, ModBanMessageComposer, ModKickMessageComposer, ModMessageMessageComposer, ModMuteMessageComposer, ModToolPreferencesComposer, ModToolSanctionComposer, ModTradingLockMessageComposer, ModerateMessageMessageComposer, ModerateRoomMessageComposer, ModerateThreadMessageComposer, ModeratorActionMessageComposer, ModeratorActionResultMessageEvent, ModeratorCautionEvent, ModeratorInitMessageEvent, ModeratorMessageEvent, ModeratorRoomInfoEvent, ModeratorToolPreferencesEvent, ModeratorUserInfoEvent, MoodlightSettingsComposer, MoodlightSettingsSaveComposer, MoodlightTogggleStateComposer, MuteAllInRoomEvent, MyFavouriteRoomsSearchMessageComposer, MyFrequentRoomHistorySearchMessageComposer, MyFriendsRoomsSearchMessageComposer, MyGuildBasesSearchMessageComposer, MyRecommendedRoomsMessageComposer, MyRoomHistorySearchMessageComposer, MyRoomRightsSearchMessageComposer, MyRoomsSearchMessageComposer, MysteryBoxKeysEvent, MysteryBoxWaitingCanceledMessageComposer, NavigatorCategoryListModeComposer, NavigatorCollapsedEvent, NavigatorDeleteSavedSearchComposer, NavigatorHomeRoomEvent, NavigatorInitComposer, NavigatorLiftedEvent, NavigatorMetadataEvent, NavigatorOpenRoomCreatorEvent, NavigatorSearchCloseComposer, NavigatorSearchComposer, NavigatorSearchEvent, NavigatorSearchOpenComposer, NavigatorSearchSaveComposer, NavigatorSearchesEvent, NavigatorSettingsEvent, NavigatorSettingsSaveComposer, NewConsoleMessageEvent, NewFriendRequestEvent, NewUserExperienceGetGiftsComposer, NewUserExperienceGiftOfferMessageEvent, NewUserExperienceNotCompleteEvent, NewUserExperienceScriptProceedComposer, NoOwnedRoomsAlertMessageEvent, NoSuchFlatEvent, NoobnessLevelMessageEvent, NotEnoughBalanceMessageEvent, NotificationDialogMessageEvent, NowPlayingMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OfferRewardDeliveredMessageEvent, OfficialSongIdMessageEvent, OneWayDoorStatusMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer, OpenMessageComposer, OpenMysteryTrophyMessageComposer, OpenPetPackageMessageComposer, OpenPetPackageRequestedMessageEvent, OpenPetPackageResultMessageEvent, OpenPresentComposer, OpenQuestTrackerMessageComposer, OpenWelcomeGiftComposer, OutgoingHeader, PeerUsersClassificationMessageComposer, PerformanceLogMessageComposer, PerkAllowancesMessageEvent, PetAddedToInventoryEvent, PetBreedingResultEvent, PetExperienceEvent, PetFigureUpdateEvent, PetInfoEvent, PetInventoryEvent, PetLevelNotificationEvent, PetLevelUpdateMessageEvent, PetMountComposer, PetMoveComposer, PetPlaceComposer, PetPlacingErrorEvent, PetReceivedMessageEvent, PetRemoveComposer, PetRemovedFromInventory, PetRespectComposer, PetRespectNoficationEvent, PetScratchFailedMessageEvent, PetSelectedMessageComposer, PetStatusUpdateEvent, PetSupplementComposer, PetSupplementedNotificationEvent, PetTrainingPanelMessageEvent, PhoneCollectionStateMessageEvent, PhotoCompetitionMessageComposer, PickIssuesMessageComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, PollAnswerComposer, PollContentsEvent, PollErrorEvent, PollOfferEvent, PollRejectComposer, PollStartComposer, PongMessageComposer, PopularRoomTagsResultEvent, PopularRoomsSearchMessageComposer, PostMessageMessageComposer, PostMessageMessageEvent, PostQuizAnswersComposer, PostThreadMessageEvent, PresentOpenedMessageEvent, ProductOfferEvent, PromoArticlesMessageEvent, PublishPhotoMessageComposer, PurchaseBasicMembershipExtensionComposer, PurchaseErrorMessageEvent, PurchaseFromCatalogAsGiftComposer, PurchaseFromCatalogComposer, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, PurchasePhotoMessageComposer, PurchaseRoomAdMessageComposer, PurchaseTargetedOfferComposer, PurchaseVipMembershipExtensionComposer, QuestCancelledMessageEvent, QuestCompletedMessageEvent, QuestDailyMessageEvent, QuestMessageEvent, QuestionAnsweredEvent, QuestionEvent, QuestionFinishedEvent, QuestsMessageEvent, QuizDataMessageEvent, QuizResultsMessageEvent, RateFlatMessageComposer, RecycleItemsMessageComposer, RecyclerFinishedMessageEvent, RecyclerStatusMessageEvent, RedeemCommunityGoalPrizeMessageComposer, RedeemItemClothingComposer, RedeemMarketplaceOfferCreditsMessageComposer, RedeemVoucherMessageComposer, RejectQuestMessageComposer, RelationshipStatusInfoEvent, ReleaseIssuesMessageComposer, RemainingMuteEvent, RemoveAllRightsMessageComposer, RemoveFriendComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RemoveWallItemComposer, RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer, RentableSpaceCancelRentMessageComposer, RentableSpaceRentFailedMessageEvent, RentableSpaceRentMessageComposer, RentableSpaceRentOkMessageEvent, RentableSpaceStatusMessageComposer, RentableSpaceStatusMessageEvent, RequestABadgeComposer, RequestAchievementsMessageComposer, RequestBadgesComposer, RequestBotCommandConfigurationComposer, RequestCameraConfigurationComposer, RequestFriendComposer, RequestFurniInventoryWhenNotInRoomComposer, RequestPetInfoComposer, RequestPetsComposer, RequestSpamWallPostItMessageEvent, ResetPhoneNumberStateMessageComposer, ResetResolutionAchievementMessageComposer, RespectReceivedEvent, RestoreClientMessageEvent, RoomAdErrorEvent, RoomAdEventTabAdClickedComposer, RoomAdEventTabViewedComposer, RoomAdPurchaseInfoEvent, RoomAdPurchaseInitiatedComposer, RoomAdSearchMessageComposer, RoomAmbassadorAlertComposer, RoomBanUserComposer, RoomBannedUsersComposer, RoomChatSettingsEvent, RoomChatlogEvent, RoomCompetitionInitMessageComposer, RoomDeleteComposer, RoomDimmerPresetsEvent, RoomDoorbellAcceptedEvent, RoomDoorbellAccessComposer, RoomEnterComposer, RoomEnterErrorEvent, RoomEnterEvent, RoomEntryInfoMessageEvent, RoomEntryTileMessageEvent, RoomEventCancelEvent, RoomEventEvent, RoomFilterSettingsMessageEvent, RoomForwardEvent, RoomGiveRightsComposer, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomInviteErrorEvent, RoomInviteEvent, RoomKickUserComposer, RoomMessageNotificationMessageEvent, RoomMuteComposer, RoomMuteUserComposer, RoomNetworkOpenConnectionMessageComposer, RoomOccupiedTilesMessageEvent, RoomPaintEvent, RoomPollResultEvent, RoomReadyMessageEvent, RoomRightsClearEvent, RoomRightsEvent, RoomRightsOwnerEvent, RoomScoreEvent, RoomSettingsComposer, RoomSettingsDataEvent, RoomSettingsErrorEvent, RoomSettingsSaveErrorEvent, RoomSettingsSavedEvent, RoomSettingsUpdatedEvent, RoomTakeRightsComposer, RoomTextSearchMessageComposer, RoomThumbnailUpdateResultEvent, RoomUnbanUserComposer, RoomUnitActionComposer, RoomUnitChatComposer, RoomUnitChatEvent, RoomUnitChatShoutComposer, RoomUnitChatShoutEvent, RoomUnitChatStyleComposer, RoomUnitChatWhisperComposer, RoomUnitChatWhisperEvent, RoomUnitDanceComposer, RoomUnitDanceEvent, RoomUnitDropHandItemComposer, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUnitHandItemEvent, RoomUnitHandItemReceivedEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitLookComposer, RoomUnitNumberEvent, RoomUnitPostureComposer, RoomUnitRemoveEvent, RoomUnitSignComposer, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomUnitTypingStartComposer, RoomUnitTypingStopComposer, RoomUnitWalkComposer, RoomUsersClassificationMessageComposer, RoomUsersWithRightsComposer, RoomVisitsEvent, RoomVisualizationSettingsEvent, RoomsWhereMyFriendsAreSearchMessageComposer, RoomsWithHighestScoreSearchMessageComposer, SSOTicketMessageComposer, SanctionStatusEvent, SaveRoomSettingsComposer, SaveWardrobeOutfitMessageComposer, ScrGetKickbackInfoMessageComposer, ScrSendKickbackInfoMessageEvent, SearchFaqsMessageComposer, SeasonalCalendarDailyOfferMessageEvent, SeasonalQuestsMessageEvent, SecondsUntilMessageEvent, SelectClubGiftComposer, SellablePetPalettesMessageEvent, SendMessageComposer, SendRoomInviteComposer, SetActivatedBadgesComposer, SetClothingChangeDataMessageComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer, SetPhoneNumberVerificationStatusMessageComposer, SetRelationshipStatusComposer, SetRoomSessionTagsMessageComposer, SetTargetedOfferStateComposer, SetYoutubeDisplayPlaylistMessageComposer, ShopTargetedOfferViewedComposer, ShowEnforceRoomCategoryDialogEvent, ShowMysteryBoxWaitMessageEvent, SimpleAlertMessageEvent, StartCampaignMessageComposer, StartRoomPollEvent, SubmitRoomToCompetitionMessageComposer, TalentLevelUpEvent, TalentTrackComposer, TalentTrackLevelMessageEvent, TalentTrackMessageEvent, TargetedOfferEvent, TargetedOfferNotFoundEvent, ThreadMessagesMessageEvent, ThumbnailStatusMessageEvent, TogglePetBreedingComposer, TogglePetRidingComposer, ToggleStaffPickMessageComposer, TradingAcceptComposer, TradingAcceptEvent, TradingCancelComposer, TradingCloseComposer, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationComposer, TradingConfirmationEvent, TradingListAddItemComposer, TradingListAddItemsComposer, TradingListItemEvent, TradingListItemRemoveComposer, TradingNoSuchItemEvent, TradingNotOpenEvent, TradingOpenComposer, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingUnacceptComposer, TradingYouAreNotAllowedEvent, TraxSongInfoMessageEvent, TryPhoneNumberMessageComposer, TryPhoneNumberResultMessageEvent, TryVerificationCodeResultMessageEvent, UnblockGroupMemberMessageComposer, UnignoreUserComposer, UniqueIDMessageComposer, UnloadGameMessageEvent, UnreadForumsCountMessageEvent, UnseenItemsEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UpdateActionMessageComposer, UpdateConditionMessageComposer, UpdateFloorPropertiesMessageComposer, UpdateForumReadMarkerMessageComposer, UpdateForumSettingsMessageComposer, UpdateHomeRoomMessageComposer, UpdateMessageMessageEvent, UpdateRoomCategoryAndTradeSettingsComposer, UpdateRoomFilterMessageComposer, UpdateRoomThumbnailMessageComposer, UpdateThreadMessageComposer, UpdateThreadMessageEvent, UpdateTriggerMessageComposer, UsePetProductComposer, UserBannedMessageEvent, UserChatlogEvent, UserClassificationMessageEvent, UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserEventCatsEvent, UserFigureComposer, UserFlatCatsEvent, UserGameAchievementsMessageEvent, UserInfoEvent, UserMottoComposer, UserNameChangeMessageEvent, UserPermissionsEvent, UserProfileComposer, UserProfileEvent, UserRelationshipsComposer, UserRespectComposer, UserSettingsCameraFollowComposer, UserSettingsEvent, UserSettingsOldChatComposer, UserSettingsRoomInvitesComposer, UserSettingsSoundComposer, UserSongDisksInventoryMessageEvent, UserSubscriptionComposer, UserSubscriptionEvent, UserTagsMessageEvent, UserUnbannedFromRoomEvent, UserWardrobePageEvent, VerifyCodeMessageComposer, VersionCheckMessageComposer, VisitUserComposer, VoteForRoomMessageComposer, VotePollCounterMessageComposer, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent, WardrobeMessageEvent, WeeklyCompetitiveFriendsLeaderboardEvent, WeeklyCompetitiveLeaderboardEvent, WeeklyGameRewardEvent, WeeklyGameRewardWinnersEvent, WelcomeGiftChangeEmailComposer, WelcomeGiftChangeEmailResultEvent, WelcomeGiftStatusEvent, WiredFurniActionEvent, WiredFurniConditionEvent, WiredFurniTriggerEvent, WiredOpenEvent, WiredRewardResultMessageEvent, WiredSaveSuccessEvent, WiredValidationErrorEvent, YouArePlayingGameEvent, YouAreSpectatorMessageEvent, YoutubeControlVideoMessageEvent, YoutubeDisplayPlaylistsEvent, YoutubeDisplayVideoMessageEvent } from './messages'; +import { AcceptFriendMessageComposer, AcceptFriendResultEvent, AcceptGameInviteMessageComposer, AcceptQuestMessageComposer, AccountSafetyLockStatusChangeMessageEvent, AchievementEvent, AchievementNotificationMessageEvent, AchievementResolutionCompletedMessageEvent, AchievementResolutionProgressMessageEvent, AchievementResolutionsMessageEvent, AchievementsEvent, AchievementsScoreEvent, ActivateQuestMessageComposer, ActivityPointNotificationMessageEvent, AddFavouriteRoomMessageComposer, AddJukeboxDiskComposer, AddSpamWallPostItMessageComposer, ApplySnapshotMessageComposer, ApplyTonerComposer, ApproveAllMembershipRequestsMessageComposer, ApproveNameMessageComposer, ApproveNameMessageEvent, AreaHideMessageEvent, AuthenticatedEvent, AuthenticationMessageComposer, AvailabilityStatusMessageEvent, AvailabilityTimeMessageEvent, AvatarEffectActivatedComposer, AvatarEffectActivatedEvent, AvatarEffectAddedEvent, AvatarEffectExpiredEvent, AvatarEffectSelectedComposer, AvatarEffectSelectedEvent, AvatarEffectsEvent, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BannedUsersFromRoomEvent, BonusRareInfoMessageEvent, BotAddedToInventoryEvent, BotCommandConfigurationEvent, BotErrorEvent, BotForceOpenContextMenuEvent, BotInventoryMessageEvent, BotPlaceComposer, BotReceivedMessageEvent, BotRemoveComposer, BotRemovedFromInventoryEvent, BotSkillListUpdateEvent, BotSkillSaveComposer, BreedPetsMessageComposer, BuildersClubFurniCountMessageEvent, BuildersClubPlaceRoomItemMessageComposer, BuildersClubPlaceWallItemMessageComposer, BuildersClubQueryFurniCountMessageComposer, BuildersClubSubscriptionStatusMessageEvent, BundleDiscountRulesetMessageEvent, BuyMarketplaceOfferMessageComposer, BuyMarketplaceTokensMessageComposer, CallForHelpDisabledNotifyMessageEvent, CallForHelpFromForumMessageMessageComposer, CallForHelpFromForumThreadMessageComposer, CallForHelpFromIMMessageComposer, CallForHelpFromPhotoMessageComposer, CallForHelpFromSelfieMessageComposer, CallForHelpMessageComposer, CallForHelpPendingCallsDeletedMessageEvent, CallForHelpPendingCallsMessageEvent, CallForHelpReplyMessageEvent, CallForHelpResultMessageEvent, CameraPublishStatusMessageEvent, CameraPurchaseOKMessageEvent, CameraSnapshotMessageEvent, CameraStorageUrlMessageEvent, CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent, CanCreateRoomEvent, CanCreateRoomEventEvent, CanCreateRoomMessageComposer, CancelEventMessageComposer, CancelMarketplaceOfferMessageComposer, CancelMysteryBoxWaitMessageEvent, CancelPetBreedingComposer, CancelQuestMessageComposer, CatalogGroupsComposer, CatalogPageExpirationEvent, CatalogPageMessageEvent, CatalogPageWithEarliestExpiryMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, CategoriesWithVisitorCountEvent, CfhChatlogEvent, CfhSanctionMessageEvent, CfhTopicsInitEvent, ChangeEmailComposer, ChangeEmailResultEvent, ChangeQueueMessageComposer, ChangeUserNameMessageComposer, ChangeUserNameResultMessageEvent, ChatReviewGuideDecidesOnOfferMessageComposer, ChatReviewGuideDetachedMessageComposer, ChatReviewGuideVoteMessageComposer, ChatReviewSessionCreateMessageComposer, ChatReviewSessionDetachedMessageEvent, ChatReviewSessionOfferedToGuideMessageEvent, ChatReviewSessionResultsMessageEvent, ChatReviewSessionStartedMessageEvent, ChatReviewSessionVotingStatusMessageEvent, CheckUserNameMessageComposer, CheckUserNameResultMessageEvent, ClickFurniMessageComposer, ClientHelloMessageComposer, ClientPingEvent, CloseIssueDefaultActionMessageComposer, CloseIssuesMessageComposer, ClubGiftInfoEvent, ClubGiftNotificationEvent, ClubGiftSelectedEvent, CommunityGoalEarnedPrizesMessageEvent, CommunityGoalHallOfFameMessageEvent, CommunityGoalProgressMessageEvent, CommunityGoalVoteMessageComposer, CommunityGoalVoteMessageEvent, CompetitionEntrySubmitResultEvent, CompetitionRoomsDataMessageEvent, CompetitionRoomsSearchMessageComposer, CompetitionStatusMessageEvent, CompetitionVotingInfoMessageEvent, CompleteDiffieHandshakeEvent, CompleteDiffieHandshakeMessageComposer, CompostPlantMessageComposer, ConcurrentUsersGoalProgressMessageEvent, ConfirmPetBreedingComposer, ConnectionErrorEvent, ControlYoutubeDisplayPlaybackMessageComposer, ConvertGlobalRoomIdMessageComposer, ConvertedRoomIdEvent, CraftComposer, CraftSecretComposer, CraftableProductsEvent, CraftingRecipeEvent, CraftingRecipesAvailableEvent, CraftingResultEvent, CreateFlatMessageComposer, CurrentTimingCodeMessageEvent, CustomUserNotificationMessageEvent, DeclineFriendMessageComposer, DefaultSanctionMessageComposer, DeleteFavouriteRoomMessageComposer, DeletePendingCallsForHelpMessageComposer, DesktopViewComposer, DesktopViewEvent, DiceValueMessageEvent, DirectSMSClubBuyAvailableMessageEvent, DisconnectMessageComposer, DisconnectReasonEvent, DoorbellMessageEvent, EditEventMessageComposer, ElementPointerMessageEvent, EmailStatusResultEvent, EpicPopupMessageEvent, ExtendRentOrBuyoutFurniMessageComposer, ExtendRentOrBuyoutStripItemMessageComposer, ExtendedProfileChangedMessageEvent, FavoriteMembershipUpdateMessageEvent, FavouriteChangedEvent, FavouritesEvent, FigureSetIdsMessageEvent, FigureUpdateEvent, FindFriendsProcessResultEvent, FindNewFriendsMessageComposer, FireworkChargeDataEvent, FlatAccessDeniedMessageEvent, FlatControllerAddedEvent, FlatControllerRemovedEvent, FlatControllersEvent, FlatCreatedEvent, FloodControlEvent, FloorHeightMapEvent, FollowFriendFailedEvent, FollowFriendMessageComposer, ForumDataMessageEvent, ForumsListMessageEvent, ForwardToACompetitionRoomMessageComposer, ForwardToARandomPromotedRoomMessageComposer, ForwardToASubmittableRoomMessageComposer, ForwardToRandomCompetitionRoomMessageComposer, ForwardToSomeRoomMessageComposer, FriendFurniConfirmLockMessageComposer, FriendListFragmentEvent, FriendListUpdateComposer, FriendListUpdateEvent, FriendNotificationEvent, FriendRequestQuestCompleteMessageComposer, FriendRequestsEvent, FurniRentOrBuyoutOfferMessageEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureColorWheelComposer, FurnitureDataEvent, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureExchangeComposer, FurnitureFloorAddEvent, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateComposer, FurnitureFloorUpdateEvent, FurnitureGroupInfoComposer, FurnitureListAddOrUpdateEvent, FurnitureListComposer, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListRemovedEvent, FurnitureMannequinSaveLookComposer, FurnitureMannequinSaveNameComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePlacePaintComposer, FurniturePostItPlaceComposer, FurniturePostItPlacedEvent, FurnitureRandomStateComposer, FurnitureStackHeightComposer, FurnitureStackHeightEvent, FurnitureWallAddEvent, FurnitureWallEvent, FurnitureWallMultiStateComposer, FurnitureWallRemoveEvent, FurnitureWallUpdateComposer, FurnitureWallUpdateEvent, Game2AccountGameStatusMessageEvent, Game2CheckGameDirectoryStatusMessageComposer, Game2ExitGameMessageComposer, Game2GameChatMessageComposer, Game2GameDirectoryStatusMessageEvent, Game2GetAccountGameStatusMessageComposer, Game2GetWeeklyFriendsLeaderboardComposer, Game2GetWeeklyLeaderboardComposer, Game2InArenaQueueMessageEvent, Game2JoiningGameFailedMessageEvent, Game2LoadStageReadyMessageComposer, Game2PlayAgainMessageComposer, Game2RequestFullStatusUpdateMessageComposer, Game2StartingGameFailedMessageEvent, Game2StopCounterMessageEvent, Game2UserLeftGameMessageEvent, Game2WeeklyFriendsLeaderboardEvent, Game2WeeklyLeaderboardEvent, GameAchievementsMessageEvent, GameInviteMessageEvent, GameListMessageEvent, GameStatusMessageEvent, GameUnloadedMessageComposer, GenericErrorEvent, GetBadgePointLimitsComposer, GetBonusRareInfoMessageComposer, GetBotInventoryComposer, GetBundleDiscountRulesetComposer, GetCatalogIndexComposer, GetCatalogPageComposer, GetCatalogPageExpirationComposer, GetCatalogPageWithEarliestExpiryComposer, GetCategoriesWithUserCountMessageComposer, GetCfhChatlogMessageComposer, GetCfhStatusMessageComposer, GetClubGiftInfo, GetClubOffersMessageComposer, GetCommunityGoalEarnedPrizesMessageComposer, GetCommunityGoalHallOfFameMessageComposer, GetCommunityGoalProgressMessageComposer, GetConcurrentUsersGoalProgressMessageComposer, GetConcurrentUsersRewardMessageComposer, GetCraftableProductsComposer, GetCraftingRecipeComposer, GetCraftingRecipesAvailableComposer, GetCurrentTimingCodeMessageComposer, GetCustomRoomFilterMessageComposer, GetDailyQuestMessageComposer, GetDirectClubBuyAvailableComposer, GetEmailStatusComposer, GetExtendedProfileByNameMessageComposer, GetFaqCategoryMessageComposer, GetFaqTextMessageComposer, GetForumStatsMessageComposer, GetForumsListMessageComposer, GetFriendRequestsComposer, GetGameAchievementsMessageComposer, GetGameListMessageComposer, GetGameStatusMessageComposer, GetGiftMessageComposer, GetGiftWrappingConfigurationComposer, GetGuestRoomMessageComposer, GetGuestRoomResultEvent, GetGuideReportingStatusMessageComposer, GetHabboBasicMembershipExtendOfferComposer, GetHabboClubExtendOfferMessageComposer, GetHabboGroupBadgesMessageComposer, GetIgnoredUsersComposer, GetInterstitialMessageComposer, GetIsBadgeRequestFulfilledComposer, GetIsOfferGiftableComposer, GetIsUserPartOfCompetitionMessageComposer, GetItemDataComposer, GetJukeboxPlayListMessageComposer, GetLimitedOfferAppearingNextComposer, GetMarketplaceCanMakeOfferComposer, GetMarketplaceConfigurationMessageComposer, GetMarketplaceItemStatsComposer, GetMarketplaceOffersMessageComposer, GetMarketplaceOwnOffersMessageComposer, GetMessagesMessageComposer, GetModeratorRoomInfoMessageComposer, GetModeratorUserInfoMessageComposer, GetNextTargetedOfferComposer, GetNowPlayingMessageComposer, GetOccupiedTilesMessageComposer, GetOfficialRoomsMessageComposer, GetOfficialSongIdMessageComposer, GetPendingCallsForHelpMessageComposer, GetPetCommandsComposer, GetPopularRoomTagsMessageComposer, GetProductOfferComposer, GetPromoArticlesComposer, GetQuestsMessageComposer, GetQuizQuestionsComposer, GetRecyclerStatusMessageComposer, GetRentOrBuyoutOfferMessageComposer, GetResolutionAchievementsMessageComposer, GetRoomAdPurchaseInfoComposer, GetRoomChatlogMessageComposer, GetRoomEntryDataMessageComposer, GetRoomEntryTileMessageComposer, GetRoomVisitsMessageComposer, GetSeasonalCalendarDailyOfferComposer, GetSeasonalQuestsOnlyMessageComposer, GetSecondsUntilMessageComposer, GetSellablePetPalettesComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetSoundSettingsComposer, GetTalentTrackLevelMessageComposer, GetTargetedOfferComposer, GetThreadMessageComposer, GetThreadsMessageComposer, GetUnreadForumsCountMessageComposer, GetUserChatlogMessageComposer, GetUserEventCatsMessageComposer, GetUserFlatCatsMessageComposer, GetUserGameAchievementsMessageComposer, GetUserSongDisksMessageComposer, GetUserTagsComposer, GetWardrobeMessageComposer, GetWeeklyGameRewardComposer, GetWeeklyGameRewardWinnersComposer, GetYoutubeDisplayStatusMessageComposer, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, GoToFlatMessageComposer, GotMysteryBoxPrizeMessageEvent, GroupAdminGiveComposer, GroupAdminTakeComposer, GroupBadgePartsComposer, GroupBadgePartsEvent, GroupBuyComposer, GroupBuyDataComposer, GroupBuyDataEvent, GroupConfirmMemberRemoveEvent, GroupConfirmRemoveMemberComposer, GroupDeleteComposer, GroupDetailsChangedMessageEvent, GroupFavoriteComposer, GroupFurniContextMenuInfoMessageEvent, GroupInformationComposer, GroupInformationEvent, GroupJoinComposer, GroupMembersComposer, GroupMembersEvent, GroupMembershipAcceptComposer, GroupMembershipDeclineComposer, GroupMembershipRequestedMessageEvent, GroupPurchasedEvent, GroupRemoveMemberComposer, GroupSaveBadgeComposer, GroupSaveColorsComposer, GroupSaveInformationComposer, GroupSavePreferencesComposer, GroupSettingsComposer, GroupSettingsEvent, GroupUnfavoriteComposer, GuestRoomSearchResultEvent, GuideOnDutyStatusMessageEvent, GuideReportingStatusMessageEvent, GuideSessionAttachedMessageEvent, GuideSessionCreateMessageComposer, GuideSessionDetachedMessageEvent, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionFeedbackMessageComposer, GuideSessionGetRequesterRoomMessageComposer, GuideSessionGuideDecidesMessageComposer, GuideSessionInviteRequesterMessageComposer, GuideSessionInvitedToGuideRoomMessageEvent, GuideSessionIsTypingMessageComposer, GuideSessionMessageMessageComposer, GuideSessionMessageMessageEvent, GuideSessionOnDutyUpdateMessageComposer, GuideSessionPartnerIsTypingMessageEvent, GuideSessionReportMessageComposer, GuideSessionRequesterCancelsMessageComposer, GuideSessionRequesterRoomMessageEvent, GuideSessionResolvedMessageComposer, GuideSessionStartedMessageEvent, GuideTicketCreationResultMessageEvent, GuideTicketResolutionMessageEvent, GuildBaseSearchMessageComposer, GuildEditFailedMessageEvent, GuildForumThreadsEvent, GuildMemberMgmtFailedMessageEvent, GuildMembershipsMessageEvent, HabboBroadcastMessageEvent, HabboClubExtendOfferMessageEvent, HabboClubOffersMessageEvent, HabboGroupBadgesMessageEvent, HabboGroupDeactivatedMessageEvent, HabboGroupJoinFailedMessageEvent, HabboSearchComposer, HabboSearchResultEvent, HarvestPetMessageComposer, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelMergeNameChangeEvent, HotelWillCloseInMinutesEvent, IdentityAccountsEvent, IgnoreResultEvent, IgnoreUserComposer, IgnoreUserIdComposer, IgnoredUsersEvent, InClientLinkEvent, IncomingHeader, InfoFeedEnableMessageEvent, InfoRetrieveMessageComposer, InitCameraMessageEvent, InitDiffieHandshakeEvent, InitDiffieHandshakeMessageComposer, InstantMessageErrorEvent, InterstitialMessageEvent, InterstitialShownMessageComposer, IsBadgeRequestFulfilledEvent, IsOfferGiftableMessageEvent, IsUserPartOfCompetitionMessageEvent, IssueCloseNotificationMessageEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ItemDataUpdateMessageEvent, JoinQueueMessageComposer, JoinedQueueMessageEvent, JoiningQueueFailedMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, LagWarningReportMessageComposer, LeaveQueueMessageComposer, LeftQueueMessageEvent, LimitedEditionSoldOutEvent, LimitedOfferAppearingNextMessageEvent, LoadGameMessageEvent, LoadGameUrlEvent, LoveLockFurniFinishedEvent, LoveLockFurniFriendConfirmedEvent, LoveLockFurniStartEvent, MOTDNotificationEvent, MaintenanceStatusMessageEvent, MakeOfferMessageComposer, MarkCatalogNewAdditionsPageOpenedComposer, MarketPlaceOffersEvent, MarketplaceBuyOfferResultEvent, MarketplaceCanMakeOfferResult, MarketplaceCancelOfferResultEvent, MarketplaceConfigurationEvent, MarketplaceItemStatsEvent, MarketplaceMakeOfferResult, MarketplaceOwnOffersEvent, MessageErrorEvent, MessengerInitComposer, MessengerInitEvent, MiniMailNewMessageEvent, MiniMailUnreadCountEvent, ModAlertMessageComposer, ModBanMessageComposer, ModKickMessageComposer, ModMessageMessageComposer, ModMuteMessageComposer, ModToolPreferencesComposer, ModToolSanctionComposer, ModTradingLockMessageComposer, ModerateMessageMessageComposer, ModerateRoomMessageComposer, ModerateThreadMessageComposer, ModeratorActionMessageComposer, ModeratorActionResultMessageEvent, ModeratorCautionEvent, ModeratorInitMessageEvent, ModeratorMessageEvent, ModeratorRoomInfoEvent, ModeratorToolPreferencesEvent, ModeratorUserInfoEvent, MoodlightSettingsComposer, MoodlightSettingsSaveComposer, MoodlightTogggleStateComposer, MuteAllInRoomEvent, MyFavouriteRoomsSearchMessageComposer, MyFrequentRoomHistorySearchMessageComposer, MyFriendsRoomsSearchMessageComposer, MyGuildBasesSearchMessageComposer, MyRecommendedRoomsMessageComposer, MyRoomHistorySearchMessageComposer, MyRoomRightsSearchMessageComposer, MyRoomsSearchMessageComposer, MysteryBoxKeysEvent, MysteryBoxWaitingCanceledMessageComposer, NavigatorCategoryListModeComposer, NavigatorCollapsedEvent, NavigatorDeleteSavedSearchComposer, NavigatorHomeRoomEvent, NavigatorInitComposer, NavigatorLiftedEvent, NavigatorMetadataEvent, NavigatorOpenRoomCreatorEvent, NavigatorSearchCloseComposer, NavigatorSearchComposer, NavigatorSearchEvent, NavigatorSearchOpenComposer, NavigatorSearchSaveComposer, NavigatorSearchesEvent, NavigatorSettingsEvent, NavigatorSettingsSaveComposer, NewConsoleMessageEvent, NewFriendRequestEvent, NewUserExperienceGetGiftsComposer, NewUserExperienceGiftOfferMessageEvent, NewUserExperienceNotCompleteEvent, NewUserExperienceScriptProceedComposer, NoOwnedRoomsAlertMessageEvent, NoSuchFlatEvent, NoobnessLevelMessageEvent, NotEnoughBalanceMessageEvent, NotificationDialogMessageEvent, NowPlayingMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OfferRewardDeliveredMessageEvent, OfficialSongIdMessageEvent, OneWayDoorStatusMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer, OpenMessageComposer, OpenMysteryTrophyMessageComposer, OpenPetPackageMessageComposer, OpenPetPackageRequestedMessageEvent, OpenPetPackageResultMessageEvent, OpenPresentComposer, OpenQuestTrackerMessageComposer, OpenWelcomeGiftComposer, OutgoingHeader, PeerUsersClassificationMessageComposer, PerformanceLogMessageComposer, PerkAllowancesMessageEvent, PetAddedToInventoryEvent, PetBreedingResultEvent, PetExperienceEvent, PetFigureUpdateEvent, PetInfoEvent, PetInventoryEvent, PetLevelNotificationEvent, PetLevelUpdateMessageEvent, PetMountComposer, PetMoveComposer, PetPlaceComposer, PetPlacingErrorEvent, PetReceivedMessageEvent, PetRemoveComposer, PetRemovedFromInventory, PetRespectComposer, PetRespectNoficationEvent, PetScratchFailedMessageEvent, PetSelectedMessageComposer, PetStatusUpdateEvent, PetSupplementComposer, PetSupplementedNotificationEvent, PetTrainingPanelMessageEvent, PhoneCollectionStateMessageEvent, PhotoCompetitionMessageComposer, PickIssuesMessageComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, PollAnswerComposer, PollContentsEvent, PollErrorEvent, PollOfferEvent, PollRejectComposer, PollStartComposer, PongMessageComposer, PopularRoomTagsResultEvent, PopularRoomsSearchMessageComposer, PostMessageMessageComposer, PostMessageMessageEvent, PostQuizAnswersComposer, PostThreadMessageEvent, PresentOpenedMessageEvent, ProductOfferEvent, PromoArticlesMessageEvent, PublishPhotoMessageComposer, PurchaseBasicMembershipExtensionComposer, PurchaseErrorMessageEvent, PurchaseFromCatalogAsGiftComposer, PurchaseFromCatalogComposer, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, PurchasePhotoMessageComposer, PurchaseRoomAdMessageComposer, PurchaseTargetedOfferComposer, PurchaseVipMembershipExtensionComposer, QuestCancelledMessageEvent, QuestCompletedMessageEvent, QuestDailyMessageEvent, QuestMessageEvent, QuestionAnsweredEvent, QuestionEvent, QuestionFinishedEvent, QuestsMessageEvent, QuizDataMessageEvent, QuizResultsMessageEvent, RateFlatMessageComposer, RecycleItemsMessageComposer, RecyclerFinishedMessageEvent, RecyclerStatusMessageEvent, RedeemCommunityGoalPrizeMessageComposer, RedeemItemClothingComposer, RedeemMarketplaceOfferCreditsMessageComposer, RedeemVoucherMessageComposer, RejectQuestMessageComposer, RelationshipStatusInfoEvent, ReleaseIssuesMessageComposer, RemainingMuteEvent, RemoveAllRightsMessageComposer, RemoveFriendComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RemoveWallItemComposer, RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer, RentableSpaceCancelRentMessageComposer, RentableSpaceRentFailedMessageEvent, RentableSpaceRentMessageComposer, RentableSpaceRentOkMessageEvent, RentableSpaceStatusMessageComposer, RentableSpaceStatusMessageEvent, RequestABadgeComposer, RequestAchievementsMessageComposer, RequestBadgesComposer, RequestBotCommandConfigurationComposer, RequestCameraConfigurationComposer, RequestFriendComposer, RequestFurniInventoryWhenNotInRoomComposer, RequestPetInfoComposer, RequestPetsComposer, RequestSpamWallPostItMessageEvent, ResetPhoneNumberStateMessageComposer, ResetResolutionAchievementMessageComposer, RespectReceivedEvent, RestoreClientMessageEvent, RoomAdErrorEvent, RoomAdEventTabAdClickedComposer, RoomAdEventTabViewedComposer, RoomAdPurchaseInfoEvent, RoomAdPurchaseInitiatedComposer, RoomAdSearchMessageComposer, RoomAmbassadorAlertComposer, RoomBanUserComposer, RoomBannedUsersComposer, RoomChatSettingsEvent, RoomChatlogEvent, RoomCompetitionInitMessageComposer, RoomDeleteComposer, RoomDimmerPresetsEvent, RoomDoorbellAcceptedEvent, RoomDoorbellAccessComposer, RoomEnterComposer, RoomEnterErrorEvent, RoomEnterEvent, RoomEntryInfoMessageEvent, RoomEntryTileMessageEvent, RoomEventCancelEvent, RoomEventEvent, RoomFilterSettingsMessageEvent, RoomForwardEvent, RoomGiveRightsComposer, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomInviteErrorEvent, RoomInviteEvent, RoomKickUserComposer, RoomMessageNotificationMessageEvent, RoomMuteComposer, RoomMuteUserComposer, RoomNetworkOpenConnectionMessageComposer, RoomOccupiedTilesMessageEvent, RoomPaintEvent, RoomPollResultEvent, RoomReadyMessageEvent, RoomRightsClearEvent, RoomRightsEvent, RoomRightsOwnerEvent, RoomScoreEvent, RoomSettingsComposer, RoomSettingsDataEvent, RoomSettingsErrorEvent, RoomSettingsSaveErrorEvent, RoomSettingsSavedEvent, RoomSettingsUpdatedEvent, RoomTakeRightsComposer, RoomTextSearchMessageComposer, RoomThumbnailUpdateResultEvent, RoomUnbanUserComposer, RoomUnitActionComposer, RoomUnitChatComposer, RoomUnitChatEvent, RoomUnitChatShoutComposer, RoomUnitChatShoutEvent, RoomUnitChatStyleComposer, RoomUnitChatWhisperComposer, RoomUnitChatWhisperEvent, RoomUnitDanceComposer, RoomUnitDanceEvent, RoomUnitDropHandItemComposer, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUnitHandItemEvent, RoomUnitHandItemReceivedEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitLookComposer, RoomUnitNumberEvent, RoomUnitPostureComposer, RoomUnitRemoveEvent, RoomUnitSignComposer, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomUnitTypingStartComposer, RoomUnitTypingStopComposer, RoomUnitWalkComposer, RoomUsersClassificationMessageComposer, RoomUsersWithRightsComposer, RoomVisitsEvent, RoomVisualizationSettingsEvent, RoomsWhereMyFriendsAreSearchMessageComposer, RoomsWithHighestScoreSearchMessageComposer, SSOTicketMessageComposer, SanctionStatusEvent, SaveRoomSettingsComposer, SaveWardrobeOutfitMessageComposer, ScrGetKickbackInfoMessageComposer, ScrSendKickbackInfoMessageEvent, SearchFaqsMessageComposer, SeasonalCalendarDailyOfferMessageEvent, SeasonalQuestsMessageEvent, SecondsUntilMessageEvent, SelectClubGiftComposer, SellablePetPalettesMessageEvent, SendMessageComposer, SendRoomInviteComposer, SetActivatedBadgesComposer, SetClothingChangeDataMessageComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer, SetPhoneNumberVerificationStatusMessageComposer, SetRelationshipStatusComposer, SetRoomSessionTagsMessageComposer, SetTargetedOfferStateComposer, SetYoutubeDisplayPlaylistMessageComposer, ShopTargetedOfferViewedComposer, ShowEnforceRoomCategoryDialogEvent, ShowMysteryBoxWaitMessageEvent, SimpleAlertMessageEvent, StartCampaignMessageComposer, StartRoomPollEvent, SubmitRoomToCompetitionMessageComposer, TalentLevelUpEvent, TalentTrackComposer, TalentTrackLevelMessageEvent, TalentTrackMessageEvent, TargetedOfferEvent, TargetedOfferNotFoundEvent, ThreadMessagesMessageEvent, ThumbnailStatusMessageEvent, TogglePetBreedingComposer, TogglePetRidingComposer, ToggleStaffPickMessageComposer, TradingAcceptComposer, TradingAcceptEvent, TradingCancelComposer, TradingCloseComposer, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationComposer, TradingConfirmationEvent, TradingListAddItemComposer, TradingListAddItemsComposer, TradingListItemEvent, TradingListItemRemoveComposer, TradingNoSuchItemEvent, TradingNotOpenEvent, TradingOpenComposer, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingUnacceptComposer, TradingYouAreNotAllowedEvent, TraxSongInfoMessageEvent, TryPhoneNumberMessageComposer, TryPhoneNumberResultMessageEvent, TryVerificationCodeResultMessageEvent, UnblockGroupMemberMessageComposer, UnignoreUserComposer, UniqueIDMessageComposer, UnloadGameMessageEvent, UnreadForumsCountMessageEvent, UnseenItemsEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UpdateActionMessageComposer, UpdateConditionMessageComposer, UpdateFloorPropertiesMessageComposer, UpdateForumReadMarkerMessageComposer, UpdateForumSettingsMessageComposer, UpdateHomeRoomMessageComposer, UpdateMessageMessageEvent, UpdateRoomCategoryAndTradeSettingsComposer, UpdateRoomFilterMessageComposer, UpdateRoomThumbnailMessageComposer, UpdateThreadMessageComposer, UpdateThreadMessageEvent, UpdateTriggerMessageComposer, UsePetProductComposer, UserBannedMessageEvent, UserChatlogEvent, UserClassificationMessageEvent, UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserEventCatsEvent, UserFigureComposer, UserFlatCatsEvent, UserGameAchievementsMessageEvent, UserInfoEvent, UserMottoComposer, UserNameChangeMessageEvent, UserPermissionsEvent, UserProfileComposer, UserProfileEvent, UserRelationshipsComposer, UserRespectComposer, UserSettingsCameraFollowComposer, UserSettingsEvent, UserSettingsOldChatComposer, UserSettingsRoomInvitesComposer, UserSettingsSoundComposer, UserSongDisksInventoryMessageEvent, UserSubscriptionComposer, UserSubscriptionEvent, UserTagsMessageEvent, UserUnbannedFromRoomEvent, UserWardrobePageEvent, VerifyCodeMessageComposer, VersionCheckMessageComposer, VisitUserComposer, VoteForRoomMessageComposer, VotePollCounterMessageComposer, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent, WardrobeMessageEvent, WeeklyCompetitiveFriendsLeaderboardEvent, WeeklyCompetitiveLeaderboardEvent, WeeklyGameRewardEvent, WeeklyGameRewardWinnersEvent, WelcomeGiftChangeEmailComposer, WelcomeGiftChangeEmailResultEvent, WelcomeGiftStatusEvent, WiredFurniActionEvent, WiredFurniConditionEvent, WiredFurniTriggerEvent, WiredOpenEvent, WiredRewardResultMessageEvent, WiredSaveSuccessEvent, WiredValidationErrorEvent, YouArePlayingGameEvent, YouAreSpectatorMessageEvent, YoutubeControlVideoMessageEvent, YoutubeDisplayPlaylistsEvent, YoutubeDisplayVideoMessageEvent } from './messages'; export class NitroMessages implements IMessageConfiguration { @@ -410,6 +410,7 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.CUSTOM_USER_NOTIFICATION, CustomUserNotificationMessageEvent); this._events.set(IncomingHeader.ROOM_MESSAGE_NOTIFICATION, RoomMessageNotificationMessageEvent); this._events.set(IncomingHeader.ROOM_POPULAR_TAGS_RESULT, PopularRoomTagsResultEvent); + this._events.set(IncomingHeader.ROOM_POPULAR_TAGS_RESULT, PopularRoomTagsResultEvent); // ROOM SETTINGS this._events.set(IncomingHeader.ROOM_RIGHTS_LIST, FlatControllersEvent); @@ -561,10 +562,16 @@ export class NitroMessages implements IMessageConfiguration // RENTABLE FURNI this._events.set(IncomingHeader.RENTABLE_FURNI_RENT_OR_BUYOUT_OFFER, FurniRentOrBuyoutOfferMessageEvent); + + // Custom packets + this._events.set(IncomingHeader.AREA_HIDE, AreaHideMessageEvent); } private registerComposers(): void { + // CUSTOM PACKETS + this._composers.set(OutgoingHeader.CLICK_FURNI, ClickFurniMessageComposer); + // AUTHENTICATION this._composers.set(OutgoingHeader.AUTHENTICATION, AuthenticationMessageComposer); diff --git a/packages/communication/src/messages/incoming/IncomingHeader.ts b/packages/communication/src/messages/incoming/IncomingHeader.ts index f7ae0fd6..558317dc 100644 --- a/packages/communication/src/messages/incoming/IncomingHeader.ts +++ b/packages/communication/src/messages/incoming/IncomingHeader.ts @@ -1,5 +1,9 @@ export class IncomingHeader { + // These packets do not belong to this revision, so these are custom packet ids + public static AREA_HIDE = 6001; + + // Original packets public static ACHIEVEMENT_LIST = 305; public static AUTHENTICATED = 2491; public static AUTHENTICATION = -1; diff --git a/packages/communication/src/messages/incoming/room/furniture/AreaHideMessageEvent.ts b/packages/communication/src/messages/incoming/room/furniture/AreaHideMessageEvent.ts new file mode 100644 index 00000000..5c04551a --- /dev/null +++ b/packages/communication/src/messages/incoming/room/furniture/AreaHideMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '@nitrots/api'; +import { MessageEvent } from '@nitrots/events'; +import { AreaHideMessageParser } from '../../../parser'; + +export class AreaHideMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AreaHideMessageParser); + } + + public getParser(): AreaHideMessageParser + { + return this.parser as AreaHideMessageParser; + } +} diff --git a/packages/communication/src/messages/incoming/room/furniture/index.ts b/packages/communication/src/messages/incoming/room/furniture/index.ts index 3926d97f..9ebbebd3 100644 --- a/packages/communication/src/messages/incoming/room/furniture/index.ts +++ b/packages/communication/src/messages/incoming/room/furniture/index.ts @@ -1,6 +1,6 @@ +export * from './AreaHideMessageEvent'; export * from './CustomUserNotificationMessageEvent'; export * from './DiceValueMessageEvent'; -export * from './floor'; export * from './FurniRentOrBuyoutOfferMessageEvent'; export * from './FurnitureAliasesEvent'; export * from './FurnitureDataEvent'; @@ -17,6 +17,7 @@ export * from './RentableSpaceStatusMessageEvent'; export * from './RequestSpamWallPostItMessageEvent'; export * from './RoomDimmerPresetsMessageEvent'; export * from './RoomMessageNotificationMessageEvent'; -export * from './wall'; export * from './WelcomeGiftStatusEvent'; +export * from './floor'; +export * from './wall'; export * from './youtube'; diff --git a/packages/communication/src/messages/outgoing/OutgoingHeader.ts b/packages/communication/src/messages/outgoing/OutgoingHeader.ts index 4917a512..a8c1b011 100644 --- a/packages/communication/src/messages/outgoing/OutgoingHeader.ts +++ b/packages/communication/src/messages/outgoing/OutgoingHeader.ts @@ -1,5 +1,8 @@ export class OutgoingHeader { + // These packets do not belong to this revision, so these are custom packet ids + public static CLICK_FURNI = 6002; + public static ACHIEVEMENT_LIST = 219; public static AUTHENTICATION = -1; public static BOT_CONFIGURATION = 1986; diff --git a/packages/communication/src/messages/outgoing/room/engine/ClickFurniMessageComposer.ts b/packages/communication/src/messages/outgoing/room/engine/ClickFurniMessageComposer.ts new file mode 100644 index 00000000..30ea6374 --- /dev/null +++ b/packages/communication/src/messages/outgoing/room/engine/ClickFurniMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '@nitrots/api'; + +export class ClickFurniMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(id: number, category: number) + { + this._data = [id, category]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/packages/communication/src/messages/outgoing/room/engine/index.ts b/packages/communication/src/messages/outgoing/room/engine/index.ts index d8c89dcd..ebee1cd4 100644 --- a/packages/communication/src/messages/outgoing/room/engine/index.ts +++ b/packages/communication/src/messages/outgoing/room/engine/index.ts @@ -1,6 +1,7 @@ export * from './BotPlaceComposer'; export * from './BotRemoveComposer'; export * from './BotSkillSaveComposer'; +export * from './ClickFurniMessageComposer'; export * from './CompostPlantMessageComposer'; export * from './GetItemDataComposer'; export * from './HarvestPetMessageComposer'; diff --git a/packages/communication/src/messages/parser/room/engine/AreaHideMessageData.ts b/packages/communication/src/messages/parser/room/engine/AreaHideMessageData.ts new file mode 100644 index 00000000..c5c44cd1 --- /dev/null +++ b/packages/communication/src/messages/parser/room/engine/AreaHideMessageData.ts @@ -0,0 +1,58 @@ +import { IMessageDataWrapper } from '@nitrots/api'; + +export class AreaHideMessageData +{ + private _furniId: number; + private _on: boolean; + private _rootX: number; + private _rootY: number; + private _width: number; + private _length: number; + private _invert: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._furniId = wrapper.readInt(); + this._on = wrapper.readBoolean(); + this._rootX = wrapper.readInt(); + this._rootY = wrapper.readInt(); + this._width = wrapper.readInt(); + this._length = wrapper.readInt(); + this._invert = wrapper.readBoolean(); + } + + public get furniId(): number + { + return this._furniId; + } + + public get on(): boolean + { + return this._on; + } + + public get rootX(): number + { + return this._rootX; + } + + public get rootY(): number + { + return this._rootY; + } + + public get width(): number + { + return this._width; + } + + public get length(): number + { + return this._length; + } + + public get invert(): boolean + { + return this._invert; + } +} diff --git a/packages/communication/src/messages/parser/room/engine/index.ts b/packages/communication/src/messages/parser/room/engine/index.ts index ba275c9a..68d71c30 100644 --- a/packages/communication/src/messages/parser/room/engine/index.ts +++ b/packages/communication/src/messages/parser/room/engine/index.ts @@ -1,3 +1,4 @@ +export * from './AreaHideMessageData'; export * from './FavoriteMembershipUpdateMessageParser'; export * from './ObjectData'; export * from './ObjectsDataUpdateParser'; diff --git a/packages/communication/src/messages/parser/room/furniture/AreaHideMessageParser.ts b/packages/communication/src/messages/parser/room/furniture/AreaHideMessageParser.ts new file mode 100644 index 00000000..32591016 --- /dev/null +++ b/packages/communication/src/messages/parser/room/furniture/AreaHideMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '@nitrots/api'; +import { AreaHideMessageData } from '../engine'; + +export class AreaHideMessageParser implements IMessageParser +{ + private _areaData: AreaHideMessageData; + + public flush(): boolean + { + this._areaData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._areaData = new AreaHideMessageData(wrapper); + + return true; + } + + public get areaData(): AreaHideMessageData + { + return this._areaData; + } +} diff --git a/packages/communication/src/messages/parser/room/furniture/index.ts b/packages/communication/src/messages/parser/room/furniture/index.ts index 8cebe4b4..8f288297 100644 --- a/packages/communication/src/messages/parser/room/furniture/index.ts +++ b/packages/communication/src/messages/parser/room/furniture/index.ts @@ -1,6 +1,6 @@ +export * from './AreaHideMessageParser'; export * from './CustomUserNotificationMessageParser'; export * from './DiceValueMessageParser'; -export * from './floor'; export * from './FurniRentOrBuyoutOfferMessageParser'; export * from './FurnitureAliasesParser'; export * from './FurnitureDataParser'; @@ -18,6 +18,7 @@ export * from './RequestSpamWallPostItMessageParser'; export * from './RoomDimmerPresetsMessageData'; export * from './RoomDimmerPresetsMessageParser'; export * from './RoomMessageNotificationMessageParser'; -export * from './wall'; export * from './WelcomeGiftStatusParser'; +export * from './floor'; +export * from './wall'; export * from './youtube'; diff --git a/packages/events/src/room/RoomEngineAreaHideStateEvent.ts b/packages/events/src/room/RoomEngineAreaHideStateEvent.ts new file mode 100644 index 00000000..537fc838 --- /dev/null +++ b/packages/events/src/room/RoomEngineAreaHideStateEvent.ts @@ -0,0 +1,20 @@ +import { RoomEngineTriggerWidgetEvent } from './RoomEngineTriggerWidgetEvent'; + +export class RoomEngineAreaHideStateEvent extends RoomEngineTriggerWidgetEvent +{ + public static UPDATE_STATE_AREA_HIDE: string = 'REAHSE_UPDATE_STATE_AREA_HIDE'; + + private _isOn: boolean; + + constructor(roomId: number, furniId: number, category: number, on: boolean) + { + super(RoomEngineAreaHideStateEvent.UPDATE_STATE_AREA_HIDE, roomId, furniId, category); + + this._isOn = on; + } + + public get isOn(): boolean + { + return this._isOn; + } +} diff --git a/packages/events/src/room/RoomEngineTriggerWidgetEvent.ts b/packages/events/src/room/RoomEngineTriggerWidgetEvent.ts index ba1c8cbd..3a22ef2e 100644 --- a/packages/events/src/room/RoomEngineTriggerWidgetEvent.ts +++ b/packages/events/src/room/RoomEngineTriggerWidgetEvent.ts @@ -23,6 +23,7 @@ export class RoomEngineTriggerWidgetEvent extends RoomEngineObjectEvent public static REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG'; public static REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG'; public static REQUEST_BACKGROUND_COLOR: string = 'RETWE_REQUEST_BACKGROUND_COLOR'; + public static REQUEST_AREA_HIDE: string = 'RETWE_REQUEST_AREA_HIDE'; public static REQUEST_MYSTERYBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYBOX_OPEN_DIALOG'; public static REQUEST_EFFECTBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_EFFECTBOX_OPEN_DIALOG'; public static REQUEST_MYSTERYTROPHY_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYTROPHY_OPEN_DIALOG'; diff --git a/packages/events/src/room/RoomObjectWidgetRequestEvent.ts b/packages/events/src/room/RoomObjectWidgetRequestEvent.ts index 36d50d1b..d71e5fd8 100644 --- a/packages/events/src/room/RoomObjectWidgetRequestEvent.ts +++ b/packages/events/src/room/RoomObjectWidgetRequestEvent.ts @@ -26,6 +26,7 @@ export class RoomObjectWidgetRequestEvent extends RoomObjectEvent public static MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG'; public static PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG'; public static BACKGROUND_COLOR: string = 'ROWRE_BACKGROUND_COLOR'; + public static AREA_HIDE: string = 'ROWRE_AREA_HIDE'; public static MYSTERYBOX_OPEN_DIALOG: string = 'ROWRE_MYSTERYBOX_OPEN_DIALOG'; public static EFFECTBOX_OPEN_DIALOG: string = 'ROWRE_EFFECTBOX_OPEN_DIALOG'; public static MYSTERYTROPHY_OPEN_DIALOG: string = 'ROWRE_MYSTERYTROPHY_OPEN_DIALOG'; diff --git a/packages/events/src/room/index.ts b/packages/events/src/room/index.ts index 6c25618f..2ba9082c 100644 --- a/packages/events/src/room/index.ts +++ b/packages/events/src/room/index.ts @@ -1,6 +1,7 @@ export * from './RoomBackgroundColorEvent'; export * from './RoomContentLoadedEvent'; export * from './RoomDragEvent'; +export * from './RoomEngineAreaHideStateEvent'; export * from './RoomEngineDimmerStateEvent'; export * from './RoomEngineEvent'; export * from './RoomEngineObjectEvent'; diff --git a/packages/room/src/RoomEngine.ts b/packages/room/src/RoomEngine.ts index 734a3758..bf142df8 100644 --- a/packages/room/src/RoomEngine.ts +++ b/packages/room/src/RoomEngine.ts @@ -1,7 +1,7 @@ -import { IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomRenderer, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, ObjectDataFactory, PetFigureData, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum } from '@nitrots/api'; +import { IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IObjectData, IPetColorResult, IPetCustomPart, IRoomAreaSelectionManager, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomRenderer, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, ObjectDataFactory, PetFigureData, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum } from '@nitrots/api'; import { GetCommunication, RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer } from '@nitrots/communication'; import { GetConfiguration } from '@nitrots/configuration'; -import { BadgeImageReadyEvent, GetEventDispatcher, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '@nitrots/events'; +import { BadgeImageReadyEvent, GetEventDispatcher, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineAreaHideStateEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '@nitrots/events'; import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session'; import { FurniId, GetTickerTime, NitroLogger, NumberBank, TextureUtils, Vector3d } from '@nitrots/utils'; import { Container, Matrix, Point, Rectangle, RenderTexture, Sprite, Texture, Ticker } from 'pixi.js'; @@ -17,6 +17,7 @@ import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, Ob import { RoomLogic, RoomMapData } from './object'; import { RoomRenderer } from './renderer'; import { RoomCamera, RoomData, RoomEnterEffect, RoomFurnitureData, RoomGeometry, RoomInstanceData, RoomObjectBadgeImageAssetListener } from './utils'; +import { RoomAreaSelectionManager } from './utils/RoomAreaSelectionManager'; export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver { @@ -55,6 +56,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService private _activeRoomDragStartY: number = 0; private _activeRoomDragX: number = 0; private _activeRoomDragY: number = 0; + private _moveBlocked: boolean = false; private _roomDraggingAlwaysCenters: boolean = false; private _roomAllowsDragging: boolean = true; private _roomDatas: Map = new Map(); @@ -62,6 +64,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService private _skipFurnitureCreationForNextFrame: boolean = false; private _mouseCursorUpdate: boolean = false; private _badgeListenerObjects: Map = new Map(); + private _areaSelectionManager: IRoomAreaSelectionManager = new RoomAreaSelectionManager(this); public async init(): Promise { @@ -543,6 +546,24 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService return true; } + public updateAreaHide(roomId: number, furniId: number, on: boolean, rootX: number, rootY: number, width: number, length: number, invert: boolean): boolean + { + const roomObject = this.getRoomOwnObject(roomId); + + if(!roomObject || !roomObject.logic) return false; + + GetEventDispatcher().dispatchEvent(new RoomEngineAreaHideStateEvent(roomId, furniId, RoomObjectCategory.FLOOR, on)); + + if(on) + { + roomObject.logic.processUpdateMessage(new ObjectRoomFloorHoleUpdateMessage(ObjectRoomFloorHoleUpdateMessage.ADD, furniId, rootX, rootY, width, length, invert)); + } + else + { + roomObject.logic.processUpdateMessage(new ObjectRoomFloorHoleUpdateMessage(ObjectRoomFloorHoleUpdateMessage.REMOVE, furniId)); + } + } + public updateObjectRoomColor(roomId: number, color: number, light: number, backgroundOnly: boolean): boolean { const roomObject = this.getRoomOwnObject(roomId); @@ -680,7 +701,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService while((pendingData = instanceData.getNextPendingFurnitureFloor())) { - furnitureAdded = this.processPendingFurnitureFloor(instanceData.roomId, pendingData.id, pendingData); + furnitureAdded = this.addObjectFurnitureFromData(instanceData.roomId, pendingData.id, pendingData); if(hasTickLimit) { @@ -700,7 +721,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService while(!this._skipFurnitureCreationForNextFrame && (pendingData = instanceData.getNextPendingFurnitureWall())) { - furnitureAdded = this.processPendingFurnitureWall(instanceData.roomId, pendingData.id, pendingData); + furnitureAdded = this.addObjectWallItemFromData(instanceData.roomId, pendingData.id, pendingData); if(hasTickLimit) { @@ -729,7 +750,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService } } - private processPendingFurnitureFloor(roomId: number, id: number, data: RoomFurnitureData): boolean + private addObjectFurnitureFromData(roomId: number, id: number, data: RoomFurnitureData): boolean { if(!data) { @@ -790,7 +811,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService return true; } - private processPendingFurnitureWall(roomId: number, id: number, data: RoomFurnitureData): boolean + private addObjectWallItemFromData(roomId: number, id: number, data: RoomFurnitureData): boolean { if(!data) { @@ -1435,12 +1456,12 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService switch(category) { case RoomObjectCategory.FLOOR: - this.processPendingFurnitureFloor(this.getRoomIdFromString(roomId), objectId, null); + this.addObjectFurnitureFromData(this.getRoomIdFromString(roomId), objectId, null); roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController); break; case RoomObjectCategory.WALL: - this.processPendingFurnitureWall(this.getRoomIdFromString(roomId), objectId, null); + this.addObjectWallItemFromData(this.getRoomIdFromString(roomId), objectId, null); roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController); break; @@ -2168,33 +2189,37 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService sprite.y = (y - (rectangle.height / 2)); } - if(!this.handleRoomDragging(canvas, x, y, type, altKey, ctrlKey, shiftKey)) + if(type === MouseEventType.MOUSE_CLICK && this._areaSelectionManager.finishSelecting()) { - if(!canvas.handleMouseEvent(x, y, type, altKey, ctrlKey, shiftKey, buttonDown)) + this._areaSelectionManager.finishSelecting(); + } + else + { + if(!this.handleRoomDragging(canvas, x, y, type, altKey, ctrlKey, shiftKey)) { - let eventType: string = null; - - if(type === MouseEventType.MOUSE_CLICK) + if(!canvas.handleMouseEvent(x, y, type, altKey, ctrlKey, shiftKey, buttonDown)) { - if(GetEventDispatcher()) + let eventType: string = null; + + if(type === MouseEventType.MOUSE_CLICK) { GetEventDispatcher().dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, this._activeRoomId, -1, RoomObjectCategory.MINIMUM)); + + eventType = RoomObjectMouseEvent.CLICK; + } + else + { + if(type === MouseEventType.MOUSE_MOVE) eventType = RoomObjectMouseEvent.MOUSE_MOVE; + + else if(type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN; + + else if(type === MouseEventType.MOUSE_DOWN_LONG) eventType = RoomObjectMouseEvent.MOUSE_DOWN_LONG; + + else if(type === MouseEventType.MOUSE_UP) eventType = RoomObjectMouseEvent.MOUSE_UP; } - eventType = RoomObjectMouseEvent.CLICK; + this._roomObjectEventHandler.handleRoomObjectEvent(new RoomObjectMouseEvent(eventType, this.getRoomObject(this._activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM), null, altKey), this._activeRoomId); } - else - { - if(type === MouseEventType.MOUSE_MOVE) eventType = RoomObjectMouseEvent.MOUSE_MOVE; - - else if(type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN; - - else if(type === MouseEventType.MOUSE_DOWN_LONG) eventType = RoomObjectMouseEvent.MOUSE_DOWN_LONG; - - else if(type === MouseEventType.MOUSE_UP) eventType = RoomObjectMouseEvent.MOUSE_UP; - } - - this._roomObjectEventHandler.handleRoomObjectEvent(new RoomObjectMouseEvent(eventType, this.getRoomObject(this._activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM), null, altKey), this._activeRoomId); } } @@ -2205,6 +2230,16 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService private handleRoomDragging(canvas: IRoomRenderingCanvas, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean): boolean { + if(this.isPlayingGame()) return false; + + if(this._areaSelectionManager.areaSelectionState === RoomAreaSelectionManager.SELECTING) + { + this._activeRoomIsDragged = false; + this._activeRoomWasDragged = false; + + return false; + }; + let offsetX = (x - this._activeRoomActiveCanvasMouseX); let offsetY = (y - this._activeRoomActiveCanvasMouseY); @@ -3223,6 +3258,11 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService this._roomManager = manager; } + public get areaSelectionManager(): IRoomAreaSelectionManager + { + return this._areaSelectionManager; + } + public get objectEventHandler(): RoomObjectEventHandler { return this._roomObjectEventHandler; @@ -3258,4 +3298,24 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService return this._roomManager.getRoomInstance(roomId.toString()).getRoomObjectsForCategory(categoryId).length; } + + public get moveBlocked(): boolean + { + return this._moveBlocked; + } + + public set moveBlocked(flag: boolean) + { + this._moveBlocked = flag; + } + + public isAreaSelectionMode(): boolean + { + return this._areaSelectionManager.areaSelectionState !== RoomAreaSelectionManager.NOT_ACTIVE; + } + + public whereYouClickIsWhereYouGo(): boolean + { + return !this.isAreaSelectionMode(); + } } diff --git a/packages/room/src/RoomMessageHandler.ts b/packages/room/src/RoomMessageHandler.ts index 246702b6..246d8241 100644 --- a/packages/room/src/RoomMessageHandler.ts +++ b/packages/room/src/RoomMessageHandler.ts @@ -1,5 +1,5 @@ import { AvatarGuideStatus, IConnection, IRoomCreator, IVector3D, LegacyDataType, ObjectRolling, PetType, RoomObjectType, RoomObjectUserType, RoomObjectVariable } from '@nitrots/api'; -import { DiceValueMessageEvent, FloorHeightMapEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureDataEvent, FurnitureFloorAddEvent, FurnitureFloorDataParser, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateEvent, FurnitureWallAddEvent, FurnitureWallDataParser, FurnitureWallEvent, FurnitureWallRemoveEvent, FurnitureWallUpdateEvent, GetCommunication, GetRoomEntryDataMessageComposer, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionStartedMessageEvent, IgnoreResultEvent, ItemDataUpdateMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OneWayDoorStatusMessageEvent, PetExperienceEvent, PetFigureUpdateEvent, RoomEntryTileMessageEvent, RoomEntryTileMessageParser, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitDanceEvent, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitHandItemEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitNumberEvent, RoomUnitRemoveEvent, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomVisualizationSettingsEvent, UserInfoEvent, YouArePlayingGameEvent } from '@nitrots/communication'; +import { AreaHideMessageEvent, DiceValueMessageEvent, FloorHeightMapEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureDataEvent, FurnitureFloorAddEvent, FurnitureFloorDataParser, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateEvent, FurnitureWallAddEvent, FurnitureWallDataParser, FurnitureWallEvent, FurnitureWallRemoveEvent, FurnitureWallUpdateEvent, GetCommunication, GetRoomEntryDataMessageComposer, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionStartedMessageEvent, IgnoreResultEvent, ItemDataUpdateMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OneWayDoorStatusMessageEvent, PetExperienceEvent, PetFigureUpdateEvent, RoomEntryTileMessageEvent, RoomEntryTileMessageParser, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitDanceEvent, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitHandItemEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitNumberEvent, RoomUnitRemoveEvent, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomVisualizationSettingsEvent, UserInfoEvent, YouArePlayingGameEvent } from '@nitrots/communication'; import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session'; import { Vector3d } from '@nitrots/utils'; import { GetRoomEngine } from './GetRoomEngine'; @@ -47,6 +47,7 @@ export class RoomMessageHandler this._connection.addMessageEvent(new FurnitureDataEvent(this.onFurnitureDataEvent.bind(this))); this._connection.addMessageEvent(new ItemDataUpdateMessageEvent(this.onItemDataUpdateMessageEvent.bind(this))); this._connection.addMessageEvent(new OneWayDoorStatusMessageEvent(this.onOneWayDoorStatusMessageEvent.bind(this))); + this._connection.addMessageEvent(new AreaHideMessageEvent(this.onAreaHideMessageEvent.bind(this))); this._connection.addMessageEvent(new RoomUnitDanceEvent(this.onRoomUnitDanceEvent.bind(this))); this._connection.addMessageEvent(new RoomUnitEffectEvent(this.onRoomUnitEffectEvent.bind(this))); this._connection.addMessageEvent(new RoomUnitEvent(this.onRoomUnitEvent.bind(this))); @@ -555,6 +556,16 @@ export class RoomMessageHandler this._roomEngine.updateRoomObjectFloor(this._currentRoomId, parser.itemId, null, null, parser.state, new LegacyDataType()); } + private onAreaHideMessageEvent(event: AreaHideMessageEvent): void + { + if(!(event instanceof AreaHideMessageEvent) || !event.connection || !this._roomEngine) return; + + const parser = event.getParser(); + const areaData = parser.areaData; + + this._roomEngine.updateAreaHide(this._currentRoomId, areaData.furniId, areaData.on, areaData.rootX, areaData.rootY, areaData.width, areaData.length, areaData.invert); + } + private onDiceValueMessageEvent(event: DiceValueMessageEvent): void { if(!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomEngine) return; diff --git a/packages/room/src/RoomObjectEventHandler.ts b/packages/room/src/RoomObjectEventHandler.ts index 9d6c2a3d..2725f262 100644 --- a/packages/room/src/RoomObjectEventHandler.ts +++ b/packages/room/src/RoomObjectEventHandler.ts @@ -1,5 +1,5 @@ import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IObjectData, IRoomCanvasMouseListener, IRoomEngineServices, IRoomGeometry, IRoomObject, IRoomObjectController, IRoomObjectEventManager, ISelectedRoomObjectData, IVector3D, MouseEventType, RoomObjectCategory, RoomObjectOperationType, RoomObjectPlacementSource, RoomObjectType, RoomObjectUserType, RoomObjectVariable } from '@nitrots/api'; -import { BotPlaceComposer, FurnitureColorWheelComposer, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureFloorUpdateComposer, FurnitureGroupInfoComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePostItPlaceComposer, FurnitureRandomStateComposer, FurnitureWallMultiStateComposer, FurnitureWallUpdateComposer, GetCommunication, GetItemDataComposer, GetResolutionAchievementsMessageComposer, PetMoveComposer, PetPlaceComposer, RemoveWallItemComposer, RoomUnitLookComposer, RoomUnitWalkComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer } from '@nitrots/communication'; +import { BotPlaceComposer, ClickFurniMessageComposer, FurnitureColorWheelComposer, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureFloorUpdateComposer, FurnitureGroupInfoComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePostItPlaceComposer, FurnitureRandomStateComposer, FurnitureWallMultiStateComposer, FurnitureWallUpdateComposer, GetCommunication, GetItemDataComposer, GetResolutionAchievementsMessageComposer, PetMoveComposer, PetPlaceComposer, RemoveWallItemComposer, RoomUnitLookComposer, RoomUnitWalkComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer } from '@nitrots/communication'; import { GetConfiguration } from '@nitrots/configuration'; import { GetEventDispatcher, RoomEngineDimmerStateEvent, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomEngineObjectPlacedOnUserEvent, RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineSamplePlaybackEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomObjectBadgeAssetEvent, RoomObjectDataRequestEvent, RoomObjectDimmerStateUpdateEvent, RoomObjectEvent, RoomObjectFloorHoleEvent, RoomObjectFurnitureActionEvent, RoomObjectHSLColorEnableEvent, RoomObjectHSLColorEnabledEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSamplePlaybackEvent, RoomObjectSoundMachineEvent, RoomObjectStateChangedEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '@nitrots/events'; import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session'; @@ -185,6 +185,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb case RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: case RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR: + case RoomObjectWidgetRequestEvent.AREA_HIDE: case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG: case RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG: case RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG: @@ -265,6 +266,11 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb { if(!event || !event.type) return; + if(event instanceof RoomObjectTileMouseEvent) + { + this._roomEngine.areaSelectionManager.handleTileMouseEvent(event); + } + switch(event.type) { case RoomObjectMouseEvent.CLICK: @@ -291,10 +297,36 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb } } + private clickRoomObject(event: RoomObjectMouseEvent): void + { + if(!event || event.altKey || event.ctrlKey || event.shiftKey) return; + + const objectId = event.objectId; + const objectType = event.objectType; + const category = this._roomEngine.getRoomObjectCategoryForType(objectType); + + if(category === RoomObjectCategory.FLOOR) + { + GetCommunication().connection.send(new ClickFurniMessageComposer(objectId, category)); + + return; + } + + if(category === RoomObjectCategory.WALL) + { + // This packet only sends a negative number to tell the server that its a wall item + GetCommunication().connection.send(new ClickFurniMessageComposer(-Math.abs(objectId), category)); + + return; + } + } + private handleRoomObjectMouseClickEvent(event: RoomObjectMouseEvent, roomId: number): void { if(!event) return; + this.clickRoomObject(event); + let operation = RoomObjectOperationType.OBJECT_UNDEFINED; const selectedData = this.getSelectedRoomObjectData(roomId); @@ -304,7 +336,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb let didWalk = false; let didMove = false; - if(this._whereYouClickIsWhereYouGo) + if(this.whereYouClickIsWhereYouGo()) { if(!operation || (operation === RoomObjectOperationType.OBJECT_UNDEFINED)) { @@ -370,11 +402,20 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb case RoomObjectOperationType.OBJECT_UNDEFINED: if(category === RoomObjectCategory.ROOM) { - if(!didWalk && (event instanceof RoomObjectTileMouseEvent)) this.onRoomObjectTileMouseEvent(roomId, event); + if(!didWalk && (event instanceof RoomObjectTileMouseEvent)) this.handleClickOnTile(roomId, event); } else { - this.setSelectedObject(roomId, event.objectId, category); + if(!this._roomEngine.isAreaSelectionMode() || (category === RoomObjectCategory.UNIT)) + { + this.setSelectedObject(roomId, event.objectId, category); + } + else + { + this.deselectObject(roomId); + + GetEventDispatcher().dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, roomId, -1, RoomObjectCategory.MINIMUM)); + } didMove = false; @@ -507,7 +548,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb else if(event.object && (event.object.id !== -1)) { - if(this._whereYouClickIsWhereYouGo) + if(this.whereYouClickIsWhereYouGo()) { newEvent = this.handleMouseOverObject(category, roomId, event); } @@ -758,6 +799,9 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR: GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, roomId, objectId, objectCategory)); return; + case RoomObjectWidgetRequestEvent.AREA_HIDE: + GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_AREA_HIDE, roomId, objectId, objectCategory)); + return; case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG: GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYBOX_OPEN_DIALOG, roomId, objectId, objectCategory)); return; @@ -1017,13 +1061,15 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb } } - private onRoomObjectTileMouseEvent(roomId: number, event: RoomObjectTileMouseEvent): void + private handleClickOnTile(roomId: number, event: RoomObjectTileMouseEvent): void { + if(!this._roomEngine || this._roomEngine.isDecorating) return; + const session = GetRoomSessionManager().getSession(roomId); if(!session || session.isSpectator) return; - this.sendWalkUpdate(event.tileXAsInt, event.tileYAsInt); + if(!this._roomEngine.moveBlocked) this.sendWalkUpdate(event.tileXAsInt, event.tileYAsInt); } private handleObjectMove(event: RoomObjectMouseEvent, roomId: number): void @@ -1480,14 +1526,12 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb private handleMoveTargetFurni(k: number, _arg_2: RoomObjectMouseEvent): boolean { - if((_arg_2.objectType === RoomObjectUserType.USER) || (_arg_2.objectType === RoomObjectUserType.PET) || (_arg_2.objectType === RoomObjectUserType.BOT) || (_arg_2.objectType === RoomObjectUserType.RENTABLE_BOT) || (_arg_2.objectType === RoomObjectUserType.MONSTER_PLANT)) return; + const roomObject = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR); + const point = this.getActiveSurfaceLocation(roomObject, _arg_2); - const _local_3 = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR); - const _local_4 = this.getActiveSurfaceLocation(_local_3, _arg_2); - - if(_local_4) + if(point && !this._roomEngine.moveBlocked) { - this.sendWalkUpdate(_local_4.x, _local_4.y); + this.sendWalkUpdate(point.x, point.y); return true; } @@ -1548,7 +1592,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb private handleMouseOverTile(k: RoomObjectTileMouseEvent, roomId: number): ObjectTileCursorUpdateMessage { - if(this._whereYouClickIsWhereYouGo) + if(this.whereYouClickIsWhereYouGo()) { return new ObjectTileCursorUpdateMessage(new Vector3d(k.tileXAsInt, k.tileYAsInt, k.tileZAsInt), 0, true, k.eventId); } @@ -2187,4 +2231,9 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb { return this._selectedAvatarId; } + + public whereYouClickIsWhereYouGo(): boolean + { + return this._roomEngine.whereYouClickIsWhereYouGo(); + } } diff --git a/packages/room/src/RoomObjectLogicFactory.ts b/packages/room/src/RoomObjectLogicFactory.ts index 2678a576..d1fa032d 100644 --- a/packages/room/src/RoomObjectLogicFactory.ts +++ b/packages/room/src/RoomObjectLogicFactory.ts @@ -2,7 +2,7 @@ import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory, Roo import { GetEventDispatcher, RoomObjectEvent } from '@nitrots/events'; import { NitroLogger } from '@nitrots/utils'; import { RoomObjectLogicBase } from '../../room'; -import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object'; +import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureAreaHideLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object'; export class RoomObjectLogicFactory implements IRoomObjectLogicFactory { @@ -293,6 +293,9 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory case RoomObjectLogicType.FURNITURE_HABBOWHEEL: logic = FurnitureHabboWheelLogic; break; + case RoomObjectLogicType.FURNITURE_AREA_HIDE: + logic = FurnitureAreaHideLogic; + break; default: logic = FurnitureLogic; break; diff --git a/packages/room/src/messages/ObjectRoomFloorHoleUpdateMessage.ts b/packages/room/src/messages/ObjectRoomFloorHoleUpdateMessage.ts index 42316784..15c5c80b 100644 --- a/packages/room/src/messages/ObjectRoomFloorHoleUpdateMessage.ts +++ b/packages/room/src/messages/ObjectRoomFloorHoleUpdateMessage.ts @@ -11,8 +11,9 @@ export class ObjectRoomFloorHoleUpdateMessage extends RoomObjectUpdateMessage private _y: number; private _width: number; private _height: number; + private _invert: boolean; - constructor(type: string, id: number, x: number = 0, y: number = 0, width: number = 0, height: number = 0) + constructor(type: string, id: number, x: number = 0, y: number = 0, width: number = 0, height: number = 0, invert: boolean = false) { super(null, null); @@ -22,6 +23,7 @@ export class ObjectRoomFloorHoleUpdateMessage extends RoomObjectUpdateMessage this._y = y; this._width = width; this._height = height; + this._invert = invert; } public get type(): string @@ -53,4 +55,9 @@ export class ObjectRoomFloorHoleUpdateMessage extends RoomObjectUpdateMessage { return this._height; } + + public get invert(): boolean + { + return this._invert; + } } diff --git a/packages/room/src/object/RoomMapData.ts b/packages/room/src/object/RoomMapData.ts index 2013364d..8a55d874 100644 --- a/packages/room/src/object/RoomMapData.ts +++ b/packages/room/src/object/RoomMapData.ts @@ -7,7 +7,7 @@ export class RoomMapData implements IRoomMapData private _wallHeight: number; private _fixedWallsHeight: number; private _tileMap: { height: number }[][]; - private _holeMap: { id: number, x: number, y: number, width: number, height: number }[]; + private _holeMap: { id: number, x: number, y: number, width: number, height: number, invert: boolean }[]; private _doors: { x: number, y: number, z: number, dir: number }[]; private _dimensions: { minX: number, maxX: number, minY: number, maxY: number }; @@ -73,7 +73,7 @@ export class RoomMapData implements IRoomMapData return this._tileMap; } - public get holeMap(): { id: number, x: number, y: number, width: number, height: number }[] + public get holeMap(): { id: number, x: number, y: number, width: number, height: number, invert: boolean }[] { return this._holeMap; } diff --git a/packages/room/src/object/RoomPlaneParser.ts b/packages/room/src/object/RoomPlaneParser.ts index 01743282..bf150790 100644 --- a/packages/room/src/object/RoomPlaneParser.ts +++ b/packages/room/src/object/RoomPlaneParser.ts @@ -8,40 +8,177 @@ import { RoomWallData } from './RoomWallData'; export class RoomPlaneParser { + public static TILE_BLOCKED: number = -110; + public static TILE_HOLE: number = -100; private static FLOOR_THICKNESS: number = 0.25; private static WALL_THICKNESS: number = 0.25; private static MAX_WALL_ADDITIONAL_HEIGHT: number = 20; - - public static TILE_BLOCKED: number = -110; - public static TILE_HOLE: number = -100; - private _tileMatrix: number[][]; private _tileMatrixOriginal: number[][]; private _width: number = 0; private _height: number = 0; - private _minX: number = 0; - private _maxX: number = 0; - private _minY: number = 0; - private _maxY: number = 0; private _planes: RoomPlaneData[]; - private _wallHeight: number; - private _wallThicknessMultiplier: number; - private _floorThicknessMultiplier: number; + private _highlights: RoomPlaneData[]; private _fixedWallHeight: number = -1; - private _floorHeight: number = 0; private _floorHoles: Map; + private _floorHolesInverted: Map; private _floorHoleMatrix: boolean[][]; + private floorTiles: number[][]; constructor() { this._tileMatrix = []; this._tileMatrixOriginal = []; + this._highlights = []; this._planes = []; this._floorHoleMatrix = []; this._wallHeight = 3.6; this._wallThicknessMultiplier = 1; this._floorThicknessMultiplier = 1; this._floorHoles = new Map(); + this._floorHolesInverted = new Map(); + } + + private _minX: number = 0; + + public get minX(): number + { + return this._minX; + } + + private _maxX: number = 0; + + public get maxX(): number + { + return this._maxX; + } + + private _minY: number = 0; + + public get minY(): number + { + return this._minY; + } + + private _maxY: number = 0; + + public get maxY(): number + { + return this._maxY; + } + + private _wallHeight: number; + + public get wallHeight(): number + { + if(this._fixedWallHeight != -1) + { + return this._fixedWallHeight + 3.6; + } + return this._wallHeight; + } + + public set wallHeight(k: number) + { + if(k < 0) + { + k = 0; + } + this._wallHeight = k; + } + + private _wallThicknessMultiplier: number; + + public get wallThicknessMultiplier(): number + { + return this._wallThicknessMultiplier; + } + + public set wallThicknessMultiplier(k: number) + { + if(k < 0) + { + k = 0; + } + this._wallThicknessMultiplier = k; + } + + private _floorThicknessMultiplier: number; + + public get floorThicknessMultiplier(): number + { + return this._floorThicknessMultiplier; + } + + public set floorThicknessMultiplier(k: number) + { + if(k < 0) + { + k = 0; + } + this._floorThicknessMultiplier = k; + } + + private _floorHeight: number = 0; + + public get floorHeight(): number + { + if(this._fixedWallHeight != -1) + { + return this._fixedWallHeight; + } + return this._floorHeight; + } + + private _restrictsDragging: boolean; + + public get restrictsDragging(): boolean + { + return this._restrictsDragging; + } + + public set restrictsDragging(flag: boolean) + { + this._restrictsDragging = flag; + } + + private _restrictsScaling: boolean = false; + + public get restrictsScaling(): boolean + { + return this._restrictsScaling; + } + + public set restrictsScaling(flag: boolean) + { + this._restrictsScaling = flag; + } + + private _restrictedScale: number = 1; + + public get restrictedScale(): number + { + return this._restrictedScale; + } + + public set restrictedScale(scale: number) + { + this._restrictedScale = scale; + } + + public get tileMapWidth(): number + { + return this._width; + } + + public get tileMapHeight(): number + { + return this._height; + } + + public get planeCount(): number + { + return this._planes.length; } private static getFloorHeight(matricies: number[][]): number @@ -287,97 +424,6 @@ export class RoomPlaneParser k.unshift(_local_2); } - - public get minX(): number - { - return this._minX; - } - - public get maxX(): number - { - return this._maxX; - } - - public get minY(): number - { - return this._minY; - } - - public get maxY(): number - { - return this._maxY; - } - - public get tileMapWidth(): number - { - return this._width; - } - - public get tileMapHeight(): number - { - return this._height; - } - - public get planeCount(): number - { - return this._planes.length; - } - - public get floorHeight(): number - { - if(this._fixedWallHeight != -1) - { - return this._fixedWallHeight; - } - return this._floorHeight; - } - - public get wallHeight(): number - { - if(this._fixedWallHeight != -1) - { - return this._fixedWallHeight + 3.6; - } - return this._wallHeight; - } - - public set wallHeight(k: number) - { - if(k < 0) - { - k = 0; - } - this._wallHeight = k; - } - - public get wallThicknessMultiplier(): number - { - return this._wallThicknessMultiplier; - } - - public set wallThicknessMultiplier(k: number) - { - if(k < 0) - { - k = 0; - } - this._wallThicknessMultiplier = k; - } - - public get floorThicknessMultiplier(): number - { - return this._floorThicknessMultiplier; - } - - public set floorThicknessMultiplier(k: number) - { - if(k < 0) - { - k = 0; - } - this._floorThicknessMultiplier = k; - } - public dispose(): void { this._planes = null; @@ -389,6 +435,11 @@ export class RoomPlaneParser this._floorHoles.clear(); this._floorHoles = null; } + if(this._floorHolesInverted != null) + { + this._floorHolesInverted.clear(); + this._floorHolesInverted = null; + } } public reset(): void @@ -555,30 +606,6 @@ export class RoomPlaneParser return Math.abs(_local_3[k]); } - private getTileHeightOriginal(k: number, _arg_2: number): number - { - if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) - { - return RoomPlaneParser.TILE_BLOCKED; - } - if(this._floorHoleMatrix[_arg_2][k]) - { - return RoomPlaneParser.TILE_HOLE; - } - const _local_3 = this._tileMatrixOriginal[_arg_2]; - return _local_3[k]; - } - - private getTileHeightInternal(k: number, _arg_2: number): number - { - if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) - { - return RoomPlaneParser.TILE_BLOCKED; - } - const _local_3 = this._tileMatrix[_arg_2]; - return _local_3[k]; - } - public initializeFromTileData(k: number = -1): boolean { let _local_2: number; @@ -617,6 +644,365 @@ export class RoomPlaneParser return this.initialize(_local_4); } + public initializeHighlightArea(param1: number, param2: number, param3: number, param4: number): void + { + this.clearHighlightArea(); + this.extractPlanes(this.floorTiles, param1 * 4, param2 * 4, param3 * 4, param4 * 4, true); + } + + public clearHighlightArea(): number + { + const highLightsLength: number = this._highlights.length; + this._planes = this._planes.slice(0, this._planes.length - this._highlights.length); + this._highlights.length = 0; + return highLightsLength; + } + + public initializeFromMapData(data: RoomMapData): boolean + { + if(!data) return false; + + this.reset(); + + this.resetFloorHoles(); + + const width = data.width; + const height = data.height; + const wallHeight = data.wallHeight; + const fixedWallsHeight = data.fixedWallsHeight; + + this.initializeTileMap(width, height); + + if(data.tileMap) + { + let y = 0; + + while(y < data.tileMap.length) + { + const row = data.tileMap[y]; + + if(row) + { + let x = 0; + + while(x < row.length) + { + const column = row[x]; + + if(column) this.setTileHeight(x, y, column.height); + + x++; + } + } + + y++; + } + } + + if(data.holeMap && data.holeMap.length) + { + let index = 0; + + while(index < data.holeMap.length) + { + const hole = data.holeMap[index]; + + if(!hole) continue; + + this.addFloorHole(hole.id, hole.x, hole.y, hole.width, hole.height, hole.invert); + + index++; + } + + this.initializeHoleMap(); + } + + this.wallHeight = wallHeight; + + this.initializeFromTileData(fixedWallsHeight); + + return true; + } + + public isPlaneTemporaryHighlighter(param1: number): boolean + { + if(param1 < 0 || param1 >= this.planeCount) + { + return false; + } + + const _loc2_: RoomPlaneData = this._planes[param1]; + + if(_loc2_ == null) + { + return false; + } + + return this._highlights.indexOf(_loc2_) != -1; + } + + public getMapData(): RoomMapData + { + const data = new RoomMapData(); + + data.width = this._width; + data.height = this._height; + data.wallHeight = this._wallHeight; + data.fixedWallsHeight = this._fixedWallHeight; + data.dimensions.minX = this.minX; + data.dimensions.maxX = this.maxX; + data.dimensions.minY = this.minY; + data.dimensions.maxY = this.maxY; + + let y = 0; + + while(y < this._height) + { + const tileRow: { height: number }[] = []; + const tileMatrix = this._tileMatrixOriginal[y]; + + let x = 0; + + while(x < this._width) + { + const tileHeight = tileMatrix[x]; + + tileRow.push({ height: tileHeight }); + + x++; + } + + data.tileMap.push(tileRow); + + y++; + } + + for(const [ holeId, holeData ] of this._floorHoles.entries()) + { + if(!holeData) continue; + + data.holeMap.push({ + id: holeId, + x: holeData.x, + y: holeData.y, + width: holeData.width, + height: holeData.height, + invert: false, + }); + } + + for(const [ holeId, holeData ] of this._floorHolesInverted.entries()) + { + if(!holeData) continue; + + data.holeMap.push({ + id: holeId, + x: holeData.x, + y: holeData.y, + width: holeData.width, + height: holeData.height, + invert: true, + }); + } + + return data; + } + + public getPlaneLocation(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.loc; + } + + public getPlaneNormal(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.normal; + } + + public getPlaneLeftSide(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.leftSide; + } + + public getPlaneRightSide(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.rightSide; + } + + public getPlaneNormalDirection(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.normalDirection; + } + + public getPlaneSecondaryNormals(k: number): IVector3D[] + { + let _local_3: IVector3D[]; + let _local_4: number; + if(((k < 0) || (k >= this.planeCount))) + { + return null; + } + const _local_2: RoomPlaneData = (this._planes[k]); + if(_local_2 != null) + { + _local_3 = []; + _local_4 = 0; + while(_local_4 < _local_2.secondaryNormalCount) + { + _local_3.push(_local_2.getSecondaryNormal(_local_4)); + _local_4++; + } + return _local_3; + } + return null; + } + + public getPlaneType(k: number): number + { + if(((k < 0) || (k >= this.planeCount))) return RoomPlaneData.PLANE_UNDEFINED; + + const planeData = this._planes[k]; + + if(!planeData) return RoomPlaneData.PLANE_UNDEFINED; + + return planeData.type; + } + + public getPlaneMaskCount(k: number): number + { + if(((k < 0) || (k >= this.planeCount))) return 0; + + const planeData = this._planes[k]; + + if(!planeData) return 0; + + return planeData.maskCount; + } + + public getPlaneMaskLeftSideLoc(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskLeftSideLoc(_arg_2); + } + + public getPlaneMaskRightSideLoc(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskRightSideLoc(_arg_2); + } + + public getPlaneMaskLeftSideLength(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskLeftSideLength(_arg_2); + } + + public getPlaneMaskRightSideLength(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskRightSideLength(_arg_2); + } + + public addFloorHole(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: number, _arg_6: boolean = false): void + { + this.removeFloorHole(k); + + if(_arg_6) + { + this._floorHolesInverted.set(k, new RoomFloorHole(_arg_2, _arg_3, _arg_4, _arg_5)); + } + else + { + this._floorHoles.set(k, new RoomFloorHole(_arg_2, _arg_3, _arg_4, _arg_5)); + } + + } + + public removeFloorHole(k: number): void + { + this._floorHoles.delete(k); + this._floorHolesInverted.delete(k); + } + + public resetFloorHoles(): void + { + this._floorHoles.clear(); + this._floorHolesInverted.clear(); + } + + private getTileHeightOriginal(k: number, _arg_2: number): number + { + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + { + return RoomPlaneParser.TILE_BLOCKED; + } + if(this._floorHoleMatrix[_arg_2][k]) + { + return RoomPlaneParser.TILE_HOLE; + } + const _local_3 = this._tileMatrixOriginal[_arg_2]; + return _local_3[k]; + } + + private getTileHeightInternal(k: number, _arg_2: number): number + { + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + { + return RoomPlaneParser.TILE_BLOCKED; + } + const _local_3 = this._tileMatrix[_arg_2]; + return _local_3[k]; + } + private initialize(k: Point): boolean { let _local_2 = 0; @@ -634,8 +1020,8 @@ export class RoomPlaneParser RoomPlaneParser.padHeightMap(_local_3); RoomPlaneParser.addTileTypes(_local_3); RoomPlaneParser.unpadHeightMap(_local_3); - const _local_5 = RoomPlaneParser.expandFloorTiles(_local_3); - this.extractPlanes(_local_5); + this.floorTiles = RoomPlaneParser.expandFloorTiles(_local_3); + this.extractPlanes(this.floorTiles); if(k != null) { this.setTileHeight(k.x, k.y, _local_2); @@ -653,7 +1039,7 @@ export class RoomPlaneParser let _local_11: Point; let _local_12: number; const _local_3: RoomWallData = new RoomWallData(); - const _local_4: Function[] = [this.extractTopWall.bind(this), this.extractRightWall.bind(this), this.extractBottomWall.bind(this), this.extractLeftWall.bind(this)]; + const _local_4: Function[] = [ this.extractTopWall.bind(this), this.extractRightWall.bind(this), this.extractBottomWall.bind(this), this.extractLeftWall.bind(this) ]; let _local_5 = 0; let _local_6: Point = new Point(k.x, k.y); let _local_7 = 0; @@ -1165,34 +1551,34 @@ export class RoomPlaneParser private addWall(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: boolean, _arg_6: boolean, _arg_7: boolean): void { - this.addPlane(RoomPlaneData.PLANE_WALL, k, _arg_2, _arg_3, [_arg_4]); - this.addPlane(RoomPlaneData.PLANE_LANDSCAPE, k, _arg_2, _arg_3, [_arg_4]); + this.addPlane(RoomPlaneData.PLANE_WALL, k, _arg_2, _arg_3, [ _arg_4 ]); + this.addPlane(RoomPlaneData.PLANE_LANDSCAPE, k, _arg_2, _arg_3, [ _arg_4 ]); const _local_8: number = (RoomPlaneParser.WALL_THICKNESS * this._wallThicknessMultiplier); const _local_9: number = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier); const _local_10: Vector3d = Vector3d.crossProduct(_arg_2, _arg_3); const _local_11: Vector3d = Vector3d.product(_local_10, ((1 / _local_10.length) * -(_local_8))); - this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, _arg_3), _arg_2, _local_11, [_local_10, _arg_4]); + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, _arg_3), _arg_2, _local_11, [ _local_10, _arg_4 ]); if(_arg_5) { - this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_2), _arg_3), Vector3d.product(_arg_3, (-(_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_2), _arg_3), Vector3d.product(_arg_3, (-(_arg_3.length + _local_9) / _arg_3.length)), _local_11, [ _local_10, _arg_4 ]); } if(_arg_6) { - this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, Vector3d.product(_arg_3, (-(_local_9) / _arg_3.length))), Vector3d.product(_arg_3, ((_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, Vector3d.product(_arg_3, (-(_local_9) / _arg_3.length))), Vector3d.product(_arg_3, ((_arg_3.length + _local_9) / _arg_3.length)), _local_11, [ _local_10, _arg_4 ]); if(_arg_7) { const _local_12 = Vector3d.product(_arg_2, (_local_8 / _arg_2.length)); - this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_3), Vector3d.product(_local_12, -1)), _local_12, _local_11, [_local_10, _arg_2, _arg_4]); + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_3), Vector3d.product(_local_12, -1)), _local_12, _local_11, [ _local_10, _arg_2, _arg_4 ]); } } } - private addFloor(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: boolean, _arg_5: boolean, _arg_6: boolean, _arg_7: boolean): void + private addFloor(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: boolean, _arg_5: boolean, _arg_6: boolean, _arg_7: boolean, param8: boolean = false): void { let _local_9: number; let _local_10: Vector3d; let _local_11: Vector3d; - const _local_8: RoomPlaneData = this.addPlane(RoomPlaneData.PLANE_FLOOR, k, _arg_2, _arg_3); + const _local_8: RoomPlaneData = this.addPlane(RoomPlaneData.PLANE_FLOOR, k, _arg_2, _arg_3, null, param8); if(_local_8 != null) { _local_9 = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier); @@ -1200,90 +1586,24 @@ export class RoomPlaneParser _local_11 = Vector3d.dif(k, _local_10); if(_arg_6) { - this.addPlane(RoomPlaneData.PLANE_FLOOR, _local_11, _arg_2, _local_10); + this.addPlane(RoomPlaneData.PLANE_FLOOR, _local_11, _arg_2, _local_10, null, param8); } if(_arg_7) { - this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, Vector3d.sum(_arg_2, _arg_3)), Vector3d.product(_arg_2, -1), _local_10); + this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, Vector3d.sum(_arg_2, _arg_3)), Vector3d.product(_arg_2, -1), _local_10, null, param8); } if(_arg_4) { - this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_3), Vector3d.product(_arg_3, -1), _local_10); + this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_3), Vector3d.product(_arg_3, -1), _local_10, null, param8); } if(_arg_5) { - this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_2), _arg_3, _local_10); + this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_2), _arg_3, _local_10, null, param8); } } } - public initializeFromMapData(data: RoomMapData): boolean - { - if(!data) return false; - - this.reset(); - - this.resetFloorHoles(); - - const width = data.width; - const height = data.height; - const wallHeight = data.wallHeight; - const fixedWallsHeight = data.fixedWallsHeight; - - this.initializeTileMap(width, height); - - if(data.tileMap) - { - let y = 0; - - while(y < data.tileMap.length) - { - const row = data.tileMap[y]; - - if(row) - { - let x = 0; - - while(x < row.length) - { - const column = row[x]; - - if(column) this.setTileHeight(x, y, column.height); - - x++; - } - } - - y++; - } - } - - if(data.holeMap && data.holeMap.length) - { - let index = 0; - - while(index < data.holeMap.length) - { - const hole = data.holeMap[index]; - - if(!hole) continue; - - this.addFloorHole(hole.id, hole.x, hole.y, hole.width, hole.height); - - index++; - } - - this.initializeHoleMap(); - } - - this.wallHeight = wallHeight; - - this.initializeFromTileData(fixedWallsHeight); - - return true; - } - - private addPlane(k: number, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D[] = null): RoomPlaneData + private addPlane(k: number, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D[] = null, param6: boolean = false): RoomPlaneData { if(((_arg_3.length == 0) || (_arg_4.length == 0))) { @@ -1291,223 +1611,12 @@ export class RoomPlaneParser } const _local_6: RoomPlaneData = new RoomPlaneData(k, _arg_2, _arg_3, _arg_4, _arg_5); this._planes.push(_local_6); + + if(param6) this._highlights.push(_local_6); + return _local_6; } - public getMapData(): RoomMapData - { - const data = new RoomMapData(); - - data.width = this._width; - data.height = this._height; - data.wallHeight = this._wallHeight; - data.fixedWallsHeight = this._fixedWallHeight; - data.dimensions.minX = this.minX; - data.dimensions.maxX = this.maxX; - data.dimensions.minY = this.minY; - data.dimensions.maxY = this.maxY; - - let y = 0; - - while(y < this._height) - { - const tileRow: { height: number }[] = []; - const tileMatrix = this._tileMatrixOriginal[y]; - - let x = 0; - - while(x < this._width) - { - const tileHeight = tileMatrix[x]; - - tileRow.push({ height: tileHeight }); - - x++; - } - - data.tileMap.push(tileRow); - - y++; - } - - for(const [holeId, holeData] of this._floorHoles.entries()) - { - if(!holeData) continue; - - data.holeMap.push({ - id: holeId, - x: holeData.x, - y: holeData.y, - width: holeData.width, - height: holeData.height - }); - } - - return data; - } - - public getPlaneLocation(k: number): IVector3D - { - if(((k < 0) || (k >= this.planeCount))) return null; - - const planeData = this._planes[k]; - - if(!planeData) return null; - - return planeData.loc; - } - - public getPlaneNormal(k: number): IVector3D - { - if(((k < 0) || (k >= this.planeCount))) return null; - - const planeData = this._planes[k]; - - if(!planeData) return null; - - return planeData.normal; - } - - public getPlaneLeftSide(k: number): IVector3D - { - if(((k < 0) || (k >= this.planeCount))) return null; - - const planeData = this._planes[k]; - - if(!planeData) return null; - - return planeData.leftSide; - } - - public getPlaneRightSide(k: number): IVector3D - { - if(((k < 0) || (k >= this.planeCount))) return null; - - const planeData = this._planes[k]; - - if(!planeData) return null; - - return planeData.rightSide; - } - - public getPlaneNormalDirection(k: number): IVector3D - { - if(((k < 0) || (k >= this.planeCount))) return null; - - const planeData = this._planes[k]; - - if(!planeData) return null; - - return planeData.normalDirection; - } - - public getPlaneSecondaryNormals(count: number): IVector3D[] - { - if((count < 0) || (count >= this.planeCount)) return null; - - const planes = this._planes[count]; - - if(planes != null) - { - const normals: IVector3D[] = []; - let i = 0; - - while(i < planes.secondaryNormalCount) - { - normals.push(planes.getSecondaryNormal(i)); - - i++; - } - - return normals; - } - - return null; - } - - public getPlaneType(k: number): number - { - if(((k < 0) || (k >= this.planeCount))) return RoomPlaneData.PLANE_UNDEFINED; - - const planeData = this._planes[k]; - - if(!planeData) return RoomPlaneData.PLANE_UNDEFINED; - - return planeData.type; - } - - public getPlaneMaskCount(k: number): number - { - if(((k < 0) || (k >= this.planeCount))) return 0; - - const planeData = this._planes[k]; - - if(!planeData) return 0; - - return planeData.maskCount; - } - - public getPlaneMaskLeftSideLoc(k: number, _arg_2: number): number - { - if(((k < 0) || (k >= this.planeCount))) return -1; - - const planeData = this._planes[k]; - - if(!planeData) return -1; - - return planeData.getMaskLeftSideLoc(_arg_2); - } - - public getPlaneMaskRightSideLoc(k: number, _arg_2: number): number - { - if(((k < 0) || (k >= this.planeCount))) return -1; - - const planeData = this._planes[k]; - - if(!planeData) return -1; - - return planeData.getMaskRightSideLoc(_arg_2); - } - - public getPlaneMaskLeftSideLength(k: number, _arg_2: number): number - { - if(((k < 0) || (k >= this.planeCount))) return -1; - - const planeData = this._planes[k]; - - if(!planeData) return -1; - - return planeData.getMaskLeftSideLength(_arg_2); - } - - public getPlaneMaskRightSideLength(k: number, _arg_2: number): number - { - if(((k < 0) || (k >= this.planeCount))) return -1; - - const planeData = this._planes[k]; - - if(!planeData) return -1; - - return planeData.getMaskRightSideLength(_arg_2); - } - - public addFloorHole(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: number): void - { - this.removeFloorHole(k); - - this._floorHoles.set(k, new RoomFloorHole(_arg_2, _arg_3, _arg_4, _arg_5)); - } - - public removeFloorHole(k: number): void - { - this._floorHoles.delete(k); - } - - public resetFloorHoles(): void - { - this._floorHoles.clear(); - } - private initializeHoleMap(): void { let k: number; @@ -1525,138 +1634,158 @@ export class RoomPlaneParser k = 0; while(k < this._width) { - _local_3[k] = false; + _local_3[k] = this._floorHolesInverted.size > 0; k++; } _local_2++; } + for(const _local_4 of this._floorHolesInverted.values()) + { + this.initializeHole(_local_4, true); + } for(const _local_4 of this._floorHoles.values()) { - _local_5 = _local_4; - if(_local_5 != null) - { - _local_6 = _local_5.x; - _local_7 = ((_local_5.x + _local_5.width) - 1); - _local_8 = _local_5.y; - _local_9 = ((_local_5.y + _local_5.height) - 1); - _local_6 = ((_local_6 < 0) ? 0 : _local_6); - _local_7 = ((_local_7 >= this._width) ? (this._width - 1) : _local_7); - _local_8 = ((_local_8 < 0) ? 0 : _local_8); - _local_9 = ((_local_9 >= this._height) ? (this._height - 1) : _local_9); - _local_2 = _local_8; - while(_local_2 <= _local_9) - { - _local_3 = this._floorHoleMatrix[_local_2]; - k = _local_6; - while(k <= _local_7) - { - _local_3[k] = true; - k++; - } - _local_2++; - } - } + this.initializeHole(_local_4); } } - private extractPlanes(k: number[][]): void + private initializeHole(param1: RoomFloorHole, param2: boolean = false): void { + let k: number; + let _local_2: number; + let _local_3: boolean[]; + let _local_6: number; let _local_7: number; let _local_8: number; let _local_9: number; - let _local_10: number; - let _local_11: boolean; - let _local_12: boolean; - let _local_13: boolean; - let _local_14: boolean; - let _local_15: number; - let _local_16: number; - let _local_17: boolean; - let _local_18: number; - let _local_19: number; - let _local_20: number; - let _local_21: number; - - const _local_2 = k.length; - - const _local_3: number = k[0].length; - const _local_4: boolean[][] = []; - let _local_5 = 0; - while(_local_5 < _local_2) + const _local_5: RoomFloorHole = param1; + if(_local_5 != null) { - _local_4[_local_5] = []; - _local_5++; - } - let _local_6 = 0; - while(_local_6 < _local_2) - { - _local_7 = 0; - while(_local_7 < _local_3) + _local_6 = _local_5.x; + _local_7 = ((_local_5.x + _local_5.width) - 1); + _local_8 = _local_5.y; + _local_9 = ((_local_5.y + _local_5.height) - 1); + _local_6 = ((_local_6 < 0) ? 0 : _local_6); + _local_7 = ((_local_7 >= this._width) ? (this._width - 1) : _local_7); + _local_8 = ((_local_8 < 0) ? 0 : _local_8); + _local_9 = ((_local_9 >= this._height) ? (this._height - 1) : _local_9); + _local_2 = _local_8; + while(_local_2 <= _local_9) { - _local_8 = k[_local_6][_local_7]; - if(((_local_8 < 0) || (_local_4[_local_6][_local_7]))) + _local_3 = this._floorHoleMatrix[_local_2]; + k = _local_6; + while(k <= _local_7) { - // + _local_3[k] = !param2; + k++; } - else + _local_2++; + } + } + } + + private extractPlanes(param1: number[][], param2: number = 0, param3: number = 0, param4: number = -1, param5: number = -1, param6: boolean = false): void + { + let _loc13_ = 0; + let _loc24_ = 0; + let _loc25_ = 0; + let _loc9_ = 0; + let _loc19_ = 0; + let _loc16_ = 0; + let _loc10_ = false; + let _loc8_ = false; + let _loc20_ = false; + let _loc12_ = false; + let _loc21_ = 0; + let _loc23_ = 0; + let _loc11_ = false; + let _loc15_ = NaN; + let _loc17_ = NaN; + let _loc18_ = NaN; + let _loc28_ = NaN; + const _loc14_: number = param1.length; + const _loc26_: number = param1[0].length; + const _loc27_: number = param5 == -1 ? _loc14_ : Math.min(_loc14_, param3 + param5); + const _loc22_: number = param4 == -1 ? _loc26_ : Math.min(_loc26_, param2 + param4); + const _loc7_: boolean[][] = []; + _loc13_ = 0; + while(_loc13_ < _loc27_) + { + _loc7_[_loc13_] = []; + _loc13_++; + } + _loc24_ = param3; + while(_loc24_ < _loc27_) + { + _loc25_ = param2; + while(_loc25_ < _loc22_) + { + if(!((_loc9_ = param1[_loc24_][_loc25_]) < 0 || _loc7_[_loc24_][_loc25_])) { - _local_11 = ((_local_7 == 0) || (!(k[_local_6][(_local_7 - 1)] == _local_8))); - _local_12 = ((_local_6 == 0) || (!(k[(_local_6 - 1)][_local_7] == _local_8))); - _local_9 = (_local_7 + 1); - while(_local_9 < _local_3) + _loc10_ = _loc25_ == 0 || param1[_loc24_][_loc25_ - 1] != _loc9_; + _loc8_ = _loc24_ == 0 || param1[_loc24_ - 1][_loc25_] != _loc9_; + _loc19_ = _loc25_ + 1; + while(_loc19_ < _loc22_) { - if((((!(k[_local_6][_local_9] == _local_8)) || (_local_4[_local_6][_local_9])) || ((_local_6 > 0) && ((k[(_local_6 - 1)][_local_9] == _local_8) == _local_12)))) + if(param1[_loc24_][_loc19_] != _loc9_ || _loc7_[_loc24_][_loc19_] || _loc24_ > 0 && param1[_loc24_ - 1][_loc19_] == _loc9_ == _loc8_) { break; } - _local_9++; + _loc19_++; } - _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); - _local_17 = false; - _local_10 = (_local_6 + 1); - while(((_local_10 < _local_2) && (!(_local_17)))) + _loc20_ = _loc19_ == _loc26_ || param1[_loc24_][_loc19_] != _loc9_; + _loc11_ = false; + _loc16_ = _loc24_ + 1; + while(_loc16_ <= _loc27_ && !_loc11_) { - _local_14 = (!(k[_local_10][_local_7] == _local_8)); - _local_17 = (((_local_14) || ((_local_7 > 0) && ((k[_local_10][(_local_7 - 1)] == _local_8) == _local_11))) || ((_local_9 < _local_3) && ((k[_local_10][_local_9] == _local_8) == _local_13))); - _local_15 = _local_7; - while(_local_15 < _local_9) + _loc12_ = _loc16_ == _loc14_ || param1[_loc16_][_loc25_] != _loc9_; + _loc11_ = _loc16_ == _loc27_ || _loc12_ || _loc25_ > 0 && param1[_loc16_][_loc25_ - 1] == _loc9_ == _loc10_ || _loc19_ < _loc26_ && param1[_loc16_][_loc19_] == _loc9_ == _loc20_; + if(_loc16_ == _loc14_) { - if((k[_local_10][_local_15] == _local_8) == _local_14) + break; + } + _loc21_ = _loc25_; + while(_loc21_ < _loc19_) + { + if(param1[_loc16_][_loc21_] == _loc9_ == _loc12_) { - _local_17 = true; - _local_9 = _local_15; + _loc11_ = true; + _loc19_ = _loc21_; break; } - _local_15++; + _loc21_++; } - if(_local_17) + if(_loc11_) { break; } - _local_10++; + _loc16_++; } - _local_14 = ((_local_14) || (_local_10 == _local_2)); - _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); - _local_16 = _local_6; - while(_local_16 < _local_10) + if(!_loc12_) { - _local_15 = _local_7; - while(_local_15 < _local_9) - { - _local_4[_local_16][_local_15] = true; - _local_15++; - } - _local_16++; + _loc12_ = _loc16_ == _loc14_; } - _local_18 = ((_local_7 / 4) - 0.5); - _local_19 = ((_local_6 / 4) - 0.5); - _local_20 = ((_local_9 - _local_7) / 4); - _local_21 = ((_local_10 - _local_6) / 4); - this.addFloor(new Vector3d((_local_18 + _local_20), (_local_19 + _local_21), (_local_8 / 4)), new Vector3d(-(_local_20), 0, 0), new Vector3d(0, -(_local_21), 0), _local_13, _local_11, _local_14, _local_12); + _loc20_ = _loc19_ == _loc26_ || param1[_loc24_][_loc19_] != _loc9_; + _loc23_ = _loc24_; + while(_loc23_ < _loc16_) + { + _loc21_ = _loc25_; + while(_loc21_ < _loc19_) + { + _loc7_[_loc23_][_loc21_] = true; + _loc21_++; + } + _loc23_++; + } + _loc15_ = _loc25_ / 4 - 0.5; + _loc17_ = _loc24_ / 4 - 0.5; + _loc18_ = (_loc19_ - _loc25_) / 4; + _loc28_ = (_loc16_ - _loc24_) / 4; + this.addFloor(new Vector3d(_loc15_ + _loc18_, _loc17_ + _loc28_, _loc9_ / 4), new Vector3d(-_loc18_, 0, 0), new Vector3d(0, -_loc28_, 0), _loc20_, _loc10_, _loc12_, _loc8_, param6); } - _local_7++; + _loc25_++; } - _local_6++; + _loc24_++; } } } diff --git a/packages/room/src/object/logic/RoomLogic.ts b/packages/room/src/object/logic/RoomLogic.ts index 22c6835f..97561d5e 100644 --- a/packages/room/src/object/logic/RoomLogic.ts +++ b/packages/room/src/object/logic/RoomLogic.ts @@ -413,12 +413,14 @@ export class RoomLogic extends RoomObjectLogicBase let eventType: string = null; if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE; - else if((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK; + else if(event.type === MouseEventType.MOUSE_CLICK) eventType = RoomObjectMouseEvent.CLICK; + else if(event.type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN; switch(event.type) { case MouseEventType.MOUSE_MOVE: case MouseEventType.ROLL_OVER: + case MouseEventType.MOUSE_DOWN: case MouseEventType.MOUSE_CLICK: { let newEvent: RoomObjectEvent = null; diff --git a/packages/room/src/object/logic/furniture/FurnitureAreaHideLogic.ts b/packages/room/src/object/logic/furniture/FurnitureAreaHideLogic.ts new file mode 100644 index 00000000..5affad46 --- /dev/null +++ b/packages/room/src/object/logic/furniture/FurnitureAreaHideLogic.ts @@ -0,0 +1,96 @@ +import { IRoomGeometry, MouseEventType, NumberDataType, RoomObjectVariable } from '@nitrots/api'; +import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '@nitrots/events'; +import { ObjectDataUpdateMessage, RoomObjectUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureAreaHideLogic extends FurnitureMultiStateLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.AREA_HIDE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(!this.object) return; + + if(message instanceof ObjectDataUpdateMessage) + { + message.data.writeRoomObjectModel(this.object.model); + + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + this.setupObject(); + } + } + } + + private setupObject(): void + { + if(!this.object || !this.object.model) return; + + const numberData = new NumberDataType(); + + numberData.initializeFromRoomObjectModel(this.object.model); + + const state = numberData.getValue(0); + const rootX = numberData.getValue(1); + const rootY = numberData.getValue(2); + const width = numberData.getValue(3); + const length = numberData.getValue(4); + const invisibility = (numberData.getValue(5) === 1); + const wallItems = (numberData.getValue(6) === 1); + const invert = (numberData.getValue(7) === 1); + + this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_ROOT_X, rootX); + this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_ROOT_Y, rootY); + this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_WIDTH, width); + this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_LENGTH, length); + this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_INVISIBILITY, ((invisibility) ? 1 : 0)); + this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_WALL_ITEMS, ((wallItems) ? 1 : 0)); + this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_INVERT, ((invert) ? 1 : 0)); + this.object.setState(state, 0); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.AREA_HIDE, this.object)); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + let objectEvent: RoomObjectEvent = null; + + switch(event.type) + { + case MouseEventType.DOUBLE_CLICK: { + if((event.spriteTag === 'turn_on') || (event.spriteTag === 'turn_off')) + { + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object); + } + else + { + objectEvent = new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.AREA_HIDE, this.object); + } + + if(this.eventDispatcher && objectEvent) + { + this.eventDispatcher.dispatchEvent(objectEvent); + + return; + } + break; + } + } + + super.mouseEvent(event, geometry); + } +} diff --git a/packages/room/src/object/logic/furniture/index.ts b/packages/room/src/object/logic/furniture/index.ts index d548e949..02e57b66 100644 --- a/packages/room/src/object/logic/furniture/index.ts +++ b/packages/room/src/object/logic/furniture/index.ts @@ -1,4 +1,5 @@ export * from './FurnitureAchievementResolutionLogic'; +export * from './FurnitureAreaHideLogic'; export * from './FurnitureBadgeDisplayLogic'; export * from './FurnitureChangeStateWhenStepOnLogic'; export * from './FurnitureClothingChangeLogic'; diff --git a/packages/room/src/object/visualization/RoomObjectSprite.ts b/packages/room/src/object/visualization/RoomObjectSprite.ts index 51b87963..efeb8085 100644 --- a/packages/room/src/object/visualization/RoomObjectSprite.ts +++ b/packages/room/src/object/visualization/RoomObjectSprite.ts @@ -26,6 +26,7 @@ export class RoomObjectSprite implements IRoomObjectSprite private _varyingDepth: boolean = false; private _libraryAssetName: string = ''; private _clickHandling: boolean = false; + private _skipMouseHandling: boolean = false; private _visible: boolean = true; private _tag: string = ''; private _posture: string = null; @@ -352,4 +353,14 @@ export class RoomObjectSprite implements IRoomObjectSprite { return this._updateCounter; } + + public get skipMouseHandling(): boolean + { + return this._skipMouseHandling; + } + + public set skipMouseHandling(flag: boolean) + { + this._skipMouseHandling = flag; + } } diff --git a/packages/room/src/object/visualization/furniture/FurnitureVisualization.ts b/packages/room/src/object/visualization/furniture/FurnitureVisualization.ts index 12c022e5..310ccd3e 100644 --- a/packages/room/src/object/visualization/furniture/FurnitureVisualization.ts +++ b/packages/room/src/object/visualization/furniture/FurnitureVisualization.ts @@ -1,5 +1,5 @@ import { AlphaTolerance, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObjectSprite, RoomObjectVariable, RoomObjectVisualizationType } from '@nitrots/api'; -import { BLEND_MODES, Texture } from 'pixi.js'; +import { BLEND_MODES, Filter, Texture } from 'pixi.js'; import { RoomObjectSpriteVisualization } from '../RoomObjectSpriteVisualization'; import { ColorData, LayerData } from '../data'; import { FurnitureVisualizationData } from './FurnitureVisualizationData'; @@ -38,8 +38,11 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization protected _spriteXOffsets: number[]; protected _spriteYOffsets: number[]; protected _spriteZOffsets: number[]; + protected _filters: Filter[] = []; private _animationNumber: number; + private _lookThrough: boolean; + private _needsLookThroughUpdate: boolean; constructor() { @@ -75,6 +78,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization this._spriteZOffsets = []; this._animationNumber = 0; + this._lookThrough = false; } public initialize(data: IObjectVisualizationData): boolean @@ -104,6 +108,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization this._spriteXOffsets = null; this._spriteYOffsets = null; this._spriteZOffsets = null; + this._filters = []; } protected reset(): void @@ -160,6 +165,12 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization if(this.updateModel(scale)) updateSprites = true; + if(this._needsLookThroughUpdate) + { + updateSprites = true; + this._needsLookThroughUpdate = false; + } + let number = 0; if(skipUpdate) @@ -313,11 +324,15 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization relativeDepth = 1; } + if(this._lookThrough) sprite.alpha *= 0.2; + sprite.relativeDepth = (relativeDepth * FurnitureVisualization.DEPTH_MULTIPLIER); sprite.name = assetName; sprite.libraryAssetName = this.getLibraryAssetNameForSprite(assetData, sprite); sprite.posture = this.getPostureForAsset(scale, assetData.source); sprite.clickHandling = this._clickHandling; + + if(sprite.blendMode !== 'add') sprite.filters = this._filters; } else { @@ -582,6 +597,14 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization return asset?.texture ?? null; } + public set lookThrough(flag: boolean) + { + if(this._lookThrough == flag) return; + + this._lookThrough = flag; + this._needsLookThroughUpdate = true; + } + protected get direction(): number { return this._direction; diff --git a/packages/room/src/object/visualization/room/RoomPlane.ts b/packages/room/src/object/visualization/room/RoomPlane.ts index 3feaa5e9..7ffaa26a 100644 --- a/packages/room/src/object/visualization/room/RoomPlane.ts +++ b/packages/room/src/object/visualization/room/RoomPlane.ts @@ -50,6 +50,8 @@ export class RoomPlane implements IRoomPlane private _hasTexture: boolean = true; private _canBeVisible: boolean = true; private _geometryUpdateId: number = -1; + private _extraDepth: number = 0; + private _isHighlighter: boolean = false; private _useMask: boolean; private _bitmapMasks: RoomPlaneBitmapMask[] = []; @@ -569,7 +571,12 @@ export class RoomPlane implements IRoomPlane public get relativeDepth(): number { - return this._relativeDepth; + return (this._relativeDepth + this._extraDepth); + } + + public set extraDepth(value: number) + { + this._extraDepth = value; } public get color(): number @@ -633,4 +640,14 @@ export class RoomPlane implements IRoomPlane { this._hasTexture = flag; } + + public get isHighlighter(): boolean + { + return this._isHighlighter; + } + + public set isHighlighter(flag: boolean) + { + this._isHighlighter = flag; + } } diff --git a/packages/room/src/object/visualization/room/RoomVisualization.ts b/packages/room/src/object/visualization/room/RoomVisualization.ts index 4c6e7321..101ce236 100644 --- a/packages/room/src/object/visualization/room/RoomVisualization.ts +++ b/packages/room/src/object/visualization/room/RoomVisualization.ts @@ -1,6 +1,6 @@ import { AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType, RoomObjectVariable } from '@nitrots/api'; import { ToInt32, Vector3d } from '@nitrots/utils'; -import { Rectangle, Texture } from 'pixi.js'; +import { Filter, Rectangle, Texture } from 'pixi.js'; import { RoomMapData } from '../../RoomMapData'; import { RoomMapMaskData } from '../../RoomMapMaskData'; import { RoomPlaneBitmapMaskData } from '../../RoomPlaneBitmapMaskData'; @@ -54,6 +54,13 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements private _maskData: RoomMapMaskData = null; private _isPlaneSet: boolean = false; + private _highlightAreaX: number = 0; + private _highlightAreaY: number = 0; + private _highlightAreaWidth: number = 0; + private _highlightAreaHeight: number = 0; + private _highlightFilter: Filter = null; + private _highlightPlaneOffsets: number[] = []; + constructor() { super(); @@ -86,6 +93,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements this._planes = null; this._visiblePlanes = null; this._visiblePlaneSpriteNumbers = null; + this._highlightPlaneOffsets = []; if(this._roomPlaneParser) { @@ -321,6 +329,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements } this._planes = []; + this._highlightPlaneOffsets = []; } this._isPlaneSet = false; @@ -336,19 +345,29 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements if(!isNaN(this._floorThickness)) this._roomPlaneParser.floorThicknessMultiplier = this._floorThickness; if(!isNaN(this._wallThickness)) this._roomPlaneParser.wallThicknessMultiplier = this._wallThickness; + this._roomPlaneParser.clearHighlightArea(); + const mapData = this.object.model.getValue(RoomObjectVariable.ROOM_MAP_DATA); if(!this._roomPlaneParser.initializeFromMapData(mapData)) return; + this._roomPlaneParser.initializeHighlightArea(this._highlightAreaX, this._highlightAreaY, this._highlightAreaWidth, this._highlightAreaHeight); + + this.createPlanesAndSprites(); + } + + private createPlanesAndSprites(offset: number = 0): void + { const maxX = this.getLandscapeWidth(); const maxY = this.getLandscapeHeight(); let landscapeOffsetX = 0; let randomSeed = this.object.model.getValue(RoomObjectVariable.ROOM_RANDOM_SEED); - let index = 0; + let index = offset; while(index < this._roomPlaneParser.planeCount) { + this._highlightPlaneOffsets[index] = -1; const location = this._roomPlaneParser.getPlaneLocation(index); const leftSide = this._roomPlaneParser.getPlaneLeftSide(index); const rightSide = this._roomPlaneParser.getPlaneRightSide(index); @@ -414,6 +433,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements i++; } + this._highlightPlaneOffsets[index] = this._planes.length; this._planes.push(plane); } } @@ -429,6 +449,53 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements this.defineSprites(); } + public initializeHighlightArea(highlightAreaX: number, highlightAreaY: number, highlightAreaWidth: number, highlightAreaHeight: number, highlightFilter: Filter): void + { + this.clearHighlightArea(); + + this._highlightAreaX = highlightAreaX; + this._highlightAreaY = highlightAreaY; + this._highlightAreaWidth = highlightAreaWidth; + this._highlightAreaHeight = highlightAreaHeight; + this._highlightFilter = highlightFilter; + + this._roomPlaneParser.initializeHighlightArea(highlightAreaX, highlightAreaY, highlightAreaWidth, highlightAreaHeight); + + this.createPlanesAndSprites(this._planes.length); + this.reset(); + } + + public clearHighlightArea(): void + { + this._highlightAreaX = 0; + this._highlightAreaY = 0; + this._highlightAreaWidth = 0; + this._highlightAreaHeight = 0; + + const totalHighlightedPlanes = this._roomPlaneParser.clearHighlightArea(); + let _local_4 = 0; + + let _local_1 = this._roomPlaneParser.planeCount; + + while(_local_1 < (this._roomPlaneParser.planeCount + totalHighlightedPlanes)) + { + const _local_2 = this._highlightPlaneOffsets[_local_1]; + + if(_local_2 !== -1) + { + _local_4 = (_local_4 + 1); + this._highlightPlaneOffsets[_local_1] = -1; + }; + + _local_1 = (_local_1 + 1); + }; + + this._planes = this._planes.slice(0, (this._planes.length - _local_4)); + this.createSprites(this._planes.length); + + this.reset(); + } + protected defineSprites(): void { this.createSprites(this._planes.length); @@ -467,6 +534,22 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements } sprite.spriteType = RoomObjectSpriteType.ROOM_PLANE; + + if(this._roomPlaneParser.isPlaneTemporaryHighlighter(planeIndex)) + { + if(this._highlightFilter) sprite.filters = [ this._highlightFilter ]; + + sprite.skipMouseHandling = true; + plane.extraDepth = -100; + plane.isHighlighter = true; + } + else + { + sprite.filters = []; + sprite.skipMouseHandling = false; + plane.extraDepth = 0; + plane.isHighlighter = false; + } } planeIndex++; diff --git a/packages/room/src/renderer/RoomSpriteCanvas.ts b/packages/room/src/renderer/RoomSpriteCanvas.ts index aa59bce5..b29195d3 100644 --- a/packages/room/src/renderer/RoomSpriteCanvas.ts +++ b/packages/room/src/renderer/RoomSpriteCanvas.ts @@ -528,6 +528,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas extendedSprite.label = sprite.name; extendedSprite.varyingDepth = objectSprite.varyingDepth; extendedSprite.clickHandling = objectSprite.clickHandling; + extendedSprite.skipMouseHandling = objectSprite.skipMouseHandling; extendedSprite.filters = objectSprite.filters; const alpha = (objectSprite.alpha / 255); @@ -604,6 +605,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas extendedSprite.label = sprite.name; extendedSprite.varyingDepth = sprite.varyingDepth; extendedSprite.clickHandling = sprite.clickHandling; + extendedSprite.skipMouseHandling = sprite.skipMouseHandling; extendedSprite.blendMode = sprite.blendMode; extendedSprite.filters = sprite.filters; @@ -757,61 +759,64 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y)))) { - if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK))) + if(!extendedSprite.skipMouseHandling) { - // - } - else - { - const identifier = this.getExtendedSpriteIdentifier(extendedSprite); - - if(checkedSprites.indexOf(identifier) === -1) + if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK))) { - const tag = extendedSprite.tag; + // + } + else + { + const identifier = this.getExtendedSpriteIdentifier(extendedSprite); - let mouseData = this._mouseActiveObjects.get(identifier); - - if(mouseData) + if(checkedSprites.indexOf(identifier) === -1) { - if(mouseData.spriteTag !== tag) - { - mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown); + const tag = extendedSprite.tag; + let mouseData = this._mouseActiveObjects.get(identifier); + + if(mouseData) + { + if(mouseData.spriteTag !== tag) + { + mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown); + + this.bufferMouseEvent(mouseEvent, identifier); + } + } + + if((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag))) + { + mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown); + } + else + { + mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), type, tag, altKey, ctrlKey, shiftKey, buttonDown); + + mouseEvent.spriteOffsetX = extendedSprite.offsetX; + mouseEvent.spriteOffsetY = extendedSprite.offsetY; + } + + if(!mouseData) + { + mouseData = new ObjectMouseData(); + + mouseData.objectId = identifier; + this._mouseActiveObjects.set(identifier, mouseData); + } + + mouseData.spriteTag = tag; + + if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY)) + { this.bufferMouseEvent(mouseEvent, identifier); } + + checkedSprites.push(identifier); } - if((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag))) - { - mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown); - } - else - { - mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), type, tag, altKey, ctrlKey, shiftKey, buttonDown); - - mouseEvent.spriteOffsetX = extendedSprite.offsetX; - mouseEvent.spriteOffsetY = extendedSprite.offsetY; - } - - if(!mouseData) - { - mouseData = new ObjectMouseData(); - - mouseData.objectId = identifier; - this._mouseActiveObjects.set(identifier, mouseData); - } - - mouseData.spriteTag = tag; - - if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY)) - { - this.bufferMouseEvent(mouseEvent, identifier); - } - - checkedSprites.push(identifier); + didHitSprite = true; } - - didHitSprite = true; } } diff --git a/packages/room/src/renderer/utils/ExtendedSprite.ts b/packages/room/src/renderer/utils/ExtendedSprite.ts index 14c991ed..f3b08be7 100644 --- a/packages/room/src/renderer/utils/ExtendedSprite.ts +++ b/packages/room/src/renderer/utils/ExtendedSprite.ts @@ -12,6 +12,7 @@ export class ExtendedSprite extends Sprite private _alphaTolerance: number = AlphaTolerance.MATCH_OPAQUE_PIXELS; private _varyingDepth: boolean = false; private _clickHandling: boolean = false; + private _skipMouseHandling: boolean = false; private _updateId1: number = -1; private _updateId2: number = -1; @@ -43,7 +44,7 @@ export class ExtendedSprite extends Sprite public containsPoint(point: Point): boolean { - if(!point || (this.alphaTolerance > 255) || !this.texture || (this.texture === Texture.EMPTY) || (this.blendMode !== 'normal')) return false; + if(!point || (this.alphaTolerance > 255) || !this.texture || (this.texture === Texture.EMPTY)) return false; point = new Point((point.x * this.scale.x), (point.y * this.scale.y)); @@ -181,4 +182,14 @@ export class ExtendedSprite extends Sprite { this._clickHandling = flag; } + + public get skipMouseHandling(): boolean + { + return this._skipMouseHandling; + } + + public set skipMouseHandling(flag: boolean) + { + this._skipMouseHandling = flag; + } } diff --git a/packages/room/src/utils/RoomAreaSelectionManager.ts b/packages/room/src/utils/RoomAreaSelectionManager.ts new file mode 100644 index 00000000..8ac67841 --- /dev/null +++ b/packages/room/src/utils/RoomAreaSelectionManager.ts @@ -0,0 +1,233 @@ +import { IRoomAreaSelectionManager, IRoomEngine, IRoomObject } from '@nitrots/api'; +import { GetEventDispatcher, RoomEngineObjectEvent, RoomObjectMouseEvent, RoomObjectTileMouseEvent } from '@nitrots/events'; +import { ColorMatrixFilter } from 'pixi.js'; +import { FurnitureVisualization, RoomVisualization } from '../object'; + +export class RoomAreaSelectionManager implements IRoomAreaSelectionManager +{ + public static NOT_ACTIVE: number = 0; + public static NOT_SELECTING_AREA: number = 1; + public static AWAITING_MOUSE_DOWN: number = 2; + public static SELECTING: number = 3; + public static HIGHLIGHT_DARKEN = 'highlight_darken'; + public static HIGHLIGHT_BRIGHTEN = 'highlight_brighten'; + public static HIGHLIGHT_BLUE = 'highlight_blue'; + + private static HIGHLIGHT_FILTERS: { [key: string]: ColorMatrixFilter } = {}; + + private _roomEngine: IRoomEngine = null; + private _state: number = RoomAreaSelectionManager.NOT_ACTIVE; + private _tileXInit: number = 0; + private _tileYInit: number = 0; + private _tileXEnd: number = 0; + private _tileYEnd: number = 0; + private _highlightRootX: number = 0; + private _highlightRootY: number = 0; + private _highlightWidth: number = 0; + private _highlightHeight: number = 0; + private _callback: (rootX: number, rootY: number, width: number, height: number) => void; + private _highlightType: string = RoomAreaSelectionManager.HIGHLIGHT_BRIGHTEN; + + constructor(roomEngine: IRoomEngine) + { + this._roomEngine = roomEngine; + + GetEventDispatcher().addEventListener(RoomEngineObjectEvent.ADDED, event => + { + if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return; + + if(event.roomId !== this._roomEngine.activeRoomId) return; + + if(event.category !== 10 && event.category !== 20) return; + + const roomObject = this._roomEngine.getRoomObject(event.roomId, event.objectId, event.category); + + if(roomObject.visualization instanceof FurnitureVisualization) roomObject.visualization.lookThrough = true; + }); + + const brightenFilter = new ColorMatrixFilter(); + + brightenFilter.matrix = [1.5, 0, 0, 0, 0, 0, 1.5, 0, 0, 20, 0, 0, 1.5, 0, 20, 0, 0, 0, 1, 0]; + + const blueFilter = new ColorMatrixFilter(); + + brightenFilter.matrix = [1.05, 0, 0, 0, 0, 0, 1.3, 0, 0, 8, 0, 0, 1.8, 0, 20, 0, 0, 0, 1, 0]; + + const darkenFilter = new ColorMatrixFilter(); + + brightenFilter.matrix = [0.55, 0, 0, 0, -10, 0, 0.55, 0, 0, -10, 0, 0, 0.55, 0, -10, 0, 0, 0, 1, 0]; + + RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_DARKEN] = darkenFilter; + RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_BRIGHTEN] = brightenFilter; + RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_BLUE] = blueFilter; + } + + private getAllFurniture(): IRoomObject[] + { + return this._roomEngine.getRoomObjects(this._roomEngine.activeRoomId, 20).concat(this._roomEngine.getRoomObjects(this._roomEngine.activeRoomId, 10)); + } + + public startSelecting(): void + { + if(this._state !== RoomAreaSelectionManager.NOT_SELECTING_AREA) return; + + this.clearHighlightSilent(); + this._state = RoomAreaSelectionManager.AWAITING_MOUSE_DOWN; + this._roomEngine.moveBlocked = true; + } + + public handleTileMouseEvent(event: RoomObjectTileMouseEvent): void + { + let isWaitingForMouseDown = ((this._state === RoomAreaSelectionManager.AWAITING_MOUSE_DOWN) && (event.type == RoomObjectMouseEvent.MOUSE_DOWN)); + + if(event.shiftKey && (this._state === RoomAreaSelectionManager.NOT_SELECTING_AREA) && (event.type == RoomObjectMouseEvent.MOUSE_DOWN)) + { + this.startSelecting(); + + isWaitingForMouseDown = true; + }; + + if(isWaitingForMouseDown) + { + this._state = RoomAreaSelectionManager.SELECTING; + this._tileXInit = event.tileXAsInt; + this._tileYInit = event.tileYAsInt; + this._tileXEnd = event.tileXAsInt; + this._tileYEnd = event.tileYAsInt; + this.setHighlight(this._tileXInit, this._tileYInit, 1, 1); + + return; + } + + if((this._state === RoomAreaSelectionManager.SELECTING) && (event.type === RoomObjectMouseEvent.MOUSE_MOVE)) + { + if((event.tileXAsInt !== this._tileXEnd) || (event.tileYAsInt !== this._tileYEnd)) + { + let rootX: number = 0; + let rootY: number = 0; + let width: number = 0; + let height: number = 0; + + this._tileXEnd = event.tileXAsInt; + this._tileYEnd = event.tileYAsInt; + + if(this._tileXEnd > this._tileXInit) + { + rootX = this._tileXInit; + width = ((this._tileXEnd - this._tileXInit) + 1); + } + else + { + rootX = this._tileXEnd; + width = ((this._tileXInit - this._tileXEnd) + 1); + }; + + if(this._tileYEnd > this._tileYInit) + { + rootY = this._tileYInit; + height = ((this._tileYEnd - this._tileYInit) + 1); + } + else + { + rootY = this._tileYEnd; + height = ((this._tileYInit - this._tileYEnd) + 1); + }; + + this.setHighlight(rootX, rootY, width, height); + }; + }; + } + + public finishSelecting(): boolean + { + if(this._state !== RoomAreaSelectionManager.SELECTING) return false; + + this._state = RoomAreaSelectionManager.NOT_SELECTING_AREA; + + this._roomEngine.moveBlocked = false; + + if(this._callback) this._callback(this._highlightRootX, this._highlightRootY, this._highlightWidth, this._highlightHeight); + + return true; + } + + private clearHighlightSilent():void + { + const roomObject = this._roomEngine.getRoomObject(this._roomEngine.activeRoomId, -1, 0); + + if(!roomObject) return; + + (roomObject.visualization as RoomVisualization)?.clearHighlightArea(); + } + + public clearHighlight(): void + { + if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return; + + this.clearHighlightSilent(); + + this._state = RoomAreaSelectionManager.NOT_SELECTING_AREA; + + this._roomEngine.moveBlocked = false; + + if(this._callback) this._callback(0, 0, 0, 0); + } + + public setHighlight(rootX: number, rootY: number, width: number, height: number): void + { + if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return; + + this._highlightRootX = rootX; + this._highlightRootY = rootY; + this._highlightWidth = width; + this._highlightHeight = height; + + const roomObject = this._roomEngine.getRoomObject(this._roomEngine.activeRoomId, -1, 0); + + if(!roomObject) return; + + (roomObject.visualization as RoomVisualization)?.initializeHighlightArea(rootX, rootY, width, height, RoomAreaSelectionManager.HIGHLIGHT_FILTERS[this._highlightType]); + } + + public activate(callback: (rootX: number, rootY: number, width: number, height: number) => void, highlightType: string): boolean + { + if(this._state !== RoomAreaSelectionManager.NOT_ACTIVE) return false; + + this._callback = callback; + this._highlightType = highlightType; + + for(const roomObject of this.getAllFurniture()) + { + const visualization = (roomObject.visualization as FurnitureVisualization); + + if(visualization) visualization.lookThrough = true; + }; + + this._state = RoomAreaSelectionManager.NOT_SELECTING_AREA; + + return true; + } + + public deactivate(): void + { + if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return; + + this._callback = null; + + for(const roomObject of this.getAllFurniture()) + { + const visualization = (roomObject.visualization as FurnitureVisualization); + + if(visualization) visualization.lookThrough = false; + }; + + this.clearHighlight(); + + this._state = RoomAreaSelectionManager.NOT_ACTIVE; + } + + public get areaSelectionState(): number + { + return this._state; + } +}