Merge branch 'Snaiker-nux-system'

This commit is contained in:
dank074 2022-12-23 16:31:38 -06:00
commit 473f3ab12c
15 changed files with 229 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

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

View File

@ -36,6 +36,7 @@ export * from './moderation';
export * from './mysterybox';
export * from './navigator';
export * from './notifications';
export * from './nux';
export * from './perk';
export * from './pet';
export * from './poll';

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 index = 0;
while(index < count)
{
this._productOfferList.push(new ProductOffer(wrapper));
index++;
}
}
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 count:number = wrapper.readInt();
let index = 0;
while(index < count)
{
this._options.push(new NewUserExperienceGift(wrapper));
index++;
}
}
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 HARVEST_PET = 1521;
public static GROUP_UNFAVORITE = 1820;
public static NEW_USER_EXPERIENCE_GET_GIFTS = 1822;
}

View File

@ -32,6 +32,7 @@ export * from './marketplace';
export * from './moderation';
export * from './mysterybox';
export * from './navigator';
export * from './nux';
export * from './OutgoingHeader';
export * from './pet';
export * from './poll';

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 count = wrapper.readInt();
this._giftOptions = [];
let index = 0;
while(index < count)
{
this._giftOptions.push(new NewUserExperienceGiftOptions(wrapper));
index++;
}
return true;
}
public get giftOptions(): NewUserExperienceGiftOptions[]
{
return this._giftOptions;
}
}

View File

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