updated packets

This commit is contained in:
dank074 2022-06-17 20:55:29 -05:00
parent 4da2ade4c0
commit df6d672df8
8 changed files with 95 additions and 22 deletions

View File

@ -1,7 +1,7 @@
import { RoomInfoComposer } from '@nitrots/nitro-renderer'; import { GetGuestRoomMessageComposer } from '@nitrots/nitro-renderer';
import { SendMessageComposer } from '../nitro'; import { SendMessageComposer } from '../nitro';
export function TryVisitRoom(roomId: number): void export function TryVisitRoom(roomId: number): void
{ {
SendMessageComposer(new RoomInfoComposer(roomId, false, true)); SendMessageComposer(new GetGuestRoomMessageComposer(roomId, false, true));
} }

View File

@ -1,5 +1,4 @@
import { MouseEventType } from '@nitrots/nitro-renderer'; import { MouseEventType, NitroSoundEvent } from '@nitrots/nitro-renderer';
import { NitroSoundEvent } from '@nitrots/nitro-renderer/src/nitro/events/NitroSoundEvent';
import { DispatchMainEvent } from '../../hooks'; import { DispatchMainEvent } from '../../hooks';
let canPlaySound = false; let canPlaySound = false;

View File

@ -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>
</>
);
}

View File

@ -8,6 +8,7 @@ import { CatalogLayouGuildFrontpageView } from './CatalogLayoutGuildFrontpageVie
import { CatalogLayoutInfoLoyaltyView } from './CatalogLayoutInfoLoyaltyView'; import { CatalogLayoutInfoLoyaltyView } from './CatalogLayoutInfoLoyaltyView';
import { CatalogLayoutPets2View } from './CatalogLayoutPets2View'; import { CatalogLayoutPets2View } from './CatalogLayoutPets2View';
import { CatalogLayoutPets3View } from './CatalogLayoutPets3View'; import { CatalogLayoutPets3View } from './CatalogLayoutPets3View';
import { CatalogLayoutRoomAdsView } from './CatalogLayoutRoomAdsView';
import { CatalogLayoutRoomBundleView } from './CatalogLayoutRoomBundleView'; import { CatalogLayoutRoomBundleView } from './CatalogLayoutRoomBundleView';
import { CatalogLayoutSingleBundleView } from './CatalogLayoutSingleBundleView'; import { CatalogLayoutSingleBundleView } from './CatalogLayoutSingleBundleView';
import { CatalogLayoutSpacesView } from './CatalogLayoutSpacesView'; import { CatalogLayoutSpacesView } from './CatalogLayoutSpacesView';
@ -63,6 +64,8 @@ export const GetCatalogLayout = (page: ICatalogPage, hideNavigation: () => void)
return <CatalogLayoutInfoLoyaltyView { ...layoutProps } />; return <CatalogLayoutInfoLoyaltyView { ...layoutProps } />;
case 'badge_display': case 'badge_display':
return <CatalogLayoutBadgeDisplayView { ...layoutProps } />; return <CatalogLayoutBadgeDisplayView { ...layoutProps } />;
case 'roomads':
return <CatalogLayoutRoomAdsView { ...layoutProps } />;
//case 'default_3x3_color_grouping': //case 'default_3x3_color_grouping':
//return <CatalogLayoutColorGroupingView { ...layoutProps } />; //return <CatalogLayoutColorGroupingView { ...layoutProps } />;
case 'bots': case 'bots':

View File

@ -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 { FC, useCallback } from 'react';
import { CreateLinkEvent, CreateRoomSession, DoorStateType, GetConfiguration, GetSessionDataManager, LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer, TryVisitRoom, VisitDesktop } from '../../api'; import { CreateLinkEvent, CreateRoomSession, DoorStateType, GetConfiguration, GetSessionDataManager, LocalizeText, NotificationAlertType, NotificationUtilities, SendMessageComposer, TryVisitRoom, VisitDesktop } from '../../api';
import { BatchUpdates, UseMessageEventHook } from '../../hooks'; import { BatchUpdates, UseMessageEventHook } from '../../hooks';
@ -12,7 +12,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
{ {
const parser = event.getParser(); const parser = event.getParser();
SendMessageComposer(new RoomInfoComposer(parser.roomId, false, false)); SendMessageComposer(new GetGuestRoomMessageComposer(parser.roomId, false, false));
}, []); }, []);
UseMessageEventHook(RoomSettingsUpdatedEvent, onRoomSettingsUpdatedEvent); UseMessageEventHook(RoomSettingsUpdatedEvent, onRoomSettingsUpdatedEvent);
@ -35,8 +35,8 @@ export const NavigatorMessageHandler: FC<{}> = props =>
const onUserInfoEvent = useCallback((event: UserInfoEvent) => const onUserInfoEvent = useCallback((event: UserInfoEvent) =>
{ {
SendMessageComposer(new NavigatorCategoriesComposer()); SendMessageComposer(new GetUserFlatCatsMessageComposer());
SendMessageComposer(new NavigatorSettingsComposer()); SendMessageComposer(new GetUserEventCatsMessageComposer());
}, []); }, []);
const onUserPermissionsEvent = useCallback((event: UserPermissionsEvent) => const onUserPermissionsEvent = useCallback((event: UserPermissionsEvent) =>
@ -80,7 +80,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
// close room settings // close room settings
// close room filter // 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 ]); if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'navigator', 'private', [ parser.roomId ]);
}, [ setNavigatorData ]); }, [ setNavigatorData ]);
@ -181,7 +181,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
}); });
}, [ setNavigatorData ]); }, [ setNavigatorData ]);
const onRoomDoorbellEvent = useCallback((event: RoomDoorbellEvent) => const onRoomDoorbellEvent = useCallback((event: DoorbellMessageEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
@ -215,7 +215,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
} }
}, [ setDoorData ]); }, [ setDoorData ]);
const onRoomDoorbellRejectedEvent = useCallback((event: RoomDoorbellRejectedEvent) => const onRoomDoorbellRejectedEvent = useCallback((event: FlatAccessDeniedMessageEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
@ -323,7 +323,7 @@ export const NavigatorMessageHandler: FC<{}> = props =>
setCategories(parser.categories); setCategories(parser.categories);
}, [ setCategories ]); }, [ setCategories ]);
const onRoomCreatedEvent = useCallback((event: RoomCreatedEvent) => const onRoomCreatedEvent = useCallback((event: FlatCreatedEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();
@ -427,14 +427,14 @@ export const NavigatorMessageHandler: FC<{}> = props =>
UseMessageEventHook(RoomEntryInfoMessageEvent, onRoomEntryInfoMessageEvent); UseMessageEventHook(RoomEntryInfoMessageEvent, onRoomEntryInfoMessageEvent);
UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent); UseMessageEventHook(GetGuestRoomResultEvent, onGetGuestRoomResultEvent);
UseMessageEventHook(RoomScoreEvent, onRoomScoreEvent); UseMessageEventHook(RoomScoreEvent, onRoomScoreEvent);
UseMessageEventHook(RoomDoorbellEvent, onRoomDoorbellEvent); UseMessageEventHook(DoorbellMessageEvent, onRoomDoorbellEvent);
UseMessageEventHook(RoomDoorbellAcceptedEvent, onRoomDoorbellAcceptedEvent); UseMessageEventHook(RoomDoorbellAcceptedEvent, onRoomDoorbellAcceptedEvent);
UseMessageEventHook(RoomDoorbellRejectedEvent, onRoomDoorbellRejectedEvent); UseMessageEventHook(FlatAccessDeniedMessageEvent, onRoomDoorbellRejectedEvent);
UseMessageEventHook(GenericErrorEvent, onGenericErrorEvent); UseMessageEventHook(GenericErrorEvent, onGenericErrorEvent);
UseMessageEventHook(NavigatorMetadataEvent, onNavigatorMetadataEvent); UseMessageEventHook(NavigatorMetadataEvent, onNavigatorMetadataEvent);
UseMessageEventHook(NavigatorSearchEvent, onNavigatorSearchEvent); UseMessageEventHook(NavigatorSearchEvent, onNavigatorSearchEvent);
UseMessageEventHook(NavigatorCategoriesEvent, onNavigatorCategoriesEvent); UseMessageEventHook(NavigatorCategoriesEvent, onNavigatorCategoriesEvent);
UseMessageEventHook(RoomCreatedEvent, onRoomCreatedEvent); UseMessageEventHook(FlatCreatedEvent, onRoomCreatedEvent);
UseMessageEventHook(NavigatorHomeRoomEvent, onNavigatorHomeRoomEvent); UseMessageEventHook(NavigatorHomeRoomEvent, onNavigatorHomeRoomEvent);
UseMessageEventHook(RoomEnterErrorEvent, onRoomEnterErrorEvent); UseMessageEventHook(RoomEnterErrorEvent, onRoomEnterErrorEvent);
UseMessageEventHook(NavigatorOpenRoomCreatorEvent, onRoomCreatorEvent); UseMessageEventHook(NavigatorOpenRoomCreatorEvent, onRoomCreatorEvent);

View File

@ -1,5 +1,5 @@
/* eslint-disable no-template-curly-in-string */ /* 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 { FC, useEffect, useState } from 'react';
import { GetClubMemberLevel, GetConfiguration, IRoomModel, LocalizeText, RoomModels, SendMessageComposer } from '../../../api'; import { GetClubMemberLevel, GetConfiguration, IRoomModel, LocalizeText, RoomModels, SendMessageComposer } from '../../../api';
import { Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, Text } from '../../../common'; import { Button, Column, Flex, Grid, LayoutCurrencyIcon, LayoutGridItem, Text } from '../../../common';
@ -28,7 +28,7 @@ export const NavigatorRoomCreatorView: FC<{}> = props =>
const createRoom = () => 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(() => useEffect(() =>

View File

@ -1,5 +1,5 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; 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 classNames from 'classnames';
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { CreateLinkEvent, GetGroupInformation, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../api'; import { CreateLinkEvent, GetGroupInformation, GetSessionDataManager, LocalizeText, SendMessageComposer } from '../../../api';
@ -49,7 +49,7 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
newRoomId = navigatorData.enteredGuestRoom.roomId; newRoomId = navigatorData.enteredGuestRoom.roomId;
} }
SendMessageComposer(new UserHomeRoomComposer(newRoomId)); SendMessageComposer(new UpdateHomeRoomMessageComposer(newRoomId));
return; return;
case 'navigator_search_tag': case 'navigator_search_tag':
return; return;
@ -67,7 +67,7 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
return; return;
case 'toggle_pick': case 'toggle_pick':
setIsRoomPicked(value => !value); setIsRoomPicked(value => !value);
SendMessageComposer(new RoomStaffPickComposer(navigatorData.enteredGuestRoom.roomId)); SendMessageComposer(new ToggleStaffPickMessageComposer(navigatorData.enteredGuestRoom.roomId));
return; return;
case 'toggle_mute': case 'toggle_mute':
setIsRoomMuted(value => !value); setIsRoomMuted(value => !value);

View File

@ -1,4 +1,4 @@
import { GetGuestRoomResultEvent, RoomLikeRoomComposer } from '@nitrots/nitro-renderer'; import { GetGuestRoomResultEvent, RateFlatMessageComposer } from '@nitrots/nitro-renderer';
import classNames from 'classnames'; import classNames from 'classnames';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { CreateLinkEvent, LocalizeText, RoomWidgetZoomToggleMessage, SendMessageComposer } from '../../../../api'; import { CreateLinkEvent, LocalizeText, RoomWidgetZoomToggleMessage, SendMessageComposer } from '../../../../api';
@ -32,7 +32,7 @@ export const RoomToolsWidgetView: FC<{}> = props =>
CreateLinkEvent('chat-history/toggle'); CreateLinkEvent('chat-history/toggle');
return; return;
case 'like_room': case 'like_room':
SendMessageComposer(new RoomLikeRoomComposer(1)); SendMessageComposer(new RateFlatMessageComposer(1));
return; return;
case 'toggle_room_link': case 'toggle_room_link':
CreateLinkEvent('navigator/toggle-room-link'); CreateLinkEvent('navigator/toggle-room-link');