From a1eb711f6ab7e345aacb3d711676ce3f347af863 Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Mon, 6 Sep 2021 06:00:25 -0300 Subject: [PATCH] Talent Track messages --- src/nitro/communication/NitroMessages.ts | 9 ++- .../messages/incoming/IncomingHeader.ts | 1 + .../incoming/help/TalentTrackEvent.ts | 16 ++++ .../messages/incoming/help/index.ts | 1 + .../messages/outgoing/OutgoingHeader.ts | 1 + .../outgoing/helper/TalentTrackComposer.ts | 21 +++++ .../messages/outgoing/helper/index.ts | 1 + .../communication/messages/outgoing/index.ts | 1 + .../messages/parser/help/TalentTrackParser.ts | 79 +++++++++++++++++++ .../parser/help/common/TalentTrackLevel.ts | 45 +++++++++++ .../common/TalentTrackLevelAchievement.ts | 49 ++++++++++++ .../help/common/TalentTrackLevelItem.ts | 21 +++++ .../messages/parser/help/common/index.ts | 3 + .../messages/parser/help/index.ts | 2 + 14 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 src/nitro/communication/messages/incoming/help/TalentTrackEvent.ts create mode 100644 src/nitro/communication/messages/outgoing/helper/TalentTrackComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/helper/index.ts create mode 100644 src/nitro/communication/messages/parser/help/TalentTrackParser.ts create mode 100644 src/nitro/communication/messages/parser/help/common/TalentTrackLevel.ts create mode 100644 src/nitro/communication/messages/parser/help/common/TalentTrackLevelAchievement.ts create mode 100644 src/nitro/communication/messages/parser/help/common/TalentTrackLevelItem.ts create mode 100644 src/nitro/communication/messages/parser/help/common/index.ts diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index f5102f61..85c860b8 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -1,5 +1,5 @@ import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration'; -import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, ApproveNameMessageEvent, AvailabilityTimeMessageEvent, BadgePointLimitsEvent, BadgeReceivedEvent, BonusRareInfoMessageEvent, BuildersClubFurniCountMessageEvent, BuildersClubSubscriptionStatusMessageEvent, BundleDiscountRulesetMessageEvent, ChangeUserNameMessageComposer, ChangeUserNameResultMessageEvent, CheckUserNameMessageComposer, CheckUserNameResultMessageEvent, ClubGiftNotificationEvent, DirectSMSClubBuyAvailableMessageEvent, FigureUpdateEvent, FurnitureGroupInfoComposer, GetBonusRareInfoMessageComposer, GetCatalogPageExpirationComposer, GetCatalogPageWithEarliestExpiryComposer, GetDirectClubBuyAvailableComposer, GetHabboBasicMembershipExtendOfferComposer, GetHabboClubExtendOfferMessageComposer, GetInterstitialMessageComposer, GetJukeboxPlayListMessageComposer, GetLimitedOfferAppearingNextComposer, GetNextTargetedOfferComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetRoomAdPurchaseInfoComposer, GetSeasonalCalendarDailyOfferComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, GroupBadgesComposer, GroupBadgesEvent, HabboClubExtendOfferMessageEvent, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, InterstitialMessageEvent, InterstitialShownMessageComposer, IsBadgeRequestFulfilledEvent, IsOfferGiftableMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, LimitedOfferAppearingNextMessageEvent, MaintenanceStatusMessageEvent, MarkCatalogNewAdditionsPageOpenedComposer, MarketplaceBuyOfferComposer, MarketplaceRedeemCreditsComposer, MarketplaceRequesstItemStatsComposer, MarketplaceRequestComposer, MarketplaceRequestOffersComposer, MarketplaceRequestOwnItemsComposer, MarketplaceTakeItemBackComposer, MysteryBoxKeysEvent, NotEnoughBalanceMessageEvent, NowPlayingMessageEvent, OfficialSongIdMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer, PetExperienceEvent, PetMountComposer, PetSupplementComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, PurchaseBasicMembershipExtensionComposer, PurchaseRoomAdMessageComposer, PurchaseTargetedOfferComposer, PurchaseVipMembershipExtensionComposer, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomAdErrorEvent, RoomAdPurchaseInfoEvent, RoomUnitGiveHandItemPetComposer, SeasonalCalendarDailyOfferMessageEvent, SellablePetPalettesMessageEvent, SetTargetedOfferStateComposer, ShopTargetedOfferViewedComposer, TargetedOfferEvent, TargetedOfferNotFoundEvent, TogglePetBreedingComposer, TogglePetRidingComposer, TraxSongInfoMessageEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer, UserSongDisksInventoryMessageEvent, WardrobeMessageEvent } from './messages'; +import { AchievementNotificationMessageEvent, ActivityPointNotificationMessageEvent, AddJukeboxDiskComposer, ApproveNameMessageComposer, ApproveNameMessageEvent, AvailabilityTimeMessageEvent, BadgePointLimitsEvent, BadgeReceivedEvent, BonusRareInfoMessageEvent, BuildersClubFurniCountMessageEvent, BuildersClubSubscriptionStatusMessageEvent, BundleDiscountRulesetMessageEvent, ChangeUserNameMessageComposer, ChangeUserNameResultMessageEvent, CheckUserNameMessageComposer, CheckUserNameResultMessageEvent, ClubGiftNotificationEvent, DirectSMSClubBuyAvailableMessageEvent, FigureUpdateEvent, FurnitureGroupInfoComposer, GetBonusRareInfoMessageComposer, GetCatalogPageExpirationComposer, GetCatalogPageWithEarliestExpiryComposer, GetDirectClubBuyAvailableComposer, GetHabboBasicMembershipExtendOfferComposer, GetHabboClubExtendOfferMessageComposer, GetInterstitialMessageComposer, GetJukeboxPlayListMessageComposer, GetLimitedOfferAppearingNextComposer, GetNextTargetedOfferComposer, GetNowPlayingMessageComposer, GetOfficialSongIdMessageComposer, GetRoomAdPurchaseInfoComposer, GetSeasonalCalendarDailyOfferComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetUserSongDisksMessageComposer, GroupBadgesComposer, GroupBadgesEvent, HabboClubExtendOfferMessageEvent, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelWillCloseInMinutesEvent, InfoFeedEnableMessageEvent, InterstitialMessageEvent, InterstitialShownMessageComposer, IsBadgeRequestFulfilledEvent, IsOfferGiftableMessageEvent, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, LimitedOfferAppearingNextMessageEvent, MaintenanceStatusMessageEvent, MarkCatalogNewAdditionsPageOpenedComposer, MarketplaceBuyOfferComposer, MarketplaceRedeemCreditsComposer, MarketplaceRequesstItemStatsComposer, MarketplaceRequestComposer, MarketplaceRequestOffersComposer, MarketplaceRequestOwnItemsComposer, MarketplaceTakeItemBackComposer, MysteryBoxKeysEvent, NotEnoughBalanceMessageEvent, NowPlayingMessageEvent, OfficialSongIdMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer, PetExperienceEvent, PetMountComposer, PetSupplementComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, PurchaseBasicMembershipExtensionComposer, PurchaseRoomAdMessageComposer, PurchaseTargetedOfferComposer, PurchaseVipMembershipExtensionComposer, RemoveAllRightsMessageComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RoomAdErrorEvent, RoomAdPurchaseInfoEvent, RoomUnitGiveHandItemPetComposer, SeasonalCalendarDailyOfferMessageEvent, SellablePetPalettesMessageEvent, SetTargetedOfferStateComposer, ShopTargetedOfferViewedComposer, TalentTrackEvent, TargetedOfferEvent, TargetedOfferNotFoundEvent, TogglePetBreedingComposer, TogglePetRidingComposer, TraxSongInfoMessageEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer, UserSongDisksInventoryMessageEvent, WardrobeMessageEvent } from './messages'; import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent'; import { CfhSanctionMessageEvent, CfhTopicsInitEvent, SanctionStatusEvent } from './messages/incoming/callforhelp'; import { CameraPublishStatusMessageEvent } from './messages/incoming/camera/CameraPublishStatusMessageEvent'; @@ -293,6 +293,7 @@ import { GroupSettingsComposer } from './messages/outgoing/group/GroupSettingsCo import { AuthenticationMessageComposer } from './messages/outgoing/handshake/AuthenticationMessageComposer'; import { InfoRetrieveBaseMessageComposer } from './messages/outgoing/handshake/InfoRetrieveBaseMessageComposer'; import { SecurityTicketComposer } from './messages/outgoing/handshake/SecurityTicketComposer'; +import { TalentTrackComposer } from './messages/outgoing/helper/TalentTrackComposer'; import { RequestBadgesComposer } from './messages/outgoing/inventory/badges/RequestBadgesComposer'; import { SetActivatedBadgesComposer } from './messages/outgoing/inventory/badges/SetActivatedBadgesComposer'; import { GetBotInventoryComposer } from './messages/outgoing/inventory/bots/GetBotInventoryComposer'; @@ -873,6 +874,9 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.PLAYLIST_SONG_ADDED, PlayListSongAddedMessageEvent); this._events.set(IncomingHeader.TRAX_SONG_INFO, TraxSongInfoMessageEvent); this._events.set(IncomingHeader.USER_SONG_DISKS_INVENTORY, UserSongDisksInventoryMessageEvent); + + // HELPER + this._events.set(IncomingHeader.HELPER_TALENT_TRACK, TalentTrackEvent); } private registerComposers(): void @@ -1267,6 +1271,9 @@ export class NitroMessages implements IMessageConfiguration this._composers.set(OutgoingHeader.GET_SOUND_MACHINE_PLAYLIST, GetSoundMachinePlayListMessageComposer); this._composers.set(OutgoingHeader.GET_USER_SONG_DISKS, GetUserSongDisksMessageComposer); this._composers.set(OutgoingHeader.REMOVE_JUKEBOX_DISK, RemoveJukeboxDiskComposer); + + // HELPER + this._composers.set(OutgoingHeader.HELPER_TALENT_TRACK, TalentTrackComposer); } public get events(): Map diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 6bf27d55..736bec3a 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -317,4 +317,5 @@ export class IncomingHeader public static COMPETITION_SECONDS_UNTIL = 3926; public static BADGE_POINT_LIMITS = 2501; public static BADGE_REQUEST_FULFILLED = 2998; + public static HELPER_TALENT_TRACK = 3406; } diff --git a/src/nitro/communication/messages/incoming/help/TalentTrackEvent.ts b/src/nitro/communication/messages/incoming/help/TalentTrackEvent.ts new file mode 100644 index 00000000..488e9f42 --- /dev/null +++ b/src/nitro/communication/messages/incoming/help/TalentTrackEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { TalentTrackParser } from '../../parser/help/TalentTrackParser'; + +export class TalentTrackEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TalentTrackParser); + } + + public getParser(): TalentTrackParser + { + return this.parser as TalentTrackParser; + } +} diff --git a/src/nitro/communication/messages/incoming/help/index.ts b/src/nitro/communication/messages/incoming/help/index.ts index 82185bf2..b0bcb133 100644 --- a/src/nitro/communication/messages/incoming/help/index.ts +++ b/src/nitro/communication/messages/incoming/help/index.ts @@ -1 +1,2 @@ export * from './CallForHelpResultMessageEvent'; +export * from './TalentTrackEvent'; diff --git a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts index 8ebd3888..e82aeb68 100644 --- a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts +++ b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts @@ -307,4 +307,5 @@ export class OutgoingHeader public static ROOM_AD_PURCHASE_INITIATED = 2283; public static SET_TARGETTED_OFFER_STATE = 2041; public static SHOP_TARGETED_OFFER_VIEWED = 3483; + public static HELPER_TALENT_TRACK = 196; } diff --git a/src/nitro/communication/messages/outgoing/helper/TalentTrackComposer.ts b/src/nitro/communication/messages/outgoing/helper/TalentTrackComposer.ts new file mode 100644 index 00000000..6992b7e7 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/helper/TalentTrackComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; + +export class TalentTrackComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(type: string) + { + this._data = [ type ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/helper/index.ts b/src/nitro/communication/messages/outgoing/helper/index.ts new file mode 100644 index 00000000..018730e0 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/helper/index.ts @@ -0,0 +1 @@ +export * from './TalentTrackComposer'; diff --git a/src/nitro/communication/messages/outgoing/index.ts b/src/nitro/communication/messages/outgoing/index.ts index a91f1642..ceca7a00 100644 --- a/src/nitro/communication/messages/outgoing/index.ts +++ b/src/nitro/communication/messages/outgoing/index.ts @@ -9,6 +9,7 @@ export * from './desktop'; export * from './friendlist'; export * from './group'; export * from './handshake'; +export * from './helper'; export * from './inventory'; export * from './landingview'; export * from './marketplace'; diff --git a/src/nitro/communication/messages/parser/help/TalentTrackParser.ts b/src/nitro/communication/messages/parser/help/TalentTrackParser.ts new file mode 100644 index 00000000..71e97ccd --- /dev/null +++ b/src/nitro/communication/messages/parser/help/TalentTrackParser.ts @@ -0,0 +1,79 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; +import { TalentTrackLevel } from './common/TalentTrackLevel'; +import { TalentTrackLevelAchievement } from './common/TalentTrackLevelAchievement'; +import { TalentTrackLevelItem } from './common/TalentTrackLevelItem'; + +export class TalentTrackParser implements IMessageParser +{ + private _type: string; + private _levels: TalentTrackLevel[]; + + public flush(): boolean + { + this._type = null; + this._levels = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readString(); + + this._levels = []; + const levelsCount = wrapper.readInt(); + + for(let i = 0; i < levelsCount; i++) + { + const levelId = wrapper.readInt(); + const levelState = wrapper.readInt(); + + const levelAchievements: TalentTrackLevelAchievement[] = []; + const achievementsCount = wrapper.readInt(); + + for(let j = 0; j < achievementsCount; j++) + { + const id = wrapper.readInt(); + const index = wrapper.readInt(); + const code = wrapper.readString(); + const state = wrapper.readInt(); + const progress = wrapper.readInt(); + const achievementProgress = wrapper.readInt(); + + levelAchievements.push(new TalentTrackLevelAchievement(id, index, code, state, progress, achievementProgress)); + } + + const levelPerks: string[] = []; + const perksCount = wrapper.readInt(); + + for(let j = 0; j < perksCount; j++) levelPerks.push(wrapper.readString()); + + const levelItems: TalentTrackLevelItem[] = []; + const itemsCount = wrapper.readInt(); + + for(let j = 0; j < itemsCount; j++) + { + const name = wrapper.readString(); + const unknownInt = wrapper.readInt(); + + levelItems.push(new TalentTrackLevelItem(name, unknownInt)); + } + + this._levels.push(new TalentTrackLevel(levelId, levelState, levelAchievements, levelPerks, levelItems)); + } + + return true; + } + + public get type(): string + { + return this._type; + } + + public get levels(): TalentTrackLevel[] + { + return this._levels; + } +} diff --git a/src/nitro/communication/messages/parser/help/common/TalentTrackLevel.ts b/src/nitro/communication/messages/parser/help/common/TalentTrackLevel.ts new file mode 100644 index 00000000..ffc487bd --- /dev/null +++ b/src/nitro/communication/messages/parser/help/common/TalentTrackLevel.ts @@ -0,0 +1,45 @@ +import { TalentTrackLevelAchievement } from './TalentTrackLevelAchievement'; +import { TalentTrackLevelItem } from './TalentTrackLevelItem'; + +export class TalentTrackLevel +{ + private _level: number; + private _state: number; + private _achievements: TalentTrackLevelAchievement[] + private _perks: string[]; + private _items: TalentTrackLevelItem[]; + + constructor(level: number, state: number, achievements: TalentTrackLevelAchievement[], perks: string[], items: TalentTrackLevelItem[]) + { + this._level = level; + this._state = state; + this._achievements = achievements; + this._perks = perks; + this._items = items; + } + + public get level(): number + { + return this._level; + } + + public get state(): number + { + return this._state; + } + + public get achievements(): TalentTrackLevelAchievement[] + { + return this._achievements; + } + + public get perks(): string[] + { + return this._perks; + } + + public get items(): TalentTrackLevelItem[] + { + return this._items; + } +} diff --git a/src/nitro/communication/messages/parser/help/common/TalentTrackLevelAchievement.ts b/src/nitro/communication/messages/parser/help/common/TalentTrackLevelAchievement.ts new file mode 100644 index 00000000..cd77c5d7 --- /dev/null +++ b/src/nitro/communication/messages/parser/help/common/TalentTrackLevelAchievement.ts @@ -0,0 +1,49 @@ +export class TalentTrackLevelAchievement +{ + private _id: number; + private _index: number; + private _achievementCode: string; + private _state: number; + private _progress: number; + private _achievementProgress: number; + + constructor(id: number, index: number, achievementCode: string, state: number, progress: number, achievementProgress: number) + { + this._id = id; + this._index = index; + this._achievementCode = achievementCode; + this._state = state; + this._progress = progress; + this._achievementProgress = achievementProgress; + } + + public get id(): number + { + return this._id; + } + + public get index(): number + { + return this._index; + } + + public get achievementCode(): string + { + return this._achievementCode; + } + + public get state(): number + { + return this._state; + } + + public get progress(): number + { + return this._progress; + } + + public get achievementProgress(): number + { + return this._achievementProgress; + } +} diff --git a/src/nitro/communication/messages/parser/help/common/TalentTrackLevelItem.ts b/src/nitro/communication/messages/parser/help/common/TalentTrackLevelItem.ts new file mode 100644 index 00000000..bf59dc07 --- /dev/null +++ b/src/nitro/communication/messages/parser/help/common/TalentTrackLevelItem.ts @@ -0,0 +1,21 @@ +export class TalentTrackLevelItem +{ + private _name: string; + private _unknownInt: number; + + constructor(name: string, unknownInt: number) + { + this._name = name; + this._unknownInt = unknownInt; + } + + public get name(): string + { + return this._name; + } + + public get unknownInt(): number + { + return this._unknownInt; + } +} diff --git a/src/nitro/communication/messages/parser/help/common/index.ts b/src/nitro/communication/messages/parser/help/common/index.ts new file mode 100644 index 00000000..22aefb71 --- /dev/null +++ b/src/nitro/communication/messages/parser/help/common/index.ts @@ -0,0 +1,3 @@ +export * from './TalentTrackLevel'; +export * from './TalentTrackLevelAchievement'; +export * from './TalentTrackLevelItem'; diff --git a/src/nitro/communication/messages/parser/help/index.ts b/src/nitro/communication/messages/parser/help/index.ts index d09023ae..66126c4c 100644 --- a/src/nitro/communication/messages/parser/help/index.ts +++ b/src/nitro/communication/messages/parser/help/index.ts @@ -1 +1,3 @@ export * from './CallForHelpResultMessageParser'; +export * from './common'; +export * from './TalentTrackParser';