Add option to disable hc

This commit is contained in:
Bill 2022-03-15 02:33:36 -04:00
parent 78d13a7571
commit 77e0de6128
8 changed files with 29 additions and 20 deletions

View File

@ -12,6 +12,7 @@
"widget.dimmer.colorwheel": false,
"avatar.wardrobe.max.slots": 10,
"user.badges.max.slots": 5,
"hc.disabled": false,
"hotelview": {
"widgets": {
"slot.1.widget": "promoarticle",

View File

@ -1,5 +1,5 @@
import { AvatarExpressionEnum, HabboClubLevelEnum, NitroEvent, RoomControllerLevel, RoomRotatingEffect, RoomSessionChatEvent, RoomSettingsComposer, RoomShakingEffect, RoomWidgetEnum, RoomZoomEvent, TextureUtils } from '@nitrots/nitro-renderer';
import { GetConfiguration, GetNitroInstance, SendMessageComposer } from '../../..';
import { GetClubMemberLevel, GetConfiguration, GetNitroInstance, SendMessageComposer } from '../../..';
import { GetRoomEngine, GetSessionDataManager, LocalizeText, NotificationUtilities } from '../../../..';
import { FloorplanEditorEvent } from '../../../../../events/floorplan-editor/FloorplanEditorEvent';
import { DispatchUiEvent } from '../../../../../hooks';
@ -77,7 +77,7 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
return null;
case ':d':
case ';d':
if(GetSessionDataManager().clubLevel === HabboClubLevelEnum.VIP)
if(GetClubMemberLevel() === HabboClubLevelEnum.VIP)
{
this.container.roomSession.sendExpressionMessage(AvatarExpressionEnum.LAUGH.ordinal);
}
@ -89,7 +89,7 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
return null;
case ':kiss':
if(GetSessionDataManager().clubLevel === HabboClubLevelEnum.VIP)
if(GetClubMemberLevel() === HabboClubLevelEnum.VIP)
{
this.container.roomSession.sendExpressionMessage(AvatarExpressionEnum.BLOW.ordinal);
@ -98,7 +98,7 @@ export class RoomWidgetChatInputHandler extends RoomWidgetHandler
break;
case ':jump':
if(GetSessionDataManager().clubLevel === HabboClubLevelEnum.VIP)
if(GetClubMemberLevel() === HabboClubLevelEnum.VIP)
{
this.container.roomSession.sendExpressionMessage(AvatarExpressionEnum.JUMP.ordinal);

View File

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

View File

@ -1,6 +1,6 @@
import { IAvatarFigureContainer, SaveWardrobeOutfitMessageComposer } from '@nitrots/nitro-renderer';
import { Dispatch, FC, SetStateAction, useCallback, useMemo } from 'react';
import { GetAvatarRenderManager, GetSessionDataManager, SendMessageComposer } from '../../../../api';
import { GetAvatarRenderManager, GetClubMemberLevel, SendMessageComposer } from '../../../../api';
import { AutoGrid, Base, Button, Flex, LayoutAvatarImageView, LayoutCurrencyIcon, LayoutGridItem } from '../../../../common';
import { FigureData } from '../../common/FigureData';
@ -61,7 +61,7 @@ export const AvatarEditorWardrobeView: FC<AvatarEditorWardrobeViewProps> = props
<Flex gap={ 1 } className="button-container">
<Button variant="link" fullWidth onClick={ event => saveFigureAtWardrobeIndex(index) }>Save</Button>
{ figureContainer &&
<Button variant="link" fullWidth onClick={ event => wearFigureAtIndex(index) } disabled={ (clubLevel > GetSessionDataManager().clubLevel) }>Use</Button> }
<Button variant="link" fullWidth onClick={ event => wearFigureAtIndex(index) } disabled={ (clubLevel > GetClubMemberLevel()) }>Use</Button> }
</Flex>
</LayoutGridItem>
);

View File

@ -1,7 +1,7 @@
/* eslint-disable no-template-curly-in-string */
import { HabboClubLevelEnum, RoomCreateComposer } from '@nitrots/nitro-renderer';
import { FC, useEffect, useState } from 'react';
import { GetConfiguration, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../../api';
import { GetClubMemberLevel, GetConfiguration, LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, Text } from '../../../../common';
import { BatchUpdates } from '../../../../hooks';
import { IRoomModel, RoomModels } from '../../common/RoomModels';
@ -25,7 +25,7 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
{
if(!model) return;
if(model.clubLevel > GetSessionDataManager().clubLevel) return;
if(model.clubLevel > GetClubMemberLevel()) return;
setSelectedModelName(name);
}
@ -99,7 +99,7 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
{
RoomModels.map(model =>
{
return (<LayoutGridItem fullHeight key={ model.name } onClick={ () => selectModel(model) } itemActive={ (selectedModelName === model.name) } overflow="unset" gap={ 0 } className="p-1" disabled={ (GetSessionDataManager().clubLevel < model.clubLevel) }>
return (<LayoutGridItem fullHeight key={ model.name } onClick={ () => selectModel(model) } itemActive={ (selectedModelName === model.name) } overflow="unset" gap={ 0 } className="p-1" disabled={ (GetClubMemberLevel() < model.clubLevel) }>
<Flex fullHeight center overflow="hidden">
<img alt="" src={ getRoomModelImage(model.name) } />
</Flex>

View File

@ -16,6 +16,7 @@ export const PurseView: FC<{}> = props =>
{
const [ purse, setPurse ] = useState<IPurse>(new Purse());
const hcDisabled = useMemo(() => GetConfiguration<boolean>('hc.disabled', false), []);
const displayedCurrencies = useMemo(() => GetConfiguration<number[]>('system.currency.types', []), []);
const currencyDisplayNumberShort = useMemo(() => GetConfiguration<boolean>('currency.display.number.short', false), []);
@ -152,12 +153,14 @@ export const PurseView: FC<{}> = props =>
useEffect(() =>
{
if(hcDisabled) return;
SendMessageComposer(new UserSubscriptionComposer('habbo_club'));
const interval = setInterval(() => SendMessageComposer(new UserSubscriptionComposer('habbo_club')), 50000);
return () => clearInterval(interval);
}, [ purse ]);
}, [ hcDisabled ]);
useEffect(() =>
{
@ -168,17 +171,18 @@ export const PurseView: FC<{}> = props =>
return (
<PurseContextProvider value={ { purse } }>
<Column className="nitro-purse-container" gap={ 1 }>
<Column alignItems="end" className="nitro-purse-container" gap={ 1 }>
<Flex className="nitro-purse rounded-bottom p-1">
<Grid fullWidth gap={ 1 }>
<Column justifyContent="center" size={ 6 } gap={ 0 }>
<Column justifyContent="center" size={ hcDisabled ? 10 : 6 } gap={ 0 }>
<CurrencyView type={ -1 } amount={ purse.credits } short={ currencyDisplayNumberShort } />
{ getCurrencyElements(0, 2) }
</Column>
<Column center pointer size={ 4 } gap={ 1 } className="nitro-purse-subscription rounded" onClick={ event => DispatchUiEvent(new HcCenterEvent(HcCenterEvent.TOGGLE_HC_CENTER)) }>
<LayoutCurrencyIcon type="hc" />
<Text variant="white">{ getClubText }</Text>
</Column>
{ !hcDisabled &&
<Column center pointer size={ 4 } gap={ 1 } className="nitro-purse-subscription rounded" onClick={ event => DispatchUiEvent(new HcCenterEvent(HcCenterEvent.TOGGLE_HC_CENTER)) }>
<LayoutCurrencyIcon type="hc" />
<Text variant="white">{ getClubText }</Text>
</Column> }
<Column justifyContent="center" size={ 2 } gap={ 0 }>
<Flex center pointer fullHeight className="nitro-purse-button p-1 rounded" onClick={ event => CreateLinkEvent('help/show') }>
<i className="icon icon-help"/>

View File

@ -1,7 +1,7 @@
import { HabboClubLevelEnum, RoomControllerLevel } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import { GetConfiguration, GetSessionDataManager, LocalizeText, RoomWidgetChatMessage, RoomWidgetChatTypingMessage, RoomWidgetUpdateChatInputContentEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
import { GetClubMemberLevel, GetConfiguration, GetSessionDataManager, LocalizeText, RoomWidgetChatMessage, RoomWidgetChatTypingMessage, RoomWidgetUpdateChatInputContentEvent, RoomWidgetUpdateInfostandUserEvent, RoomWidgetUpdateRoomObjectEvent } from '../../../../api';
import { UseEventDispatcherHook } from '../../../../hooks';
import { useRoomContext } from '../../RoomContext';
import { ChatInputStyleSelectorView } from './ChatInputStyleSelectorView';
@ -240,7 +240,7 @@ export const ChatInputView: FC<{}> = props =>
if(GetConfiguration<number[]>('chat.styles.disabled').indexOf(style.styleId) >= 0) continue;
if(style.isHcOnly && (GetSessionDataManager().clubLevel >= HabboClubLevelEnum.CLUB))
if(style.isHcOnly && (GetClubMemberLevel() >= HabboClubLevelEnum.CLUB))
{
styleIds.push(style.styleId);

View File

@ -1,6 +1,6 @@
import { AvatarFigurePartType, FurnitureMannequinSaveLookComposer, FurnitureMannequinSaveNameComposer, FurnitureMultiStateComposer, HabboClubLevelEnum, IAvatarFigureContainer, RoomControllerLevel } from '@nitrots/nitro-renderer';
import { FC, KeyboardEvent, useCallback, useEffect, useState } from 'react';
import { GetAvatarRenderManager, GetSessionDataManager, LocalizeText, RoomWidgetUpdateMannequinEvent, SendMessageComposer } from '../../../../../api';
import { GetAvatarRenderManager, GetClubMemberLevel, GetSessionDataManager, LocalizeText, RoomWidgetUpdateMannequinEvent, SendMessageComposer } from '../../../../../api';
import { Base, Button, Column, Flex, LayoutAvatarImageView, LayoutCurrencyIcon, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../../common';
import { BatchUpdates, UseEventDispatcherHook } from '../../../../../hooks';
import { useRoomContext } from '../../../RoomContext';
@ -61,7 +61,7 @@ export const FurnitureMannequinView: FC<{}> = props =>
setMode(MODE_WRONG_GENDER);
}
else if(GetSessionDataManager().clubLevel < figureClubLevel)
else if(GetClubMemberLevel() < figureClubLevel)
{
setMode(MODE_NO_CLUB);
}