mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-22 23:50:52 +01:00
cleaned AchievementData
This commit is contained in:
parent
75f15cc73f
commit
b7351d372c
@ -1,156 +0,0 @@
|
||||
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
|
||||
export class Achievement
|
||||
{
|
||||
public static _Str_21736: number = -1;
|
||||
public static _Str_21318: number = 0;
|
||||
public static _Str_15908: number = 1;
|
||||
public static _Str_20384: number = 2;
|
||||
|
||||
private _achievementId: number;
|
||||
private _level: number;
|
||||
private _badgeId: string;
|
||||
private _Str_6791: number;
|
||||
private _Str_18274: number;
|
||||
private _Str_10280: number;
|
||||
private _Str_12282: number;
|
||||
private _Str_19007: number;
|
||||
private _Str_16081: boolean;
|
||||
private _category: string;
|
||||
private _Str_21707: string;
|
||||
private _Str_20339: number;
|
||||
private _Str_19099: 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._Str_6791 = wrapper.readInt();
|
||||
this._Str_18274 = Math.max(1, wrapper.readInt());
|
||||
this._Str_10280 = wrapper.readInt();
|
||||
this._Str_12282 = wrapper.readInt();
|
||||
this._Str_19007 = wrapper.readInt();
|
||||
this._Str_16081 = wrapper.readBoolean();
|
||||
this._category = wrapper.readString();
|
||||
this._Str_21707 = wrapper.readString();
|
||||
this._Str_20339 = wrapper.readInt();
|
||||
this._Str_19099 = 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 _Str_25209(): number
|
||||
{
|
||||
return this._Str_6791;
|
||||
}
|
||||
|
||||
public get _Str_24142(): number
|
||||
{
|
||||
return (this._Str_18274 - this._Str_6791);
|
||||
}
|
||||
|
||||
public get rewardAmount(): number
|
||||
{
|
||||
return this._Str_10280;
|
||||
}
|
||||
|
||||
public get rewardType(): number
|
||||
{
|
||||
return this._Str_12282;
|
||||
}
|
||||
|
||||
public get _Str_22939(): number
|
||||
{
|
||||
return (this._Str_19007 - this._Str_6791);
|
||||
}
|
||||
|
||||
public get _Str_7518(): boolean
|
||||
{
|
||||
return this._Str_16081;
|
||||
}
|
||||
|
||||
public get category(): string
|
||||
{
|
||||
return this._category;
|
||||
}
|
||||
|
||||
public get _Str_25896(): string
|
||||
{
|
||||
return this._Str_21707;
|
||||
}
|
||||
|
||||
public get totalLevels(): number
|
||||
{
|
||||
return this._Str_20339;
|
||||
}
|
||||
|
||||
public get _Str_10438(): boolean
|
||||
{
|
||||
return (this._level > 1) || (this._Str_16081);
|
||||
}
|
||||
|
||||
public _Str_24410(): void
|
||||
{
|
||||
this._Str_19007 = this._Str_18274;
|
||||
}
|
||||
|
||||
public get _Str_24874(): number
|
||||
{
|
||||
return this._Str_19099;
|
||||
}
|
||||
|
||||
public get progress(): number
|
||||
{
|
||||
return this._Str_19007;
|
||||
}
|
||||
|
||||
public get toNextProgress(): number
|
||||
{
|
||||
return this._Str_18274;
|
||||
}
|
||||
|
||||
public set unseen(unseen: number)
|
||||
{
|
||||
this._unseen = unseen;
|
||||
}
|
||||
|
||||
public get unseen(): number
|
||||
{
|
||||
return this._unseen;
|
||||
}
|
||||
|
||||
public reset(badge: Achievement)
|
||||
{
|
||||
this._achievementId = badge._achievementId;
|
||||
this._level = badge._level;
|
||||
this._badgeId = badge._badgeId;
|
||||
this._Str_6791 = badge._Str_6791;
|
||||
this._Str_18274 = badge._Str_18274;
|
||||
this._Str_10280 = badge._Str_10280;
|
||||
this._Str_12282 = badge._Str_12282;
|
||||
this._Str_19007 = badge._Str_19007;
|
||||
this._Str_16081 = badge._Str_16081;
|
||||
this._category = badge.category;
|
||||
this._Str_21707 = badge._Str_21707;
|
||||
this._Str_20339 = badge._Str_20339;
|
||||
this._Str_19099 = badge._Str_19099;
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
import { IMessageDataWrapper } from 'nitro-renderer/src/core/communication/messages/IMessageDataWrapper';
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
export * from './Achievement';
|
||||
export * from './AchievementData';
|
||||
export * from './AchievementEvent';
|
||||
export * from './AchievementResolution';
|
||||
export * from './AchievementsEvent';
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser';
|
||||
import { Achievement } from '../../../incoming/inventory/achievements/Achievement';
|
||||
import { AchievementData } from '../../../incoming/inventory/achievements/AchievementData';
|
||||
|
||||
export class AchievementParser implements IMessageParser
|
||||
{
|
||||
private _achievement: Achievement;
|
||||
private _achievement: AchievementData;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
@ -17,13 +17,13 @@ export class AchievementParser implements IMessageParser
|
||||
{
|
||||
if(!k) return false;
|
||||
|
||||
this._achievement = new Achievement(k);
|
||||
this._achievement = new AchievementData(k);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get achievement(): Achievement
|
||||
public get achievement(): AchievementData
|
||||
{
|
||||
return this._achievement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { AchievementData } from 'nitro-renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementData';
|
||||
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser';
|
||||
import { Achievement } from '../../../incoming/inventory/achievements/Achievement';
|
||||
|
||||
export class AchievementsParser implements IMessageParser
|
||||
{
|
||||
private _achievements: Achievement[];
|
||||
private _achievements: AchievementData[];
|
||||
private _Str_19269: string;
|
||||
|
||||
public flush(): boolean
|
||||
@ -25,7 +25,7 @@ export class AchievementsParser implements IMessageParser
|
||||
|
||||
while(totalCount > 0)
|
||||
{
|
||||
this._achievements.push(new Achievement(k));
|
||||
this._achievements.push(new AchievementData(k));
|
||||
|
||||
totalCount--;
|
||||
}
|
||||
@ -35,7 +35,7 @@ export class AchievementsParser implements IMessageParser
|
||||
return true;
|
||||
}
|
||||
|
||||
public get achievements(): Achievement[]
|
||||
public get achievements(): AchievementData[]
|
||||
{
|
||||
return this._achievements;
|
||||
}
|
||||
@ -44,4 +44,4 @@ export class AchievementsParser implements IMessageParser
|
||||
{
|
||||
return this._Str_19269;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user