From b7a10a578e0d741539c9dae93d996cf0107a8951 Mon Sep 17 00:00:00 2001 From: Dank074 Date: Wed, 23 Jun 2021 20:07:18 -0500 Subject: [PATCH] cleaned marketplace parsers --- src/nitro/communication/NitroMessages.ts | 4 +-- .../MarketplaceAfterOrderStatusEvent.ts | 16 ------------ .../MarketplaceBuyOfferResultEvent.ts | 16 ++++++++++++ .../incoming/catalog/marketplace/index.ts | 2 +- .../marketplace/MarketplaceSellItemEvent.ts | 8 +++--- .../room/access/RoomEnterErrorEvent.ts | 10 ++++---- ....ts => MarketplaceBuyOfferResultParser.ts} | 25 +++++++++---------- .../parser/catalog/marketplace/index.ts | 2 +- .../achievements/AchievementsParser.ts | 10 ++++---- ...=> MarketplaceCanMakeOfferResultParser.ts} | 16 ++++++------ .../parser/inventory/marketplace/index.ts | 2 +- ...rParser.ts => CantConnectMessageParser.ts} | 12 ++++----- .../messages/parser/room/access/index.ts | 2 +- 13 files changed, 61 insertions(+), 64 deletions(-) delete mode 100644 src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts create mode 100644 src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceBuyOfferResultEvent.ts rename src/nitro/communication/messages/parser/catalog/marketplace/{MarketplaceAfterOrderParser.ts => MarketplaceBuyOfferResultParser.ts} (54%) rename src/nitro/communication/messages/parser/inventory/marketplace/{MarketplaceSellItemParser.ts => MarketplaceCanMakeOfferResultParser.ts} (65%) rename src/nitro/communication/messages/parser/room/access/{RoomEnterErrorParser.ts => CantConnectMessageParser.ts} (74%) diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 0b2677f2..dbcacc86 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -17,7 +17,7 @@ import { CatalogRedeemVoucherOkEvent } from './messages/incoming/catalog/Catalog import { CatalogSearchEvent } from './messages/incoming/catalog/CatalogSearchEvent'; import { CatalogSoldOutEvent } from './messages/incoming/catalog/CatalogSoldOutEvent'; import { CatalogUpdatedEvent } from './messages/incoming/catalog/CatalogUpdatedEvent'; -import { MarketplaceAfterOrderStatusEvent } from './messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent'; +import { MarketplaceBuyOfferResultEvent } from './messages/incoming/catalog/marketplace/MarketplaceBuyOfferResultEvent'; import { MarketplaceCancelItemEvent } from './messages/incoming/catalog/marketplace/MarketplaceCancelItemEvent'; import { MarketplaceOffersReceivedEvent } from './messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent'; import { MarketplaceOwnItemsEvent } from './messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent'; @@ -740,7 +740,7 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.MARKETPLACE_CANCEL_SALE, MarketplaceCancelItemEvent); this._events.set(IncomingHeader.MARKETPLACE_ITEM_POSTED, MarketplaceItemPostedEvent); this._events.set(IncomingHeader.MARKETPLACE_ITEMS_SEARCHED, MarketplaceOffersReceivedEvent); - this._events.set(IncomingHeader.MARKETPLACE_AFTER_ORDER_STATUS, MarketplaceAfterOrderStatusEvent); + this._events.set(IncomingHeader.MARKETPLACE_AFTER_ORDER_STATUS, MarketplaceBuyOfferResultEvent); } private registerComposers(): void diff --git a/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts deleted file mode 100644 index 4317e90c..00000000 --- a/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; -import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { MarketplaceAfterOrderParser } from '../../../parser/catalog/marketplace/MarketplaceAfterOrderParser'; - -export class MarketplaceAfterOrderStatusEvent extends MessageEvent implements IMessageEvent -{ - constructor(callBack: Function) - { - super(callBack, MarketplaceAfterOrderParser); - } - - public getParser(): MarketplaceAfterOrderParser - { - return this.parser as MarketplaceAfterOrderParser; - } -} diff --git a/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceBuyOfferResultEvent.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceBuyOfferResultEvent.ts new file mode 100644 index 00000000..1d3531be --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceBuyOfferResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceBuyOfferResultParser } from '../../../parser/catalog/marketplace/MarketplaceBuyOfferResultParser'; + +export class MarketplaceBuyOfferResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceBuyOfferResultParser); + } + + public getParser(): MarketplaceBuyOfferResultParser + { + return this.parser as MarketplaceBuyOfferResultParser; + } +} diff --git a/src/nitro/communication/messages/incoming/catalog/marketplace/index.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/index.ts index 47b101da..f8ebd14b 100644 --- a/src/nitro/communication/messages/incoming/catalog/marketplace/index.ts +++ b/src/nitro/communication/messages/incoming/catalog/marketplace/index.ts @@ -1,4 +1,4 @@ -export * from './MarketplaceAfterOrderStatusEvent'; +export * from './MarketplaceBuyOfferResultEvent'; export * from './MarketplaceCancelItemEvent'; export * from './MarketplaceOffersReceivedEvent'; export * from './MarketplaceOwnItemsEvent'; diff --git a/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts b/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts index 3c56c2ce..7c1d5a8f 100644 --- a/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts +++ b/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts @@ -1,16 +1,16 @@ import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { MarketplaceSellItemParser } from '../../../parser/inventory/marketplace/MarketplaceSellItemParser'; +import { MarketplaceCanMakeOfferResultParser } from '../../../parser/inventory/marketplace/MarketplaceCanMakeOfferResultParser'; export class MarketplaceSellItemEvent extends MessageEvent implements IMessageEvent { constructor(callBack: Function) { - super(callBack, MarketplaceSellItemParser); + super(callBack, MarketplaceCanMakeOfferResultParser); } - public getParser(): MarketplaceSellItemParser + public getParser(): MarketplaceCanMakeOfferResultParser { - return this.parser as MarketplaceSellItemParser; + return this.parser as MarketplaceCanMakeOfferResultParser; } } diff --git a/src/nitro/communication/messages/incoming/room/access/RoomEnterErrorEvent.ts b/src/nitro/communication/messages/incoming/room/access/RoomEnterErrorEvent.ts index d959a351..7da823f2 100644 --- a/src/nitro/communication/messages/incoming/room/access/RoomEnterErrorEvent.ts +++ b/src/nitro/communication/messages/incoming/room/access/RoomEnterErrorEvent.ts @@ -1,16 +1,16 @@ import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; -import { RoomEnterErrorParser } from '../../../parser/room/access/RoomEnterErrorParser'; +import { CantConnectMessageParser } from '../../../parser/room/access/CantConnectMessageParser'; export class RoomEnterErrorEvent extends MessageEvent implements IMessageEvent { constructor(callBack: Function) { - super(callBack, RoomEnterErrorParser); + super(callBack, CantConnectMessageParser); } - public getParser(): RoomEnterErrorParser + public getParser(): CantConnectMessageParser { - return this.parser as RoomEnterErrorParser; + return this.parser as CantConnectMessageParser; } -} \ No newline at end of file +} diff --git a/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceAfterOrderParser.ts b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceBuyOfferResultParser.ts similarity index 54% rename from src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceAfterOrderParser.ts rename to src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceBuyOfferResultParser.ts index 9accf02c..29d4fe69 100644 --- a/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceAfterOrderParser.ts +++ b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceBuyOfferResultParser.ts @@ -1,13 +1,12 @@ import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; -export class MarketplaceAfterOrderParser implements IMessageParser +export class MarketplaceBuyOfferResultParser implements IMessageParser { - private _result: number; - private _offerId: number = -1; - private _Str_20780: number = -1; - private _Str_8508: number = -1; + private _newOfferId: number = -1; + private _newPrice: number = -1; + private _requestedOfferId: number = -1; public flush(): boolean { @@ -19,9 +18,9 @@ export class MarketplaceAfterOrderParser implements IMessageParser if(!wrapper) return false; this._result = wrapper.readInt(); - this._offerId = wrapper.readInt(); - this._Str_20780 = wrapper.readInt(); - this._Str_8508 = wrapper.readInt(); + this._newOfferId = wrapper.readInt(); + this._newPrice = wrapper.readInt(); + this._requestedOfferId = wrapper.readInt(); return true; } @@ -33,16 +32,16 @@ export class MarketplaceAfterOrderParser implements IMessageParser public get offerId():number { - return this._offerId; + return this._newOfferId; } - public get _Str_24839():number + public get newPrice():number { - return this._Str_20780; + return this._newPrice; } - public get _Str_7501():number + public get requestedOfferId():number { - return this._Str_8508; + return this._requestedOfferId; } } diff --git a/src/nitro/communication/messages/parser/catalog/marketplace/index.ts b/src/nitro/communication/messages/parser/catalog/marketplace/index.ts index 73c5c49e..f89a2624 100644 --- a/src/nitro/communication/messages/parser/catalog/marketplace/index.ts +++ b/src/nitro/communication/messages/parser/catalog/marketplace/index.ts @@ -1,4 +1,4 @@ -export * from './MarketplaceAfterOrderParser'; +export * from './MarketplaceBuyOfferResultParser'; export * from './MarketplaceCancelItemParser'; export * from './MarketplaceOffersReceivedParser'; export * from './MarketplaceOwnItemsParser'; diff --git a/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts b/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts index 22b98cf9..cbab053a 100644 --- a/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts +++ b/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts @@ -6,12 +6,12 @@ import { AchievementData } from '../../../incoming/inventory/achievements/Achiev export class AchievementsParser implements IMessageParser { private _achievements: AchievementData[]; - private _Str_19269: string; + private _defaultCategory: string; public flush(): boolean { this._achievements = []; - this._Str_19269 = null; + this._defaultCategory = null; return true; } @@ -31,7 +31,7 @@ export class AchievementsParser implements IMessageParser totalCount--; } - this._Str_19269 = k.readString(); + this._defaultCategory = k.readString(); return true; } @@ -41,8 +41,8 @@ export class AchievementsParser implements IMessageParser return this._achievements; } - public get _Str_16300(): string + public get defaultCategory(): string { - return this._Str_19269; + return this._defaultCategory; } } diff --git a/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceSellItemParser.ts b/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceCanMakeOfferResultParser.ts similarity index 65% rename from src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceSellItemParser.ts rename to src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceCanMakeOfferResultParser.ts index ff1248b8..2cef030c 100644 --- a/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceSellItemParser.ts +++ b/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceCanMakeOfferResultParser.ts @@ -1,14 +1,14 @@ import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; -export class MarketplaceSellItemParser implements IMessageParser +export class MarketplaceCanMakeOfferResultParser implements IMessageParser { - private _Str_19825: number = null; + private _tokenCount: number = null; private _result: number = null; public flush(): boolean { - this._Str_19825 = null; + this._tokenCount = null; this._result = null; return true; @@ -19,20 +19,18 @@ export class MarketplaceSellItemParser implements IMessageParser if(!wrapper) return false; this._result = wrapper.readInt(); - this._Str_19825 = wrapper.readInt(); + this._tokenCount = wrapper.readInt(); return true; } - public get _Str_24601(): number + public get tokenCount(): number { - return this._Str_19825; + return this._tokenCount; } - public get _Str_3278(): number + public get resultCode(): number { return this._result; } - - } diff --git a/src/nitro/communication/messages/parser/inventory/marketplace/index.ts b/src/nitro/communication/messages/parser/inventory/marketplace/index.ts index d3dbc488..320c4a40 100644 --- a/src/nitro/communication/messages/parser/inventory/marketplace/index.ts +++ b/src/nitro/communication/messages/parser/inventory/marketplace/index.ts @@ -1,2 +1,2 @@ +export * from './MarketplaceCanMakeOfferResultParser'; export * from './MarketplaceItemPostedParser'; -export * from './MarketplaceSellItemParser'; diff --git a/src/nitro/communication/messages/parser/room/access/RoomEnterErrorParser.ts b/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts similarity index 74% rename from src/nitro/communication/messages/parser/room/access/RoomEnterErrorParser.ts rename to src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts index 1bae004e..5e338468 100644 --- a/src/nitro/communication/messages/parser/room/access/RoomEnterErrorParser.ts +++ b/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts @@ -1,12 +1,12 @@ import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; -export class RoomEnterErrorParser implements IMessageParser +export class CantConnectMessageParser implements IMessageParser { - public static FULL_ERROR: number = 1; - public static _Str_19431: number = 2; - public static QUEUE_ERROR: number = 3; - public static BANNED: number = 4; + public static REASON_FULL: number = 1; + public static REASON_CLOSED: number = 2; + public static REASON_QUEUE_ERROR: number = 3; + public static REASON_BANNED: number = 4; private _reason: number; private _parameter: string; @@ -38,4 +38,4 @@ export class RoomEnterErrorParser implements IMessageParser { return this._parameter; } -} \ No newline at end of file +} diff --git a/src/nitro/communication/messages/parser/room/access/index.ts b/src/nitro/communication/messages/parser/room/access/index.ts index 9f8c0bcf..90158a7e 100644 --- a/src/nitro/communication/messages/parser/room/access/index.ts +++ b/src/nitro/communication/messages/parser/room/access/index.ts @@ -1,5 +1,5 @@ +export * from './CantConnectMessageParser'; export * from './doorbell'; export * from './rights'; -export * from './RoomEnterErrorParser'; export * from './RoomEnterParser'; export * from './RoomFowardParser';