mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-30 00:50:50 +01:00
updated packets
This commit is contained in:
parent
4da2ade4c0
commit
df6d672df8
@ -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,71 @@
|
||||
import { GetRoomAdPurchaseInfoComposer, PurchaseRoomAdMessageComposer, RoomAdPurchaseInfoEvent, RoomEntryData } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText, SendMessageComposer } from '../../../../../api';
|
||||
import { Base, 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>(null);
|
||||
const [ availableRooms, setAvailableRooms ] = useState<RoomEntryData[]>([]);
|
||||
const [ extended, setExtended ] = useState<boolean>(false);
|
||||
const [ categories, setCategories ] = useState(null);
|
||||
|
||||
const onRoomAdPurchaseInfoEvent = useCallback((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 categoryId = -1;
|
||||
|
||||
SendMessageComposer(new PurchaseRoomAdMessageComposer(pageId, offerId, flatId, name, extended, desc, categoryId))
|
||||
}, [eventDesc, eventName, extended, page.offers, page.pageId, roomId]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
SendMessageComposer(new GetRoomAdPurchaseInfoComposer());
|
||||
//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={ 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>
|
||||
</Base>
|
||||
</Column>
|
||||
</>
|
||||
);
|
||||
}
|
@ -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 { 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, NavigatorCategoriesEvent, NavigatorHomeRoomEvent, NavigatorMetadataEvent, NavigatorOpenRoomCreatorEvent, NavigatorSearchEvent, RoomDataParser, RoomDoorbellAcceptedEvent, RoomEnterErrorEvent, RoomEntryInfoMessageEvent, RoomForwardEvent, RoomScoreEvent, RoomSettingsUpdatedEvent, SecurityLevel, 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 { BatchUpdates, UseMessageEventHook } from '../../hooks';
|
||||
@ -12,7 +12,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
{
|
||||
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();
|
||||
|
||||
@ -323,7 +323,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
||||
setCategories(parser.categories);
|
||||
}, [ setCategories ]);
|
||||
|
||||
const onRoomCreatedEvent = useCallback((event: RoomCreatedEvent) =>
|
||||
const onRoomCreatedEvent = useCallback((event: FlatCreatedEvent) =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
@ -427,14 +427,14 @@ 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(FlatCreatedEvent, onRoomCreatedEvent);
|
||||
UseMessageEventHook(NavigatorHomeRoomEvent, onNavigatorHomeRoomEvent);
|
||||
UseMessageEventHook(RoomEnterErrorEvent, onRoomEnterErrorEvent);
|
||||
UseMessageEventHook(NavigatorOpenRoomCreatorEvent, onRoomCreatorEvent);
|
||||
|
@ -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, RoomModels, SendMessageComposer } from '../../../api';
|
||||
import { Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, Text } from '../../../common';
|
||||
@ -28,7 +28,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';
|
||||
@ -49,7 +49,7 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
||||
newRoomId = navigatorData.enteredGuestRoom.roomId;
|
||||
}
|
||||
|
||||
SendMessageComposer(new UserHomeRoomComposer(newRoomId));
|
||||
SendMessageComposer(new UpdateHomeRoomMessageComposer(newRoomId));
|
||||
return;
|
||||
case 'navigator_search_tag':
|
||||
return;
|
||||
@ -67,7 +67,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 { 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, LocalizeText, RoomWidgetZoomToggleMessage, SendMessageComposer } from '../../../../api';
|
||||
@ -32,7 +32,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…
Reference in New Issue
Block a user