Merge branch 'dev' into navigator-packets

This commit is contained in:
dank074 2022-06-17 20:59:36 -05:00
commit 9d94443a95
553 changed files with 10688 additions and 12020 deletions

View File

@ -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
View 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" ]
}
}

View File

@ -1 +0,0 @@
*.scss

View File

@ -14,5 +14,7 @@
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"editor.wordWrap": "on",
"emmet.showExpandedAbbreviation": "never"
"emmet.showExpandedAbbreviation": "never",
"eslint.validate": [ "javascript", "javascriptreact", "html", "typescriptreact" ],
"eslint.workingDirectories": [ "./src" ]
}

View File

@ -3,28 +3,30 @@
"version": "2.0.0",
"private": true,
"scripts": {
"start": "cross-env BROWSER=none IMAGE_INLINE_SIZE_LIMIT=100000 craco start",
"build": "cross-env GENERATE_SOURCEMAP=false IMAGE_INLINE_SIZE_LIMIT=100000 craco build",
"start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none IMAGE_INLINE_SIZE_LIMIT=100000 craco start",
"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",
"test": "craco test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"eslint": "eslint src --ext .ts,.tsx"
},
"dependencies": {
"@craco/craco": "^6.3.0",
"@fortawesome/fontawesome-svg-core": "^6.1.0",
"@fortawesome/free-solid-svg-icons": "^6.1.0",
"@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",
"classnames": "^2.3.1",
"cross-env": "^7.0.3",
"emoji-toolkit": "^6.6.0",
"node-sass": "^6.0.1",
"react": "^17.0.2",
"react-bootstrap": "^2.0.0-alpha.2",
"react-dom": "^17.0.2",
"react": "^18.0.0",
"react-bootstrap": "^2.2.2",
"react-dom": "^18.0.0",
"react-scripts": "4.0.3",
"react-slider": "^1.3.1",
"react-slider": "^2.0.0",
"react-transition-group": "^4.4.2",
"react-virtualized": "^9.22.3",
"react-youtube": "^7.13.1",
@ -32,16 +34,23 @@
"use-between": "^1.3.1"
},
"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": {
"@types/node": "^12.20.19",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.9",
"@types/react": "^18.0.8",
"@types/react-dom": "^18.0.3",
"@types/react-slider": "^1.3.1",
"@types/react-transition-group": "^4.4.2",
"@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"
}
}

View File

@ -1,8 +1,8 @@
{
"image.library.notifications.url": "${image.library.url}notifications/%image%.png",
"achievements.images.url": "${image.library.url}Quests/%image%.png",
"camera.url": "https://camera.com",
"thumbnails.url": "https://camera.com/thumbnail/%thumbnail%.png",
"camera.url": "https://camera.url",
"thumbnails.url": "https://camera.url/thumbnail/%thumbnail%.png",
"url.prefix": "https://website.com",
"habbopages.url": "${url.prefix}/",
"group.homepage.url": "${url.prefix}/groups/%groupid%/id",
@ -16,6 +16,43 @@
"badge.descriptions.enabled": true,
"motto.max.length": 38,
"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": {
"show.avatar": true,
"widgets": {

View File

@ -52,7 +52,7 @@ $friends-list-width: 250px;
$friends-list-height: 300px;
$help-width: 450px;
$help-height: 250px;
$help-height: 290px;
$nitropedia-width: 400px;
$nitropedia-height: 400px;

View File

@ -1,10 +1,12 @@
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 { Base, TransitionAnimation, TransitionAnimationTypes } from './common';
import { LoadingView } from './components/loading/LoadingView';
import { MainView } from './components/main/MainView';
import { DispatchUiEvent, UseConfigurationEvent, UseLocalizationEvent, UseMainEvent, UseRoomEngineEvent } from './hooks';
import IntervalWebWorker from './workers/IntervalWebWorker';
import { WorkerBuilder } from './workers/WorkerBuilder';
NitroVersion.UI_VERSION = GetUIVersion();
@ -12,28 +14,21 @@ export const App: FC<{}> = props =>
{
const [ isReady, setIsReady ] = useState(false);
const [ isError, setIsError ] = useState(false);
const [message, setMessage] = useState('Getting Ready');
const [percent, setPercent] = useState(0);
const [ message, setMessage ] = useState('Getting Ready');
const [ percent, setPercent ] = useState(0);
const [ imageRendering, setImageRendering ] = useState<boolean>(true);
//@ts-ignore
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
if(!GetNitroInstance()) Nitro.bootstrap();
const getPreloadAssetUrls = useCallback(() =>
if(!GetNitroInstance())
{
const urls: string[] = [];
const assetUrls = GetConfiguration<string[]>('preload.assets.urls');
//@ts-ignore
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
if(assetUrls && assetUrls.length)
{
for(const url of assetUrls) urls.push(GetNitroInstance().core.configuration.interpolate(url));
}
Nitro.bootstrap();
return urls;
}, []);
const worker = new WorkerBuilder(IntervalWebWorker);
const loadPercent = useCallback(() => setPercent(prevValue => (prevValue + 20)), []);
Nitro.instance.setWorker(worker);
}
const handler = useCallback((event: NitroEvent) =>
{
@ -41,7 +36,7 @@ export const App: FC<{}> = props =>
{
case ConfigurationEvent.LOADED:
GetNitroInstance().localization.init();
loadPercent();
setPercent(prevValue => (prevValue + 20));
return;
case ConfigurationEvent.FAILED:
setIsError(true);
@ -58,44 +53,48 @@ export const App: FC<{}> = props =>
setTimeout(() => window.location.reload(), 1500);
return;
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
loadPercent();
return;
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
setPercent(prevValue => (prevValue + 20));
return;
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
setIsError(true);
setMessage('Handshake Failed');
return;
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
loadPercent();
return;
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
setPercent(prevValue => (prevValue + 20));
GetNitroInstance().init();
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
return;
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
return;
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
setIsError(true);
setMessage('Connection Error');
return;
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
return;
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
//if(GetNitroInstance().roomEngine) GetNitroInstance().roomEngine.dispose();
//setIsError(true);
setMessage('Connection Error');
HabboWebTools.send(-1, 'client.init.handshake.fail');
return;
case RoomEngineEvent.ENGINE_INITIALIZED:
loadPercent();
setPercent(prevValue => (prevValue + 20));
setTimeout(() => setIsReady(true), 300);
return;
case NitroLocalizationEvent.LOADED:
GetNitroInstance().core.asset.downloadAssets(getPreloadAssetUrls(), (status: boolean) =>
case NitroLocalizationEvent.LOADED: {
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)
{
GetCommunication().init();
loadPercent();
setPercent(prevValue => (prevValue + 20))
}
else
{
@ -104,8 +103,9 @@ export const App: FC<{}> = props =>
}
});
return;
}
}
}, [ getPreloadAssetUrls,loadPercent ]);
}, []);
UseMainEvent(Nitro.WEBGL_UNAVAILABLE, handler);
UseMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler);
@ -119,19 +119,33 @@ export const App: FC<{}> = props =>
UseConfigurationEvent(ConfigurationEvent.LOADED, handler);
UseConfigurationEvent(ConfigurationEvent.FAILED, handler);
if(!WebGL.isWebGLAvailable())
useEffect(() =>
{
DispatchUiEvent(new NitroEvent(Nitro.WEBGL_UNAVAILABLE));
}
else
{
GetNitroInstance().core.configuration.init();
}
if(!WebGL.isWebGLAvailable())
{
DispatchUiEvent(new NitroEvent(Nitro.WEBGL_UNAVAILABLE));
}
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 (
<Base fit overflow="hidden">
<Base fit overflow="hidden" className={ imageRendering && 'image-rendering-pixelated' }>
{ (!isReady || isError) &&
<LoadingView isError={isError} message={message} percent={ percent } /> }
<LoadingView isError={ isError } message={ message } percent={ percent } /> }
<TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ (isReady) }>
<MainView />
</TransitionAnimation>

View File

@ -6,7 +6,7 @@ export const GetAchievementCategoryTotalUnseen = (category: IAchievementCategory
let unseen = 0;
for(const achievement of category.achievements) unseen += achievement.unseen;
for(const achievement of category.achievements) ((achievement.unseen > 0) && unseen++);
return unseen;
}

View 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;
}

View File

@ -5,5 +5,6 @@ export class CatalogPetPalette
constructor(
public readonly breed: string,
public readonly palettes: SellablePetPaletteData[]
) {}
)
{}
}

View File

@ -1,5 +1,5 @@
import { SellablePetPaletteData } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../../../api';
import { GetRoomEngine } from '../nitro';
import { ICatalogNode } from './ICatalogNode';
export const GetPixelEffectIcon = (id: number) =>
@ -85,21 +85,21 @@ export function GetPetAvailableColors(petIndex: number, palettes: SellablePetPal
switch(petIndex)
{
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:
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:
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:
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD]];
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
case 4:
return [[0xFFFFFF], [16053490], [15464440], [16248792], [15396319], [15007487]];
return [ [ 0xFFFFFF ], [ 16053490 ], [ 15464440 ], [ 16248792 ], [ 15396319 ], [ 15007487 ] ];
case 5:
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD]];
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ] ];
case 6:
return [[0xFFFFFF], [0xEEEEEE], [0xDDDDDD], [16767177], [16770205], [16751331]];
return [ [ 0xFFFFFF ], [ 0xEEEEEE ], [ 0xDDDDDD ], [ 16767177 ], [ 16770205 ], [ 16751331 ] ];
case 7:
return [[0xCCCCCC], [0xAEAEAE], [16751331], [10149119], [16763290], [16743786]];
return [ [ 0xCCCCCC ], [ 0xAEAEAE ], [ 16751331 ], [ 10149119 ], [ 16763290 ], [ 16743786 ] ];
default: {
const colors: number[][] = [];

View File

@ -1,5 +1,5 @@
import { GetProductOfferComposer, IFurnitureData } from '@nitrots/nitro-renderer';
import { GetProductDataForLocalization, SendMessageComposer } from '../../../api';
import { GetProductDataForLocalization, SendMessageComposer } from '..';
import { ICatalogPage } from './ICatalogPage';
import { IProduct } from './IProduct';
import { IPurchasableOffer } from './IPurchasableOffer';

View File

@ -1,7 +1,6 @@
import { ClubGiftInfoParser, ClubOfferData, HabboGroupEntryData, MarketplaceConfigurationMessageParser } from '@nitrots/nitro-renderer';
import { CatalogPetPalette } from './CatalogPetPalette';
import { GiftWrappingConfiguration } from './GiftWrappingConfiguration';
import { SubscriptionInfo } from './SubscriptionInfo';
export interface ICatalogOptions
{
@ -9,7 +8,6 @@ export interface ICatalogOptions
petPalettes?: CatalogPetPalette[];
clubOffers?: ClubOfferData[];
clubGifts?: ClubGiftInfoParser;
subscriptionInfo?: SubscriptionInfo;
giftConfiguration?: GiftWrappingConfiguration;
marketplaceConfiguration?: MarketplaceConfigurationMessageParser;
}

View File

@ -1,9 +1,8 @@
import { GetFurnitureData, GetProductDataForLocalization, LocalizeText } from '../../../api';
import { GetFurnitureData, GetProductDataForLocalization, LocalizeText, ProductTypeEnum } from '..';
import { ICatalogPage } from './ICatalogPage';
import { IProduct } from './IProduct';
import { IPurchasableOffer } from './IPurchasableOffer';
import { Product } from './Product';
import { ProductTypeEnum } from './ProductTypeEnum';
export class Offer implements IPurchasableOffer
{

View File

@ -1,4 +1,4 @@
import { GetConfiguration } from '../../../api';
import { GetConfiguration } from '../nitro';
import { IPageLocalization } from './IPageLocalization';
export class PageLocalization implements IPageLocalization

View 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;
}
}

View File

@ -1,5 +1,5 @@
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 { IProduct } from './IProduct';
import { IPurchasableOffer } from './IPurchasableOffer';

View 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';
}

View File

@ -6,6 +6,6 @@ export class SearchResult
constructor(
public readonly searchValue: string,
public readonly offers: IPurchasableOffer[],
public readonly filteredNodes: ICatalogNode[]
) {}
public readonly filteredNodes: ICatalogNode[])
{}
}

24
src/api/catalog/index.ts Normal file
View 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';

View File

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

View 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);
}

View File

@ -0,0 +1,6 @@
export interface IGroupChatData
{
username: string;
figure: string;
userId: number;
}

View File

@ -2,7 +2,7 @@ import { FriendParser } from '@nitrots/nitro-renderer';
export class MessengerFriend
{
public static RELATIONSHIP_NONE: number = 0;
public static RELATIONSHIP_NONE: number = 0;
public static RELATIONSHIP_HEART: number = 1;
public static RELATIONSHIP_SMILE: number = 2;
public static RELATIONSHIP_BOBBA: number = 3;

View File

@ -0,0 +1,6 @@
export class MessengerIconState
{
public static HIDDEN: number = 0;
public static SHOW: number = 1;
public static UNREAD: number = 2;
}

View File

@ -11,10 +11,10 @@ export class MessengerRequest
{
if(!data) return false;
this._id = data.requestId;
this._name = data.requesterName;
this._figureString = data.figureString;
this._requesterUserId = data.requesterUserId;
this._id = data.requestId;
this._name = data.requesterName;
this._figureString = data.figureString;
this._requesterUserId = data.requesterUserId;
return true;
}

View File

@ -6,5 +6,6 @@ export class MessengerSettings
public userFriendLimit: number = 0,
public normalFriendLimit: number = 0,
public extendedFriendLimit: number = 0,
public categories: FriendCategoryData[] = []) {}
public categories: FriendCategoryData[] = [])
{}
}

View File

@ -1,14 +1,16 @@
import { LocalizeText } from '../../../api';
import { LocalizeText } from '../utils';
import { GetGroupChatData } from './GetGroupChatData';
import { GroupType } from './GroupType';
import { MessengerFriend } from './MessengerFriend';
import { MessengerThreadChat } from './MessengerThreadChat';
import { MessengerThreadChatGroup } from './MessengerThreadChatGroup';
import { getGroupChatData } from './Utils';
export class MessengerThread
{
public static MESSAGE_RECEIVED: string = 'MT_MESSAGE_RECEIVED';
public static THREAD_ID: number = 0;
private _threadId: number;
private _participant: MessengerFriend;
private _groups: MessengerThreadChatGroup[];
private _lastUpdated: Date;
@ -16,6 +18,7 @@ export class MessengerThread
constructor(participant: MessengerFriend, isNew: boolean = true)
{
this._threadId = ++MessengerThread.THREAD_ID;
this._participant = participant;
this._groups = [];
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
{
const isGroupChat = (senderId < 0 && extraData);
const userId = isGroupChat ? getGroupChatData(extraData).userId : senderId;
const userId = isGroupChat ? GetGroupChatData(extraData).userId : senderId;
const group = this.getLastGroup(userId);
@ -45,6 +48,7 @@ export class MessengerThread
group.addChat(chat);
this._lastUpdated = new Date();
this._unreadCount++;
return chat;
@ -68,6 +72,11 @@ export class MessengerThread
this._unreadCount = 0;
}
public get threadId(): number
{
return this._threadId;
}
public get participant(): MessengerFriend
{
return this._participant;
@ -90,6 +99,6 @@ export class MessengerThread
public get unread(): boolean
{
return this._unreadCount > 0;
return (this._unreadCount > 0);
}
}

View File

@ -2,6 +2,6 @@ import { CreateLinkEvent } from '..';
export function OpenMessengerChat(friendId: number = 0): void
{
if(friendId === 0) CreateLinkEvent('friends/messenger/open');
else CreateLinkEvent(`friends/messenger/${friendId}`);
if(friendId === 0) CreateLinkEvent('friends-messenger/open');
else CreateLinkEvent(`friends-messenger/${ friendId }`);
}

View File

@ -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';

View File

@ -2,5 +2,5 @@ import { CreateLinkEvent } from '..';
export function GetGroupManager(groupId: number): void
{
CreateLinkEvent(`groups/manage/${groupId}`);
CreateLinkEvent(`groups/manage/${ groupId }`);
}

View 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);
}

View File

@ -0,0 +1,2 @@
export * from './ClubStatus';
export * from './GetClubBadge';

View File

@ -1,11 +1,14 @@
export * from './achievements';
export * from './campaign';
export * from './common';
export * from './catalog';
export * from './core';
export * from './friends';
export * from './GetRendererVersion';
export * from './GetUIVersion';
export * from './groups';
export * from './hc-center';
export * from './inventory';
export * from './inventory/unseen';
export * from './navigator';
export * from './nitro';
export * from './nitro/avatar';
@ -17,6 +20,7 @@ export * from './nitro/room/widgets/handlers';
export * from './nitro/room/widgets/messages';
export * from './nitro/session';
export * from './notification';
export * from './purse';
export * from './user';
export * from './utils';
export * from './wired';

View File

@ -1,6 +1,6 @@
import { IFurnitureItemData, IObjectData } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from '../../../api';
import { IFurnitureItem } from './IFurnitureItem';
import { IFurnitureItem } from '.';
import { GetNitroInstance } from '..';
export class FurnitureItem implements IFurnitureItem
{
@ -31,28 +31,28 @@ export class FurnitureItem implements IFurnitureItem
{
if(!parser) return;
this._locked = false;
this._id = parser.itemId;
this._type = parser.spriteId;
this._ref = parser.ref;
this._category = parser.category;
this._groupable = ((parser.isGroupable) && (!(parser.rentable)));
this._tradeable = parser.tradable;
this._recyclable = parser.isRecycleable;
this._sellable = parser.sellable;
this._stuffData = parser.stuffData;
this._extra = parser.extra;
this._secondsToExpiration = parser.secondsToExpiration;
this._expirationTimeStamp = parser.expirationTimeStamp;
this._hasRentPeriodStarted = parser.hasRentPeriodStarted;
this._creationDay = parser.creationDay;
this._creationMonth = parser.creationMonth;
this._creationYear = parser.creationYear;
this._slotId = parser.slotId;
this._songId = parser.songId;
this._flatId = parser.flatId;
this._isRented = parser.rentable;
this._isWallItem = parser.isWallItem;
this._locked = false;
this._id = parser.itemId;
this._type = parser.spriteId;
this._ref = parser.ref;
this._category = parser.category;
this._groupable = ((parser.isGroupable) && (!(parser.rentable)));
this._tradeable = parser.tradable;
this._recyclable = parser.isRecycleable;
this._sellable = parser.sellable;
this._stuffData = parser.stuffData;
this._extra = parser.extra;
this._secondsToExpiration = parser.secondsToExpiration;
this._expirationTimeStamp = parser.expirationTimeStamp;
this._hasRentPeriodStarted = parser.hasRentPeriodStarted;
this._creationDay = parser.creationDay;
this._creationMonth = parser.creationMonth;
this._creationYear = parser.creationYear;
this._slotId = parser.slotId;
this._songId = parser.songId;
this._flatId = parser.flatId;
this._isRented = parser.rentable;
this._isWallItem = parser.isWallItem;
}
public get rentable(): boolean
@ -95,7 +95,7 @@ export class FurnitureItem implements IFurnitureItem
return this._extra;
}
public get _Str_16260(): boolean
public get recyclable(): boolean
{
return this._recyclable;
}
@ -135,17 +135,17 @@ export class FurnitureItem implements IFurnitureItem
return time;
}
public get _Str_8932(): number
public get creationDay(): number
{
return this._creationDay;
}
public get _Str_9050(): number
public get creationMonth(): number
{
return this._creationMonth;
}
public get _Str_9408(): number
public get creationYear(): number
{
return this._creationYear;
}
@ -155,7 +155,7 @@ export class FurnitureItem implements IFurnitureItem
return this._slotId;
}
public get _Str_3951(): number
public get songId(): number
{
return this._songId;
}
@ -185,7 +185,7 @@ export class FurnitureItem implements IFurnitureItem
return this._hasRentPeriodStarted;
}
public get _Str_10616(): number
public get expirationTimeStamp(): number
{
return this._expirationTimeStamp;
}

View 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;
}

View File

@ -1,5 +1,5 @@
import { IObjectData, IRoomEngine } from '@nitrots/nitro-renderer';
import { LocalizeText } from '../../../api';
import { LocalizeText } from '..';
import { FurniCategory } from './FurniCategory';
import { FurnitureItem } from './FurnitureItem';
import { IFurnitureItem } from './IFurnitureItem';
@ -95,8 +95,8 @@ export class GroupItem
if(!furnitureItem) return items;
let found = 0;
let i = 0;
let found = 0;
let i = 0;
while(i < this._items.length)
{
@ -201,8 +201,8 @@ export class GroupItem
{
if(this._category === FurniCategory.POST_IT)
{
let count = 0;
let index = 0;
let count = 0;
let index = 0;
while(index < this._items.length)
{
@ -281,8 +281,8 @@ export class GroupItem
while(index < items.length)
{
const item = items[index];
const locked = (itemIds.indexOf(item.ref) >= 0);
const item = items[index];
const locked = (itemIds.indexOf(item.ref) >= 0);
if(item.locked !== locked)
{

View File

@ -0,0 +1,6 @@
import { BotData } from '@nitrots/nitro-renderer';
export interface IBotItem
{
botData: BotData;
}

View File

@ -8,7 +8,7 @@ export interface IFurnitureItem
stuffData: IObjectData;
extra: number;
category: number;
_Str_16260: boolean;
recyclable: boolean;
isTradable: boolean;
isGroupable: boolean;
sellable: boolean;

View File

@ -0,0 +1,6 @@
import { PetData } from '@nitrots/nitro-renderer';
export interface IPetItem
{
petData: PetData;
}

View 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;
}

View 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;
}

View 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;
}

View File

@ -6,10 +6,10 @@ export class TradeUserData
constructor(
public userId: number = -1,
public userName: string = '',
public userItems: AdvancedMap<string, GroupItem> = null,
public userItems: AdvancedMap<string, GroupItem> = new AdvancedMap(),
public itemCount: number = 0,
public creditsCount: number = 0,
public accepts: boolean = false,
public canTrade: boolean = false,
public items: AdvancedMap<string, GroupItem> = new AdvancedMap()) {}
public canTrade: boolean = false)
{}
}

View File

@ -1,28 +1,26 @@
import { LocalizeText, NotificationUtilities } from '../../../api';
import { LocalizeText, NotificationUtilities } from '..';
import { TradingNotificationType } from './TradingNotificationType';
export const TradingNotificationMessage = (type: number) =>
export const TradingNotificationMessage = (type: number, otherUsername: string = '') =>
{
switch(type)
{
case TradingNotificationType.ALERT_SCAM:
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.warning.other_not_offering'), null, null, null, LocalizeText('inventory.trading.notification.title'));
return;
case TradingNotificationType.ALERT_OTHER_CANCELLED:
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.info.closed'), null, null, null, LocalizeText('inventory.trading.notification.title'));
return;
case TradingNotificationType.ALERT_ALREADY_OPEN:
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.info.already_open'), null, null, null, LocalizeText('inventory.trading.notification.title'));
return;
case TradingNotificationType.ALERT_OTHER_DISABLED:
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.warning.others_account_disabled'), null, null, null, LocalizeText('inventory.trading.notification.title'));
case TradingNotificationType.HOTEL_TRADING_DISABLED:
case TradingNotificationType.YOU_NOT_ALLOWED:
case TradingNotificationType.THEY_NOT_ALLOWED:
case TradingNotificationType.ROOM_DISABLED:
case TradingNotificationType.YOU_OPEN:
case TradingNotificationType.THEY_OPEN:
NotificationUtilities.simpleAlert(LocalizeText(`inventory.trading.openfail.${ type }`, [ 'otherusername' ], [ otherUsername ]), null, null, null, LocalizeText('inventory.trading.openfail.title'));
return;
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'));
return;
case TradingNotificationType.YOU_NOT_ALLOWED:
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.warning.own_account_disabled'), null, null, null, LocalizeText('inventory.trading.notification.title'));
case TradingNotificationType.THEY_CANCELLED:
NotificationUtilities.simpleAlert(LocalizeText('inventory.trading.info.closed'), null, null, null, LocalizeText('inventory.trading.notification.title'));
return;
}
}

View 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;
}

View 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;
}

View 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';

View File

@ -3,7 +3,6 @@ export interface IUnseenItemTracker
dispose(): void;
resetCategory(category: number): boolean;
resetItems(category: number, itemIds: number[]): boolean;
resetCategoryIfEmpty(category: number): boolean;
isUnseen(category: number, itemId: number): boolean;
removeUnseen(category: number, itemId: number): boolean;
getIds(category: number): number[];

View 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;
}

View File

@ -0,0 +1,2 @@
export * from './IUnseenItemTracker';
export * from './UnseenItemCategory';

View File

@ -0,0 +1,8 @@
export interface IRoomChatSettings
{
mode: number;
weight: number;
speed: number;
distance: number;
protection: number;
}

View 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;
}

View File

@ -0,0 +1,6 @@
export interface IRoomModel
{
clubLevel: number;
tileSize: number;
name: string;
}

View File

@ -0,0 +1,6 @@
export interface IRoomModerationSettings
{
allowMute: number;
allowKick: number;
allowBan: number;
}

View File

@ -1,6 +1,6 @@
export class NavigatorSearchResultViewDisplayMode
{
public static readonly LIST: number = 0;
public static readonly THUMBNAILS: number = 1;
public static readonly FORCED_THUMBNAILS: number = 2;
public static readonly LIST: number = 0;
public static readonly THUMBNAILS: number = 1;
public static readonly FORCED_THUMBNAILS: number = 2;
}

View File

@ -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' }
];

View File

@ -40,37 +40,37 @@ export class RoomSettingsData
{
if(!parser) throw new Error('invalid_parser');
this.roomId = parser.roomId;
this.roomName = parser.name;
this.roomOriginalName = parser.name;
this.roomDescription = parser.description;
this.categoryId = parser.categoryId;
this.userCount = parser.userCount;
this.tags = parser.tags;
this.tradeState = parser.tradeMode;
this.allowWalkthrough = parser.allowWalkthrough;
this.roomId = parser.roomId;
this.roomName = parser.name;
this.roomOriginalName = parser.name;
this.roomDescription = parser.description;
this.categoryId = parser.categoryId;
this.userCount = parser.userCount;
this.tags = parser.tags;
this.tradeState = parser.tradeMode;
this.allowWalkthrough = parser.allowWalkthrough;
this.lockState = parser.state;
this.originalLockState = parser.state;
this.password = null;
this.confirmPassword = null;
this.allowPets = parser.allowPets;
this.allowPetsEat = parser.allowPetsEat;
this.lockState = parser.state;
this.originalLockState = parser.state;
this.password = null;
this.confirmPassword = null;
this.allowPets = parser.allowPets;
this.allowPetsEat = parser.allowPetsEat;
this.usersWithRights = new Map<number, string>();
this.usersWithRights = new Map<number, string>();
this.hideWalls = parser.hideWalls;
this.wallThickness = parser.thicknessWall;
this.floorThickness = parser.thicknessFloor;
this.chatBubbleMode = parser.chatSettings.mode;
this.chatBubbleWeight = parser.chatSettings.weight;
this.chatBubbleSpeed = parser.chatSettings.speed;
this.chatFloodProtection = parser.chatSettings.protection;
this.chatDistance = parser.chatSettings.distance;
this.hideWalls = parser.hideWalls;
this.wallThickness = parser.thicknessWall;
this.floorThickness = parser.thicknessFloor;
this.chatBubbleMode = parser.chatSettings.mode;
this.chatBubbleWeight = parser.chatSettings.weight;
this.chatBubbleSpeed = parser.chatSettings.speed;
this.chatFloodProtection = parser.chatSettings.protection;
this.chatDistance = parser.chatSettings.distance;
this.muteState = parser.moderationSettings.allowMute;
this.kickState = parser.moderationSettings.allowKick;
this.banState = parser.moderationSettings.allowBan;
this.bannedUsers = [];
this.muteState = parser.moderationSettings.allowMute;
this.kickState = parser.moderationSettings.allowKick;
this.banState = parser.moderationSettings.allowBan;
this.bannedUsers = [];
}
}

View File

@ -1,9 +1,12 @@
export * from './DoorStateType';
export * from './INavigatorData';
export * from './INavigatorSearchFilter';
export * from './IRoomChatSettings';
export * from './IRoomData';
export * from './IRoomModel';
export * from './IRoomModerationSettings';
export * from './NavigatorSearchResultViewDisplayMode';
export * from './RoomInfoData';
export * from './RoomModels';
export * from './RoomSettingsData';
export * from './RoomSettingsUtils';
export * from './SearchFilterOptions';

View File

@ -0,0 +1,7 @@
import { IWorkerEventTracker } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export const AddWorkerEventTracker = (tracker: IWorkerEventTracker) =>
{
GetNitroInstance().addWorkerEventTracker(tracker);
}

View File

@ -0,0 +1,7 @@
import { IWorkerEventTracker } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export const RemoveWorkerEventTracker = (tracker: IWorkerEventTracker) =>
{
GetNitroInstance().removeWorkerEventTracker(tracker);
}

View File

@ -0,0 +1,6 @@
import { GetNitroInstance } from './GetNitroInstance';
export const SendWorkerEvent = (message: { [index: string]: any }) =>
{
GetNitroInstance().sendWorkerEvent(message);
}

View File

@ -1,4 +1,5 @@
export * from './AddLinkEventTracker';
export * from './AddWorkerEventTracker';
export * from './avatar';
export * from './camera';
export * from './CreateLinkEvent';
@ -9,10 +10,12 @@ export * from './GetLocalization';
export * from './GetNitroInstance';
export * from './GetTicker';
export * from './RemoveLinkEventTracker';
export * from './RemoveWorkerEventTracker';
export * from './room';
export * from './room/widgets';
export * from './room/widgets/events';
export * from './room/widgets/handlers';
export * from './room/widgets/messages';
export * from './SendMessageComposer';
export * from './SendWorkerEvent';
export * from './session';

View File

@ -1,12 +1,11 @@
import { MouseEventType } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from './GetRoomEngine';
import { SetActiveRoomId } from './SetActiveRoomId';
let didMouseMove = false;
let lastClick = 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 y = event.clientY;
@ -28,8 +27,8 @@ export function DispatchMouseEvent(roomId: number, canvasId: number, event: Mous
{
if(!didMouseMove) eventType = MouseEventType.DOUBLE_CLICK;
clickCount = 0;
lastClick = null;
clickCount = 0;
lastClick = null;
}
}
@ -51,7 +50,6 @@ export function DispatchMouseEvent(roomId: number, canvasId: number, event: Mous
break;
default: return;
}
SetActiveRoomId(roomId);
GetRoomEngine().dispatchMouseEvent(canvasId, x, y, eventType, event.altKey, (event.ctrlKey || event.metaKey), event.shiftKey, false);
}

View File

@ -6,7 +6,7 @@ let lastClick = 0;
let clickCount = 0;
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;
@ -29,8 +29,8 @@ export function DispatchTouchEvent(roomId: number, canvasId: number, event: Touc
{
eventType = MouseEventType.DOUBLE_CLICK;
clickCount = 0;
lastClick = null;
clickCount = 0;
lastClick = null;
}
}
@ -51,8 +51,6 @@ export function DispatchTouchEvent(roomId: number, canvasId: number, event: Touc
y = event.changedTouches[0].clientY;
}
GetRoomEngine().setActiveRoomId(roomId);
switch(eventType)
{
case MouseEventType.MOUSE_CLICK:
@ -64,7 +62,7 @@ export function DispatchTouchEvent(roomId: number, canvasId: number, event: Touc
{
if(didMouseMove) return;
DispatchTouchEvent(roomId, canvasId, event, true);
DispatchTouchEvent(event, canvasId, true);
}, 300);
eventType = MouseEventType.MOUSE_DOWN;

View File

@ -1,7 +1,13 @@
import { NitroRectangle } from '@nitrots/nitro-renderer';
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;
}

View 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;
}

View File

@ -1,6 +1,9 @@
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);
}

View File

@ -3,6 +3,7 @@ export * from './DispatchTouchEvent';
export * from './GetOwnRoomObject';
export * from './GetRoomEngine';
export * from './GetRoomObjectBounds';
export * from './GetRoomObjectScreenLocation';
export * from './InitializeRoomInstanceRenderingCanvas';
export * from './IsFurnitureSelectionDisabled';
export * from './ProcessRoomObjectOperation';

View File

@ -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;
}
}

View File

@ -14,11 +14,11 @@ export class RoomWidgetUpdateDimmerStateEvent extends RoomWidgetUpdateEvent
{
super(RoomWidgetUpdateDimmerStateEvent.DIMMER_STATE);
this._state = state;
this._presetId = presetId;
this._effectId = effectId;
this._color = color;
this._brightness = brightness;
this._state = state;
this._presetId = presetId;
this._effectId = effectId;
this._color = color;
this._brightness = brightness;
}
public get state(): number

View File

@ -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;
}
}

View File

@ -24,12 +24,10 @@ export class RoomWidgetUpdateInfostandUserEvent extends RoomWidgetUpdateInfostan
public carryItem: number = 0;
public roomIndex: number = 0;
public isSpectatorMode: boolean = false;
public realName: string = '';
public allowNameChange: boolean = false;
public amIOwner: boolean = false;
public amIAnyRoomController: boolean = false;
public roomControllerLevel: number = 0;
public canBeAskedAsFriend: boolean = false;
public canBeKicked: boolean = false;
public canBeBanned: boolean = false;
public canBeMuted: boolean = false;
@ -39,7 +37,6 @@ export class RoomWidgetUpdateInfostandUserEvent extends RoomWidgetUpdateInfostan
public canTrade: boolean = false;
public canTradeReason: number = 0;
public targetRoomControllerLevel: number = 0;
public isFriend: boolean = false;
public isAmbassador: boolean = false;
public get isOwnUser(): boolean

View File

@ -2,15 +2,15 @@ import { RoomWidgetUpdateEvent } from './RoomWidgetUpdateEvent';
export class RoomWidgetUpdateRoomObjectEvent extends RoomWidgetUpdateEvent
{
public static OBJECT_SELECTED: string = 'RWUROE_OBJECT_SELECTED';
public static OBJECT_DESELECTED: string = 'RWUROE_OBJECT_DESELECTED';
public static USER_REMOVED: string = 'RWUROE_USER_REMOVED';
public static FURNI_REMOVED: string = 'RWUROE_FURNI_REMOVED';
public static FURNI_ADDED: string = 'RWUROE_FURNI_ADDED';
public static USER_ADDED: string = 'RWUROE_USER_ADDED';
public static OBJECT_ROLL_OVER: string = 'RWUROE_OBJECT_ROLL_OVER';
public static OBJECT_ROLL_OUT: string = 'RWUROE_OBJECT_ROLL_OUT';
public static OBJECT_REQUEST_MANIPULATION: string = 'RWUROE_OBJECT_REQUEST_MANIPULATION';
public static OBJECT_SELECTED: string = 'RWUROE_OBJECT_SELECTED';
public static OBJECT_DESELECTED: string = 'RWUROE_OBJECT_DESELECTED';
public static USER_REMOVED: string = 'RWUROE_USER_REMOVED';
public static FURNI_REMOVED: string = 'RWUROE_FURNI_REMOVED';
public static FURNI_ADDED: string = 'RWUROE_FURNI_ADDED';
public static USER_ADDED: string = 'RWUROE_USER_ADDED';
public static OBJECT_ROLL_OVER: string = 'RWUROE_OBJECT_ROLL_OVER';
public static OBJECT_ROLL_OUT: string = 'RWUROE_OBJECT_ROLL_OUT';
public static OBJECT_REQUEST_MANIPULATION: string = 'RWUROE_OBJECT_REQUEST_MANIPULATION';
private _id: number;
private _category: number;
@ -20,9 +20,9 @@ export class RoomWidgetUpdateRoomObjectEvent extends RoomWidgetUpdateEvent
{
super(type);
this._id = id;
this._category = category;
this._roomId = roomId;
this._id = id;
this._category = category;
this._roomId = roomId;
}
public get id(): number

View File

@ -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;
}
}

View File

@ -3,7 +3,6 @@ export * from './RoomDimmerPreset';
export * from './RoomObjectItem';
export * from './RoomWidgetAvatarInfoEvent';
export * from './RoomWidgetChooserContentEvent';
export * from './RoomWidgetDoorbellEvent';
export * from './RoomWidgetFloodControlEvent';
export * from './RoomWidgetObjectNameEvent';
export * from './RoomWidgetPollUpdateEvent';
@ -18,7 +17,6 @@ export * from './RoomWidgetUpdateDimmerEvent';
export * from './RoomWidgetUpdateDimmerStateEvent';
export * from './RoomWidgetUpdateEvent';
export * from './RoomWidgetUpdateExternalImageEvent';
export * from './RoomWidgetUpdateFriendRequestEvent';
export * from './RoomWidgetUpdateInfostandEvent';
export * from './RoomWidgetUpdateInfostandFurniEvent';
export * from './RoomWidgetUpdateInfostandPetEvent';
@ -29,7 +27,6 @@ export * from './RoomWidgetUpdatePresentDataEvent';
export * from './RoomWidgetUpdateRentableBotChatEvent';
export * from './RoomWidgetUpdateRoomEngineEvent';
export * from './RoomWidgetUpdateRoomObjectEvent';
export * from './RoomWidgetUpdateRoomViewEvent';
export * from './RoomWidgetUpdateSongEvent';
export * from './RoomWidgetUpdateTrophyEvent';
export * from './RoomWidgetUpdateUserDataEvent';

View File

@ -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
];
}
}

View File

@ -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
];
}
}

View File

@ -37,40 +37,40 @@ export class FurniChooserWidgetHandler extends RoomWidgetHandler
const floorItems = GetRoomEngine().getRoomObjects(roomId, RoomObjectCategory.FLOOR);
wallItems.forEach(roomObject =>
{
let name = roomObject.type;
if(name.startsWith('poster'))
{
let name = roomObject.type;
if(name.startsWith('poster'))
{
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 =>
name = LocalizeText(`poster_${ name.replace('poster', '') }_name`);
}
else
{
let name = roomObject.type;
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;
}
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) =>
{
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));
}

View File

@ -43,7 +43,7 @@ export class FurnitureInternalLinkHandler extends RoomWidgetHandler
public get eventTypes(): string[]
{
return [RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK];
return [ RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK ];
}
public get messageTypes(): string[]

View File

@ -1,7 +1,7 @@
import { IFurnitureData, IGetImageListener, NitroEvent, NitroRenderTexture, PetFigureData, RoomObjectCategory, RoomObjectVariable, RoomSessionPresentEvent, RoomWidgetEnum, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
import { GetSessionDataManager, IsOwnerOfFurniture } from '../../..';
import { GetRoomEngine, LocalizeText } from '../../../..';
import { ProductTypeEnum } from '../../../../../components/catalog/common/ProductTypeEnum';
import { ProductTypeEnum } from '../../../../catalog';
import { RoomWidgetUpdateEvent, RoomWidgetUpdatePresentDataEvent } from '../events';
import { RoomWidgetFurniToWidgetMessage, RoomWidgetPresentOpenMessage } from '../messages';
import { RoomWidgetMessage } from '../messages/RoomWidgetMessage';
@ -9,10 +9,10 @@ import { RoomWidgetHandler } from './RoomWidgetHandler';
export class FurniturePresentWidgetHandler extends RoomWidgetHandler implements IGetImageListener
{
private static FLOOR: string = 'floor';
private static WALLPAPER: string = 'wallpaper';
private static LANDSCAPE: string = 'landscape';
private static POSTER: string = 'poster';
private static FLOOR: string = 'floor';
private static WALLPAPER: string = 'wallpaper';
private static LANDSCAPE: string = 'landscape';
private static POSTER: string = 'poster';
private _lastFurniId: number = -1;
private _name: string = null;

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