diff --git a/packages/api/src/nitro/avatar/IAvatarImage.ts b/packages/api/src/nitro/avatar/IAvatarImage.ts index d8d5052..72ce55e 100644 --- a/packages/api/src/nitro/avatar/IAvatarImage.ts +++ b/packages/api/src/nitro/avatar/IAvatarImage.ts @@ -1,4 +1,5 @@ import { Container, Texture } from 'pixi.js'; +import { IActiveActionData } from './actions'; import { IAvatarFigureContainer } from './IAvatarFigureContainer'; import { IAnimationLayerData, ISpriteDataContainer } from './animation'; import { IPartColor } from './structure'; @@ -18,6 +19,7 @@ export interface IAvatarImage getDirection(): number; getFigure(): IAvatarFigureContainer; getPartColor(_arg_1: string): IPartColor; + getMainAction(): IActiveActionData; isAnimating(): boolean; getCanvasOffsets(): number[]; initActionAppends(): void; diff --git a/packages/api/src/nitro/avatar/enum/AvatarEditorFigureCategory.ts b/packages/api/src/nitro/avatar/enum/AvatarEditorFigureCategory.ts index c66a37d..f52d082 100644 --- a/packages/api/src/nitro/avatar/enum/AvatarEditorFigureCategory.ts +++ b/packages/api/src/nitro/avatar/enum/AvatarEditorFigureCategory.ts @@ -8,5 +8,6 @@ public static WARDROBE: string = 'wardrobe'; public static EFFECTS: string = 'effects'; public static PETS: string = 'pets'; + public static MISC: string = 'misc'; public static NFT: string = 'nft'; } diff --git a/packages/api/src/nitro/avatar/enum/AvatarFigurePartType.ts b/packages/api/src/nitro/avatar/enum/AvatarFigurePartType.ts index 214f285..d6eb04c 100644 --- a/packages/api/src/nitro/avatar/enum/AvatarFigurePartType.ts +++ b/packages/api/src/nitro/avatar/enum/AvatarFigurePartType.ts @@ -32,5 +32,6 @@ public static LEFT_COAT_SLEEVE: string = 'lc'; public static RIGHT_COAT_SLEEVE: string = 'rc'; public static PET: string = 'pt'; - public static FIGURE_SETS: string[] = [ AvatarFigurePartType.SHOES, AvatarFigurePartType.LEGS, AvatarFigurePartType.CHEST, AvatarFigurePartType.WAIST_ACCESSORY, AvatarFigurePartType.CHEST_ACCESSORY, AvatarFigurePartType.HEAD, AvatarFigurePartType.HAIR, AvatarFigurePartType.FACE_ACCESSORY, AvatarFigurePartType.EYE_ACCESSORY, AvatarFigurePartType.HEAD_ACCESSORY, AvatarFigurePartType.HEAD_ACCESSORY_EXTRA, AvatarFigurePartType.COAT_CHEST, AvatarFigurePartType.CHEST_PRINT, AvatarFigurePartType.PET ]; + public static MISC: string = 'mc'; + public static FIGURE_SETS: string[] = [ AvatarFigurePartType.SHOES, AvatarFigurePartType.LEGS, AvatarFigurePartType.CHEST, AvatarFigurePartType.WAIST_ACCESSORY, AvatarFigurePartType.CHEST_ACCESSORY, AvatarFigurePartType.HEAD, AvatarFigurePartType.HAIR, AvatarFigurePartType.FACE_ACCESSORY, AvatarFigurePartType.EYE_ACCESSORY, AvatarFigurePartType.HEAD_ACCESSORY, AvatarFigurePartType.HEAD_ACCESSORY_EXTRA, AvatarFigurePartType.COAT_CHEST, AvatarFigurePartType.CHEST_PRINT, AvatarFigurePartType.PET, AvatarFigurePartType.MISC ]; } diff --git a/packages/avatar/src/AvatarImage.ts b/packages/avatar/src/AvatarImage.ts index 6f7e92b..27b17e4 100644 --- a/packages/avatar/src/AvatarImage.ts +++ b/packages/avatar/src/AvatarImage.ts @@ -158,6 +158,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener return this._canvasOffsets; } + public getMainAction(): IActiveActionData + { + return this._mainAction; + } + public getLayerData(k: ISpriteDataContainer): IAnimationLayerData { return this._structure.getBodyPartData(k.animation.id, this._frameCounter, k.id); @@ -314,6 +319,9 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener const canvas = GetRenderer().texture.generateCanvas(texture); const url = canvas.toDataURL('image/png'); + + canvas.width = 0; + canvas.height = 0; return url; } diff --git a/packages/avatar/src/AvatarStructure.ts b/packages/avatar/src/AvatarStructure.ts index d3fff55..024cbf8 100644 --- a/packages/avatar/src/AvatarStructure.ts +++ b/packages/avatar/src/AvatarStructure.ts @@ -366,6 +366,9 @@ export class AvatarStructure const visiblePartTypes = this._geometry.getParts(geometryType, bodyPartId, direction, activePartTypes, avatar); const figurePartTypeIds = figureContainer.getPartTypeIds(); + const mainAction = avatar?.getMainAction?.(); + const isSittingPosture = (mainAction?.definition?.assetPartDefinition === 'sit') + || (action.definition.assetPartDefinition === 'sit'); for(const figurePartType of figurePartTypeIds) { @@ -390,8 +393,44 @@ export class AvatarStructure { removes = removes.concat(figurePartSet.hiddenLayers); + let petHasVisibleSit = false; + + if(isSittingPosture && figurePartType === 'pt') + { + for(const fp of figurePartSet.parts) + { + if(fp.type === 'pt') + { + for(const dir of ['0', '2']) + { + const assetName = 'h_sit_pt_' + fp.id + '_' + dir + '_0'; + const testAsset = this._renderManager.getAssetByName(assetName); + + if(testAsset && testAsset.width > 1 && testAsset.height > 1 && testAsset.source === assetName) + { + const stdName = 'h_std_pt_' + fp.id + '_' + dir + '_0'; + const stdAsset = this._renderManager.getAssetByName(stdName); + + if(!stdAsset || stdAsset.source !== assetName) + { + petHasVisibleSit = true; + break; + } + } + } + + break; + } + } + } + for(const figurePart of figurePartSet.parts) { + if(isSittingPosture && figurePartType === 'pt') + { + if(petHasVisibleSit && figurePart.type !== 'pt') continue; + if(!petHasVisibleSit) continue; + } if(visiblePartTypes.indexOf(figurePart.type) > -1) { if(animationAction) diff --git a/packages/avatar/src/cache/AvatarImageCache.ts b/packages/avatar/src/cache/AvatarImageCache.ts index a2d457e..30c2dc1 100644 --- a/packages/avatar/src/cache/AvatarImageCache.ts +++ b/packages/avatar/src/cache/AvatarImageCache.ts @@ -139,6 +139,8 @@ export class AvatarImageCache if((((this._geometryType === GeometryType.SITTING) && (k === GeometryType.VERTICAL)) || ((this._geometryType === GeometryType.VERTICAL) && (k === GeometryType.SITTING)) || ((this._geometryType === GeometryType.SNOWWARS_HORIZONTAL) && (k = GeometryType.SNOWWARS_HORIZONTAL)))) { + this.disposeInactiveActions(0); + this._geometryType = k; this._canvas = null; this._defaultAction = (k === GeometryType.HORIZONTAL) ? 'lay' : 'std'; diff --git a/packages/avatar/src/cache/ImageData.ts b/packages/avatar/src/cache/ImageData.ts index c43c2c2..7e5789a 100644 --- a/packages/avatar/src/cache/ImageData.ts +++ b/packages/avatar/src/cache/ImageData.ts @@ -23,6 +23,12 @@ export class ImageData public dispose(): void { + if(this._container) + { + this._container.destroy({ children: true }); + this._container = null; + } + this._texture = null; this._regPoint = null; this._colorTransform = null; diff --git a/packages/avatar/src/data/HabboAvatarAnimations.ts b/packages/avatar/src/data/HabboAvatarAnimations.ts index 867ff9e..84d8c53 100644 --- a/packages/avatar/src/data/HabboAvatarAnimations.ts +++ b/packages/avatar/src/data/HabboAvatarAnimations.ts @@ -249,6 +249,45 @@ export const HabboAvatarAnimations = { { 'number': 6, 'assetPartDefinition': 'std' }, { 'number': 7, 'assetPartDefinition': 'std' } ] + }, + { + 'setType': 'mc', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'std' }, + { 'number': 1, 'assetPartDefinition': 'std' }, + { 'number': 2, 'assetPartDefinition': 'std' }, + { 'number': 3, 'assetPartDefinition': 'std' }, + { 'number': 4, 'assetPartDefinition': 'std' }, + { 'number': 5, 'assetPartDefinition': 'std' }, + { 'number': 6, 'assetPartDefinition': 'std' }, + { 'number': 7, 'assetPartDefinition': 'std' } + ] + }, + { + 'setType': 'mcl', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'std' }, + { 'number': 1, 'assetPartDefinition': 'std' }, + { 'number': 2, 'assetPartDefinition': 'std' }, + { 'number': 3, 'assetPartDefinition': 'std' }, + { 'number': 4, 'assetPartDefinition': 'std' }, + { 'number': 5, 'assetPartDefinition': 'std' }, + { 'number': 6, 'assetPartDefinition': 'std' }, + { 'number': 7, 'assetPartDefinition': 'std' } + ] + }, + { + 'setType': 'mcr', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'std' }, + { 'number': 1, 'assetPartDefinition': 'std' }, + { 'number': 2, 'assetPartDefinition': 'std' }, + { 'number': 3, 'assetPartDefinition': 'std' }, + { 'number': 4, 'assetPartDefinition': 'std' }, + { 'number': 5, 'assetPartDefinition': 'std' }, + { 'number': 6, 'assetPartDefinition': 'std' }, + { 'number': 7, 'assetPartDefinition': 'std' } + ] } ] }, @@ -410,6 +449,45 @@ export const HabboAvatarAnimations = { { 'number': 6, 'assetPartDefinition': 'sit' }, { 'number': 7, 'assetPartDefinition': 'sit' } ] + }, + { + 'setType': 'mc', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'sit' }, + { 'number': 1, 'assetPartDefinition': 'sit' }, + { 'number': 2, 'assetPartDefinition': 'sit' }, + { 'number': 3, 'assetPartDefinition': 'sit' }, + { 'number': 4, 'assetPartDefinition': 'sit' }, + { 'number': 5, 'assetPartDefinition': 'sit' }, + { 'number': 6, 'assetPartDefinition': 'sit' }, + { 'number': 7, 'assetPartDefinition': 'sit' } + ] + }, + { + 'setType': 'mcl', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'sit' }, + { 'number': 1, 'assetPartDefinition': 'sit' }, + { 'number': 2, 'assetPartDefinition': 'sit' }, + { 'number': 3, 'assetPartDefinition': 'sit' }, + { 'number': 4, 'assetPartDefinition': 'sit' }, + { 'number': 5, 'assetPartDefinition': 'sit' }, + { 'number': 6, 'assetPartDefinition': 'sit' }, + { 'number': 7, 'assetPartDefinition': 'sit' } + ] + }, + { + 'setType': 'mcr', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'sit' }, + { 'number': 1, 'assetPartDefinition': 'sit' }, + { 'number': 2, 'assetPartDefinition': 'sit' }, + { 'number': 3, 'assetPartDefinition': 'sit' }, + { 'number': 4, 'assetPartDefinition': 'sit' }, + { 'number': 5, 'assetPartDefinition': 'sit' }, + { 'number': 6, 'assetPartDefinition': 'sit' }, + { 'number': 7, 'assetPartDefinition': 'sit' } + ] } ] }, @@ -584,6 +662,45 @@ export const HabboAvatarAnimations = { { 'number': 6, 'assetPartDefinition': 'lay' }, { 'number': 7, 'assetPartDefinition': 'lay' } ] + }, + { + 'setType': 'mc', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'lay' }, + { 'number': 1, 'assetPartDefinition': 'lay' }, + { 'number': 2, 'assetPartDefinition': 'lay' }, + { 'number': 3, 'assetPartDefinition': 'lay' }, + { 'number': 4, 'assetPartDefinition': 'lay' }, + { 'number': 5, 'assetPartDefinition': 'lay' }, + { 'number': 6, 'assetPartDefinition': 'lay' }, + { 'number': 7, 'assetPartDefinition': 'lay' } + ] + }, + { + 'setType': 'mcl', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'lay' }, + { 'number': 1, 'assetPartDefinition': 'lay' }, + { 'number': 2, 'assetPartDefinition': 'lay' }, + { 'number': 3, 'assetPartDefinition': 'lay' }, + { 'number': 4, 'assetPartDefinition': 'lay' }, + { 'number': 5, 'assetPartDefinition': 'lay' }, + { 'number': 6, 'assetPartDefinition': 'lay' }, + { 'number': 7, 'assetPartDefinition': 'lay' } + ] + }, + { + 'setType': 'mcr', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'lay' }, + { 'number': 1, 'assetPartDefinition': 'lay' }, + { 'number': 2, 'assetPartDefinition': 'lay' }, + { 'number': 3, 'assetPartDefinition': 'lay' }, + { 'number': 4, 'assetPartDefinition': 'lay' }, + { 'number': 5, 'assetPartDefinition': 'lay' }, + { 'number': 6, 'assetPartDefinition': 'lay' }, + { 'number': 7, 'assetPartDefinition': 'lay' } + ] } ] }, @@ -910,6 +1027,33 @@ export const HabboAvatarAnimations = { { 'number': 2, 'assetPartDefinition': 'wlk' }, { 'number': 3, 'assetPartDefinition': 'wlk' } ] + }, + { + 'setType': 'mc', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'wlk' }, + { 'number': 1, 'assetPartDefinition': 'wlk' }, + { 'number': 2, 'assetPartDefinition': 'wlk' }, + { 'number': 3, 'assetPartDefinition': 'wlk' } + ] + }, + { + 'setType': 'mcl', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'wlk' }, + { 'number': 1, 'assetPartDefinition': 'wlk' }, + { 'number': 2, 'assetPartDefinition': 'wlk' }, + { 'number': 3, 'assetPartDefinition': 'wlk' } + ] + }, + { + 'setType': 'mcr', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'wlk' }, + { 'number': 1, 'assetPartDefinition': 'wlk' }, + { 'number': 2, 'assetPartDefinition': 'wlk' }, + { 'number': 3, 'assetPartDefinition': 'wlk' } + ] } ] }, @@ -1009,6 +1153,27 @@ export const HabboAvatarAnimations = { { 'number': 0, 'assetPartDefinition': 'wav' }, { 'number': 1, 'assetPartDefinition': 'wav' } ] + }, + { + 'setType': 'mc', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'wav' }, + { 'number': 1, 'assetPartDefinition': 'wav' } + ] + }, + { + 'setType': 'mcl', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'wav' }, + { 'number': 1, 'assetPartDefinition': 'wav' } + ] + }, + { + 'setType': 'mcr', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'wav' }, + { 'number': 1, 'assetPartDefinition': 'wav' } + ] } ] }, @@ -1239,6 +1404,24 @@ export const HabboAvatarAnimations = { 'frames': [ { 'number': 0, 'assetPartDefinition': 'std' } ] + }, + { + 'setType': 'mc', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'std' } + ] + }, + { + 'setType': 'mcl', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'std' } + ] + }, + { + 'setType': 'mcr', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'std' } + ] } ] }, @@ -1317,6 +1500,24 @@ export const HabboAvatarAnimations = { 'frames': [ { 'number': 0, 'assetPartDefinition': 'drk' } ] + }, + { + 'setType': 'mc', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'drk' } + ] + }, + { + 'setType': 'mcl', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'drk' } + ] + }, + { + 'setType': 'mcr', + 'frames': [ + { 'number': 0, 'assetPartDefinition': 'drk' } + ] } ], 'offsets': { diff --git a/packages/avatar/src/data/HabboAvatarGeometry.ts b/packages/avatar/src/data/HabboAvatarGeometry.ts index 64d48d4..c3028b6 100644 --- a/packages/avatar/src/data/HabboAvatarGeometry.ts +++ b/packages/avatar/src/data/HabboAvatarGeometry.ts @@ -278,6 +278,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -382,6 +393,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcl', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -446,6 +468,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -710,6 +743,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -814,6 +858,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcl', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -878,6 +933,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -1121,6 +1187,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -1225,6 +1302,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcl', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -1289,6 +1377,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -1532,6 +1631,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -1636,6 +1746,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcl', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, @@ -1700,6 +1821,17 @@ export const HabboAvatarGeometry = { 'ny': 0, 'nz': -1, 'double': false + }, + { + 'id': 'mcr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false } ] }, diff --git a/packages/avatar/src/data/HabboAvatarPartSets.ts b/packages/avatar/src/data/HabboAvatarPartSets.ts index 4e91647..cd89a8c 100644 --- a/packages/avatar/src/data/HabboAvatarPartSets.ts +++ b/packages/avatar/src/data/HabboAvatarPartSets.ts @@ -114,6 +114,17 @@ export const HabboAvatarPartSets = { { 'setType': 'ptr', 'flippedSetType': 'ptl' + }, + { + 'setType': 'mc' + }, + { + 'setType': 'mcl', + 'flippedSetType': 'mcr' + }, + { + 'setType': 'mcr', + 'flippedSetType': 'mcl' } ], 'activePartSets': [ @@ -212,6 +223,15 @@ export const HabboAvatarPartSets = { }, { 'setType': 'ptr' + }, + { + 'setType': 'mc' + }, + { + 'setType': 'mcl' + }, + { + 'setType': 'mcr' } ] }, diff --git a/packages/camera/src/RoomCameraWidgetManager.ts b/packages/camera/src/RoomCameraWidgetManager.ts index 1d28a4c..f45f933 100644 --- a/packages/camera/src/RoomCameraWidgetManager.ts +++ b/packages/camera/src/RoomCameraWidgetManager.ts @@ -117,7 +117,12 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager TextureUtils.writeToTexture(container, renderTexture); - return await TextureUtils.generateImage(renderTexture); + const image = await TextureUtils.generateImage(renderTexture); + + renderTexture.destroy(true); + container.destroy({ children: true }); + + return image; } public get effects(): Map diff --git a/packages/communication/src/index.ts b/packages/communication/src/index.ts index 9d63e66..5f617ab 100644 --- a/packages/communication/src/index.ts +++ b/packages/communication/src/index.ts @@ -66,6 +66,7 @@ export * from './messages/incoming/room/furniture'; export * from './messages/incoming/room/furniture/floor'; export * from './messages/incoming/room/furniture/wall'; export * from './messages/incoming/room/furniture/youtube'; +export * from './messages/incoming/room/youtube'; export * from './messages/incoming/room/mapping'; export * from './messages/incoming/room/pet'; export * from './messages/incoming/room/session'; @@ -143,6 +144,7 @@ export * from './messages/outgoing/room/furniture/presents'; export * from './messages/outgoing/room/furniture/toner'; export * from './messages/outgoing/room/furniture/wall'; export * from './messages/outgoing/room/furniture/youtube'; +export * from './messages/outgoing/room/youtube'; export * from './messages/outgoing/room/layout'; export * from './messages/outgoing/room/pets'; export * from './messages/outgoing/room/session'; @@ -225,6 +227,7 @@ export * from './messages/parser/room/furniture'; export * from './messages/parser/room/furniture/floor'; export * from './messages/parser/room/furniture/wall'; export * from './messages/parser/room/furniture/youtube'; +export * from './messages/parser/room/youtube'; export * from './messages/parser/room/mapping'; export * from './messages/parser/room/pet'; export * from './messages/parser/room/session'; diff --git a/packages/communication/src/messages/incoming/index.ts b/packages/communication/src/messages/incoming/index.ts index a61a7ed..5584383 100644 --- a/packages/communication/src/messages/incoming/index.ts +++ b/packages/communication/src/messages/incoming/index.ts @@ -58,6 +58,7 @@ export * from './room/furniture'; export * from './room/furniture/floor'; export * from './room/furniture/wall'; export * from './room/furniture/youtube'; +export * from './room/youtube'; export * from './room/mapping'; export * from './room/pet'; export * from './room/session'; diff --git a/packages/communication/src/messages/incoming/room/index.ts b/packages/communication/src/messages/incoming/room/index.ts index 0bab99d..81b327b 100644 --- a/packages/communication/src/messages/incoming/room/index.ts +++ b/packages/communication/src/messages/incoming/room/index.ts @@ -13,4 +13,3 @@ export * from './pet'; export * from './session'; export * from './unit'; export * from './unit/chat'; -export * from './youtube'; diff --git a/packages/communication/src/messages/outgoing/catalog/CatalogAdminCreateOfferComposer.ts b/packages/communication/src/messages/outgoing/catalog/CatalogAdminCreateOfferComposer.ts index 5bbd2ef..f964b6f 100644 --- a/packages/communication/src/messages/outgoing/catalog/CatalogAdminCreateOfferComposer.ts +++ b/packages/communication/src/messages/outgoing/catalog/CatalogAdminCreateOfferComposer.ts @@ -4,9 +4,9 @@ export class CatalogAdminCreateOfferComposer implements IMessageComposer; - constructor(pageId: number, itemId: number, catalogName: string, costCredits: number, costPoints: number, pointsType: number, amount: number, clubOnly: number, extradata: string, haveOffer: boolean, offerIdGroup: number, limitedStack: number, orderNumber: number, catalogMode: string = 'NORMAL') + constructor(pageId: number, itemIds: string, catalogName: string, costCredits: number, costPoints: number, pointsType: number, amount: number, clubOnly: number, extradata: string, haveOffer: boolean, offerIdGroup: number, limitedStack: number, orderNumber: number, catalogMode: string = 'NORMAL') { - this._data = [ pageId, itemId, catalogName, costCredits, costPoints, pointsType, amount, clubOnly, extradata, haveOffer, offerIdGroup, limitedStack, orderNumber, catalogMode ]; + this._data = [ pageId, itemIds, catalogName, costCredits, costPoints, pointsType, amount, clubOnly, extradata, haveOffer, offerIdGroup, limitedStack, orderNumber, catalogMode ]; } dispose(): void diff --git a/packages/communication/src/messages/outgoing/catalog/CatalogAdminSaveOfferComposer.ts b/packages/communication/src/messages/outgoing/catalog/CatalogAdminSaveOfferComposer.ts index 7b399a9..521ac32 100644 --- a/packages/communication/src/messages/outgoing/catalog/CatalogAdminSaveOfferComposer.ts +++ b/packages/communication/src/messages/outgoing/catalog/CatalogAdminSaveOfferComposer.ts @@ -4,9 +4,9 @@ export class CatalogAdminSaveOfferComposer implements IMessageComposer; - constructor(offerId: number, pageId: number, itemId: number, catalogName: string, costCredits: number, costPoints: number, pointsType: number, amount: number, clubOnly: number, extradata: string, haveOffer: boolean, offerIdGroup: number, limitedStack: number, orderNumber: number, catalogMode: string = 'NORMAL') + constructor(offerId: number, pageId: number, itemIds: string, catalogName: string, costCredits: number, costPoints: number, pointsType: number, amount: number, clubOnly: number, extradata: string, haveOffer: boolean, offerIdGroup: number, limitedStack: number, orderNumber: number, catalogMode: string = 'NORMAL') { - this._data = [ offerId, pageId, itemId, catalogName, costCredits, costPoints, pointsType, amount, clubOnly, extradata, haveOffer, offerIdGroup, limitedStack, orderNumber, catalogMode ]; + this._data = [ offerId, pageId, itemIds, catalogName, costCredits, costPoints, pointsType, amount, clubOnly, extradata, haveOffer, offerIdGroup, limitedStack, orderNumber, catalogMode ]; } dispose(): void diff --git a/packages/communication/src/messages/outgoing/catalog/CatalogAdminSavePageIconComposer.ts b/packages/communication/src/messages/outgoing/catalog/CatalogAdminSavePageIconComposer.ts new file mode 100644 index 0000000..2a6a09a --- /dev/null +++ b/packages/communication/src/messages/outgoing/catalog/CatalogAdminSavePageIconComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '@nitrots/api'; + +export class CatalogAdminSavePageIconComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(pageId: number, iconId: number) + { + this._data = [ pageId, iconId ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/packages/communication/src/messages/outgoing/catalog/CatalogAdminSavePageImagesComposer.ts b/packages/communication/src/messages/outgoing/catalog/CatalogAdminSavePageImagesComposer.ts new file mode 100644 index 0000000..cb1484c --- /dev/null +++ b/packages/communication/src/messages/outgoing/catalog/CatalogAdminSavePageImagesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '@nitrots/api'; + +export class CatalogAdminSavePageImagesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(pageId: number, headerImage: string, teaserImage: string) + { + this._data = [ pageId, headerImage, teaserImage ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/packages/communication/src/messages/outgoing/index.ts b/packages/communication/src/messages/outgoing/index.ts index dfea14d..10e3549 100644 --- a/packages/communication/src/messages/outgoing/index.ts +++ b/packages/communication/src/messages/outgoing/index.ts @@ -55,6 +55,7 @@ export * from './room/furniture/presents'; export * from './room/furniture/toner'; export * from './room/furniture/wall'; export * from './room/furniture/youtube'; +export * from './room/youtube'; export * from './room/layout'; export * from './room/pets'; export * from './room/session'; diff --git a/packages/communication/src/messages/outgoing/room/index.ts b/packages/communication/src/messages/outgoing/room/index.ts index 9e30ade..0067ee0 100644 --- a/packages/communication/src/messages/outgoing/room/index.ts +++ b/packages/communication/src/messages/outgoing/room/index.ts @@ -17,4 +17,3 @@ export * from './RedeemItemClothingComposer'; export * from './session'; export * from './unit'; export * from './unit/chat'; -export * from './youtube'; diff --git a/packages/communication/src/messages/outgoing/room/youtube/YouTubeRoomWatchingComposer.ts b/packages/communication/src/messages/outgoing/room/youtube/YouTubeRoomWatchingComposer.ts index b818591..0472d74 100644 --- a/packages/communication/src/messages/outgoing/room/youtube/YouTubeRoomWatchingComposer.ts +++ b/packages/communication/src/messages/outgoing/room/youtube/YouTubeRoomWatchingComposer.ts @@ -6,8 +6,6 @@ export class YouTubeRoomWatchingComposer implements IMessageComposer constructor(watching: boolean) { - // Send as int (0/1) instead of bare boolean to avoid - // serialization ambiguity in the Nitro wire protocol. this._data = [watching ? 1 : 0]; } diff --git a/packages/communication/src/messages/parser/catalog/CatalogPageMessageOfferData.ts b/packages/communication/src/messages/parser/catalog/CatalogPageMessageOfferData.ts index 301fa3d..1b788d6 100644 --- a/packages/communication/src/messages/parser/catalog/CatalogPageMessageOfferData.ts +++ b/packages/communication/src/messages/parser/catalog/CatalogPageMessageOfferData.ts @@ -14,6 +14,8 @@ export class CatalogPageMessageOfferData private _bundlePurchaseAllowed: boolean; private _isPet: boolean; private _previewImage: string; + private _itemIds: string; + private _haveOffer: boolean; private _products: CatalogPageMessageProductData[]; constructor(wrapper: IMessageDataWrapper) @@ -41,6 +43,8 @@ export class CatalogPageMessageOfferData this._bundlePurchaseAllowed = wrapper.readBoolean(); this._isPet = wrapper.readBoolean(); this._previewImage = wrapper.readString(); + this._itemIds = wrapper.readString(); + this._haveOffer = wrapper.readBoolean(); } public get offerId(): number @@ -102,4 +106,14 @@ export class CatalogPageMessageOfferData { return this._products; } + + public get itemIds(): string + { + return this._itemIds; + } + + public get haveOffer(): boolean + { + return this._haveOffer; + } } diff --git a/packages/communication/src/messages/parser/index.ts b/packages/communication/src/messages/parser/index.ts index b9898dc..7a7fc3b 100644 --- a/packages/communication/src/messages/parser/index.ts +++ b/packages/communication/src/messages/parser/index.ts @@ -59,6 +59,7 @@ export * from './room/furniture'; export * from './room/furniture/floor'; export * from './room/furniture/wall'; export * from './room/furniture/youtube'; +export * from './room/youtube'; export * from './room/mapping'; export * from './room/pet'; export * from './room/session'; diff --git a/packages/communication/src/messages/parser/inventory/badges/BadgeReceivedParser.ts b/packages/communication/src/messages/parser/inventory/badges/BadgeReceivedParser.ts index b63867e..08d3eac 100644 --- a/packages/communication/src/messages/parser/inventory/badges/BadgeReceivedParser.ts +++ b/packages/communication/src/messages/parser/inventory/badges/BadgeReceivedParser.ts @@ -1,4 +1,4 @@ -import { IMessageDataWrapper, IMessageParser } from '@nitrots/api'; +import { IMessageDataWrapper, IMessageParser } from '@nitrots/api'; export class BadgeReceivedParser implements IMessageParser { @@ -21,9 +21,6 @@ export class BadgeReceivedParser implements IMessageParser this._badgeId = wrapper.readInt(); this._badgeCode = wrapper.readString(); - // Extra field appended by the Arcturus-Nitro fork: sender username for - // badges awarded by a staff member via the `:badge` command. Read - // defensively so older servers that don't send it still parse cleanly. this._senderName = wrapper.bytesAvailable ? wrapper.readString() : ''; return true; @@ -43,4 +40,4 @@ export class BadgeReceivedParser implements IMessageParser { return this._senderName; } -} +} \ No newline at end of file diff --git a/packages/communication/src/messages/parser/room/index.ts b/packages/communication/src/messages/parser/room/index.ts index 0bab99d..81b327b 100644 --- a/packages/communication/src/messages/parser/room/index.ts +++ b/packages/communication/src/messages/parser/room/index.ts @@ -13,4 +13,3 @@ export * from './pet'; export * from './session'; export * from './unit'; export * from './unit/chat'; -export * from './youtube'; diff --git a/packages/room/src/RoomPreviewer.ts b/packages/room/src/RoomPreviewer.ts index f6d70c7..53b7537 100644 --- a/packages/room/src/RoomPreviewer.ts +++ b/packages/room/src/RoomPreviewer.ts @@ -239,8 +239,8 @@ export class RoomPreviewer if(this.isRoomEngineReady) { - if((this._currentPreviewObjectCategory === RoomObjectCategory.FLOOR) && (this._currentPreviewObjectType === classId) && (this._currentPreviewObjectData === (extra || ''))) return RoomPreviewer.PREVIEW_OBJECT_ID; - + if((this._currentPreviewObjectCategory === RoomObjectCategory.FLOOR) && (this._currentPreviewObjectType === classId) && (this._currentPreviewObjectData === (extra || ''))) return RoomPreviewer.PREVIEW_OBJECT_ID; + this.reset(false); this._currentPreviewObjectType = classId; diff --git a/packages/room/src/object/visualization/avatar/AvatarVisualization.ts b/packages/room/src/object/visualization/avatar/AvatarVisualization.ts index 7372730..6cb656d 100644 --- a/packages/room/src/object/visualization/avatar/AvatarVisualization.ts +++ b/packages/room/src/object/visualization/avatar/AvatarVisualization.ts @@ -163,6 +163,18 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement super.dispose(); if(this._avatarImage) this._avatarImage.dispose(); + + if(this._cachedAvatars) + { + for(const avatar of this._cachedAvatars.getValues()) avatar && avatar.dispose(); + this._cachedAvatars.reset(); + } + + if(this._cachedAvatarEffects) + { + for(const avatar of this._cachedAvatarEffects.getValues()) avatar && avatar.dispose(); + this._cachedAvatarEffects.reset(); + } if(this._reflectionOppositeTexture) { diff --git a/packages/room/src/object/visualization/furniture/IsometricImageFurniVisualization.ts b/packages/room/src/object/visualization/furniture/IsometricImageFurniVisualization.ts index 799fc68..df98fa8 100644 --- a/packages/room/src/object/visualization/furniture/IsometricImageFurniVisualization.ts +++ b/packages/room/src/object/visualization/furniture/IsometricImageFurniVisualization.ts @@ -26,6 +26,17 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza this._uniqueId = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`; this._photoUrl = null; } + + public dispose(): void { + if (this._thumbnailTexture instanceof RenderTexture) { + this._thumbnailTexture.destroy(true); + } + + this._thumbnailTexture = null; + this._thumbnailImageNormal = null; + + super.dispose(); + } public get hasThumbnailImage(): boolean { return !(this._thumbnailImageNormal == null); diff --git a/packages/room/src/object/visualization/room/RoomPlane.ts b/packages/room/src/object/visualization/room/RoomPlane.ts index 116bdd4..93570e9 100644 --- a/packages/room/src/object/visualization/room/RoomPlane.ts +++ b/packages/room/src/object/visualization/room/RoomPlane.ts @@ -157,6 +157,16 @@ export class RoomPlane implements IRoomPlane } this._animationLayers = []; } + + this._windowReflectionLastVisible.clear(); + this._windowReflectionFadeOut.clear(); + this._windowReflectionFirstSeenAt.clear(); + + if(this._maskFilter) + { + this._maskFilter.destroy(); + this._maskFilter = null; + } this._disposed = true; }