Add calendar packets

This commit is contained in:
Bill 2021-08-22 20:30:14 -04:00
parent 224b085079
commit 49e1336e9d
9 changed files with 243 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import { CameraStorageUrlMessageEvent } from './messages/incoming/camera/CameraS
import { CompetitionStatusMessageEvent } from './messages/incoming/camera/CompetitionStatusMessageEvent'; import { CompetitionStatusMessageEvent } from './messages/incoming/camera/CompetitionStatusMessageEvent';
import { InitCameraMessageEvent } from './messages/incoming/camera/InitCameraMessageEvent'; import { InitCameraMessageEvent } from './messages/incoming/camera/InitCameraMessageEvent';
import { ThumbnailStatusMessageEvent } from './messages/incoming/camera/ThumbnailStatusMessageEvent'; import { ThumbnailStatusMessageEvent } from './messages/incoming/camera/ThumbnailStatusMessageEvent';
import { CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent } from './messages/incoming/campaign';
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent'; import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent';
import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent'; import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent';
import { CatalogGiftConfigurationEvent } from './messages/incoming/catalog/CatalogGiftConfigurationEvent'; 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_TOPICS, CfhTopicsInitEvent);
this._events.set(IncomingHeader.CFH_SANCTION_STATUS, SanctionStatusEvent); 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 // CATALOG
this._events.set(IncomingHeader.CATALOG_CLUB, CatalogClubEvent); this._events.set(IncomingHeader.CATALOG_CLUB, CatalogClubEvent);
this._events.set(IncomingHeader.CATALOG_MODE, CatalogModeEvent); this._events.set(IncomingHeader.CATALOG_MODE, CatalogModeEvent);

View File

@ -292,4 +292,6 @@ export class IncomingHeader
public static CFH_SANCTION = 2782; public static CFH_SANCTION = 2782;
public static CFH_TOPICS = 325; public static CFH_TOPICS = 325;
public static CFH_SANCTION_STATUS = 2221; public static CFH_SANCTION_STATUS = 2221;
public static CAMPAIGN_CALENDAR_DATA = 2531;
public static CAMPAIGN_CALENDAR_DOOR_OPENED = 2551;
} }

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,2 @@
export * from './CampaignCalendarDataMessageEvent';
export * from './CampaignCalendarDoorOpenedMessageEvent';

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,3 @@
export * from './CampaignCalendarData';
export * from './CampaignCalendarDataMessageParser';
export * from './CampaignCalendarDoorOpenedMessageParser';