mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Merge branch 'dev' into more-layout-changes
This commit is contained in:
commit
3d0383988e
@ -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 { FC, useCallback, useState } from 'react';
|
||||||
import { GetCommunication, GetConfiguration, GetNitroInstance } from './api';
|
import { GetCommunication, GetConfiguration, GetNitroInstance } from './api';
|
||||||
import { useConfigurationEvent } from './hooks/events/core/configuration/configuration-event';
|
import { useConfigurationEvent } from './hooks/events/core/configuration/configuration-event';
|
||||||
@ -68,6 +68,8 @@ export const App: FC<{}> = props =>
|
|||||||
setMessage('Finishing Up');
|
setMessage('Finishing Up');
|
||||||
|
|
||||||
GetNitroInstance().init();
|
GetNitroInstance().init();
|
||||||
|
|
||||||
|
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'authentication', 'authok', []);
|
||||||
return;
|
return;
|
||||||
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
||||||
setIsError(true);
|
setIsError(true);
|
||||||
@ -79,7 +81,7 @@ export const App: FC<{}> = props =>
|
|||||||
setIsError(true);
|
setIsError(true);
|
||||||
setMessage('Connection Error');
|
setMessage('Connection Error');
|
||||||
|
|
||||||
LegacyExternalInterface.call('disconnect', -1, 'client.init.handshake.fail');
|
HabboWebTools.send(-1, 'client.init.handshake.fail');
|
||||||
return;
|
return;
|
||||||
case RoomEngineEvent.ENGINE_INITIALIZED:
|
case RoomEngineEvent.ENGINE_INITIALIZED:
|
||||||
setIsReady(true);
|
setIsReady(true);
|
||||||
|
@ -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 { FC, useCallback } from 'react';
|
||||||
import { CreateRoomSession, GetSessionDataManager } from '../../api';
|
import { CreateRoomSession, GetSessionDataManager } from '../../api';
|
||||||
import { UpdateDoorStateEvent } from '../../events';
|
import { UpdateDoorStateEvent } from '../../events';
|
||||||
@ -40,6 +40,8 @@ export const NavigatorMessageHandler: FC<{}> = props =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
SendMessageHook(new RoomInfoComposer(parser.roomId, true, false));
|
SendMessageHook(new RoomInfoComposer(parser.roomId, true, false));
|
||||||
|
|
||||||
|
if(LegacyExternalInterface.available) LegacyExternalInterface.call('legacyTrack', 'navigator', 'private', [ parser.roomId ]);
|
||||||
}, [ navigatorState, dispatchNavigatorState ]);
|
}, [ navigatorState, dispatchNavigatorState ]);
|
||||||
|
|
||||||
const onGetGuestRoomResultEvent = useCallback((event: GetGuestRoomResultEvent) =>
|
const onGetGuestRoomResultEvent = useCallback((event: GetGuestRoomResultEvent) =>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { MouseEventType } from '@nitrots/nitro-renderer';
|
import { MouseEventType } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
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 { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../layout';
|
||||||
|
import { NotificationUtilities } from '../notification-center/common/NotificationUtilities';
|
||||||
|
|
||||||
const newLineRegex = /\n\r|\n|\r/mg;
|
const newLineRegex = /\n\r|\n|\r/mg;
|
||||||
const internalLinkPrefix = 'event:';
|
|
||||||
export const NitropediaView: FC<{}> = props =>
|
export const NitropediaView: FC<{}> = props =>
|
||||||
{
|
{
|
||||||
const [ content, setContent ] = useState<string>(null);
|
const [ content, setContent ] = useState<string>(null);
|
||||||
@ -40,17 +40,7 @@ export const NitropediaView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const link = event.target.href;
|
const link = event.target.href;
|
||||||
|
NotificationUtilities.openUrl(link);
|
||||||
if(link.startsWith(internalLinkPrefix))
|
|
||||||
{
|
|
||||||
const internalLink = link.substring(internalLinkPrefix.length);
|
|
||||||
CreateLinkEvent(internalLink);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
window.open(link);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},[]);
|
},[]);
|
||||||
|
@ -361,7 +361,7 @@ export const AvatarInfoWidgetView: FC<{}> = props =>
|
|||||||
{
|
{
|
||||||
return <AvatarInfoUseProductView key={ item.id } item={ item } updateConfirmingProduct={ updateConfirmingProduct } close={ () => removeProductBubble(index) } />;
|
return <AvatarInfoUseProductView key={ item.id } item={ item } updateConfirmingProduct={ updateConfirmingProduct } close={ () => removeProductBubble(index) } />;
|
||||||
}) }
|
}) }
|
||||||
{ rentableBotChatEvent && <AvatarInfoRentableBotChatView chatEvent={ rentableBotChatEvent } /> }
|
{ rentableBotChatEvent && <AvatarInfoRentableBotChatView chatEvent={ rentableBotChatEvent } close={ () => setRentableBotChatEvent(null)}/> }
|
||||||
{ confirmingProduct && <AvatarInfoUseProductConfirmView item={ confirmingProduct } close={ () => setConfirmingProduct(null) } /> }
|
{ confirmingProduct && <AvatarInfoUseProductConfirmView item={ confirmingProduct } close={ () => setConfirmingProduct(null) } /> }
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
export class BotSkillsEnum
|
export class BotSkillsEnum
|
||||||
{
|
{
|
||||||
public static _Str_19584: number = 0;
|
public static GENERIC_SKILL: number = 0;
|
||||||
public static DRESS_UP: number = 1;
|
public static DRESS_UP: number = 1;
|
||||||
public static SETUP_CHAT: number = 2;
|
public static SETUP_CHAT: number = 2;
|
||||||
public static RANDOM_WALK: number = 3;
|
public static RANDOM_WALK: number = 3;
|
||||||
public static DANCE: number = 4;
|
public static DANCE: number = 4;
|
||||||
public static CHANGE_BOT_NAME: number = 5;
|
public static CHANGE_BOT_NAME: number = 5;
|
||||||
public static _Str_20280: number = 6;
|
public static SERVE_BEVERAGE: number = 6;
|
||||||
public static _Str_18934: number = 7;
|
public static INCLIENT_LINK: number = 7;
|
||||||
public static _Str_14917: number = 8;
|
public static NUX_PROCEED: number = 8;
|
||||||
public static CHANGE_BOT_MOTTO: number = 9;
|
public static CHANGE_BOT_MOTTO: number = 9;
|
||||||
public static NUX_TAKE_TOUR: number = 10;
|
public static NUX_TAKE_TOUR: number = 10;
|
||||||
public static NO_PICK_UP: number = 12;
|
public static NO_PICK_UP: number = 12;
|
||||||
|
@ -1,21 +1,64 @@
|
|||||||
import { FC, useMemo } from 'react';
|
import { BotSkillSaveComposer } from '@nitrots/nitro-renderer';
|
||||||
import { GetRoomObjectBounds, GetRoomSession } from '../../../../../../api';
|
import { FC, useCallback, useMemo, useState } from 'react';
|
||||||
|
import { GetRoomObjectBounds, GetRoomSession, LocalizeText } from '../../../../../../api';
|
||||||
|
import { SendMessageHook } from '../../../../../../hooks';
|
||||||
import { DraggableWindow, DraggableWindowPosition } from '../../../../../../layout';
|
import { DraggableWindow, DraggableWindowPosition } from '../../../../../../layout';
|
||||||
|
import { BotSkillsEnum } from '../../common/BotSkillsEnum';
|
||||||
import { AvatarInfoRentableBotChatViewProps } from './AvatarInfoRentableBotChatView.types';
|
import { AvatarInfoRentableBotChatViewProps } from './AvatarInfoRentableBotChatView.types';
|
||||||
|
|
||||||
export const AvatarInfoRentableBotChatView: FC<AvatarInfoRentableBotChatViewProps> = props =>
|
export const AvatarInfoRentableBotChatView: FC<AvatarInfoRentableBotChatViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { chatEvent = null } = props;
|
const { chatEvent = null, close = null } = props;
|
||||||
|
// eslint-disable-next-line no-template-curly-in-string
|
||||||
|
const [ newText, setNewText ] = useState<string>(chatEvent.chat === '${bot.skill.chatter.configuration.text.placeholder}' ? '' : chatEvent.chat);
|
||||||
|
const [ automaticChat, setAutomaticChat ] = useState<boolean>(chatEvent.automaticChat);
|
||||||
|
const [ mixSentences, setMixSentences ] = useState<boolean>(chatEvent.mixSentences);
|
||||||
|
const [ chatDelay, setChatDelay ] = useState<number>(chatEvent.chatDelay);
|
||||||
|
|
||||||
const getObjectLocation = useMemo(() =>
|
const getObjectLocation = useMemo(() =>
|
||||||
{
|
{
|
||||||
return GetRoomObjectBounds(GetRoomSession().roomId, chatEvent.objectId, chatEvent.category, 1);
|
return GetRoomObjectBounds(GetRoomSession().roomId, chatEvent.objectId, chatEvent.category, 1);
|
||||||
}, [ chatEvent ]);
|
}, [ 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 (
|
return (
|
||||||
<DraggableWindow position={ DraggableWindowPosition.NOTHING } handleSelector=".drag-handler" style={ { top: getObjectLocation.y, left: getObjectLocation.x } }>
|
<DraggableWindow position={ DraggableWindowPosition.NOTHING } handleSelector=".drag-handler" style={ { top: getObjectLocation.y, left: getObjectLocation.x } }>
|
||||||
<div className="nitro-context-menu">
|
<div className="nitro-context-menu">
|
||||||
<div className="drag-handler">test!!!!!</div>
|
<div className="drag-handler">
|
||||||
|
<div className="px-2">
|
||||||
|
<div className="d-flex flex-column menu-item">
|
||||||
|
<p className="mb-1">{ LocalizeText('bot.skill.chatter.configuration.chat.text') }</p>
|
||||||
|
<textarea className="form-control form-control-sm mb-2" placeholder={LocalizeText('bot.skill.chatter.configuration.text.placeholder')} value={newText} rows={7} onChange={e => setNewText(e.target.value)}/>
|
||||||
|
</div>
|
||||||
|
<div className="d-flex flex-row menu-item">
|
||||||
|
<p className="mb-1 me-2">{ LocalizeText('bot.skill.chatter.configuration.automatic.chat') }</p>
|
||||||
|
<input type="checkbox" className="form-check-input" checked={automaticChat} onChange={e => setAutomaticChat(e.target.checked)} />
|
||||||
|
</div>
|
||||||
|
<div className="d-flex flex-row menu-item">
|
||||||
|
<p className="mb-1 me-2">{ LocalizeText('bot.skill.chatter.configuration.markov')}</p>
|
||||||
|
<input type="checkbox" className="form-check-input" checked={mixSentences} onChange={ e => setMixSentences(e.target.checked)} />
|
||||||
|
</div>
|
||||||
|
<div className="d-flex flex-row menu-item">
|
||||||
|
<p className="mb-1 me-2">{ LocalizeText('bot.skill.chatter.configuration.chat.delay') }</p>
|
||||||
|
<input type="number" className="form-control form-control-sm mb-2" value={chatDelay} onChange={e => setChatDelay(e.target.valueAsNumber)}/>
|
||||||
|
</div>
|
||||||
|
<div className="d-flex flex-row justify-content-between mt-1">
|
||||||
|
<button type="button" className="btn btn-secondary btn-sm" onClick={close}>{ LocalizeText('cancel')}</button>
|
||||||
|
<button type="button" className="btn btn-success btn-sm" onClick={save}>{ LocalizeText('save') }</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DraggableWindow>
|
</DraggableWindow>
|
||||||
);
|
);
|
||||||
|
@ -3,4 +3,5 @@ import { RoomWidgetUpdateRentableBotChatEvent } from '../../../../../../api';
|
|||||||
export interface AvatarInfoRentableBotChatViewProps
|
export interface AvatarInfoRentableBotChatViewProps
|
||||||
{
|
{
|
||||||
chatEvent: RoomWidgetUpdateRentableBotChatEvent;
|
chatEvent: RoomWidgetUpdateRentableBotChatEvent;
|
||||||
|
close(): void;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user