Connection Error Event (#25)

Co-authored-by: Snaiker <steveraki2000@gmail.com>
This commit is contained in:
Snaiker 2022-12-26 06:27:47 +00:00 committed by GitHub
parent 26741b78a7
commit 31fa866243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -414,4 +414,5 @@ export class IncomingHeader
public static SHOW_ENFORCE_ROOM_CATEGORY = 3896; public static SHOW_ENFORCE_ROOM_CATEGORY = 3896;
public static CUSTOM_USER_NOTIFICATION = 909; public static CUSTOM_USER_NOTIFICATION = 909;
public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575; public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575;
public static CONNECTION_ERROR = 1004;
} }

View File

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

View File

@ -2,6 +2,7 @@ export * from './AchievementNotificationMessageEvent';
export * from './ActivityPointNotificationMessageEvent'; export * from './ActivityPointNotificationMessageEvent';
export * from './BotErrorEvent'; export * from './BotErrorEvent';
export * from './ClubGiftNotificationEvent'; export * from './ClubGiftNotificationEvent';
export * from './ConnectionErrorEvent';
export * from './HabboBroadcastMessageEvent'; export * from './HabboBroadcastMessageEvent';
export * from './HotelWillShutdownEvent'; export * from './HotelWillShutdownEvent';
export * from './InfoFeedEnableMessageEvent'; export * from './InfoFeedEnableMessageEvent';

View File

@ -0,0 +1,43 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../api';
export class ConnectionErrorMessageParser implements IMessageParser
{
private _errorCode: number;
private _messageId: number;
private _timestamp: string;
public flush(): boolean
{
this._errorCode = 0;
this._messageId = 0;
this._timestamp = null;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._messageId = wrapper.readInt();
this._errorCode = wrapper.readInt();
this._timestamp = wrapper.readString();
return true;
}
public get errorCode(): number
{
return this._errorCode;
}
public get messageId(): number
{
return this._messageId;
}
public get timestamp(): string
{
return this._timestamp;
}
}

View File

@ -3,6 +3,7 @@ export * from './AchievementNotificationMessageParser';
export * from './ActivityPointNotificationParser'; export * from './ActivityPointNotificationParser';
export * from './BotErrorEventParser'; export * from './BotErrorEventParser';
export * from './ClubGiftNotificationParser'; export * from './ClubGiftNotificationParser';
export * from './ConnectionErrorMessageParser';
export * from './HabboBroadcastMessageParser'; export * from './HabboBroadcastMessageParser';
export * from './HotelWillShutdownParser'; export * from './HotelWillShutdownParser';
export * from './InfoFeedEnableMessageParser'; export * from './InfoFeedEnableMessageParser';