diff --git a/src/api/nitro/GetConnection.ts b/src/api/nitro/GetConnection.ts new file mode 100644 index 00000000..03c13354 --- /dev/null +++ b/src/api/nitro/GetConnection.ts @@ -0,0 +1,6 @@ +import { IConnection, Nitro } from 'nitro-renderer'; + +export function GetConnection(): IConnection +{ + return Nitro.instance.communication.connection; +} diff --git a/src/api/nitro/index.ts b/src/api/nitro/index.ts index 8dce3b61..e3920860 100644 --- a/src/api/nitro/index.ts +++ b/src/api/nitro/index.ts @@ -1,3 +1,4 @@ export * from './avatar'; +export * from './GetConnection'; export * from './room'; export * from './session'; diff --git a/src/views/room-host/utils/IsFurnitureSelectionDisabled.ts b/src/api/nitro/room/IsFurnitureSelectionDisabled.ts similarity index 83% rename from src/views/room-host/utils/IsFurnitureSelectionDisabled.ts rename to src/api/nitro/room/IsFurnitureSelectionDisabled.ts index 211960f5..fc5f26ab 100644 --- a/src/views/room-host/utils/IsFurnitureSelectionDisabled.ts +++ b/src/api/nitro/room/IsFurnitureSelectionDisabled.ts @@ -1,6 +1,6 @@ import { RoomEngineObjectEvent, RoomObjectVariable } from 'nitro-renderer'; -import { GetSessionDataManager } from '../../../api'; -import { GetRoomEngine } from '../../../api/nitro/room/GetRoomEngine'; +import { GetSessionDataManager } from '../..'; +import { GetRoomEngine } from './GetRoomEngine'; export function IsFurnitureSelectionDisabled(event: RoomEngineObjectEvent): boolean { diff --git a/src/api/nitro/room/index.ts b/src/api/nitro/room/index.ts index c0d76ff2..f0122ddf 100644 --- a/src/api/nitro/room/index.ts +++ b/src/api/nitro/room/index.ts @@ -3,5 +3,6 @@ export * from './DispatchResizeEvent'; export * from './DispatchTouchEvent'; export * from './GetRoomEngine'; export * from './InitializeRoomInstanceRenderingCanvas'; +export * from './IsFurnitureSelectionDisabled'; export * from './ProcessRoomObjectOperation'; export * from './SetActiveRoomId'; diff --git a/src/views/room-host/utils/CanManipulateFurniture.ts b/src/api/nitro/session/CanManipulateFurniture.ts similarity index 79% rename from src/views/room-host/utils/CanManipulateFurniture.ts rename to src/api/nitro/session/CanManipulateFurniture.ts index badb4f5c..390d2fbc 100644 --- a/src/views/room-host/utils/CanManipulateFurniture.ts +++ b/src/api/nitro/session/CanManipulateFurniture.ts @@ -1,6 +1,6 @@ import { IRoomSession, RoomControllerLevel } from 'nitro-renderer'; -import { GetSessionDataManager } from '../../../api'; -import { GetRoomEngine } from '../../../api/nitro/room/GetRoomEngine'; +import { GetSessionDataManager } from '../..'; +import { GetRoomEngine } from '../room/GetRoomEngine'; import { IsOwnerOfFurniture } from './IsOwnerOfFurniture'; export function CanManipulateFurniture(roomSession: IRoomSession, objectId: number, category: number): boolean diff --git a/src/views/room/widgets/avatar-info/utils/FurnitureInfoData.ts b/src/api/nitro/session/FurnitureInfoData.ts similarity index 100% rename from src/views/room/widgets/avatar-info/utils/FurnitureInfoData.ts rename to src/api/nitro/session/FurnitureInfoData.ts diff --git a/src/api/nitro/session/GetBotInfoData.ts b/src/api/nitro/session/GetBotInfoData.ts new file mode 100644 index 00000000..48693973 --- /dev/null +++ b/src/api/nitro/session/GetBotInfoData.ts @@ -0,0 +1,30 @@ +import { RoomObjectVariable, RoomUserData } from 'nitro-renderer'; +import { GetRoomEngine } from '../room'; +import { GetRoomSession } from './GetRoomSession'; +import { GetSessionDataManager } from './GetSessionDataManager'; +import { UserInfoData } from './UserInfoData'; + +export function GetBotInfoData(roomId: number, objectId: number, category: number, userData: RoomUserData): UserInfoData +{ + const userInfoData = new UserInfoData(UserInfoData.BOT); + + userInfoData.name = userData.name; + userInfoData.motto = userData.custom; + userInfoData.webID = userData.webID; + userInfoData.userRoomId = objectId; + userInfoData.userType = userData.type; + + const roomObject = GetRoomEngine().getRoomObject(roomId, objectId, category); + + if(roomObject) userInfoData.carryItem = roomObject.model.getValue(RoomObjectVariable.FIGURE_CARRY_OBJECT); + + userInfoData.amIOwner = GetRoomSession().isRoomOwner; + userInfoData.isGuildRoom = GetRoomSession().isGuildRoom; + userInfoData.roomControllerLevel = GetRoomSession().controllerLevel; + userInfoData.amIAnyRoomController = GetSessionDataManager().isModerator; + userInfoData.isAmbassador = GetSessionDataManager().isAmbassador; + userInfoData.badges = [ 'BOT' ]; + userInfoData.figure = userData.figure; + + return userInfoData; +} diff --git a/src/views/room/widgets/avatar-info/utils/GetFurnitureInfoData.ts b/src/api/nitro/session/GetFurnitureInfoData.ts similarity index 95% rename from src/views/room/widgets/avatar-info/utils/GetFurnitureInfoData.ts rename to src/api/nitro/session/GetFurnitureInfoData.ts index a8a2f9f1..a0f6537e 100644 --- a/src/views/room/widgets/avatar-info/utils/GetFurnitureInfoData.ts +++ b/src/api/nitro/session/GetFurnitureInfoData.ts @@ -1,7 +1,9 @@ import { IFurnitureData, Nitro, ObjectDataFactory, RoomObjectCategory, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter, Vector3d } from 'nitro-renderer'; -import { GetRoomEngine, GetRoomSession, GetSessionDataManager } from '../../../../../api'; -import { IsOwnerOfFurniture } from '../../../../room-host/utils/IsOwnerOfFurniture'; +import { GetRoomEngine } from '../room'; import { FurnitureInfoData } from './FurnitureInfoData'; +import { GetRoomSession } from './GetRoomSession'; +import { GetSessionDataManager } from './GetSessionDataManager'; +import { IsOwnerOfFurniture } from './IsOwnerOfFurniture'; export function GetFurnitureInfoData(roomId: number, objectId: number, category: number): FurnitureInfoData { diff --git a/src/api/nitro/session/GetRentableBotInfoData.ts b/src/api/nitro/session/GetRentableBotInfoData.ts new file mode 100644 index 00000000..f7fb3a12 --- /dev/null +++ b/src/api/nitro/session/GetRentableBotInfoData.ts @@ -0,0 +1,31 @@ +import { RoomObjectVariable, RoomUserData } from 'nitro-renderer'; +import { GetRoomEngine } from '../room'; +import { GetRoomSession } from './GetRoomSession'; +import { GetSessionDataManager } from './GetSessionDataManager'; +import { RentableBotInfoData } from './RentableBotInfoData'; +import { UserInfoData } from './UserInfoData'; + +export function GetRentableBotInfoData(roomId: number, objectId: number, category: number, userData: RoomUserData): RentableBotInfoData +{ + const rentBotInfoData = new RentableBotInfoData(UserInfoData.BOT); + + rentBotInfoData.name = userData.name; + rentBotInfoData.motto = userData.custom; + rentBotInfoData.webID = userData.webID; + rentBotInfoData.userRoomId = objectId; + rentBotInfoData.ownerId = userData.ownerId; + rentBotInfoData.ownerName = userData.ownerName; + rentBotInfoData.botSkills = userData.botSkills; + + const roomObject = GetRoomEngine().getRoomObject(roomId, objectId, category); + + if(roomObject) rentBotInfoData.carryItem = roomObject.model.getValue(RoomObjectVariable.FIGURE_CARRY_OBJECT); + + rentBotInfoData.amIOwner = GetRoomSession().isRoomOwner; + rentBotInfoData.roomControllerLevel = GetRoomSession().controllerLevel; + rentBotInfoData.amIAnyRoomController = GetSessionDataManager().isModerator; + rentBotInfoData.badges = [ 'BOT' ]; + rentBotInfoData.figure = userData.figure; + + return rentBotInfoData; +} diff --git a/src/views/room/widgets/avatar-info/utils/GetRoomObjectNameData.ts b/src/api/nitro/session/GetRoomObjectNameData.ts similarity index 92% rename from src/views/room/widgets/avatar-info/utils/GetRoomObjectNameData.ts rename to src/api/nitro/session/GetRoomObjectNameData.ts index b692e777..b68f96a6 100644 --- a/src/views/room/widgets/avatar-info/utils/GetRoomObjectNameData.ts +++ b/src/api/nitro/session/GetRoomObjectNameData.ts @@ -1,5 +1,7 @@ import { IFurnitureData, RoomObjectCategory, RoomObjectVariable } from 'nitro-renderer'; -import { GetRoomEngine, GetRoomSession, GetSessionDataManager } from '../../../../../api'; +import { GetRoomEngine } from '../room'; +import { GetRoomSession } from './GetRoomSession'; +import { GetSessionDataManager } from './GetSessionDataManager'; import { RoomObjectNameData } from './RoomObjectNameData'; export function GetRoomObjectNameData(roomId: number, objectId: number, category: number): RoomObjectNameData diff --git a/src/views/room/widgets/avatar-info/utils/GetUserInfoData.ts b/src/api/nitro/session/GetUserInfoData.ts similarity index 93% rename from src/views/room/widgets/avatar-info/utils/GetUserInfoData.ts rename to src/api/nitro/session/GetUserInfoData.ts index f4de2254..85b32c85 100644 --- a/src/views/room/widgets/avatar-info/utils/GetUserInfoData.ts +++ b/src/api/nitro/session/GetUserInfoData.ts @@ -1,5 +1,7 @@ import { RoomControllerLevel, RoomModerationParser, RoomObjectType, RoomObjectVariable, RoomTradingLevelEnum, RoomUserData } from 'nitro-renderer'; -import { GetRoomEngine, GetRoomSession, GetSessionDataManager } from '../../../../../api'; +import { GetRoomEngine } from '../room'; +import { GetRoomSession } from './GetRoomSession'; +import { GetSessionDataManager } from './GetSessionDataManager'; import { UserInfoData } from './UserInfoData'; export const _Str_18400: number = 0; @@ -8,9 +10,11 @@ export const _Str_13798: number = 3; export function GetUserInfoData(roomId: number, objectId: number, category: number, userData: RoomUserData): UserInfoData { - const isOwnUser = false; + let userDataType = UserInfoData.OWN_USER; - const userInfoData = new UserInfoData(); + if(userData.webID !== GetSessionDataManager().userId) userDataType = UserInfoData.PEER; + + const userInfoData = new UserInfoData(userDataType); userInfoData.isSpectatorMode = GetRoomSession().isSpectator; userInfoData.name = userData.name; @@ -24,7 +28,7 @@ export function GetUserInfoData(roomId: number, objectId: number, category: numb if(roomObject) userInfoData.carryItem = roomObject.model.getValue(RoomObjectVariable.FIGURE_CARRY_OBJECT); - if(isOwnUser) + if(userDataType === UserInfoData.OWN_USER) { userInfoData.realName = GetSessionDataManager().realName; userInfoData.allowNameChange = GetSessionDataManager().canChangeName; @@ -36,7 +40,7 @@ export function GetUserInfoData(roomId: number, objectId: number, category: numb userInfoData.amIAnyRoomController = GetSessionDataManager().isModerator; userInfoData.isAmbassador = GetSessionDataManager().isAmbassador; - if(!isOwnUser) + if(userDataType === UserInfoData.PEER) { // userInfoData.canBeAskedAsFriend = this._container.friendService.canBeAskedForAFriend(userData.webID); diff --git a/src/views/room-host/utils/IsOwnerOfFurniture.ts b/src/api/nitro/session/IsOwnerOfFurniture.ts similarity index 100% rename from src/views/room-host/utils/IsOwnerOfFurniture.ts rename to src/api/nitro/session/IsOwnerOfFurniture.ts diff --git a/src/api/nitro/session/ProcessFurniAction.ts b/src/api/nitro/session/ProcessFurniAction.ts new file mode 100644 index 00000000..4e70daab --- /dev/null +++ b/src/api/nitro/session/ProcessFurniAction.ts @@ -0,0 +1,70 @@ +import { RoomAdsUpdateComposer, RoomObjectOperationType, SecurityLevel } from 'nitro-renderer'; +import { GetConnection } from '../GetConnection'; +import { GetRoomEngine } from '../room'; +import { GetSessionDataManager } from './GetSessionDataManager'; + +export class FurniAction +{ + public static ROTATE: string = 'FA_ROTATE'; + public static MOVE: string = 'FA_MOVE'; + public static PICKUP: string = 'FA_PICKUP'; + public static EJECT: string = 'FA_EJECT'; + public static USE: string = 'FA_USE'; + public static OPEN_WELCOME_GIFT: string = 'FA_OPEN_WELCOME_GIFT'; + public static SAVE_STUFF_DATA: string = 'FA_SAVE_STUFF_DATA'; +} + +export function ProcessFurniAction(type: string, objectId: number, category: number, offerId = -1, objectData: string = null): void +{ + switch(type) + { + case FurniAction.ROTATE: + GetRoomEngine().processRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_ROTATE_POSITIVE); + return; + case FurniAction.MOVE: + GetRoomEngine().processRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_MOVE); + return; + case FurniAction.PICKUP: + GetRoomEngine().processRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_PICKUP); + return; + case FurniAction.EJECT: + GetRoomEngine().processRoomObjectOperation(objectId, category, RoomObjectOperationType.OBJECT_EJECT); + return; + case FurniAction.USE: + GetRoomEngine().useRoomObject(objectId, category); + return; + case FurniAction.SAVE_STUFF_DATA: { + if(objectData) + { + const mapData = new Map(); + const dataParts = objectData.split('\t'); + + if(dataParts) + { + for(const part of dataParts) + { + const partPieces = part.split('=', 2); + + if(partPieces && partPieces.length === 2) + { + const piece1 = partPieces[0]; + const piece2 = partPieces[1]; + + mapData.set(piece1, piece2); + } + } + } + + GetRoomEngine().processRoomObjectWallOperation(objectId, category, RoomObjectOperationType.OBJECT_SAVE_STUFF_DATA, mapData); + + if(GetSessionDataManager().hasSecurity(SecurityLevel.MODERATOR)) + { + GetConnection().send(new RoomAdsUpdateComposer(this._widget.furniData.id, mapData)); + } + + mapData.clear(); + } + return; + } + } +} diff --git a/src/api/nitro/session/ProcessUserAction.ts b/src/api/nitro/session/ProcessUserAction.ts new file mode 100644 index 00000000..05ada760 --- /dev/null +++ b/src/api/nitro/session/ProcessUserAction.ts @@ -0,0 +1,194 @@ +import { RoomUnitDropHandItemComposer, RoomUnitGiveHandItemComposer, RoomUserData } from 'nitro-renderer'; +import { GetConnection } from '../GetConnection'; +import { GetRoomSession } from './GetRoomSession'; +import { GetSessionDataManager } from './GetSessionDataManager'; + +export class UserAction +{ + public static WHISPER_USER: string = 'UA_WHISPER_USER'; + public static IGNORE_USER: string = 'UA_IGNORE_USER'; + public static IGNORE_USER_BUBBLE: string = 'UA_IGNORE_USER_BUBBLE'; + public static UNIGNORE_USER: string = 'UA_UNIGNORE_USER'; + public static KICK_USER: string = 'UA_KICK_USER'; + public static BAN_USER_HOUR: string = 'UA_BAN_USER_HOUR'; + public static BAN_USER_DAY: string = 'UA_BAN_USER_DAY'; + public static BAN_USER_PERM: string = 'UA_BAN_USER_PERM'; + public static MUTE_USER_2MIN: string = 'UA_MUTE_USER_2MIN'; + public static MUTE_USER_5MIN: string = 'UA_MUTE_USER_5MIN'; + public static MUTE_USER_10MIN: string = 'UA_MUTE_USER_10MIN'; + public static SEND_FRIEND_REQUEST: string = 'UA_SEND_FRIEND_REQUEST'; + public static RESPECT_USER: string = 'UA_RESPECT_USER'; + public static GIVE_RIGHTS: string = 'UA_GIVE_RIGHTS'; + public static TAKE_RIGHTS: string = 'UA_TAKE_RIGHTS'; + public static START_TRADING: string = 'UA_START_TRADING'; + public static OPEN_HOME_PAGE: string = 'UA_OPEN_HOME_PAGE'; + public static REPORT: string = 'UA_REPORT'; + public static PICKUP_PET: string = 'UA_PICKUP_PET'; + public static MOUNT_PET: string = 'UA_MOUNT_PET'; + public static TOGGLE_PET_RIDING_PERMISSION: string = 'UA_TOGGLE_PET_RIDING_PERMISSION'; + public static TOGGLE_PET_BREEDING_PERMISSION: string = 'UA_TOGGLE_PET_BREEDING_PERMISSION'; + public static DISMOUNT_PET: string = 'UA_DISMOUNT_PET'; + public static SADDLE_OFF: string = 'UA_SADDLE_OFF'; + public static TRAIN_PET: string = 'UA_TRAIN_PET'; + public static RESPECT_PET: string = 'UA_ RESPECT_PET'; + public static TREAT_PET: string = 'UA_TREAT_PET'; + public static REQUEST_PET_UPDATE: string = 'UA_REQUEST_PET_UPDATE'; + public static START_NAME_CHANGE: string = 'UA_START_NAME_CHANGE'; + public static PASS_CARRY_ITEM: string = 'UA_PASS_CARRY_ITEM'; + public static DROP_CARRY_ITEM: string = 'UA_DROP_CARRY_ITEM'; + public static GIVE_CARRY_ITEM_TO_PET: string = 'UA_GIVE_CARRY_ITEM_TO_PET'; + public static GIVE_WATER_TO_PET: string = 'UA_GIVE_WATER_TO_PET'; + public static GIVE_LIGHT_TO_PET: string = 'UA_GIVE_LIGHT_TO_PET'; + public static REQUEST_BREED_PET: string = 'UA_REQUEST_BREED_PET'; + public static HARVEST_PET: string = 'UA_HARVEST_PET'; + public static REVIVE_PET: string = 'UA_REVIVE_PET'; + public static COMPOST_PLANT: string = 'UA_COMPOST_PLANT'; + public static GET_BOT_INFO: string = 'UA_GET_BOT_INFO'; + public static REPORT_CFH_OTHER: string = 'UA_REPORT_CFH_OTHER'; + public static AMBASSADOR_ALERT_USER: string = 'UA_AMBASSADOR_ALERT_USER'; + public static AMBASSADOR_KICK_USER: string = 'UA_AMBASSADOR_KICK_USER'; + public static AMBASSADOR_MUTE_USER_2MIN: string = 'UA_AMBASSADOR_MUTE_2MIN'; + public static AMBASSADOR_MUTE_USER_10MIN: string = 'UA_AMBASSADOR_MUTE_10MIN'; + public static AMBASSADOR_MUTE_USER_60MIN: string = 'UA_AMBASSADOR_MUTE_60MIN'; + public static AMBASSADOR_MUTE_USER_18HOUR: string = 'UA_AMBASSADOR_MUTE_18HOUR'; +} + +export function ProcessUserAction(userId: number, type: string): void +{ + let userData: RoomUserData = null; + + const petMessages = [ + UserAction.REQUEST_PET_UPDATE, + UserAction.RESPECT_PET, + UserAction.PICKUP_PET, + UserAction.MOUNT_PET, + UserAction.TOGGLE_PET_RIDING_PERMISSION, + UserAction.TOGGLE_PET_BREEDING_PERMISSION, + UserAction.DISMOUNT_PET, + UserAction.SADDLE_OFF, + UserAction.GIVE_CARRY_ITEM_TO_PET, + UserAction.GIVE_WATER_TO_PET, + UserAction.GIVE_LIGHT_TO_PET, + UserAction.TREAT_PET + ]; + + if(petMessages.indexOf(type) >= 0) + { + userData = GetRoomSession().userDataManager.getPetData(userId); + } + else + { + userData = GetRoomSession().userDataManager.getUserData(userId); + } + + if(!userData) return + + switch(type) + { + case UserAction.RESPECT_USER: + GetSessionDataManager().giveRespect(userId); + return; + case UserAction.RESPECT_PET: + GetSessionDataManager().givePetRespect(userId); + return; + // case UserAction.WHISPER_USER: + // this._container.events.dispatchEvent(new RoomWidgetChatInputContentUpdateEvent(RoomWidgetChatInputContentUpdateEvent.WHISPER, userData.name)); + // return; + case UserAction.IGNORE_USER: + GetSessionDataManager().ignoreUser(userData.name); + return; + case UserAction.UNIGNORE_USER: + GetSessionDataManager().unignoreUser(userData.name); + return; + case UserAction.KICK_USER: + GetRoomSession().sendKickMessage(userId); + return; + case UserAction.BAN_USER_DAY: + case UserAction.BAN_USER_HOUR: + case UserAction.BAN_USER_PERM: + GetRoomSession().sendBanMessage(userId, type); + return; + case UserAction.MUTE_USER_2MIN: + GetRoomSession().sendMuteMessage(userId, 2); + return; + case UserAction.MUTE_USER_5MIN: + GetRoomSession().sendMuteMessage(userId, 5); + return; + case UserAction.MUTE_USER_10MIN: + GetRoomSession().sendMuteMessage(userId, 10); + return; + case UserAction.GIVE_RIGHTS: + GetRoomSession().sendGiveRightsMessage(userId); + return; + case UserAction.TAKE_RIGHTS: + GetRoomSession().sendTakeRightsMessage(userId); + return; + // case UserAction.START_TRADING: + // if(userData) this._widget.inventoryTrading.startTrade(userData.roomIndex, userData.name); + // return; + // case UserAction.OPEN_HOME_PAGE: + // GetSessionDataManager()._Str_21275(userId, _local_3.name); + // return; + // case UserAction.PICKUP_PET: + // GetRoomSession()._Str_13781(_local_2); + // return; + // case UserAction.MOUNT_PET: + // GetRoomSession()._Str_21066(_local_2); + // return; + // case UserAction.TOGGLE_PET_RIDING_PERMISSION: + // GetRoomSession()._Str_21025(_local_2); + // return; + // case UserAction.TOGGLE_PET_BREEDING_PERMISSION: + // GetRoomSession()._Str_21562(_local_2); + // return; + // case UserAction.DISMOUNT_PET: + // GetRoomSession()._Str_19075(_local_2); + // return; + // case UserAction.SADDLE_OFF: + // GetRoomSession()._Str_21635(_local_2); + // return; + case UserAction.PASS_CARRY_ITEM: + GetConnection().send(new RoomUnitGiveHandItemComposer(userId)); + return; + // case UserAction.GIVE_CARRY_ITEM_TO_PET: + // GetConnection().send(new RoomUnitGiveHandItemPetComposer(userId)); + // return; + // case UserAction.GIVE_WATER_TO_PET: + // GetConnection().send(new _Str_7251(_local_2, PetSupplementEnum._Str_9473)); + // return; + // case UserAction.GIVE_LIGHT_TO_PET: + // GetConnection().send(new _Str_7251(_local_2, PetSupplementEnum._Str_8421)); + // return; + // case UserAction.TREAT_PET: + // GetConnection().send(new _Str_8184(_local_2)); + // return; + case UserAction.DROP_CARRY_ITEM: + GetConnection().send(new RoomUnitDropHandItemComposer()); + return; + case UserAction.REQUEST_PET_UPDATE: + GetRoomSession().userDataManager.requestPetInfo(userId); + return; + case UserAction.REPORT: + return; + case UserAction.REPORT_CFH_OTHER: + return; + case UserAction.AMBASSADOR_ALERT_USER: + GetRoomSession().sendAmbassadorAlertMessage(userId); + return; + case UserAction.AMBASSADOR_KICK_USER: + GetRoomSession().sendKickMessage(userId); + return; + case UserAction.AMBASSADOR_MUTE_USER_2MIN: + GetRoomSession().sendMuteMessage(userId, 2); + return; + case UserAction.AMBASSADOR_MUTE_USER_10MIN: + GetRoomSession().sendMuteMessage(userId, 10); + return; + case UserAction.AMBASSADOR_MUTE_USER_60MIN: + GetRoomSession().sendMuteMessage(userId, 60); + return; + case UserAction.AMBASSADOR_MUTE_USER_18HOUR: + GetRoomSession().sendMuteMessage(userId, 1080); + return; + } +} diff --git a/src/api/nitro/session/RentableBotInfoData.ts b/src/api/nitro/session/RentableBotInfoData.ts new file mode 100644 index 00000000..8d34d605 --- /dev/null +++ b/src/api/nitro/session/RentableBotInfoData.ts @@ -0,0 +1,17 @@ +export class RentableBotInfoData +{ + constructor( + public name: string = '', + public motto: string = '', + public webID: number = 0, + public figure: string = '', + public badges: string[] = [], + public carryItem: number = 0, + public userRoomId: number = 0, + public amIOwner: boolean = false, + public amIAnyRoomController: boolean = false, + public roomControllerLevel: number = 0, + public ownerId: number = -1, + public ownerName: string = '', + public botSkills: number[] = []) {} +} diff --git a/src/views/room/widgets/avatar-info/utils/RoomObjectNameData.ts b/src/api/nitro/session/RoomObjectNameData.ts similarity index 100% rename from src/views/room/widgets/avatar-info/utils/RoomObjectNameData.ts rename to src/api/nitro/session/RoomObjectNameData.ts diff --git a/src/views/room/widgets/avatar-info/utils/UserInfoData.ts b/src/api/nitro/session/UserInfoData.ts similarity index 88% rename from src/views/room/widgets/avatar-info/utils/UserInfoData.ts rename to src/api/nitro/session/UserInfoData.ts index 11984f7d..5b84a1ce 100644 --- a/src/views/room/widgets/avatar-info/utils/UserInfoData.ts +++ b/src/api/nitro/session/UserInfoData.ts @@ -1,6 +1,11 @@ export class UserInfoData { + public static OWN_USER: string = 'UID_OWN_USER'; + public static PEER: string = 'UID_PEER'; + public static BOT: string = 'UID_BOT'; + constructor( + public type: string, public name: string = '', public motto: string = '', public achievementScore: number = 0, diff --git a/src/api/nitro/session/index.ts b/src/api/nitro/session/index.ts index 96478e85..4290c424 100644 --- a/src/api/nitro/session/index.ts +++ b/src/api/nitro/session/index.ts @@ -1,6 +1,20 @@ +export * from './CanManipulateFurniture'; +export * from './FurnitureInfoData'; +export * from './GetBotInfoData'; export * from './GetFurnitureDataForProductOffer'; +export * from './GetFurnitureInfoData'; +export * from './GetProductDataForLocalization'; +export * from './GetRentableBotInfoData'; +export * from './GetRoomObjectNameData'; export * from './GetRoomSession'; export * from './GetRoomSessionManager'; export * from './GetSessionDataManager'; +export * from './GetUserInfoData'; +export * from './IsOwnerOfFurniture'; +export * from './ProcessFurniAction'; +export * from './ProcessUserAction'; +export * from './RentableBotInfoData'; +export * from './RoomObjectNameData'; export * from './SendChatTypingMessage'; export * from './StartRoomSession'; +export * from './UserInfoData'; diff --git a/src/views/room-host/RoomHostView.tsx b/src/views/room-host/RoomHostView.tsx index d26f8c92..e3066a29 100644 --- a/src/views/room-host/RoomHostView.tsx +++ b/src/views/room-host/RoomHostView.tsx @@ -1,7 +1,9 @@ import { EventDispatcher, IEventDispatcher, IRoomSession, RoomBackgroundColorEvent, RoomEngineDimmerStateEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomId, RoomObjectCategory, RoomObjectHSLColorEnabledEvent, RoomObjectOperationType, RoomSessionEvent, RoomZoomEvent } from 'nitro-renderer'; import { FC, useCallback, useState } from 'react'; +import { IsFurnitureSelectionDisabled } from '../../api/nitro/room/IsFurnitureSelectionDisabled'; import { ProcessRoomObjectOperation } from '../../api/nitro/room/ProcessRoomObjectOperation'; import { SetActiveRoomId } from '../../api/nitro/room/SetActiveRoomId'; +import { CanManipulateFurniture } from '../../api/nitro/session/CanManipulateFurniture'; import { GetRoomSession } from '../../api/nitro/session/GetRoomSession'; import { StartRoomSession } from '../../api/nitro/session/StartRoomSession'; import { useRoomEngineEvent } from '../../hooks/events/nitro/room/room-engine-event'; @@ -10,8 +12,6 @@ import { RoomErrorHandler } from '../room-error-handler/RoomErrorHandler'; import { RoomView } from '../room/RoomView'; import { RoomWidgetRoomEngineUpdateEvent, RoomWidgetRoomObjectUpdateEvent } from '../room/widgets/events'; import { RoomHostViewProps } from './RoomHostView.types'; -import { CanManipulateFurniture } from './utils/CanManipulateFurniture'; -import { IsFurnitureSelectionDisabled } from './utils/IsFurnitureSelectionDisabled'; export const RoomHostView: FC = props => {