public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) { ScenePresence npc = scene.GetScenePresence(agentId); if (npc == null || npc.IsChildAgent) { return(false); } lock (m_avatars) if (!m_avatars.ContainsKey(agentId)) { return(false); } // Delete existing npc attachments scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); npc.Appearance = npcAppearance; // Rez needed npc attachments scene.AttachmentsModule.RezAttachments(npc); IAvatarFactoryModule module = scene.RequestModuleInterface <IAvatarFactoryModule>(); module.SendAppearance(npc.UUID); return(true); }
public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) { ScenePresence sp = scene.GetScenePresence(agentId); if (sp == null || sp.IsChildAgent) { return(false); } lock (m_avatars) if (!m_avatars.ContainsKey(agentId)) { return(false); } scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); sp.Appearance = npcAppearance; scene.AttachmentsModule.RezAttachments(sp); IAvatarFactoryModule module = scene.RequestModuleInterface <IAvatarFactoryModule>(); module.SendAppearance(sp.UUID); return(true); }
public string UpdateAgentPreferences(string request, string path, string param, UUID agent) { OSDMap resp = new OSDMap(); // if there is no preference service, // we'll return a null llsd block for debugging purposes. This may change if someone knows what the // correct server response would be here. if (m_scenes[0].AgentPreferencesService == null) { return(OSDParser.SerializeLLSDXmlString(resp)); } m_log.DebugFormat("[AgentPrefs]: UpdateAgentPreferences for {0}", agent.ToString()); OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); AgentPrefs data = m_scenes[0].AgentPreferencesService.GetAgentPreferences(agent); if (data == null) { data = new AgentPrefs(agent); } if (req.ContainsKey("access_prefs")) { OSDMap accessPrefs = (OSDMap)req["access_prefs"]; // We could check with ContainsKey... data.AccessPrefs = accessPrefs["max"].AsString(); } if (req.ContainsKey("default_object_perm_masks")) { OSDMap permsMap = (OSDMap)req["default_object_perm_masks"]; data.PermEveryone = permsMap["Everyone"].AsInteger(); data.PermGroup = permsMap["Group"].AsInteger(); data.PermNextOwner = permsMap["NextOwner"].AsInteger(); } if (req.ContainsKey("hover_height")) { data.HoverHeight = (float)req["hover_height"].AsReal(); } if (req.ContainsKey("language")) { data.Language = req["language"].AsString(); } if (req.ContainsKey("language_is_public")) { data.LanguageIsPublic = req["language_is_public"].AsBoolean(); } m_scenes[0].AgentPreferencesService.StoreAgentPreferences(data); OSDMap respAccessPrefs = new OSDMap(); respAccessPrefs["max"] = data.AccessPrefs; resp["access_prefs"] = respAccessPrefs; OSDMap respDefaultPerms = new OSDMap(); respDefaultPerms["Everyone"] = data.PermEveryone; respDefaultPerms["Group"] = data.PermGroup; respDefaultPerms["NextOwner"] = data.PermNextOwner; resp["default_object_perm_masks"] = respDefaultPerms; resp["god_level"] = 0; // *TODO: Add this resp["hover_height"] = data.HoverHeight; resp["language"] = data.Language; resp["language_is_public"] = data.LanguageIsPublic; IAvatarFactoryModule afm = m_scenes[0].RequestModuleInterface <IAvatarFactoryModule>(); afm?.SetPreferencesHoverZ(agent, (float)data.HoverHeight); string response = OSDParser.SerializeLLSDXmlString(resp); return(response); }
/// <summary> /// Sets up references to modules required by the scene /// </summary> public void SetModuleInterfaces() { m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); m_worldCommModule = RequestModuleInterface<IWorldComm>(); XferManager = RequestModuleInterface<IXfer>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactoryModule>(); AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); m_dialogModule = RequestModuleInterface<IDialogModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); EntityTransferModule = RequestModuleInterface<IEntityTransferModule>(); m_groupsModule = RequestModuleInterface<IGroupsModule>(); AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>(); UserManagementModule = RequestModuleInterface<IUserManagement>(); }
public void UpdateAgentPreferences(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse, UUID agent) { if (httpRequest.HttpMethod != "POST") { httpResponse.StatusCode = (int)HttpStatusCode.NotFound; return; } //m_log.DebugFormat("[AgentPrefs]: UpdateAgentPreferences for {0}", agent.ToString()); OSDMap req; try { req = (OSDMap)OSDParser.DeserializeLLSDXml(httpRequest.InputStream); } catch { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; return; } IAgentPreferencesService aps = m_scenes[0].AgentPreferencesService; AgentPrefs data = null; if (aps != null) { data = aps.GetAgentPreferences(agent); } if (data == null) { data = new AgentPrefs(agent); } bool changed = false; OSD tmp; if (req.TryGetValue("access_prefs", out tmp) && tmp is OSDMap) { OSDMap accessPrefs = (OSDMap)tmp; // We could check with ContainsKey... data.AccessPrefs = accessPrefs["max"].AsString(); changed = true; } if (req.TryGetValue("default_object_perm_masks", out tmp) && tmp is OSDMap) { OSDMap permsMap = (OSDMap)tmp; data.PermEveryone = permsMap["Everyone"].AsInteger(); data.PermGroup = permsMap["Group"].AsInteger(); data.PermNextOwner = permsMap["NextOwner"].AsInteger(); changed = true; } if (req.TryGetValue("hover_height", out tmp)) { data.HoverHeight = (float)tmp.AsReal(); changed = true; } if (req.TryGetValue("language", out tmp)) { data.Language = tmp.AsString(); changed = true; } if (req.TryGetValue("language_is_public", out tmp)) { data.LanguageIsPublic = tmp.AsBoolean(); changed = true; } if (changed) { aps?.StoreAgentPreferences(data); } IAvatarFactoryModule afm = m_scenes[0].RequestModuleInterface <IAvatarFactoryModule>(); afm?.SetPreferencesHoverZ(agent, (float)data.HoverHeight); OSDMap resp = new OSDMap(); OSDMap respAccessPrefs = new OSDMap(); respAccessPrefs["max"] = data.AccessPrefs; resp["access_prefs"] = respAccessPrefs; OSDMap respDefaultPerms = new OSDMap(); respDefaultPerms["Everyone"] = data.PermEveryone; respDefaultPerms["Group"] = data.PermGroup; respDefaultPerms["NextOwner"] = data.PermNextOwner; resp["default_object_perm_masks"] = respDefaultPerms; resp["god_level"] = 0; // *TODO: Add this resp["hover_height"] = data.HoverHeight; resp["language"] = data.Language; resp["language_is_public"] = data.LanguageIsPublic; httpResponse.RawBuffer = OSDParser.SerializeLLSDXmlBytes(resp); httpResponse.StatusCode = (int)HttpStatusCode.OK; }
/// <summary> /// Sets up references to modules required by the scene /// </summary> public void SetModuleInterfaces() { m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); m_worldCommModule = RequestModuleInterface<IWorldComm>(); XferManager = RequestModuleInterface<IXfer>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactoryModule>(); AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); m_dialogModule = RequestModuleInterface<IDialogModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); }