diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
7 files changed, 76 insertions, 19 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3f77f38..60568a8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -360,7 +360,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
360 | 360 | ||
361 | UUID ownerID = ti.OwnerID; | 361 | UUID ownerID = ti.OwnerID; |
362 | 362 | ||
363 | //OSSL only may be used if objet is in the same group as the parcel | 363 | //OSSL only may be used if object is in the same group as the parcel |
364 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) | 364 | if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) |
365 | { | 365 | { |
366 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 366 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
@@ -738,11 +738,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
738 | 738 | ||
739 | m_host.AddScriptLPS(1); | 739 | m_host.AddScriptLPS(1); |
740 | 740 | ||
741 | // For safety, we add another permission check here, and don't rely only on the standard OSSL permissions | ||
741 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 742 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) |
742 | { | 743 | { |
743 | MainConsole.Instance.RunCommand(command); | 744 | MainConsole.Instance.RunCommand(command); |
744 | return true; | 745 | return true; |
745 | } | 746 | } |
747 | |||
746 | return false; | 748 | return false; |
747 | } | 749 | } |
748 | 750 | ||
@@ -2569,6 +2571,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2569 | 2571 | ||
2570 | public void osNpcSay(LSL_Key npc, string message) | 2572 | public void osNpcSay(LSL_Key npc, string message) |
2571 | { | 2573 | { |
2574 | osNpcSay(npc, 0, message); | ||
2575 | } | ||
2576 | |||
2577 | public void osNpcSay(LSL_Key npc, int channel, string message) | ||
2578 | { | ||
2572 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); | 2579 | CheckThreatLevel(ThreatLevel.High, "osNpcSay"); |
2573 | m_host.AddScriptLPS(1); | 2580 | m_host.AddScriptLPS(1); |
2574 | 2581 | ||
@@ -2580,7 +2587,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2580 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | 2587 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) |
2581 | return; | 2588 | return; |
2582 | 2589 | ||
2583 | module.Say(npcId, World, message); | 2590 | module.Say(npcId, World, message, channel); |
2591 | } | ||
2592 | } | ||
2593 | |||
2594 | public void osNpcShout(LSL_Key npc, int channel, string message) | ||
2595 | { | ||
2596 | CheckThreatLevel(ThreatLevel.High, "osNpcShout"); | ||
2597 | m_host.AddScriptLPS(1); | ||
2598 | |||
2599 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2600 | if (module != null) | ||
2601 | { | ||
2602 | UUID npcId = new UUID(npc.m_string); | ||
2603 | |||
2604 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2605 | return; | ||
2606 | |||
2607 | module.Shout(npcId, World, message, channel); | ||
2584 | } | 2608 | } |
2585 | } | 2609 | } |
2586 | 2610 | ||
@@ -2681,6 +2705,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2681 | } | 2705 | } |
2682 | } | 2706 | } |
2683 | 2707 | ||
2708 | public void osNpcWhisper(LSL_Key npc, int channel, string message) | ||
2709 | { | ||
2710 | CheckThreatLevel(ThreatLevel.High, "osNpcWhisper"); | ||
2711 | m_host.AddScriptLPS(1); | ||
2712 | |||
2713 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2714 | if (module != null) | ||
2715 | { | ||
2716 | UUID npcId = new UUID(npc.m_string); | ||
2717 | |||
2718 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2719 | return; | ||
2720 | |||
2721 | module.Whisper(npcId, World, message, channel); | ||
2722 | } | ||
2723 | } | ||
2724 | |||
2684 | /// <summary> | 2725 | /// <summary> |
2685 | /// Save the current appearance of the script owner permanently to the named notecard. | 2726 | /// Save the current appearance of the script owner permanently to the named notecard. |
2686 | /// </summary> | 2727 | /// </summary> |
@@ -2832,21 +2873,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2832 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); | 2873 | CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar"); |
2833 | m_host.AddScriptLPS(1); | 2874 | m_host.AddScriptLPS(1); |
2834 | 2875 | ||
2835 | if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) | 2876 | World.ForEachRootScenePresence(delegate(ScenePresence sp) |
2836 | { | 2877 | { |
2837 | World.ForEachRootScenePresence(delegate(ScenePresence sp) | 2878 | if (sp.Firstname == FirstName && sp.Lastname == SurName) |
2838 | { | 2879 | { |
2839 | if (sp.Firstname == FirstName && sp.Lastname == SurName) | 2880 | // kick client... |
2840 | { | 2881 | if (alert != null) |
2841 | // kick client... | 2882 | sp.ControllingClient.Kick(alert); |
2842 | if (alert != null) | ||
2843 | sp.ControllingClient.Kick(alert); | ||
2844 | 2883 | ||
2845 | // ...and close on our side | 2884 | // ...and close on our side |
2846 | sp.Scene.IncomingCloseAgent(sp.UUID); | 2885 | sp.Scene.IncomingCloseAgent(sp.UUID); |
2847 | } | 2886 | } |
2848 | }); | 2887 | }); |
2849 | } | ||
2850 | } | 2888 | } |
2851 | 2889 | ||
2852 | public void osCauseDamage(string avatar, double damage) | 2890 | public void osCauseDamage(string avatar, double damage) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index fc77d05..7382495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -217,11 +217,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
217 | void osNpcSetRot(LSL_Key npc, rotation rot); | 217 | void osNpcSetRot(LSL_Key npc, rotation rot); |
218 | void osNpcStopMoveToTarget(LSL_Key npc); | 218 | void osNpcStopMoveToTarget(LSL_Key npc); |
219 | void osNpcSay(key npc, string message); | 219 | void osNpcSay(key npc, string message); |
220 | void osNpcSay(key npc, int channel, string message); | ||
221 | void osNpcShout(key npc, int channel, string message); | ||
220 | void osNpcSit(key npc, key target, int options); | 222 | void osNpcSit(key npc, key target, int options); |
221 | void osNpcStand(LSL_Key npc); | 223 | void osNpcStand(LSL_Key npc); |
222 | void osNpcRemove(key npc); | 224 | void osNpcRemove(key npc); |
223 | void osNpcPlayAnimation(LSL_Key npc, string animation); | 225 | void osNpcPlayAnimation(LSL_Key npc, string animation); |
224 | void osNpcStopAnimation(LSL_Key npc, string animation); | 226 | void osNpcStopAnimation(LSL_Key npc, string animation); |
227 | void osNpcWhisper(key npc, int channel, string message); | ||
225 | 228 | ||
226 | LSL_Key osOwnerSaveAppearance(string notecard); | 229 | LSL_Key osOwnerSaveAppearance(string notecard); |
227 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); | 230 | LSL_Key osAgentSaveAppearance(key agentId, string notecard); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 36ac0e3..d230662 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -580,6 +580,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
580 | m_OSSL_Functions.osNpcSay(npc, message); | 580 | m_OSSL_Functions.osNpcSay(npc, message); |
581 | } | 581 | } |
582 | 582 | ||
583 | public void osNpcSay(key npc, int channel, string message) | ||
584 | { | ||
585 | m_OSSL_Functions.osNpcSay(npc, channel, message); | ||
586 | } | ||
587 | |||
588 | |||
589 | public void osNpcShout(key npc, int channel, string message) | ||
590 | { | ||
591 | m_OSSL_Functions.osNpcShout(npc, channel, message); | ||
592 | } | ||
593 | |||
583 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) | 594 | public void osNpcSit(LSL_Key npc, LSL_Key target, int options) |
584 | { | 595 | { |
585 | m_OSSL_Functions.osNpcSit(npc, target, options); | 596 | m_OSSL_Functions.osNpcSit(npc, target, options); |
@@ -605,6 +616,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
605 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); | 616 | m_OSSL_Functions.osNpcStopAnimation(npc, animation); |
606 | } | 617 | } |
607 | 618 | ||
619 | public void osNpcWhisper(key npc, int channel, string message) | ||
620 | { | ||
621 | m_OSSL_Functions.osNpcWhisper(npc, channel, message); | ||
622 | } | ||
623 | |||
608 | public LSL_Key osOwnerSaveAppearance(string notecard) | 624 | public LSL_Key osOwnerSaveAppearance(string notecard) |
609 | { | 625 | { |
610 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); | 626 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index e2d0db2..49266e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
63 | IConfig config = initConfigSource.AddConfig("XEngine"); | 63 | IConfig config = initConfigSource.AddConfig("XEngine"); |
64 | config.Set("Enabled", "true"); | 64 | config.Set("Enabled", "true"); |
65 | 65 | ||
66 | m_scene = SceneHelpers.SetupScene(); | 66 | m_scene = new SceneHelpers().SetupScene(); |
67 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource); | 67 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource); |
68 | 68 | ||
69 | m_engine = new XEngine.XEngine(); | 69 | m_engine = new XEngine.XEngine(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 9cf9258..92a63bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
58 | IConfig config = initConfigSource.AddConfig("XEngine"); | 58 | IConfig config = initConfigSource.AddConfig("XEngine"); |
59 | config.Set("Enabled", "true"); | 59 | config.Set("Enabled", "true"); |
60 | 60 | ||
61 | Scene scene = SceneHelpers.SetupScene(); | 61 | Scene scene = new SceneHelpers().SetupScene(); |
62 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); | 62 | SceneObjectPart part = SceneHelpers.AddSceneObject(scene); |
63 | 63 | ||
64 | XEngine.XEngine engine = new XEngine.XEngine(); | 64 | XEngine.XEngine engine = new XEngine.XEngine(); |
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
261 | TestHelpers.InMethod(); | 261 | TestHelpers.InMethod(); |
262 | 262 | ||
263 | // Create Prim1. | 263 | // Create Prim1. |
264 | Scene scene = SceneHelpers.SetupScene(); | 264 | Scene scene = new SceneHelpers().SetupScene(); |
265 | string obj1Name = "Prim1"; | 265 | string obj1Name = "Prim1"; |
266 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 266 | UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
267 | SceneObjectPart part1 = | 267 | SceneObjectPart part1 = |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 7573dff..c51227b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
67 | config = initConfigSource.AddConfig("NPC"); | 67 | config = initConfigSource.AddConfig("NPC"); |
68 | config.Set("Enabled", "true"); | 68 | config.Set("Enabled", "true"); |
69 | 69 | ||
70 | m_scene = SceneHelpers.SetupScene(); | 70 | m_scene = new SceneHelpers().SetupScene(); |
71 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); | 71 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); |
72 | 72 | ||
73 | m_engine = new XEngine.XEngine(); | 73 | m_engine = new XEngine.XEngine(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 9d9fc51..9c36108 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
68 | config = initConfigSource.AddConfig("NPC"); | 68 | config = initConfigSource.AddConfig("NPC"); |
69 | config.Set("Enabled", "true"); | 69 | config.Set("Enabled", "true"); |
70 | 70 | ||
71 | m_scene = SceneHelpers.SetupScene(); | 71 | m_scene = new SceneHelpers().SetupScene(); |
72 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); | 72 | SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); |
73 | 73 | ||
74 | m_engine = new XEngine.XEngine(); | 74 | m_engine = new XEngine.XEngine(); |