From 7bf6e2e5439beb47c76792ca746871e116b2b62d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 18 Mar 2022 22:48:24 +0000 Subject: [PATCH] more uuid == --- .../Shared/Api/Implementation/LSL_Api.cs | 107 +++++++++--------- 1 file changed, 53 insertions(+), 54 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e0887ca14e..048073b948 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -610,7 +610,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error("llResetOtherScript", "Can't find script '" + name + "'"); return; } - if(item == m_item.ItemID) + if(item.Equals(m_item.ItemID)) llResetScript(); else { @@ -1311,7 +1311,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { World.SimChat(binText, ChatTypeEnum.Shout, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); - } IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); @@ -1484,7 +1483,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_item.ItemID, number); if (detectedParams == null) return new LSL_Integer(0); - if (m_host.GroupID == detectedParams.Group) + if (m_host.GroupID.Equals(detectedParams.Group)) return new LSL_Integer(1); return new LSL_Integer(0); } @@ -2645,7 +2644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach (KeyValuePair inv in part.TaskInventory) { - if (inv.Value.AssetID == texface.TextureID) + if (inv.Value.AssetID.Equals(texface.TextureID)) { texture = inv.Value.Name.ToString(); break; @@ -2713,7 +2712,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // we're only checking prim limits if it's moving to a different parcel under the assumption that if the object got onto the parcel without exceeding the prim limits. - bool sameParcel = here.GlobalID == there.GlobalID; + bool sameParcel = here.GlobalID.Equals(there.GlobalID); if (!sameParcel && !World.Permissions.CanRezObject( m_host.ParentGroup.PrimCount, m_host.ParentGroup.OwnerID, pos)) @@ -4051,14 +4050,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UserAccount account = null; if (target == ScriptBaseClass.TARGETED_EMAIL_OBJECT_OWNER) { - if(parent.OwnerID == parent.GroupID) + if(parent.OwnerID.Equals(parent.GroupID)) return; account = m_userAccountService.GetUserAccount(RegionScopeID, parent.OwnerID); } else if (target == ScriptBaseClass.TARGETED_EMAIL_ROOT_CREATOR) { // non standard avoid creator spam - if(m_item.CreatorID == parent.RootPart.CreatorID) + if(m_item.CreatorID.Equals(parent.RootPart.CreatorID)) { account = m_userAccountService.GetUserAccount(RegionScopeID, parent.RootPart.CreatorID); } @@ -4849,7 +4848,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api GridInstantMessage msg = new GridInstantMessage(World, m_host.OwnerID, m_host.Name, destId, (byte)InstantMessageDialog.TaskInventoryOffered, - m_host.OwnerID == m_host.GroupID, "'"+item.Name+"'. ("+m_host.Name+" is located at "+ + m_host.OwnerID.Equals(m_host.GroupID), "'"+item.Name+"'. ("+m_host.Name+" is located at "+ World.RegionInfo.RegionName+" "+ m_host.AbsolutePosition.ToString() + ")", agentItem.ID, true, m_host.AbsolutePosition, bucket, true); @@ -5100,7 +5099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence == null || presence.IsDeleted || presence.IsChildAgent || presence.IsNPC || presence.IsSatOnObject || presence.IsInTransit) return; - if (m_item.PermsGranter == agentId) + if (m_item.PermsGranter.Equals(agentId)) { if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) { @@ -5111,7 +5110,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // special opensim legacy extra permissions, possible to remove // agent must be wearing the object - if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID) + if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID.Equals(presence.UUID)) { DoLLTeleport(presence, destination, targetPos, targetLookAt); return; @@ -5124,7 +5123,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // agent must be over the owners land ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition); ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition); - if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.LandData.OwnerID) + if (m_host.OwnerID.Equals(objectLand.LandData.OwnerID) && m_host.OwnerID.Equals(agentLand.LandData.OwnerID)) { DoLLTeleport(presence, destination, targetPos, targetLookAt); } @@ -5147,7 +5146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence == null || presence.IsDeleted || presence.IsChildAgent || presence.IsNPC || presence.IsSatOnObject || presence.IsInTransit) return; - if (m_item.PermsGranter == agentId) + if (m_item.PermsGranter.Equals(agentId)) { if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0) { @@ -5366,8 +5365,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; // Need provisions for Group Owned here - if (m_host.OwnerID == targetlandObj.LandData.OwnerID || - targetlandObj.LandData.IsGroupOwned || m_host.OwnerID == targetID) + if (m_host.OwnerID.Equals(targetlandObj.LandData.OwnerID) || + targetlandObj.LandData.IsGroupOwned || m_host.OwnerID.Equals(targetID)) { pushAllowed = true; } @@ -5386,9 +5385,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((targetlandObj.LandData.Flags & (uint)ParcelFlags.RestrictPushObject) == (uint)ParcelFlags.RestrictPushObject) { // Need provisions for Group Owned here - if (m_host.OwnerID == targetlandObj.LandData.OwnerID || + if (m_host.OwnerID.Equals(targetlandObj.LandData.OwnerID) || targetlandObj.LandData.IsGroupOwned || - m_host.OwnerID == targetID) + m_host.OwnerID.Equals(targetID)) { pushAllowed = true; } @@ -5861,7 +5860,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // type 'obj' and wrongly returns "" if (!(item is LSL_String || item is LSL_Key || - item.ToString() == "00000000-0000-0000-0000-000000000000")) + item.ToString().Equals("00000000-0000-0000-0000-000000000000"))) { return String.Empty; } @@ -6677,8 +6676,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api land = World.LandChannel.GetLandObject(ssp.AbsolutePosition); if (land != null) { - if (parcelOwned && land.LandData.OwnerID == id || - parcel && land.LandData.GlobalID == id) + if (parcelOwned && land.LandData.OwnerID.Equals(id) || + parcel && land.LandData.GlobalID.Equals(id)) { result.Add(new LSL_Key(ssp.UUID.ToString())); } @@ -6919,7 +6918,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (land == null) return; - if (m_host.OwnerID == land.LandData.OwnerID) + if (m_host.OwnerID.Equals(land.LandData.OwnerID)) { Vector3 p = World.GetNearestAllowedPosition(presence, land); presence.TeleportOnEject(p); @@ -6945,7 +6944,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(key); if (presence != null) // object is an avatar { - if (m_host.OwnerID == World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID) + if (m_host.OwnerID.Equals(World.LandChannel.GetLandObject(presence.AbsolutePosition).LandData.OwnerID)) return 1; } else // object is not an avatar @@ -6953,7 +6952,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectPart obj = World.GetSceneObjectPart(key); if (obj != null && - m_host.OwnerID == World.LandChannel.GetLandObject(obj.AbsolutePosition).LandData.OwnerID) + m_host.OwnerID.Equals(World.LandChannel.GetLandObject(obj.AbsolutePosition).LandData.OwnerID)) return 1; } } @@ -6998,7 +6997,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; // Check if it's a group key - if (uuid == m_host.ParentGroup.RootPart.GroupID) + if (uuid.Equals(m_host.ParentGroup.RootPart.GroupID)) return 1; // Handle object case @@ -7013,7 +7012,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // This will handle both deed and non-deed and also the no // group case - if (part.ParentGroup.RootPart.GroupID == m_host.ParentGroup.RootPart.GroupID) + if (part.ParentGroup.RootPart.GroupID.Equals(m_host.ParentGroup.RootPart.GroupID)) return 1; return 0; } @@ -7027,7 +7026,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return 0; IClientAPI client = presence.ControllingClient; - if (m_host.ParentGroup.RootPart.GroupID == client.ActiveGroupId) + if (m_host.ParentGroup.RootPart.GroupID.Equals(client.ActiveGroupId)) return 1; return 0; @@ -7064,8 +7063,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition); if (parcel != null) { - if (m_host.OwnerID == parcel.LandData.OwnerID || - (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.LandData.GroupID + if (m_host.OwnerID.Equals(parcel.LandData.OwnerID) || + (m_host.OwnerID.Equals(m_host.GroupID) && m_host.GroupID.Equals(parcel.LandData.GroupID) && parcel.LandData.IsGroupOwned) || World.Permissions.IsGod(m_host.OwnerID)) { av.StandUp(); @@ -7828,7 +7827,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api GridInstantMessage msg = new GridInstantMessage(World, m_host.OwnerID, m_host.Name, destID, (byte)InstantMessageDialog.TaskInventoryOffered, - m_host.OwnerID == m_host.GroupID, + m_host.OwnerID.Equals(m_host.GroupID), string.Format("'{0}'", category), //string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), folderID, false, pos, @@ -7968,7 +7967,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int idx = land.LandData.ParcelAccessList.FindIndex( delegate(LandAccessEntry e) { - if (e.AgentID == key && e.Flags == AccessList.Access) + if (e.Flags == AccessList.Access && e.AgentID.Equals(key)) return true; return false; }); @@ -8173,7 +8172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // target must be a different prim than the one containing the script - if (m_host.UUID == destId) + if (m_host.UUID.Equals(destId)) { return; } @@ -10607,7 +10606,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api mat.AlphaMaskCutoff = (byte)materialMaskCutoff; UUID id = m_materialsModule.AddNewMaterial(mat); // id is a hash of entire material hash, so this means no change - if(oldid == id) + if(oldid.Equals(id)) return false; texface.MaterialID = id; @@ -10670,7 +10669,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api mapID = m_materialsModule.AddNewMaterial(mat); - if(oldid == mapID) + if(oldid.Equals(mapID)) return false; texface.MaterialID = mapID; @@ -10743,7 +10742,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api mapID = m_materialsModule.AddNewMaterial(mat); - if(oldid == mapID) + if(oldid.Equals(mapID)) return false; texface.MaterialID = mapID; @@ -11049,8 +11048,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 box = presence.Appearance.AvatarBoxSize * 0.5f; - if (presence.Animator.Animations.ImplicitDefaultAnimation.AnimID - == DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"]) + if (presence.Animator.Animations.ImplicitDefaultAnimation.AnimID.Equals( + DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"])) { // This is for ground sitting avatars TODO! lower = new LSL_Vector(-box.X - 0.1125, -box.Y, box.Z * -1.0f); @@ -11123,7 +11122,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api upper = new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height); } // When avatar is groundsitting - else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"]) + else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID.Equals(DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"])) { lower = new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height); upper = new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height); @@ -11722,7 +11721,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { foreach(KeyValuePair inv in part.TaskInventory) { - if(inv.Value.InvType == (int)InventoryType.Texture && inv.Value.AssetID == origID) + if(inv.Value.InvType == (int)InventoryType.Texture && inv.Value.AssetID.Equals(origID)) return origID.ToString(); } } @@ -12992,7 +12991,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llLoadURL(string avatar_id, string message, string url) { - if(m_host.OwnerID == m_host.GroupID) + if(m_host.OwnerID.Equals(m_host.GroupID)) return; try { @@ -13242,7 +13241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // now send to all (non-child) agents in the parcel World.ForEachRootScenePresence(delegate(ScenePresence sp) { - if (sp.currentParcelUUID == landData.GlobalID) + if (sp.currentParcelUUID.Equals(landData.GlobalID)) { sp.ControllingClient.SendParcelMediaUpdate(landData.MediaURL, landData.MediaID, @@ -13275,7 +13274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // send to all (non-child) agents in the parcel World.ForEachRootScenePresence(delegate(ScenePresence sp) { - if (sp.currentParcelUUID == landData.GlobalID) + if (sp.currentParcelUUID.Equals(landData.GlobalID)) { sp.ControllingClient.SendParcelMediaCommand(cmndFlags, commandToSend.Value, time); @@ -13507,7 +13506,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int idx = land.LandData.ParcelAccessList.FindIndex( delegate(LandAccessEntry e) { - if (e.AgentID == key && e.Flags == AccessList.Ban) + if (e.Flags == AccessList.Ban && e.AgentID.Equals(key)) return true; return false; }); @@ -13544,7 +13543,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int idx = land.LandData.ParcelAccessList.FindIndex( delegate(LandAccessEntry e) { - if (e.AgentID == key && e.Flags == AccessList.Access) + if (e.Flags == AccessList.Access && e.AgentID.Equals(key)) return true; return false; }); @@ -13570,7 +13569,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api int idx = land.LandData.ParcelAccessList.FindIndex( delegate(LandAccessEntry e) { - if (e.AgentID == key && e.Flags == AccessList.Ban) + if (e.Flags == AccessList.Ban && e.AgentID.Equals(key)) return true; return false; }); @@ -14229,7 +14228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llResetLandBanList() { LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; - if (land.OwnerID == m_host.OwnerID && land.ParcelAccessList.Count > 0) + if (land.ParcelAccessList.Count > 0 && land.OwnerID.Equals(m_host.OwnerID)) { var todelete = new List(); foreach (LandAccessEntry entry in land.ParcelAccessList) @@ -14246,7 +14245,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llResetLandPassList() { LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition).LandData; - if (land.OwnerID == m_host.OwnerID && land.ParcelAccessList.Count > 0) + if (land.ParcelAccessList.Count > 0 && land.OwnerID.Equals(m_host.OwnerID)) { var todelete = new List(); foreach (LandAccessEntry entry in land.ParcelAccessList) @@ -14666,7 +14665,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (obj.ParentGroup.RootPart == obj) + if (obj.ParentGroup.RootPart.LocalId == obj.LocalId) rot = obj.ParentGroup.GroupRotation; else rot = obj.GetWorldRotation(); @@ -15064,7 +15063,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(prim, out UUID id)) return; SceneObjectPart obj = World.GetSceneObjectPart(id); - if (obj == null || obj.OwnerID != m_host.OwnerID) + if (obj == null || obj.OwnerID.NotEqual(m_host.OwnerID)) return; uint rulesParsed = 0; @@ -15106,7 +15105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return result; SceneObjectPart obj = World.GetSceneObjectPart(id); - if (obj == null || obj.OwnerID != m_host.OwnerID) + if (obj == null || obj.OwnerID.NotEqual(m_host.OwnerID)) return result; LSL_List remaining = GetPrimParams(obj, rules, ref result); @@ -15166,7 +15165,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string[] parts = name.Split(new char[] {' '}); if (parts.Length < 2) return name.ToLower(); - if (parts[1] == "Resident") + if (parts[1].Equals("Resident")) return parts[0].ToLower(); return name.Replace(" ", ".").ToLower(); @@ -15842,10 +15841,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_castRayCalls[i].CalledMs < fromCalledMs) m_castRayCalls.RemoveAt(i); // Use current region (in multi-region sims) - else if (m_castRayCalls[i].RegionId == regionId) + else if (m_castRayCalls[i].RegionId.Equals(regionId)) { // Reduce available time with recent calls - if (m_castRayCalls[i].UserId == userId) + if (m_castRayCalls[i].UserId.Equals(userId)) msAvailable -= m_castRayCalls[i].UsedMs; } } @@ -16859,7 +16858,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } - if (m_host.OwnerID == m_host.GroupID) + if (m_host.OwnerID.Equals(m_host.GroupID)) { replydata = "GROUP_OWNED"; break; @@ -17512,13 +17511,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (KeyValuePair kvp in DefaultAvatarAnimations.AnimsUUIDbyName) { - if (kvp.Value == animID) + if (kvp.Value.Equals(animID)) return kvp.Key.ToLower(); } foreach (TaskInventoryItem item in m_host.Inventory.GetInventoryItems()) { - if (item.AssetID == animID) + if (item.AssetID.Equals(animID)) return item.Name; }