diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 61835f9d71..5be8556eb8 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -320,13 +320,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles UUID targetID; UUID.TryParse(args[0], out targetID); - // Can't handle NPC yet... - ScenePresence p = FindPresence(targetID); - if (null != p) + ScenePresence p = FindPresence(targetID); + if (p != null && p.isNPC) { - if (p.PresenceType == PresenceType.Npc) - return; + remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), new Dictionary()); + return; } string serverURI = string.Empty; @@ -575,10 +574,10 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles // Can't handle NPC yet... ScenePresence p = FindPresence(targetId); - if (null != p) + if (p != null && p.isNPC) { - if (p.PresenceType == PresenceType.Npc) - return; + remoteClient.SendAvatarPicksReply(new UUID(args[0]), new Dictionary()); + return; } string serverURI = string.Empty; @@ -860,6 +859,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles /// public void NotesUpdate(IClientAPI remoteClient, UUID queryTargetID, string queryNotes) { + ScenePresence p = FindPresence(queryTargetID); + if (p != null && p.isNPC) + { + remoteClient.SendAgentAlertMessage( + "Notes for NPCs not available", false); + return; + } + UserProfileNotes note = new UserProfileNotes(); note.UserId = remoteClient.AgentId; @@ -1000,10 +1007,14 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles // Can't handle NPC yet... ScenePresence p = FindPresence(avatarID); - if (null != p) + if (p != null && p.isNPC) { - if (p.PresenceType == PresenceType.Npc) - return; + remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, "5/25/1977", + Utils.StringToBytes("Non Player Character (NPC)"), "NPCs have no life", 16, + UUID.Zero, UUID.Zero, "", UUID.Zero); + remoteClient.SendAvatarInterestsReply(avatarID, 0, "", + 0, "Getting into trouble", "Droidspeak"); + return; } string serverURI = string.Empty; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a7105e2bb2..ad094b4b91 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -776,6 +776,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else if (sp.Flying) teleportFlags |= (uint)TeleportFlags.IsFlying; + sp.IsInTransit = true; + if (DisableInterRegionTeleportCancellation) teleportFlags |= (uint)TeleportFlags.DisableCancel; @@ -878,7 +880,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); sp.ControllingClient.SendTeleportFailed(reason); - + sp.IsInTransit = false; return; } @@ -889,7 +891,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", sp.Name, finalDestination.RegionName, sp.Scene.Name); - + sp.IsInTransit = false; return; } else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) @@ -899,7 +901,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", sp.Name, finalDestination.RegionName, sp.Scene.Name); - + sp.IsInTransit = false; return; } @@ -960,7 +962,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent", sp.Name, finalDestination.RegionName, sp.Scene.Name); - + sp.IsInTransit = false; return; } @@ -977,7 +979,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", sp.Name, finalDestination.RegionName, sp.Scene.Name); - + sp.IsInTransit = false; return; } @@ -986,6 +988,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, finalDestination.RegionName, sp.Scene.Name); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); + sp.IsInTransit = false; return; } @@ -998,7 +1001,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, finalDestination.RegionName, sp.Scene.Name); CleanupFailedInterRegionTeleport(sp, currentAgentCircuit.SessionID.ToString(), finalDestination); - + sp.IsInTransit = false; return; } @@ -1035,7 +1038,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.", sp.Name, finalDestination.RegionName, sp.Scene.Name); - + sp.IsInTransit = false; return; } @@ -1044,7 +1047,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Destination region did not signal teleport completion."); - + sp.IsInTransit = false; return; } @@ -1093,6 +1096,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Thread.Sleep(500); sp.Scene.CloseAgent(sp.UUID, false); } + sp.IsInTransit = false; } private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, @@ -1115,7 +1119,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); sp.ControllingClient.SendTeleportFailed(reason); - + sp.IsInTransit = false; return; } @@ -1127,6 +1131,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", sp.Name, finalDestination.RegionName, sp.Scene.Name); + sp.IsInTransit = false; return; } else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) @@ -1137,6 +1142,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", sp.Name, finalDestination.RegionName, sp.Scene.Name); + sp.IsInTransit = false; return; } @@ -1189,7 +1195,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", sp.Name, finalDestination.RegionName, sp.Scene.Name); - + sp.IsInTransit = false; return; } @@ -1198,6 +1204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Name, finalDestination.RegionName, sp.Scene.Name); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); + sp.IsInTransit = false; return; } @@ -1255,6 +1262,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.Reset(); } */ + sp.IsInTransit = false; } /// diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 5507526310..2701912d18 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -805,7 +805,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return !userdata.IsUnknownUser; } - public virtual void AddUser(UUID uuid, string first, string last) + public virtual void AddUser(UUID uuid, string first, string last, bool isNPC = false) { lock(m_UserCache) { @@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement user.FirstName = first; user.LastName = last; user.IsUnknownUser = false; - user.HasGridUserTried = false; + user.HasGridUserTried = isNPC; m_UserCache.Add(uuid, user); } } diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 58ea309f99..13103584e1 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -58,6 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces bool SenseAsAgent { get; } UUID ActiveGroupId { get; set; } UUID Owner { get; } + string profileAbout { get; set; } } public interface INPCModule diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 09f0b19201..e44f11a54e 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3226,7 +3226,7 @@ namespace OpenSim.Region.Framework.Scenes if (sp != null && sp.PresenceType == PresenceType.Npc) { - UserManagementModule.AddUser(aCircuit.AgentID, first, last); + UserManagementModule.AddUser(aCircuit.AgentID, first, last, true); } else { diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 1ad71ba4cc..1096eae7b7 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC private readonly Scene m_scene; private readonly UUID m_ownerID; private UUID m_hostGroupID; - + private string m_profileAbout = ""; public List SelectedObjects {get; private set;} public NPCAvatar( @@ -98,6 +98,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_hostGroupID = UUID.Zero; } + public string profileAbout + { + get { return m_profileAbout; } + set + { + if(value.Length > 255) + m_profileAbout = value.Substring(0,255); + else + m_profileAbout = value; + } + } public IScene Scene { get { return m_scene; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 19f2d0972b..b101cf9b44 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2999,6 +2999,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcSetProfileAbout(LSL_Key npc, string about) + { + CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); + m_host.AddScriptLPS(1); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcId = new UUID(npc.m_string); + + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; + + ScenePresence sp = World.GetScenePresence(npcId); + if (sp != null) + ((INPC)(sp.ControllingClient)).profileAbout = about; + } + } + public void osNpcSay(LSL_Key npc, string message) { osNpcSay(npc, 0, message); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 5ce859ee36..87b09675b2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -343,6 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces rotation osNpcGetRot(key npc); void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcStopMoveToTarget(LSL_Key npc); + void osNpcSetProfileAbout(LSL_Key npc, string about); void osNpcSay(key npc, string message); void osNpcSay(key npc, int channel, string message); void osNpcShout(key npc, int channel, string message); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c5cb88e05f..5bc998e8c1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -637,6 +637,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcStopMoveToTarget(npc); } + public void osNpcSetProfileAbout(LSL_Key npc, string about) + { + m_OSSL_Functions.osNpcSetProfileAbout(npc, about); + } + public void osNpcSay(key npc, string message) { m_OSSL_Functions.osNpcSay(npc, message); diff --git a/OpenSim/Services/Interfaces/IUserManagement.cs b/OpenSim/Services/Interfaces/IUserManagement.cs index 225560e00b..91b344e0dc 100644 --- a/OpenSim/Services/Interfaces/IUserManagement.cs +++ b/OpenSim/Services/Interfaces/IUserManagement.cs @@ -79,7 +79,7 @@ namespace OpenSim.Services.Interfaces /// /// /// - void AddUser(UUID uuid, string firstName, string lastName); + void AddUser(UUID uuid, string first, string last, bool isNPC = false); /// /// Add a user.