cleaned PresentOpenedParser

This commit is contained in:
Dank074 2021-06-23 03:55:45 -05:00
parent b2b94ca764
commit 436905d5b6
12 changed files with 105 additions and 107 deletions

View File

@ -69,7 +69,7 @@ import { FurnitureListEvent } from './messages/incoming/inventory/furni/Furnitur
import { FurnitureListInvalidateEvent } from './messages/incoming/inventory/furni/FurnitureListInvalidateEvent';
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 { 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';
@ -696,7 +696,7 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.MESSENGER_RELATIONSHIPS, UserRelationshipsEvent);
// GIFTS
this._events.set(IncomingHeader.GIFT_OPENED, FurnitureGiftOpenedEvent);
this._events.set(IncomingHeader.GIFT_OPENED, PresentOpenedMessageEvent);
// INVENTORY
this._events.set(IncomingHeader.GIFT_RECEIVER_NOT_FOUND, CatalogGiftUsernameUnavailableEvent);

View File

@ -1,17 +0,0 @@
import { IMessageEvent } from '../../../../../../../core/communication/messages/IMessageEvent';
import { MessageEvent } from '../../../../../../../core/communication/messages/MessageEvent';
import { FurnitureGiftOpenedParser } from '../../../../parser/inventory/furniture/FurnitureGiftOpenedParser';
// see _Str_9591
export class FurnitureGiftOpenedEvent extends MessageEvent implements IMessageEvent
{
constructor(callBack: Function)
{
super(callBack, FurnitureGiftOpenedParser);
}
public getParser(): FurnitureGiftOpenedParser
{
return this.parser as FurnitureGiftOpenedParser;
}
}

View File

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

View File

@ -1 +1 @@
export * from './FurnitureGiftOpenedEvent';
export * from './PresentOpenedMessageEvent';

View File

@ -4,8 +4,8 @@ import { WiredRewardResultMessageParser } from '../../parser/roomevents/WiredRew
export class WiredRewardResultMessageEvent extends MessageEvent implements IMessageEvent
{
public static _Str_18436: number = 6;
public static _Str_17787: number = 7;
public static PRODUCT_DONATED_CODE: number = 6;
public static BADGE_DONATED_CODE: number = 7;
constructor(callBack: Function)
{

View File

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

View File

@ -1,72 +0,0 @@
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser';
// see _Str_8104
export class FurnitureGiftOpenedParser implements IMessageParser
{
private _Str_2625: string;
private _Str_2825: number;
private _Str_2570: string;
private _Str_3054: number;
private _Str_3970: string;
private _Str_3224: boolean;
private _Str_10229: string;
public flush(): boolean
{
this._Str_2625 = '';
this._Str_2825 = 0;
this._Str_2570 = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._Str_2625 = wrapper.readString();
this._Str_2825 = wrapper.readInt();
this._Str_2570 = wrapper.readString();
this._Str_3054 = wrapper.readInt();
this._Str_3970 = wrapper.readString();
this._Str_3224 = wrapper.readBoolean();
this._Str_10229 = wrapper.readString();
return true;
}
public get _Str_2887():string
{
return this._Str_2625;
}
public get classId():number
{
return this._Str_2825;
}
public get productCode():string
{
return this._Str_2570;
}
public get placedItemId():number
{
return this._Str_3054;
}
public get placedItemType():string
{
return this._Str_3970;
}
public get placedInRoom():boolean
{
return this._Str_3224;
}
public get petFigureString():string
{
return this._Str_10229;
}
}

View File

@ -0,0 +1,71 @@
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser';
export class PresentOpenedMessageParser implements IMessageParser
{
private _itemType: string;
private _classId: number;
private _productCode: string;
private _placedItemId: number;
private _placedItemType: string;
private _placedInRoom: boolean;
private _petFigureString: string;
public flush(): boolean
{
this._itemType = '';
this._classId = 0;
this._productCode = '';
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
this._itemType = wrapper.readString();
this._classId = wrapper.readInt();
this._productCode = wrapper.readString();
this._placedItemId = wrapper.readInt();
this._placedItemType = wrapper.readString();
this._placedInRoom = wrapper.readBoolean();
this._petFigureString = wrapper.readString();
return true;
}
public get itemType():string
{
return this._itemType;
}
public get classId():number
{
return this._classId;
}
public get productCode():string
{
return this._productCode;
}
public get placedItemId():number
{
return this._placedItemId;
}
public get placedItemType():string
{
return this._placedItemType;
}
public get placedInRoom():boolean
{
return this._placedInRoom;
}
public get petFigureString():string
{
return this._petFigureString;
}
}

View File

@ -1,7 +1,7 @@
export * from './FurnitureGiftOpenedParser';
export * from './FurnitureListAddOrUpdateParser';
export * from './FurnitureListInvalidateParser';
export * from './FurnitureListParser';
export * from './FurnitureListRemovedParser';
export * from './FurniturePostItPlacedParser';
export * from './PresentOpenedMessageParser';
export * from './utils';

View File

@ -39,7 +39,7 @@ export class UserMessageData
this._roomIndex = k;
}
public _Str_4710(): void
public setReadOnly(): void
{
this._isReadOnly = true;
}

View File

@ -2,18 +2,18 @@
export class SessionDataPreferencesEvent extends NitroEvent
{
public static APUE_UPDATED: string = 'APUE_UPDATED';
public static UPDATED: string = 'APUE_UPDATED';
private _uiFlags: number;
constructor(k: number)
{
super(SessionDataPreferencesEvent.APUE_UPDATED);
super(SessionDataPreferencesEvent.UPDATED);
this._uiFlags = k;
}
public get _Str_8444(): number
public get uiFlags(): number
{
return this._uiFlags;
}

View File

@ -1,5 +1,5 @@
import { IConnection } from '../../../core/communication/connections/IConnection';
import { FurnitureGiftOpenedEvent } from '../../communication/messages/incoming/inventory/furni/gifts/FurnitureGiftOpenedEvent';
import { PresentOpenedMessageEvent } from '../../communication/messages/incoming/inventory/furni/gifts/PresentOpenedMessageEvent';
import { RoomSessionPresentEvent } from '../events/RoomSessionPresentEvent';
import { IRoomHandlerListener } from '../IRoomHandlerListener';
import { BaseHandler } from './BaseHandler';
@ -12,10 +12,10 @@ export class RoomPresentHandler extends BaseHandler
if(!connection) return;
connection.addMessageEvent(new FurnitureGiftOpenedEvent(this.onFurnitureGiftOpenedEvent.bind(this)));
connection.addMessageEvent(new PresentOpenedMessageEvent(this.onFurnitureGiftOpenedEvent.bind(this)));
}
private onFurnitureGiftOpenedEvent(event: FurnitureGiftOpenedEvent): void
private onFurnitureGiftOpenedEvent(event: PresentOpenedMessageEvent): void
{
if(!event) return;
@ -28,7 +28,7 @@ export class RoomPresentHandler extends BaseHandler
if(!session) return;
if(this.listener && this.listener.events) this.listener.events.dispatchEvent(
new RoomSessionPresentEvent(RoomSessionPresentEvent.RSPE_PRESENT_OPENED, session, parser.classId, parser._Str_2887,
new RoomSessionPresentEvent(RoomSessionPresentEvent.RSPE_PRESENT_OPENED, session, parser.classId, parser.itemType,
parser.productCode, parser.placedItemId, parser.placedItemType, parser.placedInRoom, parser.petFigureString));
}