diff --git a/package.json b/package.json index 1270c575..629b9eb1 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,11 @@ "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/free-solid-svg-icons": "^6.1.1", "@fortawesome/react-fontawesome": "^0.2.0", - "@nitrots/nitro-renderer": "^1.4.2", + "@nitrots/nitro-renderer": "^1.4.4", "@tanstack/react-virtual": "^3.0.0-beta.18", "animate.css": "^4.1.1", "cross-env": "^7.0.3", - "emoji-toolkit": "^6.6.0", + "emoji-toolkit": "^7.0.0", "react": "^18.2.0", "react-bootstrap": "^2.2.2", "react-dom": "^18.2.0", diff --git a/src/api/inventory/FurnitureItem.ts b/src/api/inventory/FurnitureItem.ts index 2ad27ce5..f5f2f0fa 100644 --- a/src/api/inventory/FurnitureItem.ts +++ b/src/api/inventory/FurnitureItem.ts @@ -1,5 +1,4 @@ -import { IFurnitureItemData, IObjectData } from '@nitrots/nitro-renderer'; -import { GetNitroInstance } from '../nitro'; +import { GetTickerTime, IFurnitureItemData, IObjectData } from '@nitrots/nitro-renderer'; import { IFurnitureItem } from './IFurnitureItem'; export class FurnitureItem implements IFurnitureItem @@ -123,7 +122,7 @@ export class FurnitureItem implements IFurnitureItem if(this._hasRentPeriodStarted) { - time = (this._secondsToExpiration - ((GetNitroInstance().time - this._expirationTimeStamp) / 1000)); + time = (this._secondsToExpiration - ((GetTickerTime() - this._expirationTimeStamp) / 1000)); if(time < 0) time = 0; } diff --git a/src/api/nitro/GetTicker.ts b/src/api/nitro/GetTicker.ts deleted file mode 100644 index 9d02551f..00000000 --- a/src/api/nitro/GetTicker.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { GetNitroInstance } from './GetNitroInstance'; - -export function GetTicker() -{ - return GetNitroInstance().ticker; -} diff --git a/src/api/nitro/index.ts b/src/api/nitro/index.ts index c5af3a30..fbd85328 100644 --- a/src/api/nitro/index.ts +++ b/src/api/nitro/index.ts @@ -9,7 +9,6 @@ export * from './GetConfiguration'; export * from './GetConnection'; export * from './GetLocalization'; export * from './GetNitroInstance'; -export * from './GetTicker'; export * from './OpenUrl'; export * from './RemoveLinkEventTracker'; export * from './RemoveWorkerEventTracker'; diff --git a/src/api/purse/Purse.ts b/src/api/purse/Purse.ts index a0a54b4c..25192420 100644 --- a/src/api/purse/Purse.ts +++ b/src/api/purse/Purse.ts @@ -1,5 +1,4 @@ -import { HabboClubLevelEnum } from '@nitrots/nitro-renderer'; -import { GetNitroInstance } from '..'; +import { GetTickerTime, HabboClubLevelEnum } from '@nitrots/nitro-renderer'; import { IPurse } from './IPurse'; export class Purse implements IPurse @@ -42,7 +41,7 @@ export class Purse implements IPurse public set credits(credits: number) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._credits = credits; } @@ -53,7 +52,7 @@ export class Purse implements IPurse public set activityPoints(k: Map) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._activityPoints = k; } @@ -64,7 +63,7 @@ export class Purse implements IPurse public set clubDays(k: number) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._clubDays = k; } @@ -75,7 +74,7 @@ export class Purse implements IPurse public set clubPeriods(k: number) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._clubPeriods = k; } @@ -101,7 +100,7 @@ export class Purse implements IPurse public set pastClubDays(k: number) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._pastClubDays = k; } @@ -112,7 +111,7 @@ export class Purse implements IPurse public set pastVipDays(k: number) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._pastVipDays = k; } @@ -128,14 +127,14 @@ export class Purse implements IPurse public get minutesUntilExpiration(): number { - var k: number = ((GetNitroInstance().time - this._lastUpdated) / (1000 * 60)); + var k: number = ((GetTickerTime() - this._lastUpdated) / (1000 * 60)); var _local_2: number = (this._minutesUntilExpiration - k); return (_local_2 > 0) ? _local_2 : 0; } public set minutesUntilExpiration(k: number) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._minutesUntilExpiration = k; } @@ -146,7 +145,7 @@ export class Purse implements IPurse public set minutesSinceLastModified(k: number) { - this._lastUpdated = GetNitroInstance().time; + this._lastUpdated = GetTickerTime(); this._minutesSinceLastModified = k; } diff --git a/src/api/room/widgets/AvatarInfoUtilities.ts b/src/api/room/widgets/AvatarInfoUtilities.ts index 5162a00e..ea2123bd 100644 --- a/src/api/room/widgets/AvatarInfoUtilities.ts +++ b/src/api/room/widgets/AvatarInfoUtilities.ts @@ -1,5 +1,5 @@ -import { IFurnitureData, IRoomModerationSettings, IRoomPetData, IRoomUserData, ObjectDataFactory, PetFigureData, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomTradingLevelEnum, RoomWidgetEnumItemExtradataParameter, Vector3d } from '@nitrots/nitro-renderer'; -import { GetNitroInstance, GetRoomEngine, GetRoomSession, GetSessionDataManager, IsOwnerOfFurniture } from '../../nitro'; +import { GetTickerTime, IFurnitureData, IRoomModerationSettings, IRoomPetData, IRoomUserData, ObjectDataFactory, PetFigureData, PetType, RoomControllerLevel, RoomModerationSettings, RoomObjectCategory, RoomObjectType, RoomObjectVariable, RoomTradingLevelEnum, RoomWidgetEnumItemExtradataParameter, Vector3d } from '@nitrots/nitro-renderer'; +import { GetRoomEngine, GetRoomSession, GetSessionDataManager, IsOwnerOfFurniture } from '../../nitro'; import { LocalizeText } from '../../utils'; import { AvatarInfoFurni } from './AvatarInfoFurni'; import { AvatarInfoName } from './AvatarInfoName'; @@ -139,7 +139,7 @@ export class AvatarInfoUtilities const expiryTime = model.getValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME); const expiryTimestamp = model.getValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP); - furniInfo.expiration = ((expiryTime < 0) ? expiryTime : Math.max(0, (expiryTime - ((GetNitroInstance().time - expiryTimestamp) / 1000)))); + furniInfo.expiration = ((expiryTime < 0) ? expiryTime : Math.max(0, (expiryTime - ((GetTickerTime() - expiryTimestamp) / 1000)))); let roomObjectImage = GetRoomEngine().getRoomObjectImage(roomSession.roomId, objectId, category, new Vector3d(180), 64, null); diff --git a/src/common/layout/LayoutRoomPreviewerView.tsx b/src/common/layout/LayoutRoomPreviewerView.tsx index d115e22f..69fbea84 100644 --- a/src/common/layout/LayoutRoomPreviewerView.tsx +++ b/src/common/layout/LayoutRoomPreviewerView.tsx @@ -1,6 +1,5 @@ -import { ColorConverter, IRoomRenderingCanvas, RoomPreviewer, TextureUtils } from '@nitrots/nitro-renderer'; +import { ColorConverter, GetTicker, IRoomRenderingCanvas, RoomPreviewer, TextureUtils } from '@nitrots/nitro-renderer'; import { FC, MouseEvent, ReactNode, useEffect, useRef, useState } from 'react'; -import { GetNitroInstance } from '../../api'; export interface LayoutRoomPreviewerViewProps { @@ -65,7 +64,7 @@ export const LayoutRoomPreviewerView: FC = props = } } - GetNitroInstance().ticker.add(update); + GetTicker().add(update); const resizeObserver = new ResizeObserver(() => { @@ -84,7 +83,7 @@ export const LayoutRoomPreviewerView: FC = props = { resizeObserver.disconnect(); - GetNitroInstance().ticker.remove(update); + GetTicker().remove(update); } }, [ renderingCanvas, roomPreviewer, elementRef, height ]); diff --git a/src/components/room/widgets/context-menu/ContextMenuView.tsx b/src/components/room/widgets/context-menu/ContextMenuView.tsx index 7b80bf80..9df5bd6f 100644 --- a/src/components/room/widgets/context-menu/ContextMenuView.tsx +++ b/src/components/room/widgets/context-menu/ContextMenuView.tsx @@ -1,6 +1,6 @@ -import { FixedSizeStack, NitroPoint, NitroRectangle, RoomObjectType } from '@nitrots/nitro-renderer'; +import { FixedSizeStack, GetTicker, NitroPoint, NitroRectangle, RoomObjectType } from '@nitrots/nitro-renderer'; import { CSSProperties, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { GetNitroInstance, GetRoomObjectBounds, GetRoomObjectScreenLocation, GetRoomSession, GetTicker } from '../../../../api'; +import { GetNitroInstance, GetRoomObjectBounds, GetRoomObjectScreenLocation, GetRoomSession } from '../../../../api'; import { Base, BaseProps } from '../../../../common'; import { ContextMenuCaretView } from './ContextMenuCaretView'; diff --git a/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx b/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx index ce8e8a82..804462d6 100644 --- a/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx +++ b/src/components/room/widgets/furniture/FurnitureBackgroundColorView.tsx @@ -20,7 +20,7 @@ export const FurnitureBackgroundColorView: FC<{}> = props => setHue(event) } thumbClassName={ 'thumb degree' } @@ -31,10 +31,10 @@ export const FurnitureBackgroundColorView: FC<{}> = props => setSaturation(event) } - thumbClassName={ 'thumb percent' } + thumbClassName={ 'thumb degree' } renderThumb={ (props, state) =>
{ state.valueNow }
} /> @@ -42,10 +42,10 @@ export const FurnitureBackgroundColorView: FC<{}> = props => setLightness(event) } - thumbClassName={ 'thumb percent' } + thumbClassName={ 'thumb degree' } renderThumb={ (props, state) =>
{ state.valueNow }
} />
diff --git a/src/components/room/widgets/object-location/ObjectLocationView.tsx b/src/components/room/widgets/object-location/ObjectLocationView.tsx index acd21fb1..237090b7 100644 --- a/src/components/room/widgets/object-location/ObjectLocationView.tsx +++ b/src/components/room/widgets/object-location/ObjectLocationView.tsx @@ -1,5 +1,6 @@ +import { GetTicker } from '@nitrots/nitro-renderer'; import { FC, useEffect, useRef, useState } from 'react'; -import { GetNitroInstance, GetRoomObjectBounds, GetRoomSession } from '../../../../api'; +import { GetRoomObjectBounds, GetRoomSession } from '../../../../api'; import { Base, BaseProps } from '../../../../common'; interface ObjectLocationViewProps extends BaseProps @@ -47,12 +48,12 @@ export const ObjectLocationView: FC = props => { remove = true; - GetNitroInstance().ticker.add(updatePosition); + GetTicker().add(updatePosition); } return () => { - if(remove) GetNitroInstance().ticker.remove(updatePosition); + if(remove) GetTicker().remove(updatePosition); } }, [ objectId, category, noFollow ]); diff --git a/src/hooks/catalog/useCatalog.ts b/src/hooks/catalog/useCatalog.ts index 785f6f52..9317cc3f 100644 --- a/src/hooks/catalog/useCatalog.ts +++ b/src/hooks/catalog/useCatalog.ts @@ -1,7 +1,7 @@ -import { BuildersClubFurniCountMessageEvent, BuildersClubPlaceRoomItemMessageComposer, BuildersClubPlaceWallItemMessageComposer, BuildersClubQueryFurniCountMessageComposer, BuildersClubSubscriptionStatusMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, FrontPageItem, FurniturePlaceComposer, FurniturePlacePaintComposer, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GiftWrappingConfigurationEvent, GuildMembershipsMessageEvent, HabboClubOffersMessageEvent, LegacyDataType, LimitedEditionSoldOutEvent, MarketplaceMakeOfferResult, NodeData, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseFromCatalogComposer, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, RoomControllerLevel, RoomEngineObjectPlacedEvent, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType, RoomObjectVariable, RoomPreviewer, SellablePetPalettesMessageEvent, Vector3d } from '@nitrots/nitro-renderer'; +import { BuildersClubFurniCountMessageEvent, BuildersClubPlaceRoomItemMessageComposer, BuildersClubPlaceWallItemMessageComposer, BuildersClubQueryFurniCountMessageComposer, BuildersClubSubscriptionStatusMessageEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPublishedMessageEvent, ClubGiftInfoEvent, FrontPageItem, FurniturePlaceComposer, FurniturePlacePaintComposer, GetCatalogIndexComposer, GetCatalogPageComposer, GetClubGiftInfo, GetGiftWrappingConfigurationComposer, GetTickerTime, GiftWrappingConfigurationEvent, GuildMembershipsMessageEvent, HabboClubOffersMessageEvent, LegacyDataType, LimitedEditionSoldOutEvent, MarketplaceMakeOfferResult, NodeData, ProductOfferEvent, PurchaseErrorMessageEvent, PurchaseFromCatalogComposer, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, RoomControllerLevel, RoomEngineObjectPlacedEvent, RoomObjectCategory, RoomObjectPlacementSource, RoomObjectType, RoomObjectVariable, RoomPreviewer, SellablePetPalettesMessageEvent, Vector3d } from '@nitrots/nitro-renderer'; import { useCallback, useEffect, useRef, useState } from 'react'; import { useBetween } from 'use-between'; -import { BuilderFurniPlaceableStatus, CatalogNode, CatalogPage, CatalogPetPalette, CatalogType, CreateLinkEvent, DispatchUiEvent, FurniCategory, GetFurnitureData, GetNitroInstance, GetProductDataForLocalization, GetRoomEngine, GetRoomSession, GiftWrappingConfiguration, ICatalogNode, ICatalogOptions, ICatalogPage, IPageLocalization, IProduct, IPurchasableOffer, IPurchaseOptions, LocalizeText, NotificationAlertType, Offer, PageLocalization, PlacedObjectPurchaseData, PlaySound, Product, ProductTypeEnum, RequestedPage, SearchResult, SendMessageComposer, SoundNames } from '../../api'; +import { BuilderFurniPlaceableStatus, CatalogNode, CatalogPage, CatalogPetPalette, CatalogType, CreateLinkEvent, DispatchUiEvent, FurniCategory, GetFurnitureData, GetProductDataForLocalization, GetRoomEngine, GetRoomSession, GiftWrappingConfiguration, ICatalogNode, ICatalogOptions, ICatalogPage, IPageLocalization, IProduct, IPurchasableOffer, IPurchaseOptions, LocalizeText, NotificationAlertType, Offer, PageLocalization, PlacedObjectPurchaseData, PlaySound, Product, ProductTypeEnum, RequestedPage, SearchResult, SendMessageComposer, SoundNames } from '../../api'; import { CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, InventoryFurniAddedEvent } from '../../events'; import { useMessageEvent, useRoomEngineEvent, useUiEvent } from '../events'; import { useNotification } from '../notification'; @@ -677,7 +677,7 @@ const useCatalogState = () => setFurniLimit(parser._Str_15864); setMaxFurniLimit(parser._Str_24094); setSecondsLeft(parser._Str_3709); - setUpdateTime(GetNitroInstance().time); + setUpdateTime(GetTickerTime()); setSecondsLeftWithGrace(parser._Str_24379); refreshBuilderStatus(); diff --git a/src/hooks/rooms/widgets/useChatInputWidget.ts b/src/hooks/rooms/widgets/useChatInputWidget.ts index e79af288..8709164d 100644 --- a/src/hooks/rooms/widgets/useChatInputWidget.ts +++ b/src/hooks/rooms/widgets/useChatInputWidget.ts @@ -1,6 +1,6 @@ -import { AvatarExpressionEnum, HabboClubLevelEnum, RoomControllerLevel, RoomEngineObjectEvent, RoomObjectCategory, RoomRotatingEffect, RoomSessionChatEvent, RoomSettingsComposer, RoomShakingEffect, RoomZoomEvent, TextureUtils } from '@nitrots/nitro-renderer'; +import { AvatarExpressionEnum, GetTicker, HabboClubLevelEnum, RoomControllerLevel, RoomEngineObjectEvent, RoomObjectCategory, RoomRotatingEffect, RoomSessionChatEvent, RoomSettingsComposer, RoomShakingEffect, RoomZoomEvent, TextureUtils } from '@nitrots/nitro-renderer'; import { useEffect, useState } from 'react'; -import { ChatMessageTypeEnum, CreateLinkEvent, GetClubMemberLevel, GetConfiguration, GetNitroInstance, GetRoomEngine, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../api'; +import { ChatMessageTypeEnum, CreateLinkEvent, GetClubMemberLevel, GetConfiguration, GetRoomEngine, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../api'; import { useRoomEngineEvent, useRoomSessionManagerEvent } from '../../events'; import { useNotification } from '../../notification'; import { useObjectSelectedEvent } from '../engine'; @@ -144,8 +144,8 @@ const useChatInputWidgetState = () => return null; case ':togglefps': { - if(GetNitroInstance().ticker.maxFPS > 0) GetNitroInstance().ticker.maxFPS = 0; - else GetNitroInstance().ticker.maxFPS = GetConfiguration('system.animation.fps'); + if(GetTicker().maxFPS > 0) GetTicker().maxFPS = 0; + else GetTicker().maxFPS = GetConfiguration('system.animation.fps'); return null; } diff --git a/yarn.lock b/yarn.lock index c256ebf2..7e5e62f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1484,10 +1484,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@nitrots/nitro-renderer@^1.4.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@nitrots/nitro-renderer/-/nitro-renderer-1.4.2.tgz#386862a1d136ac5d36866beb5265fcb90067ff58" - integrity sha512-k98vn5UaPOg3v9UGsDiGFeZu/3ZJs3c4+t41qDyxqluvij5GLIFgHrTF+D0K8M69HJ0WLX8Wzct7kJuwH9JXjw== +"@nitrots/nitro-renderer@^1.4.4": + version "1.4.4" + resolved "https://registry.yarnpkg.com/@nitrots/nitro-renderer/-/nitro-renderer-1.4.4.tgz#84d479181dd1ffc753fb82001531e447ab9942ec" + integrity sha512-Q8aSTrDB8GWXpRCNeEQtuW4/dy9EGlGUYScdvrTQAq+KvlUlZyvUJYjY6VHwfDKZx9NpvHGnlMotEyhXITGBMg== dependencies: "@pixi/app" "~6.4.2" "@pixi/basis" "~6.4.2" @@ -4731,10 +4731,10 @@ emoji-regex@^9.2.2: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== -emoji-toolkit@^6.6.0: - version "6.6.0" - resolved "https://registry.yarnpkg.com/emoji-toolkit/-/emoji-toolkit-6.6.0.tgz#e7287c43a96f940ec4c5428cd7100a40e57518f1" - integrity sha512-pEu0kow2p1N8zCKnn/L6H0F3rWUBB3P3hVjr/O5yl1fK7N9jU4vO4G7EFapC5Y3XwZLUCY0FZbOPyTkH+4V2eQ== +emoji-toolkit@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/emoji-toolkit/-/emoji-toolkit-7.0.0.tgz#63b5e5bdc63acd2e5629a0157969b94d414961fb" + integrity sha512-swoVbGlR/cyJ2ysrw1+axjRkEHAlH0myhbK1ybkv8zR6r9KpL4vzb96m3Y2j0hixUKj1Nb8YBQbk3ihB+XkpBw== emojis-list@^2.0.0: version "2.1.0" @@ -8416,9 +8416,9 @@ p-try@^2.0.0: integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== pako@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pako/-/pako-2.0.4.tgz#6cebc4bbb0b6c73b0d5b8d7e8476e2b2fbea576d" - integrity sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg== + version "2.1.0" + resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" + integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== pako@~1.0.5: version "1.0.11"