From 8b1a1744305fb3cc87ce08a6a11fb9539137c003 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 21 Sep 2016 14:04:23 +0100 Subject: [PATCH] ****DANGER**** try to make LSL_Types.key to work. bin/ScriptEngines contents must be deleted to recompile scripts. Needs more testing on all uses of key type ****DANGER**** --- .../Shared/Api/Implementation/LSL_Api.cs | 1352 ++++++++--------- .../Shared/Api/Implementation/LS_Api.cs | 2 +- .../Shared/Api/Implementation/MOD_Api.cs | 9 +- .../Shared/Api/Implementation/OSSL_Api.cs | 197 +-- .../Api/Implementation/Plugins/Dataserver.cs | 2 +- .../Api/Implementation/Plugins/HttpRequest.cs | 2 +- .../Api/Implementation/Plugins/Listener.cs | 2 +- .../Api/Implementation/Plugins/XmlRequest.cs | 10 +- .../Shared/Api/Interface/ILSL_Api.cs | 118 +- .../Shared/Api/Interface/IMOD_Api.cs | 2 +- .../Shared/Api/Interface/IOSSL_Api.cs | 165 +- .../Shared/Api/Runtime/LSL_Constants.cs | 3 +- .../Shared/Api/Runtime/LSL_Stub.cs | 106 +- .../Shared/Api/Runtime/OSSL_Stub.cs | 56 +- .../Shared/Api/Runtime/ScriptBase.cs | 10 + .../Shared/CodeTools/CSCodeGenerator.cs | 4 + .../Shared/CodeTools/LSL2CSCodeTransformer.cs | 6 +- .../Shared/Instance/ScriptInstance.cs | 4 +- .../Region/ScriptEngine/Shared/LSL_Types.cs | 80 +- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 2 +- .../ScriptEngine/XEngine/EventManager.cs | 6 +- .../Region/ScriptEngine/XEngine/XEngine.cs | 4 + 22 files changed, 1101 insertions(+), 1041 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 66cb30c5ec..fd08844826 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -69,7 +69,7 @@ using RegionFlags = OpenSim.Framework.RegionFlags; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; @@ -101,10 +101,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IScriptEngine m_ScriptEngine; protected SceneObjectPart m_host; - /// - /// Used for script sleeps when we are using co-operative script termination. - /// - /// null if co-operative script termination is not active /// /// The item that hosts this script /// @@ -117,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected float m_MinTimerInterval = 0.5f; protected float m_recoilScaleFactor = 0.0f; - protected DateTime m_timer = DateTime.Now; + protected DateTime m_timer = DateTime.UtcNow; protected bool m_waitingForScriptAnswer = false; protected bool m_automaticLinkPermission = false; protected IMessageTransferModule m_TransferModule = null; @@ -450,11 +446,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.SleepScript(m_item.ItemID, delay); } - /// - /// Check for co-operative termination. - /// - /// If called with 0, then just the check is performed with no wait. - public Scene World { get { return m_ScriptEngine.World; } @@ -1277,7 +1268,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); } - public void llRegionSayTo(string target, int channel, string msg) + public void llRegionSayTo(LSL_Key target, int channel, string msg) { if (msg.Length > 1023) msg = msg.Substring(0, 1023); @@ -1287,19 +1278,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (channel == ScriptBaseClass.DEBUG_CHANNEL) return; - UUID TargetID; - UUID.TryParse(target, out TargetID); + UUID TargetID = target; + if(TargetID == UUID.Zero) + return; IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); } - public LSL_Integer llListen(int channelID, string name, string ID, string msg) + public LSL_Integer llListen(int channelID, string name, LSL_Key ID, string msg) { m_host.AddScriptLPS(1); - UUID keyID; - UUID.TryParse(ID, out keyID); + UUID keyID = ID; IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) return wComm.Listen(m_host.LocalId, m_item.ItemID, m_host.UUID, channelID, name, keyID, msg); @@ -1323,20 +1314,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api wComm.ListenRemove(m_item.ItemID, number); } - public void llSensor(string name, string id, int type, double range, double arc) + public void llSensor(string name, LSL_Key id, int type, double range, double arc) { m_host.AddScriptLPS(1); - UUID keyID = UUID.Zero; - UUID.TryParse(id, out keyID); + UUID keyID = id; AsyncCommands.SensorRepeatPlugin.SenseOnce(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, m_host); } - public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) + public void llSensorRepeat(string name, LSL_Key id, int type, double range, double arc, double rate) { m_host.AddScriptLPS(1); - UUID keyID = UUID.Zero; - UUID.TryParse(id, out keyID); + UUID keyID = id; AsyncCommands.SensorRepeatPlugin.SetSenseRepeatEvent(m_host.LocalId, m_item.ItemID, name, keyID, type, range, arc, rate, m_host); } @@ -1391,7 +1380,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return detectedParams.Name; } - public LSL_String llDetectedKey(int number) + public LSL_Key llDetectedKey(int number) { m_host.AddScriptLPS(1); DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); @@ -1400,7 +1389,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return detectedParams.Key.ToString(); } - public LSL_String llDetectedOwner(int number) + public LSL_Key llDetectedOwner(int number) { m_host.AddScriptLPS(1); DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); @@ -1916,8 +1905,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_UrlModule == null) return; + UUID uuid = id; + if(uuid == UUID.Zero) + return; + // Make sure the content type is text/plain to start with - m_UrlModule.HttpContentType(new UUID(id), "text/plain"); + m_UrlModule.HttpContentType(id, "text/plain"); // Is the object owner online and in the region ScenePresence agent = World.GetScenePresence(m_host.ParentGroup.OwnerID); @@ -1925,7 +1918,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; // Fail if the owner is not in the same region // Is it the embeded browser? - string userAgent = m_UrlModule.GetHttpHeader(new UUID(id), "user-agent"); + string userAgent = m_UrlModule.GetHttpHeader(uuid, "user-agent"); if (userAgent.IndexOf("SecondLife") < 0) return; // Not the embedded browser. Is this check good enough? @@ -1933,7 +1926,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // seperate logins from the same IP will allow all of them to get non-text/plain as long // as the owner is in the region. Same as SL! string logonFromIPAddress = agent.ControllingClient.RemoteEndPoint.Address.ToString(); - string requestFromIPAddress = m_UrlModule.GetHttpHeader(new UUID(id), "remote_addr"); + string requestFromIPAddress = m_UrlModule.GetHttpHeader(uuid, "remote_addr"); //m_log.Debug("IP from header='" + requestFromIPAddress + "' IP from endpoint='" + logonFromIPAddress + "'"); if (requestFromIPAddress == null || requestFromIPAddress.Trim() == "") return; @@ -1947,31 +1940,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api switch (type) { case ScriptBaseClass.CONTENT_TYPE_HTML: - m_UrlModule.HttpContentType(new UUID(id), "text/html"); + m_UrlModule.HttpContentType(uuid, "text/html"); break; case ScriptBaseClass.CONTENT_TYPE_XML: - m_UrlModule.HttpContentType(new UUID(id), "application/xml"); + m_UrlModule.HttpContentType(uuid, "application/xml"); break; case ScriptBaseClass.CONTENT_TYPE_XHTML: - m_UrlModule.HttpContentType(new UUID(id), "application/xhtml+xml"); + m_UrlModule.HttpContentType(uuid, "application/xhtml+xml"); break; case ScriptBaseClass.CONTENT_TYPE_ATOM: - m_UrlModule.HttpContentType(new UUID(id), "application/atom+xml"); + m_UrlModule.HttpContentType(uuid, "application/atom+xml"); break; case ScriptBaseClass.CONTENT_TYPE_JSON: - m_UrlModule.HttpContentType(new UUID(id), "application/json"); + m_UrlModule.HttpContentType(uuid, "application/json"); break; case ScriptBaseClass.CONTENT_TYPE_LLSD: - m_UrlModule.HttpContentType(new UUID(id), "application/llsd+xml"); + m_UrlModule.HttpContentType(uuid, "application/llsd+xml"); break; case ScriptBaseClass.CONTENT_TYPE_FORM: - m_UrlModule.HttpContentType(new UUID(id), "application/x-www-form-urlencoded"); + m_UrlModule.HttpContentType(uuid, "application/x-www-form-urlencoded"); break; case ScriptBaseClass.CONTENT_TYPE_RSS: - m_UrlModule.HttpContentType(new UUID(id), "application/rss+xml"); + m_UrlModule.HttpContentType(uuid, "application/rss+xml"); break; default: - m_UrlModule.HttpContentType(new UUID(id), "text/plain"); + m_UrlModule.HttpContentType(uuid, "text/plain"); break; } } @@ -3051,21 +3044,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Float llGetTime() { m_host.AddScriptLPS(1); - TimeSpan ScriptTime = DateTime.Now - m_timer; + TimeSpan ScriptTime = DateTime.UtcNow - m_timer; return (double)(ScriptTime.TotalMilliseconds / 1000); } public void llResetTime() { m_host.AddScriptLPS(1); - m_timer = DateTime.Now; + m_timer = DateTime.UtcNow; } public LSL_Float llGetAndResetTime() { m_host.AddScriptLPS(1); - TimeSpan ScriptTime = DateTime.Now - m_timer; - m_timer = DateTime.Now; + DateTime now = DateTime.UtcNow; + TimeSpan ScriptTime = now - m_timer; + m_timer = now; return (double)(ScriptTime.TotalMilliseconds / 1000); } @@ -3393,7 +3387,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return src.ToLower(); } - public LSL_Integer llGiveMoney(string destination, int amount) + public LSL_Integer llGiveMoney(LSL_Key destination, int amount) { Util.FireAndForget(x => { @@ -3408,9 +3402,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - UUID toID = new UUID(); + UUID toID = destination; - if (!UUID.TryParse(destination, out toID)) + if (toID == UUID.Zero) { Error("llGiveMoney", "Bad key in llGiveMoney"); return; @@ -3511,8 +3505,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( "object_rez", new Object[] { - new LSL_String( - group.RootPart.UUID.ToString()) }, + new LSL_Key(group.RootPart.UUID) }, new DetectParams[0])); if (notAttachment) @@ -3652,14 +3645,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 100f * llGetMass(); } - public void llCollisionFilter(string name, string id, int accept) + public void llCollisionFilter(string name, LSL_Key id, int accept) { m_host.AddScriptLPS(1); m_host.CollisionFilter.Clear(); - UUID objectID; - if (!UUID.TryParse(id, out objectID)) - objectID = UUID.Zero; + UUID objectID = id; if (objectID == UUID.Zero && name == "") return; @@ -3791,18 +3782,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Deprecated("llReleaseCamera", "Use llClearCameraParams instead"); } - public LSL_String llGetOwner() + public LSL_Key llGetOwner() { m_host.AddScriptLPS(1); return m_host.OwnerID.ToString(); } - public void llInstantMessage(string user, string message) + public void llInstantMessage(LSL_Key user, string message) { m_host.AddScriptLPS(1); - UUID result; - if (!UUID.TryParse(user, out result) || result == UUID.Zero) + UUID result = user; + if (result == UUID.Zero) { Error("llInstantMessage","An invalid key was passed to llInstantMessage"); ScriptSleep(2000); @@ -3923,7 +3914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - public LSL_String llGetKey() + public LSL_Key llGetKey() { m_host.AddScriptLPS(1); return m_host.UUID.ToString(); @@ -4098,12 +4089,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_ScriptEngine.GetStartParameter(m_item.ItemID); } - public void llRequestPermissions(string agent, int perm) + public void llRequestPermissions(LSL_Key agent, int perm) { - UUID agentID; - - if (!UUID.TryParse(agent, out agentID)) - return; + UUID agentID = agent; if (agentID == UUID.Zero || perm == 0) // Releasing permissions { @@ -4114,7 +4102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { - new LSL_Integer(0) }, + new LSL_Integer(0) }, new DetectParams[0])); return; @@ -4127,7 +4115,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int implicitPerms = 0; - if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar) + if (m_host.ParentGroup.IsAttachment && agentID == m_host.ParentGroup.AttachedAvatar) { // When attached, certain permissions are implicit if requested from owner implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | @@ -4167,7 +4155,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "run_time_permissions", new Object[] { - new LSL_Integer(perm) }, + new LSL_Integer(perm) }, new DetectParams[0])); return; @@ -4193,7 +4181,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.PostScriptEvent( m_item.ItemID, new EventParams( - "run_time_permissions", new Object[] { new LSL_Integer(perm) }, new DetectParams[0])); + "run_time_permissions", new Object[] { new LSL_Integer(perm) }, + new DetectParams[0])); } // it is an NPC, exit even if the permissions werent granted above, they are not going to answer @@ -4225,7 +4214,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Requested agent is not in range, refuse perms m_ScriptEngine.PostScriptEvent( m_item.ItemID, - new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, new DetectParams[0])); + new EventParams("run_time_permissions", new Object[] { new LSL_Integer(0) }, + new DetectParams[0])); } void handleScriptAnswer(IClientAPI client, UUID taskID, UUID itemID, int answer) @@ -4244,12 +4234,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.TaskInventory.LockItemsForWrite(false); m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( - "run_time_permissions", new Object[] { - new LSL_Integer(answer) }, + "run_time_permissions", new Object[] {new LSL_Integer(answer) }, new DetectParams[0])); } - public LSL_String llGetPermissionsKey() + public LSL_Key llGetPermissionsKey() { m_host.AddScriptLPS(1); @@ -4296,15 +4285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llCreateLink(string target, int parent) + public void llCreateLink(LSL_Key target, int parent) { m_host.AddScriptLPS(1); - UUID targetID; - - if (!UUID.TryParse(target, out targetID)) - return; - if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { @@ -4315,14 +4299,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CreateLink(target, parent); } - public void CreateLink(string target, int parent) + public void CreateLink(LSL_Key target, int parent) { - UUID targetID; + UUID targetID = target; + if(targetID == UUID.Zero) + return; - if (!UUID.TryParse(target, out targetID)) - return; - - SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); + SceneObjectPart targetPart = World.GetSceneObjectPart(targetID); if (targetPart == null) return; @@ -4500,7 +4483,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parentPrim.ScheduleGroupForFullUpdate(); } - public LSL_String llGetLinkKey(int linknum) + public LSL_Key llGetLinkKey(int linknum) { m_host.AddScriptLPS(1); SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknum); @@ -4630,13 +4613,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 1.0f; } - public void llGiveInventory(string destination, string inventory) + public void llGiveInventory(LSL_Key destination, string inventory) { m_host.AddScriptLPS(1); - UUID destId = UUID.Zero; + UUID destId = destination; - if (!UUID.TryParse(destination, out destId)) + if (destId == UUID.Zero) { Error("llGiveInventory", "Can't parse destination key '" + destination + "'"); return; @@ -4762,12 +4745,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.PassTouches = false; } - public LSL_String llRequestAgentData(string id, int data) + public LSL_Key llRequestAgentData(LSL_Key id, int data) { m_host.AddScriptLPS(1); - UUID uuid; - if (UUID.TryParse(id, out uuid)) + UUID uuid = id; + if (uuid != UUID.Zero) { PresenceInfo pinfo = null; UserAccount account; @@ -4880,7 +4863,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ""; } - public LSL_String llRequestInventoryData(string name) + public LSL_Key llRequestInventoryData(string name) { m_host.AddScriptLPS(1); @@ -4924,11 +4907,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.ParentGroup.Damage = (float)damage; } - public void llTeleportAgentHome(string agent) + public void llTeleportAgentHome(LSL_Key agent) { m_host.AddScriptLPS(1); - UUID agentId = new UUID(); - if (UUID.TryParse(agent, out agentId)) + UUID agentId = agent; + if (agentId != UUID.Zero) { ScenePresence presence = World.GetScenePresence(agentId); if (presence != null && presence.PresenceType != PresenceType.Npc) @@ -4957,12 +4940,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(m_sleepMsOnSetDamage); } - public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt) + public void llTeleportAgent(LSL_Key agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt) { m_host.AddScriptLPS(1); - UUID agentId = new UUID(); + UUID agentId = agent; - if (UUID.TryParse(agent, out agentId)) + if (agentId != UUID.Zero) { ScenePresence presence = World.GetScenePresence(agentId); if (presence != null && presence.PresenceType != PresenceType.Npc) @@ -5000,38 +4983,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt) + public void llTeleportAgentGlobalCoords(LSL_Key agent, LSL_Vector global_coords, LSL_Vector targetPos, LSL_Vector targetLookAt) { m_host.AddScriptLPS(1); - UUID agentId = new UUID(); + UUID agentId = agent; + if(agentId == UUID.Zero) + return; ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y); - if (UUID.TryParse(agent, out agentId)) - { - // This function is owner only! - if (m_host.OwnerID != agentId) - return; + // This function is owner only! + if (m_host.OwnerID != agentId) + return; - ScenePresence presence = World.GetScenePresence(agentId); + ScenePresence presence = World.GetScenePresence(agentId); - if (presence == null || presence.PresenceType == PresenceType.Npc) - return; + if (presence == null || presence.PresenceType == PresenceType.Npc) + return; - // Can't TP sitting avatars - if (presence.ParentID != 0) // Sitting - return; + // Can't TP sitting avatars + if (presence.ParentID != 0) // Sitting + return; - if (m_item.PermsGranter == agentId) - { - // If attached using llAttachToAvatarTemp, cowardly refuse - if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID == UUID.Zero) - return; + if (m_item.PermsGranter == agentId) + { + // If attached using llAttachToAvatarTemp, cowardly refuse + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.ParentGroup.FromItemID == UUID.Zero) + return; - if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) - { - World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); - } + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) + { + World.RequestTeleportLocation(presence.ControllingClient, regionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); } } } @@ -5060,7 +5042,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation); } - public void llTextBox(string agent, string message, int chatChannel) + public void llTextBox(LSL_Key agent, string message, int chatChannel) { IDialogModule dm = World.RequestModuleInterface(); @@ -5068,10 +5050,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; m_host.AddScriptLPS(1); - UUID av = new UUID(); - if (!UUID.TryParse(agent,out av)) + UUID av = agent; + if (av == UUID.Zero) { - Error("llTextBox", "First parameter must be a key"); + Error("llTextBox", "First parameter must be a valid key"); return; } @@ -5127,11 +5109,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.aggregateScriptEvents(); } - public LSL_String llGetAnimation(string id) + public LSL_String llGetAnimation(LSL_Key id) { // This should only return a value if the avatar is in the same region m_host.AddScriptLPS(1); - UUID avatar = (UUID)id; + + UUID avatar = id; + if(avatar == UUID.Zero) + return ""; + ScenePresence presence = World.GetScenePresence(avatar); if (presence == null) return ""; @@ -5156,7 +5142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; } - public void llMessageLinked(int linknumber, int num, string msg, string id) + public void llMessageLinked(int linknumber, int num, string msg, LSL_Key id) { m_host.AddScriptLPS(1); @@ -5176,27 +5162,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object[] resobj = new object[] { - new LSL_Integer(linkNumber), new LSL_Integer(num), new LSL_String(msg), new LSL_String(id) + new LSL_Integer(linkNumber), + new LSL_Integer(num), + new LSL_String(msg), + new LSL_Key(id) }; m_ScriptEngine.PostScriptEvent(partItemID, new EventParams("link_message", - resobj, new DetectParams[0])); + resobj, new DetectParams[0])); } } } } - public void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local) + public void llPushObject(LSL_Key target, LSL_Vector impulse, LSL_Vector ang_impulse, int local) { m_host.AddScriptLPS(1); bool pushrestricted = World.RegionInfo.RegionSettings.RestrictPushing; bool pushAllowed = false; bool pusheeIsAvatar = false; - UUID targetID = UUID.Zero; + UUID targetID = target; - if (!UUID.TryParse(target,out targetID)) + if (targetID == UUID.Zero) return; ScenePresence pusheeav = null; @@ -5230,7 +5219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!pusheeIsAvatar) { // not an avatar so push is not affected by parcel flags - pusheeob = World.GetSceneObjectPart((UUID)target); + pusheeob = World.GetSceneObjectPart(targetID); // We can't find object if (pusheeob == null) @@ -5521,7 +5510,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Math.Acos(2 * quotient - 1); } - public LSL_String llGetInventoryKey(string name) + public LSL_Key llGetInventoryKey(string name) { m_host.AddScriptLPS(1); @@ -5641,28 +5630,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return source.IndexOf(pattern); } - public LSL_String llGetOwnerKey(string id) + public LSL_Key llGetOwnerKey(LSL_Key id) { m_host.AddScriptLPS(1); - UUID key = new UUID(); - if (UUID.TryParse(id, out key)) + UUID key = id; + if(key == UUID.Zero) + return UUID.Zero; + + try { - try - { - SceneObjectPart obj = World.GetSceneObjectPart(key); - if (obj == null) - return id; // the key is for an agent so just return the key - else - return obj.OwnerID.ToString(); - } - catch (KeyNotFoundException) - { - return id; // The Object/Agent not in the region so just return the key - } + SceneObjectPart obj = World.GetSceneObjectPart(key); + if (obj == null) + return id; // the key is for an agent so just return the key + else + return obj.OwnerID; } - else + catch (KeyNotFoundException) { - return UUID.Zero.ToString(); + return id; // The Object/Agent not in the region so just return the key } } @@ -5703,9 +5688,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; } - // Vectors & Rotations always return zero in SL, but - // keys don't always return zero, it seems to be a bit complex. - else if (src.Data[index] is LSL_Vector || + // Vectors & Rotations always return zero in SL, but + if (src.Data[index] is LSL_Vector || src.Data[index] is LSL_Rotation) { return 0; @@ -5743,22 +5727,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return 0; } - // valid keys seem to get parsed as integers then converted to floats - else - { - UUID uuidt; - if (src.Data[index] is LSL_Key && UUID.TryParse(src.Data[index].ToString(), out uuidt)) - { - return Convert.ToDouble(new LSL_Integer(src.Data[index].ToString()).value); - } - } try { if (src.Data[index] is LSL_Integer) return Convert.ToDouble(((LSL_Integer)src.Data[index]).value); else if (src.Data[index] is LSL_Float) return Convert.ToDouble(((LSL_Float)src.Data[index]).value); - else if (src.Data[index] is LSL_String) + else if (src.Data[index] is LSL_String || src.Data[index] is LSL_Key) { string str = ((LSL_String) src.Data[index]).m_string; Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)"); @@ -5848,6 +5823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // is a string, so we're going to leave that up to the // LSL_Vector constructor. else if (!(src.Data[index] is LSL_String || + src.Data[index] is LSL_Key || // old scripts may use key as string src.Data[index] is LSL_Vector)) { return new LSL_Vector(0, 0, 0); @@ -5877,6 +5853,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // is a string, so we're going to leave that up to the // LSL_Rotation constructor. else if (!(src.Data[index] is LSL_String || + src.Data[index] is LSL_Key || // old scripts may use key as string src.Data[index] is LSL_Rotation)) { return new LSL_Rotation(0, 0, 0, 1); @@ -5918,14 +5895,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 1; if (src.Data[index] is LSL_Float || src.Data[index] is Single || src.Data[index] is Double) return 2; + if (src.Data[index] is LSL_Key) + return 4; if (src.Data[index] is LSL_String || src.Data[index] is String) { +/* UUID tuuid; if (UUID.TryParse(src.Data[index].ToString(), out tuuid)) { return 4; } else +*/ { return 3; } @@ -6457,23 +6438,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// AGENT_BUSY /// Remove as they are done /// - public LSL_Integer llGetAgentInfo(string id) + public LSL_Integer llGetAgentInfo(LSL_Key id) { m_host.AddScriptLPS(1); - UUID key = new UUID(); - if (!UUID.TryParse(id, out key)) - { + UUID key = id; + if (key == UUID.Zero) return 0; - } int flags = 0; ScenePresence agent = World.GetScenePresence(key); if (agent == null) - { return 0; - } if (agent.IsChildAgent) return 0; // Fail if they are not in the same region @@ -6646,13 +6623,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (parcelOwned && land.LandData.OwnerID == id || parcel && land.LandData.GlobalID == id) { - result.Add(new LSL_Key(ssp.UUID.ToString())); + result.Add(new LSL_Key(ssp.UUID)); } } } else { - result.Add(new LSL_Key(ssp.UUID.ToString())); + result.Add(new LSL_Key(ssp.UUID)); } } // Maximum of 100 results @@ -6678,11 +6655,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SoundRadius = radius; } - public LSL_String llKey2Name(string id) + public LSL_String llKey2Name(LSL_Key id) { m_host.AddScriptLPS(1); - UUID key = new UUID(); - if (UUID.TryParse(id,out key)) + UUID key = id; + if (key != UUID.Zero) { ScenePresence presence = World.GetScenePresence(key); @@ -6761,11 +6738,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llEjectFromLand(string pest) + public void llEjectFromLand(LSL_Key pest) { m_host.AddScriptLPS(1); - UUID agentID = new UUID(); - if (UUID.TryParse(pest, out agentID)) + UUID agentID = pest; + if (agentID != UUID.Zero) { ScenePresence presence = World.GetScenePresence(agentID); if (presence != null) @@ -6791,11 +6768,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ParseString2List(str, separators, in_spacers, false); } - public LSL_Integer llOverMyLand(string id) + public LSL_Integer llOverMyLand(LSL_Key id) { m_host.AddScriptLPS(1); - UUID key = new UUID(); - if (UUID.TryParse(id, out key)) + UUID key = id; + if (key != UUID.Zero) { ScenePresence presence = World.GetScenePresence(key); if (presence != null) // object is an avatar @@ -6818,7 +6795,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; } - public LSL_String llGetLandOwnerAt(LSL_Vector pos) + public LSL_Key llGetLandOwnerAt(LSL_Vector pos) { m_host.AddScriptLPS(1); ILandObject land = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); @@ -6832,29 +6809,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// only the height of avatars vary and that says: /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). /// - public LSL_Vector llGetAgentSize(string id) + public LSL_Vector llGetAgentSize(LSL_Key id) { m_host.AddScriptLPS(1); - ScenePresence avatar = World.GetScenePresence((UUID)id); - LSL_Vector agentSize; + + UUID uuid = id; + if(uuid == UUID.Zero) + return ScriptBaseClass.ZERO_VECTOR; + + ScenePresence avatar = World.GetScenePresence(uuid); + if (avatar == null || avatar.IsChildAgent) // Fail if not in the same region - { - agentSize = ScriptBaseClass.ZERO_VECTOR; - } - else - { -// agentSize = new LSL_Vector(0.45f, 0.6f, avatar.Appearance.AvatarHeight); - Vector3 s = avatar.Appearance.AvatarSize; - agentSize = new LSL_Vector(s.X, s.Y, s.Z); - } - return agentSize; + return ScriptBaseClass.ZERO_VECTOR; + + Vector3 s = avatar.Appearance.AvatarSize; + return new LSL_Vector(s.X, s.Y, s.Z); } - public LSL_Integer llSameGroup(string id) + public LSL_Integer llSameGroup(LSL_Key id) { m_host.AddScriptLPS(1); - UUID uuid = new UUID(); - if (!UUID.TryParse(id, out uuid)) + UUID uuid = id; + if (uuid == UUID.Zero) return new LSL_Integer(0); // Check if it's a group key @@ -6898,12 +6874,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Integer(0); } - public void llUnSit(string id) + public void llUnSit(LSL_Key id) { m_host.AddScriptLPS(1); - UUID key = new UUID(); - if (UUID.TryParse(id, out key)) + UUID key = id; + if (key != UUID.Zero) { ScenePresence av = World.GetScenePresence(key); List sittingAvatars = m_host.ParentGroup.GetSittingAvatars(); @@ -7403,7 +7379,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: try { - prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1)); + prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLKeyItem(i + 1)); } catch(InvalidCastException) { @@ -7586,12 +7562,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llGiveInventoryList(string destination, string category, LSL_List inventory) + public void llGiveInventoryList(LSL_Key destination, string category, LSL_List inventory) { m_host.AddScriptLPS(1); - UUID destID; - if (!UUID.TryParse(destination, out destID)) + UUID destID = destination; + if (destID == UUID.Zero) return; List itemList = new List(); @@ -7741,14 +7717,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_String llAvatarOnSitTarget() + public LSL_Key llAvatarOnSitTarget() { m_host.AddScriptLPS(1); return m_host.SitTargetAvatar.ToString(); } // http://wiki.secondlife.com/wiki/LlAvatarOnLinkSitTarget - public LSL_String llAvatarOnLinkSitTarget(int linknum) + public LSL_Key llAvatarOnLinkSitTarget(int linknum) { m_host.AddScriptLPS(1); if(linknum == ScriptBaseClass.LINK_SET || @@ -7764,45 +7740,45 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - public void llAddToLandPassList(string avatar, double hours) + public void llAddToLandPassList(LSL_Key avatar, double hours) { m_host.AddScriptLPS(1); - UUID key; + UUID key = avatar; + if(key == UUID.Zero) + return; ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); - if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false)) - { - int expires = 0; - if (hours != 0) - expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); + if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false)) + return; - if (UUID.TryParse(avatar, out key)) - { - int idx = land.LandData.ParcelAccessList.FindIndex( - delegate(LandAccessEntry e) - { - if (e.AgentID == key && e.Flags == AccessList.Access) - return true; - return false; - }); + int expires = 0; + if (hours != 0) + expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); - if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) - return; + int idx = land.LandData.ParcelAccessList.FindIndex( + delegate(LandAccessEntry e) + { + if (e.AgentID == key && e.Flags == AccessList.Access) + return true; + return false; + }); - if (idx != -1) - land.LandData.ParcelAccessList.RemoveAt(idx); + if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) + return; - LandAccessEntry entry = new LandAccessEntry(); + if (idx != -1) + land.LandData.ParcelAccessList.RemoveAt(idx); - entry.AgentID = key; - entry.Flags = AccessList.Access; - entry.Expires = expires; + LandAccessEntry entry = new LandAccessEntry(); - land.LandData.ParcelAccessList.Add(entry); + entry.AgentID = key; + entry.Flags = AccessList.Access; + entry.Expires = expires; + + land.LandData.ParcelAccessList.Add(entry); + + World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); - World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); - } - } ScriptSleep(m_sleepMsOnAddToLandPassList); } @@ -7897,7 +7873,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) + public void llDialog(LSL_Key avatar, string message, LSL_List buttons, int chat_channel) { IDialogModule dm = World.RequestModuleInterface(); @@ -7905,10 +7881,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; m_host.AddScriptLPS(1); - UUID av = new UUID(); - if (!UUID.TryParse(avatar,out av)) + UUID av = avatar; + if (av == UUID.Zero) { - Error("llDialog", "First parameter must be a key"); + Error("llDialog", "First parameter must be a valid key"); return; } @@ -7966,7 +7942,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); } - public void llRemoteLoadScript(string target, string name, int running, int start_param) + public void llRemoteLoadScript(LSL_Key target, string name, int running, int start_param) { m_host.AddScriptLPS(1); Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead"); @@ -7979,15 +7955,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.ScriptAccessPin = pin; } - public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) + public void llRemoteLoadScriptPin(LSL_Key target, string name, int pin, int running, int start_param) { m_host.AddScriptLPS(1); - UUID destId = UUID.Zero; + UUID destId = target; - if (!UUID.TryParse(target, out destId)) + if (destId == UUID.Zero) { - Error("llRemoteLoadScriptPin", "Can't parse key '" + target + "'"); + Error("llRemoteLoadScriptPin", "invalid taget '" + target + "'"); return; } @@ -8042,8 +8018,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object[] resobj = new object[] { new LSL_Integer(1), - new LSL_String(channelID.ToString()), - new LSL_String(UUID.Zero.ToString()), + new LSL_Key(channelID), + new LSL_Key(UUID.Zero), new LSL_String(String.Empty), new LSL_Integer(0), new LSL_String(String.Empty) @@ -8054,29 +8030,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(m_sleepMsOnOpenRemoteDataChannel); } - public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata) + public LSL_Key llSendRemoteData(LSL_Key channel, string dest, int idata, string sdata) { m_host.AddScriptLPS(1); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); ScriptSleep(m_sleepMsOnSendRemoteData); if (xmlrpcMod == null) return ""; - return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); + return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel.ToString(), dest, idata, sdata)).ToString(); } - public void llRemoteDataReply(string channel, string message_id, string sdata, int idata) + public void llRemoteDataReply(LSL_Key channel, LSL_Key message_id, string sdata, int idata) { m_host.AddScriptLPS(1); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); if (xmlrpcMod != null) - xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); + xmlrpcMod.RemoteDataReply(channel.ToString(), message_id.ToString(), sdata, idata); ScriptSleep(m_sleepMsOnRemoteDataReply); } - public void llCloseRemoteDataChannel(string channel) + public void llCloseRemoteDataChannel(LSL_Key channel) { m_host.AddScriptLPS(1); + UUID chid = channel; + IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface(); if (xmlRpcRouter != null) { @@ -8085,7 +8063,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); if (xmlrpcMod != null) - xmlrpcMod.CloseXMLRPCChannel((UUID)channel); + xmlrpcMod.CloseXMLRPCChannel(chid); ScriptSleep(m_sleepMsOnCloseRemoteDataChannel); } @@ -10363,18 +10341,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return (double)Math.Log(val); } - public LSL_List llGetAnimationList(string id) + public LSL_List llGetAnimationList(LSL_Key id) { m_host.AddScriptLPS(1); - LSL_List l = new LSL_List(); - ScenePresence av = World.GetScenePresence((UUID)id); + + UUID uuid = id; + if(uuid == UUID.Zero) + return l; + + ScenePresence av = World.GetScenePresence(uuid); if (av == null || av.IsChildAgent) // only if in the region return l; UUID[] anims; anims = av.Animator.GetAnimationArray(); foreach (UUID foo in anims) - l.Add(new LSL_Key(foo.ToString())); + l.Add(new LSL_Key(foo)); return l; } @@ -10452,7 +10434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.Description = desc!=null?desc:String.Empty; } - public LSL_String llGetCreator() + public LSL_Key llGetCreator() { m_host.AddScriptLPS(1); return m_host.CreatorID.ToString(); @@ -10482,14 +10464,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Uses meshing of prims for high accuracy /// or less accurate box models for speed. /// - public LSL_List llGetBoundingBox(string obj) + public LSL_List llGetBoundingBox(LSL_Key obj) { m_host.AddScriptLPS(1); - UUID objID = UUID.Zero; LSL_List result = new LSL_List(); // If the ID is not valid, return null result - if (!UUID.TryParse(obj, out objID)) + UUID objID = obj; + if (objID == UUID.Zero) { result.Add(new LSL_Vector()); result.Add(new LSL_Vector()); @@ -10792,7 +10774,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case ScriptBaseClass.PRIM_TYPE_SCULPT: - res.Add(new LSL_String(Shape.SculptTexture.ToString())); + res.Add(new LSL_Key(Shape.SculptTexture)); res.Add(new LSL_Integer(Shape.SculptType)); break; @@ -10860,7 +10842,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Primitive.TextureEntryFace texface = tex.GetFace((uint)face); - res.Add(new LSL_String(texface.TextureID.ToString())); + res.Add(new LSL_Key(texface.TextureID)); res.Add(new LSL_Vector(texface.RepeatU, texface.RepeatV, 0)); @@ -10876,7 +10858,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Primitive.TextureEntryFace texface = tex.GetFace((uint)face); - res.Add(new LSL_String(texface.TextureID.ToString())); + res.Add(new LSL_Key(texface.TextureID)); res.Add(new LSL_Vector(texface.RepeatU, texface.RepeatV, 0)); @@ -11725,13 +11707,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llGetHTTPHeader(LSL_Key request_id, string header) { m_host.AddScriptLPS(1); + UUID id = request_id; - if (m_UrlModule != null) - return m_UrlModule.GetHttpHeader(new UUID(request_id), header); + if (m_UrlModule != null && id != UUID.Zero) + return m_UrlModule.GetHttpHeader(id, header); return String.Empty; } - public LSL_String llGetSimulatorHostname() { m_host.AddScriptLPS(1); @@ -12034,7 +12016,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_String llGetInventoryCreator(string itemName) + public LSL_Key llGetInventoryCreator(string itemName) { m_host.AddScriptLPS(1); @@ -12060,7 +12042,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); } - public LSL_String llRequestSecureURL() + public LSL_Key llRequestSecureURL() { m_host.AddScriptLPS(1); if (m_UrlModule != null) @@ -12068,7 +12050,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public LSL_String llRequestSimulatorData(string simulator, int data) + public LSL_Key llRequestSimulatorData(string simulator, int data) { IOSSL_Api ossl = (IOSSL_Api)m_ScriptEngine.GetApi(m_item.ItemID, "OSSL"); @@ -12177,7 +12159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_String llRequestURL() + public LSL_Key llRequestURL() { m_host.AddScriptLPS(1); @@ -12192,11 +12174,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SetForceMouselook(mouselook != 0); } - public LSL_Float llGetObjectMass(string id) + public LSL_Float llGetObjectMass(LSL_Key id) { m_host.AddScriptLPS(1); - UUID key = new UUID(); - if (UUID.TryParse(id, out key)) + UUID key = id; + if (key != UUID.Zero) { // return total object mass SceneObjectPart part = World.GetSceneObjectPart(key); @@ -12307,15 +12289,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llLoadURL(string avatar_id, string message, string url) + public void llLoadURL(LSL_Key avatar_id, string message, string url) { m_host.AddScriptLPS(1); - + UUID av = avatar_id; + if(av == UUID.Zero) + return; IDialogModule dm = World.RequestModuleInterface(); if (null != dm) - dm.SendUrlToUser( - new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url); - + dm.SendUrlToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url); ScriptSleep(m_sleepMsOnLoadURL); } @@ -12329,14 +12311,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // according to the docs, this command only works if script owner and land owner are the same // lets add estate owners and gods, too, and use the generic permission check. ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition); - if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia, false)) return; + if (landObject == null || !World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia, false)) + return; bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? byte loop = 0; LandData landData = landObject.LandData; string url = landData.MediaURL; - string texture = landData.MediaID.ToString(); + UUID texture = landData.MediaID; bool autoAlign = landData.MediaAutoScale != 0; string mediaType = ""; // TODO these have to be added as soon as LandData supports it string description = ""; @@ -12357,10 +12340,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // we send only to one agent if ((i + 1) < commandList.Length) { - if (commandList.Data[i + 1] is LSL_String) + if (commandList.Data[i + 1] is LSL_String || commandList.Data[i + 1] is LSL_Key) { UUID agentID; - if (UUID.TryParse((LSL_String)commandList.Data[i + 1], out agentID)) + if (UUID.TryParse((string)commandList.Data[i + 1], out agentID) && + agentID != UUID.Zero) { presence = World.GetScenePresence(agentID); } @@ -12404,9 +12388,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ParcelMediaCommandEnum.Texture: if ((i + 1) < commandList.Length) { - if (commandList.Data[i + 1] is LSL_String) + if (commandList.Data[i + 1] is LSL_Key || commandList.Data[i + 1] is LSL_String) { - texture = (LSL_String)commandList.Data[i + 1]; + UUID.TryParse((string)commandList.Data[i + 1], out texture); update = true; } else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or a key"); @@ -12580,7 +12564,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).Description)); break; case ParcelMediaCommandEnum.Texture: - list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaID.ToString())); + list.Add(new LSL_Key(World.GetLandData(m_host.AbsolutePosition).MediaID)); break; case ParcelMediaCommandEnum.Type: list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition).MediaType)); @@ -12757,98 +12741,102 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(m_sleepMsOnMapDestination); } - public void llAddToLandBanList(string avatar, double hours) + public void llAddToLandBanList(LSL_Key avatar, double hours) { m_host.AddScriptLPS(1); - UUID key; + + UUID key = avatar; + if(key == UUID.Zero) + return; + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); - if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false)) - { - int expires = 0; - if (hours != 0) - expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); + if (land == null || !World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false)) + return; - if (UUID.TryParse(avatar, out key)) - { - int idx = land.LandData.ParcelAccessList.FindIndex( - delegate(LandAccessEntry e) - { - if (e.AgentID == key && e.Flags == AccessList.Ban) - return true; - return false; - }); + int expires = 0; + if (hours != 0) + expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); - if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) - return; + int idx = land.LandData.ParcelAccessList.FindIndex( + delegate(LandAccessEntry e) + { + if (e.AgentID == key && e.Flags == AccessList.Ban) + return true; + return false; + }); - if (idx != -1) - land.LandData.ParcelAccessList.RemoveAt(idx); + if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) + return; - LandAccessEntry entry = new LandAccessEntry(); + if (idx != -1) + land.LandData.ParcelAccessList.RemoveAt(idx); - entry.AgentID = key; - entry.Flags = AccessList.Ban; - entry.Expires = expires; + LandAccessEntry entry = new LandAccessEntry(); - land.LandData.ParcelAccessList.Add(entry); + entry.AgentID = key; + entry.Flags = AccessList.Ban; + entry.Expires = expires; + + land.LandData.ParcelAccessList.Add(entry); + + World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); - World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); - } - } ScriptSleep(m_sleepMsOnAddToLandBanList); } - public void llRemoveFromLandPassList(string avatar) + public void llRemoveFromLandPassList(LSL_Key avatar) { m_host.AddScriptLPS(1); - UUID key; + UUID key = avatar; + if (key == UUID.Zero) + return; ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); - if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed, false)) - { - if (UUID.TryParse(avatar, out key)) - { - int idx = land.LandData.ParcelAccessList.FindIndex( - delegate(LandAccessEntry e) - { - if (e.AgentID == key && e.Flags == AccessList.Access) - return true; - return false; - }); + if (land == null || !World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed, false)) + return; - if (idx != -1) + int idx = land.LandData.ParcelAccessList.FindIndex( + delegate(LandAccessEntry e) { - land.LandData.ParcelAccessList.RemoveAt(idx); - World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); - } - } + if (e.AgentID == key && e.Flags == AccessList.Access) + return true; + return false; + }); + + if (idx != -1) + { + land.LandData.ParcelAccessList.RemoveAt(idx); + World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); } + ScriptSleep(m_sleepMsOnRemoveFromLandPassList); } - public void llRemoveFromLandBanList(string avatar) + public void llRemoveFromLandBanList(LSL_Key avatar) { m_host.AddScriptLPS(1); - UUID key; - ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); - if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false)) - { - if (UUID.TryParse(avatar, out key)) - { - int idx = land.LandData.ParcelAccessList.FindIndex( - delegate(LandAccessEntry e) - { - if (e.AgentID == key && e.Flags == AccessList.Ban) - return true; - return false; - }); - if (idx != -1) + UUID key = avatar; + if (key == UUID.Zero) + return; + + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); + if (land == null || !World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned, false)) + return; + + int idx = land.LandData.ParcelAccessList.FindIndex( + delegate(LandAccessEntry e) { - land.LandData.ParcelAccessList.RemoveAt(idx); - World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); - } - } + if (e.AgentID == key && e.Flags == AccessList.Ban) + return true; + return false; + }); + + if (idx != -1) + { + land.LandData.ParcelAccessList.RemoveAt(idx); + World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); } + ScriptSleep(m_sleepMsOnRemoveFromLandBanList); } @@ -13123,7 +13111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Convert.ToBase64String(data1); } - public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) + public LSL_Key llHTTPRequest(string url, LSL_List parameters, string body) { // Partial implementation: support for parameter flags needed // see http://wiki.secondlife.com/wiki/LlHTTPRequest @@ -13317,7 +13305,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); if (m_UrlModule != null) - m_UrlModule.HttpResponse(new UUID(id), status,body); + m_UrlModule.HttpResponse(id, status,body); } public void llResetLandBanList() @@ -13405,7 +13393,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (KeyValuePair detectedParams in land.GetLandObjectOwners()) { - ret.Add(new LSL_String(detectedParams.Key.ToString())); + ret.Add(new LSL_Key(detectedParams.Key)); ret.Add(new LSL_Integer(detectedParams.Value)); } } @@ -13413,10 +13401,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ret; } - public LSL_Integer llGetObjectPrimCount(string object_id) + public LSL_Integer llGetObjectPrimCount(LSL_Key object_id) { m_host.AddScriptLPS(1); - SceneObjectPart part = World.GetSceneObjectPart(new UUID(object_id)); + SceneObjectPart part = World.GetSceneObjectPart((UUID)object_id); if (part == null) { return 0; @@ -13462,16 +13450,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ret.Add(new LSL_String(land.Description)); break; case "2": - ret.Add(new LSL_Key(land.OwnerID.ToString())); + ret.Add(new LSL_Key(land.OwnerID)); break; case "3": - ret.Add(new LSL_Key(land.GroupID.ToString())); + ret.Add(new LSL_Key(land.GroupID)); break; case "4": ret.Add(new LSL_Integer(land.Area)); break; case "5": - ret.Add(new LSL_Key(land.GlobalID.ToString())); + ret.Add(new LSL_Key(land.GlobalID)); break; default: ret.Add(new LSL_Integer(0)); @@ -13490,324 +13478,323 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return src; } - public LSL_List llGetObjectDetails(string id, LSL_List args) + public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args) { m_host.AddScriptLPS(1); LSL_List ret = new LSL_List(); - UUID key = new UUID(); - + UUID key = id; + if(key == UUID.Zero) + return ret; - if (UUID.TryParse(id, out key)) + ScenePresence av = World.GetScenePresence(key); + if (av != null) { - ScenePresence av = World.GetScenePresence(key); - - if (av != null) + foreach (object o in args.Data) { - foreach (object o in args.Data) + switch (int.Parse(o.ToString())) { - switch (int.Parse(o.ToString())) - { - case ScriptBaseClass.OBJECT_NAME: - ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); - break; - case ScriptBaseClass.OBJECT_DESC: - ret.Add(new LSL_String("")); - break; - case ScriptBaseClass.OBJECT_POS: - Vector3 avpos; + case ScriptBaseClass.OBJECT_NAME: + ret.Add(new LSL_String(av.Firstname + " " + av.Lastname)); + break; + case ScriptBaseClass.OBJECT_DESC: + ret.Add(new LSL_String("")); + break; + case ScriptBaseClass.OBJECT_POS: + Vector3 avpos; - if (av.ParentID != 0 && av.ParentPart != null && - av.ParentPart.ParentGroup != null && av.ParentPart.ParentGroup.RootPart != null ) + if (av.ParentID != 0 && av.ParentPart != null && + av.ParentPart.ParentGroup != null && + av.ParentPart.ParentGroup.RootPart != null ) + { + avpos = av.OffsetPosition; + + if(!av.LegacySitOffsets) { - avpos = av.OffsetPosition; - - if(!av.LegacySitOffsets) - { - Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f); - avpos -= sitOffset; - } - - SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart; - avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation(); + Vector3 sitOffset = (Zrot(av.Rotation)) * + (av.Appearance.AvatarHeight * 0.02638f *2.0f); + avpos -= sitOffset; } - else - avpos = av.AbsolutePosition; - ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); - break; - case ScriptBaseClass.OBJECT_ROT: - Quaternion avrot = av.GetWorldRotation(); - ret.Add(new LSL_Rotation(avrot)); - break; - case ScriptBaseClass.OBJECT_VELOCITY: - Vector3 avvel = av.GetWorldVelocity(); - ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z)); - break; - case ScriptBaseClass.OBJECT_OWNER: - ret.Add(new LSL_String(id)); - break; - case ScriptBaseClass.OBJECT_GROUP: - ret.Add(new LSL_String(UUID.Zero.ToString())); - break; - case ScriptBaseClass.OBJECT_CREATOR: - ret.Add(new LSL_String(UUID.Zero.ToString())); - break; - // For the following 8 see the Object version below - case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: - ret.Add(new LSL_Integer(av.RunningScriptCount())); - break; - case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: - ret.Add(new LSL_Integer(av.ScriptCount())); - break; - case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: - ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); - break; - case ScriptBaseClass.OBJECT_SCRIPT_TIME: - ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); - break; - case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: - ret.Add(new LSL_Integer(1)); - break; - case ScriptBaseClass.OBJECT_SERVER_COST: - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_STREAMING_COST: - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_PHYSICS_COST: - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_ROOT: - SceneObjectPart p = av.ParentPart; - if (p != null) - { - ret.Add(new LSL_String(p.ParentGroup.RootPart.UUID.ToString())); - } - else - { - ret.Add(new LSL_String(id)); - } - break; - case ScriptBaseClass.OBJECT_ATTACHED_POINT: - ret.Add(new LSL_Integer(0)); - break; - case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding - ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR)); - break; - case ScriptBaseClass.OBJECT_PHYSICS: - ret.Add(new LSL_Integer(0)); - break; - case ScriptBaseClass.OBJECT_PHANTOM: - ret.Add(new LSL_Integer(0)); - break; - case ScriptBaseClass.OBJECT_TEMP_ON_REZ: - ret.Add(new LSL_Integer(0)); - break; - case ScriptBaseClass.OBJECT_RENDER_WEIGHT: - ret.Add(new LSL_Integer(-1)); - break; - case ScriptBaseClass.OBJECT_HOVER_HEIGHT: - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE: - LSL_Float shapeType; - if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0) - shapeType = new LSL_Float(1); - else - shapeType = new LSL_Float(0); - ret.Add(shapeType); - break; - case ScriptBaseClass.OBJECT_LAST_OWNER_ID: - ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY)); - break; - default: - // Invalid or unhandled constant. - ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); - break; - } + SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart; + avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation(); + } + else + avpos = av.AbsolutePosition; + + ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); + break; + case ScriptBaseClass.OBJECT_ROT: + Quaternion avrot = av.GetWorldRotation(); + ret.Add(new LSL_Rotation(avrot)); + break; + case ScriptBaseClass.OBJECT_VELOCITY: + Vector3 avvel = av.GetWorldVelocity(); + ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z)); + break; + case ScriptBaseClass.OBJECT_OWNER: + ret.Add(new LSL_Key(id)); + break; + case ScriptBaseClass.OBJECT_GROUP: + ret.Add(new LSL_Key(UUID.Zero)); + break; + case ScriptBaseClass.OBJECT_CREATOR: + ret.Add(new LSL_Key(UUID.Zero)); + break; + // For the following 8 see the Object version below + case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: + ret.Add(new LSL_Integer(av.RunningScriptCount())); + break; + case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: + ret.Add(new LSL_Integer(av.ScriptCount())); + break; + case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: + ret.Add(new LSL_Integer(av.RunningScriptCount() * 16384)); + break; + case ScriptBaseClass.OBJECT_SCRIPT_TIME: + ret.Add(new LSL_Float(av.ScriptExecutionTime() / 1000.0f)); + break; + case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: + ret.Add(new LSL_Integer(1)); + break; + case ScriptBaseClass.OBJECT_SERVER_COST: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_STREAMING_COST: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_PHYSICS_COST: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_ROOT: + SceneObjectPart p = av.ParentPart; + if (p != null) + { + ret.Add(new LSL_Key(p.ParentGroup.RootPart.UUID)); + } + else + { + ret.Add(new LSL_Key(id)); + } + break; + case ScriptBaseClass.OBJECT_ATTACHED_POINT: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: // Pathfinding + ret.Add(new LSL_Integer(ScriptBaseClass.OPT_AVATAR)); + break; + case ScriptBaseClass.OBJECT_PHYSICS: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_PHANTOM: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_TEMP_ON_REZ: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_RENDER_WEIGHT: + ret.Add(new LSL_Integer(-1)); + break; + case ScriptBaseClass.OBJECT_HOVER_HEIGHT: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE: + LSL_Float shapeType; + if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0) + shapeType = new LSL_Float(1); + else + shapeType = new LSL_Float(0); + ret.Add(shapeType); + break; + case ScriptBaseClass.OBJECT_LAST_OWNER_ID: + ret.Add(new LSL_Key(UUID.Zero)); + break; + default: + // Invalid or unhandled constant. + ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); + break; } - - return ret; } - SceneObjectPart obj = World.GetSceneObjectPart(key); - if (obj != null) - { - foreach (object o in args.Data) - { - switch (int.Parse(o.ToString())) - { - case ScriptBaseClass.OBJECT_NAME: - ret.Add(new LSL_String(obj.Name)); - break; - case ScriptBaseClass.OBJECT_DESC: - ret.Add(new LSL_String(obj.Description)); - break; - case ScriptBaseClass.OBJECT_POS: - Vector3 opos = obj.AbsolutePosition; - ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); - break; - case ScriptBaseClass.OBJECT_ROT: - Quaternion rot = Quaternion.Identity; - - if (obj.ParentGroup.IsAttachment) - { - ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); - - if (sp != null) - rot = sp.GetWorldRotation(); - } - else - { - if (obj.ParentGroup.RootPart == obj) - rot = obj.ParentGroup.GroupRotation; - else - rot = obj.GetWorldRotation(); - } - - LSL_Rotation objrot = new LSL_Rotation(rot); - ret.Add(objrot); - - break; - case ScriptBaseClass.OBJECT_VELOCITY: - Vector3 vel = Vector3.Zero; - - if (obj.ParentGroup.IsAttachment) - { - ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); - - if (sp != null) - vel = sp.GetWorldVelocity(); - } - else - { - vel = obj.Velocity; - } - - ret.Add(vel); - break; - case ScriptBaseClass.OBJECT_OWNER: - ret.Add(new LSL_String(obj.OwnerID.ToString())); - break; - case ScriptBaseClass.OBJECT_GROUP: - ret.Add(new LSL_String(obj.GroupID.ToString())); - break; - case ScriptBaseClass.OBJECT_CREATOR: - ret.Add(new LSL_String(obj.CreatorID.ToString())); - break; - case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: - ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); - break; - case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: - ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); - break; - case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: - // The value returned in SL for mono scripts is 65536 * number of active scripts - // and 16384 * number of active scripts for LSO. since llGetFreememory - // is coded to give the LSO value use it here - ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); - break; - case ScriptBaseClass.OBJECT_SCRIPT_TIME: - // Average cpu time in seconds per simulator frame expended on all scripts in the object - ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); - break; - case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: - // according to the SL wiki A prim or linkset will have prim - // equivalent of the number of prims in a linkset if it does not - // contain a mesh anywhere in the link set or is not a normal prim - // The value returned in SL for normal prims is prim count - ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); - break; - - // costs below may need to be diferent for root parts, need to check - case ScriptBaseClass.OBJECT_SERVER_COST: - // The linden calculation is here - // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight - // The value returned in SL for normal prims looks like the prim count - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_STREAMING_COST: - // The value returned in SL for normal prims is prim count * 0.06 - ret.Add(new LSL_Float(obj.StreamingCost)); - break; - case ScriptBaseClass.OBJECT_PHYSICS_COST: - // The value returned in SL for normal prims is prim count - ret.Add(new LSL_Float(obj.PhysicsCost)); - break; - case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_ROOT: - ret.Add(new LSL_String(obj.ParentGroup.RootPart.UUID.ToString())); - break; - case ScriptBaseClass.OBJECT_ATTACHED_POINT: - ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint)); - break; - case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: - byte pcode = obj.Shape.PCode; - if (obj.ParentGroup.AttachmentPoint != 0 - || pcode == (byte)PCode.Grass - || pcode == (byte)PCode.Tree - || pcode == (byte)PCode.NewTree) - { - ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER)); - } - else - { - ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET)); - } - break; - case ScriptBaseClass.OBJECT_PHYSICS: - if (obj.ParentGroup.AttachmentPoint != 0) - { - ret.Add(new LSL_Integer(0)); // Always false if attached - } - else - { - ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0)); - } - break; - case ScriptBaseClass.OBJECT_PHANTOM: - if (obj.ParentGroup.AttachmentPoint != 0) - { - ret.Add(new LSL_Integer(0)); // Always false if attached - } - else - { - ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0)); - } - break; - case ScriptBaseClass.OBJECT_TEMP_ON_REZ: - ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0)); - break; - case ScriptBaseClass.OBJECT_RENDER_WEIGHT: - ret.Add(new LSL_Integer(0)); - break; - case ScriptBaseClass.OBJECT_HOVER_HEIGHT: - ret.Add(new LSL_Float(0)); - break; - case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE: - ret.Add(new LSL_Float(-1)); - break; - case ScriptBaseClass.OBJECT_LAST_OWNER_ID: - ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString())); - break; - default: - // Invalid or unhandled constant. - ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); - break; - } - } - - return ret; - } + return ret; } - return new LSL_List(); + SceneObjectPart obj = World.GetSceneObjectPart(key); + if (obj != null) + { + foreach (object o in args.Data) + { + switch (int.Parse(o.ToString())) + { + case ScriptBaseClass.OBJECT_NAME: + ret.Add(new LSL_String(obj.Name)); + break; + case ScriptBaseClass.OBJECT_DESC: + ret.Add(new LSL_String(obj.Description)); + break; + case ScriptBaseClass.OBJECT_POS: + Vector3 opos = obj.AbsolutePosition; + ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); + break; + case ScriptBaseClass.OBJECT_ROT: + Quaternion rot = Quaternion.Identity; + + if (obj.ParentGroup.IsAttachment) + { + ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); + + if (sp != null) + rot = sp.GetWorldRotation(); + } + else + { + if (obj.ParentGroup.RootPart == obj) + rot = obj.ParentGroup.GroupRotation; + else + rot = obj.GetWorldRotation(); + } + + LSL_Rotation objrot = new LSL_Rotation(rot); + ret.Add(objrot); + + break; + case ScriptBaseClass.OBJECT_VELOCITY: + Vector3 vel = Vector3.Zero; + + if (obj.ParentGroup.IsAttachment) + { + ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar); + + if (sp != null) + vel = sp.GetWorldVelocity(); + } + else + { + vel = obj.Velocity; + } + + ret.Add(vel); + break; + case ScriptBaseClass.OBJECT_OWNER: + ret.Add(new LSL_Key(obj.OwnerID)); + break; + case ScriptBaseClass.OBJECT_GROUP: + ret.Add(new LSL_Key(obj.GroupID)); + break; + case ScriptBaseClass.OBJECT_CREATOR: + ret.Add(new LSL_Key(obj.CreatorID)); + break; + case ScriptBaseClass.OBJECT_RUNNING_SCRIPT_COUNT: + ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount())); + break; + case ScriptBaseClass.OBJECT_TOTAL_SCRIPT_COUNT: + ret.Add(new LSL_Integer(obj.ParentGroup.ScriptCount())); + break; + case ScriptBaseClass.OBJECT_SCRIPT_MEMORY: + // The value returned in SL for mono scripts is 65536 * number of active scripts + // and 16384 * number of active scripts for LSO. since llGetFreememory + // is coded to give the LSO value use it here + ret.Add(new LSL_Integer(obj.ParentGroup.RunningScriptCount() * 16384)); + break; + case ScriptBaseClass.OBJECT_SCRIPT_TIME: + // Average cpu time in seconds per simulator frame expended on all scripts in the object + ret.Add(new LSL_Float(obj.ParentGroup.ScriptExecutionTime() / 1000.0f)); + break; + case ScriptBaseClass.OBJECT_PRIM_EQUIVALENCE: + // according to the SL wiki A prim or linkset will have prim + // equivalent of the number of prims in a linkset if it does not + // contain a mesh anywhere in the link set or is not a normal prim + // The value returned in SL for normal prims is prim count + ret.Add(new LSL_Integer(obj.ParentGroup.PrimCount)); + break; + + // costs below may need to be diferent for root parts, need to check + case ScriptBaseClass.OBJECT_SERVER_COST: + // The linden calculation is here + // http://wiki.secondlife.com/wiki/Mesh/Mesh_Server_Weight + // The value returned in SL for normal prims looks like the prim count + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_STREAMING_COST: + // The value returned in SL for normal prims is prim count * 0.06 + ret.Add(new LSL_Float(obj.StreamingCost)); + break; + case ScriptBaseClass.OBJECT_PHYSICS_COST: + // The value returned in SL for normal prims is prim count + ret.Add(new LSL_Float(obj.PhysicsCost)); + break; + case ScriptBaseClass.OBJECT_CHARACTER_TIME: // Pathfinding + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_ROOT: + ret.Add(new LSL_Key(obj.ParentGroup.RootPart.UUID)); + break; + case ScriptBaseClass.OBJECT_ATTACHED_POINT: + ret.Add(new LSL_Integer(obj.ParentGroup.AttachmentPoint)); + break; + case ScriptBaseClass.OBJECT_PATHFINDING_TYPE: + byte pcode = obj.Shape.PCode; + if (obj.ParentGroup.AttachmentPoint != 0 + || pcode == (byte)PCode.Grass + || pcode == (byte)PCode.Tree + || pcode == (byte)PCode.NewTree) + { + ret.Add(new LSL_Integer(ScriptBaseClass.OPT_OTHER)); + } + else + { + ret.Add(new LSL_Integer(ScriptBaseClass.OPT_LEGACY_LINKSET)); + } + break; + case ScriptBaseClass.OBJECT_PHYSICS: + if (obj.ParentGroup.AttachmentPoint != 0) + { + ret.Add(new LSL_Integer(0)); // Always false if attached + } + else + { + ret.Add(new LSL_Integer(obj.ParentGroup.UsesPhysics ? 1 : 0)); + } + break; + case ScriptBaseClass.OBJECT_PHANTOM: + if (obj.ParentGroup.AttachmentPoint != 0) + { + ret.Add(new LSL_Integer(0)); // Always false if attached + } + else + { + ret.Add(new LSL_Integer(obj.ParentGroup.IsPhantom ? 1 : 0)); + } + break; + case ScriptBaseClass.OBJECT_TEMP_ON_REZ: + ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0)); + break; + case ScriptBaseClass.OBJECT_RENDER_WEIGHT: + ret.Add(new LSL_Integer(0)); + break; + case ScriptBaseClass.OBJECT_HOVER_HEIGHT: + ret.Add(new LSL_Float(0)); + break; + case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE: + ret.Add(new LSL_Float(-1)); + break; + case ScriptBaseClass.OBJECT_LAST_OWNER_ID: + ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID)); + break; + default: + // Invalid or unhandled constant. + ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); + break; + } + } + + return ret; + } + + return ret; } internal UUID GetScriptByName(string name) @@ -13899,7 +13886,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api }); } - public LSL_String llGetNumberOfNotecardLines(string name) + public LSL_Key llGetNumberOfNotecardLines(string name) { m_host.AddScriptLPS(1); @@ -13950,7 +13937,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return tid.ToString(); } - public LSL_String llGetNotecardLine(string name, int line) + public LSL_Key llGetNotecardLine(string name, int line) { m_host.AddScriptLPS(1); @@ -13969,7 +13956,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // => complain loudly, as specified by the LSL docs Error("llGetNotecardLine", "Can't find notecard '" + name + "'"); - return UUID.Zero.ToString(); + return UUID.Zero; } string reqIdentifier = UUID.Random().ToString(); @@ -14007,7 +13994,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc) { - SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); + SceneObjectPart obj = World.GetSceneObjectPart((UUID)prim); if (obj == null) return; @@ -14019,7 +14006,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { - SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); + SceneObjectPart obj = World.GetSceneObjectPart((UUID)prim); LSL_List result = new LSL_List(); @@ -14072,12 +14059,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return name.Replace(" ", ".").ToLower(); } - public LSL_String llGetUsername(string id) + public LSL_String llGetUsername(LSL_Key id) { return Name2Username(llKey2Name(id)); } - public LSL_String llRequestUsername(string id) + public LSL_Key llRequestUsername(LSL_Key id) { UUID rq = UUID.Random(); @@ -14088,12 +14075,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return rq.ToString(); } - public LSL_String llGetDisplayName(string id) + public LSL_String llGetDisplayName(LSL_Key id) { return llKey2Name(id); } - public LSL_String llRequestDisplayName(string id) + public LSL_Key llRequestDisplayName(LSL_Key id) { UUID rq = UUID.Random(); @@ -14603,8 +14590,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api itemID = sp.UUID; } - list.Add(new LSL_String(itemID.ToString())); - list.Add(new LSL_String(result.Pos.ToString())); + list.Add(new LSL_Key(itemID)); + list.Add(new LSL_Vector(result.Pos)); if ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) == ScriptBaseClass.RC_GET_LINK_NUM) list.Add(new LSL_Integer(linkNum)); @@ -15060,9 +15047,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { RayHit rayHit = rayHits[i]; if (getRootKey) - result.Add(new LSL_Key(rayHit.GroupId.ToString())); + result.Add(new LSL_Key(rayHit.GroupId)); else - result.Add(new LSL_Key(rayHit.PartId.ToString())); + result.Add(new LSL_Key(rayHit.PartId)); result.Add(new LSL_Vector(rayHit.Position)); if (getLinkNum) result.Add(new LSL_Integer(rayHit.Link)); @@ -15489,7 +15476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; } - public LSL_Integer llManageEstateAccess(int action, string avatar) + public LSL_Integer llManageEstateAccess(int action, LSL_Key avatar) { m_host.AddScriptLPS(1); EstateSettings estate = World.RegionInfo.EstateSettings; @@ -15499,8 +15486,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!estate.IsEstateOwner(m_host.OwnerID) || !estate.IsEstateManagerOrOwner(m_host.OwnerID)) return 0; - UUID id = new UUID(); - if (!UUID.TryParse(avatar, out id)) + UUID id = avatar; + if (id == UUID.Zero) return 0; UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, id); @@ -15613,14 +15600,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // of fixing it. Therefore, letting this be a NOP seems appropriate. } - public void llGodLikeRezObject(string inventory, LSL_Vector pos) + public void llGodLikeRezObject(LSL_Key inventory, LSL_Vector pos) { m_host.AddScriptLPS(1); if (!World.Permissions.IsGod(m_host.OwnerID)) NotImplemented("llGodLikeRezObject"); - AssetBase rezAsset = World.AssetService.Get(inventory); + AssetBase rezAsset = World.AssetService.Get(inventory.ToString()); if (rezAsset == null) { llSay(0, "Asset not found"); @@ -15663,19 +15650,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( "object_rez", new Object[] { - new LSL_String( - group.RootPart.UUID.ToString()) }, + new LSL_Key(group.RootPart.UUID) }, new DetectParams[0])); } - public LSL_String llTransferLindenDollars(string destination, int amount) + public LSL_Key llTransferLindenDollars(LSL_Key destination, int amount) { UUID txn = UUID.Random(); Util.FireAndForget(delegate(object x) { int replycode = 0; - string replydata = destination + "," + amount.ToString(); + string replydata = destination.ToString() + "," + amount.ToString(); try { @@ -15712,9 +15698,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - UUID toID = new UUID(); + UUID toID = destination; - if (!UUID.TryParse(destination, out toID)) + if (toID == UUID.Zero) { replydata = "INVALID_AGENT"; return; @@ -15750,7 +15736,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( "transaction_result", new Object[] { - new LSL_String(txn.ToString()), + new LSL_Key(txn), new LSL_Integer(replycode), new LSL_String(replydata) }, new DetectParams[0])); @@ -16018,7 +16004,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (face = 0; face < 21; face++) { - res.Add(new LSL_String("")); + res.Add(new LSL_Key(UUID.Zero)); res.Add(new LSL_Vector(0,0,0)); res.Add(new LSL_Vector(0,0,0)); res.Add(new LSL_Float(0.0)); @@ -16028,7 +16014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (face >= 0 && face < 21) { - res.Add(new LSL_String("")); + res.Add(new LSL_Key(UUID.Zero)); res.Add(new LSL_Vector(0,0,0)); res.Add(new LSL_Vector(0,0,0)); res.Add(new LSL_Float(0.0)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index e5e43f80fd..4f2426bd45 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -567,7 +567,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api idx++; try { - wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); + wl.normalMapTexture = new UUID(rules.GetLSLKeyItem(idx).m_string); } catch (ArgumentException) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 7bd4fa7cae..e4287a74c3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -46,7 +46,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; @@ -202,8 +202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (returntype != typeof(UUID)) MODError(String.Format("return type mismatch for {0}",fname)); - UUID result = (UUID)modInvoke(fname,parms); - return new LSL_Key(result.ToString()); + return (UUID)modInvoke(fname,parms); } public LSL_Vector modInvokeV(string fname, params object[] parms) @@ -394,7 +393,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else if (lslparm is LSL_Key) { if (type == typeof(UUID)) - return new UUID((LSL_Key)lslparm); + return (UUID)((LSL_Key)lslparm); } // ---------- Rotation ---------- @@ -435,7 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api else if (plist[i] is LSL_Float) result[i] = (float)(LSL_Float)plist[i]; else if (plist[i] is LSL_Key) - result[i] = new UUID((LSL_Key)plist[i]); + result[i] = (UUID)((LSL_Key)plist[i]); else if (plist[i] is LSL_Rotation) result[i] = (Quaternion)((LSL_Rotation)plist[i]); else if (plist[i] is LSL_Vector) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4af433926d..37db84e149 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -58,7 +58,7 @@ using System.Text.RegularExpressions; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; @@ -626,7 +626,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, + public LSL_Key osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { // This may be upgraded depending on the griefing or DOS @@ -651,7 +651,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, + public LSL_Key osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, int timer, int alpha) { CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlend"); @@ -673,7 +673,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, + public LSL_Key osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, bool blend, int disp, int timer, int alpha, int face) { CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureURLBlendFace"); @@ -695,7 +695,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, + public LSL_Key osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer) { CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureData"); @@ -724,7 +724,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, + public LSL_Key osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, int timer, int alpha) { CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlend"); @@ -753,7 +753,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, + public LSL_Key osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, bool blend, int disp, int timer, int alpha, int face) { CheckThreatLevel(ThreatLevel.VeryLow, "osSetDynamicTextureDataBlendFace"); @@ -808,7 +808,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Teleport functions - public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + public void osTeleportAgent(LSL_Key agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // @@ -817,7 +817,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api TeleportAgent(agent, regionName, position, lookat, false); } - private void TeleportAgent(string agent, string regionName, + private void TeleportAgent(LSL_Key agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { m_host.AddScriptLPS(1); @@ -853,7 +853,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osTeleportAgent(string agent, int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + public void osTeleportAgent(LSL_Key agent, int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // @@ -862,7 +862,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api TeleportAgent(agent, regionGridX, regionGridY, position, lookat, false); } - private void TeleportAgent(string agent, int regionGridX, int regionGridY, + private void TeleportAgent(LSL_Key agent, int regionGridX, int regionGridY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { ulong regionHandle = Util.RegionGridLocToHandle((uint)regionGridX, (uint)regionGridY); @@ -900,7 +900,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + public void osTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); } @@ -932,7 +932,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Does work if passed key (or keys if overloaded). /// /// - public void osForceOtherSit(string avatar) + public void osForceOtherSit(LSL_Key avatar) { CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); @@ -947,7 +947,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// /// - public void osForceOtherSit(string avatar, string target) + public void osForceOtherSit(LSL_Key avatar, string target) { CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit"); @@ -958,7 +958,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ForceSit(avatar, targetID); } - public void ForceSit(string avatar, UUID targetID) + public void ForceSit(LSL_Key avatar, UUID targetID) { UUID agentID; @@ -985,14 +985,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //resources based on the IP address of the clients connected. //I think High is a good risk level for this, as it is an //information leak. - public string osGetAgentIP(string agent) + public string osGetAgentIP(LSL_Key agent) { CheckThreatLevel(ThreatLevel.High, "osGetAgentIP"); - UUID avatarID = (UUID)agent; + UUID avatarID; + if (!UUID.TryParse(agent, out avatarID)) + return ""; m_host.AddScriptLPS(1); - if (World.Entities.ContainsKey((UUID)agent) && World.Entities[avatarID] is ScenePresence) + if (World.Entities.ContainsKey(avatarID) && World.Entities[avatarID] is ScenePresence) { ScenePresence target = (ScenePresence)World.Entities[avatarID]; return target.ControllingClient.RemoteEndPoint.Address.ToString(); @@ -1019,14 +1021,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Adam's super super custom animation functions - public void osAvatarPlayAnimation(string avatar, string animation) + public void osAvatarPlayAnimation(LSL_Key avatar, string animation) { CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarPlayAnimation"); AvatarPlayAnimation(avatar, animation); } - private void AvatarPlayAnimation(string avatar, string animation) + private void AvatarPlayAnimation(LSL_Key avatar, string animation) { m_host.AddScriptLPS(1); @@ -1065,16 +1067,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api target.Animator.AddAnimation(animID, m_host.UUID); } - public void osAvatarStopAnimation(string avatar, string animation) + public void osAvatarStopAnimation(LSL_Key avatar, string animation) { CheckThreatLevel(ThreatLevel.VeryHigh, "osAvatarStopAnimation"); AvatarStopAnimation(avatar, animation); } - private void AvatarStopAnimation(string avatar, string animation) + private void AvatarStopAnimation(LSL_Key avatar, string animation) { - UUID avatarID = (UUID)avatar; + UUID avatarID; + if(!UUID.TryParse(avatar, out avatarID)) + return; m_host.AddScriptLPS(1); @@ -1859,7 +1863,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private void MessageObject(UUID objUUID, string message) { - object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; + object[] resobj = new object[] { + new LSL_Types.key(m_host.UUID), + new LSL_Types.LSLString(message) }; SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID); @@ -2143,7 +2149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return NotecardCache.GetLines(assetID); } - public string osAvatarName2Key(string firstname, string lastname) + public LSL_Key osAvatarName2Key(string firstname, string lastname) { CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); m_host.AddScriptLPS(1); @@ -2195,7 +2201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public string osKey2Name(string id) + public string osKey2Name(LSL_Key id) { CheckThreatLevel(ThreatLevel.Low, "osKey2Name"); m_host.AddScriptLPS(1); @@ -2414,17 +2420,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return retval; } - public string osGetAvatarHomeURI(string uuid) + public string osGetAvatarHomeURI(LSL_Key id) { CheckThreatLevel(ThreatLevel.Low, "osGetAvatarHomeURI"); m_host.AddScriptLPS(1); + UUID uuid; + if(!UUID.TryParse(id, out uuid)) + return ""; IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface(); string returnValue = ""; if (userManager != null) { - returnValue = userManager.GetUserServerURL(new UUID(uuid), "HomeURI"); + returnValue = userManager.GetUserServerURL(uuid, "HomeURI"); } if (returnValue == "") @@ -2538,7 +2547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return World.RegionInfo.RegionSettings.LoadedCreationTime; } - public string osLoadedCreationID() + public LSL_Key osLoadedCreationID() { CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationID"); m_host.AddScriptLPS(1); @@ -2587,7 +2596,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return retVal; } - public void osForceCreateLink(string target, int parent) + public void osForceCreateLink(LSL_Key target, int parent) { CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink"); @@ -2626,7 +2635,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { UUID npcId; - if (UUID.TryParse(npc.m_string, out npcId)) + if (UUID.TryParse(npc, out npcId)) if (module.IsNPC(npcId, World)) return ScriptBaseClass.TRUE; } @@ -2642,7 +2651,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // have to get the npc module also here to set the default Not Owned INPCModule module = World.RequestModuleInterface(); if(module == null) - return new LSL_Key(UUID.Zero.ToString()); + return new LSL_Key(UUID.Zero); bool owned = (module.NPCOptionFlags & NPCOptionsFlags.AllowNotOwned) == 0; @@ -2666,11 +2675,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (!World.Permissions.CanRezObject(1, m_host.OwnerID, new Vector3((float)position.x, (float)position.y, (float)position.z))) - return new LSL_Key(UUID.Zero.ToString()); + return new LSL_Key(UUID.Zero); INPCModule module = World.RequestModuleInterface(); if(module == null) - new LSL_Key(UUID.Zero.ToString()); + new LSL_Key(UUID.Zero); string groupTitle = String.Empty; UUID groupID = UUID.Zero; @@ -2701,7 +2710,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (member == null) { OSSLError(string.Format("osNpcCreate: the object owner is not member of the object group")); - return new LSL_Key(UUID.Zero.ToString()); + return new LSL_Key(UUID.Zero); } groupID = m_host.GroupID; @@ -2750,7 +2759,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api catch { OSSLError(string.Format("osNpcCreate: Error processing notcard '{0}'", notecard)); - return new LSL_Key(UUID.Zero.ToString()); + return new LSL_Key(UUID.Zero); } } else @@ -2797,16 +2806,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { UUID npcId; - if (!UUID.TryParse(npc.m_string, out npcId)) - return new LSL_Key(UUID.Zero.ToString()); + if (!UUID.TryParse(npc.ToString(), out npcId)) + return UUID.Zero; if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) - return new LSL_Key(UUID.Zero.ToString()); + return UUID.Zero; return SaveAppearanceToNotecard(npcId, notecard); } - return new LSL_Key(UUID.Zero.ToString()); + return UUID.Zero; } public void osNpcLoadAppearance(LSL_Key npc, string notecard) @@ -2819,7 +2828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { UUID npcId; - if (!UUID.TryParse(npc.m_string, out npcId)) + if (!UUID.TryParse(npc, out npcId)) return; if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) @@ -2850,7 +2859,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { UUID npcId; - if (UUID.TryParse(npc.m_string, out npcId)) + if (UUID.TryParse(npc, out npcId)) { UUID owner = npcModule.GetOwner(npcId); if (owner != UUID.Zero) @@ -2872,7 +2881,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { UUID npcId; - if (!UUID.TryParse(npc.m_string, out npcId)) + if (!UUID.TryParse(npc, out npcId)) return new LSL_Vector(0, 0, 0); if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) @@ -2896,7 +2905,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { UUID npcId; - if (!UUID.TryParse(npc.m_string, out npcId)) + if (!UUID.TryParse(npc, out npcId)) return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) @@ -2915,14 +2924,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { UUID npcId; - if (!UUID.TryParse(npc.m_string, out npcId)) + if (!UUID.TryParse(npc, out npcId)) return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; module.MoveToTarget( - new UUID(npc.m_string), + npcId, World, target, (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, @@ -2940,7 +2949,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { UUID npcId; - if (!UUID.TryParse(npc.m_string, out npcId)) + if (!UUID.TryParse(npc, out npcId)) return new LSL_Rotation(Quaternion.Identity); if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) @@ -2964,7 +2973,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { UUID npcId; - if (!UUID.TryParse(npc.m_string, out npcId)) + if (!UUID.TryParse(npc, out npcId)) return; if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) @@ -2985,7 +2994,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc, out npcId)) + return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; @@ -3007,7 +3018,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc, out npcId)) + return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; @@ -3024,7 +3037,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc, out npcId)) + return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; @@ -3041,12 +3056,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc, out npcId)) + return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; - module.Sit(npcId, new UUID(target.m_string), World); + module.Sit(npcId, (UUID)target, World); } } @@ -3058,7 +3075,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc, out npcId)) + return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; @@ -3077,7 +3096,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc, out npcId)) + return; if (!module.CheckPermissions(npcId, m_host.OwnerID)) return; @@ -3096,7 +3117,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcID = new UUID(npc.m_string); + UUID npcID; + if (!UUID.TryParse(npc, out npcID)) + return; if (module.CheckPermissions(npcID, m_host.OwnerID)) AvatarPlayAnimation(npcID.ToString(), animation); @@ -3111,7 +3134,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcID = new UUID(npc.m_string); + UUID npcID; + if (!UUID.TryParse(npc, out npcID)) + return; if (module.CheckPermissions(npcID, m_host.OwnerID)) AvatarStopAnimation(npcID.ToString(), animation); @@ -3126,12 +3151,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - UUID npcId = new UUID(npc.m_string); - - if (!module.CheckPermissions(npcId, m_host.OwnerID)) + UUID npcID; + if (!UUID.TryParse(npc, out npcID)) return; - module.Whisper(npcId, World, message, channel); + if (!module.CheckPermissions(npcID, m_host.OwnerID)) + return; + + module.Whisper(npcID, World, message, channel); } } @@ -3367,11 +3394,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return (int)pws; } - public void osSetSpeed(string UUID, LSL_Float SpeedModifier) + public void osSetSpeed(LSL_Key UUID, LSL_Float SpeedModifier) { CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); m_host.AddScriptLPS(1); - ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); + ScenePresence avatar = World.GetScenePresence((UUID)UUID); if (avatar != null) avatar.SpeedModifier = (float)SpeedModifier; @@ -3396,23 +3423,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api }); } - public LSL_Float osGetHealth(string avatar) + public LSL_Float osGetHealth(LSL_Key avatar) { CheckThreatLevel(ThreatLevel.None, "osGetHealth"); m_host.AddScriptLPS(1); LSL_Float health = new LSL_Float(-1); - ScenePresence presence = World.GetScenePresence(new UUID(avatar)); + ScenePresence presence = World.GetScenePresence((UUID)avatar); if (presence != null) health = presence.Health; return health; } - public void osCauseDamage(string avatar, double damage) + public void osCauseDamage(LSL_Key avatar, double damage) { CheckThreatLevel(ThreatLevel.High, "osCauseDamage"); m_host.AddScriptLPS(1); - UUID avatarId = new UUID(avatar); + UUID avatarId = (UUID)avatar; Vector3 pos = m_host.GetWorldPosition(); ScenePresence presence = World.GetScenePresence(avatarId); @@ -3435,12 +3462,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osCauseHealing(string avatar, double healing) + public void osCauseHealing(LSL_Key avatar, double healing) { CheckThreatLevel(ThreatLevel.High, "osCauseHealing"); m_host.AddScriptLPS(1); - UUID avatarId = new UUID(avatar); + UUID avatarId = (UUID)avatar; ScenePresence presence = World.GetScenePresence(avatarId); if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) @@ -3455,12 +3482,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osSetHealth(string avatar, double health) + public void osSetHealth(LSL_Key avatar, double health) { CheckThreatLevel(ThreatLevel.High, "osSetHealth"); m_host.AddScriptLPS(1); - UUID avatarId = new UUID(avatar); + UUID avatarId = (UUID)avatar; ScenePresence presence = World.GetScenePresence(avatarId); if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) @@ -3474,25 +3501,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osSetHealRate(string avatar, double healrate) + public void osSetHealRate(LSL_Key avatar, double healrate) { CheckThreatLevel(ThreatLevel.High, "osSetHealRate"); m_host.AddScriptLPS(1); - UUID avatarId = new UUID(avatar); + UUID avatarId = (UUID)avatar; ScenePresence presence = World.GetScenePresence(avatarId); if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition())) presence.HealRate = (float)healrate; } - public LSL_Float osGetHealRate(string avatar) + public LSL_Float osGetHealRate(LSL_Key avatar) { CheckThreatLevel(ThreatLevel.None, "osGetHealRate"); m_host.AddScriptLPS(1); LSL_Float rate = new LSL_Float(0); - ScenePresence presence = World.GetScenePresence(new UUID(avatar)); + ScenePresence presence = World.GetScenePresence((UUID)avatar); if (presence != null) rate = presence.HealRate; return rate; @@ -3541,13 +3568,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - obj = World.GetSceneObjectPart(new UUID(prim)); + obj = World.GetSceneObjectPart((UUID)prim); if (obj == null) return; } obj.Shape.ProjectionEntry = projection; - obj.Shape.ProjectionTextureUUID = new UUID(texture); + obj.Shape.ProjectionTextureUUID = (UUID)texture; obj.Shape.ProjectionFOV = (float)fov; obj.Shape.ProjectionFocus = (float)focus; obj.Shape.ProjectionAmbiance = (float)amb; @@ -3570,7 +3597,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (avatar != null && avatar.UUID != m_host.OwnerID) { - result.Add(new LSL_String(avatar.UUID.ToString())); + result.Add(new LSL_Key(avatar.UUID)); result.Add(new LSL_Vector(avatar.AbsolutePosition)); result.Add(new LSL_String(avatar.Name)); } @@ -3630,7 +3657,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup"); m_host.AddScriptLPS(1); - UUID agent = new UUID(agentId); + UUID agent = (UUID)agentId; // groups module is required IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface(); @@ -3665,7 +3692,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup"); m_host.AddScriptLPS(1); - UUID agent = new UUID(agentId); + UUID agent = (UUID)agentId; // groups module is required IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface(); @@ -3765,7 +3792,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint); } - public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint) + public void osForceAttachToOtherAvatarFromInventory(LSL_Key rawAvatarId, string itemName, int attachmentPoint) { CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAttachToOtherAvatarFromInventory"); @@ -4064,7 +4091,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osSetContentType"); if (m_UrlModule != null) - m_UrlModule.HttpContentType(new UUID(id),type); + m_UrlModule.HttpContentType((UUID)id, type); } /// Shout an error if the object owner did not grant the script the specified permissions. @@ -4153,7 +4180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api DropAttachmentAt(false, pos, rot); } - public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield) + public LSL_Integer osListenRegex(int channelID, string name, LSL_Key ID, string msg, int regexBitfield) { CheckThreatLevel(ThreatLevel.Low, "osListenRegex"); m_host.AddScriptLPS(1); @@ -4216,7 +4243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_String osRequestURL(LSL_List options) + public LSL_Key osRequestURL(LSL_List options) { CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); m_host.AddScriptLPS(1); @@ -4234,7 +4261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return UUID.Zero.ToString(); } - public LSL_String osRequestSecureURL(LSL_List options) + public LSL_Key osRequestSecureURL(LSL_List options) { CheckThreatLevel(ThreatLevel.Moderate, "osRequestSecureURL"); m_host.AddScriptLPS(1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs index 9f78a49c0f..b6104d8458 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs @@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins m_CmdManager.m_ScriptEngine.PostObjectEvent(ds.localID, new EventParams("dataserver", new Object[] - { new LSL_Types.LSLString(ds.ID.ToString()), + { new LSL_Types.key(ds.ID), new LSL_Types.LSLString(reply)}, new DetectParams[0])); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs index 629b14bbb2..d439d228c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins object[] resobj = new object[] { - new LSL_Types.LSLString(httpInfo.ReqID.ToString()), + new LSL_Types.key(httpInfo.ReqID), new LSL_Types.LSLInteger(httpInfo.Status), new LSL_Types.list(), new LSL_Types.LSLString(httpInfo.ResponseBody) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index efa86fc0e0..f9d0e6af0a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { new LSL_Types.LSLInteger(lInfo.GetChannel()), new LSL_Types.LSLString(lInfo.GetName()), - new LSL_Types.LSLString(lInfo.GetID().ToString()), + new LSL_Types.key(lInfo.GetID()), new LSL_Types.LSLString(lInfo.GetMessage()) }; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs index 25c4cbedbc..91ec782302 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs @@ -62,10 +62,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins object[] resobj = new object[] { new LSL_Types.LSLInteger(2), - new LSL_Types.LSLString( - rInfo.GetChannelKey().ToString()), - new LSL_Types.LSLString( - rInfo.GetMessageID().ToString()), + new LSL_Types.key(rInfo.GetChannelKey()), + new LSL_Types.key(rInfo.GetMessageID()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(rInfo.GetIntValue()), new LSL_Types.LSLString(rInfo.GetStrVal()) @@ -93,8 +91,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins object[] resobj = new object[] { new LSL_Types.LSLInteger(3), - new LSL_Types.LSLString(srdInfo.Channel.ToString()), - new LSL_Types.LSLString(srdInfo.GetReqID().ToString()), + new LSL_Types.key(srdInfo.Channel), + new LSL_Types.key(srdInfo.GetReqID()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(srdInfo.Idata), new LSL_Types.LSLString(srdInfo.Sdata) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 8b8638c935..cf99bf415a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -29,7 +29,7 @@ using System; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; @@ -43,8 +43,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llAbs(int i); LSL_Float llAcos(double val); - void llAddToLandBanList(string avatar, double hours); - void llAddToLandPassList(string avatar, double hours); + void llAddToLandBanList(LSL_Key avatar, double hours); + void llAddToLandPassList(LSL_Key avatar, double hours); void llAdjustSoundVolume(double volume); void llAllowInventoryDrop(int add); LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b); @@ -66,13 +66,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llClearCameraParams(); LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face); LSL_Integer llClearPrimMedia(LSL_Integer face); - void llCloseRemoteDataChannel(string channel); + void llCloseRemoteDataChannel(LSL_Key channel); LSL_Float llCloud(LSL_Vector offset); - void llCollisionFilter(string name, string id, int accept); + void llCollisionFilter(string name, LSL_Key id, int accept); void llCollisionSound(string impact_sound, double impact_volume); void llCollisionSprite(string impact_sprite); LSL_Float llCos(double f); - void llCreateLink(string target, int parent); + void llCreateLink(LSL_Key target, int parent); LSL_List llCSV2List(string src); LSL_List llDeleteSubList(LSL_List src, int start, int end); LSL_String llDeleteSubString(string src, int start, int end); @@ -93,11 +93,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Vector llDetectedTouchST(int index); LSL_Vector llDetectedTouchUV(int index); LSL_Vector llDetectedVel(int number); - void llDialog(string avatar, string message, LSL_List buttons, int chat_channel); + void llDialog(LSL_Key avatar, string message, LSL_List buttons, int chat_channel); void llDie(); LSL_String llDumpList2String(LSL_List src, string seperator); LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir); - void llEjectFromLand(string pest); + void llEjectFromLand(LSL_Key pest); void llEmail(string address, string subject, string message); LSL_String llEscapeURL(string url); LSL_Rotation llEuler2Rot(LSL_Vector v); @@ -107,21 +107,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Float llFrand(double mag); LSL_Key llGenerateKey(); LSL_Vector llGetAccel(); - LSL_Integer llGetAgentInfo(string id); + LSL_Integer llGetAgentInfo(LSL_Key id); LSL_String llGetAgentLanguage(string id); LSL_List llGetAgentList(LSL_Integer scope, LSL_List options); - LSL_Vector llGetAgentSize(string id); + LSL_Vector llGetAgentSize(LSL_Key id); LSL_Float llGetAlpha(int face); LSL_Float llGetAndResetTime(); - LSL_String llGetAnimation(string id); - LSL_List llGetAnimationList(string id); + LSL_String llGetAnimation(LSL_Key id); + LSL_List llGetAnimationList(LSL_Key id); LSL_Integer llGetAttached(); - LSL_List llGetBoundingBox(string obj); + LSL_List llGetBoundingBox(LSL_Key obj); LSL_Vector llGetCameraPos(); LSL_Rotation llGetCameraRot(); LSL_Vector llGetCenterOfMass(); LSL_Vector llGetColor(int face); - LSL_String llGetCreator(); + LSL_Key llGetCreator(); LSL_String llGetDate(); LSL_Float llGetEnergy(); LSL_String llGetEnv(LSL_String name); @@ -154,19 +154,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Float llGetMassMKS(); LSL_Integer llGetMemoryLimit(); void llGetNextEmail(string address, string subject); - LSL_String llGetNotecardLine(string name, int line); + LSL_Key llGetNotecardLine(string name, int line); LSL_Key llGetNumberOfNotecardLines(string name); LSL_Integer llGetNumberOfPrims(); LSL_Integer llGetNumberOfSides(); LSL_String llGetObjectDesc(); - LSL_List llGetObjectDetails(string id, LSL_List args); - LSL_Float llGetObjectMass(string id); + LSL_List llGetObjectDetails(LSL_Key id, LSL_List args); + LSL_Float llGetObjectMass(LSL_Key id); LSL_String llGetObjectName(); LSL_Integer llGetObjectPermMask(int mask); - LSL_Integer llGetObjectPrimCount(string object_id); + LSL_Integer llGetObjectPrimCount(LSL_Key object_id); LSL_Vector llGetOmega(); LSL_Key llGetOwner(); - LSL_Key llGetOwnerKey(string id); + LSL_Key llGetOwnerKey(LSL_Key id); LSL_List llGetParcelDetails(LSL_Vector pos, LSL_List param); LSL_Integer llGetParcelFlags(LSL_Vector pos); LSL_Integer llGetParcelMaxPrims(LSL_Vector pos, int sim_wide); @@ -207,28 +207,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llGetUnixTime(); LSL_Vector llGetVel(); LSL_Float llGetWallclock(); - void llGiveInventory(string destination, string inventory); - void llGiveInventoryList(string destination, string category, LSL_List inventory); - LSL_Integer llGiveMoney(string destination, int amount); - LSL_String llTransferLindenDollars(string destination, int amount); - void llGodLikeRezObject(string inventory, LSL_Vector pos); + void llGiveInventory(LSL_Key destination, string inventory); + void llGiveInventoryList(LSL_Key destination, string category, LSL_List inventory); + LSL_Integer llGiveMoney(LSL_Key destination, int amount); + LSL_Key llTransferLindenDollars(LSL_Key destination, int amount); + void llGodLikeRezObject(LSL_Key inventory, LSL_Vector pos); LSL_Float llGround(LSL_Vector offset); LSL_Vector llGroundContour(LSL_Vector offset); LSL_Vector llGroundNormal(LSL_Vector offset); void llGroundRepel(double height, int water, double tau); LSL_Vector llGroundSlope(LSL_Vector offset); - LSL_String llHTTPRequest(string url, LSL_List parameters, string body); + LSL_Key llHTTPRequest(string url, LSL_List parameters, string body); void llHTTPResponse(LSL_Key id, int status, string body); LSL_String llInsertString(string dst, int position, string src); - void llInstantMessage(string user, string message); + void llInstantMessage(LSL_Key user, string message); LSL_String llIntegerToBase64(int number); - LSL_String llKey2Name(string id); - LSL_String llGetUsername(string id); - LSL_String llRequestUsername(string id); - LSL_String llGetDisplayName(string id); - LSL_String llRequestDisplayName(string id); - void llLinkParticleSystem(int linknum, LSL_List rules); - void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot); + LSL_String llKey2Name(LSL_Key id); + LSL_String llGetUsername(LSL_Key id); + LSL_Key llRequestUsername(LSL_Key id); + LSL_String llGetDisplayName(LSL_Key id); + LSL_Key llRequestDisplayName(LSL_Key id); + void llLinkParticleSystem(int linknum, LSL_List rules); + void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot); LSL_String llList2CSV(LSL_List src); LSL_Float llList2Float(LSL_List src, int index); LSL_Integer llList2Integer(LSL_List src, int index); @@ -238,7 +238,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Rotation llList2Rot(LSL_List src, int index); LSL_String llList2String(LSL_List src, int index); LSL_Vector llList2Vector(LSL_List src, int index); - LSL_Integer llListen(int channelID, string name, string ID, string msg); + LSL_Integer llListen(int channelID, string name, LSL_Key ID, string msg); void llListenControl(int number, int active); void llListenRemove(int number); LSL_Integer llListFindList(LSL_List src, LSL_List test); @@ -247,29 +247,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end); LSL_List llListSort(LSL_List src, int stride, int ascending); LSL_Float llListStatistics(int operation, LSL_List src); - void llLoadURL(string avatar_id, string message, string url); + void llLoadURL(LSL_Key avatar_id, string message, string url); LSL_Float llLog(double val); LSL_Float llLog10(double val); void llLookAt(LSL_Vector target, double strength, double damping); void llLoopSound(string sound, double volume); void llLoopSoundMaster(string sound, double volume); void llLoopSoundSlave(string sound, double volume); - LSL_Integer llManageEstateAccess(int action, string avatar); + LSL_Integer llManageEstateAccess(int action, LSL_Key avatar); void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset); void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset); void llMapDestination(string simname, LSL_Vector pos, LSL_Vector look_at); - LSL_String llMD5String(string src, int nonce); - LSL_String llSHA1String(string src); - void llMessageLinked(int linknum, int num, string str, string id); + LSL_String llMD5String(string src, int nonce); + LSL_String llSHA1String(string src); + void llMessageLinked(int linknum, int num, string str, LSL_Key id); void llMinEventDelay(double delay); void llModifyLand(int action, int brush); LSL_Integer llModPow(int a, int b, int c); void llMoveToTarget(LSL_Vector target, double tau); void llOffsetTexture(double u, double v, int face); void llOpenRemoteDataChannel(); - LSL_Integer llOverMyLand(string id); + LSL_Integer llOverMyLand(LSL_Key id); void llOwnerSay(string msg); void llParcelMediaCommandList(LSL_List commandList); LSL_List llParcelMediaQuery(LSL_List aList); @@ -283,25 +283,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llPointAt(LSL_Vector pos); LSL_Float llPow(double fbase, double fexponent); void llPreloadSound(string sound); - void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local); + void llPushObject(LSL_Key target, LSL_Vector impulse, LSL_Vector ang_impulse, int local); void llRefreshPrimURL(); void llRegionSay(int channelID, string text); - void llRegionSayTo(string target, int channelID, string text); + void llRegionSayTo(LSL_Key target, int channelID, string text); void llReleaseCamera(string avatar); void llReleaseControls(); void llReleaseURL(string url); - void llRemoteDataReply(string channel, string message_id, string sdata, int idata); + void llRemoteDataReply(LSL_Key channel, LSL_Key message_id, string sdata, int idata); void llRemoteDataSetRegion(); - void llRemoteLoadScript(string target, string name, int running, int start_param); - void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param); - void llRemoveFromLandBanList(string avatar); - void llRemoveFromLandPassList(string avatar); + void llRemoteLoadScript(LSL_Key target, string name, int running, int start_param); + void llRemoteLoadScriptPin(LSL_Key target, string name, int pin, int running, int start_param); + void llRemoveFromLandBanList(LSL_Key avatar); + void llRemoveFromLandPassList(LSL_Key avatar); void llRemoveInventory(string item); void llRemoveVehicleFlags(int flags); - LSL_Key llRequestAgentData(string id, int data); + LSL_Key llRequestAgentData(LSL_Key id, int data); LSL_Key llRequestInventoryData(string name); - void llRequestPermissions(string agent, int perm); - LSL_String llRequestSecureURL(); + void llRequestPermissions(LSL_Key agent, int perm); + LSL_Key llRequestSecureURL(); LSL_Key llRequestSimulatorData(string simulator, int data); LSL_Key llRequestURL(); void llResetLandBanList(); @@ -323,15 +323,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llRotTarget(LSL_Rotation rot, double error); void llRotTargetRemove(int number); LSL_Integer llRound(double f); - LSL_Integer llSameGroup(string agent); + LSL_Integer llSameGroup(LSL_Key agent); void llSay(int channelID, string text); void llScaleTexture(double u, double v, int face); LSL_Integer llScriptDanger(LSL_Vector pos); void llScriptProfiler(LSL_Integer flag); - LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); - void llSensor(string name, string id, int type, double range, double arc); + LSL_Key llSendRemoteData(LSL_Key channel, string dest, int idata, string sdata); + void llSensor(string name, LSL_Key id, int type, double range, double arc); void llSensorRemove(); - void llSensorRepeat(string name, string id, int type, double range, double arc, double rate); + void llSensorRepeat(string name, LSL_Key id, int type, double range, double arc, double rate); void llSetAlpha(double alpha, int face); void llSetBuoyancy(double buoyancy); void llSetCameraAtOffset(LSL_Vector offset); @@ -410,16 +410,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer llTarget(LSL_Vector position, double range); void llTargetOmega(LSL_Vector axis, double spinrate, double gain); void llTargetRemove(int number); - void llTeleportAgentHome(string agent); - void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt); - void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt); - void llTextBox(string avatar, string message, int chat_channel); + void llTeleportAgentHome(LSL_Key agent); + void llTeleportAgent(LSL_Key agent, string simname, LSL_Vector pos, LSL_Vector lookAt); + void llTeleportAgentGlobalCoords(LSL_Key agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt); + void llTextBox(LSL_Key avatar, string message, int chat_channel); LSL_String llToLower(string source); LSL_String llToUpper(string source); void llTriggerSound(string sound, double volume); void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, LSL_Vector bottom_south_west); LSL_String llUnescapeURL(string url); - void llUnSit(string id); + void llUnSit(LSL_Key id); LSL_Float llVecDist(LSL_Vector a, LSL_Vector b); LSL_Float llVecMag(LSL_Vector v); LSL_Vector llVecNorm(LSL_Vector v); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs index aa78aaa6bb..13a62bb8fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IMOD_Api.cs @@ -30,7 +30,7 @@ using OpenSim.Region.ScriptEngine.Interfaces; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 5ce859ee36..3ccc72f047 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -29,14 +29,13 @@ using System; using System.Collections; using OpenSim.Region.ScriptEngine.Interfaces; -using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces { @@ -117,15 +116,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void CheckThreatLevel(ThreatLevel level, string function); //OpenSim functions - string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); - string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, + LSL_Key osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); + LSL_Key osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, int timer, int alpha); - string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, + LSL_Key osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, bool blend, int disp, int timer, int alpha, int face); - string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); - string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, + LSL_Key osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer); + LSL_Key osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams, int timer, int alpha); - string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, + LSL_Key osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, bool blend, int disp, int timer, int alpha, int face); LSL_Float osGetTerrainHeight(int x, int y); @@ -143,20 +142,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetParcelSIPAddress(string SIPAddress); // Avatar Info Commands - string osGetAgentIP(string agent); + string osGetAgentIP(LSL_Key agent); LSL_List osGetAgents(); // Teleport commands - void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); - void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); - void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportAgent(LSL_Key agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportAgent(LSL_Key agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportOwner(int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); // Animation commands - void osAvatarPlayAnimation(string avatar, string animation); - void osAvatarStopAnimation(string avatar, string animation); + void osAvatarPlayAnimation(LSL_Key avatar, string animation); + void osAvatarStopAnimation(LSL_Key avatar, string animation); #region Attachment commands @@ -185,7 +184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// The UUID of the avatar to which to attach. Nothing happens if this is not a UUID /// The name of the item. If this is not found then a warning is said to the owner /// The attachment point. For example, ATTACH_CHEST - void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint); + void osForceAttachToOtherAvatarFromInventory(LSL_Key rawAvatarId, string itemName, int attachmentPoint); /// /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH @@ -234,18 +233,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osSetPenCap(string drawList, string direction, string type); string osDrawImage(string drawList, int width, int height, string imageUrl); vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize); - void osSetStateEvents(int events); + void osSetStateEvents(int events); double osList2Double(LSL_Types.list src, int index); - void osSetRegionWaterHeight(double height); - void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); - void osSetEstateSunSettings(bool sunFixed, double sunHour); + void osSetRegionWaterHeight(double height); + void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour); + void osSetEstateSunSettings(bool sunFixed, double sunHour); double osGetCurrentSunHour(); double osGetSunParam(string param); double osSunGetParam(string param); // Deprecated - void osSetSunParam(string param, double value); - void osSunSetParam(string param, double value); // Deprecated + void osSetSunParam(string param, double value); + void osSunSetParam(string param, double value); // Deprecated // Wind Module Functions string osWindActiveModelPluginName(); @@ -258,24 +257,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetParcelDetails(vector pos, LSL_List rules); void osParcelSetDetails(vector pos, LSL_List rules); // Deprecated - string osGetScriptEngineName(); - string osGetSimulatorVersion(); + string osGetScriptEngineName(); + string osGetSimulatorVersion(); LSL_Integer osCheckODE(); - string osGetPhysicsEngineType(); - string osGetPhysicsEngineName(); + string osGetPhysicsEngineType(); + string osGetPhysicsEngineName(); + Object osParseJSONNew(string JSON); Hashtable osParseJSON(string JSON); - void osMessageObject(key objectUUID,string message); + void osMessageObject(LSL_Key objectUUID, string message); void osMakeNotecard(string notecardName, LSL_Types.list contents); string osGetNotecardLine(string name, int line); string osGetNotecard(string name); - int osGetNumberOfNotecardLines(string name); + int osGetNumberOfNotecardLines(string name); - string osAvatarName2Key(string firstname, string lastname); - string osKey2Name(string id); + LSL_Key osAvatarName2Key(string firstname, string lastname); + string osKey2Name(LSL_Key id); // Grid Info Functions string osGetGridNick(); @@ -285,16 +285,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osGetGridGatekeeperURI(); string osGetGridCustom(string key); - string osGetAvatarHomeURI(string uuid); + string osGetAvatarHomeURI(LSL_Key uuid); LSL_String osFormatString(string str, LSL_List strings); - LSL_List osMatchString(string src, string pattern, int start); + LSL_List osMatchString(string src, string pattern, int start); LSL_String osReplaceString(string src, string pattern, string replace, int count, int start); // Information about data loaded into the region - string osLoadedCreationDate(); - string osLoadedCreationTime(); - string osLoadedCreationID(); + string osLoadedCreationDate(); + string osLoadedCreationTime(); + LSL_Key osLoadedCreationID(); LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); @@ -303,7 +303,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// /// - void osForceCreateLink(string target, int parent); + void osForceCreateLink(LSL_Key target, int parent); /// /// Identical to llBreakLink() but does not require permission from the owner. @@ -323,13 +323,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// TRUE if the key belongs to an npc in the scene. FALSE otherwise. LSL_Integer osIsNpc(LSL_Key npc); - key osNpcCreate(string user, string name, vector position, string notecard); - key osNpcCreate(string user, string name, vector position, string notecard, int options); - LSL_Key osNpcSaveAppearance(key npc, string notecard); - void osNpcLoadAppearance(key npc, string notecard); - vector osNpcGetPos(key npc); - void osNpcMoveTo(key npc, vector position); - void osNpcMoveToTarget(key npc, vector target, int options); + LSL_Key osNpcCreate(string user, string name, vector position, string notecard); + LSL_Key osNpcCreate(string user, string name, vector position, string notecard, int options); + LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard); + void osNpcLoadAppearance(LSL_Key npc, string notecard); + vector osNpcGetPos(LSL_Key npc); + void osNpcMoveTo(LSL_Key npc, vector position); + void osNpcMoveToTarget(LSL_Key npc, vector target, int options); /// /// Get the owner of the NPC @@ -338,46 +338,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// The owner of the NPC for an owned NPC. The NPC's agent id for an unowned NPC. UUID.Zero if the key is not an npc. /// - LSL_Key osNpcGetOwner(key npc); + LSL_Key osNpcGetOwner(LSL_Key npc); + rotation osNpcGetRot(LSL_Key npc); + void osNpcSetRot(LSL_Key npc, rotation rot); + void osNpcStopMoveToTarget(LSL_Key npc); + void osNpcSay(LSL_Key npc, string message); + void osNpcSay(LSL_Key npc, int channel, string message); + void osNpcShout(LSL_Key npc, int channel, string message); + void osNpcSit(LSL_Key npc, LSL_Key target, int options); + void osNpcStand(LSL_Key npc); + void osNpcRemove(LSL_Key npc); + void osNpcPlayAnimation(LSL_Key npc, string animation); + void osNpcStopAnimation(LSL_Key npc, string animation); + void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num); + void osNpcWhisper(LSL_Key npc, int channel, string message); - rotation osNpcGetRot(key npc); - void osNpcSetRot(LSL_Key npc, rotation rot); - void osNpcStopMoveToTarget(LSL_Key npc); - void osNpcSay(key npc, string message); - void osNpcSay(key npc, int channel, string message); - void osNpcShout(key npc, int channel, string message); - void osNpcSit(key npc, key target, int options); - void osNpcStand(LSL_Key npc); - void osNpcRemove(key npc); - void osNpcPlayAnimation(LSL_Key npc, string animation); - void osNpcStopAnimation(LSL_Key npc, string animation); - void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num); - void osNpcWhisper(key npc, int channel, string message); + LSL_Key osOwnerSaveAppearance(string notecard); + LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecard); - LSL_Key osOwnerSaveAppearance(string notecard); - LSL_Key osAgentSaveAppearance(key agentId, string notecard); + LSL_String osGetGender(LSL_Key rawAvatarId); + LSL_Key osGetMapTexture(); + LSL_Key osGetRegionMapTexture(string regionName); + LSL_List osGetRegionStats(); + vector osGetRegionSize(); - key osGetGender(LSL_Key rawAvatarId); - key osGetMapTexture(); - key osGetRegionMapTexture(string regionName); - LSL_List osGetRegionStats(); - vector osGetRegionSize(); - - int osGetSimulatorMemory(); - void osKickAvatar(string FirstName,string SurName,string alert); - void osSetSpeed(string UUID, LSL_Float SpeedModifier); - LSL_Float osGetHealth(string avatar); - void osCauseHealing(string avatar, double healing); - void osSetHealth(string avatar, double health); - void osSetHealRate(string avatar, double health); - LSL_Float osGetHealRate(string avatar); - void osCauseDamage(string avatar, double damage); - void osForceOtherSit(string avatar); - void osForceOtherSit(string avatar, string target); - LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); - void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); - void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb); - void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); + int osGetSimulatorMemory(); + void osKickAvatar(string FirstName, string SurName, string alert); + void osSetSpeed(LSL_Key UUID, LSL_Float SpeedModifier); + LSL_Float osGetHealth(LSL_Key avatar); + void osCauseHealing(LSL_Key avatar, double healing); + void osSetHealth(LSL_Key avatar, double health); + void osSetHealRate(LSL_Key avatar, double health); + LSL_Float osGetHealRate(LSL_Key avatar); + void osCauseDamage(LSL_Key avatar, double damage); + void osForceOtherSit(LSL_Key avatar); + void osForceOtherSit(LSL_Key avatar, string target); + LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); + void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); + void osSetProjectionParams(bool projection, LSL_Key texture, double fov, + double focus, double amb); + void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, + double focus, double amb); LSL_List osGetAvatarList(); @@ -463,7 +464,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// OS_LISTEN_REGEX_MESSAGE /// /// - LSL_Integer osListenRegex(int channelID, string name, string ID, + LSL_Integer osListenRegex(int channelID, string name, LSL_Key ID, string msg, int regexBitfield); /// @@ -474,8 +475,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// boolean LSL_Integer osRegexIsMatch(string input, string pattern); - LSL_String osRequestURL(LSL_List options); - LSL_String osRequestSecureURL(LSL_List options); + LSL_Key osRequestURL(LSL_List options); + LSL_Key osRequestSecureURL(LSL_List options); void osCollisionSound(string impact_sound, double impact_volume); void osVolumeDetect(int detect); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 4a8e885c59..ec24f4da66 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -29,6 +29,7 @@ using System; using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; +using LSLKey = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { @@ -540,7 +541,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public static readonly LSLInteger PAY_HIDE = new LSLInteger(-1); public static readonly LSLInteger PAY_DEFAULT = new LSLInteger(-2); - public const string NULL_KEY = "00000000-0000-0000-0000-000000000000"; + public static readonly LSLKey NULL_KEY = new LSLKey("00000000-0000-0000-0000-000000000000"); public const string EOF = "\n\n\n"; public const double PI = 3.14159274f; public const double TWO_PI = 6.28318548f; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index cea66d2c5f..2c08c972c7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -37,7 +37,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; @@ -75,12 +75,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llAcos(val); } - public void llAddToLandBanList(string avatar, double hours) + public void llAddToLandBanList(LSL_Key avatar, double hours) { m_LSL_Functions.llAddToLandBanList(avatar, hours); } - public void llAddToLandPassList(string avatar, double hours) + public void llAddToLandPassList(LSL_Key avatar, double hours) { m_LSL_Functions.llAddToLandPassList(avatar, hours); } @@ -175,7 +175,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llClearCameraParams(); } - public void llCloseRemoteDataChannel(string channel) + public void llCloseRemoteDataChannel(LSL_Key channel) { m_LSL_Functions.llCloseRemoteDataChannel(channel); } @@ -185,7 +185,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llCloud(offset); } - public void llCollisionFilter(string name, string id, int accept) + public void llCollisionFilter(string name, LSL_Key id, int accept) { m_LSL_Functions.llCollisionFilter(name, id, accept); } @@ -205,7 +205,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llCos(f); } - public void llCreateLink(string target, int parent) + public void llCreateLink(LSL_Key target, int parent) { m_LSL_Functions.llCreateLink(target, parent); } @@ -310,7 +310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llDetectedVel(number); } - public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) + public void llDialog(LSL_Key avatar, string message, LSL_List buttons, int chat_channel) { m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel); } @@ -331,7 +331,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llEdgeOfWorld(pos, dir); } - public void llEjectFromLand(string pest) + public void llEjectFromLand(LSL_Key pest) { m_LSL_Functions.llEjectFromLand(pest); } @@ -381,7 +381,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetAccel(); } - public LSL_Integer llGetAgentInfo(string id) + public LSL_Integer llGetAgentInfo(LSL_Key id) { return m_LSL_Functions.llGetAgentInfo(id); } @@ -396,7 +396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetAgentList(scope, options); } - public LSL_Vector llGetAgentSize(string id) + public LSL_Vector llGetAgentSize(LSL_Key id) { return m_LSL_Functions.llGetAgentSize(id); } @@ -411,12 +411,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetAndResetTime(); } - public LSL_String llGetAnimation(string id) + public LSL_String llGetAnimation(LSL_Key id) { return m_LSL_Functions.llGetAnimation(id); } - public LSL_List llGetAnimationList(string id) + public LSL_List llGetAnimationList(LSL_Key id) { return m_LSL_Functions.llGetAnimationList(id); } @@ -426,7 +426,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetAttached(); } - public LSL_List llGetBoundingBox(string obj) + public LSL_List llGetBoundingBox(LSL_Key obj) { return m_LSL_Functions.llGetBoundingBox(obj); } @@ -451,7 +451,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetColor(face); } - public LSL_String llGetCreator() + public LSL_Key llGetCreator() { return m_LSL_Functions.llGetCreator(); } @@ -606,7 +606,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llGetNextEmail(address, subject); } - public LSL_String llGetNotecardLine(string name, int line) + public LSL_Key llGetNotecardLine(string name, int line) { return m_LSL_Functions.llGetNotecardLine(name, line); } @@ -631,12 +631,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetObjectDesc(); } - public LSL_List llGetObjectDetails(string id, LSL_List args) + public LSL_List llGetObjectDetails(LSL_Key id, LSL_List args) { return m_LSL_Functions.llGetObjectDetails(id, args); } - public LSL_Float llGetObjectMass(string id) + public LSL_Float llGetObjectMass(LSL_Key id) { return m_LSL_Functions.llGetObjectMass(id); } @@ -651,7 +651,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetObjectPermMask(mask); } - public LSL_Integer llGetObjectPrimCount(string object_id) + public LSL_Integer llGetObjectPrimCount(LSL_Key object_id) { return m_LSL_Functions.llGetObjectPrimCount(object_id); } @@ -666,7 +666,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetOwner(); } - public LSL_Key llGetOwnerKey(string id) + public LSL_Key llGetOwnerKey(LSL_Key id) { return m_LSL_Functions.llGetOwnerKey(id); } @@ -871,27 +871,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetWallclock(); } - public void llGiveInventory(string destination, string inventory) + public void llGiveInventory(LSL_Key destination, string inventory) { m_LSL_Functions.llGiveInventory(destination, inventory); } - public void llGiveInventoryList(string destination, string category, LSL_List inventory) + public void llGiveInventoryList(LSL_Key destination, string category, LSL_List inventory) { m_LSL_Functions.llGiveInventoryList(destination, category, inventory); } - public LSL_Integer llGiveMoney(string destination, int amount) + public LSL_Integer llGiveMoney(LSL_Key destination, int amount) { return m_LSL_Functions.llGiveMoney(destination, amount); } - public LSL_String llTransferLindenDollars(string destination, int amount) + public LSL_Key llTransferLindenDollars(LSL_Key destination, int amount) { return m_LSL_Functions.llTransferLindenDollars(destination, amount); } - public void llGodLikeRezObject(string inventory, LSL_Vector pos) + public void llGodLikeRezObject(LSL_Key inventory, LSL_Vector pos) { m_LSL_Functions.llGodLikeRezObject(inventory, pos); } @@ -921,7 +921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGroundSlope(offset); } - public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) + public LSL_Key llHTTPRequest(string url, LSL_List parameters, string body) { return m_LSL_Functions.llHTTPRequest(url, parameters, body); } @@ -936,7 +936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llInsertString(dst, position, src); } - public void llInstantMessage(string user, string message) + public void llInstantMessage(LSL_Key user, string message) { m_LSL_Functions.llInstantMessage(user, message); } @@ -946,27 +946,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llIntegerToBase64(number); } - public LSL_String llKey2Name(string id) + public LSL_String llKey2Name(LSL_Key id) { return m_LSL_Functions.llKey2Name(id); } - public LSL_String llGetUsername(string id) + public LSL_String llGetUsername(LSL_Key id) { return m_LSL_Functions.llGetUsername(id); } - public LSL_String llRequestUsername(string id) + public LSL_Key llRequestUsername(LSL_Key id) { return m_LSL_Functions.llRequestUsername(id); } - public LSL_String llGetDisplayName(string id) + public LSL_String llGetDisplayName(LSL_Key id) { return m_LSL_Functions.llGetDisplayName(id); } - public LSL_String llRequestDisplayName(string id) + public LSL_Key llRequestDisplayName(LSL_Key id) { return m_LSL_Functions.llRequestDisplayName(id); } @@ -1026,7 +1026,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llList2Vector(src, index); } - public LSL_Integer llListen(int channelID, string name, string ID, string msg) + public LSL_Integer llListen(int channelID, string name, LSL_Key ID, string msg) { return m_LSL_Functions.llListen(channelID, name, ID, msg); } @@ -1071,7 +1071,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llListStatistics(operation, src); } - public void llLoadURL(string avatar_id, string message, string url) + public void llLoadURL(LSL_Key avatar_id, string message, string url) { m_LSL_Functions.llLoadURL(avatar_id, message, url); } @@ -1106,7 +1106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llLoopSoundSlave(sound, volume); } - public LSL_Integer llManageEstateAccess(int action, string avatar) + public LSL_Integer llManageEstateAccess(int action, LSL_Key avatar) { return m_LSL_Functions.llManageEstateAccess(action, avatar); } @@ -1146,7 +1146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llSHA1String(src); } - public void llMessageLinked(int linknum, int num, string str, string id) + public void llMessageLinked(int linknum, int num, string str, LSL_Key id) { m_LSL_Functions.llMessageLinked(linknum, num, str, id); } @@ -1181,7 +1181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llOpenRemoteDataChannel(); } - public LSL_Integer llOverMyLand(string id) + public LSL_Integer llOverMyLand(LSL_Key id) { return m_LSL_Functions.llOverMyLand(id); } @@ -1251,7 +1251,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llPreloadSound(sound); } - public void llPushObject(string target, LSL_Vector impulse, LSL_Vector ang_impulse, int local) + public void llPushObject(LSL_Key target, LSL_Vector impulse, LSL_Vector ang_impulse, int local) { m_LSL_Functions.llPushObject(target, impulse, ang_impulse, local); } @@ -1266,7 +1266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llRegionSay(channelID, text); } - public void llRegionSayTo(string key, int channelID, string text) + public void llRegionSayTo(LSL_Key key, int channelID, string text) { m_LSL_Functions.llRegionSayTo(key, channelID, text); } @@ -1296,22 +1296,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llRemoteDataSetRegion(); } - public void llRemoteLoadScript(string target, string name, int running, int start_param) + public void llRemoteLoadScript(LSL_Key target, string name, int running, int start_param) { m_LSL_Functions.llRemoteLoadScript(target, name, running, start_param); } - public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) + public void llRemoteLoadScriptPin(LSL_Key target, string name, int pin, int running, int start_param) { m_LSL_Functions.llRemoteLoadScriptPin(target, name, pin, running, start_param); } - public void llRemoveFromLandBanList(string avatar) + public void llRemoveFromLandBanList(LSL_Key avatar) { m_LSL_Functions.llRemoveFromLandBanList(avatar); } - public void llRemoveFromLandPassList(string avatar) + public void llRemoveFromLandPassList(LSL_Key avatar) { m_LSL_Functions.llRemoveFromLandPassList(avatar); } @@ -1326,7 +1326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llRemoveVehicleFlags(flags); } - public LSL_Key llRequestAgentData(string id, int data) + public LSL_Key llRequestAgentData(LSL_Key id, int data) { return m_LSL_Functions.llRequestAgentData(id, data); } @@ -1336,7 +1336,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llRequestInventoryData(name); } - public void llRequestPermissions(string agent, int perm) + public void llRequestPermissions(LSL_Key agent, int perm) { m_LSL_Functions.llRequestPermissions(agent, perm); } @@ -1450,7 +1450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llRound(f); } - public LSL_Integer llSameGroup(string agent) + public LSL_Integer llSameGroup(LSL_Key agent) { return m_LSL_Functions.llSameGroup(agent); } @@ -1475,12 +1475,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llScriptProfiler(flags); } - public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) + public LSL_Key llSendRemoteData(LSL_Key channel, string dest, int idata, string sdata) { return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); } - public void llSensor(string name, string id, int type, double range, double arc) + public void llSensor(string name, LSL_Key id, int type, double range, double arc) { m_LSL_Functions.llSensor(name, id, type, range, arc); } @@ -1490,7 +1490,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSensorRemove(); } - public void llSensorRepeat(string name, string id, int type, double range, double arc, double rate) + public void llSensorRepeat(string name, LSL_Key id, int type, double range, double arc, double rate) { m_LSL_Functions.llSensorRepeat(name, id, type, range, arc, rate); } @@ -1881,22 +1881,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llTargetRemove(number); } - public void llTeleportAgent(string agent, string simname, LSL_Vector pos, LSL_Vector lookAt) + public void llTeleportAgent(LSL_Key agent, string simname, LSL_Vector pos, LSL_Vector lookAt) { m_LSL_Functions.llTeleportAgent(agent, simname, pos, lookAt); } - public void llTeleportAgentGlobalCoords(string agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt) + public void llTeleportAgentGlobalCoords(LSL_Key agent, LSL_Vector global, LSL_Vector pos, LSL_Vector lookAt) { m_LSL_Functions.llTeleportAgentGlobalCoords(agent, global, pos, lookAt); } - public void llTeleportAgentHome(string agent) + public void llTeleportAgentHome(LSL_Key agent) { m_LSL_Functions.llTeleportAgentHome(agent); } - public void llTextBox(string avatar, string message, int chat_channel) + public void llTextBox(LSL_Key avatar, string message, int chat_channel) { m_LSL_Functions.llTextBox(avatar, message, chat_channel); } @@ -1926,7 +1926,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llUnescapeURL(url); } - public void llUnSit(string id) + public void llUnSit(LSL_Key id) { m_LSL_Functions.llUnSit(id); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c5cb88e05f..8ea90c055c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -38,10 +38,10 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; -using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; -using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.key; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; @@ -141,7 +141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osList2Double(src, index); } - public string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, + public LSL_Key osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer) { return m_OSSL_Functions.osSetDynamicTextureURL(dynamicID, contentType, url, extraParams, timer); @@ -153,7 +153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osSetDynamicTextureData(dynamicID, contentType, data, extraParams, timer); } - public string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, + public LSL_Key osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams, int timer, int alpha) { return m_OSSL_Functions.osSetDynamicTextureURLBlend(dynamicID, contentType, url, extraParams, timer, alpha); @@ -165,14 +165,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osSetDynamicTextureDataBlend(dynamicID, contentType, data, extraParams, timer, alpha); } - public string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, + public LSL_Key osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, bool blend, int disp, int timer, int alpha, int face) { return m_OSSL_Functions.osSetDynamicTextureURLBlendFace(dynamicID, contentType, url, extraParams, blend, disp, timer, alpha, face); } - public string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, + public LSL_Key osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, bool blend, int disp, int timer, int alpha, int face) { return m_OSSL_Functions.osSetDynamicTextureDataBlendFace(dynamicID, contentType, data, extraParams, @@ -241,12 +241,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase // Teleport Functions - public void osTeleportAgent(string agent, string regionName, vector position, vector lookat) + public void osTeleportAgent(LSL_Key agent, string regionName, vector position, vector lookat) { m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat); } - public void osTeleportAgent(string agent, int regionX, int regionY, vector position, vector lookat) + public void osTeleportAgent(LSL_Key agent, int regionX, int regionY, vector position, vector lookat) { m_OSSL_Functions.osTeleportAgent(agent, regionX, regionY, position, lookat); } @@ -272,7 +272,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } // Avatar info functions - public string osGetAgentIP(string agent) + public string osGetAgentIP(LSL_Key agent) { return m_OSSL_Functions.osGetAgentIP(agent); } @@ -284,12 +284,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase // Animation Functions - public void osAvatarPlayAnimation(string avatar, string animation) + public void osAvatarPlayAnimation(LSL_Key avatar, string animation) { m_OSSL_Functions.osAvatarPlayAnimation(avatar, animation); } - public void osAvatarStopAnimation(string avatar, string animation) + public void osAvatarStopAnimation(LSL_Key avatar, string animation) { m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); } @@ -306,7 +306,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceAttachToAvatarFromInventory(itemName, attachmentPoint); } - public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint) + public void osForceAttachToOtherAvatarFromInventory(LSL_Key rawAvatarId, string itemName, int attachmentPoint) { m_OSSL_Functions.osForceAttachToOtherAvatarFromInventory(rawAvatarId, itemName, attachmentPoint); } @@ -480,12 +480,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetNumberOfNotecardLines(name); } - public string osAvatarName2Key(string firstname, string lastname) + public key osAvatarName2Key(string firstname, string lastname) { return m_OSSL_Functions.osAvatarName2Key(firstname, lastname); } - public string osKey2Name(string id) + public string osKey2Name(LSL_Key id) { return m_OSSL_Functions.osKey2Name(id); } @@ -520,7 +520,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetGridCustom(key); } - public string osGetAvatarHomeURI(string uuid) + public string osGetAvatarHomeURI(LSL_Key uuid) { return m_OSSL_Functions.osGetAvatarHomeURI(uuid); } @@ -562,7 +562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); } - public void osForceCreateLink(string target, int parent) + public void osForceCreateLink(LSL_Key target, int parent) { m_OSSL_Functions.osForceCreateLink(target, parent); } @@ -925,47 +925,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); } - public void osSetSpeed(string UUID, LSL_Float SpeedModifier) + public void osSetSpeed(LSL_Key UUID, LSL_Float SpeedModifier) { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); } - public LSL_Float osGetHealth(string avatar) + public LSL_Float osGetHealth(LSL_Key avatar) { return m_OSSL_Functions.osGetHealth(avatar); } - public void osCauseDamage(string avatar, double damage) + public void osCauseDamage(LSL_Key avatar, double damage) { m_OSSL_Functions.osCauseDamage(avatar, damage); } - public void osCauseHealing(string avatar, double healing) + public void osCauseHealing(LSL_Key avatar, double healing) { m_OSSL_Functions.osCauseHealing(avatar, healing); } - public void osSetHealth(string avatar, double health) + public void osSetHealth(LSL_Key avatar, double health) { m_OSSL_Functions.osSetHealth(avatar, health); } - public void osSetHealRate(string avatar, double health) + public void osSetHealRate(LSL_Key avatar, double health) { m_OSSL_Functions.osSetHealRate(avatar, health); } - public LSL_Float osGetHealRate(string avatar) + public LSL_Float osGetHealRate(LSL_Key avatar) { return m_OSSL_Functions.osGetHealRate(avatar); } - public void osForceOtherSit(string avatar) + public void osForceOtherSit(LSL_Key avatar) { m_OSSL_Functions.osForceOtherSit(avatar); } - public void osForceOtherSit(string avatar, string target) + public void osForceOtherSit(LSL_Key avatar, string target) { m_OSSL_Functions.osForceOtherSit(avatar, target); } @@ -1070,7 +1070,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceDropAttachmentAt(pos, rot); } - public LSL_Integer osListenRegex(int channelID, string name, string ID, string msg, int regexBitfield) + public LSL_Integer osListenRegex(int channelID, string name, LSL_Key ID, string msg, int regexBitfield) { return m_OSSL_Functions.osListenRegex(channelID, name, ID, msg, regexBitfield); } @@ -1080,12 +1080,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osRegexIsMatch(input, pattern); } - public LSL_String osRequestURL(LSL_List options) + public LSL_Key osRequestURL(LSL_List options) { return m_OSSL_Functions.osRequestURL(options); } - public LSL_String osRequestSecureURL(LSL_List options) + public LSL_Key osRequestSecureURL(LSL_List options) { return m_OSSL_Functions.osRequestSecureURL(options); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs index b138da38a3..c845c83329 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs @@ -168,6 +168,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } else if (field.FieldType == typeof(LSL_Types.LSLInteger) || field.FieldType == typeof(LSL_Types.LSLString) || + field.FieldType == typeof(LSL_Types.key) || field.FieldType == typeof(LSL_Types.LSLFloat) || field.FieldType == typeof(Int32) || field.FieldType == typeof(Double) || @@ -199,6 +200,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase Array.Copy(data, 0, v.Data, 0, data.Length); m_Fields[var.Key].SetValue(this, v); } + else if(m_Fields[var.Key].FieldType == typeof(LSL_Types.key)) + { + if(var.Value.GetType() == typeof(LSL_Types.LSLString)) + { + m_Fields[var.Key].SetValue(this, (object)((LSL_Types.key)var.Value.ToString())); + } + else + m_Fields[var.Key].SetValue(this, var.Value); + } else if (m_Fields[var.Key].FieldType == typeof(LSL_Types.LSLInteger) || m_Fields[var.Key].FieldType == typeof(LSL_Types.LSLString) || m_Fields[var.Key].FieldType == typeof(LSL_Types.LSLFloat) || diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index bc6ce4ff80..e15b34262d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -957,6 +957,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools { c.Value = "new LSL_Types.LSLString(\""+c.Value+"\")"; } + else if ("LSL_Types.key" == c.Type) + { + c.Value = "new LSL_Types.key(\""+c.Value+"\")"; + } Generate(c.Value, c, sb); } diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs index 0585f8b05e..c113351322 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs @@ -54,8 +54,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools m_datatypeLSL2OpenSim = new Dictionary(); m_datatypeLSL2OpenSim.Add("integer", "LSL_Types.LSLInteger"); m_datatypeLSL2OpenSim.Add("float", "LSL_Types.LSLFloat"); - //m_datatypeLSL2OpenSim.Add("key", "LSL_Types.key"); // key doesn't seem to be used - m_datatypeLSL2OpenSim.Add("key", "LSL_Types.LSLString"); + m_datatypeLSL2OpenSim.Add("key", "LSL_Types.key"); // key doesn't seem to be used m_datatypeLSL2OpenSim.Add("string", "LSL_Types.LSLString"); m_datatypeLSL2OpenSim.Add("vector", "LSL_Types.Vector3"); m_datatypeLSL2OpenSim.Add("rotation", "LSL_Types.Quaternion"); @@ -174,8 +173,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools case "float": return new Constant(p, constantType, "0.0"); case "string": - case "key": return new Constant(p, constantType, ""); + case "key": + return new Constant(p, "key", ""); case "list": ArgumentList al = new ArgumentList(p); return new ListConstant(p, al); diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 611df58952..aaacade543 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -419,7 +419,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (m_stateSource == StateSource.AttachedRez) { PostEvent(new EventParams("attach", - new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0])); + new object[] { new LSL_Types.key(m_AttachedAvatar) }, new DetectParams[0])); } else if (m_stateSource == StateSource.RegionStart) { @@ -454,7 +454,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance if (m_stateSource == StateSource.AttachedRez) { PostEvent(new EventParams("attach", - new object[] { new LSL_Types.LSLString(m_AttachedAvatar.ToString()) }, new DetectParams[0])); + new object[] { new LSL_Types.key(m_AttachedAvatar) }, new DetectParams[0])); } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 9fb1e2cf8c..dfe05492c0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -982,7 +982,6 @@ namespace OpenSim.Region.ScriptEngine.Shared } int ret = 0; - if (left is key) { key l = (key)left; @@ -1424,33 +1423,37 @@ namespace OpenSim.Region.ScriptEngine.Shared value = s; } + public key(LSLString s) + { + value = s.m_string; + } + + public key(UUID val) + { + value = val.ToString(); + } + + public key(key val) + { + value = val.value; + } + #endregion #region Methods - static public bool Parse2Key(string s) - { - Regex isuuid = new Regex(@"^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$", RegexOptions.Compiled); - if (isuuid.IsMatch(s)) - { - return true; - } - else - { - return false; - } - } - #endregion #region Operators static public implicit operator Boolean(key k) { - if (k.value.Length == 0) - { + if (String.IsNullOrEmpty(k.value)) + return false; + + int len = k.value.Length; + if((k.value[0] == '{' && len != 38) || (len != 36 && len != 32)) return false; - } if (k.value == "00000000-0000-0000-0000-000000000000") { @@ -1482,14 +1485,32 @@ namespace OpenSim.Region.ScriptEngine.Shared return new key(s); } - static public implicit operator String(key k) + static public implicit operator key(LSLString s) + { + return new key(s); + } + + static public implicit operator key(UUID id) + { + return new key(id); + } + + static public implicit operator string(key k) { return k.value; } static public implicit operator LSLString(key k) { - return k.value; + return new LSLString(k.value); + } + + static public implicit operator UUID(key k) + { + UUID uuid; + if(!UUID.TryParse(k, out uuid)) + return UUID.Zero; + return uuid; } public static bool operator ==(key k1, key k2) @@ -1560,14 +1581,23 @@ namespace OpenSim.Region.ScriptEngine.Shared #region Operators static public implicit operator Boolean(LSLString s) { - if (s.m_string.Length == 0) - { + if(s.m_string.Length == 0) return false; - } - else - { + return true; + } + + public static bool operator true(LSLString s) + { + if(s.m_string.Length == 0) + return false; + return true; + } + + public static bool operator false(LSLString s) + { + if(s.m_string.Length == 0) return true; - } + return false; } static public implicit operator String(LSLString s) diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 2f9a5641bd..260fa949e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -138,7 +138,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests string notecardName = "appearanceNc"; - osslApi.osAgentSaveAppearance(new LSL_Types.LSLString(nonOwnerId.ToString()), notecardName); + osslApi.osAgentSaveAppearance(new LSL_Types.key(nonOwnerId.ToString()), notecardName); IList items = part.Inventory.GetInventoryItems(notecardName); Assert.That(items.Count, Is.EqualTo(1)); diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 301eadae42..34d635eccb 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -230,7 +230,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine { myScriptEngine.PostObjectEvent(localID, new EventParams( "money", new object[] { - new LSL_Types.LSLString(agentID.ToString()), + new LSL_Types.key(agentID), new LSL_Types.LSLInteger(amount) }, new DetectParams[0])); } @@ -349,7 +349,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine { myScriptEngine.PostScriptEvent(itemID, new EventParams( "control",new object[] { - new LSL_Types.LSLString(agentID.ToString()), + new LSL_Types.key(agentID), new LSL_Types.LSLInteger(held), new LSL_Types.LSLInteger(change)}, new DetectParams[0])); @@ -416,7 +416,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine { myScriptEngine.PostObjectEvent(part.LocalId, new EventParams( "attach",new object[] { - new LSL_Types.LSLString(avatar.ToString()) }, + new LSL_Types.key(avatar) }, new DetectParams[0])); } } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 30389152f0..67c6ba3fdd 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1781,6 +1781,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]); else if (p[i] is float) lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); + else if (p[i] is UUID) + lsl_p[i] = new LSL_Types.key((UUID)p[i]); else lsl_p[i] = p[i]; } @@ -1807,6 +1809,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine lsl_p[i] = new LSL_Types.Quaternion((Quaternion)p[i]); else if (p[i] is float) lsl_p[i] = new LSL_Types.LSLFloat((float)p[i]); + else if (p[i] is UUID) + lsl_p[i] = new LSL_Types.key((UUID)p[i]); else lsl_p[i] = p[i]; }