Updates for new renderer

This commit is contained in:
billsonnn 2024-03-20 22:39:51 -04:00
parent 5ef5cdd6c6
commit 2c8298a493
287 changed files with 2322 additions and 1963 deletions

View File

@ -1,29 +0,0 @@
image: node:16.13
stages:
- install-dependencies
- build
Install Dependencies:
stage: install-dependencies
script:
- yarn install
cache:
key: ${CI_COMMIT_BRANCH}
paths:
- node_modules
Build Nitro:
stage: build
script:
- cp public/renderer-config.json.example public/renderer-config.json
- cp public/ui-config.json.example public/ui-config.json
- yarn build:prod
cache:
key: ${CI_COMMIT_BRANCH}
paths:
- node_modules
artifacts:
expire_in: 2 weeks
paths:
- build/*

View File

@ -6,9 +6,9 @@
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
"editor.wordWrap": "on",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.sortJSON": false,
"source.organizeImports": true
"source.fixAll.eslint": "explicit",
"source.fixAll.sortJSON": "never",
"source.organizeImports": "explicit"
},
"editor.formatOnSave": false,
"git.ignoreLimitWarning": true,

View File

@ -24,6 +24,7 @@
<script>
const NitroConfig = {
"config.urls": [ '/renderer-config.json', '/ui-config.json' ],
"socket.url": (new URLSearchParams(window.location.search).get('socket.url') || null),
"sso.ticket": (new URLSearchParams(window.location.search).get('sso') || null),
"forward.type": (new URLSearchParams(window.location.search).get('room') ? 2 : -1),
"forward.id": (new URLSearchParams(window.location.search).get('room') || 0),

View File

@ -1,6 +1,6 @@
{
"name": "nitro-react",
"version": "2.1.1",
"version": "2.2",
"homepage": ".",
"private": true,
"scripts": {
@ -10,30 +10,30 @@
"eslint": "eslint src --ext .ts,.tsx"
},
"dependencies": {
"@tanstack/react-virtual": "^3.0.0-alpha.0",
"@tanstack/react-virtual": "3.0.0-alpha.0",
"react": "^18.2.0",
"react-bootstrap": "^2.2.2",
"react-dom": "^18.2.0",
"react-icons": "^4.7.1",
"react-slider": "^2.0.0",
"react-icons": "^5.0.1",
"react-slider": "^2.0.6",
"react-youtube": "^7.13.1",
"typescript": "^4.3.5",
"use-between": "^1.3.4"
"use-between": "^1.3.5"
},
"devDependencies": {
"@types/node": "^18.6.1",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/react-slider": "^1.3.1",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"@vitejs/plugin-react": "^3.0.0",
"eslint": "^8.20.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-react": "^7.30.1",
"@types/node": "^20.11.30",
"@types/react": "^18.2.67",
"@types/react-dom": "^18.2.22",
"@types/react-slider": "^1.3.6",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"sass": "^1.56.2",
"vite": "^4.4.5"
"sass": "^1.72.0",
"typescript": "^5.4.2",
"vite": "^5.1.6"
}
}

View File

@ -1,9 +1,10 @@
import { Nitro, NitroLogger, NitroVersion } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager, GetCommunication, GetConfiguration, GetLocalizationManager, GetPixi, GetRoomEngine, GetRoomSessionManager, GetSessionDataManager, GetSoundManager, GetTicker, HabboWebTools, LegacyExternalInterface, LoadGameUrlEvent, NitroLogger, NitroVersion } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react';
import { GetNitroInstance, GetUIVersion } from './api';
import { GetUIVersion } from './api';
import { Base } from './common';
import { LoadingView } from './components/loading/LoadingView';
import { MainView } from './components/main/MainView';
import { useMessageEvent } from './hooks';
NitroVersion.UI_VERSION = GetUIVersion();
@ -15,15 +16,48 @@ export const App: FC<{}> = props =>
useEffect(() =>
{
(async () =>
const prepare = async (width: number, height: number) =>
{
try
{
//@ts-ignore
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
Nitro.bootstrap();
await GetNitroInstance().init();
NitroVersion.sayHello();
await GetPixi().init({
autoStart: false,
autoDensity: false,
width,
height,
sharedTicker: true,
backgroundAlpha: 0
});
await GetConfiguration().init();
GetTicker().maxFPS = GetConfiguration().getValue<number>('system.fps.max', 24);
NitroLogger.LOG_DEBUG = GetConfiguration().getValue<boolean>('system.log.debug', true);
NitroLogger.LOG_WARN = GetConfiguration().getValue<boolean>('system.log.warn', false);
NitroLogger.LOG_ERROR = GetConfiguration().getValue<boolean>('system.log.error', false);
NitroLogger.LOG_EVENTS = GetConfiguration().getValue<boolean>('system.log.events', false);
NitroLogger.LOG_PACKETS = GetConfiguration().getValue<boolean>('system.log.packets', false);
await GetLocalizationManager().init();
await GetAvatarRenderManager().init();
await GetSoundManager().init();
await GetSessionDataManager().init();
await GetRoomSessionManager().init();
await GetRoomEngine().init();
await GetCommunication().init();
// new GameMessageHandler();
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
HabboWebTools.sendHeartBeat();
setInterval(() => HabboWebTools.sendHeartBeat(), 10000);
setIsReady(true);
@ -35,7 +69,7 @@ export const App: FC<{}> = props =>
{
NitroLogger.error(err);
}
})();
}
const resize = (event: UIEvent) => setImageRendering(!(window.devicePixelRatio % 1));
@ -43,11 +77,22 @@ export const App: FC<{}> = props =>
resize(null);
prepare(window.innerWidth, window.innerHeight);
return () =>
{
window.removeEventListener('resize', resize);
}
}, []);
useMessageEvent<LoadGameUrlEvent>(LoadGameUrlEvent, event =>
{
const parser = event.getParser();
if(!parser) return;
LegacyExternalInterface.callGame('showGame', parser.url);
});
return (
<Base fit overflow="hidden" className={ imageRendering && 'image-rendering-pixelated' }>

View File

@ -1,5 +1,5 @@
import { AchievementData } from '@nitrots/nitro-renderer';
import { GetConfiguration, GetLocalization } from '../nitro';
import { AchievementData, GetLocalizationManager } from '@nitrots/nitro-renderer';
import { GetConfigurationValue } from '../nitro';
import { IAchievementCategory } from './IAchievementCategory';
export class AchievementUtilities
@ -10,14 +10,14 @@ export class AchievementUtilities
let badgeId = achievement.badgeId;
if(!achievement.finalLevel) badgeId = GetLocalization().getPreviousLevelBadgeId(badgeId);
if(!achievement.finalLevel) badgeId = GetLocalizationManager().getPreviousLevelBadgeId(badgeId);
return badgeId;
}
public static getAchievementCategoryImageUrl(category: IAchievementCategory, progress: number = null, icon: boolean = false): string
{
const imageUrl = GetConfiguration<string>('achievements.images.url');
const imageUrl = GetConfigurationValue<string>('achievements.images.url');
let imageName = icon ? 'achicon_' : 'achcategory_';
@ -77,7 +77,7 @@ export class AchievementUtilities
{
if(!achievement) return false;
const ignored = GetConfiguration<string[]>('achievements.unseen.ignored');
const ignored = GetConfigurationValue<string[]>('achievements.unseen.ignored');
const value = achievement.badgeId.replace(/[0-9]/g, '');
const index = ignored.indexOf(value);

View File

@ -1,10 +1,9 @@
import { AvatarFigurePartType, IAvatarImageListener, IAvatarRenderManager, IFigurePart, IFigurePartSet, IGraphicAsset, IPartColor, NitroAlphaFilter, NitroContainer, NitroSprite, TextureUtils } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager } from '../nitro';
import { AvatarFigurePartType, GetAvatarRenderManager, IAvatarImageListener, IAvatarRenderManager, IFigurePart, IFigurePartSet, IGraphicAsset, IPartColor, NitroAlphaFilter, NitroContainer, NitroSprite, TextureUtils } from '@nitrots/nitro-renderer';
import { FigureData } from './FigureData';
export class AvatarEditorGridPartItem implements IAvatarImageListener
{
private static ALPHA_FILTER: NitroAlphaFilter = new NitroAlphaFilter(0.2);
private static ALPHA_FILTER: NitroAlphaFilter = new NitroAlphaFilter({ alpha: 0.2 });
private static THUMB_DIRECTIONS: number[] = [ 2, 6, 0, 4, 3, 1 ];
private static DRAW_ORDER: string[] = [
AvatarFigurePartType.LEFT_HAND_ITEM,

View File

@ -1,5 +1,5 @@
import { IPartColor } from '@nitrots/nitro-renderer';
import { GetAvatarPalette, GetAvatarRenderManager, GetAvatarSetType, GetClubMemberLevel, GetConfiguration } from '../nitro';
import { GetAvatarRenderManager, IPartColor } from '@nitrots/nitro-renderer';
import { GetClubMemberLevel, GetConfigurationValue } from '../nitro';
import { AvatarEditorGridColorItem } from './AvatarEditorGridColorItem';
import { AvatarEditorGridPartItem } from './AvatarEditorGridPartItem';
import { CategoryBaseModel } from './CategoryBaseModel';
@ -56,11 +56,11 @@ export class AvatarEditorUtilities
i++;
}
const setType = GetAvatarSetType(name);
const setType = GetAvatarRenderManager().structureData.getSetType(name);
if(!setType) return null;
const palette = GetAvatarPalette(setType.paletteID);
const palette = GetAvatarRenderManager().structureData.getPalette(setType.paletteID);
if(!palette) return null;
@ -247,11 +247,11 @@ export class AvatarEditorUtilities
public static avatarSetFirstSelectableColor(name: string): number
{
const setType = GetAvatarSetType(name);
const setType = GetAvatarRenderManager().structureData.getSetType(name);
if(!setType) return -1;
const palette = GetAvatarPalette(setType.paletteID);
const palette = GetAvatarRenderManager().structureData.getPalette(setType.paletteID);
if(!palette) return -1;
@ -267,11 +267,11 @@ export class AvatarEditorUtilities
public static get clubItemsFirst(): boolean
{
return GetConfiguration<boolean>('avatareditor.show.clubitems.first', true);
return GetConfigurationValue<boolean>('avatareditor.show.clubitems.first', true);
}
public static get clubItemsDimmed(): boolean
{
return GetConfiguration<boolean>('avatareditor.show.clubitems.dimmed', true);
return GetConfigurationValue<boolean>('avatareditor.show.clubitems.dimmed', true);
}
}

View File

@ -1,5 +1,4 @@
import { AvatarEditorFigureCategory, AvatarScaleType, AvatarSetType } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager } from '../nitro';
import { AvatarEditorFigureCategory, AvatarScaleType, AvatarSetType, GetAvatarRenderManager } from '@nitrots/nitro-renderer';
import { AvatarEditorUtilities } from './AvatarEditorUtilities';
import { CategoryBaseModel } from './CategoryBaseModel';
import { FigureData } from './FigureData';

View File

@ -1,5 +1,4 @@
import { AvatarFigureContainer, IFigurePartSet, IPalette, IPartColor, SetType } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager } from '../nitro';
import { AvatarFigureContainer, GetAvatarRenderManager, IFigurePartSet, IPalette, IPartColor, SetType } from '@nitrots/nitro-renderer';
import { Randomizer } from '../utils';
import { FigureData } from './FigureData';

View File

@ -1,5 +1,4 @@
import { SellablePetPaletteData } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../nitro';
import { GetRoomEngine, SellablePetPaletteData } from '@nitrots/nitro-renderer';
import { ICatalogNode } from './ICatalogNode';
export const GetPixelEffectIcon = (id: number) =>

View File

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

View File

@ -1,4 +1,4 @@
import { GetRoomEngine } from '../nitro';
import { GetRoomEngine } from '@nitrots/nitro-renderer';
import { ProductTypeEnum } from './ProductTypeEnum';
export const GetImageIconUrlForProduct = (productType: string, productClassId: number, extraData: string = null) =>

View File

@ -1,4 +1,4 @@
import { GetConfiguration } from '../nitro';
import { GetConfigurationValue } from '../nitro';
import { IPageLocalization } from './IPageLocalization';
export class PageLocalization implements IPageLocalization
@ -27,7 +27,7 @@ export class PageLocalization implements IPageLocalization
if(!imageName || !imageName.length) return null;
let assetUrl = GetConfiguration<string>('catalog.asset.image.url');
let assetUrl = GetConfigurationValue<string>('catalog.asset.image.url');
assetUrl = assetUrl.replace('%name%', imageName);

View File

@ -1,5 +1,5 @@
import { IFurnitureData, IObjectData, IProductData } from '@nitrots/nitro-renderer';
import { GetConfiguration, GetRoomEngine, GetSessionDataManager } from '../nitro';
import { GetRoomEngine, GetSessionDataManager, IFurnitureData, IObjectData, IProductData } from '@nitrots/nitro-renderer';
import { GetConfigurationValue } from '../nitro';
import { GetPixelEffectIcon, GetSubscriptionProductIcon } from './CatalogUtilities';
import { IProduct } from './IProduct';
import { IPurchasableOffer } from './IPurchasableOffer';
@ -65,7 +65,7 @@ export class Product implements IProduct
if(iconName !== '')
{
const assetUrl = GetConfiguration<string>('catalog.asset.url');
const assetUrl = GetConfigurationValue<string>('catalog.asset.url');
return `${ assetUrl }/${ iconName }.png`;
}

View File

@ -1,5 +1,4 @@
import { NitroEvent } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from '../nitro';
import { GetEventDispatcher, NitroEvent } from '@nitrots/nitro-renderer';
import { DispatchEvent } from './DispatchEvent';
export const DispatchMainEvent = (event: NitroEvent) => DispatchEvent(GetNitroInstance().events, event);
export const DispatchMainEvent = (event: NitroEvent) => DispatchEvent(GetEventDispatcher(), event);

View File

@ -1,4 +1,4 @@
import { CreateLinkEvent } from '..';
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
export function OpenMessengerChat(friendId: number = 0): void
{

View File

@ -1,5 +1,5 @@
import { GroupInformationComposer } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '..';
import { SendMessageComposer } from '../nitro';
export function GetGroupInformation(groupId: number): void
{

View File

@ -1,4 +1,4 @@
import { CreateLinkEvent } from '..';
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
export function GetGroupManager(groupId: number): void
{

View File

@ -1,4 +1,4 @@
import { CreateLinkEvent } from '..';
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
export function GetGroupMembers(groupId: number, levelId?: number): void
{

View File

@ -1,4 +1,3 @@
export class GroupBadgePart
{
public static BASE: string = 'b';

View File

@ -1,5 +1,5 @@
import { GroupFavoriteComposer, GroupUnfavoriteComposer, HabboGroupEntryData } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '..';
import { SendMessageComposer } from '../nitro';
export const ToggleFavoriteGroup = (group: HabboGroupEntryData) =>
{

View File

@ -1,4 +1,4 @@
import { GroupJoinComposer } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '..';
import { SendMessageComposer } from '../nitro';
export const TryJoinGroup = (groupId: number) => SendMessageComposer(new GroupJoinComposer(groupId));

View File

@ -16,13 +16,13 @@ export * from './inventory';
export * from './mod-tools';
export * from './navigator';
export * from './nitro';
export * from './nitro/avatar';
export * from './nitro/camera';
export * from './nitro/room';
export * from './nitro/session';
export * from './notification';
export * from './purse';
export * from './room';
export * from './room/events';
export * from './room/widgets';
export * from './user';
export * from './utils';
export * from './wired';

View File

@ -1,5 +1,4 @@
import { FurnitureListItemParser, IObjectData } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../nitro';
import { FurnitureListItemParser, GetRoomEngine, IObjectData } from '@nitrots/nitro-renderer';
import { FurniCategory } from './FurniCategory';
import { FurnitureItem } from './FurnitureItem';
import { GroupItem } from './GroupItem';

View File

@ -1,5 +1,5 @@
import { FurniturePlacePaintComposer, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType } from '@nitrots/nitro-renderer';
import { CreateLinkEvent, GetRoomEngine, GetRoomSessionManager, SendMessageComposer } from '../nitro';
import { CreateLinkEvent, FurniturePlacePaintComposer, GetRoomEngine, GetRoomSessionManager, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '../nitro';
import { FurniCategory } from './FurniCategory';
import { GroupItem } from './GroupItem';
import { IBotItem } from './IBotItem';

View File

@ -1,7 +1,6 @@
import { PetData } from '@nitrots/nitro-renderer';
import { CreateLinkEvent } from '../nitro';
import { cancelRoomObjectPlacement, getPlacingItemId } from './InventoryUtilities';
import { CreateLinkEvent, PetData } from '@nitrots/nitro-renderer';
import { IPetItem } from './IPetItem';
import { cancelRoomObjectPlacement, getPlacingItemId } from './InventoryUtilities';
import { UnseenItemCategory } from './UnseenItemCategory';
export const getAllPetIds = (petItems: IPetItem[]) => petItems.map(item => item.petData.id);

View File

@ -1,5 +1,4 @@
import { AdvancedMap, IObjectData, ItemDataStructure, StringDataType } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from '../nitro';
import { AdvancedMap, GetSessionDataManager, IObjectData, ItemDataStructure, StringDataType } from '@nitrots/nitro-renderer';
import { FurniCategory } from './FurniCategory';
import { FurnitureItem } from './FurnitureItem';
import { createGroupItem } from './FurnitureUtilities';

View File

@ -4,9 +4,9 @@ export * from './FurnitureUtilities';
export * from './GroupItem';
export * from './IBotItem';
export * from './IFurnitureItem';
export * from './InventoryUtilities';
export * from './IPetItem';
export * from './IUnseenItemTracker';
export * from './InventoryUtilities';
export * from './PetUtilities';
export * from './TradeState';
export * from './TradeUserData';

View File

@ -1,7 +0,0 @@
import { ILinkEventTracker } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export function AddEventLinkTracker(tracker: ILinkEventTracker): void
{
GetNitroInstance().addLinkEventTracker(tracker);
}

View File

@ -1,8 +0,0 @@
import { GetNitroInstance } from './GetNitroInstance';
export function CreateLinkEvent(link: string): void
{
link = (link.startsWith('event:') ? link.substring(6) : link);
GetNitroInstance().createLinkEvent(link);
}

View File

@ -1,7 +0,0 @@
import { INitroCommunicationManager } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export function GetCommunication(): INitroCommunicationManager
{
return GetNitroInstance()?.communication;
}

View File

@ -1,6 +0,0 @@
import { NitroConfiguration } from '@nitrots/nitro-renderer';
export function GetConfiguration<T>(key: string, value: T = null): T
{
return NitroConfiguration.getValue(key, value);
}

View File

@ -1,7 +0,0 @@
import { IConfigurationManager } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export function GetConfigurationManager(): IConfigurationManager
{
return GetNitroInstance().configuration;
}

View File

@ -0,0 +1,6 @@
import { GetConfiguration } from '@nitrots/nitro-renderer';
export function GetConfigurationValue<T>(key: string, value: T = null): T
{
return GetConfiguration().getValue(key, value);
}

View File

@ -1,7 +0,0 @@
import { IConnection } from '@nitrots/nitro-renderer';
import { GetCommunication } from './GetCommunication';
export function GetConnection(): IConnection
{
return GetCommunication()?.connection;
}

View File

@ -1,7 +0,0 @@
import { INitroLocalizationManager } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export function GetLocalization(): INitroLocalizationManager
{
return GetNitroInstance().localization;
}

View File

@ -1,6 +0,0 @@
import { INitro, Nitro } from '@nitrots/nitro-renderer';
export function GetNitroInstance(): INitro
{
return Nitro.instance;
}

View File

@ -1,5 +1,4 @@
import { HabboWebTools } from '@nitrots/nitro-renderer';
import { CreateLinkEvent } from './CreateLinkEvent';
import { CreateLinkEvent, HabboWebTools } from '@nitrots/nitro-renderer';
export const OpenUrl = (url: string) =>
{

View File

@ -1,7 +0,0 @@
import { ILinkEventTracker } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from './GetNitroInstance';
export function RemoveLinkEventTracker(tracker: ILinkEventTracker): void
{
GetNitroInstance().removeLinkEventTracker(tracker);
}

View File

@ -1,4 +1,3 @@
import { IMessageComposer } from '@nitrots/nitro-renderer';
import { GetConnection } from './GetConnection';
import { GetCommunication, IMessageComposer } from '@nitrots/nitro-renderer';
export const SendMessageComposer = (event: IMessageComposer<unknown[]>) => GetConnection().send(event);
export const SendMessageComposer = (event: IMessageComposer<unknown[]>) => GetCommunication().connection.send(event);

View File

@ -1,7 +0,0 @@
import { IPalette } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager } from './GetAvatarRenderManager';
export function GetAvatarPalette(paletteId: number): IPalette
{
return GetAvatarRenderManager().structureData.getPalette(paletteId);
}

View File

@ -1,7 +0,0 @@
import { IAvatarRenderManager } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from '../GetNitroInstance';
export function GetAvatarRenderManager(): IAvatarRenderManager
{
return GetNitroInstance().avatar;
}

View File

@ -1,7 +0,0 @@
import { ISetType } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager } from './GetAvatarRenderManager';
export function GetAvatarSetType(setType: string): ISetType
{
return GetAvatarRenderManager().structureData.getSetType(setType);
}

View File

@ -1,3 +0,0 @@
export * from './GetAvatarPalette';
export * from './GetAvatarRenderManager';
export * from './GetAvatarSetType';

View File

@ -1,7 +0,0 @@
import { IRoomCameraWidgetManager } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from '../GetNitroInstance';
export function GetRoomCameraWidgetManager(): IRoomCameraWidgetManager
{
return GetNitroInstance().cameraManager;
}

View File

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

View File

@ -1,15 +1,5 @@
export * from './AddLinkEventTracker';
export * from './CreateLinkEvent';
export * from './GetCommunication';
export * from './GetConfiguration';
export * from './GetConfigurationManager';
export * from './GetConnection';
export * from './GetLocalization';
export * from './GetNitroInstance';
export * from './GetConfigurationValue';
export * from './OpenUrl';
export * from './RemoveLinkEventTracker';
export * from './SendMessageComposer';
export * from './avatar';
export * from './camera';
export * from './room';
export * from './session';

View File

@ -1,5 +1,4 @@
import { MouseEventType } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine, MouseEventType } from '@nitrots/nitro-renderer';
let didMouseMove = false;
let lastClick = 0;

View File

@ -1,5 +1,4 @@
import { MouseEventType, TouchEventType } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine, MouseEventType, TouchEventType } from '@nitrots/nitro-renderer';
let didMouseMove = false;
let lastClick = 0;

View File

@ -1,6 +1,5 @@
import { IRoomObjectController, RoomObjectCategory } from '@nitrots/nitro-renderer';
import { GetRoomSession, GetSessionDataManager } from '../session';
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine, GetSessionDataManager, IRoomObjectController, RoomObjectCategory } from '@nitrots/nitro-renderer';
import { GetRoomSession } from '../session';
export function GetOwnRoomObject(): IRoomObjectController
{

View File

@ -1,7 +0,0 @@
import { IRoomEngine } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from '../GetNitroInstance';
export function GetRoomEngine(): IRoomEngine
{
return GetNitroInstance().roomEngine;
}

View File

@ -1,4 +1,4 @@
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine } from '@nitrots/nitro-renderer';
export const GetRoomObjectBounds = (roomId: number, objectId: number, category: number, canvasId = 1) =>
{

View File

@ -1,4 +1,4 @@
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine } from '@nitrots/nitro-renderer';
export const GetRoomObjectScreenLocation = (roomId: number, objectId: number, category: number, canvasId = 1) =>
{

View File

@ -1,4 +1,4 @@
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine } from '@nitrots/nitro-renderer';
export const InitializeRoomInstanceRenderingCanvas = (width: number, height: number, canvasId: number = 1) =>
{

View File

@ -1,6 +1,4 @@
import { RoomEngineObjectEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from '../..';
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine, GetSessionDataManager, RoomEngineObjectEvent, RoomObjectVariable } from '@nitrots/nitro-renderer';
export function IsFurnitureSelectionDisabled(event: RoomEngineObjectEvent): boolean
{

View File

@ -1,4 +1,4 @@
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine } from '@nitrots/nitro-renderer';
export function ProcessRoomObjectOperation(objectId: number, category: number, operation: string): void
{

View File

@ -1,4 +1,4 @@
import { GetRoomEngine } from './GetRoomEngine';
import { GetRoomEngine } from '@nitrots/nitro-renderer';
export function SetActiveRoomId(roomId: number): void
{

View File

@ -1,7 +1,6 @@
export * from './DispatchMouseEvent';
export * from './DispatchTouchEvent';
export * from './GetOwnRoomObject';
export * from './GetRoomEngine';
export * from './GetRoomObjectBounds';
export * from './GetRoomObjectScreenLocation';
export * from './InitializeRoomInstanceRenderingCanvas';

View File

@ -1,6 +1,4 @@
import { IRoomSession, RoomControllerLevel } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from '../..';
import { GetRoomEngine } from '../room/GetRoomEngine';
import { GetRoomEngine, GetSessionDataManager, IRoomSession, RoomControllerLevel } from '@nitrots/nitro-renderer';
import { IsOwnerOfFurniture } from './IsOwnerOfFurniture';
export function CanManipulateFurniture(roomSession: IRoomSession, objectId: number, category: number): boolean

View File

@ -1,4 +1,4 @@
import { GetRoomSessionManager } from './GetRoomSessionManager';
import { GetRoomSessionManager } from '@nitrots/nitro-renderer';
export function CreateRoomSession(roomId: number, password: string = null): void
{

View File

@ -1,10 +1,9 @@
import { HabboClubLevelEnum } from '@nitrots/nitro-renderer';
import { GetConfiguration } from '..';
import { GetSessionDataManager } from './GetSessionDataManager';
import { GetSessionDataManager, HabboClubLevelEnum } from '@nitrots/nitro-renderer';
import { GetConfigurationValue } from '../GetConfigurationValue';
export function GetClubMemberLevel(): number
{
if(GetConfiguration<boolean>('hc.disabled', false)) return HabboClubLevelEnum.VIP;
if(GetConfigurationValue<boolean>('hc.disabled', false)) return HabboClubLevelEnum.VIP;
return GetSessionDataManager().clubLevel;
}

View File

@ -1,5 +1,4 @@
import { IFurnitureData } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from '.';
import { GetSessionDataManager, IFurnitureData } from '@nitrots/nitro-renderer';
import { ProductTypeEnum } from '../../catalog';
export function GetFurnitureData(furniClassId: number, productType: string): IFurnitureData

View File

@ -1,5 +1,4 @@
import { CatalogPageMessageProductData, FurnitureType, IFurnitureData } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from './GetSessionDataManager';
import { CatalogPageMessageProductData, FurnitureType, GetSessionDataManager, IFurnitureData } from '@nitrots/nitro-renderer';
export function GetFurnitureDataForProductOffer(offer: CatalogPageMessageProductData): IFurnitureData
{

View File

@ -1,6 +1,4 @@
import { IFurnitureData, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../room';
import { GetSessionDataManager } from './GetSessionDataManager';
import { GetRoomEngine, GetSessionDataManager, IFurnitureData, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
export function GetFurnitureDataForRoomObject(roomId: number, objectId: number, category: number): IFurnitureData
{

View File

@ -1,5 +1,4 @@
import { IProductData } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from './GetSessionDataManager';
import { GetSessionDataManager, IProductData } from '@nitrots/nitro-renderer';
export function GetProductDataForLocalization(localizationId: string): IProductData
{

View File

@ -1,7 +1,3 @@
import { IRoomSession } from '@nitrots/nitro-renderer';
import { GetRoomSessionManager } from './GetRoomSessionManager';
import { GetRoomSessionManager } from '@nitrots/nitro-renderer';
export function GetRoomSession(): IRoomSession
{
return GetRoomSessionManager().getSession(-1);
}
export const GetRoomSession = () => GetRoomSessionManager().getSession(-1);

View File

@ -1,7 +0,0 @@
import { IRoomSessionManager } from '@nitrots/nitro-renderer';
import { GetRoomEngine } from '../room';
export function GetRoomSessionManager(): IRoomSessionManager
{
return GetRoomEngine().roomSessionManager;
}

View File

@ -1,7 +0,0 @@
import { ISessionDataManager } from '@nitrots/nitro-renderer';
import { GetNitroInstance } from '../GetNitroInstance';
export function GetSessionDataManager(): ISessionDataManager
{
return GetNitroInstance().sessionDataManager;
}

View File

@ -1,5 +1,5 @@
import { DesktopViewComposer } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '..';
import { SendMessageComposer } from '../SendMessageComposer';
export function GoToDesktop(): void
{

View File

@ -1,5 +1,4 @@
import { HabboClubLevelEnum } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from './GetSessionDataManager';
import { GetSessionDataManager, HabboClubLevelEnum } from '@nitrots/nitro-renderer';
export function HasHabboClub(): boolean
{

View File

@ -1,5 +1,4 @@
import { HabboClubLevelEnum } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from './GetSessionDataManager';
import { GetSessionDataManager, HabboClubLevelEnum } from '@nitrots/nitro-renderer';
export function HasHabboVip(): boolean
{

View File

@ -1,7 +1,5 @@
import { RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { GetRoomSession } from '.';
import { GetRoomEngine } from '..';
import { GetSessionDataManager } from '../../../api';
import { GetRoomEngine, GetSessionDataManager, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { GetRoomSession } from './GetRoomSession';
export function IsOwnerOfFloorFurniture(id: number): boolean
{

View File

@ -1,5 +1,4 @@
import { IRoomObject, RoomObjectVariable } from '@nitrots/nitro-renderer';
import { GetSessionDataManager } from '../../../api';
import { GetSessionDataManager, IRoomObject, RoomObjectVariable } from '@nitrots/nitro-renderer';
export function IsOwnerOfFurniture(roomObject: IRoomObject): boolean
{

View File

@ -1,5 +1,4 @@
import { IRoomSession } from '@nitrots/nitro-renderer';
import { GetRoomSessionManager } from './GetRoomSessionManager';
import { GetRoomSessionManager, IRoomSession } from '@nitrots/nitro-renderer';
export function StartRoomSession(session: IRoomSession): void
{

View File

@ -1,4 +1,6 @@
import { GetRoomSession, GetRoomSessionManager, GoToDesktop } from '.';
import { GetRoomSessionManager } from '@nitrots/nitro-renderer';
import { GetRoomSession } from './GetRoomSession';
import { GoToDesktop } from './GoToDesktop';
export const VisitDesktop = () =>
{

View File

@ -9,8 +9,6 @@ export * from './GetFurnitureDataForRoomObject';
export * from './GetOwnPosture';
export * from './GetProductDataForLocalization';
export * from './GetRoomSession';
export * from './GetRoomSessionManager';
export * from './GetSessionDataManager';
export * from './GoToDesktop';
export * from './HasHabboClub';
export * from './HasHabboVip';

View File

@ -1,5 +1,5 @@
import { GetTickerTime, IFurnitureData, IRoomModerationSettings, IRoomPetData, IRoomUserData, ObjectDataFactory, PetFigureData, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomTradingLevelEnum, RoomWidgetEnumItemExtradataParameter } from '@nitrots/nitro-renderer';
import { GetRoomEngine, GetRoomSession, GetSessionDataManager, IsOwnerOfFurniture } from '../../nitro';
import { GetRoomEngine, GetSessionDataManager, GetTickerTime, IFurnitureData, IRoomModerationSettings, IRoomPetData, IRoomUserData, ObjectDataFactory, PetFigureData, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomTradingLevelEnum, RoomWidgetEnumItemExtradataParameter } from '@nitrots/nitro-renderer';
import { GetRoomSession, IsOwnerOfFurniture } from '../../nitro';
import { LocalizeText } from '../../utils';
import { AvatarInfoFurni } from './AvatarInfoFurni';
import { AvatarInfoName } from './AvatarInfoName';

View File

@ -1,5 +1,3 @@
import { INitroPoint } from '@nitrots/nitro-renderer';
export class ChatBubbleMessage
{
public static BUBBLE_COUNTER: number = 0;
@ -20,7 +18,7 @@ export class ChatBubbleMessage
public text: string = '',
public formattedText: string = '',
public username: string = '',
public location: INitroPoint = null,
public location: { x: number, y: number } = null,
public type: number = 0,
public styleId: number = 0,
public imageUrl: string = null,

View File

@ -1,5 +1,4 @@
import { AvatarFigurePartType, AvatarScaleType, AvatarSetType, PetFigureData, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager, GetRoomEngine } from '../../nitro';
import { AvatarFigurePartType, AvatarScaleType, AvatarSetType, GetAvatarRenderManager, GetRoomEngine, PetFigureData, TextureUtils, Vector3d } from '@nitrots/nitro-renderer';
export class ChatBubbleUtilities
{

View File

@ -1,4 +1,5 @@
import { GetRoomEngine, GetRoomSession } from '../../nitro';
import { GetRoomEngine } from '@nitrots/nitro-renderer';
import { GetRoomSession } from '../../nitro';
export class FurnitureDimmerUtilities
{

View File

@ -1,5 +1,4 @@
import { AvatarFigurePartType, IAvatarFigureContainer } from '@nitrots/nitro-renderer';
import { GetAvatarRenderManager } from '../../nitro';
import { AvatarFigurePartType, GetAvatarRenderManager, IAvatarFigureContainer } from '@nitrots/nitro-renderer';
export class MannequinUtilities
{

View File

@ -1,5 +1,5 @@
import { UserProfileComposer } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '..';
import { SendMessageComposer } from '../nitro';
export function GetUserProfile(userId: number): void
{

View File

@ -0,0 +1,65 @@
export class FixedSizeStack
{
private _data: number[];
private _maxSize: number;
private _index: number;
constructor(k: number)
{
this._data = [];
this._maxSize = k;
this._index = 0;
}
public reset(): void
{
this._data = [];
this._index = 0;
}
public addValue(k: number): void
{
if(this._data.length < this._maxSize)
{
this._data.push(k);
}
else
{
this._data[this._index] = k;
}
this._index = ((this._index + 1) % this._maxSize);
}
public getMax(): number
{
let k = Number.MIN_VALUE;
let _local_2 = 0;
while(_local_2 < this._maxSize)
{
if(this._data[_local_2] > k) k = this._data[_local_2];
_local_2++;
}
return k;
}
public getMin(): number
{
let k = Number.MAX_VALUE;
let _local_2 = 0;
while(_local_2 < this._maxSize)
{
if(this._data[_local_2] < k) k = this._data[_local_2];
_local_2++;
}
return k;
}
}

View File

@ -0,0 +1,47 @@
import { LocalizeText } from './LocalizeText';
export class FriendlyTime
{
private static MINUTE: number = 60;
private static HOUR: number = (60 * FriendlyTime.MINUTE);
private static DAY: number = (24 * FriendlyTime.HOUR);
private static WEEK: number = (7 * FriendlyTime.DAY);
private static MONTH: number = (30 * FriendlyTime.DAY);
private static YEAR: number = (365 * FriendlyTime.DAY);
public static format(seconds: number, key: string = '', threshold: number = 3): string
{
if(seconds > (threshold * FriendlyTime.YEAR)) return FriendlyTime.getLocalization(('friendlytime.years' + key), Math.round((seconds / FriendlyTime.YEAR)));
if(seconds > (threshold * FriendlyTime.MONTH)) return FriendlyTime.getLocalization(('friendlytime.months' + key), Math.round((seconds / FriendlyTime.MONTH)));
if(seconds > (threshold * FriendlyTime.DAY)) return FriendlyTime.getLocalization(('friendlytime.days' + key), Math.round((seconds / FriendlyTime.DAY)));
if(seconds > (threshold * FriendlyTime.HOUR)) return FriendlyTime.getLocalization(('friendlytime.hours' + key), Math.round((seconds / FriendlyTime.HOUR)));
if(seconds > (threshold * FriendlyTime.MINUTE)) return FriendlyTime.getLocalization(('friendlytime.minutes' + key), Math.round((seconds / FriendlyTime.MINUTE)));
return FriendlyTime.getLocalization(('friendlytime.seconds' + key), Math.round(seconds));
}
public static shortFormat(seconds: number, key: string = '', threshold: number = 3): string
{
if(seconds > (threshold * FriendlyTime.YEAR)) return FriendlyTime.getLocalization(('friendlytime.years.short' + key), Math.round((seconds / FriendlyTime.YEAR)));
if(seconds > (threshold * FriendlyTime.MONTH)) return FriendlyTime.getLocalization(('friendlytime.months.short' + key), Math.round((seconds / FriendlyTime.MONTH)));
if(seconds > (threshold * FriendlyTime.DAY)) return FriendlyTime.getLocalization(('friendlytime.days.short' + key), Math.round((seconds / FriendlyTime.DAY)));
if(seconds > (threshold * FriendlyTime.HOUR)) return FriendlyTime.getLocalization(('friendlytime.hours.short' + key), Math.round((seconds / FriendlyTime.HOUR)));
if(seconds > (threshold * FriendlyTime.MINUTE)) return FriendlyTime.getLocalization(('friendlytime.minutes.short' + key), Math.round((seconds / FriendlyTime.MINUTE)));
return FriendlyTime.getLocalization(('friendlytime.seconds.short' + key), Math.round(seconds));
}
public static getLocalization(key: string, amount: number): string
{
return LocalizeText(key, [ 'amount' ], [ amount.toString() ]);
}
}

View File

@ -1,8 +1,8 @@
import { GetNitroInstance } from '..';
import { GetLocalizationManager } from '@nitrots/nitro-renderer';
export const LocalizeBadgeDescription = (key: string) =>
{
let badgeDesc = GetNitroInstance().localization.getBadgeDesc(key);
let badgeDesc = GetLocalizationManager().getBadgeDesc(key);
if(!badgeDesc || !badgeDesc.length) badgeDesc = `badge_desc_${ key }`;

View File

@ -1,8 +1,8 @@
import { GetNitroInstance } from '..';
import { GetLocalizationManager } from '@nitrots/nitro-renderer';
export const LocalizeBadgeName = (key: string) =>
{
let badgeName = GetNitroInstance().localization.getBadgeName(key);
let badgeName = GetLocalizationManager().getBadgeName(key);
if(!badgeName || !badgeName.length) badgeName = `badge_name_${ key }`;

View File

@ -1,6 +1,6 @@
import { GetNitroInstance } from '..';
import { GetLocalizationManager } from '@nitrots/nitro-renderer';
export function LocalizeText(key: string, parameters: string[] = null, replacements: string[] = null): string
{
return GetNitroInstance().getLocalizationWithParameters(key, parameters, replacements);
return GetLocalizationManager().getValueWithParameters(key, parameters, replacements);
}

View File

@ -1,6 +1,5 @@
import { CatalogPageMessageProductData } from '@nitrots/nitro-renderer';
import { CatalogPageMessageProductData, GetRoomEngine } from '@nitrots/nitro-renderer';
import { FurniCategory } from '../inventory';
import { GetRoomEngine } from '../nitro';
export class ProductImageUtility
{

View File

@ -1,13 +1,15 @@
export * from './CloneObject';
export * from './ColorUtils';
export * from './ConvertSeconds';
export * from './FixedSizeStack';
export * from './FriendlyTime';
export * from './GetLocalStorage';
export * from './LocalStorageKeys';
export * from './LocalizeBadgeDescription';
export * from './LocalizeBageName';
export * from './LocalizeFormattedNumber';
export * from './LocalizeShortNumber';
export * from './LocalizeText';
export * from './LocalStorageKeys';
export * from './PlaySound';
export * from './ProductImageUtility';
export * from './Randomizer';

View File

@ -1,95 +0,0 @@
import { ColorConverter, NitroFilter } from '@nitrots/nitro-renderer';
const vertex = `
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
void main(void)
{
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
vTextureCoord = aTextureCoord;
}`;
const fragment = `
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform vec3 lineColor;
uniform vec3 color;
void main(void) {
vec4 currentColor = texture2D(uSampler, vTextureCoord);
vec3 colorLine = lineColor * currentColor.a;
vec3 colorOverlay = color * currentColor.a;
if(currentColor.r == 0.0 && currentColor.g == 0.0 && currentColor.b == 0.0 && currentColor.a > 0.0) {
gl_FragColor = vec4(colorLine.r, colorLine.g, colorLine.b, currentColor.a);
} else if(currentColor.a > 0.0) {
gl_FragColor = vec4(colorOverlay.r, colorOverlay.g, colorOverlay.b, currentColor.a);
}
}`;
export class WiredSelectionFilter extends NitroFilter
{
private _lineColor: number;
private _color: number;
constructor(lineColor: number | number[], color: number | number[])
{
super(vertex, fragment);
this.uniforms.lineColor = new Float32Array(3);
this.uniforms.color = new Float32Array(3);
this.lineColor = lineColor;
this.color = color;
}
public get lineColor(): number | number[]
{
return this._lineColor;
}
public set lineColor(value: number | number[])
{
const arr = this.uniforms.lineColor;
if(typeof value === 'number')
{
ColorConverter.hex2rgb(value, arr);
this._lineColor = value;
}
else
{
arr[0] = value[0];
arr[1] = value[1];
arr[2] = value[2];
this._lineColor = ColorConverter.rgb2hex(arr);
}
}
public get color(): number | number[]
{
return this._color;
}
public set color(value: number | number[])
{
const arr = this.uniforms.color;
if(typeof value === 'number')
{
ColorConverter.hex2rgb(value, arr);
this._color = value;
}
else
{
arr[0] = value[0];
arr[1] = value[1];
arr[2] = value[2];
this._color = ColorConverter.rgb2hex(arr);
}
}
}

View File

@ -1,10 +1,9 @@
import { IRoomObject, IRoomObjectSpriteVisualization, NitroFilter, RoomObjectCategory } from '@nitrots/nitro-renderer';
import { WiredSelectionFilter } from '.';
import { GetRoomEngine } from '..';
import { GetRoomEngine, IRoomObject, IRoomObjectSpriteVisualization, NitroFilter, RoomObjectCategory } from '@nitrots/nitro-renderer';
export class WiredSelectionVisualizer
{
private static _selectionShader: NitroFilter = new WiredSelectionFilter([ 1, 1, 1 ], [ 0.6, 0.6, 0.6 ]);
// private static _selectionShader: NitroFilter = new WiredSelectionFilter([ 1, 1, 1 ], [ 0.6, 0.6, 0.6 ]);
private static _selectionShader: NitroFilter = null;
public static show(furniId: number): void
{
@ -49,7 +48,7 @@ export class WiredSelectionVisualizer
for(const sprite of visualization.sprites)
{
if(sprite.blendMode === 1) continue; // BLEND_MODE: ADD
if(sprite.blendMode === 'add') continue;
sprite.filters = [ WiredSelectionVisualizer._selectionShader ];
}

View File

@ -3,7 +3,6 @@ export * from './WiredActionLayoutCode';
export * from './WiredConditionLayoutCode';
export * from './WiredDateToString';
export * from './WiredFurniType';
export * from './WiredSelectionFilter';
export * from './WiredSelectionVisualizer';
export * from './WiredStringDelimeter';
export * from './WiredTriggerLayoutCode';

View File

@ -1,6 +1,7 @@
//
// Base styles
//
@use 'sass:math';
.alert {
position: relative;
@ -48,7 +49,7 @@
$alert-border: shift-color($value, $alert-border-scale);
$alert-color: shift-color($value, $alert-color-scale);
@if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) {
$alert-color: mix($value, color-contrast($alert-background), abs($alert-color-scale));
$alert-color: mix($value, color-contrast($alert-background), math.abs($alert-color-scale));
}
.alert-#{$state} {
@include alert-variant($alert-background, $alert-border, $alert-color);

View File

@ -4,6 +4,8 @@
// Ascending
// Used to evaluate Sass maps like our grid breakpoints.
@use 'sass:math';
@mixin _assert-ascending($map, $map-name) {
$prev-key: null;
$prev-num: null;
@ -255,8 +257,8 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
@function divide($dividend, $divisor, $precision: 10) {
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
$dividend: abs($dividend);
$divisor: abs($divisor);
$dividend: math.abs($dividend);
$divisor: math.abs($divisor);
@if $dividend == 0 {
@return 0;
}

View File

@ -2,6 +2,8 @@
//
// Easily usable on <ul>, <ol>, or <div>.
@use 'sass:math';
.list-group {
display: flex;
flex-direction: column;
@ -166,7 +168,7 @@
$list-group-variant-bg: shift-color($value, $list-group-item-bg-scale);
$list-group-variant-color: shift-color($value, $list-group-item-color-scale);
@if (contrast-ratio($list-group-variant-bg, $list-group-variant-color) < $min-contrast-ratio) {
$list-group-variant-color: mix($value, color-contrast($list-group-variant-bg), abs($list-group-item-color-scale));
$list-group-variant-color: mix($value, color-contrast($list-group-variant-bg), math.abs($list-group-item-color-scale));
}
@include list-group-item-variant($state, $list-group-variant-bg, $list-group-variant-color);

View File

@ -7,6 +7,7 @@
// Licensed under MIT (https://github.com/twbs/rfs/blob/main/LICENSE)
// Configuration
@use 'sass:math';
// Base value
$rfs-base-value: 1.25rem !default;
@ -54,8 +55,8 @@ $rfs-base-value-unit: unit($rfs-base-value);
@function divide($dividend, $divisor, $precision: 10) {
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
$dividend: abs($dividend);
$divisor: abs($divisor);
$dividend: math.abs($dividend);
$divisor: math.abs($divisor);
@if $dividend == 0 {
@return 0;
}
@ -250,15 +251,15 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height
$value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value)));
// Only add the media query if the value is greater than the minimum value
@if abs($value) <= $rfs-base-value or not $enable-rfs {
@if math.abs($value) <= $rfs-base-value or not $enable-rfs {
$val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px);
}
@else {
// Calculate the minimum value
$value-min: $rfs-base-value + divide(abs($value) - $rfs-base-value, $rfs-factor);
$value-min: $rfs-base-value + divide(math.abs($value) - $rfs-base-value, $rfs-factor);
// Calculate difference between $value and the minimum value
$value-diff: abs($value) - $value-min;
$value-diff: math.abs($value) - $value-min;
// Base value formatting
$min-width: if($rfs-unit == rem, #{divide($value-min, $rfs-rem-value)}rem, #{$value-min}px);

View File

@ -1,6 +1,5 @@
import { AvatarScaleType, AvatarSetType } from '@nitrots/nitro-renderer';
import { AvatarScaleType, AvatarSetType, GetAvatarRenderManager } from '@nitrots/nitro-renderer';
import { CSSProperties, FC, useEffect, useMemo, useRef, useState } from 'react';
import { GetAvatarRenderManager } from '../../api';
import { Base, BaseProps } from '../Base';
export interface LayoutAvatarImageViewProps extends BaseProps<HTMLDivElement>

View File

@ -1,6 +1,6 @@
import { BadgeImageReadyEvent, NitroEventDispatcher, NitroSprite, TextureUtils } from '@nitrots/nitro-renderer';
import { BadgeImageReadyEvent, GetEventDispatcher, GetSessionDataManager, NitroSprite, TextureUtils } from '@nitrots/nitro-renderer';
import { CSSProperties, FC, useEffect, useMemo, useState } from 'react';
import { GetConfiguration, GetSessionDataManager, LocalizeBadgeDescription, LocalizeBadgeName, LocalizeText } from '../../api';
import { GetConfigurationValue, LocalizeBadgeDescription, LocalizeBadgeName, LocalizeText } from '../../api';
import { Base, BaseProps } from '../Base';
export interface LayoutBadgeImageViewProps extends BaseProps<HTMLDivElement>
@ -37,7 +37,7 @@ export const LayoutBadgeImageView: FC<LayoutBadgeImageViewProps> = props =>
if(imageElement)
{
newStyle.backgroundImage = `url(${ (isGroup) ? imageElement.src : GetConfiguration<string>('badge.asset.url').replace('%badgename%', badgeCode.toString()) })`;
newStyle.backgroundImage = `url(${ (isGroup) ? imageElement.src : GetConfigurationValue<string>('badge.asset.url').replace('%badgename%', badgeCode.toString()) })`;
newStyle.width = imageElement.width;
newStyle.height = imageElement.height;
@ -73,10 +73,10 @@ export const LayoutBadgeImageView: FC<LayoutBadgeImageViewProps> = props =>
didSetBadge = true;
NitroEventDispatcher.removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
GetEventDispatcher().removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
}
NitroEventDispatcher.addEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
GetEventDispatcher().addEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
const texture = isGroup ? GetSessionDataManager().getGroupBadgeImage(badgeCode) : GetSessionDataManager().getBadgeImage(badgeCode);
@ -90,12 +90,12 @@ export const LayoutBadgeImageView: FC<LayoutBadgeImageViewProps> = props =>
})();
}
return () => NitroEventDispatcher.removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
return () => GetEventDispatcher().removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
}, [ badgeCode, isGroup ]);
return (
<Base classNames={ getClassNames } style={ getStyle } { ...rest }>
{ (showInfo && GetConfiguration<boolean>('badge.descriptions.enabled', true)) &&
{ (showInfo && GetConfigurationValue<boolean>('badge.descriptions.enabled', true)) &&
<Base className="badge-information text-black py-1 px-2 small">
<div className="fw-bold mb-1">{ isGroup ? customTitle : LocalizeBadgeName(badgeCode) }</div>
<div>{ isGroup ? LocalizeText('group.badgepopup.body') : LocalizeBadgeDescription(badgeCode) }</div>

View File

@ -1,5 +1,5 @@
import { CSSProperties, FC, useMemo } from 'react';
import { GetConfiguration } from '../../api';
import { GetConfigurationValue } from '../../api';
import { Base, BaseProps } from '../Base';
export interface CurrencyIconProps extends BaseProps<HTMLDivElement>
@ -22,7 +22,7 @@ export const LayoutCurrencyIcon: FC<CurrencyIconProps> = props =>
const urlString = useMemo(() =>
{
let url = GetConfiguration<string>('currency.asset.icon.url', '');
let url = GetConfigurationValue<string>('currency.asset.icon.url', '');
url = url.replace('%type%', type.toString());

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