You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
Move to Renderer V2
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class InterstitialMessageParser implements IMessageParser
|
||||
{
|
||||
private _canShowInterstitial: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._canShowInterstitial = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._canShowInterstitial = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get canShowInterstitial(): boolean
|
||||
{
|
||||
return this._canShowInterstitial;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class RoomAdErrorMessageParser implements IMessageParser
|
||||
{
|
||||
private _errorCode: number;
|
||||
private _filteredText: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._errorCode = 0;
|
||||
this._filteredText = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._errorCode = wrapper.readInt();
|
||||
this._filteredText = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get errorCode(): number
|
||||
{
|
||||
return this._errorCode;
|
||||
}
|
||||
|
||||
public get filteredText(): string
|
||||
{
|
||||
return this._filteredText;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './InterstitialMessageParser';
|
||||
export * from './RoomAdErrorMessageParser';
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class AvailabilityStatusMessageParser implements IMessageParser
|
||||
{
|
||||
private _isOpen: boolean;
|
||||
private _onShutdown: boolean;
|
||||
private _isAuthenticUser: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._isOpen = false;
|
||||
this._onShutdown = false;
|
||||
this._isAuthenticUser = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._isOpen = wrapper.readBoolean();
|
||||
this._onShutdown = wrapper.readBoolean();
|
||||
|
||||
if(wrapper.bytesAvailable)
|
||||
{
|
||||
this._isAuthenticUser = wrapper.readBoolean();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get isOpen(): boolean
|
||||
{
|
||||
return this._isOpen;
|
||||
}
|
||||
|
||||
public get onShutdown(): boolean
|
||||
{
|
||||
return this._onShutdown;
|
||||
}
|
||||
|
||||
public get isAuthenticUser(): boolean
|
||||
{
|
||||
return this._isAuthenticUser;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class AvailabilityTimeMessageParser implements IMessageParser
|
||||
{
|
||||
private _isOpen: boolean;
|
||||
private _minutesUntilChange: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._isOpen = false;
|
||||
this._minutesUntilChange = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._isOpen = (wrapper.readInt() > 0);
|
||||
this._minutesUntilChange = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get isOpen(): boolean
|
||||
{
|
||||
return this._isOpen;
|
||||
}
|
||||
|
||||
public get minutesUntilChange(): number
|
||||
{
|
||||
return this._minutesUntilChange;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class HotelClosedAndOpensMessageParser implements IMessageParser
|
||||
{
|
||||
private _openHour: number;
|
||||
private _openMinute: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._openHour = 0;
|
||||
this._openMinute = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._openHour = wrapper.readInt();
|
||||
this._openMinute = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get openHour(): number
|
||||
{
|
||||
return this._openHour;
|
||||
}
|
||||
|
||||
public get openMinute(): number
|
||||
{
|
||||
return this._openMinute;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class HotelClosesAndWillOpenAtMessageParser implements IMessageParser
|
||||
{
|
||||
private _openHour: number;
|
||||
private _openMinute: number;
|
||||
private _userThrownOutAtClose: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._openHour = 0;
|
||||
this._openMinute = 0;
|
||||
this._userThrownOutAtClose = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._openHour = wrapper.readInt();
|
||||
this._openMinute = wrapper.readInt();
|
||||
this._userThrownOutAtClose = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get openHour(): number
|
||||
{
|
||||
return this._openHour;
|
||||
}
|
||||
|
||||
public get openMinute(): number
|
||||
{
|
||||
return this._openMinute;
|
||||
}
|
||||
|
||||
public get userThrowOutAtClose(): boolean
|
||||
{
|
||||
return this._userThrownOutAtClose;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class HotelWillCloseInMinutesMessageParser implements IMessageParser
|
||||
{
|
||||
private _minutes: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._minutes = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._minutes = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get openMinute(): number
|
||||
{
|
||||
return this._minutes;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class MaintenanceStatusMessageParser implements IMessageParser
|
||||
{
|
||||
private _isInMaintenance: boolean;
|
||||
private _minutesUntilMaintenance: number;
|
||||
private _duration: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._isInMaintenance = false;
|
||||
this._minutesUntilMaintenance = 0;
|
||||
this._duration = 15;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._isInMaintenance = wrapper.readBoolean();
|
||||
this._minutesUntilMaintenance = wrapper.readInt();
|
||||
|
||||
if(wrapper.bytesAvailable)
|
||||
{
|
||||
this._duration = wrapper.readInt();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get isInMaintenance(): boolean
|
||||
{
|
||||
return this._isInMaintenance;
|
||||
}
|
||||
|
||||
public get minutesUntilMaintenance(): number
|
||||
{
|
||||
return this._minutesUntilMaintenance;
|
||||
}
|
||||
|
||||
public get duration(): number
|
||||
{
|
||||
return this._duration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './AvailabilityStatusMessageParser';
|
||||
export * from './AvailabilityTimeMessageParser';
|
||||
export * from './HotelClosedAndOpensMessageParser';
|
||||
export * from './HotelClosesAndWillOpenAtMessageParser';
|
||||
export * from './HotelWillCloseInMinutesMessageParser';
|
||||
export * from './MaintenanceStatusMessageParser';
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class ChangeUserNameResultMessageParser implements IMessageParser
|
||||
{
|
||||
private _resultCode: number;
|
||||
private _name: string;
|
||||
private _nameSuggestions: string[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._resultCode = -1;
|
||||
this._name = '';
|
||||
this._nameSuggestions = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._resultCode = wrapper.readInt();
|
||||
this._name = wrapper.readString();
|
||||
|
||||
let totalSuggestions = wrapper.readInt();
|
||||
|
||||
while(totalSuggestions > 0)
|
||||
{
|
||||
this._nameSuggestions.push(wrapper.readString());
|
||||
|
||||
totalSuggestions--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get resultCode(): number
|
||||
{
|
||||
return this._resultCode;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get nameSuggestions(): string[]
|
||||
{
|
||||
return this._nameSuggestions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CheckUserNameResultMessageParser implements IMessageParser
|
||||
{
|
||||
private _resultCode: number;
|
||||
private _name: string;
|
||||
private _nameSuggestions: string[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._resultCode = -1;
|
||||
this._name = '';
|
||||
this._nameSuggestions = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._resultCode = wrapper.readInt();
|
||||
this._name = wrapper.readString();
|
||||
|
||||
let totalSuggestions = wrapper.readInt();
|
||||
|
||||
while(totalSuggestions > 0)
|
||||
{
|
||||
this._nameSuggestions.push(wrapper.readString());
|
||||
|
||||
totalSuggestions--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get resultCode(): number
|
||||
{
|
||||
return this._resultCode;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get nameSuggestions(): string[]
|
||||
{
|
||||
return this._nameSuggestions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class FigureUpdateParser implements IMessageParser
|
||||
{
|
||||
private _figure: string;
|
||||
private _gender: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._figure = '';
|
||||
this._gender = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._figure = wrapper.readString();
|
||||
this._gender = wrapper.readString();
|
||||
|
||||
if(this._gender) this._gender = this._gender.toUpperCase();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get figure(): string
|
||||
{
|
||||
return this._figure;
|
||||
}
|
||||
|
||||
public get gender(): string
|
||||
{
|
||||
return this._gender;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class OutfitData
|
||||
{
|
||||
private _slotId: number;
|
||||
private _figureString: string;
|
||||
private _gender: string;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._slotId = wrapper.readInt();
|
||||
this._figureString = wrapper.readString();
|
||||
this._gender = wrapper.readString();
|
||||
}
|
||||
|
||||
public get slotId(): number
|
||||
{
|
||||
return this._slotId;
|
||||
}
|
||||
|
||||
public get figureString(): string
|
||||
{
|
||||
return this._figureString;
|
||||
}
|
||||
|
||||
public get gender(): string
|
||||
{
|
||||
return this._gender;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { OutfitData } from './OutfitData';
|
||||
|
||||
export class WardrobeMessageParser implements IMessageParser
|
||||
{
|
||||
private _state: number;
|
||||
private _outfits: OutfitData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._state = 0;
|
||||
this._outfits = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._state = wrapper.readInt();
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._outfits.push(new OutfitData(wrapper));
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get state(): number
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public get outfits(): OutfitData[]
|
||||
{
|
||||
return this._outfits;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './ChangeUserNameResultMessageParser';
|
||||
export * from './CheckUserNameResultMessageParser';
|
||||
export * from './FigureUpdateParser';
|
||||
export * from './OutfitData';
|
||||
export * from './WardrobeMessageParser';
|
||||
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BotData } from './BotData';
|
||||
|
||||
export class BotAddedToInventoryParser implements IMessageParser
|
||||
{
|
||||
private _item: BotData;
|
||||
private _openInventory: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._item = null;
|
||||
this._openInventory = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._item = new BotData(wrapper);
|
||||
this._openInventory = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get item(): BotData
|
||||
{
|
||||
return this._item;
|
||||
}
|
||||
|
||||
public openInventory(): boolean
|
||||
{
|
||||
return this._openInventory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class BotData
|
||||
{
|
||||
private _id: number;
|
||||
private _name: string;
|
||||
private _motto: string;
|
||||
private _gender: string;
|
||||
private _figure: string;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_parser');
|
||||
|
||||
this._id = wrapper.readInt();
|
||||
this._name = wrapper.readString();
|
||||
this._motto = wrapper.readString();
|
||||
this._gender = wrapper.readString();
|
||||
this._figure = wrapper.readString();
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get motto(): string
|
||||
{
|
||||
return this._motto;
|
||||
}
|
||||
|
||||
public get figure(): string
|
||||
{
|
||||
return this._figure;
|
||||
}
|
||||
|
||||
public get gender(): string
|
||||
{
|
||||
return this._gender;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BotData } from './BotData';
|
||||
|
||||
export class BotInventoryMessageParser implements IMessageParser
|
||||
{
|
||||
private _items: Map<number, BotData>;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._items = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._items = new Map();
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
const data = new BotData(wrapper);
|
||||
|
||||
this._items.set(data.id, data);
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get items(): Map<number, BotData>
|
||||
{
|
||||
return this._items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BotData } from './BotData';
|
||||
|
||||
export class BotReceivedMessageParser implements IMessageParser
|
||||
{
|
||||
private _boughtAsGift: boolean;
|
||||
private _item: BotData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._boughtAsGift = false;
|
||||
this._item = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._boughtAsGift = wrapper.readBoolean();
|
||||
this._item = new BotData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get boughtAsGift(): boolean
|
||||
{
|
||||
return this._boughtAsGift;
|
||||
}
|
||||
|
||||
public get item(): BotData
|
||||
{
|
||||
return this._item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class BotRemovedFromInventoryParser implements IMessageParser
|
||||
{
|
||||
private _itemId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._itemId = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._itemId = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get itemId(): number
|
||||
{
|
||||
return this._itemId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './BotAddedToInventoryParser';
|
||||
export * from './BotData';
|
||||
export * from './BotInventoryMessageParser';
|
||||
export * from './BotReceivedMessageParser';
|
||||
export * from './BotRemovedFromInventoryParser';
|
||||
@@ -0,0 +1,48 @@
|
||||
import { IDisposable, IMessageDataWrapper } from '@nitrots/api';
|
||||
import { INamed } from '../moderation';
|
||||
import { CallForHelpTopicData } from './CallForHelpTopicData';
|
||||
|
||||
export class CallForHelpCategoryData implements INamed, IDisposable
|
||||
{
|
||||
private _name: string;
|
||||
private _topics: CallForHelpTopicData[];
|
||||
private _disposed: boolean;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._topics = [];
|
||||
this._name = wrapper.readString();
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._topics.push(new CallForHelpTopicData(wrapper));
|
||||
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
if(this._disposed) return;
|
||||
|
||||
this._disposed = true;
|
||||
this._topics = null;
|
||||
}
|
||||
|
||||
public get disposed(): boolean
|
||||
{
|
||||
return this._disposed;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get topics(): CallForHelpTopicData[]
|
||||
{
|
||||
return this._topics;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { INamed } from '../moderation';
|
||||
|
||||
export class CallForHelpTopicData implements INamed
|
||||
{
|
||||
private _name: string;
|
||||
private _id: number;
|
||||
private _consequence: string;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._name = wrapper.readString();
|
||||
this._id = wrapper.readInt();
|
||||
this._consequence = wrapper.readString();
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get consequence(): string
|
||||
{
|
||||
return this._consequence;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CfhSanctionTypeData } from './CfhSanctionTypeData';
|
||||
|
||||
export class CfhSanctionMessageParser implements IMessageParser
|
||||
{
|
||||
private _issueId: number;
|
||||
private _accountId: number;
|
||||
private _sanctionType: CfhSanctionTypeData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._issueId = -1;
|
||||
this._accountId = 1;
|
||||
this._sanctionType = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._issueId = wrapper.readInt();
|
||||
this._accountId = wrapper.readInt();
|
||||
this._sanctionType = new CfhSanctionTypeData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get issueId(): number
|
||||
{
|
||||
return this._issueId;
|
||||
}
|
||||
|
||||
public get accountId(): number
|
||||
{
|
||||
return this._accountId;
|
||||
}
|
||||
|
||||
public get sanctionType(): CfhSanctionTypeData
|
||||
{
|
||||
return this._sanctionType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { INamed } from '../moderation';
|
||||
|
||||
export class CfhSanctionTypeData implements INamed
|
||||
{
|
||||
private _name: string;
|
||||
private _sanctionLengthInHours: number;
|
||||
private _probationDays: number;
|
||||
private _avatarOnly: boolean;
|
||||
private _tradeLockInfo: string = '';
|
||||
private _machineBanInfo: string = '';
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._name = wrapper.readString();
|
||||
this._sanctionLengthInHours = wrapper.readInt();
|
||||
this._probationDays = wrapper.readInt();
|
||||
this._avatarOnly = wrapper.readBoolean();
|
||||
|
||||
if(wrapper.bytesAvailable) this._tradeLockInfo = wrapper.readString();
|
||||
|
||||
if(wrapper.bytesAvailable) this._machineBanInfo = wrapper.readString();
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get sanctionLengthInHours(): number
|
||||
{
|
||||
return this._sanctionLengthInHours;
|
||||
}
|
||||
|
||||
public get avatarOnly(): boolean
|
||||
{
|
||||
return this._avatarOnly;
|
||||
}
|
||||
|
||||
public get tradeLockInfo(): string
|
||||
{
|
||||
return this._tradeLockInfo;
|
||||
}
|
||||
|
||||
public get machineBanInfo(): string
|
||||
{
|
||||
return this._machineBanInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CallForHelpCategoryData } from './CallForHelpCategoryData';
|
||||
|
||||
export class CfhTopicsInitMessageParser implements IMessageParser
|
||||
{
|
||||
private _callForHelpCategories: CallForHelpCategoryData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._callForHelpCategories = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._callForHelpCategories = [];
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._callForHelpCategories.push(new CallForHelpCategoryData(wrapper));
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get callForHelpCategories(): CallForHelpCategoryData[]
|
||||
{
|
||||
return this._callForHelpCategories;
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class SanctionStatusMessageParser implements IMessageParser
|
||||
{
|
||||
private _isSanctionNew: boolean;
|
||||
private _isSanctionActive: boolean;
|
||||
private _sanctionName: string;
|
||||
private _sanctionLengthHours: number;
|
||||
private _sanctionReason: string;
|
||||
private _sanctionCreationTime: string;
|
||||
private _probationHoursLeft: number;
|
||||
private _nextSanctionName: string;
|
||||
private _nextSanctionLengthHours: number;
|
||||
private _hasCustomMute: boolean;
|
||||
private _tradeLockExpiryTime: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._isSanctionNew = false;
|
||||
this._isSanctionActive = false;
|
||||
this._sanctionName = null;
|
||||
this._sanctionLengthHours = 0;
|
||||
this._sanctionReason = null;
|
||||
this._sanctionCreationTime = null;
|
||||
this._probationHoursLeft = 0;
|
||||
this._nextSanctionName = null;
|
||||
this._nextSanctionLengthHours = 0;
|
||||
this._hasCustomMute = false;
|
||||
this._tradeLockExpiryTime = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._isSanctionNew = wrapper.readBoolean();
|
||||
this._isSanctionActive = wrapper.readBoolean();
|
||||
this._sanctionName = wrapper.readString();
|
||||
this._sanctionLengthHours = wrapper.readInt();
|
||||
|
||||
wrapper.readInt();
|
||||
|
||||
this._sanctionReason = wrapper.readString();
|
||||
this._sanctionCreationTime = wrapper.readString();
|
||||
this._probationHoursLeft = wrapper.readInt();
|
||||
this._nextSanctionName = wrapper.readString();
|
||||
this._nextSanctionLengthHours = wrapper.readInt();
|
||||
|
||||
wrapper.readInt();
|
||||
|
||||
this._hasCustomMute = wrapper.readBoolean();
|
||||
|
||||
if(wrapper.bytesAvailable) this._tradeLockExpiryTime = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get isSanctionNew(): boolean
|
||||
{
|
||||
return this._isSanctionNew;
|
||||
}
|
||||
|
||||
public get isSanctionActive(): boolean
|
||||
{
|
||||
return this._isSanctionActive;
|
||||
}
|
||||
|
||||
public get sanctionName(): string
|
||||
{
|
||||
return this._sanctionName;
|
||||
}
|
||||
|
||||
public get sanctionLengthHours(): number
|
||||
{
|
||||
return this._sanctionLengthHours;
|
||||
}
|
||||
|
||||
public get sanctionReason(): string
|
||||
{
|
||||
return this._sanctionReason;
|
||||
}
|
||||
|
||||
public get sanctionCreationTime(): string
|
||||
{
|
||||
return this._sanctionCreationTime;
|
||||
}
|
||||
|
||||
public get probationHoursLeft(): number
|
||||
{
|
||||
return this._probationHoursLeft;
|
||||
}
|
||||
|
||||
public get nextSanctionName(): string
|
||||
{
|
||||
return this._nextSanctionName;
|
||||
}
|
||||
|
||||
public get nextSanctionLengthHours(): number
|
||||
{
|
||||
return this._nextSanctionLengthHours;
|
||||
}
|
||||
|
||||
public get hasCustomMute(): boolean
|
||||
{
|
||||
return this._hasCustomMute;
|
||||
}
|
||||
|
||||
public get tradeLockExpiryTime(): string
|
||||
{
|
||||
return this._tradeLockExpiryTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './CallForHelpCategoryData';
|
||||
export * from './CallForHelpTopicData';
|
||||
export * from './CfhSanctionMessageParser';
|
||||
export * from './CfhSanctionTypeData';
|
||||
export * from './CfhTopicsInitMessageParser';
|
||||
export * from './SanctionStatusMessageParser';
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CameraPublishStatusMessageParser implements IMessageParser
|
||||
{
|
||||
private _ok: boolean = false;
|
||||
private _secondsToWait: number = 0;
|
||||
private _extraDataId: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._ok = false;
|
||||
this._secondsToWait = 0;
|
||||
this._extraDataId = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._ok = wrapper.readBoolean();
|
||||
this._secondsToWait = wrapper.readInt();
|
||||
|
||||
if(this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get ok(): boolean
|
||||
{
|
||||
return this._ok;
|
||||
}
|
||||
|
||||
public get secondsToWait(): number
|
||||
{
|
||||
return this._secondsToWait;
|
||||
}
|
||||
|
||||
public get extraDataId(): string
|
||||
{
|
||||
return this._extraDataId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CameraPurchaseOKMessageParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CameraSnapshotMessageParser implements IMessageParser
|
||||
{
|
||||
private _roomType: string;
|
||||
private _roomId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._roomType = null;
|
||||
this._roomId = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._roomType = wrapper.readString();
|
||||
this._roomId = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get roomType(): string
|
||||
{
|
||||
return this._roomType;
|
||||
}
|
||||
|
||||
public get roomId(): number
|
||||
{
|
||||
return this._roomId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CameraStorageUrlMessageParser implements IMessageParser
|
||||
{
|
||||
private _url: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._url = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._url = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get url(): string
|
||||
{
|
||||
return this._url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CompetitionStatusMessageParser implements IMessageParser
|
||||
{
|
||||
private _ok: boolean = false;
|
||||
private _errorReason: string = null;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._ok = false;
|
||||
this._errorReason = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._ok = wrapper.readBoolean();
|
||||
this._errorReason = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get ok(): boolean
|
||||
{
|
||||
return this._ok;
|
||||
}
|
||||
|
||||
public get errorReason(): string
|
||||
{
|
||||
return this._errorReason;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class InitCameraMessageParser implements IMessageParser
|
||||
{
|
||||
private _creditPrice: number = 0;
|
||||
private _ducketPrice: number = 0;
|
||||
private _publishDucketPrice: number = 0;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._creditPrice = 0;
|
||||
this._ducketPrice = 0;
|
||||
this._publishDucketPrice = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._creditPrice = wrapper.readInt();
|
||||
this._ducketPrice = wrapper.readInt();
|
||||
|
||||
if(wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get creditPrice(): number
|
||||
{
|
||||
return this._creditPrice;
|
||||
}
|
||||
|
||||
public get ducketPrice(): number
|
||||
{
|
||||
return this._ducketPrice;
|
||||
}
|
||||
|
||||
public get publishDucketPrice(): number
|
||||
{
|
||||
return this._publishDucketPrice;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class ThumbnailStatusMessageParser implements IMessageParser
|
||||
{
|
||||
private _ok: boolean = true;
|
||||
private _renderLimitHit: boolean = false;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._ok = true;
|
||||
this._renderLimitHit = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
if(wrapper.bytesAvailable)
|
||||
{
|
||||
this._ok = wrapper.readBoolean();
|
||||
this._renderLimitHit = wrapper.readBoolean();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get ok(): boolean
|
||||
{
|
||||
return this._ok;
|
||||
}
|
||||
|
||||
public get isRenderLimitHit(): boolean
|
||||
{
|
||||
return this._renderLimitHit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './CameraPublishStatusMessageParser';
|
||||
export * from './CameraPurchaseOKMessageParser';
|
||||
export * from './CameraSnapshotMessageParser';
|
||||
export * from './CameraStorageUrlMessageParser';
|
||||
export * from './CompetitionStatusMessageParser';
|
||||
export * from './InitCameraMessageParser';
|
||||
export * from './ThumbnailStatusMessageParser';
|
||||
@@ -0,0 +1,114 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
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();
|
||||
|
||||
for(let i = 0; i < count; i++)
|
||||
{
|
||||
this._openedDays.push(wrapper.readInt());
|
||||
}
|
||||
|
||||
this._missedDays = [];
|
||||
|
||||
count = wrapper.readInt();
|
||||
|
||||
for(let i = 0; i < count; i++)
|
||||
{
|
||||
this._missedDays.push(wrapper.readInt());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public clone(): CampaignCalendarData
|
||||
{
|
||||
const data = new CampaignCalendarData();
|
||||
|
||||
data.campaignDays = this._campaignDays;
|
||||
data.campaignImage = this._campaignImage;
|
||||
data.campaignName = this._campaignName;
|
||||
data.currentDay = this._currentDay;
|
||||
data.missedDays = this._missedDays;
|
||||
data.openedDays = this._openedDays;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public get campaignName(): string
|
||||
{
|
||||
return this._campaignName;
|
||||
}
|
||||
|
||||
public set campaignName(name: string)
|
||||
{
|
||||
this._campaignName = name;
|
||||
}
|
||||
|
||||
public get campaignImage(): string
|
||||
{
|
||||
return this._campaignImage;
|
||||
}
|
||||
|
||||
public set campaignImage(image: string)
|
||||
{
|
||||
this._campaignImage = image;
|
||||
}
|
||||
|
||||
public get currentDay(): number
|
||||
{
|
||||
return this._currentDay;
|
||||
}
|
||||
|
||||
public set currentDay(day: number)
|
||||
{
|
||||
this._currentDay = day;
|
||||
}
|
||||
|
||||
public get campaignDays(): number
|
||||
{
|
||||
return this._campaignDays;
|
||||
}
|
||||
|
||||
public set campaignDays(days: number)
|
||||
{
|
||||
this._campaignDays = days;
|
||||
}
|
||||
|
||||
public get openedDays(): number[]
|
||||
{
|
||||
return this._openedDays;
|
||||
}
|
||||
|
||||
public set openedDays(days: number[])
|
||||
{
|
||||
this._openedDays = days;
|
||||
}
|
||||
|
||||
public get missedDays(): number[]
|
||||
{
|
||||
return this._missedDays;
|
||||
}
|
||||
|
||||
public set missedDays(days: number[])
|
||||
{
|
||||
this._missedDays = days;
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
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 = new CampaignCalendarData();
|
||||
this._calendarData.parse(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get calendarData(): CampaignCalendarData
|
||||
{
|
||||
return this._calendarData;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CampaignCalendarDoorOpenedMessageParser implements IMessageParser
|
||||
{
|
||||
private _doorOpened: boolean;
|
||||
private _productName: string;
|
||||
private _customImage: string;
|
||||
private _furnitureClassName: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._doorOpened = false;
|
||||
this._productName = null;
|
||||
this._customImage = null;
|
||||
this._furnitureClassName = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._doorOpened = wrapper.readBoolean();
|
||||
this._productName = wrapper.readString();
|
||||
this._customImage = wrapper.readString();
|
||||
this._furnitureClassName = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get doorOpened(): boolean
|
||||
{
|
||||
return this._doorOpened;
|
||||
}
|
||||
|
||||
public get productName(): string
|
||||
{
|
||||
return this._productName;
|
||||
}
|
||||
|
||||
public get customImage(): string
|
||||
{
|
||||
return this._customImage;
|
||||
}
|
||||
|
||||
public get furnitureClassName(): string
|
||||
{
|
||||
return this._furnitureClassName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './CampaignCalendarData';
|
||||
export * from './CampaignCalendarDataMessageParser';
|
||||
export * from './CampaignCalendarDoorOpenedMessageParser';
|
||||
@@ -0,0 +1,49 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class BonusRareInfoMessageParser implements IMessageParser
|
||||
{
|
||||
private _productType: string;
|
||||
private _productClassId: number;
|
||||
private _totalCoinsForBonus: number;
|
||||
private _coinsStillRequiredToBuy: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._totalCoinsForBonus = -1;
|
||||
this._coinsStillRequiredToBuy = -1;
|
||||
this._productType = '';
|
||||
this._productClassId = -1;
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._productType = wrapper.readString();
|
||||
this._productClassId = wrapper.readInt();
|
||||
this._totalCoinsForBonus = wrapper.readInt();
|
||||
this._coinsStillRequiredToBuy = wrapper.readInt();
|
||||
return true;
|
||||
}
|
||||
|
||||
public get totalCoinsForBonus(): number
|
||||
{
|
||||
return this._totalCoinsForBonus;
|
||||
}
|
||||
|
||||
public get coinsStillRequiredToBuy(): number
|
||||
{
|
||||
return this._coinsStillRequiredToBuy;
|
||||
}
|
||||
|
||||
public get productType(): string
|
||||
{
|
||||
return this._productType;
|
||||
}
|
||||
|
||||
public get productClassId(): number
|
||||
{
|
||||
return this._productClassId;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class BuildersClubFurniCountMessageParser implements IMessageParser
|
||||
{
|
||||
private _furniCount: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._furniCount = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._furniCount = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get furniCount(): number
|
||||
{
|
||||
return this._furniCount;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class BuildersClubSubscriptionStatusMessageParser implements IMessageParser
|
||||
{
|
||||
private _secondsLeft: number;
|
||||
private _furniLimit: number;
|
||||
private _maxFurniLimit: number;
|
||||
private _secondsLeftWithGrace: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._secondsLeft = 0;
|
||||
this._furniLimit = 0;
|
||||
this._maxFurniLimit = 0;
|
||||
this._secondsLeftWithGrace = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._secondsLeft = wrapper.readInt();
|
||||
this._furniLimit = wrapper.readInt();
|
||||
this._maxFurniLimit = wrapper.readInt();
|
||||
|
||||
if(wrapper.bytesAvailable) this._secondsLeftWithGrace = wrapper.readInt();
|
||||
else this._secondsLeftWithGrace = this._secondsLeft;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get secondsLeft(): number
|
||||
{
|
||||
return this._secondsLeft;
|
||||
}
|
||||
|
||||
public get furniLimit(): number
|
||||
{
|
||||
return this._furniLimit;
|
||||
}
|
||||
|
||||
public get maxFurniLimit(): number
|
||||
{
|
||||
return this._maxFurniLimit;
|
||||
}
|
||||
|
||||
public get secondsLeftWithGrace(): number
|
||||
{
|
||||
return this._secondsLeftWithGrace;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class BundleDiscountRuleset
|
||||
{
|
||||
private _maxPurchaseSize: number;
|
||||
private _bundleSize: number;
|
||||
private _bundleDiscountSize: number;
|
||||
private _bonusThreshold: number;
|
||||
private _additionalBonusDiscountThresholdQuantities: number[];
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._maxPurchaseSize = wrapper.readInt();
|
||||
this._bundleSize = wrapper.readInt();
|
||||
this._bundleDiscountSize = wrapper.readInt();
|
||||
this._bonusThreshold = wrapper.readInt();
|
||||
this._additionalBonusDiscountThresholdQuantities = [];
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._additionalBonusDiscountThresholdQuantities.push(wrapper.readInt());
|
||||
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
public get maxPurchaseSize(): number
|
||||
{
|
||||
return this._maxPurchaseSize;
|
||||
}
|
||||
|
||||
public get bundleSize(): number
|
||||
{
|
||||
return this._bundleSize;
|
||||
}
|
||||
|
||||
public get bundleDiscountSize(): number
|
||||
{
|
||||
return this._bundleDiscountSize;
|
||||
}
|
||||
|
||||
public get bonusThreshold(): number
|
||||
{
|
||||
return this._bonusThreshold;
|
||||
}
|
||||
|
||||
public get additionalBonusDiscountThresholdQuantities(): number[]
|
||||
{
|
||||
return this._additionalBonusDiscountThresholdQuantities;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BundleDiscountRuleset } from './BundleDiscountRuleset';
|
||||
|
||||
export class BundleDiscountRulesetMessageParser implements IMessageParser
|
||||
{
|
||||
private _bundleDiscountRuleset: BundleDiscountRuleset;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._bundleDiscountRuleset = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._bundleDiscountRuleset = new BundleDiscountRuleset(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get bundleDiscountRuleset(): BundleDiscountRuleset
|
||||
{
|
||||
return this._bundleDiscountRuleset;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { NodeData } from './NodeData';
|
||||
|
||||
export class CatalogIndexMessageParser implements IMessageParser
|
||||
{
|
||||
private _root: NodeData;
|
||||
private _newAdditionsAvailable: boolean;
|
||||
private _catalogType: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._root = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._root = new NodeData(wrapper);
|
||||
this._newAdditionsAvailable = wrapper.readBoolean();
|
||||
this._catalogType = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get root(): NodeData
|
||||
{
|
||||
return this._root;
|
||||
}
|
||||
|
||||
public get newAdditionsAvailable(): boolean
|
||||
{
|
||||
return this._newAdditionsAvailable;
|
||||
}
|
||||
|
||||
public get catalogType(): string
|
||||
{
|
||||
return this._catalogType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class CatalogLocalizationData
|
||||
{
|
||||
private _images: string[];
|
||||
private _texts: string[];
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._images = [];
|
||||
this._texts = [];
|
||||
|
||||
let totalImages = wrapper.readInt();
|
||||
|
||||
while(totalImages > 0)
|
||||
{
|
||||
this._images.push(wrapper.readString());
|
||||
|
||||
totalImages--;
|
||||
}
|
||||
|
||||
let totalTexts = wrapper.readInt();
|
||||
|
||||
while(totalTexts > 0)
|
||||
{
|
||||
this._texts.push(wrapper.readString());
|
||||
|
||||
totalTexts--;
|
||||
}
|
||||
}
|
||||
|
||||
public get images(): string[]
|
||||
{
|
||||
return this._images;
|
||||
}
|
||||
|
||||
public get texts(): string[]
|
||||
{
|
||||
return this._texts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CatalogPageExpirationParser implements IMessageParser
|
||||
{
|
||||
private _pageName: string;
|
||||
private _pageId: number;
|
||||
private _secondsToExpiry: number;
|
||||
private _image: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._pageName = null;
|
||||
this._pageId = 0;
|
||||
this._secondsToExpiry = 0;
|
||||
this._image = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._pageId = wrapper.readInt();
|
||||
this._pageName = wrapper.readString();
|
||||
this._secondsToExpiry = wrapper.readInt();
|
||||
this._image = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get pageName(): string
|
||||
{
|
||||
return this._pageName;
|
||||
}
|
||||
|
||||
public get pageId(): number
|
||||
{
|
||||
return this._pageId;
|
||||
}
|
||||
|
||||
public get secondsToExpiry(): number
|
||||
{
|
||||
return this._secondsToExpiry;
|
||||
}
|
||||
|
||||
public get image(): string
|
||||
{
|
||||
return this._image;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { CatalogPageMessageProductData } from './CatalogPageMessageProductData';
|
||||
|
||||
export class CatalogPageMessageOfferData
|
||||
{
|
||||
private _offerId: number;
|
||||
private _localizationId: string;
|
||||
private _rent: boolean;
|
||||
private _priceCredits: number;
|
||||
private _priceActivityPoints: number;
|
||||
private _priceActivityPointsType: number;
|
||||
private _clubLevel: number;
|
||||
private _giftable: boolean;
|
||||
private _bundlePurchaseAllowed: boolean;
|
||||
private _isPet: boolean;
|
||||
private _previewImage: string;
|
||||
private _products: CatalogPageMessageProductData[];
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._offerId = wrapper.readInt();
|
||||
this._localizationId = wrapper.readString();
|
||||
this._rent = wrapper.readBoolean();
|
||||
this._priceCredits = wrapper.readInt();
|
||||
this._priceActivityPoints = wrapper.readInt();
|
||||
this._priceActivityPointsType = wrapper.readInt();
|
||||
this._giftable = wrapper.readBoolean();
|
||||
|
||||
this._products = [];
|
||||
|
||||
let totalProducts = wrapper.readInt();
|
||||
|
||||
while(totalProducts > 0)
|
||||
{
|
||||
this._products.push(new CatalogPageMessageProductData(wrapper));
|
||||
|
||||
totalProducts--;
|
||||
}
|
||||
|
||||
this._clubLevel = wrapper.readInt();
|
||||
this._bundlePurchaseAllowed = wrapper.readBoolean();
|
||||
this._isPet = wrapper.readBoolean();
|
||||
this._previewImage = wrapper.readString();
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get localizationId(): string
|
||||
{
|
||||
return this._localizationId;
|
||||
}
|
||||
|
||||
public get rent(): boolean
|
||||
{
|
||||
return this._rent;
|
||||
}
|
||||
|
||||
public get priceCredits(): number
|
||||
{
|
||||
return this._priceCredits;
|
||||
}
|
||||
|
||||
public get priceActivityPoints(): number
|
||||
{
|
||||
return this._priceActivityPoints;
|
||||
}
|
||||
|
||||
public get priceActivityPointsType(): number
|
||||
{
|
||||
return this._priceActivityPointsType;
|
||||
}
|
||||
|
||||
public get clubLevel(): number
|
||||
{
|
||||
return this._clubLevel;
|
||||
}
|
||||
|
||||
public get giftable(): boolean
|
||||
{
|
||||
return this._giftable;
|
||||
}
|
||||
|
||||
public get bundlePurchaseAllowed(): boolean
|
||||
{
|
||||
return this._bundlePurchaseAllowed;
|
||||
}
|
||||
|
||||
public get isPet(): boolean
|
||||
{
|
||||
return this._isPet;
|
||||
}
|
||||
|
||||
public get previewImage(): string
|
||||
{
|
||||
return this._previewImage;
|
||||
}
|
||||
|
||||
public get products(): CatalogPageMessageProductData[]
|
||||
{
|
||||
return this._products;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CatalogLocalizationData } from './CatalogLocalizationData';
|
||||
import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData';
|
||||
import { FrontPageItem } from './FrontPageItem';
|
||||
|
||||
export class CatalogPageMessageParser implements IMessageParser
|
||||
{
|
||||
private _pageId: number;
|
||||
private _catalogType: string;
|
||||
private _layoutCode: string;
|
||||
private _localization: CatalogLocalizationData;
|
||||
private _offers: CatalogPageMessageOfferData[];
|
||||
private _offerId: number;
|
||||
private _acceptSeasonCurrencyAsCredits: boolean;
|
||||
private _frontPageItems: FrontPageItem[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._pageId = -1;
|
||||
this._catalogType = null;
|
||||
this._layoutCode = null;
|
||||
this._localization = null;
|
||||
this._offers = [];
|
||||
this._offerId = -1;
|
||||
this._acceptSeasonCurrencyAsCredits = false;
|
||||
this._frontPageItems = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._pageId = wrapper.readInt();
|
||||
this._catalogType = wrapper.readString();
|
||||
this._layoutCode = wrapper.readString();
|
||||
this._localization = new CatalogLocalizationData(wrapper);
|
||||
|
||||
let totalOffers = wrapper.readInt();
|
||||
|
||||
while(totalOffers > 0)
|
||||
{
|
||||
this._offers.push(new CatalogPageMessageOfferData(wrapper));
|
||||
|
||||
totalOffers--;
|
||||
}
|
||||
|
||||
this._offerId = wrapper.readInt();
|
||||
this._acceptSeasonCurrencyAsCredits = wrapper.readBoolean();
|
||||
|
||||
if(wrapper.bytesAvailable)
|
||||
{
|
||||
let totalFrontPageItems = wrapper.readInt();
|
||||
|
||||
while(totalFrontPageItems > 0)
|
||||
{
|
||||
this._frontPageItems.push(new FrontPageItem(wrapper));
|
||||
|
||||
totalFrontPageItems--;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get pageId(): number
|
||||
{
|
||||
return this._pageId;
|
||||
}
|
||||
|
||||
public get catalogType(): string
|
||||
{
|
||||
return this._catalogType;
|
||||
}
|
||||
|
||||
public get layoutCode(): string
|
||||
{
|
||||
return this._layoutCode;
|
||||
}
|
||||
|
||||
public get localization(): CatalogLocalizationData
|
||||
{
|
||||
return this._localization;
|
||||
}
|
||||
|
||||
public get offers(): CatalogPageMessageOfferData[]
|
||||
{
|
||||
return this._offers;
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get acceptSeasonCurrencyAsCredits(): boolean
|
||||
{
|
||||
return this._acceptSeasonCurrencyAsCredits;
|
||||
}
|
||||
|
||||
public get frontPageItems(): FrontPageItem[]
|
||||
{
|
||||
return this._frontPageItems;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class CatalogPageMessageProductData
|
||||
{
|
||||
public static I: string = 'i';
|
||||
public static S: string = 's';
|
||||
public static E: string = 'e';
|
||||
public static B: string = 'b';
|
||||
|
||||
private _productType: string;
|
||||
private _furniClassId: number;
|
||||
private _extraParam: string;
|
||||
private _productCount: number;
|
||||
private _uniqueLimitedItem: boolean;
|
||||
private _uniqueLimitedItemSeriesSize: number;
|
||||
private _uniqueLimitedItemsLeft: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this.flush();
|
||||
this.parse(wrapper);
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._productType = null;
|
||||
this._furniClassId = -1;
|
||||
this._extraParam = null;
|
||||
this._productCount = 0;
|
||||
this._uniqueLimitedItem = false;
|
||||
this._uniqueLimitedItemSeriesSize = 0;
|
||||
this._uniqueLimitedItemsLeft = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._productType = wrapper.readString();
|
||||
|
||||
switch(this._productType)
|
||||
{
|
||||
case CatalogPageMessageProductData.B:
|
||||
this._extraParam = wrapper.readString();
|
||||
this._productCount = 1;
|
||||
return true;
|
||||
default:
|
||||
this._furniClassId = wrapper.readInt();
|
||||
this._extraParam = wrapper.readString();
|
||||
this._productCount = wrapper.readInt();
|
||||
this._uniqueLimitedItem = wrapper.readBoolean();
|
||||
|
||||
if(this._uniqueLimitedItem)
|
||||
{
|
||||
this._uniqueLimitedItemSeriesSize = wrapper.readInt();
|
||||
this._uniqueLimitedItemsLeft = wrapper.readInt();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public get productType(): string
|
||||
{
|
||||
return this._productType;
|
||||
}
|
||||
|
||||
public get furniClassId(): number
|
||||
{
|
||||
return this._furniClassId;
|
||||
}
|
||||
|
||||
public get extraParam(): string
|
||||
{
|
||||
return this._extraParam;
|
||||
}
|
||||
|
||||
public get productCount(): number
|
||||
{
|
||||
return this._productCount;
|
||||
}
|
||||
|
||||
public get uniqueLimitedItem(): boolean
|
||||
{
|
||||
return this._uniqueLimitedItem;
|
||||
}
|
||||
|
||||
public get uniqueLimitedSeriesSize(): number
|
||||
{
|
||||
return this._uniqueLimitedItemSeriesSize;
|
||||
}
|
||||
|
||||
public get uniqueLimitedItemsLeft(): number
|
||||
{
|
||||
return this._uniqueLimitedItemsLeft;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CatalogPageWithEarliestExpiryMessageParser implements IMessageParser
|
||||
{
|
||||
private _pageName: string;
|
||||
private _secondsToExpiry: number;
|
||||
private _image: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._pageName = null;
|
||||
this._secondsToExpiry = 0;
|
||||
this._image = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._pageName = wrapper.readString();
|
||||
this._secondsToExpiry = wrapper.readInt();
|
||||
this._image = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get pageName(): string
|
||||
{
|
||||
return this._pageName;
|
||||
}
|
||||
|
||||
public get secondsToExpiry(): number
|
||||
{
|
||||
return this._secondsToExpiry;
|
||||
}
|
||||
|
||||
public get image(): string
|
||||
{
|
||||
return this._image;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CatalogPublishedMessageParser implements IMessageParser
|
||||
{
|
||||
private _instantlyRefreshCatalogue: boolean;
|
||||
private _newFurniDataHash: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._instantlyRefreshCatalogue = false;
|
||||
this._newFurniDataHash = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._instantlyRefreshCatalogue = wrapper.readBoolean();
|
||||
|
||||
if(wrapper.bytesAvailable) this._newFurniDataHash = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get instantlyRefreshCatalogue(): boolean
|
||||
{
|
||||
return this._instantlyRefreshCatalogue;
|
||||
}
|
||||
|
||||
public get newFurniDataHash(): string
|
||||
{
|
||||
return this._newFurniDataHash;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class ClubGiftData
|
||||
{
|
||||
private _offerId: number;
|
||||
private _isVip: boolean;
|
||||
private _isSelectable: boolean;
|
||||
private _daysRequired: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._offerId = wrapper.readInt();
|
||||
this._isVip = wrapper.readBoolean();
|
||||
this._daysRequired = wrapper.readInt();
|
||||
this._isSelectable = wrapper.readBoolean();
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get isVip(): boolean
|
||||
{
|
||||
return this._isVip;
|
||||
}
|
||||
|
||||
public get isSelectable(): boolean
|
||||
{
|
||||
return this._isSelectable;
|
||||
}
|
||||
|
||||
public get daysRequired(): number
|
||||
{
|
||||
return this._daysRequired;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData';
|
||||
import { ClubGiftData } from './ClubGiftData';
|
||||
|
||||
export class ClubGiftInfoParser implements IMessageParser
|
||||
{
|
||||
private _daysUntilNextGift: number;
|
||||
private _giftsAvailable: number;
|
||||
private _offers: CatalogPageMessageOfferData[];
|
||||
private _giftData: Map<number, ClubGiftData>;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._offers = [];
|
||||
this._giftData = new Map<number, ClubGiftData>();
|
||||
this._daysUntilNextGift = wrapper.readInt();
|
||||
this._giftsAvailable = wrapper.readInt();
|
||||
|
||||
const offerCount = wrapper.readInt();
|
||||
|
||||
for(let i = 0; i < offerCount; i++)
|
||||
{
|
||||
this._offers.push(new CatalogPageMessageOfferData(wrapper));
|
||||
}
|
||||
|
||||
const giftDataCount = wrapper.readInt();
|
||||
|
||||
for(let i = 0; i < giftDataCount; i++)
|
||||
{
|
||||
const item = new ClubGiftData(wrapper);
|
||||
this._giftData.set(item.offerId, item);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get offers(): CatalogPageMessageOfferData[]
|
||||
{
|
||||
return this._offers;
|
||||
}
|
||||
|
||||
public get daysUntilNextGift(): number
|
||||
{
|
||||
return this._daysUntilNextGift;
|
||||
}
|
||||
|
||||
public get giftsAvailable(): number
|
||||
{
|
||||
return this._giftsAvailable;
|
||||
}
|
||||
|
||||
public set giftsAvailable(gifts: number)
|
||||
{
|
||||
this._giftsAvailable = gifts;
|
||||
}
|
||||
|
||||
public getOfferExtraData(offerId: number): ClubGiftData
|
||||
{
|
||||
if(!offerId) return null;
|
||||
|
||||
return this._giftData.get(offerId);
|
||||
}
|
||||
|
||||
|
||||
public get giftData(): Map<number, ClubGiftData>
|
||||
{
|
||||
return this._giftData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CatalogPageMessageProductData } from './CatalogPageMessageProductData';
|
||||
|
||||
export class ClubGiftSelectedParser implements IMessageParser
|
||||
{
|
||||
private _productCode: string;
|
||||
private _products: CatalogPageMessageProductData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._productCode = null;
|
||||
this._products = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._productCode = wrapper.readString();
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._products.push(new CatalogPageMessageProductData(wrapper));
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get productCode(): string
|
||||
{
|
||||
return this._productCode;
|
||||
}
|
||||
|
||||
public get products(): CatalogPageMessageProductData[]
|
||||
{
|
||||
return this._products;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class ClubOfferData
|
||||
{
|
||||
private _offerId: number;
|
||||
private _productCode: string;
|
||||
private _priceCredits: number;
|
||||
private _priceActivityPoints: number;
|
||||
private _priceActivityPointsType: number;
|
||||
private _vip: boolean;
|
||||
private _months: number;
|
||||
private _extraDays: number;
|
||||
private _daysLeftAfterPurchase: number;
|
||||
private _year: number;
|
||||
private _month: number;
|
||||
private _day: number;
|
||||
private _giftable: boolean;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this._offerId = wrapper.readInt();
|
||||
this._productCode = wrapper.readString();
|
||||
|
||||
wrapper.readBoolean();
|
||||
|
||||
this._priceCredits = wrapper.readInt();
|
||||
this._priceActivityPoints = wrapper.readInt();
|
||||
this._priceActivityPointsType = wrapper.readInt();
|
||||
this._vip = wrapper.readBoolean();
|
||||
this._months = wrapper.readInt();
|
||||
this._extraDays = wrapper.readInt();
|
||||
this._giftable = wrapper.readBoolean();
|
||||
this._daysLeftAfterPurchase = wrapper.readInt();
|
||||
this._year = wrapper.readInt();
|
||||
this._month = wrapper.readInt();
|
||||
this._day = wrapper.readInt();
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get productCode(): string
|
||||
{
|
||||
return this._productCode;
|
||||
}
|
||||
|
||||
public get priceCredits(): number
|
||||
{
|
||||
return this._priceCredits;
|
||||
}
|
||||
|
||||
public get priceActivityPoints(): number
|
||||
{
|
||||
return this._priceActivityPoints;
|
||||
}
|
||||
|
||||
public get priceActivityPointsType(): number
|
||||
{
|
||||
return this._priceActivityPointsType;
|
||||
}
|
||||
|
||||
public get vip(): boolean
|
||||
{
|
||||
return this._vip;
|
||||
}
|
||||
|
||||
public get months(): number
|
||||
{
|
||||
return this._months;
|
||||
}
|
||||
|
||||
public get extraDays(): number
|
||||
{
|
||||
return this._extraDays;
|
||||
}
|
||||
|
||||
public get daysLeftAfterPurchase(): number
|
||||
{
|
||||
return this._daysLeftAfterPurchase;
|
||||
}
|
||||
|
||||
public get year(): number
|
||||
{
|
||||
return this._year;
|
||||
}
|
||||
|
||||
public get month(): number
|
||||
{
|
||||
return this._month;
|
||||
}
|
||||
|
||||
public get day(): number
|
||||
{
|
||||
return this._day;
|
||||
}
|
||||
|
||||
public get giftable(): boolean
|
||||
{
|
||||
return this._giftable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { ClubOfferData } from './ClubOfferData';
|
||||
|
||||
export class ClubOfferExtendData extends ClubOfferData
|
||||
{
|
||||
private _originalPrice: number;
|
||||
private _originalActivityPointPrice: number;
|
||||
private _originalActivityPointType: number;
|
||||
private _subscriptionDaysLeft: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
super(wrapper);
|
||||
|
||||
this._originalPrice = wrapper.readInt();
|
||||
this._originalActivityPointPrice = wrapper.readInt();
|
||||
this._originalActivityPointType = wrapper.readInt();
|
||||
this._subscriptionDaysLeft = wrapper.readInt();
|
||||
}
|
||||
|
||||
public get originalPrice(): number
|
||||
{
|
||||
return this._originalPrice * this.months;
|
||||
}
|
||||
|
||||
public get originalActivityPointPrice(): number
|
||||
{
|
||||
return this._originalActivityPointPrice * this.months;
|
||||
}
|
||||
|
||||
public get originalActivityPointType(): number
|
||||
{
|
||||
return this._originalActivityPointType;
|
||||
}
|
||||
|
||||
public get discountCreditAmount(): number
|
||||
{
|
||||
return (this._originalPrice * this.months) - this.priceCredits;
|
||||
}
|
||||
|
||||
public get discountActivityPointAmount(): number
|
||||
{
|
||||
return (this.originalActivityPointPrice * this.months) - this.priceActivityPoints;
|
||||
}
|
||||
|
||||
public get subscriptionDaysLeft(): number
|
||||
{
|
||||
return this._subscriptionDaysLeft;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class DirectSMSClubBuyAvailableMessageParser implements IMessageParser
|
||||
{
|
||||
private _available: boolean;
|
||||
private _pricePointUrl: string;
|
||||
private _market: string;
|
||||
private _lengthInDays: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._available = false;
|
||||
this._pricePointUrl = null;
|
||||
this._market = null;
|
||||
this._lengthInDays = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._pricePointUrl = wrapper.readString();
|
||||
|
||||
if(this._pricePointUrl !== '') this._available = true;
|
||||
|
||||
this._market = wrapper.readString();
|
||||
this._lengthInDays = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get available(): boolean
|
||||
{
|
||||
return this._available;
|
||||
}
|
||||
|
||||
public get pricePointUrl(): string
|
||||
{
|
||||
return this._pricePointUrl;
|
||||
}
|
||||
|
||||
public get market(): string
|
||||
{
|
||||
return this._market;
|
||||
}
|
||||
|
||||
public get lengthInDays(): number
|
||||
{
|
||||
return this._lengthInDays;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class FireworkChargeData
|
||||
{
|
||||
private _stuffId: number;
|
||||
private _charges: number;
|
||||
private _SafeStr_6935: number;
|
||||
private _SafeStr_6936: number;
|
||||
private _SafeStr_6518: number;
|
||||
private _SafeStr_7875: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._stuffId = wrapper.readInt();
|
||||
this._charges = wrapper.readInt();
|
||||
this._SafeStr_6935 = wrapper.readInt();
|
||||
this._SafeStr_6936 = wrapper.readInt();
|
||||
this._SafeStr_6518 = wrapper.readInt();
|
||||
this._SafeStr_7875 = wrapper.readInt();
|
||||
}
|
||||
|
||||
public get stuffId(): number
|
||||
{
|
||||
return this._stuffId;
|
||||
}
|
||||
|
||||
public get charges(): number
|
||||
{
|
||||
return this._charges;
|
||||
}
|
||||
|
||||
public get _SafeStr_5946(): number
|
||||
{
|
||||
return this._SafeStr_6935;
|
||||
}
|
||||
|
||||
public get _SafeStr_5944(): number
|
||||
{
|
||||
return this._SafeStr_6936;
|
||||
}
|
||||
|
||||
public get _SafeStr_7876(): number
|
||||
{
|
||||
return this._SafeStr_7875;
|
||||
}
|
||||
|
||||
public get _SafeStr_5945(): number
|
||||
{
|
||||
return this._SafeStr_6518;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { FireworkChargeData } from './FireworkChargeData';
|
||||
|
||||
export class FireworkChargeDataParser implements IMessageParser
|
||||
{
|
||||
private _fireworkChargeData: FireworkChargeData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._fireworkChargeData = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._fireworkChargeData = new FireworkChargeData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get fireworkChargeData(): FireworkChargeData
|
||||
{
|
||||
return this._fireworkChargeData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class FrontPageItem
|
||||
{
|
||||
public static ITEM_CATALOGUE_PAGE: number = 0;
|
||||
public static ITEM_PRODUCT_OFFER: number = 1;
|
||||
public static ITEM_IAP: number = 2;
|
||||
|
||||
private _type: number;
|
||||
private _position: number;
|
||||
private _itemName: string;
|
||||
private _itemPromoImage: string;
|
||||
private _catalogPageLocation: string;
|
||||
private _productCode: string;
|
||||
private _productOfferId: number;
|
||||
private _expirationTime: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this.flush();
|
||||
this.parse(wrapper);
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._type = -1;
|
||||
this._position = null;
|
||||
this._itemName = null;
|
||||
this._itemPromoImage = null;
|
||||
this._catalogPageLocation = null;
|
||||
this._productCode = null;
|
||||
this._productOfferId = 0;
|
||||
this._expirationTime = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._position = wrapper.readInt();
|
||||
this._itemName = wrapper.readString();
|
||||
this._itemPromoImage = wrapper.readString();
|
||||
this._type = wrapper.readInt();
|
||||
|
||||
switch(this._type)
|
||||
{
|
||||
case FrontPageItem.ITEM_CATALOGUE_PAGE:
|
||||
this._catalogPageLocation = wrapper.readString();
|
||||
break;
|
||||
case FrontPageItem.ITEM_PRODUCT_OFFER:
|
||||
this._productOfferId = wrapper.readInt();
|
||||
break;
|
||||
case FrontPageItem.ITEM_IAP:
|
||||
this._productCode = wrapper.readString();
|
||||
break;
|
||||
}
|
||||
|
||||
const time = wrapper.readInt();
|
||||
|
||||
this._expirationTime = ((time > 0) ? ((time * 1000) + 0) : 0); //GetTickerTime
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public get position(): number
|
||||
{
|
||||
return this._position;
|
||||
}
|
||||
|
||||
public get itemName(): string
|
||||
{
|
||||
return this._itemName;
|
||||
}
|
||||
|
||||
public get itemPromoImage(): string
|
||||
{
|
||||
return this._itemPromoImage;
|
||||
}
|
||||
|
||||
public get catalogPageLocation(): string
|
||||
{
|
||||
return this._catalogPageLocation;
|
||||
}
|
||||
|
||||
public get productCode(): string
|
||||
{
|
||||
return this._productCode;
|
||||
}
|
||||
|
||||
public get productOfferId(): number
|
||||
{
|
||||
return this._productOfferId;
|
||||
}
|
||||
|
||||
public get expirationTime(): number
|
||||
{
|
||||
return this._expirationTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class GiftReceiverNotFoundParser implements IMessageParser
|
||||
{
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class GiftWrappingConfigurationParser implements IMessageParser
|
||||
{
|
||||
private _isEnabled: boolean = false;
|
||||
private _price: number = null;
|
||||
private _giftWrappers: number[] = null;
|
||||
private _boxTypes: number[] = null;
|
||||
private _ribbonTypes: number[] = null;
|
||||
private _giftFurnis: number[] = null;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._boxTypes = null;
|
||||
this._giftFurnis = null;
|
||||
this._giftWrappers = null;
|
||||
this._ribbonTypes = null;
|
||||
this._isEnabled = null;
|
||||
this._price = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
const giftWrappers = [];
|
||||
const boxTypes = [];
|
||||
const ribbonTypes = [];
|
||||
const giftFurnis = [];
|
||||
this._isEnabled = wrapper.readBoolean();
|
||||
// hotel.gifts.special.price
|
||||
this._price = wrapper.readInt();
|
||||
|
||||
|
||||
let _local_3 = wrapper.readInt();
|
||||
|
||||
let i = 0;
|
||||
while(i < _local_3)
|
||||
{
|
||||
giftWrappers.push(wrapper.readInt());
|
||||
i++;
|
||||
}
|
||||
|
||||
_local_3 = wrapper.readInt();
|
||||
i = 0;
|
||||
while(i < _local_3)
|
||||
{
|
||||
boxTypes.push(wrapper.readInt());
|
||||
i++;
|
||||
}
|
||||
|
||||
_local_3 = wrapper.readInt();
|
||||
i = 0;
|
||||
while(i < _local_3)
|
||||
{
|
||||
ribbonTypes.push(wrapper.readInt());
|
||||
i++;
|
||||
}
|
||||
|
||||
_local_3 = wrapper.readInt();
|
||||
i = 0;
|
||||
while(i < _local_3)
|
||||
{
|
||||
giftFurnis.push(wrapper.readInt());
|
||||
i++;
|
||||
}
|
||||
|
||||
this._giftWrappers = giftWrappers;
|
||||
this._ribbonTypes = ribbonTypes;
|
||||
this._giftFurnis = giftFurnis;
|
||||
this._boxTypes = boxTypes;
|
||||
return true;
|
||||
}
|
||||
|
||||
public get giftWrappers(): number[]
|
||||
{
|
||||
return this._giftWrappers;
|
||||
}
|
||||
|
||||
public get ribbonTypes(): number[]
|
||||
{
|
||||
return this._ribbonTypes;
|
||||
}
|
||||
|
||||
public get giftFurnis(): number[]
|
||||
{
|
||||
return this._giftFurnis;
|
||||
}
|
||||
|
||||
public get boxTypes(): number[]
|
||||
{
|
||||
return this._boxTypes;
|
||||
}
|
||||
|
||||
public get isEnabled(): boolean
|
||||
{
|
||||
return this._isEnabled;
|
||||
}
|
||||
|
||||
public get price(): number
|
||||
{
|
||||
return this._price;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { ClubOfferExtendData } from './ClubOfferExtendData';
|
||||
|
||||
export class HabboClubExtendOfferMessageParser implements IMessageParser
|
||||
{
|
||||
private _offer: ClubOfferExtendData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._offer = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._offer = new ClubOfferExtendData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get offer(): ClubOfferExtendData
|
||||
{
|
||||
return this._offer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { ClubOfferData } from './ClubOfferData';
|
||||
|
||||
export class HabboClubOffersMessageParser implements IMessageParser
|
||||
{
|
||||
private _offers: ClubOfferData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._offers = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
let totalOffers = wrapper.readInt();
|
||||
|
||||
while(totalOffers > 0)
|
||||
{
|
||||
this._offers.push(new ClubOfferData(wrapper));
|
||||
|
||||
totalOffers--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get offers(): ClubOfferData[]
|
||||
{
|
||||
return this._offers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export interface INodeData
|
||||
{
|
||||
visible: boolean;
|
||||
icon: number;
|
||||
pageId: number;
|
||||
pageName: string;
|
||||
localization: string;
|
||||
children: INodeData[];
|
||||
offerIds: number[];
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class IsOfferGiftableMessageParser implements IMessageParser
|
||||
{
|
||||
private _offerId: number;
|
||||
private _isGiftable: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._offerId = 0;
|
||||
this._isGiftable = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._offerId = wrapper.readInt();
|
||||
this._isGiftable = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get isGiftable(): boolean
|
||||
{
|
||||
return this._isGiftable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class LimitedEditionSoldOutParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class LimitedOfferAppearingNextMessageParser implements IMessageParser
|
||||
{
|
||||
private _appearsInSeconds: number;
|
||||
private _pageId: number;
|
||||
private _offerId: number;
|
||||
private _productType: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._appearsInSeconds = -1;
|
||||
this._pageId = -1;
|
||||
this._offerId = -1;
|
||||
this._productType = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._appearsInSeconds = wrapper.readInt();
|
||||
this._pageId = wrapper.readInt();
|
||||
this._offerId = wrapper.readInt();
|
||||
this._productType = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get appearsInSeconds(): number
|
||||
{
|
||||
return this._appearsInSeconds;
|
||||
}
|
||||
|
||||
public get pageId(): number
|
||||
{
|
||||
return this._pageId;
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get productType(): string
|
||||
{
|
||||
return this._productType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class NodeData
|
||||
{
|
||||
private _visible: boolean;
|
||||
private _icon: number;
|
||||
private _pageId: number;
|
||||
private _pageName: string;
|
||||
private _localization: string;
|
||||
private _children: NodeData[];
|
||||
private _offerIds: number[];
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this.flush();
|
||||
this.parse(wrapper);
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._visible = false;
|
||||
this._icon = 0;
|
||||
this._pageId = -1;
|
||||
this._pageName = null;
|
||||
this._localization = null;
|
||||
this._children = [];
|
||||
this._offerIds = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._visible = wrapper.readBoolean();
|
||||
this._icon = wrapper.readInt();
|
||||
this._pageId = wrapper.readInt();
|
||||
this._pageName = wrapper.readString();
|
||||
this._localization = wrapper.readString();
|
||||
|
||||
let totalOffers = wrapper.readInt();
|
||||
|
||||
while(totalOffers > 0)
|
||||
{
|
||||
this._offerIds.push(wrapper.readInt());
|
||||
|
||||
totalOffers--;
|
||||
}
|
||||
|
||||
let totalChildren = wrapper.readInt();
|
||||
|
||||
while(totalChildren > 0)
|
||||
{
|
||||
this._children.push(new NodeData(wrapper));
|
||||
|
||||
totalChildren--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get visible(): boolean
|
||||
{
|
||||
return this._visible;
|
||||
}
|
||||
|
||||
public get icon(): number
|
||||
{
|
||||
return this._icon;
|
||||
}
|
||||
|
||||
public get pageId(): number
|
||||
{
|
||||
return this._pageId;
|
||||
}
|
||||
|
||||
public get pageName(): string
|
||||
{
|
||||
return this._pageName;
|
||||
}
|
||||
|
||||
public get localization(): string
|
||||
{
|
||||
return this._localization;
|
||||
}
|
||||
|
||||
public get children(): NodeData[]
|
||||
{
|
||||
return this._children;
|
||||
}
|
||||
|
||||
public get offerIds(): number[]
|
||||
{
|
||||
return this._offerIds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class NotEnoughBalanceMessageParser implements IMessageParser
|
||||
{
|
||||
private _notEnoughCredits: boolean = false;
|
||||
private _notEnoughActivityPoints: boolean = false;
|
||||
private _activityPointType: number = 0;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._notEnoughCredits = false;
|
||||
this._notEnoughActivityPoints = false;
|
||||
this._activityPointType = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._notEnoughCredits = wrapper.readBoolean();
|
||||
this._notEnoughActivityPoints = wrapper.readBoolean();
|
||||
|
||||
if(wrapper.bytesAvailable) this._activityPointType = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get notEnoughCredits(): boolean
|
||||
{
|
||||
return this._notEnoughCredits;
|
||||
}
|
||||
|
||||
public get notEnoughActivityPoints(): boolean
|
||||
{
|
||||
return this._notEnoughActivityPoints;
|
||||
}
|
||||
|
||||
public get activityPointType(): number
|
||||
{
|
||||
return this._activityPointType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData';
|
||||
|
||||
export class ProductOfferMessageParser implements IMessageParser
|
||||
{
|
||||
private _offer: CatalogPageMessageOfferData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._offer = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._offer = new CatalogPageMessageOfferData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get offer(): CatalogPageMessageOfferData
|
||||
{
|
||||
return this._offer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class PurchaseErrorMessageParser implements IMessageParser
|
||||
{
|
||||
private _code: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._code = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._code = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get code(): number
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class PurchaseNotAllowedMessageParser implements IMessageParser
|
||||
{
|
||||
private _code: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._code = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._code = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get code(): number
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { CatalogPageMessageProductData } from './CatalogPageMessageProductData';
|
||||
|
||||
export class PurchaseOKMessageOfferData
|
||||
{
|
||||
private _offerId: number;
|
||||
private _localizationId: string;
|
||||
private _rent: boolean;
|
||||
private _priceCredits: number;
|
||||
private _priceActivityPoints: number;
|
||||
private _priceActivityPointsType: number;
|
||||
private _clubLevel: number;
|
||||
private _giftable: boolean;
|
||||
private _bundlePurchaseAllowed: boolean;
|
||||
private _products: CatalogPageMessageProductData[];
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this.flush();
|
||||
this.parse(wrapper);
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._offerId = -1;
|
||||
this._localizationId = null;
|
||||
this._rent = false;
|
||||
this._priceCredits = 0;
|
||||
this._priceActivityPoints = 0;
|
||||
this._priceActivityPointsType = 0;
|
||||
this._clubLevel = 0;
|
||||
this._giftable = false;
|
||||
this._bundlePurchaseAllowed = false;
|
||||
this._products = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._offerId = wrapper.readInt();
|
||||
this._localizationId = wrapper.readString();
|
||||
this._rent = wrapper.readBoolean();
|
||||
this._priceCredits = wrapper.readInt();
|
||||
this._priceActivityPoints = wrapper.readInt();
|
||||
this._priceActivityPointsType = wrapper.readInt();
|
||||
this._giftable = wrapper.readBoolean();
|
||||
|
||||
let totalProducts = wrapper.readInt();
|
||||
|
||||
while(totalProducts > 0)
|
||||
{
|
||||
this._products.push(new CatalogPageMessageProductData(wrapper));
|
||||
|
||||
totalProducts--;
|
||||
}
|
||||
|
||||
this._clubLevel = wrapper.readInt();
|
||||
this._bundlePurchaseAllowed = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get offerId(): number
|
||||
{
|
||||
return this._offerId;
|
||||
}
|
||||
|
||||
public get localizationId(): string
|
||||
{
|
||||
return this._localizationId;
|
||||
}
|
||||
|
||||
public get rent(): boolean
|
||||
{
|
||||
return this._rent;
|
||||
}
|
||||
|
||||
public get priceCredits(): number
|
||||
{
|
||||
return this._priceCredits;
|
||||
}
|
||||
|
||||
public get priceActivityPoints(): number
|
||||
{
|
||||
return this._priceActivityPoints;
|
||||
}
|
||||
|
||||
public get priceActivityPointsType(): number
|
||||
{
|
||||
return this._priceActivityPointsType;
|
||||
}
|
||||
|
||||
public get clubLevel(): number
|
||||
{
|
||||
return this._clubLevel;
|
||||
}
|
||||
|
||||
public get giftable(): boolean
|
||||
{
|
||||
return this._giftable;
|
||||
}
|
||||
|
||||
public get bundlePurchaseAllowed(): boolean
|
||||
{
|
||||
return this._bundlePurchaseAllowed;
|
||||
}
|
||||
|
||||
public get products(): CatalogPageMessageProductData[]
|
||||
{
|
||||
return this._products;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { PurchaseOKMessageOfferData } from './PurchaseOKMessageOfferData';
|
||||
|
||||
export class PurchaseOKMessageParser implements IMessageParser
|
||||
{
|
||||
private _offer: PurchaseOKMessageOfferData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._offer = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._offer = new PurchaseOKMessageOfferData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get offer(): PurchaseOKMessageOfferData
|
||||
{
|
||||
return this._offer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { RoomEntryData } from '../user';
|
||||
|
||||
export class RoomAdPurchaseInfoEventParser implements IMessageParser
|
||||
{
|
||||
private _isVip: boolean;
|
||||
private _rooms: RoomEntryData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._isVip = false;
|
||||
this._rooms = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._isVip = wrapper.readBoolean();
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._rooms.push(new RoomEntryData(wrapper.readInt(), wrapper.readString(), wrapper.readBoolean()));
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get isVip(): boolean
|
||||
{
|
||||
return this._isVip;
|
||||
}
|
||||
|
||||
public get rooms(): RoomEntryData[]
|
||||
{
|
||||
return this._rooms;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData';
|
||||
|
||||
export class SeasonalCalendarDailyOfferMessageParser implements IMessageParser
|
||||
{
|
||||
private _pageId: number;
|
||||
private _data: CatalogPageMessageOfferData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._pageId = -1;
|
||||
this._data = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._pageId = wrapper.readInt();
|
||||
this._data = new CatalogPageMessageOfferData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get pageId(): number
|
||||
{
|
||||
return this._pageId;
|
||||
}
|
||||
|
||||
public get data(): CatalogPageMessageOfferData
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class SellablePetPaletteData
|
||||
{
|
||||
private _type: number;
|
||||
private _breedId: number;
|
||||
private _paletteId: number;
|
||||
private _sellable: boolean;
|
||||
private _rare: boolean;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this.flush();
|
||||
this.parse(wrapper);
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._type = -1;
|
||||
this._breedId = -1;
|
||||
this._paletteId = -1;
|
||||
this._sellable = false;
|
||||
this._rare = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._type = wrapper.readInt();
|
||||
this._breedId = wrapper.readInt();
|
||||
this._paletteId = wrapper.readInt();
|
||||
this._sellable = wrapper.readBoolean();
|
||||
this._rare = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public get breedId(): number
|
||||
{
|
||||
return this._breedId;
|
||||
}
|
||||
|
||||
public get paletteId(): number
|
||||
{
|
||||
return this._paletteId;
|
||||
}
|
||||
|
||||
public get sellable(): boolean
|
||||
{
|
||||
return this._sellable;
|
||||
}
|
||||
|
||||
public get rare(): boolean
|
||||
{
|
||||
return this._rare;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { SellablePetPaletteData } from './SellablePetPaletteData';
|
||||
|
||||
export class SellablePetPalettesParser implements IMessageParser
|
||||
{
|
||||
private _productCode: string;
|
||||
private _palettes: SellablePetPaletteData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._productCode = '';
|
||||
this._palettes = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._productCode = wrapper.readString();
|
||||
|
||||
let totalPalettes = wrapper.readInt();
|
||||
|
||||
while(totalPalettes > 0)
|
||||
{
|
||||
this._palettes.push(new SellablePetPaletteData(wrapper));
|
||||
|
||||
totalPalettes--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get productCode(): string
|
||||
{
|
||||
return this._productCode;
|
||||
}
|
||||
|
||||
public get palettes(): SellablePetPaletteData[]
|
||||
{
|
||||
return this._palettes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class TargetedOfferData
|
||||
{
|
||||
protected _id: number;
|
||||
protected _identifier: string;
|
||||
protected _type: number;
|
||||
protected _title: string;
|
||||
protected _description: string;
|
||||
protected _imageUrl: string;
|
||||
protected _iconImageUrl: string;
|
||||
protected _productCode: string;
|
||||
protected _purchaseLimit: number;
|
||||
protected _expirationTime: number;
|
||||
protected _priceInCredits: number;
|
||||
protected _priceInActivityPoints: number;
|
||||
protected _activityPointType: number;
|
||||
protected _subProductCodes: string[];
|
||||
protected _trackingState: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._trackingState = wrapper.readInt();
|
||||
this._id = wrapper.readInt();
|
||||
this._identifier = wrapper.readString();
|
||||
this._productCode = wrapper.readString();
|
||||
this._priceInCredits = wrapper.readInt();
|
||||
this._priceInActivityPoints = wrapper.readInt();
|
||||
this._activityPointType = wrapper.readInt();
|
||||
this._purchaseLimit = wrapper.readInt();
|
||||
|
||||
const time = wrapper.readInt();
|
||||
this._expirationTime = ((time > 0) ? ((time * 1000) + Date.now()) : 0);
|
||||
|
||||
this._title = wrapper.readString();
|
||||
this._description = wrapper.readString();
|
||||
this._imageUrl = wrapper.readString();
|
||||
this._iconImageUrl = wrapper.readString();
|
||||
this._type = wrapper.readInt();
|
||||
this._subProductCodes = [];
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._subProductCodes.push(wrapper.readString());
|
||||
|
||||
count--;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public populate(offerData: TargetedOfferData)
|
||||
{
|
||||
if(!offerData) return;
|
||||
|
||||
this._id = offerData.id;
|
||||
this._identifier = offerData.identifier;
|
||||
this._type = offerData.type;
|
||||
this._title = offerData.title;
|
||||
this._description = offerData.description;
|
||||
this._imageUrl = offerData.imageUrl;
|
||||
this._iconImageUrl = offerData.iconImageUrl;
|
||||
this._productCode = offerData.productCode;
|
||||
this._purchaseLimit = offerData.purchaseLimit;
|
||||
this._expirationTime = offerData.expirationTime;
|
||||
this._priceInCredits = offerData.priceInCredits;
|
||||
this._priceInActivityPoints = offerData.priceInActivityPoints;
|
||||
this._activityPointType = offerData.activityPointType;
|
||||
this._subProductCodes = offerData.subProductCodes;
|
||||
this._trackingState = offerData.trackingState;
|
||||
}
|
||||
|
||||
public purchase(k: number): void
|
||||
{
|
||||
this._purchaseLimit = (this._purchaseLimit - k);
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get identifier(): string
|
||||
{
|
||||
return this._identifier;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public get title(): string
|
||||
{
|
||||
return this._title;
|
||||
}
|
||||
|
||||
public get description(): string
|
||||
{
|
||||
return this._description;
|
||||
}
|
||||
|
||||
public get imageUrl(): string
|
||||
{
|
||||
return this._imageUrl;
|
||||
}
|
||||
|
||||
public get iconImageUrl(): string
|
||||
{
|
||||
return this._iconImageUrl;
|
||||
}
|
||||
|
||||
public get productCode(): string
|
||||
{
|
||||
return this._productCode;
|
||||
}
|
||||
|
||||
public get purchaseLimit(): number
|
||||
{
|
||||
return this._purchaseLimit;
|
||||
}
|
||||
|
||||
public get expirationTime(): number
|
||||
{
|
||||
return this._expirationTime;
|
||||
}
|
||||
|
||||
public get priceInCredits(): number
|
||||
{
|
||||
return this._priceInCredits;
|
||||
}
|
||||
|
||||
public get priceInActivityPoints(): number
|
||||
{
|
||||
return this._priceInActivityPoints;
|
||||
}
|
||||
|
||||
public get activityPointType(): number
|
||||
{
|
||||
return this._activityPointType;
|
||||
}
|
||||
|
||||
public get subProductCodes(): string[]
|
||||
{
|
||||
return this._subProductCodes;
|
||||
}
|
||||
|
||||
public get trackingState(): number
|
||||
{
|
||||
return this._trackingState;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TargetedOfferNotFoundParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { TargetedOfferData } from './TargetedOfferData';
|
||||
|
||||
export class TargetedOfferParser implements IMessageParser
|
||||
{
|
||||
private _data: TargetedOfferData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._data = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._data = new TargetedOfferData(wrapper);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get data(): TargetedOfferData
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class VoucherRedeemErrorMessageParser implements IMessageParser
|
||||
{
|
||||
private _errorCode: string = '';
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._errorCode = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._errorCode = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get errorCode(): string
|
||||
{
|
||||
return this._errorCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class VoucherRedeemOkMessageParser implements IMessageParser
|
||||
{
|
||||
private _productName: string = '';
|
||||
private _productDescription: string = '';
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._productDescription = '';
|
||||
this._productName = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._productDescription = wrapper.readString();
|
||||
this._productName = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get productName(): string
|
||||
{
|
||||
return this._productName;
|
||||
}
|
||||
|
||||
public get productDescription(): string
|
||||
{
|
||||
return this._productDescription;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
export * from './BonusRareInfoMessageParser';
|
||||
export * from './BuildersClubFurniCountMessageParser';
|
||||
export * from './BuildersClubSubscriptionStatusMessageParser';
|
||||
export * from './BundleDiscountRuleset';
|
||||
export * from './BundleDiscountRulesetMessageParser';
|
||||
export * from './CatalogIndexMessageParser';
|
||||
export * from './CatalogLocalizationData';
|
||||
export * from './CatalogPageExpirationParser';
|
||||
export * from './CatalogPageMessageOfferData';
|
||||
export * from './CatalogPageMessageParser';
|
||||
export * from './CatalogPageMessageProductData';
|
||||
export * from './CatalogPageWithEarliestExpiryMessageParser';
|
||||
export * from './CatalogPublishedMessageParser';
|
||||
export * from './ClubGiftData';
|
||||
export * from './ClubGiftInfoParser';
|
||||
export * from './ClubGiftSelectedParser';
|
||||
export * from './ClubOfferData';
|
||||
export * from './ClubOfferExtendData';
|
||||
export * from './DirectSMSClubBuyAvailableMessageParser';
|
||||
export * from './FireworkChargeData';
|
||||
export * from './FireworkChargeDataParser';
|
||||
export * from './FrontPageItem';
|
||||
export * from './GiftReceiverNotFoundParser';
|
||||
export * from './GiftWrappingConfigurationParser';
|
||||
export * from './HabboClubExtendOfferMessageParser';
|
||||
export * from './HabboClubOffersMessageParser';
|
||||
export * from './INodeData';
|
||||
export * from './IsOfferGiftableMessageParser';
|
||||
export * from './LimitedEditionSoldOutParser';
|
||||
export * from './LimitedOfferAppearingNextMessageParser';
|
||||
export * from './NodeData';
|
||||
export * from './NotEnoughBalanceMessageParser';
|
||||
export * from './ProductOfferMessageParser';
|
||||
export * from './PurchaseErrorMessageParser';
|
||||
export * from './PurchaseNotAllowedMessageParser';
|
||||
export * from './PurchaseOKMessageOfferData';
|
||||
export * from './PurchaseOKMessageParser';
|
||||
export * from './RoomAdPurchaseInfoEventParser';
|
||||
export * from './SeasonalCalendarDailyOfferMessageParser';
|
||||
export * from './SellablePetPaletteData';
|
||||
export * from './SellablePetPalettesParser';
|
||||
export * from './TargetedOfferData';
|
||||
export * from './TargetedOfferNotFoundParser';
|
||||
export * from './TargetedOfferParser';
|
||||
export * from './VoucherRedeemErrorMessageParser';
|
||||
export * from './VoucherRedeemOkMessageParser';
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class ClientPingParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './ClientPingParser';
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CompetitionEntrySubmitResultMessageParser implements IMessageParser
|
||||
{
|
||||
public static SUBMITTED: number = 0;
|
||||
public static ASK_FOR_SUBMIT: number = 1;
|
||||
public static ASK_FOR_CONFIRM: number = 2;
|
||||
public static PREREQUISITES_NOT_MET: number = 3;
|
||||
public static ROOM_DOOR_NOT_OPEN: number = 4;
|
||||
public static ROOM_TOO_OLD: number = 5;
|
||||
public static ASK_FOR_ACCEPT_RULES: number = 6;
|
||||
|
||||
private _goalId: number;
|
||||
private _goalCode: string;
|
||||
private _result: number;
|
||||
private _requiredFurnis: string[];
|
||||
private _missingFurnis: { [index: string]: string };
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._goalId = 0;
|
||||
this._goalCode = null;
|
||||
this._result = 0;
|
||||
this._requiredFurnis = null;
|
||||
this._missingFurnis = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._goalId = wrapper.readInt();
|
||||
this._goalCode = wrapper.readString();
|
||||
this._result = wrapper.readInt();
|
||||
this._requiredFurnis = [];
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._requiredFurnis.push(wrapper.readString());
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
|
||||
count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
this._missingFurnis[wrapper.readString()] = '';
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get goalId(): number
|
||||
{
|
||||
return this._goalId;
|
||||
}
|
||||
|
||||
public get goalCode(): string
|
||||
{
|
||||
return this._goalCode;
|
||||
}
|
||||
|
||||
public get result(): number
|
||||
{
|
||||
return this._result;
|
||||
}
|
||||
|
||||
public get requiredFurnis(): string[]
|
||||
{
|
||||
return this._requiredFurnis;
|
||||
}
|
||||
|
||||
public isMissing(name: string): boolean
|
||||
{
|
||||
return !!this._missingFurnis[name];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CompetitionVotingInfoResult } from './CompetitionVotingInfoResult';
|
||||
|
||||
export class CompetitionVotingInfoMessageParser implements IMessageParser
|
||||
{
|
||||
private _goalId: number;
|
||||
private _goalCode: string;
|
||||
private _resultCode: number;
|
||||
private _votesRemaining: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._goalId = 0;
|
||||
this._goalCode = null;
|
||||
this._resultCode = 0;
|
||||
this._votesRemaining = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._goalId = wrapper.readInt();
|
||||
this._goalCode = wrapper.readString();
|
||||
this._resultCode = wrapper.readInt();
|
||||
this._votesRemaining = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get goalId(): number
|
||||
{
|
||||
return this._goalId;
|
||||
}
|
||||
|
||||
public get goalCode(): string
|
||||
{
|
||||
return this._goalCode;
|
||||
}
|
||||
|
||||
public get isVotingAllowedForUser(): boolean
|
||||
{
|
||||
return (this._resultCode === CompetitionVotingInfoResult.ALLOWED);
|
||||
}
|
||||
|
||||
public get votesRemaining(): number
|
||||
{
|
||||
return this._votesRemaining;
|
||||
}
|
||||
|
||||
public get resultCode(): number
|
||||
{
|
||||
return this._resultCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export class CompetitionVotingInfoResult
|
||||
{
|
||||
public static ALLOWED: number = 0;
|
||||
public static REQUIRED_PERK_MISSING: number = 1;
|
||||
public static REQUIRED_BADGE_MISSING: number = 2;
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class CurrentTimingCodeMessageParser implements IMessageParser
|
||||
{
|
||||
private _schedulingStr: string;
|
||||
private _code: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._schedulingStr = null;
|
||||
this._code = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._schedulingStr = wrapper.readString();
|
||||
this._code = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get schedulingStr(): string
|
||||
{
|
||||
return this._schedulingStr;
|
||||
}
|
||||
|
||||
public get code(): string
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class IsUserPartOfCompetitionMessageParser implements IMessageParser
|
||||
{
|
||||
private _isPartOf: boolean;
|
||||
private _targetId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._isPartOf = false;
|
||||
this._targetId = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._isPartOf = wrapper.readBoolean();
|
||||
this._targetId = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get isPartOf(): boolean
|
||||
{
|
||||
return this._isPartOf;
|
||||
}
|
||||
|
||||
public get targetId(): number
|
||||
{
|
||||
return this._targetId;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class NoOwnedRoomsAlertMessageParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class SecondsUntilMessageParser implements IMessageParser
|
||||
{
|
||||
private _timeStr: string;
|
||||
private _secondsUntil: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._timeStr = null;
|
||||
this._secondsUntil = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._timeStr = wrapper.readString();
|
||||
this._secondsUntil = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get timeStr(): string
|
||||
{
|
||||
return this._timeStr;
|
||||
}
|
||||
|
||||
public get secondsUntil(): number
|
||||
{
|
||||
return this._secondsUntil;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export * from './CompetitionEntrySubmitResultMessageParser';
|
||||
export * from './CompetitionVotingInfoMessageParser';
|
||||
export * from './CompetitionVotingInfoResult';
|
||||
export * from './CurrentTimingCodeMessageParser';
|
||||
export * from './IsUserPartOfCompetitionMessageParser';
|
||||
export * from './NoOwnedRoomsAlertMessageParser';
|
||||
export * from './SecondsUntilMessageParser';
|
||||
@@ -0,0 +1,52 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { CraftingResultObjectParser } from './CraftingResultObjectParser';
|
||||
|
||||
export class CraftableProductsMessageParser implements IMessageParser
|
||||
{
|
||||
private _recipes: CraftingResultObjectParser[];
|
||||
private _ingredients: string[];
|
||||
|
||||
constructor()
|
||||
{
|
||||
this._recipes = [];
|
||||
this._ingredients = [];
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._recipes = [];
|
||||
this._ingredients = [];
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
const craftingResultCount = wrapper.readInt();
|
||||
for(let i = 0; i < craftingResultCount; i++)
|
||||
{
|
||||
this._recipes.push(new CraftingResultObjectParser(wrapper));
|
||||
}
|
||||
const ingredientCount = wrapper.readInt();
|
||||
for(let i = 0; i < ingredientCount; i++)
|
||||
{
|
||||
this._ingredients.push(wrapper.readString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public get recipes(): CraftingResultObjectParser[]
|
||||
{
|
||||
return this._recipes;
|
||||
}
|
||||
|
||||
public get ingredients(): string[]
|
||||
{
|
||||
return this._ingredients;
|
||||
}
|
||||
|
||||
public isActive(): boolean
|
||||
{
|
||||
return (this._recipes.length > 0) || (this._ingredients.length > 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class CraftingRecipeIngredientParser
|
||||
{
|
||||
private _count: number;
|
||||
private _itemName: string;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._count = wrapper.readInt();
|
||||
this._itemName = wrapper.readString();
|
||||
}
|
||||
|
||||
public get count(): number
|
||||
{
|
||||
return this._count;
|
||||
}
|
||||
|
||||
public get itemName(): string
|
||||
{
|
||||
return this._itemName;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user