diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index eaa719c7..2f8c0fbc 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -8,6 +8,7 @@ import { CameraStorageUrlMessageEvent } from './messages/incoming/camera/CameraS import { CompetitionStatusMessageEvent } from './messages/incoming/camera/CompetitionStatusMessageEvent'; import { InitCameraMessageEvent } from './messages/incoming/camera/InitCameraMessageEvent'; import { ThumbnailStatusMessageEvent } from './messages/incoming/camera/ThumbnailStatusMessageEvent'; +import { CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent } from './messages/incoming/campaign'; import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent'; import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent'; import { CatalogGiftConfigurationEvent } from './messages/incoming/catalog/CatalogGiftConfigurationEvent'; @@ -499,6 +500,10 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.CFH_TOPICS, CfhTopicsInitEvent); this._events.set(IncomingHeader.CFH_SANCTION_STATUS, SanctionStatusEvent); + // CAMPAIGN + this._events.set(IncomingHeader.CAMPAIGN_CALENDAR_DATA, CampaignCalendarDataMessageEvent); + this._events.set(IncomingHeader.CAMPAIGN_CALENDAR_DOOR_OPENED, CampaignCalendarDoorOpenedMessageEvent); + // CATALOG this._events.set(IncomingHeader.CATALOG_CLUB, CatalogClubEvent); this._events.set(IncomingHeader.CATALOG_MODE, CatalogModeEvent); diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 6963e111..3f88191a 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -292,4 +292,6 @@ export class IncomingHeader public static CFH_SANCTION = 2782; public static CFH_TOPICS = 325; public static CFH_SANCTION_STATUS = 2221; + public static CAMPAIGN_CALENDAR_DATA = 2531; + public static CAMPAIGN_CALENDAR_DOOR_OPENED = 2551; } diff --git a/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDataMessageEvent.ts b/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDataMessageEvent.ts new file mode 100644 index 00000000..c8ba5bbd --- /dev/null +++ b/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDataMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { CampaignCalendarDataMessageParser } from '../../parser/campaign'; + +export class CampaignCalendarDataMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CampaignCalendarDataMessageParser); + } + + public getParser(): CampaignCalendarDataMessageParser + { + return this.parser as CampaignCalendarDataMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDoorOpenedMessageEvent.ts b/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDoorOpenedMessageEvent.ts new file mode 100644 index 00000000..48911446 --- /dev/null +++ b/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDoorOpenedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { CampaignCalendarDoorOpenedMessageParser } from '../../parser/campaign'; + +export class CampaignCalendarDoorOpenedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CampaignCalendarDoorOpenedMessageParser); + } + + public getParser(): CampaignCalendarDoorOpenedMessageParser + { + return this.parser as CampaignCalendarDoorOpenedMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/campaign/index.ts b/src/nitro/communication/messages/incoming/campaign/index.ts new file mode 100644 index 00000000..a6263aee --- /dev/null +++ b/src/nitro/communication/messages/incoming/campaign/index.ts @@ -0,0 +1,2 @@ +export * from './CampaignCalendarDataMessageEvent'; +export * from './CampaignCalendarDoorOpenedMessageEvent'; diff --git a/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts b/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts new file mode 100644 index 00000000..a7fb5f94 --- /dev/null +++ b/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts @@ -0,0 +1,118 @@ +import { IMessageDataWrapper } from '../../../../../core'; + +export class CampaignCalendarData +{ + private _campaignName: string; + private _campaignImage: string; + private _currentDay: number; + private _campaignDays: number; + private _openedDays: number[]; + private _missedDays: number[]; + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._campaignName = wrapper.readString(); + this._campaignImage = wrapper.readString(); + this._currentDay = wrapper.readInt(); + this._campaignDays = wrapper.readInt(); + this._openedDays = []; + + let count = wrapper.readInt(); + + while(count > 0) + { + this._openedDays.push(wrapper.readInt()); + + count--; + } + + this._missedDays = []; + + count = wrapper.readInt(); + + while(count > 0) + { + this._missedDays.push(wrapper.readInt()); + + count--; + } + + return true; + } + + public clone(): CampaignCalendarData + { + const data = new CampaignCalendarData(); + + data._Str_8399 = this._campaignDays; + data._Str_19589 = this._campaignImage; + data._Str_11123 = this._campaignName; + data._Str_5472 = this._currentDay; + data._Str_14267 = this._missedDays; + data._Str_10724 = this._openedDays; + + return data; + } + + public get _Str_11123(): string + { + return this._campaignName; + } + + public set _Str_11123(name: string) + { + this._campaignName = name; + } + + public get _Str_19589(): string + { + return this._campaignImage; + } + + public set _Str_19589(image: string) + { + this._campaignImage = image; + } + + public get _Str_5472(): number + { + return this._currentDay; + } + + public set _Str_5472(day: number) + { + this._currentDay = day; + } + + public get _Str_8399(): number + { + return this._campaignDays; + } + + public set _Str_8399(days: number) + { + this._campaignDays = days; + } + + public get _Str_10724(): number[] + { + return this._openedDays; + } + + public set _Str_10724(days: number[]) + { + this._openedDays = days; + } + + public get _Str_14267(): number[] + { + return this._missedDays; + } + + public set _Str_14267(days: number[]) + { + this._missedDays = days; + } +} diff --git a/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts new file mode 100644 index 00000000..40c51aff --- /dev/null +++ b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from './../../../../../core/communication/messages/IMessageParser'; +import { CampaignCalendarData } from './CampaignCalendarData'; + +export class CampaignCalendarDataMessageParser implements IMessageParser +{ + private _calendarData: CampaignCalendarData; + + public flush(): boolean + { + this._calendarData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._calendarData.parse(wrapper); + + return true; + } + + public get calendarData(): CampaignCalendarData + { + return this._calendarData; + } +} diff --git a/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts new file mode 100644 index 00000000..14a732dd --- /dev/null +++ b/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from './../../../../../core/communication/messages/IMessageParser'; + +export class CampaignCalendarDoorOpenedMessageParser implements IMessageParser +{ + private _Str_17229: boolean; + private _productName: string; + private _customImage: string; + private _Str_6002: string; + + public flush(): boolean + { + this._Str_17229 = false; + this._productName = null; + this._customImage = null; + this._Str_6002 = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._Str_17229 = wrapper.readBoolean(); + this._productName = wrapper.readString(); + this._customImage = wrapper.readString(); + this._Str_6002 = wrapper.readString(); + + return true; + } + + public get _Str_22341(): boolean + { + return this._Str_17229; + } + + public get productName(): string + { + return this._productName; + } + + public get customImage(): string + { + return this._customImage; + } + + public get _Str_8979(): string + { + return this._Str_6002; + } +} diff --git a/src/nitro/communication/messages/parser/campaign/index.ts b/src/nitro/communication/messages/parser/campaign/index.ts new file mode 100644 index 00000000..bb30603c --- /dev/null +++ b/src/nitro/communication/messages/parser/campaign/index.ts @@ -0,0 +1,3 @@ +export * from './CampaignCalendarData'; +export * from './CampaignCalendarDataMessageParser'; +export * from './CampaignCalendarDoorOpenedMessageParser';