Update packets

This commit is contained in:
Bill 2021-06-05 23:48:44 -04:00
parent 33da59c3c2
commit f561b91e2f
11 changed files with 125 additions and 16 deletions

View File

@ -1,5 +1,5 @@
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration'; import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, SellablePetPalettesEvent } from './messages'; import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, ObjectsDataUpdateEvent, SellablePetPalettesEvent } from './messages';
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent'; import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
import { ChangeNameUpdateEvent } from './messages/incoming/avatar/ChangeNameUpdateEvent'; import { ChangeNameUpdateEvent } from './messages/incoming/avatar/ChangeNameUpdateEvent';
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent'; import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent';
@ -593,6 +593,7 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.LOVELOCK_FURNI_FINISHED, LoveLockFurniFinishedEvent); this._events.set(IncomingHeader.LOVELOCK_FURNI_FINISHED, LoveLockFurniFinishedEvent);
this._events.set(IncomingHeader.LOVELOCK_FURNI_FRIEND_COMFIRMED, LoveLockFurniFriendConfirmedEvent); this._events.set(IncomingHeader.LOVELOCK_FURNI_FRIEND_COMFIRMED, LoveLockFurniFriendConfirmedEvent);
this._events.set(IncomingHeader.LOVELOCK_FURNI_START, LoveLockFurniStartEvent); this._events.set(IncomingHeader.LOVELOCK_FURNI_START, LoveLockFurniStartEvent);
this._events.set(IncomingHeader.OBJECTS_DATA_UPDATE, ObjectsDataUpdateEvent);
// FLOOR // FLOOR
this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent); this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent);

View File

@ -247,4 +247,5 @@ export class IncomingHeader
public static MARKETPLACE_AFTER_ORDER_STATUS = 2032; public static MARKETPLACE_AFTER_ORDER_STATUS = 2032;
public static CATALOG_RECEIVE_PET_BREEDS = 3331; public static CATALOG_RECEIVE_PET_BREEDS = 3331;
public static CATALOG_APPROVE_NAME_RESULT = 1503; public static CATALOG_APPROVE_NAME_RESULT = 1503;
public static OBJECTS_DATA_UPDATE = 1453;
} }

View File

@ -0,0 +1,30 @@
import { IObjectData } from '../../../../../room';
export class ObjectData
{
private _id: number = 0;
private _state: number = 0;
private _data: IObjectData;
constructor(id: number, state: number, objectData: IObjectData)
{
this._id = id;
this._state = state;
this._data = objectData;
}
public get id(): number
{
return this._id;
}
public get state(): number
{
return this._state;
}
public get data(): IObjectData
{
return this._data;
}
}

View File

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

View File

@ -1,2 +1,4 @@
export * from './ObjectData';
export * from './ObjectsDataUpdateEvent';
export * from './ObjectsRollingEvent'; export * from './ObjectsRollingEvent';
export * from './RoomCreatedEvent'; export * from './RoomCreatedEvent';

View File

@ -0,0 +1,41 @@
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser';
import { ObjectData } from '../../../incoming/room/engine/ObjectData';
import { FurnitureDataParser } from '../furniture/FurnitureDataParser';
export class ObjectsDataUpdateParser implements IMessageParser
{
private _objects: ObjectData[];
public flush(): boolean
{
this._objects = [];
return true;
}
public parse(wrapper: IMessageDataWrapper): boolean
{
if(!wrapper) return false;
let totalObjects = wrapper.readInt();
while(totalObjects > 0)
{
const id = wrapper.readInt();
const stuffData = FurnitureDataParser.parseObjectData(wrapper);
const state = parseFloat(stuffData.getLegacyString());
this._objects.push(new ObjectData(id, state, stuffData));
totalObjects--;
}
return true;
}
public get objects(): ObjectData[]
{
return this._objects;
}
}

View File

@ -21,7 +21,7 @@ export class ObjectsRollingParser implements IMessageParser
public parse(wrapper: IMessageDataWrapper): boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(!wrapper) return; if(!wrapper) return false;
const x = wrapper.readInt(); const x = wrapper.readInt();
const y = wrapper.readInt(); const y = wrapper.readInt();

View File

@ -16,7 +16,7 @@ export class RoomCreatedParser implements IMessageParser
public parse(wrapper: IMessageDataWrapper): boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(!wrapper) return; if(!wrapper) return false;
this._roomId = wrapper.readInt(); this._roomId = wrapper.readInt();
this._roomName = wrapper.readString(); this._roomName = wrapper.readString();

View File

@ -1,2 +1,3 @@
export * from './ObjectsDataUpdateParser';
export * from './ObjectsRollingParser'; export * from './ObjectsRollingParser';
export * from './RoomCreatedParser'; export * from './RoomCreatedParser';

View File

@ -18,16 +18,16 @@ export class UserSubscriptionParser implements IMessageParser
public flush(): boolean public flush(): boolean
{ {
this._name = null; this._name = null;
this._days = 0; this._days = 0;
this._int1 = 0; this._int1 = 0;
this._months = 0; this._months = 0;
this._years = 0; this._years = 0;
this._hasEverBeenMember = false; this._hasEverBeenMember = false;
this._isVip = false; this._isVip = false;
this._pastClubDays = 0; this._pastClubDays = 0;
this._pastVIPDays = 0; this._pastVIPDays = 0;
this._totalSeconds = 0; this._totalSeconds = 0;
return true; return true;
} }
@ -45,7 +45,8 @@ export class UserSubscriptionParser implements IMessageParser
this._isVip = wrapper.readBoolean(); this._isVip = wrapper.readBoolean();
this._pastClubDays = wrapper.readInt(); this._pastClubDays = wrapper.readInt();
this._pastVIPDays = wrapper.readInt(); this._pastVIPDays = wrapper.readInt();
this._totalSeconds = wrapper.readInt();
if(wrapper.bytesAvailable) this._totalSeconds = wrapper.readInt();
return true; return true;
} }

View File

@ -3,6 +3,7 @@ import { IConnection } from '../../core/communication/connections/IConnection';
import { IVector3D } from '../../room/utils/IVector3D'; import { IVector3D } from '../../room/utils/IVector3D';
import { Vector3d } from '../../room/utils/Vector3d'; import { Vector3d } from '../../room/utils/Vector3d';
import { PetType } from '../avatar/pets/PetType'; import { PetType } from '../avatar/pets/PetType';
import { ObjectsDataUpdateEvent } from '../communication';
import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent'; import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent';
import { FurnitureFloorAddEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent'; import { FurnitureFloorAddEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent';
import { FurnitureFloorEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorEvent'; import { FurnitureFloorEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorEvent';
@ -113,6 +114,7 @@ export class RoomMessageHandler extends Disposable
this._connection.addMessageEvent(new RoomThicknessEvent(this.onRoomThicknessEvent.bind(this))); this._connection.addMessageEvent(new RoomThicknessEvent(this.onRoomThicknessEvent.bind(this)));
this._connection.addMessageEvent(new RoomDoorEvent(this.onRoomDoorEvent.bind(this))); this._connection.addMessageEvent(new RoomDoorEvent(this.onRoomDoorEvent.bind(this)));
this._connection.addMessageEvent(new ObjectsRollingEvent(this.onRoomRollingEvent.bind(this))); this._connection.addMessageEvent(new ObjectsRollingEvent(this.onRoomRollingEvent.bind(this)));
this._connection.addMessageEvent(new ObjectsDataUpdateEvent(this.onObjectsDataUpdateEvent.bind(this)));
this._connection.addMessageEvent(new FurnitureAliasesEvent(this.onFurnitureAliasesEvent.bind(this))); this._connection.addMessageEvent(new FurnitureAliasesEvent(this.onFurnitureAliasesEvent.bind(this)));
this._connection.addMessageEvent(new FurnitureFloorAddEvent(this.onFurnitureFloorAddEvent.bind(this))); this._connection.addMessageEvent(new FurnitureFloorAddEvent(this.onFurnitureFloorAddEvent.bind(this)));
this._connection.addMessageEvent(new FurnitureFloorEvent(this.onFurnitureFloorEvent.bind(this))); this._connection.addMessageEvent(new FurnitureFloorEvent(this.onFurnitureFloorEvent.bind(this)));
@ -459,6 +461,20 @@ export class RoomMessageHandler extends Disposable
} }
} }
private onObjectsDataUpdateEvent(event: ObjectsDataUpdateEvent): void
{
if(!(event instanceof ObjectsDataUpdateEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser();
if(!parser) return;
for(const object of parser.objects)
{
this._roomCreator.updateRoomObjectFloor(this._currentRoomId, object.id, null, null, object.state, object.data);
}
}
private onFurnitureAliasesEvent(event: FurnitureAliasesEvent): void private onFurnitureAliasesEvent(event: FurnitureAliasesEvent): void
{ {
if(!(event instanceof FurnitureAliasesEvent) || !event.connection || !this._roomCreator) return; if(!(event instanceof FurnitureAliasesEvent) || !event.connection || !this._roomCreator) return;