Add pet breed catalog packets

This commit is contained in:
Bill 2021-05-17 12:48:29 -04:00
parent c8089982c5
commit eb1f029441
11 changed files with 176 additions and 17 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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';

View File

@ -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;
}

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
export class CatalogRequestPetBreedsComposer implements IMessageComposer<ConstructorParameters<typeof CatalogRequestPetBreedsComposer>>
{
private _data: ConstructorParameters<typeof CatalogRequestPetBreedsComposer>;
constructor(name: string)
{
this._data = [ name ];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -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';

View File

@ -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;
}
}

View File

@ -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';

View File

@ -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;
}
}

View File

@ -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';