From f442456e167895541e20350731666dc12cff96b3 Mon Sep 17 00:00:00 2001 From: MyNameIsBatman Date: Sat, 27 Nov 2021 00:04:39 -0300 Subject: [PATCH] Updates --- .../help/GuideReportingStatusMessageEvent.ts | 16 ++++++++++++++++ .../parser/perk/PerkAllowancesMessageParser.ts | 16 ++++++++++++++++ .../messages/parser/perk/common/PerkEnum.ts | 15 +++++++++++++++ .../messages/parser/perk/common/index.ts | 2 ++ .../communication/messages/parser/perk/index.ts | 1 + 5 files changed, 50 insertions(+) create mode 100644 src/nitro/communication/messages/incoming/help/GuideReportingStatusMessageEvent.ts create mode 100644 src/nitro/communication/messages/parser/perk/common/PerkEnum.ts create mode 100644 src/nitro/communication/messages/parser/perk/common/index.ts diff --git a/src/nitro/communication/messages/incoming/help/GuideReportingStatusMessageEvent.ts b/src/nitro/communication/messages/incoming/help/GuideReportingStatusMessageEvent.ts new file mode 100644 index 00000000..72a89fd3 --- /dev/null +++ b/src/nitro/communication/messages/incoming/help/GuideReportingStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { GuideReportingStatusMessageParser } from './../../parser/help/GuideReportingStatusMessageParser'; + +export class GuideReportingStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideReportingStatusMessageParser); + } + + public getParser(): GuideReportingStatusMessageParser + { + return this.parser as GuideReportingStatusMessageParser; + } +} diff --git a/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts b/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts index 916b6201..b1b41cd8 100644 --- a/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts +++ b/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts @@ -29,6 +29,22 @@ export class PerkAllowancesMessageParser implements IMessageParser return true; } + public isAllowed(perkCode: string): boolean + { + let allowed = false; + + for(const perk of this._perks) + { + if(perk.code === perkCode) + { + allowed = perk.isAllowed; + break; + } + } + + return allowed; + } + public get perks(): PerkData[] { return this._perks; diff --git a/src/nitro/communication/messages/parser/perk/common/PerkEnum.ts b/src/nitro/communication/messages/parser/perk/common/PerkEnum.ts new file mode 100644 index 00000000..454eee9e --- /dev/null +++ b/src/nitro/communication/messages/parser/perk/common/PerkEnum.ts @@ -0,0 +1,15 @@ +export class PerkEnum +{ + public static USE_GUIDE_TOOL: string = 'USE_GUIDE_TOOL'; + public static GIVE_GUIDE_TOUR: string = 'GIVE_GUIDE_TOUR'; + public static JUDGE_CHAT_REVIEWS: string = 'JUDGE_CHAT_REVIEWS'; + public static VOTE_IN_COMPETITIONS: string = 'VOTE_IN_COMPETITIONS'; + public static CALL_ON_HELPERS: string = 'CALL_ON_HELPERS'; + public static CITIZEN: string = 'CITIZEN'; + public static TRADE: string = 'TRADE'; + public static HEIGHTMAP_EDITOR_BETA: string = 'HEIGHTMAP_EDITOR_BETA'; + public static BUILDER_AT_WORK: string = 'BUILDER_AT_WORK'; + public static NAVIGATOR_ROOM_THUMBNAIL_CAMERA: string = 'NAVIGATOR_ROOM_THUMBNAIL_CAMERA'; + public static CAMERA: string = 'CAMERA'; + public static MOUSE_ZOOM: string = 'MOUSE_ZOOM'; +} diff --git a/src/nitro/communication/messages/parser/perk/common/index.ts b/src/nitro/communication/messages/parser/perk/common/index.ts new file mode 100644 index 00000000..a6170730 --- /dev/null +++ b/src/nitro/communication/messages/parser/perk/common/index.ts @@ -0,0 +1,2 @@ +export * from './PerkData'; +export * from './PerkEnum'; diff --git a/src/nitro/communication/messages/parser/perk/index.ts b/src/nitro/communication/messages/parser/perk/index.ts index a513d8fe..598feef8 100644 --- a/src/nitro/communication/messages/parser/perk/index.ts +++ b/src/nitro/communication/messages/parser/perk/index.ts @@ -1 +1,2 @@ +export * from './common'; export * from './PerkAllowancesMessageParser';