More changes

This commit is contained in:
Bill 2022-11-02 23:24:36 -04:00
parent dbf3e8c107
commit 5c0ed553e0
128 changed files with 2156 additions and 2237 deletions

View File

@ -1,4 +1,4 @@
import { IDisposable } from '../../api'; import { IDisposable } from '../../common';
export interface IAvatarEffectListener extends IDisposable export interface IAvatarEffectListener extends IDisposable
{ {

View File

@ -1,11 +1,10 @@
import { RenderTexture } from '@pixi/core'; import { RenderTexture } from '@pixi/core';
import { Sprite } from '@pixi/sprite'; import { Sprite } from '@pixi/sprite';
import { IDisposable, IGraphicAsset } from '../../api'; import { IGraphicAsset } from '../../asset';
import { IAnimationLayerData } from './animation/IAnimationLayerData'; import { IDisposable } from '../../common';
import { IAvatarDataContainer } from './animation/IAvatarDataContainer'; import { IAnimationLayerData, IAvatarDataContainer, ISpriteDataContainer } from './animation';
import { ISpriteDataContainer } from './animation/ISpriteDataContainer';
import { IAvatarFigureContainer } from './IAvatarFigureContainer'; import { IAvatarFigureContainer } from './IAvatarFigureContainer';
import { IPartColor } from './structure/figure/IPartColor'; import { IPartColor } from './structure';
export interface IAvatarImage extends IDisposable export interface IAvatarImage extends IDisposable
{ {

View File

@ -1,4 +1,4 @@
import { IDisposable } from '../../api'; import { IDisposable } from '../../common';
export interface IAvatarImageListener extends IDisposable export interface IAvatarImageListener extends IDisposable
{ {

View File

@ -1,11 +1,11 @@
import { IAssetManager, IGraphicAsset, INitroManager } from '../../api'; import { AvatarAssetDownloadManager, AvatarStructure } from '../../../nitro';
import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager'; import { IAssetManager, IGraphicAsset } from '../../asset';
import { AvatarStructure } from './AvatarStructure'; import { INitroManager } from '../../common';
import { IAvatarEffectListener } from './IAvatarEffectListener'; import { IAvatarEffectListener } from './IAvatarEffectListener';
import { IAvatarFigureContainer } from './IAvatarFigureContainer'; import { IAvatarFigureContainer } from './IAvatarFigureContainer';
import { IAvatarImage } from './IAvatarImage'; import { IAvatarImage } from './IAvatarImage';
import { IAvatarImageListener } from './IAvatarImageListener'; import { IAvatarImageListener } from './IAvatarImageListener';
import { IStructureData } from './structure/IStructureData'; import { IStructureData } from './structure';
export interface IAvatarRenderManager extends INitroManager export interface IAvatarRenderManager extends INitroManager
{ {

View File

@ -1,4 +1,3 @@
export interface IActionDefinition export interface IActionDefinition
{ {
id: string; id: string;

View File

@ -0,0 +1,2 @@
export * from './IActionDefinition';
export * from './IActiveActionData';

View File

@ -1,4 +1,4 @@
import { IActiveActionData } from '../actions/IActiveActionData'; import { IActiveActionData } from '../actions';
export interface IAnimationLayerData export interface IAnimationLayerData
{ {

View File

@ -0,0 +1,5 @@
export * from './IAnimation';
export * from './IAnimationLayerData';
export * from './IAnimationManager';
export * from './IAvatarDataContainer';
export * from './ISpriteDataContainer';

View File

@ -1 +1,12 @@
export * from './actions';
export * from './animation';
export * from './enum';
export * from './figuredata';
export * from './IAvatarEffectListener';
export * from './IAvatarFigureContainer';
export * from './IAvatarImage';
export * from './IAvatarImageListener';
export * from './IAvatarRenderManager';
export * from './IOutfit';
export * from './pet'; export * from './pet';
export * from './structure';

View File

@ -1,4 +1,4 @@
import { IFigureData } from '../interfaces'; import { IFigureData } from '../figuredata';
export interface IFigureSetData export interface IFigureSetData
{ {

View File

@ -1,9 +1,9 @@
import { AdvancedMap } from '../../../../core'; import { IAdvancedMap } from '../../../IAdvancedMap';
import { IPartColor } from './IPartColor'; import { IPartColor } from './IPartColor';
export interface IPalette export interface IPalette
{ {
getColor(id: number): IPartColor; getColor(id: number): IPartColor;
id: number; id: number;
colors: AdvancedMap<string, IPartColor>; colors: IAdvancedMap<string, IPartColor>;
} }

View File

@ -1,6 +1,6 @@
import { IFigurePartSet } from './figure/IFigurePartSet'; import { IFigurePartSet } from './IFigurePartSet';
import { IPalette } from './figure/IPalette'; import { IPalette } from './IPalette';
import { ISetType } from './figure/ISetType'; import { ISetType } from './ISetType';
export interface IStructureData export interface IStructureData
{ {

View File

@ -0,0 +1,7 @@
export * from './IFigurePart';
export * from './IFigurePartSet';
export * from './IFigureSetData';
export * from './IPalette';
export * from './IPartColor';
export * from './ISetType';
export * from './IStructureData';

View File

@ -1,5 +1,10 @@
export * from './avatar'; export * from './avatar';
export * from './avatar/actions';
export * from './avatar/animation';
export * from './avatar/enum';
export * from './avatar/figuredata';
export * from './avatar/pet'; export * from './avatar/pet';
export * from './avatar/structure';
export * from './camera'; export * from './camera';
export * from './communication'; export * from './communication';
export * from './enums'; export * from './enums';
@ -12,3 +17,4 @@ export * from './room/object/data/type';
export * from './room/utils'; export * from './room/utils';
export * from './session'; export * from './session';
export * from './session/enum'; export * from './session/enum';
export * from './sound';

View File

@ -1,5 +1,4 @@
import { INitroManager } from '../../../api'; import { INitroManager } from '../../common';
export interface IMusicManager extends INitroManager export interface IMusicManager extends INitroManager
{ {

View File

@ -0,0 +1,7 @@
import { INitroManager } from '../../common';
import { IMusicManager } from './IMusicManager';
export interface ISoundManager extends INitroManager
{
musicManager: IMusicManager;
}

View File

@ -0,0 +1,2 @@
export * from './IMusicManager';
export * from './ISoundManager';

View File

@ -2,6 +2,7 @@ import { BaseTexture, Resource, Texture } from '@pixi/core';
import { Spritesheet } from '@pixi/spritesheet'; import { Spritesheet } from '@pixi/spritesheet';
import { Dict } from '@pixi/utils'; import { Dict } from '@pixi/utils';
import { IAsset, IAssetData, IAssetPalette, IGraphicAsset, IGraphicAssetCollection } from '../../api'; import { IAsset, IAssetData, IAssetPalette, IGraphicAsset, IGraphicAssetCollection } from '../../api';
import { GetTickerTime } from '../../pixi-proxy';
import { GraphicAsset } from './GraphicAsset'; import { GraphicAsset } from './GraphicAsset';
import { GraphicAssetPalette } from './GraphicAssetPalette'; import { GraphicAssetPalette } from './GraphicAssetPalette';
@ -22,7 +23,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
constructor(data: IAssetData, spritesheet: Spritesheet) constructor(data: IAssetData, spritesheet: Spritesheet)
{ {
if(!data) throw new Error('invalid_collection'); if (!data) throw new Error('invalid_collection');
this._name = data.name; this._name = data.name;
this._baseTexture = ((spritesheet && spritesheet.baseTexture) || null); this._baseTexture = ((spritesheet && spritesheet.baseTexture) || null);
@ -32,7 +33,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
this._palettes = new Map(); this._palettes = new Map();
this._paletteAssetNames = []; this._paletteAssetNames = [];
if(spritesheet) this.addLibraryAsset(spritesheet.textures); if (spritesheet) this.addLibraryAsset(spritesheet.textures);
this.define(data); this.define(data);
} }
@ -44,23 +45,23 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
public dispose(): void public dispose(): void
{ {
if(this._palettes) if (this._palettes)
{ {
for(const palette of this._palettes.values()) palette.dispose(); for (const palette of this._palettes.values()) palette.dispose();
this._palettes.clear(); this._palettes.clear();
} }
if(this._paletteAssetNames) if (this._paletteAssetNames)
{ {
this.disposePaletteAssets(); this.disposePaletteAssets();
this._paletteAssetNames = null; this._paletteAssetNames = null;
} }
if(this._assets) if (this._assets)
{ {
for(const asset of this._assets.values()) asset.recycle(); for (const asset of this._assets.values()) asset.recycle();
this._assets.clear(); this._assets.clear();
} }
@ -69,17 +70,17 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
public addReference(): void public addReference(): void
{ {
this._referenceCount++; this._referenceCount++;
//this._referenceTimestamp = Nitro.instance.time; this._referenceTimestamp = GetTickerTime();
} }
public removeReference(): void public removeReference(): void
{ {
this._referenceCount--; this._referenceCount--;
if(this._referenceCount <= 0) if (this._referenceCount <= 0)
{ {
this._referenceCount = 0; this._referenceCount = 0;
//this._referenceTimestamp = Nitro.instance.time; this._referenceTimestamp = GetTickerTime();
this.disposePaletteAssets(false); this.disposePaletteAssets(false);
} }
@ -90,20 +91,20 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
const assets = data.assets; const assets = data.assets;
const palettes = data.palettes; const palettes = data.palettes;
if(assets) this.defineAssets(assets); if (assets) this.defineAssets(assets);
if(palettes) this.definePalettes(palettes); if (palettes) this.definePalettes(palettes);
} }
private defineAssets(assets: { [index: string]: IAsset }): void private defineAssets(assets: { [index: string]: IAsset }): void
{ {
if(!assets) return; if (!assets) return;
for(const name in assets) for (const name in assets)
{ {
const asset = assets[name]; const asset = assets[name];
if(!asset) continue; if (!asset) continue;
const x = (-(asset.x) || 0); const x = (-(asset.x) || 0);
const y = (-(asset.y) || 0); const y = (-(asset.y) || 0);
@ -112,23 +113,23 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
const usesPalette = (asset.usesPalette || false); const usesPalette = (asset.usesPalette || false);
let source = (asset.source || ''); let source = (asset.source || '');
if(asset.flipH && source.length) flipH = true; if (asset.flipH && source.length) flipH = true;
// if(asset.flipV && source.length) flipV = true; // if(asset.flipV && source.length) flipV = true;
if(!source.length) source = name; if (!source.length) source = name;
const texture = this.getLibraryAsset(source); const texture = this.getLibraryAsset(source);
if(!texture) continue; if (!texture) continue;
let didAddAsset = this.createAsset(name, source, texture, flipH, flipV, x, y, usesPalette); let didAddAsset = this.createAsset(name, source, texture, flipH, flipV, x, y, usesPalette);
if(!didAddAsset) if (!didAddAsset)
{ {
const existingAsset = this.getAsset(name); const existingAsset = this.getAsset(name);
if(existingAsset && (existingAsset.name !== existingAsset.source)) if (existingAsset && (existingAsset.name !== existingAsset.source))
{ {
didAddAsset = this.replaceAsset(name, source, texture, flipH, flipV, x, y, usesPalette); didAddAsset = this.replaceAsset(name, source, texture, flipH, flipV, x, y, usesPalette);
} }
@ -138,28 +139,28 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
private definePalettes(palettes: { [index: string]: IAssetPalette }): void private definePalettes(palettes: { [index: string]: IAssetPalette }): void
{ {
if(!palettes) return; if (!palettes) return;
for(const name in palettes) for (const name in palettes)
{ {
const palette = palettes[name]; const palette = palettes[name];
if(!palette) continue; if (!palette) continue;
const id = palette.id.toString(); const id = palette.id.toString();
if(this._palettes.get(id)) continue; if (this._palettes.get(id)) continue;
let colorOne = 0xFFFFFF; let colorOne = 0xFFFFFF;
let colorTwo = 0xFFFFFF; let colorTwo = 0xFFFFFF;
let color = palette.color1; let color = palette.color1;
if(color && color.length > 0) colorOne = parseInt(color, 16); if (color && color.length > 0) colorOne = parseInt(color, 16);
color = palette.color2; color = palette.color2;
if(color && color.length > 0) colorTwo = parseInt(color, 16); if (color && color.length > 0) colorTwo = parseInt(color, 16);
this._palettes.set(id, new GraphicAssetPalette(palette.rgb, colorOne, colorTwo)); this._palettes.set(id, new GraphicAssetPalette(palette.rgb, colorOne, colorTwo));
} }
@ -167,7 +168,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
private createAsset(name: string, source: string, texture: Texture<Resource>, flipH: boolean, flipV: boolean, x: number, y: number, usesPalette: boolean): boolean private createAsset(name: string, source: string, texture: Texture<Resource>, flipH: boolean, flipV: boolean, x: number, y: number, usesPalette: boolean): boolean
{ {
if(this._assets.get(name)) return false; if (this._assets.get(name)) return false;
const graphicAsset = GraphicAsset.createAsset(name, source, texture, x, y, flipH, flipV, usesPalette); const graphicAsset = GraphicAsset.createAsset(name, source, texture, x, y, flipH, flipV, usesPalette);
@ -180,7 +181,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
{ {
const existing = this._assets.get(name); const existing = this._assets.get(name);
if(existing) if (existing)
{ {
this._assets.delete(name); this._assets.delete(name);
@ -192,11 +193,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
public getAsset(name: string): IGraphicAsset public getAsset(name: string): IGraphicAsset
{ {
if(!name) return null; if (!name) return null;
const existing = this._assets.get(name); const existing = this._assets.get(name);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
@ -207,19 +208,19 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
let asset = this.getAsset(saveName); let asset = this.getAsset(saveName);
if(!asset) if (!asset)
{ {
asset = this.getAsset(name); asset = this.getAsset(name);
if(!asset || !asset.usesPalette) return asset; if (!asset || !asset.usesPalette) return asset;
const palette = this.getPalette(paletteName); const palette = this.getPalette(paletteName);
if(palette) if (palette)
{ {
const texture = palette.applyPalette(asset.texture); const texture = palette.applyPalette(asset.texture);
if(texture) if (texture)
{ {
this._paletteAssetNames.push(saveName); this._paletteAssetNames.push(saveName);
@ -247,36 +248,36 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
{ {
const palette = this.getPalette(paletteName); const palette = this.getPalette(paletteName);
if(palette) return [palette.primaryColor, palette.secondaryColor]; if (palette) return [palette.primaryColor, palette.secondaryColor];
return null; return null;
} }
public getPalette(name: string): GraphicAssetPalette public getPalette(name: string): GraphicAssetPalette
{ {
if(!name) return null; if (!name) return null;
const existing = this._palettes.get(name); const existing = this._palettes.get(name);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
public addAsset(name: string, texture: Texture<Resource>, override: boolean, x: number = 0, y: number = 0, flipH: boolean = false, flipV: boolean = false): boolean public addAsset(name: string, texture: Texture<Resource>, override: boolean, x: number = 0, y: number = 0, flipH: boolean = false, flipV: boolean = false): boolean
{ {
if(!name || !texture) return false; if (!name || !texture) return false;
const existingTexture = this.getLibraryAsset(name); const existingTexture = this.getLibraryAsset(name);
if(!existingTexture) if (!existingTexture)
{ {
this._textures.set(name, texture); this._textures.set(name, texture);
return this.createAsset(name, name, texture, flipH, flipV, x, y, false); return this.createAsset(name, name, texture, flipH, flipV, x, y, false);
} }
if(override) if (override)
{ {
existingTexture.baseTexture = texture.baseTexture; existingTexture.baseTexture = texture.baseTexture;
existingTexture.frame = texture.frame; existingTexture.frame = texture.frame;
@ -294,13 +295,13 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
{ {
const existing = this._assets.get(name); const existing = this._assets.get(name);
if(!existing) return; if (!existing) return;
this._assets.delete(name); this._assets.delete(name);
const texture = this.getLibraryAsset(existing.source); const texture = this.getLibraryAsset(existing.source);
if(texture) if (texture)
{ {
this._textures.delete(existing.source); this._textures.delete(existing.source);
@ -312,26 +313,26 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
public getLibraryAsset(name: string): Texture<Resource> public getLibraryAsset(name: string): Texture<Resource>
{ {
if(!name) return null; if (!name) return null;
name = this._name + '_' + name; name = this._name + '_' + name;
const texture = this._textures.get(name); const texture = this._textures.get(name);
if(!texture) return null; if (!texture) return null;
return texture; return texture;
} }
private addLibraryAsset(textures: Dict<Texture<Resource>>): void private addLibraryAsset(textures: Dict<Texture<Resource>>): void
{ {
if(!textures) return; if (!textures) return;
for(const name in textures) for (const name in textures)
{ {
const texture = textures[name]; const texture = textures[name];
if(!texture) continue; if (!texture) continue;
this._textures.set(GraphicAssetCollection.removeFileExtension(name), texture); this._textures.set(GraphicAssetCollection.removeFileExtension(name), texture);
} }
@ -339,11 +340,11 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
private disposePaletteAssets(disposeAll: boolean = true): void private disposePaletteAssets(disposeAll: boolean = true): void
{ {
if(this._paletteAssetNames) if (this._paletteAssetNames)
{ {
if(disposeAll || (this._paletteAssetNames.length > GraphicAssetCollection.PALETTE_ASSET_DISPOSE_THRESHOLD)) if (disposeAll || (this._paletteAssetNames.length > GraphicAssetCollection.PALETTE_ASSET_DISPOSE_THRESHOLD))
{ {
for(const name of this._paletteAssetNames) this.disposeAsset(name); for (const name of this._paletteAssetNames) this.disposeAsset(name);
this._paletteAssetNames = []; this._paletteAssetNames = [];
} }

View File

@ -1,8 +1,6 @@
import { Application } from '@pixi/app'; import { Application } from '@pixi/app';
import { Ticker } from '@pixi/ticker'; import { Ticker } from '@pixi/ticker';
import { IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, IWorkerEventTracker } from '../api'; import { IAvatarRenderManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager, IWorkerEventTracker } from '../api';
import { IAvatarRenderManager } from './avatar/IAvatarRenderManager';
import { ISoundManager } from './sound/ISoundManager';
export interface INitro export interface INitro
{ {

View File

@ -2,25 +2,21 @@ import { Application, IApplicationOptions } from '@pixi/app';
import { SCALE_MODES } from '@pixi/constants'; import { SCALE_MODES } from '@pixi/constants';
import { settings } from '@pixi/settings'; import { settings } from '@pixi/settings';
import { Ticker } from '@pixi/ticker'; import { Ticker } from '@pixi/ticker';
import { IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, IWorkerEventTracker } from '../api'; import { IAvatarRenderManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager, IWorkerEventTracker } from '../api';
import { ConfigurationEvent, EventDispatcher, NitroCore, NitroEvent } from '../core'; import { ConfigurationEvent, EventDispatcher, NitroCore, NitroEvent } from '../core';
import { PixiApplicationProxy } from '../pixi-proxy'; import { PixiApplicationProxy } from '../pixi-proxy';
import { RoomManager } from '../room/RoomManager'; import { RoomManager } from '../room';
import { AvatarRenderManager } from './avatar/AvatarRenderManager'; import { AvatarRenderManager } from './avatar';
import { IAvatarRenderManager } from './avatar/IAvatarRenderManager'; import { RoomCameraWidgetManager } from './camera';
import { RoomCameraWidgetManager } from './camera/RoomCameraWidgetManager'; import { NitroCommunicationManager } from './communication';
import { NitroCommunicationManager } from './communication/NitroCommunicationManager'; import { LegacyExternalInterface } from './externalInterface';
import { LegacyExternalInterface } from './externalInterface/LegacyExternalInterface'; import { GameMessageHandler } from './game';
import { GameMessageHandler } from './game/GameMessageHandler';
import { INitro } from './INitro'; import { INitro } from './INitro';
import { NitroLocalizationManager } from './localization/NitroLocalizationManager'; import { NitroLocalizationManager } from './localization';
import './Plugins'; import './Plugins';
import { RoomEngineEvent } from './room'; import { RoomEngine, RoomEngineEvent } from './room';
import { RoomEngine } from './room/RoomEngine'; import { RoomSessionManager, SessionDataManager } from './session';
import { RoomSessionManager } from './session/RoomSessionManager'; import { SoundManager } from './sound';
import { SessionDataManager } from './session/SessionDataManager';
import { ISoundManager } from './sound/ISoundManager';
import { SoundManager } from './sound/SoundManager';
import { HabboWebTools } from './utils/HabboWebTools'; import { HabboWebTools } from './utils/HabboWebTools';
LegacyExternalInterface.available; LegacyExternalInterface.available;
@ -57,7 +53,7 @@ export class Nitro implements INitro
constructor(core: INitroCore, options?: IApplicationOptions) constructor(core: INitroCore, options?: IApplicationOptions)
{ {
if(!Nitro.INSTANCE) Nitro.INSTANCE = this; if (!Nitro.INSTANCE) Nitro.INSTANCE = this;
this._worker = null; this._worker = null;
this._application = new PixiApplicationProxy(options); this._application = new PixiApplicationProxy(options);
@ -81,12 +77,12 @@ export class Nitro implements INitro
this._core.configuration.events.addEventListener(ConfigurationEvent.LOADED, this.onConfigurationLoadedEvent.bind(this)); this._core.configuration.events.addEventListener(ConfigurationEvent.LOADED, this.onConfigurationLoadedEvent.bind(this));
this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineReady.bind(this)); this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineReady.bind(this));
if(this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this); if (this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this);
} }
public static bootstrap(): void public static bootstrap(): void
{ {
if(Nitro.INSTANCE) if (Nitro.INSTANCE)
{ {
Nitro.INSTANCE.dispose(); Nitro.INSTANCE.dispose();
@ -108,25 +104,25 @@ export class Nitro implements INitro
public init(): void public init(): void
{ {
if(this._isReady || this._isDisposed) return; if (this._isReady || this._isDisposed) return;
if(this._avatar) this._avatar.init(); if (this._avatar) this._avatar.init();
if(this._soundManager) this._soundManager.init(); if (this._soundManager) this._soundManager.init();
if(this._roomEngine) if (this._roomEngine)
{ {
this._roomEngine.sessionDataManager = this._sessionDataManager; this._roomEngine.sessionDataManager = this._sessionDataManager;
this._roomEngine.roomSessionManager = this._roomSessionManager; this._roomEngine.roomSessionManager = this._roomSessionManager;
this._roomEngine.roomManager = this._roomManager; this._roomEngine.roomManager = this._roomManager;
if(this._sessionDataManager) this._sessionDataManager.init(); if (this._sessionDataManager) this._sessionDataManager.init();
if(this._roomSessionManager) this._roomSessionManager.init(); if (this._roomSessionManager) this._roomSessionManager.init();
this._roomEngine.init(); this._roomEngine.init();
} }
if(!this._communication.connection) if (!this._communication.connection)
{ {
throw new Error('No connection found'); throw new Error('No connection found');
} }
@ -138,58 +134,58 @@ export class Nitro implements INitro
public dispose(): void public dispose(): void
{ {
if(this._isDisposed) return; if (this._isDisposed) return;
if(this._roomManager) if (this._roomManager)
{ {
this._roomManager.dispose(); this._roomManager.dispose();
this._roomManager = null; this._roomManager = null;
} }
if(this._roomSessionManager) if (this._roomSessionManager)
{ {
this._roomSessionManager.dispose(); this._roomSessionManager.dispose();
this._roomSessionManager = null; this._roomSessionManager = null;
} }
if(this._sessionDataManager) if (this._sessionDataManager)
{ {
this._sessionDataManager.dispose(); this._sessionDataManager.dispose();
this._sessionDataManager = null; this._sessionDataManager = null;
} }
if(this._roomEngine) if (this._roomEngine)
{ {
this._roomEngine.dispose(); this._roomEngine.dispose();
this._roomEngine = null; this._roomEngine = null;
} }
if(this._avatar) if (this._avatar)
{ {
this._avatar.dispose(); this._avatar.dispose();
this._avatar = null; this._avatar = null;
} }
if(this._soundManager) if (this._soundManager)
{ {
this._soundManager.dispose(); this._soundManager.dispose();
this._soundManager = null; this._soundManager = null;
} }
if(this._communication) if (this._communication)
{ {
this._communication.dispose(); this._communication.dispose();
this._communication = null; this._communication = null;
} }
if(this._application) if (this._application)
{ {
this._application.destroy(); this._application.destroy();
@ -205,7 +201,7 @@ export class Nitro implements INitro
const animationFPS = this.getConfiguration<number>('system.animation.fps', 24); const animationFPS = this.getConfiguration<number>('system.animation.fps', 24);
const limitsFPS = this.getConfiguration<boolean>('system.limits.fps', true); const limitsFPS = this.getConfiguration<boolean>('system.limits.fps', true);
if(limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS; if (limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS;
} }
private onRoomEngineReady(event: RoomEngineEvent): void private onRoomEngineReady(event: RoomEngineEvent): void
@ -235,7 +231,7 @@ export class Nitro implements INitro
public addWorkerEventTracker(tracker: IWorkerEventTracker): void public addWorkerEventTracker(tracker: IWorkerEventTracker): void
{ {
if(this._workerTrackers.indexOf(tracker) >= 0) return; if (this._workerTrackers.indexOf(tracker) >= 0) return;
this._workerTrackers.push(tracker); this._workerTrackers.push(tracker);
} }
@ -244,20 +240,20 @@ export class Nitro implements INitro
{ {
const index = this._workerTrackers.indexOf(tracker); const index = this._workerTrackers.indexOf(tracker);
if(index === -1) return; if (index === -1) return;
this._workerTrackers.splice(index, 1); this._workerTrackers.splice(index, 1);
} }
public createWorkerEvent(message: MessageEvent): void public createWorkerEvent(message: MessageEvent): void
{ {
if(!message) return; if (!message) return;
const data: { [index: string]: any } = message.data; const data: { [index: string]: any } = message.data;
for(const tracker of this._workerTrackers) for (const tracker of this._workerTrackers)
{ {
if(!tracker) continue; if (!tracker) continue;
tracker.workerMessageReceived(data); tracker.workerMessageReceived(data);
} }
@ -265,14 +261,14 @@ export class Nitro implements INitro
public sendWorkerEvent(message: { [index: string]: any }): void public sendWorkerEvent(message: { [index: string]: any }): void
{ {
if(!message || !this._worker) return; if (!message || !this._worker) return;
this._worker.postMessage(message); this._worker.postMessage(message);
} }
public addLinkEventTracker(tracker: ILinkEventTracker): void public addLinkEventTracker(tracker: ILinkEventTracker): void
{ {
if(this._linkTrackers.indexOf(tracker) >= 0) return; if (this._linkTrackers.indexOf(tracker) >= 0) return;
this._linkTrackers.push(tracker); this._linkTrackers.push(tracker);
} }
@ -281,24 +277,24 @@ export class Nitro implements INitro
{ {
const index = this._linkTrackers.indexOf(tracker); const index = this._linkTrackers.indexOf(tracker);
if(index === -1) return; if (index === -1) return;
this._linkTrackers.splice(index, 1); this._linkTrackers.splice(index, 1);
} }
public createLinkEvent(link: string): void public createLinkEvent(link: string): void
{ {
if(!link || (link === '')) return; if (!link || (link === '')) return;
for(const tracker of this._linkTrackers) for (const tracker of this._linkTrackers)
{ {
if(!tracker) continue; if (!tracker) continue;
const prefix = tracker.eventUrlPrefix; const prefix = tracker.eventUrlPrefix;
if(prefix.length > 0) if (prefix.length > 0)
{ {
if(link.substr(0, prefix.length) === prefix) tracker.linkReceived(link); if (link.substr(0, prefix.length) === prefix) tracker.linkReceived(link);
} }
else else
{ {

View File

@ -1,11 +1,9 @@
import { IAssetManager } from '../../api'; import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener } from '../../api';
import { EventDispatcher, NitroEvent } from '../../core'; import { EventDispatcher, NitroEvent } from '../../core';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
import { AvatarAssetDownloadLibrary } from './AvatarAssetDownloadLibrary'; import { AvatarAssetDownloadLibrary } from './AvatarAssetDownloadLibrary';
import { AvatarStructure } from './AvatarStructure'; import { AvatarStructure } from './AvatarStructure';
import { AvatarRenderEvent, AvatarRenderLibraryEvent } from './events'; import { AvatarRenderEvent, AvatarRenderLibraryEvent } from './events';
import { IAvatarFigureContainer } from './IAvatarFigureContainer';
import { IAvatarImageListener } from './IAvatarImageListener';
export class AvatarAssetDownloadManager extends EventDispatcher export class AvatarAssetDownloadManager extends EventDispatcher
{ {
@ -64,7 +62,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
request.onloadend = e => request.onloadend = e =>
{ {
if(request.responseText) if (request.responseText)
{ {
const data = JSON.parse(request.responseText); const data = JSON.parse(request.responseText);
@ -92,16 +90,16 @@ export class AvatarAssetDownloadManager extends EventDispatcher
private processFigureMap(data: any): void private processFigureMap(data: any): void
{ {
if(!data) return; if (!data) return;
for(const library of data) for (const library of data)
{ {
if(!library) continue; if (!library) continue;
const id = (library.id as string); const id = (library.id as string);
const revision = (library.revision || ''); const revision = (library.revision || '');
if(this._libraryNames.indexOf(id) >= 0) continue; if (this._libraryNames.indexOf(id) >= 0) continue;
this._libraryNames.push(id); this._libraryNames.push(id);
@ -109,7 +107,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
downloadLibrary.addEventListener(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded); downloadLibrary.addEventListener(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded);
for(const part of library.parts) for (const part of library.parts)
{ {
const id = (part.id as string); const id = (part.id as string);
const type = (part.type as string); const type = (part.type as string);
@ -117,7 +115,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
let existing = this._figureMap.get(partString); let existing = this._figureMap.get(partString);
if(!existing) existing = []; if (!existing) existing = [];
existing.push(downloadLibrary); existing.push(downloadLibrary);
@ -128,9 +126,9 @@ export class AvatarAssetDownloadManager extends EventDispatcher
private onAvatarRenderReady(event: NitroEvent): void private onAvatarRenderReady(event: NitroEvent): void
{ {
if(!event) return; if (!event) return;
for(const [container, listener] of this._pendingContainers) for (const [container, listener] of this._pendingContainers)
{ {
this.downloadAvatarFigure(container, listener); this.downloadAvatarFigure(container, listener);
} }
@ -140,34 +138,34 @@ export class AvatarAssetDownloadManager extends EventDispatcher
private onLibraryLoaded(event: AvatarRenderLibraryEvent): void private onLibraryLoaded(event: AvatarRenderLibraryEvent): void
{ {
if(!event || !event.library) return; if (!event || !event.library) return;
const loadedFigures: string[] = []; const loadedFigures: string[] = [];
for(const [figure, libraries] of this._incompleteFigures.entries()) for (const [figure, libraries] of this._incompleteFigures.entries())
{ {
let isReady = true; let isReady = true;
for(const library of libraries) for (const library of libraries)
{ {
if(!library || library.isLoaded) continue; if (!library || library.isLoaded) continue;
isReady = false; isReady = false;
break; break;
} }
if(isReady) if (isReady)
{ {
loadedFigures.push(figure); loadedFigures.push(figure);
const listeners = this._figureListeners.get(figure); const listeners = this._figureListeners.get(figure);
if(listeners) if (listeners)
{ {
for(const listener of listeners) for (const listener of listeners)
{ {
if(!listener || listener.disposed) continue; if (!listener || listener.disposed) continue;
listener.resetFigure(figure); listener.resetFigure(figure);
} }
@ -179,22 +177,22 @@ export class AvatarAssetDownloadManager extends EventDispatcher
} }
} }
for(const figure of loadedFigures) for (const figure of loadedFigures)
{ {
if(!figure) continue; if (!figure) continue;
this._incompleteFigures.delete(figure); this._incompleteFigures.delete(figure);
} }
let index = 0; let index = 0;
while(index < this._currentDownloads.length) while (index < this._currentDownloads.length)
{ {
const download = this._currentDownloads[index]; const download = this._currentDownloads[index];
if(download) if (download)
{ {
if(download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); if (download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1);
} }
index++; index++;
@ -205,19 +203,19 @@ export class AvatarAssetDownloadManager extends EventDispatcher
{ {
const libraries = this._missingMandatoryLibs.slice(); const libraries = this._missingMandatoryLibs.slice();
for(const library of libraries) for (const library of libraries)
{ {
if(!library) continue; if (!library) continue;
const map = this._figureMap.get(library); const map = this._figureMap.get(library);
if(map) for(const avatar of map) avatar && this.downloadLibrary(avatar); if (map) for (const avatar of map) avatar && this.downloadLibrary(avatar);
} }
} }
public isAvatarFigureContainerReady(container: IAvatarFigureContainer): boolean public isAvatarFigureContainerReady(container: IAvatarFigureContainer): boolean
{ {
if(!this._isReady || !this._structure.renderManager.isReady) if (!this._isReady || !this._structure.renderManager.isReady)
{ {
return false; return false;
} }
@ -231,38 +229,38 @@ export class AvatarAssetDownloadManager extends EventDispatcher
{ {
const pendingLibraries: AvatarAssetDownloadLibrary[] = []; const pendingLibraries: AvatarAssetDownloadLibrary[] = [];
if(!container || !this._structure) return pendingLibraries; if (!container || !this._structure) return pendingLibraries;
const figureData = this._structure.figureData; const figureData = this._structure.figureData;
if(!figureData) return pendingLibraries; if (!figureData) return pendingLibraries;
const setKeys = container.getPartTypeIds(); const setKeys = container.getPartTypeIds();
for(const key of setKeys) for (const key of setKeys)
{ {
const set = figureData.getSetType(key); const set = figureData.getSetType(key);
if(!set) continue; if (!set) continue;
const figurePartSet = set.getPartSet(container.getPartSetId(key)); const figurePartSet = set.getPartSet(container.getPartSetId(key));
if(!figurePartSet) continue; if (!figurePartSet) continue;
for(const part of figurePartSet.parts) for (const part of figurePartSet.parts)
{ {
if(!part) continue; if (!part) continue;
const name = (part.type + ':' + part.id); const name = (part.type + ':' + part.id);
const existing = this._figureMap.get(name); const existing = this._figureMap.get(name);
if(existing === undefined) continue; if (existing === undefined) continue;
for(const library of existing) for (const library of existing)
{ {
if(!library || library.isLoaded) continue; if (!library || library.isLoaded) continue;
if(pendingLibraries.indexOf(library) >= 0) continue; if (pendingLibraries.indexOf(library) >= 0) continue;
pendingLibraries.push(library); pendingLibraries.push(library);
} }
@ -274,7 +272,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void
{ {
if(!this._isReady || !this._structure.renderManager.isReady) if (!this._isReady || !this._structure.renderManager.isReady)
{ {
this._pendingContainers.push([container, listener]); this._pendingContainers.push([container, listener]);
@ -284,13 +282,13 @@ export class AvatarAssetDownloadManager extends EventDispatcher
const figure = container.getFigureString(); const figure = container.getFigureString();
const pendingLibraries = this.getAvatarFigurePendingLibraries(container); const pendingLibraries = this.getAvatarFigurePendingLibraries(container);
if(pendingLibraries && pendingLibraries.length) if (pendingLibraries && pendingLibraries.length)
{ {
if(listener && !listener.disposed) if (listener && !listener.disposed)
{ {
let listeners = this._figureListeners.get(figure); let listeners = this._figureListeners.get(figure);
if(!listeners) if (!listeners)
{ {
listeners = []; listeners = [];
@ -302,24 +300,24 @@ export class AvatarAssetDownloadManager extends EventDispatcher
this._incompleteFigures.set(figure, pendingLibraries); this._incompleteFigures.set(figure, pendingLibraries);
for(const library of pendingLibraries) for (const library of pendingLibraries)
{ {
if(!library) continue; if (!library) continue;
this.downloadLibrary(library); this.downloadLibrary(library);
} }
} }
else else
{ {
if(listener && !listener.disposed) listener.resetFigure(figure); if (listener && !listener.disposed) listener.resetFigure(figure);
} }
} }
private downloadLibrary(library: AvatarAssetDownloadLibrary): void private downloadLibrary(library: AvatarAssetDownloadLibrary): void
{ {
if(!library || library.isLoaded) return; if (!library || library.isLoaded) return;
if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; if ((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return;
this._pendingDownloadQueue.push(library); this._pendingDownloadQueue.push(library);
@ -328,7 +326,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
private processDownloadQueue(): void private processDownloadQueue(): void
{ {
while(this._pendingDownloadQueue.length) while (this._pendingDownloadQueue.length)
{ {
const library = this._pendingDownloadQueue[0]; const library = this._pendingDownloadQueue[0];

View File

@ -1,4 +1,4 @@
import { IAvatarFigureContainer } from './IAvatarFigureContainer'; import { IAvatarFigureContainer } from '../../api';
export class AvatarFigureContainer implements IAvatarFigureContainer export class AvatarFigureContainer implements IAvatarFigureContainer
{ {
@ -25,7 +25,7 @@ export class AvatarFigureContainer implements IAvatarFigureContainer
{ {
const existing = this.partSets().get(k); const existing = this.partSets().get(k);
if(!existing) return 0; if (!existing) return 0;
return existing.get('setid'); return existing.get('setid');
} }
@ -34,7 +34,7 @@ export class AvatarFigureContainer implements IAvatarFigureContainer
{ {
const existing = this.partSets().get(k); const existing = this.partSets().get(k);
if(!existing) return null; if (!existing) return null;
return existing.get('colorids'); return existing.get('colorids');
} }
@ -62,9 +62,9 @@ export class AvatarFigureContainer implements IAvatarFigureContainer
{ {
const parts: string[] = []; const parts: string[] = [];
for(const key of this.partSets().keys()) for (const key of this.partSets().keys())
{ {
if(!key) continue; if (!key) continue;
let setParts = []; let setParts = [];
@ -81,20 +81,20 @@ export class AvatarFigureContainer implements IAvatarFigureContainer
private partSets(): Map<string, Map<string, any>> private partSets(): Map<string, Map<string, any>>
{ {
if(!this._parts) this._parts = new Map(); if (!this._parts) this._parts = new Map();
return this._parts; return this._parts;
} }
private parseFigure(figure: string): void private parseFigure(figure: string): void
{ {
if(!figure) figure = ''; if (!figure) figure = '';
for(const part of figure.split('.')) for (const part of figure.split('.'))
{ {
const pieces = part.split('-'); const pieces = part.split('-');
if(pieces.length >= 2) if (pieces.length >= 2)
{ {
const type = pieces[0]; const type = pieces[0];
const setId = parseInt(pieces[1]); const setId = parseInt(pieces[1]);
@ -102,7 +102,7 @@ export class AvatarFigureContainer implements IAvatarFigureContainer
let index = 2; let index = 2;
while(index < pieces.length) while (index < pieces.length)
{ {
colors.push(parseInt(pieces[index])); colors.push(parseInt(pieces[index]));

View File

@ -3,29 +3,15 @@ import { Container } from '@pixi/display';
import { ColorMatrixFilter } from '@pixi/filter-color-matrix'; import { ColorMatrixFilter } from '@pixi/filter-color-matrix';
import { Rectangle } from '@pixi/math'; import { Rectangle } from '@pixi/math';
import { Sprite } from '@pixi/sprite'; import { Sprite } from '@pixi/sprite';
import { IGraphicAsset } from '../../api'; import { AvatarAction, AvatarDirectionAngle, AvatarScaleType, AvatarSetType, IActionDefinition, IActiveActionData, IAnimationLayerData, IAvatarDataContainer, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IGraphicAsset, IPartColor, ISpriteDataContainer } from '../../api';
import { AdvancedMap } from '../../core'; import { AdvancedMap } from '../../core';
import { NitroContainer, NitroSprite, PaletteMapFilter, PixiApplicationProxy, TextureUtils } from '../../pixi-proxy'; import { GetTickerTime, NitroContainer, NitroSprite, PaletteMapFilter, PixiApplicationProxy, TextureUtils } from '../../pixi-proxy';
import { Nitro } from '../Nitro'; import { ActiveActionData } from './actions';
import { ActiveActionData } from './actions/ActiveActionData'; import { AssetAliasCollection } from './alias';
import { IActionDefinition } from './actions/IActionDefinition';
import { IActiveActionData } from './actions/IActiveActionData';
import { AssetAliasCollection } from './alias/AssetAliasCollection';
import { IAnimationLayerData } from './animation/IAnimationLayerData';
import { IAvatarDataContainer } from './animation/IAvatarDataContainer';
import { ISpriteDataContainer } from './animation/ISpriteDataContainer';
import { AvatarFigureContainer } from './AvatarFigureContainer'; import { AvatarFigureContainer } from './AvatarFigureContainer';
import { AvatarStructure } from './AvatarStructure'; import { AvatarStructure } from './AvatarStructure';
import { AvatarImageCache } from './cache/AvatarImageCache'; import { AvatarImageCache } from './cache';
import { EffectAssetDownloadManager } from './EffectAssetDownloadManager'; import { EffectAssetDownloadManager } from './EffectAssetDownloadManager';
import { AvatarAction } from './enum/AvatarAction';
import { AvatarDirectionAngle } from './enum/AvatarDirectionAngle';
import { AvatarScaleType } from './enum/AvatarScaleType';
import { AvatarSetType } from './enum/AvatarSetType';
import { IAvatarEffectListener } from './IAvatarEffectListener';
import { IAvatarFigureContainer } from './IAvatarFigureContainer';
import { IAvatarImage } from './IAvatarImage';
import { IPartColor } from './structure/figure/IPartColor';
export class AvatarImage implements IAvatarImage, IAvatarEffectListener export class AvatarImage implements IAvatarImage, IAvatarEffectListener
{ {
@ -90,11 +76,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
this._assets = _arg_2; this._assets = _arg_2;
this._scale = _arg_4; this._scale = _arg_4;
this._effectListener = _arg_6; this._effectListener = _arg_6;
if(this._scale == null) if (this._scale == null)
{ {
this._scale = AvatarScaleType.LARGE; this._scale = AvatarScaleType.LARGE;
} }
if(_arg_3 == null) if (_arg_3 == null)
{ {
_arg_3 = new AvatarFigureContainer('hr-893-45.hd-180-2.ch-210-66.lg-270-82.sh-300-91.wa-2007-.ri-1-'); _arg_3 = new AvatarFigureContainer('hr-893-45.hd-180-2.ch-210-66.lg-270-82.sh-300-91.wa-2007-.ri-1-');
} }
@ -118,7 +104,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
public dispose(): void public dispose(): void
{ {
if(this._disposed) return; if (this._disposed) return;
this._structure = null; this._structure = null;
this._assets = null; this._assets = null;
@ -127,22 +113,22 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
this._avatarSpriteData = null; this._avatarSpriteData = null;
this._actions = null; this._actions = null;
if(this._image) if (this._image)
{ {
this._image.destroy(); this._image.destroy();
this._image = null; this._image = null;
} }
if(this._cache) if (this._cache)
{ {
this._cache.dispose(); this._cache.dispose();
this._cache = null; this._cache = null;
} }
if(this._fullImageCache) if (this._fullImageCache)
{ {
for(const k of this._fullImageCache.getValues()) (k && k.destroy()); for (const k of this._fullImageCache.getValues()) (k && k.destroy());
this._fullImageCache = null; this._fullImageCache = null;
} }
@ -176,24 +162,24 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
{ {
_arg_2 = (_arg_2 + this._directionOffset); _arg_2 = (_arg_2 + this._directionOffset);
if(_arg_2 < AvatarDirectionAngle.MIN_DIRECTION) if (_arg_2 < AvatarDirectionAngle.MIN_DIRECTION)
{ {
_arg_2 = (AvatarDirectionAngle.MAX_DIRECTION + (_arg_2 + 1)); _arg_2 = (AvatarDirectionAngle.MAX_DIRECTION + (_arg_2 + 1));
} }
if(_arg_2 > AvatarDirectionAngle.MAX_DIRECTION) if (_arg_2 > AvatarDirectionAngle.MAX_DIRECTION)
{ {
_arg_2 = (_arg_2 - (AvatarDirectionAngle.MAX_DIRECTION + 1)); _arg_2 = (_arg_2 - (AvatarDirectionAngle.MAX_DIRECTION + 1));
} }
if(this._structure.isMainAvatarSet(k)) if (this._structure.isMainAvatarSet(k))
{ {
this._mainDirection = _arg_2; this._mainDirection = _arg_2;
} }
if((k === AvatarSetType.HEAD) || (k === AvatarSetType.FULL)) if ((k === AvatarSetType.HEAD) || (k === AvatarSetType.FULL))
{ {
if((k === AvatarSetType.HEAD) && (this.isHeadTurnPreventedByAction())) if ((k === AvatarSetType.HEAD) && (this.isHeadTurnPreventedByAction()))
{ {
_arg_2 = this._mainDirection; _arg_2 = this._mainDirection;
} }
@ -239,34 +225,34 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
private getFullImageCacheKey(): string private getFullImageCacheKey(): string
{ {
if(!this._useFullImageCache) return null; if (!this._useFullImageCache) return null;
if(((this._sortedActions.length == 1) && (this._mainDirection == this._headDirection))) if (((this._sortedActions.length == 1) && (this._mainDirection == this._headDirection)))
{ {
return (this._mainDirection + this._currentActionsString) + (this._frameCounter % 4); return (this._mainDirection + this._currentActionsString) + (this._frameCounter % 4);
} }
if(this._sortedActions.length == 2) if (this._sortedActions.length == 2)
{ {
for(const k of this._sortedActions) for (const k of this._sortedActions)
{ {
if(((k.actionType == 'fx') && ((((k.actionParameter == '33') || (k.actionParameter == '34')) || (k.actionParameter == '35')) || (k.actionParameter == '36')))) if (((k.actionType == 'fx') && ((((k.actionParameter == '33') || (k.actionParameter == '34')) || (k.actionParameter == '35')) || (k.actionParameter == '36'))))
{ {
return (this._mainDirection + this._currentActionsString) + 0; return (this._mainDirection + this._currentActionsString) + 0;
} }
if(((k.actionType == 'fx') && ((k.actionParameter == '38') || (k.actionParameter == '39')))) if (((k.actionType == 'fx') && ((k.actionParameter == '38') || (k.actionParameter == '39'))))
{ {
return (((this._mainDirection + '_') + this._headDirection) + this._currentActionsString) + (this._frameCounter % 11); return (((this._mainDirection + '_') + this._headDirection) + this._currentActionsString) + (this._frameCounter % 11);
} }
if((k.actionType === 'dance') && ((k.actionParameter === '1') || (k.actionParameter === '2') || (k.actionParameter === '3') || (k.actionParameter === '4'))) if ((k.actionType === 'dance') && ((k.actionParameter === '1') || (k.actionParameter === '2') || (k.actionParameter === '3') || (k.actionParameter === '4')))
{ {
let frame = (this._frameCounter % 8); let frame = (this._frameCounter % 8);
if((k.actionParameter === '3')) frame = (this._frameCounter % 10); if ((k.actionParameter === '3')) frame = (this._frameCounter % 10);
if((k.actionParameter === '4')) frame = (this._frameCounter % 16); if ((k.actionParameter === '4')) frame = (this._frameCounter % 16);
return (((this._mainDirection + k.actionType) + k.actionParameter) + frame); return (((this._mainDirection + k.actionType) + k.actionParameter) + frame);
} }
@ -278,7 +264,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
private getBodyParts(k: string, _arg_2: string, _arg_3: number): string[] private getBodyParts(k: string, _arg_2: string, _arg_3: number): string[]
{ {
if((((!(_arg_3 == this._cachedBodyPartsDirection)) || (!(_arg_2 == this._cachedBodyPartsGeometryType))) || (!(k == this._cachedBodyPartsAvatarSet)))) if ((((!(_arg_3 == this._cachedBodyPartsDirection)) || (!(_arg_2 == this._cachedBodyPartsGeometryType))) || (!(k == this._cachedBodyPartsAvatarSet))))
{ {
this._cachedBodyPartsDirection = _arg_3; this._cachedBodyPartsDirection = _arg_3;
this._cachedBodyPartsGeometryType = _arg_2; this._cachedBodyPartsGeometryType = _arg_2;
@ -291,18 +277,18 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
public getAvatarPartsForCamera(k: string): void public getAvatarPartsForCamera(k: string): void
{ {
let _local_4: string; let _local_4: string;
if(this._mainAction == null) if (this._mainAction == null)
{ {
return; return;
} }
const _local_2 = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); const _local_2 = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType);
if(_local_2 == null) if (_local_2 == null)
{ {
return; return;
} }
const _local_3 = this.getBodyParts(k, this._mainAction.definition.geometryType, this._mainDirection); const _local_3 = this.getBodyParts(k, this._mainAction.definition.geometryType, this._mainDirection);
let _local_6 = (_local_3.length - 1); let _local_6 = (_local_3.length - 1);
while(_local_6 >= 0) while (_local_6 >= 0)
{ {
_local_4 = _local_3[_local_6]; _local_4 = _local_3[_local_6];
const _local_5 = this._cache.getImageContainer(_local_4, this._frameCounter, true); const _local_5 = this._cache.getImageContainer(_local_4, this._frameCounter, true);
@ -312,19 +298,19 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
public getImage(setType: string, hightlight: boolean, scale: number = 1, cache: boolean = true): RenderTexture public getImage(setType: string, hightlight: boolean, scale: number = 1, cache: boolean = true): RenderTexture
{ {
if(!this._changes) return this._image; if (!this._changes) return this._image;
if(!this._mainAction) return null; if (!this._mainAction) return null;
if(!this._actionsSorted) this.endActionAppends(); if (!this._actionsSorted) this.endActionAppends();
const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType);
if(!avatarCanvas) return null; if (!avatarCanvas) return null;
if(this._image && ((this._image.width !== avatarCanvas.width) || (this._image.height !== avatarCanvas.height))) if (this._image && ((this._image.width !== avatarCanvas.width) || (this._image.height !== avatarCanvas.height)))
{ {
if(this._reusableTexture) if (this._reusableTexture)
{ {
this._reusableTexture.destroy(true); this._reusableTexture.destroy(true);
@ -344,16 +330,16 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
let isCachable = true; let isCachable = true;
let partCount = (_local_6.length - 1); let partCount = (_local_6.length - 1);
while(partCount >= 0) while (partCount >= 0)
{ {
const set = _local_6[partCount]; const set = _local_6[partCount];
const part = this._cache.getImageContainer(set, this._frameCounter); const part = this._cache.getImageContainer(set, this._frameCounter);
if(part) if (part)
{ {
const partCacheContainer = part.image; const partCacheContainer = part.image;
if(!partCacheContainer) if (!partCacheContainer)
{ {
container.destroy({ container.destroy({
children: true children: true
@ -366,7 +352,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
const point = part.regPoint.clone(); const point = part.regPoint.clone();
if(point) if (point)
{ {
point.x += avatarCanvas.offset.x; point.x += avatarCanvas.offset.x;
point.y += avatarCanvas.offset.y; point.y += avatarCanvas.offset.y;
@ -378,7 +364,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
partContainer.addChild(partCacheContainer); partContainer.addChild(partCacheContainer);
if(partContainer) if (partContainer)
{ {
partContainer.position.set(point.x, point.y); partContainer.position.set(point.x, point.y);
@ -390,13 +376,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
partCount--; partCount--;
} }
if(this._avatarSpriteData) if (this._avatarSpriteData)
{ {
if(!container.filters) container.filters = []; if (!container.filters) container.filters = [];
if(this._avatarSpriteData.colorTransform) container.filters.push(this._avatarSpriteData.colorTransform); if (this._avatarSpriteData.colorTransform) container.filters.push(this._avatarSpriteData.colorTransform);
if(this._avatarSpriteData.paletteIsGrayscale) if (this._avatarSpriteData.paletteIsGrayscale)
{ {
this.convertToGrayscale(container); this.convertToGrayscale(container);
@ -404,12 +390,12 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
} }
} }
if(!cache) if (!cache)
{ {
return TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height)); return TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height));
} }
if(this._reusableTexture) if (this._reusableTexture)
{ {
PixiApplicationProxy.instance.renderer.render(container, { PixiApplicationProxy.instance.renderer.render(container, {
renderTexture: this._reusableTexture, renderTexture: this._reusableTexture,
@ -421,7 +407,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
this._reusableTexture = TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height)); this._reusableTexture = TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height));
} }
if(!this._reusableTexture) return null; if (!this._reusableTexture) return null;
/* /*
if(this._avatarSpriteData) if(this._avatarSpriteData)
@ -446,31 +432,31 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height); const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height);
const data = textureImageData.data; const data = textureImageData.data;
for(let i = 0; i < data.length; i += 4) for (let i = 0; i < data.length; i += 4)
{ {
if(reds.length == 256) if (reds.length == 256)
{ {
let paletteColor = reds[data[i]]; let paletteColor = reds[data[i]];
if(paletteColor === undefined) paletteColor = 0; if (paletteColor === undefined) paletteColor = 0;
data[i] = ((paletteColor >> 16) & 0xFF); data[i] = ((paletteColor >> 16) & 0xFF);
data[i + 1] = ((paletteColor >> 8) & 0xFF); data[i + 1] = ((paletteColor >> 8) & 0xFF);
data[i + 2] = (paletteColor & 0xFF); data[i + 2] = (paletteColor & 0xFF);
} }
if(greens.length == 256) if (greens.length == 256)
{ {
let paletteColor = greens[data[i + 1]]; let paletteColor = greens[data[i + 1]];
if(paletteColor === undefined) paletteColor = 0; if (paletteColor === undefined) paletteColor = 0;
data[i] = ((paletteColor >> 16) & 0xFF); data[i] = ((paletteColor >> 16) & 0xFF);
data[i + 1] = ((paletteColor >> 8) & 0xFF); data[i + 1] = ((paletteColor >> 8) & 0xFF);
data[i + 2] = (paletteColor & 0xFF); data[i + 2] = (paletteColor & 0xFF);
} }
if(blues.length == 256) if (blues.length == 256)
{ {
let paletteColor = greens[data[i + 2]]; let paletteColor = greens[data[i + 2]];
if(paletteColor === undefined) paletteColor = 0; if (paletteColor === undefined) paletteColor = 0;
data[i] = ((paletteColor >> 16) & 0xFF); data[i] = ((paletteColor >> 16) & 0xFF);
data[i + 1] = ((paletteColor >> 8) & 0xFF); data[i + 1] = ((paletteColor >> 8) & 0xFF);
@ -492,13 +478,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
public getImageAsSprite(setType: string, scale: number = 1): Sprite public getImageAsSprite(setType: string, scale: number = 1): Sprite
{ {
if(!this._mainAction) return null; if (!this._mainAction) return null;
if(!this._actionsSorted) this.endActionAppends(); if (!this._actionsSorted) this.endActionAppends();
const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType);
if(!avatarCanvas) return null; if (!avatarCanvas) return null;
const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection);
const container = new NitroSprite(); const container = new NitroSprite();
@ -511,16 +497,16 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
let partCount = (setTypes.length - 1); let partCount = (setTypes.length - 1);
while(partCount >= 0) while (partCount >= 0)
{ {
const set = setTypes[partCount]; const set = setTypes[partCount];
const part = this._cache.getImageContainer(set, this._frameCounter); const part = this._cache.getImageContainer(set, this._frameCounter);
if(part) if (part)
{ {
const partCacheContainer = part.image; const partCacheContainer = part.image;
if(!partCacheContainer) if (!partCacheContainer)
{ {
container.destroy({ container.destroy({
children: true children: true
@ -531,7 +517,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
const point = part.regPoint.clone(); const point = part.regPoint.clone();
if(point) if (point)
{ {
point.x += avatarCanvas.offset.x; point.x += avatarCanvas.offset.x;
point.y += avatarCanvas.offset.y; point.y += avatarCanvas.offset.y;
@ -557,29 +543,29 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
public getCroppedImage(setType: string, scale: number = 1): HTMLImageElement public getCroppedImage(setType: string, scale: number = 1): HTMLImageElement
{ {
if(!this._mainAction) return null; if (!this._mainAction) return null;
if(!this._actionsSorted) this.endActionAppends(); if (!this._actionsSorted) this.endActionAppends();
const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType);
if(!avatarCanvas) return null; if (!avatarCanvas) return null;
const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection);
const container = new NitroContainer(); const container = new NitroContainer();
let partCount = (setTypes.length - 1); let partCount = (setTypes.length - 1);
while(partCount >= 0) while (partCount >= 0)
{ {
const set = setTypes[partCount]; const set = setTypes[partCount];
const part = this._cache.getImageContainer(set, this._frameCounter); const part = this._cache.getImageContainer(set, this._frameCounter);
if(part) if (part)
{ {
const partCacheContainer = part.image; const partCacheContainer = part.image;
if(!partCacheContainer) if (!partCacheContainer)
{ {
container.destroy({ container.destroy({
children: true children: true
@ -590,7 +576,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
const point = part.regPoint.clone(); const point = part.regPoint.clone();
if(point) if (point)
{ {
point.x += avatarCanvas.offset.x; point.x += avatarCanvas.offset.x;
point.y += avatarCanvas.offset.y; point.y += avatarCanvas.offset.y;
@ -602,7 +588,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
partContainer.addChild(partCacheContainer); partContainer.addChild(partCacheContainer);
if(partContainer) if (partContainer)
{ {
partContainer.position.set(point.x, point.y); partContainer.position.set(point.x, point.y);
@ -618,7 +604,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
const image = TextureUtils.generateImage(texture); const image = TextureUtils.generateImage(texture);
if(!image) return null; if (!image) return null;
return image; return image;
} }
@ -627,9 +613,9 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
{ {
const existing = this._fullImageCache.getValue(k); const existing = this._fullImageCache.getValue(k);
if(existing) if (existing)
{ {
if(!existing.valid) if (!existing.valid)
{ {
this._fullImageCache.remove(k); this._fullImageCache.remove(k);
@ -646,18 +632,18 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
{ {
const existing = this._fullImageCache.getValue(k); const existing = this._fullImageCache.getValue(k);
if(existing) if (existing)
{ {
this._fullImageCache.remove(k); this._fullImageCache.remove(k);
existing.destroy(true); existing.destroy(true);
} }
if(this._fullImageCache.length === this._fullImageCacheSize) if (this._fullImageCache.length === this._fullImageCacheSize)
{ {
const oldestKey = this._fullImageCache.getKey(0); const oldestKey = this._fullImageCache.getKey(0);
if(oldestKey) if (oldestKey)
{ {
const removed = this._fullImageCache.remove(oldestKey); const removed = this._fullImageCache.remove(oldestKey);
@ -690,13 +676,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
{ {
let k: ActiveActionData; let k: ActiveActionData;
if(!this.sortActions()) return; if (!this.sortActions()) return;
for(const k of this._sortedActions) for (const k of this._sortedActions)
{ {
if(k.actionType === AvatarAction.EFFECT) if (k.actionType === AvatarAction.EFFECT)
{ {
if(!this._effectManager.isAvatarEffectReady(parseInt(k.actionParameter))) this._effectManager.downloadAvatarEffect(parseInt(k.actionParameter), this); if (!this._effectManager.isAvatarEffectReady(parseInt(k.actionParameter))) this._effectManager.downloadAvatarEffect(parseInt(k.actionParameter), this);
} }
} }
@ -710,14 +696,14 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
this._actionsSorted = false; this._actionsSorted = false;
if(_args && (_args.length > 0)) _local_3 = _args[0]; if (_args && (_args.length > 0)) _local_3 = _args[0];
if((_local_3 !== undefined) && (_local_3 !== null)) _local_3 = _local_3.toString(); if ((_local_3 !== undefined) && (_local_3 !== null)) _local_3 = _local_3.toString();
switch(k) switch (k)
{ {
case AvatarAction.POSTURE: case AvatarAction.POSTURE:
switch(_local_3) switch (_local_3)
{ {
case AvatarAction.POSTURE_LAY: case AvatarAction.POSTURE_LAY:
case AvatarAction.POSTURE_WALK: case AvatarAction.POSTURE_WALK:
@ -730,11 +716,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
case AvatarAction.SNOWWAR_DIE_BACK: case AvatarAction.SNOWWAR_DIE_BACK:
case AvatarAction.SNOWWAR_PICK: case AvatarAction.SNOWWAR_PICK:
case AvatarAction.SNOWWAR_THROW: case AvatarAction.SNOWWAR_THROW:
if((_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY)) if ((_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY))
{ {
if(_local_3 === AvatarAction.POSTURE_LAY) if (_local_3 === AvatarAction.POSTURE_LAY)
{ {
if(this._mainDirection == 0) if (this._mainDirection == 0)
{ {
this.setDirection(AvatarSetType.FULL, 4); this.setDirection(AvatarSetType.FULL, 4);
} }
@ -753,7 +739,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
} }
break; break;
case AvatarAction.GESTURE: case AvatarAction.GESTURE:
switch(_local_3) switch (_local_3)
{ {
case AvatarAction.GESTURE_AGGRAVATED: case AvatarAction.GESTURE_AGGRAVATED:
case AvatarAction.GESTURE_SAD: case AvatarAction.GESTURE_SAD:
@ -777,9 +763,9 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
case AvatarAction.EXPRESSION_SNOWBOARD_OLLIE: case AvatarAction.EXPRESSION_SNOWBOARD_OLLIE:
case AvatarAction.EXPRESSION_SNOWBORD_360: case AvatarAction.EXPRESSION_SNOWBORD_360:
case AvatarAction.EXPRESSION_RIDE_JUMP: case AvatarAction.EXPRESSION_RIDE_JUMP:
if(_local_3 === AvatarAction.EFFECT) if (_local_3 === AvatarAction.EFFECT)
{ {
if((((((_local_3 === '33') || (_local_3 === '34')) || (_local_3 === '35')) || (_local_3 === '36')) || (_local_3 === '38')) || (_local_3 === '39')) if ((((((_local_3 === '33') || (_local_3 === '34')) || (_local_3 === '35')) || (_local_3 === '36')) || (_local_3 === '38')) || (_local_3 === '39'))
{ {
this._useFullImageCache = true; this._useFullImageCache = true;
} }
@ -790,7 +776,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
case AvatarAction.CARRY_OBJECT: case AvatarAction.CARRY_OBJECT:
case AvatarAction.USE_OBJECT: { case AvatarAction.USE_OBJECT: {
const _local_4 = this._structure.getActionDefinitionWithState(k); const _local_4 = this._structure.getActionDefinitionWithState(k);
if(_local_4) _local_3 = _local_4.getParameterValue(_local_3); if (_local_4) _local_3 = _local_4.getParameterValue(_local_3);
this.addActionData(k, _local_3); this.addActionData(k, _local_3);
break; break;
} }
@ -802,13 +788,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
protected addActionData(k: string, _arg_2: string = ''): void protected addActionData(k: string, _arg_2: string = ''): void
{ {
let _local_3: ActiveActionData; let _local_3: ActiveActionData;
if(!this._actions) this._actions = []; if (!this._actions) this._actions = [];
let _local_4 = 0; let _local_4 = 0;
while(_local_4 < this._actions.length) while (_local_4 < this._actions.length)
{ {
_local_3 = this._actions[_local_4]; _local_3 = this._actions[_local_4];
if(((_local_3.actionType == k) && (_local_3.actionParameter == _arg_2))) if (((_local_3.actionType == k) && (_local_3.actionParameter == _arg_2)))
{ {
return; return;
} }
@ -841,14 +827,14 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
let _local_2: IActionDefinition; let _local_2: IActionDefinition;
let _local_3: ActiveActionData; let _local_3: ActiveActionData;
let k: boolean; let k: boolean;
if(this._sortedActions == null) if (this._sortedActions == null)
{ {
return false; return false;
} }
for(const _local_3 of this._sortedActions) for (const _local_3 of this._sortedActions)
{ {
_local_2 = this._structure.getActionDefinitionWithState(_local_3.actionType); _local_2 = this._structure.getActionDefinitionWithState(_local_3.actionType);
if(((!(_local_2 == null)) && (_local_2.getPreventHeadTurn(_local_3.actionParameter)))) if (((!(_local_2 == null)) && (_local_2.getPreventHeadTurn(_local_3.actionParameter))))
{ {
k = true; k = true;
} }
@ -868,11 +854,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
this._sortedActions = this._structure.sortActions(this._actions); this._sortedActions = this._structure.sortActions(this._actions);
this._animationFrameCount = this._structure.maxFrames(this._sortedActions); this._animationFrameCount = this._structure.maxFrames(this._sortedActions);
if(!this._sortedActions) if (!this._sortedActions)
{ {
this._canvasOffsets = [0, 0, 0]; this._canvasOffsets = [0, 0, 0];
if(this._lastActionsString !== '') if (this._lastActionsString !== '')
{ {
k = true; k = true;
@ -883,15 +869,15 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
{ {
this._canvasOffsets = this._structure.getCanvasOffsets(this._sortedActions, this._scale, this._mainDirection); this._canvasOffsets = this._structure.getCanvasOffsets(this._sortedActions, this._scale, this._mainDirection);
for(const _local_4 of this._sortedActions) for (const _local_4 of this._sortedActions)
{ {
this._currentActionsString = (this._currentActionsString + (_local_4.actionType + _local_4.actionParameter)); this._currentActionsString = (this._currentActionsString + (_local_4.actionType + _local_4.actionParameter));
if(_local_4.actionType === AvatarAction.EFFECT) if (_local_4.actionType === AvatarAction.EFFECT)
{ {
const _local_5 = parseInt(_local_4.actionParameter); const _local_5 = parseInt(_local_4.actionParameter);
if(this._effectIdInUse !== _local_5) _local_2 = true; if (this._effectIdInUse !== _local_5) _local_2 = true;
this._effectIdInUse = _local_5; this._effectIdInUse = _local_5;
@ -899,16 +885,16 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
} }
} }
if(!_local_3) if (!_local_3)
{ {
if(this._effectIdInUse > -1) _local_2 = true; if (this._effectIdInUse > -1) _local_2 = true;
this._effectIdInUse = -1; this._effectIdInUse = -1;
} }
if(_local_2) this._cache.disposeInactiveActions(0); if (_local_2) this._cache.disposeInactiveActions(0);
if(this._lastActionsString != this._currentActionsString) if (this._lastActionsString != this._currentActionsString)
{ {
k = true; k = true;
@ -923,60 +909,60 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
private setActionsToParts(): void private setActionsToParts(): void
{ {
if(!this._sortedActions == null) return; if (!this._sortedActions == null) return;
const _local_3: number = Nitro.instance.time; const _local_3: number = GetTickerTime();
const _local_4: string[] = []; const _local_4: string[] = [];
for(const k of this._sortedActions) _local_4.push(k.actionType); for (const k of this._sortedActions) _local_4.push(k.actionType);
for(const k of this._sortedActions) for (const k of this._sortedActions)
{ {
if((k && k.definition) && k.definition.isAnimation) if ((k && k.definition) && k.definition.isAnimation)
{ {
const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter)); const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter));
if(_local_2 && _local_2.hasOverriddenActions()) if (_local_2 && _local_2.hasOverriddenActions())
{ {
const _local_5 = _local_2.overriddenActionNames(); const _local_5 = _local_2.overriddenActionNames();
if(_local_5) if (_local_5)
{ {
for(const _local_6 of _local_5) for (const _local_6 of _local_5)
{ {
if(_local_4.indexOf(_local_6) >= 0) k.overridingAction = _local_2.overridingAction(_local_6); if (_local_4.indexOf(_local_6) >= 0) k.overridingAction = _local_2.overridingAction(_local_6);
} }
} }
} }
if(_local_2 && _local_2.resetOnToggle) if (_local_2 && _local_2.resetOnToggle)
{ {
this._animationHasResetOnToggle = true; this._animationHasResetOnToggle = true;
} }
} }
} }
for(const k of this._sortedActions) for (const k of this._sortedActions)
{ {
if(!((!(k)) || (!(k.definition)))) if (!((!(k)) || (!(k.definition))))
{ {
if(k.definition.isAnimation && (k.actionParameter === '')) k.actionParameter = '1'; if (k.definition.isAnimation && (k.actionParameter === '')) k.actionParameter = '1';
this.setActionToParts(k, _local_3); this.setActionToParts(k, _local_3);
if(k.definition.isAnimation) if (k.definition.isAnimation)
{ {
this._isAnimating = k.definition.isAnimated(k.actionParameter); this._isAnimating = k.definition.isAnimated(k.actionParameter);
const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter)); const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter));
if(_local_2) if (_local_2)
{ {
this._sprites = this._sprites.concat(_local_2.spriteData); this._sprites = this._sprites.concat(_local_2.spriteData);
if(_local_2.hasDirectionData()) this._directionOffset = _local_2.directionData.offset; if (_local_2.hasDirectionData()) this._directionOffset = _local_2.directionData.offset;
if(_local_2.hasAvatarData()) this._avatarSpriteData = _local_2.avatarData; if (_local_2.hasAvatarData()) this._avatarSpriteData = _local_2.avatarData;
} }
} }
} }
@ -985,15 +971,15 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
private setActionToParts(k: IActiveActionData, _arg_2: number): void private setActionToParts(k: IActiveActionData, _arg_2: number): void
{ {
if(((k == null) || (k.definition == null))) if (((k == null) || (k.definition == null)))
{ {
return; return;
} }
if(k.definition.assetPartDefinition == '') if (k.definition.assetPartDefinition == '')
{ {
return; return;
} }
if(k.definition.isMain) if (k.definition.isMain)
{ {
this._mainAction = k; this._mainAction = k;
this._cache.setGeometryType(k.definition.geometryType); this._cache.setGeometryType(k.definition.geometryType);
@ -1004,11 +990,11 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
private resetBodyPartCache(k: IActiveActionData): void private resetBodyPartCache(k: IActiveActionData): void
{ {
if(!k) return; if (!k) return;
if(k.definition.assetPartDefinition === '') return; if (k.definition.assetPartDefinition === '') return;
if(k.definition.isMain) if (k.definition.isMain)
{ {
this._mainAction = k; this._mainAction = k;
this._cache.setGeometryType(k.definition.geometryType); this._cache.setGeometryType(k.definition.geometryType);
@ -1030,7 +1016,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
let _local_5 = 0.33; let _local_5 = 0.33;
const _local_6 = 1; const _local_6 = 1;
switch(channel) switch (channel)
{ {
case AvatarImage.CHANNELS_UNIQUE: case AvatarImage.CHANNELS_UNIQUE:
_local_3 = 0.3; _local_3 = 0.3;
@ -1098,7 +1084,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
public resetEffect(effect: number): void public resetEffect(effect: number): void
{ {
if(effect === this._effectIdInUse) if (effect === this._effectIdInUse)
{ {
this.resetActions(); this.resetActions();
this.setActionsToParts(); this.setActionsToParts();
@ -1106,7 +1092,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
this._animationHasResetOnToggle = true; this._animationHasResetOnToggle = true;
this._changes = true; this._changes = true;
if(this._effectListener) this._effectListener.resetEffect(effect); if (this._effectListener) this._effectListener.resetEffect(effect);
} }
} }
} }

View File

@ -1,7 +1,6 @@
import { AdjustmentFilter } from '@pixi/filter-adjustment'; import { AdjustmentFilter } from '@pixi/filter-adjustment';
import { IActionDefinition } from './actions/IActionDefinition'; import { IActionDefinition, IPartColor } from '../../api';
import { AvatarAnimationFrame } from './structure/animation/AvatarAnimationFrame'; import { AvatarAnimationFrame } from './structure';
import { IPartColor } from './structure/figure/IPartColor';
export class AvatarImagePartContainer export class AvatarImagePartContainer
{ {
@ -17,30 +16,30 @@ export class AvatarImagePartContainer
private _blendTransform: AdjustmentFilter; private _blendTransform: AdjustmentFilter;
private _paletteMapId: number; private _paletteMapId: number;
constructor(k: string, _arg_2: string, _arg_3: string, _arg_4: IPartColor, _arg_5: AvatarAnimationFrame[], _arg_6: IActionDefinition, _arg_7: boolean, _arg_8: number, _arg_9: string = '', _arg_10: boolean = false, _arg_11: number = 1) constructor(bodyPartId: string, partType: string, partId: string, partColor: IPartColor, frames: AvatarAnimationFrame[], action: IActionDefinition, isColorable: boolean, paletteMapId: number, flippedPartType: string = '', isBlendable: boolean = false, _arg_11: number = 1)
{ {
this._bodyPartId = k; this._bodyPartId = bodyPartId;
this._partType = _arg_2; this._partType = partType;
this._partId = _arg_3; this._partId = partId;
this._color = _arg_4; this._color = partColor;
this._frames = _arg_5; this._frames = frames;
this._action = _arg_6; this._action = action;
this._isColorable = _arg_7; this._isColorable = isColorable;
this._paletteMapId = _arg_8; this._paletteMapId = paletteMapId;
this._flippedPartType = _arg_9; this._flippedPartType = flippedPartType;
this._isBlendable = _arg_10; this._isBlendable = isBlendable;
this._blendTransform = null; this._blendTransform = null;
if(this._partType === 'ey') this._isColorable = false; if (this._partType === 'ey') this._isColorable = false;
} }
public getFrameIndex(k: number): number public getFrameIndex(k: number): number
{ {
if(!this._frames || !this._frames.length) return 0; if (!this._frames || !this._frames.length) return 0;
const frameNumber = (k % this._frames.length); const frameNumber = (k % this._frames.length);
if(this._frames[frameNumber] instanceof AvatarAnimationFrame) if (this._frames[frameNumber] instanceof AvatarAnimationFrame)
{ {
return this._frames[frameNumber].number; return this._frames[frameNumber].number;
} }
@ -52,9 +51,9 @@ export class AvatarImagePartContainer
{ {
const frameNumber = (k % this._frames.length); const frameNumber = (k % this._frames.length);
if(this._frames && (this._frames.length > frameNumber)) if (this._frames && (this._frames.length > frameNumber))
{ {
if(this._frames[frameNumber] instanceof AvatarAnimationFrame) if (this._frames[frameNumber] instanceof AvatarAnimationFrame)
{ {
return this._frames[frameNumber]; return this._frames[frameNumber];
} }
@ -67,9 +66,9 @@ export class AvatarImagePartContainer
{ {
const frameNumber = (k % this._frames.length); const frameNumber = (k % this._frames.length);
if(this._frames && (this._frames.length > frameNumber)) if (this._frames && (this._frames.length > frameNumber))
{ {
if(this._frames[frameNumber] instanceof AvatarAnimationFrame) if (this._frames[frameNumber] instanceof AvatarAnimationFrame)
{ {
const frame = this._frames[frameNumber]; const frame = this._frames[frameNumber];
@ -132,6 +131,6 @@ export class AvatarImagePartContainer
public toString(): string public toString(): string
{ {
return [ this._bodyPartId, this._partType, this._partId ].join(':'); return [this._bodyPartId, this._partType, this._partId].join(':');
} }
} }

View File

@ -1,29 +1,19 @@
import { IAssetManager, IGraphicAsset } from '../../api'; import { AvatarSetType, IAssetManager, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IFigureData, IFigurePartSet, IFigureSetData, IGraphicAsset, IStructureData } from '../../api';
import { NitroEvent, NitroManager } from '../../core'; import { NitroEvent, NitroManager } from '../../core';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
import { FigureDataContainer } from '../utils/FigureDataContainer'; import { FigureDataContainer } from '../utils';
import { AssetAliasCollection } from './alias/AssetAliasCollection'; import { AssetAliasCollection } from './alias';
import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager'; import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager';
import { AvatarFigureContainer } from './AvatarFigureContainer'; import { AvatarFigureContainer } from './AvatarFigureContainer';
import { AvatarImage } from './AvatarImage'; import { AvatarImage } from './AvatarImage';
import { AvatarStructure } from './AvatarStructure'; import { AvatarStructure } from './AvatarStructure';
import { HabboAvatarAnimations } from './data/HabboAvatarAnimations'; import { HabboAvatarAnimations } from "./data/HabboAvatarAnimations";
import { HabboAvatarGeometry } from './data/HabboAvatarGeometry'; import { HabboAvatarGeometry } from './data/HabboAvatarGeometry';
import { HabboAvatarPartSets } from './data/HabboAvatarPartSets'; import { HabboAvatarPartSets } from './data/HabboAvatarPartSets';
import { EffectAssetDownloadManager } from './EffectAssetDownloadManager'; import { EffectAssetDownloadManager } from './EffectAssetDownloadManager';
import { AvatarSetType } from './enum/AvatarSetType'; import { AvatarRenderEvent } from './events';
import { AvatarRenderEvent } from './events/AvatarRenderEvent';
import { IAvatarEffectListener } from './IAvatarEffectListener';
import { IAvatarFigureContainer } from './IAvatarFigureContainer';
import { IAvatarImage } from './IAvatarImage';
import { IAvatarImageListener } from './IAvatarImageListener';
import { IAvatarRenderManager } from './IAvatarRenderManager';
import { IFigureData } from './interfaces';
import { PlaceHolderAvatarImage } from './PlaceHolderAvatarImage'; import { PlaceHolderAvatarImage } from './PlaceHolderAvatarImage';
import { AvatarStructureDownload } from './structure/AvatarStructureDownload'; import { AvatarStructureDownload } from './structure';
import { IFigurePartSet } from './structure/figure/IFigurePartSet';
import { IFigureSetData } from './structure/IFigureSetData';
import { IStructureData } from './structure/IStructureData';
export class AvatarRenderManager extends NitroManager implements IAvatarRenderManager export class AvatarRenderManager extends NitroManager implements IAvatarRenderManager
{ {
@ -84,7 +74,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
this._aliasCollection.init(); this._aliasCollection.init();
if(!this._avatarAssetDownloadManager) if (!this._avatarAssetDownloadManager)
{ {
this._avatarAssetDownloadManager = new AvatarAssetDownloadManager(Nitro.instance.core.asset, this._structure); this._avatarAssetDownloadManager = new AvatarAssetDownloadManager(Nitro.instance.core.asset, this._structure);
@ -92,7 +82,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded);
} }
if(!this._effectAssetDownloadManager) if (!this._effectAssetDownloadManager)
{ {
this._effectAssetDownloadManager = new EffectAssetDownloadManager(Nitro.instance.core.asset, this._structure); this._effectAssetDownloadManager = new EffectAssetDownloadManager(Nitro.instance.core.asset, this._structure);
@ -105,14 +95,14 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
public onDispose(): void public onDispose(): void
{ {
if(this._avatarAssetDownloadManager) if (this._avatarAssetDownloadManager)
{ {
this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady); this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady);
this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded);
} }
if(this._effectAssetDownloadManager) if (this._effectAssetDownloadManager)
{ {
this._effectAssetDownloadManager.removeEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady); this._effectAssetDownloadManager.removeEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady);
@ -122,7 +112,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
private loadGeometry(): void private loadGeometry(): void
{ {
if(!this._structure) return; if (!this._structure) return;
this._structure.initGeometry(HabboAvatarGeometry.geometry); this._structure.initGeometry(HabboAvatarGeometry.geometry);
@ -133,7 +123,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
private loadPartSets(): void private loadPartSets(): void
{ {
if(!this._structure) return; if (!this._structure) return;
this._structure.initPartSets(HabboAvatarPartSets.partSets); this._structure.initPartSets(HabboAvatarPartSets.partSets);
@ -146,7 +136,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{ {
const defaultActions = Nitro.instance.getConfiguration<string>('avatar.default.actions'); const defaultActions = Nitro.instance.getConfiguration<string>('avatar.default.actions');
if(defaultActions) this._structure.initActions(Nitro.instance.core.asset, defaultActions); if (defaultActions) this._structure.initActions(Nitro.instance.core.asset, defaultActions);
const request = new XMLHttpRequest(); const request = new XMLHttpRequest();
@ -158,7 +148,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
request.onloadend = e => request.onloadend = e =>
{ {
if(!this._structure) return; if (!this._structure) return;
this._structure.updateActions(JSON.parse(request.responseText)); this._structure.updateActions(JSON.parse(request.responseText));
@ -181,7 +171,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
private loadAnimations(): void private loadAnimations(): void
{ {
if(!this._structure) return; if (!this._structure) return;
this._structure.initAnimation(HabboAvatarAnimations.animations); this._structure.initAnimation(HabboAvatarAnimations.animations);
@ -194,14 +184,14 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{ {
const defaultFigureData = Nitro.instance.getConfiguration<IFigureData>('avatar.default.figuredata'); const defaultFigureData = Nitro.instance.getConfiguration<IFigureData>('avatar.default.figuredata');
if(!defaultFigureData || (typeof defaultFigureData === 'string')) if (!defaultFigureData || (typeof defaultFigureData === 'string'))
{ {
this.logger.error('XML figuredata is no longer supported'); this.logger.error('XML figuredata is no longer supported');
return; return;
} }
if(this._structure) this._structure.initFigureData(defaultFigureData); if (this._structure) this._structure.initFigureData(defaultFigureData);
const structureDownloader = new AvatarStructureDownload(Nitro.instance.getConfiguration<string>('avatar.figuredata.url'), (this._structure.figureData as IFigureSetData)); const structureDownloader = new AvatarStructureDownload(Nitro.instance.getConfiguration<string>('avatar.figuredata.url'), (this._structure.figureData as IFigureSetData));
@ -219,7 +209,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
private onAvatarAssetDownloaderReady(event: NitroEvent): void private onAvatarAssetDownloaderReady(event: NitroEvent): void
{ {
if(!event) return; if (!event) return;
this._figureMapReady = true; this._figureMapReady = true;
@ -228,14 +218,14 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
private onAvatarAssetDownloaded(event: NitroEvent): void private onAvatarAssetDownloaded(event: NitroEvent): void
{ {
if(!event) return; if (!event) return;
this._aliasCollection.reset(); this._aliasCollection.reset();
} }
private onEffectAssetDownloaderReady(event: NitroEvent): void private onEffectAssetDownloaderReady(event: NitroEvent): void
{ {
if(!event) return; if (!event) return;
this._effectMapReady = true; this._effectMapReady = true;
@ -244,20 +234,20 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
private onEffectAssetDownloaded(event: NitroEvent): void private onEffectAssetDownloaded(event: NitroEvent): void
{ {
if(!event) return; if (!event) return;
this._aliasCollection.reset(); this._aliasCollection.reset();
} }
private checkReady(): void private checkReady(): void
{ {
if(this._isReady) return; if (this._isReady) return;
if(!this._geometryReady || !this._partSetsReady || !this._actionsReady || !this._animationsReady || !this._figureMapReady || !this._effectMapReady || !this._structureReady) return; if (!this._geometryReady || !this._partSetsReady || !this._actionsReady || !this._animationsReady || !this._figureMapReady || !this._effectMapReady || !this._structureReady) return;
this._isReady = true; this._isReady = true;
if(this.events) this.events.dispatchEvent(new NitroEvent(AvatarRenderEvent.AVATAR_RENDER_READY)); if (this.events) this.events.dispatchEvent(new NitroEvent(AvatarRenderEvent.AVATAR_RENDER_READY));
} }
public createFigureContainer(figure: string): IAvatarFigureContainer public createFigureContainer(figure: string): IAvatarFigureContainer
@ -267,25 +257,25 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
public isFigureContainerReady(container: IAvatarFigureContainer): boolean public isFigureContainerReady(container: IAvatarFigureContainer): boolean
{ {
if(!this._avatarAssetDownloadManager) return false; if (!this._avatarAssetDownloadManager) return false;
return this._avatarAssetDownloadManager.isAvatarFigureContainerReady(container); return this._avatarAssetDownloadManager.isAvatarFigureContainerReady(container);
} }
public createAvatarImage(figure: string, size: string, gender: string, listener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage public createAvatarImage(figure: string, size: string, gender: string, listener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage
{ {
if(!this._structure || !this._avatarAssetDownloadManager) return null; if (!this._structure || !this._avatarAssetDownloadManager) return null;
const figureContainer = new AvatarFigureContainer(figure); const figureContainer = new AvatarFigureContainer(figure);
if(gender) this.validateAvatarFigure(figureContainer, gender); if (gender) this.validateAvatarFigure(figureContainer, gender);
if(this._avatarAssetDownloadManager.isAvatarFigureContainerReady(figureContainer)) if (this._avatarAssetDownloadManager.isAvatarFigureContainerReady(figureContainer))
{ {
return new AvatarImage(this._structure, this._aliasCollection, figureContainer, size, this._effectAssetDownloadManager, effectListener); return new AvatarImage(this._structure, this._aliasCollection, figureContainer, size, this._effectAssetDownloadManager, effectListener);
} }
if(!this._placeHolderFigure) this._placeHolderFigure = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE); if (!this._placeHolderFigure) this._placeHolderFigure = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE);
this._avatarAssetDownloadManager.downloadAvatarFigure(figureContainer, listener); this._avatarAssetDownloadManager.downloadAvatarFigure(figureContainer, listener);
@ -294,7 +284,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void
{ {
if(!this._avatarAssetDownloadManager) return; if (!this._avatarAssetDownloadManager) return;
this._avatarAssetDownloadManager.downloadAvatarFigure(container, listener); this._avatarAssetDownloadManager.downloadAvatarFigure(container, listener);
} }
@ -305,17 +295,17 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
const typeIds = this._structure.getMandatorySetTypeIds(gender, 2); const typeIds = this._structure.getMandatorySetTypeIds(gender, 2);
if(typeIds) if (typeIds)
{ {
const figureData = this._structure.figureData; const figureData = this._structure.figureData;
for(const id of typeIds) for (const id of typeIds)
{ {
if(!container.hasPartType(id)) if (!container.hasPartType(id))
{ {
const figurePartSet = this._structure.getDefaultPartSet(id, gender); const figurePartSet = this._structure.getDefaultPartSet(id, gender);
if(figurePartSet) if (figurePartSet)
{ {
container.updatePart(id, figurePartSet.id, [0]); container.updatePart(id, figurePartSet.id, [0]);
@ -326,15 +316,15 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
{ {
const setType = figureData.getSetType(id); const setType = figureData.getSetType(id);
if(setType) if (setType)
{ {
const figurePartSet = setType.getPartSet(container.getPartSetId(id)); const figurePartSet = setType.getPartSet(container.getPartSetId(id));
if(!figurePartSet) if (!figurePartSet)
{ {
const partSet = this._structure.getDefaultPartSet(id, gender); const partSet = this._structure.getDefaultPartSet(id, gender);
if(partSet) if (partSet)
{ {
container.updatePart(id, partSet.id, [0]); container.updatePart(id, partSet.id, [0]);
@ -351,49 +341,49 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[] = null): number public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[] = null): number
{ {
if(!this._structure) return 0; if (!this._structure) return 0;
const figureData = this._structure.figureData; const figureData = this._structure.figureData;
const parts = Array.from(container.getPartTypeIds()); const parts = Array.from(container.getPartTypeIds());
let clubLevel = 0; let clubLevel = 0;
for(const part of parts) for (const part of parts)
{ {
const set = figureData.getSetType(part); const set = figureData.getSetType(part);
if(!set) continue; if (!set) continue;
const setId = container.getPartSetId(part); const setId = container.getPartSetId(part);
const partSet = set.getPartSet(setId); const partSet = set.getPartSet(setId);
if(partSet) if (partSet)
{ {
clubLevel = Math.max(partSet.clubLevel, clubLevel); clubLevel = Math.max(partSet.clubLevel, clubLevel);
const palette = figureData.getPalette(set.paletteID); const palette = figureData.getPalette(set.paletteID);
const colors = container.getPartColorIds(part); const colors = container.getPartColorIds(part);
for(const colorId of colors) for (const colorId of colors)
{ {
const color = palette.getColor(colorId); const color = palette.getColor(colorId);
if(!color) continue; if (!color) continue;
clubLevel = Math.max(color.clubLevel, clubLevel); clubLevel = Math.max(color.clubLevel, clubLevel);
} }
} }
} }
if(!searchParts) searchParts = this._structure.getBodyPartsUnordered(AvatarSetType.FULL); if (!searchParts) searchParts = this._structure.getBodyPartsUnordered(AvatarSetType.FULL);
for(const part of searchParts) for (const part of searchParts)
{ {
const set = figureData.getSetType(part); const set = figureData.getSetType(part);
if(!set) continue; if (!set) continue;
if(parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel); if (parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel);
} }
return clubLevel; return clubLevel;
@ -407,15 +397,15 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
return !!(partSet && ((partSet.gender.toUpperCase() === 'U') || (partSet.gender.toUpperCase() === gender.toUpperCase()))); return !!(partSet && ((partSet.gender.toUpperCase() === 'U') || (partSet.gender.toUpperCase() === gender.toUpperCase())));
} }
public getFigureStringWithFigureIds(k: string, _arg_2: string, _arg_3: number[]): string public getFigureStringWithFigureIds(figure: string, gender: string, _arg_3: number[]): string
{ {
const container = new FigureDataContainer(); const container = new FigureDataContainer();
container.loadAvatarData(k, _arg_2); container.loadAvatarData(figure, gender);
const partSets: IFigurePartSet[] = this.resolveFigureSets(_arg_3); const partSets: IFigurePartSet[] = this.resolveFigureSets(_arg_3);
for(const partSet of partSets) for (const partSet of partSets)
{ {
container.savePartData(partSet.type, partSet.id, container.getColourIds(partSet.type)); container.savePartData(partSet.type, partSet.id, container.getColourIds(partSet.type));
} }
@ -423,16 +413,16 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
return container.getFigureString(); return container.getFigureString();
} }
private resolveFigureSets(k: number[]): IFigurePartSet[] private resolveFigureSets(setIds: number[]): IFigurePartSet[]
{ {
const structure = this.structureData; const structure = this.structureData;
const partSets: IFigurePartSet[] = []; const partSets: IFigurePartSet[] = [];
for(const _local_4 of k) for (const setId of setIds)
{ {
const partSet = structure.getFigurePartSet(_local_4); const partSet = structure.getFigurePartSet(setId);
if(partSet) partSets.push(partSet); if (partSet) partSets.push(partSet);
} }
return partSets; return partSets;
@ -440,7 +430,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
public getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[] public getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[]
{ {
if(!this._structure) return null; if (!this._structure) return null;
return this._structure.getMandatorySetTypeIds(k, _arg_2); return this._structure.getMandatorySetTypeIds(k, _arg_2);
} }
@ -467,7 +457,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
public get structureData(): IStructureData public get structureData(): IStructureData
{ {
if(this._structure) return this._structure.figureData; if (this._structure) return this._structure.figureData;
return null; return null;
} }

View File

@ -1,30 +1,12 @@
import { Point } from '@pixi/math'; import { Point } from '@pixi/math';
import { IAssetAnimation, IAssetManager } from '../../api'; import { AvatarDirectionAngle, IActionDefinition, IActiveActionData, IAssetAnimation, IAssetManager, IAvatarFigureContainer, IAvatarImage, IAvatarRenderManager, IFigureData, IFigurePartSet, IPartColor, IStructureData } from '../../api';
import { EventDispatcher } from '../../core'; import { EventDispatcher } from '../../core';
import { ActionDefinition } from './actions/ActionDefinition'; import { ActionDefinition, AvatarActionManager } from './actions';
import { AvatarActionManager } from './actions/AvatarActionManager'; import { Animation, AnimationManager, AvatarAnimationLayerData } from './animation';
import { IActionDefinition } from './actions/IActionDefinition';
import { IActiveActionData } from './actions/IActiveActionData';
import { Animation } from './animation/Animation';
import { AnimationManager } from './animation/AnimationManager';
import { AvatarAnimationLayerData } from './animation/AvatarAnimationLayerData';
import { AvatarImagePartContainer } from './AvatarImagePartContainer'; import { AvatarImagePartContainer } from './AvatarImagePartContainer';
import { AvatarRenderManager } from './AvatarRenderManager'; import { AvatarRenderManager } from './AvatarRenderManager';
import { AvatarDirectionAngle } from './enum/AvatarDirectionAngle'; import { AvatarModelGeometry } from './geometry';
import { AvatarModelGeometry } from './geometry/AvatarModelGeometry'; import { AnimationAction, AvatarAnimationData, AvatarAnimationFrame, AvatarCanvas, FigureSetData, PartSetsData } from './structure';
import { IAvatarFigureContainer } from './IAvatarFigureContainer';
import { IAvatarImage } from './IAvatarImage';
import { IAvatarRenderManager } from './IAvatarRenderManager';
import { IFigureData } from './interfaces';
import { AnimationAction } from './structure/animation/AnimationAction';
import { AvatarAnimationFrame } from './structure/animation/AvatarAnimationFrame';
import { AvatarAnimationData } from './structure/AvatarAnimationData';
import { AvatarCanvas } from './structure/AvatarCanvas';
import { IFigurePartSet } from './structure/figure/IFigurePartSet';
import { IPartColor } from './structure/figure/IPartColor';
import { FigureSetData } from './structure/FigureSetData';
import { IStructureData } from './structure/IStructureData';
import { PartSetsData } from './structure/PartSetsData';
export class AvatarStructure extends EventDispatcher export class AvatarStructure extends EventDispatcher
{ {
@ -60,7 +42,7 @@ export class AvatarStructure extends EventDispatcher
public dispose(): void public dispose(): void
{ {
if(this.disposed) return; if (this.disposed) return;
super.dispose(); super.dispose();
@ -73,14 +55,14 @@ export class AvatarStructure extends EventDispatcher
public initGeometry(k: any): void public initGeometry(k: any): void
{ {
if(!k) return; if (!k) return;
this._geometry = new AvatarModelGeometry(k); this._geometry = new AvatarModelGeometry(k);
} }
public initActions(k: IAssetManager, _arg_2: any): void public initActions(k: IAssetManager, _arg_2: any): void
{ {
if(!_arg_2) return; if (!_arg_2) return;
this._actionManager = new AvatarActionManager(k, _arg_2); this._actionManager = new AvatarActionManager(k, _arg_2);
this._defaultAction = this._actionManager.getDefaultAction(); this._defaultAction = this._actionManager.getDefaultAction();
@ -95,9 +77,9 @@ export class AvatarStructure extends EventDispatcher
public initPartSets(k: any): boolean public initPartSets(k: any): boolean
{ {
if(!k) return false; if (!k) return false;
if(this._partSetsData.parse(k)) if (this._partSetsData.parse(k))
{ {
this._partSetsData.getPartDefinition('ri').appendToFigure = true; this._partSetsData.getPartDefinition('ri').appendToFigure = true;
this._partSetsData.getPartDefinition('li').appendToFigure = true; this._partSetsData.getPartDefinition('li').appendToFigure = true;
@ -110,14 +92,14 @@ export class AvatarStructure extends EventDispatcher
public initAnimation(k: any): boolean public initAnimation(k: any): boolean
{ {
if(!k) return false; if (!k) return false;
return this._animationData.parse(k); return this._animationData.parse(k);
} }
public initFigureData(k: IFigureData): boolean public initFigureData(k: IFigureData): boolean
{ {
if(!k) return false; if (!k) return false;
return this._figureData.parse(k); return this._figureData.parse(k);
} }
@ -131,11 +113,11 @@ export class AvatarStructure extends EventDispatcher
{ {
let index = 0; let index = 0;
while(index < _arg_3) while (index < _arg_3)
{ {
const collection = k.getCollection((_arg_2 + index)); const collection = k.getCollection((_arg_2 + index));
if(collection) if (collection)
{ {
const animationData = collection.data; const animationData = collection.data;
@ -155,15 +137,15 @@ export class AvatarStructure extends EventDispatcher
{ {
const _local_4 = k.getPartColorIds(_arg_2); const _local_4 = k.getPartColorIds(_arg_2);
if((!(_local_4)) || (_local_4.length < _arg_3)) return null; if ((!(_local_4)) || (_local_4.length < _arg_3)) return null;
const _local_5 = this._figureData.getSetType(_arg_2); const _local_5 = this._figureData.getSetType(_arg_2);
if(_local_5 == null) return null; if (_local_5 == null) return null;
const _local_6 = this._figureData.getPalette(_local_5.paletteID); const _local_6 = this._figureData.getPalette(_local_5.paletteID);
if(!_local_6) return null; if (!_local_6) return null;
return _local_6.getColor(_local_4[_arg_3]); return _local_6.getColor(_local_4[_arg_3]);
} }
@ -202,7 +184,7 @@ export class AvatarStructure extends EventDispatcher
{ {
let _local_2 = 0; let _local_2 = 0;
for(const _local_3 of k) for (const _local_3 of k)
{ {
_local_2 = Math.max(_local_2, this._animationData.getFrameCount(_local_3.definition)); _local_2 = Math.max(_local_2, this._animationData.getFrameCount(_local_3.definition));
} }
@ -211,12 +193,12 @@ export class AvatarStructure extends EventDispatcher
public getMandatorySetTypeIds(k: string, _arg_2: number): string[] public getMandatorySetTypeIds(k: string, _arg_2: number): string[]
{ {
if(!this._mandatorySetTypeIds[k]) if (!this._mandatorySetTypeIds[k])
{ {
this._mandatorySetTypeIds[k] = []; this._mandatorySetTypeIds[k] = [];
} }
if(this._mandatorySetTypeIds[k][_arg_2]) if (this._mandatorySetTypeIds[k][_arg_2])
{ {
return this._mandatorySetTypeIds[k][_arg_2]; return this._mandatorySetTypeIds[k][_arg_2];
} }
@ -253,16 +235,16 @@ export class AvatarStructure extends EventDispatcher
const _local_4: string[] = []; const _local_4: string[] = [];
const _local_5 = k.definition.geometryType; const _local_5 = k.definition.geometryType;
if(k.definition.isAnimation) if (k.definition.isAnimation)
{ {
const _local_7 = ((k.definition.state + '.') + k.actionParameter); const _local_7 = ((k.definition.state + '.') + k.actionParameter);
const _local_8 = this._animationManager.getAnimation(_local_7); const _local_8 = this._animationManager.getAnimation(_local_7);
if(_local_8) if (_local_8)
{ {
_local_3 = _local_8.getAnimatedBodyPartIds(0, k.overridingAction); _local_3 = _local_8.getAnimatedBodyPartIds(0, k.overridingAction);
if(_local_8.hasAddData()) if (_local_8.hasAddData())
{ {
const _local_11 = { const _local_11 = {
id: '', id: '',
@ -280,11 +262,11 @@ export class AvatarStructure extends EventDispatcher
setType: '' setType: ''
}; };
for(const _local_13 of _local_8.addData) for (const _local_13 of _local_8.addData)
{ {
const _local_6 = this._geometry.getBodyPart(_local_5, _local_13.align); const _local_6 = this._geometry.getBodyPart(_local_5, _local_13.align);
if(_local_6) if (_local_6)
{ {
_local_11.id = _local_13.id; _local_11.id = _local_13.id;
_local_6.addPart(_local_11, _arg_2); _local_6.addPart(_local_11, _arg_2);
@ -294,30 +276,30 @@ export class AvatarStructure extends EventDispatcher
const _local_10 = this._partSetsData.addPartDefinition(_local_12); const _local_10 = this._partSetsData.addPartDefinition(_local_12);
_local_10.appendToFigure = true; _local_10.appendToFigure = true;
if(_local_13.base === '') _local_10.staticId = 1; if (_local_13.base === '') _local_10.staticId = 1;
if(_local_4.indexOf(_local_6.id) === -1) _local_4.push(_local_6.id); if (_local_4.indexOf(_local_6.id) === -1) _local_4.push(_local_6.id);
} }
} }
} }
} }
for(const _local_9 of _local_3) for (const _local_9 of _local_3)
{ {
const _local_6 = this._geometry.getBodyPart(_local_5, _local_9); const _local_6 = this._geometry.getBodyPart(_local_5, _local_9);
if(_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); if (_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id);
} }
} }
else else
{ {
_local_3 = this._partSetsData.getActiveParts(k.definition); _local_3 = this._partSetsData.getActiveParts(k.definition);
for(const _local_14 of _local_3) for (const _local_14 of _local_3)
{ {
const _local_6 = this._geometry.getBodyPartOfItem(_local_5, _local_14, _arg_2); const _local_6 = this._geometry.getBodyPartOfItem(_local_5, _local_14, _arg_2);
if(_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); if (_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id);
} }
} }
@ -340,7 +322,7 @@ export class AvatarStructure extends EventDispatcher
{ {
const _local_5 = this._animationData.getAction(k.definition); const _local_5 = this._animationData.getAction(k.definition);
if(_local_5) return _local_5.getFrameBodyPartOffset(_arg_2, _arg_3, _arg_4); if (_local_5) return _local_5.getFrameBodyPartOffset(_arg_2, _arg_3, _arg_4);
return AnimationAction.DEFAULT_OFFSET; return AnimationAction.DEFAULT_OFFSET;
} }
@ -353,31 +335,31 @@ export class AvatarStructure extends EventDispatcher
let _local_20: AvatarAnimationFrame[] = []; let _local_20: AvatarAnimationFrame[] = [];
let _local_36: IPartColor = null; let _local_36: IPartColor = null;
if(!_arg_3 == null) return []; if (!_arg_3 == null) return [];
const _local_9 = this._partSetsData.getActiveParts(_arg_3.definition); const _local_9 = this._partSetsData.getActiveParts(_arg_3.definition);
const _local_11: AvatarImagePartContainer[] = []; const _local_11: AvatarImagePartContainer[] = [];
let _local_14: any[] = [0]; let _local_14: any[] = [0];
const _local_15 = this._animationData.getAction(_arg_3.definition); const _local_15 = this._animationData.getAction(_arg_3.definition);
if(_arg_3.definition.isAnimation) if (_arg_3.definition.isAnimation)
{ {
const _local_24 = ((_arg_3.definition.state + '.') + _arg_3.actionParameter); const _local_24 = ((_arg_3.definition.state + '.') + _arg_3.actionParameter);
const _local_10 = this._animationManager.getAnimation(_local_24); const _local_10 = this._animationManager.getAnimation(_local_24);
if(_local_10) if (_local_10)
{ {
_local_14 = this.getPopulatedArray(_local_10.frameCount(_arg_3.overridingAction)); _local_14 = this.getPopulatedArray(_local_10.frameCount(_arg_3.overridingAction));
for(const _local_25 of _local_10.getAnimatedBodyPartIds(0, _arg_3.overridingAction)) for (const _local_25 of _local_10.getAnimatedBodyPartIds(0, _arg_3.overridingAction))
{ {
if(_local_25 === k) if (_local_25 === k)
{ {
const _local_26 = this._geometry.getBodyPart(_arg_4, _local_25); const _local_26 = this._geometry.getBodyPart(_arg_4, _local_25);
if(_local_26) if (_local_26)
{ {
for(const _local_27 of _local_26.getDynamicParts(_arg_7)) for (const _local_27 of _local_26.getDynamicParts(_arg_7))
{ {
_local_9.push(_local_27.id); _local_9.push(_local_27.id);
} }
@ -390,11 +372,11 @@ export class AvatarStructure extends EventDispatcher
const _local_16 = this._geometry.getParts(_arg_4, k, _arg_5, _local_9, _arg_7); const _local_16 = this._geometry.getParts(_arg_4, k, _arg_5, _local_9, _arg_7);
const _local_21 = _arg_2.getPartTypeIds(); const _local_21 = _arg_2.getPartTypeIds();
for(const _local_17 of _local_21) for (const _local_17 of _local_21)
{ {
if(_arg_8) if (_arg_8)
{ {
if(_arg_8.get(_local_17)) continue; if (_arg_8.get(_local_17)) continue;
} }
const _local_28 = _arg_2.getPartSetId(_local_17); const _local_28 = _arg_2.getPartSetId(_local_17);
@ -403,27 +385,27 @@ export class AvatarStructure extends EventDispatcher
if(_local_30) if (_local_30)
{ {
const _local_31 = this._figureData.getPalette(_local_30.paletteID); const _local_31 = this._figureData.getPalette(_local_30.paletteID);
if(_local_31) if (_local_31)
{ {
const _local_32 = _local_30.getPartSet(_local_28); const _local_32 = _local_30.getPartSet(_local_28);
if(_local_32) if (_local_32)
{ {
removes = removes.concat(_local_32.hiddenLayers); removes = removes.concat(_local_32.hiddenLayers);
for(const _local_33 of _local_32.parts) for (const _local_33 of _local_32.parts)
{ {
if(_local_16.indexOf(_local_33.type) > -1) if (_local_16.indexOf(_local_33.type) > -1)
{ {
if(_local_15) if (_local_15)
{ {
const _local_19 = _local_15.getPart(_local_33.type); const _local_19 = _local_15.getPart(_local_33.type);
if(_local_19) if (_local_19)
{ {
_local_20 = _local_19.frames; _local_20 = _local_19.frames;
} }
@ -439,15 +421,15 @@ export class AvatarStructure extends EventDispatcher
_local_34 = _arg_3.definition; _local_34 = _arg_3.definition;
if(_local_9.indexOf(_local_33.type) === -1) _local_34 = this._defaultAction; if (_local_9.indexOf(_local_33.type) === -1) _local_34 = this._defaultAction;
const _local_13 = this._partSetsData.getPartDefinition(_local_33.type); const _local_13 = this._partSetsData.getPartDefinition(_local_33.type);
let _local_35 = (!_local_13) ? _local_33.type : _local_13.flippedSetType; let _local_35 = (!_local_13) ? _local_33.type : _local_13.flippedSetType;
if(!_local_35 || (_local_35 === '')) _local_35 = _local_33.type; if (!_local_35 || (_local_35 === '')) _local_35 = _local_33.type;
if(_local_29 && (_local_29.length > (_local_33.colorLayerIndex - 1))) if (_local_29 && (_local_29.length > (_local_33.colorLayerIndex - 1)))
{ {
_local_36 = _local_31.getColor(_local_29[(_local_33.colorLayerIndex - 1)]); _local_36 = _local_31.getColor(_local_29[(_local_33.colorLayerIndex - 1)]);
} }
@ -465,18 +447,18 @@ export class AvatarStructure extends EventDispatcher
const _local_22: AvatarImagePartContainer[] = []; const _local_22: AvatarImagePartContainer[] = [];
for(const _local_12 of _local_16) for (const _local_12 of _local_16)
{ {
let _local_39: IPartColor = null; let _local_39: IPartColor = null;
let _local_38 = false; let _local_38 = false;
const _local_40 = ((_arg_8) && (_arg_8.get(_local_12))); const _local_40 = ((_arg_8) && (_arg_8.get(_local_12)));
for(const _local_23 of _local_11) for (const _local_23 of _local_11)
{ {
if(_local_23.partType === _local_12) if (_local_23.partType === _local_12)
{ {
if(_local_40) if (_local_40)
{ {
_local_39 = _local_23.color; _local_39 = _local_23.color;
} }
@ -484,31 +466,31 @@ export class AvatarStructure extends EventDispatcher
{ {
_local_38 = true; _local_38 = true;
if(removes.indexOf(_local_12) === -1) _local_22.push(_local_23); if (removes.indexOf(_local_12) === -1) _local_22.push(_local_23);
} }
} }
} }
if(!_local_38) if (!_local_38)
{ {
if(_local_40) if (_local_40)
{ {
const _local_41 = _arg_8.get(_local_12); const _local_41 = _arg_8.get(_local_12);
let _local_42 = 0; let _local_42 = 0;
let _local_43 = 0; let _local_43 = 0;
while(_local_43 < _local_41.length) while (_local_43 < _local_41.length)
{ {
_local_42 = (_local_42 + _local_41.charCodeAt(_local_43)); _local_42 = (_local_42 + _local_41.charCodeAt(_local_43));
_local_43++; _local_43++;
} }
if(_local_15) if (_local_15)
{ {
const _local_19 = _local_15.getPart(_local_12); const _local_19 = _local_15.getPart(_local_12);
if(_local_19) if (_local_19)
{ {
_local_20 = _local_19.frames; _local_20 = _local_19.frames;
} }
@ -528,11 +510,11 @@ export class AvatarStructure extends EventDispatcher
} }
else else
{ {
if(_local_9.indexOf(_local_12) > -1) if (_local_9.indexOf(_local_12) > -1)
{ {
const _local_44 = this._geometry.getBodyPartOfItem(_arg_4, _local_12, _arg_7); const _local_44 = this._geometry.getBodyPartOfItem(_arg_4, _local_12, _arg_7);
if(k !== _local_44.id) if (k !== _local_44.id)
{ {
// //
} }
@ -543,36 +525,36 @@ export class AvatarStructure extends EventDispatcher
let _local_45 = false; let _local_45 = false;
let _local_46 = 1; let _local_46 = 1;
if(_local_13.appendToFigure) if (_local_13.appendToFigure)
{ {
let _local_47 = '1'; let _local_47 = '1';
if(_arg_3.actionParameter !== '') if (_arg_3.actionParameter !== '')
{ {
_local_47 = _arg_3.actionParameter; _local_47 = _arg_3.actionParameter;
} }
if(_local_13.hasStaticId()) if (_local_13.hasStaticId())
{ {
_local_47 = _local_13.staticId.toString(); _local_47 = _local_13.staticId.toString();
} }
if(_local_10 != null) if (_local_10 != null)
{ {
const _local_48 = _local_10.getAddData(_local_12); const _local_48 = _local_10.getAddData(_local_12);
if(_local_48) if (_local_48)
{ {
_local_45 = _local_48.isBlended; _local_45 = _local_48.isBlended;
_local_46 = _local_48.blend; _local_46 = _local_48.blend;
} }
} }
if(_local_15) if (_local_15)
{ {
const _local_19 = _local_15.getPart(_local_12); const _local_19 = _local_15.getPart(_local_12);
if(_local_19) if (_local_19)
{ {
_local_20 = _local_19.frames; _local_20 = _local_19.frames;
} }
@ -605,7 +587,7 @@ export class AvatarStructure extends EventDispatcher
let index = 0; let index = 0;
while(index < k) while (index < k)
{ {
_local_2.push(index); _local_2.push(index);
@ -617,13 +599,13 @@ export class AvatarStructure extends EventDispatcher
public getItemIds(): string[] public getItemIds(): string[]
{ {
if(this._actionManager) if (this._actionManager)
{ {
const k = this._actionManager.getActionDefinition('CarryItem').params; const k = this._actionManager.getActionDefinition('CarryItem').params;
const _local_2 = []; const _local_2 = [];
for(const _local_3 of k.values()) _local_2.push(_local_3); for (const _local_3 of k.values()) _local_2.push(_local_3);
return _local_2; return _local_2;
} }

View File

@ -1,10 +1,9 @@
import { IAssetManager } from '../../api'; import { IAssetManager, IAvatarEffectListener } from '../../api';
import { EventDispatcher, NitroEvent } from '../../core'; import { EventDispatcher, NitroEvent } from '../../core';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
import { AvatarStructure } from './AvatarStructure'; import { AvatarStructure } from './AvatarStructure';
import { EffectAssetDownloadLibrary } from './EffectAssetDownloadLibrary'; import { EffectAssetDownloadLibrary } from './EffectAssetDownloadLibrary';
import { AvatarRenderEffectLibraryEvent, AvatarRenderEvent } from './events'; import { AvatarRenderEffectLibraryEvent, AvatarRenderEvent } from './events';
import { IAvatarEffectListener } from './IAvatarEffectListener';
export class EffectAssetDownloadManager extends EventDispatcher export class EffectAssetDownloadManager extends EventDispatcher
{ {
@ -63,7 +62,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
request.onloadend = e => request.onloadend = e =>
{ {
if(request.responseText) if (request.responseText)
{ {
const data = JSON.parse(request.responseText); const data = JSON.parse(request.responseText);
@ -91,17 +90,17 @@ export class EffectAssetDownloadManager extends EventDispatcher
private processEffectMap(data: any): void private processEffectMap(data: any): void
{ {
if(!data) return; if (!data) return;
for(const effect of data) for (const effect of data)
{ {
if(!effect) continue; if (!effect) continue;
const id = (effect.id as string); const id = (effect.id as string);
const lib = (effect.lib as string); const lib = (effect.lib as string);
const revision = (effect.revision || ''); const revision = (effect.revision || '');
if(this._libraryNames.indexOf(lib) >= 0) continue; if (this._libraryNames.indexOf(lib) >= 0) continue;
this._libraryNames.push(lib); this._libraryNames.push(lib);
@ -111,7 +110,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
let existing = this._effectMap.get(id); let existing = this._effectMap.get(id);
if(!existing) existing = []; if (!existing) existing = [];
existing.push(downloadLibrary); existing.push(downloadLibrary);
@ -121,7 +120,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
public downloadAvatarEffect(id: number, listener: IAvatarEffectListener): void public downloadAvatarEffect(id: number, listener: IAvatarEffectListener): void
{ {
if(!this._isReady || !this._structure.renderManager.isReady) if (!this._isReady || !this._structure.renderManager.isReady)
{ {
this._initDownloadBuffer.push([id, listener]); this._initDownloadBuffer.push([id, listener]);
@ -130,13 +129,13 @@ export class EffectAssetDownloadManager extends EventDispatcher
const pendingLibraries = this.getAvatarEffectPendingLibraries(id); const pendingLibraries = this.getAvatarEffectPendingLibraries(id);
if(pendingLibraries && pendingLibraries.length) if (pendingLibraries && pendingLibraries.length)
{ {
if(listener && !listener.disposed) if (listener && !listener.disposed)
{ {
let listeners = this._effectListeners.get(id.toString()); let listeners = this._effectListeners.get(id.toString());
if(!listeners) listeners = []; if (!listeners) listeners = [];
listeners.push(listener); listeners.push(listener);
@ -145,24 +144,24 @@ export class EffectAssetDownloadManager extends EventDispatcher
this._incompleteEffects.set(id.toString(), pendingLibraries); this._incompleteEffects.set(id.toString(), pendingLibraries);
for(const library of pendingLibraries) for (const library of pendingLibraries)
{ {
if(!library) continue; if (!library) continue;
this.downloadLibrary(library); this.downloadLibrary(library);
} }
} }
else else
{ {
if(listener && !listener.disposed) listener.resetEffect(id); if (listener && !listener.disposed) listener.resetEffect(id);
} }
} }
private onAvatarRenderReady(event: NitroEvent): void private onAvatarRenderReady(event: NitroEvent): void
{ {
if(!event) return; if (!event) return;
for(const [id, listener] of this._initDownloadBuffer) for (const [id, listener] of this._initDownloadBuffer)
{ {
this.downloadAvatarEffect(id, listener); this.downloadAvatarEffect(id, listener);
} }
@ -172,34 +171,34 @@ export class EffectAssetDownloadManager extends EventDispatcher
private onLibraryLoaded(event: AvatarRenderEffectLibraryEvent): void private onLibraryLoaded(event: AvatarRenderEffectLibraryEvent): void
{ {
if(!event || !event.library) return; if (!event || !event.library) return;
const loadedEffects: string[] = []; const loadedEffects: string[] = [];
this._structure.registerAnimation(event.library.animation); this._structure.registerAnimation(event.library.animation);
for(const [id, libraries] of this._incompleteEffects.entries()) for (const [id, libraries] of this._incompleteEffects.entries())
{ {
let isReady = true; let isReady = true;
for(const library of libraries) for (const library of libraries)
{ {
if(!library || library.isLoaded) continue; if (!library || library.isLoaded) continue;
isReady = false; isReady = false;
break; break;
} }
if(isReady) if (isReady)
{ {
loadedEffects.push(id); loadedEffects.push(id);
const listeners = this._effectListeners.get(id); const listeners = this._effectListeners.get(id);
for(const listener of listeners) for (const listener of listeners)
{ {
if(!listener || listener.disposed) continue; if (!listener || listener.disposed) continue;
listener.resetEffect(parseInt(id)); listener.resetEffect(parseInt(id));
} }
@ -210,17 +209,17 @@ export class EffectAssetDownloadManager extends EventDispatcher
} }
} }
for(const id of loadedEffects) this._incompleteEffects.delete(id); for (const id of loadedEffects) this._incompleteEffects.delete(id);
let index = 0; let index = 0;
while(index < this._currentDownloads.length) while (index < this._currentDownloads.length)
{ {
const download = this._currentDownloads[index]; const download = this._currentDownloads[index];
if(download) if (download)
{ {
if(download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); if (download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1);
} }
index++; index++;
@ -231,19 +230,19 @@ export class EffectAssetDownloadManager extends EventDispatcher
{ {
const libraries = this._missingMandatoryLibs.slice(); const libraries = this._missingMandatoryLibs.slice();
for(const library of libraries) for (const library of libraries)
{ {
if(!library) continue; if (!library) continue;
const map = this._effectMap.get(library); const map = this._effectMap.get(library);
if(map) for(const effect of map) effect && this.downloadLibrary(effect); if (map) for (const effect of map) effect && this.downloadLibrary(effect);
} }
} }
public isAvatarEffectReady(effect: number): boolean public isAvatarEffectReady(effect: number): boolean
{ {
if(!this._isReady || !this._structure.renderManager.isReady) if (!this._isReady || !this._structure.renderManager.isReady)
{ {
return false; return false;
} }
@ -257,17 +256,17 @@ export class EffectAssetDownloadManager extends EventDispatcher
{ {
const pendingLibraries: EffectAssetDownloadLibrary[] = []; const pendingLibraries: EffectAssetDownloadLibrary[] = [];
if(!this._structure) return pendingLibraries; if (!this._structure) return pendingLibraries;
const libraries = this._effectMap.get(id.toString()); const libraries = this._effectMap.get(id.toString());
if(libraries) if (libraries)
{ {
for(const library of libraries) for (const library of libraries)
{ {
if(!library || library.isLoaded) continue; if (!library || library.isLoaded) continue;
if(pendingLibraries.indexOf(library) === -1) pendingLibraries.push(library); if (pendingLibraries.indexOf(library) === -1) pendingLibraries.push(library);
} }
} }
@ -276,9 +275,9 @@ export class EffectAssetDownloadManager extends EventDispatcher
private downloadLibrary(library: EffectAssetDownloadLibrary): void private downloadLibrary(library: EffectAssetDownloadLibrary): void
{ {
if(!library || library.isLoaded) return; if (!library || library.isLoaded) return;
if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; if ((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return;
this._pendingDownloadQueue.push(library); this._pendingDownloadQueue.push(library);
@ -287,7 +286,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
private processDownloadQueue(): void private processDownloadQueue(): void
{ {
while(this._pendingDownloadQueue.length) while (this._pendingDownloadQueue.length)
{ {
const library = this._pendingDownloadQueue[0]; const library = this._pendingDownloadQueue[0];

View File

@ -1,4 +1,4 @@
import { AssetAliasCollection } from './alias/AssetAliasCollection'; import { AssetAliasCollection } from './alias';
import { AvatarFigureContainer } from './AvatarFigureContainer'; import { AvatarFigureContainer } from './AvatarFigureContainer';
import { AvatarImage } from './AvatarImage'; import { AvatarImage } from './AvatarImage';
import { AvatarStructure } from './AvatarStructure'; import { AvatarStructure } from './AvatarStructure';
@ -15,4 +15,4 @@ export class PlaceHolderAvatarImage extends AvatarImage
{ {
return true; return true;
} }
} }

View File

@ -1,5 +1,5 @@
import { IActionDefinition } from '../../../api';
import { ActionType } from './ActionType'; import { ActionType } from './ActionType';
import { IActionDefinition } from './IActionDefinition';
export class ActionDefinition implements IActionDefinition export class ActionDefinition implements IActionDefinition
{ {
@ -41,22 +41,22 @@ export class ActionDefinition implements IActionDefinition
this._defaultParameterValue = ''; this._defaultParameterValue = '';
this._canvasOffsets = null; this._canvasOffsets = null;
if(data.params && (data.params.length > 0)) if (data.params && (data.params.length > 0))
{ {
for(const param of data.params) for (const param of data.params)
{ {
if(!param) continue; if (!param) continue;
if(param.id === 'default') this._defaultParameterValue = param.value; if (param.id === 'default') this._defaultParameterValue = param.value;
else this._params.set(param.id, param.value); else this._params.set(param.id, param.value);
} }
} }
if(data.types && (data.types.length > 0)) if (data.types && (data.types.length > 0))
{ {
for(const type of data.types) for (const type of data.types)
{ {
if(!type) continue; if (!type) continue;
const action = new ActionType(type); const action = new ActionType(type);
@ -67,11 +67,11 @@ export class ActionDefinition implements IActionDefinition
public setOffsets(k: string, _arg_2: number, _arg_3: number[]): void public setOffsets(k: string, _arg_2: number, _arg_3: number[]): void
{ {
if(!this._canvasOffsets) this._canvasOffsets = new Map(); if (!this._canvasOffsets) this._canvasOffsets = new Map();
let existing = this._canvasOffsets.get(k); let existing = this._canvasOffsets.get(k);
if(!existing) if (!existing)
{ {
existing = new Map(); existing = new Map();
@ -83,33 +83,33 @@ export class ActionDefinition implements IActionDefinition
public getOffsets(k: string, _arg_2: number): number[] public getOffsets(k: string, _arg_2: number): number[]
{ {
if(!this._canvasOffsets) return null; if (!this._canvasOffsets) return null;
const existing = this._canvasOffsets.get(k); const existing = this._canvasOffsets.get(k);
if(!existing) return null; if (!existing) return null;
return existing.get(_arg_2); return existing.get(_arg_2);
} }
public getType(id: string): ActionType public getType(id: string): ActionType
{ {
if(!id) return null; if (!id) return null;
const existing = this._types.get(parseInt(id)); const existing = this._types.get(parseInt(id));
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
public getParameterValue(id: string): string public getParameterValue(id: string): string
{ {
if(!id) return ''; if (!id) return '';
const existing = this._params.get(id); const existing = this._params.get(id);
if(!existing) return this._defaultParameterValue; if (!existing) return this._defaultParameterValue;
return existing; return existing;
} }
@ -121,33 +121,33 @@ export class ActionDefinition implements IActionDefinition
private getTypePrevents(type: string): string[] private getTypePrevents(type: string): string[]
{ {
if(!type) return []; if (!type) return [];
const existing = this._types.get(parseInt(type)); const existing = this._types.get(parseInt(type));
if(!existing) return []; if (!existing) return [];
return existing.prevents; return existing.prevents;
} }
public getPreventHeadTurn(k: string): boolean public getPreventHeadTurn(k: string): boolean
{ {
if(!k) return this._preventHeadTurn; if (!k) return this._preventHeadTurn;
const type = this.getType(k); const type = this.getType(k);
if(!type) return this._preventHeadTurn; if (!type) return this._preventHeadTurn;
return type.preventHeadTurn; return type.preventHeadTurn;
} }
public isAnimated(k: string): boolean public isAnimated(k: string): boolean
{ {
if(!k) return true; if (!k) return true;
const type = this.getType(k); const type = this.getType(k);
if(!type) return true; if (!type) return true;
return type.isAnimated; return type.isAnimated;
} }

View File

@ -1,5 +1,4 @@
import { IActionDefinition } from './IActionDefinition'; import { IActionDefinition, IActiveActionData } from '../../../api';
import { IActiveActionData } from './IActiveActionData';
export class ActiveActionData implements IActiveActionData export class ActiveActionData implements IActiveActionData
{ {
@ -27,7 +26,7 @@ export class ActiveActionData implements IActiveActionData
public get id(): string public get id(): string
{ {
if(!this._definition) return ''; if (!this._definition) return '';
return this._definition.id + '_' + this._actionParameter; return this._definition.id + '_' + this._actionParameter;
} }

View File

@ -1,6 +1,5 @@
import { IAssetManager } from '../../../api'; import { IActiveActionData, IAssetManager } from '../../../api';
import { ActionDefinition } from './ActionDefinition'; import { ActionDefinition } from './ActionDefinition';
import { IActiveActionData } from './IActiveActionData';
export class AvatarActionManager export class AvatarActionManager
{ {
@ -19,36 +18,36 @@ export class AvatarActionManager
public updateActions(data: any): void public updateActions(data: any): void
{ {
if(!data) return; if (!data) return;
for(const action of data.actions) for (const action of data.actions)
{ {
if(!action || !action.state) continue; if (!action || !action.state) continue;
const definition = new ActionDefinition(action); const definition = new ActionDefinition(action);
this._actions.set(definition.state, definition); this._actions.set(definition.state, definition);
} }
if(data.actionOffsets) this.parseActionOffsets(data.actionOffsets); if (data.actionOffsets) this.parseActionOffsets(data.actionOffsets);
} }
private parseActionOffsets(offsets: any): void private parseActionOffsets(offsets: any): void
{ {
if(!offsets || !offsets.length) return; if (!offsets || !offsets.length) return;
for(const offset of offsets) for (const offset of offsets)
{ {
const action = this._actions.get(offset.action); const action = this._actions.get(offset.action);
if(!action) continue; if (!action) continue;
for(const canvasOffset of offset.offsets) for (const canvasOffset of offset.offsets)
{ {
const size = (canvasOffset.size || ''); const size = (canvasOffset.size || '');
const direction = canvasOffset.direction; const direction = canvasOffset.direction;
if((size === '') || (direction === undefined)) continue; if ((size === '') || (direction === undefined)) continue;
const x = (canvasOffset.x || 0); const x = (canvasOffset.x || 0);
const y = (canvasOffset.y || 0); const y = (canvasOffset.y || 0);
@ -61,11 +60,11 @@ export class AvatarActionManager
public getActionDefinition(id: string): ActionDefinition public getActionDefinition(id: string): ActionDefinition
{ {
if(!id) return null; if (!id) return null;
for(const action of this._actions.values()) for (const action of this._actions.values())
{ {
if(!action || (action.id !== id)) continue; if (!action || (action.id !== id)) continue;
return action; return action;
} }
@ -77,18 +76,18 @@ export class AvatarActionManager
{ {
const existing = this._actions.get(state); const existing = this._actions.get(state);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
public getDefaultAction(): ActionDefinition public getDefaultAction(): ActionDefinition
{ {
if(this._defaultAction) return this._defaultAction; if (this._defaultAction) return this._defaultAction;
for(const action of this._actions.values()) for (const action of this._actions.values())
{ {
if(!action || !action.isDefault) continue; if (!action || !action.isDefault) continue;
this._defaultAction = action; this._defaultAction = action;
@ -102,14 +101,14 @@ export class AvatarActionManager
{ {
let canvasOffsets: number[] = []; let canvasOffsets: number[] = [];
for(const activeAction of k) for (const activeAction of k)
{ {
if(!activeAction) continue; if (!activeAction) continue;
const action = this._actions.get(activeAction.actionType); const action = this._actions.get(activeAction.actionType);
const offsets = action && action.getOffsets(_arg_2, _arg_3); const offsets = action && action.getOffsets(_arg_2, _arg_3);
if(offsets) canvasOffsets = offsets; if (offsets) canvasOffsets = offsets;
} }
return canvasOffsets; return canvasOffsets;
@ -117,19 +116,19 @@ export class AvatarActionManager
public sortActions(actions: IActiveActionData[]): IActiveActionData[] public sortActions(actions: IActiveActionData[]): IActiveActionData[]
{ {
if(!actions) return null; if (!actions) return null;
actions = this.filterActions(actions); actions = this.filterActions(actions);
const validatedActions: IActiveActionData[] = []; const validatedActions: IActiveActionData[] = [];
for(const action of actions) for (const action of actions)
{ {
if(!action) continue; if (!action) continue;
const definition = this._actions.get(action.actionType); const definition = this._actions.get(action.actionType);
if(!definition) continue; if (!definition) continue;
action.definition = definition; action.definition = definition;
@ -146,24 +145,24 @@ export class AvatarActionManager
let preventions: string[] = []; let preventions: string[] = [];
const activeActions: IActiveActionData[] = []; const activeActions: IActiveActionData[] = [];
for(const action of actions) for (const action of actions)
{ {
if(!action) continue; if (!action) continue;
const localAction = this._actions.get(action.actionType); const localAction = this._actions.get(action.actionType);
if(localAction) preventions = preventions.concat(localAction.getPrevents(action.actionParameter)); if (localAction) preventions = preventions.concat(localAction.getPrevents(action.actionParameter));
} }
for(const action of actions) for (const action of actions)
{ {
if(!action) continue; if (!action) continue;
let actionType = action.actionType; let actionType = action.actionType;
if(action.actionType === 'fx') actionType = (actionType + ('.' + action.actionParameter)); if (action.actionType === 'fx') actionType = (actionType + ('.' + action.actionParameter));
if(preventions.indexOf(actionType) >= 0) continue; if (preventions.indexOf(actionType) >= 0) continue;
activeActions.push(action); activeActions.push(action);
} }
@ -173,14 +172,14 @@ export class AvatarActionManager
private sortByPrecedence(actionOne: IActiveActionData, actionTwo: IActiveActionData): number private sortByPrecedence(actionOne: IActiveActionData, actionTwo: IActiveActionData): number
{ {
if(!actionOne || !actionTwo) return 0; if (!actionOne || !actionTwo) return 0;
const precedenceOne = actionOne.definition.precedence; const precedenceOne = actionOne.definition.precedence;
const precedenceTwo = actionTwo.definition.precedence; const precedenceTwo = actionTwo.definition.precedence;
if(precedenceOne < precedenceTwo) return 1; if (precedenceOne < precedenceTwo) return 1;
if(precedenceOne > precedenceTwo) return -1; if (precedenceOne > precedenceTwo) return -1;
return 0; return 0;
} }

View File

@ -2,5 +2,3 @@ export * from './ActionDefinition';
export * from './ActionType'; export * from './ActionType';
export * from './ActiveActionData'; export * from './ActiveActionData';
export * from './AvatarActionManager'; export * from './AvatarActionManager';
export * from './IActionDefinition';
export * from './IActiveActionData';

View File

@ -1,10 +1,9 @@
import { IAssetAnimation, IAssetAnimationFrame } from '../../../api'; import { IAnimation, IAssetAnimation, IAssetAnimationFrame } from '../../../api';
import { AvatarStructure } from '../AvatarStructure'; import { AvatarStructure } from '../AvatarStructure';
import { AddDataContainer } from './AddDataContainer'; import { AddDataContainer } from './AddDataContainer';
import { AvatarAnimationLayerData } from './AvatarAnimationLayerData'; import { AvatarAnimationLayerData } from './AvatarAnimationLayerData';
import { AvatarDataContainer } from './AvatarDataContainer'; import { AvatarDataContainer } from './AvatarDataContainer';
import { DirectionDataContainer } from './DirectionDataContainer'; import { DirectionDataContainer } from './DirectionDataContainer';
import { IAnimation } from './IAnimation';
import { SpriteDataContainer } from './SpriteDataContainer'; import { SpriteDataContainer } from './SpriteDataContainer';
export class Animation implements IAnimation export class Animation implements IAnimation
@ -37,37 +36,37 @@ export class Animation implements IAnimation
this._overrideFrames = null; this._overrideFrames = null;
this._resetOnToggle = (_arg_2.resetOnToggle || false); this._resetOnToggle = (_arg_2.resetOnToggle || false);
if(_arg_2.sprites && _arg_2.sprites.length) if (_arg_2.sprites && _arg_2.sprites.length)
{ {
this._spriteData = []; this._spriteData = [];
for(const sprite of _arg_2.sprites) this._spriteData.push(new SpriteDataContainer(this, sprite)); for (const sprite of _arg_2.sprites) this._spriteData.push(new SpriteDataContainer(this, sprite));
} }
if(_arg_2.avatars && _arg_2.avatars.length) this._avatarData = new AvatarDataContainer(_arg_2.avatars[0]); if (_arg_2.avatars && _arg_2.avatars.length) this._avatarData = new AvatarDataContainer(_arg_2.avatars[0]);
if(_arg_2.directions && _arg_2.directions.length) this._directionData = new DirectionDataContainer(_arg_2.directions[0]); if (_arg_2.directions && _arg_2.directions.length) this._directionData = new DirectionDataContainer(_arg_2.directions[0]);
if(_arg_2.removes && _arg_2.removes.length) if (_arg_2.removes && _arg_2.removes.length)
{ {
this._removeData = []; this._removeData = [];
for(const remove of _arg_2.removes) this._removeData.push(remove.id); for (const remove of _arg_2.removes) this._removeData.push(remove.id);
} }
if(_arg_2.adds && _arg_2.adds.length) if (_arg_2.adds && _arg_2.adds.length)
{ {
this._addData = []; this._addData = [];
for(const add of _arg_2.adds) this._addData.push(new AddDataContainer(add)); for (const add of _arg_2.adds) this._addData.push(new AddDataContainer(add));
} }
if(_arg_2.overrides && _arg_2.overrides.length) if (_arg_2.overrides && _arg_2.overrides.length)
{ {
this._overrideFrames = new Map(); this._overrideFrames = new Map();
this._overriddenActions = new Map(); this._overriddenActions = new Map();
for(const override of _arg_2.overrides) for (const override of _arg_2.overrides)
{ {
const name = override.name; const name = override.name;
const value = override.override; const value = override.override;
@ -87,23 +86,23 @@ export class Animation implements IAnimation
private parseFrames(frames: AvatarAnimationLayerData[][], _arg_2: IAssetAnimationFrame[], _arg_3: AvatarStructure): void private parseFrames(frames: AvatarAnimationLayerData[][], _arg_2: IAssetAnimationFrame[], _arg_3: AvatarStructure): void
{ {
if(!_arg_2 || !_arg_2.length) return; if (!_arg_2 || !_arg_2.length) return;
for(const frame of _arg_2) for (const frame of _arg_2)
{ {
let repeats = 1; let repeats = 1;
if(frame.repeats && (frame.repeats > 1)) repeats = frame.repeats; if (frame.repeats && (frame.repeats > 1)) repeats = frame.repeats;
let index = 0; let index = 0;
while(index < repeats) while (index < repeats)
{ {
const layers: AvatarAnimationLayerData[] = []; const layers: AvatarAnimationLayerData[] = [];
if(frame.bodyparts && frame.bodyparts.length) if (frame.bodyparts && frame.bodyparts.length)
{ {
for(const bodyPart of frame.bodyparts) for (const bodyPart of frame.bodyparts)
{ {
const definition = _arg_3.getActionDefinition(bodyPart.action); const definition = _arg_3.getActionDefinition(bodyPart.action);
const layer = new AvatarAnimationLayerData(bodyPart, AvatarAnimationLayerData.BODYPART, definition); const layer = new AvatarAnimationLayerData(bodyPart, AvatarAnimationLayerData.BODYPART, definition);
@ -112,9 +111,9 @@ export class Animation implements IAnimation
} }
} }
if(frame.fxs && frame.fxs.length) if (frame.fxs && frame.fxs.length)
{ {
for(const fx of frame.fxs) for (const fx of frame.fxs)
{ {
const definition = _arg_3.getActionDefinition(fx.action); const definition = _arg_3.getActionDefinition(fx.action);
const layer = new AvatarAnimationLayerData(fx, AvatarAnimationLayerData.FX, definition); const layer = new AvatarAnimationLayerData(fx, AvatarAnimationLayerData.FX, definition);
@ -132,13 +131,13 @@ export class Animation implements IAnimation
public frameCount(k: string = null): number public frameCount(k: string = null): number
{ {
if(!k) return this._frames.length; if (!k) return this._frames.length;
if(this._overrideFrames) if (this._overrideFrames)
{ {
const _local_2 = this._overrideFrames.get(k); const _local_2 = this._overrideFrames.get(k);
if(_local_2) return _local_2.length; if (_local_2) return _local_2.length;
} }
return 0; return 0;
@ -146,38 +145,38 @@ export class Animation implements IAnimation
public hasOverriddenActions(): boolean public hasOverriddenActions(): boolean
{ {
if(!this._overriddenActions) return false; if (!this._overriddenActions) return false;
return (this._overriddenActions.size > 0); return (this._overriddenActions.size > 0);
} }
public overriddenActionNames(): string[] public overriddenActionNames(): string[]
{ {
if(!this._overriddenActions) return null; if (!this._overriddenActions) return null;
const keys: string[] = []; const keys: string[] = [];
for(const key of this._overriddenActions.keys()) keys.push(key); for (const key of this._overriddenActions.keys()) keys.push(key);
return keys; return keys;
} }
public overridingAction(k: string): string public overridingAction(k: string): string
{ {
if(!this._overriddenActions) return null; if (!this._overriddenActions) return null;
return this._overriddenActions.get(k); return this._overriddenActions.get(k);
} }
private getFrame(frameCount: number, _arg_2: string = null): AvatarAnimationLayerData[] private getFrame(frameCount: number, _arg_2: string = null): AvatarAnimationLayerData[]
{ {
if(frameCount < 0) frameCount = 0; if (frameCount < 0) frameCount = 0;
let layers: AvatarAnimationLayerData[] = []; let layers: AvatarAnimationLayerData[] = [];
if(!_arg_2) if (!_arg_2)
{ {
if(this._frames.length > 0) if (this._frames.length > 0)
{ {
layers = this._frames[(frameCount % this._frames.length)]; layers = this._frames[(frameCount % this._frames.length)];
} }
@ -186,7 +185,7 @@ export class Animation implements IAnimation
{ {
const overrideLayers = this._overrideFrames.get(_arg_2); const overrideLayers = this._overrideFrames.get(_arg_2);
if(overrideLayers && (overrideLayers.length > 0)) if (overrideLayers && (overrideLayers.length > 0))
{ {
layers = overrideLayers[(frameCount % overrideLayers.length)]; layers = overrideLayers[(frameCount % overrideLayers.length)];
} }
@ -199,20 +198,20 @@ export class Animation implements IAnimation
{ {
const _local_3: string[] = []; const _local_3: string[] = [];
for(const layer of this.getFrame(k, _arg_2)) for (const layer of this.getFrame(k, _arg_2))
{ {
if(layer.type === AvatarAnimationLayerData.BODYPART) if (layer.type === AvatarAnimationLayerData.BODYPART)
{ {
_local_3.push(layer.id); _local_3.push(layer.id);
} }
else if(layer.type === AvatarAnimationLayerData.FX) else if (layer.type === AvatarAnimationLayerData.FX)
{ {
if(this._addData && this._addData.length) if (this._addData && this._addData.length)
{ {
for(const _local_5 of this._addData) for (const _local_5 of this._addData)
{ {
if(_local_5.id === layer.id) _local_3.push(_local_5.align); if (_local_5.id === layer.id) _local_3.push(_local_5.align);
} }
} }
} }
@ -223,17 +222,17 @@ export class Animation implements IAnimation
public getLayerData(frameCount: number, spriteId: string, _arg_3: string = null): AvatarAnimationLayerData public getLayerData(frameCount: number, spriteId: string, _arg_3: string = null): AvatarAnimationLayerData
{ {
for(const layer of this.getFrame(frameCount, _arg_3)) for (const layer of this.getFrame(frameCount, _arg_3))
{ {
if(layer.id === spriteId) return layer; if (layer.id === spriteId) return layer;
if(layer.type === AvatarAnimationLayerData.FX) if (layer.type === AvatarAnimationLayerData.FX)
{ {
if(this._addData && this._addData.length) if (this._addData && this._addData.length)
{ {
for(const addData of this._addData) for (const addData of this._addData)
{ {
if(((addData.align === spriteId) && (addData.id === layer.id))) return layer; if (((addData.align === spriteId) && (addData.id === layer.id))) return layer;
} }
} }
} }
@ -259,11 +258,11 @@ export class Animation implements IAnimation
public getAddData(k: string): AddDataContainer public getAddData(k: string): AddDataContainer
{ {
if(this._addData) if (this._addData)
{ {
for(const _local_2 of this._addData) for (const _local_2 of this._addData)
{ {
if(_local_2.id === k) return _local_2; if (_local_2.id === k) return _local_2;
} }
} }

View File

@ -1,9 +1,6 @@
import { IAssetAnimation } from '../../../api'; import { IAnimation, IAnimationLayerData, IAnimationManager, IAssetAnimation } from '../../../api';
import { AvatarStructure } from '../AvatarStructure'; import { AvatarStructure } from '../AvatarStructure';
import { Animation } from './Animation'; import { Animation } from './Animation';
import { IAnimation } from './IAnimation';
import { IAnimationLayerData } from './IAnimationLayerData';
import { IAnimationManager } from './IAnimationManager';
export class AnimationManager implements IAnimationManager export class AnimationManager implements IAnimationManager
{ {
@ -29,7 +26,7 @@ export class AnimationManager implements IAnimationManager
{ {
const existing = this._animations.get(animation); const existing = this._animations.get(animation);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
@ -38,7 +35,7 @@ export class AnimationManager implements IAnimationManager
{ {
const existing = this.getAnimation(animation); const existing = this.getAnimation(animation);
if(!existing) return null; if (!existing) return null;
return existing.getLayerData(frameCount, spriteId); return existing.getLayerData(frameCount, spriteId);
} }

View File

@ -1,8 +1,5 @@
import { IAssetAnimationFramePart } from '../../../api'; import { IActionDefinition, IActiveActionData, IAnimationLayerData, IAssetAnimationFramePart } from '../../../api';
import { ActiveActionData } from '../actions/ActiveActionData'; import { ActiveActionData } from '../actions';
import { IActionDefinition } from '../actions/IActionDefinition';
import { IActiveActionData } from '../actions/IActiveActionData';
import { IAnimationLayerData } from './IAnimationLayerData';
export class AvatarAnimationLayerData implements IAnimationLayerData export class AvatarAnimationLayerData implements IAnimationLayerData
{ {
@ -32,13 +29,13 @@ export class AvatarAnimationLayerData implements IAnimationLayerData
this._base = (k.base || ''); this._base = (k.base || '');
this._items = new Map(); this._items = new Map();
if(k.items) for(const _local_4 of k.items) this._items.set(_local_4.id, _local_4.base); if (k.items) for (const _local_4 of k.items) this._items.set(_local_4.id, _local_4.base);
let _local_5 = ''; let _local_5 = '';
if(this._base !== '') _local_5 = this.baseAsInt().toString(); if (this._base !== '') _local_5 = this.baseAsInt().toString();
if(_arg_3) if (_arg_3)
{ {
this._action = new ActiveActionData(_arg_3.state, this.base); this._action = new ActiveActionData(_arg_3.state, this.base);
this._action.definition = _arg_3; this._action.definition = _arg_3;
@ -55,7 +52,7 @@ export class AvatarAnimationLayerData implements IAnimationLayerData
let k = 0; let k = 0;
let index = 0; let index = 0;
while(index < this._base.length) while (index < this._base.length)
{ {
k = (k + this._base.charCodeAt(index)); k = (k + this._base.charCodeAt(index));

View File

@ -1,6 +1,5 @@
import { AdjustmentFilter } from '@pixi/filter-adjustment'; import { AdjustmentFilter } from '@pixi/filter-adjustment';
import { IAssetAnimationAvatar } from '../../../api'; import { IAssetAnimationAvatar, IAvatarDataContainer } from '../../../api';
import { IAvatarDataContainer } from './IAvatarDataContainer';
export class AvatarDataContainer implements IAvatarDataContainer export class AvatarDataContainer implements IAvatarDataContainer
{ {
@ -42,7 +41,7 @@ export class AvatarDataContainer implements IAvatarDataContainer
this._alphaMultiplier = 1; this._alphaMultiplier = 1;
this._paletteIsGrayscale = true; this._paletteIsGrayscale = true;
if(this._ink === 37) if (this._ink === 37)
{ {
this._alphaMultiplier = 0.5; this._alphaMultiplier = 0.5;
this._paletteIsGrayscale = false; this._paletteIsGrayscale = false;
@ -111,9 +110,9 @@ export class AvatarDataContainer implements IAvatarDataContainer
let _local_22 = greenBackground; let _local_22 = greenBackground;
let _local_23 = blueBackground; let _local_23 = blueBackground;
for(let i = 0; i < 256; i++) for (let i = 0; i < 256; i++)
{ {
if((((_local_21 == redBackground) && (_local_22 == greenBackground)) && (_local_23 == blueBackground))) if ((((_local_21 == redBackground) && (_local_22 == greenBackground)) && (_local_23 == blueBackground)))
{ {
_local_20 = 0; _local_20 = 0;
} }

View File

@ -1,6 +1,4 @@
import { IAssetAnimationSprite } from '../../../api'; import { IAnimation, IAssetAnimationSprite, ISpriteDataContainer } from '../../../api';
import { IAnimation } from './IAnimation';
import { ISpriteDataContainer } from './ISpriteDataContainer';
export class SpriteDataContainer implements ISpriteDataContainer export class SpriteDataContainer implements ISpriteDataContainer
{ {
@ -28,13 +26,13 @@ export class SpriteDataContainer implements ISpriteDataContainer
const directions = _arg_2.directionList; const directions = _arg_2.directionList;
if(directions && directions.length) if (directions && directions.length)
{ {
for(const direction of directions) for (const direction of directions)
{ {
const id = direction.id; const id = direction.id;
if(id === undefined) continue; if (id === undefined) continue;
this._dx[id] = (direction.dx || 0); this._dx[id] = (direction.dx || 0);
this._dy[id] = (direction.dy || 0); this._dy[id] = (direction.dy || 0);
@ -45,21 +43,21 @@ export class SpriteDataContainer implements ISpriteDataContainer
public getDirectionOffsetX(k: number): number public getDirectionOffsetX(k: number): number
{ {
if(k < this._dx.length) return this._dx[k]; if (k < this._dx.length) return this._dx[k];
return 0; return 0;
} }
public getDirectionOffsetY(k: number): number public getDirectionOffsetY(k: number): number
{ {
if(k < this._dy.length) return this._dy[k]; if (k < this._dy.length) return this._dy[k];
return 0; return 0;
} }
public getDirectionOffsetZ(k: number): number public getDirectionOffsetZ(k: number): number
{ {
if(k < this._dz.length) return this._dz[k]; if (k < this._dz.length) return this._dz[k];
return 0; return 0;
} }

View File

@ -4,9 +4,4 @@ export * from './AnimationManager';
export * from './AvatarAnimationLayerData'; export * from './AvatarAnimationLayerData';
export * from './AvatarDataContainer'; export * from './AvatarDataContainer';
export * from './DirectionDataContainer'; export * from './DirectionDataContainer';
export * from './IAnimation';
export * from './IAnimationLayerData';
export * from './IAnimationManager';
export * from './IAvatarDataContainer';
export * from './ISpriteDataContainer';
export * from './SpriteDataContainer'; export * from './SpriteDataContainer';

View File

@ -1,4 +1,4 @@
import { Nitro } from '../../Nitro'; import { GetTickerTime } from '../../../pixi-proxy';
import { AvatarImageDirectionCache } from './AvatarImageDirectionCache'; import { AvatarImageDirectionCache } from './AvatarImageDirectionCache';
export class AvatarImageActionCache export class AvatarImageActionCache
@ -10,18 +10,18 @@ export class AvatarImageActionCache
{ {
this._cache = new Map(); this._cache = new Map();
this.setLastAccessTime(Nitro.instance.time); this.setLastAccessTime(GetTickerTime());
} }
public dispose(): void public dispose(): void
{ {
this.debugInfo('[dispose]'); this.debugInfo('[dispose]');
if(!this._cache) return; if (!this._cache) return;
for(const direction of this._cache.values()) for (const direction of this._cache.values())
{ {
if(direction) direction.dispose(); if (direction) direction.dispose();
} }
this._cache.clear(); this._cache.clear();
@ -31,7 +31,7 @@ export class AvatarImageActionCache
{ {
const existing = this._cache.get(k.toString()); const existing = this._cache.get(k.toString());
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }

View File

@ -1,4 +1,4 @@
import { IActiveActionData } from '../actions/IActiveActionData'; import { IActiveActionData } from '../../../api';
import { AvatarImageActionCache } from './AvatarImageActionCache'; import { AvatarImageActionCache } from './AvatarImageActionCache';
export class AvatarImageBodyPartCache export class AvatarImageBodyPartCache
@ -15,20 +15,20 @@ export class AvatarImageBodyPartCache
public setAction(k: IActiveActionData, _arg_2: number): void public setAction(k: IActiveActionData, _arg_2: number): void
{ {
if(!this._currentAction) this._currentAction = k; if (!this._currentAction) this._currentAction = k;
const _local_3 = this.getActionCache(this._currentAction); const _local_3 = this.getActionCache(this._currentAction);
if(_local_3) _local_3.setLastAccessTime(_arg_2); if (_local_3) _local_3.setLastAccessTime(_arg_2);
this._currentAction = k; this._currentAction = k;
} }
public dispose(): void public dispose(): void
{ {
if(!this._disposed) if (!this._disposed)
{ {
if(!this._cache) return; if (!this._cache) return;
this.disposeActions(0, 2147483647); this.disposeActions(0, 2147483647);
@ -41,15 +41,15 @@ export class AvatarImageBodyPartCache
public disposeActions(k: number, _arg_2: number): void public disposeActions(k: number, _arg_2: number): void
{ {
if(!this._cache || this._disposed) return; if (!this._cache || this._disposed) return;
for(const [ key, cache ] of this._cache.entries()) for (const [key, cache] of this._cache.entries())
{ {
if(!cache) continue; if (!cache) continue;
const _local_3 = cache.getLastAccessTime(); const _local_3 = cache.getLastAccessTime();
if((_arg_2 - _local_3) >= k) if ((_arg_2 - _local_3) >= k)
{ {
cache.dispose(); cache.dispose();
@ -58,7 +58,7 @@ export class AvatarImageBodyPartCache
} }
} }
public getAction():IActiveActionData public getAction(): IActiveActionData
{ {
return this._currentAction; return this._currentAction;
} }
@ -73,20 +73,20 @@ export class AvatarImageBodyPartCache
return this._currentDirection; return this._currentDirection;
} }
public getActionCache(k: IActiveActionData=null): AvatarImageActionCache public getActionCache(k: IActiveActionData = null): AvatarImageActionCache
{ {
if(!this._currentAction) return null; if (!this._currentAction) return null;
if(!k) k = this._currentAction; if (!k) k = this._currentAction;
if(k.overridingAction) return this._cache.get(k.overridingAction); if (k.overridingAction) return this._cache.get(k.overridingAction);
return this._cache.get(k.id); return this._cache.get(k.id);
} }
public updateActionCache(k: IActiveActionData, _arg_2: AvatarImageActionCache): void public updateActionCache(k: IActiveActionData, _arg_2: AvatarImageActionCache): void
{ {
if(k.overridingAction) this._cache.set(k.overridingAction, _arg_2); if (k.overridingAction) this._cache.set(k.overridingAction, _arg_2);
else this._cache.set(k.id, _arg_2); else this._cache.set(k.id, _arg_2);
} }

View File

@ -1,19 +1,13 @@
import { Texture } from '@pixi/core'; import { Texture } from '@pixi/core';
import { Matrix, Point, Rectangle } from '@pixi/math'; import { Matrix, Point, Rectangle } from '@pixi/math';
import { RoomObjectSpriteData } from '../../../api'; import { AvatarDirectionAngle, AvatarFigurePartType, AvatarScaleType, GeometryType, IActiveActionData, IAvatarImage, RoomObjectSpriteData } from '../../../api';
import { NitroContainer, NitroSprite, PixiApplicationProxy } from '../../../pixi-proxy'; import { GetTickerTime, NitroContainer, NitroSprite } from '../../../pixi-proxy';
import { IActiveActionData } from '../actions/IActiveActionData'; import { AssetAliasCollection } from '../alias';
import { AssetAliasCollection } from '../alias/AssetAliasCollection'; import { AvatarAnimationLayerData } from '../animation';
import { AvatarAnimationLayerData } from '../animation/AvatarAnimationLayerData';
import { AvatarImageBodyPartContainer } from '../AvatarImageBodyPartContainer'; import { AvatarImageBodyPartContainer } from '../AvatarImageBodyPartContainer';
import { AvatarImagePartContainer } from '../AvatarImagePartContainer'; import { AvatarImagePartContainer } from '../AvatarImagePartContainer';
import { AvatarStructure } from '../AvatarStructure'; import { AvatarStructure } from '../AvatarStructure';
import { AvatarDirectionAngle } from '../enum/AvatarDirectionAngle'; import { AvatarCanvas } from '../structure';
import { AvatarFigurePartType } from '../enum/AvatarFigurePartType';
import { AvatarScaleType } from '../enum/AvatarScaleType';
import { GeometryType } from '../enum/GeometryType';
import { IAvatarImage } from '../IAvatarImage';
import { AvatarCanvas } from '../structure/AvatarCanvas';
import { AvatarImageActionCache } from './AvatarImageActionCache'; import { AvatarImageActionCache } from './AvatarImageActionCache';
import { AvatarImageBodyPartCache } from './AvatarImageBodyPartCache'; import { AvatarImageBodyPartCache } from './AvatarImageBodyPartCache';
import { AvatarImageDirectionCache } from './AvatarImageDirectionCache'; import { AvatarImageDirectionCache } from './AvatarImageDirectionCache';
@ -51,7 +45,7 @@ export class AvatarImageCache
public dispose(): void public dispose(): void
{ {
if(this._disposed) return; if (this._disposed) return;
this._structure = null; this._structure = null;
this._avatar = null; this._avatar = null;
@ -59,11 +53,11 @@ export class AvatarImageCache
this._canvas = null; this._canvas = null;
this._disposed = true; this._disposed = true;
if(this._cache) if (this._cache)
{ {
for(const cache of this._cache.values()) for (const cache of this._cache.values())
{ {
if(!cache) continue; if (!cache) continue;
cache.dispose(); cache.dispose();
} }
@ -71,11 +65,11 @@ export class AvatarImageCache
this._cache = null; this._cache = null;
} }
if(this._unionImages) if (this._unionImages)
{ {
for(const image of this._unionImages) for (const image of this._unionImages)
{ {
if(!image) continue; if (!image) continue;
image.dispose(); image.dispose();
} }
@ -86,13 +80,13 @@ export class AvatarImageCache
public disposeInactiveActions(k: number = 60000): void public disposeInactiveActions(k: number = 60000): void
{ {
const time = PixiApplicationProxy.instance.ticker.lastTime; const time = GetTickerTime();
if(this._cache) if (this._cache)
{ {
for(const cache of this._cache.values()) for (const cache of this._cache.values())
{ {
if(!cache) continue; if (!cache) continue;
cache.disposeActions(k, time); cache.disposeActions(k, time);
} }
@ -101,11 +95,11 @@ export class AvatarImageCache
public resetBodyPartCache(k: IActiveActionData): void public resetBodyPartCache(k: IActiveActionData): void
{ {
if(this._cache) if (this._cache)
{ {
for(const cache of this._cache.values()) for (const cache of this._cache.values())
{ {
if(!cache) continue; if (!cache) continue;
cache.setAction(k, 0); cache.setAction(k, 0);
} }
@ -116,13 +110,13 @@ export class AvatarImageCache
{ {
const parts = this._structure.getBodyPartsUnordered(k); const parts = this._structure.getBodyPartsUnordered(k);
if(parts) if (parts)
{ {
for(const part of parts) for (const part of parts)
{ {
const actionCache = this.getBodyPartCache(part); const actionCache = this.getBodyPartCache(part);
if(!actionCache) continue; if (!actionCache) continue;
actionCache.setDirection(_arg_2); actionCache.setDirection(_arg_2);
} }
@ -133,19 +127,19 @@ export class AvatarImageCache
{ {
const _local_3 = this._structure.getActiveBodyPartIds(k, this._avatar); const _local_3 = this._structure.getActiveBodyPartIds(k, this._avatar);
for(const _local_4 of _local_3) for (const _local_4 of _local_3)
{ {
const _local_5 = this.getBodyPartCache(_local_4); const _local_5 = this.getBodyPartCache(_local_4);
if(_local_5) _local_5.setAction(k, _arg_2); if (_local_5) _local_5.setAction(k, _arg_2);
} }
} }
public setGeometryType(k: string): void public setGeometryType(k: string): void
{ {
if(this._geometryType === k) return; if (this._geometryType === k) return;
if((((this._geometryType === GeometryType.SITTING) && (k === GeometryType.VERTICAL)) || ((this._geometryType === GeometryType.VERTICAL) && (k === GeometryType.SITTING)) || ((this._geometryType === GeometryType.SNOWWARS_HORIZONTAL) && (k = GeometryType.SNOWWARS_HORIZONTAL)))) 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._geometryType = k; this._geometryType = k;
this._canvas = null; this._canvas = null;
@ -163,7 +157,7 @@ export class AvatarImageCache
{ {
let _local_4 = this.getBodyPartCache(k); let _local_4 = this.getBodyPartCache(k);
if(!_local_4) if (!_local_4)
{ {
_local_4 = new AvatarImageBodyPartCache(); _local_4 = new AvatarImageBodyPartCache();
@ -174,48 +168,48 @@ export class AvatarImageCache
let _local_7 = _local_4.getAction(); let _local_7 = _local_4.getAction();
let frameCount = frameNumber; let frameCount = frameNumber;
if(_local_7.definition.startFromFrameZero) frameCount -= _local_7.startFrame; if (_local_7.definition.startFromFrameZero) frameCount -= _local_7.startFrame;
let _local_8 = _local_7; let _local_8 = _local_7;
let _local_9: string[] = []; let _local_9: string[] = [];
let _local_10: Map<string, string> = new Map(); let _local_10: Map<string, string> = new Map();
const _local_11 = new Point(); const _local_11 = new Point();
if(!((!(_local_7)) || (!(_local_7.definition)))) if (!((!(_local_7)) || (!(_local_7.definition))))
{ {
if(_local_7.definition.isAnimation) if (_local_7.definition.isAnimation)
{ {
let _local_15 = _local_5; let _local_15 = _local_5;
const _local_16 = this._structure.getAnimation(((_local_7.definition.state + '.') + _local_7.actionParameter)); const _local_16 = this._structure.getAnimation(((_local_7.definition.state + '.') + _local_7.actionParameter));
const _local_17 = (frameNumber - _local_7.startFrame); const _local_17 = (frameNumber - _local_7.startFrame);
if(_local_16) if (_local_16)
{ {
const _local_18 = _local_16.getLayerData(_local_17, k, _local_7.overridingAction); const _local_18 = _local_16.getLayerData(_local_17, k, _local_7.overridingAction);
if(_local_18) if (_local_18)
{ {
_local_15 = (_local_5 + _local_18.dd); _local_15 = (_local_5 + _local_18.dd);
if(_local_18.dd < 0) if (_local_18.dd < 0)
{ {
if(_local_15 < 0) if (_local_15 < 0)
{ {
_local_15 = (8 + _local_15); _local_15 = (8 + _local_15);
} }
else if(_local_15 > 7) _local_15 = (8 - _local_15); else if (_local_15 > 7) _local_15 = (8 - _local_15);
} }
else else
{ {
if(_local_15 < 0) if (_local_15 < 0)
{ {
_local_15 = (_local_15 + 8); _local_15 = (_local_15 + 8);
} }
else if(_local_15 > 7) _local_15 = (_local_15 - 8); else if (_local_15 > 7) _local_15 = (_local_15 - 8);
} }
if(this._scale === AvatarScaleType.LARGE) if (this._scale === AvatarScaleType.LARGE)
{ {
_local_11.x = _local_18.dx; _local_11.x = _local_18.dx;
_local_11.y = _local_18.dy; _local_11.y = _local_18.dy;
@ -228,21 +222,21 @@ export class AvatarImageCache
frameCount = _local_18.animationFrame; frameCount = _local_18.animationFrame;
if(_local_18.action) if (_local_18.action)
{ {
_local_7 = _local_18.action; _local_7 = _local_18.action;
} }
if(_local_18.type === AvatarAnimationLayerData.BODYPART) if (_local_18.type === AvatarAnimationLayerData.BODYPART)
{ {
if(_local_18.action != null) if (_local_18.action != null)
{ {
_local_8 = _local_18.action; _local_8 = _local_18.action;
} }
_local_5 = _local_15; _local_5 = _local_15;
} }
else if(_local_18.type === AvatarAnimationLayerData.FX) _local_5 = _local_15; else if (_local_18.type === AvatarAnimationLayerData.FX) _local_5 = _local_15;
_local_10 = _local_18.items; _local_10 = _local_18.items;
} }
@ -254,7 +248,7 @@ export class AvatarImageCache
let _local_12 = _local_4.getActionCache(_local_8); let _local_12 = _local_4.getActionCache(_local_8);
if(!_local_12 || _arg_3) if (!_local_12 || _arg_3)
{ {
_local_12 = new AvatarImageActionCache(); _local_12 = new AvatarImageActionCache();
_local_4.updateActionCache(_local_8, _local_12); _local_4.updateActionCache(_local_8, _local_12);
@ -262,7 +256,7 @@ export class AvatarImageCache
let _local_13 = _local_12.getDirectionCache(_local_5); let _local_13 = _local_12.getDirectionCache(_local_5);
if(!_local_13 || _arg_3) if (!_local_13 || _arg_3)
{ {
const _local_19 = this._structure.getParts(k, this._avatar.getFigure(), _local_8, this._geometryType, _local_5, _local_9, this._avatar, _local_10); const _local_19 = this._structure.getParts(k, this._avatar.getFigure(), _local_8, this._geometryType, _local_5, _local_9, this._avatar, _local_10);
@ -273,15 +267,15 @@ export class AvatarImageCache
let _local_14 = _local_13.getImageContainer(frameCount); let _local_14 = _local_13.getImageContainer(frameCount);
if(!_local_14 || _arg_3) if (!_local_14 || _arg_3)
{ {
const _local_20 = _local_13.getPartList(); const _local_20 = _local_13.getPartList();
_local_14 = this.renderBodyPart(_local_5, _local_20, frameCount, _local_7, _arg_3); _local_14 = this.renderBodyPart(_local_5, _local_20, frameCount, _local_7, _arg_3);
if(_local_14 && !_arg_3) if (_local_14 && !_arg_3)
{ {
if(_local_14.isCacheable) _local_13.updateImageContainer(_local_14, frameCount); if (_local_14.isCacheable) _local_13.updateImageContainer(_local_14, frameCount);
} }
else else
{ {
@ -310,7 +304,7 @@ export class AvatarImageCache
{ {
let existing = this._cache.get(k); let existing = this._cache.get(k);
if(!existing) if (!existing)
{ {
existing = new AvatarImageBodyPartCache(); existing = new AvatarImageBodyPartCache();
@ -322,13 +316,13 @@ export class AvatarImageCache
private renderBodyPart(direction: number, containers: AvatarImagePartContainer[], frameCount: number, _arg_4: IActiveActionData, renderServerData: boolean = false): AvatarImageBodyPartContainer private renderBodyPart(direction: number, containers: AvatarImagePartContainer[], frameCount: number, _arg_4: IActiveActionData, renderServerData: boolean = false): AvatarImageBodyPartContainer
{ {
if(!containers || !containers.length) return null; if (!containers || !containers.length) return null;
if(!this._canvas) if (!this._canvas)
{ {
this._canvas = this._structure.getCanvas(this._scale, this._geometryType); this._canvas = this._structure.getCanvas(this._scale, this._geometryType);
if(!this._canvas) return null; if (!this._canvas) return null;
} }
const isFlipped = AvatarDirectionAngle.DIRECTION_IS_FLIPPED[direction] || false; const isFlipped = AvatarDirectionAngle.DIRECTION_IS_FLIPPED[direction] || false;
@ -336,15 +330,15 @@ export class AvatarImageCache
let isCacheable = true; let isCacheable = true;
let containerIndex = (containers.length - 1); let containerIndex = (containers.length - 1);
while(containerIndex >= 0) while (containerIndex >= 0)
{ {
const container = containers[containerIndex]; const container = containers[containerIndex];
let color = 16777215; let color = 16777215;
if(!((direction == 7) && ((container.partType === 'fc') || (container.partType === 'ey')))) if (!((direction == 7) && ((container.partType === 'fc') || (container.partType === 'ey'))))
{ {
if(!((container.partType === 'ri') && !container.partId)) if (!((container.partType === 'ri') && !container.partId))
{ {
const partId = container.partId; const partId = container.partId;
const animationFrame = container.getFrameDefinition(frameCount); const animationFrame = container.getFrameDefinition(frameCount);
@ -352,59 +346,59 @@ export class AvatarImageCache
let partType = container.partType; let partType = container.partType;
let frameNumber = 0; let frameNumber = 0;
if(animationFrame) if (animationFrame)
{ {
frameNumber = animationFrame.number; frameNumber = animationFrame.number;
if((animationFrame.assetPartDefinition) && (animationFrame.assetPartDefinition !== '')) assetPartDefinition = animationFrame.assetPartDefinition; if ((animationFrame.assetPartDefinition) && (animationFrame.assetPartDefinition !== '')) assetPartDefinition = animationFrame.assetPartDefinition;
} }
else frameNumber = container.getFrameIndex(frameCount); else frameNumber = container.getFrameIndex(frameCount);
let assetDirection = direction; let assetDirection = direction;
let flipH = false; let flipH = false;
if(isFlipped) if (isFlipped)
{ {
if(((assetPartDefinition === 'wav') && (((partType === AvatarFigurePartType.LEFT_HAND) || (partType === AvatarFigurePartType.LEFT_SLEEVE)) || (partType === AvatarFigurePartType.LEFT_COAT_SLEEVE))) || ((assetPartDefinition === 'drk') && (((partType === AvatarFigurePartType.RIGHT_HAND) || (partType === AvatarFigurePartType.RIGHT_SLEEVE)) || (partType === AvatarFigurePartType.RIGHT_COAT_SLEEVE))) || ((assetPartDefinition === 'blw') && (partType === AvatarFigurePartType.RIGHT_HAND)) || ((assetPartDefinition === 'sig') && (partType === AvatarFigurePartType.LEFT_HAND)) || ((assetPartDefinition === 'respect') && (partType === AvatarFigurePartType.LEFT_HAND)) || (partType === AvatarFigurePartType.RIGHT_HAND_ITEM) || (partType === AvatarFigurePartType.LEFT_HAND_ITEM) || (partType === AvatarFigurePartType.CHEST_PRINT)) if (((assetPartDefinition === 'wav') && (((partType === AvatarFigurePartType.LEFT_HAND) || (partType === AvatarFigurePartType.LEFT_SLEEVE)) || (partType === AvatarFigurePartType.LEFT_COAT_SLEEVE))) || ((assetPartDefinition === 'drk') && (((partType === AvatarFigurePartType.RIGHT_HAND) || (partType === AvatarFigurePartType.RIGHT_SLEEVE)) || (partType === AvatarFigurePartType.RIGHT_COAT_SLEEVE))) || ((assetPartDefinition === 'blw') && (partType === AvatarFigurePartType.RIGHT_HAND)) || ((assetPartDefinition === 'sig') && (partType === AvatarFigurePartType.LEFT_HAND)) || ((assetPartDefinition === 'respect') && (partType === AvatarFigurePartType.LEFT_HAND)) || (partType === AvatarFigurePartType.RIGHT_HAND_ITEM) || (partType === AvatarFigurePartType.LEFT_HAND_ITEM) || (partType === AvatarFigurePartType.CHEST_PRINT))
{ {
flipH = true; flipH = true;
} }
else else
{ {
if(direction === 4) assetDirection = 2; if (direction === 4) assetDirection = 2;
else if(direction === 5) assetDirection = 1; else if (direction === 5) assetDirection = 1;
else if(direction === 6) assetDirection = 0; else if (direction === 6) assetDirection = 0;
if(container.flippedPartType !== partType) partType = container.flippedPartType; if (container.flippedPartType !== partType) partType = container.flippedPartType;
} }
} }
let assetName = (this._scale + '_' + assetPartDefinition + '_' + partType + '_' + partId + '_' + assetDirection + '_' + frameNumber); let assetName = (this._scale + '_' + assetPartDefinition + '_' + partType + '_' + partId + '_' + assetDirection + '_' + frameNumber);
let asset = this._assets.getAsset(assetName); let asset = this._assets.getAsset(assetName);
if(!asset) if (!asset)
{ {
assetName = (this._scale + '_std_' + partType + '_' + partId + '_' + assetDirection + '_0'); assetName = (this._scale + '_std_' + partType + '_' + partId + '_' + assetDirection + '_0');
asset = this._assets.getAsset(assetName); asset = this._assets.getAsset(assetName);
} }
if(asset) if (asset)
{ {
const texture = asset.texture; const texture = asset.texture;
if(!texture || !texture.valid || !texture.baseTexture) if (!texture || !texture.valid || !texture.baseTexture)
{ {
isCacheable = false; isCacheable = false;
} }
else else
{ {
if(container.isColorable && container.color) color = container.color.rgb; if (container.isColorable && container.color) color = container.color.rgb;
const offset = new Point(-(asset.x), -(asset.y)); const offset = new Point(-(asset.x), -(asset.y));
if(flipH) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 65 : 31)); if (flipH) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 65 : 31));
if(renderServerData) if (renderServerData)
{ {
const spriteData = new RoomObjectSpriteData(); const spriteData = new RoomObjectSpriteData();
@ -416,17 +410,17 @@ export class AvatarImageCache
spriteData.height = asset.rectangle.height; spriteData.height = asset.rectangle.height;
spriteData.flipH = flipH; spriteData.flipH = flipH;
if(assetPartDefinition === 'lay') spriteData.x = (spriteData.x + 53); if (assetPartDefinition === 'lay') spriteData.x = (spriteData.x + 53);
if(isFlipped) if (isFlipped)
{ {
spriteData.flipH = (!(spriteData.flipH)); spriteData.flipH = (!(spriteData.flipH));
if(spriteData.flipH) spriteData.x = (-(spriteData.x) - texture.width); if (spriteData.flipH) spriteData.x = (-(spriteData.x) - texture.width);
else spriteData.x = (spriteData.x + 65); else spriteData.x = (spriteData.x + 65);
} }
if(container.isColorable) spriteData.color = `${color}`; if (container.isColorable) spriteData.color = `${color}`;
this._serverRenderData.push(spriteData); this._serverRenderData.push(spriteData);
} }
@ -440,21 +434,21 @@ export class AvatarImageCache
containerIndex--; containerIndex--;
} }
if(!this._unionImages.length) return null; if (!this._unionImages.length) return null;
const imageData = this.createUnionImage(this._unionImages, isFlipped); const imageData = this.createUnionImage(this._unionImages, isFlipped);
const canvasOffset = ((this._scale === AvatarScaleType.LARGE) ? (this._canvas.height - 16) : (this._canvas.height - 8)); const canvasOffset = ((this._scale === AvatarScaleType.LARGE) ? (this._canvas.height - 16) : (this._canvas.height - 8));
const offset = new Point(-(imageData.regPoint.x), (canvasOffset - imageData.regPoint.y)); const offset = new Point(-(imageData.regPoint.x), (canvasOffset - imageData.regPoint.y));
if(isFlipped && (assetPartDefinition !== 'lay')) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 67 : 31)); if (isFlipped && (assetPartDefinition !== 'lay')) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 67 : 31));
let imageIndex = (this._unionImages.length - 1); let imageIndex = (this._unionImages.length - 1);
while(imageIndex >= 0) while (imageIndex >= 0)
{ {
const _local_17 = this._unionImages.pop(); const _local_17 = this._unionImages.pop();
if(_local_17) _local_17.dispose(); if (_local_17) _local_17.dispose();
imageIndex--; imageIndex--;
} }
@ -465,7 +459,7 @@ export class AvatarImageCache
private convertColorToHex(k: number): string private convertColorToHex(k: number): string
{ {
let _local_2: string = (k * 0xFF).toString(16); let _local_2: string = (k * 0xFF).toString(16);
if(_local_2.length < 2) if (_local_2.length < 2)
{ {
_local_2 = ('0' + _local_2); _local_2 = ('0' + _local_2);
} }
@ -476,7 +470,7 @@ export class AvatarImageCache
{ {
const bounds = new Rectangle(); const bounds = new Rectangle();
for(const data of k) data && bounds.enlarge(data.offsetRect); for (const data of k) data && bounds.enlarge(data.offsetRect);
const point = new Point(-(bounds.x), -(bounds.y)); const point = new Point(-(bounds.x), -(bounds.y));
const container = new NitroContainer(); const container = new NitroContainer();
@ -488,9 +482,9 @@ export class AvatarImageCache
container.addChild(sprite); container.addChild(sprite);
for(const data of k) for (const data of k)
{ {
if(!data) continue; if (!data) continue;
const texture = data.texture; const texture = data.texture;
const color = data.colorTransform; const color = data.colorTransform;
@ -500,9 +494,9 @@ export class AvatarImageCache
regPoint.x -= data.regPoint.x; regPoint.x -= data.regPoint.x;
regPoint.y -= data.regPoint.y; regPoint.y -= data.regPoint.y;
if(isFlipped) regPoint.x = (container.width - (regPoint.x + data.rect.width)); if (isFlipped) regPoint.x = (container.width - (regPoint.x + data.rect.width));
if(flipH) if (flipH)
{ {
this._matrix.a = -1; this._matrix.a = -1;
this._matrix.tx = ((data.rect.x + data.rect.width) + regPoint.x); this._matrix.tx = ((data.rect.x + data.rect.width) + regPoint.x);

View File

@ -1,5 +1,5 @@
import { IAvatarImage } from '../IAvatarImage'; import { IAvatarImage } from '../../../api';
import { AvatarCanvas } from '../structure/AvatarCanvas'; import { AvatarCanvas } from '../structure';
import { AvatarSet } from './AvatarSet'; import { AvatarSet } from './AvatarSet';
import { GeometryBodyPart } from './GeometryBodyPart'; import { GeometryBodyPart } from './GeometryBodyPart';
import { Matrix4x4 } from './Matrix4x4'; import { Matrix4x4 } from './Matrix4x4';
@ -25,27 +25,27 @@ export class AvatarModelGeometry
const camera = k.camera; const camera = k.camera;
if(camera) if (camera)
{ {
this._camera.x = parseFloat(camera.x); this._camera.x = parseFloat(camera.x);
this._camera.y = parseFloat(camera.y); this._camera.y = parseFloat(camera.y);
this._camera.z = parseFloat(camera.z); this._camera.z = parseFloat(camera.z);
} }
if(k.canvases && (k.canvases.length > 0)) if (k.canvases && (k.canvases.length > 0))
{ {
for(const canvas of k.canvases) for (const canvas of k.canvases)
{ {
if(!canvas) continue; if (!canvas) continue;
const scale = canvas.scale; const scale = canvas.scale;
const geometries = new Map(); const geometries = new Map();
if(canvas.geometries && (canvas.geometries.length > 0)) if (canvas.geometries && (canvas.geometries.length > 0))
{ {
for(const geometry of canvas.geometries) for (const geometry of canvas.geometries)
{ {
if(!geometry) continue; if (!geometry) continue;
const avatarCanvas = new AvatarCanvas(geometry, scale); const avatarCanvas = new AvatarCanvas(geometry, scale);
@ -57,26 +57,26 @@ export class AvatarModelGeometry
} }
} }
if(k.types && (k.types.length > 0)) if (k.types && (k.types.length > 0))
{ {
for(const type of k.types) for (const type of k.types)
{ {
if(!type) continue; if (!type) continue;
const bodyParts: Map<string, GeometryBodyPart> = new Map(); const bodyParts: Map<string, GeometryBodyPart> = new Map();
const itemIds: Map<string, GeometryBodyPart> = new Map(); const itemIds: Map<string, GeometryBodyPart> = new Map();
if(type.bodyParts && (type.bodyParts.length > 0)) if (type.bodyParts && (type.bodyParts.length > 0))
{ {
for(const bodyPart of type.bodyParts) for (const bodyPart of type.bodyParts)
{ {
if(!bodyPart) continue; if (!bodyPart) continue;
const geometryBodyPart = new GeometryBodyPart(bodyPart); const geometryBodyPart = new GeometryBodyPart(bodyPart);
bodyParts.set(geometryBodyPart.id, geometryBodyPart); bodyParts.set(geometryBodyPart.id, geometryBodyPart);
for(const part of geometryBodyPart.getPartIds(null)) for (const part of geometryBodyPart.getPartIds(null))
{ {
itemIds.set(part, geometryBodyPart); itemIds.set(part, geometryBodyPart);
} }
@ -91,13 +91,13 @@ export class AvatarModelGeometry
public removeDynamicItems(k: IAvatarImage): void public removeDynamicItems(k: IAvatarImage): void
{ {
for(const geometry of this._geometryTypes.values()) for (const geometry of this._geometryTypes.values())
{ {
if(!geometry) continue; if (!geometry) continue;
for(const part of geometry.values()) for (const part of geometry.values())
{ {
if(!part) continue; if (!part) continue;
part.removeDynamicParts(k); part.removeDynamicParts(k);
} }
@ -108,7 +108,7 @@ export class AvatarModelGeometry
{ {
const avatarSet = this._avatarSet.findAvatarSet(k); const avatarSet = this._avatarSet.findAvatarSet(k);
if(!avatarSet) return []; if (!avatarSet) return [];
return avatarSet.getBodyParts(); return avatarSet.getBodyParts();
} }
@ -117,7 +117,7 @@ export class AvatarModelGeometry
{ {
const avatarSet = this._avatarSet.findAvatarSet(k); const avatarSet = this._avatarSet.findAvatarSet(k);
if(!avatarSet) return false; if (!avatarSet) return false;
return avatarSet.isMain; return avatarSet.isMain;
} }
@ -126,7 +126,7 @@ export class AvatarModelGeometry
{ {
const canvas = this._canvases.get(k); const canvas = this._canvases.get(k);
if(!canvas) return null; if (!canvas) return null;
return (canvas.get(_arg_2) || null); return (canvas.get(_arg_2) || null);
} }
@ -135,18 +135,18 @@ export class AvatarModelGeometry
{ {
const existing = this._geometryTypes.get(k); const existing = this._geometryTypes.get(k);
if(existing) return true; if (existing) return true;
return false; return false;
} }
private hasBodyPart(k: string, _arg_2: string): boolean private hasBodyPart(k: string, _arg_2: string): boolean
{ {
if(this.typeExists(k)) if (this.typeExists(k))
{ {
const existing = this._geometryTypes.get(k); const existing = this._geometryTypes.get(k);
if(existing && existing.get(_arg_2)) return true; if (existing && existing.get(_arg_2)) return true;
} }
return false; return false;
@ -158,11 +158,11 @@ export class AvatarModelGeometry
const types = []; const types = [];
if(parts) if (parts)
{ {
for(const part of parts.values()) for (const part of parts.values())
{ {
if(!part) continue; if (!part) continue;
types.push(part.id); types.push(part.id);
} }
@ -173,7 +173,7 @@ export class AvatarModelGeometry
private getBodyPartsOfType(k: string): Map<string, GeometryBodyPart> private getBodyPartsOfType(k: string): Map<string, GeometryBodyPart>
{ {
if(this.typeExists(k)) return this._geometryTypes.get(k); if (this.typeExists(k)) return this._geometryTypes.get(k);
return new Map(); return new Map();
} }
@ -183,25 +183,25 @@ export class AvatarModelGeometry
return (this.getBodyPartsOfType(k).get(_arg_2) || null); return (this.getBodyPartsOfType(k).get(_arg_2) || null);
} }
public getBodyPartOfItem(k: string, _arg_2: string, _arg_3:IAvatarImage): GeometryBodyPart public getBodyPartOfItem(k: string, _arg_2: string, _arg_3: IAvatarImage): GeometryBodyPart
{ {
const itemIds = this._itemIdToBodyPartMap.get(k); const itemIds = this._itemIdToBodyPartMap.get(k);
if(itemIds) if (itemIds)
{ {
const part = itemIds.get(_arg_2); const part = itemIds.get(_arg_2);
if(part) return part; if (part) return part;
const parts = this.getBodyPartsOfType(k); const parts = this.getBodyPartsOfType(k);
if(parts) if (parts)
{ {
for(const part of parts.values()) for (const part of parts.values())
{ {
if(!part) continue; if (!part) continue;
if(part.hasPart(_arg_2, _arg_3)) return part; if (part.hasPart(_arg_2, _arg_3)) return part;
} }
} }
} }
@ -214,13 +214,13 @@ export class AvatarModelGeometry
const parts = this.getBodyPartIdsInAvatarSet(_arg_2); const parts = this.getBodyPartIdsInAvatarSet(_arg_2);
const geometryParts = []; const geometryParts = [];
for(const part of parts) for (const part of parts)
{ {
if(!part) continue; if (!part) continue;
const bodyPart = k.get(part); const bodyPart = k.get(part);
if(bodyPart) if (bodyPart)
{ {
geometryParts.push(bodyPart); geometryParts.push(bodyPart);
} }
@ -231,22 +231,22 @@ export class AvatarModelGeometry
public getBodyPartsAtAngle(k: string, _arg_2: number, _arg_3: string): string[] public getBodyPartsAtAngle(k: string, _arg_2: number, _arg_3: string): string[]
{ {
if(!_arg_3) return []; if (!_arg_3) return [];
const geometryParts = this.getBodyPartsOfType(_arg_3); const geometryParts = this.getBodyPartsOfType(_arg_3);
const parts = this.getBodyPartsInAvatarSet(geometryParts, k); const parts = this.getBodyPartsInAvatarSet(geometryParts, k);
const sets: [ number, GeometryBodyPart ][] = []; const sets: [number, GeometryBodyPart][] = [];
const ids: string[] = []; const ids: string[] = [];
this._transformation = Matrix4x4.getYRotationMatrix(_arg_2); this._transformation = Matrix4x4.getYRotationMatrix(_arg_2);
for(const part of parts.values()) for (const part of parts.values())
{ {
if(!part) continue; if (!part) continue;
part.applyTransform(this._transformation); part.applyTransform(this._transformation);
sets.push([ part.getDistance(this._camera), part ]); sets.push([part.getDistance(this._camera), part]);
} }
sets.sort((a, b) => sets.sort((a, b) =>
@ -254,16 +254,16 @@ export class AvatarModelGeometry
const partA = a[0]; const partA = a[0];
const partB = b[0]; const partB = b[0];
if(partA < partB) return -1; if (partA < partB) return -1;
if(partA > partB) return 1; if (partA > partB) return 1;
return 0; return 0;
}); });
for(const set of sets) for (const set of sets)
{ {
if(!set) continue; if (!set) continue;
ids.push(set[1].id); ids.push(set[1].id);
} }
@ -271,9 +271,9 @@ export class AvatarModelGeometry
return ids; return ids;
} }
public getParts(k: string, _arg_2: string, _arg_3: number, _arg_4: any[], _arg_5:IAvatarImage): string[] public getParts(k: string, _arg_2: string, _arg_3: number, _arg_4: any[], _arg_5: IAvatarImage): string[]
{ {
if(this.hasBodyPart(k, _arg_2)) if (this.hasBodyPart(k, _arg_2))
{ {
const part = this.getBodyPartsOfType(k).get(_arg_2); const part = this.getBodyPartsOfType(k).get(_arg_2);

View File

@ -1,4 +1,4 @@
import { IAvatarImage } from '../IAvatarImage'; import { IAvatarImage } from '../../../api';
import { GeometryItem } from './GeometryItem'; import { GeometryItem } from './GeometryItem';
import { Matrix4x4 } from './Matrix4x4'; import { Matrix4x4 } from './Matrix4x4';
import { Node3D } from './Node3D'; import { Node3D } from './Node3D';
@ -20,11 +20,11 @@ export class GeometryBodyPart extends Node3D
this._parts = new Map(); this._parts = new Map();
this._dynamicParts = new Map(); this._dynamicParts = new Map();
if(k.items && (k.items.length > 0)) if (k.items && (k.items.length > 0))
{ {
for(const item of k.items) for (const item of k.items)
{ {
if(!item) continue; if (!item) continue;
const geometryItem = new GeometryItem(item); const geometryItem = new GeometryItem(item);
@ -38,13 +38,13 @@ export class GeometryBodyPart extends Node3D
const existing = this._dynamicParts.get(k); const existing = this._dynamicParts.get(k);
const parts: GeometryItem[] = []; const parts: GeometryItem[] = [];
if(existing) if (existing)
{ {
for(const index in existing) for (const index in existing)
{ {
const item = existing[index]; const item = existing[index];
if(!item) continue; if (!item) continue;
parts.push(item); parts.push(item);
} }
@ -57,24 +57,24 @@ export class GeometryBodyPart extends Node3D
{ {
const ids: string[] = []; const ids: string[] = [];
for(const part of this._parts.values()) for (const part of this._parts.values())
{ {
if(!part) continue; if (!part) continue;
ids.push(part.id); ids.push(part.id);
} }
if(k) if (k)
{ {
const existing = this._dynamicParts.get(k); const existing = this._dynamicParts.get(k);
if(existing) if (existing)
{ {
for(const index in existing) for (const index in existing)
{ {
const part = existing[index]; const part = existing[index];
if(!part) continue; if (!part) continue;
ids.push(part.id); ids.push(part.id);
} }
@ -93,11 +93,11 @@ export class GeometryBodyPart extends Node3D
public addPart(k: any, _arg_2: IAvatarImage): boolean public addPart(k: any, _arg_2: IAvatarImage): boolean
{ {
if(this.hasPart(k.id, _arg_2)) return false; if (this.hasPart(k.id, _arg_2)) return false;
let existing = this._dynamicParts.get(_arg_2); let existing = this._dynamicParts.get(_arg_2);
if(!existing) if (!existing)
{ {
existing = {}; existing = {};
@ -113,7 +113,7 @@ export class GeometryBodyPart extends Node3D
{ {
let existingPart = (this._parts.get(k) || null); let existingPart = (this._parts.get(k) || null);
if(!existingPart && (this._dynamicParts.get(_arg_2) !== undefined)) if (!existingPart && (this._dynamicParts.get(_arg_2) !== undefined))
{ {
existingPart = (this._dynamicParts.get(_arg_2)[k] || null); existingPart = (this._dynamicParts.get(_arg_2)[k] || null);
} }
@ -123,30 +123,30 @@ export class GeometryBodyPart extends Node3D
public getParts(k: Matrix4x4, _arg_2: Vector3D, _arg_3: any[], _arg_4: IAvatarImage): string[] public getParts(k: Matrix4x4, _arg_2: Vector3D, _arg_3: any[], _arg_4: IAvatarImage): string[]
{ {
const parts: [ number, GeometryItem ][] = []; const parts: [number, GeometryItem][] = [];
for(const part of this._parts.values()) for (const part of this._parts.values())
{ {
if(!part) continue; if (!part) continue;
part.applyTransform(k); part.applyTransform(k);
parts.push([ part.getDistance(_arg_2), part ]); parts.push([part.getDistance(_arg_2), part]);
} }
const existingDynamic = this._dynamicParts.get(_arg_4); const existingDynamic = this._dynamicParts.get(_arg_4);
if(existingDynamic) if (existingDynamic)
{ {
for(const index in existingDynamic) for (const index in existingDynamic)
{ {
const part = existingDynamic[index]; const part = existingDynamic[index];
if(!part) continue; if (!part) continue;
part.applyTransform(k); part.applyTransform(k);
parts.push([ part.getDistance(_arg_2), part ]); parts.push([part.getDistance(_arg_2), part]);
} }
} }
@ -155,18 +155,18 @@ export class GeometryBodyPart extends Node3D
const partA = a[0]; const partA = a[0];
const partB = b[0]; const partB = b[0];
if(partA < partB) return -1; if (partA < partB) return -1;
if(partA > partB) return 1; if (partA > partB) return 1;
return 0; return 0;
}); });
const partIds: string[] = []; const partIds: string[] = [];
for(const part of parts) for (const part of parts)
{ {
if(!part) continue; if (!part) continue;
partIds.push(part[1].id); partIds.push(part[1].id);
} }

View File

@ -10,17 +10,16 @@ export * from './AvatarImagePartContainer';
export * from './AvatarRenderManager'; export * from './AvatarRenderManager';
export * from './AvatarStructure'; export * from './AvatarStructure';
export * from './cache'; export * from './cache';
export * from './data/HabboAvatarAnimations';
export * from './data/HabboAvatarGeometry';
export * from './data/HabboAvatarPartSets';
export * from './EffectAssetDownloadLibrary'; export * from './EffectAssetDownloadLibrary';
export * from './EffectAssetDownloadManager'; export * from './EffectAssetDownloadManager';
export * from './enum';
export * from './events'; export * from './events';
export * from './geometry'; export * from './geometry';
export * from './IAvatarEffectListener';
export * from './IAvatarFigureContainer';
export * from './IAvatarImage';
export * from './IAvatarImageListener';
export * from './IAvatarRenderManager';
export * from './IOutfit';
export * from './pets'; export * from './pets';
export * from './PlaceHolderAvatarImage'; export * from './PlaceHolderAvatarImage';
export * from './structure'; export * from './structure';
export * from './structure/animation';
export * from './structure/figure';
export * from './structure/parts';

View File

@ -1 +0,0 @@
export * from './figuredata';

View File

@ -1,6 +1,5 @@
import { IActionDefinition } from '../actions/IActionDefinition'; import { IActionDefinition, IFigureSetData } from '../../../api';
import { AnimationAction } from './animation/AnimationAction'; import { AnimationAction } from './animation';
import { IFigureSetData } from './IFigureSetData';
export class AvatarAnimationData implements IFigureSetData export class AvatarAnimationData implements IFigureSetData
{ {
@ -13,11 +12,11 @@ export class AvatarAnimationData implements IFigureSetData
public parse(data: any): boolean public parse(data: any): boolean
{ {
if(data && (data.length > 0)) if (data && (data.length > 0))
{ {
for(const animation of data) for (const animation of data)
{ {
if(!animation) continue; if (!animation) continue;
const newAnimation = new AnimationAction(animation); const newAnimation = new AnimationAction(animation);
@ -30,7 +29,7 @@ export class AvatarAnimationData implements IFigureSetData
public appendJSON(k: any): boolean public appendJSON(k: any): boolean
{ {
for(const _local_2 of k.action) for (const _local_2 of k.action)
{ {
this._actions.set(_local_2.id, new AnimationAction(_local_2)); this._actions.set(_local_2.id, new AnimationAction(_local_2));
} }
@ -42,7 +41,7 @@ export class AvatarAnimationData implements IFigureSetData
{ {
const existing = this._actions.get(action.id); const existing = this._actions.get(action.id);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
@ -51,7 +50,7 @@ export class AvatarAnimationData implements IFigureSetData
{ {
const animationAction = this.getAction(k); const animationAction = this.getAction(k);
if(!animationAction) return 0; if (!animationAction) return 0;
return animationAction.frameCount; return animationAction.frameCount;
} }

View File

@ -1,5 +1,5 @@
import { Point } from '@pixi/math'; import { Point } from '@pixi/math';
import { AvatarScaleType } from '../enum/AvatarScaleType'; import { AvatarScaleType } from '../../../api';
export class AvatarCanvas export class AvatarCanvas
{ {
@ -16,7 +16,7 @@ export class AvatarCanvas
this._height = k.height; this._height = k.height;
this._offset = new Point(k.dx, k.dy); this._offset = new Point(k.dx, k.dy);
if(_arg_2 == AvatarScaleType.LARGE) this._regPoint = new Point(((this._width - 64) / 2), 0); if (_arg_2 == AvatarScaleType.LARGE) this._regPoint = new Point(((this._width - 64) / 2), 0);
else this._regPoint = new Point(((this._width - 32) / 2), 0); else this._regPoint = new Point(((this._width - 32) / 2), 0);
} }

View File

@ -1,5 +1,5 @@
import { IFigureSetData } from '../../../api';
import { EventDispatcher, NitroEvent } from '../../../core'; import { EventDispatcher, NitroEvent } from '../../../core';
import { IFigureSetData } from './IFigureSetData';
export class AvatarStructureDownload extends EventDispatcher export class AvatarStructureDownload extends EventDispatcher
{ {
@ -30,9 +30,9 @@ export class AvatarStructureDownload extends EventDispatcher
{ {
const response = request.responseText; const response = request.responseText;
if(!response || !response.length) throw new Error('invalid_figure_data'); if (!response || !response.length) throw new Error('invalid_figure_data');
if(this._dataReceiver) this._dataReceiver.appendJSON(JSON.parse(response)); if (this._dataReceiver) this._dataReceiver.appendJSON(JSON.parse(response));
this.dispatchEvent(new NitroEvent(AvatarStructureDownload.AVATAR_STRUCTURE_DONE)); this.dispatchEvent(new NitroEvent(AvatarStructureDownload.AVATAR_STRUCTURE_DONE));
}; };

View File

@ -1,11 +1,5 @@
import { IFigureData } from '../interfaces'; import { IFigureData, IFigurePartSet, IFigureSetData, IPalette, ISetType, IStructureData } from '../../../api';
import { IFigurePartSet } from './figure/IFigurePartSet'; import { Palette, SetType } from './figure';
import { IPalette } from './figure/IPalette';
import { ISetType } from './figure/ISetType';
import { Palette } from './figure/Palette';
import { SetType } from './figure/SetType';
import { IFigureSetData } from './IFigureSetData';
import { IStructureData } from './IStructureData';
export class FigureSetData implements IFigureSetData, IStructureData export class FigureSetData implements IFigureSetData, IStructureData
{ {
@ -25,22 +19,22 @@ export class FigureSetData implements IFigureSetData, IStructureData
public parse(data: IFigureData): boolean public parse(data: IFigureData): boolean
{ {
if(!data) return false; if (!data) return false;
for(const palette of data.palettes) for (const palette of data.palettes)
{ {
const newPalette = new Palette(palette); const newPalette = new Palette(palette);
if(!newPalette) continue; if (!newPalette) continue;
this._palettes.set(newPalette.id.toString(), newPalette); this._palettes.set(newPalette.id.toString(), newPalette);
} }
for(const set of data.setTypes) for (const set of data.setTypes)
{ {
const newSet = new SetType(set); const newSet = new SetType(set);
if(!newSet) continue; if (!newSet) continue;
this._setTypes.set(newSet.type, newSet); this._setTypes.set(newSet.type, newSet);
} }
@ -50,11 +44,11 @@ export class FigureSetData implements IFigureSetData, IStructureData
public injectJSON(data: IFigureData): void public injectJSON(data: IFigureData): void
{ {
for(const setType of data.setTypes) for (const setType of data.setTypes)
{ {
const existingSetType = this._setTypes.get(setType.type); const existingSetType = this._setTypes.get(setType.type);
if(existingSetType) existingSetType.cleanUp(setType); if (existingSetType) existingSetType.cleanUp(setType);
else this._setTypes.set(setType.type, new SetType(setType)); else this._setTypes.set(setType.type, new SetType(setType));
} }
@ -63,23 +57,23 @@ export class FigureSetData implements IFigureSetData, IStructureData
public appendJSON(data: IFigureData): boolean public appendJSON(data: IFigureData): boolean
{ {
if(!data) return false; if (!data) return false;
for(const palette of data.palettes) for (const palette of data.palettes)
{ {
const id = palette.id.toString(); const id = palette.id.toString();
const existingPalette = this._palettes.get(id); const existingPalette = this._palettes.get(id);
if(!existingPalette) this._palettes.set(id, new Palette(palette)); if (!existingPalette) this._palettes.set(id, new Palette(palette));
else existingPalette.append(palette); else existingPalette.append(palette);
} }
for(const setType of data.setTypes) for (const setType of data.setTypes)
{ {
const type = setType.type; const type = setType.type;
const existingSetType = this._setTypes.get(type); const existingSetType = this._setTypes.get(type);
if(!existingSetType) this._setTypes.set(type, new SetType(setType)); if (!existingSetType) this._setTypes.set(type, new SetType(setType));
else existingSetType.append(setType); else existingSetType.append(setType);
} }
@ -90,9 +84,9 @@ export class FigureSetData implements IFigureSetData, IStructureData
{ {
const types: string[] = []; const types: string[] = [];
for(const set of this._setTypes.values()) for (const set of this._setTypes.values())
{ {
if(!set || !set.isMandatory(k, _arg_2)) continue; if (!set || !set.isMandatory(k, _arg_2)) continue;
types.push(set.type); types.push(set.type);
} }
@ -100,13 +94,13 @@ export class FigureSetData implements IFigureSetData, IStructureData
return types; return types;
} }
public getDefaultPartSet(k: string, _arg_2: string): IFigurePartSet public getDefaultPartSet(type: string, gender: string): IFigurePartSet
{ {
const setType = this._setTypes.get(k); const setType = this._setTypes.get(type);
if(!setType) return null; if (!setType) return null;
return setType.getDefaultPartSet(_arg_2); return setType.getDefaultPartSet(gender);
} }
public getSetType(k: string): ISetType public getSetType(k: string): ISetType
@ -121,11 +115,11 @@ export class FigureSetData implements IFigureSetData, IStructureData
public getFigurePartSet(k: number): IFigurePartSet public getFigurePartSet(k: number): IFigurePartSet
{ {
for(const set of this._setTypes.values()) for (const set of this._setTypes.values())
{ {
const partSet = set.getPartSet(k); const partSet = set.getPartSet(k);
if(!partSet) continue; if (!partSet) continue;
return partSet; return partSet;
} }

View File

@ -1,8 +1,6 @@
import { ActionDefinition } from '../actions/ActionDefinition'; import { IActionDefinition, IFigureSetData } from '../../../api';
import { IActionDefinition } from '../actions/IActionDefinition'; import { ActionDefinition } from '../actions';
import { IFigureSetData } from './IFigureSetData'; import { ActivePartSet, PartDefinition } from './parts';
import { ActivePartSet } from './parts/ActivePartSet';
import { PartDefinition } from './parts/PartDefinition';
export class PartSetsData implements IFigureSetData export class PartSetsData implements IFigureSetData
{ {
@ -17,21 +15,21 @@ export class PartSetsData implements IFigureSetData
public parse(data: any): boolean public parse(data: any): boolean
{ {
if(data.partSet && (data.partSet.length > 0)) if (data.partSet && (data.partSet.length > 0))
{ {
for(const part of data.partSet) for (const part of data.partSet)
{ {
if(!part) continue; if (!part) continue;
this._parts.set(part.setType, new PartDefinition(part)); this._parts.set(part.setType, new PartDefinition(part));
} }
} }
if(data.activePartSets && (data.activePartSets.length > 0)) if (data.activePartSets && (data.activePartSets.length > 0))
{ {
for(const activePart of data.activePartSets) for (const activePart of data.activePartSets)
{ {
if(!activePart) continue; if (!activePart) continue;
this._activePartSets.set(activePart.id, new ActivePartSet(activePart)); this._activePartSets.set(activePart.id, new ActivePartSet(activePart));
} }
@ -42,21 +40,21 @@ export class PartSetsData implements IFigureSetData
public appendJSON(data: any): boolean public appendJSON(data: any): boolean
{ {
if(data.partSet && (data.partSet.length > 0)) if (data.partSet && (data.partSet.length > 0))
{ {
for(const part of data.partSet) for (const part of data.partSet)
{ {
if(!part) continue; if (!part) continue;
this._parts.set(part.setType, new PartDefinition(part)); this._parts.set(part.setType, new PartDefinition(part));
} }
} }
if(data.activePartSets && (data.activePartSets.length > 0)) if (data.activePartSets && (data.activePartSets.length > 0))
{ {
for(const activePart of data.activePartSets) for (const activePart of data.activePartSets)
{ {
if(!activePart) continue; if (!activePart) continue;
this._activePartSets.set(activePart.id, new ActivePartSet(activePart)); this._activePartSets.set(activePart.id, new ActivePartSet(activePart));
} }
@ -65,11 +63,11 @@ export class PartSetsData implements IFigureSetData
return false; return false;
} }
public getActiveParts(k:IActionDefinition): string[] public getActiveParts(k: IActionDefinition): string[]
{ {
const activePartSet = this._activePartSets.get(k.activePartSet); const activePartSet = this._activePartSets.get(k.activePartSet);
if(!activePartSet) return []; if (!activePartSet) return [];
return activePartSet.parts; return activePartSet.parts;
} }
@ -78,7 +76,7 @@ export class PartSetsData implements IFigureSetData
{ {
const existing = this._parts.get(part); const existing = this._parts.get(part);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }
@ -89,7 +87,7 @@ export class PartSetsData implements IFigureSetData
let existing = this._parts.get(_local_2); let existing = this._parts.get(_local_2);
if(!existing) if (!existing)
{ {
existing = new PartDefinition(k); existing = new PartDefinition(k);
@ -103,7 +101,7 @@ export class PartSetsData implements IFigureSetData
{ {
const existing = this._activePartSets.get(k.activePartSet); const existing = this._activePartSets.get(k.activePartSet);
if(!existing) return null; if (!existing) return null;
return existing; return existing;
} }

View File

@ -1,5 +1,4 @@
import { IFigureDataPart } from '../../interfaces'; import { IFigureDataPart, IFigurePart } from '../../../../api';
import { IFigurePart } from './IFigurePart';
export class FigurePart implements IFigurePart export class FigurePart implements IFigurePart
{ {
@ -12,7 +11,7 @@ export class FigurePart implements IFigurePart
constructor(data: IFigureDataPart) constructor(data: IFigureDataPart)
{ {
if(!data) throw new Error('invalid_data'); if (!data) throw new Error('invalid_data');
this._id = data.id; this._id = data.id;
this._type = data.type; this._type = data.type;

View File

@ -1,7 +1,5 @@
import { IFigureDataSet } from '../../interfaces'; import { IFigureDataSet, IFigurePart, IFigurePartSet } from '../../../../api';
import { FigurePart } from './FigurePart'; import { FigurePart } from './FigurePart';
import { IFigurePart } from './IFigurePart';
import { IFigurePartSet } from './IFigurePartSet';
export class FigurePartSet implements IFigurePartSet export class FigurePartSet implements IFigurePartSet
{ {
@ -18,7 +16,7 @@ export class FigurePartSet implements IFigurePartSet
constructor(type: string, data: IFigureDataSet) constructor(type: string, data: IFigureDataSet)
{ {
if(!type || !data) throw new Error('invalid_data'); if (!type || !data) throw new Error('invalid_data');
this._id = data.id; this._id = data.id;
this._type = type; this._type = type;
@ -31,24 +29,24 @@ export class FigurePartSet implements IFigurePartSet
this._isPreSelectable = data.preselectable; this._isPreSelectable = data.preselectable;
this._isSellable = data.sellable; this._isSellable = data.sellable;
for(const part of data.parts) for (const part of data.parts)
{ {
const newPart = new FigurePart(part); const newPart = new FigurePart(part);
const partIndex = this.getPartIndex(newPart); const partIndex = this.getPartIndex(newPart);
if(partIndex !== -1) this._parts.splice(partIndex, 0, newPart); if (partIndex !== -1) this._parts.splice(partIndex, 0, newPart);
else this._parts.push(newPart); else this._parts.push(newPart);
} }
if(data.hiddenLayers) if (data.hiddenLayers)
{ {
for(const hiddenLayer of data.hiddenLayers) this._hiddenLayers.push(hiddenLayer.partType); for (const hiddenLayer of data.hiddenLayers) this._hiddenLayers.push(hiddenLayer.partType);
} }
} }
public dispose(): void public dispose(): void
{ {
for(const part of this._parts) for (const part of this._parts)
{ {
const figurePart = part as FigurePart; const figurePart = part as FigurePart;
@ -63,15 +61,15 @@ export class FigurePartSet implements IFigurePartSet
{ {
const totalParts = this._parts.length; const totalParts = this._parts.length;
if(!totalParts) return -1; if (!totalParts) return -1;
for(let i = 0; i < totalParts; i++) for (let i = 0; i < totalParts; i++)
{ {
const existingPart = this._parts[i]; const existingPart = this._parts[i];
if(!existingPart) continue; if (!existingPart) continue;
if(existingPart.type !== part.type || existingPart.index > part.index) continue; if (existingPart.type !== part.type || existingPart.index > part.index) continue;
return i; return i;
} }
@ -81,9 +79,9 @@ export class FigurePartSet implements IFigurePartSet
public getPart(k: string, _arg_2: number): IFigurePart public getPart(k: string, _arg_2: number): IFigurePart
{ {
for(const part of this._parts) for (const part of this._parts)
{ {
if((part.type !== k) || (part.id !== _arg_2)) continue; if ((part.type !== k) || (part.id !== _arg_2)) continue;
return part; return part;
} }

View File

@ -1,7 +1,5 @@
import { IFigureDataPalette, IPalette, IPartColor } from '../../../../api';
import { AdvancedMap } from '../../../../core'; import { AdvancedMap } from '../../../../core';
import { IFigureDataPalette } from '../../interfaces';
import { IPalette } from './IPalette';
import { IPartColor } from './IPartColor';
import { PartColor } from './PartColor'; import { PartColor } from './PartColor';
export class Palette implements IPalette export class Palette implements IPalette
@ -11,7 +9,7 @@ export class Palette implements IPalette
constructor(data: IFigureDataPalette) constructor(data: IFigureDataPalette)
{ {
if(!data) throw new Error('invalid_data'); if (!data) throw new Error('invalid_data');
this._id = data.id; this._id = data.id;
this._colors = new AdvancedMap(); this._colors = new AdvancedMap();
@ -21,7 +19,7 @@ export class Palette implements IPalette
public append(data: IFigureDataPalette): void public append(data: IFigureDataPalette): void
{ {
for(const color of data.colors) for (const color of data.colors)
{ {
const newColor = new PartColor(color); const newColor = new PartColor(color);
@ -31,7 +29,7 @@ export class Palette implements IPalette
public getColor(id: number): IPartColor public getColor(id: number): IPartColor
{ {
if((id === undefined) || id < 0) return null; if ((id === undefined) || id < 0) return null;
return (this._colors.getValue(id.toString()) || null); return (this._colors.getValue(id.toString()) || null);
} }

View File

@ -1,5 +1,4 @@
import { IFigureDataColor } from '../../interfaces'; import { IFigureDataColor, IPartColor } from '../../../../api';
import { IPartColor } from './IPartColor';
export class PartColor implements IPartColor export class PartColor implements IPartColor
{ {
@ -11,7 +10,7 @@ export class PartColor implements IPartColor
constructor(data: IFigureDataColor) constructor(data: IFigureDataColor)
{ {
if(!data) throw new Error('invalid_data'); if (!data) throw new Error('invalid_data');
this._id = data.id; this._id = data.id;
this._index = data.index; this._index = data.index;

View File

@ -1,8 +1,6 @@
import { IFigureDataSetType, IFigurePartSet, ISetType } from '../../../../api';
import { AdvancedMap } from '../../../../core'; import { AdvancedMap } from '../../../../core';
import { IFigureDataSetType } from '../../interfaces';
import { FigurePartSet } from './FigurePartSet'; import { FigurePartSet } from './FigurePartSet';
import { IFigurePartSet } from './IFigurePartSet';
import { ISetType } from './ISetType';
export class SetType implements ISetType export class SetType implements ISetType
{ {
@ -13,7 +11,7 @@ export class SetType implements ISetType
constructor(data: IFigureDataSetType) constructor(data: IFigureDataSetType)
{ {
if(!data) throw new Error('invalid_data'); if (!data) throw new Error('invalid_data');
this._type = data.type; this._type = data.type;
this._paletteId = data.paletteId; this._paletteId = data.paletteId;
@ -27,7 +25,7 @@ export class SetType implements ISetType
public dispose(): void public dispose(): void
{ {
for(const set of this._partSets.getValues()) for (const set of this._partSets.getValues())
{ {
const partSet = set as FigurePartSet; const partSet = set as FigurePartSet;
@ -39,12 +37,12 @@ export class SetType implements ISetType
public cleanUp(data: IFigureDataSetType): void public cleanUp(data: IFigureDataSetType): void
{ {
for(const set of data.sets) for (const set of data.sets)
{ {
const setId = set.id.toString(); const setId = set.id.toString();
const partSet = (this._partSets.getValue(setId) as FigurePartSet); const partSet = (this._partSets.getValue(setId) as FigurePartSet);
if(partSet) if (partSet)
{ {
partSet.dispose(); partSet.dispose();
@ -55,18 +53,18 @@ export class SetType implements ISetType
public append(setType: IFigureDataSetType): void public append(setType: IFigureDataSetType): void
{ {
if(!setType || !setType.sets) return; if (!setType || !setType.sets) return;
for(const set of setType.sets) this._partSets.add(set.id.toString(), new FigurePartSet(this._type, set)); for (const set of setType.sets) this._partSets.add(set.id.toString(), new FigurePartSet(this._type, set));
} }
public getDefaultPartSet(gender: string): IFigurePartSet public getDefaultPartSet(gender: string): IFigurePartSet
{ {
for(const set of this._partSets.getValues()) for (const set of this._partSets.getValues())
{ {
if(!set) continue; if (!set) continue;
if((set.clubLevel === 0) && ((set.gender === gender) || (set.gender === 'U'))) return set; if ((set.clubLevel === 0) && ((set.gender === gender) || (set.gender === 'U'))) return set;
} }
return null; return null;

View File

@ -1,10 +1,5 @@
export * from './FigurePart'; export * from './FigurePart';
export * from './FigurePartSet'; export * from './FigurePartSet';
export * from './IFigurePart';
export * from './IFigurePartSet';
export * from './IPalette';
export * from './IPartColor';
export * from './ISetType';
export * from './Palette'; export * from './Palette';
export * from './PartColor'; export * from './PartColor';
export * from './SetType'; export * from './SetType';

View File

@ -4,7 +4,5 @@ export * from './AvatarCanvas';
export * from './AvatarStructureDownload'; export * from './AvatarStructureDownload';
export * from './figure'; export * from './figure';
export * from './FigureSetData'; export * from './FigureSetData';
export * from './IFigureSetData';
export * from './IStructureData';
export * from './parts'; export * from './parts';
export * from './PartSetsData'; export * from './PartSetsData';

View File

@ -1,5 +1,6 @@
import { IConnection, INitroCommunicationDemo, INitroCommunicationManager } from '../../../api'; import { IConnection, INitroCommunicationDemo, INitroCommunicationManager } from '../../../api';
import { NitroManager, SocketConnectionEvent } from '../../../core'; import { NitroManager, SocketConnectionEvent } from '../../../core';
import { GetTickerTime } from '../../../pixi-proxy';
import { Nitro } from '../../Nitro'; import { Nitro } from '../../Nitro';
import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer } from '../messages'; import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer } from '../messages';
import { NitroCommunicationDemoEvent } from './NitroCommunicationDemoEvent'; import { NitroCommunicationDemoEvent } from './NitroCommunicationDemoEvent';
@ -34,7 +35,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(connection) if (connection)
{ {
connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent);
connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent);
@ -49,7 +50,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(connection) if (connection)
{ {
connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent);
connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent);
@ -67,13 +68,13 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(!connection) return; if (!connection) return;
this._didConnect = true; this._didConnect = true;
this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection); this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection);
if(Nitro.instance.getConfiguration<boolean>('system.pong.manually', false)) this.startPonging(); if (Nitro.instance.getConfiguration<boolean>('system.pong.manually', false)) this.startPonging();
this.startHandshake(connection); this.startHandshake(connection);
@ -86,18 +87,18 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(!connection) return; if (!connection) return;
this.stopPonging(); this.stopPonging();
if(this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection); if (this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection);
} }
private onConnectionErrorEvent(event: CloseEvent): void private onConnectionErrorEvent(event: CloseEvent): void
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(!connection) return; if (!connection) return;
this.stopPonging(); this.stopPonging();
@ -106,9 +107,9 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
private tryAuthentication(connection: IConnection): void private tryAuthentication(connection: IConnection): void
{ {
if(!connection || !this.getSSO()) if (!connection || !this.getSSO())
{ {
if(!this.getSSO()) if (!this.getSSO())
{ {
this.logger.error('Login without an SSO ticket is not supported'); this.logger.error('Login without an SSO ticket is not supported');
} }
@ -118,19 +119,19 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
return; return;
} }
connection.send(new SSOTicketMessageComposer(this.getSSO(), Nitro.instance.time)); connection.send(new SSOTicketMessageComposer(this.getSSO(), GetTickerTime()));
} }
private onClientPingEvent(event: ClientPingEvent): void private onClientPingEvent(event: ClientPingEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
this.sendPong(event.connection); this.sendPong(event.connection);
} }
private onAuthenticatedEvent(event: AuthenticatedEvent): void private onAuthenticatedEvent(event: AuthenticatedEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
this.completeHandshake(event.connection); this.completeHandshake(event.connection);
@ -162,7 +163,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
private stopPonging(): void private stopPonging(): void
{ {
if(!this._pongInterval) return; if (!this._pongInterval) return;
clearInterval(this._pongInterval); clearInterval(this._pongInterval);
@ -173,7 +174,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
{ {
connection = ((connection || this._communication.connection) || null); connection = ((connection || this._communication.connection) || null);
if(!connection) return; if (!connection) return;
connection.send(new PongMessageComposer()); connection.send(new PongMessageComposer());
} }

View File

@ -1,5 +1,5 @@
import { IMessageDataWrapper } from '../../../../../api'; import { IMessageDataWrapper } from '../../../../../api';
import { PixiApplicationProxy } from '../../../../../pixi-proxy'; import { GetTickerTime } from '../../../../../pixi-proxy';
export class FrontPageItem export class FrontPageItem
{ {
@ -18,7 +18,7 @@ export class FrontPageItem
constructor(wrapper: IMessageDataWrapper) constructor(wrapper: IMessageDataWrapper)
{ {
if(!wrapper) throw new Error('invalid_wrapper'); if (!wrapper) throw new Error('invalid_wrapper');
this.flush(); this.flush();
this.parse(wrapper); this.parse(wrapper);
@ -40,14 +40,14 @@ export class FrontPageItem
public parse(wrapper: IMessageDataWrapper): boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(!wrapper) return false; if (!wrapper) return false;
this._position = wrapper.readInt(); this._position = wrapper.readInt();
this._itemName = wrapper.readString(); this._itemName = wrapper.readString();
this._itemPromoImage = wrapper.readString(); this._itemPromoImage = wrapper.readString();
this._type = wrapper.readInt(); this._type = wrapper.readInt();
switch(this._type) switch (this._type)
{ {
case FrontPageItem.ITEM_CATALOGUE_PAGE: case FrontPageItem.ITEM_CATALOGUE_PAGE:
this._catalogPageLocation = wrapper.readString(); this._catalogPageLocation = wrapper.readString();
@ -62,7 +62,7 @@ export class FrontPageItem
const time = wrapper.readInt(); const time = wrapper.readInt();
this._expirationTime = ((time > 0) ? ((time * 1000) + PixiApplicationProxy.instance.ticker.lastTime) : 0); this._expirationTime = ((time > 0) ? ((time * 1000) + GetTickerTime()) : 0);
return true; return true;
} }

View File

@ -1,5 +1,5 @@
import { IMessageDataWrapper } from '../../../../../api'; import { IMessageDataWrapper } from '../../../../../api';
import { PixiApplicationProxy } from '../../../../../pixi-proxy'; import { GetTickerTime } from '../../../../../pixi-proxy';
export class TargetedOfferData export class TargetedOfferData
{ {
@ -31,7 +31,7 @@ export class TargetedOfferData
this._Str_9772 = wrapper.readInt(); this._Str_9772 = wrapper.readInt();
const time = wrapper.readInt(); const time = wrapper.readInt();
this._expirationTime = ((time > 0) ? ((time * 1000) + PixiApplicationProxy.instance.ticker.lastTime) : 0); this._expirationTime = ((time > 0) ? ((time * 1000) + GetTickerTime()) : 0);
this._title = wrapper.readString(); this._title = wrapper.readString();
this._Str_1858 = wrapper.readString(); this._Str_1858 = wrapper.readString();
@ -42,7 +42,7 @@ export class TargetedOfferData
let count = wrapper.readInt(); let count = wrapper.readInt();
while(count > 0) while (count > 0)
{ {
this._Str_11962.push(wrapper.readString()); this._Str_11962.push(wrapper.readString());
@ -53,7 +53,7 @@ export class TargetedOfferData
public populate(offerData: TargetedOfferData) public populate(offerData: TargetedOfferData)
{ {
if(!offerData) return; if (!offerData) return;
this._id = offerData.id; this._id = offerData.id;
this._identifier = offerData.identifier; this._identifier = offerData.identifier;

View File

@ -1,5 +1,5 @@
import { IMessageDataWrapper, IObjectData } from '../../../../../../api'; import { IMessageDataWrapper, IObjectData } from '../../../../../../api';
import { PixiApplicationProxy } from '../../../../../../pixi-proxy'; import { GetTickerTime } from '../../../../../../pixi-proxy';
import { FurnitureDataParser } from '../../room'; import { FurnitureDataParser } from '../../room';
import { IFurnitureItemData } from './IFurnitureItemData'; import { IFurnitureItemData } from './IFurnitureItemData';
@ -30,7 +30,7 @@ export class FurnitureListItemParser implements IFurnitureItemData
constructor(wrapper: IMessageDataWrapper) constructor(wrapper: IMessageDataWrapper)
{ {
if(!wrapper) throw new Error('invalid_wrapper'); if (!wrapper) throw new Error('invalid_wrapper');
this.flush(); this.flush();
this.parse(wrapper); this.parse(wrapper);
@ -63,7 +63,7 @@ export class FurnitureListItemParser implements IFurnitureItemData
public parse(wrapper: IMessageDataWrapper): boolean public parse(wrapper: IMessageDataWrapper): boolean
{ {
if(!wrapper) return false; if (!wrapper) return false;
this._itemId = wrapper.readInt(); this._itemId = wrapper.readInt();
this._furniType = wrapper.readString(); this._furniType = wrapper.readString();
@ -76,9 +76,9 @@ export class FurnitureListItemParser implements IFurnitureItemData
this._isGroupable = wrapper.readBoolean(); this._isGroupable = wrapper.readBoolean();
this._sellable = wrapper.readBoolean(); this._sellable = wrapper.readBoolean();
this._secondsToExpiration = wrapper.readInt(); this._secondsToExpiration = wrapper.readInt();
this._expirationTimeStamp = PixiApplicationProxy.instance.ticker.lastTime; this._expirationTimeStamp = GetTickerTime();
if(this.secondsToExpiration > -1) if (this.secondsToExpiration > -1)
{ {
this._rentable = true; this._rentable = true;
} }
@ -92,7 +92,7 @@ export class FurnitureListItemParser implements IFurnitureItemData
this._flatId = wrapper.readInt(); this._flatId = wrapper.readInt();
this._isWallItem = (this._furniType === FurnitureListItemParser.WALL_ITEM); this._isWallItem = (this._furniType === FurnitureListItemParser.WALL_ITEM);
if(this._furniType === FurnitureListItemParser.FLOOR_ITEM) if (this._furniType === FurnitureListItemParser.FLOOR_ITEM)
{ {
this._slotId = wrapper.readString(); this._slotId = wrapper.readString();
this._extra = wrapper.readInt(); this._extra = wrapper.readInt();

View File

@ -1,5 +1,5 @@
import { IMessageDataWrapper, IObjectData } from '../../../../../../api'; import { IMessageDataWrapper, IObjectData } from '../../../../../../api';
import { PixiApplicationProxy } from '../../../../../../pixi-proxy'; import { GetTickerTime } from '../../../../../../pixi-proxy';
import { FurnitureDataParser } from '../../room'; import { FurnitureDataParser } from '../../room';
import { IFurnitureItemData } from '../furniture'; import { IFurnitureItemData } from '../furniture';
@ -34,7 +34,7 @@ export class ItemDataStructure implements IFurnitureItemData
this._isGroupable = wrapper.readBoolean(); this._isGroupable = wrapper.readBoolean();
this._stuffData = FurnitureDataParser.parseObjectData(wrapper); this._stuffData = FurnitureDataParser.parseObjectData(wrapper);
this._secondsToExpiration = -1; this._secondsToExpiration = -1;
this._expirationTimeStamp = PixiApplicationProxy.instance.ticker.lastTime; this._expirationTimeStamp = GetTickerTime();
this._hasRentPeriodStarted = false; this._hasRentPeriodStarted = false;
this._creationDay = wrapper.readInt(); this._creationDay = wrapper.readInt();
this._creationMonth = wrapper.readInt(); this._creationMonth = wrapper.readInt();

View File

@ -1,4 +1,4 @@
import { PixiApplicationProxy } from '../../../../../pixi-proxy'; import { GetTickerTime } from '../../../../../pixi-proxy';
import { PatternMatchData } from './PatternMatchData'; import { PatternMatchData } from './PatternMatchData';
export class IssueMessageData export class IssueMessageData
@ -47,7 +47,7 @@ export class IssueMessageData
this._message = message; this._message = message;
this._chatRecordId = chatRecordId; this._chatRecordId = chatRecordId;
this._patterns = patterns; this._patterns = patterns;
this._creationTimeInMilliseconds = PixiApplicationProxy.instance.ticker.lastTime; //getTimer() this._creationTimeInMilliseconds = GetTickerTime(); //getTimer()
} }
public get issueId(): number public get issueId(): number
@ -133,11 +133,11 @@ export class IssueMessageData
public dispose(): void public dispose(): void
{ {
if(this.disposed) if (this.disposed)
{ {
return; return;
} }
for(const k of this._patterns) for (const k of this._patterns)
{ {
k.dispose(); k.dispose();
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,9 @@
import { IConnection, IRoomCreator, IVector3D, LegacyDataType, ObjectRolling, PetType, RoomObjectType, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../api'; import { AvatarGuideStatus, IConnection, IRoomCreator, IVector3D, LegacyDataType, ObjectRolling, PetType, RoomObjectType, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../api';
import { Disposable } from '../../core'; import { Disposable } from '../../core';
import { AvatarGuideStatus } from '../avatar/enum/AvatarGuideStatus';
import { DiceValueMessageEvent, FloorHeightMapEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureDataEvent, FurnitureFloorAddEvent, FurnitureFloorDataParser, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateEvent, FurnitureWallAddEvent, FurnitureWallDataParser, FurnitureWallEvent, FurnitureWallRemoveEvent, FurnitureWallUpdateEvent, GetRoomEntryDataMessageComposer, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionStartedMessageEvent, IgnoreResultEvent, ItemDataUpdateMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OneWayDoorStatusMessageEvent, PetExperienceEvent, PetFigureUpdateEvent, RoomEntryTileMessageEvent, RoomEntryTileMessageParser, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitDanceEvent, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitHandItemEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitNumberEvent, RoomUnitRemoveEvent, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomVisualizationSettingsEvent, UserInfoEvent, YouArePlayingGameEvent } from '../communication'; import { DiceValueMessageEvent, FloorHeightMapEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureDataEvent, FurnitureFloorAddEvent, FurnitureFloorDataParser, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateEvent, FurnitureWallAddEvent, FurnitureWallDataParser, FurnitureWallEvent, FurnitureWallRemoveEvent, FurnitureWallUpdateEvent, GetRoomEntryDataMessageComposer, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionStartedMessageEvent, IgnoreResultEvent, ItemDataUpdateMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OneWayDoorStatusMessageEvent, PetExperienceEvent, PetFigureUpdateEvent, RoomEntryTileMessageEvent, RoomEntryTileMessageParser, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitDanceEvent, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitHandItemEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitNumberEvent, RoomUnitRemoveEvent, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomVisualizationSettingsEvent, UserInfoEvent, YouArePlayingGameEvent } from '../communication';
import { RoomPlaneParser } from './object/RoomPlaneParser'; import { RoomPlaneParser } from './object/RoomPlaneParser';
import { RoomVariableEnum } from './RoomVariableEnum'; import { RoomVariableEnum } from './RoomVariableEnum';
import { FurnitureStackingHeightMap } from './utils/FurnitureStackingHeightMap'; import { FurnitureStackingHeightMap, LegacyWallGeometry } from './utils';
import { LegacyWallGeometry } from './utils/LegacyWallGeometry';
export class RoomMessageHandler extends Disposable export class RoomMessageHandler extends Disposable
{ {
@ -44,7 +42,7 @@ export class RoomMessageHandler extends Disposable
this._roomCreator = null; this._roomCreator = null;
this._latestEntryTileEvent = null; this._latestEntryTileEvent = null;
if(this._planeParser) if (this._planeParser)
{ {
this._planeParser.dispose(); this._planeParser.dispose();
@ -54,7 +52,7 @@ export class RoomMessageHandler extends Disposable
public setConnection(connection: IConnection) public setConnection(connection: IConnection)
{ {
if(this._connection || !connection) return; if (this._connection || !connection) return;
this._connection = connection; this._connection = connection;
@ -106,9 +104,9 @@ export class RoomMessageHandler extends Disposable
public setRoomId(id: number): void public setRoomId(id: number): void
{ {
if(this._currentRoomId !== 0) if (this._currentRoomId !== 0)
{ {
if(this._roomCreator) this._roomCreator.destroyRoom(this._currentRoomId); if (this._roomCreator) this._roomCreator.destroyRoom(this._currentRoomId);
} }
this._currentRoomId = id; this._currentRoomId = id;
@ -123,11 +121,11 @@ export class RoomMessageHandler extends Disposable
private onUserInfoEvent(event: UserInfoEvent): void private onUserInfoEvent(event: UserInfoEvent): void
{ {
if(!(event instanceof UserInfoEvent) || !event.connection) return; if (!(event instanceof UserInfoEvent) || !event.connection) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._ownUserId = parser.userInfo.userId; this._ownUserId = parser.userInfo.userId;
} }
@ -136,17 +134,17 @@ export class RoomMessageHandler extends Disposable
{ {
const parser = event.getParser(); const parser = event.getParser();
if(this._currentRoomId !== parser.roomId) if (this._currentRoomId !== parser.roomId)
{ {
this.setRoomId(parser.roomId); this.setRoomId(parser.roomId);
} }
if(this._roomCreator) if (this._roomCreator)
{ {
this._roomCreator.setRoomInstanceModelName(parser.roomId, parser.name); this._roomCreator.setRoomInstanceModelName(parser.roomId, parser.name);
} }
if(this._initialConnection) if (this._initialConnection)
{ {
event.connection.send(new FurnitureAliasesComposer()); event.connection.send(new FurnitureAliasesComposer());
@ -160,17 +158,17 @@ export class RoomMessageHandler extends Disposable
private onRoomPaintEvent(event: RoomPaintEvent): void private onRoomPaintEvent(event: RoomPaintEvent): void
{ {
if(!(event instanceof RoomPaintEvent)) return; if (!(event instanceof RoomPaintEvent)) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const floorType = parser.floorType; const floorType = parser.floorType;
const wallType = parser.wallType; const wallType = parser.wallType;
const landscapeType = parser.landscapeType; const landscapeType = parser.landscapeType;
if(this._roomCreator) if (this._roomCreator)
{ {
this._roomCreator.updateRoomInstancePlaneType(this._currentRoomId, floorType, wallType, landscapeType); this._roomCreator.updateRoomInstancePlaneType(this._currentRoomId, floorType, wallType, landscapeType);
} }
@ -178,15 +176,15 @@ export class RoomMessageHandler extends Disposable
private onRoomModelEvent(event: FloorHeightMapEvent): void private onRoomModelEvent(event: FloorHeightMapEvent): void
{ {
if(!(event instanceof FloorHeightMapEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FloorHeightMapEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId); const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId);
if(!wallGeometry) return; if (!wallGeometry) return;
this._planeParser.reset(); this._planeParser.reset();
@ -197,7 +195,7 @@ export class RoomMessageHandler extends Disposable
let entryTile: RoomEntryTileMessageParser = null; let entryTile: RoomEntryTileMessageParser = null;
if(this._latestEntryTileEvent) entryTile = this._latestEntryTileEvent.getParser(); if (this._latestEntryTileEvent) entryTile = this._latestEntryTileEvent.getParser();
let doorX = -1; let doorX = -1;
let doorY = -1; let doorY = -1;
@ -206,17 +204,17 @@ export class RoomMessageHandler extends Disposable
let y = 0; let y = 0;
while(y < height) while (y < height)
{ {
let x = 0; let x = 0;
while(x < width) while (x < width)
{ {
const tileHeight = parser.getHeight(x, y); const tileHeight = parser.getHeight(x, y);
if(((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y)))) if (((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y))))
{ {
if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED)) if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED))
{ {
doorX = (x + 0.5); doorX = (x + 0.5);
doorY = y; doorY = y;
@ -224,7 +222,7 @@ export class RoomMessageHandler extends Disposable
doorDirection = 90; doorDirection = 90;
} }
if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED)) if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED))
{ {
doorX = x; doorX = x;
doorY = (y + 0.5); doorY = (y + 0.5);
@ -245,7 +243,7 @@ export class RoomMessageHandler extends Disposable
this._planeParser.initializeFromTileData(parser.wallHeight); this._planeParser.initializeFromTileData(parser.wallHeight);
this._planeParser.setTileHeight(Math.floor(doorX), Math.floor(doorY), (doorZ + this._planeParser.wallHeight)); this._planeParser.setTileHeight(Math.floor(doorX), Math.floor(doorY), (doorZ + this._planeParser.wallHeight));
if(parser.scale === 64) if (parser.scale === 64)
{ {
this._planeParser.restrictsDragging = true; this._planeParser.restrictsDragging = true;
this._planeParser.restrictsScaling = true; this._planeParser.restrictsScaling = true;
@ -263,11 +261,11 @@ export class RoomMessageHandler extends Disposable
let heightIterator = (parser.height - 1); let heightIterator = (parser.height - 1);
while(heightIterator >= 0) while (heightIterator >= 0)
{ {
let widthIterator = (parser.width - 1); let widthIterator = (parser.width - 1);
while(widthIterator >= 0) while (widthIterator >= 0)
{ {
wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator)); wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator));
widthIterator--; widthIterator--;
@ -290,11 +288,11 @@ export class RoomMessageHandler extends Disposable
private onRoomHeightMapEvent(event: RoomHeightMapEvent): void private onRoomHeightMapEvent(event: RoomHeightMapEvent): void
{ {
if(!(event instanceof RoomHeightMapEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomHeightMapEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const width = parser.width; const width = parser.width;
const height = parser.height; const height = parser.height;
@ -302,11 +300,11 @@ export class RoomMessageHandler extends Disposable
let y = 0; let y = 0;
while(y < height) while (y < height)
{ {
let x = 0; let x = 0;
while(x < width) while (x < width)
{ {
heightMap.setTileHeight(x, y, parser.getTileHeight(x, y)); heightMap.setTileHeight(x, y, parser.getTileHeight(x, y));
heightMap.setStackingBlocked(x, y, parser.getStackingBlocked(x, y)); heightMap.setStackingBlocked(x, y, parser.getStackingBlocked(x, y));
@ -323,17 +321,17 @@ export class RoomMessageHandler extends Disposable
private onRoomHeightMapUpdateEvent(event: RoomHeightMapUpdateEvent): void private onRoomHeightMapUpdateEvent(event: RoomHeightMapUpdateEvent): void
{ {
if(!(event instanceof RoomHeightMapUpdateEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomHeightMapUpdateEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const heightMap = this._roomCreator.getFurnitureStackingHeightMap(this._currentRoomId); const heightMap = this._roomCreator.getFurnitureStackingHeightMap(this._currentRoomId);
if(!heightMap) return; if (!heightMap) return;
while(parser.next()) while (parser.next())
{ {
heightMap.setTileHeight(parser.x, parser.y, parser.tileHeight()); heightMap.setTileHeight(parser.x, parser.y, parser.tileHeight());
heightMap.setStackingBlocked(parser.x, parser.y, parser.isStackingBlocked()); heightMap.setStackingBlocked(parser.x, parser.y, parser.isStackingBlocked());
@ -345,18 +343,18 @@ export class RoomMessageHandler extends Disposable
private onRoomThicknessEvent(event: RoomVisualizationSettingsEvent): void private onRoomThicknessEvent(event: RoomVisualizationSettingsEvent): void
{ {
if(!(event instanceof RoomVisualizationSettingsEvent)) return; if (!(event instanceof RoomVisualizationSettingsEvent)) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const visibleWall = !parser.hideWalls; const visibleWall = !parser.hideWalls;
const visibleFloor = true; const visibleFloor = true;
const thicknessWall = parser.thicknessWall; const thicknessWall = parser.thicknessWall;
const thicknessFloor = parser.thicknessFloor; const thicknessFloor = parser.thicknessFloor;
if(this._roomCreator) if (this._roomCreator)
{ {
this._roomCreator.updateRoomInstancePlaneVisibility(this._currentRoomId, visibleWall, visibleFloor); this._roomCreator.updateRoomInstancePlaneVisibility(this._currentRoomId, visibleWall, visibleFloor);
this._roomCreator.updateRoomInstancePlaneThickness(this._currentRoomId, thicknessWall, thicknessFloor); this._roomCreator.updateRoomInstancePlaneThickness(this._currentRoomId, thicknessWall, thicknessFloor);
@ -365,14 +363,14 @@ export class RoomMessageHandler extends Disposable
private onRoomDoorEvent(event: RoomEntryTileMessageEvent): void private onRoomDoorEvent(event: RoomEntryTileMessageEvent): void
{ {
if(!(event instanceof RoomEntryTileMessageEvent)) return; if (!(event instanceof RoomEntryTileMessageEvent)) return;
this._latestEntryTileEvent = event; this._latestEntryTileEvent = event;
} }
private onRoomRollingEvent(event: ObjectsRollingEvent): void private onRoomRollingEvent(event: ObjectsRollingEvent): void
{ {
if(!(event instanceof ObjectsRollingEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof ObjectsRollingEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
@ -381,11 +379,11 @@ export class RoomMessageHandler extends Disposable
const furnitureRolling = parser.itemsRolling; const furnitureRolling = parser.itemsRolling;
if(furnitureRolling && furnitureRolling.length) if (furnitureRolling && furnitureRolling.length)
{ {
for(const rollData of furnitureRolling) for (const rollData of furnitureRolling)
{ {
if(!rollData) continue; if (!rollData) continue;
this._roomCreator.rollRoomObjectFloor(this._currentRoomId, rollData.id, rollData.location, rollData.targetLocation); this._roomCreator.rollRoomObjectFloor(this._currentRoomId, rollData.id, rollData.location, rollData.targetLocation);
} }
@ -393,17 +391,17 @@ export class RoomMessageHandler extends Disposable
const unitRollData = parser.unitRolling; const unitRollData = parser.unitRolling;
if(unitRollData) if (unitRollData)
{ {
this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, unitRollData.id, unitRollData.location, unitRollData.targetLocation); this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, unitRollData.id, unitRollData.location, unitRollData.targetLocation);
const object = this._roomCreator.getRoomObjectUser(this._currentRoomId, unitRollData.id); const object = this._roomCreator.getRoomObjectUser(this._currentRoomId, unitRollData.id);
if(object && object.type !== RoomObjectUserType.MONSTER_PLANT) if (object && object.type !== RoomObjectUserType.MONSTER_PLANT)
{ {
let posture = 'std'; let posture = 'std';
switch(unitRollData.movementType) switch (unitRollData.movementType)
{ {
case ObjectRolling.MOVE: case ObjectRolling.MOVE:
posture = 'mv'; posture = 'mv';
@ -420,13 +418,13 @@ export class RoomMessageHandler extends Disposable
private onObjectsDataUpdateEvent(event: ObjectsDataUpdateEvent): void private onObjectsDataUpdateEvent(event: ObjectsDataUpdateEvent): void
{ {
if(!(event instanceof ObjectsDataUpdateEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof ObjectsDataUpdateEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
for(const object of parser.objects) for (const object of parser.objects)
{ {
this._roomCreator.updateRoomObjectFloor(this._currentRoomId, object.id, null, null, object.state, object.data); this._roomCreator.updateRoomObjectFloor(this._currentRoomId, object.id, null, null, object.state, object.data);
} }
@ -434,7 +432,7 @@ export class RoomMessageHandler extends Disposable
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;
const alises = event.getParser().aliases; const alises = event.getParser().aliases;
@ -443,32 +441,32 @@ export class RoomMessageHandler extends Disposable
private onFurnitureFloorAddEvent(event: FurnitureFloorAddEvent): void private onFurnitureFloorAddEvent(event: FurnitureFloorAddEvent): void
{ {
if(!(event instanceof FurnitureFloorAddEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureFloorAddEvent) || !event.connection || !this._roomCreator) return;
const item = event.getParser().item; const item = event.getParser().item;
if(!item) return; if (!item) return;
this.addRoomObjectFurnitureFloor(this._currentRoomId, item); this.addRoomObjectFurnitureFloor(this._currentRoomId, item);
} }
private onFurnitureFloorEvent(event: FurnitureFloorEvent): void private onFurnitureFloorEvent(event: FurnitureFloorEvent): void
{ {
if(!(event instanceof FurnitureFloorEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureFloorEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const totalObjects = parser.items.length; const totalObjects = parser.items.length;
let iterator = 0; let iterator = 0;
while(iterator < totalObjects) while (iterator < totalObjects)
{ {
const object = parser.items[iterator]; const object = parser.items[iterator];
if(object) this.addRoomObjectFurnitureFloor(this._currentRoomId, object); if (object) this.addRoomObjectFurnitureFloor(this._currentRoomId, object);
iterator++; iterator++;
} }
@ -476,13 +474,13 @@ export class RoomMessageHandler extends Disposable
private onFurnitureFloorRemoveEvent(event: FurnitureFloorRemoveEvent): void private onFurnitureFloorRemoveEvent(event: FurnitureFloorRemoveEvent): void
{ {
if(!(event instanceof FurnitureFloorRemoveEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureFloorRemoveEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
if(parser.delay > 0) if (parser.delay > 0)
{ {
setTimeout(() => setTimeout(() =>
{ {
@ -497,11 +495,11 @@ export class RoomMessageHandler extends Disposable
private onFurnitureFloorUpdateEvent(event: FurnitureFloorUpdateEvent): void private onFurnitureFloorUpdateEvent(event: FurnitureFloorUpdateEvent): void
{ {
if(!(event instanceof FurnitureFloorUpdateEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureFloorUpdateEvent) || !event.connection || !this._roomCreator) return;
const item = event.getParser().item; const item = event.getParser().item;
if(!item) return; if (!item) return;
const location: IVector3D = new Vector3d(item.x, item.y, item.z); const location: IVector3D = new Vector3d(item.x, item.y, item.z);
const direction: IVector3D = new Vector3d(item.direction); const direction: IVector3D = new Vector3d(item.direction);
@ -513,32 +511,32 @@ export class RoomMessageHandler extends Disposable
private onFurnitureWallAddEvent(event: FurnitureWallAddEvent): void private onFurnitureWallAddEvent(event: FurnitureWallAddEvent): void
{ {
if(!(event instanceof FurnitureWallAddEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureWallAddEvent) || !event.connection || !this._roomCreator) return;
const data = event.getParser().item; const data = event.getParser().item;
if(!data) return; if (!data) return;
this.addRoomObjectFurnitureWall(this._currentRoomId, data); this.addRoomObjectFurnitureWall(this._currentRoomId, data);
} }
private onFurnitureWallEvent(event: FurnitureWallEvent): void private onFurnitureWallEvent(event: FurnitureWallEvent): void
{ {
if(!(event instanceof FurnitureWallEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureWallEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const totalObjects = parser.items.length; const totalObjects = parser.items.length;
let iterator = 0; let iterator = 0;
while(iterator < totalObjects) while (iterator < totalObjects)
{ {
const data = parser.items[iterator]; const data = parser.items[iterator];
if(data) this.addRoomObjectFurnitureWall(this._currentRoomId, data); if (data) this.addRoomObjectFurnitureWall(this._currentRoomId, data);
iterator++; iterator++;
} }
@ -546,26 +544,26 @@ export class RoomMessageHandler extends Disposable
private onFurnitureWallRemoveEvent(event: FurnitureWallRemoveEvent): void private onFurnitureWallRemoveEvent(event: FurnitureWallRemoveEvent): void
{ {
if(!(event instanceof FurnitureWallRemoveEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureWallRemoveEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._roomCreator.removeRoomObjectWall(this._currentRoomId, parser.itemId, parser.userId); this._roomCreator.removeRoomObjectWall(this._currentRoomId, parser.itemId, parser.userId);
} }
private onFurnitureWallUpdateEvent(event: FurnitureWallUpdateEvent): void private onFurnitureWallUpdateEvent(event: FurnitureWallUpdateEvent): void
{ {
if(!(event instanceof FurnitureWallUpdateEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureWallUpdateEvent) || !event.connection || !this._roomCreator) return;
const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId); const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId);
if(!wallGeometry) return; if (!wallGeometry) return;
const item = event.getParser().item; const item = event.getParser().item;
if(!item) return; if (!item) return;
const location = wallGeometry.getLocation(item.width, item.height, item.localX, item.localY, item.direction); const location = wallGeometry.getLocation(item.width, item.height, item.localX, item.localY, item.direction);
const direction = new Vector3d(wallGeometry.getDirection(item.direction)); const direction = new Vector3d(wallGeometry.getDirection(item.direction));
@ -576,7 +574,7 @@ export class RoomMessageHandler extends Disposable
private onFurnitureDataEvent(event: FurnitureDataEvent): void private onFurnitureDataEvent(event: FurnitureDataEvent): void
{ {
if(!(event instanceof FurnitureDataEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof FurnitureDataEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
@ -585,7 +583,7 @@ export class RoomMessageHandler extends Disposable
private onItemDataUpdateMessageEvent(event: ItemDataUpdateMessageEvent): void private onItemDataUpdateMessageEvent(event: ItemDataUpdateMessageEvent): void
{ {
if(!(event instanceof ItemDataUpdateMessageEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof ItemDataUpdateMessageEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
@ -594,7 +592,7 @@ export class RoomMessageHandler extends Disposable
private onOneWayDoorStatusMessageEvent(event: OneWayDoorStatusMessageEvent): void private onOneWayDoorStatusMessageEvent(event: OneWayDoorStatusMessageEvent): void
{ {
if(!(event instanceof OneWayDoorStatusMessageEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof OneWayDoorStatusMessageEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
@ -603,7 +601,7 @@ export class RoomMessageHandler extends Disposable
private onDiceValueMessageEvent(event: DiceValueMessageEvent): void private onDiceValueMessageEvent(event: DiceValueMessageEvent): void
{ {
if(!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
@ -612,36 +610,36 @@ export class RoomMessageHandler extends Disposable
private onRoomUnitDanceEvent(event: RoomUnitDanceEvent): void private onRoomUnitDanceEvent(event: RoomUnitDanceEvent): void
{ {
if(!(event instanceof RoomUnitDanceEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitDanceEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_DANCE, event.getParser().danceId); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_DANCE, event.getParser().danceId);
} }
private onRoomUnitEffectEvent(event: RoomUnitEffectEvent): void private onRoomUnitEffectEvent(event: RoomUnitEffectEvent): void
{ {
if(!(event instanceof RoomUnitEffectEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitEffectEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.updateRoomObjectUserEffect(this._currentRoomId, event.getParser().unitId, event.getParser().effectId, event.getParser().delay); this._roomCreator.updateRoomObjectUserEffect(this._currentRoomId, event.getParser().unitId, event.getParser().effectId, event.getParser().delay);
} }
private onRoomUnitEvent(event: RoomUnitEvent): void private onRoomUnitEvent(event: RoomUnitEvent): void
{ {
if(!(event instanceof RoomUnitEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitEvent) || !event.connection || !this._roomCreator) return;
const users = event.getParser().users; const users = event.getParser().users;
if(!users || !users.length) return; if (!users || !users.length) return;
for(const user of users) for (const user of users)
{ {
if(!user) continue; if (!user) continue;
const location = new Vector3d(user.x, user.y, user.z); const location = new Vector3d(user.x, user.y, user.z);
const direction = new Vector3d(user.dir); const direction = new Vector3d(user.dir);
this._roomCreator.addRoomObjectUser(this._currentRoomId, user.roomIndex, location, direction, user.dir, user.userType, user.figure); this._roomCreator.addRoomObjectUser(this._currentRoomId, user.roomIndex, location, direction, user.dir, user.userType, user.figure);
if(user.webID === this._ownUserId) if (user.webID === this._ownUserId)
{ {
this._roomCreator.setRoomSessionOwnUser(this._currentRoomId, user.roomIndex); this._roomCreator.setRoomSessionOwnUser(this._currentRoomId, user.roomIndex);
this._roomCreator.updateRoomObjectUserOwn(this._currentRoomId, user.roomIndex); this._roomCreator.updateRoomObjectUserOwn(this._currentRoomId, user.roomIndex);
@ -649,9 +647,9 @@ export class RoomMessageHandler extends Disposable
this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, user.roomIndex, user.figure, user.sex, user.subType, user.isRiding); this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, user.roomIndex, user.figure, user.sex, user.subType, user.isRiding);
if(RoomObjectUserType.getTypeString(user.userType) === RoomObjectUserType.PET) if (RoomObjectUserType.getTypeString(user.userType) === RoomObjectUserType.PET)
{ {
if(this._roomCreator.getPetTypeId(user.figure) === PetType.MONSTERPLANT) if (this._roomCreator.getPetTypeId(user.figure) === PetType.MONSTERPLANT)
{ {
this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, user.roomIndex, user.petPosture); this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, user.roomIndex, user.petPosture);
} }
@ -665,46 +663,46 @@ export class RoomMessageHandler extends Disposable
private onRoomUnitExpressionEvent(event: RoomUnitExpressionEvent): void private onRoomUnitExpressionEvent(event: RoomUnitExpressionEvent): void
{ {
if(!(event instanceof RoomUnitExpressionEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitExpressionEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_EXPRESSION, event.getParser().expression); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_EXPRESSION, event.getParser().expression);
} }
private onRoomUnitHandItemEvent(event: RoomUnitHandItemEvent): void private onRoomUnitHandItemEvent(event: RoomUnitHandItemEvent): void
{ {
if(!(event instanceof RoomUnitHandItemEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitHandItemEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_CARRY_OBJECT, event.getParser().handId); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_CARRY_OBJECT, event.getParser().handId);
} }
private onRoomUnitIdleEvent(event: RoomUnitIdleEvent): void private onRoomUnitIdleEvent(event: RoomUnitIdleEvent): void
{ {
if(!(event instanceof RoomUnitIdleEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitIdleEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_SLEEP, (event.getParser().isIdle ? 1 : 0)); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_SLEEP, (event.getParser().isIdle ? 1 : 0));
} }
private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void
{ {
if(!(event instanceof RoomUnitInfoEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitInfoEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, event.getParser().unitId, event.getParser().figure, event.getParser().gender); this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, event.getParser().unitId, event.getParser().figure, event.getParser().gender);
} }
private onRoomUnitNumberEvent(event: RoomUnitNumberEvent): void private onRoomUnitNumberEvent(event: RoomUnitNumberEvent): void
{ {
if(!(event instanceof RoomUnitNumberEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitNumberEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.unitId, RoomObjectVariable.FIGURE_NUMBER_VALUE, parser.value); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.unitId, RoomObjectVariable.FIGURE_NUMBER_VALUE, parser.value);
} }
private onRoomUnitRemoveEvent(event: RoomUnitRemoveEvent): void private onRoomUnitRemoveEvent(event: RoomUnitRemoveEvent): void
{ {
if(!(event instanceof RoomUnitRemoveEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitRemoveEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.removeRoomObjectUser(this._currentRoomId, event.getParser().unitId); this._roomCreator.removeRoomObjectUser(this._currentRoomId, event.getParser().unitId);
@ -713,32 +711,32 @@ export class RoomMessageHandler extends Disposable
private onRoomUnitStatusEvent(event: RoomUnitStatusEvent): void private onRoomUnitStatusEvent(event: RoomUnitStatusEvent): void
{ {
if(!(event instanceof RoomUnitStatusEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitStatusEvent) || !event.connection || !this._roomCreator) return;
const statuses = event.getParser().statuses; const statuses = event.getParser().statuses;
if(!statuses || !statuses.length) return; if (!statuses || !statuses.length) return;
const roomInstance = this._roomCreator.getRoomInstance(this._currentRoomId); const roomInstance = this._roomCreator.getRoomInstance(this._currentRoomId);
if(!roomInstance) return; if (!roomInstance) return;
const zScale = (roomInstance.model.getValue<number>(RoomVariableEnum.ROOM_Z_SCALE) || 1); const zScale = (roomInstance.model.getValue<number>(RoomVariableEnum.ROOM_Z_SCALE) || 1);
for(const status of statuses) for (const status of statuses)
{ {
if(!status) continue; if (!status) continue;
let height = status.height; let height = status.height;
if(height) height = (height / zScale); if (height) height = (height / zScale);
const location = new Vector3d(status.x, status.y, (status.z + height)); const location = new Vector3d(status.x, status.y, (status.z + height));
const direction = new Vector3d(status.direction); const direction = new Vector3d(status.direction);
let goal: IVector3D = null; let goal: IVector3D = null;
if(status.didMove) goal = new Vector3d(status.targetX, status.targetY, status.targetZ); if (status.didMove) goal = new Vector3d(status.targetX, status.targetY, status.targetZ);
this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, status.id, location, goal, status.canStandUp, height, direction, status.headDirection); this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, status.id, location, goal, status.canStandUp, height, direction, status.headDirection);
this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, null); this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, null);
@ -748,24 +746,24 @@ export class RoomMessageHandler extends Disposable
let postureType = RoomObjectVariable.STD; let postureType = RoomObjectVariable.STD;
let parameter = ''; let parameter = '';
if(status.actions && status.actions.length) if (status.actions && status.actions.length)
{ {
for(const action of status.actions) for (const action of status.actions)
{ {
if(!action) continue; if (!action) continue;
switch(action.action) switch (action.action)
{ {
case 'flatctrl': case 'flatctrl':
this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, action.value); this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, action.value);
break; break;
case 'sign': case 'sign':
if(status.actions.length === 1) isPosture = false; if (status.actions.length === 1) isPosture = false;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, status.id, RoomObjectVariable.FIGURE_SIGN, parseInt(action.value)); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, status.id, RoomObjectVariable.FIGURE_SIGN, parseInt(action.value));
break; break;
case 'gst': case 'gst':
if(status.actions.length === 1) isPosture = false; if (status.actions.length === 1) isPosture = false;
this._roomCreator.updateRoomObjectUserPetGesture(this._currentRoomId, status.id, action.value); this._roomCreator.updateRoomObjectUserPetGesture(this._currentRoomId, status.id, action.value);
break; break;
@ -785,8 +783,8 @@ export class RoomMessageHandler extends Disposable
} }
} }
if(postureUpdate) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, postureType, parameter); if (postureUpdate) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, postureType, parameter);
else if(isPosture) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, RoomObjectVariable.STD, ''); else if (isPosture) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, RoomObjectVariable.STD, '');
} }
this.updateGuideMarker(); this.updateGuideMarker();
@ -794,11 +792,11 @@ export class RoomMessageHandler extends Disposable
private onRoomUnitChatEvent(event: RoomUnitChatEvent): void private onRoomUnitChatEvent(event: RoomUnitChatEvent): void
{ {
if(!event.connection || !this._roomCreator) return; if (!event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._roomCreator.updateRoomObjectUserGesture(this._currentRoomId, parser.roomIndex, parser.gesture); this._roomCreator.updateRoomObjectUserGesture(this._currentRoomId, parser.roomIndex, parser.gesture);
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_TALK, (parser.message.length / 10)); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_TALK, (parser.message.length / 10));
@ -806,18 +804,18 @@ export class RoomMessageHandler extends Disposable
private onRoomUnitTypingEvent(event: RoomUnitTypingEvent): void private onRoomUnitTypingEvent(event: RoomUnitTypingEvent): void
{ {
if(!(event instanceof RoomUnitTypingEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof RoomUnitTypingEvent) || !event.connection || !this._roomCreator) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_IS_TYPING, event.getParser().isTyping ? 1 : 0); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_IS_TYPING, event.getParser().isTyping ? 1 : 0);
} }
private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void
{ {
if(!(event instanceof PetFigureUpdateEvent) || !event.connection || !this._roomCreator) return; if (!(event instanceof PetFigureUpdateEvent) || !event.connection || !this._roomCreator) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, parser.roomIndex, parser.figureData.figuredata, '', '', parser.isRiding); this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, parser.roomIndex, parser.figureData.figuredata, '', '', parser.isRiding);
} }
@ -826,30 +824,30 @@ export class RoomMessageHandler extends Disposable
{ {
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_GAINED_EXPERIENCE, parser.gainedExperience); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_GAINED_EXPERIENCE, parser.gainedExperience);
} }
private onYouArePlayingGameEvent(event: YouArePlayingGameEvent): void private onYouArePlayingGameEvent(event: YouArePlayingGameEvent): void
{ {
if(!event) return; if (!event) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
this._roomCreator.setRoomEngineGameMode(this._currentRoomId, parser.isPlaying); this._roomCreator.setRoomEngineGameMode(this._currentRoomId, parser.isPlaying);
} }
private addRoomObjectFurnitureFloor(roomId: number, data: FurnitureFloorDataParser): void private addRoomObjectFurnitureFloor(roomId: number, data: FurnitureFloorDataParser): void
{ {
if(!data || !this._roomCreator) return; if (!data || !this._roomCreator) return;
const location = new Vector3d(data.x, data.y, data.z); const location = new Vector3d(data.x, data.y, data.z);
const direction = new Vector3d(data.direction); const direction = new Vector3d(data.direction);
if(data.spriteName) if (data.spriteName)
{ {
this._roomCreator.addFurnitureFloorByTypeName(roomId, data.itemId, data.spriteName, location, direction, data.state, data.data, data.extra, data.expires, data.usagePolicy, data.userId, data.username, true, true, data.stackHeight); this._roomCreator.addFurnitureFloorByTypeName(roomId, data.itemId, data.spriteName, location, direction, data.state, data.data, data.extra, data.expires, data.usagePolicy, data.userId, data.username, true, true, data.stackHeight);
} }
@ -861,15 +859,15 @@ export class RoomMessageHandler extends Disposable
private addRoomObjectFurnitureWall(roomId: number, data: FurnitureWallDataParser): void private addRoomObjectFurnitureWall(roomId: number, data: FurnitureWallDataParser): void
{ {
if(!data || !this._roomCreator) return; if (!data || !this._roomCreator) return;
const wallGeometry = this._roomCreator.getLegacyWallGeometry(roomId); const wallGeometry = this._roomCreator.getLegacyWallGeometry(roomId);
if(!wallGeometry) return; if (!wallGeometry) return;
let location: IVector3D = null; let location: IVector3D = null;
if(!data.isOldFormat) if (!data.isOldFormat)
{ {
location = wallGeometry.getLocation(data.width, data.height, data.localX, data.localY, data.direction); location = wallGeometry.getLocation(data.width, data.height, data.localX, data.localY, data.direction);
} }
@ -885,21 +883,21 @@ export class RoomMessageHandler extends Disposable
private onIgnoreResultEvent(event: IgnoreResultEvent): void private onIgnoreResultEvent(event: IgnoreResultEvent): void
{ {
if(!event) return; if (!event) return;
const parser = event.getParser(); const parser = event.getParser();
if(!parser) return; if (!parser) return;
const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId); const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId);
if(!roomSession) return; if (!roomSession) return;
const userData = roomSession.userDataManager.getUserDataByName(parser.name); const userData = roomSession.userDataManager.getUserDataByName(parser.name);
if(!userData) return; if (!userData) return;
switch(parser.result) switch (parser.result)
{ {
case 1: case 1:
case 2: case 2:
@ -950,15 +948,15 @@ export class RoomMessageHandler extends Disposable
private setUserGuideStatus(userId: number, status: number): void private setUserGuideStatus(userId: number, status: number): void
{ {
if(!this._roomCreator || !this._roomCreator.roomSessionManager) return; if (!this._roomCreator || !this._roomCreator.roomSessionManager) return;
const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId); const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId);
if(!roomSession) return; if (!roomSession) return;
const userData = roomSession.userDataManager.getDataByType(userId, RoomObjectType.USER); const userData = roomSession.userDataManager.getDataByType(userId, RoomObjectType.USER);
if(!userData) return; if (!userData) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, userData.roomIndex, RoomObjectVariable.FIGURE_GUIDE_STATUS, status); this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, userData.roomIndex, RoomObjectVariable.FIGURE_GUIDE_STATUS, status);
} }

View File

@ -1,8 +1,7 @@
import { IRoomGeometry, IRoomObjectModel, RoomObjectVariable, Vector3d } from '../../../../../api'; import { AvatarAction, IRoomGeometry, IRoomObjectModel, RoomObjectVariable, Vector3d } from '../../../../../api';
import { GetTickerTime } from '../../../../../pixi-proxy';
import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
import { AvatarAction } from '../../../../avatar';
import { Nitro } from '../../../../Nitro';
import { MouseEventType } from '../../../../ui'; import { MouseEventType } from '../../../../ui';
import { RoomObjectFurnitureActionEvent, RoomObjectMoveEvent } from '../../../events'; import { RoomObjectFurnitureActionEvent, RoomObjectMoveEvent } from '../../../events';
import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage } from '../../../messages'; import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage } from '../../../messages';
@ -43,7 +42,7 @@ export class AvatarLogic extends MovingObjectLogic
this._reportedLocation = null; this._reportedLocation = null;
this._effectChangeTimeStamp = 0; this._effectChangeTimeStamp = 0;
this._newEffect = 0; this._newEffect = 0;
this._blinkingStartTimestamp = Nitro.instance.time + this.randomBlinkStartTimestamp(); this._blinkingStartTimestamp = GetTickerTime() + this.randomBlinkStartTimestamp();
this._blinkingEndTimestamp = 0; this._blinkingEndTimestamp = 0;
this._talkingEndTimestamp = 0; this._talkingEndTimestamp = 0;
this._talkingPauseStartTimestamp = 0; this._talkingPauseStartTimestamp = 0;
@ -66,9 +65,9 @@ export class AvatarLogic extends MovingObjectLogic
public dispose(): void public dispose(): void
{ {
if(this._selected && this.object) if (this._selected && this.object)
{ {
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object));
} }
super.dispose(); super.dispose();
@ -80,15 +79,15 @@ export class AvatarLogic extends MovingObjectLogic
{ {
super.update(time); super.update(time);
if(this._selected && this.object) if (this._selected && this.object)
{ {
if(this.eventDispatcher) if (this.eventDispatcher)
{ {
const location = this.object.getLocation(); const location = this.object.getLocation();
if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) if (((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z))
{ {
if(!this._reportedLocation) this._reportedLocation = new Vector3d(); if (!this._reportedLocation) this._reportedLocation = new Vector3d();
this._reportedLocation.assign(location); this._reportedLocation.assign(location);
@ -99,14 +98,14 @@ export class AvatarLogic extends MovingObjectLogic
const model = this.object && this.object.model; const model = this.object && this.object.model;
if(model) this.updateModel(this.time, model); if (model) this.updateModel(this.time, model);
} }
private updateModel(time: number, model: IRoomObjectModel): void private updateModel(time: number, model: IRoomObjectModel): void
{ {
if(this._talkingEndTimestamp > 0) if (this._talkingEndTimestamp > 0)
{ {
if(time > this._talkingEndTimestamp) if (time > this._talkingEndTimestamp)
{ {
model.setValue(RoomObjectVariable.FIGURE_TALK, 0); model.setValue(RoomObjectVariable.FIGURE_TALK, 0);
@ -116,14 +115,14 @@ export class AvatarLogic extends MovingObjectLogic
} }
else else
{ {
if(!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp) if (!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp)
{ {
this._talkingPauseStartTimestamp = time + this.randomTalkingPauseStartTimestamp(); this._talkingPauseStartTimestamp = time + this.randomTalkingPauseStartTimestamp();
this._talkingPauseEndTimestamp = this._talkingPauseStartTimestamp + this.randomTalkingPauseEndTimestamp(); this._talkingPauseEndTimestamp = this._talkingPauseStartTimestamp + this.randomTalkingPauseEndTimestamp();
} }
else else
{ {
if((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp)) if ((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_TALK, 0); model.setValue(RoomObjectVariable.FIGURE_TALK, 0);
@ -131,7 +130,7 @@ export class AvatarLogic extends MovingObjectLogic
} }
else else
{ {
if((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp)) if ((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_TALK, 1); model.setValue(RoomObjectVariable.FIGURE_TALK, 1);
@ -142,30 +141,30 @@ export class AvatarLogic extends MovingObjectLogic
} }
} }
if((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp)) if ((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0); model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0);
this._animationEndTimestamp = 0; this._animationEndTimestamp = 0;
} }
if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) if ((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_GESTURE, 0); model.setValue(RoomObjectVariable.FIGURE_GESTURE, 0);
this._gestureEndTimestamp = 0; this._gestureEndTimestamp = 0;
} }
if((this._signEndTimestamp > 0) && (time > this._signEndTimestamp)) if ((this._signEndTimestamp > 0) && (time > this._signEndTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_SIGN, -1); model.setValue(RoomObjectVariable.FIGURE_SIGN, -1);
this._signEndTimestamp = 0; this._signEndTimestamp = 0;
} }
if(this._carryObjectEndTimestamp > 0) if (this._carryObjectEndTimestamp > 0)
{ {
if(time > this._carryObjectEndTimestamp) if (time > this._carryObjectEndTimestamp)
{ {
model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, 0); model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, 0);
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0);
@ -176,11 +175,11 @@ export class AvatarLogic extends MovingObjectLogic
} }
} }
if(this._allowUseCarryObject) if (this._allowUseCarryObject)
{ {
if((time - this._carryObjectStartTimestamp) > 5000) if ((time - this._carryObjectStartTimestamp) > 5000)
{ {
if(((time - this._carryObjectStartTimestamp) % 10000) < 1000) if (((time - this._carryObjectStartTimestamp) % 10000) < 1000)
{ {
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 1); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 1);
} }
@ -191,7 +190,7 @@ export class AvatarLogic extends MovingObjectLogic
} }
} }
if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp)) if ((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_BLINK, 1); model.setValue(RoomObjectVariable.FIGURE_BLINK, 1);
@ -199,21 +198,21 @@ export class AvatarLogic extends MovingObjectLogic
this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp(); this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp();
} }
if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp)) if ((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0); model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
this._blinkingEndTimestamp = 0; this._blinkingEndTimestamp = 0;
} }
if((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp)) if ((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_EFFECT, this._newEffect); model.setValue(RoomObjectVariable.FIGURE_EFFECT, this._newEffect);
this._effectChangeTimeStamp = 0; this._effectChangeTimeStamp = 0;
} }
if((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp)) if ((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp))
{ {
model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, 0); model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, 0);
@ -223,15 +222,15 @@ export class AvatarLogic extends MovingObjectLogic
public processUpdateMessage(message: RoomObjectUpdateMessage): void public processUpdateMessage(message: RoomObjectUpdateMessage): void
{ {
if(!message || !this.object) return; if (!message || !this.object) return;
super.processUpdateMessage(message); super.processUpdateMessage(message);
const model = this.object && this.object.model; const model = this.object && this.object.model;
if(!model) return; if (!model) return;
if(message instanceof ObjectAvatarPostureUpdateMessage) if (message instanceof ObjectAvatarPostureUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType); model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType);
model.setValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER, message.parameter); model.setValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER, message.parameter);
@ -239,7 +238,7 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarChatUpdateMessage) if (message instanceof ObjectAvatarChatUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_TALK, 1); model.setValue(RoomObjectVariable.FIGURE_TALK, 1);
@ -248,28 +247,28 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarTypingUpdateMessage) if (message instanceof ObjectAvatarTypingUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_IS_TYPING, message.isTyping ? 1 : 0); model.setValue(RoomObjectVariable.FIGURE_IS_TYPING, message.isTyping ? 1 : 0);
return; return;
} }
if(message instanceof ObjectAvatarMutedUpdateMessage) if (message instanceof ObjectAvatarMutedUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_IS_MUTED, (message.isMuted ? 1 : 0)); model.setValue(RoomObjectVariable.FIGURE_IS_MUTED, (message.isMuted ? 1 : 0));
return; return;
} }
if(message instanceof ObjectAvatarPlayingGameUpdateMessage) if (message instanceof ObjectAvatarPlayingGameUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_IS_PLAYING_GAME, (message.isPlayingGame ? 1 : 0)); model.setValue(RoomObjectVariable.FIGURE_IS_PLAYING_GAME, (message.isPlayingGame ? 1 : 0));
return; return;
} }
if(message instanceof ObjectAvatarUpdateMessage) if (message instanceof ObjectAvatarUpdateMessage)
{ {
model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection); model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection);
model.setValue(RoomObjectVariable.FIGURE_CAN_STAND_UP, message.canStandUp); model.setValue(RoomObjectVariable.FIGURE_CAN_STAND_UP, message.canStandUp);
@ -278,7 +277,7 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarGestureUpdateMessage) if (message instanceof ObjectAvatarGestureUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture); model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture);
@ -287,35 +286,35 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarExpressionUpdateMessage) if (message instanceof ObjectAvatarExpressionUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, message.expressionType); model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, message.expressionType);
this._animationEndTimestamp = AvatarAction.getExpressionTimeout(model.getValue<number>(RoomObjectVariable.FIGURE_EXPRESSION)); this._animationEndTimestamp = AvatarAction.getExpressionTimeout(model.getValue<number>(RoomObjectVariable.FIGURE_EXPRESSION));
if(this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time; if (this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time;
return; return;
} }
if(message instanceof ObjectAvatarDanceUpdateMessage) if (message instanceof ObjectAvatarDanceUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_DANCE, message.danceStyle); model.setValue(RoomObjectVariable.FIGURE_DANCE, message.danceStyle);
return; return;
} }
if(message instanceof ObjectAvatarSleepUpdateMessage) if (message instanceof ObjectAvatarSleepUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0); model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0);
if(message.isSleeping) this._blinkingStartTimestamp = -1; if (message.isSleeping) this._blinkingStartTimestamp = -1;
else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp()); else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp());
return; return;
} }
if(message instanceof ObjectAvatarPlayerValueUpdateMessage) if (message instanceof ObjectAvatarPlayerValueUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, message.value); model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, message.value);
@ -324,19 +323,19 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarEffectUpdateMessage) if (message instanceof ObjectAvatarEffectUpdateMessage)
{ {
this.updateAvatarEffect(message.effect, message.delayMilliseconds, model); this.updateAvatarEffect(message.effect, message.delayMilliseconds, model);
return; return;
} }
if(message instanceof ObjectAvatarCarryObjectUpdateMessage) if (message instanceof ObjectAvatarCarryObjectUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, message.itemType); model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, message.itemType);
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0);
if(message.itemType === 0) if (message.itemType === 0)
{ {
this._carryObjectStartTimestamp = 0; this._carryObjectStartTimestamp = 0;
this._carryObjectEndTimestamp = 0; this._carryObjectEndTimestamp = 0;
@ -346,7 +345,7 @@ export class AvatarLogic extends MovingObjectLogic
{ {
this._carryObjectStartTimestamp = this.time; this._carryObjectStartTimestamp = this.time;
if(message.itemType < AvatarLogic.MAX_HAND_ID) if (message.itemType < AvatarLogic.MAX_HAND_ID)
{ {
this._carryObjectEndTimestamp = 0; this._carryObjectEndTimestamp = 0;
this._allowUseCarryObject = message.itemType <= AvatarLogic.MAX_HAND_USE_ID; this._allowUseCarryObject = message.itemType <= AvatarLogic.MAX_HAND_USE_ID;
@ -361,14 +360,14 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarUseObjectUpdateMessage) if (message instanceof ObjectAvatarUseObjectUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, message.itemType); model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, message.itemType);
return; return;
} }
if(message instanceof ObjectAvatarSignUpdateMessage) if (message instanceof ObjectAvatarSignUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_SIGN, message.signType); model.setValue(RoomObjectVariable.FIGURE_SIGN, message.signType);
@ -377,14 +376,14 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarFlatControlUpdateMessage) if (message instanceof ObjectAvatarFlatControlUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE_FLAT_CONTROL, message.level); model.setValue(RoomObjectVariable.FIGURE_FLAT_CONTROL, message.level);
return; return;
} }
if(message instanceof ObjectAvatarFigureUpdateMessage) if (message instanceof ObjectAvatarFigureUpdateMessage)
{ {
model.setValue(RoomObjectVariable.FIGURE, message.figure); model.setValue(RoomObjectVariable.FIGURE, message.figure);
model.setValue(RoomObjectVariable.GENDER, message.gender); model.setValue(RoomObjectVariable.GENDER, message.gender);
@ -392,7 +391,7 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarSelectedMessage) if (message instanceof ObjectAvatarSelectedMessage)
{ {
this._selected = message.selected; this._selected = message.selected;
this._reportedLocation = null; this._reportedLocation = null;
@ -400,7 +399,7 @@ export class AvatarLogic extends MovingObjectLogic
return; return;
} }
if(message instanceof ObjectAvatarOwnMessage) if (message instanceof ObjectAvatarOwnMessage)
{ {
model.setValue(RoomObjectVariable.OWN_USER, 1); model.setValue(RoomObjectVariable.OWN_USER, 1);
@ -410,42 +409,42 @@ export class AvatarLogic extends MovingObjectLogic
private updateAvatarEffect(effect: number, delay: number, model: IRoomObjectModel): void private updateAvatarEffect(effect: number, delay: number, model: IRoomObjectModel): void
{ {
if(effect === AvatarLogic.EFFECT_TYPE_SPLASH) if (effect === AvatarLogic.EFFECT_TYPE_SPLASH)
{ {
this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM; this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM;
} }
else if(effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK) else if (effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK)
{ {
this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM_DARK; this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM_DARK;
} }
else if(model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM) else if (model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM)
{ {
this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
this._newEffect = effect; this._newEffect = effect;
effect = AvatarLogic.EFFECT_TYPE_SPLASH; effect = AvatarLogic.EFFECT_TYPE_SPLASH;
} }
else if(model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK) else if (model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK)
{ {
this._effectChangeTimeStamp = (Nitro.instance.time + AvatarLogic.EFFECT_SPLASH_LENGTH); this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
this._newEffect = effect; this._newEffect = effect;
effect = AvatarLogic.EFFECT_TYPE_SPLASH_DARK; effect = AvatarLogic.EFFECT_TYPE_SPLASH_DARK;
} }
else if(delay === 0) else if (delay === 0)
{ {
this._effectChangeTimeStamp = 0; this._effectChangeTimeStamp = 0;
} }
else else
{ {
this._effectChangeTimeStamp = (Nitro.instance.time + delay); this._effectChangeTimeStamp = (GetTickerTime() + delay);
this._newEffect = effect; this._newEffect = effect;
return; return;
@ -458,7 +457,7 @@ export class AvatarLogic extends MovingObjectLogic
{ {
let eventType: string = null; let eventType: string = null;
switch(event.type) switch (event.type)
{ {
case MouseEventType.MOUSE_CLICK: case MouseEventType.MOUSE_CLICK:
eventType = RoomObjectMouseEvent.CLICK; eventType = RoomObjectMouseEvent.CLICK;
@ -466,20 +465,20 @@ export class AvatarLogic extends MovingObjectLogic
case MouseEventType.ROLL_OVER: case MouseEventType.ROLL_OVER:
eventType = RoomObjectMouseEvent.MOUSE_ENTER; eventType = RoomObjectMouseEvent.MOUSE_ENTER;
if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1); if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1);
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object));
break; break;
case MouseEventType.ROLL_OUT: case MouseEventType.ROLL_OUT:
eventType = RoomObjectMouseEvent.MOUSE_LEAVE; eventType = RoomObjectMouseEvent.MOUSE_LEAVE;
if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0); if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0);
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object));
break; break;
} }
if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); if (eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
} }
private randomTalkingPauseStartTimestamp(): number private randomTalkingPauseStartTimestamp(): number

View File

@ -1,5 +1,5 @@
import { RoomObjectVariable, StringDataType } from '../../../../../api'; import { RoomObjectVariable, StringDataType } from '../../../../../api';
import { PixiApplicationProxy } from '../../../../../pixi-proxy'; import { GetTickerTime } from '../../../../../pixi-proxy';
import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectUpdateMessage } from '../../../../../room';
import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../events'; import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../events';
import { ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage } from '../../../messages'; import { ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage } from '../../../messages';
@ -18,25 +18,25 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic
{ {
super.processUpdateMessage(message); super.processUpdateMessage(message);
if(!this.object) return; if (!this.object) return;
if(message instanceof ObjectDataUpdateMessage) if (message instanceof ObjectDataUpdateMessage)
{ {
const data = message.data; const data = message.data;
if(data instanceof StringDataType) this.updateBadge(data.getValue(1)); if (data instanceof StringDataType) this.updateBadge(data.getValue(1));
return; return;
} }
if(message instanceof ObjectGroupBadgeUpdateMessage) if (message instanceof ObjectGroupBadgeUpdateMessage)
{ {
if(message.assetName !== 'loading_icon') if (message.assetName !== 'loading_icon')
{ {
this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME, message.assetName); this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME, message.assetName);
this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, 1); this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, 1);
this.update(PixiApplicationProxy.instance.ticker.lastTime); this.update(GetTickerTime());
} }
return; return;
@ -45,16 +45,16 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic
public useObject(): void public useObject(): void
{ {
if(!this.object || !this.eventDispatcher) return; if (!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, this.object));
} }
protected updateBadge(badgeId: string): void protected updateBadge(badgeId: string): void
{ {
if(badgeId === '') return; if (badgeId === '') return;
if(this.eventDispatcher) if (this.eventDispatcher)
{ {
this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, -1); this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, -1);

View File

@ -1,5 +1,5 @@
import { IRoomGeometry, RoomObjectVariable, StringDataType } from '../../../../../api'; import { IRoomGeometry, RoomObjectVariable, StringDataType } from '../../../../../api';
import { PixiApplicationProxy } from '../../../../../pixi-proxy'; import { GetTickerTime } from '../../../../../pixi-proxy';
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
import { MouseEventType } from '../../../../ui'; import { MouseEventType } from '../../../../ui';
import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../events'; import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../events';
@ -28,11 +28,11 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
{ {
super.processUpdateMessage(message); super.processUpdateMessage(message);
if(message instanceof ObjectDataUpdateMessage) if (message instanceof ObjectDataUpdateMessage)
{ {
const data = message.data; const data = message.data;
if(data instanceof StringDataType) if (data instanceof StringDataType)
{ {
this.updateGroupId(data.getValue(FurnitureGuildCustomizedLogic.GROUPID_KEY)); this.updateGroupId(data.getValue(FurnitureGuildCustomizedLogic.GROUPID_KEY));
this.updateBadge(data.getValue(FurnitureGuildCustomizedLogic.BADGE_KEY)); this.updateBadge(data.getValue(FurnitureGuildCustomizedLogic.BADGE_KEY));
@ -40,19 +40,19 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
} }
} }
else if(message instanceof ObjectGroupBadgeUpdateMessage) else if (message instanceof ObjectGroupBadgeUpdateMessage)
{ {
if(message.assetName !== 'loading_icon') if (message.assetName !== 'loading_icon')
{ {
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME, message.assetName); this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME, message.assetName);
this.update(PixiApplicationProxy.instance.ticker.lastTime); this.update(GetTickerTime());
} }
} }
else if(message instanceof ObjectSelectedMessage) else if (message instanceof ObjectSelectedMessage)
{ {
if(!message.selected) if (!message.selected)
{ {
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object));
} }
@ -77,9 +77,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{ {
if(!event || !geometry || !this.object) return; if (!event || !geometry || !this.object) return;
switch(event.type) switch (event.type)
{ {
case MouseEventType.MOUSE_CLICK: case MouseEventType.MOUSE_CLICK:
this.openContextMenu(); this.openContextMenu();

View File

@ -1,5 +1,5 @@
import { GetTickerTime } from '../../../../../pixi-proxy';
import { RoomObjectUpdateMessage } from '../../../../../room'; import { RoomObjectUpdateMessage } from '../../../../../room';
import { Nitro } from '../../../../Nitro';
import { ObjectDataUpdateMessage } from '../../../messages'; import { ObjectDataUpdateMessage } from '../../../messages';
import { FurnitureLogic } from './FurnitureLogic'; import { FurnitureLogic } from './FurnitureLogic';
@ -23,7 +23,7 @@ export class FurnitureScoreLogic extends FurnitureLogic
public processUpdateMessage(message: RoomObjectUpdateMessage): void public processUpdateMessage(message: RoomObjectUpdateMessage): void
{ {
if(message instanceof ObjectDataUpdateMessage) return this.updateScore(message.state); if (message instanceof ObjectDataUpdateMessage) return this.updateScore(message.state);
super.processUpdateMessage(message); super.processUpdateMessage(message);
} }
@ -34,16 +34,16 @@ export class FurnitureScoreLogic extends FurnitureLogic
const currentScore = this.object.getState(0); const currentScore = this.object.getState(0);
if(this._score !== currentScore) if (this._score !== currentScore)
{ {
let difference = (this._score - currentScore); let difference = (this._score - currentScore);
if(difference < 0) difference = -(difference); if (difference < 0) difference = -(difference);
if((difference * FurnitureScoreLogic.UPDATE_INTERVAL) > FurnitureScoreLogic.MAX_UPDATE_TIME) this._scoreIncreaser = (FurnitureScoreLogic.MAX_UPDATE_TIME / difference); if ((difference * FurnitureScoreLogic.UPDATE_INTERVAL) > FurnitureScoreLogic.MAX_UPDATE_TIME) this._scoreIncreaser = (FurnitureScoreLogic.MAX_UPDATE_TIME / difference);
else this._scoreIncreaser = FurnitureScoreLogic.UPDATE_INTERVAL; else this._scoreIncreaser = FurnitureScoreLogic.UPDATE_INTERVAL;
this._scoreTimer = Nitro.instance.time; this._scoreTimer = GetTickerTime();
} }
} }
@ -53,15 +53,15 @@ export class FurnitureScoreLogic extends FurnitureLogic
const currentScore = this.object.getState(0); const currentScore = this.object.getState(0);
if((currentScore !== this._score) && (time >= (this._scoreTimer + this._scoreIncreaser))) if ((currentScore !== this._score) && (time >= (this._scoreTimer + this._scoreIncreaser)))
{ {
const _local_3 = (time - this._scoreTimer); const _local_3 = (time - this._scoreTimer);
let _local_4 = (_local_3 / this._scoreIncreaser); let _local_4 = (_local_3 / this._scoreIncreaser);
let _local_5 = 1; let _local_5 = 1;
if(this._score < currentScore) _local_5 = -1; if (this._score < currentScore) _local_5 = -1;
if(_local_4 > (_local_5 * (this._score - currentScore))) _local_4 = (_local_5 * (this._score - currentScore)); if (_local_4 > (_local_5 * (this._score - currentScore))) _local_4 = (_local_5 * (this._score - currentScore));
this.object.setState((currentScore + (_local_5 * _local_4)), 0); this.object.setState((currentScore + (_local_5 * _local_4)), 0);

Some files were not shown because too many files have changed in this diff Show More