Update marketplace packets

This commit is contained in:
Bill 2021-08-24 01:23:22 -04:00
parent 418485f565
commit 0d9f63ef7c
37 changed files with 497 additions and 495 deletions

View File

@ -10,12 +10,6 @@ import { InitCameraMessageEvent } from './messages/incoming/camera/InitCameraMes
import { ThumbnailStatusMessageEvent } from './messages/incoming/camera/ThumbnailStatusMessageEvent';
import { CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent } from './messages/incoming/campaign';
import { CatalogPageExpirationEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPageWithEarliestExpiryMessageEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, ClubGiftSelectedEvent, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, HabboClubOffersMessageEvent, LimitedEditionSoldOutEvent, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent } from './messages/incoming/catalog';
import { MarketplaceBuyOfferResultEvent } from './messages/incoming/catalog/marketplace/MarketplaceBuyOfferResultEvent';
import { MarketplaceCancelItemEvent } from './messages/incoming/catalog/marketplace/MarketplaceCancelItemEvent';
import { MarketplaceConfigEvent } from './messages/incoming/catalog/marketplace/MarketplaceConfigEvent';
import { MarketplaceItemStatsEvent } from './messages/incoming/catalog/marketplace/MarketplaceItemStatsEvent';
import { MarketplaceOffersReceivedEvent } from './messages/incoming/catalog/marketplace/MarketplaceOffersReceivedEvent';
import { MarketplaceOwnItemsEvent } from './messages/incoming/catalog/marketplace/MarketplaceOwnItemsEvent';
import { ClientPingEvent } from './messages/incoming/client/ClientPingEvent';
import { CraftableProductsEvent } from './messages/incoming/crafting/CraftableProductsEvent';
import { CraftingRecipeEvent } from './messages/incoming/crafting/CraftingRecipeEvent';
@ -66,8 +60,6 @@ import { FurnitureListInvalidateEvent } from './messages/incoming/inventory/furn
import { FurnitureListRemovedEvent } from './messages/incoming/inventory/furni/FurnitureListRemovedEvent';
import { FurniturePostItPlacedEvent } from './messages/incoming/inventory/furni/FurniturePostItPlacedEvent';
import { PresentOpenedMessageEvent } from './messages/incoming/inventory/furni/gifts/PresentOpenedMessageEvent';
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';
@ -83,6 +75,14 @@ import { TradingOtherNotAllowedEvent } from './messages/incoming/inventory/tradi
import { TradingYouAreNotAllowedEvent } from './messages/incoming/inventory/trading/TradingYouAreNotAllowedEvent';
import { PromoArticlesMessageEvent } from './messages/incoming/landingview/PromoArticlesMessageEvent';
import { CommunityGoalVoteMessageEvent } from './messages/incoming/landingview/votes/CommunityGoalVoteMessageEvent';
import { MarketplaceBuyOfferResultEvent } from './messages/incoming/marketplace/MarketplaceBuyOfferResultEvent';
import { MarketplaceCancelOfferResultEvent } from './messages/incoming/marketplace/MarketplaceCancelOfferResultEvent';
import { MarketplaceCanMakeOfferResult } from './messages/incoming/marketplace/MarketplaceCanMakeOfferResult';
import { MarketplaceConfigurationEvent } from './messages/incoming/marketplace/MarketplaceConfigurationEvent';
import { MarketplaceItemStatsEvent } from './messages/incoming/marketplace/MarketplaceItemStatsEvent';
import { MarketplaceMakeOfferResult } from './messages/incoming/marketplace/MarketplaceMakeOfferResult';
import { MarketPlaceOffersEvent } from './messages/incoming/marketplace/MarketplaceOffersEvent';
import { MarketplaceOwnOffersEvent } from './messages/incoming/marketplace/MarketplaceOwnOffersEvent';
import { ModtoolCallForHelpTopicsEvent } from './messages/incoming/modtool/ModtoolCallForHelpTopicsEvent';
import { ModtoolMainEvent } from './messages/incoming/modtool/ModtoolMainEvent';
import { ModtoolReceivedRoomsUserEvent } from './messages/incoming/modtool/ModtoolReceivedRoomsUserEvent';
@ -802,14 +802,14 @@ export class NitroMessages implements IMessageConfiguration
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, MarketplaceBuyOfferResultEvent);
this._events.set(IncomingHeader.MARKETPLACE_CANCEL_SALE, MarketplaceCancelOfferResultEvent);
this._events.set(IncomingHeader.MARKETPLACE_SELL_ITEM, MarketplaceCanMakeOfferResult);
this._events.set(IncomingHeader.MARKETPLACE_CONFIG, MarketplaceConfigurationEvent);
this._events.set(IncomingHeader.MARKETPLACE_ITEM_STATS, MarketplaceItemStatsEvent);
this._events.set(IncomingHeader.MARKETPLACE_ITEM_POSTED, MarketplaceMakeOfferResult);
this._events.set(IncomingHeader.MARKETPLACE_ITEMS_SEARCHED, MarketPlaceOffersEvent);
this._events.set(IncomingHeader.MARKETPLACE_OWN_ITEMS, MarketplaceOwnOffersEvent);
// LANDING VIEW
this._events.set(IncomingHeader.COMMUNITY_GOAL_VOTE_EVENT, CommunityGoalVoteMessageEvent);

View File

@ -1,3 +1,4 @@
export * from '../marketplace';
export * from './BonusRareInfoMessageEvent';
export * from './BuildersClubFurniCountMessageEvent';
export * from './BuildersClubSubscriptionStatusMessageEvent';
@ -25,7 +26,6 @@ export * from './HabboClubOffersMessageEvent';
export * from './IsOfferGiftableMessageEvent';
export * from './LimitedEditionSoldOutEvent';
export * from './LimitedOfferAppearingNextMessageEvent';
export * from './marketplace';
export * from './NodeData';
export * from './NotEnoughBalanceMessageEvent';
export * from './ProductOfferEvent';

View File

@ -1,15 +0,0 @@
import { IMessageEvent, MessageEvent } from '../../../../../../core';
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;
}
}

View File

@ -1,16 +0,0 @@
import { IMessageEvent, MessageEvent } from '../../../../../core';
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;
}
}

View File

@ -1,16 +0,0 @@
import { IMessageEvent, MessageEvent } from '../../../../../../core';
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;
}
}

View File

@ -1,15 +0,0 @@
import { IMessageEvent, MessageEvent } from '../../../../../../core';
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;
}
}

View File

@ -1,4 +0,0 @@
export * from './MarketplaceBuyOfferResultEvent';
export * from './MarketplaceCancelItemEvent';
export * from './MarketplaceOffersReceivedEvent';
export * from './MarketplaceOwnItemsEvent';

View File

@ -3,7 +3,6 @@ export * from './availability';
export * from './avatar';
export * from './camera';
export * from './catalog';
export * from './catalog/marketplace';
export * from './client';
export * from './desktop';
export * from './friendlist';
@ -20,10 +19,10 @@ export * from './inventory/bots';
export * from './inventory/clothes';
export * from './inventory/furni';
export * from './inventory/furni/gifts';
export * from './inventory/marketplace';
export * from './inventory/pets';
export * from './inventory/trading';
export * from './landingview';
export * from './marketplace';
export * from './modtool';
export * from './mysterybox';
export * from './navigator';

View File

@ -1,15 +0,0 @@
import { IMessageEvent, MessageEvent } from '../../../../../../core';
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;
}
}

View File

@ -1,15 +0,0 @@
import { IMessageEvent, MessageEvent } from '../../../../../../core';
import { MarketplaceCanMakeOfferResultParser } from '../../../parser/inventory/marketplace/MarketplaceCanMakeOfferResultParser';
export class MarketplaceSellItemEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, MarketplaceCanMakeOfferResultParser);
}
public getParser(): MarketplaceCanMakeOfferResultParser
{
return this.parser as MarketplaceCanMakeOfferResultParser;
}
}

View File

@ -1,2 +0,0 @@
export * from './MarketplaceItemPostedEvent';
export * from './MarketplaceSellItemEvent';

View File

@ -1,5 +1,5 @@
import { IMessageEvent, MessageEvent } from '../../../../../../core';
import { MarketplaceBuyOfferResultParser } from '../../../parser/catalog/marketplace/MarketplaceBuyOfferResultParser';
import { IMessageEvent, MessageEvent } from '../../../../../core';
import { MarketplaceBuyOfferResultParser } from '../../parser';
export class MarketplaceBuyOfferResultEvent extends MessageEvent implements IMessageEvent
{

View File

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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
import { IMessageEvent, MessageEvent } from '../../../../../../core';
import { MarketplaceItemStatsParser } from '../../../parser';
import { IMessageEvent, MessageEvent } from '../../../../../core';
import { MarketplaceItemStatsParser } from '../../parser';
export class MarketplaceItemStatsEvent extends MessageEvent implements IMessageEvent
{

View File

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

View File

@ -1,4 +1,4 @@
import { IObjectData } from '../../../../../room/object/data/IObjectData';
import { IObjectData } from '../../../../room';
export class MarketplaceOffer
{

View File

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

View File

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

View File

@ -0,0 +1,9 @@
export * from './MarketplaceBuyOfferResultEvent';
export * from './MarketplaceCancelOfferResultEvent';
export * from './MarketplaceCanMakeOfferResult';
export * from './MarketplaceConfigurationEvent';
export * from './MarketplaceItemStatsEvent';
export * from './MarketplaceMakeOfferResult';
export * from './MarketplaceOffer';
export * from './MarketplaceOffersEvent';
export * from './MarketplaceOwnOffersEvent';

View File

@ -17,7 +17,6 @@ export * from './HabboClubOffersMessageParser';
export * from './IsOfferGiftableMessageParser';
export * from './LimitedEditionSoldOutParser';
export * from './LimitedOfferAppearingNextMessageParser';
export * from './marketplace';
export * from './NotEnoughBalanceMessageParser';
export * from './ProductOfferMessageParser';
export * from './PurchaseErrorMessageParser';

View File

@ -1,128 +0,0 @@
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 averagePrice():number
{
return this._averagePrice;
}
public get image():string
{
return this._image;
}
public set image(k:string)
{
this._image = k;
}
public set imageCallback(k:number)
{
this._imageCallback = k;
}
public get imageCallback():number
{
return this._imageCallback;
}
public get status():number
{
return this._status;
}
public get timeLeftMinutes():number
{
return this._timeLeftMinutes;
}
public set timeLeftMinutes(k:number)
{
this._timeLeftMinutes = k;
}
public get offerCount():number
{
return this._offerCount;
}
public set offerCount(k:number)
{
this._offerCount = k;
}
public get isUniqueLimitedItem():boolean
{
return (!(this.stuffData == null)) && (this.stuffData.uniqueSeries > 0);
}
}

View File

@ -1,102 +0,0 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IObjectData } from '../../../../../room/object/data/IObjectData';
import { ObjectDataFactory } from '../../../../../room/object/data/ObjectDataFactory';
import { LegacyDataType } from '../../../../../room/object/data/type/LegacyDataType';
import { MarketplaceOffer } from './MarketplaceOffer';
export class MarketplaceOffersReceivedParser implements IMessageParser
{
private static readonly FURNITYPE_STUFF = 1;
private static readonly FURNITYPE_WALL = 2;
private static readonly FAKE_FURNITYPE_UNIQUE = 3;
private readonly MAX_LIST_LENGTH = 500;
private _offers: MarketplaceOffer[];
private _totalItemsFound: number;
public flush(): boolean
{
this._offers = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._offers = [];
const offerCount = wrapper.readInt();
for(let i = 0; i < offerCount; i++)
{
const offerId = wrapper.readInt();
const local3 = wrapper.readInt();
let itemId = wrapper.readInt();
let local5: number;
let local6: string;
let local7: IObjectData;
if(itemId === MarketplaceOffersReceivedParser.FURNITYPE_STUFF)
{
local5 = wrapper.readInt();
local7 = this.getStuffData(wrapper);
}
else
{
if(itemId == MarketplaceOffersReceivedParser.FURNITYPE_WALL)
{
local5 = wrapper.readInt();
local6 = wrapper.readString();
}
else
{
if(itemId == MarketplaceOffersReceivedParser.FAKE_FURNITYPE_UNIQUE)
{
local5 = wrapper.readInt();
local7 = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY);
local7.uniqueNumber = wrapper.readInt();
local7.uniqueSeries = wrapper.readInt();
itemId = MarketplaceOffersReceivedParser.FURNITYPE_STUFF;
}
}
}
const local8 = wrapper.readInt();
const local9 = wrapper.readInt();
const local10 = wrapper.readInt();
const local11 = wrapper.readInt();
const offerItem = new MarketplaceOffer(offerId, local5, itemId, local6, local7, local8, local3, local9, local10, local11);
if(i < this.MAX_LIST_LENGTH)
{
this._offers.push(offerItem);
}
}
this._totalItemsFound = wrapper.readInt();
return true;
}
public get offers():MarketplaceOffer[]
{
return this._offers;
}
public get totalItemsFound():number
{
return this._totalItemsFound;
}
private getStuffData(wrapper: IMessageDataWrapper): IObjectData
{
const local2 = wrapper.readInt();
const local3 = ObjectDataFactory.getData(local2);
local3.parseWrapper(wrapper);
return local3;
}
}

View File

@ -1,8 +0,0 @@
export * from './MarketplaceBuyOfferResultParser';
export * from './MarketplaceCancelItemParser';
export * from './MarketplaceConfigParser';
export * from './MarketplaceItemStatsParser';
export * from './MarketplaceOffer';
export * from './MarketplaceOfferData';
export * from './MarketplaceOffersReceivedParser';
export * from './MarketplaceOwnItemsParser';

View File

@ -12,6 +12,7 @@ export * from './group';
export * from './help';
export * from './inventory';
export * from './landingview';
export * from './marketplace';
export * from './modtool';
export * from './mysterybox';
export * from './navigator';

View File

@ -1,2 +0,0 @@
export * from './MarketplaceCanMakeOfferResultParser';
export * from './MarketplaceItemPostedParser';

View File

@ -1,14 +1,18 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class MarketplaceBuyOfferResultParser implements IMessageParser
{
private _result: number;
private _newOfferId: number = -1;
private _newPrice: number = -1;
private _requestedOfferId: number = -1;
private _newOfferId: number;
private _newPrice: number;
private _requestedOfferId: number;
public flush(): boolean
{
this._newOfferId = -1;
this._newPrice = 0;
this._requestedOfferId = -1;
return true;
}

View File

@ -1,14 +1,14 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class MarketplaceCanMakeOfferResultParser implements IMessageParser
{
private _tokenCount: number = null;
private _result: number = null;
private _tokenCount: number;
private _result: number;
public flush(): boolean
{
this._tokenCount = null;
this._result = null;
this._tokenCount = 0;
this._result = 0;
return true;
}

View File

@ -1,14 +1,15 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class MarketplaceCancelItemParser implements IMessageParser
export class MarketplaceCancelOfferResultParser implements IMessageParser
{
private _offerId: number;
private _success: boolean;
public flush(): boolean
{
this._offerId = 0;
this._success = false;
return true;
}

View File

@ -1,6 +1,6 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class MarketplaceConfigParser implements IMessageParser
export class MarketplaceConfigurationMessageParser implements IMessageParser
{
private _enabled: boolean;
private _commission: number;
@ -11,6 +11,35 @@ export class MarketplaceConfigParser implements IMessageParser
private _offerTime: number;
private _displayTime: number;
public flush(): boolean
{
this._enabled = false;
this._commission = 0;
this._credits = 0;
this._advertisements = 0;
this._maximumPrice = 0;
this._minimumPrice = 0;
this._offerTime = 0;
this._displayTime = 0;
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;
}
public get enabled(): boolean
{
@ -51,27 +80,4 @@ export class MarketplaceConfigParser implements IMessageParser
{
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;
}
}

View File

@ -1,12 +1,12 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class MarketplaceItemPostedParser implements IMessageParser
export class MarketplaceMakeOfferResultParser implements IMessageParser
{
private _result: number;
public flush(): boolean
{
this._result = null;
this._result = 0;
return true;
}

View File

@ -1,4 +1,4 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
export class MarketplaceItemStatsParser implements IMessageParser
{
@ -11,6 +11,45 @@ export class MarketplaceItemStatsParser implements IMessageParser
private _furniTypeId: number;
private _furniCategoryId: number;
public flush(): boolean
{
this._averagePrice = 0;
this._currentOfferCount = 0;
this._historyLength = 0;
this._dayOffsets = [];
this._averagePrices = [];
this._soldAmounts = [];
this._furniTypeId = 0;
this._furniCategoryId = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._averagePrice = wrapper.readInt();
this._currentOfferCount = wrapper.readInt();
this._historyLength = wrapper.readInt();
let count = wrapper.readInt();
while(count > 0)
{
this._dayOffsets.push(wrapper.readInt());
this._averagePrices.push(wrapper.readInt());
this._soldAmounts.push(wrapper.readInt());
count--;
}
this._furniCategoryId = wrapper.readInt();
this._furniTypeId = wrapper.readInt();
return true;
}
public get averagePrice(): number
{
return this._averagePrice;
@ -26,17 +65,17 @@ export class MarketplaceItemStatsParser implements IMessageParser
return this._historyLength;
}
public get dayOffsets():any[]
public get dayOffsets(): number[]
{
return this._dayOffsets;
}
public get averagePrices():any[]
public get averagePrices(): number[]
{
return this._averagePrices;
}
public get soldAmounts():any[]
public get soldAmounts(): number[]
{
return this._soldAmounts;
}
@ -50,36 +89,4 @@ export class MarketplaceItemStatsParser implements IMessageParser
{
return this._furniCategoryId;
}
public flush(): boolean
{
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._averagePrice = wrapper.readInt();
this._currentOfferCount = wrapper.readInt();
this._historyLength = wrapper.readInt();
const count = wrapper.readInt();
this._dayOffsets = [];
this._averagePrices = [];
this._soldAmounts = [];
for(let i = 0; i < count; i++)
{
this._dayOffsets.push(wrapper.readInt());
this._averagePrices.push(wrapper.readInt());
this._soldAmounts.push(wrapper.readInt());
}
this._furniCategoryId = wrapper.readInt();
this._furniTypeId = wrapper.readInt();
return true;
}
}

View File

@ -0,0 +1,128 @@
import { IObjectData } from '../../../../room';
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(offerId: number)
{
this._offerId = 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 set price(price: number)
{
this._price = price;
}
public get averagePrice(): number
{
return this._averagePrice;
}
public get image(): string
{
return this._image;
}
public set image(image: string)
{
this._image = image;
}
public get imageCallback(): number
{
return this._imageCallback;
}
public set imageCallback(callback: number)
{
this._imageCallback = callback;
}
public get status(): number
{
return this._status;
}
public get timeLeftMinutes(): number
{
return this._timeLeftMinutes;
}
public set timeLeftMinutes(minutes: number)
{
this._timeLeftMinutes = minutes;
}
public get offerCount(): number
{
return this._offerCount;
}
public set offerCount(count: number)
{
this._offerCount = count;
}
public get isUniqueLimitedItem():boolean
{
return (this.stuffData && (this.stuffData.uniqueSeries > 0));
}
}

View File

@ -0,0 +1,90 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
import { IObjectData, LegacyDataType, ObjectDataFactory } from '../../../../room';
import { MarketplaceOffer } from '../../incoming';
import { FurnitureDataParser } from '../room';
export class MarketplaceOffersParser implements IMessageParser
{
private static FURNITYPE_STUFF: number = 1;
private static FURNITYPE_WALL: number = 2;
private static FAKE_FURNITYPE_UNIQUE: number = 3;
private readonly MAX_LIST_LENGTH = 500;
private _offers: MarketplaceOffer[];
private _totalItemsFound: number;
public flush(): boolean
{
this._offers = [];
this._totalItemsFound = 0;
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
const count = wrapper.readInt();
let i = 0;
while(i < count)
{
const offerId = wrapper.readInt();
const status = wrapper.readInt();
let furniType = wrapper.readInt();
let furniId = -1;
let extraData = '';
let stuffData: IObjectData = null;
if(furniType === MarketplaceOffersParser.FURNITYPE_STUFF)
{
furniId = wrapper.readInt();
stuffData = FurnitureDataParser.parseObjectData(wrapper);
}
else if(furniType === MarketplaceOffersParser.FURNITYPE_WALL)
{
furniId = wrapper.readInt();
extraData = wrapper.readString();
}
else if(furniType == MarketplaceOffersParser.FAKE_FURNITYPE_UNIQUE)
{
furniId = wrapper.readInt();
stuffData = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY);
stuffData.uniqueNumber = wrapper.readInt();
stuffData.uniqueSeries = wrapper.readInt();
furniType = MarketplaceOffersParser.FURNITYPE_STUFF;
}
const price = wrapper.readInt();
const timeLeftMinutes = wrapper.readInt();
const averagePrice = wrapper.readInt();
const offerCount = wrapper.readInt();
const offerItem = new MarketplaceOffer(offerId, furniId, furniType, extraData, stuffData, price, status, timeLeftMinutes, averagePrice, offerCount);
if(i < this.MAX_LIST_LENGTH) this._offers.push(offerItem);
i++;
}
this._totalItemsFound = wrapper.readInt();
return true;
}
public get offers(): MarketplaceOffer[]
{
return this._offers;
}
public get totalItemsFound(): number
{
return this._totalItemsFound;
}
}

View File

@ -1,11 +1,9 @@
import { IMessageDataWrapper, IMessageParser } from '../../../../../../core';
import { IObjectData } from '../../../../../room/object/data/IObjectData';
import { ObjectDataFactory } from '../../../../../room/object/data/ObjectDataFactory';
import { LegacyDataType } from '../../../../../room/object/data/type/LegacyDataType';
import { MarketplaceOffer } from './MarketplaceOffer';
import { IMessageDataWrapper, IMessageParser } from '../../../../../core';
import { IObjectData, LegacyDataType, ObjectDataFactory } from '../../../../room';
import { MarketplaceOffer } from '../../incoming';
export class MarketplaceOwnItemsParser implements IMessageParser
export class MarketplaceOwnOffersParser implements IMessageParser
{
private static MAX_LIST_LENGTH = 500;
private _offers: MarketplaceOffer[];
@ -63,7 +61,7 @@ export class MarketplaceOwnItemsParser implements IMessageParser
const local10 = wrapper.readInt();
const local13 = new MarketplaceOffer(offerId, furniId, furniType, extraData, stuffData, price, status, local9, local10);
if(i < MarketplaceOwnItemsParser.MAX_LIST_LENGTH)
if(i < MarketplaceOwnOffersParser.MAX_LIST_LENGTH)
{
this._offers.push(local13);
}

View File

@ -0,0 +1,9 @@
export * from './MarketplaceBuyOfferResultParser';
export * from './MarketplaceCancelOfferResultParser';
export * from './MarketplaceCanMakeOfferResultParser';
export * from './MarketplaceConfigurationMessageParser';
export * from './MarketplaceItemPostedParser';
export * from './MarketplaceItemStatsParser';
export * from './MarketplaceOfferData';
export * from './MarketplaceOffersParser';
export * from './MarketplaceOwnOffersParser';