diff --git a/src/App.tsx b/src/App.tsx index 7ebb30d8..f1fb127b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import { ConfigurationEvent, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer'; +import { ConfigurationEvent, HabboWebTools, LegacyExternalInterface, Nitro, NitroCommunicationDemoEvent, NitroEvent, NitroLocalizationEvent, NitroVersion, RoomEngineEvent, WebGL } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; import { GetCommunication, GetConfiguration, GetNitroInstance } from './api'; import { useConfigurationEvent } from './hooks/events/core/configuration/configuration-event'; @@ -68,6 +68,8 @@ export const App: FC<{}> = props => setMessage('Finishing Up'); GetNitroInstance().init(); + + if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []); return; case NitroCommunicationDemoEvent.CONNECTION_ERROR: setIsError(true); @@ -79,7 +81,7 @@ export const App: FC<{}> = props => setIsError(true); setMessage('Connection Error'); - LegacyExternalInterface.call('disconnect', -1, 'client.init.handshake.fail'); + HabboWebTools.send(-1, 'client.init.handshake.fail'); return; case RoomEngineEvent.ENGINE_INITIALIZED: setIsReady(true); diff --git a/src/views/navigator/NavigatorMessageHandler.tsx b/src/views/navigator/NavigatorMessageHandler.tsx index 3ca2dea8..7edac6a6 100644 --- a/src/views/navigator/NavigatorMessageHandler.tsx +++ b/src/views/navigator/NavigatorMessageHandler.tsx @@ -1,4 +1,4 @@ -import { GenericErrorEvent, GetGuestRoomResultEvent, NavigatorCategoriesComposer, NavigatorCategoriesEvent, NavigatorHomeRoomEvent, NavigatorMetadataEvent, NavigatorSearchEvent, NavigatorSettingsComposer, RoomCreatedEvent, RoomDataParser, RoomDoorbellAcceptedEvent, RoomDoorbellEvent, RoomDoorbellRejectedEvent, RoomEntryInfoMessageEvent, RoomForwardEvent, RoomInfoComposer, RoomSettingsUpdatedEvent, UserInfoEvent } from '@nitrots/nitro-renderer'; +import { GenericErrorEvent, GetGuestRoomResultEvent, LegacyExternalInterface, NavigatorCategoriesComposer, NavigatorCategoriesEvent, NavigatorHomeRoomEvent, NavigatorMetadataEvent, NavigatorSearchEvent, NavigatorSettingsComposer, RoomCreatedEvent, RoomDataParser, RoomDoorbellAcceptedEvent, RoomDoorbellEvent, RoomDoorbellRejectedEvent, RoomEntryInfoMessageEvent, RoomForwardEvent, RoomInfoComposer, RoomSettingsUpdatedEvent, UserInfoEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback } from 'react'; import { CreateRoomSession, GetSessionDataManager } from '../../api'; import { UpdateDoorStateEvent } from '../../events'; @@ -41,6 +41,8 @@ export const NavigatorMessageHandler: FC = props = }); SendMessageHook(new RoomInfoComposer(parser.roomId, true, false)); + + if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'navigator', 'private', [ parser.roomId ]); }, [ navigatorState, dispatchNavigatorState ]); const onGetGuestRoomResultEvent = useCallback((event: GetGuestRoomResultEvent) => diff --git a/src/views/nitropedia/NitropediaView.tsx b/src/views/nitropedia/NitropediaView.tsx index 578349a5..65639130 100644 --- a/src/views/nitropedia/NitropediaView.tsx +++ b/src/views/nitropedia/NitropediaView.tsx @@ -1,10 +1,10 @@ import { MouseEventType } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useRef, useState } from 'react'; -import { AddEventLinkTracker, CreateLinkEvent, GetConfiguration, RemoveLinkEventTracker } from '../../api'; +import { AddEventLinkTracker, GetConfiguration, RemoveLinkEventTracker } from '../../api'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../layout'; +import { NotificationUtilities } from '../notification-center/common/NotificationUtilities'; const newLineRegex = /\n\r|\n|\r/mg; -const internalLinkPrefix = 'event:'; export const NitropediaView: FC<{}> = props => { const [ content, setContent ] = useState(null); @@ -40,17 +40,7 @@ export const NitropediaView: FC<{}> = props => { event.preventDefault(); const link = event.target.href; - - if(link.startsWith(internalLinkPrefix)) - { - const internalLink = link.substring(internalLinkPrefix.length); - CreateLinkEvent(internalLink); - } - - else - { - window.open(link); - } + NotificationUtilities.openUrl(link); } },[]); diff --git a/src/views/room/widgets/avatar-info/AvatarInfoWidgetView.tsx b/src/views/room/widgets/avatar-info/AvatarInfoWidgetView.tsx index 41b20557..5ac5f7a0 100644 --- a/src/views/room/widgets/avatar-info/AvatarInfoWidgetView.tsx +++ b/src/views/room/widgets/avatar-info/AvatarInfoWidgetView.tsx @@ -361,7 +361,7 @@ export const AvatarInfoWidgetView: FC<{}> = props => { return removeProductBubble(index) } />; }) } - { rentableBotChatEvent && } + { rentableBotChatEvent && setRentableBotChatEvent(null)}/> } { confirmingProduct && setConfirmingProduct(null) } /> } ) diff --git a/src/views/room/widgets/avatar-info/common/BotSkillsEnum.ts b/src/views/room/widgets/avatar-info/common/BotSkillsEnum.ts index 3c7043ce..cc7942be 100644 --- a/src/views/room/widgets/avatar-info/common/BotSkillsEnum.ts +++ b/src/views/room/widgets/avatar-info/common/BotSkillsEnum.ts @@ -1,14 +1,14 @@ export class BotSkillsEnum { - public static _Str_19584: number = 0; + public static GENERIC_SKILL: number = 0; public static DRESS_UP: number = 1; public static SETUP_CHAT: number = 2; public static RANDOM_WALK: number = 3; public static DANCE: number = 4; public static CHANGE_BOT_NAME: number = 5; - public static _Str_20280: number = 6; - public static _Str_18934: number = 7; - public static _Str_14917: number = 8; + public static SERVE_BEVERAGE: number = 6; + public static INCLIENT_LINK: number = 7; + public static NUX_PROCEED: number = 8; public static CHANGE_BOT_MOTTO: number = 9; public static NUX_TAKE_TOUR: number = 10; public static NO_PICK_UP: number = 12; diff --git a/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx b/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx index 983e34a2..e4d54eaa 100644 --- a/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx +++ b/src/views/room/widgets/avatar-info/views/rentable-bot-chat/AvatarInfoRentableBotChatView.tsx @@ -1,21 +1,64 @@ -import { FC, useMemo } from 'react'; -import { GetRoomObjectBounds, GetRoomSession } from '../../../../../../api'; +import { BotSkillSaveComposer } from '@nitrots/nitro-renderer'; +import { FC, useCallback, useMemo, useState } from 'react'; +import { GetRoomObjectBounds, GetRoomSession, LocalizeText } from '../../../../../../api'; +import { SendMessageHook } from '../../../../../../hooks'; import { DraggableWindow, DraggableWindowPosition } from '../../../../../../layout'; +import { BotSkillsEnum } from '../../common/BotSkillsEnum'; import { AvatarInfoRentableBotChatViewProps } from './AvatarInfoRentableBotChatView.types'; export const AvatarInfoRentableBotChatView: FC = props => { - const { chatEvent = null } = props; + const { chatEvent = null, close = null } = props; + // eslint-disable-next-line no-template-curly-in-string + const [ newText, setNewText ] = useState(chatEvent.chat === '${bot.skill.chatter.configuration.text.placeholder}' ? '' : chatEvent.chat); + const [ automaticChat, setAutomaticChat ] = useState(chatEvent.automaticChat); + const [ mixSentences, setMixSentences ] = useState(chatEvent.mixSentences); + const [ chatDelay, setChatDelay ] = useState(chatEvent.chatDelay); const getObjectLocation = useMemo(() => { return GetRoomObjectBounds(GetRoomSession().roomId, chatEvent.objectId, chatEvent.category, 1); }, [ chatEvent ]); + const formatChatString = useCallback((value: string) => + { + return value.replace(/;#;/g, ' ').replace(/\r\n|\r|\n/g, '\r'); + }, []); + + const save = useCallback(() => + { + const chatConfiguration = formatChatString(newText) + ';#;' + automaticChat + ';#;' + chatDelay + ';#;' + mixSentences; + SendMessageHook(new BotSkillSaveComposer(chatEvent.botId, BotSkillsEnum.SETUP_CHAT, chatConfiguration)); + close(); + }, [automaticChat, chatDelay, chatEvent.botId, close, formatChatString, mixSentences, newText]); + return (
-
test!!!!!
+
+
+
+

{ LocalizeText('bot.skill.chatter.configuration.chat.text') }

+