chore: use prettier on all projects
This commit is contained in:
parent
2c998c1306
commit
63eee81b54
|
@ -2,3 +2,4 @@
|
||||||
|
|
||||||
/dist
|
/dist
|
||||||
/coverage
|
/coverage
|
||||||
|
package-lock.json
|
22
.prettierrc
22
.prettierrc
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"trailingComma": "es5",
|
"trailingComma": "es5",
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"bracketSpacing": false,
|
"bracketSpacing": false,
|
||||||
"singleQuote": false,
|
"singleQuote": false,
|
||||||
"arrowParens": "avoid",
|
"arrowParens": "avoid",
|
||||||
"printWidth": 160,
|
"printWidth": 160,
|
||||||
"jsxBracketSameLine": true,
|
"jsxBracketSameLine": true,
|
||||||
"importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
|
"importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
|
||||||
"importOrderSeparation": true,
|
"importOrderSeparation": true,
|
||||||
"importOrderSortSpecifiers": true
|
"importOrderSortSpecifiers": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": ["nrwl.angular-console", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
|
||||||
"nrwl.angular-console",
|
|
||||||
"esbenp.prettier-vscode",
|
|
||||||
"dbaeumer.vscode-eslint"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { defineConfig } from 'cypress';
|
import {nxE2EPreset} from "@nrwl/cypress/plugins/cypress-preset";
|
||||||
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
|
import {defineConfig} from "cypress";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: nxE2EPreset(__dirname, {
|
e2e: nxE2EPreset(__dirname, {
|
||||||
bundler: 'vite',
|
bundler: "vite",
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { getGreeting } from '../support/app.po';
|
import {getGreeting} from "../support/app.po";
|
||||||
|
|
||||||
describe('frontend', () => {
|
describe("frontend", () => {
|
||||||
beforeEach(() => cy.visit('/'));
|
beforeEach(() => cy.visit("/"));
|
||||||
|
|
||||||
it('should display welcome message', () => {
|
it("should display welcome message", () => {
|
||||||
// Custom command example, see `../support/commands.ts` file
|
// Custom command example, see `../support/commands.ts` file
|
||||||
cy.login('my-email@something.com', 'myPassword');
|
cy.login("my-email@something.com", "myPassword");
|
||||||
|
|
||||||
// Function helper example, see `../support/app.po.ts` file
|
// Function helper example, see `../support/app.po.ts` file
|
||||||
getGreeting().contains('Welcome frontend');
|
getGreeting().contains("Welcome frontend");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export const getGreeting = () => cy.get('h1');
|
export const getGreeting = () => cy.get("h1");
|
||||||
|
|
|
@ -17,8 +17,8 @@ declare namespace Cypress {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// -- This is a parent command --
|
// -- This is a parent command --
|
||||||
Cypress.Commands.add('login', (email, password) => {
|
Cypress.Commands.add("login", (email, password) => {
|
||||||
console.log('Custom command example: Login', email, password);
|
console.log("Custom command example: Login", email, password);
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
// -- This is a child command --
|
// -- This is a child command --
|
||||||
|
|
|
@ -12,6 +12,5 @@
|
||||||
// You can read more here:
|
// You can read more here:
|
||||||
// https://on.cypress.io/configuration
|
// https://on.cypress.io/configuration
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands';
|
import "./commands";
|
||||||
|
|
|
@ -4,18 +4,18 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||||
<link rel="manifest" crossorigin="use-credentials" href="/site.webmanifest">
|
<link rel="manifest" crossorigin="use-credentials" href="/site.webmanifest" />
|
||||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#000000">
|
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#000000" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Nitro">
|
<meta name="apple-mobile-web-app-title" content="Nitro" />
|
||||||
<meta name="application-name" content="Nitro">
|
<meta name="application-name" content="Nitro" />
|
||||||
<meta name="msapplication-TileColor" content="#000000">
|
<meta name="msapplication-TileColor" content="#000000" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<base href="./">
|
<base href="./" />
|
||||||
<title>Nitro</title>
|
<title>Nitro</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -23,11 +23,11 @@
|
||||||
<div id="root" class="w-100 h-100"></div>
|
<div id="root" class="w-100 h-100"></div>
|
||||||
<script>
|
<script>
|
||||||
const NitroConfig = {
|
const NitroConfig = {
|
||||||
"config.urls": [ '/renderer-config.json', '/ui-config.json' ],
|
"config.urls": ["/renderer-config.json", "/ui-config.json"],
|
||||||
"sso.ticket": (new URLSearchParams(window.location.search).get('sso') || null),
|
"sso.ticket": new URLSearchParams(window.location.search).get("sso") || null,
|
||||||
"forward.type": (new URLSearchParams(window.location.search).get('room') ? 2 : -1),
|
"forward.type": new URLSearchParams(window.location.search).get("room") ? 2 : -1,
|
||||||
"forward.id": (new URLSearchParams(window.location.search).get('room') || 0),
|
"forward.id": new URLSearchParams(window.location.search).get("room") || 0,
|
||||||
"friend.id": (new URLSearchParams(window.location.search).get('friend') || 0),
|
"friend.id": new URLSearchParams(window.location.search).get("friend") || 0,
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<script type="module" src="./src/index.tsx"></script>
|
<script type="module" src="./src/index.tsx"></script>
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
{
|
{
|
||||||
"start_url": "/",
|
"start_url": "/",
|
||||||
"name": "Nitro",
|
"name": "Nitro",
|
||||||
"short_name": "Nitro",
|
"short_name": "Nitro",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "android-chrome-192x192.png",
|
"src": "android-chrome-192x192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "android-chrome-512x512.png",
|
"src": "android-chrome-512x512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"theme_color": "#ffffff",
|
"theme_color": "#ffffff",
|
||||||
"background_color": "#ffffff",
|
"background_color": "#ffffff",
|
||||||
"display": "standalone"
|
"display": "standalone"
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,9 +94,9 @@ $nitro-calendar-width: 850px;
|
||||||
$nitro-calendar-height: 400px;
|
$nitro-calendar-height: 400px;
|
||||||
|
|
||||||
.nitro-app {
|
.nitro-app {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@import './common';
|
@import "./common";
|
||||||
@import './components';
|
@import "./components";
|
||||||
|
|
|
@ -1,141 +1,144 @@
|
||||||
import { ConfigurationEvent, GetAssetManager, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroConfiguration, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent } from '@nitro/renderer';
|
import {
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
ConfigurationEvent,
|
||||||
import { GetCommunication, GetConfiguration, GetNitroInstance, GetUIVersion } from './api';
|
GetAssetManager,
|
||||||
import { Base, TransitionAnimation, TransitionAnimationTypes } from './common';
|
HabboWebTools,
|
||||||
import { LoadingView } from './components/loading/LoadingView';
|
LegacyExternalInterface,
|
||||||
import { MainView } from './components/main/MainView';
|
Nitro,
|
||||||
import { useConfigurationEvent, useLocalizationEvent, useMainEvent, useRoomEngineEvent } from './hooks';
|
NitroCommunicationDemoEvent,
|
||||||
|
NitroConfiguration,
|
||||||
|
NitroEvent,
|
||||||
|
NitroLocalizationEvent,
|
||||||
|
NitroVersion,
|
||||||
|
RoomEngineEvent,
|
||||||
|
} from "@nitro/renderer";
|
||||||
|
import {FC, useCallback, useEffect, useState} from "react";
|
||||||
|
|
||||||
|
import {GetCommunication, GetConfiguration, GetNitroInstance, GetUIVersion} from "./api";
|
||||||
|
import {Base, TransitionAnimation, TransitionAnimationTypes} from "./common";
|
||||||
|
import {LoadingView} from "./components/loading/LoadingView";
|
||||||
|
import {MainView} from "./components/main/MainView";
|
||||||
|
import {useConfigurationEvent, useLocalizationEvent, useMainEvent, useRoomEngineEvent} from "./hooks";
|
||||||
|
|
||||||
NitroVersion.UI_VERSION = GetUIVersion();
|
NitroVersion.UI_VERSION = GetUIVersion();
|
||||||
|
|
||||||
export const App: FC<{}> = props =>
|
export const App: FC<{}> = props => {
|
||||||
{
|
const [isReady, setIsReady] = useState(false);
|
||||||
const [ isReady, setIsReady ] = useState(false);
|
const [isError, setIsError] = useState(false);
|
||||||
const [ isError, setIsError ] = useState(false);
|
const [message, setMessage] = useState("Getting Ready");
|
||||||
const [ message, setMessage ] = useState('Getting Ready');
|
const [percent, setPercent] = useState(0);
|
||||||
const [ percent, setPercent ] = useState(0);
|
const [imageRendering, setImageRendering] = useState<boolean>(true);
|
||||||
const [ imageRendering, setImageRendering ] = useState<boolean>(true);
|
|
||||||
|
|
||||||
if(!GetNitroInstance())
|
if (!GetNitroInstance()) {
|
||||||
{
|
//@ts-ignore
|
||||||
//@ts-ignore
|
if (!NitroConfig) throw new Error("NitroConfig is not defined!");
|
||||||
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
|
|
||||||
|
|
||||||
Nitro.bootstrap();
|
Nitro.bootstrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handler = useCallback(async (event: NitroEvent) => {
|
||||||
|
switch (event.type) {
|
||||||
|
case ConfigurationEvent.LOADED:
|
||||||
|
GetNitroInstance().localization.init();
|
||||||
|
setPercent(prevValue => prevValue + 20);
|
||||||
|
return;
|
||||||
|
case ConfigurationEvent.FAILED:
|
||||||
|
setIsError(true);
|
||||||
|
setMessage("Configuration Failed");
|
||||||
|
return;
|
||||||
|
case Nitro.WEBGL_UNAVAILABLE:
|
||||||
|
setIsError(true);
|
||||||
|
setMessage("WebGL Required");
|
||||||
|
return;
|
||||||
|
case Nitro.WEBGL_CONTEXT_LOST:
|
||||||
|
setIsError(true);
|
||||||
|
setMessage("WebGL Context Lost - Reloading");
|
||||||
|
|
||||||
|
setTimeout(() => window.location.reload(), 1500);
|
||||||
|
return;
|
||||||
|
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
|
||||||
|
setPercent(prevValue => prevValue + 20);
|
||||||
|
return;
|
||||||
|
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
|
||||||
|
setIsError(true);
|
||||||
|
setMessage("Handshake Failed");
|
||||||
|
return;
|
||||||
|
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
|
||||||
|
setPercent(prevValue => prevValue + 20);
|
||||||
|
|
||||||
|
GetNitroInstance().init();
|
||||||
|
|
||||||
|
if (LegacyExternalInterface.available) LegacyExternalInterface.call("legacyTrack", "authentication", "authok", []);
|
||||||
|
return;
|
||||||
|
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
||||||
|
setIsError(true);
|
||||||
|
setMessage("Connection Error");
|
||||||
|
return;
|
||||||
|
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
|
||||||
|
//if(GetNitroInstance().roomEngine) GetNitroInstance().roomEngine.dispose();
|
||||||
|
//setIsError(true);
|
||||||
|
setMessage("Connection Error");
|
||||||
|
|
||||||
|
HabboWebTools.send(-1, "client.init.handshake.fail");
|
||||||
|
return;
|
||||||
|
case RoomEngineEvent.ENGINE_INITIALIZED:
|
||||||
|
setPercent(prevValue => prevValue + 20);
|
||||||
|
|
||||||
|
setTimeout(() => setIsReady(true), 300);
|
||||||
|
return;
|
||||||
|
case NitroLocalizationEvent.LOADED: {
|
||||||
|
const assetUrls = GetConfiguration<string[]>("preload.assets.urls");
|
||||||
|
const urls: string[] = [];
|
||||||
|
|
||||||
|
if (assetUrls && assetUrls.length) for (const url of assetUrls) urls.push(NitroConfiguration.interpolate(url));
|
||||||
|
|
||||||
|
const status = await GetAssetManager().downloadAssets(urls);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
GetCommunication().init();
|
||||||
|
|
||||||
|
setPercent(prevValue => prevValue + 20);
|
||||||
|
} else {
|
||||||
|
setIsError(true);
|
||||||
|
setMessage("Assets Failed");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handler = useCallback(async (event: NitroEvent) =>
|
useMainEvent(Nitro.WEBGL_UNAVAILABLE, handler);
|
||||||
{
|
useMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler);
|
||||||
switch(event.type)
|
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, handler);
|
||||||
{
|
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, handler);
|
||||||
case ConfigurationEvent.LOADED:
|
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, handler);
|
||||||
GetNitroInstance().localization.init();
|
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_ERROR, handler);
|
||||||
setPercent(prevValue => (prevValue + 20));
|
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, handler);
|
||||||
return;
|
useRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, handler);
|
||||||
case ConfigurationEvent.FAILED:
|
useLocalizationEvent(NitroLocalizationEvent.LOADED, handler);
|
||||||
setIsError(true);
|
useConfigurationEvent(ConfigurationEvent.LOADED, handler);
|
||||||
setMessage('Configuration Failed');
|
useConfigurationEvent(ConfigurationEvent.FAILED, handler);
|
||||||
return;
|
|
||||||
case Nitro.WEBGL_UNAVAILABLE:
|
|
||||||
setIsError(true);
|
|
||||||
setMessage('WebGL Required');
|
|
||||||
return;
|
|
||||||
case Nitro.WEBGL_CONTEXT_LOST:
|
|
||||||
setIsError(true);
|
|
||||||
setMessage('WebGL Context Lost - Reloading');
|
|
||||||
|
|
||||||
setTimeout(() => window.location.reload(), 1500);
|
useEffect(() => {
|
||||||
return;
|
GetNitroInstance().core.configuration.init();
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
|
|
||||||
setPercent(prevValue => (prevValue + 20));
|
|
||||||
return;
|
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
|
|
||||||
setIsError(true);
|
|
||||||
setMessage('Handshake Failed');
|
|
||||||
return;
|
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
|
|
||||||
setPercent(prevValue => (prevValue + 20));
|
|
||||||
|
|
||||||
GetNitroInstance().init();
|
const resize = (event: UIEvent) => setImageRendering(!(window.devicePixelRatio % 1));
|
||||||
|
|
||||||
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
|
window.addEventListener("resize", resize);
|
||||||
return;
|
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
|
||||||
setIsError(true);
|
|
||||||
setMessage('Connection Error');
|
|
||||||
return;
|
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
|
|
||||||
//if(GetNitroInstance().roomEngine) GetNitroInstance().roomEngine.dispose();
|
|
||||||
//setIsError(true);
|
|
||||||
setMessage('Connection Error');
|
|
||||||
|
|
||||||
HabboWebTools.send(-1, 'client.init.handshake.fail');
|
resize(null);
|
||||||
return;
|
|
||||||
case RoomEngineEvent.ENGINE_INITIALIZED:
|
|
||||||
setPercent(prevValue => (prevValue + 20));
|
|
||||||
|
|
||||||
setTimeout(() => setIsReady(true), 300);
|
return () => {
|
||||||
return;
|
window.removeEventListener("resize", resize);
|
||||||
case NitroLocalizationEvent.LOADED: {
|
};
|
||||||
const assetUrls = GetConfiguration<string[]>('preload.assets.urls');
|
}, []);
|
||||||
const urls: string[] = [];
|
|
||||||
|
|
||||||
if(assetUrls && assetUrls.length) for(const url of assetUrls) urls.push(NitroConfiguration.interpolate(url));
|
return (
|
||||||
|
<Base fit overflow="hidden" className={imageRendering && "image-rendering-pixelated"}>
|
||||||
const status = await GetAssetManager().downloadAssets(urls);
|
{(!isReady || isError) && <LoadingView isError={isError} message={message} percent={percent} />}
|
||||||
|
<TransitionAnimation type={TransitionAnimationTypes.FADE_IN} inProp={isReady}>
|
||||||
if(status)
|
<MainView />
|
||||||
{
|
</TransitionAnimation>
|
||||||
GetCommunication().init();
|
<Base id="draggable-windows-container" />
|
||||||
|
</Base>
|
||||||
setPercent(prevValue => (prevValue + 20))
|
);
|
||||||
}
|
};
|
||||||
else
|
|
||||||
{
|
|
||||||
setIsError(true);
|
|
||||||
setMessage('Assets Failed');
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useMainEvent(Nitro.WEBGL_UNAVAILABLE, handler);
|
|
||||||
useMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler);
|
|
||||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, handler);
|
|
||||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, handler);
|
|
||||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, handler);
|
|
||||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_ERROR, handler);
|
|
||||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, handler);
|
|
||||||
useRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, handler);
|
|
||||||
useLocalizationEvent(NitroLocalizationEvent.LOADED, handler);
|
|
||||||
useConfigurationEvent(ConfigurationEvent.LOADED, handler);
|
|
||||||
useConfigurationEvent(ConfigurationEvent.FAILED, handler);
|
|
||||||
|
|
||||||
useEffect(() =>
|
|
||||||
{
|
|
||||||
GetNitroInstance().core.configuration.init();
|
|
||||||
|
|
||||||
const resize = (event: UIEvent) => setImageRendering(!(window.devicePixelRatio % 1));
|
|
||||||
|
|
||||||
window.addEventListener('resize', resize);
|
|
||||||
|
|
||||||
resize(null);
|
|
||||||
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
window.removeEventListener('resize', resize);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Base fit overflow="hidden" className={ imageRendering && 'image-rendering-pixelated' }>
|
|
||||||
{ (!isReady || isError) &&
|
|
||||||
<LoadingView isError={ isError } message={ message } percent={ percent } /> }
|
|
||||||
<TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ (isReady) }>
|
|
||||||
<MainView />
|
|
||||||
</TransitionAnimation>
|
|
||||||
<Base id="draggable-windows-container" />
|
|
||||||
</Base>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import { NitroVersion } from '@nitro/renderer';
|
import {NitroVersion} from "@nitro/renderer";
|
||||||
|
|
||||||
export const GetRendererVersion = () => NitroVersion.RENDERER_VERSION;
|
export const GetRendererVersion = () => NitroVersion.RENDERER_VERSION;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export const GetUIVersion = () => '2.1.1';
|
export const GetUIVersion = () => "2.1.1";
|
||||||
|
|
|
@ -1,40 +1,34 @@
|
||||||
import { AchievementData } from '@nitro/renderer';
|
import {AchievementData} from "@nitro/renderer";
|
||||||
import { AchievementUtilities } from './AchievementUtilities';
|
|
||||||
import { IAchievementCategory } from './IAchievementCategory';
|
|
||||||
|
|
||||||
export class AchievementCategory implements IAchievementCategory
|
import {AchievementUtilities} from "./AchievementUtilities";
|
||||||
{
|
import {IAchievementCategory} from "./IAchievementCategory";
|
||||||
private _code: string;
|
|
||||||
private _achievements: AchievementData[];
|
|
||||||
|
|
||||||
constructor(code: string)
|
export class AchievementCategory implements IAchievementCategory {
|
||||||
{
|
private _code: string;
|
||||||
this._code = code;
|
private _achievements: AchievementData[];
|
||||||
this._achievements = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public getProgress(): number
|
constructor(code: string) {
|
||||||
{
|
this._code = code;
|
||||||
return AchievementUtilities.getAchievementCategoryProgress(this);
|
this._achievements = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public getMaxProgress(): number
|
public getProgress(): number {
|
||||||
{
|
return AchievementUtilities.getAchievementCategoryProgress(this);
|
||||||
return AchievementUtilities.getAchievementCategoryMaxProgress(this);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get code(): string
|
public getMaxProgress(): number {
|
||||||
{
|
return AchievementUtilities.getAchievementCategoryMaxProgress(this);
|
||||||
return this._code;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get achievements(): AchievementData[]
|
public get code(): string {
|
||||||
{
|
return this._code;
|
||||||
return this._achievements;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set achievements(achievements: AchievementData[])
|
public get achievements(): AchievementData[] {
|
||||||
{
|
return this._achievements;
|
||||||
this._achievements = achievements;
|
}
|
||||||
}
|
|
||||||
|
public set achievements(achievements: AchievementData[]) {
|
||||||
|
this._achievements = achievements;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,97 +1,88 @@
|
||||||
import { AchievementData } from '@nitro/renderer';
|
import {AchievementData} from "@nitro/renderer";
|
||||||
import { GetConfiguration, GetLocalization } from '../nitro';
|
|
||||||
import { IAchievementCategory } from './IAchievementCategory';
|
|
||||||
|
|
||||||
export class AchievementUtilities
|
import {GetConfiguration, GetLocalization} from "../nitro";
|
||||||
{
|
import {IAchievementCategory} from "./IAchievementCategory";
|
||||||
public static getAchievementBadgeCode(achievement: AchievementData): string
|
|
||||||
{
|
export class AchievementUtilities {
|
||||||
if(!achievement) return null;
|
public static getAchievementBadgeCode(achievement: AchievementData): string {
|
||||||
|
if (!achievement) return null;
|
||||||
let badgeId = achievement.badgeId;
|
|
||||||
|
let badgeId = achievement.badgeId;
|
||||||
if(!achievement.finalLevel) badgeId = GetLocalization().getPreviousLevelBadgeId(badgeId);
|
|
||||||
|
if (!achievement.finalLevel) badgeId = GetLocalization().getPreviousLevelBadgeId(badgeId);
|
||||||
return badgeId;
|
|
||||||
|
return badgeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string {
|
||||||
|
const imageUrl = GetConfiguration<string>("achievements.images.url");
|
||||||
|
|
||||||
|
let imageName = icon ? "achicon_" : "achcategory_";
|
||||||
|
|
||||||
|
imageName += category.code;
|
||||||
|
|
||||||
|
if (progress !== null) imageName += `_${progress > 0 ? "active" : "inactive"}`;
|
||||||
|
|
||||||
|
return imageUrl.replace("%image%", imageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getAchievementCategoryMaxProgress(category: IAchievementCategory): number {
|
||||||
|
if (!category) return 0;
|
||||||
|
|
||||||
|
let progress = 0;
|
||||||
|
|
||||||
|
for (const achievement of category.achievements) {
|
||||||
|
progress += achievement.levelCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string
|
return progress;
|
||||||
{
|
}
|
||||||
const imageUrl = GetConfiguration<string>('achievements.images.url');
|
|
||||||
|
|
||||||
let imageName = icon ? 'achicon_' : 'achcategory_';
|
|
||||||
|
|
||||||
imageName += category.code;
|
|
||||||
|
|
||||||
if(progress !== null) imageName += `_${ ((progress > 0) ? 'active' : 'inactive') }`;
|
|
||||||
|
|
||||||
return imageUrl.replace('%image%', imageName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getAchievementCategoryMaxProgress(category: IAchievementCategory): number
|
public static getAchievementCategoryProgress(category: IAchievementCategory): number {
|
||||||
{
|
if (!category) return 0;
|
||||||
if(!category) return 0;
|
|
||||||
|
|
||||||
let progress = 0;
|
|
||||||
|
|
||||||
for(const achievement of category.achievements)
|
|
||||||
{
|
|
||||||
progress += achievement.levelCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getAchievementCategoryProgress(category: IAchievementCategory): number
|
let progress = 0;
|
||||||
{
|
|
||||||
if(!category) return 0;
|
|
||||||
|
|
||||||
let progress = 0;
|
|
||||||
|
|
||||||
for(const achievement of category.achievements) progress += (achievement.finalLevel ? achievement.level : (achievement.level - 1));
|
|
||||||
|
|
||||||
return progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getAchievementCategoryTotalUnseen(category: IAchievementCategory): number
|
for (const achievement of category.achievements) progress += achievement.finalLevel ? achievement.level : achievement.level - 1;
|
||||||
{
|
|
||||||
if(!category) return 0;
|
|
||||||
|
|
||||||
let unseen = 0;
|
|
||||||
|
|
||||||
for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++);
|
|
||||||
|
|
||||||
return unseen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getAchievementHasStarted(achievement: AchievementData): boolean
|
return progress;
|
||||||
{
|
}
|
||||||
if(!achievement) return false;
|
|
||||||
|
|
||||||
if(achievement.finalLevel || ((achievement.level - 1) > 0)) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getAchievementIsIgnored(achievement: AchievementData): boolean
|
public static getAchievementCategoryTotalUnseen(category: IAchievementCategory): number {
|
||||||
{
|
if (!category) return 0;
|
||||||
if(!achievement) return false;
|
|
||||||
|
|
||||||
const ignored = GetConfiguration<string[]>('achievements.unseen.ignored');
|
|
||||||
const value = achievement.badgeId.replace(/[0-9]/g, '');
|
|
||||||
const index = ignored.indexOf(value);
|
|
||||||
|
|
||||||
if(index >= 0) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getAchievementLevel(achievement: AchievementData): number
|
let unseen = 0;
|
||||||
{
|
|
||||||
if(!achievement) return 0;
|
for (const achievement of category.achievements) achievement.unseen > 0 && unseen++;
|
||||||
|
|
||||||
if(achievement.finalLevel) return achievement.level;
|
return unseen;
|
||||||
|
}
|
||||||
return (achievement.level - 1);
|
|
||||||
}
|
public static getAchievementHasStarted(achievement: AchievementData): boolean {
|
||||||
|
if (!achievement) return false;
|
||||||
|
|
||||||
|
if (achievement.finalLevel || achievement.level - 1 > 0) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getAchievementIsIgnored(achievement: AchievementData): boolean {
|
||||||
|
if (!achievement) return false;
|
||||||
|
|
||||||
|
const ignored = GetConfiguration<string[]>("achievements.unseen.ignored");
|
||||||
|
const value = achievement.badgeId.replace(/[0-9]/g, "");
|
||||||
|
const index = ignored.indexOf(value);
|
||||||
|
|
||||||
|
if (index >= 0) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getAchievementLevel(achievement: AchievementData): number {
|
||||||
|
if (!achievement) return 0;
|
||||||
|
|
||||||
|
if (achievement.finalLevel) return achievement.level;
|
||||||
|
|
||||||
|
return achievement.level - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { AchievementData } from '@nitro/renderer';
|
import {AchievementData} from "@nitro/renderer";
|
||||||
|
|
||||||
export interface IAchievementCategory
|
export interface IAchievementCategory {
|
||||||
{
|
code: string;
|
||||||
code: string;
|
achievements: AchievementData[];
|
||||||
achievements: AchievementData[];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './AchievementCategory';
|
export * from "./AchievementCategory";
|
||||||
export * from './AchievementUtilities';
|
export * from "./AchievementUtilities";
|
||||||
export * from './IAchievementCategory';
|
export * from "./IAchievementCategory";
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
export class AvatarEditorAction
|
export class AvatarEditorAction {
|
||||||
{
|
public static ACTION_SAVE: string = "AEA_ACTION_SAVE";
|
||||||
public static ACTION_SAVE: string = 'AEA_ACTION_SAVE';
|
public static ACTION_CLEAR: string = "AEA_ACTION_CLEAR";
|
||||||
public static ACTION_CLEAR: string = 'AEA_ACTION_CLEAR';
|
public static ACTION_RESET: string = "AEA_ACTION_RESET";
|
||||||
public static ACTION_RESET: string = 'AEA_ACTION_RESET';
|
public static ACTION_RANDOMIZE: string = "AEA_ACTION_RANDOMIZE";
|
||||||
public static ACTION_RANDOMIZE: string = 'AEA_ACTION_RANDOMIZE';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,65 +1,54 @@
|
||||||
import { ColorConverter, IPartColor } from '@nitro/renderer';
|
import {ColorConverter, IPartColor} from "@nitro/renderer";
|
||||||
|
|
||||||
export class AvatarEditorGridColorItem
|
export class AvatarEditorGridColorItem {
|
||||||
{
|
private _partColor: IPartColor;
|
||||||
private _partColor: IPartColor;
|
private _isDisabled: boolean;
|
||||||
private _isDisabled: boolean;
|
private _isHC: boolean;
|
||||||
private _isHC: boolean;
|
private _isSelected: boolean;
|
||||||
private _isSelected: boolean;
|
private _notifier: () => void;
|
||||||
private _notifier: () => void;
|
|
||||||
|
|
||||||
constructor(partColor: IPartColor, isDisabled: boolean = false)
|
constructor(partColor: IPartColor, isDisabled: boolean = false) {
|
||||||
{
|
this._partColor = partColor;
|
||||||
this._partColor = partColor;
|
this._isDisabled = isDisabled;
|
||||||
this._isDisabled = isDisabled;
|
this._isHC = this._partColor.clubLevel > 0;
|
||||||
this._isHC = (this._partColor.clubLevel > 0);
|
this._isSelected = false;
|
||||||
this._isSelected = false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public dispose(): void
|
public dispose(): void {
|
||||||
{
|
this._partColor = null;
|
||||||
this._partColor = null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get partColor(): IPartColor
|
public get partColor(): IPartColor {
|
||||||
{
|
return this._partColor;
|
||||||
return this._partColor;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get color(): string
|
public get color(): string {
|
||||||
{
|
return ColorConverter.int2rgb(this._partColor.rgb);
|
||||||
return ColorConverter.int2rgb(this._partColor.rgb);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isDisabled(): boolean
|
public get isDisabled(): boolean {
|
||||||
{
|
return this._isDisabled;
|
||||||
return this._isDisabled;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isHC(): boolean
|
public get isHC(): boolean {
|
||||||
{
|
return this._isHC;
|
||||||
return this._isHC;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isSelected(): boolean
|
public get isSelected(): boolean {
|
||||||
{
|
return this._isSelected;
|
||||||
return this._isSelected;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set isSelected(flag: boolean)
|
public set isSelected(flag: boolean) {
|
||||||
{
|
this._isSelected = flag;
|
||||||
this._isSelected = flag;
|
|
||||||
|
|
||||||
if(this.notify) this.notify();
|
if (this.notify) this.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
public get notify(): () => void
|
public get notify(): () => void {
|
||||||
{
|
return this._notifier;
|
||||||
return this._notifier;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set notify(notifier: () => void)
|
public set notify(notifier: () => void) {
|
||||||
{
|
this._notifier = notifier;
|
||||||
this._notifier = notifier;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,337 +1,321 @@
|
||||||
import { AvatarFigurePartType, IAvatarImageListener, IAvatarRenderManager, IFigurePart, IFigurePartSet, IGraphicAsset, IPartColor, NitroAlphaFilter, NitroContainer, NitroSprite, TextureUtils } from '@nitro/renderer';
|
import {
|
||||||
import { GetAvatarRenderManager } from '../nitro';
|
AvatarFigurePartType,
|
||||||
import { FigureData } from './FigureData';
|
IAvatarImageListener,
|
||||||
|
IAvatarRenderManager,
|
||||||
|
IFigurePart,
|
||||||
|
IFigurePartSet,
|
||||||
|
IGraphicAsset,
|
||||||
|
IPartColor,
|
||||||
|
NitroAlphaFilter,
|
||||||
|
NitroContainer,
|
||||||
|
NitroSprite,
|
||||||
|
TextureUtils,
|
||||||
|
} from "@nitro/renderer";
|
||||||
|
|
||||||
export class AvatarEditorGridPartItem implements IAvatarImageListener
|
import {GetAvatarRenderManager} from "../nitro";
|
||||||
{
|
import {FigureData} from "./FigureData";
|
||||||
private static ALPHA_FILTER: NitroAlphaFilter = new NitroAlphaFilter(0.2);
|
|
||||||
private static THUMB_DIRECTIONS: number[] = [ 2, 6, 0, 4, 3, 1 ];
|
|
||||||
private static DRAW_ORDER: string[] = [
|
|
||||||
AvatarFigurePartType.LEFT_HAND_ITEM,
|
|
||||||
AvatarFigurePartType.LEFT_HAND,
|
|
||||||
AvatarFigurePartType.LEFT_SLEEVE,
|
|
||||||
AvatarFigurePartType.LEFT_COAT_SLEEVE,
|
|
||||||
AvatarFigurePartType.BODY,
|
|
||||||
AvatarFigurePartType.SHOES,
|
|
||||||
AvatarFigurePartType.LEGS,
|
|
||||||
AvatarFigurePartType.CHEST,
|
|
||||||
AvatarFigurePartType.CHEST_ACCESSORY,
|
|
||||||
AvatarFigurePartType.COAT_CHEST,
|
|
||||||
AvatarFigurePartType.CHEST_PRINT,
|
|
||||||
AvatarFigurePartType.WAIST_ACCESSORY,
|
|
||||||
AvatarFigurePartType.RIGHT_HAND,
|
|
||||||
AvatarFigurePartType.RIGHT_SLEEVE,
|
|
||||||
AvatarFigurePartType.RIGHT_COAT_SLEEVE,
|
|
||||||
AvatarFigurePartType.HEAD,
|
|
||||||
AvatarFigurePartType.FACE,
|
|
||||||
AvatarFigurePartType.EYES,
|
|
||||||
AvatarFigurePartType.HAIR,
|
|
||||||
AvatarFigurePartType.HAIR_BIG,
|
|
||||||
AvatarFigurePartType.FACE_ACCESSORY,
|
|
||||||
AvatarFigurePartType.EYE_ACCESSORY,
|
|
||||||
AvatarFigurePartType.HEAD_ACCESSORY,
|
|
||||||
AvatarFigurePartType.HEAD_ACCESSORY_EXTRA,
|
|
||||||
AvatarFigurePartType.RIGHT_HAND_ITEM,
|
|
||||||
];
|
|
||||||
|
|
||||||
private _renderManager: IAvatarRenderManager;
|
export class AvatarEditorGridPartItem implements IAvatarImageListener {
|
||||||
private _partSet: IFigurePartSet;
|
private static ALPHA_FILTER: NitroAlphaFilter = new NitroAlphaFilter(0.2);
|
||||||
private _partColors: IPartColor[];
|
private static THUMB_DIRECTIONS: number[] = [2, 6, 0, 4, 3, 1];
|
||||||
private _useColors: boolean;
|
private static DRAW_ORDER: string[] = [
|
||||||
private _isDisabled: boolean;
|
AvatarFigurePartType.LEFT_HAND_ITEM,
|
||||||
private _thumbContainer: NitroContainer;
|
AvatarFigurePartType.LEFT_HAND,
|
||||||
private _imageUrl: string;
|
AvatarFigurePartType.LEFT_SLEEVE,
|
||||||
private _maxColorIndex: number;
|
AvatarFigurePartType.LEFT_COAT_SLEEVE,
|
||||||
private _isValidFigure: boolean;
|
AvatarFigurePartType.BODY,
|
||||||
private _isHC: boolean;
|
AvatarFigurePartType.SHOES,
|
||||||
private _isSellable: boolean;
|
AvatarFigurePartType.LEGS,
|
||||||
private _isClear: boolean;
|
AvatarFigurePartType.CHEST,
|
||||||
private _isSelected: boolean;
|
AvatarFigurePartType.CHEST_ACCESSORY,
|
||||||
private _disposed: boolean;
|
AvatarFigurePartType.COAT_CHEST,
|
||||||
private _isInitalized: boolean;
|
AvatarFigurePartType.CHEST_PRINT,
|
||||||
private _notifier: () => void;
|
AvatarFigurePartType.WAIST_ACCESSORY,
|
||||||
|
AvatarFigurePartType.RIGHT_HAND,
|
||||||
|
AvatarFigurePartType.RIGHT_SLEEVE,
|
||||||
|
AvatarFigurePartType.RIGHT_COAT_SLEEVE,
|
||||||
|
AvatarFigurePartType.HEAD,
|
||||||
|
AvatarFigurePartType.FACE,
|
||||||
|
AvatarFigurePartType.EYES,
|
||||||
|
AvatarFigurePartType.HAIR,
|
||||||
|
AvatarFigurePartType.HAIR_BIG,
|
||||||
|
AvatarFigurePartType.FACE_ACCESSORY,
|
||||||
|
AvatarFigurePartType.EYE_ACCESSORY,
|
||||||
|
AvatarFigurePartType.HEAD_ACCESSORY,
|
||||||
|
AvatarFigurePartType.HEAD_ACCESSORY_EXTRA,
|
||||||
|
AvatarFigurePartType.RIGHT_HAND_ITEM,
|
||||||
|
];
|
||||||
|
|
||||||
constructor(partSet: IFigurePartSet, partColors: IPartColor[], useColors: boolean = true, isDisabled: boolean = false)
|
private _renderManager: IAvatarRenderManager;
|
||||||
{
|
private _partSet: IFigurePartSet;
|
||||||
this._renderManager = GetAvatarRenderManager();
|
private _partColors: IPartColor[];
|
||||||
this._partSet = partSet;
|
private _useColors: boolean;
|
||||||
this._partColors = partColors;
|
private _isDisabled: boolean;
|
||||||
this._useColors = useColors;
|
private _thumbContainer: NitroContainer;
|
||||||
this._isDisabled = isDisabled;
|
private _imageUrl: string;
|
||||||
this._thumbContainer = null;
|
private _maxColorIndex: number;
|
||||||
this._imageUrl = null;
|
private _isValidFigure: boolean;
|
||||||
this._maxColorIndex = 0;
|
private _isHC: boolean;
|
||||||
this._isValidFigure = false;
|
private _isSellable: boolean;
|
||||||
this._isHC = false;
|
private _isClear: boolean;
|
||||||
this._isSellable = false;
|
private _isSelected: boolean;
|
||||||
this._isClear = false;
|
private _disposed: boolean;
|
||||||
this._isSelected = false;
|
private _isInitalized: boolean;
|
||||||
this._disposed = false;
|
private _notifier: () => void;
|
||||||
this._isInitalized = false;
|
|
||||||
|
|
||||||
if(partSet)
|
constructor(partSet: IFigurePartSet, partColors: IPartColor[], useColors: boolean = true, isDisabled: boolean = false) {
|
||||||
{
|
this._renderManager = GetAvatarRenderManager();
|
||||||
const colors = partSet.parts;
|
this._partSet = partSet;
|
||||||
|
this._partColors = partColors;
|
||||||
|
this._useColors = useColors;
|
||||||
|
this._isDisabled = isDisabled;
|
||||||
|
this._thumbContainer = null;
|
||||||
|
this._imageUrl = null;
|
||||||
|
this._maxColorIndex = 0;
|
||||||
|
this._isValidFigure = false;
|
||||||
|
this._isHC = false;
|
||||||
|
this._isSellable = false;
|
||||||
|
this._isClear = false;
|
||||||
|
this._isSelected = false;
|
||||||
|
this._disposed = false;
|
||||||
|
this._isInitalized = false;
|
||||||
|
|
||||||
for(const color of colors) this._maxColorIndex = Math.max(this._maxColorIndex, color.colorLayerIndex);
|
if (partSet) {
|
||||||
|
const colors = partSet.parts;
|
||||||
|
|
||||||
|
for (const color of colors) this._maxColorIndex = Math.max(this._maxColorIndex, color.colorLayerIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(): void {
|
||||||
|
if (this._isInitalized) return;
|
||||||
|
|
||||||
|
this._isInitalized = true;
|
||||||
|
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public dispose(): void {
|
||||||
|
if (this._disposed) return;
|
||||||
|
|
||||||
|
this._renderManager = null;
|
||||||
|
this._partSet = null;
|
||||||
|
this._partColors = null;
|
||||||
|
this._imageUrl = null;
|
||||||
|
this._disposed = true;
|
||||||
|
this._isInitalized = false;
|
||||||
|
|
||||||
|
if (this._thumbContainer) {
|
||||||
|
this._thumbContainer.destroy();
|
||||||
|
|
||||||
|
this._thumbContainer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public update(): void {
|
||||||
|
this.updateThumbVisualization();
|
||||||
|
}
|
||||||
|
|
||||||
|
private analyzeFigure(): boolean {
|
||||||
|
if (!this._renderManager || !this._partSet || !this._partSet.parts || !this._partSet.parts.length) return false;
|
||||||
|
|
||||||
|
const figureContainer = this._renderManager.createFigureContainer(this.partSet.type + "-" + this.partSet.id);
|
||||||
|
|
||||||
|
if (!this._renderManager.isFigureContainerReady(figureContainer)) {
|
||||||
|
this._renderManager.downloadAvatarFigure(figureContainer, this);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isValidFigure = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private renderThumb(): NitroContainer {
|
||||||
|
if (!this._renderManager || !this._partSet) return null;
|
||||||
|
|
||||||
|
if (!this._isValidFigure) {
|
||||||
|
if (!this.analyzeFigure()) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parts = this._partSet.parts.concat().sort(this.sortByDrawOrder);
|
||||||
|
const container = new NitroContainer();
|
||||||
|
|
||||||
|
for (const part of parts) {
|
||||||
|
if (!part) continue;
|
||||||
|
|
||||||
|
let asset: IGraphicAsset = null;
|
||||||
|
let direction = 0;
|
||||||
|
let hasAsset = false;
|
||||||
|
|
||||||
|
while (!hasAsset && direction < AvatarEditorGridPartItem.THUMB_DIRECTIONS.length) {
|
||||||
|
const assetName =
|
||||||
|
FigureData.SCALE +
|
||||||
|
"_" +
|
||||||
|
FigureData.STD +
|
||||||
|
"_" +
|
||||||
|
part.type +
|
||||||
|
"_" +
|
||||||
|
part.id +
|
||||||
|
"_" +
|
||||||
|
AvatarEditorGridPartItem.THUMB_DIRECTIONS[direction] +
|
||||||
|
"_" +
|
||||||
|
FigureData.DEFAULT_FRAME;
|
||||||
|
|
||||||
|
asset = this._renderManager.getAssetByName(assetName);
|
||||||
|
|
||||||
|
if (asset && asset.texture) {
|
||||||
|
hasAsset = true;
|
||||||
|
} else {
|
||||||
|
direction++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasAsset) continue;
|
||||||
|
|
||||||
|
const x = asset.offsetX;
|
||||||
|
const y = asset.offsetY;
|
||||||
|
let partColor: IPartColor = null;
|
||||||
|
|
||||||
|
if (this._useColors && part.colorLayerIndex > 0) {
|
||||||
|
const color = this._partColors[part.colorLayerIndex - 1];
|
||||||
|
|
||||||
|
if (color) partColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sprite = new NitroSprite(asset.texture);
|
||||||
|
|
||||||
|
sprite.position.set(x, y);
|
||||||
|
|
||||||
|
if (partColor) sprite.tint = partColor.rgb;
|
||||||
|
|
||||||
|
container.addChild(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(): void
|
return container;
|
||||||
{
|
}
|
||||||
if(this._isInitalized) return;
|
|
||||||
|
|
||||||
this._isInitalized = true;
|
private updateThumbVisualization(): void {
|
||||||
|
if (!this._isInitalized) return;
|
||||||
|
|
||||||
this.update();
|
let container = this._thumbContainer;
|
||||||
|
|
||||||
|
if (!container) container = this.renderThumb();
|
||||||
|
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
if (this._partSet) {
|
||||||
|
this._isHC = this._partSet.clubLevel > 0;
|
||||||
|
this._isSellable = this._partSet.isSellable;
|
||||||
|
} else {
|
||||||
|
this._isHC = false;
|
||||||
|
this._isSellable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
if (this._isDisabled) this.setAlpha(container, 0.2);
|
||||||
{
|
|
||||||
if(this._disposed) return;
|
|
||||||
|
|
||||||
this._renderManager = null;
|
this._imageUrl = TextureUtils.generateImageUrl(container);
|
||||||
this._partSet = null;
|
|
||||||
this._partColors = null;
|
|
||||||
this._imageUrl = null;
|
|
||||||
this._disposed = true;
|
|
||||||
this._isInitalized = false;
|
|
||||||
|
|
||||||
if(this._thumbContainer)
|
if (this.notify) this.notify();
|
||||||
{
|
}
|
||||||
this._thumbContainer.destroy();
|
|
||||||
|
|
||||||
this._thumbContainer = null;
|
private setAlpha(container: NitroContainer, alpha: number): NitroContainer {
|
||||||
}
|
container.filters = [AvatarEditorGridPartItem.ALPHA_FILTER];
|
||||||
}
|
|
||||||
|
|
||||||
public update(): void
|
return container;
|
||||||
{
|
}
|
||||||
this.updateThumbVisualization();
|
|
||||||
}
|
|
||||||
|
|
||||||
private analyzeFigure(): boolean
|
private sortByDrawOrder(a: IFigurePart, b: IFigurePart): number {
|
||||||
{
|
const indexA = AvatarEditorGridPartItem.DRAW_ORDER.indexOf(a.type);
|
||||||
if(!this._renderManager || !this._partSet || !this._partSet.parts || !this._partSet.parts.length) return false;
|
const indexB = AvatarEditorGridPartItem.DRAW_ORDER.indexOf(b.type);
|
||||||
|
|
||||||
const figureContainer = this._renderManager.createFigureContainer(((this.partSet.type + '-') + this.partSet.id));
|
if (indexA < indexB) return -1;
|
||||||
|
|
||||||
if(!this._renderManager.isFigureContainerReady(figureContainer))
|
if (indexA > indexB) return 1;
|
||||||
{
|
|
||||||
this._renderManager.downloadAvatarFigure(figureContainer, this);
|
|
||||||
|
|
||||||
return false;
|
if (a.index < b.index) return -1;
|
||||||
}
|
|
||||||
|
|
||||||
this._isValidFigure = true;
|
if (a.index > b.index) return 1;
|
||||||
|
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderThumb(): NitroContainer
|
public resetFigure(figure: string): void {
|
||||||
{
|
if (!this.analyzeFigure()) return;
|
||||||
if(!this._renderManager || !this._partSet) return null;
|
|
||||||
|
|
||||||
if(!this._isValidFigure)
|
this.update();
|
||||||
{
|
}
|
||||||
if(!this.analyzeFigure()) return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const parts = this._partSet.parts.concat().sort(this.sortByDrawOrder);
|
public get disposed(): boolean {
|
||||||
const container = new NitroContainer();
|
return this._disposed;
|
||||||
|
}
|
||||||
|
|
||||||
for(const part of parts)
|
public get id(): number {
|
||||||
{
|
if (!this._partSet) return -1;
|
||||||
if(!part) continue;
|
|
||||||
|
|
||||||
let asset: IGraphicAsset = null;
|
return this._partSet.id;
|
||||||
let direction = 0;
|
}
|
||||||
let hasAsset = false;
|
|
||||||
|
|
||||||
while(!hasAsset && (direction < AvatarEditorGridPartItem.THUMB_DIRECTIONS.length))
|
public get partSet(): IFigurePartSet {
|
||||||
{
|
return this._partSet;
|
||||||
const assetName = ((((((((((FigureData.SCALE + '_') + FigureData.STD) + '_') + part.type) + '_') + part.id) + '_') + AvatarEditorGridPartItem.THUMB_DIRECTIONS[direction]) + '_') + FigureData.DEFAULT_FRAME);
|
}
|
||||||
|
|
||||||
asset = this._renderManager.getAssetByName(assetName);
|
public set partColors(partColors: IPartColor[]) {
|
||||||
|
this._partColors = partColors;
|
||||||
|
|
||||||
if(asset && asset.texture)
|
this.update();
|
||||||
{
|
}
|
||||||
hasAsset = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
direction++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!hasAsset) continue;
|
public get isDisabled(): boolean {
|
||||||
|
return this._isDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
const x = asset.offsetX;
|
public set thumbContainer(container: NitroContainer) {
|
||||||
const y = asset.offsetY;
|
this._thumbContainer = container;
|
||||||
let partColor: IPartColor = null;
|
|
||||||
|
|
||||||
if(this._useColors && (part.colorLayerIndex > 0))
|
this.update();
|
||||||
{
|
}
|
||||||
const color = this._partColors[(part.colorLayerIndex - 1)];
|
|
||||||
|
|
||||||
if(color) partColor = color;
|
public get imageUrl(): string {
|
||||||
}
|
return this._imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
const sprite = new NitroSprite(asset.texture);
|
public get maxColorIndex(): number {
|
||||||
|
return this._maxColorIndex;
|
||||||
|
}
|
||||||
|
|
||||||
sprite.position.set(x, y);
|
public get isHC(): boolean {
|
||||||
|
return this._isHC;
|
||||||
|
}
|
||||||
|
|
||||||
if(partColor) sprite.tint = partColor.rgb;
|
public get isSellable(): boolean {
|
||||||
|
return this._isSellable;
|
||||||
|
}
|
||||||
|
|
||||||
container.addChild(sprite);
|
public get isClear(): boolean {
|
||||||
}
|
return this._isClear;
|
||||||
|
}
|
||||||
|
|
||||||
return container;
|
public set isClear(flag: boolean) {
|
||||||
}
|
this._isClear = flag;
|
||||||
|
}
|
||||||
|
|
||||||
private updateThumbVisualization(): void
|
public get isSelected(): boolean {
|
||||||
{
|
return this._isSelected;
|
||||||
if(!this._isInitalized) return;
|
}
|
||||||
|
|
||||||
let container = this._thumbContainer;
|
public set isSelected(flag: boolean) {
|
||||||
|
this._isSelected = flag;
|
||||||
|
|
||||||
if(!container) container = this.renderThumb();
|
if (this.notify) this.notify();
|
||||||
|
}
|
||||||
|
|
||||||
if(!container) return;
|
public get notify(): () => void {
|
||||||
|
return this._notifier;
|
||||||
|
}
|
||||||
|
|
||||||
if(this._partSet)
|
public set notify(notifier: () => void) {
|
||||||
{
|
this._notifier = notifier;
|
||||||
this._isHC = (this._partSet.clubLevel > 0);
|
}
|
||||||
this._isSellable = this._partSet.isSellable;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this._isHC = false;
|
|
||||||
this._isSellable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this._isDisabled) this.setAlpha(container, 0.2);
|
|
||||||
|
|
||||||
this._imageUrl = TextureUtils.generateImageUrl(container);
|
|
||||||
|
|
||||||
if(this.notify) this.notify();
|
|
||||||
}
|
|
||||||
|
|
||||||
private setAlpha(container: NitroContainer, alpha: number): NitroContainer
|
|
||||||
{
|
|
||||||
container.filters = [ AvatarEditorGridPartItem.ALPHA_FILTER ];
|
|
||||||
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
|
|
||||||
private sortByDrawOrder(a: IFigurePart, b: IFigurePart): number
|
|
||||||
{
|
|
||||||
const indexA = AvatarEditorGridPartItem.DRAW_ORDER.indexOf(a.type);
|
|
||||||
const indexB = AvatarEditorGridPartItem.DRAW_ORDER.indexOf(b.type);
|
|
||||||
|
|
||||||
if(indexA < indexB) return -1;
|
|
||||||
|
|
||||||
if(indexA > indexB) return 1;
|
|
||||||
|
|
||||||
if(a.index < b.index) return -1;
|
|
||||||
|
|
||||||
if(a.index > b.index) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public resetFigure(figure: string): void
|
|
||||||
{
|
|
||||||
if(!this.analyzeFigure()) return;
|
|
||||||
|
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public get disposed(): boolean
|
|
||||||
{
|
|
||||||
return this._disposed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get id(): number
|
|
||||||
{
|
|
||||||
if(!this._partSet) return -1;
|
|
||||||
|
|
||||||
return this._partSet.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get partSet(): IFigurePartSet
|
|
||||||
{
|
|
||||||
return this._partSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set partColors(partColors: IPartColor[])
|
|
||||||
{
|
|
||||||
this._partColors = partColors;
|
|
||||||
|
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isDisabled(): boolean
|
|
||||||
{
|
|
||||||
return this._isDisabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set thumbContainer(container: NitroContainer)
|
|
||||||
{
|
|
||||||
this._thumbContainer = container;
|
|
||||||
|
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
public get imageUrl(): string
|
|
||||||
{
|
|
||||||
return this._imageUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get maxColorIndex(): number
|
|
||||||
{
|
|
||||||
return this._maxColorIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isHC(): boolean
|
|
||||||
{
|
|
||||||
return this._isHC;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isSellable(): boolean
|
|
||||||
{
|
|
||||||
return this._isSellable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isClear(): boolean
|
|
||||||
{
|
|
||||||
return this._isClear;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set isClear(flag: boolean)
|
|
||||||
{
|
|
||||||
this._isClear = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isSelected(): boolean
|
|
||||||
{
|
|
||||||
return this._isSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set isSelected(flag: boolean)
|
|
||||||
{
|
|
||||||
this._isSelected = flag;
|
|
||||||
|
|
||||||
if(this.notify) this.notify();
|
|
||||||
}
|
|
||||||
|
|
||||||
public get notify(): () => void
|
|
||||||
{
|
|
||||||
return this._notifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set notify(notifier: () => void)
|
|
||||||
{
|
|
||||||
this._notifier = notifier;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,277 +1,249 @@
|
||||||
import { IPartColor } from '@nitro/renderer';
|
import {IPartColor} from "@nitro/renderer";
|
||||||
import { GetAvatarPalette, GetAvatarRenderManager, GetAvatarSetType, GetClubMemberLevel, GetConfiguration } from '../nitro';
|
|
||||||
import { AvatarEditorGridColorItem } from './AvatarEditorGridColorItem';
|
|
||||||
import { AvatarEditorGridPartItem } from './AvatarEditorGridPartItem';
|
|
||||||
import { CategoryBaseModel } from './CategoryBaseModel';
|
|
||||||
import { CategoryData } from './CategoryData';
|
|
||||||
import { FigureData } from './FigureData';
|
|
||||||
|
|
||||||
export class AvatarEditorUtilities
|
import {GetAvatarPalette, GetAvatarRenderManager, GetAvatarSetType, GetClubMemberLevel, GetConfiguration} from "../nitro";
|
||||||
{
|
import {AvatarEditorGridColorItem} from "./AvatarEditorGridColorItem";
|
||||||
private static MAX_PALETTES: number = 2;
|
import {AvatarEditorGridPartItem} from "./AvatarEditorGridPartItem";
|
||||||
|
import {CategoryBaseModel} from "./CategoryBaseModel";
|
||||||
|
import {CategoryData} from "./CategoryData";
|
||||||
|
import {FigureData} from "./FigureData";
|
||||||
|
|
||||||
public static CURRENT_FIGURE: FigureData = null;
|
export class AvatarEditorUtilities {
|
||||||
public static FIGURE_SET_IDS: number[] = [];
|
private static MAX_PALETTES: number = 2;
|
||||||
public static BOUND_FURNITURE_NAMES: string[] = [];
|
|
||||||
|
|
||||||
public static getGender(gender: string): string
|
public static CURRENT_FIGURE: FigureData = null;
|
||||||
{
|
public static FIGURE_SET_IDS: number[] = [];
|
||||||
switch(gender)
|
public static BOUND_FURNITURE_NAMES: string[] = [];
|
||||||
{
|
|
||||||
case FigureData.MALE:
|
|
||||||
case 'm':
|
|
||||||
case 'M':
|
|
||||||
gender = FigureData.MALE;
|
|
||||||
break;
|
|
||||||
case FigureData.FEMALE:
|
|
||||||
case 'f':
|
|
||||||
case 'F':
|
|
||||||
gender = FigureData.FEMALE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
gender = FigureData.MALE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return gender;
|
public static getGender(gender: string): string {
|
||||||
|
switch (gender) {
|
||||||
|
case FigureData.MALE:
|
||||||
|
case "m":
|
||||||
|
case "M":
|
||||||
|
gender = FigureData.MALE;
|
||||||
|
break;
|
||||||
|
case FigureData.FEMALE:
|
||||||
|
case "f":
|
||||||
|
case "F":
|
||||||
|
gender = FigureData.FEMALE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gender = FigureData.MALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static hasFigureSetId(setId: number): boolean
|
return gender;
|
||||||
{
|
}
|
||||||
return (this.FIGURE_SET_IDS.indexOf(setId) >= 0);
|
|
||||||
|
public static hasFigureSetId(setId: number): boolean {
|
||||||
|
return this.FIGURE_SET_IDS.indexOf(setId) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static createCategory(model: CategoryBaseModel, name: string): CategoryData {
|
||||||
|
if (!model || !name || !this.CURRENT_FIGURE) return null;
|
||||||
|
|
||||||
|
const partItems: AvatarEditorGridPartItem[] = [];
|
||||||
|
const colorItems: AvatarEditorGridColorItem[][] = [];
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < this.MAX_PALETTES) {
|
||||||
|
colorItems.push([]);
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createCategory(model: CategoryBaseModel, name: string): CategoryData
|
const setType = GetAvatarSetType(name);
|
||||||
{
|
|
||||||
if(!model || !name || !this.CURRENT_FIGURE) return null;
|
|
||||||
|
|
||||||
const partItems: AvatarEditorGridPartItem[] = [];
|
if (!setType) return null;
|
||||||
const colorItems: AvatarEditorGridColorItem[][] = [];
|
|
||||||
|
|
||||||
|
const palette = GetAvatarPalette(setType.paletteID);
|
||||||
|
|
||||||
|
if (!palette) return null;
|
||||||
|
|
||||||
|
let colorIds = this.CURRENT_FIGURE.getColorIds(name);
|
||||||
|
|
||||||
|
if (!colorIds) colorIds = [];
|
||||||
|
|
||||||
|
const partColors: IPartColor[] = new Array(colorIds.length);
|
||||||
|
const clubItemsDimmed = this.clubItemsDimmed;
|
||||||
|
const clubMemberLevel = GetClubMemberLevel();
|
||||||
|
|
||||||
|
for (const partColor of palette.colors.getValues()) {
|
||||||
|
if (partColor.isSelectable && (clubItemsDimmed || clubMemberLevel >= partColor.clubLevel)) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
while(i < this.MAX_PALETTES)
|
while (i < this.MAX_PALETTES) {
|
||||||
{
|
const isDisabled = clubMemberLevel < partColor.clubLevel;
|
||||||
colorItems.push([]);
|
const colorItem = new AvatarEditorGridColorItem(partColor, isDisabled);
|
||||||
|
|
||||||
|
colorItems[i].push(colorItem);
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name !== FigureData.FACE) {
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < colorIds.length) {
|
||||||
|
if (partColor.id === colorIds[i]) partColors[i] = partColor;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
const setType = GetAvatarSetType(name);
|
|
||||||
|
|
||||||
if(!setType) return null;
|
|
||||||
|
|
||||||
const palette = GetAvatarPalette(setType.paletteID);
|
|
||||||
|
|
||||||
if(!palette) return null;
|
|
||||||
|
|
||||||
let colorIds = this.CURRENT_FIGURE.getColorIds(name);
|
|
||||||
|
|
||||||
if(!colorIds) colorIds = [];
|
|
||||||
|
|
||||||
const partColors: IPartColor[] = new Array(colorIds.length);
|
|
||||||
const clubItemsDimmed = this.clubItemsDimmed;
|
|
||||||
const clubMemberLevel = GetClubMemberLevel();
|
|
||||||
|
|
||||||
for(const partColor of palette.colors.getValues())
|
|
||||||
{
|
|
||||||
if(partColor.isSelectable && (clubItemsDimmed || (clubMemberLevel >= partColor.clubLevel)))
|
|
||||||
{
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < this.MAX_PALETTES)
|
|
||||||
{
|
|
||||||
const isDisabled = (clubMemberLevel < partColor.clubLevel);
|
|
||||||
const colorItem = new AvatarEditorGridColorItem(partColor, isDisabled);
|
|
||||||
|
|
||||||
colorItems[i].push(colorItem);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(name !== FigureData.FACE)
|
|
||||||
{
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < colorIds.length)
|
|
||||||
{
|
|
||||||
if(partColor.id === colorIds[i]) partColors[i] = partColor;
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mandatorySetIds: string[] = [];
|
|
||||||
|
|
||||||
if(clubItemsDimmed)
|
|
||||||
{
|
|
||||||
mandatorySetIds = GetAvatarRenderManager().getMandatoryAvatarPartSetIds(this.CURRENT_FIGURE.gender, 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mandatorySetIds = GetAvatarRenderManager().getMandatoryAvatarPartSetIds(this.CURRENT_FIGURE.gender, clubMemberLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
const isntMandatorySet = (mandatorySetIds.indexOf(name) === -1);
|
|
||||||
|
|
||||||
if(isntMandatorySet)
|
|
||||||
{
|
|
||||||
const partItem = new AvatarEditorGridPartItem(null, null, false);
|
|
||||||
|
|
||||||
partItem.isClear = true;
|
|
||||||
|
|
||||||
partItems.push(partItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
const usesColors = (name !== FigureData.FACE);
|
|
||||||
const partSets = setType.partSets;
|
|
||||||
const totalPartSets = partSets.length;
|
|
||||||
|
|
||||||
i = (totalPartSets - 1);
|
|
||||||
|
|
||||||
while(i >= 0)
|
|
||||||
{
|
|
||||||
const partSet = partSets.getWithIndex(i);
|
|
||||||
|
|
||||||
let isValidGender = false;
|
|
||||||
|
|
||||||
if(partSet.gender === FigureData.UNISEX)
|
|
||||||
{
|
|
||||||
isValidGender = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(partSet.gender === this.CURRENT_FIGURE.gender)
|
|
||||||
{
|
|
||||||
isValidGender = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(partSet.isSelectable && isValidGender && (clubItemsDimmed || (clubMemberLevel >= partSet.clubLevel)))
|
|
||||||
{
|
|
||||||
const isDisabled = (clubMemberLevel < partSet.clubLevel);
|
|
||||||
|
|
||||||
let isValid = true;
|
|
||||||
|
|
||||||
if(partSet.isSellable) isValid = this.hasFigureSetId(partSet.id);
|
|
||||||
|
|
||||||
if(isValid) partItems.push(new AvatarEditorGridPartItem(partSet, partColors, usesColors, isDisabled));
|
|
||||||
}
|
|
||||||
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
|
|
||||||
partItems.sort(this.clubItemsFirst ? this.clubSorter : this.noobSorter);
|
|
||||||
|
|
||||||
// if(this._forceSellableClothingVisibility || GetNitroInstance().getConfiguration<boolean>("avatareditor.support.sellablefurni", false))
|
|
||||||
// {
|
|
||||||
// _local_31 = (this._manager.windowManager.assets.getAssetByName("camera_zoom_in") as BitmapDataAsset);
|
|
||||||
// _local_32 = (_local_31.content as BitmapData).clone();
|
|
||||||
// _local_33 = (AvatarEditorView._Str_6802.clone() as IWindowContainer);
|
|
||||||
// _local_33.name = AvatarEditorGridView.GET_MORE;
|
|
||||||
// _local_7 = new AvatarEditorGridPartItem(_local_33, k, null, null, false);
|
|
||||||
// _local_7._Str_3093 = _local_32;
|
|
||||||
// _local_3.push(_local_7);
|
|
||||||
// }
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
while(i < this.MAX_PALETTES)
|
|
||||||
{
|
|
||||||
colorItems[i].sort(this.colorSorter);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CategoryData(name, partItems, colorItems);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static clubSorter(a: AvatarEditorGridPartItem, b: AvatarEditorGridPartItem): number
|
let mandatorySetIds: string[] = [];
|
||||||
{
|
|
||||||
const clubLevelA = (!a.partSet ? 9999999999 : a.partSet.clubLevel);
|
|
||||||
const clubLevelB = (!b.partSet ? 9999999999 : b.partSet.clubLevel);
|
|
||||||
const isSellableA = (!a.partSet ? false : a.partSet.isSellable);
|
|
||||||
const isSellableB = (!b.partSet ? false : b.partSet.isSellable);
|
|
||||||
|
|
||||||
if(isSellableA && !isSellableB) return 1;
|
if (clubItemsDimmed) {
|
||||||
|
mandatorySetIds = GetAvatarRenderManager().getMandatoryAvatarPartSetIds(this.CURRENT_FIGURE.gender, 2);
|
||||||
if(isSellableB && !isSellableA) return -1;
|
} else {
|
||||||
|
mandatorySetIds = GetAvatarRenderManager().getMandatoryAvatarPartSetIds(this.CURRENT_FIGURE.gender, clubMemberLevel);
|
||||||
if(clubLevelA > clubLevelB) return -1;
|
|
||||||
|
|
||||||
if(clubLevelA < clubLevelB) return 1;
|
|
||||||
|
|
||||||
if(a.partSet.id > b.partSet.id) return -1;
|
|
||||||
|
|
||||||
if(a.partSet.id < b.partSet.id) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static colorSorter(a: AvatarEditorGridColorItem, b: AvatarEditorGridColorItem): number
|
const isntMandatorySet = mandatorySetIds.indexOf(name) === -1;
|
||||||
{
|
|
||||||
const clubLevelA = (!a.partColor ? -1 : a.partColor.clubLevel);
|
|
||||||
const clubLevelB = (!b.partColor ? -1 : b.partColor.clubLevel);
|
|
||||||
|
|
||||||
if(clubLevelA < clubLevelB) return -1;
|
if (isntMandatorySet) {
|
||||||
|
const partItem = new AvatarEditorGridPartItem(null, null, false);
|
||||||
|
|
||||||
if(clubLevelA > clubLevelB) return 1;
|
partItem.isClear = true;
|
||||||
|
|
||||||
if(a.partColor.index < b.partColor.index) return -1;
|
partItems.push(partItem);
|
||||||
|
|
||||||
if(a.partColor.index > b.partColor.index) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static noobSorter(a: AvatarEditorGridPartItem, b: AvatarEditorGridPartItem): number
|
const usesColors = name !== FigureData.FACE;
|
||||||
{
|
const partSets = setType.partSets;
|
||||||
const clubLevelA = (!a.partSet ? -1 : a.partSet.clubLevel);
|
const totalPartSets = partSets.length;
|
||||||
const clubLevelB = (!b.partSet ? -1 : b.partSet.clubLevel);
|
|
||||||
const isSellableA = (!a.partSet ? false : a.partSet.isSellable);
|
|
||||||
const isSellableB = (!b.partSet ? false : b.partSet.isSellable);
|
|
||||||
|
|
||||||
if(isSellableA && !isSellableB) return 1;
|
i = totalPartSets - 1;
|
||||||
|
|
||||||
if(isSellableB && !isSellableA) return -1;
|
while (i >= 0) {
|
||||||
|
const partSet = partSets.getWithIndex(i);
|
||||||
|
|
||||||
if(clubLevelA < clubLevelB) return -1;
|
let isValidGender = false;
|
||||||
|
|
||||||
if(clubLevelA > clubLevelB) return 1;
|
if (partSet.gender === FigureData.UNISEX) {
|
||||||
|
isValidGender = true;
|
||||||
|
} else if (partSet.gender === this.CURRENT_FIGURE.gender) {
|
||||||
|
isValidGender = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(a.partSet.id < b.partSet.id) return -1;
|
if (partSet.isSelectable && isValidGender && (clubItemsDimmed || clubMemberLevel >= partSet.clubLevel)) {
|
||||||
|
const isDisabled = clubMemberLevel < partSet.clubLevel;
|
||||||
|
|
||||||
if(a.partSet.id > b.partSet.id) return 1;
|
let isValid = true;
|
||||||
|
|
||||||
return 0;
|
if (partSet.isSellable) isValid = this.hasFigureSetId(partSet.id);
|
||||||
|
|
||||||
|
if (isValid) partItems.push(new AvatarEditorGridPartItem(partSet, partColors, usesColors, isDisabled));
|
||||||
|
}
|
||||||
|
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static avatarSetFirstSelectableColor(name: string): number
|
partItems.sort(this.clubItemsFirst ? this.clubSorter : this.noobSorter);
|
||||||
{
|
|
||||||
const setType = GetAvatarSetType(name);
|
|
||||||
|
|
||||||
if(!setType) return -1;
|
// if(this._forceSellableClothingVisibility || GetNitroInstance().getConfiguration<boolean>("avatareditor.support.sellablefurni", false))
|
||||||
|
// {
|
||||||
|
// _local_31 = (this._manager.windowManager.assets.getAssetByName("camera_zoom_in") as BitmapDataAsset);
|
||||||
|
// _local_32 = (_local_31.content as BitmapData).clone();
|
||||||
|
// _local_33 = (AvatarEditorView._Str_6802.clone() as IWindowContainer);
|
||||||
|
// _local_33.name = AvatarEditorGridView.GET_MORE;
|
||||||
|
// _local_7 = new AvatarEditorGridPartItem(_local_33, k, null, null, false);
|
||||||
|
// _local_7._Str_3093 = _local_32;
|
||||||
|
// _local_3.push(_local_7);
|
||||||
|
// }
|
||||||
|
|
||||||
const palette = GetAvatarPalette(setType.paletteID);
|
i = 0;
|
||||||
|
|
||||||
if(!palette) return -1;
|
while (i < this.MAX_PALETTES) {
|
||||||
|
colorItems[i].sort(this.colorSorter);
|
||||||
|
|
||||||
for(const color of palette.colors.getValues())
|
i++;
|
||||||
{
|
|
||||||
if(!color.isSelectable || (GetClubMemberLevel() < color.clubLevel)) continue;
|
|
||||||
|
|
||||||
return color.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get clubItemsFirst(): boolean
|
return new CategoryData(name, partItems, colorItems);
|
||||||
{
|
}
|
||||||
return GetConfiguration<boolean>('avatareditor.show.clubitems.first', true);
|
|
||||||
|
public static clubSorter(a: AvatarEditorGridPartItem, b: AvatarEditorGridPartItem): number {
|
||||||
|
const clubLevelA = !a.partSet ? 9999999999 : a.partSet.clubLevel;
|
||||||
|
const clubLevelB = !b.partSet ? 9999999999 : b.partSet.clubLevel;
|
||||||
|
const isSellableA = !a.partSet ? false : a.partSet.isSellable;
|
||||||
|
const isSellableB = !b.partSet ? false : b.partSet.isSellable;
|
||||||
|
|
||||||
|
if (isSellableA && !isSellableB) return 1;
|
||||||
|
|
||||||
|
if (isSellableB && !isSellableA) return -1;
|
||||||
|
|
||||||
|
if (clubLevelA > clubLevelB) return -1;
|
||||||
|
|
||||||
|
if (clubLevelA < clubLevelB) return 1;
|
||||||
|
|
||||||
|
if (a.partSet.id > b.partSet.id) return -1;
|
||||||
|
|
||||||
|
if (a.partSet.id < b.partSet.id) return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static colorSorter(a: AvatarEditorGridColorItem, b: AvatarEditorGridColorItem): number {
|
||||||
|
const clubLevelA = !a.partColor ? -1 : a.partColor.clubLevel;
|
||||||
|
const clubLevelB = !b.partColor ? -1 : b.partColor.clubLevel;
|
||||||
|
|
||||||
|
if (clubLevelA < clubLevelB) return -1;
|
||||||
|
|
||||||
|
if (clubLevelA > clubLevelB) return 1;
|
||||||
|
|
||||||
|
if (a.partColor.index < b.partColor.index) return -1;
|
||||||
|
|
||||||
|
if (a.partColor.index > b.partColor.index) return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static noobSorter(a: AvatarEditorGridPartItem, b: AvatarEditorGridPartItem): number {
|
||||||
|
const clubLevelA = !a.partSet ? -1 : a.partSet.clubLevel;
|
||||||
|
const clubLevelB = !b.partSet ? -1 : b.partSet.clubLevel;
|
||||||
|
const isSellableA = !a.partSet ? false : a.partSet.isSellable;
|
||||||
|
const isSellableB = !b.partSet ? false : b.partSet.isSellable;
|
||||||
|
|
||||||
|
if (isSellableA && !isSellableB) return 1;
|
||||||
|
|
||||||
|
if (isSellableB && !isSellableA) return -1;
|
||||||
|
|
||||||
|
if (clubLevelA < clubLevelB) return -1;
|
||||||
|
|
||||||
|
if (clubLevelA > clubLevelB) return 1;
|
||||||
|
|
||||||
|
if (a.partSet.id < b.partSet.id) return -1;
|
||||||
|
|
||||||
|
if (a.partSet.id > b.partSet.id) return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static avatarSetFirstSelectableColor(name: string): number {
|
||||||
|
const setType = GetAvatarSetType(name);
|
||||||
|
|
||||||
|
if (!setType) return -1;
|
||||||
|
|
||||||
|
const palette = GetAvatarPalette(setType.paletteID);
|
||||||
|
|
||||||
|
if (!palette) return -1;
|
||||||
|
|
||||||
|
for (const color of palette.colors.getValues()) {
|
||||||
|
if (!color.isSelectable || GetClubMemberLevel() < color.clubLevel) continue;
|
||||||
|
|
||||||
|
return color.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get clubItemsDimmed(): boolean
|
return -1;
|
||||||
{
|
}
|
||||||
return GetConfiguration<boolean>('avatareditor.show.clubitems.dimmed', true);
|
|
||||||
}
|
public static get clubItemsFirst(): boolean {
|
||||||
|
return GetConfiguration<boolean>("avatareditor.show.clubitems.first", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static get clubItemsDimmed(): boolean {
|
||||||
|
return GetConfiguration<boolean>("avatareditor.show.clubitems.dimmed", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,76 +1,72 @@
|
||||||
import { AvatarEditorFigureCategory, AvatarScaleType, AvatarSetType } from '@nitro/renderer';
|
import {AvatarEditorFigureCategory, AvatarScaleType, AvatarSetType} from "@nitro/renderer";
|
||||||
import { GetAvatarRenderManager } from '../nitro';
|
|
||||||
import { AvatarEditorUtilities } from './AvatarEditorUtilities';
|
|
||||||
import { CategoryBaseModel } from './CategoryBaseModel';
|
|
||||||
import { FigureData } from './FigureData';
|
|
||||||
|
|
||||||
export class BodyModel extends CategoryBaseModel
|
import {GetAvatarRenderManager} from "../nitro";
|
||||||
{
|
import {AvatarEditorUtilities} from "./AvatarEditorUtilities";
|
||||||
private _imageCallBackHandled: boolean = false;
|
import {CategoryBaseModel} from "./CategoryBaseModel";
|
||||||
|
import {FigureData} from "./FigureData";
|
||||||
|
|
||||||
public init(): void
|
export class BodyModel extends CategoryBaseModel {
|
||||||
{
|
private _imageCallBackHandled: boolean = false;
|
||||||
super.init();
|
|
||||||
|
|
||||||
this.addCategory(FigureData.FACE);
|
public init(): void {
|
||||||
|
super.init();
|
||||||
|
|
||||||
this._isInitalized = true;
|
this.addCategory(FigureData.FACE);
|
||||||
}
|
|
||||||
|
|
||||||
public selectColor(category: string, colorIndex: number, paletteId: number): void
|
this._isInitalized = true;
|
||||||
{
|
}
|
||||||
super.selectColor(category, colorIndex, paletteId);
|
|
||||||
|
|
||||||
this.updateSelectionsFromFigure(FigureData.FACE);
|
public selectColor(category: string, colorIndex: number, paletteId: number): void {
|
||||||
}
|
super.selectColor(category, colorIndex, paletteId);
|
||||||
|
|
||||||
protected updateSelectionsFromFigure(name: string): void
|
this.updateSelectionsFromFigure(FigureData.FACE);
|
||||||
{
|
}
|
||||||
if(!this._categories || !AvatarEditorUtilities.CURRENT_FIGURE) return;
|
|
||||||
|
|
||||||
const category = this._categories.get(name);
|
protected updateSelectionsFromFigure(name: string): void {
|
||||||
|
if (!this._categories || !AvatarEditorUtilities.CURRENT_FIGURE) return;
|
||||||
|
|
||||||
if(!category) return;
|
const category = this._categories.get(name);
|
||||||
|
|
||||||
const setId = AvatarEditorUtilities.CURRENT_FIGURE.getPartSetId(name);
|
if (!category) return;
|
||||||
|
|
||||||
let colorIds = AvatarEditorUtilities.CURRENT_FIGURE.getColorIds(name);
|
const setId = AvatarEditorUtilities.CURRENT_FIGURE.getPartSetId(name);
|
||||||
|
|
||||||
if(!colorIds) colorIds = [];
|
let colorIds = AvatarEditorUtilities.CURRENT_FIGURE.getColorIds(name);
|
||||||
|
|
||||||
category.selectPartId(setId);
|
if (!colorIds) colorIds = [];
|
||||||
category.selectColorIds(colorIds);
|
|
||||||
|
|
||||||
for(const part of category.parts)
|
category.selectPartId(setId);
|
||||||
{
|
category.selectColorIds(colorIds);
|
||||||
const resetFigure = (figure: string) =>
|
|
||||||
{
|
|
||||||
const figureString = AvatarEditorUtilities.CURRENT_FIGURE.getFigureStringWithFace(part.id);
|
|
||||||
const avatarImage = GetAvatarRenderManager().createAvatarImage(figureString, AvatarScaleType.LARGE, null, { resetFigure, dispose: null, disposed: false });
|
|
||||||
|
|
||||||
const sprite = avatarImage.getImageAsSprite(AvatarSetType.HEAD);
|
|
||||||
|
|
||||||
if(sprite)
|
|
||||||
{
|
|
||||||
sprite.y = 10;
|
|
||||||
|
|
||||||
part.thumbContainer = sprite;
|
|
||||||
|
|
||||||
setTimeout(() => avatarImage.dispose(), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resetFigure(null);
|
for (const part of category.parts) {
|
||||||
|
const resetFigure = (figure: string) => {
|
||||||
|
const figureString = AvatarEditorUtilities.CURRENT_FIGURE.getFigureStringWithFace(part.id);
|
||||||
|
const avatarImage = GetAvatarRenderManager().createAvatarImage(figureString, AvatarScaleType.LARGE, null, {
|
||||||
|
resetFigure,
|
||||||
|
dispose: null,
|
||||||
|
disposed: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const sprite = avatarImage.getImageAsSprite(AvatarSetType.HEAD);
|
||||||
|
|
||||||
|
if (sprite) {
|
||||||
|
sprite.y = 10;
|
||||||
|
|
||||||
|
part.thumbContainer = sprite;
|
||||||
|
|
||||||
|
setTimeout(() => avatarImage.dispose(), 0);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
public get canSetGender(): boolean
|
resetFigure(null);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public get name(): string
|
public get canSetGender(): boolean {
|
||||||
{
|
return true;
|
||||||
return AvatarEditorFigureCategory.GENERIC;
|
}
|
||||||
}
|
|
||||||
|
public get name(): string {
|
||||||
|
return AvatarEditorFigureCategory.GENERIC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,246 +1,215 @@
|
||||||
import { AvatarEditorUtilities } from './AvatarEditorUtilities';
|
import {AvatarEditorUtilities} from "./AvatarEditorUtilities";
|
||||||
import { CategoryData } from './CategoryData';
|
import {CategoryData} from "./CategoryData";
|
||||||
import { IAvatarEditorCategoryModel } from './IAvatarEditorCategoryModel';
|
import {IAvatarEditorCategoryModel} from "./IAvatarEditorCategoryModel";
|
||||||
|
|
||||||
export class CategoryBaseModel implements IAvatarEditorCategoryModel
|
export class CategoryBaseModel implements IAvatarEditorCategoryModel {
|
||||||
{
|
protected _categories: Map<string, CategoryData>;
|
||||||
protected _categories: Map<string, CategoryData>;
|
protected _isInitalized: boolean;
|
||||||
protected _isInitalized: boolean;
|
protected _maxPaletteCount: number;
|
||||||
protected _maxPaletteCount: number;
|
private _disposed: boolean;
|
||||||
private _disposed: boolean;
|
|
||||||
|
|
||||||
constructor()
|
constructor() {
|
||||||
{
|
this._isInitalized = false;
|
||||||
this._isInitalized = false;
|
this._maxPaletteCount = 0;
|
||||||
this._maxPaletteCount = 0;
|
}
|
||||||
|
|
||||||
|
public dispose(): void {
|
||||||
|
this._categories = null;
|
||||||
|
this._disposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get disposed(): boolean {
|
||||||
|
return this._disposed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(): void {
|
||||||
|
if (!this._categories) this._categories = new Map();
|
||||||
|
}
|
||||||
|
|
||||||
|
public reset(): void {
|
||||||
|
this._isInitalized = false;
|
||||||
|
|
||||||
|
if (this._categories) {
|
||||||
|
for (const category of this._categories.values()) category && category.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
this._categories = new Map();
|
||||||
{
|
}
|
||||||
this._categories = null;
|
|
||||||
this._disposed = true;
|
protected addCategory(name: string): void {
|
||||||
|
let existing = this._categories.get(name);
|
||||||
|
|
||||||
|
if (existing) return;
|
||||||
|
|
||||||
|
existing = AvatarEditorUtilities.createCategory(this, name);
|
||||||
|
|
||||||
|
if (!existing) return;
|
||||||
|
|
||||||
|
this._categories.set(name, existing);
|
||||||
|
|
||||||
|
this.updateSelectionsFromFigure(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected updateSelectionsFromFigure(figure: string): void {
|
||||||
|
const category = this._categories.get(figure);
|
||||||
|
|
||||||
|
if (!category) return;
|
||||||
|
|
||||||
|
const setId = AvatarEditorUtilities.CURRENT_FIGURE.getPartSetId(figure);
|
||||||
|
|
||||||
|
let colorIds = AvatarEditorUtilities.CURRENT_FIGURE.getColorIds(figure);
|
||||||
|
|
||||||
|
if (!colorIds) colorIds = [];
|
||||||
|
|
||||||
|
category.selectPartId(setId);
|
||||||
|
category.selectColorIds(colorIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public hasClubSelectionsOverLevel(level: number): boolean {
|
||||||
|
if (!this._categories) return false;
|
||||||
|
|
||||||
|
for (const category of this._categories.values()) {
|
||||||
|
if (!category) continue;
|
||||||
|
|
||||||
|
if (category.hasClubSelectionsOverLevel(level)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get disposed(): boolean
|
return false;
|
||||||
{
|
}
|
||||||
return this._disposed;
|
|
||||||
|
public hasInvalidSelectedItems(ownedItems: number[]): boolean {
|
||||||
|
if (!this._categories) return false;
|
||||||
|
|
||||||
|
for (const category of this._categories.values()) {
|
||||||
|
if (category.hasInvalidSelectedItems(ownedItems)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(): void
|
return false;
|
||||||
{
|
}
|
||||||
if(!this._categories) this._categories = new Map();
|
|
||||||
}
|
|
||||||
|
|
||||||
public reset(): void
|
public stripClubItemsOverLevel(level: number): boolean {
|
||||||
{
|
if (!this._categories) return false;
|
||||||
this._isInitalized = false;
|
|
||||||
|
|
||||||
if(this._categories)
|
let didStrip = false;
|
||||||
{
|
|
||||||
for(const category of this._categories.values()) (category && category.dispose());
|
for (const [name, category] of this._categories.entries()) {
|
||||||
|
let isValid = false;
|
||||||
|
|
||||||
|
if (category.stripClubItemsOverLevel(level)) isValid = true;
|
||||||
|
|
||||||
|
if (category.stripClubColorsOverLevel(level)) isValid = true;
|
||||||
|
|
||||||
|
if (isValid) {
|
||||||
|
const partItem = category.getCurrentPart();
|
||||||
|
|
||||||
|
if (partItem && AvatarEditorUtilities.CURRENT_FIGURE) {
|
||||||
|
AvatarEditorUtilities.CURRENT_FIGURE.savePartData(name, partItem.id, category.getSelectedColorIds(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._categories = new Map();
|
didStrip = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected addCategory(name: string): void
|
return didStrip;
|
||||||
{
|
}
|
||||||
let existing = this._categories.get(name);
|
|
||||||
|
|
||||||
if(existing) return;
|
public stripInvalidSellableItems(): boolean {
|
||||||
|
if (!this._categories) return false;
|
||||||
|
|
||||||
existing = AvatarEditorUtilities.createCategory(this, name);
|
let didStrip = false;
|
||||||
|
|
||||||
if(!existing) return;
|
for (const [name, category] of this._categories.entries()) {
|
||||||
|
const isValid = false;
|
||||||
|
|
||||||
this._categories.set(name, existing);
|
// if(category._Str_8360(this._Str_2278.manager.inventory)) _local_6 = true;
|
||||||
|
|
||||||
this.updateSelectionsFromFigure(name);
|
if (isValid) {
|
||||||
}
|
const partItem = category.getCurrentPart();
|
||||||
|
|
||||||
protected updateSelectionsFromFigure(figure: string): void
|
if (partItem && AvatarEditorUtilities.CURRENT_FIGURE) {
|
||||||
{
|
AvatarEditorUtilities.CURRENT_FIGURE.savePartData(name, partItem.id, category.getSelectedColorIds(), true);
|
||||||
const category = this._categories.get(figure);
|
|
||||||
|
|
||||||
if(!category) return;
|
|
||||||
|
|
||||||
const setId = AvatarEditorUtilities.CURRENT_FIGURE.getPartSetId(figure);
|
|
||||||
|
|
||||||
let colorIds = AvatarEditorUtilities.CURRENT_FIGURE.getColorIds(figure);
|
|
||||||
|
|
||||||
if(!colorIds) colorIds = [];
|
|
||||||
|
|
||||||
category.selectPartId(setId);
|
|
||||||
category.selectColorIds(colorIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public hasClubSelectionsOverLevel(level: number): boolean
|
|
||||||
{
|
|
||||||
if(!this._categories) return false;
|
|
||||||
|
|
||||||
for(const category of this._categories.values())
|
|
||||||
{
|
|
||||||
if(!category) continue;
|
|
||||||
|
|
||||||
if(category.hasClubSelectionsOverLevel(level)) return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
didStrip = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public hasInvalidSelectedItems(ownedItems: number[]): boolean
|
return didStrip;
|
||||||
{
|
}
|
||||||
if(!this._categories) return false;
|
|
||||||
|
|
||||||
for(const category of this._categories.values())
|
public selectPart(category: string, partIndex: number): void {
|
||||||
{
|
const categoryData = this._categories.get(category);
|
||||||
if(category.hasInvalidSelectedItems(ownedItems)) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
if (!categoryData) return;
|
||||||
|
|
||||||
|
const selectedPartIndex = categoryData.selectedPartIndex;
|
||||||
|
|
||||||
|
categoryData.selectPartIndex(partIndex);
|
||||||
|
|
||||||
|
const partItem = categoryData.getCurrentPart();
|
||||||
|
|
||||||
|
if (!partItem) return;
|
||||||
|
|
||||||
|
if (partItem.isDisabled) {
|
||||||
|
categoryData.selectPartIndex(selectedPartIndex);
|
||||||
|
|
||||||
|
// open hc window
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public stripClubItemsOverLevel(level: number): boolean
|
this._maxPaletteCount = partItem.maxColorIndex;
|
||||||
{
|
|
||||||
if(!this._categories) return false;
|
|
||||||
|
|
||||||
let didStrip = false;
|
AvatarEditorUtilities.CURRENT_FIGURE.savePartData(category, partItem.id, categoryData.getSelectedColorIds(), true);
|
||||||
|
}
|
||||||
|
|
||||||
for(const [ name, category ] of this._categories.entries())
|
public selectColor(category: string, colorIndex: number, paletteId: number): void {
|
||||||
{
|
const categoryData = this._categories.get(category);
|
||||||
let isValid = false;
|
|
||||||
|
|
||||||
if(category.stripClubItemsOverLevel(level)) isValid = true;
|
if (!categoryData) return;
|
||||||
|
|
||||||
if(category.stripClubColorsOverLevel(level)) isValid = true;
|
const paletteIndex = categoryData.getCurrentColorIndex(paletteId);
|
||||||
|
|
||||||
if(isValid)
|
categoryData.selectColorIndex(colorIndex, paletteId);
|
||||||
{
|
|
||||||
const partItem = category.getCurrentPart();
|
|
||||||
|
|
||||||
if(partItem && AvatarEditorUtilities.CURRENT_FIGURE)
|
const colorItem = categoryData.getSelectedColor(paletteId);
|
||||||
{
|
|
||||||
AvatarEditorUtilities.CURRENT_FIGURE.savePartData(name, partItem.id, category.getSelectedColorIds(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
didStrip = true;
|
if (colorItem.isDisabled) {
|
||||||
}
|
categoryData.selectColorIndex(paletteIndex, paletteId);
|
||||||
}
|
|
||||||
|
|
||||||
return didStrip;
|
// open hc window
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public stripInvalidSellableItems(): boolean
|
AvatarEditorUtilities.CURRENT_FIGURE.savePartSetColourId(category, categoryData.getSelectedColorIds(), true);
|
||||||
{
|
}
|
||||||
if(!this._categories) return false;
|
|
||||||
|
|
||||||
let didStrip = false;
|
public getCategoryData(category: string): CategoryData {
|
||||||
|
if (!this._isInitalized) this.init();
|
||||||
|
|
||||||
for(const [ name, category ] of this._categories.entries())
|
if (!this._categories) return null;
|
||||||
{
|
|
||||||
const isValid = false;
|
|
||||||
|
|
||||||
// if(category._Str_8360(this._Str_2278.manager.inventory)) _local_6 = true;
|
return this._categories.get(category);
|
||||||
|
}
|
||||||
|
|
||||||
if(isValid)
|
public get categories(): Map<string, CategoryData> {
|
||||||
{
|
return this._categories;
|
||||||
const partItem = category.getCurrentPart();
|
}
|
||||||
|
|
||||||
if(partItem && AvatarEditorUtilities.CURRENT_FIGURE)
|
public get canSetGender(): boolean {
|
||||||
{
|
return false;
|
||||||
AvatarEditorUtilities.CURRENT_FIGURE.savePartData(name, partItem.id, category.getSelectedColorIds(), true);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
didStrip = true;
|
public get maxPaletteCount(): number {
|
||||||
}
|
return this._maxPaletteCount || 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return didStrip;
|
public set maxPaletteCount(count: number) {
|
||||||
}
|
this._maxPaletteCount = count;
|
||||||
|
}
|
||||||
|
|
||||||
public selectPart(category: string, partIndex: number): void
|
public get name(): string {
|
||||||
{
|
return null;
|
||||||
const categoryData = this._categories.get(category);
|
}
|
||||||
|
|
||||||
if(!categoryData) return;
|
|
||||||
|
|
||||||
const selectedPartIndex = categoryData.selectedPartIndex;
|
|
||||||
|
|
||||||
categoryData.selectPartIndex(partIndex);
|
|
||||||
|
|
||||||
const partItem = categoryData.getCurrentPart();
|
|
||||||
|
|
||||||
if(!partItem) return;
|
|
||||||
|
|
||||||
if(partItem.isDisabled)
|
|
||||||
{
|
|
||||||
categoryData.selectPartIndex(selectedPartIndex);
|
|
||||||
|
|
||||||
// open hc window
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._maxPaletteCount = partItem.maxColorIndex;
|
|
||||||
|
|
||||||
AvatarEditorUtilities.CURRENT_FIGURE.savePartData(category, partItem.id, categoryData.getSelectedColorIds(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public selectColor(category: string, colorIndex: number, paletteId: number): void
|
|
||||||
{
|
|
||||||
const categoryData = this._categories.get(category);
|
|
||||||
|
|
||||||
if(!categoryData) return;
|
|
||||||
|
|
||||||
const paletteIndex = categoryData.getCurrentColorIndex(paletteId);
|
|
||||||
|
|
||||||
categoryData.selectColorIndex(colorIndex, paletteId);
|
|
||||||
|
|
||||||
const colorItem = categoryData.getSelectedColor(paletteId);
|
|
||||||
|
|
||||||
if(colorItem.isDisabled)
|
|
||||||
{
|
|
||||||
categoryData.selectColorIndex(paletteIndex, paletteId);
|
|
||||||
|
|
||||||
// open hc window
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AvatarEditorUtilities.CURRENT_FIGURE.savePartSetColourId(category, categoryData.getSelectedColorIds(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public getCategoryData(category: string): CategoryData
|
|
||||||
{
|
|
||||||
if(!this._isInitalized) this.init();
|
|
||||||
|
|
||||||
if(!this._categories) return null;
|
|
||||||
|
|
||||||
return this._categories.get(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
public get categories(): Map<string, CategoryData>
|
|
||||||
{
|
|
||||||
return this._categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get canSetGender(): boolean
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get maxPaletteCount(): number
|
|
||||||
{
|
|
||||||
return (this._maxPaletteCount || 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public set maxPaletteCount(count: number)
|
|
||||||
{
|
|
||||||
this._maxPaletteCount = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get name(): string
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,487 +1,418 @@
|
||||||
import { IPartColor } from '@nitro/renderer';
|
import {IPartColor} from "@nitro/renderer";
|
||||||
import { AvatarEditorGridColorItem } from './AvatarEditorGridColorItem';
|
|
||||||
import { AvatarEditorGridPartItem } from './AvatarEditorGridPartItem';
|
|
||||||
|
|
||||||
export class CategoryData
|
import {AvatarEditorGridColorItem} from "./AvatarEditorGridColorItem";
|
||||||
{
|
import {AvatarEditorGridPartItem} from "./AvatarEditorGridPartItem";
|
||||||
private _name: string;
|
|
||||||
private _parts: AvatarEditorGridPartItem[];
|
|
||||||
private _palettes: AvatarEditorGridColorItem[][];
|
|
||||||
private _selectedPartIndex: number = -1;
|
|
||||||
private _paletteIndexes: number[];
|
|
||||||
|
|
||||||
constructor(name: string, partItems: AvatarEditorGridPartItem[], colorItems: AvatarEditorGridColorItem[][])
|
export class CategoryData {
|
||||||
{
|
private _name: string;
|
||||||
this._name = name;
|
private _parts: AvatarEditorGridPartItem[];
|
||||||
this._parts = partItems;
|
private _palettes: AvatarEditorGridColorItem[][];
|
||||||
this._palettes = colorItems;
|
private _selectedPartIndex: number = -1;
|
||||||
this._selectedPartIndex = -1;
|
private _paletteIndexes: number[];
|
||||||
|
|
||||||
|
constructor(name: string, partItems: AvatarEditorGridPartItem[], colorItems: AvatarEditorGridColorItem[][]) {
|
||||||
|
this._name = name;
|
||||||
|
this._parts = partItems;
|
||||||
|
this._palettes = colorItems;
|
||||||
|
this._selectedPartIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static defaultColorId(palettes: AvatarEditorGridColorItem[], clubLevel: number): number {
|
||||||
|
if (!palettes || !palettes.length) return -1;
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < palettes.length) {
|
||||||
|
const colorItem = palettes[i];
|
||||||
|
|
||||||
|
if (colorItem.partColor && colorItem.partColor.clubLevel <= clubLevel) {
|
||||||
|
return colorItem.partColor.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static defaultColorId(palettes: AvatarEditorGridColorItem[], clubLevel: number): number
|
return -1;
|
||||||
{
|
}
|
||||||
if(!palettes || !palettes.length) return -1;
|
|
||||||
|
|
||||||
let i = 0;
|
public init(): void {
|
||||||
|
for (const part of this._parts) {
|
||||||
|
if (!part) continue;
|
||||||
|
|
||||||
while(i < palettes.length)
|
part.init();
|
||||||
{
|
}
|
||||||
const colorItem = palettes[i];
|
}
|
||||||
|
|
||||||
if(colorItem.partColor && (colorItem.partColor.clubLevel <= clubLevel))
|
public dispose(): void {
|
||||||
{
|
if (this._parts) {
|
||||||
return colorItem.partColor.id;
|
for (const part of this._parts) part.dispose();
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
this._parts = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._palettes) {
|
||||||
|
for (const palette of this._palettes) for (const colorItem of palette) colorItem.dispose();
|
||||||
|
|
||||||
|
this._palettes = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._selectedPartIndex = -1;
|
||||||
|
this._paletteIndexes = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public selectPartId(partId: number): void {
|
||||||
|
if (!this._parts) return;
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < this._parts.length) {
|
||||||
|
const partItem = this._parts[i];
|
||||||
|
|
||||||
|
if (partItem.id === partId) {
|
||||||
|
this.selectPartIndex(i);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public selectColorIds(colorIds: number[]): void {
|
||||||
|
if (!colorIds || !this._palettes) return;
|
||||||
|
|
||||||
|
this._paletteIndexes = new Array(colorIds.length);
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < this._palettes.length) {
|
||||||
|
const palette = this.getPalette(i);
|
||||||
|
|
||||||
|
if (palette) {
|
||||||
|
let colorId = 0;
|
||||||
|
|
||||||
|
if (colorIds.length > i) {
|
||||||
|
colorId = colorIds[i];
|
||||||
|
} else {
|
||||||
|
const colorItem = palette[0];
|
||||||
|
|
||||||
|
if (colorItem && colorItem.partColor) colorId = colorItem.partColor.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
let j = 0;
|
||||||
}
|
|
||||||
|
|
||||||
public init(): void
|
while (j < palette.length) {
|
||||||
{
|
const colorItem = palette[j];
|
||||||
for(const part of this._parts)
|
|
||||||
{
|
|
||||||
if(!part) continue;
|
|
||||||
|
|
||||||
part.init();
|
if (colorItem.partColor.id === colorId) {
|
||||||
|
this._paletteIndexes[i] = j;
|
||||||
|
|
||||||
|
colorItem.isSelected = true;
|
||||||
|
} else {
|
||||||
|
colorItem.isSelected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
this.updatePartColors();
|
||||||
{
|
}
|
||||||
if(this._parts)
|
|
||||||
{
|
|
||||||
for(const part of this._parts) part.dispose();
|
|
||||||
|
|
||||||
this._parts = null;
|
public selectPartIndex(partIndex: number): AvatarEditorGridPartItem {
|
||||||
|
if (!this._parts) return null;
|
||||||
|
|
||||||
|
if (this._selectedPartIndex >= 0 && this._parts.length > this._selectedPartIndex) {
|
||||||
|
const partItem = this._parts[this._selectedPartIndex];
|
||||||
|
|
||||||
|
if (partItem) partItem.isSelected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._parts.length > partIndex) {
|
||||||
|
const partItem = this._parts[partIndex];
|
||||||
|
|
||||||
|
if (partItem) {
|
||||||
|
partItem.isSelected = true;
|
||||||
|
|
||||||
|
this._selectedPartIndex = partIndex;
|
||||||
|
|
||||||
|
return partItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public selectColorIndex(colorIndex: number, paletteId: number): AvatarEditorGridColorItem {
|
||||||
|
const palette = this.getPalette(paletteId);
|
||||||
|
|
||||||
|
if (!palette) return null;
|
||||||
|
|
||||||
|
if (palette.length <= colorIndex) return null;
|
||||||
|
|
||||||
|
this.deselectColorIndex(this._paletteIndexes[paletteId], paletteId);
|
||||||
|
|
||||||
|
this._paletteIndexes[paletteId] = colorIndex;
|
||||||
|
|
||||||
|
const colorItem = palette[colorIndex];
|
||||||
|
|
||||||
|
if (!colorItem) return null;
|
||||||
|
|
||||||
|
colorItem.isSelected = true;
|
||||||
|
|
||||||
|
this.updatePartColors();
|
||||||
|
|
||||||
|
return colorItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getCurrentColorIndex(k: number): number {
|
||||||
|
return this._paletteIndexes[k];
|
||||||
|
}
|
||||||
|
|
||||||
|
private deselectColorIndex(colorIndex: number, paletteIndex: number): void {
|
||||||
|
const palette = this.getPalette(paletteIndex);
|
||||||
|
|
||||||
|
if (!palette) return;
|
||||||
|
|
||||||
|
if (palette.length <= colorIndex) return;
|
||||||
|
|
||||||
|
const colorItem = palette[colorIndex];
|
||||||
|
|
||||||
|
if (!colorItem) return;
|
||||||
|
|
||||||
|
colorItem.isSelected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSelectedColorIds(): number[] {
|
||||||
|
if (!this._paletteIndexes || !this._paletteIndexes.length) return null;
|
||||||
|
|
||||||
|
if (!this._palettes || !this._palettes.length) return null;
|
||||||
|
|
||||||
|
const palette = this._palettes[0];
|
||||||
|
|
||||||
|
if (!palette || !palette.length) return null;
|
||||||
|
|
||||||
|
const colorItem = palette[0];
|
||||||
|
|
||||||
|
if (!colorItem || !colorItem.partColor) return null;
|
||||||
|
|
||||||
|
const colorId = colorItem.partColor.id;
|
||||||
|
const colorIds: number[] = [];
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < this._paletteIndexes.length) {
|
||||||
|
const paletteSet = this._palettes[i];
|
||||||
|
|
||||||
|
if (!(!paletteSet || paletteSet.length <= i)) {
|
||||||
|
if (paletteSet.length > this._paletteIndexes[i]) {
|
||||||
|
const color = paletteSet[this._paletteIndexes[i]];
|
||||||
|
|
||||||
|
if (color && color.partColor) {
|
||||||
|
colorIds.push(color.partColor.id);
|
||||||
|
} else {
|
||||||
|
colorIds.push(colorId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
colorIds.push(colorId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(this._palettes)
|
i++;
|
||||||
{
|
}
|
||||||
for(const palette of this._palettes) for(const colorItem of palette) colorItem.dispose();
|
|
||||||
|
|
||||||
this._palettes = null;
|
const partItem = this.getCurrentPart();
|
||||||
|
|
||||||
|
if (!partItem) return null;
|
||||||
|
|
||||||
|
return colorIds.slice(0, Math.max(partItem.maxColorIndex, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private getSelectedColors(): IPartColor[] {
|
||||||
|
const partColors: IPartColor[] = [];
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < this._paletteIndexes.length) {
|
||||||
|
const colorItem = this.getSelectedColor(i);
|
||||||
|
|
||||||
|
if (colorItem) {
|
||||||
|
partColors.push(colorItem.partColor);
|
||||||
|
} else {
|
||||||
|
partColors.push(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return partColors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSelectedColor(paletteId: number): AvatarEditorGridColorItem {
|
||||||
|
const palette = this.getPalette(paletteId);
|
||||||
|
|
||||||
|
if (!palette || palette.length <= this._paletteIndexes[paletteId]) return null;
|
||||||
|
|
||||||
|
return palette[this._paletteIndexes[paletteId]];
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSelectedColorId(paletteId: number): number {
|
||||||
|
const colorItem = this.getSelectedColor(paletteId);
|
||||||
|
|
||||||
|
if (colorItem && colorItem.partColor) return colorItem.partColor.id;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getPalette(paletteId: number): AvatarEditorGridColorItem[] {
|
||||||
|
if (!this._paletteIndexes || !this._palettes || this._palettes.length <= paletteId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._palettes[paletteId];
|
||||||
|
}
|
||||||
|
|
||||||
|
public getCurrentPart(): AvatarEditorGridPartItem {
|
||||||
|
return this._parts[this._selectedPartIndex] as AvatarEditorGridPartItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private updatePartColors(): void {
|
||||||
|
const partColors = this.getSelectedColors();
|
||||||
|
|
||||||
|
for (const partItem of this._parts) {
|
||||||
|
if (partItem) partItem.partColors = partColors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public hasClubSelectionsOverLevel(level: number): boolean {
|
||||||
|
let hasInvalidSelections = false;
|
||||||
|
|
||||||
|
const partColors = this.getSelectedColors();
|
||||||
|
|
||||||
|
if (partColors) {
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < partColors.length) {
|
||||||
|
const partColor = partColors[i];
|
||||||
|
|
||||||
|
if (partColor && partColor.clubLevel > level) hasInvalidSelections = true;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const partItem = this.getCurrentPart();
|
||||||
|
|
||||||
|
if (partItem && partItem.partSet) {
|
||||||
|
const partSet = partItem.partSet;
|
||||||
|
|
||||||
|
if (partSet && partSet.clubLevel > level) hasInvalidSelections = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasInvalidSelections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public hasInvalidSelectedItems(ownedItems: number[]): boolean {
|
||||||
|
const part = this.getCurrentPart();
|
||||||
|
|
||||||
|
if (!part) return false;
|
||||||
|
|
||||||
|
const partSet = part.partSet;
|
||||||
|
|
||||||
|
if (!partSet || !partSet.isSellable) return;
|
||||||
|
|
||||||
|
return ownedItems.indexOf(partSet.id) > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public stripClubItemsOverLevel(level: number): boolean {
|
||||||
|
const partItem = this.getCurrentPart();
|
||||||
|
|
||||||
|
if (partItem && partItem.partSet) {
|
||||||
|
const partSet = partItem.partSet;
|
||||||
|
|
||||||
|
if (partSet.clubLevel > level) {
|
||||||
|
const newPartItem = this.selectPartIndex(0);
|
||||||
|
|
||||||
|
if (newPartItem && !newPartItem.partSet) this.selectPartIndex(1);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public stripClubColorsOverLevel(level: number): boolean {
|
||||||
|
const colorIds: number[] = [];
|
||||||
|
const partColors = this.getSelectedColors();
|
||||||
|
const colorItems = this.getPalette(0);
|
||||||
|
|
||||||
|
let didStrip = false;
|
||||||
|
|
||||||
|
const colorId = CategoryData.defaultColorId(colorItems, level);
|
||||||
|
|
||||||
|
if (colorId === -1) return false;
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while (i < partColors.length) {
|
||||||
|
const partColor = partColors[i];
|
||||||
|
|
||||||
|
if (!partColor) {
|
||||||
|
colorIds.push(colorId);
|
||||||
|
|
||||||
|
didStrip = true;
|
||||||
|
} else {
|
||||||
|
if (partColor.clubLevel > level) {
|
||||||
|
colorIds.push(colorId);
|
||||||
|
|
||||||
|
didStrip = true;
|
||||||
|
} else {
|
||||||
|
colorIds.push(partColor.id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._selectedPartIndex = -1;
|
i++;
|
||||||
this._paletteIndexes = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public selectPartId(partId: number): void
|
if (didStrip) this.selectColorIds(colorIds);
|
||||||
{
|
|
||||||
if(!this._parts) return;
|
return didStrip;
|
||||||
|
}
|
||||||
let i = 0;
|
|
||||||
|
// public stripInvalidSellableItems(k:IHabboInventory): boolean
|
||||||
while(i < this._parts.length)
|
// {
|
||||||
{
|
// var _local_3:IFigurePartSet;
|
||||||
const partItem = this._parts[i];
|
// var _local_4:AvatarEditorGridPartItem;
|
||||||
|
// var _local_2:AvatarEditorGridPartItem = this._Str_6315();
|
||||||
if(partItem.id === partId)
|
// if (((_local_2) && (_local_2.partSet)))
|
||||||
{
|
// {
|
||||||
this.selectPartIndex(i);
|
// _local_3 = _local_2.partSet;
|
||||||
|
// if (((_local_3.isSellable) && (!(k._Str_14439(_local_3.id)))))
|
||||||
return;
|
// {
|
||||||
}
|
// _local_4 = this._Str_8066(0);
|
||||||
|
// if (((!(_local_4 == null)) && (_local_4.partSet == null)))
|
||||||
i++;
|
// {
|
||||||
}
|
// this._Str_8066(1);
|
||||||
}
|
// }
|
||||||
|
// return true;
|
||||||
public selectColorIds(colorIds: number[]): void
|
// }
|
||||||
{
|
// }
|
||||||
if(!colorIds || !this._palettes) return;
|
// return false;
|
||||||
|
// }
|
||||||
this._paletteIndexes = new Array(colorIds.length);
|
|
||||||
|
public get name(): string {
|
||||||
let i = 0;
|
return this._name;
|
||||||
|
}
|
||||||
while(i < this._palettes.length)
|
|
||||||
{
|
public get parts(): AvatarEditorGridPartItem[] {
|
||||||
const palette = this.getPalette(i);
|
return this._parts;
|
||||||
|
}
|
||||||
if(palette)
|
|
||||||
{
|
public get selectedPartIndex(): number {
|
||||||
let colorId = 0;
|
return this._selectedPartIndex;
|
||||||
|
}
|
||||||
if(colorIds.length > i)
|
|
||||||
{
|
|
||||||
colorId = colorIds[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const colorItem = palette[0];
|
|
||||||
|
|
||||||
if(colorItem && colorItem.partColor) colorId = colorItem.partColor.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
let j = 0;
|
|
||||||
|
|
||||||
while(j < palette.length)
|
|
||||||
{
|
|
||||||
const colorItem = palette[j];
|
|
||||||
|
|
||||||
if(colorItem.partColor.id === colorId)
|
|
||||||
{
|
|
||||||
this._paletteIndexes[i] = j;
|
|
||||||
|
|
||||||
colorItem.isSelected = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colorItem.isSelected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updatePartColors();
|
|
||||||
}
|
|
||||||
|
|
||||||
public selectPartIndex(partIndex: number): AvatarEditorGridPartItem
|
|
||||||
{
|
|
||||||
if(!this._parts) return null;
|
|
||||||
|
|
||||||
if((this._selectedPartIndex >= 0) && (this._parts.length > this._selectedPartIndex))
|
|
||||||
{
|
|
||||||
const partItem = this._parts[this._selectedPartIndex];
|
|
||||||
|
|
||||||
if(partItem) partItem.isSelected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this._parts.length > partIndex)
|
|
||||||
{
|
|
||||||
const partItem = this._parts[partIndex];
|
|
||||||
|
|
||||||
if(partItem)
|
|
||||||
{
|
|
||||||
partItem.isSelected = true;
|
|
||||||
|
|
||||||
this._selectedPartIndex = partIndex;
|
|
||||||
|
|
||||||
return partItem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public selectColorIndex(colorIndex: number, paletteId: number): AvatarEditorGridColorItem
|
|
||||||
{
|
|
||||||
const palette = this.getPalette(paletteId);
|
|
||||||
|
|
||||||
if(!palette) return null;
|
|
||||||
|
|
||||||
if(palette.length <= colorIndex) return null;
|
|
||||||
|
|
||||||
this.deselectColorIndex(this._paletteIndexes[paletteId], paletteId);
|
|
||||||
|
|
||||||
this._paletteIndexes[paletteId] = colorIndex;
|
|
||||||
|
|
||||||
const colorItem = palette[colorIndex];
|
|
||||||
|
|
||||||
if(!colorItem) return null;
|
|
||||||
|
|
||||||
colorItem.isSelected = true;
|
|
||||||
|
|
||||||
this.updatePartColors();
|
|
||||||
|
|
||||||
return colorItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getCurrentColorIndex(k: number): number
|
|
||||||
{
|
|
||||||
return this._paletteIndexes[k];
|
|
||||||
}
|
|
||||||
|
|
||||||
private deselectColorIndex(colorIndex: number, paletteIndex: number): void
|
|
||||||
{
|
|
||||||
const palette = this.getPalette(paletteIndex);
|
|
||||||
|
|
||||||
if(!palette) return;
|
|
||||||
|
|
||||||
if(palette.length <= colorIndex) return;
|
|
||||||
|
|
||||||
const colorItem = palette[colorIndex];
|
|
||||||
|
|
||||||
if(!colorItem) return;
|
|
||||||
|
|
||||||
colorItem.isSelected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getSelectedColorIds(): number[]
|
|
||||||
{
|
|
||||||
if(!this._paletteIndexes || !this._paletteIndexes.length) return null;
|
|
||||||
|
|
||||||
if(!this._palettes || !this._palettes.length) return null;
|
|
||||||
|
|
||||||
const palette = this._palettes[0];
|
|
||||||
|
|
||||||
if(!palette || (!palette.length)) return null;
|
|
||||||
|
|
||||||
const colorItem = palette[0];
|
|
||||||
|
|
||||||
if(!colorItem || !colorItem.partColor) return null;
|
|
||||||
|
|
||||||
const colorId = colorItem.partColor.id;
|
|
||||||
const colorIds: number[] = [];
|
|
||||||
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < this._paletteIndexes.length)
|
|
||||||
{
|
|
||||||
const paletteSet = this._palettes[i];
|
|
||||||
|
|
||||||
if(!((!(paletteSet)) || (paletteSet.length <= i)))
|
|
||||||
{
|
|
||||||
if(paletteSet.length > this._paletteIndexes[i])
|
|
||||||
{
|
|
||||||
const color = paletteSet[this._paletteIndexes[i]];
|
|
||||||
|
|
||||||
if(color && color.partColor)
|
|
||||||
{
|
|
||||||
colorIds.push(color.partColor.id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colorIds.push(colorId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colorIds.push(colorId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
const partItem = this.getCurrentPart();
|
|
||||||
|
|
||||||
if(!partItem) return null;
|
|
||||||
|
|
||||||
return colorIds.slice(0, Math.max(partItem.maxColorIndex, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
private getSelectedColors(): IPartColor[]
|
|
||||||
{
|
|
||||||
const partColors: IPartColor[] = [];
|
|
||||||
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < this._paletteIndexes.length)
|
|
||||||
{
|
|
||||||
const colorItem = this.getSelectedColor(i);
|
|
||||||
|
|
||||||
if(colorItem)
|
|
||||||
{
|
|
||||||
partColors.push(colorItem.partColor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
partColors.push(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return partColors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getSelectedColor(paletteId: number): AvatarEditorGridColorItem
|
|
||||||
{
|
|
||||||
const palette = this.getPalette(paletteId);
|
|
||||||
|
|
||||||
if(!palette || (palette.length <= this._paletteIndexes[paletteId])) return null;
|
|
||||||
|
|
||||||
return palette[this._paletteIndexes[paletteId]];
|
|
||||||
}
|
|
||||||
|
|
||||||
public getSelectedColorId(paletteId: number): number
|
|
||||||
{
|
|
||||||
const colorItem = this.getSelectedColor(paletteId);
|
|
||||||
|
|
||||||
if(colorItem && (colorItem.partColor)) return colorItem.partColor.id;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getPalette(paletteId: number): AvatarEditorGridColorItem[]
|
|
||||||
{
|
|
||||||
if(!this._paletteIndexes || !this._palettes || (this._palettes.length <= paletteId))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._palettes[paletteId];
|
|
||||||
}
|
|
||||||
|
|
||||||
public getCurrentPart(): AvatarEditorGridPartItem
|
|
||||||
{
|
|
||||||
return this._parts[this._selectedPartIndex] as AvatarEditorGridPartItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
private updatePartColors(): void
|
|
||||||
{
|
|
||||||
const partColors = this.getSelectedColors();
|
|
||||||
|
|
||||||
for(const partItem of this._parts)
|
|
||||||
{
|
|
||||||
if(partItem) partItem.partColors = partColors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public hasClubSelectionsOverLevel(level: number): boolean
|
|
||||||
{
|
|
||||||
let hasInvalidSelections = false;
|
|
||||||
|
|
||||||
const partColors = this.getSelectedColors();
|
|
||||||
|
|
||||||
if(partColors)
|
|
||||||
{
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < partColors.length)
|
|
||||||
{
|
|
||||||
const partColor = partColors[i];
|
|
||||||
|
|
||||||
if(partColor && (partColor.clubLevel > level)) hasInvalidSelections = true;
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const partItem = this.getCurrentPart();
|
|
||||||
|
|
||||||
if(partItem && partItem.partSet)
|
|
||||||
{
|
|
||||||
const partSet = partItem.partSet;
|
|
||||||
|
|
||||||
if(partSet && (partSet.clubLevel > level)) hasInvalidSelections = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasInvalidSelections;
|
|
||||||
}
|
|
||||||
|
|
||||||
public hasInvalidSelectedItems(ownedItems: number[]): boolean
|
|
||||||
{
|
|
||||||
const part = this.getCurrentPart();
|
|
||||||
|
|
||||||
if(!part) return false;
|
|
||||||
|
|
||||||
const partSet = part.partSet;
|
|
||||||
|
|
||||||
if(!partSet || !partSet.isSellable) return;
|
|
||||||
|
|
||||||
return (ownedItems.indexOf(partSet.id) > -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public stripClubItemsOverLevel(level: number): boolean
|
|
||||||
{
|
|
||||||
const partItem = this.getCurrentPart();
|
|
||||||
|
|
||||||
if(partItem && partItem.partSet)
|
|
||||||
{
|
|
||||||
const partSet = partItem.partSet;
|
|
||||||
|
|
||||||
if(partSet.clubLevel > level)
|
|
||||||
{
|
|
||||||
const newPartItem = this.selectPartIndex(0);
|
|
||||||
|
|
||||||
if(newPartItem && !newPartItem.partSet) this.selectPartIndex(1);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public stripClubColorsOverLevel(level: number): boolean
|
|
||||||
{
|
|
||||||
const colorIds: number[] = [];
|
|
||||||
const partColors = this.getSelectedColors();
|
|
||||||
const colorItems = this.getPalette(0);
|
|
||||||
|
|
||||||
let didStrip = false;
|
|
||||||
|
|
||||||
const colorId = CategoryData.defaultColorId(colorItems, level);
|
|
||||||
|
|
||||||
if(colorId === -1) return false;
|
|
||||||
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < partColors.length)
|
|
||||||
{
|
|
||||||
const partColor = partColors[i];
|
|
||||||
|
|
||||||
if(!partColor)
|
|
||||||
{
|
|
||||||
colorIds.push(colorId);
|
|
||||||
|
|
||||||
didStrip = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(partColor.clubLevel > level)
|
|
||||||
{
|
|
||||||
colorIds.push(colorId);
|
|
||||||
|
|
||||||
didStrip = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
colorIds.push(partColor.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(didStrip) this.selectColorIds(colorIds);
|
|
||||||
|
|
||||||
return didStrip;
|
|
||||||
}
|
|
||||||
|
|
||||||
// public stripInvalidSellableItems(k:IHabboInventory): boolean
|
|
||||||
// {
|
|
||||||
// var _local_3:IFigurePartSet;
|
|
||||||
// var _local_4:AvatarEditorGridPartItem;
|
|
||||||
// var _local_2:AvatarEditorGridPartItem = this._Str_6315();
|
|
||||||
// if (((_local_2) && (_local_2.partSet)))
|
|
||||||
// {
|
|
||||||
// _local_3 = _local_2.partSet;
|
|
||||||
// if (((_local_3.isSellable) && (!(k._Str_14439(_local_3.id)))))
|
|
||||||
// {
|
|
||||||
// _local_4 = this._Str_8066(0);
|
|
||||||
// if (((!(_local_4 == null)) && (_local_4.partSet == null)))
|
|
||||||
// {
|
|
||||||
// this._Str_8066(1);
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public get name(): string
|
|
||||||
{
|
|
||||||
return this._name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get parts(): AvatarEditorGridPartItem[]
|
|
||||||
{
|
|
||||||
return this._parts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get selectedPartIndex(): number
|
|
||||||
{
|
|
||||||
return this._selectedPartIndex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,287 +1,268 @@
|
||||||
import { AvatarEditorUtilities } from './AvatarEditorUtilities';
|
import {AvatarEditorUtilities} from "./AvatarEditorUtilities";
|
||||||
|
|
||||||
export class FigureData
|
export class FigureData {
|
||||||
{
|
private static DEFAULT_DIRECTION: number = 4;
|
||||||
private static DEFAULT_DIRECTION: number = 4;
|
|
||||||
|
|
||||||
public static MALE: string = 'M';
|
public static MALE: string = "M";
|
||||||
public static FEMALE: string = 'F';
|
public static FEMALE: string = "F";
|
||||||
public static UNISEX: string = 'U';
|
public static UNISEX: string = "U";
|
||||||
public static SCALE: string = 'h';
|
public static SCALE: string = "h";
|
||||||
public static STD: string = 'std';
|
public static STD: string = "std";
|
||||||
public static DEFAULT_FRAME: string = '0';
|
public static DEFAULT_FRAME: string = "0";
|
||||||
public static FACE: string = 'hd';
|
public static FACE: string = "hd";
|
||||||
public static HAIR: string = 'hr';
|
public static HAIR: string = "hr";
|
||||||
public static HAT: string = 'ha';
|
public static HAT: string = "ha";
|
||||||
public static HEAD_ACCESSORIES: string = 'he';
|
public static HEAD_ACCESSORIES: string = "he";
|
||||||
public static EYE_ACCESSORIES: string = 'ea';
|
public static EYE_ACCESSORIES: string = "ea";
|
||||||
public static FACE_ACCESSORIES: string = 'fa';
|
public static FACE_ACCESSORIES: string = "fa";
|
||||||
public static JACKET: string = 'cc';
|
public static JACKET: string = "cc";
|
||||||
public static SHIRT: string = 'ch';
|
public static SHIRT: string = "ch";
|
||||||
public static CHEST_ACCESSORIES: string = 'ca';
|
public static CHEST_ACCESSORIES: string = "ca";
|
||||||
public static CHEST_PRINTS: string = 'cp';
|
public static CHEST_PRINTS: string = "cp";
|
||||||
public static TROUSERS: string = 'lg';
|
public static TROUSERS: string = "lg";
|
||||||
public static SHOES: string = 'sh';
|
public static SHOES: string = "sh";
|
||||||
public static TROUSER_ACCESSORIES: string = 'wa';
|
public static TROUSER_ACCESSORIES: string = "wa";
|
||||||
public static SET_TYPES = [ FigureData.FACE, FigureData.HAIR, FigureData.HAT, FigureData.HEAD_ACCESSORIES, FigureData.EYE_ACCESSORIES, FigureData.FACE_ACCESSORIES, FigureData.JACKET, FigureData.SHIRT, FigureData.CHEST_ACCESSORIES, FigureData.CHEST_PRINTS, FigureData.TROUSERS, FigureData.SHOES, FigureData.TROUSERS ];
|
public static SET_TYPES = [
|
||||||
|
FigureData.FACE,
|
||||||
|
FigureData.HAIR,
|
||||||
|
FigureData.HAT,
|
||||||
|
FigureData.HEAD_ACCESSORIES,
|
||||||
|
FigureData.EYE_ACCESSORIES,
|
||||||
|
FigureData.FACE_ACCESSORIES,
|
||||||
|
FigureData.JACKET,
|
||||||
|
FigureData.SHIRT,
|
||||||
|
FigureData.CHEST_ACCESSORIES,
|
||||||
|
FigureData.CHEST_PRINTS,
|
||||||
|
FigureData.TROUSERS,
|
||||||
|
FigureData.SHOES,
|
||||||
|
FigureData.TROUSERS,
|
||||||
|
];
|
||||||
|
|
||||||
private _data: Map<string, number>;
|
private _data: Map<string, number>;
|
||||||
private _colors: Map<string, number[]>;
|
private _colors: Map<string, number[]>;
|
||||||
private _gender: string = 'M';
|
private _gender: string = "M";
|
||||||
private _direction: number = FigureData.DEFAULT_DIRECTION;
|
private _direction: number = FigureData.DEFAULT_DIRECTION;
|
||||||
private _avatarEffectType: number = -1;
|
private _avatarEffectType: number = -1;
|
||||||
private _notifier: () => void = null;
|
private _notifier: () => void = null;
|
||||||
|
|
||||||
public loadAvatarData(figureString: string, gender: string): void
|
public loadAvatarData(figureString: string, gender: string): void {
|
||||||
{
|
this._data = new Map();
|
||||||
this._data = new Map();
|
this._colors = new Map();
|
||||||
this._colors = new Map();
|
this._gender = gender;
|
||||||
this._gender = gender;
|
|
||||||
|
|
||||||
this.parseFigureString(figureString);
|
this.parseFigureString(figureString);
|
||||||
this.updateView();
|
this.updateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseFigureString(figure: string): void {
|
||||||
|
if (!figure) return;
|
||||||
|
|
||||||
|
const sets = figure.split(".");
|
||||||
|
|
||||||
|
if (!sets || !sets.length) return;
|
||||||
|
|
||||||
|
for (const set of sets) {
|
||||||
|
const parts = set.split("-");
|
||||||
|
|
||||||
|
if (!parts.length) continue;
|
||||||
|
|
||||||
|
const setType = parts[0];
|
||||||
|
const setId = parseInt(parts[1]);
|
||||||
|
const colorIds: number[] = [];
|
||||||
|
|
||||||
|
let offset = 2;
|
||||||
|
|
||||||
|
while (offset < parts.length) {
|
||||||
|
colorIds.push(parseInt(parts[offset]));
|
||||||
|
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!colorIds.length) colorIds.push(0);
|
||||||
|
|
||||||
|
this.savePartSetId(setType, setId, false);
|
||||||
|
this.savePartSetColourId(setType, colorIds, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private parseFigureString(figure: string): void
|
public getPartSetId(setType: string): number {
|
||||||
{
|
const existing = this._data.get(setType);
|
||||||
if(!figure) return;
|
|
||||||
|
|
||||||
const sets = figure.split('.');
|
if (existing !== undefined) return existing;
|
||||||
|
|
||||||
if(!sets || !sets.length) return;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
for(const set of sets)
|
public getColorIds(setType: string): number[] {
|
||||||
{
|
const existing = this._colors.get(setType);
|
||||||
const parts = set.split('-');
|
|
||||||
|
|
||||||
if(!parts.length) continue;
|
if (existing !== undefined) return existing;
|
||||||
|
|
||||||
const setType = parts[0];
|
return [AvatarEditorUtilities.avatarSetFirstSelectableColor(setType)];
|
||||||
const setId = parseInt(parts[1]);
|
}
|
||||||
const colorIds: number[] = [];
|
|
||||||
|
|
||||||
let offset = 2;
|
public getFigureString(): string {
|
||||||
|
let figureString = "";
|
||||||
|
const setParts: string[] = [];
|
||||||
|
|
||||||
while(offset < parts.length)
|
for (const [setType, setId] of this._data.entries()) {
|
||||||
{
|
const colorIds = this._colors.get(setType);
|
||||||
colorIds.push(parseInt(parts[offset]));
|
|
||||||
|
|
||||||
offset++;
|
let setPart = setType + "-" + setId;
|
||||||
}
|
|
||||||
|
|
||||||
if(!colorIds.length) colorIds.push(0);
|
|
||||||
|
|
||||||
this.savePartSetId(setType, setId, false);
|
|
||||||
this.savePartSetColourId(setType, colorIds, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public getPartSetId(setType: string): number
|
|
||||||
{
|
|
||||||
const existing = this._data.get(setType);
|
|
||||||
|
|
||||||
if(existing !== undefined) return existing;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getColorIds(setType: string): number[]
|
|
||||||
{
|
|
||||||
const existing = this._colors.get(setType);
|
|
||||||
|
|
||||||
if(existing !== undefined) return existing;
|
|
||||||
|
|
||||||
return [ AvatarEditorUtilities.avatarSetFirstSelectableColor(setType) ];
|
|
||||||
}
|
|
||||||
|
|
||||||
public getFigureString(): string
|
|
||||||
{
|
|
||||||
let figureString = '';
|
|
||||||
const setParts: string[] = [];
|
|
||||||
|
|
||||||
for(const [ setType, setId ] of this._data.entries())
|
|
||||||
{
|
|
||||||
const colorIds = this._colors.get(setType);
|
|
||||||
|
|
||||||
let setPart = ((setType + '-') + setId);
|
|
||||||
|
|
||||||
if(colorIds && colorIds.length)
|
|
||||||
{
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < colorIds.length)
|
|
||||||
{
|
|
||||||
setPart = (setPart + ('-' + colorIds[i]));
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setParts.push(setPart);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (colorIds && colorIds.length) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
while(i < setParts.length)
|
while (i < colorIds.length) {
|
||||||
{
|
setPart = setPart + ("-" + colorIds[i]);
|
||||||
figureString = (figureString + setParts[i]);
|
|
||||||
|
|
||||||
if(i < (setParts.length - 1)) figureString = (figureString + '.');
|
i++;
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return figureString;
|
setParts.push(setPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
public savePartData(setType: string, partId: number, colorIds: number[], update: boolean = false): void
|
let i = 0;
|
||||||
{
|
|
||||||
this.savePartSetId(setType, partId, update);
|
while (i < setParts.length) {
|
||||||
this.savePartSetColourId(setType, colorIds, update);
|
figureString = figureString + setParts[i];
|
||||||
|
|
||||||
|
if (i < setParts.length - 1) figureString = figureString + ".";
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private savePartSetId(setType: string, partId: number, update: boolean = true): void
|
return figureString;
|
||||||
{
|
}
|
||||||
switch(setType)
|
|
||||||
{
|
|
||||||
case FigureData.FACE:
|
|
||||||
case FigureData.HAIR:
|
|
||||||
case FigureData.HAT:
|
|
||||||
case FigureData.HEAD_ACCESSORIES:
|
|
||||||
case FigureData.EYE_ACCESSORIES:
|
|
||||||
case FigureData.FACE_ACCESSORIES:
|
|
||||||
case FigureData.SHIRT:
|
|
||||||
case FigureData.JACKET:
|
|
||||||
case FigureData.CHEST_ACCESSORIES:
|
|
||||||
case FigureData.CHEST_PRINTS:
|
|
||||||
case FigureData.TROUSERS:
|
|
||||||
case FigureData.SHOES:
|
|
||||||
case FigureData.TROUSER_ACCESSORIES:
|
|
||||||
if(partId >= 0)
|
|
||||||
{
|
|
||||||
this._data.set(setType, partId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this._data.delete(setType);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(update) this.updateView();
|
public savePartData(setType: string, partId: number, colorIds: number[], update: boolean = false): void {
|
||||||
|
this.savePartSetId(setType, partId, update);
|
||||||
|
this.savePartSetColourId(setType, colorIds, update);
|
||||||
|
}
|
||||||
|
|
||||||
|
private savePartSetId(setType: string, partId: number, update: boolean = true): void {
|
||||||
|
switch (setType) {
|
||||||
|
case FigureData.FACE:
|
||||||
|
case FigureData.HAIR:
|
||||||
|
case FigureData.HAT:
|
||||||
|
case FigureData.HEAD_ACCESSORIES:
|
||||||
|
case FigureData.EYE_ACCESSORIES:
|
||||||
|
case FigureData.FACE_ACCESSORIES:
|
||||||
|
case FigureData.SHIRT:
|
||||||
|
case FigureData.JACKET:
|
||||||
|
case FigureData.CHEST_ACCESSORIES:
|
||||||
|
case FigureData.CHEST_PRINTS:
|
||||||
|
case FigureData.TROUSERS:
|
||||||
|
case FigureData.SHOES:
|
||||||
|
case FigureData.TROUSER_ACCESSORIES:
|
||||||
|
if (partId >= 0) {
|
||||||
|
this._data.set(setType, partId);
|
||||||
|
} else {
|
||||||
|
this._data.delete(setType);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
public savePartSetColourId(setType: string, colorIds: number[], update: boolean = true): void
|
if (update) this.updateView();
|
||||||
{
|
}
|
||||||
switch(setType)
|
|
||||||
{
|
|
||||||
case FigureData.FACE:
|
|
||||||
case FigureData.HAIR:
|
|
||||||
case FigureData.HAT:
|
|
||||||
case FigureData.HEAD_ACCESSORIES:
|
|
||||||
case FigureData.EYE_ACCESSORIES:
|
|
||||||
case FigureData.FACE_ACCESSORIES:
|
|
||||||
case FigureData.SHIRT:
|
|
||||||
case FigureData.JACKET:
|
|
||||||
case FigureData.CHEST_ACCESSORIES:
|
|
||||||
case FigureData.CHEST_PRINTS:
|
|
||||||
case FigureData.TROUSERS:
|
|
||||||
case FigureData.SHOES:
|
|
||||||
case FigureData.TROUSER_ACCESSORIES:
|
|
||||||
this._colors.set(setType, colorIds);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(update) this.updateView();
|
public savePartSetColourId(setType: string, colorIds: number[], update: boolean = true): void {
|
||||||
|
switch (setType) {
|
||||||
|
case FigureData.FACE:
|
||||||
|
case FigureData.HAIR:
|
||||||
|
case FigureData.HAT:
|
||||||
|
case FigureData.HEAD_ACCESSORIES:
|
||||||
|
case FigureData.EYE_ACCESSORIES:
|
||||||
|
case FigureData.FACE_ACCESSORIES:
|
||||||
|
case FigureData.SHIRT:
|
||||||
|
case FigureData.JACKET:
|
||||||
|
case FigureData.CHEST_ACCESSORIES:
|
||||||
|
case FigureData.CHEST_PRINTS:
|
||||||
|
case FigureData.TROUSERS:
|
||||||
|
case FigureData.SHOES:
|
||||||
|
case FigureData.TROUSER_ACCESSORIES:
|
||||||
|
this._colors.set(setType, colorIds);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getFigureStringWithFace(k: number, override = true): string
|
if (update) this.updateView();
|
||||||
{
|
}
|
||||||
let figureString = '';
|
|
||||||
|
|
||||||
const setTypes: string[] = [ FigureData.FACE ];
|
public getFigureStringWithFace(k: number, override = true): string {
|
||||||
const figureSets: string[] = [];
|
let figureString = "";
|
||||||
|
|
||||||
for(const setType of setTypes)
|
const setTypes: string[] = [FigureData.FACE];
|
||||||
{
|
const figureSets: string[] = [];
|
||||||
const colors = this._colors.get(setType);
|
|
||||||
|
|
||||||
if(!colors) continue;
|
for (const setType of setTypes) {
|
||||||
|
const colors = this._colors.get(setType);
|
||||||
|
|
||||||
let setId = this._data.get(setType);
|
if (!colors) continue;
|
||||||
|
|
||||||
if((setType === FigureData.FACE) && override) setId = k;
|
let setId = this._data.get(setType);
|
||||||
|
|
||||||
let figureSet = ((setType + '-') + setId);
|
if (setType === FigureData.FACE && override) setId = k;
|
||||||
|
|
||||||
if(setId >= 0)
|
let figureSet = setType + "-" + setId;
|
||||||
{
|
|
||||||
let i = 0;
|
|
||||||
|
|
||||||
while(i < colors.length)
|
|
||||||
{
|
|
||||||
figureSet = (figureSet + ('-' + colors[i]));
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
figureSets.push(figureSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (setId >= 0) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
while(i < figureSets.length)
|
while (i < colors.length) {
|
||||||
{
|
figureSet = figureSet + ("-" + colors[i]);
|
||||||
figureString = (figureString + figureSets[i]);
|
|
||||||
|
|
||||||
if(i < (figureSets.length - 1)) figureString = (figureString + '.');
|
i++;
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return figureString;
|
figureSets.push(figureSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateView(): void
|
let i = 0;
|
||||||
{
|
|
||||||
if(this.notify) this.notify();
|
while (i < figureSets.length) {
|
||||||
|
figureString = figureString + figureSets[i];
|
||||||
|
|
||||||
|
if (i < figureSets.length - 1) figureString = figureString + ".";
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get gender(): string
|
return figureString;
|
||||||
{
|
}
|
||||||
return this._gender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get direction(): number
|
public updateView(): void {
|
||||||
{
|
if (this.notify) this.notify();
|
||||||
return this._direction;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set direction(direction: number)
|
public get gender(): string {
|
||||||
{
|
return this._gender;
|
||||||
this._direction = direction;
|
}
|
||||||
|
|
||||||
this.updateView();
|
public get direction(): number {
|
||||||
}
|
return this._direction;
|
||||||
|
}
|
||||||
|
|
||||||
public set avatarEffectType(k: number)
|
public set direction(direction: number) {
|
||||||
{
|
this._direction = direction;
|
||||||
this._avatarEffectType = k;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get avatarEffectType(): number
|
this.updateView();
|
||||||
{
|
}
|
||||||
return this._avatarEffectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get notify(): () => void
|
public set avatarEffectType(k: number) {
|
||||||
{
|
this._avatarEffectType = k;
|
||||||
return this._notifier;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set notify(notifier: () => void)
|
public get avatarEffectType(): number {
|
||||||
{
|
return this._avatarEffectType;
|
||||||
this._notifier = notifier;
|
}
|
||||||
}
|
|
||||||
|
public get notify(): () => void {
|
||||||
|
return this._notifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set notify(notifier: () => void) {
|
||||||
|
this._notifier = notifier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,90 +1,93 @@
|
||||||
import { AvatarFigureContainer, IFigurePartSet, IPalette, IPartColor, SetType } from '@nitro/renderer';
|
import {AvatarFigureContainer, IFigurePartSet, IPalette, IPartColor, SetType} from "@nitro/renderer";
|
||||||
import { GetAvatarRenderManager } from '../nitro';
|
|
||||||
import { Randomizer } from '../utils';
|
|
||||||
import { FigureData } from './FigureData';
|
|
||||||
|
|
||||||
function getTotalColors(partSet: IFigurePartSet): number
|
import {GetAvatarRenderManager} from "../nitro";
|
||||||
{
|
import {Randomizer} from "../utils";
|
||||||
const parts = partSet.parts;
|
import {FigureData} from "./FigureData";
|
||||||
|
|
||||||
let totalColors = 0;
|
function getTotalColors(partSet: IFigurePartSet): number {
|
||||||
|
const parts = partSet.parts;
|
||||||
|
|
||||||
for(const part of parts) totalColors = Math.max(totalColors, part.colorLayerIndex);
|
let totalColors = 0;
|
||||||
|
|
||||||
return totalColors;
|
for (const part of parts) totalColors = Math.max(totalColors, part.colorLayerIndex);
|
||||||
|
|
||||||
|
return totalColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomSetTypes(requiredSets: string[], options: string[]): string[]
|
function getRandomSetTypes(requiredSets: string[], options: string[]): string[] {
|
||||||
{
|
options = options.filter(option => requiredSets.indexOf(option) === -1);
|
||||||
options = options.filter(option => (requiredSets.indexOf(option) === -1));
|
|
||||||
|
|
||||||
return [ ...requiredSets, ...Randomizer.getRandomElements(options, (Randomizer.getRandomNumber(options.length) + 1)) ];
|
return [...requiredSets, ...Randomizer.getRandomElements(options, Randomizer.getRandomNumber(options.length) + 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomPartSet(setType: SetType, gender: string, clubLevel: number = 0, figureSetIds: number[] = []): IFigurePartSet
|
function getRandomPartSet(setType: SetType, gender: string, clubLevel: number = 0, figureSetIds: number[] = []): IFigurePartSet {
|
||||||
{
|
if (!setType) return null;
|
||||||
if(!setType) return null;
|
|
||||||
|
|
||||||
const options = setType.partSets.getValues().filter(option =>
|
const options = setType.partSets.getValues().filter(option => {
|
||||||
{
|
if (
|
||||||
if(!option.isSelectable || ((option.gender !== 'U') && (option.gender !== gender)) || (option.clubLevel > clubLevel) || (option.isSellable && (figureSetIds.indexOf(option.id) === -1))) return null;
|
!option.isSelectable ||
|
||||||
|
(option.gender !== "U" && option.gender !== gender) ||
|
||||||
|
option.clubLevel > clubLevel ||
|
||||||
|
(option.isSellable && figureSetIds.indexOf(option.id) === -1)
|
||||||
|
)
|
||||||
|
return null;
|
||||||
|
|
||||||
return option;
|
return option;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!options || !options.length) return null;
|
if (!options || !options.length) return null;
|
||||||
|
|
||||||
return Randomizer.getRandomElement(options);
|
return Randomizer.getRandomElement(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomColors(palette: IPalette, partSet: IFigurePartSet, clubLevel: number = 0): IPartColor[]
|
function getRandomColors(palette: IPalette, partSet: IFigurePartSet, clubLevel: number = 0): IPartColor[] {
|
||||||
{
|
if (!palette) return [];
|
||||||
if(!palette) return [];
|
|
||||||
|
|
||||||
const options = palette.colors.getValues().filter(option =>
|
const options = palette.colors.getValues().filter(option => {
|
||||||
{
|
if (!option.isSelectable || option.clubLevel > clubLevel) return null;
|
||||||
if(!option.isSelectable || (option.clubLevel > clubLevel)) return null;
|
|
||||||
|
|
||||||
return option;
|
return option;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!options || !options.length) return null;
|
if (!options || !options.length) return null;
|
||||||
|
|
||||||
return Randomizer.getRandomElements(options, getTotalColors(partSet));
|
return Randomizer.getRandomElements(options, getTotalColors(partSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateRandomFigure(figureData: FigureData, gender: string, clubLevel: number = 0, figureSetIds: number[] = [], ignoredSets: string[] = []): string
|
export function generateRandomFigure(
|
||||||
{
|
figureData: FigureData,
|
||||||
const structure = GetAvatarRenderManager().structure;
|
gender: string,
|
||||||
const figureContainer = new AvatarFigureContainer('');
|
clubLevel: number = 0,
|
||||||
const requiredSets = getRandomSetTypes(structure.getMandatorySetTypeIds(gender, clubLevel), FigureData.SET_TYPES);
|
figureSetIds: number[] = [],
|
||||||
|
ignoredSets: string[] = []
|
||||||
|
): string {
|
||||||
|
const structure = GetAvatarRenderManager().structure;
|
||||||
|
const figureContainer = new AvatarFigureContainer("");
|
||||||
|
const requiredSets = getRandomSetTypes(structure.getMandatorySetTypeIds(gender, clubLevel), FigureData.SET_TYPES);
|
||||||
|
|
||||||
for(const setType of ignoredSets)
|
for (const setType of ignoredSets) {
|
||||||
{
|
const partSetId = figureData.getPartSetId(setType);
|
||||||
const partSetId = figureData.getPartSetId(setType);
|
const colors = figureData.getColorIds(setType);
|
||||||
const colors = figureData.getColorIds(setType);
|
|
||||||
|
|
||||||
figureContainer.updatePart(setType, partSetId, colors);
|
figureContainer.updatePart(setType, partSetId, colors);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const type of requiredSets) {
|
||||||
|
if (figureContainer.hasPartType(type)) continue;
|
||||||
|
|
||||||
|
const setType = structure.figureData.getSetType(type) as SetType;
|
||||||
|
const selectedSet = getRandomPartSet(setType, gender, clubLevel, figureSetIds);
|
||||||
|
|
||||||
|
if (!selectedSet) continue;
|
||||||
|
|
||||||
|
let selectedColors: number[] = [];
|
||||||
|
|
||||||
|
if (selectedSet.isColorable) {
|
||||||
|
selectedColors = getRandomColors(structure.figureData.getPalette(setType.paletteID), selectedSet, clubLevel).map(color => color.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(const type of requiredSets)
|
figureContainer.updatePart(setType.type, selectedSet.id, selectedColors);
|
||||||
{
|
}
|
||||||
if(figureContainer.hasPartType(type)) continue;
|
|
||||||
|
|
||||||
const setType = (structure.figureData.getSetType(type) as SetType);
|
|
||||||
const selectedSet = getRandomPartSet(setType, gender, clubLevel, figureSetIds);
|
|
||||||
|
|
||||||
if(!selectedSet) continue;
|
return figureContainer.getFigureString();
|
||||||
|
|
||||||
let selectedColors: number[] = [];
|
|
||||||
|
|
||||||
if(selectedSet.isColorable)
|
|
||||||
{
|
|
||||||
selectedColors = getRandomColors(structure.figureData.getPalette(setType.paletteID), selectedSet, clubLevel).map(color => color.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
figureContainer.updatePart(setType.type, selectedSet.id, selectedColors);
|
|
||||||
}
|
|
||||||
|
|
||||||
return figureContainer.getFigureString();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,22 @@
|
||||||
import { AvatarEditorFigureCategory } from '@nitro/renderer';
|
import {AvatarEditorFigureCategory} from "@nitro/renderer";
|
||||||
import { CategoryBaseModel } from './CategoryBaseModel';
|
|
||||||
import { FigureData } from './FigureData';
|
|
||||||
|
|
||||||
export class HeadModel extends CategoryBaseModel
|
import {CategoryBaseModel} from "./CategoryBaseModel";
|
||||||
{
|
import {FigureData} from "./FigureData";
|
||||||
public init(): void
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
this.addCategory(FigureData.HAIR);
|
export class HeadModel extends CategoryBaseModel {
|
||||||
this.addCategory(FigureData.HAT);
|
public init(): void {
|
||||||
this.addCategory(FigureData.HEAD_ACCESSORIES);
|
super.init();
|
||||||
this.addCategory(FigureData.EYE_ACCESSORIES);
|
|
||||||
this.addCategory(FigureData.FACE_ACCESSORIES);
|
|
||||||
|
|
||||||
this._isInitalized = true;
|
this.addCategory(FigureData.HAIR);
|
||||||
}
|
this.addCategory(FigureData.HAT);
|
||||||
|
this.addCategory(FigureData.HEAD_ACCESSORIES);
|
||||||
|
this.addCategory(FigureData.EYE_ACCESSORIES);
|
||||||
|
this.addCategory(FigureData.FACE_ACCESSORIES);
|
||||||
|
|
||||||
public get name(): string
|
this._isInitalized = true;
|
||||||
{
|
}
|
||||||
return AvatarEditorFigureCategory.HEAD;
|
|
||||||
}
|
public get name(): string {
|
||||||
|
return AvatarEditorFigureCategory.HEAD;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
import { CategoryData } from './CategoryData';
|
import {CategoryData} from "./CategoryData";
|
||||||
|
|
||||||
export interface IAvatarEditorCategoryModel
|
export interface IAvatarEditorCategoryModel {
|
||||||
{
|
init(): void;
|
||||||
init(): void;
|
dispose(): void;
|
||||||
dispose(): void;
|
reset(): void;
|
||||||
reset(): void;
|
getCategoryData(category: string): CategoryData;
|
||||||
getCategoryData(category: string): CategoryData;
|
selectPart(category: string, partIndex: number): void;
|
||||||
selectPart(category: string, partIndex: number): void;
|
selectColor(category: string, colorIndex: number, paletteId: number): void;
|
||||||
selectColor(category: string, colorIndex: number, paletteId: number): void;
|
hasClubSelectionsOverLevel(level: number): boolean;
|
||||||
hasClubSelectionsOverLevel(level: number): boolean;
|
hasInvalidSelectedItems(ownedItems: number[]): boolean;
|
||||||
hasInvalidSelectedItems(ownedItems: number[]): boolean;
|
stripClubItemsOverLevel(level: number): boolean;
|
||||||
stripClubItemsOverLevel(level: number): boolean;
|
stripInvalidSellableItems(): boolean;
|
||||||
stripInvalidSellableItems(): boolean;
|
categories: Map<string, CategoryData>;
|
||||||
categories: Map<string, CategoryData>;
|
canSetGender: boolean;
|
||||||
canSetGender: boolean;
|
maxPaletteCount: number;
|
||||||
maxPaletteCount: number;
|
name: string;
|
||||||
name: string;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
import { AvatarEditorFigureCategory } from '@nitro/renderer';
|
import {AvatarEditorFigureCategory} from "@nitro/renderer";
|
||||||
import { CategoryBaseModel } from './CategoryBaseModel';
|
|
||||||
import { FigureData } from './FigureData';
|
|
||||||
|
|
||||||
export class LegModel extends CategoryBaseModel
|
import {CategoryBaseModel} from "./CategoryBaseModel";
|
||||||
{
|
import {FigureData} from "./FigureData";
|
||||||
public init(): void
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
this.addCategory(FigureData.TROUSERS);
|
export class LegModel extends CategoryBaseModel {
|
||||||
this.addCategory(FigureData.SHOES);
|
public init(): void {
|
||||||
this.addCategory(FigureData.TROUSER_ACCESSORIES);
|
super.init();
|
||||||
|
|
||||||
this._isInitalized = true;
|
this.addCategory(FigureData.TROUSERS);
|
||||||
}
|
this.addCategory(FigureData.SHOES);
|
||||||
|
this.addCategory(FigureData.TROUSER_ACCESSORIES);
|
||||||
|
|
||||||
public get name(): string
|
this._isInitalized = true;
|
||||||
{
|
}
|
||||||
return AvatarEditorFigureCategory.LEGS;
|
|
||||||
}
|
public get name(): string {
|
||||||
|
return AvatarEditorFigureCategory.LEGS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
import { AvatarEditorFigureCategory } from '@nitro/renderer';
|
import {AvatarEditorFigureCategory} from "@nitro/renderer";
|
||||||
import { CategoryBaseModel } from './CategoryBaseModel';
|
|
||||||
import { FigureData } from './FigureData';
|
|
||||||
|
|
||||||
export class TorsoModel extends CategoryBaseModel
|
import {CategoryBaseModel} from "./CategoryBaseModel";
|
||||||
{
|
import {FigureData} from "./FigureData";
|
||||||
public init(): void
|
|
||||||
{
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
this.addCategory(FigureData.SHIRT);
|
export class TorsoModel extends CategoryBaseModel {
|
||||||
this.addCategory(FigureData.CHEST_PRINTS);
|
public init(): void {
|
||||||
this.addCategory(FigureData.JACKET);
|
super.init();
|
||||||
this.addCategory(FigureData.CHEST_ACCESSORIES);
|
|
||||||
|
|
||||||
this._isInitalized = true;
|
this.addCategory(FigureData.SHIRT);
|
||||||
}
|
this.addCategory(FigureData.CHEST_PRINTS);
|
||||||
|
this.addCategory(FigureData.JACKET);
|
||||||
|
this.addCategory(FigureData.CHEST_ACCESSORIES);
|
||||||
|
|
||||||
public get name(): string
|
this._isInitalized = true;
|
||||||
{
|
}
|
||||||
return AvatarEditorFigureCategory.TORSO;
|
|
||||||
}
|
public get name(): string {
|
||||||
|
return AvatarEditorFigureCategory.TORSO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
export * from './AvatarEditorAction';
|
export * from "./AvatarEditorAction";
|
||||||
export * from './AvatarEditorGridColorItem';
|
export * from "./AvatarEditorGridColorItem";
|
||||||
export * from './AvatarEditorGridPartItem';
|
export * from "./AvatarEditorGridPartItem";
|
||||||
export * from './AvatarEditorUtilities';
|
export * from "./AvatarEditorUtilities";
|
||||||
export * from './BodyModel';
|
export * from "./BodyModel";
|
||||||
export * from './CategoryBaseModel';
|
export * from "./CategoryBaseModel";
|
||||||
export * from './CategoryData';
|
export * from "./CategoryData";
|
||||||
export * from './FigureData';
|
export * from "./FigureData";
|
||||||
export * from './FigureGenerator';
|
export * from "./FigureGenerator";
|
||||||
export * from './HeadModel';
|
export * from "./HeadModel";
|
||||||
export * from './IAvatarEditorCategoryModel';
|
export * from "./IAvatarEditorCategoryModel";
|
||||||
export * from './LegModel';
|
export * from "./LegModel";
|
||||||
export * from './TorsoModel';
|
export * from "./TorsoModel";
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
export class CameraEditorTabs
|
export class CameraEditorTabs {
|
||||||
{
|
public static readonly COLORMATRIX: string = "colormatrix";
|
||||||
public static readonly COLORMATRIX: string = 'colormatrix';
|
public static readonly COMPOSITE: string = "composite";
|
||||||
public static readonly COMPOSITE: string = 'composite';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
import { NitroTexture } from '@nitro/renderer';
|
import {NitroTexture} from "@nitro/renderer";
|
||||||
|
|
||||||
export class CameraPicture
|
export class CameraPicture {
|
||||||
{
|
constructor(public texture: NitroTexture, public imageUrl: string) {}
|
||||||
constructor(
|
|
||||||
public texture: NitroTexture,
|
|
||||||
public imageUrl: string)
|
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
export class CameraPictureThumbnail
|
export class CameraPictureThumbnail {
|
||||||
{
|
constructor(public effectName: string, public thumbnailUrl: string) {}
|
||||||
constructor(
|
|
||||||
public effectName: string,
|
|
||||||
public thumbnailUrl: string)
|
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './CameraEditorTabs';
|
export * from "./CameraEditorTabs";
|
||||||
export * from './CameraPicture';
|
export * from "./CameraPicture";
|
||||||
export * from './CameraPictureThumbnail';
|
export * from "./CameraPictureThumbnail";
|
||||||
|
|
|
@ -1,30 +1,25 @@
|
||||||
import { ICalendarItem } from './ICalendarItem';
|
import {ICalendarItem} from "./ICalendarItem";
|
||||||
|
|
||||||
export class CalendarItem implements ICalendarItem
|
export class CalendarItem implements ICalendarItem {
|
||||||
{
|
private _productName: string;
|
||||||
private _productName: string;
|
private _customImage: string;
|
||||||
private _customImage: string;
|
private _furnitureClassName: string;
|
||||||
private _furnitureClassName: string;
|
|
||||||
|
|
||||||
constructor(productName: string, customImage: string, furnitureClassName: string)
|
constructor(productName: string, customImage: string, furnitureClassName: string) {
|
||||||
{
|
this._productName = productName;
|
||||||
this._productName = productName;
|
this._customImage = customImage;
|
||||||
this._customImage = customImage;
|
this._furnitureClassName = furnitureClassName;
|
||||||
this._furnitureClassName = furnitureClassName;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get productName(): string
|
public get productName(): string {
|
||||||
{
|
return this._productName;
|
||||||
return this._productName;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get customImage(): string
|
public get customImage(): string {
|
||||||
{
|
return this._customImage;
|
||||||
return this._customImage;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get furnitureClassName(): string
|
public get furnitureClassName(): string {
|
||||||
{
|
return this._furnitureClassName;
|
||||||
return this._furnitureClassName;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
export class CalendarItemState
|
export class CalendarItemState {
|
||||||
{
|
public static readonly STATE_UNLOCKED = 1;
|
||||||
public static readonly STATE_UNLOCKED = 1;
|
public static readonly STATE_LOCKED_AVAILABLE = 2;
|
||||||
public static readonly STATE_LOCKED_AVAILABLE = 2;
|
public static readonly STATE_LOCKED_EXPIRED = 3;
|
||||||
public static readonly STATE_LOCKED_EXPIRED = 3;
|
public static readonly STATE_LOCKED_FUTURE = 4;
|
||||||
public static readonly STATE_LOCKED_FUTURE = 4;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export interface ICalendarItem
|
export interface ICalendarItem {
|
||||||
{
|
readonly productName: string;
|
||||||
readonly productName: string;
|
readonly customImage: string;
|
||||||
readonly customImage: string;
|
readonly furnitureClassName: string;
|
||||||
readonly furnitureClassName: string;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export * from './CalendarItem';
|
export * from "./CalendarItem";
|
||||||
export * from './CalendarItemState';
|
export * from "./CalendarItemState";
|
||||||
export * from './ICalendarItem';
|
export * from "./ICalendarItem";
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
export class BuilderFurniPlaceableStatus
|
export class BuilderFurniPlaceableStatus {
|
||||||
{
|
public static OKAY: number = 0;
|
||||||
public static OKAY: number = 0;
|
public static MISSING_OFFER: number = 1;
|
||||||
public static MISSING_OFFER: number = 1;
|
public static FURNI_LIMIT_REACHED: number = 2;
|
||||||
public static FURNI_LIMIT_REACHED: number = 2;
|
public static NOT_IN_ROOM: number = 3;
|
||||||
public static NOT_IN_ROOM: number = 3;
|
public static NOT_ROOM_OWNER: number = 4;
|
||||||
public static NOT_ROOM_OWNER: number = 4;
|
public static GUILD_ROOM: number = 5;
|
||||||
public static GUILD_ROOM: number = 5;
|
public static VISITORS_IN_ROOM: number = 6;
|
||||||
public static VISITORS_IN_ROOM: number = 6;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,124 +1,105 @@
|
||||||
import { NodeData } from '@nitro/renderer';
|
import {NodeData} from "@nitro/renderer";
|
||||||
import { ICatalogNode } from './ICatalogNode';
|
|
||||||
|
|
||||||
export class CatalogNode implements ICatalogNode
|
import {ICatalogNode} from "./ICatalogNode";
|
||||||
{
|
|
||||||
private _depth: number = 0;
|
|
||||||
private _localization: string = '';
|
|
||||||
private _pageId: number = -1;
|
|
||||||
private _pageName: string = '';
|
|
||||||
private _iconId: number = 0;
|
|
||||||
private _children: ICatalogNode[];
|
|
||||||
private _offerIds: number[];
|
|
||||||
private _parent: ICatalogNode;
|
|
||||||
private _isVisible: boolean;
|
|
||||||
private _isActive: boolean;
|
|
||||||
private _isOpen: boolean;
|
|
||||||
|
|
||||||
constructor(node: NodeData, depth: number, parent: ICatalogNode)
|
export class CatalogNode implements ICatalogNode {
|
||||||
{
|
private _depth: number = 0;
|
||||||
this._depth = depth;
|
private _localization: string = "";
|
||||||
this._parent = parent;
|
private _pageId: number = -1;
|
||||||
this._localization = node.localization;
|
private _pageName: string = "";
|
||||||
this._pageId = node.pageId;
|
private _iconId: number = 0;
|
||||||
this._pageName = node.pageName;
|
private _children: ICatalogNode[];
|
||||||
this._iconId = node.icon;
|
private _offerIds: number[];
|
||||||
this._children = [];
|
private _parent: ICatalogNode;
|
||||||
this._offerIds = node.offerIds;
|
private _isVisible: boolean;
|
||||||
this._isVisible = node.visible;
|
private _isActive: boolean;
|
||||||
this._isActive = false;
|
private _isOpen: boolean;
|
||||||
this._isOpen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public activate(): void
|
constructor(node: NodeData, depth: number, parent: ICatalogNode) {
|
||||||
{
|
this._depth = depth;
|
||||||
this._isActive = true;
|
this._parent = parent;
|
||||||
}
|
this._localization = node.localization;
|
||||||
|
this._pageId = node.pageId;
|
||||||
|
this._pageName = node.pageName;
|
||||||
|
this._iconId = node.icon;
|
||||||
|
this._children = [];
|
||||||
|
this._offerIds = node.offerIds;
|
||||||
|
this._isVisible = node.visible;
|
||||||
|
this._isActive = false;
|
||||||
|
this._isOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
public deactivate(): void
|
public activate(): void {
|
||||||
{
|
this._isActive = true;
|
||||||
this._isActive = false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public open(): void
|
public deactivate(): void {
|
||||||
{
|
this._isActive = false;
|
||||||
this._isOpen = true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public close(): void
|
public open(): void {
|
||||||
{
|
this._isOpen = true;
|
||||||
this._isOpen = false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public addChild(child: ICatalogNode):void
|
public close(): void {
|
||||||
{
|
this._isOpen = false;
|
||||||
if(!child) return;
|
}
|
||||||
|
|
||||||
this._children.push(child);
|
public addChild(child: ICatalogNode): void {
|
||||||
}
|
if (!child) return;
|
||||||
|
|
||||||
public get depth(): number
|
this._children.push(child);
|
||||||
{
|
}
|
||||||
return this._depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isBranch(): boolean
|
public get depth(): number {
|
||||||
{
|
return this._depth;
|
||||||
return (this._children.length > 0);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isLeaf(): boolean
|
public get isBranch(): boolean {
|
||||||
{
|
return this._children.length > 0;
|
||||||
return (this._children.length === 0);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get localization(): string
|
public get isLeaf(): boolean {
|
||||||
{
|
return this._children.length === 0;
|
||||||
return this._localization;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get pageId(): number
|
public get localization(): string {
|
||||||
{
|
return this._localization;
|
||||||
return this._pageId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get pageName(): string
|
public get pageId(): number {
|
||||||
{
|
return this._pageId;
|
||||||
return this._pageName;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get iconId(): number
|
public get pageName(): string {
|
||||||
{
|
return this._pageName;
|
||||||
return this._iconId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get children(): ICatalogNode[]
|
public get iconId(): number {
|
||||||
{
|
return this._iconId;
|
||||||
return this._children;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get offerIds(): number[]
|
public get children(): ICatalogNode[] {
|
||||||
{
|
return this._children;
|
||||||
return this._offerIds;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get parent(): ICatalogNode
|
public get offerIds(): number[] {
|
||||||
{
|
return this._offerIds;
|
||||||
return this._parent;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isVisible(): boolean
|
public get parent(): ICatalogNode {
|
||||||
{
|
return this._parent;
|
||||||
return this._isVisible;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isActive(): boolean
|
public get isVisible(): boolean {
|
||||||
{
|
return this._isVisible;
|
||||||
return this._isActive;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isOpen(): boolean
|
public get isActive(): boolean {
|
||||||
{
|
return this._isActive;
|
||||||
return this._isOpen;
|
}
|
||||||
}
|
|
||||||
|
public get isOpen(): boolean {
|
||||||
|
return this._isOpen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,58 @@
|
||||||
import { ICatalogPage } from './ICatalogPage';
|
import {ICatalogPage} from "./ICatalogPage";
|
||||||
import { IPageLocalization } from './IPageLocalization';
|
import {IPageLocalization} from "./IPageLocalization";
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
|
|
||||||
export class CatalogPage implements ICatalogPage
|
export class CatalogPage implements ICatalogPage {
|
||||||
{
|
public static MODE_NORMAL: number = 0;
|
||||||
public static MODE_NORMAL: number = 0;
|
|
||||||
|
|
||||||
private _pageId: number;
|
private _pageId: number;
|
||||||
private _layoutCode: string;
|
private _layoutCode: string;
|
||||||
private _localization: IPageLocalization;
|
private _localization: IPageLocalization;
|
||||||
private _offers: IPurchasableOffer[];
|
private _offers: IPurchasableOffer[];
|
||||||
private _acceptSeasonCurrencyAsCredits: boolean;
|
private _acceptSeasonCurrencyAsCredits: boolean;
|
||||||
private _mode: number;
|
private _mode: number;
|
||||||
|
|
||||||
constructor(pageId: number, layoutCode: string, localization: IPageLocalization, offers: IPurchasableOffer[], acceptSeasonCurrencyAsCredits: boolean, mode: number = -1)
|
constructor(
|
||||||
{
|
pageId: number,
|
||||||
this._pageId = pageId;
|
layoutCode: string,
|
||||||
this._layoutCode = layoutCode;
|
localization: IPageLocalization,
|
||||||
this._localization = localization;
|
offers: IPurchasableOffer[],
|
||||||
this._offers = offers;
|
acceptSeasonCurrencyAsCredits: boolean,
|
||||||
this._acceptSeasonCurrencyAsCredits = acceptSeasonCurrencyAsCredits;
|
mode: number = -1
|
||||||
|
) {
|
||||||
|
this._pageId = pageId;
|
||||||
|
this._layoutCode = layoutCode;
|
||||||
|
this._localization = localization;
|
||||||
|
this._offers = offers;
|
||||||
|
this._acceptSeasonCurrencyAsCredits = acceptSeasonCurrencyAsCredits;
|
||||||
|
|
||||||
for(const offer of offers) (offer.page = this);
|
for (const offer of offers) offer.page = this;
|
||||||
|
|
||||||
if(mode === -1) this._mode = CatalogPage.MODE_NORMAL;
|
if (mode === -1) this._mode = CatalogPage.MODE_NORMAL;
|
||||||
else this._mode = mode;
|
else this._mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get pageId(): number
|
public get pageId(): number {
|
||||||
{
|
return this._pageId;
|
||||||
return this._pageId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get layoutCode(): string
|
public get layoutCode(): string {
|
||||||
{
|
return this._layoutCode;
|
||||||
return this._layoutCode;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get localization(): IPageLocalization
|
public get localization(): IPageLocalization {
|
||||||
{
|
return this._localization;
|
||||||
return this._localization;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get offers(): IPurchasableOffer[]
|
public get offers(): IPurchasableOffer[] {
|
||||||
{
|
return this._offers;
|
||||||
return this._offers;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get acceptSeasonCurrencyAsCredits(): boolean
|
public get acceptSeasonCurrencyAsCredits(): boolean {
|
||||||
{
|
return this._acceptSeasonCurrencyAsCredits;
|
||||||
return this._acceptSeasonCurrencyAsCredits;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get mode(): number
|
public get mode(): number {
|
||||||
{
|
return this._mode;
|
||||||
return this._mode;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
export class CatalogPageName
|
export class CatalogPageName {
|
||||||
{
|
public static DUCKET_INFO: string = "ducket_info";
|
||||||
public static DUCKET_INFO: string = 'ducket_info';
|
public static CREDITS: string = "credits";
|
||||||
public static CREDITS: string = 'credits';
|
public static AVATAR_EFFECTS: string = "avatar_effects";
|
||||||
public static AVATAR_EFFECTS: string = 'avatar_effects';
|
public static HC_MEMBERSHIP: string = "hc_membership";
|
||||||
public static HC_MEMBERSHIP: string = 'hc_membership';
|
public static CLUB_GIFTS: string = "club_gifts";
|
||||||
public static CLUB_GIFTS: string = 'club_gifts';
|
public static LIMITED_SOLD: string = "limited_sold";
|
||||||
public static LIMITED_SOLD: string = 'limited_sold';
|
public static PET_ACCESSORIES: string = "pet_accessories";
|
||||||
public static PET_ACCESSORIES: string = 'pet_accessories';
|
public static TRAX_SONGS: string = "trax_songs";
|
||||||
public static TRAX_SONGS: string = 'trax_songs';
|
public static NEW_ADDITIONS: string = "new_additions";
|
||||||
public static NEW_ADDITIONS: string = 'new_additions';
|
public static QUEST_SHELL: string = "quest_shell";
|
||||||
public static QUEST_SHELL: string = 'quest_shell';
|
public static QUEST_SNOWFLAKES: string = "quest_snowflakes";
|
||||||
public static QUEST_SNOWFLAKES: string = 'quest_snowflakes';
|
public static VAL_QUESTS: string = "val_quests";
|
||||||
public static VAL_QUESTS: string = 'val_quests';
|
public static GUILD_CUSTOM_FURNI: string = "guild_custom_furni";
|
||||||
public static GUILD_CUSTOM_FURNI: string = 'guild_custom_furni';
|
public static GIFT_SHOP: string = "gift_shop";
|
||||||
public static GIFT_SHOP: string = 'gift_shop';
|
public static HORSE_STYLES: string = "horse_styles";
|
||||||
public static HORSE_STYLES: string = 'horse_styles';
|
public static HORSE_SHOE: string = "horse_shoe";
|
||||||
public static HORSE_SHOE: string = 'horse_shoe';
|
public static SET_EASTER: string = "set_easter";
|
||||||
public static SET_EASTER: string = 'set_easter';
|
public static ECOTRON_TRANSFORM: string = "ecotron_transform";
|
||||||
public static ECOTRON_TRANSFORM: string = 'ecotron_transform';
|
public static LOYALTY_INFO: string = "loyalty_info";
|
||||||
public static LOYALTY_INFO: string = 'loyalty_info';
|
public static ROOM_BUNDLES: string = "room_bundles";
|
||||||
public static ROOM_BUNDLES: string = 'room_bundles';
|
public static ROOM_BUNDLES_MOBILE: string = "room_bundles_mobile";
|
||||||
public static ROOM_BUNDLES_MOBILE: string = 'room_bundles_mobile';
|
public static HABBO_CLUB_DESKTOP: string = "habbo_club_desktop";
|
||||||
public static HABBO_CLUB_DESKTOP: string = 'habbo_club_desktop';
|
public static MOBILE_SUBSCRIPTIONS: string = "mobile_subscriptions";
|
||||||
public static MOBILE_SUBSCRIPTIONS: string = 'mobile_subscriptions';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
import { SellablePetPaletteData } from '@nitro/renderer';
|
import {SellablePetPaletteData} from "@nitro/renderer";
|
||||||
|
|
||||||
export class CatalogPetPalette
|
export class CatalogPetPalette {
|
||||||
{
|
constructor(public readonly breed: string, public readonly palettes: SellablePetPaletteData[]) {}
|
||||||
constructor(
|
|
||||||
public readonly breed: string,
|
|
||||||
public readonly palettes: SellablePetPaletteData[]
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
export class CatalogPurchaseState
|
export class CatalogPurchaseState {
|
||||||
{
|
public static NONE = 0;
|
||||||
public static NONE = 0;
|
public static CONFIRM = 1;
|
||||||
public static CONFIRM = 1;
|
public static PURCHASE = 2;
|
||||||
public static PURCHASE = 2;
|
public static NO_CREDITS = 3;
|
||||||
public static NO_CREDITS = 3;
|
public static NO_POINTS = 4;
|
||||||
public static NO_POINTS = 4;
|
public static SOLD_OUT = 5;
|
||||||
public static SOLD_OUT = 5;
|
public static FAILED = 6;
|
||||||
public static FAILED = 6;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
export class CatalogType
|
export class CatalogType {
|
||||||
{
|
public static NORMAL: string = "NORMAL";
|
||||||
public static NORMAL: string = 'NORMAL';
|
public static BUILDER: string = "BUILDERS_CLUB";
|
||||||
public static BUILDER: string = 'BUILDERS_CLUB';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,125 +1,207 @@
|
||||||
import { SellablePetPaletteData } from '@nitro/renderer';
|
import {SellablePetPaletteData} from "@nitro/renderer";
|
||||||
import { GetRoomEngine } from '../nitro';
|
|
||||||
import { ICatalogNode } from './ICatalogNode';
|
|
||||||
|
|
||||||
export const GetPixelEffectIcon = (id: number) =>
|
import {GetRoomEngine} from "../nitro";
|
||||||
{
|
import {ICatalogNode} from "./ICatalogNode";
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GetSubscriptionProductIcon = (id: number) =>
|
export const GetPixelEffectIcon = (id: number) => {
|
||||||
{
|
return "";
|
||||||
return '';
|
};
|
||||||
}
|
|
||||||
|
|
||||||
export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId: number) =>
|
export const GetSubscriptionProductIcon = (id: number) => {
|
||||||
{
|
return "";
|
||||||
const nodes = offerNodes.get(offerId);
|
};
|
||||||
const allowedNodes: ICatalogNode[] = [];
|
|
||||||
|
|
||||||
if(nodes && nodes.length)
|
export const GetOfferNodes = (offerNodes: Map<number, ICatalogNode[]>, offerId: number) => {
|
||||||
{
|
const nodes = offerNodes.get(offerId);
|
||||||
for(const node of nodes)
|
const allowedNodes: ICatalogNode[] = [];
|
||||||
{
|
|
||||||
if(!node.isVisible) continue;
|
if (nodes && nodes.length) {
|
||||||
|
for (const node of nodes) {
|
||||||
allowedNodes.push(node);
|
if (!node.isVisible) continue;
|
||||||
}
|
|
||||||
|
allowedNodes.push(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return allowedNodes;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) => {
|
||||||
|
if (node.isVisible && node.pageId > 0) {
|
||||||
|
let nodeAdded = false;
|
||||||
|
|
||||||
|
const hayStack = [node.pageName, node.localization].join(" ").toLowerCase().replace(/ /gi, "");
|
||||||
|
|
||||||
|
if (hayStack.indexOf(search) > -1) {
|
||||||
|
nodes.push(node);
|
||||||
|
|
||||||
|
nodeAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return allowedNodes;
|
if (!nodeAdded) {
|
||||||
}
|
for (const furniLine of furniLines) {
|
||||||
|
if (hayStack.indexOf(furniLine) >= 0) {
|
||||||
|
nodes.push(node);
|
||||||
|
|
||||||
export const FilterCatalogNode = (search: string, furniLines: string[], node: ICatalogNode, nodes: ICatalogNode[]) =>
|
break;
|
||||||
{
|
|
||||||
if(node.isVisible && (node.pageId > 0))
|
|
||||||
{
|
|
||||||
let nodeAdded = false;
|
|
||||||
|
|
||||||
const hayStack = [ node.pageName, node.localization ].join(' ').toLowerCase().replace(/ /gi, '');
|
|
||||||
|
|
||||||
if(hayStack.indexOf(search) > -1)
|
|
||||||
{
|
|
||||||
nodes.push(node);
|
|
||||||
|
|
||||||
nodeAdded = true;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!nodeAdded)
|
for (const child of node.children) FilterCatalogNode(search, furniLines, child, nodes);
|
||||||
{
|
};
|
||||||
for(const furniLine of furniLines)
|
|
||||||
{
|
|
||||||
if(hayStack.indexOf(furniLine) >= 0)
|
|
||||||
{
|
|
||||||
nodes.push(node);
|
|
||||||
|
|
||||||
break;
|
export function GetPetIndexFromLocalization(localization: string) {
|
||||||
}
|
if (!localization.length) return 0;
|
||||||
}
|
|
||||||
}
|
let index = localization.length - 1;
|
||||||
}
|
|
||||||
|
while (index >= 0) {
|
||||||
for(const child of node.children) FilterCatalogNode(search, furniLines, child, nodes);
|
if (isNaN(parseInt(localization.charAt(index)))) break;
|
||||||
}
|
|
||||||
|
index--;
|
||||||
export function GetPetIndexFromLocalization(localization: string)
|
}
|
||||||
{
|
|
||||||
if(!localization.length) return 0;
|
if (index > 0) return parseInt(localization.substring(index + 1));
|
||||||
|
|
||||||
let index = (localization.length - 1);
|
return -1;
|
||||||
|
}
|
||||||
while(index >= 0)
|
|
||||||
{
|
export function GetPetAvailableColors(petIndex: number, palettes: SellablePetPaletteData[]): number[][] {
|
||||||
if(isNaN(parseInt(localization.charAt(index)))) break;
|
switch (petIndex) {
|
||||||
|
case 0:
|
||||||
index--;
|
return [
|
||||||
}
|
[16743226],
|
||||||
|
[16750435],
|
||||||
if(index > 0) return parseInt(localization.substring(index + 1));
|
[16764339],
|
||||||
|
[0xf59500],
|
||||||
return -1;
|
[16498012],
|
||||||
}
|
[16704690],
|
||||||
|
[0xedd400],
|
||||||
export function GetPetAvailableColors(petIndex: number, palettes: SellablePetPaletteData[]): number[][]
|
[16115545],
|
||||||
{
|
[16513201],
|
||||||
switch(petIndex)
|
[8694111],
|
||||||
{
|
[11585939],
|
||||||
case 0:
|
[14413767],
|
||||||
return [ [ 16743226 ], [ 16750435 ], [ 16764339 ], [ 0xF59500 ], [ 16498012 ], [ 16704690 ], [ 0xEDD400 ], [ 16115545 ], [ 16513201 ], [ 8694111 ], [ 11585939 ], [ 14413767 ], [ 6664599 ], [ 9553845 ], [ 12971486 ], [ 8358322 ], [ 10002885 ], [ 13292268 ], [ 10780600 ], [ 12623573 ], [ 14403561 ], [ 12418717 ], [ 14327229 ], [ 15517403 ], [ 14515069 ], [ 15764368 ], [ 16366271 ], [ 0xABABAB ], [ 0xD4D4D4 ], [ 0xFFFFFF ], [ 14256481 ], [ 14656129 ], [ 15848130 ], [ 14005087 ], [ 14337152 ], [ 15918540 ], [ 15118118 ], [ 15531929 ], [ 9764857 ], [ 11258085 ] ];
|
[6664599],
|
||||||
case 1:
|
[9553845],
|
||||||
return [ [ 16743226 ], [ 16750435 ], [ 16764339 ], [ 0xF59500 ], [ 16498012 ], [ 16704690 ], [ 0xEDD400 ], [ 16115545 ], [ 16513201 ], [ 8694111 ], [ 11585939 ], [ 14413767 ], [ 6664599 ], [ 9553845 ], [ 12971486 ], [ 8358322 ], [ 10002885 ], [ 13292268 ], [ 10780600 ], [ 12623573 ], [ 14403561 ], [ 12418717 ], [ 14327229 ], [ 15517403 ], [ 14515069 ], [ 15764368 ], [ 16366271 ], [ 0xABABAB ], [ 0xD4D4D4 ], [ 0xFFFFFF ], [ 14256481 ], [ 14656129 ], [ 15848130 ], [ 14005087 ], [ 14337152 ], [ 15918540 ], [ 15118118 ], [ 15531929 ], [ 9764857 ], [ 11258085 ] ];
|
[12971486],
|
||||||
case 2:
|
[8358322],
|
||||||
return [ [ 16579283 ], [ 15378351 ], [ 8830016 ], [ 15257125 ], [ 9340985 ], [ 8949607 ], [ 6198292 ], [ 8703620 ], [ 9889626 ], [ 8972045 ], [ 12161285 ], [ 13162269 ], [ 8620113 ], [ 12616503 ], [ 8628101 ], [ 0xD2FF00 ], [ 9764857 ] ];
|
[10002885],
|
||||||
case 3:
|
[13292268],
|
||||||
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
[10780600],
|
||||||
case 4:
|
[12623573],
|
||||||
return [ [ 0xFFFFFF ], [ 16053490 ], [ 15464440 ], [ 16248792 ], [ 15396319 ], [ 15007487 ] ];
|
[14403561],
|
||||||
case 5:
|
[12418717],
|
||||||
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
[14327229],
|
||||||
case 6:
|
[15517403],
|
||||||
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ], [ 16767177 ], [ 16770205 ], [ 16751331 ] ];
|
[14515069],
|
||||||
case 7:
|
[15764368],
|
||||||
return [ [ 0xCCCCCC ], [ 0xAEAEAE ], [ 16751331 ], [ 10149119 ], [ 16763290 ], [ 16743786 ] ];
|
[16366271],
|
||||||
default: {
|
[0xababab],
|
||||||
const colors: number[][] = [];
|
[0xd4d4d4],
|
||||||
|
[0xffffff],
|
||||||
for(const palette of palettes)
|
[14256481],
|
||||||
{
|
[14656129],
|
||||||
const petColorResult = GetRoomEngine().getPetColorResult(petIndex, palette.paletteId);
|
[15848130],
|
||||||
|
[14005087],
|
||||||
if(!petColorResult) continue;
|
[14337152],
|
||||||
|
[15918540],
|
||||||
if(petColorResult.primaryColor === petColorResult.secondaryColor)
|
[15118118],
|
||||||
{
|
[15531929],
|
||||||
colors.push([ petColorResult.primaryColor ]);
|
[9764857],
|
||||||
}
|
[11258085],
|
||||||
else
|
];
|
||||||
{
|
case 1:
|
||||||
colors.push([ petColorResult.primaryColor, petColorResult.secondaryColor ]);
|
return [
|
||||||
}
|
[16743226],
|
||||||
}
|
[16750435],
|
||||||
|
[16764339],
|
||||||
return colors;
|
[0xf59500],
|
||||||
|
[16498012],
|
||||||
|
[16704690],
|
||||||
|
[0xedd400],
|
||||||
|
[16115545],
|
||||||
|
[16513201],
|
||||||
|
[8694111],
|
||||||
|
[11585939],
|
||||||
|
[14413767],
|
||||||
|
[6664599],
|
||||||
|
[9553845],
|
||||||
|
[12971486],
|
||||||
|
[8358322],
|
||||||
|
[10002885],
|
||||||
|
[13292268],
|
||||||
|
[10780600],
|
||||||
|
[12623573],
|
||||||
|
[14403561],
|
||||||
|
[12418717],
|
||||||
|
[14327229],
|
||||||
|
[15517403],
|
||||||
|
[14515069],
|
||||||
|
[15764368],
|
||||||
|
[16366271],
|
||||||
|
[0xababab],
|
||||||
|
[0xd4d4d4],
|
||||||
|
[0xffffff],
|
||||||
|
[14256481],
|
||||||
|
[14656129],
|
||||||
|
[15848130],
|
||||||
|
[14005087],
|
||||||
|
[14337152],
|
||||||
|
[15918540],
|
||||||
|
[15118118],
|
||||||
|
[15531929],
|
||||||
|
[9764857],
|
||||||
|
[11258085],
|
||||||
|
];
|
||||||
|
case 2:
|
||||||
|
return [
|
||||||
|
[16579283],
|
||||||
|
[15378351],
|
||||||
|
[8830016],
|
||||||
|
[15257125],
|
||||||
|
[9340985],
|
||||||
|
[8949607],
|
||||||
|
[6198292],
|
||||||
|
[8703620],
|
||||||
|
[9889626],
|
||||||
|
[8972045],
|
||||||
|
[12161285],
|
||||||
|
[13162269],
|
||||||
|
[8620113],
|
||||||
|
[12616503],
|
||||||
|
[8628101],
|
||||||
|
[0xd2ff00],
|
||||||
|
[9764857],
|
||||||
|
];
|
||||||
|
case 3:
|
||||||
|
return [[0xffffff], [0xeeeeee], [0xdddddd]];
|
||||||
|
case 4:
|
||||||
|
return [[0xffffff], [16053490], [15464440], [16248792], [15396319], [15007487]];
|
||||||
|
case 5:
|
||||||
|
return [[0xffffff], [0xeeeeee], [0xdddddd]];
|
||||||
|
case 6:
|
||||||
|
return [[0xffffff], [0xeeeeee], [0xdddddd], [16767177], [16770205], [16751331]];
|
||||||
|
case 7:
|
||||||
|
return [[0xcccccc], [0xaeaeae], [16751331], [10149119], [16763290], [16743786]];
|
||||||
|
default: {
|
||||||
|
const colors: number[][] = [];
|
||||||
|
|
||||||
|
for (const palette of palettes) {
|
||||||
|
const petColorResult = GetRoomEngine().getPetColorResult(petIndex, palette.paletteId);
|
||||||
|
|
||||||
|
if (!petColorResult) continue;
|
||||||
|
|
||||||
|
if (petColorResult.primaryColor === petColorResult.secondaryColor) {
|
||||||
|
colors.push([petColorResult.primaryColor]);
|
||||||
|
} else {
|
||||||
|
colors.push([petColorResult.primaryColor, petColorResult.secondaryColor]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return colors;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,120 +1,106 @@
|
||||||
import { GetProductOfferComposer, IFurnitureData } from '@nitro/renderer';
|
import {GetProductOfferComposer, IFurnitureData} from "@nitro/renderer";
|
||||||
import { GetProductDataForLocalization, SendMessageComposer } from '..';
|
|
||||||
import { ICatalogPage } from './ICatalogPage';
|
|
||||||
import { IProduct } from './IProduct';
|
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
|
||||||
import { Offer } from './Offer';
|
|
||||||
import { Product } from './Product';
|
|
||||||
|
|
||||||
export class FurnitureOffer implements IPurchasableOffer
|
import {GetProductDataForLocalization, SendMessageComposer} from "..";
|
||||||
{
|
import {ICatalogPage} from "./ICatalogPage";
|
||||||
private _furniData:IFurnitureData;
|
import {IProduct} from "./IProduct";
|
||||||
private _page: ICatalogPage;
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
private _product: IProduct;
|
import {Offer} from "./Offer";
|
||||||
|
import {Product} from "./Product";
|
||||||
|
|
||||||
constructor(furniData: IFurnitureData)
|
export class FurnitureOffer implements IPurchasableOffer {
|
||||||
{
|
private _furniData: IFurnitureData;
|
||||||
this._furniData = furniData;
|
private _page: ICatalogPage;
|
||||||
this._product = (new Product(this._furniData.type, this._furniData.id, this._furniData.customParams, 1, GetProductDataForLocalization(this._furniData.className), this._furniData) as IProduct);
|
private _product: IProduct;
|
||||||
}
|
|
||||||
|
|
||||||
public activate(): void
|
constructor(furniData: IFurnitureData) {
|
||||||
{
|
this._furniData = furniData;
|
||||||
SendMessageComposer(new GetProductOfferComposer((this._furniData.rentOfferId > -1) ? this._furniData.rentOfferId : this._furniData.purchaseOfferId));
|
this._product = new Product(
|
||||||
}
|
this._furniData.type,
|
||||||
|
this._furniData.id,
|
||||||
|
this._furniData.customParams,
|
||||||
|
1,
|
||||||
|
GetProductDataForLocalization(this._furniData.className),
|
||||||
|
this._furniData
|
||||||
|
) as IProduct;
|
||||||
|
}
|
||||||
|
|
||||||
public get offerId(): number
|
public activate(): void {
|
||||||
{
|
SendMessageComposer(new GetProductOfferComposer(this._furniData.rentOfferId > -1 ? this._furniData.rentOfferId : this._furniData.purchaseOfferId));
|
||||||
return (this.isRentOffer) ? this._furniData.rentOfferId : this._furniData.purchaseOfferId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get priceInActivityPoints(): number
|
public get offerId(): number {
|
||||||
{
|
return this.isRentOffer ? this._furniData.rentOfferId : this._furniData.purchaseOfferId;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get activityPointType(): number
|
public get priceInActivityPoints(): number {
|
||||||
{
|
return 0;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get priceInCredits(): number
|
public get activityPointType(): number {
|
||||||
{
|
return 0;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get page(): ICatalogPage
|
public get priceInCredits(): number {
|
||||||
{
|
return 0;
|
||||||
return this._page;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set page(page: ICatalogPage)
|
public get page(): ICatalogPage {
|
||||||
{
|
return this._page;
|
||||||
this._page = page;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get priceType(): string
|
public set page(page: ICatalogPage) {
|
||||||
{
|
this._page = page;
|
||||||
return '';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get product(): IProduct
|
public get priceType(): string {
|
||||||
{
|
return "";
|
||||||
return this._product;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get products(): IProduct[]
|
public get product(): IProduct {
|
||||||
{
|
return this._product;
|
||||||
return [ this._product ];
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get localizationId(): string
|
public get products(): IProduct[] {
|
||||||
{
|
return [this._product];
|
||||||
return 'roomItem.name.' + this._furniData.id;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get bundlePurchaseAllowed(): boolean
|
public get localizationId(): string {
|
||||||
{
|
return "roomItem.name." + this._furniData.id;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isRentOffer(): boolean
|
public get bundlePurchaseAllowed(): boolean {
|
||||||
{
|
return false;
|
||||||
return (this._furniData.rentOfferId > -1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get giftable(): boolean
|
public get isRentOffer(): boolean {
|
||||||
{
|
return this._furniData.rentOfferId > -1;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get pricingModel(): string
|
public get giftable(): boolean {
|
||||||
{
|
return false;
|
||||||
return Offer.PRICING_MODEL_FURNITURE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get clubLevel(): number
|
public get pricingModel(): string {
|
||||||
{
|
return Offer.PRICING_MODEL_FURNITURE;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get badgeCode(): string
|
public get clubLevel(): number {
|
||||||
{
|
return 0;
|
||||||
return '';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get localizationName(): string
|
public get badgeCode(): string {
|
||||||
{
|
return "";
|
||||||
return this._furniData.name;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get localizationDescription(): string
|
public get localizationName(): string {
|
||||||
{
|
return this._furniData.name;
|
||||||
return this._furniData.description;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isLazy(): boolean
|
public get localizationDescription(): string {
|
||||||
{
|
return this._furniData.description;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
public get isLazy(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
import { GetRoomEngine } from '../nitro';
|
import {GetRoomEngine} from "../nitro";
|
||||||
import { ProductTypeEnum } from './ProductTypeEnum';
|
import {ProductTypeEnum} from "./ProductTypeEnum";
|
||||||
|
|
||||||
export const GetImageIconUrlForProduct = (productType: string, productClassId: number, extraData: string = null) =>
|
export const GetImageIconUrlForProduct = (productType: string, productClassId: number, extraData: string = null) => {
|
||||||
{
|
let imageUrl: string = null;
|
||||||
let imageUrl: string = null;
|
|
||||||
|
|
||||||
switch(productType.toLocaleLowerCase())
|
switch (productType.toLocaleLowerCase()) {
|
||||||
{
|
case ProductTypeEnum.FLOOR:
|
||||||
case ProductTypeEnum.FLOOR:
|
imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(productClassId);
|
||||||
imageUrl = GetRoomEngine().getFurnitureFloorIconUrl(productClassId);
|
break;
|
||||||
break;
|
case ProductTypeEnum.WALL:
|
||||||
case ProductTypeEnum.WALL:
|
imageUrl = GetRoomEngine().getFurnitureWallIconUrl(productClassId, extraData);
|
||||||
imageUrl = GetRoomEngine().getFurnitureWallIconUrl(productClassId, extraData);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return imageUrl;
|
return imageUrl;
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,51 +1,43 @@
|
||||||
import { GiftWrappingConfigurationParser } from '@nitro/renderer';
|
import {GiftWrappingConfigurationParser} from "@nitro/renderer";
|
||||||
|
|
||||||
export class GiftWrappingConfiguration
|
export class GiftWrappingConfiguration {
|
||||||
{
|
private _isEnabled: boolean = false;
|
||||||
private _isEnabled: boolean = false;
|
private _price: number = null;
|
||||||
private _price: number = null;
|
private _stuffTypes: number[] = null;
|
||||||
private _stuffTypes: number[] = null;
|
private _boxTypes: number[] = null;
|
||||||
private _boxTypes: number[] = null;
|
private _ribbonTypes: number[] = null;
|
||||||
private _ribbonTypes: number[] = null;
|
private _defaultStuffTypes: number[] = null;
|
||||||
private _defaultStuffTypes: number[] = null;
|
|
||||||
|
|
||||||
constructor(parser: GiftWrappingConfigurationParser)
|
constructor(parser: GiftWrappingConfigurationParser) {
|
||||||
{
|
this._isEnabled = parser.isEnabled;
|
||||||
this._isEnabled = parser.isEnabled;
|
this._price = parser.price;
|
||||||
this._price = parser.price;
|
this._boxTypes = parser.boxTypes;
|
||||||
this._boxTypes = parser.boxTypes;
|
this._ribbonTypes = parser.ribbonTypes;
|
||||||
this._ribbonTypes = parser.ribbonTypes;
|
this._stuffTypes = parser.giftWrappers;
|
||||||
this._stuffTypes = parser.giftWrappers;
|
this._defaultStuffTypes = parser.giftFurnis;
|
||||||
this._defaultStuffTypes = parser.giftFurnis;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isEnabled(): boolean
|
public get isEnabled(): boolean {
|
||||||
{
|
return this._isEnabled;
|
||||||
return this._isEnabled;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get price(): number
|
public get price(): number {
|
||||||
{
|
return this._price;
|
||||||
return this._price;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get stuffTypes(): number[]
|
public get stuffTypes(): number[] {
|
||||||
{
|
return this._stuffTypes;
|
||||||
return this._stuffTypes;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get boxTypes(): number[]
|
public get boxTypes(): number[] {
|
||||||
{
|
return this._boxTypes;
|
||||||
return this._boxTypes;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get ribbonTypes(): number[]
|
public get ribbonTypes(): number[] {
|
||||||
{
|
return this._ribbonTypes;
|
||||||
return this._ribbonTypes;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get defaultStuffTypes(): number[]
|
public get defaultStuffTypes(): number[] {
|
||||||
{
|
return this._defaultStuffTypes;
|
||||||
return this._defaultStuffTypes;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
export interface ICatalogNode
|
export interface ICatalogNode {
|
||||||
{
|
activate(): void;
|
||||||
activate(): void;
|
deactivate(): void;
|
||||||
deactivate(): void;
|
open(): void;
|
||||||
open(): void;
|
close(): void;
|
||||||
close(): void;
|
addChild(node: ICatalogNode): void;
|
||||||
addChild(node: ICatalogNode): void;
|
readonly depth: number;
|
||||||
readonly depth: number;
|
readonly isBranch: boolean;
|
||||||
readonly isBranch: boolean;
|
readonly isLeaf: boolean;
|
||||||
readonly isLeaf: boolean;
|
readonly localization: string;
|
||||||
readonly localization: string;
|
readonly pageId: number;
|
||||||
readonly pageId: number;
|
readonly pageName: string;
|
||||||
readonly pageName: string;
|
readonly iconId: number;
|
||||||
readonly iconId: number;
|
readonly children: ICatalogNode[];
|
||||||
readonly children: ICatalogNode[];
|
readonly offerIds: number[];
|
||||||
readonly offerIds: number[];
|
readonly parent: ICatalogNode;
|
||||||
readonly parent: ICatalogNode;
|
readonly isVisible: boolean;
|
||||||
readonly isVisible: boolean;
|
readonly isActive: boolean;
|
||||||
readonly isActive: boolean;
|
readonly isOpen: boolean;
|
||||||
readonly isOpen: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { ClubGiftInfoParser, ClubOfferData, HabboGroupEntryData, MarketplaceConfigurationMessageParser } from '@nitro/renderer';
|
import {ClubGiftInfoParser, ClubOfferData, HabboGroupEntryData, MarketplaceConfigurationMessageParser} from "@nitro/renderer";
|
||||||
import { CatalogPetPalette } from './CatalogPetPalette';
|
|
||||||
import { GiftWrappingConfiguration } from './GiftWrappingConfiguration';
|
|
||||||
|
|
||||||
export interface ICatalogOptions
|
import {CatalogPetPalette} from "./CatalogPetPalette";
|
||||||
{
|
import {GiftWrappingConfiguration} from "./GiftWrappingConfiguration";
|
||||||
groups?: HabboGroupEntryData[];
|
|
||||||
petPalettes?: CatalogPetPalette[];
|
export interface ICatalogOptions {
|
||||||
clubOffers?: ClubOfferData[];
|
groups?: HabboGroupEntryData[];
|
||||||
clubGifts?: ClubGiftInfoParser;
|
petPalettes?: CatalogPetPalette[];
|
||||||
giftConfiguration?: GiftWrappingConfiguration;
|
clubOffers?: ClubOfferData[];
|
||||||
marketplaceConfiguration?: MarketplaceConfigurationMessageParser;
|
clubGifts?: ClubGiftInfoParser;
|
||||||
|
giftConfiguration?: GiftWrappingConfiguration;
|
||||||
|
marketplaceConfiguration?: MarketplaceConfigurationMessageParser;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { IPageLocalization } from './IPageLocalization';
|
import {IPageLocalization} from "./IPageLocalization";
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
|
|
||||||
export interface ICatalogPage
|
export interface ICatalogPage {
|
||||||
{
|
readonly pageId: number;
|
||||||
readonly pageId: number;
|
readonly layoutCode: string;
|
||||||
readonly layoutCode: string;
|
readonly localization: IPageLocalization;
|
||||||
readonly localization: IPageLocalization;
|
readonly offers: IPurchasableOffer[];
|
||||||
readonly offers: IPurchasableOffer[];
|
readonly acceptSeasonCurrencyAsCredits: boolean;
|
||||||
readonly acceptSeasonCurrencyAsCredits: boolean;
|
readonly mode: number;
|
||||||
readonly mode: number;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
export interface IMarketplaceSearchOptions
|
export interface IMarketplaceSearchOptions {
|
||||||
{
|
query: string;
|
||||||
query: string;
|
type: number;
|
||||||
type: number;
|
minPrice: number;
|
||||||
minPrice: number;
|
maxPrice: number;
|
||||||
maxPrice: number;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
export interface IPageLocalization
|
export interface IPageLocalization {
|
||||||
{
|
getText(index: number): string;
|
||||||
getText(index: number): string
|
getImage(index: number): string;
|
||||||
getImage(index: number): string
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { IFurnitureData, IProductData } from '@nitro/renderer';
|
import {IFurnitureData, IProductData} from "@nitro/renderer";
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
|
||||||
|
|
||||||
export interface IProduct
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
{
|
|
||||||
getIconUrl(offer?: IPurchasableOffer): string;
|
export interface IProduct {
|
||||||
productType: string;
|
getIconUrl(offer?: IPurchasableOffer): string;
|
||||||
productClassId: number;
|
productType: string;
|
||||||
extraParam: string;
|
productClassId: number;
|
||||||
productCount: number;
|
extraParam: string;
|
||||||
productData: IProductData;
|
productCount: number;
|
||||||
furnitureData: IFurnitureData;
|
productData: IProductData;
|
||||||
isUniqueLimitedItem: boolean;
|
furnitureData: IFurnitureData;
|
||||||
uniqueLimitedItemSeriesSize: number;
|
isUniqueLimitedItem: boolean;
|
||||||
uniqueLimitedItemsLeft: number;
|
uniqueLimitedItemSeriesSize: number;
|
||||||
|
uniqueLimitedItemsLeft: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,24 @@
|
||||||
import { ICatalogPage } from './ICatalogPage';
|
import {ICatalogPage} from "./ICatalogPage";
|
||||||
import { IProduct } from './IProduct';
|
import {IProduct} from "./IProduct";
|
||||||
|
|
||||||
export interface IPurchasableOffer
|
export interface IPurchasableOffer {
|
||||||
{
|
activate(): void;
|
||||||
activate(): void;
|
clubLevel: number;
|
||||||
clubLevel: number;
|
page: ICatalogPage;
|
||||||
page: ICatalogPage;
|
offerId: number;
|
||||||
offerId: number;
|
localizationId: string;
|
||||||
localizationId: string;
|
priceInCredits: number;
|
||||||
priceInCredits: number;
|
priceInActivityPoints: number;
|
||||||
priceInActivityPoints: number;
|
activityPointType: number;
|
||||||
activityPointType: number;
|
giftable: boolean;
|
||||||
giftable: boolean;
|
product: IProduct;
|
||||||
product: IProduct;
|
pricingModel: string;
|
||||||
pricingModel: string;
|
priceType: string;
|
||||||
priceType: string;
|
bundlePurchaseAllowed: boolean;
|
||||||
bundlePurchaseAllowed: boolean;
|
isRentOffer: boolean;
|
||||||
isRentOffer: boolean;
|
badgeCode: string;
|
||||||
badgeCode: string;
|
localizationName: string;
|
||||||
localizationName: string;
|
localizationDescription: string;
|
||||||
localizationDescription: string;
|
isLazy: boolean;
|
||||||
isLazy: boolean;
|
products: IProduct[];
|
||||||
products: IProduct[];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { IObjectData } from '@nitro/renderer';
|
import {IObjectData} from "@nitro/renderer";
|
||||||
|
|
||||||
export interface IPurchaseOptions
|
export interface IPurchaseOptions {
|
||||||
{
|
quantity?: number;
|
||||||
quantity?: number;
|
extraData?: string;
|
||||||
extraData?: string;
|
extraParamRequired?: boolean;
|
||||||
extraParamRequired?: boolean;
|
previewStuffData?: IObjectData;
|
||||||
previewStuffData?: IObjectData;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,128 +1,117 @@
|
||||||
import { IObjectData } from '@nitro/renderer';
|
import {IObjectData} from "@nitro/renderer";
|
||||||
|
|
||||||
export class MarketplaceOfferData
|
export class MarketplaceOfferData {
|
||||||
{
|
public static readonly TYPE_FLOOR: number = 1;
|
||||||
public static readonly TYPE_FLOOR: number = 1;
|
public static readonly TYPE_WALL: number = 2;
|
||||||
public static readonly TYPE_WALL: number = 2;
|
|
||||||
|
|
||||||
private _offerId: number;
|
private _offerId: number;
|
||||||
private _furniId: number;
|
private _furniId: number;
|
||||||
private _furniType: number;
|
private _furniType: number;
|
||||||
private _extraData: string;
|
private _extraData: string;
|
||||||
private _stuffData: IObjectData;
|
private _stuffData: IObjectData;
|
||||||
private _price: number;
|
private _price: number;
|
||||||
private _averagePrice: number;
|
private _averagePrice: number;
|
||||||
private _imageCallback: number;
|
private _imageCallback: number;
|
||||||
private _status: number;
|
private _status: number;
|
||||||
private _timeLeftMinutes: number = -1;
|
private _timeLeftMinutes: number = -1;
|
||||||
private _offerCount: number;
|
private _offerCount: number;
|
||||||
private _image: string;
|
private _image: string;
|
||||||
|
|
||||||
constructor(offerId: number, furniId: number, furniType: number, extraData: string, stuffData: IObjectData, price: number, status: number, averagePrice: number, offerCount: number = -1)
|
constructor(
|
||||||
{
|
offerId: number,
|
||||||
this._offerId = offerId;
|
furniId: number,
|
||||||
this._furniId = furniId;
|
furniType: number,
|
||||||
this._furniType = furniType;
|
extraData: string,
|
||||||
this._extraData = extraData;
|
stuffData: IObjectData,
|
||||||
this._stuffData = stuffData;
|
price: number,
|
||||||
this._price = price;
|
status: number,
|
||||||
this._status = status;
|
averagePrice: number,
|
||||||
this._averagePrice = averagePrice;
|
offerCount: number = -1
|
||||||
this._offerCount = offerCount;
|
) {
|
||||||
}
|
this._offerId = offerId;
|
||||||
|
this._furniId = furniId;
|
||||||
|
this._furniType = furniType;
|
||||||
|
this._extraData = extraData;
|
||||||
|
this._stuffData = stuffData;
|
||||||
|
this._price = price;
|
||||||
|
this._status = status;
|
||||||
|
this._averagePrice = averagePrice;
|
||||||
|
this._offerCount = offerCount;
|
||||||
|
}
|
||||||
|
|
||||||
public get offerId(): number
|
public get offerId(): number {
|
||||||
{
|
return this._offerId;
|
||||||
return this._offerId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set offerId(offerId: number)
|
public set offerId(offerId: number) {
|
||||||
{
|
this._offerId = offerId;
|
||||||
this._offerId = offerId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get furniId(): number
|
public get furniId(): number {
|
||||||
{
|
return this._furniId;
|
||||||
return this._furniId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get furniType(): number
|
public get furniType(): number {
|
||||||
{
|
return this._furniType;
|
||||||
return this._furniType;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get extraData(): string
|
public get extraData(): string {
|
||||||
{
|
return this._extraData;
|
||||||
return this._extraData;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get stuffData(): IObjectData
|
public get stuffData(): IObjectData {
|
||||||
{
|
return this._stuffData;
|
||||||
return this._stuffData;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get price(): number
|
public get price(): number {
|
||||||
{
|
return this._price;
|
||||||
return this._price;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set price(price: number)
|
public set price(price: number) {
|
||||||
{
|
this._price = price;
|
||||||
this._price = price;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get averagePrice(): number
|
public get averagePrice(): number {
|
||||||
{
|
return this._averagePrice;
|
||||||
return this._averagePrice;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get image(): string
|
public get image(): string {
|
||||||
{
|
return this._image;
|
||||||
return this._image;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set image(image: string)
|
public set image(image: string) {
|
||||||
{
|
this._image = image;
|
||||||
this._image = image;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get imageCallback(): number
|
public get imageCallback(): number {
|
||||||
{
|
return this._imageCallback;
|
||||||
return this._imageCallback;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set imageCallback(callback: number)
|
public set imageCallback(callback: number) {
|
||||||
{
|
this._imageCallback = callback;
|
||||||
this._imageCallback = callback;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get status(): number
|
public get status(): number {
|
||||||
{
|
return this._status;
|
||||||
return this._status;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get timeLeftMinutes(): number
|
public get timeLeftMinutes(): number {
|
||||||
{
|
return this._timeLeftMinutes;
|
||||||
return this._timeLeftMinutes;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set timeLeftMinutes(minutes: number)
|
public set timeLeftMinutes(minutes: number) {
|
||||||
{
|
this._timeLeftMinutes = minutes;
|
||||||
this._timeLeftMinutes = minutes;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get offerCount(): number
|
public get offerCount(): number {
|
||||||
{
|
return this._offerCount;
|
||||||
return this._offerCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set offerCount(count: number)
|
public set offerCount(count: number) {
|
||||||
{
|
this._offerCount = count;
|
||||||
this._offerCount = count;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isUniqueLimitedItem(): boolean
|
public get isUniqueLimitedItem(): boolean {
|
||||||
{
|
return this.stuffData && this.stuffData.uniqueSeries > 0;
|
||||||
return (this.stuffData && (this.stuffData.uniqueSeries > 0));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
export class MarketPlaceOfferState
|
export class MarketPlaceOfferState {
|
||||||
{
|
public static readonly ONGOING = 1;
|
||||||
public static readonly ONGOING = 1;
|
public static readonly ONGOING_OWN = 1;
|
||||||
public static readonly ONGOING_OWN = 1;
|
public static readonly SOLD = 2;
|
||||||
public static readonly SOLD = 2;
|
public static readonly EXPIRED = 3;
|
||||||
public static readonly EXPIRED = 3;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export class MarketplaceSearchType
|
export class MarketplaceSearchType {
|
||||||
{
|
public static readonly BY_ACTIVITY = 1;
|
||||||
public static readonly BY_ACTIVITY = 1;
|
public static readonly BY_VALUE = 2;
|
||||||
public static readonly BY_VALUE = 2;
|
public static readonly ADVANCED = 3;
|
||||||
public static readonly ADVANCED = 3;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,245 +1,217 @@
|
||||||
import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, ProductTypeEnum } from '..';
|
import {GetFurnitureData, GetProductDataForLocalization, LocalizeText, ProductTypeEnum} from "..";
|
||||||
import { ICatalogPage } from './ICatalogPage';
|
import {ICatalogPage} from "./ICatalogPage";
|
||||||
import { IProduct } from './IProduct';
|
import {IProduct} from "./IProduct";
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
import { Product } from './Product';
|
import {Product} from "./Product";
|
||||||
|
|
||||||
export class Offer implements IPurchasableOffer
|
export class Offer implements IPurchasableOffer {
|
||||||
{
|
public static PRICING_MODEL_UNKNOWN: string = "pricing_model_unknown";
|
||||||
public static PRICING_MODEL_UNKNOWN: string = 'pricing_model_unknown';
|
public static PRICING_MODEL_SINGLE: string = "pricing_model_single";
|
||||||
public static PRICING_MODEL_SINGLE: string = 'pricing_model_single';
|
public static PRICING_MODEL_MULTI: string = "pricing_model_multi";
|
||||||
public static PRICING_MODEL_MULTI: string = 'pricing_model_multi';
|
public static PRICING_MODEL_BUNDLE: string = "pricing_model_bundle";
|
||||||
public static PRICING_MODEL_BUNDLE: string = 'pricing_model_bundle';
|
public static PRICING_MODEL_FURNITURE: string = "pricing_model_furniture";
|
||||||
public static PRICING_MODEL_FURNITURE: string = 'pricing_model_furniture';
|
public static PRICE_TYPE_NONE: string = "price_type_none";
|
||||||
public static PRICE_TYPE_NONE: string = 'price_type_none';
|
public static PRICE_TYPE_CREDITS: string = "price_type_credits";
|
||||||
public static PRICE_TYPE_CREDITS: string = 'price_type_credits';
|
public static PRICE_TYPE_ACTIVITYPOINTS: string = "price_type_activitypoints";
|
||||||
public static PRICE_TYPE_ACTIVITYPOINTS: string = 'price_type_activitypoints';
|
public static PRICE_TYPE_CREDITS_ACTIVITYPOINTS: string = "price_type_credits_and_activitypoints";
|
||||||
public static PRICE_TYPE_CREDITS_ACTIVITYPOINTS: string = 'price_type_credits_and_activitypoints';
|
|
||||||
|
|
||||||
private _pricingModel: string;
|
private _pricingModel: string;
|
||||||
private _priceType: string;
|
private _priceType: string;
|
||||||
private _offerId: number;
|
private _offerId: number;
|
||||||
private _localizationId: string;
|
private _localizationId: string;
|
||||||
private _priceInCredits: number;
|
private _priceInCredits: number;
|
||||||
private _priceInActivityPoints: number;
|
private _priceInActivityPoints: number;
|
||||||
private _activityPointType: number;
|
private _activityPointType: number;
|
||||||
private _giftable: boolean;
|
private _giftable: boolean;
|
||||||
private _isRentOffer: boolean;
|
private _isRentOffer: boolean;
|
||||||
private _page: ICatalogPage;
|
private _page: ICatalogPage;
|
||||||
private _clubLevel: number = 0;
|
private _clubLevel: number = 0;
|
||||||
private _products: IProduct[];
|
private _products: IProduct[];
|
||||||
private _badgeCode: string;
|
private _badgeCode: string;
|
||||||
private _bundlePurchaseAllowed: boolean = false;
|
private _bundlePurchaseAllowed: boolean = false;
|
||||||
|
|
||||||
constructor(offerId: number, localizationId: string, isRentOffer: boolean, priceInCredits: number, priceInActivityPoints: number, activityPointType: number, giftable: boolean, clubLevel: number, products: IProduct[], bundlePurchaseAllowed: boolean)
|
constructor(
|
||||||
{
|
offerId: number,
|
||||||
this._offerId = offerId;
|
localizationId: string,
|
||||||
this._localizationId = localizationId;
|
isRentOffer: boolean,
|
||||||
this._isRentOffer = isRentOffer;
|
priceInCredits: number,
|
||||||
this._priceInCredits = priceInCredits;
|
priceInActivityPoints: number,
|
||||||
this._priceInActivityPoints = priceInActivityPoints;
|
activityPointType: number,
|
||||||
this._activityPointType = activityPointType;
|
giftable: boolean,
|
||||||
this._giftable = giftable;
|
clubLevel: number,
|
||||||
this._clubLevel = clubLevel;
|
products: IProduct[],
|
||||||
this._products = products;
|
bundlePurchaseAllowed: boolean
|
||||||
this._bundlePurchaseAllowed = bundlePurchaseAllowed;
|
) {
|
||||||
|
this._offerId = offerId;
|
||||||
|
this._localizationId = localizationId;
|
||||||
|
this._isRentOffer = isRentOffer;
|
||||||
|
this._priceInCredits = priceInCredits;
|
||||||
|
this._priceInActivityPoints = priceInActivityPoints;
|
||||||
|
this._activityPointType = activityPointType;
|
||||||
|
this._giftable = giftable;
|
||||||
|
this._clubLevel = clubLevel;
|
||||||
|
this._products = products;
|
||||||
|
this._bundlePurchaseAllowed = bundlePurchaseAllowed;
|
||||||
|
|
||||||
this.setPricingModelForProducts();
|
this.setPricingModelForProducts();
|
||||||
this.setPricingType();
|
this.setPricingType();
|
||||||
|
|
||||||
for(const product of products)
|
for (const product of products) {
|
||||||
{
|
if (product.productType === ProductTypeEnum.BADGE) {
|
||||||
if(product.productType === ProductTypeEnum.BADGE)
|
this._badgeCode = product.extraParam;
|
||||||
{
|
|
||||||
this._badgeCode = product.extraParam;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public activate(): void {}
|
||||||
|
|
||||||
|
public get clubLevel(): number {
|
||||||
|
return this._clubLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get page(): ICatalogPage {
|
||||||
|
return this._page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set page(k: ICatalogPage) {
|
||||||
|
this._page = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get offerId(): number {
|
||||||
|
return this._offerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get localizationId(): string {
|
||||||
|
return this._localizationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get priceInCredits(): number {
|
||||||
|
return this._priceInCredits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get priceInActivityPoints(): number {
|
||||||
|
return this._priceInActivityPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get activityPointType(): number {
|
||||||
|
return this._activityPointType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get giftable(): boolean {
|
||||||
|
return this._giftable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get product(): IProduct {
|
||||||
|
if (!this._products || !this._products.length) return null;
|
||||||
|
|
||||||
|
if (this._products.length === 1) return this._products[0];
|
||||||
|
|
||||||
|
const products = Product.stripAddonProducts(this._products);
|
||||||
|
|
||||||
|
if (products.length) return products[0];
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get pricingModel(): string {
|
||||||
|
return this._pricingModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get priceType(): string {
|
||||||
|
return this._priceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get bundlePurchaseAllowed(): boolean {
|
||||||
|
return this._bundlePurchaseAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get isRentOffer(): boolean {
|
||||||
|
return this._isRentOffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get badgeCode(): string {
|
||||||
|
return this._badgeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get localizationName(): string {
|
||||||
|
const productData = GetProductDataForLocalization(this._localizationId);
|
||||||
|
|
||||||
|
if (productData) return productData.name;
|
||||||
|
|
||||||
|
return LocalizeText(this._localizationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get localizationDescription(): string {
|
||||||
|
const productData = GetProductDataForLocalization(this._localizationId);
|
||||||
|
|
||||||
|
if (productData) return productData.description;
|
||||||
|
|
||||||
|
return LocalizeText(this._localizationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public get isLazy(): boolean {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get products(): IProduct[] {
|
||||||
|
return this._products;
|
||||||
|
}
|
||||||
|
|
||||||
|
private setPricingModelForProducts(): void {
|
||||||
|
const products = Product.stripAddonProducts(this._products);
|
||||||
|
|
||||||
|
if (products.length === 1) {
|
||||||
|
if (products[0].productCount === 1) {
|
||||||
|
this._pricingModel = Offer.PRICING_MODEL_SINGLE;
|
||||||
|
} else {
|
||||||
|
this._pricingModel = Offer.PRICING_MODEL_MULTI;
|
||||||
|
}
|
||||||
|
} else if (products.length > 1) {
|
||||||
|
this._pricingModel = Offer.PRICING_MODEL_BUNDLE;
|
||||||
|
} else {
|
||||||
|
this._pricingModel = Offer.PRICING_MODEL_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private setPricingType(): void {
|
||||||
|
if (this._priceInCredits > 0 && this._priceInActivityPoints > 0) {
|
||||||
|
this._priceType = Offer.PRICE_TYPE_CREDITS_ACTIVITYPOINTS;
|
||||||
|
} else if (this._priceInCredits > 0) {
|
||||||
|
this._priceType = Offer.PRICE_TYPE_CREDITS;
|
||||||
|
} else if (this._priceInActivityPoints > 0) {
|
||||||
|
this._priceType = Offer.PRICE_TYPE_ACTIVITYPOINTS;
|
||||||
|
} else {
|
||||||
|
this._priceType = Offer.PRICE_TYPE_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public clone(): IPurchasableOffer {
|
||||||
|
const products: IProduct[] = [];
|
||||||
|
const productData = GetProductDataForLocalization(this.localizationId);
|
||||||
|
|
||||||
|
for (const product of this._products) {
|
||||||
|
const furnitureData = GetFurnitureData(product.productClassId, product.productType);
|
||||||
|
|
||||||
|
products.push(new Product(product.productType, product.productClassId, product.extraParam, product.productCount, productData, furnitureData));
|
||||||
}
|
}
|
||||||
|
|
||||||
public activate(): void
|
const offer = new Offer(
|
||||||
{
|
this.offerId,
|
||||||
|
this.localizationId,
|
||||||
}
|
this.isRentOffer,
|
||||||
|
this.priceInCredits,
|
||||||
|
this.priceInActivityPoints,
|
||||||
|
this.activityPointType,
|
||||||
|
this.giftable,
|
||||||
|
this.clubLevel,
|
||||||
|
products,
|
||||||
|
this.bundlePurchaseAllowed
|
||||||
|
);
|
||||||
|
|
||||||
public get clubLevel(): number
|
offer.page = this.page;
|
||||||
{
|
|
||||||
return this._clubLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get page(): ICatalogPage
|
return offer;
|
||||||
{
|
}
|
||||||
return this._page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set page(k: ICatalogPage)
|
|
||||||
{
|
|
||||||
this._page = k;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get offerId(): number
|
|
||||||
{
|
|
||||||
return this._offerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get localizationId(): string
|
|
||||||
{
|
|
||||||
return this._localizationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get priceInCredits(): number
|
|
||||||
{
|
|
||||||
return this._priceInCredits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get priceInActivityPoints(): number
|
|
||||||
{
|
|
||||||
return this._priceInActivityPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get activityPointType(): number
|
|
||||||
{
|
|
||||||
return this._activityPointType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get giftable(): boolean
|
|
||||||
{
|
|
||||||
return this._giftable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get product(): IProduct
|
|
||||||
{
|
|
||||||
if(!this._products || !this._products.length) return null;
|
|
||||||
|
|
||||||
if(this._products.length === 1) return this._products[0];
|
|
||||||
|
|
||||||
const products = Product.stripAddonProducts(this._products);
|
|
||||||
|
|
||||||
if(products.length) return products[0];
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get pricingModel(): string
|
|
||||||
{
|
|
||||||
return this._pricingModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get priceType(): string
|
|
||||||
{
|
|
||||||
return this._priceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get bundlePurchaseAllowed(): boolean
|
|
||||||
{
|
|
||||||
return this._bundlePurchaseAllowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isRentOffer(): boolean
|
|
||||||
{
|
|
||||||
return this._isRentOffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get badgeCode(): string
|
|
||||||
{
|
|
||||||
return this._badgeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get localizationName(): string
|
|
||||||
{
|
|
||||||
const productData = GetProductDataForLocalization(this._localizationId);
|
|
||||||
|
|
||||||
if(productData) return productData.name;
|
|
||||||
|
|
||||||
return LocalizeText(this._localizationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public get localizationDescription(): string
|
|
||||||
{
|
|
||||||
const productData = GetProductDataForLocalization(this._localizationId);
|
|
||||||
|
|
||||||
if(productData) return productData.description;
|
|
||||||
|
|
||||||
return LocalizeText(this._localizationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public get isLazy(): boolean
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get products(): IProduct[]
|
|
||||||
{
|
|
||||||
return this._products;
|
|
||||||
}
|
|
||||||
|
|
||||||
private setPricingModelForProducts(): void
|
|
||||||
{
|
|
||||||
const products = Product.stripAddonProducts(this._products);
|
|
||||||
|
|
||||||
if(products.length === 1)
|
|
||||||
{
|
|
||||||
if(products[0].productCount === 1)
|
|
||||||
{
|
|
||||||
this._pricingModel = Offer.PRICING_MODEL_SINGLE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this._pricingModel = Offer.PRICING_MODEL_MULTI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(products.length > 1)
|
|
||||||
{
|
|
||||||
this._pricingModel = Offer.PRICING_MODEL_BUNDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this._pricingModel = Offer.PRICING_MODEL_UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private setPricingType(): void
|
|
||||||
{
|
|
||||||
if((this._priceInCredits > 0) && (this._priceInActivityPoints > 0))
|
|
||||||
{
|
|
||||||
this._priceType = Offer.PRICE_TYPE_CREDITS_ACTIVITYPOINTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(this._priceInCredits > 0)
|
|
||||||
{
|
|
||||||
this._priceType = Offer.PRICE_TYPE_CREDITS;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(this._priceInActivityPoints > 0)
|
|
||||||
{
|
|
||||||
this._priceType = Offer.PRICE_TYPE_ACTIVITYPOINTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this._priceType = Offer.PRICE_TYPE_NONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public clone(): IPurchasableOffer
|
|
||||||
{
|
|
||||||
const products: IProduct[] = [];
|
|
||||||
const productData = GetProductDataForLocalization(this.localizationId);
|
|
||||||
|
|
||||||
for(const product of this._products)
|
|
||||||
{
|
|
||||||
const furnitureData = GetFurnitureData(product.productClassId, product.productType);
|
|
||||||
|
|
||||||
products.push(new Product(product.productType, product.productClassId, product.extraParam, product.productCount, productData, furnitureData));
|
|
||||||
}
|
|
||||||
|
|
||||||
const offer = new Offer(this.offerId, this.localizationId, this.isRentOffer, this.priceInCredits, this.priceInActivityPoints, this.activityPointType, this.giftable, this.clubLevel, products, this.bundlePurchaseAllowed);
|
|
||||||
|
|
||||||
offer.page = this.page;
|
|
||||||
|
|
||||||
return offer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,32 @@
|
||||||
import { GetConfiguration } from '../nitro';
|
import {GetConfiguration} from "../nitro";
|
||||||
import { IPageLocalization } from './IPageLocalization';
|
import {IPageLocalization} from "./IPageLocalization";
|
||||||
|
|
||||||
export class PageLocalization implements IPageLocalization
|
export class PageLocalization implements IPageLocalization {
|
||||||
{
|
private _images: string[];
|
||||||
private _images: string[];
|
private _texts: string[];
|
||||||
private _texts: string[]
|
|
||||||
|
|
||||||
constructor(images: string[], texts: string[])
|
constructor(images: string[], texts: string[]) {
|
||||||
{
|
this._images = images;
|
||||||
this._images = images;
|
this._texts = texts;
|
||||||
this._texts = texts;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public getText(index: number): string
|
public getText(index: number): string {
|
||||||
{
|
let message = this._texts[index] || "";
|
||||||
let message = (this._texts[index] || '');
|
|
||||||
|
|
||||||
if(message && message.length) message = message.replace(/\r\n|\r|\n/g, '<br />');
|
if (message && message.length) message = message.replace(/\r\n|\r|\n/g, "<br />");
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getImage(index: number): string
|
public getImage(index: number): string {
|
||||||
{
|
const imageName = this._images[index] || "";
|
||||||
const imageName = (this._images[index] || '');
|
|
||||||
|
|
||||||
if(!imageName || !imageName.length) return null;
|
if (!imageName || !imageName.length) return null;
|
||||||
|
|
||||||
let assetUrl = GetConfiguration<string>('catalog.asset.image.url');
|
let assetUrl = GetConfiguration<string>("catalog.asset.image.url");
|
||||||
|
|
||||||
assetUrl = assetUrl.replace('%name%', imageName);
|
assetUrl = assetUrl.replace("%name%", imageName);
|
||||||
|
|
||||||
return assetUrl;
|
return assetUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,36 @@
|
||||||
import { IFurnitureData, IProductData } from '@nitro/renderer';
|
import {IFurnitureData, IProductData} from "@nitro/renderer";
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
|
||||||
|
|
||||||
export class PlacedObjectPurchaseData
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
{
|
|
||||||
constructor(
|
|
||||||
public readonly roomId: number,
|
|
||||||
public readonly objectId: number,
|
|
||||||
public readonly category: number,
|
|
||||||
public readonly wallLocation: string,
|
|
||||||
public readonly x: number,
|
|
||||||
public readonly y: number,
|
|
||||||
public readonly direction: number,
|
|
||||||
public readonly offer: IPurchasableOffer)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public get offerId(): number
|
export class PlacedObjectPurchaseData {
|
||||||
{
|
constructor(
|
||||||
return this.offer.offerId;
|
public readonly roomId: number,
|
||||||
}
|
public readonly objectId: number,
|
||||||
|
public readonly category: number,
|
||||||
|
public readonly wallLocation: string,
|
||||||
|
public readonly x: number,
|
||||||
|
public readonly y: number,
|
||||||
|
public readonly direction: number,
|
||||||
|
public readonly offer: IPurchasableOffer
|
||||||
|
) {}
|
||||||
|
|
||||||
public get productClassId(): number
|
public get offerId(): number {
|
||||||
{
|
return this.offer.offerId;
|
||||||
return this.offer.product.productClassId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get productData(): IProductData
|
public get productClassId(): number {
|
||||||
{
|
return this.offer.product.productClassId;
|
||||||
return this.offer.product.productData;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get furniData(): IFurnitureData
|
public get productData(): IProductData {
|
||||||
{
|
return this.offer.product.productData;
|
||||||
return this.offer.product.furnitureData;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get extraParam(): string
|
public get furniData(): IFurnitureData {
|
||||||
{
|
return this.offer.product.furnitureData;
|
||||||
return this.offer.product.extraParam;
|
}
|
||||||
}
|
|
||||||
|
public get extraParam(): string {
|
||||||
|
return this.offer.product.extraParam;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,143 +1,140 @@
|
||||||
import { IFurnitureData, IObjectData, IProductData } from '@nitro/renderer';
|
import {IFurnitureData, IObjectData, IProductData} from "@nitro/renderer";
|
||||||
import { GetConfiguration, GetRoomEngine, GetSessionDataManager } from '../nitro';
|
|
||||||
import { GetPixelEffectIcon, GetSubscriptionProductIcon } from './CatalogUtilities';
|
|
||||||
import { IProduct } from './IProduct';
|
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
|
||||||
import { ProductTypeEnum } from './ProductTypeEnum';
|
|
||||||
|
|
||||||
export class Product implements IProduct
|
import {GetConfiguration, GetRoomEngine, GetSessionDataManager} from "../nitro";
|
||||||
{
|
import {GetPixelEffectIcon, GetSubscriptionProductIcon} from "./CatalogUtilities";
|
||||||
public static EFFECT_CLASSID_NINJA_DISAPPEAR: number = 108;
|
import {IProduct} from "./IProduct";
|
||||||
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
|
import {ProductTypeEnum} from "./ProductTypeEnum";
|
||||||
|
|
||||||
private _productType: string;
|
export class Product implements IProduct {
|
||||||
private _productClassId: number;
|
public static EFFECT_CLASSID_NINJA_DISAPPEAR: number = 108;
|
||||||
private _extraParam: string;
|
|
||||||
private _productCount: number;
|
|
||||||
private _productData: IProductData;
|
|
||||||
private _furnitureData: IFurnitureData;
|
|
||||||
private _isUniqueLimitedItem: boolean;
|
|
||||||
private _uniqueLimitedItemSeriesSize: number;
|
|
||||||
private _uniqueLimitedItemsLeft: number;
|
|
||||||
|
|
||||||
constructor(productType: string, productClassId: number, extraParam: string, productCount: number, productData: IProductData, furnitureData: IFurnitureData, isUniqueLimitedItem: boolean = false, uniqueLimitedItemSeriesSize: number = 0, uniqueLimitedItemsLeft: number = 0)
|
private _productType: string;
|
||||||
{
|
private _productClassId: number;
|
||||||
this._productType = productType.toLowerCase();
|
private _extraParam: string;
|
||||||
this._productClassId = productClassId;
|
private _productCount: number;
|
||||||
this._extraParam = extraParam;
|
private _productData: IProductData;
|
||||||
this._productCount = productCount;
|
private _furnitureData: IFurnitureData;
|
||||||
this._productData = productData;
|
private _isUniqueLimitedItem: boolean;
|
||||||
this._furnitureData = furnitureData;
|
private _uniqueLimitedItemSeriesSize: number;
|
||||||
this._isUniqueLimitedItem = isUniqueLimitedItem;
|
private _uniqueLimitedItemsLeft: number;
|
||||||
this._uniqueLimitedItemSeriesSize = uniqueLimitedItemSeriesSize;
|
|
||||||
this._uniqueLimitedItemsLeft = uniqueLimitedItemsLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static stripAddonProducts(products: IProduct[]): IProduct[]
|
constructor(
|
||||||
{
|
productType: string,
|
||||||
if(products.length === 1) return products;
|
productClassId: number,
|
||||||
|
extraParam: string,
|
||||||
|
productCount: number,
|
||||||
|
productData: IProductData,
|
||||||
|
furnitureData: IFurnitureData,
|
||||||
|
isUniqueLimitedItem: boolean = false,
|
||||||
|
uniqueLimitedItemSeriesSize: number = 0,
|
||||||
|
uniqueLimitedItemsLeft: number = 0
|
||||||
|
) {
|
||||||
|
this._productType = productType.toLowerCase();
|
||||||
|
this._productClassId = productClassId;
|
||||||
|
this._extraParam = extraParam;
|
||||||
|
this._productCount = productCount;
|
||||||
|
this._productData = productData;
|
||||||
|
this._furnitureData = furnitureData;
|
||||||
|
this._isUniqueLimitedItem = isUniqueLimitedItem;
|
||||||
|
this._uniqueLimitedItemSeriesSize = uniqueLimitedItemSeriesSize;
|
||||||
|
this._uniqueLimitedItemsLeft = uniqueLimitedItemsLeft;
|
||||||
|
}
|
||||||
|
|
||||||
return products.filter(product => ((product.productType !== ProductTypeEnum.BADGE) && (product.productType !== ProductTypeEnum.EFFECT) && (product.productClassId !== Product.EFFECT_CLASSID_NINJA_DISAPPEAR)));
|
public static stripAddonProducts(products: IProduct[]): IProduct[] {
|
||||||
}
|
if (products.length === 1) return products;
|
||||||
|
|
||||||
public getIconUrl(offer: IPurchasableOffer = null, stuffData: IObjectData = null): string
|
return products.filter(
|
||||||
{
|
product =>
|
||||||
switch(this._productType)
|
product.productType !== ProductTypeEnum.BADGE &&
|
||||||
{
|
product.productType !== ProductTypeEnum.EFFECT &&
|
||||||
case ProductTypeEnum.FLOOR:
|
product.productClassId !== Product.EFFECT_CLASSID_NINJA_DISAPPEAR
|
||||||
return GetRoomEngine().getFurnitureFloorIconUrl(this.productClassId);
|
);
|
||||||
case ProductTypeEnum.WALL: {
|
}
|
||||||
if(offer && this._furnitureData)
|
|
||||||
{
|
|
||||||
let iconName = '';
|
|
||||||
|
|
||||||
switch(this._furnitureData.className)
|
public getIconUrl(offer: IPurchasableOffer = null, stuffData: IObjectData = null): string {
|
||||||
{
|
switch (this._productType) {
|
||||||
case 'floor':
|
case ProductTypeEnum.FLOOR:
|
||||||
iconName = [ 'th', this._furnitureData.className, offer.product.extraParam ].join('_');
|
return GetRoomEngine().getFurnitureFloorIconUrl(this.productClassId);
|
||||||
break;
|
case ProductTypeEnum.WALL: {
|
||||||
case 'wallpaper':
|
if (offer && this._furnitureData) {
|
||||||
iconName = [ 'th', 'wall', offer.product.extraParam ].join('_');
|
let iconName = "";
|
||||||
break;
|
|
||||||
case 'landscape':
|
|
||||||
iconName = [ 'th', this._furnitureData.className, (offer.product.extraParam || '').replace('.', '_'), '001' ].join('_');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(iconName !== '')
|
switch (this._furnitureData.className) {
|
||||||
{
|
case "floor":
|
||||||
const assetUrl = GetConfiguration<string>('catalog.asset.url');
|
iconName = ["th", this._furnitureData.className, offer.product.extraParam].join("_");
|
||||||
|
break;
|
||||||
|
case "wallpaper":
|
||||||
|
iconName = ["th", "wall", offer.product.extraParam].join("_");
|
||||||
|
break;
|
||||||
|
case "landscape":
|
||||||
|
iconName = ["th", this._furnitureData.className, (offer.product.extraParam || "").replace(".", "_"), "001"].join("_");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return `${ assetUrl }/${ iconName }.png`;
|
if (iconName !== "") {
|
||||||
}
|
const assetUrl = GetConfiguration<string>("catalog.asset.url");
|
||||||
}
|
|
||||||
|
|
||||||
return GetRoomEngine().getFurnitureWallIconUrl(this.productClassId, this._extraParam);
|
return `${assetUrl}/${iconName}.png`;
|
||||||
}
|
}
|
||||||
case ProductTypeEnum.EFFECT:
|
|
||||||
return GetPixelEffectIcon(this.productClassId);
|
|
||||||
case ProductTypeEnum.HABBO_CLUB:
|
|
||||||
return GetSubscriptionProductIcon(this.productClassId);
|
|
||||||
case ProductTypeEnum.BADGE:
|
|
||||||
return GetSessionDataManager().getBadgeUrl(this._extraParam);
|
|
||||||
case ProductTypeEnum.ROBOT:
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return GetRoomEngine().getFurnitureWallIconUrl(this.productClassId, this._extraParam);
|
||||||
|
}
|
||||||
|
case ProductTypeEnum.EFFECT:
|
||||||
|
return GetPixelEffectIcon(this.productClassId);
|
||||||
|
case ProductTypeEnum.HABBO_CLUB:
|
||||||
|
return GetSubscriptionProductIcon(this.productClassId);
|
||||||
|
case ProductTypeEnum.BADGE:
|
||||||
|
return GetSessionDataManager().getBadgeUrl(this._extraParam);
|
||||||
|
case ProductTypeEnum.ROBOT:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get productType(): string
|
return null;
|
||||||
{
|
}
|
||||||
return this._productType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get productClassId(): number
|
public get productType(): string {
|
||||||
{
|
return this._productType;
|
||||||
return this._productClassId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get extraParam(): string
|
public get productClassId(): number {
|
||||||
{
|
return this._productClassId;
|
||||||
return this._extraParam;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set extraParam(extraParam: string)
|
public get extraParam(): string {
|
||||||
{
|
return this._extraParam;
|
||||||
this._extraParam = extraParam;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get productCount(): number
|
public set extraParam(extraParam: string) {
|
||||||
{
|
this._extraParam = extraParam;
|
||||||
return this._productCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get productData(): IProductData
|
public get productCount(): number {
|
||||||
{
|
return this._productCount;
|
||||||
return this._productData;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get furnitureData(): IFurnitureData
|
public get productData(): IProductData {
|
||||||
{
|
return this._productData;
|
||||||
return this._furnitureData;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get isUniqueLimitedItem(): boolean
|
public get furnitureData(): IFurnitureData {
|
||||||
{
|
return this._furnitureData;
|
||||||
return this._isUniqueLimitedItem;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get uniqueLimitedItemSeriesSize(): number
|
public get isUniqueLimitedItem(): boolean {
|
||||||
{
|
return this._isUniqueLimitedItem;
|
||||||
return this._uniqueLimitedItemSeriesSize;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get uniqueLimitedItemsLeft(): number
|
public get uniqueLimitedItemSeriesSize(): number {
|
||||||
{
|
return this._uniqueLimitedItemSeriesSize;
|
||||||
return this._uniqueLimitedItemsLeft;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set uniqueLimitedItemsLeft(uniqueLimitedItemsLeft: number)
|
public get uniqueLimitedItemsLeft(): number {
|
||||||
{
|
return this._uniqueLimitedItemsLeft;
|
||||||
this._uniqueLimitedItemsLeft = uniqueLimitedItemsLeft;
|
}
|
||||||
}
|
|
||||||
|
public set uniqueLimitedItemsLeft(uniqueLimitedItemsLeft: number) {
|
||||||
|
this._uniqueLimitedItemsLeft = uniqueLimitedItemsLeft;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
export class ProductTypeEnum
|
export class ProductTypeEnum {
|
||||||
{
|
public static WALL: string = "i";
|
||||||
public static WALL: string = 'i';
|
public static FLOOR: string = "s";
|
||||||
public static FLOOR: string = 's';
|
public static EFFECT: string = "e";
|
||||||
public static EFFECT: string = 'e';
|
public static HABBO_CLUB: string = "h";
|
||||||
public static HABBO_CLUB: string = 'h';
|
public static BADGE: string = "b";
|
||||||
public static BADGE: string = 'b';
|
public static GAME_TOKEN: string = "GAME_TOKEN";
|
||||||
public static GAME_TOKEN: string = 'GAME_TOKEN';
|
public static PET: string = "p";
|
||||||
public static PET: string = 'p';
|
public static ROBOT: string = "r";
|
||||||
public static ROBOT: string = 'r';
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,63 +1,53 @@
|
||||||
export class RequestedPage
|
export class RequestedPage {
|
||||||
{
|
public static REQUEST_TYPE_NONE: number = 0;
|
||||||
public static REQUEST_TYPE_NONE: number = 0;
|
public static REQUEST_TYPE_ID: number = 1;
|
||||||
public static REQUEST_TYPE_ID: number = 1;
|
public static REQUEST_TYPE_OFFER: number = 2;
|
||||||
public static REQUEST_TYPE_OFFER: number = 2;
|
public static REQUEST_TYPE_NAME: number = 3;
|
||||||
public static REQUEST_TYPE_NAME: number = 3;
|
|
||||||
|
|
||||||
private _requestType: number;
|
private _requestType: number;
|
||||||
private _requestById: number;
|
private _requestById: number;
|
||||||
private _requestedByOfferId: number;
|
private _requestedByOfferId: number;
|
||||||
private _requestByName: string;
|
private _requestByName: string;
|
||||||
|
|
||||||
constructor()
|
constructor() {
|
||||||
{
|
this._requestType = RequestedPage.REQUEST_TYPE_NONE;
|
||||||
this._requestType = RequestedPage.REQUEST_TYPE_NONE;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public resetRequest():void
|
public resetRequest(): void {
|
||||||
{
|
this._requestType = RequestedPage.REQUEST_TYPE_NONE;
|
||||||
this._requestType = RequestedPage.REQUEST_TYPE_NONE;
|
this._requestById = -1;
|
||||||
this._requestById = -1;
|
this._requestedByOfferId = -1;
|
||||||
this._requestedByOfferId = -1;
|
this._requestByName = null;
|
||||||
this._requestByName = null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get requestType(): number
|
public get requestType(): number {
|
||||||
{
|
return this._requestType;
|
||||||
return this._requestType;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get requestById(): number
|
public get requestById(): number {
|
||||||
{
|
return this._requestById;
|
||||||
return this._requestById;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set requestById(id: number)
|
public set requestById(id: number) {
|
||||||
{
|
this._requestType = RequestedPage.REQUEST_TYPE_ID;
|
||||||
this._requestType = RequestedPage.REQUEST_TYPE_ID;
|
this._requestById = id;
|
||||||
this._requestById = id;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get requestedByOfferId(): number
|
public get requestedByOfferId(): number {
|
||||||
{
|
return this._requestedByOfferId;
|
||||||
return this._requestedByOfferId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set requestedByOfferId(offerId: number)
|
public set requestedByOfferId(offerId: number) {
|
||||||
{
|
this._requestType = RequestedPage.REQUEST_TYPE_OFFER;
|
||||||
this._requestType = RequestedPage.REQUEST_TYPE_OFFER;
|
this._requestedByOfferId = offerId;
|
||||||
this._requestedByOfferId = offerId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get requestByName(): string
|
public get requestByName(): string {
|
||||||
{
|
return this._requestByName;
|
||||||
return this._requestByName;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set requestByName(name: string)
|
public set requestByName(name: string) {
|
||||||
{
|
this._requestType = RequestedPage.REQUEST_TYPE_NAME;
|
||||||
this._requestType = RequestedPage.REQUEST_TYPE_NAME;
|
this._requestByName = name;
|
||||||
this._requestByName = name;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import { ICatalogNode } from './ICatalogNode';
|
import {ICatalogNode} from "./ICatalogNode";
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
import {IPurchasableOffer} from "./IPurchasableOffer";
|
||||||
|
|
||||||
export class SearchResult
|
export class SearchResult {
|
||||||
{
|
constructor(public readonly searchValue: string, public readonly offers: IPurchasableOffer[], public readonly filteredNodes: ICatalogNode[]) {}
|
||||||
constructor(
|
|
||||||
public readonly searchValue: string,
|
|
||||||
public readonly offers: IPurchasableOffer[],
|
|
||||||
public readonly filteredNodes: ICatalogNode[])
|
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
export * from './BuilderFurniPlaceableStatus';
|
export * from "./BuilderFurniPlaceableStatus";
|
||||||
export * from './CatalogNode';
|
export * from "./CatalogNode";
|
||||||
export * from './CatalogPage';
|
export * from "./CatalogPage";
|
||||||
export * from './CatalogPageName';
|
export * from "./CatalogPageName";
|
||||||
export * from './CatalogPetPalette';
|
export * from "./CatalogPetPalette";
|
||||||
export * from './CatalogPurchaseState';
|
export * from "./CatalogPurchaseState";
|
||||||
export * from './CatalogType';
|
export * from "./CatalogType";
|
||||||
export * from './CatalogUtilities';
|
export * from "./CatalogUtilities";
|
||||||
export * from './FurnitureOffer';
|
export * from "./FurnitureOffer";
|
||||||
export * from './GetImageIconUrlForProduct';
|
export * from "./GetImageIconUrlForProduct";
|
||||||
export * from './GiftWrappingConfiguration';
|
export * from "./GiftWrappingConfiguration";
|
||||||
export * from './ICatalogNode';
|
export * from "./ICatalogNode";
|
||||||
export * from './ICatalogOptions';
|
export * from "./ICatalogOptions";
|
||||||
export * from './ICatalogPage';
|
export * from "./ICatalogPage";
|
||||||
export * from './IMarketplaceSearchOptions';
|
export * from "./IMarketplaceSearchOptions";
|
||||||
export * from './IPageLocalization';
|
export * from "./IPageLocalization";
|
||||||
export * from './IProduct';
|
export * from "./IProduct";
|
||||||
export * from './IPurchasableOffer';
|
export * from "./IPurchasableOffer";
|
||||||
export * from './IPurchaseOptions';
|
export * from "./IPurchaseOptions";
|
||||||
export * from './MarketplaceOfferData';
|
export * from "./MarketplaceOfferData";
|
||||||
export * from './MarketplaceOfferState';
|
export * from "./MarketplaceOfferState";
|
||||||
export * from './MarketplaceSearchType';
|
export * from "./MarketplaceSearchType";
|
||||||
export * from './Offer';
|
export * from "./Offer";
|
||||||
export * from './PageLocalization';
|
export * from "./PageLocalization";
|
||||||
export * from './PlacedObjectPurchaseData';
|
export * from "./PlacedObjectPurchaseData";
|
||||||
export * from './Product';
|
export * from "./Product";
|
||||||
export * from './ProductTypeEnum';
|
export * from "./ProductTypeEnum";
|
||||||
export * from './RequestedPage';
|
export * from "./RequestedPage";
|
||||||
export * from './SearchResult';
|
export * from "./SearchResult";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export class ChatEntryType
|
export class ChatEntryType {
|
||||||
{
|
public static TYPE_CHAT = 1;
|
||||||
public static TYPE_CHAT = 1;
|
public static TYPE_ROOM_INFO = 2;
|
||||||
public static TYPE_ROOM_INFO = 2;
|
public static TYPE_IM = 3;
|
||||||
public static TYPE_IM = 3;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export const ChatHistoryCurrentDate = () =>
|
export const ChatHistoryCurrentDate = () => {
|
||||||
{
|
const currentTime = new Date();
|
||||||
const currentTime = new Date();
|
|
||||||
|
|
||||||
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
|
return `${currentTime.getHours().toString().padStart(2, "0")}:${currentTime.getMinutes().toString().padStart(2, "0")}`;
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
export interface IChatEntry
|
export interface IChatEntry {
|
||||||
{
|
id: number;
|
||||||
id: number;
|
webId: number;
|
||||||
webId: number;
|
entityId: number;
|
||||||
entityId: number;
|
name: string;
|
||||||
name: string;
|
look?: string;
|
||||||
look?: string;
|
message?: string;
|
||||||
message?: string;
|
entityType?: number;
|
||||||
entityType?: number;
|
style?: number;
|
||||||
style?: number;
|
chatType?: number;
|
||||||
chatType?: number;
|
imageUrl?: string;
|
||||||
imageUrl?: string;
|
color?: string;
|
||||||
color?: string;
|
roomId: number;
|
||||||
roomId: number;
|
timestamp: string;
|
||||||
timestamp: string;
|
type: number;
|
||||||
type: number;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
export interface IRoomHistoryEntry
|
export interface IRoomHistoryEntry {
|
||||||
{
|
id: number;
|
||||||
id: number;
|
name: string;
|
||||||
name: string;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export const MessengerHistoryCurrentDate = (secondsSinceNow: number = 0) =>
|
export const MessengerHistoryCurrentDate = (secondsSinceNow: number = 0) => {
|
||||||
{
|
const currentTime = secondsSinceNow ? new Date(Date.now() - secondsSinceNow * 1000) : new Date();
|
||||||
const currentTime = secondsSinceNow ? new Date(Date.now() - secondsSinceNow * 1000) : new Date();
|
|
||||||
|
return `${currentTime.getHours().toString().padStart(2, "0")}:${currentTime.getMinutes().toString().padStart(2, "0")}`;
|
||||||
return `${ currentTime.getHours().toString().padStart(2, '0') }:${ currentTime.getMinutes().toString().padStart(2, '0') }`;
|
};
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export * from './ChatEntryType';
|
export * from "./ChatEntryType";
|
||||||
export * from './ChatHistoryCurrentDate';
|
export * from "./ChatHistoryCurrentDate";
|
||||||
export * from './IChatEntry';
|
export * from "./IChatEntry";
|
||||||
export * from './IRoomHistoryEntry';
|
export * from "./IRoomHistoryEntry";
|
||||||
export * from './MessengerHistoryCurrentDate';
|
export * from "./MessengerHistoryCurrentDate";
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import { IEventDispatcher, NitroEvent } from '@nitro/renderer';
|
import {IEventDispatcher, NitroEvent} from "@nitro/renderer";
|
||||||
|
|
||||||
export const DispatchEvent = (eventDispatcher: IEventDispatcher, event: NitroEvent) => eventDispatcher.dispatchEvent(event);
|
export const DispatchEvent = (eventDispatcher: IEventDispatcher, event: NitroEvent) => eventDispatcher.dispatchEvent(event);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { NitroEvent } from '@nitro/renderer';
|
import {NitroEvent} from "@nitro/renderer";
|
||||||
import { GetNitroInstance } from '../nitro';
|
|
||||||
import { DispatchEvent } from './DispatchEvent';
|
import {GetNitroInstance} from "../nitro";
|
||||||
|
import {DispatchEvent} from "./DispatchEvent";
|
||||||
|
|
||||||
export const DispatchMainEvent = (event: NitroEvent) => DispatchEvent(GetNitroInstance().events, event);
|
export const DispatchMainEvent = (event: NitroEvent) => DispatchEvent(GetNitroInstance().events, event);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { NitroEvent } from '@nitro/renderer';
|
import {NitroEvent} from "@nitro/renderer";
|
||||||
import { DispatchEvent } from './DispatchEvent';
|
|
||||||
import { UI_EVENT_DISPATCHER } from './UI_EVENT_DISPATCHER';
|
import {DispatchEvent} from "./DispatchEvent";
|
||||||
|
import {UI_EVENT_DISPATCHER} from "./UI_EVENT_DISPATCHER";
|
||||||
|
|
||||||
export const DispatchUiEvent = (event: NitroEvent) => DispatchEvent(UI_EVENT_DISPATCHER, event);
|
export const DispatchUiEvent = (event: NitroEvent) => DispatchEvent(UI_EVENT_DISPATCHER, event);
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import { EventDispatcher, IEventDispatcher } from '@nitro/renderer';
|
import {EventDispatcher, IEventDispatcher} from "@nitro/renderer";
|
||||||
|
|
||||||
export const UI_EVENT_DISPATCHER: IEventDispatcher = new EventDispatcher();
|
export const UI_EVENT_DISPATCHER: IEventDispatcher = new EventDispatcher();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export * from './DispatchEvent';
|
export * from "./DispatchEvent";
|
||||||
export * from './DispatchMainEvent';
|
export * from "./DispatchMainEvent";
|
||||||
export * from './DispatchUiEvent';
|
export * from "./DispatchUiEvent";
|
||||||
export * from './UI_EVENT_DISPATCHER';
|
export * from "./UI_EVENT_DISPATCHER";
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import { IGroupChatData } from './IGroupChatData';
|
import {IGroupChatData} from "./IGroupChatData";
|
||||||
|
|
||||||
export const GetGroupChatData = (extraData: string) =>
|
export const GetGroupChatData = (extraData: string) => {
|
||||||
{
|
if (!extraData || !extraData.length) return null;
|
||||||
if(!extraData || !extraData.length) return null;
|
|
||||||
|
|
||||||
const splitData = extraData.split('/');
|
|
||||||
const username = splitData[0];
|
|
||||||
const figure = splitData[1];
|
|
||||||
const userId = parseInt(splitData[2]);
|
|
||||||
|
|
||||||
return ({ username: username, figure: figure, userId: userId } as IGroupChatData);
|
const splitData = extraData.split("/");
|
||||||
}
|
const username = splitData[0];
|
||||||
|
const figure = splitData[1];
|
||||||
|
const userId = parseInt(splitData[2]);
|
||||||
|
|
||||||
|
return {username: username, figure: figure, userId: userId} as IGroupChatData;
|
||||||
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export interface IGroupChatData
|
export interface IGroupChatData {
|
||||||
{
|
username: string;
|
||||||
username: string;
|
figure: string;
|
||||||
figure: string;
|
userId: number;
|
||||||
userId: number;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +1,41 @@
|
||||||
import { FriendParser } from '@nitro/renderer';
|
import {FriendParser} from "@nitro/renderer";
|
||||||
|
|
||||||
export class MessengerFriend
|
export class MessengerFriend {
|
||||||
{
|
public static RELATIONSHIP_NONE: number = 0;
|
||||||
public static RELATIONSHIP_NONE: number = 0;
|
public static RELATIONSHIP_HEART: number = 1;
|
||||||
public static RELATIONSHIP_HEART: number = 1;
|
public static RELATIONSHIP_SMILE: number = 2;
|
||||||
public static RELATIONSHIP_SMILE: number = 2;
|
public static RELATIONSHIP_BOBBA: number = 3;
|
||||||
public static RELATIONSHIP_BOBBA: number = 3;
|
|
||||||
|
|
||||||
public id: number = -1;
|
public id: number = -1;
|
||||||
public name: string = null;
|
public name: string = null;
|
||||||
public gender: number = 0;
|
public gender: number = 0;
|
||||||
public online: boolean = false;
|
public online: boolean = false;
|
||||||
public followingAllowed: boolean = false;
|
public followingAllowed: boolean = false;
|
||||||
public figure: string = null;
|
public figure: string = null;
|
||||||
public categoryId: number = 0;
|
public categoryId: number = 0;
|
||||||
public motto: string = null;
|
public motto: string = null;
|
||||||
public realName: string = null;
|
public realName: string = null;
|
||||||
public lastAccess: string = null;
|
public lastAccess: string = null;
|
||||||
public persistedMessageUser: boolean = false;
|
public persistedMessageUser: boolean = false;
|
||||||
public vipMember: boolean = false;
|
public vipMember: boolean = false;
|
||||||
public pocketHabboUser: boolean = false;
|
public pocketHabboUser: boolean = false;
|
||||||
public relationshipStatus: number = -1;
|
public relationshipStatus: number = -1;
|
||||||
public unread: number = 0;
|
public unread: number = 0;
|
||||||
|
|
||||||
public populate(parser: FriendParser): void
|
public populate(parser: FriendParser): void {
|
||||||
{
|
this.id = parser.id;
|
||||||
this.id = parser.id;
|
this.name = parser.name;
|
||||||
this.name = parser.name;
|
this.gender = parser.gender;
|
||||||
this.gender = parser.gender;
|
this.online = parser.online;
|
||||||
this.online = parser.online;
|
this.followingAllowed = parser.followingAllowed;
|
||||||
this.followingAllowed = parser.followingAllowed;
|
this.figure = parser.figure;
|
||||||
this.figure = parser.figure;
|
this.categoryId = parser.categoryId;
|
||||||
this.categoryId = parser.categoryId;
|
this.motto = parser.motto;
|
||||||
this.motto = parser.motto;
|
this.realName = parser.realName;
|
||||||
this.realName = parser.realName;
|
this.lastAccess = parser.lastAccess;
|
||||||
this.lastAccess = parser.lastAccess;
|
this.persistedMessageUser = parser.persistedMessageUser;
|
||||||
this.persistedMessageUser = parser.persistedMessageUser;
|
this.vipMember = parser.vipMember;
|
||||||
this.vipMember = parser.vipMember;
|
this.pocketHabboUser = parser.pocketHabboUser;
|
||||||
this.pocketHabboUser = parser.pocketHabboUser;
|
this.relationshipStatus = parser.relationshipStatus;
|
||||||
this.relationshipStatus = parser.relationshipStatus;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
export class MessengerGroupType
|
export class MessengerGroupType {
|
||||||
{
|
public static readonly GROUP_CHAT = 0;
|
||||||
public static readonly GROUP_CHAT = 0;
|
public static readonly PRIVATE_CHAT = 1;
|
||||||
public static readonly PRIVATE_CHAT = 1;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export class MessengerIconState
|
export class MessengerIconState {
|
||||||
{
|
public static HIDDEN: number = 0;
|
||||||
public static HIDDEN: number = 0;
|
public static SHOW: number = 1;
|
||||||
public static SHOW: number = 1;
|
public static UNREAD: number = 2;
|
||||||
public static UNREAD: number = 2;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,35 @@
|
||||||
import { FriendRequestData } from '@nitro/renderer';
|
import {FriendRequestData} from "@nitro/renderer";
|
||||||
|
|
||||||
export class MessengerRequest
|
export class MessengerRequest {
|
||||||
{
|
private _id: number;
|
||||||
private _id: number;
|
private _name: string;
|
||||||
private _name: string;
|
private _requesterUserId: number;
|
||||||
private _requesterUserId: number;
|
private _figureString: string;
|
||||||
private _figureString: string;
|
|
||||||
|
|
||||||
public populate(data: FriendRequestData): boolean
|
public populate(data: FriendRequestData): boolean {
|
||||||
{
|
if (!data) return false;
|
||||||
if(!data) return false;
|
|
||||||
|
|
||||||
this._id = data.requestId;
|
this._id = data.requestId;
|
||||||
this._name = data.requesterName;
|
this._name = data.requesterName;
|
||||||
this._figureString = data.figureString;
|
this._figureString = data.figureString;
|
||||||
this._requesterUserId = data.requesterUserId;
|
this._requesterUserId = data.requesterUserId;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get id(): number
|
public get id(): number {
|
||||||
{
|
return this._id;
|
||||||
return this._id;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get name(): string
|
public get name(): string {
|
||||||
{
|
return this._name;
|
||||||
return this._name;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get requesterUserId(): number
|
public get requesterUserId(): number {
|
||||||
{
|
return this._requesterUserId;
|
||||||
return this._requesterUserId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get figureString(): string
|
public get figureString(): string {
|
||||||
{
|
return this._figureString;
|
||||||
return this._figureString;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { FriendCategoryData } from '@nitro/renderer';
|
import {FriendCategoryData} from "@nitro/renderer";
|
||||||
|
|
||||||
export class MessengerSettings
|
export class MessengerSettings {
|
||||||
{
|
constructor(
|
||||||
constructor(
|
public userFriendLimit: number = 0,
|
||||||
public userFriendLimit: number = 0,
|
public normalFriendLimit: number = 0,
|
||||||
public normalFriendLimit: number = 0,
|
public extendedFriendLimit: number = 0,
|
||||||
public extendedFriendLimit: number = 0,
|
public categories: FriendCategoryData[] = []
|
||||||
public categories: FriendCategoryData[] = [])
|
) {}
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,96 +1,85 @@
|
||||||
import { GetGroupChatData } from './GetGroupChatData';
|
import {GetGroupChatData} from "./GetGroupChatData";
|
||||||
import { MessengerFriend } from './MessengerFriend';
|
import {MessengerFriend} from "./MessengerFriend";
|
||||||
import { MessengerGroupType } from './MessengerGroupType';
|
import {MessengerGroupType} from "./MessengerGroupType";
|
||||||
import { MessengerThreadChat } from './MessengerThreadChat';
|
import {MessengerThreadChat} from "./MessengerThreadChat";
|
||||||
import { MessengerThreadChatGroup } from './MessengerThreadChatGroup';
|
import {MessengerThreadChatGroup} from "./MessengerThreadChatGroup";
|
||||||
|
|
||||||
export class MessengerThread
|
export class MessengerThread {
|
||||||
{
|
public static MESSAGE_RECEIVED: string = "MT_MESSAGE_RECEIVED";
|
||||||
public static MESSAGE_RECEIVED: string = 'MT_MESSAGE_RECEIVED';
|
public static THREAD_ID: number = 0;
|
||||||
public static THREAD_ID: number = 0;
|
|
||||||
|
|
||||||
private _threadId: number;
|
private _threadId: number;
|
||||||
private _participant: MessengerFriend;
|
private _participant: MessengerFriend;
|
||||||
private _groups: MessengerThreadChatGroup[];
|
private _groups: MessengerThreadChatGroup[];
|
||||||
private _lastUpdated: Date;
|
private _lastUpdated: Date;
|
||||||
private _unreadCount: number;
|
private _unreadCount: number;
|
||||||
|
|
||||||
constructor(participant: MessengerFriend)
|
constructor(participant: MessengerFriend) {
|
||||||
{
|
this._threadId = ++MessengerThread.THREAD_ID;
|
||||||
this._threadId = ++MessengerThread.THREAD_ID;
|
this._participant = participant;
|
||||||
this._participant = participant;
|
this._groups = [];
|
||||||
this._groups = [];
|
this._lastUpdated = new Date();
|
||||||
this._lastUpdated = new Date();
|
this._unreadCount = 0;
|
||||||
this._unreadCount = 0;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public addMessage(senderId: number, message: string, secondsSinceSent: number = 0, extraData: string = null, type: number = 0): MessengerThreadChat
|
public addMessage(senderId: number, message: string, secondsSinceSent: number = 0, extraData: string = null, type: number = 0): MessengerThreadChat {
|
||||||
{
|
const isGroupChat = senderId < 0 && extraData;
|
||||||
const isGroupChat = (senderId < 0 && extraData);
|
const userId = isGroupChat ? GetGroupChatData(extraData).userId : senderId;
|
||||||
const userId = isGroupChat ? GetGroupChatData(extraData).userId : senderId;
|
|
||||||
|
|
||||||
const group = this.getLastGroup(userId);
|
const group = this.getLastGroup(userId);
|
||||||
|
|
||||||
if(!group) return;
|
if (!group) return;
|
||||||
|
|
||||||
if(isGroupChat) group.type = MessengerGroupType.GROUP_CHAT;
|
if (isGroupChat) group.type = MessengerGroupType.GROUP_CHAT;
|
||||||
|
|
||||||
const chat = new MessengerThreadChat(senderId, message, secondsSinceSent, extraData, type);
|
const chat = new MessengerThreadChat(senderId, message, secondsSinceSent, extraData, type);
|
||||||
|
|
||||||
group.addChat(chat);
|
group.addChat(chat);
|
||||||
|
|
||||||
this._lastUpdated = new Date();
|
this._lastUpdated = new Date();
|
||||||
|
|
||||||
this._unreadCount++;
|
|
||||||
|
|
||||||
return chat;
|
this._unreadCount++;
|
||||||
}
|
|
||||||
|
|
||||||
private getLastGroup(userId: number): MessengerThreadChatGroup
|
return chat;
|
||||||
{
|
}
|
||||||
let group = this._groups[(this._groups.length - 1)];
|
|
||||||
|
|
||||||
if(group && (group.userId === userId)) return group;
|
private getLastGroup(userId: number): MessengerThreadChatGroup {
|
||||||
|
let group = this._groups[this._groups.length - 1];
|
||||||
|
|
||||||
group = new MessengerThreadChatGroup(userId);
|
if (group && group.userId === userId) return group;
|
||||||
|
|
||||||
this._groups.push(group);
|
group = new MessengerThreadChatGroup(userId);
|
||||||
|
|
||||||
return group;
|
this._groups.push(group);
|
||||||
}
|
|
||||||
|
|
||||||
public setRead(): void
|
return group;
|
||||||
{
|
}
|
||||||
this._unreadCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get threadId(): number
|
public setRead(): void {
|
||||||
{
|
this._unreadCount = 0;
|
||||||
return this._threadId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get participant(): MessengerFriend
|
public get threadId(): number {
|
||||||
{
|
return this._threadId;
|
||||||
return this._participant;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get groups(): MessengerThreadChatGroup[]
|
public get participant(): MessengerFriend {
|
||||||
{
|
return this._participant;
|
||||||
return this._groups;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get lastUpdated(): Date
|
public get groups(): MessengerThreadChatGroup[] {
|
||||||
{
|
return this._groups;
|
||||||
return this._lastUpdated;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get unreadCount(): number
|
public get lastUpdated(): Date {
|
||||||
{
|
return this._lastUpdated;
|
||||||
return this._unreadCount;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get unread(): boolean
|
public get unreadCount(): number {
|
||||||
{
|
return this._unreadCount;
|
||||||
return (this._unreadCount > 0);
|
}
|
||||||
}
|
|
||||||
|
public get unread(): boolean {
|
||||||
|
return this._unreadCount > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,46 @@
|
||||||
export class MessengerThreadChat
|
export class MessengerThreadChat {
|
||||||
{
|
public static CHAT: number = 0;
|
||||||
public static CHAT: number = 0;
|
public static ROOM_INVITE: number = 1;
|
||||||
public static ROOM_INVITE: number = 1;
|
public static STATUS_NOTIFICATION: number = 2;
|
||||||
public static STATUS_NOTIFICATION: number = 2;
|
public static SECURITY_NOTIFICATION: number = 3;
|
||||||
public static SECURITY_NOTIFICATION: number = 3;
|
|
||||||
|
|
||||||
private _type: number;
|
private _type: number;
|
||||||
private _senderId: number;
|
private _senderId: number;
|
||||||
private _message: string;
|
private _message: string;
|
||||||
private _secondsSinceSent: number;
|
private _secondsSinceSent: number;
|
||||||
private _extraData: string;
|
private _extraData: string;
|
||||||
private _date: Date;
|
private _date: Date;
|
||||||
|
|
||||||
constructor(senderId: number, message: string, secondsSinceSent: number = 0, extraData: string = null, type: number = 0)
|
constructor(senderId: number, message: string, secondsSinceSent: number = 0, extraData: string = null, type: number = 0) {
|
||||||
{
|
this._type = type;
|
||||||
this._type = type;
|
this._senderId = senderId;
|
||||||
this._senderId = senderId;
|
this._message = message;
|
||||||
this._message = message;
|
this._secondsSinceSent = secondsSinceSent;
|
||||||
this._secondsSinceSent = secondsSinceSent;
|
this._extraData = extraData;
|
||||||
this._extraData = extraData;
|
this._date = new Date();
|
||||||
this._date = new Date();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get type(): number
|
public get type(): number {
|
||||||
{
|
return this._type;
|
||||||
return this._type;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get senderId(): number
|
public get senderId(): number {
|
||||||
{
|
return this._senderId;
|
||||||
return this._senderId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get message(): string
|
public get message(): string {
|
||||||
{
|
return this._message;
|
||||||
return this._message;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get secondsSinceSent(): number
|
public get secondsSinceSent(): number {
|
||||||
{
|
return this._secondsSinceSent;
|
||||||
return this._secondsSinceSent;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get extraData(): string
|
public get extraData(): string {
|
||||||
{
|
return this._extraData;
|
||||||
return this._extraData;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get date(): Date
|
public get date(): Date {
|
||||||
{
|
return this._date;
|
||||||
return this._date;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,34 @@
|
||||||
import { MessengerGroupType } from './MessengerGroupType';
|
import {MessengerGroupType} from "./MessengerGroupType";
|
||||||
import { MessengerThreadChat } from './MessengerThreadChat';
|
import {MessengerThreadChat} from "./MessengerThreadChat";
|
||||||
|
|
||||||
export class MessengerThreadChatGroup
|
export class MessengerThreadChatGroup {
|
||||||
{
|
private _userId: number;
|
||||||
private _userId: number;
|
private _chats: MessengerThreadChat[];
|
||||||
private _chats: MessengerThreadChat[];
|
private _type: number;
|
||||||
private _type: number;
|
|
||||||
|
|
||||||
constructor(userId: number, type = MessengerGroupType.PRIVATE_CHAT)
|
constructor(userId: number, type = MessengerGroupType.PRIVATE_CHAT) {
|
||||||
{
|
this._userId = userId;
|
||||||
this._userId = userId;
|
this._chats = [];
|
||||||
this._chats = [];
|
this._type = type;
|
||||||
this._type = type;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public addChat(message: MessengerThreadChat): void
|
public addChat(message: MessengerThreadChat): void {
|
||||||
{
|
this._chats.push(message);
|
||||||
this._chats.push(message);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get userId(): number
|
public get userId(): number {
|
||||||
{
|
return this._userId;
|
||||||
return this._userId;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get chats(): MessengerThreadChat[]
|
public get chats(): MessengerThreadChat[] {
|
||||||
{
|
return this._chats;
|
||||||
return this._chats;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public get type(): number
|
public get type(): number {
|
||||||
{
|
return this._type;
|
||||||
return this._type;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public set type(type: number)
|
public set type(type: number) {
|
||||||
{
|
this._type = type;
|
||||||
this._type = type;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { CreateLinkEvent } from '..';
|
import {CreateLinkEvent} from "..";
|
||||||
|
|
||||||
export function OpenMessengerChat(friendId: number = 0): void
|
export function OpenMessengerChat(friendId: number = 0): void {
|
||||||
{
|
if (friendId === 0) CreateLinkEvent("friends-messenger/toggle");
|
||||||
if(friendId === 0) CreateLinkEvent('friends-messenger/toggle');
|
else CreateLinkEvent(`friends-messenger/${friendId}`);
|
||||||
else CreateLinkEvent(`friends-messenger/${ friendId }`);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
export * from './GetGroupChatData';
|
export * from "./GetGroupChatData";
|
||||||
export * from './IGroupChatData';
|
export * from "./IGroupChatData";
|
||||||
export * from './MessengerFriend';
|
export * from "./MessengerFriend";
|
||||||
export * from './MessengerGroupType';
|
export * from "./MessengerGroupType";
|
||||||
export * from './MessengerIconState';
|
export * from "./MessengerIconState";
|
||||||
export * from './MessengerRequest';
|
export * from "./MessengerRequest";
|
||||||
export * from './MessengerSettings';
|
export * from "./MessengerSettings";
|
||||||
export * from './MessengerThread';
|
export * from "./MessengerThread";
|
||||||
export * from './MessengerThreadChat';
|
export * from "./MessengerThreadChat";
|
||||||
export * from './MessengerThreadChatGroup';
|
export * from "./MessengerThreadChatGroup";
|
||||||
export * from './OpenMessengerChat';
|
export * from "./OpenMessengerChat";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { GroupInformationComposer } from '@nitro/renderer';
|
import {GroupInformationComposer} from "@nitro/renderer";
|
||||||
import { SendMessageComposer } from '..';
|
|
||||||
|
|
||||||
export function GetGroupInformation(groupId: number): void
|
import {SendMessageComposer} from "..";
|
||||||
{
|
|
||||||
SendMessageComposer(new GroupInformationComposer(groupId, true));
|
export function GetGroupInformation(groupId: number): void {
|
||||||
|
SendMessageComposer(new GroupInformationComposer(groupId, true));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { CreateLinkEvent } from '..';
|
import {CreateLinkEvent} from "..";
|
||||||
|
|
||||||
export function GetGroupManager(groupId: number): void
|
export function GetGroupManager(groupId: number): void {
|
||||||
{
|
CreateLinkEvent(`groups/manage/${groupId}`);
|
||||||
CreateLinkEvent(`groups/manage/${ groupId }`);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { CreateLinkEvent } from '..';
|
import {CreateLinkEvent} from "..";
|
||||||
|
|
||||||
export function GetGroupMembers(groupId: number, levelId?: number): void
|
export function GetGroupMembers(groupId: number, levelId?: number): void {
|
||||||
{
|
if (!levelId) CreateLinkEvent(`group-members/${groupId}`);
|
||||||
if(!levelId) CreateLinkEvent(`group-members/${ groupId }`);
|
else CreateLinkEvent(`group-members/${groupId}/${levelId}`);
|
||||||
else CreateLinkEvent(`group-members/${ groupId }/${ levelId }`);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,26 @@
|
||||||
|
export class GroupBadgePart {
|
||||||
|
public static BASE: string = "b";
|
||||||
|
public static SYMBOL: string = "s";
|
||||||
|
|
||||||
export class GroupBadgePart
|
public type: string;
|
||||||
{
|
public key: number;
|
||||||
public static BASE: string = 'b';
|
public color: number;
|
||||||
public static SYMBOL: string = 's';
|
public position: number;
|
||||||
|
|
||||||
public type: string;
|
constructor(type: string, key?: number, color?: number, position?: number) {
|
||||||
public key: number;
|
this.type = type;
|
||||||
public color: number;
|
this.key = key ? key : 0;
|
||||||
public position: number;
|
this.color = color ? color : 0;
|
||||||
|
this.position = position ? position : 4;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(type: string, key?: number, color?: number, position?: number)
|
public get code(): string {
|
||||||
{
|
if (this.key === 0 && this.type !== GroupBadgePart.BASE) return null;
|
||||||
this.type = type;
|
|
||||||
this.key = key ? key : 0;
|
|
||||||
this.color = color ? color : 0;
|
|
||||||
this.position = position ? position : 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get code(): string
|
return GroupBadgePart.getCode(this.type, this.key, this.color, this.position);
|
||||||
{
|
}
|
||||||
if((this.key === 0) && (this.type !== GroupBadgePart.BASE)) return null;
|
|
||||||
|
|
||||||
return GroupBadgePart.getCode(this.type, this.key, this.color, this.position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getCode(type: string, key: number, color: number, position: number): string
|
public static getCode(type: string, key: number, color: number, position: number): string {
|
||||||
{
|
return type + (key < 10 ? "0" : "") + key + (color < 10 ? "0" : "") + color + position;
|
||||||
return type + (key < 10 ? '0' : '') + key + (color < 10 ? '0' : '') + color + position;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export class GroupMembershipType
|
export class GroupMembershipType {
|
||||||
{
|
public static NOT_MEMBER: number = 0;
|
||||||
public static NOT_MEMBER: number = 0;
|
public static MEMBER: number = 1;
|
||||||
public static MEMBER: number = 1;
|
public static REQUEST_PENDING: number = 2;
|
||||||
public static REQUEST_PENDING: number = 2;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export class GroupType
|
export class GroupType {
|
||||||
{
|
public static REGULAR: number = 0;
|
||||||
public static REGULAR: number = 0;
|
public static EXCLUSIVE: number = 1;
|
||||||
public static EXCLUSIVE: number = 1;
|
public static PRIVATE: number = 2;
|
||||||
public static PRIVATE: number = 2;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
export interface IGroupCustomize
|
export interface IGroupCustomize {
|
||||||
{
|
badgeBases: {id: number; images: string[]}[];
|
||||||
badgeBases: { id: number, images: string[] }[];
|
badgeSymbols: {id: number; images: string[]}[];
|
||||||
badgeSymbols: { id: number, images: string[] }[];
|
badgePartColors: {id: number; color: string}[];
|
||||||
badgePartColors: { id: number, color: string }[];
|
groupColorsA: {id: number; color: string}[];
|
||||||
groupColorsA: { id: number, color: string }[];
|
groupColorsB: {id: number; color: string}[];
|
||||||
groupColorsB: { id: number, color: string }[];
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue