This commit is contained in:
dank074 2021-10-20 14:53:50 -05:00
commit abdbe7a542
5 changed files with 23 additions and 8 deletions

View File

@ -151,6 +151,7 @@ import { RoomUsersWithRightsEvent } from './messages/incoming/room/data/RoomUser
import { ObjectsDataUpdateEvent } from './messages/incoming/room/engine/ObjectsDataUpdateEvent'; import { ObjectsDataUpdateEvent } from './messages/incoming/room/engine/ObjectsDataUpdateEvent';
import { ObjectsRollingEvent } from './messages/incoming/room/engine/ObjectsRollingEvent'; import { ObjectsRollingEvent } from './messages/incoming/room/engine/ObjectsRollingEvent';
import { RoomCreatedEvent } from './messages/incoming/room/engine/RoomCreatedEvent'; import { RoomCreatedEvent } from './messages/incoming/room/engine/RoomCreatedEvent';
import { DiceValueMessageEvent } from './messages/incoming/room/furniture/DiceValueMessageEvent';
import { FurnitureFloorAddEvent } from './messages/incoming/room/furniture/floor/FurnitureFloorAddEvent'; import { FurnitureFloorAddEvent } from './messages/incoming/room/furniture/floor/FurnitureFloorAddEvent';
import { FurnitureFloorEvent } from './messages/incoming/room/furniture/floor/FurnitureFloorEvent'; import { FurnitureFloorEvent } from './messages/incoming/room/furniture/floor/FurnitureFloorEvent';
import { FurnitureFloorRemoveEvent } from './messages/incoming/room/furniture/floor/FurnitureFloorRemoveEvent'; import { FurnitureFloorRemoveEvent } from './messages/incoming/room/furniture/floor/FurnitureFloorRemoveEvent';
@ -160,7 +161,6 @@ import { FurnitureDataEvent } from './messages/incoming/room/furniture/Furniture
import { FurnitureItemDataEvent } from './messages/incoming/room/furniture/FurnitureItemDataEvent'; import { FurnitureItemDataEvent } from './messages/incoming/room/furniture/FurnitureItemDataEvent';
import { FurniturePostItStickyPoleOpenEvent } from './messages/incoming/room/furniture/FurniturePostItStickyPoleOpenEvent'; import { FurniturePostItStickyPoleOpenEvent } from './messages/incoming/room/furniture/FurniturePostItStickyPoleOpenEvent';
import { FurnitureStackHeightEvent } from './messages/incoming/room/furniture/FurnitureStackHeightEvent'; import { FurnitureStackHeightEvent } from './messages/incoming/room/furniture/FurnitureStackHeightEvent';
import { FurnitureState2Event } from './messages/incoming/room/furniture/FurnitureState2Event';
import { FurnitureStateEvent } from './messages/incoming/room/furniture/FurnitureStateEvent'; import { FurnitureStateEvent } from './messages/incoming/room/furniture/FurnitureStateEvent';
import { GroupFurniContextMenuInfoMessageEvent } from './messages/incoming/room/furniture/GroupFurniContextMenuInfoMessageEvent'; import { GroupFurniContextMenuInfoMessageEvent } from './messages/incoming/room/furniture/GroupFurniContextMenuInfoMessageEvent';
import { LoveLockFurniFinishedEvent } from './messages/incoming/room/furniture/LoveLockFurniFinishedEvent'; import { LoveLockFurniFinishedEvent } from './messages/incoming/room/furniture/LoveLockFurniFinishedEvent';
@ -753,7 +753,7 @@ export class NitroMessages implements IMessageConfiguration
this._events.set(IncomingHeader.ITEM_STACK_HELPER, FurnitureStackHeightEvent); this._events.set(IncomingHeader.ITEM_STACK_HELPER, FurnitureStackHeightEvent);
this._events.set(IncomingHeader.FURNITURE_STATE, FurnitureStateEvent); this._events.set(IncomingHeader.FURNITURE_STATE, FurnitureStateEvent);
this._events.set(IncomingHeader.ITEM_DIMMER_SETTINGS, RoomDimmerPresetsEvent); this._events.set(IncomingHeader.ITEM_DIMMER_SETTINGS, RoomDimmerPresetsEvent);
this._events.set(IncomingHeader.FURNITURE_STATE_2, FurnitureState2Event); this._events.set(IncomingHeader.FURNITURE_STATE_2, DiceValueMessageEvent);
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);

View File

@ -2,7 +2,7 @@ import { IMessageEvent } from '../../../../../../core/communication/messages/IMe
import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent';
import { FurnitureState2Parser } from '../../../parser/room/furniture/FurnitureState2Parser'; import { FurnitureState2Parser } from '../../../parser/room/furniture/FurnitureState2Parser';
export class FurnitureState2Event extends MessageEvent implements IMessageEvent export class DiceValueMessageEvent extends MessageEvent implements IMessageEvent
{ {
constructor(callBack: Function) constructor(callBack: Function)
{ {

View File

@ -1,10 +1,10 @@
export * from './DiceValueMessageEvent';
export * from './floor'; export * from './floor';
export * from './FurnitureAliasesEvent'; export * from './FurnitureAliasesEvent';
export * from './FurnitureDataEvent'; export * from './FurnitureDataEvent';
export * from './FurnitureItemDataEvent'; export * from './FurnitureItemDataEvent';
export * from './FurniturePostItStickyPoleOpenEvent'; export * from './FurniturePostItStickyPoleOpenEvent';
export * from './FurnitureStackHeightEvent'; export * from './FurnitureStackHeightEvent';
export * from './FurnitureState2Event';
export * from './FurnitureStateEvent'; export * from './FurnitureStateEvent';
export * from './GroupFurniContextMenuInfoMessageEvent'; export * from './GroupFurniContextMenuInfoMessageEvent';
export * from './LoveLockFurniFinishedEvent'; export * from './LoveLockFurniFinishedEvent';

View File

@ -5,6 +5,7 @@ import { Vector3d } from '../../room/utils/Vector3d';
import { PetType } from '../avatar/pets/PetType'; import { PetType } from '../avatar/pets/PetType';
import { ObjectsDataUpdateEvent, PetExperienceEvent } from '../communication'; import { ObjectsDataUpdateEvent, PetExperienceEvent } from '../communication';
import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent'; import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent';
import { DiceValueMessageEvent } from '../communication/messages/incoming/room/furniture/DiceValueMessageEvent';
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';
import { FurnitureFloorRemoveEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorRemoveEvent'; import { FurnitureFloorRemoveEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorRemoveEvent';
@ -12,7 +13,6 @@ import { FurnitureFloorUpdateEvent } from '../communication/messages/incoming/ro
import { FurnitureAliasesEvent } from '../communication/messages/incoming/room/furniture/FurnitureAliasesEvent'; import { FurnitureAliasesEvent } from '../communication/messages/incoming/room/furniture/FurnitureAliasesEvent';
import { FurnitureDataEvent } from '../communication/messages/incoming/room/furniture/FurnitureDataEvent'; import { FurnitureDataEvent } from '../communication/messages/incoming/room/furniture/FurnitureDataEvent';
import { FurnitureItemDataEvent } from '../communication/messages/incoming/room/furniture/FurnitureItemDataEvent'; import { FurnitureItemDataEvent } from '../communication/messages/incoming/room/furniture/FurnitureItemDataEvent';
import { FurnitureState2Event } from '../communication/messages/incoming/room/furniture/FurnitureState2Event';
import { FurnitureStateEvent } from '../communication/messages/incoming/room/furniture/FurnitureStateEvent'; import { FurnitureStateEvent } from '../communication/messages/incoming/room/furniture/FurnitureStateEvent';
import { FurnitureWallAddEvent } from '../communication/messages/incoming/room/furniture/wall/FurnitureWallAddEvent'; import { FurnitureWallAddEvent } from '../communication/messages/incoming/room/furniture/wall/FurnitureWallAddEvent';
import { FurnitureWallEvent } from '../communication/messages/incoming/room/furniture/wall/FurnitureWallEvent'; import { FurnitureWallEvent } from '../communication/messages/incoming/room/furniture/wall/FurnitureWallEvent';
@ -144,7 +144,7 @@ export class RoomMessageHandler extends Disposable
this._connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this))); this._connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this)));
this._connection.addMessageEvent(new PetExperienceEvent(this.onPetExperienceEvent.bind(this))); this._connection.addMessageEvent(new PetExperienceEvent(this.onPetExperienceEvent.bind(this)));
this._connection.addMessageEvent(new YouArePlayingGameEvent(this.onYouArePlayingGameEvent.bind(this))); this._connection.addMessageEvent(new YouArePlayingGameEvent(this.onYouArePlayingGameEvent.bind(this)));
this._connection.addMessageEvent(new FurnitureState2Event(this.onFurnitureState2Event.bind(this))); this._connection.addMessageEvent(new DiceValueMessageEvent(this.onDiceValueMessageEvent.bind(this)));
this._connection.addMessageEvent(new IgnoreResultEvent(this.onIgnoreResultEvent.bind(this))); this._connection.addMessageEvent(new IgnoreResultEvent(this.onIgnoreResultEvent.bind(this)));
} }
@ -645,9 +645,9 @@ export class RoomMessageHandler extends Disposable
this._roomCreator.updateRoomObjectFloor(this._currentRoomId, parser.itemId, null, null, parser.state, new LegacyDataType()); this._roomCreator.updateRoomObjectFloor(this._currentRoomId, parser.itemId, null, null, parser.state, new LegacyDataType());
} }
private onFurnitureState2Event(event: FurnitureState2Event): void private onDiceValueMessageEvent(event: DiceValueMessageEvent): void
{ {
if(!(event instanceof FurnitureState2Event) || !event.connection || !this._roomCreator) return; if(!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();

View File

@ -14,11 +14,26 @@ export class ColorConverter
return out; return out;
} }
public static hex2rgba(hex: number, out: Array<number> | Float32Array = []): Array<number> | Float32Array
{
out[0] = ((hex >> 16) & 0xFF) / 255;
out[1] = ((hex >> 8) & 0xFF) / 255;
out[2] = (hex & 0xFF) / 255;
out[3] = (hex & 0xFF);
return out;
}
public static rgb2hex(rgb: number[] | Float32Array): number public static rgb2hex(rgb: number[] | Float32Array): number
{ {
return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));
} }
public static rgba2hex(rgb: number[] | Float32Array): number
{
return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0) + (rgb[3] | 0));
}
public static rgbStringToHex(rgb: string): string public static rgbStringToHex(rgb: string): string
{ {
const extracted = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); const extracted = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);