#28 - BotSkillListUpdateEvent added

This commit is contained in:
oobjectt 2022-12-25 19:00:54 +01:00
parent 26741b78a7
commit 1ae87a5606
7 changed files with 89 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -277,6 +277,7 @@ export class IncomingHeader
public static REDEEM_VOUCHER_OK = 3336;
public static IN_CLIENT_LINK = 2023;
public static BOT_COMMAND_CONFIGURATION = 1618;
public static BOT_SKILL_LIST_UPDATE = 69;
public static HAND_ITEM_RECEIVED = 354;
public static PET_PLACING_ERROR = 2913;
public static BOT_ERROR = 639;

View File

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

View File

@ -1 +1,2 @@
export * from './BotCommandConfigurationEvent';
export * from './BotSkillListUpdateEvent';

View File

@ -0,0 +1,23 @@
import { IMessageDataWrapper } from '../../../../../../api';
export class BotSkillData
{
private _id: number;
private _data: string;
constructor(wrapper: IMessageDataWrapper)
{
this._id = wrapper.readInt();
this._data = wrapper.readString();
}
public get id(): number
{
return this._id;
}
public get data(): string
{
return this._data;
}
}

View File

@ -0,0 +1,44 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../api';
import { BotSkillData } from './BotSkillData';
export class BotSkillListUpdateParser implements IMessageParser
{
private _botId: number;
private _skillList: BotSkillData[];
public flush(): boolean
{
this._botId = -1;
this._skillList = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._botId = wrapper.readInt();
let totalSkills = wrapper.readInt();
while(totalSkills > 0)
{
this._skillList.push(new BotSkillData(wrapper));
totalSkills--;
}
return true;
}
public get botId(): number
{
return this._botId;
}
public get skillList(): BotSkillData[]
{
return this._skillList;
}
}

View File

@ -1 +1,3 @@
export * from './BotCommandConfigurationParser';
export * from './BotSkillData';
export * from './BotSkillListUpdateParser';