Merge branch 'oobjectt-talent-track-level-up'

This commit is contained in:
dank074 2022-12-26 01:00:13 -06:00
commit 697b03b4d8
8 changed files with 114 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -367,6 +367,7 @@ export class IncomingHeader
public static BADGE_REQUEST_FULFILLED = 2998; public static BADGE_REQUEST_FULFILLED = 2998;
public static HELPER_TALENT_TRACK = 3406; public static HELPER_TALENT_TRACK = 3406;
public static TALENT_TRACK_LEVEL = 1203; public static TALENT_TRACK_LEVEL = 1203;
public static TALENT_TRACK_LEVEL_UP = 638;
public static USER_BANNED = 1683; public static USER_BANNED = 1683;
public static BOT_RECEIVED = 3684; public static BOT_RECEIVED = 3684;
public static PET_LEVEL_NOTIFICATION = 859; public static PET_LEVEL_NOTIFICATION = 859;

View File

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

View File

@ -1,2 +1,3 @@
export * from './TalentLevelUpEvent';
export * from './TalentTrackLevelMessageEvent'; export * from './TalentTrackLevelMessageEvent';
export * from './TalentTrackMessageEvent'; export * from './TalentTrackMessageEvent';

View File

@ -0,0 +1,74 @@
import { TalentTrackRewardPerk, TalentTrackRewardProduct } from '.';
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class TalentLevelUpMessageParser implements IMessageParser
{
private _talentTrackName: string;
private _level: number;
private _rewardPerks: TalentTrackRewardPerk[];
private _rewardProducts: TalentTrackRewardProduct[];
public flush(): boolean
{
this._talentTrackName = null;
this._level = -1;
this._rewardPerks = [];
this._rewardProducts = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
let totalRewards = 0;
this._talentTrackName = wrapper.readString();
this._level = wrapper.readInt();
const totalRewardsPerks = wrapper.readInt();
while(totalRewards < totalRewardsPerks)
{
this._rewardPerks.push(new TalentTrackRewardPerk(wrapper));
totalRewards++;
}
const totalRewardsProducts = wrapper.readInt();
if(totalRewards < totalRewardsProducts)
{
for(let i = 0; i < totalRewardsProducts; i++)
{
const name = wrapper.readString();
const vipDays = wrapper.readInt();
this._rewardProducts.push(new TalentTrackRewardProduct(name, vipDays));
totalRewards++;
}
}
return true;
}
public get talentTrackName(): string
{
return this._talentTrackName;
}
public get level(): number
{
return this._level;
}
public get rewardPerks(): TalentTrackRewardPerk[]
{
return this._rewardPerks;
}
public get rewardProducts(): TalentTrackRewardProduct[]
{
return this._rewardProducts;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageDataWrapper } from '../../../../../api';
export class TalentTrackRewardPerk
{
private _perkId: number;
constructor(wrapper: IMessageDataWrapper)
{
this._perkId = wrapper.readInt();
}
public get perkId(): number
{
return this._perkId;
}
}

View File

@ -3,10 +3,10 @@ export class TalentTrackRewardProduct
private _productCode: string; private _productCode: string;
private _vipDays: number; private _vipDays: number;
constructor(name: string, unknownInt: number) constructor(name: string, vipDays: number)
{ {
this._productCode = name; this._productCode = name;
this._vipDays = unknownInt; this._vipDays = vipDays;
} }
public get productCode(): string public get productCode(): string

View File

@ -1,5 +1,7 @@
export * from './TalentLevelUpMessageParser';
export * from './TalentTrackLevel'; export * from './TalentTrackLevel';
export * from './TalentTrackLevelMessageParser'; export * from './TalentTrackLevelMessageParser';
export * from './TalentTrackParser'; export * from './TalentTrackParser';
export * from './TalentTrackRewardPerk';
export * from './TalentTrackRewardProduct'; export * from './TalentTrackRewardProduct';
export * from './TalentTrackTask'; export * from './TalentTrackTask';