#28 - RecyclerStatusEvent and RecyclerFinishedEvent added

This commit is contained in:
oobjectt 2022-12-25 17:36:58 +01:00
parent 26741b78a7
commit 3931e0299a
10 changed files with 120 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -130,6 +130,8 @@ export class IncomingHeader
public static PET_NEST_BREEDING_SUCCESS = 2527;
public static PET_CONFIRM_BREEDING_REQUEST = 634;
public static RECYCLER_PRIZES = 3164;
public static RECYCLER_STATUS = 3433;
public static RECYCLER_FINISHED = 468;
public static ROOM_BAN_LIST = 1869;
public static ROOM_BAN_REMOVE = 3429;
public static ROOM_CREATED = 1304;

View File

@ -41,6 +41,7 @@ export * from './perk';
export * from './pet';
export * from './poll';
export * from './quest';
export * from './recycler';
export * from './room';
export * from './room/access';
export * from './room/access/doorbell';

View File

@ -0,0 +1,19 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { RecyclerFinishedMessageParser } from '../../parser';
export class RecyclerFinishedMessageEvent extends MessageEvent implements IMessageEvent
{
public static readonly FINISHED_OK: number = 1;
public static readonly FINISHED_FAIL: number = 2;
constructor(callBack: Function)
{
super(callBack, RecyclerFinishedMessageParser);
}
public getParser(): RecyclerFinishedMessageParser
{
return this.parser as RecyclerFinishedMessageParser;
}
}

View File

@ -0,0 +1,20 @@
import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../events';
import { RecyclerStatusMessageParser } from '../../parser';
export class RecyclerStatusMessageEvent extends MessageEvent implements IMessageEvent
{
public static readonly SYSTEM_STATUS_ENABLED: number = 1;
public static readonly SYSTEM_STATUS_DISABLED: number = 2;
public static readonly SYSTEM_STATUS_TIMEOUT: number = 3;
constructor(callBack: Function)
{
super(callBack, RecyclerStatusMessageParser);
}
public getParser(): RecyclerStatusMessageParser
{
return this.parser as RecyclerStatusMessageParser;
}
}

View File

@ -0,0 +1,2 @@
export * from './RecyclerFinishedMessageEvent';
export * from './RecyclerStatusMessageEvent';

View File

@ -43,6 +43,7 @@ export * from './perk/common';
export * from './pet';
export * from './poll';
export * from './quest';
export * from './recycler';
export * from './room';
export * from './room/access';
export * from './room/access/doorbell';

View File

@ -0,0 +1,34 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class RecyclerFinishedMessageParser implements IMessageParser
{
private _recyclerFinishedStatus: number;
private _prizeId: number;
public flush(): boolean
{
this._recyclerFinishedStatus = -1;
this._prizeId = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._recyclerFinishedStatus = wrapper.readInt();
this._prizeId = wrapper.readInt();
return true;
}
public get recyclerFinishedStatus(): number
{
return this._recyclerFinishedStatus;
}
public get prizeId(): number
{
return this._prizeId;
}
}

View File

@ -0,0 +1,34 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class RecyclerStatusMessageParser implements IMessageParser
{
private _recyclerStatus: number;
private _recyclerTimeoutSeconds: number;
public flush(): boolean
{
this._recyclerStatus = -1;
this._recyclerTimeoutSeconds = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._recyclerStatus = wrapper.readInt();
this._recyclerTimeoutSeconds = wrapper.readInt();
return true;
}
public get recyclerStatus(): number
{
return this._recyclerStatus;
}
public get recyclerTimeoutSeconds(): number
{
return this._recyclerTimeoutSeconds;
}
}

View File

@ -0,0 +1,2 @@
export * from './RecyclerFinishedMessageParser';
export * from './RecyclerStatusMessageParser';