Merge branch 'master' into fix/variable-cleanup

This commit is contained in:
Dank074 2021-06-11 20:02:56 -05:00
commit 0442c3f814
24 changed files with 351 additions and 32 deletions

View File

@ -1,4 +1,5 @@
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration'; import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, SellablePetPalettesEvent } from './messages';
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent'; import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
import { ChangeUserNameResultMessageEvent } from 'nitro-renderer/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent'; import { ChangeUserNameResultMessageEvent } from 'nitro-renderer/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent';
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent'; 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 { CatalogSearchEvent } from './messages/incoming/catalog/CatalogSearchEvent';
import { CatalogSoldOutEvent } from './messages/incoming/catalog/CatalogSoldOutEvent'; import { CatalogSoldOutEvent } from './messages/incoming/catalog/CatalogSoldOutEvent';
import { CatalogUpdatedEvent } from './messages/incoming/catalog/CatalogUpdatedEvent'; 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 { ClientPingEvent } from './messages/incoming/client/ClientPingEvent';
import { DesktopViewEvent } from './messages/incoming/desktop/DesktopViewEvent'; import { DesktopViewEvent } from './messages/incoming/desktop/DesktopViewEvent';
import { AcceptFriendResultEvent } from './messages/incoming/friendlist/AcceptFriendResultEvent'; 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 { FurnitureListRemovedEvent } from './messages/incoming/inventory/furni/FurnitureListRemovedEvent';
import { FurniturePostItPlacedEvent } from './messages/incoming/inventory/furni/FurniturePostItPlacedEvent'; import { FurniturePostItPlacedEvent } from './messages/incoming/inventory/furni/FurniturePostItPlacedEvent';
import { FurnitureGiftOpenedEvent } from './messages/incoming/inventory/furni/gifts/FurnitureGiftOpenedEvent'; 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 { PetAddedToInventoryEvent } from './messages/incoming/inventory/pets/PetAddedToInventoryEvent';
import { PetInventoryEvent } from './messages/incoming/inventory/pets/PetInventoryEvent'; import { PetInventoryEvent } from './messages/incoming/inventory/pets/PetInventoryEvent';
import { PetRemovedFromInventory } from './messages/incoming/inventory/pets/PetRemovedFromInventoryEvent'; 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 { CatalogPurchaseComposer } from './messages/outgoing/catalog/CatalogPurchaseComposer';
import { CatalogPurchaseGiftComposer } from './messages/outgoing/catalog/CatalogPurchaseGiftComposer'; import { CatalogPurchaseGiftComposer } from './messages/outgoing/catalog/CatalogPurchaseGiftComposer';
import { CatalogRequestGiftConfigurationComposer } from './messages/outgoing/catalog/CatalogRequestGiftConfigurationComposer'; import { CatalogRequestGiftConfigurationComposer } from './messages/outgoing/catalog/CatalogRequestGiftConfigurationComposer';
import { CatalogRequestPetBreedsComposer } from './messages/outgoing/catalog/CatalogRequestPetBreedsComposer';
import { CatalogRequestVipGiftsComposer } from './messages/outgoing/catalog/CatalogRequestVipGiftsComposer'; import { CatalogRequestVipGiftsComposer } from './messages/outgoing/catalog/CatalogRequestVipGiftsComposer';
import { CatalogRequestVipOffersComposer } from './messages/outgoing/catalog/CatalogRequestVipOffersComposer'; import { CatalogRequestVipOffersComposer } from './messages/outgoing/catalog/CatalogRequestVipOffersComposer';
import { CatalogSearchComposer } from './messages/outgoing/catalog/CatalogSearchComposer'; import { CatalogSearchComposer } from './messages/outgoing/catalog/CatalogSearchComposer';
import { CatalogSelectClubGiftComposer } from './messages/outgoing/catalog/CatalogSelectClubGiftComposer'; 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 { RedeemItemClothingComposer } from './messages/outgoing/catalog/RedeemItemClothingComposer';
import { CatalogRedeemVoucherComposer } from './messages/outgoing/catalog/RedeemVoucherComposer'; import { CatalogRedeemVoucherComposer } from './messages/outgoing/catalog/RedeemVoucherComposer';
import { ClientPongComposer } from './messages/outgoing/client/ClientPongComposer'; 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 { GetBotInventoryComposer } from './messages/outgoing/inventory/bots/GetBotInventoryComposer';
import { FurnitureList2Composer } from './messages/outgoing/inventory/furni/FurnitureList2Composer'; import { FurnitureList2Composer } from './messages/outgoing/inventory/furni/FurnitureList2Composer';
import { FurnitureListComposer } from './messages/outgoing/inventory/furni/FurnitureListComposer'; 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 { RequestPetsComposer } from './messages/outgoing/inventory/pets/RequestPetsComposer';
import { TradingAcceptComposer } from './messages/outgoing/inventory/trading/TradingAcceptComposer'; import { TradingAcceptComposer } from './messages/outgoing/inventory/trading/TradingAcceptComposer';
import { TradingCancelComposer } from './messages/outgoing/inventory/trading/TradingCancelComposer'; 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 { UserWardrobePageComposer } from './messages/outgoing/user/wardrobe/UserWardrobePageComposer';
import { UserWardrobeSaveComposer } from './messages/outgoing/user/wardrobe/UserWardrobeSaveComposer'; import { UserWardrobeSaveComposer } from './messages/outgoing/user/wardrobe/UserWardrobeSaveComposer';
import { MiniMailUnreadCountParser } from './messages/parser/friendlist/MiniMailUnreadCountParser'; 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 export class NitroMessages implements IMessageConfiguration
{ {
@ -441,6 +443,8 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.GIFT_CONFIG, CatalogGiftConfigurationEvent); this._events.set(IncomingHeader.GIFT_CONFIG, CatalogGiftConfigurationEvent);
this._events.set(IncomingHeader.REDEEM_VOUCHER_ERROR, CatalogRedeemVoucherErrorEvent); this._events.set(IncomingHeader.REDEEM_VOUCHER_ERROR, CatalogRedeemVoucherErrorEvent);
this._events.set(IncomingHeader.REDEEM_VOUCHER_OK, CatalogRedeemVoucherOkEvent); this._events.set(IncomingHeader.REDEEM_VOUCHER_OK, CatalogRedeemVoucherOkEvent);
this._events.set(IncomingHeader.CATALOG_RECEIVE_PET_BREEDS, SellablePetPalettesEvent);
this._events.set(IncomingHeader.CATALOG_APPROVE_NAME_RESULT, CatalogApproveNameResultEvent);
// CLIENT // CLIENT
this._events.set(IncomingHeader.CLIENT_PING, ClientPingEvent); this._events.set(IncomingHeader.CLIENT_PING, ClientPingEvent);
@ -737,6 +741,7 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.GROUP_MEMBERSHIPS, CatalogGroupsComposer); this._composers.set(OutgoingHeader.GROUP_MEMBERSHIPS, CatalogGroupsComposer);
this._composers.set(OutgoingHeader.GIFT_CONFIG, CatalogRequestGiftConfigurationComposer); this._composers.set(OutgoingHeader.GIFT_CONFIG, CatalogRequestGiftConfigurationComposer);
this._composers.set(OutgoingHeader.CATALOG_SELECT_VIP_GIFT, CatalogSelectClubGiftComposer); this._composers.set(OutgoingHeader.CATALOG_SELECT_VIP_GIFT, CatalogSelectClubGiftComposer);
this._composers.set(OutgoingHeader.CATALOG_REQUESET_PET_BREEDS, CatalogRequestPetBreedsComposer);
// CLIENT // CLIENT
this._composers.set(OutgoingHeader.CLIENT_PONG, ClientPongComposer); this._composers.set(OutgoingHeader.CLIENT_PONG, ClientPongComposer);
@ -934,6 +939,7 @@ export class NitroMessages implements IMessageConfiguration
this._composers.set(OutgoingHeader.ROOM_MUTE, RoomMuteComposer); this._composers.set(OutgoingHeader.ROOM_MUTE, RoomMuteComposer);
// USER // USER
this._composers.set(OutgoingHeader.APPROVE_NAME, ApproveNameMessageComposer);
this._composers.set(OutgoingHeader.USER_RESPECT, UserRespectComposer); this._composers.set(OutgoingHeader.USER_RESPECT, UserRespectComposer);
// DATA // DATA

View File

@ -245,4 +245,6 @@ export class IncomingHeader
public static MARKETPLACE_ITEM_POSTED = 1359; public static MARKETPLACE_ITEM_POSTED = 1359;
public static MARKETPLACE_ITEMS_SEARCHED = 680; public static MARKETPLACE_ITEMS_SEARCHED = 680;
public static MARKETPLACE_AFTER_ORDER_STATUS = 2032; public static MARKETPLACE_AFTER_ORDER_STATUS = 2032;
public static CATALOG_RECEIVE_PET_BREEDS = 3331;
public static CATALOG_APPROVE_NAME_RESULT = 1503;
} }

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CatalogApproveNameResultParser } from '../../parser';
export class CatalogApproveNameResultEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, CatalogApproveNameResultParser);
}
public getParser(): CatalogApproveNameResultParser
{
return this.parser as CatalogApproveNameResultParser;
}
}

View File

@ -0,0 +1,16 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { SellablePetPalettesParser } from '../../parser';
export class SellablePetPalettesEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, SellablePetPalettesParser);
}
public getParser(): SellablePetPalettesParser
{
return this.parser as SellablePetPalettesParser;
}
}

View File

@ -1,3 +1,4 @@
export * from './CatalogApproveNameResultEvent';
export * from './CatalogClubEvent'; export * from './CatalogClubEvent';
export * from './CatalogClubGiftsEvent'; export * from './CatalogClubGiftsEvent';
export * from './CatalogGiftConfigurationEvent'; export * from './CatalogGiftConfigurationEvent';
@ -17,3 +18,4 @@ export * from './CatalogUpdatedEvent';
export * from './marketplace'; export * from './marketplace';
export * from './MarketplaceConfigEvent'; export * from './MarketplaceConfigEvent';
export * from './MarketplaceItemStatsEvent'; export * from './MarketplaceItemStatsEvent';
export * from './SellablePetPalettesEvent';

View File

@ -230,4 +230,6 @@ export class OutgoingHeader
public static MARKETPLACE_REDEEM_CREDITS = 2650; public static MARKETPLACE_REDEEM_CREDITS = 2650;
public static MARKETPLACE_REQUEST_OFFERS = 2407; public static MARKETPLACE_REQUEST_OFFERS = 2407;
public static MARKETPLACE_BUY_OFFER = 1603; public static MARKETPLACE_BUY_OFFER = 1603;
public static CATALOG_REQUESET_PET_BREEDS = 1756;
public static APPROVE_NAME = 2109;
} }

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 './CatalogPurchaseComposer';
export * from './CatalogPurchaseGiftComposer'; export * from './CatalogPurchaseGiftComposer';
export * from './CatalogRequestGiftConfigurationComposer'; export * from './CatalogRequestGiftConfigurationComposer';
export * from './CatalogRequestPetBreedsComposer';
export * from './CatalogRequestVipGiftsComposer'; export * from './CatalogRequestVipGiftsComposer';
export * from './CatalogRequestVipOffersComposer'; export * from './CatalogRequestVipOffersComposer';
export * from './CatalogSearchComposer'; export * from './CatalogSearchComposer';

View File

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

View File

@ -1,3 +1,4 @@
export * from './ApproveNameMessageComposer';
export * from './data'; export * from './data';
export * from './inventory'; export * from './inventory';
export * from './settings'; export * from './settings';

View File

@ -0,0 +1,36 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
export class CatalogApproveNameResultParser implements IMessageParser
{
private _result: number;
private _validationInfo: string;
public flush(): boolean
{
this._result = -1;
this._validationInfo = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._result = wrapper.readInt();
this._validationInfo = wrapper.readString();
return true;
}
public get result(): number
{
return this._result;
}
public get validationInfo(): string
{
return this._validationInfo;
}
}

View File

@ -0,0 +1,45 @@
import { IMessageDataWrapper } from '../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../core/communication/messages/IMessageParser';
import { SellablePetPaletteData } from './utils';
export class SellablePetPalettesParser implements IMessageParser
{
private _productCode: string;
private _palettes: SellablePetPaletteData[];
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 SellablePetPaletteData(wrapper));
totalPalettes--;
}
return true;
}
public get productCode(): string
{
return this._productCode;
}
public get palettes(): SellablePetPaletteData[]
{
return this._palettes;
}
}

View File

@ -1,3 +1,4 @@
export * from './CatalogApproveNameResultParser';
export * from './CatalogClubGiftsParser'; export * from './CatalogClubGiftsParser';
export * from './CatalogClubParser'; export * from './CatalogClubParser';
export * from './CatalogGiftConfigurationParser'; export * from './CatalogGiftConfigurationParser';
@ -6,6 +7,7 @@ export * from './CatalogGroupsParser';
export * from './CatalogModeParser'; export * from './CatalogModeParser';
export * from './CatalogPageParser'; export * from './CatalogPageParser';
export * from './CatalogPagesParser'; export * from './CatalogPagesParser';
export * from './CatalogPetBreedsParser';
export * from './CatalogPurchaseFailedParser'; export * from './CatalogPurchaseFailedParser';
export * from './CatalogPurchaseParser'; export * from './CatalogPurchaseParser';
export * from './CatalogPurchaseUnavailableParser'; export * from './CatalogPurchaseUnavailableParser';

View File

@ -0,0 +1,67 @@
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
export class SellablePetPaletteData
{
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

@ -13,4 +13,5 @@ export * from './ICatalogPageParser';
export * from './MarketplaceOfferData'; export * from './MarketplaceOfferData';
export * from './MarketplaceOfferItem'; export * from './MarketplaceOfferItem';
export * from './MarketplaceOwnItem'; export * from './MarketplaceOwnItem';
export * from './SellablePetPaletteData';
export * from './_Str_5178'; export * from './_Str_5178';

View File

@ -15,6 +15,7 @@ import { IGetImageListener } from './IGetImageListener';
import { ImageResult } from './ImageResult'; import { ImageResult } from './ImageResult';
import { IObjectData } from './object/data/IObjectData'; import { IObjectData } from './object/data/IObjectData';
import { RoomMapData } from './object/RoomMapData'; import { RoomMapData } from './object/RoomMapData';
import { PetColorResult } from './PetColorResult';
import { RoomContentLoader } from './RoomContentLoader'; import { RoomContentLoader } from './RoomContentLoader';
import { RoomObjectEventHandler } from './RoomObjectEventHandler'; import { RoomObjectEventHandler } from './RoomObjectEventHandler';
@ -73,6 +74,7 @@ export interface IRoomEngine extends INitroManager
getRoomObjectPetImage(typeId: number, paletteId: number, color: number, direction: IVector3D, scale: number, listener: IGetImageListener, headOnly?: boolean, bgColor?: number, customParts?: PetCustomPart[], posture?: string): ImageResult; getRoomObjectPetImage(typeId: number, paletteId: number, color: number, direction: IVector3D, scale: number, listener: IGetImageListener, headOnly?: boolean, bgColor?: number, customParts?: PetCustomPart[], posture?: string): ImageResult;
selectRoomObject(roomId: number, objectId: number, objectCategory: number): void; selectRoomObject(roomId: number, objectId: number, objectCategory: number): void;
_Str_8675(): void; _Str_8675(): void;
getPetColorResult(petIndex: number, paletteIndex: number): PetColorResult;
cancelRoomObjectPlacement(): void; cancelRoomObjectPlacement(): void;
getFurnitureFloorName(typeId: number): string; getFurnitureFloorName(typeId: number): string;
useRoomObject(objectId: number, category: number): boolean; useRoomObject(objectId: number, category: number): boolean;

View File

@ -10,16 +10,16 @@ export class PetColorResult
private _isMaster: boolean; private _isMaster: boolean;
private _layerTags: string[]; private _layerTags: string[];
constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: string, _arg_6: boolean, _arg_7: string[]) constructor(primaryColor: number, secondaryColor: number, breed: number, tag: number, id: string, isMaster: boolean, layerTags: string[])
{ {
this._layerTags = []; this._layerTags = [];
this._primaryColor = (k & 0xFFFFFF); this._primaryColor = (primaryColor & 0xFFFFFF);
this._secondaryColor = (_arg_2 & 0xFFFFFF); this._secondaryColor = (secondaryColor & 0xFFFFFF);
this._breed = _arg_3; this._breed = breed;
this._tag = (((_arg_4 > -1) && (_arg_4 < PetColorResult.COLOR_TAGS.length)) ? PetColorResult.COLOR_TAGS[_arg_4] : ''); this._tag = (((tag > -1) && (tag < PetColorResult.COLOR_TAGS.length)) ? PetColorResult.COLOR_TAGS[tag] : '');
this._id = _arg_5; this._id = id;
this._isMaster = _arg_6; this._isMaster = isMaster;
this._layerTags = _arg_7; this._layerTags = layerTags;
} }
public get primaryColor(): number public get primaryColor(): number

View File

@ -19,6 +19,7 @@ import { RoomObjectCategory } from './object/RoomObjectCategory';
import { RoomObjectUserType } from './object/RoomObjectUserType'; import { RoomObjectUserType } from './object/RoomObjectUserType';
import { RoomObjectVariable } from './object/RoomObjectVariable'; import { RoomObjectVariable } from './object/RoomObjectVariable';
import { RoomObjectVisualizationType } from './object/RoomObjectVisualizationType'; import { RoomObjectVisualizationType } from './object/RoomObjectVisualizationType';
import { PetColorResult } from './PetColorResult';
export class RoomContentLoader implements IFurnitureDataListener export class RoomContentLoader implements IFurnitureDataListener
{ {
@ -51,6 +52,7 @@ export class RoomContentLoader implements IFurnitureDataListener
private _wallItemTypeIds: Map<string, number>; private _wallItemTypeIds: Map<string, number>;
private _furniRevisions: Map<string, number>; private _furniRevisions: Map<string, number>;
private _pets: { [index: string]: number }; private _pets: { [index: string]: number };
private _petColors: Map<number, Map<number, PetColorResult>>;
private _objectAliases: Map<string, string>; private _objectAliases: Map<string, string>;
private _objectOriginalNames: Map<string, string>; private _objectOriginalNames: Map<string, string>;
@ -77,6 +79,7 @@ export class RoomContentLoader implements IFurnitureDataListener
this._wallItemTypeIds = new Map(); this._wallItemTypeIds = new Map();
this._furniRevisions = new Map(); this._furniRevisions = new Map();
this._pets = {}; this._pets = {};
this._petColors = new Map();
this._objectAliases = new Map(); this._objectAliases = new Map();
this._objectOriginalNames = new Map(); this._objectOriginalNames = new Map();
@ -250,6 +253,15 @@ export class RoomContentLoader implements IFurnitureDataListener
return name.substr(0, index); return name.substr(0, index);
} }
public getPetColorResult(petIndex: number, paletteIndex: number): PetColorResult
{
const colorResults = this._petColors.get(petIndex);
if(!colorResults) return null;
return colorResults.get(paletteIndex);
}
public getCollection(name: string): IGraphicAssetCollection public getCollection(name: string): IGraphicAssetCollection
{ {
if(!name) return null; if(!name) return null;
@ -304,6 +316,27 @@ export class RoomContentLoader implements IFurnitureDataListener
const collection = new GraphicAssetCollection(data, spritesheet); const collection = new GraphicAssetCollection(data, spritesheet);
this._collections.set(collection.name, collection); this._collections.set(collection.name, collection);
const petIndex = this._pets[collection.name];
if(petIndex !== undefined)
{
const keys = collection.getPaletteNames();
const palettes: Map<number, PetColorResult> = new Map();
for(const key of keys)
{
const palette = collection.getPalette(key);
const breed = 0;
const primaryColor = palette.primaryColor;
const secondaryColor = palette.secondaryColor;
palettes.set(parseInt(key), new PetColorResult(primaryColor, secondaryColor, breed, -1, key, false, []));
}
this._petColors.set(petIndex, palettes);
}
} }
public getPlaceholderName(type: string): string public getPlaceholderName(type: string): string

View File

@ -94,6 +94,7 @@ import { RoomObjectCategory } from './object/RoomObjectCategory';
import { RoomObjectUserType } from './object/RoomObjectUserType'; import { RoomObjectUserType } from './object/RoomObjectUserType';
import { RoomObjectVariable } from './object/RoomObjectVariable'; import { RoomObjectVariable } from './object/RoomObjectVariable';
import { RoomObjectVisualizationFactory } from './object/RoomObjectVisualizationFactory'; import { RoomObjectVisualizationFactory } from './object/RoomObjectVisualizationFactory';
import { PetColorResult } from './PetColorResult';
import { RoomContentLoader } from './RoomContentLoader'; import { RoomContentLoader } from './RoomContentLoader';
import { RoomMessageHandler } from './RoomMessageHandler'; import { RoomMessageHandler } from './RoomMessageHandler';
import { RoomObjectEventHandler } from './RoomObjectEventHandler'; import { RoomObjectEventHandler } from './RoomObjectEventHandler';
@ -3527,6 +3528,13 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
return (this._roomContentLoader.getCollection(name) !== null); return (this._roomContentLoader.getCollection(name) !== null);
} }
public getPetColorResult(petIndex: number, paletteIndex: number): PetColorResult
{
if(!this._roomContentLoader) return null;
return this._roomContentLoader.getPetColorResult(petIndex, paletteIndex);
}
public modifyRoomObjectData(objectId: number, objectCategory: number, colorHex: string, text: string): boolean public modifyRoomObjectData(objectId: number, objectCategory: number, colorHex: string, text: string): boolean
{ {
if(!this._roomObjectEventHandler || (objectCategory !== RoomObjectCategory.WALL)) return false; if(!this._roomObjectEventHandler || (objectCategory !== RoomObjectCategory.WALL)) return false;

View File

@ -52,6 +52,7 @@ export class RoomPreviewer
private _previousAutomaticStateChangeTime: number; private _previousAutomaticStateChangeTime: number;
private _addViewOffset: Point; private _addViewOffset: Point;
private _backgroundColor: number = 305148561; private _backgroundColor: number = 305148561;
private _backgroundSprite: Sprite = null;
private _disableUpdate: boolean = false; private _disableUpdate: boolean = false;
constructor(roomEngine: IRoomEngine, roomId: number = 1) constructor(roomEngine: IRoomEngine, roomId: number = 1)
@ -85,6 +86,13 @@ export class RoomPreviewer
this._roomEngine.events.removeEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized); this._roomEngine.events.removeEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized);
} }
if(this._backgroundSprite)
{
this._backgroundSprite.destroy();
this._backgroundSprite = null;
}
if(this._planeParser) if(this._planeParser)
{ {
this._planeParser.dispose(); this._planeParser.dispose();
@ -438,13 +446,18 @@ export class RoomPreviewer
if(displayObject && (this._backgroundColor !== null)) if(displayObject && (this._backgroundColor !== null))
{ {
const background = new Sprite(Texture.WHITE); let backgroundSprite = this._backgroundSprite;
background.width = width; if(!backgroundSprite)
background.height = height; {
background.tint = this._backgroundColor; backgroundSprite = new Sprite(Texture.WHITE);
displayObject.addChildAt(background, 0); displayObject.addChildAt(backgroundSprite, 0);
}
backgroundSprite.width = width;
backgroundSprite.height = height;
backgroundSprite.tint = this._backgroundColor;
} }
this._roomEngine.setRoomInstanceRenderingCanvasMask(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, true); this._roomEngine.setRoomInstanceRenderingCanvasMask(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, true);
@ -469,6 +482,12 @@ export class RoomPreviewer
this._currentPreviewCanvasWidth = width; this._currentPreviewCanvasWidth = width;
this._currentPreviewCanvasHeight = height; this._currentPreviewCanvasHeight = height;
if(this._backgroundSprite)
{
this._backgroundSprite.width = width;
this._backgroundSprite.height = height;
}
this._roomEngine.initializeRoomInstanceRenderingCanvas(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height); this._roomEngine.initializeRoomInstanceRenderingCanvas(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height);
} }
} }
@ -850,4 +869,14 @@ export class RoomPreviewer
{ {
this._backgroundColor = color; this._backgroundColor = color;
} }
public get width(): number
{
return this._currentPreviewCanvasWidth;
}
public get height(): number
{
return this._currentPreviewCanvasHeight;
}
} }

View File

@ -220,8 +220,6 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
furnitureData.push(data); furnitureData.push(data);
} }
if(!furnitureData || !furnitureData.length) return null;
return furnitureData; return furnitureData;
} }

View File

@ -0,0 +1,3 @@
import { IPoint } from 'pixi.js';
export type INitroPoint = IPoint;

View File

@ -0,0 +1,5 @@
import { Point } from 'pixi.js';
import { INitroPoint } from './INitroPoint';
export class NitroPoint extends Point implements INitroPoint
{}

View File

@ -1,6 +1,8 @@
export * from './ColorConverter'; export * from './ColorConverter';
export * from './INitroPoint';
export * from './IRoomGeometry'; export * from './IRoomGeometry';
export * from './IVector3D'; export * from './IVector3D';
export * from './NitroPoint';
export * from './NumberBank'; export * from './NumberBank';
export * from './PointMath'; export * from './PointMath';
export * from './Rasterizer'; export * from './Rasterizer';