mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-19 06:46:28 +01:00
Update packets
This commit is contained in:
parent
33da59c3c2
commit
f561b91e2f
@ -1,5 +1,5 @@
|
||||
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 { ChangeNameUpdateEvent } from './messages/incoming/avatar/ChangeNameUpdateEvent';
|
||||
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_FRIEND_COMFIRMED, LoveLockFurniFriendConfirmedEvent);
|
||||
this._events.set(IncomingHeader.LOVELOCK_FURNI_START, LoveLockFurniStartEvent);
|
||||
this._events.set(IncomingHeader.OBJECTS_DATA_UPDATE, ObjectsDataUpdateEvent);
|
||||
|
||||
// FLOOR
|
||||
this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent);
|
||||
|
@ -247,4 +247,5 @@ export class IncomingHeader
|
||||
public static MARKETPLACE_AFTER_ORDER_STATUS = 2032;
|
||||
public static CATALOG_RECEIVE_PET_BREEDS = 3331;
|
||||
public static CATALOG_APPROVE_NAME_RESULT = 1503;
|
||||
public static OBJECTS_DATA_UPDATE = 1453;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,2 +1,4 @@
|
||||
export * from './ObjectData';
|
||||
export * from './ObjectsDataUpdateEvent';
|
||||
export * from './ObjectsRollingEvent';
|
||||
export * from './RoomCreatedEvent';
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ export class ObjectsRollingParser implements IMessageParser
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return;
|
||||
if(!wrapper) return false;
|
||||
|
||||
const x = wrapper.readInt();
|
||||
const y = wrapper.readInt();
|
||||
@ -79,4 +79,4 @@ export class ObjectsRollingParser implements IMessageParser
|
||||
{
|
||||
return this._unitRolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export class RoomCreatedParser implements IMessageParser
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return;
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._roomId = wrapper.readInt();
|
||||
this._roomName = wrapper.readString();
|
||||
@ -33,4 +33,4 @@ export class RoomCreatedParser implements IMessageParser
|
||||
{
|
||||
return this._roomName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
export * from './ObjectsDataUpdateParser';
|
||||
export * from './ObjectsRollingParser';
|
||||
export * from './RoomCreatedParser';
|
||||
|
@ -18,16 +18,16 @@ export class UserSubscriptionParser implements IMessageParser
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._name = null;
|
||||
this._days = 0;
|
||||
this._int1 = 0;
|
||||
this._months = 0;
|
||||
this._years = 0;
|
||||
this._hasEverBeenMember = false;
|
||||
this._isVip = false;
|
||||
this._pastClubDays = 0;
|
||||
this._pastVIPDays = 0;
|
||||
this._totalSeconds = 0;
|
||||
this._name = null;
|
||||
this._days = 0;
|
||||
this._int1 = 0;
|
||||
this._months = 0;
|
||||
this._years = 0;
|
||||
this._hasEverBeenMember = false;
|
||||
this._isVip = false;
|
||||
this._pastClubDays = 0;
|
||||
this._pastVIPDays = 0;
|
||||
this._totalSeconds = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -45,7 +45,8 @@ export class UserSubscriptionParser implements IMessageParser
|
||||
this._isVip = wrapper.readBoolean();
|
||||
this._pastClubDays = wrapper.readInt();
|
||||
this._pastVIPDays = wrapper.readInt();
|
||||
this._totalSeconds = wrapper.readInt();
|
||||
|
||||
if(wrapper.bytesAvailable) this._totalSeconds = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import { IConnection } from '../../core/communication/connections/IConnection';
|
||||
import { IVector3D } from '../../room/utils/IVector3D';
|
||||
import { Vector3d } from '../../room/utils/Vector3d';
|
||||
import { PetType } from '../avatar/pets/PetType';
|
||||
import { ObjectsDataUpdateEvent } from '../communication';
|
||||
import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent';
|
||||
import { FurnitureFloorAddEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent';
|
||||
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 RoomDoorEvent(this.onRoomDoorEvent.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 FurnitureFloorAddEvent(this.onFurnitureFloorAddEvent.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
|
||||
{
|
||||
if(!(event instanceof FurnitureAliasesEvent) || !event.connection || !this._roomCreator) return;
|
||||
|
Loading…
Reference in New Issue
Block a user