mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Merge branch 'dev' of https://git.krews.org/nitro/nitro-react into dev
This commit is contained in:
commit
212f47286c
@ -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": {
|
||||
|
6
src/api/navigator/IRoomModel.ts
Normal file
6
src/api/navigator/IRoomModel.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface IRoomModel
|
||||
{
|
||||
clubLevel: number;
|
||||
tileSize: number;
|
||||
name: string;
|
||||
}
|
@ -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' }
|
||||
];
|
@ -3,10 +3,10 @@ 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';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { GetConfiguration } from '../../../../api';
|
||||
import { LayoutCurrencyIcon, LayoutGridItem, LayoutGridItemProps } from '../../../../common';
|
||||
import { AvatarEditorGridPartItem } from '../../common/AvatarEditorGridPartItem';
|
||||
import { AvatarEditorIcon } from '../AvatarEditorIcon';
|
||||
@ -13,6 +14,8 @@ export const AvatarEditorFigureSetItemView: FC<AvatarEditorFigureSetItemViewProp
|
||||
const { partItem = null, children = null, ...rest } = props;
|
||||
const [ updateId, setUpdateId ] = useState(-1);
|
||||
|
||||
const hcDisabled = GetConfiguration<boolean>('hc.disabled', false);
|
||||
|
||||
const rerender = useCallback(() =>
|
||||
{
|
||||
setUpdateId(prevValue => (prevValue + 1));
|
||||
@ -30,7 +33,7 @@ export const AvatarEditorFigureSetItemView: FC<AvatarEditorFigureSetItemViewProp
|
||||
|
||||
return (
|
||||
<LayoutGridItem itemImage={ (partItem.isClear ? undefined : partItem.imageUrl) } itemActive={ partItem.isSelected } { ...rest }>
|
||||
{ partItem.isHC && <LayoutCurrencyIcon className="position-absolute end-1 bottom-1" type={ 'hc' } /> }
|
||||
{ !hcDisabled && partItem.isHC && <LayoutCurrencyIcon className="position-absolute end-1 bottom-1" type="hc" /> }
|
||||
{ partItem.isClear && <AvatarEditorIcon icon="clear" /> }
|
||||
{ partItem.isSellable && <AvatarEditorIcon icon="sellable" position="absolute" className="end-1 bottom-1" /> }
|
||||
{ children }
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { GetConfiguration } from '../../../../api';
|
||||
import { LayoutCurrencyIcon, LayoutGridItem, LayoutGridItemProps } from '../../../../common';
|
||||
import { AvatarEditorGridColorItem } from '../../common/AvatarEditorGridColorItem';
|
||||
|
||||
@ -12,6 +13,8 @@ export const AvatarEditorPaletteSetItem: FC<AvatarEditorPaletteSetItemProps> = p
|
||||
const { colorItem = null, children = null, ...rest } = props;
|
||||
const [ updateId, setUpdateId ] = useState(-1);
|
||||
|
||||
const hcDisabled = GetConfiguration<boolean>('hc.disabled', false);
|
||||
|
||||
const rerender = useCallback(() =>
|
||||
{
|
||||
setUpdateId(prevValue => (prevValue + 1));
|
||||
@ -26,7 +29,7 @@ export const AvatarEditorPaletteSetItem: FC<AvatarEditorPaletteSetItemProps> = p
|
||||
|
||||
return (
|
||||
<LayoutGridItem itemHighlight itemColor={ colorItem.color } itemActive={ colorItem.isSelected } className="clear-bg" { ...rest }>
|
||||
{ colorItem.isHC && <LayoutCurrencyIcon className="position-absolute end-1 bottom-1" type={ 'hc' } /> }
|
||||
{ !hcDisabled && colorItem.isHC && <LayoutCurrencyIcon className="position-absolute end-1 bottom-1" type="hc" /> }
|
||||
{ children }
|
||||
</LayoutGridItem>
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IAvatarFigureContainer, SaveWardrobeOutfitMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import { Dispatch, FC, SetStateAction, useCallback, useMemo } from 'react';
|
||||
import { GetAvatarRenderManager, GetClubMemberLevel, LocalizeText, SendMessageComposer } from '../../../../api';
|
||||
import { GetAvatarRenderManager, GetClubMemberLevel, GetConfiguration, LocalizeText, SendMessageComposer } from '../../../../api';
|
||||
import { AutoGrid, Base, Button, Flex, LayoutAvatarImageView, LayoutCurrencyIcon, LayoutGridItem } from '../../../../common';
|
||||
import { FigureData } from '../../common/FigureData';
|
||||
|
||||
@ -16,6 +16,8 @@ export const AvatarEditorWardrobeView: FC<AvatarEditorWardrobeViewProps> = props
|
||||
{
|
||||
const { figureData = null, savedFigures = [], setSavedFigures = null, loadAvatarInEditor = null } = props;
|
||||
|
||||
const hcDisabled = GetConfiguration<boolean>('hc.disabled', false);
|
||||
|
||||
const wearFigureAtIndex = useCallback((index: number) =>
|
||||
{
|
||||
if((index >= savedFigures.length) || (index < 0)) return;
|
||||
@ -57,7 +59,7 @@ export const AvatarEditorWardrobeView: FC<AvatarEditorWardrobeViewProps> = props
|
||||
{ figureContainer &&
|
||||
<LayoutAvatarImageView figure={ figureContainer.getFigureString() } gender={ gender } direction={ 2 } /> }
|
||||
<Base className="avatar-shadow" />
|
||||
{ (clubLevel > 0) && <LayoutCurrencyIcon className="position-absolute top-1 start-1" type="hc" /> }
|
||||
{ !hcDisabled && (clubLevel > 0) && <LayoutCurrencyIcon className="position-absolute top-1 start-1" type="hc" /> }
|
||||
<Flex gap={ 1 } className="button-container">
|
||||
<Button variant="link" fullWidth onClick={ event => saveFigureAtWardrobeIndex(index) }>{ LocalizeText('avatareditor.wardrobe.save') }</Button>
|
||||
{ figureContainer &&
|
||||
@ -68,7 +70,7 @@ export const AvatarEditorWardrobeView: FC<AvatarEditorWardrobeViewProps> = props
|
||||
});
|
||||
|
||||
return items;
|
||||
}, [ savedFigures, saveFigureAtWardrobeIndex, wearFigureAtIndex ]);
|
||||
}, [ savedFigures, hcDisabled, saveFigureAtWardrobeIndex, wearFigureAtIndex ]);
|
||||
|
||||
return (
|
||||
<AutoGrid columnCount={ 5 } columnMinWidth={ 80 } columnMinHeight={ 140 }>
|
||||
|
@ -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 { GetClubMemberLevel, GetConfiguration, IRoomModel, LocalizeText, RoomModels, SendMessageComposer } from '../../../api';
|
||||
import { GetClubMemberLevel, GetConfiguration, IRoomModel, LocalizeText, SendMessageComposer } from '../../../api';
|
||||
import { Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, Text } from '../../../common';
|
||||
import { useNavigatorContext } from '../NavigatorContext';
|
||||
|
||||
@ -13,22 +13,25 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
|
||||
const [ category, setCategory ] = useState<number>(null);
|
||||
const [ visitorsCount, setVisitorsCount ] = useState<number>(null);
|
||||
const [ tradesSetting, setTradesSetting ] = useState<number>(0);
|
||||
const [ selectedModelName, setSelectedModelName ] = useState<string>(RoomModels[0].name);
|
||||
const [ roomModels, setRoomModels ] = useState<IRoomModel[]>([]);
|
||||
const [ selectedModelName, setSelectedModelName ] = useState<string>('');
|
||||
const { categories = null } = useNavigatorContext();
|
||||
|
||||
const hcDisabled = GetConfiguration<boolean>('hc.disabled', false);
|
||||
|
||||
const getRoomModelImage = (name: string) => GetConfiguration<string>('images.url') + `/navigator/models/model_${ name }.png`;
|
||||
|
||||
const selectModel = (model: IRoomModel, index: number) =>
|
||||
{
|
||||
if(!model || (model.clubLevel > GetClubMemberLevel())) return;
|
||||
|
||||
setSelectedModelName(RoomModels[index].name);
|
||||
}
|
||||
setSelectedModelName(roomModels[index].name);
|
||||
};
|
||||
|
||||
const createRoom = () =>
|
||||
{
|
||||
SendMessageComposer(new RoomCreateComposer(name, description, 'model_' + selectedModelName, Number(category), Number(visitorsCount), tradesSetting));
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
@ -48,6 +51,17 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
|
||||
if(categories && categories.length) setCategory(categories[0].id);
|
||||
}, [ categories ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
const models = GetConfiguration<IRoomModel[]>('navigator.room.models');
|
||||
|
||||
if(models && models.length)
|
||||
{
|
||||
setRoomModels(models);
|
||||
setSelectedModelName(models[0].name);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Column overflow="hidden">
|
||||
<Grid overflow="hidden">
|
||||
@ -89,14 +103,14 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
|
||||
</Column>
|
||||
<Column size={ 6 } gap={ 1 } overflow="auto">
|
||||
{
|
||||
RoomModels.map((model, index )=>
|
||||
roomModels.map((model, index )=>
|
||||
{
|
||||
return (<LayoutGridItem fullHeight key={ model.name } onClick={ () => selectModel(model, index) } 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>
|
||||
<Text bold>{ model.tileSize } { LocalizeText('navigator.createroom.tilesize') }</Text>
|
||||
{ model.clubLevel > HabboClubLevelEnum.NO_CLUB && <LayoutCurrencyIcon position="absolute" className="top-1 end-1" type="hc" /> }
|
||||
{ !hcDisabled && model.clubLevel > HabboClubLevelEnum.NO_CLUB && <LayoutCurrencyIcon position="absolute" className="top-1 end-1" type="hc" /> }
|
||||
</LayoutGridItem>);
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user