Nux Packets (Gifts)

This commit is contained in:
Snaiker 2022-12-23 11:36:20 +00:00
parent c9307102f6
commit 062df1b752
13 changed files with 228 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -404,4 +404,5 @@ export class IncomingHeader
public static ROOM_SETTINGS_ERROR = 2897; public static ROOM_SETTINGS_ERROR = 2897;
public static SHOW_ENFORCE_ROOM_CATEGORY = 3896; public static SHOW_ENFORCE_ROOM_CATEGORY = 3896;
public static CUSTOM_USER_NOTIFICATION = 909; public static CUSTOM_USER_NOTIFICATION = 909;
public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575;
} }

View File

@ -0,0 +1,37 @@
import { IMessageDataWrapper } from '../../../../../api';
import { ProductOffer } from './ProductOffer';
export class NewUserExperienceGift
{
private _thumbnailUrl: string;
private _productOfferList: ProductOffer[];
constructor(wrapper: IMessageDataWrapper)
{
this._thumbnailUrl = wrapper.readString();
if(this._thumbnailUrl == '')
{
this._thumbnailUrl = null;
}
this._productOfferList = [];
const count:number = wrapper.readInt();
let totalOffers:number;
while(totalOffers < count)
{
this._productOfferList.push(new ProductOffer(wrapper));
totalOffers++;
}
}
public get productOfferList(): ProductOffer[]
{
return this._productOfferList;
}
public get thumbnailUrl(): string
{
return this._thumbnailUrl;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { NewUserExperienceGiftOfferMessageParser } from '../../parser/nux';
export class NewUserExperienceGiftOfferMessageEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, NewUserExperienceGiftOfferMessageParser);
}
public getParser(): NewUserExperienceGiftOfferMessageParser
{
return this.parser as NewUserExperienceGiftOfferMessageParser;
}
}

View File

@ -0,0 +1,40 @@
import { IMessageDataWrapper } from '../../../../../api';
import { NewUserExperienceGift } from './NewUserExperienceGift';
export class NewUserExperienceGiftOptions
{
private _dayIndex: number;
private _stepIndex: number;
private _options: NewUserExperienceGift[];
constructor(wrapper: IMessageDataWrapper)
{
this._dayIndex = wrapper.readInt();
this._stepIndex = wrapper.readInt();
this._options = [];
const _local_2:number = wrapper.readInt();
let _local_3:number;
while(_local_3 < _local_2)
{
this._options.push(new NewUserExperienceGift(wrapper));
_local_3++;
}
}
public get dayIndex(): number
{
return this._dayIndex;
}
public get stepIndex(): number
{
return this._stepIndex;
}
public get options(): NewUserExperienceGift[]
{
return this._options;
}
}

View File

@ -0,0 +1,28 @@
import { IMessageDataWrapper } from '../../../../../api';
export class ProductOffer
{
private _itemName: string;
private _extraInfo: string;
constructor(wrapper: IMessageDataWrapper)
{
this._itemName = wrapper.readString();
this._extraInfo = wrapper.readString();
if(this._extraInfo == '')
{
this._extraInfo = null;
}
}
public get itemName(): string
{
return this._itemName;
}
public get extraInfo(): string
{
return this._extraInfo;
}
}

View File

@ -0,0 +1,4 @@
export * from './NewUserExperienceGift';
export * from './NewUserExperienceGiftOfferMessageEvent';
export * from './NewUserExperienceGiftOptions';
export * from './ProductOffer';

View File

@ -433,4 +433,5 @@ export class OutgoingHeader
public static COMPOST_PLANT = 3835; public static COMPOST_PLANT = 3835;
public static HARVEST_PET = 1521; public static HARVEST_PET = 1521;
public static GROUP_UNFAVORITE = 1820; public static GROUP_UNFAVORITE = 1820;
public static NEW_USER_EXPERIENCE_GET_GIFTS = 1822;
} }

View File

@ -0,0 +1,28 @@
import { IMessageComposer } from '../../../../../api';
import { NewUserExperienceGetGiftsSelection } from './NewUserExperienceGetGiftsSelection';
export class NewUserExperienceGetGiftsComposer implements IMessageComposer<ConstructorParameters<typeof NewUserExperienceGetGiftsComposer>>
{
private _data: any;
constructor(...data: NewUserExperienceGetGiftsSelection[])
{
this._data = [data.length * 3];
data.forEach(entry =>
{
this._data.push(entry.dayIndex);
this._data.push(entry.stepIndex);
this._data.push(entry.giftIndex);
});
}
dispose(): void
{
this._data = null;
}
public getMessageArray()
{
return this._data;
}
}

View File

@ -0,0 +1,28 @@
export class NewUserExperienceGetGiftsSelection
{
private _dayIndex: number;
private _stepIndex: number;
private _giftIndex: number;
constructor(dayIndex: number, stepIndex: number, giftIndex: number)
{
this._dayIndex = dayIndex;
this._stepIndex = stepIndex;
this._giftIndex = giftIndex;
}
public get dayIndex(): number
{
return this._dayIndex;
}
public get stepIndex(): number
{
return this._stepIndex;
}
public get giftIndex(): number
{
return this._giftIndex;
}
}

View File

@ -0,0 +1,2 @@
export * from './NewUserExperienceGetGiftsComposer';
export * from './NewUserExperienceGetGiftsSelection';

View File

@ -0,0 +1,34 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
import { NewUserExperienceGiftOptions } from '../../incoming/nux';
export class NewUserExperienceGiftOfferMessageParser implements IMessageParser
{
private _giftOptions: NewUserExperienceGiftOptions[];
public flush(): boolean
{
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
const _local_2 = wrapper.readInt();
this._giftOptions = [];
let _local_3:number;
while(_local_3 < _local_2)
{
this._giftOptions.push(new NewUserExperienceGiftOptions(wrapper));
_local_3++;
}
return true;
}
public get giftOptions(): NewUserExperienceGiftOptions[]
{
return this._giftOptions;
}
}

View File

@ -0,0 +1 @@
export * from './NewUserExperienceGiftOfferMessageParser';