Merge branch 'notifications-simple-alert' of https://github.com/oobjectt/nitro-renderer into oobjectt-notifications-simple-alert

This commit is contained in:
dank074 2022-12-26 01:13:37 -06:00
commit 865b01a7a2
6 changed files with 58 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -122,6 +122,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

@ -10,4 +10,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

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