mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 07:30:51 +01:00
Move navigator models to ui-config
This commit is contained in:
parent
dc89f4117a
commit
803ba76285
@ -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,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,7 +13,8 @@ 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 getRoomModelImage = (name: string) => GetConfiguration<string>('images.url') + `/navigator/models/model_${ name }.png`;
|
||||
@ -22,13 +23,13 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
|
||||
{
|
||||
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 +49,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,7 +101,7 @@ 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">
|
||||
|
Loading…
Reference in New Issue
Block a user