diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs | 19 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs | 6 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | 9 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/InventoryDownloadBehaviour.cs | 121 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs (renamed from OpenSim/Region/Physics/POSPlugin/POSPlugin.cs) | 40 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | 9 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour2.cs (renamed from OpenSim/Region/Physics/OdePlugin/OdePlugin.cs) | 74 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs | 9 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/Behaviours/TwitchyBehaviour.cs (renamed from OpenSim/Tests/Clients/InstantMessage/IMClient.cs) | 66 |
9 files changed, 253 insertions, 100 deletions
diff --git a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs index 9a9371d..c1ba36b 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/AbstractBehaviour.cs | |||
@@ -29,21 +29,36 @@ using OpenMetaverse; | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | 31 | using System.Linq; |
32 | using System.Threading; | ||
32 | using pCampBot.Interfaces; | 33 | using pCampBot.Interfaces; |
33 | 34 | ||
34 | namespace pCampBot | 35 | namespace pCampBot |
35 | { | 36 | { |
36 | public class AbstractBehaviour : IBehaviour | 37 | public abstract class AbstractBehaviour : IBehaviour |
37 | { | 38 | { |
39 | /// <summary> | ||
40 | /// Abbreviated name of this behaviour. | ||
41 | /// </summary> | ||
42 | public string AbbreviatedName { get; protected set; } | ||
43 | |||
38 | public string Name { get; protected set; } | 44 | public string Name { get; protected set; } |
39 | 45 | ||
40 | public Bot Bot { get; protected set; } | 46 | public Bot Bot { get; protected set; } |
41 | 47 | ||
42 | public virtual void Action() {} | 48 | public abstract void Action(); |
49 | |||
50 | public virtual void Interrupt() {} | ||
51 | |||
52 | protected AutoResetEvent m_interruptEvent = new AutoResetEvent(false); | ||
43 | 53 | ||
44 | public virtual void Initialize(Bot bot) | 54 | public virtual void Initialize(Bot bot) |
45 | { | 55 | { |
46 | Bot = bot; | 56 | Bot = bot; |
47 | } | 57 | } |
58 | |||
59 | public virtual void Close() | ||
60 | { | ||
61 | Interrupt(); | ||
62 | } | ||
48 | } | 63 | } |
49 | } | 64 | } |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs index 1e01c64..4d806fc 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/CrossBehaviour.cs | |||
@@ -47,7 +47,11 @@ namespace pCampBot | |||
47 | 47 | ||
48 | public const int m_regionCrossingTimeout = 1000 * 60; | 48 | public const int m_regionCrossingTimeout = 1000 * 60; |
49 | 49 | ||
50 | public CrossBehaviour() { Name = "Cross"; } | 50 | public CrossBehaviour() |
51 | { | ||
52 | AbbreviatedName = "c"; | ||
53 | Name = "Cross"; | ||
54 | } | ||
51 | 55 | ||
52 | public override void Action() | 56 | public override void Action() |
53 | { | 57 | { |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs index 66a336a..59f6244 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/GrabbingBehaviour.cs | |||
@@ -29,6 +29,7 @@ using OpenMetaverse; | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | 31 | using System.Linq; |
32 | using System.Threading; | ||
32 | using pCampBot.Interfaces; | 33 | using pCampBot.Interfaces; |
33 | 34 | ||
34 | namespace pCampBot | 35 | namespace pCampBot |
@@ -41,7 +42,11 @@ namespace pCampBot | |||
41 | /// </remarks> | 42 | /// </remarks> |
42 | public class GrabbingBehaviour : AbstractBehaviour | 43 | public class GrabbingBehaviour : AbstractBehaviour |
43 | { | 44 | { |
44 | public GrabbingBehaviour() { Name = "Grabbing"; } | 45 | public GrabbingBehaviour() |
46 | { | ||
47 | AbbreviatedName = "g"; | ||
48 | Name = "Grabbing"; | ||
49 | } | ||
45 | 50 | ||
46 | public override void Action() | 51 | public override void Action() |
47 | { | 52 | { |
@@ -56,6 +61,8 @@ namespace pCampBot | |||
56 | Bot.Client.Self.Grab(prim.LocalID); | 61 | Bot.Client.Self.Grab(prim.LocalID); |
57 | Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); | 62 | Bot.Client.Self.GrabUpdate(prim.ID, Vector3.Zero); |
58 | Bot.Client.Self.DeGrab(prim.LocalID); | 63 | Bot.Client.Self.DeGrab(prim.LocalID); |
64 | |||
65 | Thread.Sleep(1000); | ||
59 | } | 66 | } |
60 | } | 67 | } |
61 | } \ No newline at end of file | 68 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/InventoryDownloadBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/InventoryDownloadBehaviour.cs new file mode 100644 index 0000000..521415c --- /dev/null +++ b/OpenSim/Tools/pCampBot/Behaviours/InventoryDownloadBehaviour.cs | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Diagnostics; | ||
32 | using System.Threading; | ||
33 | using System.Linq; | ||
34 | using pCampBot.Interfaces; | ||
35 | |||
36 | namespace pCampBot | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Do nothing | ||
40 | /// </summary> | ||
41 | public class InventoryDownloadBehaviour : AbstractBehaviour | ||
42 | { | ||
43 | private bool m_initialized; | ||
44 | private int m_Requests = 2; | ||
45 | private Stopwatch m_StopWatch = new Stopwatch(); | ||
46 | private List<UUID> m_processed = new List<UUID>(); | ||
47 | |||
48 | public InventoryDownloadBehaviour() | ||
49 | { | ||
50 | AbbreviatedName = "inv"; | ||
51 | Name = "Inventory"; | ||
52 | } | ||
53 | |||
54 | public override void Action() | ||
55 | { | ||
56 | if (!m_initialized) | ||
57 | { | ||
58 | m_initialized = true; | ||
59 | Bot.Client.Settings.HTTP_INVENTORY = true; | ||
60 | Bot.Client.Settings.FETCH_MISSING_INVENTORY = true; | ||
61 | Bot.Client.Inventory.FolderUpdated += Inventory_FolderUpdated; | ||
62 | Console.WriteLine("Lib owner is " + Bot.Client.Inventory.Store.LibraryRootNode.Data.OwnerID); | ||
63 | m_StopWatch.Start(); | ||
64 | Bot.Client.Inventory.RequestFolderContents(Bot.Client.Inventory.Store.RootFolder.UUID, Bot.Client.Self.AgentID, true, true, InventorySortOrder.ByDate); | ||
65 | Bot.Client.Inventory.RequestFolderContents(Bot.Client.Inventory.Store.LibraryRootNode.Data.UUID, Bot.Client.Inventory.Store.LibraryRootNode.Data.OwnerID, true, true, InventorySortOrder.ByDate); | ||
66 | } | ||
67 | |||
68 | Thread.Sleep(1000); | ||
69 | Console.WriteLine("Total items: " + Bot.Client.Inventory.Store.Items.Count + "; Total requests: " + m_Requests + "; Time: " + m_StopWatch.Elapsed); | ||
70 | |||
71 | } | ||
72 | |||
73 | void Inventory_FolderUpdated(object sender, FolderUpdatedEventArgs e) | ||
74 | { | ||
75 | if (e.Success) | ||
76 | { | ||
77 | //Console.WriteLine("Folder " + e.FolderID + " updated"); | ||
78 | bool fetch = false; | ||
79 | lock (m_processed) | ||
80 | { | ||
81 | if (!m_processed.Contains(e.FolderID)) | ||
82 | { | ||
83 | m_processed.Add(e.FolderID); | ||
84 | fetch = true; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | if (fetch) | ||
89 | { | ||
90 | List<InventoryFolder> m_foldersToFetch = new List<InventoryFolder>(); | ||
91 | foreach (InventoryBase item in Bot.Client.Inventory.Store.GetContents(e.FolderID)) | ||
92 | { | ||
93 | if (item is InventoryFolder) | ||
94 | { | ||
95 | InventoryFolder f = new InventoryFolder(item.UUID); | ||
96 | f.OwnerID = item.OwnerID; | ||
97 | m_foldersToFetch.Add(f); | ||
98 | } | ||
99 | } | ||
100 | if (m_foldersToFetch.Count > 0) | ||
101 | { | ||
102 | m_Requests += 1; | ||
103 | Bot.Client.Inventory.RequestFolderContentsCap(m_foldersToFetch, Bot.Client.Network.CurrentSim.Caps.CapabilityURI("FetchInventoryDescendents2"), true, true, InventorySortOrder.ByDate); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | if (Bot.Client.Inventory.Store.Items.Count >= 15739) | ||
108 | { | ||
109 | m_StopWatch.Stop(); | ||
110 | Console.WriteLine("Stop! Total items: " + Bot.Client.Inventory.Store.Items.Count + "; Total requests: " + m_Requests + "; Time: " + m_StopWatch.Elapsed); | ||
111 | } | ||
112 | } | ||
113 | |||
114 | } | ||
115 | |||
116 | public override void Interrupt() | ||
117 | { | ||
118 | m_interruptEvent.Set(); | ||
119 | } | ||
120 | } | ||
121 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs index e6b42e6..0d43781 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/NoneBehaviour.cs | |||
@@ -25,40 +25,36 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | ||
28 | using System; | 29 | using System; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using Nini.Config; | 31 | using System.Linq; |
31 | using OpenSim.Framework; | 32 | using pCampBot.Interfaces; |
32 | using OpenSim.Region.Physics.Manager; | ||
33 | 33 | ||
34 | namespace OpenSim.Region.Physics.POSPlugin | 34 | namespace pCampBot |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// for now will be a very POS physics engine | 37 | /// Do nothing |
38 | /// </summary> | 38 | /// </summary> |
39 | public class POSPlugin : IPhysicsPlugin | 39 | public class NoneBehaviour : AbstractBehaviour |
40 | { | 40 | { |
41 | public POSPlugin() | 41 | public NoneBehaviour() |
42 | { | 42 | { |
43 | } | 43 | AbbreviatedName = "n"; |
44 | 44 | Name = "None"; | |
45 | public bool Init() | ||
46 | { | ||
47 | return true; | ||
48 | } | ||
49 | |||
50 | public PhysicsScene GetScene(string sceneIdentifier) | ||
51 | { | ||
52 | return new POSScene(sceneIdentifier); | ||
53 | } | 45 | } |
54 | 46 | ||
55 | public string GetName() | 47 | public override void Action() |
56 | { | 48 | { |
57 | return ("POS"); | 49 | Bot.Client.Self.Jump(false); |
50 | Bot.Client.Self.Movement.Stop = true; | ||
51 | m_interruptEvent.WaitOne(); | ||
52 | Bot.Client.Self.Movement.Stop = false; | ||
58 | } | 53 | } |
59 | 54 | ||
60 | public void Dispose() | 55 | public override void Interrupt() |
61 | { | 56 | { |
57 | m_interruptEvent.Set(); | ||
62 | } | 58 | } |
63 | } | 59 | } |
64 | } | 60 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs index daa7485..98ab931 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour.cs | |||
@@ -46,6 +46,7 @@ namespace pCampBot | |||
46 | 46 | ||
47 | public PhysicsBehaviour() | 47 | public PhysicsBehaviour() |
48 | { | 48 | { |
49 | AbbreviatedName = "p"; | ||
49 | Name = "Physics"; | 50 | Name = "Physics"; |
50 | talkarray = readexcuses(); | 51 | talkarray = readexcuses(); |
51 | } | 52 | } |
@@ -77,6 +78,14 @@ namespace pCampBot | |||
77 | Bot.Client.Self.Chat(randomf, 0, ChatType.Normal); | 78 | Bot.Client.Self.Chat(randomf, 0, ChatType.Normal); |
78 | } | 79 | } |
79 | 80 | ||
81 | public override void Close() | ||
82 | { | ||
83 | if (Bot.ConnectionState == ConnectionState.Connected) | ||
84 | Bot.Client.Self.Jump(false); | ||
85 | |||
86 | base.Close(); | ||
87 | } | ||
88 | |||
80 | private string[] readexcuses() | 89 | private string[] readexcuses() |
81 | { | 90 | { |
82 | string allexcuses = ""; | 91 | string allexcuses = ""; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour2.cs index 478dd95..1ec2046 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/PhysicsBehaviour2.cs | |||
@@ -25,66 +25,62 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | ||
28 | using System; | 29 | using System; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | ||
30 | using System.Reflection; | 32 | using System.Reflection; |
31 | using System.Runtime.InteropServices; | ||
32 | using System.Threading; | 33 | using System.Threading; |
33 | using System.IO; | ||
34 | using System.Diagnostics; | ||
35 | using log4net; | 34 | using log4net; |
36 | using Nini.Config; | 35 | using pCampBot.Interfaces; |
37 | using Ode.NET; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Region.Physics.Manager; | ||
40 | using OpenMetaverse; | ||
41 | 36 | ||
42 | namespace OpenSim.Region.Physics.OdePlugin | 37 | namespace pCampBot |
43 | { | 38 | { |
44 | /// <summary> | 39 | /// <summary> |
45 | /// ODE plugin | 40 | /// This behavior is for the systematic study of some performance improvements made |
41 | /// for OSCC'13. | ||
42 | /// Walk around, sending AgentUpdate packets all the time. | ||
46 | /// </summary> | 43 | /// </summary> |
47 | public class OdePlugin : IPhysicsPlugin | 44 | public class PhysicsBehaviour2 : AbstractBehaviour |
48 | { | 45 | { |
49 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 46 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | |||
51 | private OdeScene m_scene; | ||
52 | 47 | ||
53 | public bool Init() | 48 | public PhysicsBehaviour2() |
54 | { | 49 | { |
55 | return true; | 50 | AbbreviatedName = "ph2"; |
51 | Name = "Physics2"; | ||
56 | } | 52 | } |
57 | 53 | ||
58 | public PhysicsScene GetScene(String sceneIdentifier) | 54 | private const int TIME_WALKING = 5 * 10; // 5 seconds |
55 | private int counter = 0; | ||
56 | |||
57 | public override void Action() | ||
59 | { | 58 | { |
60 | if (m_scene == null) | 59 | |
60 | if (counter >= TIME_WALKING) | ||
61 | { | 61 | { |
62 | // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether | 62 | counter = 0; |
63 | // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports | ||
64 | // will find it already loaded later on. | ||
65 | // | ||
66 | // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be | ||
67 | // controlled in Ode.NET.dll.config | ||
68 | if (Util.IsWindows()) | ||
69 | Util.LoadArchSpecificWindowsDll("ode.dll"); | ||
70 | 63 | ||
71 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | 64 | Vector3 target = new Vector3(Bot.Random.Next(1, 254), Bot.Random.Next(1, 254), Bot.Client.Self.SimPosition.Z); |
72 | // http://opensimulator.org/mantis/view.php?id=2750). | 65 | MyTurnToward(target); |
73 | d.InitODE(); | ||
74 | |||
75 | m_scene = new OdeScene(sceneIdentifier); | ||
76 | } | ||
77 | 66 | ||
78 | return m_scene; | 67 | Bot.Client.Self.Movement.AtPos = true; |
79 | } | ||
80 | 68 | ||
81 | public string GetName() | 69 | } |
82 | { | 70 | else |
83 | return ("OpenDynamicsEngine"); | 71 | counter++; |
72 | // In any case, send an update | ||
73 | Bot.Client.Self.Movement.SendUpdate(); | ||
84 | } | 74 | } |
85 | 75 | ||
86 | public void Dispose() | 76 | private void MyTurnToward(Vector3 target) |
87 | { | 77 | { |
78 | Quaternion between = Vector3.RotationBetween(Vector3.UnitX, Vector3.Normalize(target - Bot.Client.Self.SimPosition)); | ||
79 | Quaternion rot = between ; | ||
80 | |||
81 | Bot.Client.Self.Movement.BodyRotation = rot; | ||
82 | Bot.Client.Self.Movement.HeadRotation = rot; | ||
83 | Bot.Client.Self.Movement.Camera.LookAt(Bot.Client.Self.SimPosition, target); | ||
88 | } | 84 | } |
89 | } | 85 | } |
90 | } \ No newline at end of file | 86 | } \ No newline at end of file |
diff --git a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs index fbb4e96..81f250d 100644 --- a/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/TeleportBehaviour.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | 30 | using System.Linq; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | using log4net; | 33 | using log4net; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using pCampBot.Interfaces; | 35 | using pCampBot.Interfaces; |
@@ -42,7 +43,11 @@ namespace pCampBot | |||
42 | { | 43 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 45 | ||
45 | public TeleportBehaviour() { Name = "Teleport"; } | 46 | public TeleportBehaviour() |
47 | { | ||
48 | AbbreviatedName = "t"; | ||
49 | Name = "Teleport"; | ||
50 | } | ||
46 | 51 | ||
47 | public override void Action() | 52 | public override void Action() |
48 | { | 53 | { |
@@ -70,6 +75,8 @@ namespace pCampBot | |||
70 | Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); | 75 | Bot.Name, sourceRegion.Name, Bot.Client.Self.SimPosition, destRegion.Name, destPosition); |
71 | 76 | ||
72 | Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); | 77 | Bot.Client.Self.Teleport(destRegion.RegionHandle, destPosition); |
78 | |||
79 | Thread.Sleep(Bot.Random.Next(3000, 10000)); | ||
73 | } | 80 | } |
74 | } | 81 | } |
75 | } \ No newline at end of file | 82 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs b/OpenSim/Tools/pCampBot/Behaviours/TwitchyBehaviour.cs index e7304a2..7b4639d 100644 --- a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs +++ b/OpenSim/Tools/pCampBot/Behaviours/TwitchyBehaviour.cs | |||
@@ -25,51 +25,49 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenMetaverse; | ||
28 | using System; | 29 | using System; |
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Text; | 31 | using System.Linq; |
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | |||
33 | using OpenMetaverse; | ||
34 | using log4net; | 33 | using log4net; |
35 | using log4net.Appender; | 34 | using pCampBot.Interfaces; |
36 | using log4net.Layout; | ||
37 | 35 | ||
38 | using OpenSim.Framework; | 36 | namespace pCampBot |
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenSim.Services.Connectors.InstantMessage; | ||
41 | |||
42 | namespace OpenSim.Tests.Clients.InstantMessage | ||
43 | { | 37 | { |
44 | public class IMClient | 38 | /// <summary> |
39 | /// This behavior is for the systematic study of some performance improvements made | ||
40 | /// for OSCC'13. | ||
41 | /// Do nothing, but send AgentUpdate packets all the time that have only slightly | ||
42 | /// different state. The delta of difference will be filtered by OpenSim early on | ||
43 | /// in the packet processing pipeline. These filters did not exist before OSCC'13. | ||
44 | /// </summary> | ||
45 | public class TwitchyBehaviour : AbstractBehaviour | ||
45 | { | 46 | { |
46 | private static readonly ILog m_log = | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | public static void Main(string[] args) | ||
51 | { | ||
52 | ConsoleAppender consoleAppender = new ConsoleAppender(); | ||
53 | consoleAppender.Layout = | ||
54 | new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"); | ||
55 | log4net.Config.BasicConfigurator.Configure(consoleAppender); | ||
56 | 48 | ||
57 | string serverURI = "http://127.0.0.1:8002"; | 49 | public TwitchyBehaviour() |
58 | GridInstantMessage im = new GridInstantMessage(); | 50 | { |
59 | im.fromAgentID = new Guid(); | 51 | AbbreviatedName = "tw"; |
60 | im.toAgentID = new Guid(); | 52 | Name = "Twitchy"; |
61 | im.message = "Hello"; | 53 | } |
62 | im.imSessionID = new Guid(); | 54 | |
55 | private const float TWITCH = 0.0001f; | ||
56 | private int direction = 1; | ||
57 | |||
58 | public override void Action() | ||
59 | { | ||
60 | Bot.Client.Self.Movement.BodyRotation = new Quaternion(Bot.Client.Self.Movement.BodyRotation.X + direction * TWITCH, | ||
61 | Bot.Client.Self.Movement.BodyRotation.Y, | ||
62 | Bot.Client.Self.Movement.BodyRotation.Z, | ||
63 | Bot.Client.Self.Movement.BodyRotation.W); | ||
63 | 64 | ||
64 | bool success = InstantMessageServiceConnector.SendInstantMessage(serverURI, im); | 65 | //m_log.DebugFormat("[TWITCH]: BodyRot {0}", Bot.Client.Self.Movement.BodyRotation); |
66 | direction = -direction; | ||
65 | 67 | ||
66 | if (success) | 68 | Bot.Client.Self.Movement.SendUpdate(); |
67 | m_log.InfoFormat("[IM CLIENT]: Successfully IMed {0}", serverURI); | ||
68 | else | ||
69 | m_log.InfoFormat("[IM CLIENT]: failed to IM {0}", serverURI); | ||
70 | 69 | ||
71 | System.Console.WriteLine("\n"); | ||
72 | } | 70 | } |
73 | 71 | ||
74 | } | 72 | } |
75 | } | 73 | } \ No newline at end of file |