#28 - SimpleAlertMessageEvent added

This commit is contained in:
oobjectt 2022-12-24 20:35:04 +01:00
parent 26741b78a7
commit 16c42c4518
6 changed files with 58 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -117,6 +117,7 @@ export class IncomingHeader
public static CONVERTED_ROOM_ID = 1331;
public static GUEST_ROOM_SEARCH_RESULT = 52;
public static NOTIFICATION_LIST = 1992;
public static NOTIFICATION_SIMPLE_ALERT = 5100;
public static PET_FIGURE_UPDATE = 1924;
public static PET_INFO = 2901;
public static PET_TRAINING_PANEL = 1164;

View File

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

View File

@ -9,4 +9,5 @@ export * from './MOTDNotificationEvent';
export * from './NotificationDialogMessageEvent';
export * from './PetLevelNotificationEvent';
export * from './PetPlacingErrorEvent';
export * from './SimpleAlertMessageEvent';
export * from './UnseenItemsEvent';

View File

@ -0,0 +1,37 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class SimpleAlertMessageParser implements IMessageParser
{
private _alertMessage: string;
private _titleMessage: string;
public flush(): boolean
{
this._alertMessage = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._alertMessage = wrapper.readString();
if(wrapper.bytesAvailable)
{
this._titleMessage = wrapper.readString();
}
return true;
}
public get alertMessage(): string
{
return this._alertMessage;
}
public get titleMessage(): string
{
return this._titleMessage;
}
}

View File

@ -10,4 +10,5 @@ export * from './MOTDNotificationParser';
export * from './NotificationDialogMessageParser';
export * from './PetLevelNotificationParser';
export * from './PetPlacingErrorEventParser';
export * from './SimpleAlertMessageParser';
export * from './UnseenItemsParser';