mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Merge branch 'dev' into navigator-packets
This commit is contained in:
commit
9d94443a95
86
.eslintrc.js
86
.eslintrc.js
@ -1,86 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
'extends': [
|
|
||||||
'react-app',
|
|
||||||
'react-app/jest'
|
|
||||||
],
|
|
||||||
'rules': {
|
|
||||||
'linebreak-style': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'quotes': [
|
|
||||||
'error',
|
|
||||||
'single'
|
|
||||||
],
|
|
||||||
'brace-style': [
|
|
||||||
'error',
|
|
||||||
'allman',
|
|
||||||
{
|
|
||||||
'allowSingleLine': true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'object-curly-spacing': [
|
|
||||||
'error',
|
|
||||||
'always'
|
|
||||||
],
|
|
||||||
'keyword-spacing': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
'overrides': {
|
|
||||||
'if': {
|
|
||||||
'after': false
|
|
||||||
},
|
|
||||||
'for': {
|
|
||||||
'after': false
|
|
||||||
},
|
|
||||||
'while': {
|
|
||||||
'after': false
|
|
||||||
},
|
|
||||||
'switch': {
|
|
||||||
'after': false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-explicit-any': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/ban-ts-comment': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-empty-function': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
'allow': [
|
|
||||||
'functions',
|
|
||||||
'arrowFunctions',
|
|
||||||
'generatorFunctions',
|
|
||||||
'methods',
|
|
||||||
'generatorMethods',
|
|
||||||
'constructors'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-unused-vars': [
|
|
||||||
'off'
|
|
||||||
],
|
|
||||||
'@typescript-eslint/ban-types': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
'types': {
|
|
||||||
'String': true,
|
|
||||||
'Boolean': true,
|
|
||||||
'Number': true,
|
|
||||||
'Symbol': true,
|
|
||||||
'{}': false,
|
|
||||||
'Object': false,
|
|
||||||
'object': false,
|
|
||||||
'Function': false
|
|
||||||
},
|
|
||||||
'extendDefaults': true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
'no-switch-case-fall-through': [
|
|
||||||
'off'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
67
.eslintrc.json
Normal file
67
.eslintrc.json
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"settings": {
|
||||||
|
"react": {
|
||||||
|
"pragma": "React",
|
||||||
|
"version": "18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"es2021": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:react/recommended",
|
||||||
|
"plugin:react/jsx-runtime",
|
||||||
|
"plugin:react-hooks/recommended"
|
||||||
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": true
|
||||||
|
},
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"react",
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"linebreak-style": [ "off" ],
|
||||||
|
"quotes": [ "error", "single" ],
|
||||||
|
"@typescript-eslint/indent": [ "error", 4, { "SwitchCase": 1 } ],
|
||||||
|
"array-bracket-spacing": [ "error", "always" ],
|
||||||
|
"brace-style": [ "error", "allman" ],
|
||||||
|
"template-curly-spacing": [ "error", "always" ],
|
||||||
|
"no-multi-spaces": [ "error" ],
|
||||||
|
"jsx-quotes": [ "error" ],
|
||||||
|
"react/prop-types": [ "off" ],
|
||||||
|
"react/jsx-curly-spacing": [ "error", { "when": "always", "children": true } ],
|
||||||
|
"react/jsx-equals-spacing": [ "error" ],
|
||||||
|
"react/jsx-newline": [ "error", { "prevent": true } ],
|
||||||
|
"@typescript-eslint/object-curly-spacing": [ "error", "always",
|
||||||
|
{
|
||||||
|
"arraysInObjects": true,
|
||||||
|
"objectsInObjects": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/ban-types": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"types": {
|
||||||
|
"String": true,
|
||||||
|
"Boolean": true,
|
||||||
|
"Number": true,
|
||||||
|
"Symbol": true,
|
||||||
|
"{}": false,
|
||||||
|
"Object": false,
|
||||||
|
"object": false,
|
||||||
|
"Function": false
|
||||||
|
},
|
||||||
|
"extendDefaults": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-switch-case-fall-through": [ "off" ]
|
||||||
|
}
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
*.scss
|
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -14,5 +14,7 @@
|
|||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
"files.trimFinalNewlines": true,
|
"files.trimFinalNewlines": true,
|
||||||
"editor.wordWrap": "on",
|
"editor.wordWrap": "on",
|
||||||
"emmet.showExpandedAbbreviation": "never"
|
"emmet.showExpandedAbbreviation": "never",
|
||||||
|
"eslint.validate": [ "javascript", "javascriptreact", "html", "typescriptreact" ],
|
||||||
|
"eslint.workingDirectories": [ "./src" ]
|
||||||
}
|
}
|
||||||
|
35
package.json
35
package.json
@ -3,28 +3,30 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cross-env BROWSER=none IMAGE_INLINE_SIZE_LIMIT=100000 craco start",
|
"start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none IMAGE_INLINE_SIZE_LIMIT=100000 craco start",
|
||||||
"build": "cross-env GENERATE_SOURCEMAP=false IMAGE_INLINE_SIZE_LIMIT=100000 craco build",
|
"build": "cross-env SKIP_PREFLIGHT_CHECK=true GENERATE_SOURCEMAP=false IMAGE_INLINE_SIZE_LIMIT=100000 craco build",
|
||||||
"build:prod": "npx browserslist@latest --update-db && yarn build",
|
"build:prod": "npx browserslist@latest --update-db && yarn build",
|
||||||
"test": "craco test",
|
"test": "craco test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject",
|
||||||
|
"eslint": "eslint src --ext .ts,.tsx"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@craco/craco": "^6.3.0",
|
"@craco/craco": "^6.3.0",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.1.0",
|
"@fortawesome/fontawesome-svg-core": "^6.1.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.1.0",
|
"@fortawesome/free-solid-svg-icons": "^6.1.0",
|
||||||
"@fortawesome/react-fontawesome": "^0.1.17",
|
"@fortawesome/react-fontawesome": "^0.1.17",
|
||||||
"@nitrots/nitro-renderer": "^1.1.18",
|
"@nitrots/nitro-renderer": "^1.2.5",
|
||||||
|
"@types/react-transition-group": "^4.4.4",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"emoji-toolkit": "^6.6.0",
|
"emoji-toolkit": "^6.6.0",
|
||||||
"node-sass": "^6.0.1",
|
"node-sass": "^6.0.1",
|
||||||
"react": "^17.0.2",
|
"react": "^18.0.0",
|
||||||
"react-bootstrap": "^2.0.0-alpha.2",
|
"react-bootstrap": "^2.2.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^18.0.0",
|
||||||
"react-scripts": "4.0.3",
|
"react-scripts": "4.0.3",
|
||||||
"react-slider": "^1.3.1",
|
"react-slider": "^2.0.0",
|
||||||
"react-transition-group": "^4.4.2",
|
"react-transition-group": "^4.4.2",
|
||||||
"react-virtualized": "^9.22.3",
|
"react-virtualized": "^9.22.3",
|
||||||
"react-youtube": "^7.13.1",
|
"react-youtube": "^7.13.1",
|
||||||
@ -32,16 +34,23 @@
|
|||||||
"use-between": "^1.3.1"
|
"use-between": "^1.3.1"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"react-error-overlay": "6.0.9"
|
"react-error-overlay": "6.0.9",
|
||||||
|
"@types/react": "^18.0.8",
|
||||||
|
"@types/react-dom": "^18.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^12.20.19",
|
"@types/node": "^12.20.19",
|
||||||
"@types/react": "^17.0.15",
|
"@types/react": "^18.0.8",
|
||||||
"@types/react-dom": "^17.0.9",
|
"@types/react-dom": "^18.0.3",
|
||||||
"@types/react-slider": "^1.3.1",
|
"@types/react-slider": "^1.3.1",
|
||||||
"@types/react-transition-group": "^4.4.2",
|
|
||||||
"@types/react-virtualized": "^9.21.13",
|
"@types/react-virtualized": "^9.21.13",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
||||||
|
"@typescript-eslint/parser": "^5.17.0",
|
||||||
|
"eslint": "^8.12.0",
|
||||||
|
"eslint-plugin-import": "^2.25.4",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||||
|
"eslint-plugin-react": "^7.29.4",
|
||||||
|
"eslint-plugin-react-hooks": "^4.4.0",
|
||||||
"react-error-overlay": "6.0.9"
|
"react-error-overlay": "6.0.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"image.library.notifications.url": "${image.library.url}notifications/%image%.png",
|
"image.library.notifications.url": "${image.library.url}notifications/%image%.png",
|
||||||
"achievements.images.url": "${image.library.url}Quests/%image%.png",
|
"achievements.images.url": "${image.library.url}Quests/%image%.png",
|
||||||
"camera.url": "https://camera.com",
|
"camera.url": "https://camera.url",
|
||||||
"thumbnails.url": "https://camera.com/thumbnail/%thumbnail%.png",
|
"thumbnails.url": "https://camera.url/thumbnail/%thumbnail%.png",
|
||||||
"url.prefix": "https://website.com",
|
"url.prefix": "https://website.com",
|
||||||
"habbopages.url": "${url.prefix}/",
|
"habbopages.url": "${url.prefix}/",
|
||||||
"group.homepage.url": "${url.prefix}/groups/%groupid%/id",
|
"group.homepage.url": "${url.prefix}/groups/%groupid%/id",
|
||||||
@ -16,6 +16,43 @@
|
|||||||
"badge.descriptions.enabled": true,
|
"badge.descriptions.enabled": true,
|
||||||
"motto.max.length": 38,
|
"motto.max.length": 38,
|
||||||
"bot.name.max.length": 15,
|
"bot.name.max.length": 15,
|
||||||
|
"navigator.room.models": [
|
||||||
|
{ "clubLevel": 0, "tileSize": 104, "name": "a" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 94, "name": "b" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 36, "name": "c" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 84, "name": "d" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 80, "name": "e" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 80, "name": "f" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 416, "name": "i" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 320, "name": "j" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 448, "name": "k" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 352, "name": "l" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 384, "name": "m" },
|
||||||
|
{ "clubLevel": 0, "tileSize": 372, "name": "n" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 80, "name": "g" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 74, "name": "h" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 416, "name": "o" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 352, "name": "p" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 304, "name": "q" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 336, "name": "r" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 748, "name": "u" },
|
||||||
|
{ "clubLevel": 1, "tileSize": 438, "name": "v" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 540, "name": "t" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 512, "name": "w" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 396, "name": "x" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 440, "name": "y" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 456, "name": "z" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 208, "name": "0" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 1009, "name": "1" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 1044, "name": "2" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 183, "name": "3" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 254, "name": "4" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 1024, "name": "5" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 801, "name": "6" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 354, "name": "7" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 888, "name": "8" },
|
||||||
|
{ "clubLevel": 2, "tileSize": 926, "name": "9" }
|
||||||
|
],
|
||||||
"hotelview": {
|
"hotelview": {
|
||||||
"show.avatar": true,
|
"show.avatar": true,
|
||||||
"widgets": {
|
"widgets": {
|
||||||
|
@ -52,7 +52,7 @@ $friends-list-width: 250px;
|
|||||||
$friends-list-height: 300px;
|
$friends-list-height: 300px;
|
||||||
|
|
||||||
$help-width: 450px;
|
$help-width: 450px;
|
||||||
$help-height: 250px;
|
$help-height: 290px;
|
||||||
|
|
||||||
$nitropedia-width: 400px;
|
$nitropedia-width: 400px;
|
||||||
$nitropedia-height: 400px;
|
$nitropedia-height: 400px;
|
||||||
|
102
src/App.tsx
102
src/App.tsx
@ -1,10 +1,12 @@
|
|||||||
import { ConfigurationEvent, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer';
|
import { ConfigurationEvent, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import { GetCommunication, GetConfiguration, GetNitroInstance, GetUIVersion } from './api';
|
import { GetCommunication, GetConfiguration, GetNitroInstance, GetUIVersion } from './api';
|
||||||
import { Base, TransitionAnimation, TransitionAnimationTypes } from './common';
|
import { Base, TransitionAnimation, TransitionAnimationTypes } from './common';
|
||||||
import { LoadingView } from './components/loading/LoadingView';
|
import { LoadingView } from './components/loading/LoadingView';
|
||||||
import { MainView } from './components/main/MainView';
|
import { MainView } from './components/main/MainView';
|
||||||
import { DispatchUiEvent, UseConfigurationEvent, UseLocalizationEvent, UseMainEvent, UseRoomEngineEvent } from './hooks';
|
import { DispatchUiEvent, UseConfigurationEvent, UseLocalizationEvent, UseMainEvent, UseRoomEngineEvent } from './hooks';
|
||||||
|
import IntervalWebWorker from './workers/IntervalWebWorker';
|
||||||
|
import { WorkerBuilder } from './workers/WorkerBuilder';
|
||||||
|
|
||||||
NitroVersion.UI_VERSION = GetUIVersion();
|
NitroVersion.UI_VERSION = GetUIVersion();
|
||||||
|
|
||||||
@ -12,28 +14,21 @@ 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);
|
||||||
|
|
||||||
//@ts-ignore
|
if(!GetNitroInstance())
|
||||||
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
|
|
||||||
|
|
||||||
if(!GetNitroInstance()) Nitro.bootstrap();
|
|
||||||
|
|
||||||
const getPreloadAssetUrls = useCallback(() =>
|
|
||||||
{
|
{
|
||||||
const urls: string[] = [];
|
//@ts-ignore
|
||||||
const assetUrls = GetConfiguration<string[]>('preload.assets.urls');
|
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
|
||||||
|
|
||||||
if(assetUrls && assetUrls.length)
|
Nitro.bootstrap();
|
||||||
{
|
|
||||||
for(const url of assetUrls) urls.push(GetNitroInstance().core.configuration.interpolate(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
return urls;
|
const worker = new WorkerBuilder(IntervalWebWorker);
|
||||||
}, []);
|
|
||||||
|
|
||||||
const loadPercent = useCallback(() => setPercent(prevValue => (prevValue + 20)), []);
|
Nitro.instance.setWorker(worker);
|
||||||
|
}
|
||||||
|
|
||||||
const handler = useCallback((event: NitroEvent) =>
|
const handler = useCallback((event: NitroEvent) =>
|
||||||
{
|
{
|
||||||
@ -41,7 +36,7 @@ export const App: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
case ConfigurationEvent.LOADED:
|
case ConfigurationEvent.LOADED:
|
||||||
GetNitroInstance().localization.init();
|
GetNitroInstance().localization.init();
|
||||||
loadPercent();
|
setPercent(prevValue => (prevValue + 20));
|
||||||
return;
|
return;
|
||||||
case ConfigurationEvent.FAILED:
|
case ConfigurationEvent.FAILED:
|
||||||
setIsError(true);
|
setIsError(true);
|
||||||
@ -58,44 +53,48 @@ export const App: FC<{}> = props =>
|
|||||||
setTimeout(() => window.location.reload(), 1500);
|
setTimeout(() => window.location.reload(), 1500);
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
|
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
|
||||||
loadPercent();
|
setPercent(prevValue => (prevValue + 20));
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
|
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
|
||||||
setIsError(true);
|
setIsError(true);
|
||||||
setMessage('Handshake Failed');
|
setMessage('Handshake Failed');
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
|
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
|
||||||
loadPercent();
|
setPercent(prevValue => (prevValue + 20));
|
||||||
|
|
||||||
GetNitroInstance().init();
|
GetNitroInstance().init();
|
||||||
|
|
||||||
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
|
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
||||||
setIsError(true);
|
setIsError(true);
|
||||||
setMessage('Connection Error');
|
setMessage('Connection Error');
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
|
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
|
||||||
//if(GetNitroInstance().roomEngine) GetNitroInstance().roomEngine.dispose();
|
//if(GetNitroInstance().roomEngine) GetNitroInstance().roomEngine.dispose();
|
||||||
|
|
||||||
//setIsError(true);
|
//setIsError(true);
|
||||||
setMessage('Connection Error');
|
setMessage('Connection Error');
|
||||||
|
|
||||||
HabboWebTools.send(-1, 'client.init.handshake.fail');
|
HabboWebTools.send(-1, 'client.init.handshake.fail');
|
||||||
return;
|
return;
|
||||||
case RoomEngineEvent.ENGINE_INITIALIZED:
|
case RoomEngineEvent.ENGINE_INITIALIZED:
|
||||||
loadPercent();
|
setPercent(prevValue => (prevValue + 20));
|
||||||
|
|
||||||
setTimeout(() => setIsReady(true), 300);
|
setTimeout(() => setIsReady(true), 300);
|
||||||
return;
|
return;
|
||||||
case NitroLocalizationEvent.LOADED:
|
case NitroLocalizationEvent.LOADED: {
|
||||||
GetNitroInstance().core.asset.downloadAssets(getPreloadAssetUrls(), (status: boolean) =>
|
const assetUrls = GetConfiguration<string[]>('preload.assets.urls');
|
||||||
|
const urls: string[] = [];
|
||||||
|
|
||||||
|
if(assetUrls && assetUrls.length) for(const url of assetUrls) urls.push(GetNitroInstance().core.configuration.interpolate(url));
|
||||||
|
|
||||||
|
GetNitroInstance().core.asset.downloadAssets(urls, (status: boolean) =>
|
||||||
{
|
{
|
||||||
if(status)
|
if(status)
|
||||||
{
|
{
|
||||||
GetCommunication().init();
|
GetCommunication().init();
|
||||||
|
|
||||||
loadPercent();
|
setPercent(prevValue => (prevValue + 20))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -104,8 +103,9 @@ export const App: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [ getPreloadAssetUrls,loadPercent ]);
|
}, []);
|
||||||
|
|
||||||
UseMainEvent(Nitro.WEBGL_UNAVAILABLE, handler);
|
UseMainEvent(Nitro.WEBGL_UNAVAILABLE, handler);
|
||||||
UseMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler);
|
UseMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler);
|
||||||
@ -119,19 +119,33 @@ export const App: FC<{}> = props =>
|
|||||||
UseConfigurationEvent(ConfigurationEvent.LOADED, handler);
|
UseConfigurationEvent(ConfigurationEvent.LOADED, handler);
|
||||||
UseConfigurationEvent(ConfigurationEvent.FAILED, handler);
|
UseConfigurationEvent(ConfigurationEvent.FAILED, handler);
|
||||||
|
|
||||||
if(!WebGL.isWebGLAvailable())
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
DispatchUiEvent(new NitroEvent(Nitro.WEBGL_UNAVAILABLE));
|
if(!WebGL.isWebGLAvailable())
|
||||||
}
|
{
|
||||||
else
|
DispatchUiEvent(new NitroEvent(Nitro.WEBGL_UNAVAILABLE));
|
||||||
{
|
}
|
||||||
GetNitroInstance().core.configuration.init();
|
else
|
||||||
}
|
{
|
||||||
|
GetNitroInstance().core.configuration.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
const resize = (event: UIEvent) => setImageRendering(!(window.devicePixelRatio % 1));
|
||||||
|
|
||||||
|
window.addEventListener('resize', resize);
|
||||||
|
|
||||||
|
resize(null);
|
||||||
|
|
||||||
|
return () =>
|
||||||
|
{
|
||||||
|
window.removeEventListener('resize', resize);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Base fit overflow="hidden">
|
<Base fit overflow="hidden" className={ imageRendering && 'image-rendering-pixelated' }>
|
||||||
{ (!isReady || isError) &&
|
{ (!isReady || isError) &&
|
||||||
<LoadingView isError={isError} message={message} percent={ percent } /> }
|
<LoadingView isError={ isError } message={ message } percent={ percent } /> }
|
||||||
<TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ (isReady) }>
|
<TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ (isReady) }>
|
||||||
<MainView />
|
<MainView />
|
||||||
</TransitionAnimation>
|
</TransitionAnimation>
|
||||||
|
@ -6,7 +6,7 @@ export const GetAchievementCategoryTotalUnseen = (category: IAchievementCategory
|
|||||||
|
|
||||||
let unseen = 0;
|
let unseen = 0;
|
||||||
|
|
||||||
for(const achievement of category.achievements) unseen += achievement.unseen;
|
for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++);
|
||||||
|
|
||||||
return unseen;
|
return unseen;
|
||||||
}
|
}
|
||||||
|
10
src/api/catalog/BuilderFurniPlaceableStatus.ts
Normal file
10
src/api/catalog/BuilderFurniPlaceableStatus.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export class BuilderFurniPlaceableStatus
|
||||||
|
{
|
||||||
|
public static OKAY: number = 0;
|
||||||
|
public static MISSING_OFFER: number = 1;
|
||||||
|
public static FURNI_LIMIT_REACHED: number = 2;
|
||||||
|
public static NOT_IN_ROOM: number = 3;
|
||||||
|
public static NOT_ROOM_OWNER: number = 4;
|
||||||
|
public static GUILD_ROOM: number = 5;
|
||||||
|
public static VISITORS_IN_ROOM: number = 6;
|
||||||
|
}
|
@ -5,5 +5,6 @@ export class CatalogPetPalette
|
|||||||
constructor(
|
constructor(
|
||||||
public readonly breed: string,
|
public readonly breed: string,
|
||||||
public readonly palettes: SellablePetPaletteData[]
|
public readonly palettes: SellablePetPaletteData[]
|
||||||
) {}
|
)
|
||||||
|
{}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { SellablePetPaletteData } from '@nitrots/nitro-renderer';
|
import { SellablePetPaletteData } from '@nitrots/nitro-renderer';
|
||||||
import { GetRoomEngine } from '../../../api';
|
import { GetRoomEngine } from '../nitro';
|
||||||
import { ICatalogNode } from './ICatalogNode';
|
import { ICatalogNode } from './ICatalogNode';
|
||||||
|
|
||||||
export const GetPixelEffectIcon = (id: number) =>
|
export const GetPixelEffectIcon = (id: number) =>
|
||||||
@ -85,21 +85,21 @@ export function GetPetAvailableColors(petIndex: number, palettes: SellablePetPal
|
|||||||
switch(petIndex)
|
switch(petIndex)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
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]];
|
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 ] ];
|
||||||
case 1:
|
case 1:
|
||||||
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]];
|
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 ] ];
|
||||||
case 2:
|
case 2:
|
||||||
return [[16579283], [15378351], [8830016], [15257125], [9340985], [8949607], [6198292], [8703620], [9889626], [8972045], [12161285], [13162269], [8620113], [12616503], [8628101], [0xD2FF00], [9764857]];
|
return [ [ 16579283 ], [ 15378351 ], [ 8830016 ], [ 15257125 ], [ 9340985 ], [ 8949607 ], [ 6198292 ], [ 8703620 ], [ 9889626 ], [ 8972045 ], [ 12161285 ], [ 13162269 ], [ 8620113 ], [ 12616503 ], [ 8628101 ], [ 0xD2FF00 ], [ 9764857 ] ];
|
||||||
case 3:
|
case 3:
|
||||||
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD]];
|
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
||||||
case 4:
|
case 4:
|
||||||
return [[0xFFFFFF], [16053490], [15464440], [16248792], [15396319], [15007487]];
|
return [ [ 0xFFFFFF ], [ 16053490 ], [ 15464440 ], [ 16248792 ], [ 15396319 ], [ 15007487 ] ];
|
||||||
case 5:
|
case 5:
|
||||||
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD]];
|
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
|
||||||
case 6:
|
case 6:
|
||||||
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD], [16767177], [16770205], [16751331]];
|
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ], [ 16767177 ], [ 16770205 ], [ 16751331 ] ];
|
||||||
case 7:
|
case 7:
|
||||||
return [[0xCCCCCC], [0xAEAEAE], [16751331], [10149119], [16763290], [16743786]];
|
return [ [ 0xCCCCCC ], [ 0xAEAEAE ], [ 16751331 ], [ 10149119 ], [ 16763290 ], [ 16743786 ] ];
|
||||||
default: {
|
default: {
|
||||||
const colors: number[][] = [];
|
const colors: number[][] = [];
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
import { GetProductOfferComposer, IFurnitureData } from '@nitrots/nitro-renderer';
|
import { GetProductOfferComposer, IFurnitureData } from '@nitrots/nitro-renderer';
|
||||||
import { GetProductDataForLocalization, SendMessageComposer } from '../../../api';
|
import { GetProductDataForLocalization, SendMessageComposer } 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';
|
@ -1,7 +1,6 @@
|
|||||||
import { ClubGiftInfoParser, ClubOfferData, HabboGroupEntryData, MarketplaceConfigurationMessageParser } from '@nitrots/nitro-renderer';
|
import { ClubGiftInfoParser, ClubOfferData, HabboGroupEntryData, MarketplaceConfigurationMessageParser } from '@nitrots/nitro-renderer';
|
||||||
import { CatalogPetPalette } from './CatalogPetPalette';
|
import { CatalogPetPalette } from './CatalogPetPalette';
|
||||||
import { GiftWrappingConfiguration } from './GiftWrappingConfiguration';
|
import { GiftWrappingConfiguration } from './GiftWrappingConfiguration';
|
||||||
import { SubscriptionInfo } from './SubscriptionInfo';
|
|
||||||
|
|
||||||
export interface ICatalogOptions
|
export interface ICatalogOptions
|
||||||
{
|
{
|
||||||
@ -9,7 +8,6 @@ export interface ICatalogOptions
|
|||||||
petPalettes?: CatalogPetPalette[];
|
petPalettes?: CatalogPetPalette[];
|
||||||
clubOffers?: ClubOfferData[];
|
clubOffers?: ClubOfferData[];
|
||||||
clubGifts?: ClubGiftInfoParser;
|
clubGifts?: ClubGiftInfoParser;
|
||||||
subscriptionInfo?: SubscriptionInfo;
|
|
||||||
giftConfiguration?: GiftWrappingConfiguration;
|
giftConfiguration?: GiftWrappingConfiguration;
|
||||||
marketplaceConfiguration?: MarketplaceConfigurationMessageParser;
|
marketplaceConfiguration?: MarketplaceConfigurationMessageParser;
|
||||||
}
|
}
|
@ -1,9 +1,8 @@
|
|||||||
import { GetFurnitureData, GetProductDataForLocalization, LocalizeText } from '../../../api';
|
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';
|
||||||
import { ProductTypeEnum } from './ProductTypeEnum';
|
|
||||||
|
|
||||||
export class Offer implements IPurchasableOffer
|
export class Offer implements IPurchasableOffer
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
import { GetConfiguration } from '../../../api';
|
import { GetConfiguration } from '../nitro';
|
||||||
import { IPageLocalization } from './IPageLocalization';
|
import { IPageLocalization } from './IPageLocalization';
|
||||||
|
|
||||||
export class PageLocalization implements IPageLocalization
|
export class PageLocalization implements IPageLocalization
|
41
src/api/catalog/PlacedObjectPurchaseData.ts
Normal file
41
src/api/catalog/PlacedObjectPurchaseData.ts
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import { IFurnitureData, IProductData } from '@nitrots/nitro-renderer';
|
||||||
|
import { IPurchasableOffer } from './IPurchasableOffer';
|
||||||
|
|
||||||
|
export class PlacedObjectPurchaseData
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
return this.offer.offerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get productClassId(): number
|
||||||
|
{
|
||||||
|
return this.offer.product.productClassId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get productData(): IProductData
|
||||||
|
{
|
||||||
|
return this.offer.product.productData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get furniData(): IFurnitureData
|
||||||
|
{
|
||||||
|
return this.offer.product.furnitureData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get extraParam(): string
|
||||||
|
{
|
||||||
|
return this.offer.product.extraParam;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { IFurnitureData, IObjectData, IProductData } from '@nitrots/nitro-renderer';
|
import { IFurnitureData, IObjectData, IProductData } from '@nitrots/nitro-renderer';
|
||||||
import { GetConfiguration, GetRoomEngine, GetSessionDataManager } from '../../../api';
|
import { GetConfiguration, GetRoomEngine, GetSessionDataManager } from '../nitro';
|
||||||
import { GetPixelEffectIcon, GetSubscriptionProductIcon } from './CatalogUtilities';
|
import { GetPixelEffectIcon, GetSubscriptionProductIcon } from './CatalogUtilities';
|
||||||
import { IProduct } from './IProduct';
|
import { IProduct } from './IProduct';
|
||||||
import { IPurchasableOffer } from './IPurchasableOffer';
|
import { IPurchasableOffer } from './IPurchasableOffer';
|
11
src/api/catalog/ProductTypeEnum.ts
Normal file
11
src/api/catalog/ProductTypeEnum.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export class ProductTypeEnum
|
||||||
|
{
|
||||||
|
public static WALL: string = 'i';
|
||||||
|
public static FLOOR: string = 's';
|
||||||
|
public static EFFECT: string = 'e';
|
||||||
|
public static HABBO_CLUB: string = 'h';
|
||||||
|
public static BADGE: string = 'b';
|
||||||
|
public static GAME_TOKEN: string = 'GAME_TOKEN';
|
||||||
|
public static PET: string = 'p';
|
||||||
|
public static ROBOT: string = 'r';
|
||||||
|
}
|
@ -6,6 +6,6 @@ export class SearchResult
|
|||||||
constructor(
|
constructor(
|
||||||
public readonly searchValue: string,
|
public readonly searchValue: string,
|
||||||
public readonly offers: IPurchasableOffer[],
|
public readonly offers: IPurchasableOffer[],
|
||||||
public readonly filteredNodes: ICatalogNode[]
|
public readonly filteredNodes: ICatalogNode[])
|
||||||
) {}
|
{}
|
||||||
}
|
}
|
24
src/api/catalog/index.ts
Normal file
24
src/api/catalog/index.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
export * from './BuilderFurniPlaceableStatus';
|
||||||
|
export * from './CatalogNode';
|
||||||
|
export * from './CatalogPage';
|
||||||
|
export * from './CatalogPageName';
|
||||||
|
export * from './CatalogPetPalette';
|
||||||
|
export * from './CatalogPurchaseState';
|
||||||
|
export * from './CatalogType';
|
||||||
|
export * from './CatalogUtilities';
|
||||||
|
export * from './FurnitureOffer';
|
||||||
|
export * from './GiftWrappingConfiguration';
|
||||||
|
export * from './ICatalogNode';
|
||||||
|
export * from './ICatalogOptions';
|
||||||
|
export * from './ICatalogPage';
|
||||||
|
export * from './IPageLocalization';
|
||||||
|
export * from './IProduct';
|
||||||
|
export * from './IPurchasableOffer';
|
||||||
|
export * from './IPurchaseOptions';
|
||||||
|
export * from './Offer';
|
||||||
|
export * from './PageLocalization';
|
||||||
|
export * from './PlacedObjectPurchaseData';
|
||||||
|
export * from './Product';
|
||||||
|
export * from './ProductTypeEnum';
|
||||||
|
export * from './RequestedPage';
|
||||||
|
export * from './SearchResult';
|
@ -1 +0,0 @@
|
|||||||
export * from './ProductImageUtility';
|
|
13
src/api/friends/GetGroupChatData.ts
Normal file
13
src/api/friends/GetGroupChatData.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { IGroupChatData } from './IGroupChatData';
|
||||||
|
|
||||||
|
export const GetGroupChatData = (extraData: string) =>
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
6
src/api/friends/IGroupChatData.ts
Normal file
6
src/api/friends/IGroupChatData.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export interface IGroupChatData
|
||||||
|
{
|
||||||
|
username: string;
|
||||||
|
figure: string;
|
||||||
|
userId: number;
|
||||||
|
}
|
@ -2,7 +2,7 @@ import { FriendParser } from '@nitrots/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;
|
6
src/api/friends/MessengerIconState.ts
Normal file
6
src/api/friends/MessengerIconState.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export class MessengerIconState
|
||||||
|
{
|
||||||
|
public static HIDDEN: number = 0;
|
||||||
|
public static SHOW: number = 1;
|
||||||
|
public static UNREAD: number = 2;
|
||||||
|
}
|
@ -11,10 +11,10 @@ export class MessengerRequest
|
|||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
@ -6,5 +6,6 @@ export class MessengerSettings
|
|||||||
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,14 +1,16 @@
|
|||||||
import { LocalizeText } from '../../../api';
|
import { LocalizeText } from '../utils';
|
||||||
|
import { GetGroupChatData } from './GetGroupChatData';
|
||||||
import { GroupType } from './GroupType';
|
import { GroupType } from './GroupType';
|
||||||
import { MessengerFriend } from './MessengerFriend';
|
import { MessengerFriend } from './MessengerFriend';
|
||||||
import { MessengerThreadChat } from './MessengerThreadChat';
|
import { MessengerThreadChat } from './MessengerThreadChat';
|
||||||
import { MessengerThreadChatGroup } from './MessengerThreadChatGroup';
|
import { MessengerThreadChatGroup } from './MessengerThreadChatGroup';
|
||||||
import { getGroupChatData } from './Utils';
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
private _threadId: number;
|
||||||
private _participant: MessengerFriend;
|
private _participant: MessengerFriend;
|
||||||
private _groups: MessengerThreadChatGroup[];
|
private _groups: MessengerThreadChatGroup[];
|
||||||
private _lastUpdated: Date;
|
private _lastUpdated: Date;
|
||||||
@ -16,6 +18,7 @@ export class MessengerThread
|
|||||||
|
|
||||||
constructor(participant: MessengerFriend, isNew: boolean = true)
|
constructor(participant: MessengerFriend, isNew: boolean = true)
|
||||||
{
|
{
|
||||||
|
this._threadId = ++MessengerThread.THREAD_ID;
|
||||||
this._participant = participant;
|
this._participant = participant;
|
||||||
this._groups = [];
|
this._groups = [];
|
||||||
this._lastUpdated = new Date();
|
this._lastUpdated = new Date();
|
||||||
@ -32,7 +35,7 @@ export class MessengerThread
|
|||||||
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);
|
||||||
|
|
||||||
@ -45,6 +48,7 @@ export class MessengerThread
|
|||||||
group.addChat(chat);
|
group.addChat(chat);
|
||||||
|
|
||||||
this._lastUpdated = new Date();
|
this._lastUpdated = new Date();
|
||||||
|
|
||||||
this._unreadCount++;
|
this._unreadCount++;
|
||||||
|
|
||||||
return chat;
|
return chat;
|
||||||
@ -68,6 +72,11 @@ export class MessengerThread
|
|||||||
this._unreadCount = 0;
|
this._unreadCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get threadId(): number
|
||||||
|
{
|
||||||
|
return this._threadId;
|
||||||
|
}
|
||||||
|
|
||||||
public get participant(): MessengerFriend
|
public get participant(): MessengerFriend
|
||||||
{
|
{
|
||||||
return this._participant;
|
return this._participant;
|
||||||
@ -90,6 +99,6 @@ export class MessengerThread
|
|||||||
|
|
||||||
public get unread(): boolean
|
public get unread(): boolean
|
||||||
{
|
{
|
||||||
return this._unreadCount > 0;
|
return (this._unreadCount > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,6 @@ import { CreateLinkEvent } from '..';
|
|||||||
|
|
||||||
export function OpenMessengerChat(friendId: number = 0): void
|
export function OpenMessengerChat(friendId: number = 0): void
|
||||||
{
|
{
|
||||||
if(friendId === 0) CreateLinkEvent('friends/messenger/open');
|
if(friendId === 0) CreateLinkEvent('friends-messenger/open');
|
||||||
else CreateLinkEvent(`friends/messenger/${friendId}`);
|
else CreateLinkEvent(`friends-messenger/${ friendId }`);
|
||||||
}
|
}
|
||||||
|
@ -1 +1,11 @@
|
|||||||
|
export * from './GetGroupChatData';
|
||||||
|
export * from './GroupType';
|
||||||
|
export * from './IGroupChatData';
|
||||||
|
export * from './MessengerFriend';
|
||||||
|
export * from './MessengerIconState';
|
||||||
|
export * from './MessengerRequest';
|
||||||
|
export * from './MessengerSettings';
|
||||||
|
export * from './MessengerThread';
|
||||||
|
export * from './MessengerThreadChat';
|
||||||
|
export * from './MessengerThreadChatGroup';
|
||||||
export * from './OpenMessengerChat';
|
export * from './OpenMessengerChat';
|
||||||
|
@ -2,5 +2,5 @@ import { CreateLinkEvent } from '..';
|
|||||||
|
|
||||||
export function GetGroupManager(groupId: number): void
|
export function GetGroupManager(groupId: number): void
|
||||||
{
|
{
|
||||||
CreateLinkEvent(`groups/manage/${groupId}`);
|
CreateLinkEvent(`groups/manage/${ groupId }`);
|
||||||
}
|
}
|
||||||
|
11
src/api/hc-center/GetClubBadge.ts
Normal file
11
src/api/hc-center/GetClubBadge.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const DEFAULT_BADGE: string = 'HC1';
|
||||||
|
const BADGES: string[] = [ 'ACH_VipHC1', 'ACH_VipHC2', 'ACH_VipHC3', 'ACH_VipHC4', 'ACH_VipHC5', 'HC1', 'HC2', 'HC3', 'HC4', 'HC5' ];
|
||||||
|
|
||||||
|
export const GetClubBadge = (badgeCodes: string[]) =>
|
||||||
|
{
|
||||||
|
let badgeCode: string = null;
|
||||||
|
|
||||||
|
BADGES.forEach(badge => ((badgeCodes.indexOf(badge) > -1) && (badgeCode = badge)));
|
||||||
|
|
||||||
|
return (badgeCode || DEFAULT_BADGE);
|
||||||
|
}
|
2
src/api/hc-center/index.ts
Normal file
2
src/api/hc-center/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './ClubStatus';
|
||||||
|
export * from './GetClubBadge';
|
@ -1,11 +1,14 @@
|
|||||||
export * from './achievements';
|
export * from './achievements';
|
||||||
export * from './campaign';
|
export * from './campaign';
|
||||||
export * from './common';
|
export * from './catalog';
|
||||||
export * from './core';
|
export * from './core';
|
||||||
export * from './friends';
|
export * from './friends';
|
||||||
export * from './GetRendererVersion';
|
export * from './GetRendererVersion';
|
||||||
export * from './GetUIVersion';
|
export * from './GetUIVersion';
|
||||||
export * from './groups';
|
export * from './groups';
|
||||||
|
export * from './hc-center';
|
||||||
|
export * from './inventory';
|
||||||
|
export * from './inventory/unseen';
|
||||||
export * from './navigator';
|
export * from './navigator';
|
||||||
export * from './nitro';
|
export * from './nitro';
|
||||||
export * from './nitro/avatar';
|
export * from './nitro/avatar';
|
||||||
@ -17,6 +20,7 @@ export * from './nitro/room/widgets/handlers';
|
|||||||
export * from './nitro/room/widgets/messages';
|
export * from './nitro/room/widgets/messages';
|
||||||
export * from './nitro/session';
|
export * from './nitro/session';
|
||||||
export * from './notification';
|
export * from './notification';
|
||||||
|
export * from './purse';
|
||||||
export * from './user';
|
export * from './user';
|
||||||
export * from './utils';
|
export * from './utils';
|
||||||
export * from './wired';
|
export * from './wired';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { IFurnitureItemData, IObjectData } from '@nitrots/nitro-renderer';
|
import { IFurnitureItemData, IObjectData } from '@nitrots/nitro-renderer';
|
||||||
import { GetNitroInstance } from '../../../api';
|
import { IFurnitureItem } from '.';
|
||||||
import { IFurnitureItem } from './IFurnitureItem';
|
import { GetNitroInstance } from '..';
|
||||||
|
|
||||||
export class FurnitureItem implements IFurnitureItem
|
export class FurnitureItem implements IFurnitureItem
|
||||||
{
|
{
|
||||||
@ -31,28 +31,28 @@ export class FurnitureItem implements IFurnitureItem
|
|||||||
{
|
{
|
||||||
if(!parser) return;
|
if(!parser) return;
|
||||||
|
|
||||||
this._locked = false;
|
this._locked = false;
|
||||||
this._id = parser.itemId;
|
this._id = parser.itemId;
|
||||||
this._type = parser.spriteId;
|
this._type = parser.spriteId;
|
||||||
this._ref = parser.ref;
|
this._ref = parser.ref;
|
||||||
this._category = parser.category;
|
this._category = parser.category;
|
||||||
this._groupable = ((parser.isGroupable) && (!(parser.rentable)));
|
this._groupable = ((parser.isGroupable) && (!(parser.rentable)));
|
||||||
this._tradeable = parser.tradable;
|
this._tradeable = parser.tradable;
|
||||||
this._recyclable = parser.isRecycleable;
|
this._recyclable = parser.isRecycleable;
|
||||||
this._sellable = parser.sellable;
|
this._sellable = parser.sellable;
|
||||||
this._stuffData = parser.stuffData;
|
this._stuffData = parser.stuffData;
|
||||||
this._extra = parser.extra;
|
this._extra = parser.extra;
|
||||||
this._secondsToExpiration = parser.secondsToExpiration;
|
this._secondsToExpiration = parser.secondsToExpiration;
|
||||||
this._expirationTimeStamp = parser.expirationTimeStamp;
|
this._expirationTimeStamp = parser.expirationTimeStamp;
|
||||||
this._hasRentPeriodStarted = parser.hasRentPeriodStarted;
|
this._hasRentPeriodStarted = parser.hasRentPeriodStarted;
|
||||||
this._creationDay = parser.creationDay;
|
this._creationDay = parser.creationDay;
|
||||||
this._creationMonth = parser.creationMonth;
|
this._creationMonth = parser.creationMonth;
|
||||||
this._creationYear = parser.creationYear;
|
this._creationYear = parser.creationYear;
|
||||||
this._slotId = parser.slotId;
|
this._slotId = parser.slotId;
|
||||||
this._songId = parser.songId;
|
this._songId = parser.songId;
|
||||||
this._flatId = parser.flatId;
|
this._flatId = parser.flatId;
|
||||||
this._isRented = parser.rentable;
|
this._isRented = parser.rentable;
|
||||||
this._isWallItem = parser.isWallItem;
|
this._isWallItem = parser.isWallItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get rentable(): boolean
|
public get rentable(): boolean
|
||||||
@ -95,7 +95,7 @@ export class FurnitureItem implements IFurnitureItem
|
|||||||
return this._extra;
|
return this._extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get _Str_16260(): boolean
|
public get recyclable(): boolean
|
||||||
{
|
{
|
||||||
return this._recyclable;
|
return this._recyclable;
|
||||||
}
|
}
|
||||||
@ -135,17 +135,17 @@ export class FurnitureItem implements IFurnitureItem
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get _Str_8932(): number
|
public get creationDay(): number
|
||||||
{
|
{
|
||||||
return this._creationDay;
|
return this._creationDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get _Str_9050(): number
|
public get creationMonth(): number
|
||||||
{
|
{
|
||||||
return this._creationMonth;
|
return this._creationMonth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get _Str_9408(): number
|
public get creationYear(): number
|
||||||
{
|
{
|
||||||
return this._creationYear;
|
return this._creationYear;
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ export class FurnitureItem implements IFurnitureItem
|
|||||||
return this._slotId;
|
return this._slotId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get _Str_3951(): number
|
public get songId(): number
|
||||||
{
|
{
|
||||||
return this._songId;
|
return this._songId;
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ export class FurnitureItem implements IFurnitureItem
|
|||||||
return this._hasRentPeriodStarted;
|
return this._hasRentPeriodStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get _Str_10616(): number
|
public get expirationTimeStamp(): number
|
||||||
{
|
{
|
||||||
return this._expirationTimeStamp;
|
return this._expirationTimeStamp;
|
||||||
}
|
}
|
172
src/api/inventory/FurnitureUtilities.ts
Normal file
172
src/api/inventory/FurnitureUtilities.ts
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
import { FurnitureListItemParser, IObjectData } from '@nitrots/nitro-renderer';
|
||||||
|
import { GetRoomEngine } from '../nitro';
|
||||||
|
import { FurniCategory } from './FurniCategory';
|
||||||
|
import { FurnitureItem } from './FurnitureItem';
|
||||||
|
import { GroupItem } from './GroupItem';
|
||||||
|
|
||||||
|
export const createGroupItem = (type: number, category: number, stuffData: IObjectData, extra: number = NaN) => new GroupItem(type, category, GetRoomEngine(), stuffData, extra);
|
||||||
|
|
||||||
|
const addSingleFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) =>
|
||||||
|
{
|
||||||
|
const groupItems: GroupItem[] = [];
|
||||||
|
|
||||||
|
for(const groupItem of set)
|
||||||
|
{
|
||||||
|
if(groupItem.type === item.type) groupItems.push(groupItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(const groupItem of groupItems)
|
||||||
|
{
|
||||||
|
if(groupItem.getItemById(item.id)) return groupItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
const groupItem = createGroupItem(item.type, item.category, item.stuffData, item.extra);
|
||||||
|
|
||||||
|
groupItem.push(item);
|
||||||
|
|
||||||
|
if(unseen)
|
||||||
|
{
|
||||||
|
groupItem.hasUnseenItems = true;
|
||||||
|
|
||||||
|
set.unshift(groupItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set.push(groupItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
const addGroupableFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) =>
|
||||||
|
{
|
||||||
|
let existingGroup: GroupItem = null;
|
||||||
|
|
||||||
|
for(const groupItem of set)
|
||||||
|
{
|
||||||
|
if((groupItem.type === item.type) && (groupItem.isWallItem === item.isWallItem) && groupItem.isGroupable)
|
||||||
|
{
|
||||||
|
if(item.category === FurniCategory.POSTER)
|
||||||
|
{
|
||||||
|
if(groupItem.stuffData.getLegacyString() === item.stuffData.getLegacyString())
|
||||||
|
{
|
||||||
|
existingGroup = groupItem;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(item.category === FurniCategory.GUILD_FURNI)
|
||||||
|
{
|
||||||
|
if(item.stuffData.compare(groupItem.stuffData))
|
||||||
|
{
|
||||||
|
existingGroup = groupItem;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
existingGroup = groupItem;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(existingGroup)
|
||||||
|
{
|
||||||
|
existingGroup.push(item);
|
||||||
|
|
||||||
|
if(unseen)
|
||||||
|
{
|
||||||
|
existingGroup.hasUnseenItems = true;
|
||||||
|
|
||||||
|
const index = set.indexOf(existingGroup);
|
||||||
|
|
||||||
|
if(index >= 0) set.splice(index, 1);
|
||||||
|
|
||||||
|
set.unshift(existingGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
return existingGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
existingGroup = createGroupItem(item.type, item.category, item.stuffData, item.extra);
|
||||||
|
|
||||||
|
existingGroup.push(item);
|
||||||
|
|
||||||
|
if(unseen)
|
||||||
|
{
|
||||||
|
existingGroup.hasUnseenItems = true;
|
||||||
|
|
||||||
|
set.unshift(existingGroup);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set.push(existingGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
return existingGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const addFurnitureItem = (set: GroupItem[], item: FurnitureItem, unseen: boolean) =>
|
||||||
|
{
|
||||||
|
if(!item.isGroupable)
|
||||||
|
{
|
||||||
|
addSingleFurnitureItem(set, item, unseen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addGroupableFurnitureItem(set, item, unseen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const mergeFurniFragments = (fragment: Map<number, FurnitureListItemParser>, totalFragments: number, fragmentNumber: number, fragments: Map<number, FurnitureListItemParser>[]) =>
|
||||||
|
{
|
||||||
|
if(totalFragments === 1) return fragment;
|
||||||
|
|
||||||
|
fragments[fragmentNumber] = fragment;
|
||||||
|
|
||||||
|
for(const frag of fragments)
|
||||||
|
{
|
||||||
|
if(!frag) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const merged: Map<number, FurnitureListItemParser> = new Map();
|
||||||
|
|
||||||
|
for(const frag of fragments)
|
||||||
|
{
|
||||||
|
for(const [ key, value ] of frag) merged.set(key, value);
|
||||||
|
|
||||||
|
frag.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
fragments = null;
|
||||||
|
|
||||||
|
return merged;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAllItemIds = (groupItems: GroupItem[]) =>
|
||||||
|
{
|
||||||
|
const itemIds: number[] = [];
|
||||||
|
|
||||||
|
for(const groupItem of groupItems)
|
||||||
|
{
|
||||||
|
let totalCount = groupItem.getTotalCount();
|
||||||
|
|
||||||
|
if(groupItem.category === FurniCategory.POST_IT) totalCount = 1;
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
|
||||||
|
while(i < totalCount)
|
||||||
|
{
|
||||||
|
itemIds.push(groupItem.getItemByIndex(i).id);
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemIds;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { IObjectData, IRoomEngine } from '@nitrots/nitro-renderer';
|
import { IObjectData, IRoomEngine } from '@nitrots/nitro-renderer';
|
||||||
import { LocalizeText } from '../../../api';
|
import { LocalizeText } from '..';
|
||||||
import { FurniCategory } from './FurniCategory';
|
import { FurniCategory } from './FurniCategory';
|
||||||
import { FurnitureItem } from './FurnitureItem';
|
import { FurnitureItem } from './FurnitureItem';
|
||||||
import { IFurnitureItem } from './IFurnitureItem';
|
import { IFurnitureItem } from './IFurnitureItem';
|
||||||
@ -95,8 +95,8 @@ export class GroupItem
|
|||||||
|
|
||||||
if(!furnitureItem) return items;
|
if(!furnitureItem) return items;
|
||||||
|
|
||||||
let found = 0;
|
let found = 0;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
while(i < this._items.length)
|
while(i < this._items.length)
|
||||||
{
|
{
|
||||||
@ -201,8 +201,8 @@ export class GroupItem
|
|||||||
{
|
{
|
||||||
if(this._category === FurniCategory.POST_IT)
|
if(this._category === FurniCategory.POST_IT)
|
||||||
{
|
{
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
while(index < this._items.length)
|
while(index < this._items.length)
|
||||||
{
|
{
|
||||||
@ -281,8 +281,8 @@ export class GroupItem
|
|||||||
|
|
||||||
while(index < items.length)
|
while(index < items.length)
|
||||||
{
|
{
|
||||||
const item = items[index];
|
const item = items[index];
|
||||||
const locked = (itemIds.indexOf(item.ref) >= 0);
|
const locked = (itemIds.indexOf(item.ref) >= 0);
|
||||||
|
|
||||||
if(item.locked !== locked)
|
if(item.locked !== locked)
|
||||||
{
|
{
|
6
src/api/inventory/IBotItem.ts
Normal file
6
src/api/inventory/IBotItem.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { BotData } from '@nitrots/nitro-renderer';
|
||||||
|
|
||||||
|
export interface IBotItem
|
||||||
|
{
|
||||||
|
botData: BotData;
|
||||||
|
}
|
@ -8,7 +8,7 @@ export interface IFurnitureItem
|
|||||||
stuffData: IObjectData;
|
stuffData: IObjectData;
|
||||||
extra: number;
|
extra: number;
|
||||||
category: number;
|
category: number;
|
||||||
_Str_16260: boolean;
|
recyclable: boolean;
|
||||||
isTradable: boolean;
|
isTradable: boolean;
|
||||||
isGroupable: boolean;
|
isGroupable: boolean;
|
||||||
sellable: boolean;
|
sellable: boolean;
|
6
src/api/inventory/IPetItem.ts
Normal file
6
src/api/inventory/IPetItem.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { PetData } from '@nitrots/nitro-renderer';
|
||||||
|
|
||||||
|
export interface IPetItem
|
||||||
|
{
|
||||||
|
petData: PetData;
|
||||||
|
}
|
116
src/api/inventory/InventoryUtilities.ts
Normal file
116
src/api/inventory/InventoryUtilities.ts
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
import { FurniturePlacePaintComposer, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType } from '@nitrots/nitro-renderer';
|
||||||
|
import { FurniCategory, GroupItem } from '.';
|
||||||
|
import { CreateLinkEvent, GetRoomEngine, GetRoomSessionManager, SendMessageComposer } from '..';
|
||||||
|
import { IBotItem } from './IBotItem';
|
||||||
|
import { IPetItem } from './IPetItem';
|
||||||
|
|
||||||
|
let objectMoverRequested = false;
|
||||||
|
let itemIdInPlacing = -1;
|
||||||
|
|
||||||
|
export const isObjectMoverRequested = () => objectMoverRequested;
|
||||||
|
|
||||||
|
export const setObjectMoverRequested = (flag: boolean) => objectMoverRequested = flag;
|
||||||
|
|
||||||
|
export const getPlacingItemId = () => itemIdInPlacing;
|
||||||
|
|
||||||
|
export const setPlacingItemId = (id: number) => (itemIdInPlacing = id);
|
||||||
|
|
||||||
|
export const cancelRoomObjectPlacement = () =>
|
||||||
|
{
|
||||||
|
if(getPlacingItemId() === -1) return;
|
||||||
|
|
||||||
|
GetRoomEngine().cancelRoomObjectPlacement();
|
||||||
|
|
||||||
|
setPlacingItemId(-1);
|
||||||
|
setObjectMoverRequested(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const attemptPetPlacement = (petItem: IPetItem, flag: boolean = false) =>
|
||||||
|
{
|
||||||
|
const petData = petItem.petData;
|
||||||
|
|
||||||
|
if(!petData) return false;
|
||||||
|
|
||||||
|
const session = GetRoomSessionManager().getSession(1);
|
||||||
|
|
||||||
|
if(!session) return false;
|
||||||
|
|
||||||
|
if(!session.isRoomOwner && !session.allowPets) return false;
|
||||||
|
|
||||||
|
CreateLinkEvent('inventory/hide');
|
||||||
|
|
||||||
|
if(GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, -(petData.id), RoomObjectCategory.UNIT, RoomObjectType.PET, petData.figureData.figuredata))
|
||||||
|
{
|
||||||
|
setPlacingItemId(petData.id);
|
||||||
|
setObjectMoverRequested(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const attemptItemPlacement = (groupItem: GroupItem, flag: boolean = false) =>
|
||||||
|
{
|
||||||
|
if(!groupItem || !groupItem.getUnlockedCount()) return false;
|
||||||
|
|
||||||
|
const item = groupItem.getLastItem();
|
||||||
|
|
||||||
|
if(!item) return false;
|
||||||
|
|
||||||
|
if((item.category === FurniCategory.FLOOR) || (item.category === FurniCategory.WALL_PAPER) || (item.category === FurniCategory.LANDSCAPE))
|
||||||
|
{
|
||||||
|
if(flag) return false;
|
||||||
|
|
||||||
|
SendMessageComposer(new FurniturePlacePaintComposer(item.id));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreateLinkEvent('inventory/hide');
|
||||||
|
|
||||||
|
let category = 0;
|
||||||
|
let isMoving = false;
|
||||||
|
|
||||||
|
if(item.isWallItem) category = RoomObjectCategory.WALL;
|
||||||
|
else category = RoomObjectCategory.FLOOR;
|
||||||
|
|
||||||
|
if((item.category === FurniCategory.POSTER)) // or external image from furnidata
|
||||||
|
{
|
||||||
|
isMoving = GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, item.id, category, item.type, item.stuffData.getLegacyString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isMoving = GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, item.id, category, item.type, item.extra.toString(), item.stuffData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isMoving)
|
||||||
|
{
|
||||||
|
setPlacingItemId(item.ref);
|
||||||
|
setObjectMoverRequested(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const attemptBotPlacement = (botItem: IBotItem, flag: boolean = false) =>
|
||||||
|
{
|
||||||
|
const botData = botItem.botData;
|
||||||
|
|
||||||
|
if(!botData) return false;
|
||||||
|
|
||||||
|
const session = GetRoomSessionManager().getSession(1);
|
||||||
|
|
||||||
|
if(!session || !session.isRoomOwner) return false;
|
||||||
|
|
||||||
|
CreateLinkEvent('inventory/hide');
|
||||||
|
|
||||||
|
if(GetRoomEngine().processRoomObjectPlacement(RoomObjectPlacementSource.INVENTORY, -(botData.id), RoomObjectCategory.UNIT, RoomObjectType.RENTABLE_BOT, botData.figure))
|
||||||
|
{
|
||||||
|
setPlacingItemId(botData.id);
|
||||||
|
setObjectMoverRequested(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
104
src/api/inventory/PetUtilities.ts
Normal file
104
src/api/inventory/PetUtilities.ts
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
import { PetData } from '@nitrots/nitro-renderer';
|
||||||
|
import { CreateLinkEvent } from '../nitro';
|
||||||
|
import { cancelRoomObjectPlacement, getPlacingItemId } from './InventoryUtilities';
|
||||||
|
import { IPetItem } from './IPetItem';
|
||||||
|
import { UnseenItemCategory } from './unseen';
|
||||||
|
|
||||||
|
export const getAllPetIds = (petItems: IPetItem[]) => petItems.map(item => item.petData.id);
|
||||||
|
|
||||||
|
export const addSinglePetItem = (petData: PetData, set: IPetItem[], unseen: boolean = true) =>
|
||||||
|
{
|
||||||
|
const petItem = { petData };
|
||||||
|
|
||||||
|
if(unseen)
|
||||||
|
{
|
||||||
|
//petItem.isUnseen = true;
|
||||||
|
|
||||||
|
set.unshift(petItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set.push(petItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return petItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const removePetItemById = (id: number, set: IPetItem[]) =>
|
||||||
|
{
|
||||||
|
let index = 0;
|
||||||
|
|
||||||
|
while(index < set.length)
|
||||||
|
{
|
||||||
|
const petItem = set[index];
|
||||||
|
|
||||||
|
if(petItem && (petItem.petData.id === id))
|
||||||
|
{
|
||||||
|
if(getPlacingItemId() === petItem.petData.id)
|
||||||
|
{
|
||||||
|
cancelRoomObjectPlacement();
|
||||||
|
|
||||||
|
CreateLinkEvent('inventory/open');
|
||||||
|
}
|
||||||
|
|
||||||
|
set.splice(index, 1);
|
||||||
|
|
||||||
|
return petItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const processPetFragment = (set: IPetItem[], fragment: Map<number, PetData>, isUnseen: (category: number, itemId: number) => boolean) =>
|
||||||
|
{
|
||||||
|
const existingIds = getAllPetIds(set);
|
||||||
|
const addedIds: number[] = [];
|
||||||
|
const removedIds: number[] = [];
|
||||||
|
|
||||||
|
for(const key of fragment.keys()) (existingIds.indexOf(key) === -1) && addedIds.push(key);
|
||||||
|
|
||||||
|
for(const itemId of existingIds) (!fragment.get(itemId)) && removedIds.push(itemId);
|
||||||
|
|
||||||
|
const emptyExistingSet = (existingIds.length === 0);
|
||||||
|
|
||||||
|
for(const id of removedIds) removePetItemById(id, set);
|
||||||
|
|
||||||
|
for(const id of addedIds)
|
||||||
|
{
|
||||||
|
const parser = fragment.get(id);
|
||||||
|
|
||||||
|
if(!parser) continue;
|
||||||
|
|
||||||
|
addSinglePetItem(parser, set, isUnseen(UnseenItemCategory.PET, parser.id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const mergePetFragments = (fragment: Map<number, PetData>, totalFragments: number, fragmentNumber: number, fragments: Map<number, PetData>[]) =>
|
||||||
|
{
|
||||||
|
if(totalFragments === 1) return fragment;
|
||||||
|
|
||||||
|
fragments[fragmentNumber] = fragment;
|
||||||
|
|
||||||
|
for(const frag of fragments)
|
||||||
|
{
|
||||||
|
if(!frag) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const merged: Map<number, PetData> = new Map();
|
||||||
|
|
||||||
|
for(const frag of fragments)
|
||||||
|
{
|
||||||
|
for(const [ key, value ] of frag) merged.set(key, value);
|
||||||
|
|
||||||
|
frag.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
fragments = null;
|
||||||
|
|
||||||
|
return merged;
|
||||||
|
}
|
10
src/api/inventory/TradeState.ts
Normal file
10
src/api/inventory/TradeState.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export class TradeState
|
||||||
|
{
|
||||||
|
public static TRADING_STATE_READY: number = 0;
|
||||||
|
public static TRADING_STATE_RUNNING: number = 1;
|
||||||
|
public static TRADING_STATE_COUNTDOWN: number = 2;
|
||||||
|
public static TRADING_STATE_CONFIRMING: number = 3;
|
||||||
|
public static TRADING_STATE_CONFIRMED: number = 4;
|
||||||
|
public static TRADING_STATE_COMPLETED: number = 5;
|
||||||
|
public static TRADING_STATE_CANCELLED: number = 6;
|
||||||
|
}
|
@ -6,10 +6,10 @@ export class TradeUserData
|
|||||||
constructor(
|
constructor(
|
||||||
public userId: number = -1,
|
public userId: number = -1,
|
||||||
public userName: string = '',
|
public userName: string = '',
|
||||||
public userItems: AdvancedMap<string, GroupItem> = null,
|
public userItems: AdvancedMap<string, GroupItem> = new AdvancedMap(),
|
||||||
public itemCount: number = 0,
|
public itemCount: number = 0,
|
||||||
public creditsCount: number = 0,
|
public creditsCount: number = 0,
|
||||||
public accepts: boolean = false,
|
public accepts: boolean = false,
|
||||||
public canTrade: boolean = false,
|
public canTrade: boolean = false)
|
||||||
public items: AdvancedMap<string, GroupItem> = new AdvancedMap()) {}
|
{}
|
||||||
}
|
}
|
@ -1,28 +1,26 @@
|
|||||||
import { LocalizeText, NotificationUtilities } from '../../../api';
|
import { LocalizeText, NotificationUtilities } from '..';
|
||||||
import { TradingNotificationType } from './TradingNotificationType';
|
import { TradingNotificationType } from './TradingNotificationType';
|
||||||
|
|
||||||
export const TradingNotificationMessage = (type: number) =>
|
export const TradingNotificationMessage = (type: number, otherUsername: string = '') =>
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case TradingNotificationType.ALERT_SCAM:
|
case TradingNotificationType.ALERT_SCAM:
|
||||||
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.warning.other_not_offering'), null, null, null, LocalizeText('inventory.trading.notification.title'));
|
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.warning.other_not_offering'), null, null, null, LocalizeText('inventory.trading.notification.title'));
|
||||||
return;
|
return;
|
||||||
case TradingNotificationType.ALERT_OTHER_CANCELLED:
|
case TradingNotificationType.HOTEL_TRADING_DISABLED:
|
||||||
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.info.closed'), null, null, null, LocalizeText('inventory.trading.notification.title'));
|
case TradingNotificationType.YOU_NOT_ALLOWED:
|
||||||
return;
|
case TradingNotificationType.THEY_NOT_ALLOWED:
|
||||||
case TradingNotificationType.ALERT_ALREADY_OPEN:
|
case TradingNotificationType.ROOM_DISABLED:
|
||||||
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.info.already_open'), null, null, null, LocalizeText('inventory.trading.notification.title'));
|
case TradingNotificationType.YOU_OPEN:
|
||||||
return;
|
case TradingNotificationType.THEY_OPEN:
|
||||||
case TradingNotificationType.ALERT_OTHER_DISABLED:
|
NotificationUtilities.simpleAlert(LocalizeText(`inventory.trading.openfail.${ type }`, [ 'otherusername' ], [ otherUsername ]), null, null, null, LocalizeText('inventory.trading.openfail.title'));
|
||||||
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.warning.others_account_disabled'), null, null, null, LocalizeText('inventory.trading.notification.title'));
|
|
||||||
return;
|
return;
|
||||||
case TradingNotificationType.ERROR_WHILE_COMMIT:
|
case TradingNotificationType.ERROR_WHILE_COMMIT:
|
||||||
NotificationUtilities.simpleAlert(`${ LocalizeText('inventory.trading.notification.caption') }, ${ LocalizeText('inventory.trading.notification.commiterror.info') }`, null, null, null, LocalizeText('inventory.trading.notification.title'));
|
NotificationUtilities.simpleAlert(`${ LocalizeText('inventory.trading.notification.caption') }, ${ LocalizeText('inventory.trading.notification.commiterror.info') }`, null, null, null, LocalizeText('inventory.trading.notification.title'));
|
||||||
return;
|
return;
|
||||||
case TradingNotificationType.YOU_NOT_ALLOWED:
|
case TradingNotificationType.THEY_CANCELLED:
|
||||||
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.warning.own_account_disabled'), null, null, null, LocalizeText('inventory.trading.notification.title'));
|
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.info.closed'), null, null, null, LocalizeText('inventory.trading.notification.title'));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
12
src/api/inventory/TradingNotificationType.ts
Normal file
12
src/api/inventory/TradingNotificationType.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export class TradingNotificationType
|
||||||
|
{
|
||||||
|
public static ALERT_SCAM: number = 0;
|
||||||
|
public static HOTEL_TRADING_DISABLED = 1;
|
||||||
|
public static YOU_NOT_ALLOWED: number = 2;
|
||||||
|
public static THEY_NOT_ALLOWED: number = 4;
|
||||||
|
public static ROOM_DISABLED: number = 6;
|
||||||
|
public static YOU_OPEN: number = 7;
|
||||||
|
public static THEY_OPEN: number = 8;
|
||||||
|
public static ERROR_WHILE_COMMIT: number = 9;
|
||||||
|
public static THEY_CANCELLED: number = 10;
|
||||||
|
}
|
71
src/api/inventory/TradingUtilities.ts
Normal file
71
src/api/inventory/TradingUtilities.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import { AdvancedMap, IObjectData, ItemDataStructure, StringDataType } from '@nitrots/nitro-renderer';
|
||||||
|
import { GetSessionDataManager } from '../nitro';
|
||||||
|
import { FurniCategory } from './FurniCategory';
|
||||||
|
import { FurnitureItem } from './FurnitureItem';
|
||||||
|
import { createGroupItem } from './FurnitureUtilities';
|
||||||
|
import { GroupItem } from './GroupItem';
|
||||||
|
|
||||||
|
const isExternalImage = (spriteId: number) => GetSessionDataManager().getWallItemData(spriteId)?.isExternalImage || false;
|
||||||
|
|
||||||
|
export const parseTradeItems = (items: ItemDataStructure[]) =>
|
||||||
|
{
|
||||||
|
const existingItems = new AdvancedMap<string, GroupItem>();
|
||||||
|
const totalItems = items.length;
|
||||||
|
|
||||||
|
if(totalItems)
|
||||||
|
{
|
||||||
|
for(const item of items)
|
||||||
|
{
|
||||||
|
const spriteId = item.spriteId;
|
||||||
|
const category = item.category;
|
||||||
|
|
||||||
|
let name = (item.furniType + spriteId);
|
||||||
|
|
||||||
|
if(!item.isGroupable || isExternalImage(spriteId))
|
||||||
|
{
|
||||||
|
name = ('itemid' + item.itemId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(item.category === FurniCategory.POSTER)
|
||||||
|
{
|
||||||
|
name = (item.itemId + 'poster' + item.stuffData.getLegacyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(item.category === FurniCategory.GUILD_FURNI)
|
||||||
|
{
|
||||||
|
name = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
let groupItem = ((item.isGroupable && !isExternalImage(item.spriteId)) ? existingItems.getValue(name) : null);
|
||||||
|
|
||||||
|
if(!groupItem)
|
||||||
|
{
|
||||||
|
groupItem = createGroupItem(spriteId, category, item.stuffData);
|
||||||
|
|
||||||
|
existingItems.add(name, groupItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
groupItem.push(new FurnitureItem(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return existingItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getGuildFurniType = (spriteId: number, stuffData: IObjectData) =>
|
||||||
|
{
|
||||||
|
let type = spriteId.toString();
|
||||||
|
|
||||||
|
if(!(stuffData instanceof StringDataType)) return type;
|
||||||
|
|
||||||
|
let i = 1;
|
||||||
|
|
||||||
|
while(i < 5)
|
||||||
|
{
|
||||||
|
type = (type + (',' + stuffData.getValue(i)));
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
15
src/api/inventory/index.ts
Normal file
15
src/api/inventory/index.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
export * from './FurniCategory';
|
||||||
|
export * from './FurnitureItem';
|
||||||
|
export * from './FurnitureUtilities';
|
||||||
|
export * from './GroupItem';
|
||||||
|
export * from './IBotItem';
|
||||||
|
export * from './IFurnitureItem';
|
||||||
|
export * from './InventoryUtilities';
|
||||||
|
export * from './IPetItem';
|
||||||
|
export * from './PetUtilities';
|
||||||
|
export * from './TradeState';
|
||||||
|
export * from './TradeUserData';
|
||||||
|
export * from './TradingNotificationMessage';
|
||||||
|
export * from './TradingNotificationType';
|
||||||
|
export * from './TradingUtilities';
|
||||||
|
export * from './unseen';
|
@ -3,7 +3,6 @@ export interface IUnseenItemTracker
|
|||||||
dispose(): void;
|
dispose(): void;
|
||||||
resetCategory(category: number): boolean;
|
resetCategory(category: number): boolean;
|
||||||
resetItems(category: number, itemIds: number[]): boolean;
|
resetItems(category: number, itemIds: number[]): boolean;
|
||||||
resetCategoryIfEmpty(category: number): boolean;
|
|
||||||
isUnseen(category: number, itemId: number): boolean;
|
isUnseen(category: number, itemId: number): boolean;
|
||||||
removeUnseen(category: number, itemId: number): boolean;
|
removeUnseen(category: number, itemId: number): boolean;
|
||||||
getIds(category: number): number[];
|
getIds(category: number): number[];
|
9
src/api/inventory/unseen/UnseenItemCategory.ts
Normal file
9
src/api/inventory/unseen/UnseenItemCategory.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export class UnseenItemCategory
|
||||||
|
{
|
||||||
|
public static FURNI: number = 1;
|
||||||
|
public static RENTABLE: number = 2;
|
||||||
|
public static PET: number = 3;
|
||||||
|
public static BADGE: number = 4;
|
||||||
|
public static BOT: number = 5;
|
||||||
|
public static GAMES: number = 6;
|
||||||
|
}
|
2
src/api/inventory/unseen/index.ts
Normal file
2
src/api/inventory/unseen/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './IUnseenItemTracker';
|
||||||
|
export * from './UnseenItemCategory';
|
8
src/api/navigator/IRoomChatSettings.ts
Normal file
8
src/api/navigator/IRoomChatSettings.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export interface IRoomChatSettings
|
||||||
|
{
|
||||||
|
mode: number;
|
||||||
|
weight: number;
|
||||||
|
speed: number;
|
||||||
|
distance: number;
|
||||||
|
protection: number;
|
||||||
|
}
|
23
src/api/navigator/IRoomData.ts
Normal file
23
src/api/navigator/IRoomData.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { IRoomChatSettings } from './IRoomChatSettings';
|
||||||
|
import { IRoomModerationSettings } from './IRoomModerationSettings';
|
||||||
|
|
||||||
|
export interface IRoomData
|
||||||
|
{
|
||||||
|
roomId: number;
|
||||||
|
roomName: string;
|
||||||
|
roomDescription: string;
|
||||||
|
categoryId: number;
|
||||||
|
userCount: number;
|
||||||
|
tags: string[];
|
||||||
|
tradeState: number;
|
||||||
|
allowWalkthrough: boolean;
|
||||||
|
lockState: number;
|
||||||
|
password: string;
|
||||||
|
allowPets: boolean;
|
||||||
|
allowPetsEat: boolean;
|
||||||
|
hideWalls: boolean;
|
||||||
|
wallThickness: number;
|
||||||
|
floorThickness: number;
|
||||||
|
chatSettings: IRoomChatSettings;
|
||||||
|
moderationSettings: IRoomModerationSettings;
|
||||||
|
}
|
6
src/api/navigator/IRoomModel.ts
Normal file
6
src/api/navigator/IRoomModel.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export interface IRoomModel
|
||||||
|
{
|
||||||
|
clubLevel: number;
|
||||||
|
tileSize: number;
|
||||||
|
name: string;
|
||||||
|
}
|
6
src/api/navigator/IRoomModerationSettings.ts
Normal file
6
src/api/navigator/IRoomModerationSettings.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export interface IRoomModerationSettings
|
||||||
|
{
|
||||||
|
allowMute: number;
|
||||||
|
allowKick: number;
|
||||||
|
allowBan: number;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
export class NavigatorSearchResultViewDisplayMode
|
export class NavigatorSearchResultViewDisplayMode
|
||||||
{
|
{
|
||||||
public static readonly LIST: number = 0;
|
public static readonly LIST: number = 0;
|
||||||
public static readonly THUMBNAILS: number = 1;
|
public static readonly THUMBNAILS: number = 1;
|
||||||
public static readonly FORCED_THUMBNAILS: number = 2;
|
public static readonly FORCED_THUMBNAILS: number = 2;
|
||||||
}
|
}
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
import { HabboClubLevelEnum } from '@nitrots/nitro-renderer';
|
|
||||||
|
|
||||||
export interface IRoomModel
|
|
||||||
{
|
|
||||||
clubLevel: number;
|
|
||||||
tileSize: number;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const RoomModels: IRoomModel[] = [
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 104, name: 'a' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 94, name: 'b' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 36, name: 'c' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 84, name: 'd' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 80, name: 'e' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 80, name: 'f' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 416, name: 'i' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 320, name: 'j' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 448, name: 'k' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 352, name: 'l' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 384, name: 'm' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.NO_CLUB, tileSize: 372, name: 'n' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 80, name: 'g' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 74, name: 'h' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 416, name: 'o' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 352, name: 'p' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 304, name: 'q' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 336, name: 'r' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 748, name: 'u' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.CLUB, tileSize: 438, name: 'v' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 540, name: 't' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 512, name: 'w' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 396, name: 'x' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 440, name: 'y' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 456, name: 'z' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 208, name: '0' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 1009, name: '1' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 1044, name: '2' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 183, name: '3' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 254, name: '4' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 1024, name: '5' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 801, name: '6' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 354, name: '7' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 888, name: '8' },
|
|
||||||
{ clubLevel: HabboClubLevelEnum.VIP, tileSize: 926, name: '9' }
|
|
||||||
];
|
|
@ -40,37 +40,37 @@ export class RoomSettingsData
|
|||||||
{
|
{
|
||||||
if(!parser) throw new Error('invalid_parser');
|
if(!parser) throw new Error('invalid_parser');
|
||||||
|
|
||||||
this.roomId = parser.roomId;
|
this.roomId = parser.roomId;
|
||||||
this.roomName = parser.name;
|
this.roomName = parser.name;
|
||||||
this.roomOriginalName = parser.name;
|
this.roomOriginalName = parser.name;
|
||||||
this.roomDescription = parser.description;
|
this.roomDescription = parser.description;
|
||||||
this.categoryId = parser.categoryId;
|
this.categoryId = parser.categoryId;
|
||||||
this.userCount = parser.userCount;
|
this.userCount = parser.userCount;
|
||||||
this.tags = parser.tags;
|
this.tags = parser.tags;
|
||||||
this.tradeState = parser.tradeMode;
|
this.tradeState = parser.tradeMode;
|
||||||
this.allowWalkthrough = parser.allowWalkthrough;
|
this.allowWalkthrough = parser.allowWalkthrough;
|
||||||
|
|
||||||
this.lockState = parser.state;
|
this.lockState = parser.state;
|
||||||
this.originalLockState = parser.state;
|
this.originalLockState = parser.state;
|
||||||
this.password = null;
|
this.password = null;
|
||||||
this.confirmPassword = null;
|
this.confirmPassword = null;
|
||||||
this.allowPets = parser.allowPets;
|
this.allowPets = parser.allowPets;
|
||||||
this.allowPetsEat = parser.allowPetsEat;
|
this.allowPetsEat = parser.allowPetsEat;
|
||||||
|
|
||||||
this.usersWithRights = new Map<number, string>();
|
this.usersWithRights = new Map<number, string>();
|
||||||
|
|
||||||
this.hideWalls = parser.hideWalls;
|
this.hideWalls = parser.hideWalls;
|
||||||
this.wallThickness = parser.thicknessWall;
|
this.wallThickness = parser.thicknessWall;
|
||||||
this.floorThickness = parser.thicknessFloor;
|
this.floorThickness = parser.thicknessFloor;
|
||||||
this.chatBubbleMode = parser.chatSettings.mode;
|
this.chatBubbleMode = parser.chatSettings.mode;
|
||||||
this.chatBubbleWeight = parser.chatSettings.weight;
|
this.chatBubbleWeight = parser.chatSettings.weight;
|
||||||
this.chatBubbleSpeed = parser.chatSettings.speed;
|
this.chatBubbleSpeed = parser.chatSettings.speed;
|
||||||
this.chatFloodProtection = parser.chatSettings.protection;
|
this.chatFloodProtection = parser.chatSettings.protection;
|
||||||
this.chatDistance = parser.chatSettings.distance;
|
this.chatDistance = parser.chatSettings.distance;
|
||||||
|
|
||||||
this.muteState = parser.moderationSettings.allowMute;
|
this.muteState = parser.moderationSettings.allowMute;
|
||||||
this.kickState = parser.moderationSettings.allowKick;
|
this.kickState = parser.moderationSettings.allowKick;
|
||||||
this.banState = parser.moderationSettings.allowBan;
|
this.banState = parser.moderationSettings.allowBan;
|
||||||
this.bannedUsers = [];
|
this.bannedUsers = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
export * from './DoorStateType';
|
export * from './DoorStateType';
|
||||||
export * from './INavigatorData';
|
export * from './INavigatorData';
|
||||||
export * from './INavigatorSearchFilter';
|
export * from './INavigatorSearchFilter';
|
||||||
|
export * from './IRoomChatSettings';
|
||||||
|
export * from './IRoomData';
|
||||||
|
export * from './IRoomModel';
|
||||||
|
export * from './IRoomModerationSettings';
|
||||||
export * from './NavigatorSearchResultViewDisplayMode';
|
export * from './NavigatorSearchResultViewDisplayMode';
|
||||||
export * from './RoomInfoData';
|
export * from './RoomInfoData';
|
||||||
export * from './RoomModels';
|
|
||||||
export * from './RoomSettingsData';
|
export * from './RoomSettingsData';
|
||||||
export * from './RoomSettingsUtils';
|
export * from './RoomSettingsUtils';
|
||||||
export * from './SearchFilterOptions';
|
export * from './SearchFilterOptions';
|
||||||
|
7
src/api/nitro/AddWorkerEventTracker.ts
Normal file
7
src/api/nitro/AddWorkerEventTracker.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { IWorkerEventTracker } from '@nitrots/nitro-renderer';
|
||||||
|
import { GetNitroInstance } from './GetNitroInstance';
|
||||||
|
|
||||||
|
export const AddWorkerEventTracker = (tracker: IWorkerEventTracker) =>
|
||||||
|
{
|
||||||
|
GetNitroInstance().addWorkerEventTracker(tracker);
|
||||||
|
}
|
7
src/api/nitro/RemoveWorkerEventTracker.ts
Normal file
7
src/api/nitro/RemoveWorkerEventTracker.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { IWorkerEventTracker } from '@nitrots/nitro-renderer';
|
||||||
|
import { GetNitroInstance } from './GetNitroInstance';
|
||||||
|
|
||||||
|
export const RemoveWorkerEventTracker = (tracker: IWorkerEventTracker) =>
|
||||||
|
{
|
||||||
|
GetNitroInstance().removeWorkerEventTracker(tracker);
|
||||||
|
}
|
6
src/api/nitro/SendWorkerEvent.ts
Normal file
6
src/api/nitro/SendWorkerEvent.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { GetNitroInstance } from './GetNitroInstance';
|
||||||
|
|
||||||
|
export const SendWorkerEvent = (message: { [index: string]: any }) =>
|
||||||
|
{
|
||||||
|
GetNitroInstance().sendWorkerEvent(message);
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
export * from './AddLinkEventTracker';
|
export * from './AddLinkEventTracker';
|
||||||
|
export * from './AddWorkerEventTracker';
|
||||||
export * from './avatar';
|
export * from './avatar';
|
||||||
export * from './camera';
|
export * from './camera';
|
||||||
export * from './CreateLinkEvent';
|
export * from './CreateLinkEvent';
|
||||||
@ -9,10 +10,12 @@ export * from './GetLocalization';
|
|||||||
export * from './GetNitroInstance';
|
export * from './GetNitroInstance';
|
||||||
export * from './GetTicker';
|
export * from './GetTicker';
|
||||||
export * from './RemoveLinkEventTracker';
|
export * from './RemoveLinkEventTracker';
|
||||||
|
export * from './RemoveWorkerEventTracker';
|
||||||
export * from './room';
|
export * from './room';
|
||||||
export * from './room/widgets';
|
export * from './room/widgets';
|
||||||
export * from './room/widgets/events';
|
export * from './room/widgets/events';
|
||||||
export * from './room/widgets/handlers';
|
export * from './room/widgets/handlers';
|
||||||
export * from './room/widgets/messages';
|
export * from './room/widgets/messages';
|
||||||
export * from './SendMessageComposer';
|
export * from './SendMessageComposer';
|
||||||
|
export * from './SendWorkerEvent';
|
||||||
export * from './session';
|
export * from './session';
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
import { MouseEventType } from '@nitrots/nitro-renderer';
|
import { MouseEventType } from '@nitrots/nitro-renderer';
|
||||||
import { GetRoomEngine } from './GetRoomEngine';
|
import { GetRoomEngine } from './GetRoomEngine';
|
||||||
import { SetActiveRoomId } from './SetActiveRoomId';
|
|
||||||
|
|
||||||
let didMouseMove = false;
|
let didMouseMove = false;
|
||||||
let lastClick = 0;
|
let lastClick = 0;
|
||||||
let clickCount = 0;
|
let clickCount = 0;
|
||||||
|
|
||||||
export function DispatchMouseEvent(roomId: number, canvasId: number, event: MouseEvent)
|
export const DispatchMouseEvent = (event: MouseEvent, canvasId: number = 1) =>
|
||||||
{
|
{
|
||||||
const x = event.clientX;
|
const x = event.clientX;
|
||||||
const y = event.clientY;
|
const y = event.clientY;
|
||||||
@ -28,8 +27,8 @@ export function DispatchMouseEvent(roomId: number, canvasId: number, event: Mous
|
|||||||
{
|
{
|
||||||
if(!didMouseMove) eventType = MouseEventType.DOUBLE_CLICK;
|
if(!didMouseMove) eventType = MouseEventType.DOUBLE_CLICK;
|
||||||
|
|
||||||
clickCount = 0;
|
clickCount = 0;
|
||||||
lastClick = null;
|
lastClick = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +50,6 @@ export function DispatchMouseEvent(roomId: number, canvasId: number, event: Mous
|
|||||||
break;
|
break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetActiveRoomId(roomId);
|
|
||||||
GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, event.altKey, (event.ctrlKey || event.metaKey), event.shiftKey, false);
|
GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, event.altKey, (event.ctrlKey || event.metaKey), event.shiftKey, false);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ let lastClick = 0;
|
|||||||
let clickCount = 0;
|
let clickCount = 0;
|
||||||
let touchTimer: ReturnType<typeof setTimeout> = null;
|
let touchTimer: ReturnType<typeof setTimeout> = null;
|
||||||
|
|
||||||
export function DispatchTouchEvent(roomId: number, canvasId: number, event: TouchEvent, longTouch: boolean = false, altKey: boolean = false, ctrlKey: boolean = false, shiftKey: boolean = false)
|
export const DispatchTouchEvent = (event: TouchEvent, canvasId: number = 1, longTouch: boolean = false, altKey: boolean = false, ctrlKey: boolean = false, shiftKey: boolean = false) =>
|
||||||
{
|
{
|
||||||
let eventType = event.type;
|
let eventType = event.type;
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ export function DispatchTouchEvent(roomId: number, canvasId: number, event: Touc
|
|||||||
{
|
{
|
||||||
eventType = MouseEventType.DOUBLE_CLICK;
|
eventType = MouseEventType.DOUBLE_CLICK;
|
||||||
|
|
||||||
clickCount = 0;
|
clickCount = 0;
|
||||||
lastClick = null;
|
lastClick = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +51,6 @@ export function DispatchTouchEvent(roomId: number, canvasId: number, event: Touc
|
|||||||
y = event.changedTouches[0].clientY;
|
y = event.changedTouches[0].clientY;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetRoomEngine().setActiveRoomId(roomId);
|
|
||||||
|
|
||||||
switch(eventType)
|
switch(eventType)
|
||||||
{
|
{
|
||||||
case MouseEventType.MOUSE_CLICK:
|
case MouseEventType.MOUSE_CLICK:
|
||||||
@ -64,7 +62,7 @@ export function DispatchTouchEvent(roomId: number, canvasId: number, event: Touc
|
|||||||
{
|
{
|
||||||
if(didMouseMove) return;
|
if(didMouseMove) return;
|
||||||
|
|
||||||
DispatchTouchEvent(roomId, canvasId, event, true);
|
DispatchTouchEvent(event, canvasId, true);
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
eventType = MouseEventType.MOUSE_DOWN;
|
eventType = MouseEventType.MOUSE_DOWN;
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
import { NitroRectangle } from '@nitrots/nitro-renderer';
|
|
||||||
import { GetRoomEngine } from './GetRoomEngine';
|
import { GetRoomEngine } from './GetRoomEngine';
|
||||||
|
|
||||||
export function GetRoomObjectBounds(roomId: number, objectId: number, category: number, canvasId = 1): NitroRectangle
|
export const GetRoomObjectBounds = (roomId: number, objectId: number, category: number, canvasId = 1) =>
|
||||||
{
|
{
|
||||||
return GetRoomEngine().getRoomObjectBoundingRectangle(roomId, objectId, category, canvasId);
|
const rectangle = GetRoomEngine().getRoomObjectBoundingRectangle(roomId, objectId, category, canvasId);
|
||||||
|
|
||||||
|
if(!rectangle) return null;
|
||||||
|
|
||||||
|
rectangle.x = Math.round(rectangle.x);
|
||||||
|
rectangle.y = Math.round(rectangle.y);
|
||||||
|
|
||||||
|
return rectangle;
|
||||||
}
|
}
|
||||||
|
13
src/api/nitro/room/GetRoomObjectScreenLocation.ts
Normal file
13
src/api/nitro/room/GetRoomObjectScreenLocation.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { GetRoomEngine } from './GetRoomEngine';
|
||||||
|
|
||||||
|
export const GetRoomObjectScreenLocation = (roomId: number, objectId: number, category: number, canvasId = 1) =>
|
||||||
|
{
|
||||||
|
const point = GetRoomEngine().getRoomObjectScreenLocation(roomId, objectId, category, canvasId);
|
||||||
|
|
||||||
|
if(!point) return null;
|
||||||
|
|
||||||
|
point.x = Math.round(point.x);
|
||||||
|
point.y = Math.round(point.y);
|
||||||
|
|
||||||
|
return point;
|
||||||
|
}
|
@ -1,6 +1,9 @@
|
|||||||
import { GetRoomEngine } from './GetRoomEngine';
|
import { GetRoomEngine } from './GetRoomEngine';
|
||||||
|
|
||||||
export function InitializeRoomInstanceRenderingCanvas(roomId: number, canvasId: number, width: number, height: number): void
|
export const InitializeRoomInstanceRenderingCanvas = (width: number, height: number, canvasId: number = 1) =>
|
||||||
{
|
{
|
||||||
GetRoomEngine().initializeRoomInstanceRenderingCanvas(roomId, canvasId, width, height);
|
const roomEngine = GetRoomEngine();
|
||||||
|
const roomId = roomEngine.activeRoomId;
|
||||||
|
|
||||||
|
roomEngine.initializeRoomInstanceRenderingCanvas(roomId, canvasId, width, height);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ export * from './DispatchTouchEvent';
|
|||||||
export * from './GetOwnRoomObject';
|
export * from './GetOwnRoomObject';
|
||||||
export * from './GetRoomEngine';
|
export * from './GetRoomEngine';
|
||||||
export * from './GetRoomObjectBounds';
|
export * from './GetRoomObjectBounds';
|
||||||
|
export * from './GetRoomObjectScreenLocation';
|
||||||
export * from './InitializeRoomInstanceRenderingCanvas';
|
export * from './InitializeRoomInstanceRenderingCanvas';
|
||||||
export * from './IsFurnitureSelectionDisabled';
|
export * from './IsFurnitureSelectionDisabled';
|
||||||
export * from './ProcessRoomObjectOperation';
|
export * from './ProcessRoomObjectOperation';
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
import { RoomWidgetUpdateEvent } from './RoomWidgetUpdateEvent';
|
|
||||||
|
|
||||||
export class RoomWidgetDoorbellEvent extends RoomWidgetUpdateEvent
|
|
||||||
{
|
|
||||||
public static RINGING: string = 'RWDE_RINGING';
|
|
||||||
public static REJECTED: string = 'RWDE_REJECTED';
|
|
||||||
public static ACCEPTED: string = 'RWDE_ACCEPTED';
|
|
||||||
|
|
||||||
private _userName: string = '';
|
|
||||||
|
|
||||||
constructor(type: string, userName: string)
|
|
||||||
{
|
|
||||||
super(type);
|
|
||||||
|
|
||||||
this._userName = userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get userName(): string
|
|
||||||
{
|
|
||||||
return this._userName;
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,11 +14,11 @@ export class RoomWidgetUpdateDimmerStateEvent extends RoomWidgetUpdateEvent
|
|||||||
{
|
{
|
||||||
super(RoomWidgetUpdateDimmerStateEvent.DIMMER_STATE);
|
super(RoomWidgetUpdateDimmerStateEvent.DIMMER_STATE);
|
||||||
|
|
||||||
this._state = state;
|
this._state = state;
|
||||||
this._presetId = presetId;
|
this._presetId = presetId;
|
||||||
this._effectId = effectId;
|
this._effectId = effectId;
|
||||||
this._color = color;
|
this._color = color;
|
||||||
this._brightness = brightness;
|
this._brightness = brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get state(): number
|
public get state(): number
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
import { RoomWidgetUpdateEvent } from './RoomWidgetUpdateEvent';
|
|
||||||
|
|
||||||
export class RoomWidgetUpdateFriendRequestEvent extends RoomWidgetUpdateEvent
|
|
||||||
{
|
|
||||||
public static SHOW_FRIEND_REQUEST: string = 'RWFRUE_SHOW_FRIEND_REQUEST';
|
|
||||||
public static HIDE_FRIEND_REQUEST: string = 'RWFRUE_HIDE_FRIEND_REQUEST';
|
|
||||||
|
|
||||||
private _requestId: number;
|
|
||||||
private _userId: number;
|
|
||||||
private _userName: string;
|
|
||||||
|
|
||||||
constructor(type: string, requestId: number = -1, userId: number = -1, userName: string = null)
|
|
||||||
{
|
|
||||||
super(type);
|
|
||||||
|
|
||||||
this._requestId = requestId;
|
|
||||||
this._userId = userId;
|
|
||||||
this._userName = userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get requestId(): number
|
|
||||||
{
|
|
||||||
return this._requestId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get userId(): number
|
|
||||||
{
|
|
||||||
return this._userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get userName(): string
|
|
||||||
{
|
|
||||||
return this._userName;
|
|
||||||
}
|
|
||||||
}
|
|
@ -24,12 +24,10 @@ export class RoomWidgetUpdateInfostandUserEvent extends RoomWidgetUpdateInfostan
|
|||||||
public carryItem: number = 0;
|
public carryItem: number = 0;
|
||||||
public roomIndex: number = 0;
|
public roomIndex: number = 0;
|
||||||
public isSpectatorMode: boolean = false;
|
public isSpectatorMode: boolean = false;
|
||||||
public realName: string = '';
|
|
||||||
public allowNameChange: boolean = false;
|
public allowNameChange: boolean = false;
|
||||||
public amIOwner: boolean = false;
|
public amIOwner: boolean = false;
|
||||||
public amIAnyRoomController: boolean = false;
|
public amIAnyRoomController: boolean = false;
|
||||||
public roomControllerLevel: number = 0;
|
public roomControllerLevel: number = 0;
|
||||||
public canBeAskedAsFriend: boolean = false;
|
|
||||||
public canBeKicked: boolean = false;
|
public canBeKicked: boolean = false;
|
||||||
public canBeBanned: boolean = false;
|
public canBeBanned: boolean = false;
|
||||||
public canBeMuted: boolean = false;
|
public canBeMuted: boolean = false;
|
||||||
@ -39,7 +37,6 @@ export class RoomWidgetUpdateInfostandUserEvent extends RoomWidgetUpdateInfostan
|
|||||||
public canTrade: boolean = false;
|
public canTrade: boolean = false;
|
||||||
public canTradeReason: number = 0;
|
public canTradeReason: number = 0;
|
||||||
public targetRoomControllerLevel: number = 0;
|
public targetRoomControllerLevel: number = 0;
|
||||||
public isFriend: boolean = false;
|
|
||||||
public isAmbassador: boolean = false;
|
public isAmbassador: boolean = false;
|
||||||
|
|
||||||
public get isOwnUser(): boolean
|
public get isOwnUser(): boolean
|
||||||
|
@ -2,15 +2,15 @@ import { RoomWidgetUpdateEvent } from './RoomWidgetUpdateEvent';
|
|||||||
|
|
||||||
export class RoomWidgetUpdateRoomObjectEvent extends RoomWidgetUpdateEvent
|
export class RoomWidgetUpdateRoomObjectEvent extends RoomWidgetUpdateEvent
|
||||||
{
|
{
|
||||||
public static OBJECT_SELECTED: string = 'RWUROE_OBJECT_SELECTED';
|
public static OBJECT_SELECTED: string = 'RWUROE_OBJECT_SELECTED';
|
||||||
public static OBJECT_DESELECTED: string = 'RWUROE_OBJECT_DESELECTED';
|
public static OBJECT_DESELECTED: string = 'RWUROE_OBJECT_DESELECTED';
|
||||||
public static USER_REMOVED: string = 'RWUROE_USER_REMOVED';
|
public static USER_REMOVED: string = 'RWUROE_USER_REMOVED';
|
||||||
public static FURNI_REMOVED: string = 'RWUROE_FURNI_REMOVED';
|
public static FURNI_REMOVED: string = 'RWUROE_FURNI_REMOVED';
|
||||||
public static FURNI_ADDED: string = 'RWUROE_FURNI_ADDED';
|
public static FURNI_ADDED: string = 'RWUROE_FURNI_ADDED';
|
||||||
public static USER_ADDED: string = 'RWUROE_USER_ADDED';
|
public static USER_ADDED: string = 'RWUROE_USER_ADDED';
|
||||||
public static OBJECT_ROLL_OVER: string = 'RWUROE_OBJECT_ROLL_OVER';
|
public static OBJECT_ROLL_OVER: string = 'RWUROE_OBJECT_ROLL_OVER';
|
||||||
public static OBJECT_ROLL_OUT: string = 'RWUROE_OBJECT_ROLL_OUT';
|
public static OBJECT_ROLL_OUT: string = 'RWUROE_OBJECT_ROLL_OUT';
|
||||||
public static OBJECT_REQUEST_MANIPULATION: string = 'RWUROE_OBJECT_REQUEST_MANIPULATION';
|
public static OBJECT_REQUEST_MANIPULATION: string = 'RWUROE_OBJECT_REQUEST_MANIPULATION';
|
||||||
|
|
||||||
private _id: number;
|
private _id: number;
|
||||||
private _category: number;
|
private _category: number;
|
||||||
@ -20,9 +20,9 @@ export class RoomWidgetUpdateRoomObjectEvent extends RoomWidgetUpdateEvent
|
|||||||
{
|
{
|
||||||
super(type);
|
super(type);
|
||||||
|
|
||||||
this._id = id;
|
this._id = id;
|
||||||
this._category = category;
|
this._category = category;
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get id(): number
|
public get id(): number
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
import { NitroRectangle } from '@nitrots/nitro-renderer';
|
|
||||||
import { RoomWidgetUpdateEvent } from './RoomWidgetUpdateEvent';
|
|
||||||
|
|
||||||
export class RoomWidgetUpdateRoomViewEvent extends RoomWidgetUpdateEvent
|
|
||||||
{
|
|
||||||
public static SIZE_CHANGED: string = 'RWURVE_SIZE_CHANGED';
|
|
||||||
|
|
||||||
private _roomViewRectangle: NitroRectangle;
|
|
||||||
|
|
||||||
constructor(type: string, view: NitroRectangle)
|
|
||||||
{
|
|
||||||
super(type);
|
|
||||||
|
|
||||||
this._roomViewRectangle = view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get roomViewRectangle(): NitroRectangle
|
|
||||||
{
|
|
||||||
return this._roomViewRectangle;
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,6 @@ export * from './RoomDimmerPreset';
|
|||||||
export * from './RoomObjectItem';
|
export * from './RoomObjectItem';
|
||||||
export * from './RoomWidgetAvatarInfoEvent';
|
export * from './RoomWidgetAvatarInfoEvent';
|
||||||
export * from './RoomWidgetChooserContentEvent';
|
export * from './RoomWidgetChooserContentEvent';
|
||||||
export * from './RoomWidgetDoorbellEvent';
|
|
||||||
export * from './RoomWidgetFloodControlEvent';
|
export * from './RoomWidgetFloodControlEvent';
|
||||||
export * from './RoomWidgetObjectNameEvent';
|
export * from './RoomWidgetObjectNameEvent';
|
||||||
export * from './RoomWidgetPollUpdateEvent';
|
export * from './RoomWidgetPollUpdateEvent';
|
||||||
@ -18,7 +17,6 @@ export * from './RoomWidgetUpdateDimmerEvent';
|
|||||||
export * from './RoomWidgetUpdateDimmerStateEvent';
|
export * from './RoomWidgetUpdateDimmerStateEvent';
|
||||||
export * from './RoomWidgetUpdateEvent';
|
export * from './RoomWidgetUpdateEvent';
|
||||||
export * from './RoomWidgetUpdateExternalImageEvent';
|
export * from './RoomWidgetUpdateExternalImageEvent';
|
||||||
export * from './RoomWidgetUpdateFriendRequestEvent';
|
|
||||||
export * from './RoomWidgetUpdateInfostandEvent';
|
export * from './RoomWidgetUpdateInfostandEvent';
|
||||||
export * from './RoomWidgetUpdateInfostandFurniEvent';
|
export * from './RoomWidgetUpdateInfostandFurniEvent';
|
||||||
export * from './RoomWidgetUpdateInfostandPetEvent';
|
export * from './RoomWidgetUpdateInfostandPetEvent';
|
||||||
@ -29,7 +27,6 @@ export * from './RoomWidgetUpdatePresentDataEvent';
|
|||||||
export * from './RoomWidgetUpdateRentableBotChatEvent';
|
export * from './RoomWidgetUpdateRentableBotChatEvent';
|
||||||
export * from './RoomWidgetUpdateRoomEngineEvent';
|
export * from './RoomWidgetUpdateRoomEngineEvent';
|
||||||
export * from './RoomWidgetUpdateRoomObjectEvent';
|
export * from './RoomWidgetUpdateRoomObjectEvent';
|
||||||
export * from './RoomWidgetUpdateRoomViewEvent';
|
|
||||||
export * from './RoomWidgetUpdateSongEvent';
|
export * from './RoomWidgetUpdateSongEvent';
|
||||||
export * from './RoomWidgetUpdateTrophyEvent';
|
export * from './RoomWidgetUpdateTrophyEvent';
|
||||||
export * from './RoomWidgetUpdateUserDataEvent';
|
export * from './RoomWidgetUpdateUserDataEvent';
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
import { NitroEvent, RoomSessionDoorbellEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer';
|
|
||||||
import { RoomWidgetDoorbellEvent, RoomWidgetUpdateEvent } from '../events';
|
|
||||||
import { RoomWidgetLetUserInMessage, RoomWidgetMessage } from '../messages';
|
|
||||||
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
|
||||||
|
|
||||||
export class DoorbellWidgetHandler extends RoomWidgetHandler
|
|
||||||
{
|
|
||||||
public processEvent(event: NitroEvent): void
|
|
||||||
{
|
|
||||||
const doorbellEvent = (event as RoomSessionDoorbellEvent);
|
|
||||||
|
|
||||||
switch(event.type)
|
|
||||||
{
|
|
||||||
case RoomSessionDoorbellEvent.DOORBELL:
|
|
||||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetDoorbellEvent(RoomWidgetDoorbellEvent.RINGING, doorbellEvent.userName));
|
|
||||||
return;
|
|
||||||
case RoomSessionDoorbellEvent.RSDE_REJECTED:
|
|
||||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetDoorbellEvent(RoomWidgetDoorbellEvent.REJECTED, doorbellEvent.userName));
|
|
||||||
return;
|
|
||||||
case RoomSessionDoorbellEvent.RSDE_ACCEPTED:
|
|
||||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetDoorbellEvent(RoomWidgetDoorbellEvent.ACCEPTED, doorbellEvent.userName));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public processWidgetMessage(message: RoomWidgetMessage): RoomWidgetUpdateEvent
|
|
||||||
{
|
|
||||||
switch(message.type)
|
|
||||||
{
|
|
||||||
case RoomWidgetLetUserInMessage.LET_USER_IN:
|
|
||||||
const letUserInMessage = (message as RoomWidgetLetUserInMessage);
|
|
||||||
|
|
||||||
this.container.roomSession.sendDoorbellApprovalMessage(letUserInMessage.userName, letUserInMessage.canEnter);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get type(): string
|
|
||||||
{
|
|
||||||
return RoomWidgetEnum.DOORBELL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get eventTypes(): string[]
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
RoomSessionDoorbellEvent.DOORBELL,
|
|
||||||
RoomSessionDoorbellEvent.RSDE_REJECTED,
|
|
||||||
RoomSessionDoorbellEvent.RSDE_ACCEPTED
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public get messageTypes(): string[]
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
RoomWidgetLetUserInMessage.LET_USER_IN
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
import { NitroEvent, RoomSessionFriendRequestEvent, RoomWidgetEnum } from '@nitrots/nitro-renderer';
|
|
||||||
import { FriendRequestEvent, FriendsAcceptFriendRequestEvent, FriendsDeclineFriendRequestEvent } from '../../../../../events';
|
|
||||||
import { DispatchUiEvent } from '../../../../../hooks';
|
|
||||||
import { RoomWidgetUpdateEvent, RoomWidgetUpdateFriendRequestEvent } from '../events';
|
|
||||||
import { RoomWidgetFriendRequestMessage, RoomWidgetMessage } from '../messages';
|
|
||||||
import { RoomWidgetHandler } from './RoomWidgetHandler';
|
|
||||||
|
|
||||||
export class FriendRequestHandler extends RoomWidgetHandler
|
|
||||||
{
|
|
||||||
public processEvent(event: NitroEvent): void
|
|
||||||
{
|
|
||||||
const friendRequestEvent = (event as RoomSessionFriendRequestEvent);
|
|
||||||
|
|
||||||
switch(event.type)
|
|
||||||
{
|
|
||||||
case RoomSessionFriendRequestEvent.RSFRE_FRIEND_REQUEST:
|
|
||||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetUpdateFriendRequestEvent(RoomWidgetUpdateFriendRequestEvent.SHOW_FRIEND_REQUEST, friendRequestEvent.requestId, friendRequestEvent.userId, friendRequestEvent.userName));
|
|
||||||
return;
|
|
||||||
case FriendRequestEvent.ACCEPTED:
|
|
||||||
case FriendRequestEvent.DECLINED:
|
|
||||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetUpdateFriendRequestEvent(RoomWidgetUpdateFriendRequestEvent.HIDE_FRIEND_REQUEST, friendRequestEvent.requestId));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public processWidgetMessage(message: RoomWidgetMessage): RoomWidgetUpdateEvent
|
|
||||||
{
|
|
||||||
const friendMessage = (message as RoomWidgetFriendRequestMessage);
|
|
||||||
|
|
||||||
switch(message.type)
|
|
||||||
{
|
|
||||||
case RoomWidgetFriendRequestMessage.ACCEPT:
|
|
||||||
DispatchUiEvent(new FriendsAcceptFriendRequestEvent(friendMessage.requestId));
|
|
||||||
break;
|
|
||||||
case RoomWidgetFriendRequestMessage.DECLINE:
|
|
||||||
DispatchUiEvent(new FriendsDeclineFriendRequestEvent(friendMessage.requestId));
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get type(): string
|
|
||||||
{
|
|
||||||
return RoomWidgetEnum.FRIEND_REQUEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get eventTypes(): string[]
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
RoomSessionFriendRequestEvent.RSFRE_FRIEND_REQUEST,
|
|
||||||
FriendRequestEvent.ACCEPTED,
|
|
||||||
FriendRequestEvent.DECLINED
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public get messageTypes(): string[]
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
RoomWidgetFriendRequestMessage.ACCEPT,
|
|
||||||
RoomWidgetFriendRequestMessage.DECLINE
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
@ -37,40 +37,40 @@ export class FurniChooserWidgetHandler extends RoomWidgetHandler
|
|||||||
const floorItems = GetRoomEngine().getRoomObjects(roomId, RoomObjectCategory.FLOOR);
|
const floorItems = GetRoomEngine().getRoomObjects(roomId, RoomObjectCategory.FLOOR);
|
||||||
|
|
||||||
wallItems.forEach(roomObject =>
|
wallItems.forEach(roomObject =>
|
||||||
|
{
|
||||||
|
let name = roomObject.type;
|
||||||
|
|
||||||
|
if(name.startsWith('poster'))
|
||||||
{
|
{
|
||||||
let name = roomObject.type;
|
name = LocalizeText(`poster_${ name.replace('poster', '') }_name`);
|
||||||
|
}
|
||||||
if(name.startsWith('poster'))
|
else
|
||||||
{
|
|
||||||
name = LocalizeText(`poster_${ name.replace('poster', '') }_name`);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
|
||||||
const furniData = GetSessionDataManager().getWallItemData(typeId);
|
|
||||||
|
|
||||||
if(furniData && furniData.name.length) name = furniData.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.WALL, name));
|
|
||||||
});
|
|
||||||
|
|
||||||
floorItems.forEach(roomObject =>
|
|
||||||
{
|
{
|
||||||
let name = roomObject.type;
|
|
||||||
|
|
||||||
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
||||||
const furniData = GetSessionDataManager().getFloorItemData(typeId);
|
const furniData = GetSessionDataManager().getWallItemData(typeId);
|
||||||
|
|
||||||
if(furniData && furniData.name.length) name = furniData.name;
|
if(furniData && furniData.name.length) name = furniData.name;
|
||||||
|
}
|
||||||
|
|
||||||
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.FLOOR, name));
|
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.WALL, name));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
floorItems.forEach(roomObject =>
|
||||||
|
{
|
||||||
|
let name = roomObject.type;
|
||||||
|
|
||||||
|
const typeId = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_TYPE_ID);
|
||||||
|
const furniData = GetSessionDataManager().getFloorItemData(typeId);
|
||||||
|
|
||||||
|
if(furniData && furniData.name.length) name = furniData.name;
|
||||||
|
|
||||||
|
items.push(new RoomObjectItem(roomObject.id, RoomObjectCategory.FLOOR, name));
|
||||||
|
});
|
||||||
|
|
||||||
items.sort((a, b) =>
|
items.sort((a, b) =>
|
||||||
{
|
{
|
||||||
return (a.name < b.name) ? -1 : 1;
|
return (a.name < b.name) ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items));
|
this.container.eventDispatcher.dispatchEvent(new RoomWidgetChooserContentEvent(RoomWidgetChooserContentEvent.FURNI_CHOOSER_CONTENT, items));
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ export class FurnitureInternalLinkHandler extends RoomWidgetHandler
|
|||||||
|
|
||||||
public get eventTypes(): string[]
|
public get eventTypes(): string[]
|
||||||
{
|
{
|
||||||
return [RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK];
|
return [ RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public get messageTypes(): string[]
|
public get messageTypes(): string[]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { IFurnitureData, IGetImageListener, NitroEvent, NitroRenderTexture, PetFigureData, RoomObjectCategory, RoomObjectVariable, RoomSessionPresentEvent, RoomWidgetEnum, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
|
import { IFurnitureData, IGetImageListener, NitroEvent, NitroRenderTexture, PetFigureData, RoomObjectCategory, RoomObjectVariable, RoomSessionPresentEvent, RoomWidgetEnum, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
|
||||||
import { GetSessionDataManager, IsOwnerOfFurniture } from '../../..';
|
import { GetSessionDataManager, IsOwnerOfFurniture } from '../../..';
|
||||||
import { GetRoomEngine, LocalizeText } from '../../../..';
|
import { GetRoomEngine, LocalizeText } from '../../../..';
|
||||||
import { ProductTypeEnum } from '../../../../../components/catalog/common/ProductTypeEnum';
|
import { ProductTypeEnum } from '../../../../catalog';
|
||||||
import { RoomWidgetUpdateEvent, RoomWidgetUpdatePresentDataEvent } from '../events';
|
import { RoomWidgetUpdateEvent, RoomWidgetUpdatePresentDataEvent } from '../events';
|
||||||
import { RoomWidgetFurniToWidgetMessage, RoomWidgetPresentOpenMessage } from '../messages';
|
import { RoomWidgetFurniToWidgetMessage, RoomWidgetPresentOpenMessage } from '../messages';
|
||||||
import { RoomWidgetMessage } from '../messages/RoomWidgetMessage';
|
import { RoomWidgetMessage } from '../messages/RoomWidgetMessage';
|
||||||
@ -9,10 +9,10 @@ import { RoomWidgetHandler } from './RoomWidgetHandler';
|
|||||||
|
|
||||||
export class FurniturePresentWidgetHandler extends RoomWidgetHandler implements IGetImageListener
|
export class FurniturePresentWidgetHandler extends RoomWidgetHandler implements IGetImageListener
|
||||||
{
|
{
|
||||||
private static FLOOR: string = 'floor';
|
private static FLOOR: string = 'floor';
|
||||||
private static WALLPAPER: string = 'wallpaper';
|
private static WALLPAPER: string = 'wallpaper';
|
||||||
private static LANDSCAPE: string = 'landscape';
|
private static LANDSCAPE: string = 'landscape';
|
||||||
private static POSTER: string = 'poster';
|
private static POSTER: string = 'poster';
|
||||||
|
|
||||||
private _lastFurniId: number = -1;
|
private _lastFurniId: number = -1;
|
||||||
private _name: string = null;
|
private _name: string = null;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user