From 3184d9a117fee8e6d9e9bda454267de8f386dcd6 Mon Sep 17 00:00:00 2001 From: Dank074 Date: Fri, 11 Jun 2021 19:44:40 -0500 Subject: [PATCH] renamed ChangeUserNameResultMessageEvent --- src/nitro/communication/NitroMessages.ts | 4 +-- .../incoming/avatar/ChangeNameUpdateEvent.ts | 25 ------------------- .../ChangeUserNameResultMessageEvent.ts | 25 +++++++++++++++++++ .../messages/incoming/avatar/index.ts | 2 +- src/nitro/session/SessionDataManager.ts | 8 +++--- 5 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 src/nitro/communication/messages/incoming/avatar/ChangeNameUpdateEvent.ts create mode 100644 src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent.ts diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 45c40f1b..2f37ccb2 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -1,6 +1,6 @@ import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration'; import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent'; -import { ChangeNameUpdateEvent } from './messages/incoming/avatar/ChangeNameUpdateEvent'; +import { ChangeUserNameResultMessageEvent } from 'nitro-renderer/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent'; import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent'; import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent'; import { CatalogGiftConfigurationEvent } from './messages/incoming/catalog/CatalogGiftConfigurationEvent'; @@ -423,7 +423,7 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.GENERIC_ERROR, GenericErrorEvent); // AVATAR - this._events.set(IncomingHeader.USER_CHANGE_NAME, ChangeNameUpdateEvent); + this._events.set(IncomingHeader.USER_CHANGE_NAME, ChangeUserNameResultMessageEvent); // CATALOG this._events.set(IncomingHeader.CATALOG_CLUB, CatalogClubEvent); diff --git a/src/nitro/communication/messages/incoming/avatar/ChangeNameUpdateEvent.ts b/src/nitro/communication/messages/incoming/avatar/ChangeNameUpdateEvent.ts deleted file mode 100644 index e31aaa32..00000000 --- a/src/nitro/communication/messages/incoming/avatar/ChangeNameUpdateEvent.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; -import { ChangeNameUpdateParser } from '../../parser/avatar/ChangeNameUpdateParser'; - -export class ChangeNameUpdateEvent extends MessageEvent implements IMessageEvent -{ - public static _Str_5797: number = 0; - public static _Str_7005: number = 1; - public static _Str_7389: number = 2; - public static _Str_7137: number = 3; - public static _Str_7836: number = 4; - public static _Str_7721: number = 5; - public static _Str_8620: number = 6; - public static _Str_9429: number = 7; - - constructor(callBack: Function) - { - super(callBack, ChangeNameUpdateParser); - } - - public getParser(): ChangeNameUpdateParser - { - return this.parser as ChangeNameUpdateParser; - } -} \ No newline at end of file diff --git a/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent.ts b/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent.ts new file mode 100644 index 00000000..f0058005 --- /dev/null +++ b/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent.ts @@ -0,0 +1,25 @@ +import { IMessageEvent } from 'nitro-renderer/src/core/communication/messages/IMessageEvent'; +import { MessageEvent } from 'nitro-renderer/src/core/communication/messages/MessageEvent'; +import { ChangeNameUpdateParser } from 'nitro-renderer/src/nitro/communication/messages/parser/avatar/ChangeNameUpdateParser'; + +export class ChangeUserNameResultMessageEvent extends MessageEvent implements IMessageEvent +{ + public static NAME_OK: number = 0; + public static ERROR_NAME_REQUIRED: number = 1; + public static ERROR_NAME_TOO_SHORT: number = 2; + public static ERROR_NAME_TOO_LONG: number = 3; + public static ERROR_NAME_NOT_VALID: number = 4; + public static ERROR_NAME_IN_USE: number = 5; + public static ERROR_NAME_CHANGE_NOT_ALLOWED: number = 6; + public static ERROR_MERGE_HOTEL_DOWN: number = 7; + + constructor(callBack: Function) + { + super(callBack, ChangeNameUpdateParser); + } + + public getParser(): ChangeNameUpdateParser + { + return this.parser as ChangeNameUpdateParser; + } +} diff --git a/src/nitro/communication/messages/incoming/avatar/index.ts b/src/nitro/communication/messages/incoming/avatar/index.ts index ac009e5c..53faf063 100644 --- a/src/nitro/communication/messages/incoming/avatar/index.ts +++ b/src/nitro/communication/messages/incoming/avatar/index.ts @@ -1 +1 @@ -export * from './ChangeNameUpdateEvent'; +export * from './ChangeUserNameResultMessageEvent'; diff --git a/src/nitro/session/SessionDataManager.ts b/src/nitro/session/SessionDataManager.ts index 1dbb20f5..9a604c44 100644 --- a/src/nitro/session/SessionDataManager.ts +++ b/src/nitro/session/SessionDataManager.ts @@ -4,7 +4,7 @@ import { IMessageComposer } from '../../core/communication/messages/IMessageComp import { NitroEvent } from '../../core/events/NitroEvent'; import { INitroCommunicationManager } from '../communication/INitroCommunicationManager'; import { AvailabilityStatusMessageEvent } from '../communication/messages/incoming/availability/AvailabilityStatusMessageEvent'; -import { ChangeNameUpdateEvent } from '../communication/messages/incoming/avatar/ChangeNameUpdateEvent'; +import { ChangeUserNameResultMessageEvent } from '../communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent'; import { RoomModelNameEvent } from '../communication/messages/incoming/room/mapping/RoomModelNameEvent'; import { UserPermissionsEvent } from '../communication/messages/incoming/user/access/UserPermissionsEvent'; import { UserFigureEvent } from '../communication/messages/incoming/user/data/UserFigureEvent'; @@ -123,7 +123,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._communication.registerMessageEvent(new UserInfoEvent(this.onUserInfoEvent.bind(this))); this._communication.registerMessageEvent(new UserPermissionsEvent(this.onUserPermissionsEvent.bind(this))); this._communication.registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this))); - this._communication.registerMessageEvent(new ChangeNameUpdateEvent(this.onChangeNameUpdateEvent.bind(this))); + this._communication.registerMessageEvent(new ChangeUserNameResultMessageEvent(this.onChangeNameUpdateEvent.bind(this))); this._communication.registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this))); this._communication.registerMessageEvent(new RoomModelNameEvent(this.onRoomModelNameEvent.bind(this))); this._communication.registerMessageEvent(new InClientLinkEvent(this.onInClientLinkEvent.bind(this))); @@ -291,7 +291,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana this._isAuthenticHabbo = parser.isAuthenticUser; } - private onChangeNameUpdateEvent(event: ChangeNameUpdateEvent): void + private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void { if(!event || !event.connection) return; @@ -299,7 +299,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana if(!parser) return; - if(parser.resultCode !== ChangeNameUpdateEvent._Str_5797) return; + if(parser.resultCode !== ChangeUserNameResultMessageEvent.NAME_OK) return; this._canChangeName = false;