From b4f4cc446b2b41e89102314352c8e670eeb18ee6 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 3 May 2021 23:59:30 -0400 Subject: [PATCH] Add packets --- src/nitro/communication/NitroMessages.ts | 48 +++++++ .../messages/incoming/IncomingHeader.ts | 7 + .../catalog/MarketplaceConfigEvent.ts | 17 +++ .../catalog/MarketplaceItemStatsEvent.ts | 17 +++ .../messages/incoming/catalog/index.ts | 3 + .../MarketplaceAfterOrderStatusEvent.ts | 16 +++ .../marketplace/MarketplaceCancelItemEvent.ts | 16 +++ .../MarketplaceOffersReceivedEvent.ts | 17 +++ .../marketplace/MarketplaceOwnItemsEvent.ts | 16 +++ .../incoming/catalog/marketplace/index.ts | 4 + .../friendlist/HabboSearchResultData.ts | 6 +- .../messages/incoming/inventory/index.ts | 1 + .../marketplace/MarketplaceItemPostedEvent.ts | 16 +++ .../marketplace/MarketplaceSellItemEvent.ts | 16 +++ .../incoming/inventory/marketplace/index.ts | 2 + .../room/mapping/RoomBlockedTilesEvent.ts | 16 +++ .../messages/incoming/room/mapping/index.ts | 1 + .../messages/outgoing/OutgoingHeader.ts | 8 ++ .../messages/outgoing/catalog/index.ts | 1 + .../MarketplaceBuyOfferComposer.ts | 21 +++ .../MarketplaceRedeemCreditsComposer.ts | 21 +++ .../MarketplaceRequesstItemStatsComposer.ts | 21 +++ .../marketplace/MarketplaceRequestComposer.ts | 21 +++ .../MarketplaceRequestOffersComposer.ts | 21 +++ .../MarketplaceRequestOwnItemsComposer.ts | 21 +++ .../MarketplaceTakeItemBackComposer.ts | 21 +++ .../outgoing/catalog/marketplace/index.ts | 7 + .../messages/outgoing/inventory/index.ts | 1 + .../MarketplaceSellItemComposer.ts | 21 +++ .../marketplace/RequestSellItemComposer.ts | 21 +++ .../outgoing/inventory/marketplace/index.ts | 2 + .../room/mapping/RoomBlockedTilesComposer.ts | 21 +++ .../room/mapping/RoomDoorSettingsComposer.ts | 21 +++ .../room/mapping/RoomModelSaveComposer.ts | 21 +++ .../messages/outgoing/room/mapping/index.ts | 3 + .../parser/catalog/MarketplaceConfigParser.ts | 78 ++++++++++ .../catalog/MarketplaceItemStatsParser.ts | 85 +++++++++++ .../messages/parser/catalog/index.ts | 3 + .../MarketplaceAfterOrderParser.ts | 48 +++++++ .../MarketplaceCancelItemParser.ts | 35 +++++ .../MarketplaceOffersReceivedParser.ts | 106 ++++++++++++++ .../marketplace/MarketplaceOwnItemsParser.ts | 96 +++++++++++++ .../parser/catalog/marketplace/index.ts | 4 + .../catalog/utils/MarketplaceOfferData.ts | 134 ++++++++++++++++++ .../catalog/utils/MarketplaceOfferItem.ts | 84 +++++++++++ .../catalog/utils/MarketplaceOwnItem.ts | 80 +++++++++++ .../messages/parser/catalog/utils/index.ts | 3 + .../messages/parser/inventory/index.ts | 1 + .../MarketplaceItemPostedParser.ts | 28 ++++ .../marketplace/MarketplaceSellItemParser.ts | 38 +++++ .../parser/inventory/marketplace/index.ts | 2 + .../room/mapping/RoomBlockedTilesParser.ts | 40 ++++++ .../messages/parser/room/mapping/index.ts | 1 + .../session/furniture/FurnitureDataLoader.ts | 1 - 54 files changed, 1357 insertions(+), 3 deletions(-) create mode 100644 src/nitro/communication/messages/incoming/catalog/MarketplaceConfigEvent.ts create mode 100644 src/nitro/communication/messages/incoming/catalog/MarketplaceItemStatsEvent.ts create mode 100644 src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts create mode 100644 src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceCancelItemEvent.ts create mode 100644 src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent.ts create mode 100644 src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent.ts create mode 100644 src/nitro/communication/messages/incoming/catalog/marketplace/index.ts create mode 100644 src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceItemPostedEvent.ts create mode 100644 src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts create mode 100644 src/nitro/communication/messages/incoming/inventory/marketplace/index.ts create mode 100644 src/nitro/communication/messages/incoming/room/mapping/RoomBlockedTilesEvent.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceBuyOfferComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRedeemCreditsComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequesstItemStatsComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOffersComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOwnItemsComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceTakeItemBackComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/catalog/marketplace/index.ts create mode 100644 src/nitro/communication/messages/outgoing/inventory/marketplace/MarketplaceSellItemComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/inventory/marketplace/RequestSellItemComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/inventory/marketplace/index.ts create mode 100644 src/nitro/communication/messages/outgoing/room/mapping/RoomBlockedTilesComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/room/mapping/RoomDoorSettingsComposer.ts create mode 100644 src/nitro/communication/messages/outgoing/room/mapping/RoomModelSaveComposer.ts create mode 100644 src/nitro/communication/messages/parser/catalog/MarketplaceConfigParser.ts create mode 100644 src/nitro/communication/messages/parser/catalog/MarketplaceItemStatsParser.ts create mode 100644 src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceAfterOrderParser.ts create mode 100644 src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceCancelItemParser.ts create mode 100644 src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOffersReceivedParser.ts create mode 100644 src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOwnItemsParser.ts create mode 100644 src/nitro/communication/messages/parser/catalog/marketplace/index.ts create mode 100644 src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferData.ts create mode 100644 src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferItem.ts create mode 100644 src/nitro/communication/messages/parser/catalog/utils/MarketplaceOwnItem.ts create mode 100644 src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceItemPostedParser.ts create mode 100644 src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceSellItemParser.ts create mode 100644 src/nitro/communication/messages/parser/inventory/marketplace/index.ts create mode 100644 src/nitro/communication/messages/parser/room/mapping/RoomBlockedTilesParser.ts diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 744024b9..45c40f1b 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -142,6 +142,7 @@ import { FurnitureWallAddEvent } from './messages/incoming/room/furniture/wall/F import { FurnitureWallEvent } from './messages/incoming/room/furniture/wall/FurnitureWallEvent'; import { FurnitureWallRemoveEvent } from './messages/incoming/room/furniture/wall/FurnitureWallRemoveEvent'; import { FurnitureWallUpdateEvent } from './messages/incoming/room/furniture/wall/FurnitureWallUpdateEvent'; +import { RoomBlockedTilesEvent } from './messages/incoming/room/mapping/RoomBlockedTilesEvent'; import { RoomDoorEvent } from './messages/incoming/room/mapping/RoomDoorEvent'; import { RoomHeightMapEvent } from './messages/incoming/room/mapping/RoomHeightMapEvent'; import { RoomHeightMapUpdateEvent } from './messages/incoming/room/mapping/RoomHeightMapUpdateEvent'; @@ -338,7 +339,10 @@ import { FurnitureMannequinSaveNameComposer } from './messages/outgoing/room/fur import { OpenPresentComposer } from './messages/outgoing/room/furniture/presents/OpenPresentComposer'; import { ApplyTonerComposer } from './messages/outgoing/room/furniture/toner/ApplyTonerComposer'; import { FurnitureWallUpdateComposer } from './messages/outgoing/room/furniture/wall/FurnitureWallUpdateComposer'; +import { RoomBlockedTilesComposer } from './messages/outgoing/room/mapping/RoomBlockedTilesComposer'; +import { RoomDoorSettingsComposer } from './messages/outgoing/room/mapping/RoomDoorSettingsComposer'; import { RoomModelComposer } from './messages/outgoing/room/mapping/RoomModelComposer'; +import { RoomModelSaveComposer } from './messages/outgoing/room/mapping/RoomModelSaveComposer'; import { RoomCreateComposer } from './messages/outgoing/room/RoomCreateComposer'; import { RoomUnitChatComposer } from './messages/outgoing/room/unit/chat/RoomUnitChatComposer'; import { RoomUnitChatShoutComposer } from './messages/outgoing/room/unit/chat/RoomUnitChatShoutComposer'; @@ -380,6 +384,23 @@ import { UserRespectComposer } from './messages/outgoing/user/UserRespectCompose import { UserWardrobePageComposer } from './messages/outgoing/user/wardrobe/UserWardrobePageComposer'; import { UserWardrobeSaveComposer } from './messages/outgoing/user/wardrobe/UserWardrobeSaveComposer'; import { MiniMailUnreadCountParser } from './messages/parser/friendlist/MiniMailUnreadCountParser'; +import { RequestSellItemComposer } from './messages/outgoing/inventory/marketplace/RequestSellItemComposer'; +import { MarketplaceSellItemEvent } from './messages/incoming/inventory/marketplace/MarketplaceSellItemEvent'; +import { MarketplaceConfigEvent } from './messages/incoming/catalog/MarketplaceConfigEvent'; +import { MarketplaceItemStatsEvent } from './messages/incoming/catalog/MarketplaceItemStatsEvent'; +import { MarketplaceSellItemComposer } from './messages/outgoing/inventory/marketplace/MarketplaceSellItemComposer'; +import { MarketplaceRequesstItemStatsComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequesstItemStatsComposer'; +import { MarketplaceRequestComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequestComposer'; +import { MarketplaceRequestOwnItemsComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequestOwnItemsComposer'; +import { MarketplaceOwnItemsEvent } from './messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent'; +import { MarketplaceTakeItemBackComposer } from './messages/outgoing/catalog/marketplace/MarketplaceTakeItemBackComposer'; +import { MarketplaceCancelItemEvent } from './messages/incoming/catalog/marketplace/MarketplaceCancelItemEvent'; +import { MarketplaceRedeemCreditsComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRedeemCreditsComposer'; +import { MarketplaceItemPostedEvent } from './messages/incoming/inventory/marketplace/MarketplaceItemPostedEvent'; +import { MarketplaceRequestOffersComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequestOffersComposer'; +import { MarketplaceOffersReceivedEvent } from './messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent'; +import { MarketplaceBuyOfferComposer } from './messages/outgoing/catalog/marketplace/MarketplaceBuyOfferComposer'; +import { MarketplaceAfterOrderStatusEvent } from './messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent'; export class NitroMessages implements IMessageConfiguration { @@ -589,6 +610,7 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.ROOM_MODEL_NAME, RoomModelNameEvent); this._events.set(IncomingHeader.ROOM_PAINT, RoomPaintEvent); this._events.set(IncomingHeader.ROOM_THICKNESS, RoomThicknessEvent); + this._events.set(IncomingHeader.ROOM_MODEL_BLOCKED_TILES, RoomBlockedTilesEvent); // PET this._events.set(IncomingHeader.PET_FIGURE_UPDATE, PetFigureUpdateEvent); @@ -688,6 +710,16 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.MODERATION_TOPICS, ModtoolCallForHelpTopicsEvent); this._events.set(IncomingHeader.MODERATION_TOOL, ModtoolMainEvent); this._events.set(IncomingHeader.MODTOOL_VISITED_ROOMS_USER, ModtoolReceivedRoomsUserEvent); + + // MARKETPLACE + this._events.set(IncomingHeader.MARKETPLACE_SELL_ITEM, MarketplaceSellItemEvent); + this._events.set(IncomingHeader.MARKETPLACE_CONFIG, MarketplaceConfigEvent); + this._events.set(IncomingHeader.MARKETPLACE_ITEM_STATS, MarketplaceItemStatsEvent); + this._events.set(IncomingHeader.MARKETPLACE_OWN_ITEMS, MarketplaceOwnItemsEvent); + 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); } private registerComposers(): void @@ -767,6 +799,11 @@ export class NitroMessages implements IMessageConfiguration // INVENTORY + // MARKETPLACE + this._composers.set(OutgoingHeader.REQUEST_SELL_ITEM, RequestSellItemComposer); + this._composers.set(OutgoingHeader.REQUEST_MARKETPLACE_ITEM_STATS, MarketplaceRequesstItemStatsComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_REDEEM_CREDITS, MarketplaceRedeemCreditsComposer); + // FURNI this._composers.set(OutgoingHeader.USER_FURNITURE, FurnitureListComposer); this._composers.set(OutgoingHeader.USER_FURNITURE2, FurnitureList2Composer); @@ -866,6 +903,9 @@ export class NitroMessages implements IMessageConfiguration // MAPPING this._composers.set(OutgoingHeader.ROOM_MODEL, RoomModelComposer); + this._composers.set(OutgoingHeader.ROOM_MODEL_BLOCKED_TILES, RoomBlockedTilesComposer); + this._composers.set(OutgoingHeader.ROOM_MODEL_DOOR, RoomDoorSettingsComposer); + this._composers.set(OutgoingHeader.ROOM_MODEL_SAVE, RoomModelSaveComposer); // UNIT this._composers.set(OutgoingHeader.UNIT_ACTION, RoomUnitActionComposer); @@ -917,6 +957,14 @@ export class NitroMessages implements IMessageConfiguration // INVENTORY + // MARKETPLACE + this._composers.set(OutgoingHeader.MARKETPLACE_CONFIG, MarketplaceRequestComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_SELL_ITEM, MarketplaceSellItemComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_REQUEST_OWN_ITEMS, MarketplaceRequestOwnItemsComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_TAKE_BACK_ITEM, MarketplaceTakeItemBackComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_REQUEST_OFFERS, MarketplaceRequestOffersComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_BUY_OFFER, MarketplaceBuyOfferComposer); + // BOTS this._composers.set(OutgoingHeader.USER_BOTS, GetBotInventoryComposer); diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 4b16db9b..3fb4db9a 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -238,4 +238,11 @@ export class IncomingHeader public static HAND_ITEM_RECEIVED = 354; public static PET_PLACING_ERROR = 2913; public static BOT_ERROR = 639; + public static MARKETPLACE_SELL_ITEM = 54; + public static MARKETPLACE_ITEM_STATS = 725; + public static MARKETPLACE_OWN_ITEMS = 3884; + public static MARKETPLACE_CANCEL_SALE = 3264; + public static MARKETPLACE_ITEM_POSTED = 1359; + public static MARKETPLACE_ITEMS_SEARCHED = 680; + public static MARKETPLACE_AFTER_ORDER_STATUS = 2032; } diff --git a/src/nitro/communication/messages/incoming/catalog/MarketplaceConfigEvent.ts b/src/nitro/communication/messages/incoming/catalog/MarketplaceConfigEvent.ts new file mode 100644 index 00000000..8f695f39 --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/MarketplaceConfigEvent.ts @@ -0,0 +1,17 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceConfigParser } from '../../parser/catalog/MarketplaceConfigParser'; + + +export class MarketplaceConfigEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceConfigParser); + } + + public getParser(): MarketplaceConfigParser + { + return this.parser as MarketplaceConfigParser; + } +} diff --git a/src/nitro/communication/messages/incoming/catalog/MarketplaceItemStatsEvent.ts b/src/nitro/communication/messages/incoming/catalog/MarketplaceItemStatsEvent.ts new file mode 100644 index 00000000..55637b81 --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/MarketplaceItemStatsEvent.ts @@ -0,0 +1,17 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceItemStatsParser } from '../../parser/catalog/MarketplaceItemStatsParser'; + + +export class MarketplaceItemStatsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceItemStatsParser); + } + + public getParser(): MarketplaceItemStatsParser + { + return this.parser as MarketplaceItemStatsParser; + } +} diff --git a/src/nitro/communication/messages/incoming/catalog/index.ts b/src/nitro/communication/messages/incoming/catalog/index.ts index 7abc5f25..cdda3b40 100644 --- a/src/nitro/communication/messages/incoming/catalog/index.ts +++ b/src/nitro/communication/messages/incoming/catalog/index.ts @@ -14,3 +14,6 @@ export * from './CatalogRedeemVoucherOkEvent'; export * from './CatalogSearchEvent'; export * from './CatalogSoldOutEvent'; export * from './CatalogUpdatedEvent'; +export * from './marketplace'; +export * from './MarketplaceConfigEvent'; +export * from './MarketplaceItemStatsEvent'; diff --git a/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts new file mode 100644 index 00000000..4317e90c --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceAfterOrderStatusEvent.ts @@ -0,0 +1,16 @@ +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/MarketplaceCancelItemEvent.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceCancelItemEvent.ts new file mode 100644 index 00000000..85347b3b --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceCancelItemEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceCancelItemParser } from '../../../parser/catalog/marketplace/MarketplaceCancelItemParser'; + +export class MarketplaceCancelItemEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceCancelItemParser); + } + + public getParser(): MarketplaceCancelItemParser + { + return this.parser as MarketplaceCancelItemParser; + } +} diff --git a/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent.ts new file mode 100644 index 00000000..4228ce6c --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent.ts @@ -0,0 +1,17 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceOffersReceivedParser } from '../../../parser/catalog/marketplace/MarketplaceOffersReceivedParser'; + + +export class MarketplaceOffersReceivedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceOffersReceivedParser); + } + + public getParser(): MarketplaceOffersReceivedParser + { + return this.parser as MarketplaceOffersReceivedParser; + } +} diff --git a/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent.ts new file mode 100644 index 00000000..6d069acf --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceOwnItemsParser } from '../../../parser/catalog/marketplace/MarketplaceOwnItemsParser'; + +export class MarketplaceOwnItemsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceOwnItemsParser); + } + + public getParser(): MarketplaceOwnItemsParser + { + return this.parser as MarketplaceOwnItemsParser; + } +} diff --git a/src/nitro/communication/messages/incoming/catalog/marketplace/index.ts b/src/nitro/communication/messages/incoming/catalog/marketplace/index.ts new file mode 100644 index 00000000..47b101da --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/marketplace/index.ts @@ -0,0 +1,4 @@ +export * from './MarketplaceAfterOrderStatusEvent'; +export * from './MarketplaceCancelItemEvent'; +export * from './MarketplaceOffersReceivedEvent'; +export * from './MarketplaceOwnItemsEvent'; diff --git a/src/nitro/communication/messages/incoming/friendlist/HabboSearchResultData.ts b/src/nitro/communication/messages/incoming/friendlist/HabboSearchResultData.ts index 11b8bc3f..823f6e14 100644 --- a/src/nitro/communication/messages/incoming/friendlist/HabboSearchResultData.ts +++ b/src/nitro/communication/messages/incoming/friendlist/HabboSearchResultData.ts @@ -21,9 +21,11 @@ export class HabboSearchResultData this._avatarMotto = wrapper.readString(); this._isAvatarOnline = wrapper.readBoolean(); this._canFollow = wrapper.readBoolean(); + + this._lastOnlineData = wrapper.readString(); // this was not assigned to anything on original packet + this._avatarGender = wrapper.readInt(); this._avatarFigure = wrapper.readString(); - this._lastOnlineData = wrapper.readString(); this._realName = wrapper.readString(); } @@ -71,4 +73,4 @@ export class HabboSearchResultData { return this._realName; } -} \ No newline at end of file +} diff --git a/src/nitro/communication/messages/incoming/inventory/index.ts b/src/nitro/communication/messages/incoming/inventory/index.ts index 54d73f27..d79e53bf 100644 --- a/src/nitro/communication/messages/incoming/inventory/index.ts +++ b/src/nitro/communication/messages/incoming/inventory/index.ts @@ -4,5 +4,6 @@ export * from './badges'; export * from './bots'; export * from './clothes'; export * from './furni'; +export * from './marketplace'; export * from './pets'; export * from './trading'; diff --git a/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceItemPostedEvent.ts b/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceItemPostedEvent.ts new file mode 100644 index 00000000..d306c8fa --- /dev/null +++ b/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceItemPostedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceItemPostedParser } from '../../../parser/inventory/marketplace/MarketplaceItemPostedParser'; + +export class MarketplaceItemPostedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceItemPostedParser); + } + + public getParser(): MarketplaceItemPostedParser + { + return this.parser as MarketplaceItemPostedParser; + } +} diff --git a/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts b/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts new file mode 100644 index 00000000..3c56c2ce --- /dev/null +++ b/src/nitro/communication/messages/incoming/inventory/marketplace/MarketplaceSellItemEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { MarketplaceSellItemParser } from '../../../parser/inventory/marketplace/MarketplaceSellItemParser'; + +export class MarketplaceSellItemEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceSellItemParser); + } + + public getParser(): MarketplaceSellItemParser + { + return this.parser as MarketplaceSellItemParser; + } +} diff --git a/src/nitro/communication/messages/incoming/inventory/marketplace/index.ts b/src/nitro/communication/messages/incoming/inventory/marketplace/index.ts new file mode 100644 index 00000000..f8fb0ea6 --- /dev/null +++ b/src/nitro/communication/messages/incoming/inventory/marketplace/index.ts @@ -0,0 +1,2 @@ +export * from './MarketplaceItemPostedEvent'; +export * from './MarketplaceSellItemEvent'; diff --git a/src/nitro/communication/messages/incoming/room/mapping/RoomBlockedTilesEvent.ts b/src/nitro/communication/messages/incoming/room/mapping/RoomBlockedTilesEvent.ts new file mode 100644 index 00000000..2c708a42 --- /dev/null +++ b/src/nitro/communication/messages/incoming/room/mapping/RoomBlockedTilesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; +import { RoomBlockedTilesParser } from '../../../parser/room/mapping/RoomBlockedTilesParser'; + +export class RoomBlockedTilesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomBlockedTilesParser); + } + + public getParser(): RoomBlockedTilesParser + { + return this.parser as RoomBlockedTilesParser; + } +} \ No newline at end of file diff --git a/src/nitro/communication/messages/incoming/room/mapping/index.ts b/src/nitro/communication/messages/incoming/room/mapping/index.ts index 2f112b86..a47f592e 100644 --- a/src/nitro/communication/messages/incoming/room/mapping/index.ts +++ b/src/nitro/communication/messages/incoming/room/mapping/index.ts @@ -1,3 +1,4 @@ +export * from './RoomBlockedTilesEvent'; export * from './RoomDoorEvent'; export * from './RoomHeightMapEvent'; export * from './RoomHeightMapUpdateEvent'; diff --git a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts index e7ec4cc1..95b44b25 100644 --- a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts +++ b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts @@ -222,4 +222,12 @@ export class OutgoingHeader public static MODTOOL_REQUEST_USER_ROOMS = 3526; public static MODTOOL_ROOM_ALERT = 3842; public static CONVERT_GLOBAL_ROOM_ID = 314; + public static REQUEST_SELL_ITEM = 848; + public static REQUEST_MARKETPLACE_ITEM_STATS = 3288; + public static MARKETPLACE_SELL_ITEM = 3447; + public static MARKETPLACE_REQUEST_OWN_ITEMS = 2105; + public static MARKETPLACE_TAKE_BACK_ITEM = 434; + public static MARKETPLACE_REDEEM_CREDITS = 2650; + public static MARKETPLACE_REQUEST_OFFERS = 2407; + public static MARKETPLACE_BUY_OFFER = 1603; } diff --git a/src/nitro/communication/messages/outgoing/catalog/index.ts b/src/nitro/communication/messages/outgoing/catalog/index.ts index e26c9ab7..bc93ae00 100644 --- a/src/nitro/communication/messages/outgoing/catalog/index.ts +++ b/src/nitro/communication/messages/outgoing/catalog/index.ts @@ -8,5 +8,6 @@ export * from './CatalogRequestVipGiftsComposer'; export * from './CatalogRequestVipOffersComposer'; export * from './CatalogSearchComposer'; export * from './CatalogSelectClubGiftComposer'; +export * from './marketplace'; export * from './RedeemItemClothingComposer'; export * from './RedeemVoucherComposer'; diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceBuyOfferComposer.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceBuyOfferComposer.ts new file mode 100644 index 00000000..09baf1d7 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceBuyOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceBuyOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(offerId: number) + { + this._data = [ offerId ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRedeemCreditsComposer.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRedeemCreditsComposer.ts new file mode 100644 index 00000000..c8f1da6f --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRedeemCreditsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceRedeemCreditsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequesstItemStatsComposer.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequesstItemStatsComposer.ts new file mode 100644 index 00000000..bdcc7aee --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequesstItemStatsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceRequesstItemStatsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(unknown: number, itemId: number) + { + this._data = [ unknown, itemId ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestComposer.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestComposer.ts new file mode 100644 index 00000000..e158cfe8 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceRequestComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOffersComposer.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOffersComposer.ts new file mode 100644 index 00000000..b67ba0a4 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOffersComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceRequestOffersComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(min: number, max: number, query: string, type: number) + { + this._data = [ min, max, query, type ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOwnItemsComposer.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOwnItemsComposer.ts new file mode 100644 index 00000000..4382e4af --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceRequestOwnItemsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceRequestOwnItemsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceTakeItemBackComposer.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceTakeItemBackComposer.ts new file mode 100644 index 00000000..f29ad742 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/MarketplaceTakeItemBackComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceTakeItemBackComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(offerId: number) + { + this._data = [ offerId ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/marketplace/index.ts b/src/nitro/communication/messages/outgoing/catalog/marketplace/index.ts new file mode 100644 index 00000000..948ae13e --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/marketplace/index.ts @@ -0,0 +1,7 @@ +export * from './MarketplaceBuyOfferComposer'; +export * from './MarketplaceRedeemCreditsComposer'; +export * from './MarketplaceRequesstItemStatsComposer'; +export * from './MarketplaceRequestComposer'; +export * from './MarketplaceRequestOffersComposer'; +export * from './MarketplaceRequestOwnItemsComposer'; +export * from './MarketplaceTakeItemBackComposer'; diff --git a/src/nitro/communication/messages/outgoing/inventory/index.ts b/src/nitro/communication/messages/outgoing/inventory/index.ts index 1a8fc447..51eb4de7 100644 --- a/src/nitro/communication/messages/outgoing/inventory/index.ts +++ b/src/nitro/communication/messages/outgoing/inventory/index.ts @@ -1,5 +1,6 @@ export * from './badges'; export * from './bots'; export * from './furni'; +export * from './marketplace'; export * from './pets'; export * from './trading'; diff --git a/src/nitro/communication/messages/outgoing/inventory/marketplace/MarketplaceSellItemComposer.ts b/src/nitro/communication/messages/outgoing/inventory/marketplace/MarketplaceSellItemComposer.ts new file mode 100644 index 00000000..825d3f4b --- /dev/null +++ b/src/nitro/communication/messages/outgoing/inventory/marketplace/MarketplaceSellItemComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class MarketplaceSellItemComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(credits: number, arg2: number, itemId: number) + { + this._data = [credits, arg2, itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/inventory/marketplace/RequestSellItemComposer.ts b/src/nitro/communication/messages/outgoing/inventory/marketplace/RequestSellItemComposer.ts new file mode 100644 index 00000000..2cf77e63 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/inventory/marketplace/RequestSellItemComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RequestSellItemComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/inventory/marketplace/index.ts b/src/nitro/communication/messages/outgoing/inventory/marketplace/index.ts new file mode 100644 index 00000000..aa5af83b --- /dev/null +++ b/src/nitro/communication/messages/outgoing/inventory/marketplace/index.ts @@ -0,0 +1,2 @@ +export * from './MarketplaceSellItemComposer'; +export * from './RequestSellItemComposer'; diff --git a/src/nitro/communication/messages/outgoing/room/mapping/RoomBlockedTilesComposer.ts b/src/nitro/communication/messages/outgoing/room/mapping/RoomBlockedTilesComposer.ts new file mode 100644 index 00000000..f55d5f9f --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/mapping/RoomBlockedTilesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomBlockedTilesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} \ No newline at end of file diff --git a/src/nitro/communication/messages/outgoing/room/mapping/RoomDoorSettingsComposer.ts b/src/nitro/communication/messages/outgoing/room/mapping/RoomDoorSettingsComposer.ts new file mode 100644 index 00000000..eae30ae6 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/mapping/RoomDoorSettingsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomDoorSettingsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} \ No newline at end of file diff --git a/src/nitro/communication/messages/outgoing/room/mapping/RoomModelSaveComposer.ts b/src/nitro/communication/messages/outgoing/room/mapping/RoomModelSaveComposer.ts new file mode 100644 index 00000000..3943f466 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/room/mapping/RoomModelSaveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../core/communication/messages/IMessageComposer'; + +export class RoomModelSaveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(model: string, doorX: number, doorY: number, doorDirection: number, thicknessWall: number, thicknessFloor: number, wallHeight: number) + { + this._data = [model, doorX, doorY, doorDirection, thicknessWall, thicknessFloor, wallHeight]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} \ No newline at end of file diff --git a/src/nitro/communication/messages/outgoing/room/mapping/index.ts b/src/nitro/communication/messages/outgoing/room/mapping/index.ts index 8c66d54f..ca5941e7 100644 --- a/src/nitro/communication/messages/outgoing/room/mapping/index.ts +++ b/src/nitro/communication/messages/outgoing/room/mapping/index.ts @@ -1 +1,4 @@ +export * from './RoomBlockedTilesComposer'; +export * from './RoomDoorSettingsComposer'; export * from './RoomModelComposer'; +export * from './RoomModelSaveComposer'; diff --git a/src/nitro/communication/messages/parser/catalog/MarketplaceConfigParser.ts b/src/nitro/communication/messages/parser/catalog/MarketplaceConfigParser.ts new file mode 100644 index 00000000..1cef80d1 --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/MarketplaceConfigParser.ts @@ -0,0 +1,78 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; + +export class MarketplaceConfigParser implements IMessageParser +{ + private _enabled:boolean; + private _commission:number; + private _credits:number; + private _advertisements:number; + private _maximumPrice:number; + private _minimumPrice:number; + private _offerTime:number; + private _displayTime:number; + + + public get enabled():boolean + { + return this._enabled; + } + + public get commission():number + { + return this._commission; + } + + public get credits():number + { + return this._credits; + } + + public get advertisements():number + { + return this._advertisements; + } + + public get minimumPrice():number + { + return this._minimumPrice; + } + + public get maximumPrice():number + { + return this._maximumPrice; + } + + public get offerTime():number + { + return this._offerTime; + } + + public get displayTime():number + { + return this._displayTime; + } + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._enabled = wrapper.readBoolean(); + this._commission = wrapper.readInt(); + this._credits = wrapper.readInt(); + this._advertisements = wrapper.readInt(); + this._minimumPrice = wrapper.readInt(); + this._maximumPrice = wrapper.readInt(); + this._offerTime = wrapper.readInt(); + this._displayTime = wrapper.readInt(); + + return true; + } + + +} diff --git a/src/nitro/communication/messages/parser/catalog/MarketplaceItemStatsParser.ts b/src/nitro/communication/messages/parser/catalog/MarketplaceItemStatsParser.ts new file mode 100644 index 00000000..f43354a0 --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/MarketplaceItemStatsParser.ts @@ -0,0 +1,85 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; + +export class MarketplaceItemStatsParser implements IMessageParser +{ + private _Str_5049:number; + private _Str_10039:number; + private _Str_10803:number; + private _Str_8270:number[]; + private _Str_9670:number[]; + private _Str_8961:number[]; + private _Str_10894:number; + private _Str_10644:number; + + public get _Str_3925():number + { + return this._Str_5049; + } + + public get _Str_4121():number + { + return this._Str_10039; + } + + public get _Str_10461():number + { + return this._Str_10803; + } + + public get _Str_9174():any[] + { + return this._Str_8270; + } + + public get _Str_11365():any[] + { + return this._Str_9670; + } + + public get _Str_11956():any[] + { + return this._Str_8961; + } + + public get _Str_8798():number + { + return this._Str_10894; + } + + public get _Str_9431():number + { + return this._Str_10644; + } + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._Str_5049 = wrapper.readInt(); + this._Str_10039 = wrapper.readInt(); + this._Str_10803 = wrapper.readInt(); + const _local_2:number = wrapper.readInt(); + this._Str_8270 = []; + this._Str_9670 = []; + this._Str_8961 = []; + let _local_3 = 0; + while(_local_3 < _local_2) + { + this._Str_8270.push(wrapper.readInt()); + this._Str_9670.push(wrapper.readInt()); + this._Str_8961.push(wrapper.readInt()); + _local_3++; + } + this._Str_10644 = wrapper.readInt(); + this._Str_10894 = wrapper.readInt(); + return true; + } + + +} diff --git a/src/nitro/communication/messages/parser/catalog/index.ts b/src/nitro/communication/messages/parser/catalog/index.ts index ac54df6a..936dd7f2 100644 --- a/src/nitro/communication/messages/parser/catalog/index.ts +++ b/src/nitro/communication/messages/parser/catalog/index.ts @@ -14,4 +14,7 @@ export * from './CatalogRedeemVoucherOkParser'; export * from './CatalogSearchParser'; export * from './CatalogSoldOutParser'; export * from './CatalogUpdatedParser'; +export * from './marketplace'; +export * from './MarketplaceConfigParser'; +export * from './MarketplaceItemStatsParser'; export * from './utils'; diff --git a/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceAfterOrderParser.ts b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceAfterOrderParser.ts new file mode 100644 index 00000000..9accf02c --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceAfterOrderParser.ts @@ -0,0 +1,48 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class MarketplaceAfterOrderParser implements IMessageParser +{ + + private _result: number; + private _offerId: number = -1; + private _Str_20780: number = -1; + private _Str_8508: number = -1; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + this._offerId = wrapper.readInt(); + this._Str_20780 = wrapper.readInt(); + this._Str_8508 = wrapper.readInt(); + + return true; + } + + public get result():number + { + return this._result; + } + + public get offerId():number + { + return this._offerId; + } + + public get _Str_24839():number + { + return this._Str_20780; + } + + public get _Str_7501():number + { + return this._Str_8508; + } +} diff --git a/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceCancelItemParser.ts b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceCancelItemParser.ts new file mode 100644 index 00000000..565ad113 --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceCancelItemParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class MarketplaceCancelItemParser implements IMessageParser +{ + + private _offerId: number; + private _success: boolean; + + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offerId = wrapper.readInt(); + this._success = wrapper.readBoolean(); + + return true; + } + + public get offerId(): number + { + return this._offerId; + } + + public get success(): boolean + { + return this._success; + } +} diff --git a/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOffersReceivedParser.ts b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOffersReceivedParser.ts new file mode 100644 index 00000000..11c4ee49 --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOffersReceivedParser.ts @@ -0,0 +1,106 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; +import { ObjectDataFactory } from '../../../../../room/object/data/ObjectDataFactory'; +import { IObjectData } from '../../../../../room/object/data/IObjectData'; +import { LegacyDataType } from '../../../../../room/object/data/type/LegacyDataType'; +import { MarketplaceOwnItem } from '../utils/MarketplaceOwnItem'; +import { MarketplaceOfferItem } from '../utils/MarketplaceOfferItem'; + + +export class MarketplaceOffersReceivedParser implements IMessageParser +{ + + private readonly _Str_8964 = 1; + private readonly _Str_13000 = 2; + private readonly _Str_14245 = 3; + + private readonly _Str_18070 = 500; + + private _offers: MarketplaceOfferItem[]; + private _Str_11687: number; + + public flush(): boolean + { + this._offers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offers = []; + + const offerCount = wrapper.readInt(); + let i = 0; + + while(i < offerCount) + { + const offerId = wrapper.readInt(); + const local3 = wrapper.readInt(); + let itemId = wrapper.readInt(); + + let local5: number; + let local6: string; + let local7: IObjectData; + if(itemId === this._Str_8964) + { + local5 = wrapper.readInt(); + local7 = this.getStuffData(wrapper); + } + else + { + if(itemId == this._Str_13000) + { + local5 = wrapper.readInt(); + local6 = wrapper.readString(); + } + else + { + if(itemId == this._Str_14245) + { + local5 = wrapper.readInt(); + local7 = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY); + local7.uniqueNumber = wrapper.readInt(); + local7.uniqueSeries = wrapper.readInt(); + itemId = this._Str_8964; + } + } + } + + const local8 = wrapper.readInt(); + const local9 = wrapper.readInt(); + const local10 = wrapper.readInt(); + const local11 = wrapper.readInt(); + + const offerItem = new MarketplaceOfferItem(offerId, local5, itemId, local6, local7, local8, local3, local9, local10, local11); + if(i < this._Str_18070) + { + this._offers.push(offerItem); + } + i++; + } + + this._Str_11687 = wrapper.readInt(); + return true; + } + + public get offers():MarketplaceOfferItem[] + { + return this._offers; + } + + public get totalItemsFound():number + { + return this._Str_11687; + } + + private getStuffData(wrapper: IMessageDataWrapper): IObjectData + { + const local2 = wrapper.readInt(); + const local3 = ObjectDataFactory.getData(local2); + local3.parseWrapper(wrapper); + return local3; + } +} diff --git a/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOwnItemsParser.ts b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOwnItemsParser.ts new file mode 100644 index 00000000..d72d38fd --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/marketplace/MarketplaceOwnItemsParser.ts @@ -0,0 +1,96 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; +import { ObjectDataFactory } from '../../../../../room/object/data/ObjectDataFactory'; +import { IObjectData } from '../../../../../room/object/data/IObjectData'; +import { LegacyDataType } from '../../../../../room/object/data/type/LegacyDataType'; +import { MarketplaceOwnItem } from '../utils/MarketplaceOwnItem'; + + +export class MarketplaceOwnItemsParser implements IMessageParser +{ + private static _Str_18070 = 500; + private _offers: MarketplaceOwnItem[]; + private _Str_11581: number; + + + public flush(): boolean + { + this._offers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offers = []; + this._Str_11581 = wrapper.readInt(); // SoldPriceTotal + + const offerCount = wrapper.readInt(); + let i = 0; + while(i < offerCount) + { + const offerId = wrapper.readInt(); + const status = wrapper.readInt(); + let furniType = wrapper.readInt(); + + let furniId; + let extraData; + let stuffData:IObjectData; + if(furniType == 1) + { + furniId = wrapper.readInt(); + stuffData = this.getStuffData(wrapper); + } + else + { + if(furniType == 2) + { + furniId = wrapper.readInt(); + extraData = wrapper.readString(); + } + else if(furniType == 3) + { + furniId = wrapper.readInt(); + stuffData = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY); + stuffData.uniqueNumber = wrapper.readInt(); + stuffData.uniqueSeries = wrapper.readInt(); + furniType = 1; + } + } + + const price = wrapper.readInt(); + const local9 = wrapper.readInt(); + const local10 = wrapper.readInt(); + const local13 = new MarketplaceOwnItem(offerId, furniId, furniType, extraData, stuffData, price, status, local9, local10); + + if(i < MarketplaceOwnItemsParser._Str_18070) + { + this._offers.push(local13); + } + i++; + } + + + return true; + } + + public get offers():MarketplaceOwnItem[] + { + return this._offers; + } + + public get creditsWaiting():number + { + return this._Str_11581; + } + + private getStuffData(wrapper: IMessageDataWrapper): IObjectData + { + const local2 = wrapper.readInt(); + const local3 = ObjectDataFactory.getData(local2); + local3.parseWrapper(wrapper); + return local3; + } +} diff --git a/src/nitro/communication/messages/parser/catalog/marketplace/index.ts b/src/nitro/communication/messages/parser/catalog/marketplace/index.ts new file mode 100644 index 00000000..73c5c49e --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/marketplace/index.ts @@ -0,0 +1,4 @@ +export * from './MarketplaceAfterOrderParser'; +export * from './MarketplaceCancelItemParser'; +export * from './MarketplaceOffersReceivedParser'; +export * from './MarketplaceOwnItemsParser'; diff --git a/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferData.ts b/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferData.ts new file mode 100644 index 00000000..6c12353b --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferData.ts @@ -0,0 +1,134 @@ +import { IObjectData } from '../../../../../room/object/data/IObjectData'; + +export class MarketplaceOfferData +{ + public static TYPE_LANDSCAPE:number = 1; + public static TYPE_FLOOR:number = 2; + + private _offerId:number; + private _furniId:number; + private _furniType:number; + private _extraData:string; + private _stuffData:IObjectData; + private _price:number; + private _averagePrice:number; + private _imageCallback:number; + private _status:number; + private _timeLeftMinutes:number = -1; + private _offerCount:number; + private _image:string; + + constructor(offerId:number, furniId:number, furniType:number, extraData:string, stuffData:IObjectData, price:number, status:number, averagePrice:number, offerCount:number=-1) + { + this._offerId = offerId; + this._furniId = furniId; + this._furniType = furniType; + this._extraData = extraData; + this._stuffData = stuffData; + this._price = price; + this._status = status; + this._averagePrice = averagePrice; + this._offerCount = offerCount; + } + + + + public get offerId():number + { + return this._offerId; + } + + public set offerId(k:number) + { + this._offerId = k; + } + + public get furniId():number + { + return this._furniId; + } + + public get furniType():number + { + return this._furniType; + } + + public get extraData():string + { + return this._extraData; + } + + public get stuffData():IObjectData + { + return this._stuffData; + } + + public get price():number + { + return this._price; + } + + public set price(k:number) + { + this._price = k; + } + + + public get _Str_3925():number + { + return this._averagePrice; + } + + public get image():string + { + return this._image; + } + + public set image(k:string) + { + + this._image = k; + } + + public set _Str_4774(k:number) + { + this._imageCallback = k; + } + + public get _Str_4774():number + { + return this._imageCallback; + } + + public get status():number + { + return this._status; + } + + public get _Str_5853():number + { + return this._timeLeftMinutes; + } + + public set _Str_5853(k:number) + { + this._timeLeftMinutes = k; + } + + + + public get _Str_4121():number + { + return this._offerCount; + } + + public set _Str_4121(k:number) + { + this._offerCount = k; + } + + public get isUniqueLimitedItem():boolean + { + return (!(this.stuffData == null)) && (this.stuffData.uniqueSeries > 0); + } +} diff --git a/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferItem.ts b/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferItem.ts new file mode 100644 index 00000000..7599fa43 --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOfferItem.ts @@ -0,0 +1,84 @@ +import { IObjectData } from '../../../../../room/object/data/IObjectData'; + +export class MarketplaceOfferItem +{ + private readonly _offerId:number; + private readonly _furniId:number; + private readonly _furniType:number; + private readonly _extraData:string; + private readonly _stuffData:IObjectData; + private readonly _price:number; + private readonly _status:number; + private readonly _Str_12399:number = -1; + private readonly _Str_5049:number; + private readonly _Str_4620:number; + + constructor(offerId:number, furniId:number, _arg_3:number, extraData:string, stuffData:IObjectData, price:number, status:number, _arg_8:number, _arg_9:number, _arg_10:number=-1) + { + this._offerId = offerId; + this._furniId = furniId; + this._furniType = _arg_3; + this._extraData = extraData; + this._stuffData = stuffData; + this._price = price; + this._status = status; + this._Str_12399 = _arg_8; + this._Str_5049 = _arg_9; + this._Str_4620 = _arg_10; + } + + public get offerId():number + { + return this._offerId; + } + + public get furniId():number + { + return this._furniId; + } + + public get furniType():number + { + return this._furniType; + } + + public get extraData():string + { + return this._extraData; + } + + public get stuffData():IObjectData + { + return this._stuffData; + } + + public get price():number + { + return this._price; + } + + public get status():number + { + return this._status; + } + + public get _Str_5853():number + { + return this._Str_12399; + } + + public get _Str_3925():number + { + return this._Str_5049; + } + + public get _Str_4121():number + { + return this._Str_4620; + } + + public get isUniqueLimitedItem():boolean + { + return (!(this.stuffData == null)) && (this.stuffData.uniqueSeries > 0); + } +} diff --git a/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOwnItem.ts b/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOwnItem.ts new file mode 100644 index 00000000..90812567 --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/utils/MarketplaceOwnItem.ts @@ -0,0 +1,80 @@ +import { IObjectData } from '../../../../../room/object/data/IObjectData'; + +export class MarketplaceOwnItem +{ + private readonly _offerId:number; + private readonly _furniId:number; + private readonly _furniType:number; + private readonly _extraData:string; + private readonly _stuffData:IObjectData; + private readonly _price:number; + private readonly _status:number; + private readonly _Str_12399:number = -1; + private readonly _Str_5049:number; + private readonly _Str_4620:number; + + + constructor(offerId: number, furniId: number, furniType: number, extraData: string, stuffData: IObjectData, price: number, status: number, arg8: number, arg9: number, arg10:number = -1) + { + this._offerId = offerId; + this._furniId = furniId; + this._furniType = furniType; + this._extraData = extraData; + this._stuffData = stuffData; + this._price = price; + this._status = status; + this._Str_12399 = arg8; + this._Str_5049 = arg9; + this._Str_4620 = arg10; + } + + public get offerId():number + { + return this._offerId; + } + + public get furniId():number + { + return this._furniId; + } + + public get furniType():number + { + return this._furniType; + } + + public get extraData():string + { + return this._extraData; + } + + public get stuffData():IObjectData + { + return this._stuffData; + } + + public get price():number + { + return this._price; + } + + public get status():number + { + return this._status; + } + + public get _Str_5853():number + { + return this._Str_12399; + } + + public get _Str_3925():number + { + return this._Str_5049; + } + + public get _Str_4121():number + { + return this._Str_4620; + } +} diff --git a/src/nitro/communication/messages/parser/catalog/utils/index.ts b/src/nitro/communication/messages/parser/catalog/utils/index.ts index 3f7474f0..bc58d202 100644 --- a/src/nitro/communication/messages/parser/catalog/utils/index.ts +++ b/src/nitro/communication/messages/parser/catalog/utils/index.ts @@ -10,4 +10,7 @@ export * from './CatalogSearchData'; export * from './ICatalogLocalizationData'; export * from './ICatalogPageData'; export * from './ICatalogPageParser'; +export * from './MarketplaceOfferData'; +export * from './MarketplaceOfferItem'; +export * from './MarketplaceOwnItem'; export * from './_Str_5178'; diff --git a/src/nitro/communication/messages/parser/inventory/index.ts b/src/nitro/communication/messages/parser/inventory/index.ts index b2dd91f8..f3b67ded 100644 --- a/src/nitro/communication/messages/parser/inventory/index.ts +++ b/src/nitro/communication/messages/parser/inventory/index.ts @@ -4,6 +4,7 @@ export * from './badges'; export * from './bots'; export * from './clothing'; export * from './furniture'; +export * from './marketplace'; export * from './pets'; export * from './purse'; export * from './trading'; diff --git a/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceItemPostedParser.ts b/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceItemPostedParser.ts new file mode 100644 index 00000000..21b624f6 --- /dev/null +++ b/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceItemPostedParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class MarketplaceItemPostedParser implements IMessageParser +{ + private _result: number; + + public flush(): boolean + { + this._result = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + + return true; + } + + public get result(): number + { + return this._result; + } +} diff --git a/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceSellItemParser.ts b/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceSellItemParser.ts new file mode 100644 index 00000000..ff1248b8 --- /dev/null +++ b/src/nitro/communication/messages/parser/inventory/marketplace/MarketplaceSellItemParser.ts @@ -0,0 +1,38 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class MarketplaceSellItemParser implements IMessageParser +{ + private _Str_19825: number = null; + private _result: number = null; + + public flush(): boolean + { + this._Str_19825 = null; + this._result = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + this._Str_19825 = wrapper.readInt(); + + return true; + } + + public get _Str_24601(): number + { + return this._Str_19825; + } + + public get _Str_3278(): 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 new file mode 100644 index 00000000..d3dbc488 --- /dev/null +++ b/src/nitro/communication/messages/parser/inventory/marketplace/index.ts @@ -0,0 +1,2 @@ +export * from './MarketplaceItemPostedParser'; +export * from './MarketplaceSellItemParser'; diff --git a/src/nitro/communication/messages/parser/room/mapping/RoomBlockedTilesParser.ts b/src/nitro/communication/messages/parser/room/mapping/RoomBlockedTilesParser.ts new file mode 100644 index 00000000..1a6a56f3 --- /dev/null +++ b/src/nitro/communication/messages/parser/room/mapping/RoomBlockedTilesParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser'; + +export class RoomBlockedTilesParser implements IMessageParser +{ + private _blockedTilesMap: boolean[][]; + + public flush(): boolean + { + this._blockedTilesMap = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let tilesCount = wrapper.readInt(); + + while(tilesCount > 0) + { + const x = wrapper.readInt(); + const y = wrapper.readInt(); + + if(!this._blockedTilesMap[y]) this._blockedTilesMap[y] = []; + + this._blockedTilesMap[y][x] = true; + + tilesCount--; + } + + return true; + } + + public get blockedTilesMap(): boolean[][] + { + return this._blockedTilesMap; + } +} \ No newline at end of file diff --git a/src/nitro/communication/messages/parser/room/mapping/index.ts b/src/nitro/communication/messages/parser/room/mapping/index.ts index 57af1662..3b6c2914 100644 --- a/src/nitro/communication/messages/parser/room/mapping/index.ts +++ b/src/nitro/communication/messages/parser/room/mapping/index.ts @@ -1,3 +1,4 @@ +export * from './RoomBlockedTilesParser'; export * from './RoomDoorParser'; export * from './RoomHeightMapParser'; export * from './RoomHeightMapUpdateParser'; diff --git a/src/nitro/session/furniture/FurnitureDataLoader.ts b/src/nitro/session/furniture/FurnitureDataLoader.ts index 40a3b373..fb57519c 100644 --- a/src/nitro/session/furniture/FurnitureDataLoader.ts +++ b/src/nitro/session/furniture/FurnitureDataLoader.ts @@ -16,7 +16,6 @@ export class FurnitureDataLoader extends EventDispatcher private _localization: INitroLocalizationManager; private _nitroLogger: NitroLogger; - constructor(floorItems: Map, wallItems: Map, localization: INitroLocalizationManager) { super();