mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
Merge branch 'navigator-packets' into @update/room-widgets
This commit is contained in:
commit
0121945c6a
@ -1,4 +1,4 @@
|
||||
import { RoomSettingsParser } from '@nitrots/nitro-renderer';
|
||||
import { RoomSettingsDataParser } from '@nitrots/nitro-renderer';
|
||||
|
||||
export class RoomSettingsData
|
||||
{
|
||||
@ -36,41 +36,43 @@ export class RoomSettingsData
|
||||
public bannedUsers: any[];
|
||||
public selectedUserToUnban: number;
|
||||
|
||||
constructor(parser: RoomSettingsParser)
|
||||
constructor(parser: RoomSettingsDataParser)
|
||||
{
|
||||
if(!parser) throw new Error('invalid_parser');
|
||||
|
||||
this.roomId = parser.roomId;
|
||||
this.roomName = parser.name;
|
||||
this.roomOriginalName = parser.name;
|
||||
this.roomDescription = parser.description;
|
||||
this.categoryId = parser.categoryId;
|
||||
this.userCount = parser.userCount;
|
||||
this.tags = parser.tags;
|
||||
this.tradeState = parser.tradeMode;
|
||||
this.allowWalkthrough = parser.allowWalkthrough;
|
||||
const data = parser.data;
|
||||
|
||||
this.lockState = parser.state;
|
||||
this.originalLockState = parser.state;
|
||||
this.roomId = data.roomId;
|
||||
this.roomName = data.name;
|
||||
this.roomOriginalName = data.name;
|
||||
this.roomDescription = data.description;
|
||||
this.categoryId = data.categoryId;
|
||||
this.userCount = data.maximumVisitorsLimit;
|
||||
this.tags = data.tags;
|
||||
this.tradeState = data.tradeMode;
|
||||
this.allowWalkthrough = data.allowWalkThrough;
|
||||
|
||||
this.lockState = data.doorMode;
|
||||
this.originalLockState = data.doorMode;
|
||||
this.password = null;
|
||||
this.confirmPassword = null;
|
||||
this.allowPets = parser.allowPets;
|
||||
this.allowPetsEat = parser.allowPetsEat;
|
||||
this.allowPets = data.allowPets;
|
||||
this.allowPetsEat = data.allowFoodConsume;
|
||||
|
||||
this.usersWithRights = new Map<number, string>();
|
||||
|
||||
this.hideWalls = parser.hideWalls;
|
||||
this.wallThickness = parser.thicknessWall;
|
||||
this.floorThickness = parser.thicknessFloor;
|
||||
this.chatBubbleMode = parser.chatSettings.mode;
|
||||
this.chatBubbleWeight = parser.chatSettings.weight;
|
||||
this.chatBubbleSpeed = parser.chatSettings.speed;
|
||||
this.chatFloodProtection = parser.chatSettings.protection;
|
||||
this.chatDistance = parser.chatSettings.distance;
|
||||
this.hideWalls = data.hideWalls;
|
||||
this.wallThickness = data.wallThickness;
|
||||
this.floorThickness = data.floorThickness;
|
||||
this.chatBubbleMode = data.chatSettings.mode;
|
||||
this.chatBubbleWeight = data.chatSettings.weight;
|
||||
this.chatBubbleSpeed = data.chatSettings.speed;
|
||||
this.chatFloodProtection = data.chatSettings.protection;
|
||||
this.chatDistance = data.chatSettings.distance;
|
||||
|
||||
this.muteState = parser.moderationSettings.allowMute;
|
||||
this.kickState = parser.moderationSettings.allowKick;
|
||||
this.banState = parser.moderationSettings.allowBan;
|
||||
this.muteState = data.roomModerationSettings.allowMute;
|
||||
this.kickState = data.roomModerationSettings.allowKick;
|
||||
this.banState = data.roomModerationSettings.allowBan;
|
||||
this.bannedUsers = [];
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { RoomInfoComposer } from '@nitrots/nitro-renderer';
|
||||
import { GetGuestRoomMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import { SendMessageComposer } from '../nitro';
|
||||
|
||||
export function TryVisitRoom(roomId: number): void
|
||||
{
|
||||
SendMessageComposer(new RoomInfoComposer(roomId, false, true));
|
||||
SendMessageComposer(new GetGuestRoomMessageComposer(roomId, false, true));
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { MouseEventType } from '@nitrots/nitro-renderer';
|
||||
import { NitroSoundEvent } from '@nitrots/nitro-renderer/src/nitro/events/NitroSoundEvent';
|
||||
import { MouseEventType, NitroSoundEvent } from '@nitrots/nitro-renderer';
|
||||
import { DispatchMainEvent } from '../../hooks';
|
||||
|
||||
let canPlaySound = false;
|
||||
|
@ -0,0 +1,97 @@
|
||||
import { GetRoomAdPurchaseInfoComposer, GetUserEventCatsMessageComposer, PurchaseRoomAdMessageComposer, RoomAdPurchaseInfoEvent, RoomEntryData, UserEventCatsEvent } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText, SendMessageComposer } from '../../../../../api';
|
||||
import { Base, Button, Column, Text } from '../../../../../common';
|
||||
import { UseMessageEventHook } from '../../../../../hooks';
|
||||
import { CatalogLayoutProps } from './CatalogLayout.types';
|
||||
|
||||
export const CatalogLayoutRoomAdsView: FC<CatalogLayoutProps> = props =>
|
||||
{
|
||||
const { page = null } = props;
|
||||
const [ eventName, setEventName ] = useState<string>('');
|
||||
const [ eventDesc, setEventDesc ] = useState<string>('');
|
||||
const [ roomId, setRoomId ] = useState<number>(-1);
|
||||
const [ availableRooms, setAvailableRooms ] = useState<RoomEntryData[]>([]);
|
||||
const [ extended, setExtended ] = useState<boolean>(false);
|
||||
const [ categoryId, setCategoryId ] = useState<number>(1);
|
||||
const [ categories, setCategories ] = useState<INavigatorCategory[]>(null);
|
||||
|
||||
const onRoomAdPurchaseInfoEvent = (event: RoomAdPurchaseInfoEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
setAvailableRooms(parser.rooms);
|
||||
}
|
||||
|
||||
UseMessageEventHook(RoomAdPurchaseInfoEvent, onRoomAdPurchaseInfoEvent);
|
||||
|
||||
const purchaseAd = useCallback(() =>
|
||||
{
|
||||
const pageId = page.pageId;
|
||||
const offerId = page.offers.length >= 1 ? page.offers[0].offerId : -1;
|
||||
const flatId = roomId;
|
||||
const name = eventName;
|
||||
const desc = eventDesc;
|
||||
const catId = categoryId;
|
||||
|
||||
SendMessageComposer(new PurchaseRoomAdMessageComposer(pageId, offerId, flatId, name, extended, desc, catId))
|
||||
}, [ categoryId, eventDesc, eventName, extended, page.offers, page.pageId, roomId ]);
|
||||
|
||||
|
||||
const onUserEventCatsEvent = (event: UserEventCatsEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
setCategories(parser.categories);
|
||||
}
|
||||
|
||||
UseMessageEventHook(UserEventCatsEvent, onUserEventCatsEvent);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
SendMessageComposer(new GetRoomAdPurchaseInfoComposer());
|
||||
// TODO: someone needs to fix this for morningstar
|
||||
SendMessageComposer(new GetUserEventCatsMessageComposer());
|
||||
}, []);
|
||||
|
||||
return (<>
|
||||
<Text bold center>{ LocalizeText('roomad.catalog_header') }</Text>
|
||||
<Column size={ 12 } overflow="hidden" className="text-black">
|
||||
<Base>{ LocalizeText('roomad.catalog_text') }</Base>
|
||||
<Base className="bg-muted rounded p-1">
|
||||
<Column gap={ 2 }>
|
||||
<select className="form-select form-select-sm" value={ categoryId } onChange={ event => setCategoryId(parseInt(event.target.value)) }>
|
||||
{ categories && categories.map((cat, index) => <option key={ index } value={ cat.id }>{ cat.name }</option>) }
|
||||
</select>
|
||||
</Column>
|
||||
<Column gap={ 1 }>
|
||||
<Text bold>{ LocalizeText('roomad.catalog_name') }</Text>
|
||||
<input type="text" className="form-control form-control-sm" maxLength={ 64 } value={ eventName } onChange={ event => setEventName(event.target.value) } />
|
||||
</Column>
|
||||
<Column gap={ 1 }>
|
||||
< Text bold>{ LocalizeText('roomad.catalog_description') }</Text>
|
||||
<textarea className="form-control form-control-sm" maxLength={ 64 } value={ eventDesc } onChange={ event => setEventDesc(event.target.value) }/>
|
||||
</Column>
|
||||
<Column gap={ 1 }>
|
||||
<Text bold>{ LocalizeText('roomad.catalog_roomname') }</Text>
|
||||
<select className="form-select form-select-sm" value={ roomId } onChange={ event => setRoomId(parseInt(event.target.value)) }>
|
||||
<option value={ -1 } disabled>{ LocalizeText('roomad.catalog_roomname') }</option>
|
||||
{ availableRooms && availableRooms.map((room, index) => <option key={ index } value={ room.roomId }>{ room.roomName }</option>) }
|
||||
</select>
|
||||
</Column>
|
||||
<Column gap={ 1 }>
|
||||
<Button onClick={ purchaseAd }>{ LocalizeText('buy') }</Button>
|
||||
</Column>
|
||||
</Base>
|
||||
</Column>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
interface INavigatorCategory {
|
||||
id: number;
|
||||
name: string;
|
||||
visible: boolean;
|
||||
}
|
@ -8,6 +8,7 @@ import { CatalogLayouGuildFrontpageView } from './CatalogLayoutGuildFrontpageVie
|
||||
import { CatalogLayoutInfoLoyaltyView } from './CatalogLayoutInfoLoyaltyView';
|
||||
import { CatalogLayoutPets2View } from './CatalogLayoutPets2View';
|
||||
import { CatalogLayoutPets3View } from './CatalogLayoutPets3View';
|
||||
import { CatalogLayoutRoomAdsView } from './CatalogLayoutRoomAdsView';
|
||||
import { CatalogLayoutRoomBundleView } from './CatalogLayoutRoomBundleView';
|
||||
import { CatalogLayoutSingleBundleView } from './CatalogLayoutSingleBundleView';
|
||||
import { CatalogLayoutSpacesView } from './CatalogLayoutSpacesView';
|
||||
@ -63,6 +64,8 @@ export const GetCatalogLayout = (page: ICatalogPage, hideNavigation: () => void)
|
||||
return <CatalogLayoutInfoLoyaltyView { ...layoutProps } />;
|
||||
case 'badge_display':
|
||||
return <CatalogLayoutBadgeDisplayView { ...layoutProps } />;
|
||||
case 'roomads':
|
||||
return <CatalogLayoutRoomAdsView { ...layoutProps } />;
|
||||
//case 'default_3x3_color_grouping':
|
||||
//return <CatalogLayoutColorGroupingView { ...layoutProps } />;
|
||||
case 'bots':
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { NavigatorCategoryDataParser, NavigatorSearchResultSet, NavigatorTopLevelContext, RoomDataParser } from '@nitrots/nitro-renderer';
|
||||
import { NavigatorCategoryDataParser, NavigatorEventCategoryDataParser, NavigatorSearchResultSet, NavigatorTopLevelContext, RoomDataParser } from '@nitrots/nitro-renderer';
|
||||
import { createContext, Dispatch, FC, ProviderProps, SetStateAction, useContext } from 'react';
|
||||
import { INavigatorData } from '../../api';
|
||||
|
||||
@ -6,6 +6,8 @@ interface INavigatorContext
|
||||
{
|
||||
categories: NavigatorCategoryDataParser[];
|
||||
setCategories: Dispatch<SetStateAction<NavigatorCategoryDataParser[]>>;
|
||||
eventCategories: NavigatorEventCategoryDataParser[];
|
||||
setEventCategories: Dispatch<SetStateAction<NavigatorEventCategoryDataParser[]>>;
|
||||
topLevelContext: NavigatorTopLevelContext;
|
||||
setTopLevelContext: Dispatch<SetStateAction<NavigatorTopLevelContext>>;
|
||||
topLevelContexts: NavigatorTopLevelContext[];
|
||||
@ -22,6 +24,8 @@ const NavigatorContext = createContext<INavigatorContext>({
|
||||
categories: null,
|
||||
setCategories: null,
|
||||
topLevelContext: null,
|
||||
setEventCategories: null,
|
||||
eventCategories: null,
|
||||
setTopLevelContext: null,
|
||||
topLevelContexts: null,
|
||||
setTopLevelContexts: null,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { CanCreateRoomEventEvent, CantConnectMessageParser, FollowFriendMessageComposer, GenericErrorEvent, GetGuestRoomResultEvent, HabboWebTools, LegacyExternalInterface, NavigatorCategoriesComposer, NavigatorCategoriesEvent, NavigatorHomeRoomEvent, NavigatorMetadataEvent, NavigatorOpenRoomCreatorEvent, NavigatorSearchEvent, NavigatorSettingsComposer, RoomCreatedEvent, RoomDataParser, RoomDoorbellAcceptedEvent, RoomDoorbellEvent, RoomDoorbellRejectedEvent, RoomEnterErrorEvent, RoomEntryInfoMessageEvent, RoomForwardEvent, RoomInfoComposer, RoomScoreEvent, RoomSettingsUpdatedEvent, SecurityLevel, UserInfoEvent, UserPermissionsEvent } from '@nitrots/nitro-renderer';
|
||||
import { CanCreateRoomEventEvent, CantConnectMessageParser, DoorbellMessageEvent, FlatAccessDeniedMessageEvent, FlatCreatedEvent, FollowFriendMessageComposer, GenericErrorEvent, GetGuestRoomMessageComposer, GetGuestRoomResultEvent, GetUserEventCatsMessageComposer, GetUserFlatCatsMessageComposer, HabboWebTools, LegacyExternalInterface, NavigatorHomeRoomEvent, NavigatorMetadataEvent, NavigatorOpenRoomCreatorEvent, NavigatorSearchEvent, RoomDataParser, RoomDoorbellAcceptedEvent, RoomEnterErrorEvent, RoomEntryInfoMessageEvent, RoomForwardEvent, RoomScoreEvent, RoomSettingsUpdatedEvent, SecurityLevel, UserEventCatsEvent, UserFlatCatsEvent, UserInfoEvent, UserPermissionsEvent } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback } from 'react';
|
||||
import { CreateLinkEvent, CreateRoomSession, DoorStateType, GetConfiguration, GetSessionDataManager, LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer, TryVisitRoom, VisitDesktop } from '../../api';
|
||||
import { UseMessageEventHook } from '../../hooks';
|
||||
@ -6,13 +6,13 @@ import { useNavigatorContext } from './NavigatorContext';
|
||||
|
||||
export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
{
|
||||
const { setCategories = null, setTopLevelContext = null, topLevelContexts = null, setTopLevelContexts = null, setNavigatorData = null, setDoorData = null, setSearchResult = null } = useNavigatorContext();
|
||||
const { setCategories = null, setEventCategories = null, setTopLevelContext = null, topLevelContexts = null, setTopLevelContexts = null, setNavigatorData = null, setDoorData = null, setSearchResult = null } = useNavigatorContext();
|
||||
|
||||
const onRoomSettingsUpdatedEvent = useCallback((event: RoomSettingsUpdatedEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
SendMessageComposer(new RoomInfoComposer(parser.roomId, false, false));
|
||||
SendMessageComposer(new GetGuestRoomMessageComposer(parser.roomId, false, false));
|
||||
}, []);
|
||||
|
||||
UseMessageEventHook(RoomSettingsUpdatedEvent, onRoomSettingsUpdatedEvent);
|
||||
@ -35,8 +35,8 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
|
||||
const onUserInfoEvent = useCallback((event: UserInfoEvent) =>
|
||||
{
|
||||
SendMessageComposer(new NavigatorCategoriesComposer());
|
||||
SendMessageComposer(new NavigatorSettingsComposer());
|
||||
SendMessageComposer(new GetUserFlatCatsMessageComposer());
|
||||
SendMessageComposer(new GetUserEventCatsMessageComposer());
|
||||
}, []);
|
||||
|
||||
const onUserPermissionsEvent = useCallback((event: UserPermissionsEvent) =>
|
||||
@ -80,7 +80,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
// close room settings
|
||||
// close room filter
|
||||
|
||||
SendMessageComposer(new RoomInfoComposer(parser.roomId, true, false));
|
||||
SendMessageComposer(new GetGuestRoomMessageComposer(parser.roomId, true, false));
|
||||
|
||||
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'navigator', 'private', [ parser.roomId ]);
|
||||
}, [ setNavigatorData ]);
|
||||
@ -181,7 +181,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
});
|
||||
}, [ setNavigatorData ]);
|
||||
|
||||
const onRoomDoorbellEvent = useCallback((event: RoomDoorbellEvent) =>
|
||||
const onRoomDoorbellEvent = useCallback((event: DoorbellMessageEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
@ -215,7 +215,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
}
|
||||
}, [ setDoorData ]);
|
||||
|
||||
const onRoomDoorbellRejectedEvent = useCallback((event: RoomDoorbellRejectedEvent) =>
|
||||
const onRoomDoorbellRejectedEvent = useCallback((event: FlatAccessDeniedMessageEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
@ -310,14 +310,22 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
setSearchResult(parser.result);
|
||||
}, [ topLevelContexts, setTopLevelContext, setSearchResult ]);
|
||||
|
||||
const onNavigatorCategoriesEvent = useCallback((event: NavigatorCategoriesEvent) =>
|
||||
const onNavigatorCategoriesEvent = useCallback((event: UserFlatCatsEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
setCategories(parser.categories);
|
||||
}, [ setCategories ]);
|
||||
|
||||
const onRoomCreatedEvent = useCallback((event: RoomCreatedEvent) =>
|
||||
const onNavigatorEventCategoriesEvent = (event: UserEventCatsEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
setEventCategories(parser.categories);
|
||||
console.log(parser);
|
||||
}
|
||||
|
||||
const onRoomCreatedEvent = useCallback((event: FlatCreatedEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
@ -421,14 +429,15 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
UseMessageEventHook(RoomEntryInfoMessageEvent, onRoomEntryInfoMessageEvent);
|
||||
UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent);
|
||||
UseMessageEventHook(RoomScoreEvent, onRoomScoreEvent);
|
||||
UseMessageEventHook(RoomDoorbellEvent, onRoomDoorbellEvent);
|
||||
UseMessageEventHook(DoorbellMessageEvent, onRoomDoorbellEvent);
|
||||
UseMessageEventHook(RoomDoorbellAcceptedEvent, onRoomDoorbellAcceptedEvent);
|
||||
UseMessageEventHook(RoomDoorbellRejectedEvent, onRoomDoorbellRejectedEvent);
|
||||
UseMessageEventHook(FlatAccessDeniedMessageEvent, onRoomDoorbellRejectedEvent);
|
||||
UseMessageEventHook(GenericErrorEvent, onGenericErrorEvent);
|
||||
UseMessageEventHook(NavigatorMetadataEvent, onNavigatorMetadataEvent);
|
||||
UseMessageEventHook(NavigatorSearchEvent, onNavigatorSearchEvent);
|
||||
UseMessageEventHook(NavigatorCategoriesEvent, onNavigatorCategoriesEvent);
|
||||
UseMessageEventHook(RoomCreatedEvent, onRoomCreatedEvent);
|
||||
UseMessageEventHook(UserFlatCatsEvent, onNavigatorCategoriesEvent);
|
||||
UseMessageEventHook(UserEventCatsEvent, onNavigatorEventCategoriesEvent);
|
||||
UseMessageEventHook(FlatCreatedEvent, onRoomCreatedEvent);
|
||||
UseMessageEventHook(NavigatorHomeRoomEvent, onNavigatorHomeRoomEvent);
|
||||
UseMessageEventHook(RoomEnterErrorEvent, onRoomEnterErrorEvent);
|
||||
UseMessageEventHook(NavigatorOpenRoomCreatorEvent, onRoomCreatorEvent);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { ConvertGlobalRoomIdMessageComposer, HabboWebTools, ILinkEventTracker, LegacyExternalInterface, NavigatorCategoryDataParser, NavigatorInitComposer, NavigatorSearchComposer, NavigatorSearchResultSet, NavigatorTopLevelContext, RoomDataParser, RoomSessionEvent } from '@nitrots/nitro-renderer';
|
||||
import { ConvertGlobalRoomIdMessageComposer, HabboWebTools, ILinkEventTracker, LegacyExternalInterface, NavigatorCategoryDataParser, NavigatorEventCategoryDataParser, NavigatorInitComposer, NavigatorSearchComposer, NavigatorSearchResultSet, NavigatorTopLevelContext, RoomDataParser, RoomSessionEvent } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { AddEventLinkTracker, DoorStateType, LocalizeText, RemoveLinkEventTracker, SendMessageComposer, TryVisitRoom } from '../../api';
|
||||
import { Base, Column, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
||||
@ -25,6 +25,7 @@ export const NavigatorView: FC<{}> = props =>
|
||||
const [ needsInit, setNeedsInit ] = useState(true);
|
||||
const [ needsSearch, setNeedsSearch ] = useState(false);
|
||||
const [ categories, setCategories ] = useState<NavigatorCategoryDataParser[]>(null);
|
||||
const [ eventCategories, setEventCategories ] = useState<NavigatorEventCategoryDataParser[]>(null);
|
||||
const [ topLevelContext, setTopLevelContext ] = useState<NavigatorTopLevelContext>(null);
|
||||
const [ topLevelContexts, setTopLevelContexts ] = useState<NavigatorTopLevelContext[]>(null);
|
||||
const [ navigatorData, setNavigatorData ] = useSharedNavigatorData();
|
||||
@ -207,7 +208,7 @@ export const NavigatorView: FC<{}> = props =>
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<NavigatorContextProvider value={ { categories, setCategories, topLevelContext, setTopLevelContext, topLevelContexts, setTopLevelContexts, navigatorData, setNavigatorData, doorData, setDoorData, searchResult, setSearchResult } }>
|
||||
<NavigatorContextProvider value={ { categories, setCategories, eventCategories, setEventCategories, topLevelContext, setTopLevelContext, topLevelContexts, setTopLevelContexts, navigatorData, setNavigatorData, doorData, setDoorData, searchResult, setSearchResult } }>
|
||||
<NavigatorMessageHandler />
|
||||
{ isVisible &&
|
||||
<NitroCardView uniqueKey="navigator" className="nitro-navigator">
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* eslint-disable no-template-curly-in-string */
|
||||
import { HabboClubLevelEnum, RoomCreateComposer } from '@nitrots/nitro-renderer';
|
||||
import { CreateFlatMessageComposer, HabboClubLevelEnum } from '@nitrots/nitro-renderer';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { GetClubMemberLevel, GetConfiguration, IRoomModel, LocalizeText, SendMessageComposer } from '../../../api';
|
||||
import { Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, Text } from '../../../common';
|
||||
@ -30,7 +30,7 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
|
||||
|
||||
const createRoom = () =>
|
||||
{
|
||||
SendMessageComposer(new RoomCreateComposer(name, description, 'model_' + selectedModelName, Number(category), Number(visitorsCount), tradesSetting));
|
||||
SendMessageComposer(new CreateFlatMessageComposer(name, description, 'model_' + selectedModelName, Number(category), Number(visitorsCount), tradesSetting));
|
||||
};
|
||||
|
||||
useEffect(() =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { RoomMuteComposer, RoomSettingsComposer, RoomStaffPickComposer, SecurityLevel, UserHomeRoomComposer } from '@nitrots/nitro-renderer';
|
||||
import { RoomMuteComposer, RoomSettingsComposer, SecurityLevel, ToggleStaffPickMessageComposer, UpdateHomeRoomMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import classNames from 'classnames';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { CreateLinkEvent, GetGroupInformation, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../api';
|
||||
@ -47,7 +47,7 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
||||
newRoomId = navigatorData.enteredGuestRoom.roomId;
|
||||
}
|
||||
|
||||
if(newRoomId > 0) SendMessageComposer(new UserHomeRoomComposer(newRoomId));
|
||||
if(newRoomId > 0) SendMessageComposer(new UpdateHomeRoomMessageComposer(newRoomId));
|
||||
return;
|
||||
case 'navigator_search_tag':
|
||||
return;
|
||||
@ -65,7 +65,7 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
||||
return;
|
||||
case 'toggle_pick':
|
||||
setIsRoomPicked(value => !value);
|
||||
SendMessageComposer(new RoomStaffPickComposer(navigatorData.enteredGuestRoom.roomId));
|
||||
SendMessageComposer(new ToggleStaffPickMessageComposer(navigatorData.enteredGuestRoom.roomId));
|
||||
return;
|
||||
case 'toggle_mute':
|
||||
setIsRoomMuted(value => !value);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { RoomBannedUsersComposer, RoomDataParser, RoomSettingsEvent, SaveRoomSettingsComposer } from '@nitrots/nitro-renderer';
|
||||
import { RoomBannedUsersComposer, RoomDataParser, RoomSettingsDataEvent, SaveRoomSettingsComposer } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useState } from 'react';
|
||||
import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api';
|
||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../../../common';
|
||||
@ -22,46 +22,48 @@ export const NavigatorRoomSettingsView: FC<{}> = props =>
|
||||
const [ roomData, setRoomData ] = useState<IRoomData>(null);
|
||||
const [ currentTab, setCurrentTab ] = useState(TABS[0]);
|
||||
|
||||
const onRoomSettingsEvent = useCallback((event: RoomSettingsEvent) =>
|
||||
const onRoomSettingsEvent = useCallback((event: RoomSettingsDataEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
const data = parser.data;
|
||||
|
||||
setRoomData({
|
||||
roomId: parser.roomId,
|
||||
roomName: parser.name,
|
||||
roomDescription: parser.description,
|
||||
categoryId: parser.categoryId,
|
||||
userCount: parser.userCount,
|
||||
tags: parser.tags,
|
||||
tradeState: parser.tradeMode,
|
||||
allowWalkthrough: parser.allowWalkthrough,
|
||||
lockState: parser.state,
|
||||
roomId: data.roomId,
|
||||
roomName: data.name,
|
||||
roomDescription: data.description,
|
||||
categoryId: data.categoryId,
|
||||
userCount: data.maximumVisitorsLimit,
|
||||
tags: data.tags,
|
||||
tradeState: data.tradeMode,
|
||||
allowWalkthrough: data.allowWalkThrough,
|
||||
lockState: data.doorMode,
|
||||
password: null,
|
||||
allowPets: parser.allowPets,
|
||||
allowPetsEat: parser.allowPetsEat,
|
||||
hideWalls: parser.hideWalls,
|
||||
wallThickness: parser.thicknessWall,
|
||||
floorThickness: parser.thicknessFloor,
|
||||
allowPets: data.allowPets,
|
||||
allowPetsEat: data.allowFoodConsume,
|
||||
hideWalls: data.hideWalls,
|
||||
wallThickness: data.wallThickness,
|
||||
floorThickness: data.floorThickness,
|
||||
chatSettings: {
|
||||
mode: parser.chatSettings.mode,
|
||||
weight: parser.chatSettings.weight,
|
||||
speed: parser.chatSettings.speed,
|
||||
distance: parser.chatSettings.distance,
|
||||
protection: parser.chatSettings.protection
|
||||
mode: data.chatSettings.mode,
|
||||
weight: data.chatSettings.weight,
|
||||
speed: data.chatSettings.speed,
|
||||
distance: data.chatSettings.distance,
|
||||
protection: data.chatSettings.protection
|
||||
},
|
||||
moderationSettings: {
|
||||
allowMute: parser.moderationSettings.allowMute,
|
||||
allowKick: parser.moderationSettings.allowKick,
|
||||
allowBan: parser.moderationSettings.allowBan
|
||||
allowMute: data.roomModerationSettings.allowMute,
|
||||
allowKick: data.roomModerationSettings.allowKick,
|
||||
allowBan: data.roomModerationSettings.allowBan
|
||||
}
|
||||
});
|
||||
|
||||
SendMessageComposer(new RoomBannedUsersComposer(parser.roomId));
|
||||
SendMessageComposer(new RoomBannedUsersComposer(data.roomId));
|
||||
}, []);
|
||||
|
||||
UseMessageEventHook(RoomSettingsEvent, onRoomSettingsEvent);
|
||||
UseMessageEventHook(RoomSettingsDataEvent, onRoomSettingsEvent);
|
||||
|
||||
const close = () =>
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { GetGuestRoomResultEvent, RoomLikeRoomComposer } from '@nitrots/nitro-renderer';
|
||||
import { GetGuestRoomResultEvent, RateFlatMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import classNames from 'classnames';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { CreateLinkEvent, GetRoomEngine, LocalizeText, SendMessageComposer } from '../../../../api';
|
||||
@ -41,7 +41,7 @@ export const RoomToolsWidgetView: FC<{}> = props =>
|
||||
CreateLinkEvent('chat-history/toggle');
|
||||
return;
|
||||
case 'like_room':
|
||||
SendMessageComposer(new RoomLikeRoomComposer(1));
|
||||
SendMessageComposer(new RateFlatMessageComposer(1));
|
||||
return;
|
||||
case 'toggle_room_link':
|
||||
CreateLinkEvent('navigator/toggle-room-link');
|
||||
|
Loading…
x
Reference in New Issue
Block a user