From 51d91121af70a61cabfc861c37a3a77ba2c57c11 Mon Sep 17 00:00:00 2001 From: dank074 Date: Wed, 20 Oct 2021 19:25:57 -0500 Subject: [PATCH] finished moderation packets --- src/nitro/communication/NitroMessages.ts | 12 ++++--- .../messages/incoming/IncomingHeader.ts | 6 +++- .../moderation/IssueDeletedMessageEvent.ts | 16 +++++++++ .../moderation/IssueInfoMessageEvent.ts | 16 +++++++++ .../moderation/IssuePickFailedMessageEvent.ts | 16 +++++++++ .../ModeratorActionResultMessageEvent.ts | 16 +++++++++ ...InfoEvent.ts => ModeratorUserInfoEvent.ts} | 2 +- ...oomChatlogEvent.ts => RoomChatlogEvent.ts} | 2 +- .../incoming/moderation/UserChatlogData.ts | 35 +++++++++++++++++++ ...serChatlogEvent.ts => UserChatlogEvent.ts} | 2 +- .../messages/incoming/moderation/index.ts | 11 ++++-- .../moderation/UserChatlogMessageParser.ts | 33 ++++------------- 12 files changed, 129 insertions(+), 38 deletions(-) create mode 100644 src/nitro/communication/messages/incoming/moderation/IssueDeletedMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/moderation/IssueInfoMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/moderation/IssuePickFailedMessageEvent.ts create mode 100644 src/nitro/communication/messages/incoming/moderation/ModeratorActionResultMessageEvent.ts rename src/nitro/communication/messages/incoming/moderation/{ModtoolUserInfoEvent.ts => ModeratorUserInfoEvent.ts} (86%) rename src/nitro/communication/messages/incoming/moderation/{ModtoolRoomChatlogEvent.ts => RoomChatlogEvent.ts} (85%) create mode 100644 src/nitro/communication/messages/incoming/moderation/UserChatlogData.ts rename src/nitro/communication/messages/incoming/moderation/{ModtoolUserChatlogEvent.ts => UserChatlogEvent.ts} (85%) diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 36d4570c..ba8949e3 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -90,7 +90,7 @@ import { MarketplaceItemStatsEvent } from './messages/incoming/marketplace/Marke import { MarketplaceMakeOfferResult } from './messages/incoming/marketplace/MarketplaceMakeOfferResult'; import { MarketPlaceOffersEvent } from './messages/incoming/marketplace/MarketplaceOffersEvent'; import { MarketplaceOwnOffersEvent } from './messages/incoming/marketplace/MarketplaceOwnOffersEvent'; -import { CfhChatlogEvent, ModeratorInitMessageEvent, ModeratorRoomInfoEvent, ModtoolRoomChatlogEvent, ModtoolUserChatlogEvent, ModtoolUserInfoEvent, RoomVisitsEvent, UserBannedMessageEvent } from './messages/incoming/moderation'; +import { CfhChatlogEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, ModeratorActionResultMessageEvent, ModeratorInitMessageEvent, ModeratorRoomInfoEvent, ModeratorUserInfoEvent, RoomChatlogEvent, RoomVisitsEvent, UserBannedMessageEvent, UserChatlogEvent } from './messages/incoming/moderation'; import { ModeratorCautionEvent } from './messages/incoming/moderation/ModeratorCautionEvent'; import { NavigatorCategoriesEvent } from './messages/incoming/navigator/NavigatorCategoriesEvent'; import { NavigatorCollapsedEvent } from './messages/incoming/navigator/NavigatorCollapsedEvent'; @@ -659,12 +659,16 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.USER_BANNED, UserBannedMessageEvent); this._events.set(IncomingHeader.MODERATION_CAUTION, ModeratorCautionEvent); this._events.set(IncomingHeader.MODTOOL_ROOM_INFO, ModeratorRoomInfoEvent); - this._events.set(IncomingHeader.MODTOOL_USER_CHATLOG, ModtoolUserChatlogEvent); - this._events.set(IncomingHeader.MODTOOL_ROOM_CHATLOG, ModtoolRoomChatlogEvent); - this._events.set(IncomingHeader.MODERATION_USER_INFO, ModtoolUserInfoEvent); + this._events.set(IncomingHeader.MODTOOL_USER_CHATLOG, UserChatlogEvent); + this._events.set(IncomingHeader.MODTOOL_ROOM_CHATLOG, RoomChatlogEvent); + this._events.set(IncomingHeader.MODERATION_USER_INFO, ModeratorUserInfoEvent); this._events.set(IncomingHeader.MODERATION_TOOL, ModeratorInitMessageEvent); this._events.set(IncomingHeader.MODTOOL_VISITED_ROOMS_USER, RoomVisitsEvent); this._events.set(IncomingHeader.CFH_CHATLOG, CfhChatlogEvent); + this._events.set(IncomingHeader.ISSUE_DELETED, IssueDeletedMessageEvent); + this._events.set(IncomingHeader.ISSUE_INFO, IssueInfoMessageEvent); + this._events.set(IncomingHeader.ISSUE_PICK_FAILED, IssuePickFailedMessageEvent); + this._events.set(IncomingHeader.MODERATOR_ACTION_RESULT, ModeratorActionResultMessageEvent); // MYSTERY BOX this._events.set(IncomingHeader.MYSTERY_BOX_KEYS, MysteryBoxKeysEvent); diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 0193214d..1e2f36ea 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -215,6 +215,11 @@ export class IncomingHeader public static MODTOOL_ROOM_INFO = 1333; public static MODTOOL_USER_CHATLOG = 3377; public static MODTOOL_ROOM_CHATLOG = 3434; + public static MODTOOL_VISITED_ROOMS_USER = 1752; + public static MODERATOR_ACTION_RESULT = 2335; + public static ISSUE_DELETED = 3192; + public static ISSUE_INFO = 3609; + public static ISSUE_PICK_FAILED = 3150; public static CFH_CHATLOG = 607; public static LOVELOCK_FURNI_START = 3753; public static LOVELOCK_FURNI_FRIEND_COMFIRMED = 382; @@ -230,7 +235,6 @@ export class IncomingHeader public static CLUB_GIFT_INFO = 619; public static REDEEM_VOUCHER_ERROR = 714; public static REDEEM_VOUCHER_OK = 3336; - public static MODTOOL_VISITED_ROOMS_USER = 1752; public static IN_CLIENT_LINK = 2023; public static BOT_COMMAND_CONFIGURATION = 1618; public static HAND_ITEM_RECEIVED = 354; diff --git a/src/nitro/communication/messages/incoming/moderation/IssueDeletedMessageEvent.ts b/src/nitro/communication/messages/incoming/moderation/IssueDeletedMessageEvent.ts new file mode 100644 index 00000000..a284b936 --- /dev/null +++ b/src/nitro/communication/messages/incoming/moderation/IssueDeletedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { IssueDeletedMessageParser } from '../../parser/moderation/IssueDeletedMessageParser'; + +export class IssueDeletedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IssueDeletedMessageParser); + } + + public getParser(): IssueDeletedMessageParser + { + return this.parser as IssueDeletedMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/moderation/IssueInfoMessageEvent.ts b/src/nitro/communication/messages/incoming/moderation/IssueInfoMessageEvent.ts new file mode 100644 index 00000000..c0333171 --- /dev/null +++ b/src/nitro/communication/messages/incoming/moderation/IssueInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { IssueInfoMessageParser } from '../../parser/moderation/IssueInfoMessageParser'; + +export class IssueInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IssueInfoMessageParser); + } + + public getParser(): IssueInfoMessageParser + { + return this.parser as IssueInfoMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/moderation/IssuePickFailedMessageEvent.ts b/src/nitro/communication/messages/incoming/moderation/IssuePickFailedMessageEvent.ts new file mode 100644 index 00000000..23dfcc91 --- /dev/null +++ b/src/nitro/communication/messages/incoming/moderation/IssuePickFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { IssuePickFailedMessageParser } from '../../parser/moderation/IssuePickFailedMessageParser'; + +export class IssuePickFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IssuePickFailedMessageParser); + } + + public getParser(): IssuePickFailedMessageParser + { + return this.parser as IssuePickFailedMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/moderation/ModeratorActionResultMessageEvent.ts b/src/nitro/communication/messages/incoming/moderation/ModeratorActionResultMessageEvent.ts new file mode 100644 index 00000000..67aecfad --- /dev/null +++ b/src/nitro/communication/messages/incoming/moderation/ModeratorActionResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { ModeratorActionResultMessageParser } from '../../parser/moderation/ModeratorActionResultMessageParser'; + +export class ModeratorActionResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModeratorActionResultMessageParser); + } + + public getParser(): ModeratorActionResultMessageParser + { + return this.parser as ModeratorActionResultMessageParser; + } +} diff --git a/src/nitro/communication/messages/incoming/moderation/ModtoolUserInfoEvent.ts b/src/nitro/communication/messages/incoming/moderation/ModeratorUserInfoEvent.ts similarity index 86% rename from src/nitro/communication/messages/incoming/moderation/ModtoolUserInfoEvent.ts rename to src/nitro/communication/messages/incoming/moderation/ModeratorUserInfoEvent.ts index 66948248..2da99427 100644 --- a/src/nitro/communication/messages/incoming/moderation/ModtoolUserInfoEvent.ts +++ b/src/nitro/communication/messages/incoming/moderation/ModeratorUserInfoEvent.ts @@ -2,7 +2,7 @@ import { IMessageEvent } from '../../../../../core/communication/messages/IMessa import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { ModeratorUserInfoMessageParser } from '../../parser/moderation/ModeratorUserInfoMessageParser'; -export class ModtoolUserInfoEvent extends MessageEvent implements IMessageEvent +export class ModeratorUserInfoEvent extends MessageEvent implements IMessageEvent { constructor(callBack: Function) { diff --git a/src/nitro/communication/messages/incoming/moderation/ModtoolRoomChatlogEvent.ts b/src/nitro/communication/messages/incoming/moderation/RoomChatlogEvent.ts similarity index 85% rename from src/nitro/communication/messages/incoming/moderation/ModtoolRoomChatlogEvent.ts rename to src/nitro/communication/messages/incoming/moderation/RoomChatlogEvent.ts index 905ff1b2..791a2b30 100644 --- a/src/nitro/communication/messages/incoming/moderation/ModtoolRoomChatlogEvent.ts +++ b/src/nitro/communication/messages/incoming/moderation/RoomChatlogEvent.ts @@ -2,7 +2,7 @@ import { IMessageEvent } from '../../../../../core/communication/messages/IMessa import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { RoomChatlogMessageParser } from '../../parser/moderation/RoomChatlogMessageParser'; -export class ModtoolRoomChatlogEvent extends MessageEvent implements IMessageEvent +export class RoomChatlogEvent extends MessageEvent implements IMessageEvent { constructor(callBack: Function) { diff --git a/src/nitro/communication/messages/incoming/moderation/UserChatlogData.ts b/src/nitro/communication/messages/incoming/moderation/UserChatlogData.ts new file mode 100644 index 00000000..4092c712 --- /dev/null +++ b/src/nitro/communication/messages/incoming/moderation/UserChatlogData.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper } from '../../../../..'; +import { ChatRecordData } from './ChatRecordData'; + +export class UserChatlogData +{ + private _userId: number; + private _username: string; + private _roomChatlogs: ChatRecordData[] = []; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._username = wrapper.readString(); + const size = wrapper.readInt(); + for(let i = 0; i < size; i++) + { + this._roomChatlogs.push(new ChatRecordData(wrapper)); + } + } + + public get userId(): number + { + return this._userId; + } + + public get username(): string + { + return this._username; + } + + public get roomChatlogs(): ChatRecordData[] + { + return this._roomChatlogs; + } +} diff --git a/src/nitro/communication/messages/incoming/moderation/ModtoolUserChatlogEvent.ts b/src/nitro/communication/messages/incoming/moderation/UserChatlogEvent.ts similarity index 85% rename from src/nitro/communication/messages/incoming/moderation/ModtoolUserChatlogEvent.ts rename to src/nitro/communication/messages/incoming/moderation/UserChatlogEvent.ts index 6189b612..2413b2e7 100644 --- a/src/nitro/communication/messages/incoming/moderation/ModtoolUserChatlogEvent.ts +++ b/src/nitro/communication/messages/incoming/moderation/UserChatlogEvent.ts @@ -2,7 +2,7 @@ import { IMessageEvent } from '../../../../../core/communication/messages/IMessa import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { UserChatlogMessageParser } from '../../parser/moderation/UserChatlogMessageParser'; -export class ModtoolUserChatlogEvent extends MessageEvent implements IMessageEvent +export class UserChatlogEvent extends MessageEvent implements IMessageEvent { constructor(callBack: Function) { diff --git a/src/nitro/communication/messages/incoming/moderation/index.ts b/src/nitro/communication/messages/incoming/moderation/index.ts index d98947c4..35c0383b 100644 --- a/src/nitro/communication/messages/incoming/moderation/index.ts +++ b/src/nitro/communication/messages/incoming/moderation/index.ts @@ -3,16 +3,21 @@ export * from './CfhChatlogEvent'; export * from './ChatlineData'; export * from './ChatRecordData'; export * from './INamed'; +export * from './IssueDeletedMessageEvent'; +export * from './IssueInfoMessageEvent'; +export * from './IssuePickFailedMessageEvent'; +export * from './ModeratorActionResultMessageEvent'; export * from './ModeratorCautionEvent'; export * from './ModeratorInitMessageEvent'; export * from './ModeratorRoomInfoEvent'; export * from './ModeratorUserInfoData'; -export * from './ModtoolRoomChatlogEvent'; -export * from './ModtoolUserChatlogEvent'; -export * from './ModtoolUserInfoEvent'; +export * from './ModeratorUserInfoEvent'; +export * from './RoomChatlogEvent'; export * from './RoomData'; export * from './RoomModerationData'; export * from './RoomVisitData'; export * from './RoomVisitsData'; export * from './RoomVisitsEvent'; export * from './UserBannedMessageEvent'; +export * from './UserChatlogData'; +export * from './UserChatlogEvent'; diff --git a/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts b/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts index a1251d89..0b4515d0 100644 --- a/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts +++ b/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts @@ -1,17 +1,13 @@ import { IMessageDataWrapper, IMessageParser } from '../../../../../core'; -import { ChatRecordData } from '../../incoming/moderation/ChatRecordData'; +import { UserChatlogData } from '../../incoming/moderation/UserChatlogData'; export class UserChatlogMessageParser implements IMessageParser { - private _userId: number; - private _username: string; - private _roomVisits: ChatRecordData[] = []; + private _data:UserChatlogData; public flush(): boolean { - this._userId = null; - this._username = null; - this._roomVisits = []; + this._data = null; return true; } @@ -20,30 +16,13 @@ export class UserChatlogMessageParser implements IMessageParser { if(!wrapper) return false; - this._userId = wrapper.readInt(); - this._username = wrapper.readString(); - const size = wrapper.readInt(); - for(let i = 0; i < size; i++) - { - this._roomVisits.push(new ChatRecordData(wrapper)); - } + this._data = new UserChatlogData(wrapper); return true; } - public get userId(): number + public get data():UserChatlogData { - return this._userId; + return this._data; } - - public get username(): string - { - return this._username; - } - - public get roomVisits(): ChatRecordData[] - { - return this._roomVisits; - } - }