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,156 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class AchievementData
|
||||
{
|
||||
public static DISPLAY_METHOD_OBSOLETE: number = -1;
|
||||
public static DISPLAY_METHOD_SHOW_LEVEL_PROGRESS: number = 0;
|
||||
public static DISPLAY_METHOD_NEVER_SHOW_PROGRESS: number = 1;
|
||||
public static DISPLAY_METHOD_SHOW_TOTAL_PROGRESS: number = 2;
|
||||
|
||||
private _achievementId: number;
|
||||
private _level: number;
|
||||
private _badgeId: string;
|
||||
private _scoreAtStartOfLevel: number;
|
||||
private _scoreLimit: number;
|
||||
private _levelRewardPoints: number;
|
||||
private _levelRewardPointType: number;
|
||||
private _currentPoints: number;
|
||||
private _finalLevel: boolean;
|
||||
private _category: string;
|
||||
private _subCategory: string;
|
||||
private _levelCount: number;
|
||||
private _displayMethod: number;
|
||||
|
||||
private _unseen: number = 0;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_parser');
|
||||
|
||||
this._achievementId = wrapper.readInt();
|
||||
this._level = wrapper.readInt();
|
||||
this._badgeId = wrapper.readString();
|
||||
this._scoreAtStartOfLevel = wrapper.readInt();
|
||||
this._scoreLimit = Math.max(1, wrapper.readInt());
|
||||
this._levelRewardPoints = wrapper.readInt();
|
||||
this._levelRewardPointType = wrapper.readInt();
|
||||
this._currentPoints = wrapper.readInt();
|
||||
this._finalLevel = wrapper.readBoolean();
|
||||
this._category = wrapper.readString();
|
||||
this._subCategory = wrapper.readString();
|
||||
this._levelCount = wrapper.readInt();
|
||||
this._displayMethod = wrapper.readInt();
|
||||
}
|
||||
|
||||
public get achievementId(): number
|
||||
{
|
||||
return this._achievementId;
|
||||
}
|
||||
|
||||
public get badgeId(): string
|
||||
{
|
||||
return this._badgeId;
|
||||
}
|
||||
|
||||
public get level(): number
|
||||
{
|
||||
return this._level;
|
||||
}
|
||||
|
||||
public get scoreAtStartOfLevel(): number
|
||||
{
|
||||
return this._scoreAtStartOfLevel;
|
||||
}
|
||||
|
||||
public get scoreLimit(): number
|
||||
{
|
||||
return (this._scoreLimit - this._scoreAtStartOfLevel);
|
||||
}
|
||||
|
||||
public get levelRewardPoints(): number
|
||||
{
|
||||
return this._levelRewardPoints;
|
||||
}
|
||||
|
||||
public get levelRewardPointType(): number
|
||||
{
|
||||
return this._levelRewardPointType;
|
||||
}
|
||||
|
||||
public get currentPoints(): number
|
||||
{
|
||||
return (this._currentPoints - this._scoreAtStartOfLevel);
|
||||
}
|
||||
|
||||
public get finalLevel(): boolean
|
||||
{
|
||||
return this._finalLevel;
|
||||
}
|
||||
|
||||
public get category(): string
|
||||
{
|
||||
return this._category;
|
||||
}
|
||||
|
||||
public get subCategory(): string
|
||||
{
|
||||
return this._subCategory;
|
||||
}
|
||||
|
||||
public get levelCount(): number
|
||||
{
|
||||
return this._levelCount;
|
||||
}
|
||||
|
||||
public get firstLevelAchieved(): boolean
|
||||
{
|
||||
return (this._level > 1) || (this._finalLevel);
|
||||
}
|
||||
|
||||
public setMaxProgress(): void
|
||||
{
|
||||
this._currentPoints = this._scoreLimit;
|
||||
}
|
||||
|
||||
public get displayMethod(): number
|
||||
{
|
||||
return this._displayMethod;
|
||||
}
|
||||
|
||||
public get progress(): number
|
||||
{
|
||||
return this._currentPoints;
|
||||
}
|
||||
|
||||
public get toNextProgress(): number
|
||||
{
|
||||
return this._scoreLimit;
|
||||
}
|
||||
|
||||
public set unseen(unseen: number)
|
||||
{
|
||||
this._unseen = unseen;
|
||||
}
|
||||
|
||||
public get unseen(): number
|
||||
{
|
||||
return this._unseen;
|
||||
}
|
||||
|
||||
public reset(badge: AchievementData)
|
||||
{
|
||||
this._achievementId = badge._achievementId;
|
||||
this._level = badge._level;
|
||||
this._badgeId = badge._badgeId;
|
||||
this._scoreAtStartOfLevel = badge._scoreAtStartOfLevel;
|
||||
this._scoreLimit = badge._scoreLimit;
|
||||
this._levelRewardPoints = badge._levelRewardPoints;
|
||||
this._levelRewardPointType = badge._levelRewardPointType;
|
||||
this._currentPoints = badge._currentPoints;
|
||||
this._finalLevel = badge._finalLevel;
|
||||
this._category = badge.category;
|
||||
this._subCategory = badge._subCategory;
|
||||
this._levelCount = badge._levelCount;
|
||||
this._displayMethod = badge._displayMethod;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { AchievementData } from './AchievementData';
|
||||
|
||||
export class AchievementParser implements IMessageParser
|
||||
{
|
||||
private _achievement: AchievementData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._achievement = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(k: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!k) return false;
|
||||
|
||||
this._achievement = new AchievementData(k);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get achievement(): AchievementData
|
||||
{
|
||||
return this._achievement;
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class AchievementResolutionData
|
||||
{
|
||||
public static STATE_SELECTABLE: number = 0;
|
||||
|
||||
private _achievementId: number;
|
||||
private _level: number;
|
||||
private _badgeId: string;
|
||||
private _requiredLevel: number;
|
||||
private _state: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._achievementId = wrapper.readInt();
|
||||
this._level = wrapper.readInt();
|
||||
this._badgeId = wrapper.readString();
|
||||
this._requiredLevel = wrapper.readInt();
|
||||
this._state = wrapper.readInt();
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
this._achievementId = 0;
|
||||
this._level = 0;
|
||||
this._badgeId = '';
|
||||
this._requiredLevel = 0;
|
||||
}
|
||||
|
||||
public get achievementId(): number
|
||||
{
|
||||
return this._achievementId;
|
||||
}
|
||||
|
||||
public get level(): number
|
||||
{
|
||||
return this._level;
|
||||
}
|
||||
|
||||
public get badgeId(): string
|
||||
{
|
||||
return this._badgeId;
|
||||
}
|
||||
|
||||
public get requiredLevel(): number
|
||||
{
|
||||
return this._requiredLevel;
|
||||
}
|
||||
|
||||
public get enabled(): boolean
|
||||
{
|
||||
return (this._state === AchievementResolutionData.STATE_SELECTABLE);
|
||||
}
|
||||
|
||||
public get state(): number
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { AchievementData } from './AchievementData';
|
||||
|
||||
export class AchievementsParser implements IMessageParser
|
||||
{
|
||||
private _achievements: AchievementData[];
|
||||
private _defaultCategory: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._achievements = [];
|
||||
this._defaultCategory = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(k: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!k) return false;
|
||||
|
||||
this._achievements = [];
|
||||
|
||||
let totalCount = k.readInt();
|
||||
|
||||
while(totalCount > 0)
|
||||
{
|
||||
this._achievements.push(new AchievementData(k));
|
||||
|
||||
totalCount--;
|
||||
}
|
||||
|
||||
this._defaultCategory = k.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get achievements(): AchievementData[]
|
||||
{
|
||||
return this._achievements;
|
||||
}
|
||||
|
||||
public get defaultCategory(): string
|
||||
{
|
||||
return this._defaultCategory;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class AchievementsScoreParser implements IMessageParser
|
||||
{
|
||||
private _score: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._score = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(k: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!k) return false;
|
||||
|
||||
this._score = k.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get score(): number
|
||||
{
|
||||
return this._score;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './AchievementData';
|
||||
export * from './AchievementParser';
|
||||
export * from './AchievementResolutionData';
|
||||
export * from './AchievementsParser';
|
||||
export * from './AchievementsScoreParser';
|
||||
@@ -0,0 +1,69 @@
|
||||
export class AvatarEffect
|
||||
{
|
||||
private _type: number;
|
||||
private _subType: number;
|
||||
private _duration: number;
|
||||
private _inactiveEffectsInInventory: number;
|
||||
private _secondsLeftIfActive: number;
|
||||
private _permanent: boolean;
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public set type(k: number)
|
||||
{
|
||||
this._type = k;
|
||||
}
|
||||
|
||||
public get subType(): number
|
||||
{
|
||||
return this._subType;
|
||||
}
|
||||
|
||||
public set subType(k: number)
|
||||
{
|
||||
this._subType = k;
|
||||
}
|
||||
|
||||
public get duration(): number
|
||||
{
|
||||
return this._duration;
|
||||
}
|
||||
|
||||
public set duration(k: number)
|
||||
{
|
||||
this._duration = k;
|
||||
}
|
||||
|
||||
public get inactiveEffectsInInventory(): number
|
||||
{
|
||||
return this._inactiveEffectsInInventory;
|
||||
}
|
||||
|
||||
public set inactiveEffectsInInventory(k: number)
|
||||
{
|
||||
this._inactiveEffectsInInventory = k;
|
||||
}
|
||||
|
||||
public get secondsLeftIfActive(): number
|
||||
{
|
||||
return this._secondsLeftIfActive;
|
||||
}
|
||||
|
||||
public set secondsLeftIfActive(k: number)
|
||||
{
|
||||
this._secondsLeftIfActive = k;
|
||||
}
|
||||
|
||||
public get isPermanent(): boolean
|
||||
{
|
||||
return this._permanent;
|
||||
}
|
||||
|
||||
public set isPermanent(k: boolean)
|
||||
{
|
||||
this._permanent = k;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class AvatarEffectActivatedParser implements IMessageParser
|
||||
{
|
||||
private _type: number;
|
||||
private _duration: number;
|
||||
private _isPermanent: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._type = 0;
|
||||
this._duration = 0;
|
||||
this._isPermanent = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._type = wrapper.readInt();
|
||||
this._duration = wrapper.readInt();
|
||||
this._isPermanent = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public get duration(): number
|
||||
{
|
||||
return this._duration;
|
||||
}
|
||||
|
||||
public get isPermanent(): boolean
|
||||
{
|
||||
return this._isPermanent;
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class AvatarEffectAddedParser implements IMessageParser
|
||||
{
|
||||
private _type: number;
|
||||
private _subType: number;
|
||||
private _duration: number;
|
||||
private _permanent: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._type = 0;
|
||||
this._subType = 0;
|
||||
this._duration = 0;
|
||||
this._permanent = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._type = wrapper.readInt();
|
||||
this._subType = wrapper.readInt();
|
||||
this._duration = wrapper.readInt();
|
||||
this._permanent = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public get subType(): number
|
||||
{
|
||||
return this._subType;
|
||||
}
|
||||
|
||||
public get duration(): number
|
||||
{
|
||||
return this._duration;
|
||||
}
|
||||
|
||||
public get isPermanent(): boolean
|
||||
{
|
||||
return this._permanent;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class AvatarEffectExpiredParser implements IMessageParser
|
||||
{
|
||||
private _type: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._type = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._type = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class AvatarEffectSelectedParser implements IMessageParser
|
||||
{
|
||||
private _type: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._type = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._type = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { AvatarEffect } from './AvatarEffect';
|
||||
|
||||
export class AvatarEffectsParser implements IMessageParser
|
||||
{
|
||||
private _effects: AvatarEffect[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._effects = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
let totalEffects = wrapper.readInt();
|
||||
|
||||
while(totalEffects > 0)
|
||||
{
|
||||
const effect = new AvatarEffect();
|
||||
|
||||
effect.type = wrapper.readInt();
|
||||
effect.subType = wrapper.readInt();
|
||||
effect.duration = wrapper.readInt();
|
||||
effect.inactiveEffectsInInventory = wrapper.readInt();
|
||||
effect.secondsLeftIfActive = wrapper.readInt();
|
||||
effect.isPermanent = wrapper.readBoolean();
|
||||
|
||||
this._effects.push(effect);
|
||||
|
||||
totalEffects--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get effects(): AvatarEffect[]
|
||||
{
|
||||
return this._effects;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from './AvatarEffect';
|
||||
export * from './AvatarEffectActivatedParser';
|
||||
export * from './AvatarEffectAddedParser';
|
||||
export * from './AvatarEffectExpiredParser';
|
||||
export * from './AvatarEffectSelectedParser';
|
||||
export * from './AvatarEffectsParser';
|
||||
@@ -0,0 +1,25 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
|
||||
export class BadgeAndPointLimit
|
||||
{
|
||||
private _badgeId: string;
|
||||
private _limit: number;
|
||||
|
||||
constructor(k: string, _arg_2: IMessageDataWrapper)
|
||||
{
|
||||
if(!_arg_2) throw new Error('invalid_parser');
|
||||
|
||||
this._badgeId = (('ACH_' + k) + _arg_2.readInt());
|
||||
this._limit = _arg_2.readInt();
|
||||
}
|
||||
|
||||
public get badgeId(): string
|
||||
{
|
||||
return this._badgeId;
|
||||
}
|
||||
|
||||
public get limit(): number
|
||||
{
|
||||
return this._limit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { BadgeAndPointLimit } from './BadgeAndPointLimit';
|
||||
|
||||
export class BadgePointLimitsParser implements IMessageParser
|
||||
{
|
||||
private _data: BadgeAndPointLimit[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._data = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
let _local_2 = wrapper.readInt();
|
||||
|
||||
while(_local_2 > 0)
|
||||
{
|
||||
const _local_4 = wrapper.readString();
|
||||
const _local_5 = wrapper.readInt();
|
||||
|
||||
let _local_6 = 0;
|
||||
|
||||
while(_local_6 < _local_5)
|
||||
{
|
||||
this._data.push(new BadgeAndPointLimit(_local_4, wrapper));
|
||||
|
||||
_local_6++;
|
||||
}
|
||||
|
||||
_local_2--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get data(): BadgeAndPointLimit[]
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class BadgeReceivedParser implements IMessageParser
|
||||
{
|
||||
private _badgeId: number;
|
||||
private _badgeCode: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._badgeId = 0;
|
||||
this._badgeCode = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._badgeId = wrapper.readInt();
|
||||
this._badgeCode = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get badgeId(): number
|
||||
{
|
||||
return this._badgeId;
|
||||
}
|
||||
|
||||
public get badgeCode(): string
|
||||
{
|
||||
return this._badgeCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { AdvancedMap } from '@nitrots/utils';
|
||||
|
||||
export class BadgesParser implements IMessageParser
|
||||
{
|
||||
private _allBadgeCodes: string[];
|
||||
private _activeBadgeCodes: string[];
|
||||
private _badgeIds: IAdvancedMap<string, number>;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._allBadgeCodes = [];
|
||||
this._activeBadgeCodes = null;
|
||||
this._badgeIds = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._allBadgeCodes = [];
|
||||
this._activeBadgeCodes = [];
|
||||
this._badgeIds = new AdvancedMap();
|
||||
|
||||
let count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
const badgeId = wrapper.readInt();
|
||||
const badgeCode = wrapper.readString();
|
||||
|
||||
this._badgeIds.add(badgeCode, badgeId);
|
||||
|
||||
this._allBadgeCodes.push(badgeCode);
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
count = wrapper.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
const badgeSlot = wrapper.readInt();
|
||||
const badgeCode = wrapper.readString();
|
||||
|
||||
this._activeBadgeCodes.push(badgeCode);
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public getBadgeId(code: string): number
|
||||
{
|
||||
return this._badgeIds.getValue(code);
|
||||
}
|
||||
public getAllBadgeCodes(): string[]
|
||||
{
|
||||
return this._allBadgeCodes;
|
||||
}
|
||||
|
||||
public getActiveBadgeCodes(): string[]
|
||||
{
|
||||
return this._activeBadgeCodes;
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class IsBadgeRequestFulfilledParser implements IMessageParser
|
||||
{
|
||||
private _requestCode: string;
|
||||
private _fulfilled: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._requestCode = wrapper.readString();
|
||||
this._fulfilled = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get requestCode(): string
|
||||
{
|
||||
return this._requestCode;
|
||||
}
|
||||
|
||||
public get fulfilled(): boolean
|
||||
{
|
||||
return this._fulfilled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export * from './BadgeAndPointLimit';
|
||||
export * from './BadgePointLimitsParser';
|
||||
export * from './BadgeReceivedParser';
|
||||
export * from './BadgesParser';
|
||||
export * from './IsBadgeRequestFulfilledParser';
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class FigureSetIdsMessageParser implements IMessageParser
|
||||
{
|
||||
private _figureSetIds: number[];
|
||||
private _boundFurnitureNames: string[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._figureSetIds = [];
|
||||
this._boundFurnitureNames = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
let totalSetIds = wrapper.readInt();
|
||||
|
||||
while(totalSetIds > 0)
|
||||
{
|
||||
this._figureSetIds.push(wrapper.readInt());
|
||||
|
||||
totalSetIds--;
|
||||
}
|
||||
|
||||
let totalFurnitureNames = wrapper.readInt();
|
||||
|
||||
while(totalFurnitureNames > 0)
|
||||
{
|
||||
this._boundFurnitureNames.push(wrapper.readString());
|
||||
|
||||
totalFurnitureNames--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get figureSetIds(): number[]
|
||||
{
|
||||
return this._figureSetIds;
|
||||
}
|
||||
|
||||
public get boundsFurnitureNames(): string[]
|
||||
{
|
||||
return this._boundFurnitureNames;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class _Str_8728 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,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class _Str_9021 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,3 @@
|
||||
export * from './FigureSetIdsMessageParser';
|
||||
export * from './_Str_8728';
|
||||
export * from './_Str_9021';
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { FurnitureListItemParser } from './FurnitureListItemParser';
|
||||
|
||||
export class FurnitureListAddOrUpdateParser implements IMessageParser
|
||||
{
|
||||
private _items: FurnitureListItemParser[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._items = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._items.push(new FurnitureListItemParser(wrapper));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get items(): FurnitureListItemParser[]
|
||||
{
|
||||
return this._items;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class FurnitureListInvalidateParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
import { IMessageDataWrapper, IObjectData } from '@nitrots/api';
|
||||
import { FurnitureDataParser } from '../../room';
|
||||
import { IFurnitureItemData } from './IFurnitureItemData';
|
||||
|
||||
export class FurnitureListItemParser implements IFurnitureItemData
|
||||
{
|
||||
private static WALL_ITEM: string = 'I';
|
||||
private static FLOOR_ITEM: string = 'S';
|
||||
|
||||
private _rentable: boolean;
|
||||
private _itemId: number;
|
||||
private _furniType: string;
|
||||
private _ref: number;
|
||||
private _spriteId: number;
|
||||
private _category: number;
|
||||
private _stuffData: IObjectData;
|
||||
private _isGroupable: boolean;
|
||||
private _isRecyclable: boolean;
|
||||
private _tradable: boolean;
|
||||
private _sellable: boolean;
|
||||
private _secondsToExpiration: number;
|
||||
private _extra: number;
|
||||
private _flatId: number;
|
||||
private _isWallItem: boolean;
|
||||
private _hasRentPeriodStarted: boolean;
|
||||
private _expirationTimeStamp: number;
|
||||
private _slotId: string;
|
||||
private _songId: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this.flush();
|
||||
this.parse(wrapper);
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._rentable = false;
|
||||
this._itemId = 0;
|
||||
this._furniType = null;
|
||||
this._ref = 0;
|
||||
this._spriteId = 0;
|
||||
this._category = 0;
|
||||
this._stuffData = null;
|
||||
this._isGroupable = false;
|
||||
this._isRecyclable = false;
|
||||
this._tradable = false;
|
||||
this._sellable = false;
|
||||
this._secondsToExpiration = 0;
|
||||
this._extra = 0;
|
||||
this._flatId = 0;
|
||||
this._isWallItem = false;
|
||||
this._hasRentPeriodStarted = false;
|
||||
this._expirationTimeStamp = 0;
|
||||
this._slotId = '';
|
||||
this._songId = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._itemId = wrapper.readInt();
|
||||
this._furniType = wrapper.readString();
|
||||
this._ref = wrapper.readInt();
|
||||
this._spriteId = wrapper.readInt();
|
||||
this._category = wrapper.readInt();
|
||||
this._stuffData = FurnitureDataParser.parseObjectData(wrapper);
|
||||
this._isRecyclable = wrapper.readBoolean();
|
||||
this._tradable = wrapper.readBoolean();
|
||||
this._isGroupable = wrapper.readBoolean();
|
||||
this._sellable = wrapper.readBoolean();
|
||||
this._secondsToExpiration = wrapper.readInt();
|
||||
this._expirationTimeStamp = 0; //GetTickerTime
|
||||
|
||||
if(this.secondsToExpiration > -1)
|
||||
{
|
||||
this._rentable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._rentable = false;
|
||||
this._secondsToExpiration = -1;
|
||||
}
|
||||
|
||||
this._hasRentPeriodStarted = wrapper.readBoolean();
|
||||
this._flatId = wrapper.readInt();
|
||||
this._isWallItem = (this._furniType === FurnitureListItemParser.WALL_ITEM);
|
||||
|
||||
if(this._furniType === FurnitureListItemParser.FLOOR_ITEM)
|
||||
{
|
||||
this._slotId = wrapper.readString();
|
||||
this._extra = wrapper.readInt();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get itemId(): number
|
||||
{
|
||||
return this._itemId;
|
||||
}
|
||||
|
||||
public get furniType(): string
|
||||
{
|
||||
return this._furniType;
|
||||
}
|
||||
|
||||
public get ref(): number
|
||||
{
|
||||
return this._ref;
|
||||
}
|
||||
|
||||
public get spriteId(): number
|
||||
{
|
||||
return this._spriteId;
|
||||
}
|
||||
|
||||
public get category(): number
|
||||
{
|
||||
return this._category;
|
||||
}
|
||||
|
||||
public get stuffData(): IObjectData
|
||||
{
|
||||
return this._stuffData;
|
||||
}
|
||||
|
||||
public get isGroupable(): boolean
|
||||
{
|
||||
return this._isGroupable;
|
||||
}
|
||||
|
||||
public get isRecycleable(): boolean
|
||||
{
|
||||
return this._isRecyclable;
|
||||
}
|
||||
|
||||
public get tradable(): boolean
|
||||
{
|
||||
return this._tradable;
|
||||
}
|
||||
|
||||
public get sellable(): boolean
|
||||
{
|
||||
return this._sellable;
|
||||
}
|
||||
|
||||
public get secondsToExpiration(): number
|
||||
{
|
||||
return this._secondsToExpiration;
|
||||
}
|
||||
|
||||
public get flatId(): number
|
||||
{
|
||||
return this._flatId;
|
||||
}
|
||||
|
||||
public get slotId(): string
|
||||
{
|
||||
return this._slotId;
|
||||
}
|
||||
|
||||
public get songId(): number
|
||||
{
|
||||
return this._songId;
|
||||
}
|
||||
|
||||
public get extra(): number
|
||||
{
|
||||
return this._extra;
|
||||
}
|
||||
|
||||
public get rentable(): boolean
|
||||
{
|
||||
return this._rentable;
|
||||
}
|
||||
|
||||
public get isWallItem(): boolean
|
||||
{
|
||||
return this._isWallItem;
|
||||
}
|
||||
|
||||
public get hasRentPeriodStarted(): boolean
|
||||
{
|
||||
return this._hasRentPeriodStarted;
|
||||
}
|
||||
|
||||
public get expirationTimeStamp(): number
|
||||
{
|
||||
return this._expirationTimeStamp;
|
||||
}
|
||||
|
||||
public get creationDay(): number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public get creationMonth(): number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public get creationYear(): number
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public get isExternalImageFurni(): boolean
|
||||
{
|
||||
return !(this._furniType.indexOf('external_image') === -1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { FurnitureListItemParser } from './FurnitureListItemParser';
|
||||
|
||||
export class FurnitureListParser implements IMessageParser
|
||||
{
|
||||
private _totalFragments: number;
|
||||
private _fragmentNumber: number;
|
||||
private _fragment: Map<number, FurnitureListItemParser>;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._totalFragments = 0;
|
||||
this._fragmentNumber = 0;
|
||||
this._fragment = new Map();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._totalFragments = wrapper.readInt();
|
||||
this._fragmentNumber = wrapper.readInt();
|
||||
|
||||
let totalItems = wrapper.readInt();
|
||||
|
||||
while(totalItems > 0)
|
||||
{
|
||||
const item = new FurnitureListItemParser(wrapper);
|
||||
|
||||
if(item) this._fragment.set(item.itemId, item);
|
||||
|
||||
totalItems--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get totalFragments(): number
|
||||
{
|
||||
return this._totalFragments;
|
||||
}
|
||||
|
||||
public get fragmentNumber(): number
|
||||
{
|
||||
return this._fragmentNumber;
|
||||
}
|
||||
|
||||
public get fragment(): Map<number, FurnitureListItemParser>
|
||||
{
|
||||
return this._fragment;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class FurnitureListRemovedParser 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;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class FurniturePostItPlacedParser implements IMessageParser
|
||||
{
|
||||
private _itemId: number;
|
||||
private _itemsLeft: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._itemId = 0;
|
||||
this._itemsLeft = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._itemId = wrapper.readInt();
|
||||
this._itemsLeft = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get itemId(): number
|
||||
{
|
||||
return this._itemId;
|
||||
}
|
||||
|
||||
public get itemsLeft(): number
|
||||
{
|
||||
return this._itemsLeft;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { IObjectData } from '@nitrots/api';
|
||||
|
||||
export interface IFurnitureItemData
|
||||
{
|
||||
itemId: number;
|
||||
furniType: string;
|
||||
ref: number;
|
||||
spriteId: number;
|
||||
category: number;
|
||||
stuffData: IObjectData;
|
||||
isGroupable: boolean;
|
||||
isRecycleable: boolean;
|
||||
tradable: boolean;
|
||||
sellable: boolean;
|
||||
secondsToExpiration: number;
|
||||
flatId: number;
|
||||
slotId: string;
|
||||
songId: number;
|
||||
extra: number;
|
||||
rentable: boolean;
|
||||
isWallItem: boolean;
|
||||
hasRentPeriodStarted: boolean;
|
||||
expirationTimeStamp: number;
|
||||
creationDay: number;
|
||||
creationMonth: number;
|
||||
creationYear: number;
|
||||
isExternalImageFurni: boolean;
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class PresentOpenedMessageParser implements IMessageParser
|
||||
{
|
||||
private _itemType: string;
|
||||
private _classId: number;
|
||||
private _productCode: string;
|
||||
private _placedItemId: number;
|
||||
private _placedItemType: string;
|
||||
private _placedInRoom: boolean;
|
||||
private _petFigureString: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._itemType = '';
|
||||
this._classId = 0;
|
||||
this._productCode = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._itemType = wrapper.readString();
|
||||
this._classId = wrapper.readInt();
|
||||
this._productCode = wrapper.readString();
|
||||
this._placedItemId = wrapper.readInt();
|
||||
this._placedItemType = wrapper.readString();
|
||||
this._placedInRoom = wrapper.readBoolean();
|
||||
this._petFigureString = wrapper.readString();
|
||||
return true;
|
||||
}
|
||||
|
||||
public get itemType(): string
|
||||
{
|
||||
return this._itemType;
|
||||
}
|
||||
|
||||
public get classId(): number
|
||||
{
|
||||
return this._classId;
|
||||
}
|
||||
|
||||
public get productCode(): string
|
||||
{
|
||||
return this._productCode;
|
||||
}
|
||||
|
||||
public get placedItemId(): number
|
||||
{
|
||||
return this._placedItemId;
|
||||
}
|
||||
|
||||
public get placedItemType(): string
|
||||
{
|
||||
return this._placedItemType;
|
||||
}
|
||||
|
||||
public get placedInRoom(): boolean
|
||||
{
|
||||
return this._placedInRoom;
|
||||
}
|
||||
|
||||
public get petFigureString(): string
|
||||
{
|
||||
return this._petFigureString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export * from './FurnitureListAddOrUpdateParser';
|
||||
export * from './FurnitureListInvalidateParser';
|
||||
export * from './FurnitureListItemParser';
|
||||
export * from './FurnitureListParser';
|
||||
export * from './FurnitureListRemovedParser';
|
||||
export * from './FurniturePostItPlacedParser';
|
||||
export * from './IFurnitureItemData';
|
||||
export * from './PresentOpenedMessageParser';
|
||||
@@ -0,0 +1,8 @@
|
||||
export * from './achievements';
|
||||
export * from './avatareffect';
|
||||
export * from './badges';
|
||||
export * from './clothing';
|
||||
export * from './furniture';
|
||||
export * from './pets';
|
||||
export * from './purse';
|
||||
export * from './trading';
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
import { BreedingPetInfo, IMessageDataWrapper, IMessageParser, RarityCategoryData } from '@nitrots/api';
|
||||
|
||||
export class ConfirmBreedingRequestParser implements IMessageParser
|
||||
{
|
||||
private _nestId: number;
|
||||
private _pet1: BreedingPetInfo;
|
||||
private _pet2: BreedingPetInfo;
|
||||
private _rarityCategories: RarityCategoryData[];
|
||||
private _resultPetType: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._nestId = 0;
|
||||
|
||||
if(this._pet1)
|
||||
{
|
||||
this._pet1.dispose();
|
||||
this._pet1 = null;
|
||||
}
|
||||
|
||||
if(this._pet2)
|
||||
{
|
||||
this._pet2.dispose();
|
||||
this._pet2 = null;
|
||||
}
|
||||
|
||||
for(const k of this._rarityCategories) k && k.dispose();
|
||||
|
||||
this._rarityCategories = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._nestId = wrapper.readInt();
|
||||
this._pet1 = new BreedingPetInfo(wrapper);
|
||||
this._pet2 = new BreedingPetInfo(wrapper);
|
||||
|
||||
let totalCount = wrapper.readInt();
|
||||
|
||||
while(totalCount > 0)
|
||||
{
|
||||
this._rarityCategories.push(new RarityCategoryData(wrapper));
|
||||
|
||||
totalCount--;
|
||||
}
|
||||
|
||||
this._resultPetType = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get nestId(): number
|
||||
{
|
||||
return this._nestId;
|
||||
}
|
||||
|
||||
public get pet1(): BreedingPetInfo
|
||||
{
|
||||
return this._pet1;
|
||||
}
|
||||
|
||||
public get pet2(): BreedingPetInfo
|
||||
{
|
||||
return this._pet2;
|
||||
}
|
||||
|
||||
public get rarityCategories(): RarityCategoryData[]
|
||||
{
|
||||
return this._rarityCategories;
|
||||
}
|
||||
|
||||
public get resultPetType(): number
|
||||
{
|
||||
return this._resultPetType;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class ConfirmBreedingResultParser implements IMessageParser
|
||||
{
|
||||
private _breedingNestStuffId: number;
|
||||
private _result: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._breedingNestStuffId = 0;
|
||||
this._result = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._breedingNestStuffId = wrapper.readInt();
|
||||
this._result = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get breedingNestStuffId(): number
|
||||
{
|
||||
return this._breedingNestStuffId;
|
||||
}
|
||||
|
||||
public get result(): number
|
||||
{
|
||||
return this._result;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class GoToBreedingNestFailureParser implements IMessageParser
|
||||
{
|
||||
public static PET_TOO_TIRED_TO_BREED: number = 6;
|
||||
|
||||
private _reason: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._reason = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get reason(): number
|
||||
{
|
||||
return this._reason;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class NestBreedingSuccessParser implements IMessageParser
|
||||
{
|
||||
private _rarityCategory: number;
|
||||
private _petId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._petId = -1;
|
||||
this._rarityCategory = -1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._petId = wrapper.readInt();
|
||||
this._rarityCategory = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get rarityCategory(): number
|
||||
{
|
||||
return this._rarityCategory;
|
||||
}
|
||||
|
||||
public get petId(): number
|
||||
{
|
||||
return this._petId;
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { PetData } from './PetData';
|
||||
|
||||
export class PetAddedToInventoryParser implements IMessageParser
|
||||
{
|
||||
private _pet: PetData;
|
||||
private _boughtAsGift: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._pet = null;
|
||||
this._boughtAsGift = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._pet = new PetData(wrapper);
|
||||
this._boughtAsGift = wrapper.readBoolean();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get pet(): PetData
|
||||
{
|
||||
return this._pet;
|
||||
}
|
||||
|
||||
public get boughtAsGift(): boolean
|
||||
{
|
||||
return this._boughtAsGift;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class PetBreedingMessageParser implements IMessageParser
|
||||
{
|
||||
public static STATE_CANCEL: number = 1;
|
||||
public static STATE_ACCEPT: number = 2;
|
||||
public static STATE_REQUEST: number = 3;
|
||||
|
||||
private _state: number;
|
||||
private _ownPetId: number;
|
||||
private _otherPetId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._state = 0;
|
||||
this._ownPetId = 0;
|
||||
this._otherPetId = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._state = wrapper.readInt();
|
||||
this._ownPetId = wrapper.readInt();
|
||||
this._otherPetId = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get state(): number
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public get ownPetId(): number
|
||||
{
|
||||
return this._ownPetId;
|
||||
}
|
||||
|
||||
public get otherPetId(): number
|
||||
{
|
||||
return this._otherPetId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import { IMessageDataWrapper } from '@nitrots/api';
|
||||
import { PetFigureDataParser } from './PetFigureDataParser';
|
||||
|
||||
export class PetData
|
||||
{
|
||||
private _id: number;
|
||||
private _name: string;
|
||||
private _figureData: PetFigureDataParser;
|
||||
private _level: number;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
if(!wrapper) throw new Error('invalid_wrapper');
|
||||
|
||||
this._id = wrapper.readInt();
|
||||
this._name = wrapper.readString();
|
||||
this._figureData = new PetFigureDataParser(wrapper);
|
||||
this._level = wrapper.readInt();
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get name(): string
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get typeId(): number
|
||||
{
|
||||
return this._figureData.typeId;
|
||||
}
|
||||
|
||||
public get paletteId(): number
|
||||
{
|
||||
return this._figureData.paletteId;
|
||||
}
|
||||
|
||||
public get color(): string
|
||||
{
|
||||
return this._figureData.color;
|
||||
}
|
||||
|
||||
public get breedId(): number
|
||||
{
|
||||
return this._figureData.breedId;
|
||||
}
|
||||
|
||||
public get customPartCount(): number
|
||||
{
|
||||
return this._figureData.customPartCount;
|
||||
}
|
||||
|
||||
public get figureString(): string
|
||||
{
|
||||
return this._figureData.figuredata;
|
||||
}
|
||||
|
||||
public get figureData(): PetFigureDataParser
|
||||
{
|
||||
return this._figureData;
|
||||
}
|
||||
|
||||
public get level(): number
|
||||
{
|
||||
return this._level;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import { IMessageDataWrapper, IPetCustomPart, IPetFigureData, PetCustomPart } from '@nitrots/api';
|
||||
|
||||
export class PetFigureDataParser implements IPetFigureData
|
||||
{
|
||||
private _typeId: number;
|
||||
private _paletteId: number;
|
||||
private _color: string;
|
||||
private _breedId: number;
|
||||
private _customPartCount: number;
|
||||
private _customParts: IPetCustomPart[];
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._typeId = wrapper.readInt();
|
||||
this._paletteId = wrapper.readInt();
|
||||
this._color = wrapper.readString();
|
||||
this._breedId = wrapper.readInt();
|
||||
this._customParts = [];
|
||||
this._customPartCount = wrapper.readInt();
|
||||
|
||||
let i = 0;
|
||||
|
||||
while(i < this._customPartCount)
|
||||
{
|
||||
this._customParts.push(new PetCustomPart(wrapper.readInt(), wrapper.readInt(), wrapper.readInt()));
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public get typeId(): number
|
||||
{
|
||||
return this._typeId;
|
||||
}
|
||||
|
||||
public get paletteId(): number
|
||||
{
|
||||
return this._paletteId;
|
||||
}
|
||||
|
||||
public get color(): string
|
||||
{
|
||||
return this._color;
|
||||
}
|
||||
|
||||
public get breedId(): number
|
||||
{
|
||||
return this._breedId;
|
||||
}
|
||||
|
||||
public get figuredata(): string
|
||||
{
|
||||
let figure = ((((this.typeId + ' ') + this.paletteId) + ' ') + this.color);
|
||||
|
||||
figure = (figure + (' ' + this.customPartCount));
|
||||
|
||||
for(const _local_2 of this.customParts) figure = (figure + (' ' + _local_2.layerId + ' ' + _local_2.partId + ' ' + _local_2.paletteId));
|
||||
|
||||
return figure;
|
||||
}
|
||||
|
||||
public get customParts(): IPetCustomPart[]
|
||||
{
|
||||
return this._customParts;
|
||||
}
|
||||
|
||||
public get customPartCount(): number
|
||||
{
|
||||
return this._customPartCount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { PetData } from './PetData';
|
||||
|
||||
export class PetInventoryParser implements IMessageParser
|
||||
{
|
||||
protected _totalFragments: number;
|
||||
protected _fragmentNumber: number;
|
||||
private _fragment: Map<number, PetData>;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._fragment = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._totalFragments = wrapper.readInt();
|
||||
this._fragmentNumber = wrapper.readInt();
|
||||
|
||||
let totalCount: number = wrapper.readInt();
|
||||
|
||||
this._fragment = new Map();
|
||||
|
||||
while(totalCount > 0)
|
||||
{
|
||||
const petData = new PetData(wrapper);
|
||||
|
||||
this._fragment.set(petData.id, petData);
|
||||
|
||||
totalCount--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get totalFragments(): number
|
||||
{
|
||||
return this._totalFragments;
|
||||
}
|
||||
|
||||
public get fragmentNumber(): number
|
||||
{
|
||||
return this._fragmentNumber;
|
||||
}
|
||||
|
||||
public get fragment(): Map<number, PetData>
|
||||
{
|
||||
return this._fragment;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
import { PetData } from './PetData';
|
||||
|
||||
export class PetReceivedMessageParser implements IMessageParser
|
||||
{
|
||||
private _boughtAsGift: boolean;
|
||||
private _pet: PetData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._boughtAsGift = false;
|
||||
this._pet = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(k: IMessageDataWrapper): boolean
|
||||
{
|
||||
this._boughtAsGift = k.readBoolean();
|
||||
this._pet = new PetData(k);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get boughtAsGift(): boolean
|
||||
{
|
||||
return this._boughtAsGift;
|
||||
}
|
||||
|
||||
public get pet(): PetData
|
||||
{
|
||||
return this._pet;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class PetRemovedFromInventoryParser implements IMessageParser
|
||||
{
|
||||
private _petId: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._petId = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get petId(): number
|
||||
{
|
||||
return this._petId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export * from './ConfirmBreedingRequestParser';
|
||||
export * from './ConfirmBreedingResultParser';
|
||||
export * from './GoToBreedingNestFailureParser';
|
||||
export * from './NestBreedingSuccessParser';
|
||||
export * from './PetAddedToInventoryParser';
|
||||
export * from './PetBreedingMessageParser';
|
||||
export * from './PetData';
|
||||
export * from './PetFigureDataParser';
|
||||
export * from './PetInventoryParser';
|
||||
export * from './PetReceivedMessageParser';
|
||||
export * from './PetRemovedFromInventoryParser';
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class UserCreditsMessageParser implements IMessageParser
|
||||
{
|
||||
private _balance: number;
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._balance = parseFloat(wrapper.readString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public get balance(): number
|
||||
{
|
||||
return this._balance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './UserCreditsMessageParser';
|
||||
@@ -0,0 +1,162 @@
|
||||
import { IMessageDataWrapper, IObjectData } from '@nitrots/api';
|
||||
import { GetTickerTime } from '@nitrots/utils';
|
||||
import { FurnitureDataParser } from '../../room';
|
||||
import { IFurnitureItemData } from '../furniture';
|
||||
|
||||
export class ItemDataStructure implements IFurnitureItemData
|
||||
{
|
||||
private _expirationTimeStamp: number;
|
||||
private _isWallItem: boolean;
|
||||
private _itemId: number;
|
||||
private _furniType: string;
|
||||
private _ref: number;
|
||||
private _spriteId: number;
|
||||
private _category: number;
|
||||
private _stuffData: IObjectData;
|
||||
private _extra: number;
|
||||
private _secondsToExpiration: number;
|
||||
private _creationDay: number;
|
||||
private _creationMonth: number;
|
||||
private _creationYear: number;
|
||||
private _isGroupable: boolean;
|
||||
private _songId: number;
|
||||
private _flatId: number;
|
||||
private _rentable: boolean;
|
||||
private _hasRentPeriodStarted: boolean;
|
||||
|
||||
constructor(wrapper: IMessageDataWrapper)
|
||||
{
|
||||
this._itemId = wrapper.readInt();
|
||||
this._furniType = wrapper.readString().toUpperCase();
|
||||
this._ref = wrapper.readInt();
|
||||
this._spriteId = wrapper.readInt();
|
||||
this._category = wrapper.readInt();
|
||||
this._isGroupable = wrapper.readBoolean();
|
||||
this._stuffData = FurnitureDataParser.parseObjectData(wrapper);
|
||||
this._secondsToExpiration = -1;
|
||||
this._expirationTimeStamp = GetTickerTime();
|
||||
this._hasRentPeriodStarted = false;
|
||||
this._creationDay = wrapper.readInt();
|
||||
this._creationMonth = wrapper.readInt();
|
||||
this._creationYear = wrapper.readInt();
|
||||
this._extra = ((this.furniType === 'S') ? wrapper.readInt() : -1);
|
||||
this._flatId = -1;
|
||||
this._rentable = false;
|
||||
this._isWallItem = (this._furniType === 'I');
|
||||
}
|
||||
|
||||
public get itemId(): number
|
||||
{
|
||||
return this._itemId;
|
||||
}
|
||||
|
||||
public get furniType(): string
|
||||
{
|
||||
return this._furniType;
|
||||
}
|
||||
|
||||
public get ref(): number
|
||||
{
|
||||
return this._ref;
|
||||
}
|
||||
|
||||
public get spriteId(): number
|
||||
{
|
||||
return this._spriteId;
|
||||
}
|
||||
|
||||
public get category(): number
|
||||
{
|
||||
return this._category;
|
||||
}
|
||||
|
||||
public get stuffData(): IObjectData
|
||||
{
|
||||
return this._stuffData;
|
||||
}
|
||||
|
||||
public get extra(): number
|
||||
{
|
||||
return this._extra;
|
||||
}
|
||||
|
||||
public get secondsToExpiration(): number
|
||||
{
|
||||
return this._secondsToExpiration;
|
||||
}
|
||||
|
||||
public get creationDay(): number
|
||||
{
|
||||
return this._creationDay;
|
||||
}
|
||||
|
||||
public get creationMonth(): number
|
||||
{
|
||||
return this._creationMonth;
|
||||
}
|
||||
|
||||
public get creationYear(): number
|
||||
{
|
||||
return this._creationYear;
|
||||
}
|
||||
|
||||
public get isGroupable(): boolean
|
||||
{
|
||||
return this._isGroupable;
|
||||
}
|
||||
|
||||
public get songId(): number
|
||||
{
|
||||
return this._extra;
|
||||
}
|
||||
|
||||
public get flatId(): number
|
||||
{
|
||||
return this._flatId;
|
||||
}
|
||||
|
||||
public get rentable(): boolean
|
||||
{
|
||||
return this._rentable;
|
||||
}
|
||||
|
||||
public get isWallItem(): boolean
|
||||
{
|
||||
return this._isWallItem;
|
||||
}
|
||||
|
||||
public get hasRentPeriodStarted(): boolean
|
||||
{
|
||||
return this._hasRentPeriodStarted;
|
||||
}
|
||||
|
||||
public get expirationTimeStamp(): number
|
||||
{
|
||||
return this._expirationTimeStamp;
|
||||
}
|
||||
|
||||
public get isRecycleable(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public get tradable(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public get sellable(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public get slotId(): string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public get isExternalImageFurni(): boolean
|
||||
{
|
||||
return (this._furniType.indexOf('external_image') !== -1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingAcceptParser implements IMessageParser
|
||||
{
|
||||
private _userID: number;
|
||||
private _userAccepts: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._userID = -1;
|
||||
this._userAccepts = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._userID = wrapper.readInt();
|
||||
this._userAccepts = (wrapper.readInt() > 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get userID(): number
|
||||
{
|
||||
return this._userID;
|
||||
}
|
||||
|
||||
public get userAccepts(): boolean
|
||||
{
|
||||
return this._userAccepts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingCloseParser implements IMessageParser
|
||||
{
|
||||
public static ERROR_WHILE_COMMIT: number = 1;
|
||||
|
||||
private _userId: number;
|
||||
private _reason: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._userId = wrapper.readInt();
|
||||
this._reason = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get userID(): number
|
||||
{
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
public get reason(): number
|
||||
{
|
||||
return this._reason;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingCompletedParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingConfirmationParser 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';
|
||||
import { ItemDataStructure } from './ItemDataStructure';
|
||||
|
||||
export class TradingListItemParser implements IMessageParser
|
||||
{
|
||||
private _firstUserID: number;
|
||||
private _firstUserItemArray: ItemDataStructure[];
|
||||
private _firstUserNumItems: number;
|
||||
private _firstUserNumCredits: number;
|
||||
private _secondUserID: number;
|
||||
private _secondUserItemArray: ItemDataStructure[];
|
||||
private _secondUserNumItems: number;
|
||||
private _secondUserNumCredits: number;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._firstUserID = -1;
|
||||
this._firstUserItemArray = null;
|
||||
this._firstUserNumItems = 0;
|
||||
this._firstUserNumCredits = 0;
|
||||
this._secondUserID = -1;
|
||||
this._secondUserItemArray = null;
|
||||
this._secondUserNumItems = 0;
|
||||
this._secondUserNumCredits = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._firstUserID = wrapper.readInt();
|
||||
this._firstUserItemArray = [];
|
||||
|
||||
if(!this.parseItems(wrapper, this._firstUserItemArray)) return false;
|
||||
|
||||
this._firstUserNumItems = wrapper.readInt();
|
||||
this._firstUserNumCredits = wrapper.readInt();
|
||||
|
||||
this._secondUserID = wrapper.readInt();
|
||||
this._secondUserItemArray = [];
|
||||
|
||||
if(!this.parseItems(wrapper, this._secondUserItemArray)) return false;
|
||||
|
||||
this._secondUserNumItems = wrapper.readInt();
|
||||
this._secondUserNumCredits = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private parseItems(k: IMessageDataWrapper, itemArray: ItemDataStructure[]): boolean
|
||||
{
|
||||
let count = k.readInt();
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
itemArray.push(new ItemDataStructure(k));
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get firstUserID(): number
|
||||
{
|
||||
return this._firstUserID;
|
||||
}
|
||||
|
||||
public get firstUserItemArray(): ItemDataStructure[]
|
||||
{
|
||||
return this._firstUserItemArray;
|
||||
}
|
||||
|
||||
public get firstUserNumItems(): number
|
||||
{
|
||||
return this._firstUserNumItems;
|
||||
}
|
||||
|
||||
public get firstUserNumCredits(): number
|
||||
{
|
||||
return this._firstUserNumCredits;
|
||||
}
|
||||
|
||||
public get secondUserID(): number
|
||||
{
|
||||
return this._secondUserID;
|
||||
}
|
||||
|
||||
public get secondUserItemArray(): ItemDataStructure[]
|
||||
{
|
||||
return this._secondUserItemArray;
|
||||
}
|
||||
|
||||
public get secondUserNumItems(): number
|
||||
{
|
||||
return this._secondUserNumItems;
|
||||
}
|
||||
|
||||
public get secondUserNumCredits(): number
|
||||
{
|
||||
return this._secondUserNumCredits;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingNoSuchItemParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingNotOpenParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingOpenFailedParser implements IMessageParser
|
||||
{
|
||||
public static REASON_YOU_ARE_ALREADY_TRADING: number = 7;
|
||||
public static REASON_OTHER_USER_ALREADY_TRADING: number = 8;
|
||||
|
||||
private _reason: number;
|
||||
private _otherUserName: string;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._reason = wrapper.readInt();
|
||||
this._otherUserName = wrapper.readString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get reason(): number
|
||||
{
|
||||
return this._reason;
|
||||
}
|
||||
|
||||
public get otherUserName(): string
|
||||
{
|
||||
return this._otherUserName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingOpenParser implements IMessageParser
|
||||
{
|
||||
private _userId: number;
|
||||
private _userCanTrade: boolean;
|
||||
private _otherUserId: number;
|
||||
private _otherUserCanTrade: boolean;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._userId = -1;
|
||||
this._userCanTrade = false;
|
||||
this._otherUserId = -1;
|
||||
this._otherUserCanTrade = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._userId = wrapper.readInt();
|
||||
this._userCanTrade = (wrapper.readInt() === 1);
|
||||
this._otherUserId = wrapper.readInt();
|
||||
this._otherUserCanTrade = (wrapper.readInt() === 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get userID(): number
|
||||
{
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
public get userCanTrade(): boolean
|
||||
{
|
||||
return this._userCanTrade;
|
||||
}
|
||||
|
||||
public get otherUserID(): number
|
||||
{
|
||||
return this._otherUserId;
|
||||
}
|
||||
|
||||
public get otherUserCanTrade(): boolean
|
||||
{
|
||||
return this._otherUserCanTrade;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingOtherNotAllowedParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||
|
||||
export class TradingYouAreNotAllowedParser implements IMessageParser
|
||||
{
|
||||
public flush(): boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
export * from './ItemDataStructure';
|
||||
export * from './TradingAcceptParser';
|
||||
export * from './TradingCloseParser';
|
||||
export * from './TradingCompletedParser';
|
||||
export * from './TradingConfirmationParser';
|
||||
export * from './TradingListItemParser';
|
||||
export * from './TradingNoSuchItemParser';
|
||||
export * from './TradingNotOpenParser';
|
||||
export * from './TradingOpenFailedParser';
|
||||
export * from './TradingOpenParser';
|
||||
export * from './TradingOtherNotAllowedParser';
|
||||
export * from './TradingYouAreNotAllowedParser';
|
||||
Reference in New Issue
Block a user