diff --git a/src/nitro/communication/messages/incoming/catalog/CatalogLocalizationData.ts b/src/nitro/communication/messages/incoming/catalog/CatalogLocalizationData.ts index 91b5f721..70e25015 100644 --- a/src/nitro/communication/messages/incoming/catalog/CatalogLocalizationData.ts +++ b/src/nitro/communication/messages/incoming/catalog/CatalogLocalizationData.ts @@ -1,7 +1,6 @@ import { IMessageDataWrapper } from '../../../../../core'; -import { ICatalogLocalizationData } from '../../parser/catalog/utils/ICatalogLocalizationData'; -export class CatalogLocalizationData implements ICatalogLocalizationData +export class CatalogLocalizationData { private _images: string[]; private _texts: string[]; diff --git a/src/nitro/communication/messages/incoming/catalog/INodeData.ts b/src/nitro/communication/messages/incoming/catalog/INodeData.ts new file mode 100644 index 00000000..2c201e9d --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/INodeData.ts @@ -0,0 +1,10 @@ +export interface INodeData +{ + visible: boolean; + icon: number; + pageId: number; + pageName: string; + localization: string; + children: INodeData[]; + offerIds: number[]; +} diff --git a/src/nitro/communication/messages/incoming/catalog/index.ts b/src/nitro/communication/messages/incoming/catalog/index.ts index d618b227..96964b5b 100644 --- a/src/nitro/communication/messages/incoming/catalog/index.ts +++ b/src/nitro/communication/messages/incoming/catalog/index.ts @@ -22,6 +22,7 @@ export * from './GiftReceiverNotFoundEvent'; export * from './GiftWrappingConfigurationEvent'; export * from './HabboClubExtendOfferMessageEvent'; export * from './HabboClubOffersMessageEvent'; +export * from './INodeData'; export * from './IsOfferGiftableMessageEvent'; export * from './LimitedEditionSoldOutEvent'; export * from './LimitedOfferAppearingNextMessageEvent'; diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts index 3ad38ec3..f1450e2d 100644 --- a/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts +++ b/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts @@ -2,9 +2,8 @@ import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; import { CatalogLocalizationData } from '../../incoming/catalog/CatalogLocalizationData'; import { CatalogPageMessageOfferData } from '../../incoming/catalog/CatalogPageMessageOfferData'; import { FrontPageItem } from '../../incoming/catalog/FrontPageItem'; -import { ICatalogPageParser } from './utils/ICatalogPageParser'; -export class CatalogPageMessageParser implements IMessageParser, ICatalogPageParser +export class CatalogPageMessageParser implements IMessageParser { private _pageId: number; private _catalogType: string; diff --git a/src/nitro/communication/messages/parser/catalog/index.ts b/src/nitro/communication/messages/parser/catalog/index.ts index 127c7a28..5afbef31 100644 --- a/src/nitro/communication/messages/parser/catalog/index.ts +++ b/src/nitro/communication/messages/parser/catalog/index.ts @@ -28,6 +28,5 @@ export * from './SellablePetPaletteData'; export * from './SellablePetPalettesParser'; export * from './TargetedOfferNotFoundParser'; export * from './TargetedOfferParser'; -export * from './utils'; export * from './VoucherRedeemErrorMessageParser'; export * from './VoucherRedeemOkMessageParser'; diff --git a/src/nitro/communication/messages/parser/catalog/utils/CatalogGroupData.ts b/src/nitro/communication/messages/parser/catalog/utils/CatalogGroupData.ts deleted file mode 100644 index 1b0e08ab..00000000 --- a/src/nitro/communication/messages/parser/catalog/utils/CatalogGroupData.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { IMessageDataWrapper } from '../../../../../../core'; - -export class CatalogGroupData -{ - private _id: number; - private _title: string; - private _badge: string; - private _colorA: string; - private _colorB: string; - private _isOwner: boolean; - private _ownerId: number; - private _hasForum: boolean; - - constructor(wrapper: IMessageDataWrapper) - { - if(!wrapper) throw new Error('invalid_wrapper'); - - this.flush(); - this.parse(wrapper); - } - - public flush(): boolean - { - this._id = 0; - this._title = null; - this._badge = null; - this._colorA = null; - this._colorB = null; - this._isOwner = false; - this._ownerId = 0; - this._hasForum = false; - - return true; - } - - public parse(wrapper: IMessageDataWrapper): boolean - { - if(!wrapper) return false; - - this._id = wrapper.readInt(); - this._title = wrapper.readString(); - this._badge = wrapper.readString(); - this._colorA = wrapper.readString(); - this._colorB = wrapper.readString(); - this._isOwner = wrapper.readBoolean(); - this._ownerId = wrapper.readInt(); - this._hasForum = wrapper.readBoolean(); - - return true; - } - - public get id(): number - { - return this._id; - } - - public get title(): string - { - return this._title; - } - - public get badge(): string - { - return this._badge; - } - - public get colorA(): string - { - return this._colorA; - } - - public get colorB(): string - { - return this._colorB; - } - - public get isOwner(): boolean - { - return this._isOwner; - } - - public get ownerId(): number - { - return this._ownerId; - } - - public get hasForum(): boolean - { - return this._hasForum; - } -} diff --git a/src/nitro/communication/messages/parser/catalog/utils/CatalogSearchData.ts b/src/nitro/communication/messages/parser/catalog/utils/CatalogSearchData.ts deleted file mode 100644 index c5c424a0..00000000 --- a/src/nitro/communication/messages/parser/catalog/utils/CatalogSearchData.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { ICatalogPageData } from './ICatalogPageData'; - -export class CatalogSearchData implements ICatalogPageData -{ - private _children: ICatalogPageData[]; - constructor(pages: ICatalogPageData[]) - { - this._children = pages; - } - - public get children(): ICatalogPageData[] - { - return this._children; - } - - public get icon(): number - { - return -1; - } - - public get localization(): string - { - return ''; - } - - public get offerIds(): number[] - { - return []; - } - - public get pageId(): number - { - return -1; - } - - public get pageName(): string - { - return ''; - } - - public get visible(): boolean - { - return true; - } - -} diff --git a/src/nitro/communication/messages/parser/catalog/utils/ICatalogLocalizationData.ts b/src/nitro/communication/messages/parser/catalog/utils/ICatalogLocalizationData.ts deleted file mode 100644 index c199e565..00000000 --- a/src/nitro/communication/messages/parser/catalog/utils/ICatalogLocalizationData.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface ICatalogLocalizationData -{ - readonly images: string[]; - readonly texts: string[]; -} diff --git a/src/nitro/communication/messages/parser/catalog/utils/ICatalogPageData.ts b/src/nitro/communication/messages/parser/catalog/utils/ICatalogPageData.ts deleted file mode 100644 index 8da1f031..00000000 --- a/src/nitro/communication/messages/parser/catalog/utils/ICatalogPageData.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface ICatalogPageData -{ - visible: boolean; - icon: number; - pageId: number; - pageName: string; - localization: string; - children: ICatalogPageData[]; - offerIds: number[]; -} diff --git a/src/nitro/communication/messages/parser/catalog/utils/ICatalogPageParser.ts b/src/nitro/communication/messages/parser/catalog/utils/ICatalogPageParser.ts deleted file mode 100644 index c7c9ba3e..00000000 --- a/src/nitro/communication/messages/parser/catalog/utils/ICatalogPageParser.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { CatalogPageMessageOfferData } from '../../../incoming/catalog/CatalogPageMessageOfferData'; -import { FrontPageItem } from '../../../incoming/catalog/FrontPageItem'; -import { ICatalogLocalizationData } from './ICatalogLocalizationData'; - -export interface ICatalogPageParser -{ - readonly pageId: number; - readonly catalogType: string; - readonly layoutCode: string; - readonly localization: ICatalogLocalizationData; - readonly offers: CatalogPageMessageOfferData[]; - readonly offerId: number; - readonly acceptSeasonCurrencyAsCredits: boolean; - readonly frontPageItems: FrontPageItem[]; - -} diff --git a/src/nitro/communication/messages/parser/catalog/utils/index.ts b/src/nitro/communication/messages/parser/catalog/utils/index.ts deleted file mode 100644 index 1ed67ade..00000000 --- a/src/nitro/communication/messages/parser/catalog/utils/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './CatalogGroupData'; -export * from './CatalogSearchData'; -export * from './ICatalogLocalizationData'; -export * from './ICatalogPageData'; -export * from './ICatalogPageParser'; diff --git a/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts b/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts index 5b5dba97..e75d793e 100644 --- a/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts +++ b/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts @@ -1,9 +1,9 @@ import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; -import { CatalogGroupData } from '../catalog/utils/CatalogGroupData'; +import { HabboGroupEntryData } from './HabboGroupEntryData'; export class GuildMembershipsMessageParser implements IMessageParser { - private _groups: CatalogGroupData[]; + private _groups: HabboGroupEntryData[]; public flush(): boolean { @@ -20,7 +20,7 @@ export class GuildMembershipsMessageParser implements IMessageParser while(totalOffers > 0) { - this._groups.push(new CatalogGroupData(wrapper)); + this._groups.push(new HabboGroupEntryData(wrapper)); totalOffers--; } @@ -28,7 +28,7 @@ export class GuildMembershipsMessageParser implements IMessageParser return true; } - public get groups(): CatalogGroupData[] + public get groups(): HabboGroupEntryData[] { return this._groups; } diff --git a/src/nitro/communication/messages/parser/user/HabboGroupEntryData.ts b/src/nitro/communication/messages/parser/user/HabboGroupEntryData.ts new file mode 100644 index 00000000..d8cb006c --- /dev/null +++ b/src/nitro/communication/messages/parser/user/HabboGroupEntryData.ts @@ -0,0 +1,65 @@ +import { IMessageDataWrapper } from '../../../../../core'; + +export class HabboGroupEntryData +{ + private _groupId: number; + private _groupName: string; + private _badgeCode: string; + private _Str_6751: string; + private _Str_6979: string; + private _favourite: boolean; + private _ownerId: number; + private _Str_19808: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._groupId = wrapper.readInt(); + this._groupName = wrapper.readString(); + this._badgeCode = wrapper.readString(); + this._Str_6751 = wrapper.readString(); + this._Str_6979 = wrapper.readString(); + this._favourite = wrapper.readBoolean(); + this._ownerId = wrapper.readInt(); + this._Str_19808 = wrapper.readBoolean(); + } + + public get groupId(): number + { + return this._groupId; + } + + public get groupName(): string + { + return this._groupName; + } + + public get badgeCode(): string + { + return this._badgeCode; + } + + public get _Str_5845(): string + { + return this._Str_6751; + } + + public get _Str_6659(): string + { + return this._Str_6979; + } + + public get favourite(): boolean + { + return this._favourite; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public get _Str_21674(): boolean + { + return this._Str_19808; + } +}