diff --git a/src/nitro/communication/NitroMessages.ts b/src/nitro/communication/NitroMessages.ts index 45c40f1b..3dae8db9 100644 --- a/src/nitro/communication/NitroMessages.ts +++ b/src/nitro/communication/NitroMessages.ts @@ -1,4 +1,5 @@ import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration'; +import { CatalogPetBreedsEvent } from './messages'; import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent'; import { ChangeNameUpdateEvent } from './messages/incoming/avatar/ChangeNameUpdateEvent'; import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent'; @@ -17,6 +18,12 @@ 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 { MarketplaceCancelItemEvent } from './messages/incoming/catalog/marketplace/MarketplaceCancelItemEvent'; +import { MarketplaceOffersReceivedEvent } from './messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent'; +import { MarketplaceOwnItemsEvent } from './messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent'; +import { MarketplaceConfigEvent } from './messages/incoming/catalog/MarketplaceConfigEvent'; +import { MarketplaceItemStatsEvent } from './messages/incoming/catalog/MarketplaceItemStatsEvent'; import { ClientPingEvent } from './messages/incoming/client/ClientPingEvent'; import { DesktopViewEvent } from './messages/incoming/desktop/DesktopViewEvent'; import { AcceptFriendResultEvent } from './messages/incoming/friendlist/AcceptFriendResultEvent'; @@ -63,6 +70,8 @@ import { FurnitureListInvalidateEvent } from './messages/incoming/inventory/furn import { FurnitureListRemovedEvent } from './messages/incoming/inventory/furni/FurnitureListRemovedEvent'; import { FurniturePostItPlacedEvent } from './messages/incoming/inventory/furni/FurniturePostItPlacedEvent'; import { FurnitureGiftOpenedEvent } from './messages/incoming/inventory/furni/gifts/FurnitureGiftOpenedEvent'; +import { MarketplaceItemPostedEvent } from './messages/incoming/inventory/marketplace/MarketplaceItemPostedEvent'; +import { MarketplaceSellItemEvent } from './messages/incoming/inventory/marketplace/MarketplaceSellItemEvent'; import { PetAddedToInventoryEvent } from './messages/incoming/inventory/pets/PetAddedToInventoryEvent'; import { PetInventoryEvent } from './messages/incoming/inventory/pets/PetInventoryEvent'; import { PetRemovedFromInventory } from './messages/incoming/inventory/pets/PetRemovedFromInventoryEvent'; @@ -203,10 +212,18 @@ import { CatalogPageComposer } from './messages/outgoing/catalog/CatalogPageComp import { CatalogPurchaseComposer } from './messages/outgoing/catalog/CatalogPurchaseComposer'; import { CatalogPurchaseGiftComposer } from './messages/outgoing/catalog/CatalogPurchaseGiftComposer'; import { CatalogRequestGiftConfigurationComposer } from './messages/outgoing/catalog/CatalogRequestGiftConfigurationComposer'; +import { CatalogRequestPetBreedsComposer } from './messages/outgoing/catalog/CatalogRequestPetBreedsComposer'; import { CatalogRequestVipGiftsComposer } from './messages/outgoing/catalog/CatalogRequestVipGiftsComposer'; import { CatalogRequestVipOffersComposer } from './messages/outgoing/catalog/CatalogRequestVipOffersComposer'; import { CatalogSearchComposer } from './messages/outgoing/catalog/CatalogSearchComposer'; import { CatalogSelectClubGiftComposer } from './messages/outgoing/catalog/CatalogSelectClubGiftComposer'; +import { MarketplaceBuyOfferComposer } from './messages/outgoing/catalog/marketplace/MarketplaceBuyOfferComposer'; +import { MarketplaceRedeemCreditsComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRedeemCreditsComposer'; +import { MarketplaceRequesstItemStatsComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequesstItemStatsComposer'; +import { MarketplaceRequestComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequestComposer'; +import { MarketplaceRequestOffersComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequestOffersComposer'; +import { MarketplaceRequestOwnItemsComposer } from './messages/outgoing/catalog/marketplace/MarketplaceRequestOwnItemsComposer'; +import { MarketplaceTakeItemBackComposer } from './messages/outgoing/catalog/marketplace/MarketplaceTakeItemBackComposer'; import { RedeemItemClothingComposer } from './messages/outgoing/catalog/RedeemItemClothingComposer'; import { CatalogRedeemVoucherComposer } from './messages/outgoing/catalog/RedeemVoucherComposer'; import { ClientPongComposer } from './messages/outgoing/client/ClientPongComposer'; @@ -251,6 +268,8 @@ import { SetActivatedBadgesComposer } from './messages/outgoing/inventory/badges import { GetBotInventoryComposer } from './messages/outgoing/inventory/bots/GetBotInventoryComposer'; import { FurnitureList2Composer } from './messages/outgoing/inventory/furni/FurnitureList2Composer'; import { FurnitureListComposer } from './messages/outgoing/inventory/furni/FurnitureListComposer'; +import { MarketplaceSellItemComposer } from './messages/outgoing/inventory/marketplace/MarketplaceSellItemComposer'; +import { RequestSellItemComposer } from './messages/outgoing/inventory/marketplace/RequestSellItemComposer'; import { RequestPetsComposer } from './messages/outgoing/inventory/pets/RequestPetsComposer'; import { TradingAcceptComposer } from './messages/outgoing/inventory/trading/TradingAcceptComposer'; import { TradingCancelComposer } from './messages/outgoing/inventory/trading/TradingCancelComposer'; @@ -384,23 +403,6 @@ 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 { @@ -441,6 +443,7 @@ export class NitroMessages implements IMessageConfiguration this._events.set(IncomingHeader.GIFT_CONFIG, CatalogGiftConfigurationEvent); this._events.set(IncomingHeader.REDEEM_VOUCHER_ERROR, CatalogRedeemVoucherErrorEvent); this._events.set(IncomingHeader.REDEEM_VOUCHER_OK, CatalogRedeemVoucherOkEvent); + this._events.set(IncomingHeader.CATALOG_RECEIVE_PET_BREEDS, CatalogPetBreedsEvent); // CLIENT this._events.set(IncomingHeader.CLIENT_PING, ClientPingEvent); @@ -737,6 +740,7 @@ export class NitroMessages implements IMessageConfiguration this._composers.set(OutgoingHeader.GROUP_MEMBERSHIPS, CatalogGroupsComposer); this._composers.set(OutgoingHeader.GIFT_CONFIG, CatalogRequestGiftConfigurationComposer); this._composers.set(OutgoingHeader.CATALOG_SELECT_VIP_GIFT, CatalogSelectClubGiftComposer); + this._composers.set(OutgoingHeader.CATALOG_REQUESET_PET_BREEDS, CatalogRequestPetBreedsComposer); // CLIENT this._composers.set(OutgoingHeader.CLIENT_PONG, ClientPongComposer); diff --git a/src/nitro/communication/messages/incoming/IncomingHeader.ts b/src/nitro/communication/messages/incoming/IncomingHeader.ts index 3fb4db9a..6cdecd59 100644 --- a/src/nitro/communication/messages/incoming/IncomingHeader.ts +++ b/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -245,4 +245,5 @@ export class IncomingHeader public static MARKETPLACE_ITEM_POSTED = 1359; public static MARKETPLACE_ITEMS_SEARCHED = 680; public static MARKETPLACE_AFTER_ORDER_STATUS = 2032; + public static CATALOG_RECEIVE_PET_BREEDS = 3331; } diff --git a/src/nitro/communication/messages/incoming/catalog/CatalogPetBreedsEvent.ts b/src/nitro/communication/messages/incoming/catalog/CatalogPetBreedsEvent.ts new file mode 100644 index 00000000..140ee8ed --- /dev/null +++ b/src/nitro/communication/messages/incoming/catalog/CatalogPetBreedsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; +import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; +import { CatalogPetBreedsParser } from '../../parser'; + +export class CatalogPetBreedsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CatalogPetBreedsParser); + } + + public getParser(): CatalogPetBreedsParser + { + return this.parser as CatalogPetBreedsParser; + } +} diff --git a/src/nitro/communication/messages/incoming/catalog/index.ts b/src/nitro/communication/messages/incoming/catalog/index.ts index cdda3b40..4a4179e5 100644 --- a/src/nitro/communication/messages/incoming/catalog/index.ts +++ b/src/nitro/communication/messages/incoming/catalog/index.ts @@ -6,6 +6,7 @@ export * from './CatalogGroupsEvent'; export * from './CatalogModeEvent'; export * from './CatalogPageEvent'; export * from './CatalogPagesEvent'; +export * from './CatalogPetBreedsEvent'; export * from './CatalogPurchaseEvent'; export * from './CatalogPurchaseFailedEvent'; export * from './CatalogPurchaseUnavailableEvent'; diff --git a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts index 95b44b25..6edbd82d 100644 --- a/src/nitro/communication/messages/outgoing/OutgoingHeader.ts +++ b/src/nitro/communication/messages/outgoing/OutgoingHeader.ts @@ -230,4 +230,5 @@ export class OutgoingHeader public static MARKETPLACE_REDEEM_CREDITS = 2650; public static MARKETPLACE_REQUEST_OFFERS = 2407; public static MARKETPLACE_BUY_OFFER = 1603; + public static CATALOG_REQUESET_PET_BREEDS = 1756; } diff --git a/src/nitro/communication/messages/outgoing/catalog/CatalogRequestPetBreedsComposer.ts b/src/nitro/communication/messages/outgoing/catalog/CatalogRequestPetBreedsComposer.ts new file mode 100644 index 00000000..a8ea9a15 --- /dev/null +++ b/src/nitro/communication/messages/outgoing/catalog/CatalogRequestPetBreedsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; + +export class CatalogRequestPetBreedsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(name: string) + { + this._data = [ name ]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/src/nitro/communication/messages/outgoing/catalog/index.ts b/src/nitro/communication/messages/outgoing/catalog/index.ts index bc93ae00..03f9b993 100644 --- a/src/nitro/communication/messages/outgoing/catalog/index.ts +++ b/src/nitro/communication/messages/outgoing/catalog/index.ts @@ -4,6 +4,7 @@ export * from './CatalogPageComposer'; export * from './CatalogPurchaseComposer'; export * from './CatalogPurchaseGiftComposer'; export * from './CatalogRequestGiftConfigurationComposer'; +export * from './CatalogRequestPetBreedsComposer'; export * from './CatalogRequestVipGiftsComposer'; export * from './CatalogRequestVipOffersComposer'; export * from './CatalogSearchComposer'; diff --git a/src/nitro/communication/messages/parser/catalog/CatalogPetBreedsParser.ts b/src/nitro/communication/messages/parser/catalog/CatalogPetBreedsParser.ts new file mode 100644 index 00000000..44f27f2f --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/CatalogPetBreedsParser.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper'; +import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser'; +import { CatalogPetPaletteBreed } from './utils'; + +export class CatalogPetBreedsParser implements IMessageParser +{ + private _productCode: string; + private _palettes: CatalogPetPaletteBreed[]; + + public flush(): boolean + { + this._productCode = ''; + this._palettes = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._productCode = wrapper.readString(); + + let totalPalettes = wrapper.readInt(); + + while(totalPalettes > 0) + { + this._palettes.push(new CatalogPetPaletteBreed(wrapper)); + + totalPalettes--; + } + + return true; + } + + public get productCode(): string + { + return this._productCode; + } + + public get palettes(): CatalogPetPaletteBreed[] + { + return this._palettes; + } +} diff --git a/src/nitro/communication/messages/parser/catalog/index.ts b/src/nitro/communication/messages/parser/catalog/index.ts index 936dd7f2..1ec017ed 100644 --- a/src/nitro/communication/messages/parser/catalog/index.ts +++ b/src/nitro/communication/messages/parser/catalog/index.ts @@ -6,6 +6,7 @@ export * from './CatalogGroupsParser'; export * from './CatalogModeParser'; export * from './CatalogPageParser'; export * from './CatalogPagesParser'; +export * from './CatalogPetBreedsParser'; export * from './CatalogPurchaseFailedParser'; export * from './CatalogPurchaseParser'; export * from './CatalogPurchaseUnavailableParser'; diff --git a/src/nitro/communication/messages/parser/catalog/utils/CatalogPetPaletteBreed.ts b/src/nitro/communication/messages/parser/catalog/utils/CatalogPetPaletteBreed.ts new file mode 100644 index 00000000..111ea9db --- /dev/null +++ b/src/nitro/communication/messages/parser/catalog/utils/CatalogPetPaletteBreed.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper'; + +export class CatalogPetPaletteBreed +{ + private _type: number; + private _breedId: number; + private _paletteId: number; + private _sellable: boolean; + private _rare: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._type = -1; + this._breedId = -1; + this._paletteId = -1; + this._sellable = false; + this._rare = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readInt(); + this._breedId = wrapper.readInt(); + this._paletteId = wrapper.readInt(); + this._sellable = wrapper.readBoolean(); + this._rare = wrapper.readBoolean(); + + return true; + } + + public get type(): number + { + return this._type; + } + + public get breedId(): number + { + return this._breedId; + } + + public get paletteId(): number + { + return this._paletteId; + } + + public get sellable(): boolean + { + return this._sellable; + } + + public get rare(): boolean + { + return this._rare; + } +} diff --git a/src/nitro/communication/messages/parser/catalog/utils/index.ts b/src/nitro/communication/messages/parser/catalog/utils/index.ts index bc58d202..74778bea 100644 --- a/src/nitro/communication/messages/parser/catalog/utils/index.ts +++ b/src/nitro/communication/messages/parser/catalog/utils/index.ts @@ -4,6 +4,7 @@ export * from './CatalogGroupData'; export * from './CatalogLocalizationData'; export * from './CatalogPageData'; export * from './CatalogPageOfferData'; +export * from './CatalogPetPaletteBreed'; export * from './CatalogProductOfferData'; export * from './CatalogPurchaseData'; export * from './CatalogSearchData';