diff options
author | onefang | 2019-07-25 20:20:21 +1000 |
---|---|---|
committer | onefang | 2019-07-25 20:20:21 +1000 |
commit | 0a38585d4a15100183acb293edcb9c69190c61db (patch) | |
tree | 8fbad76e2c7b275d4af90f034e7e5a637132ea7d /OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |
parent | Gatekeeper -> GatekeeperURI (diff) | |
download | opensim-SC_OLD-0a38585d4a15100183acb293edcb9c69190c61db.zip opensim-SC_OLD-0a38585d4a15100183acb293edcb9c69190c61db.tar.gz opensim-SC_OLD-0a38585d4a15100183acb293edcb9c69190c61db.tar.bz2 opensim-SC_OLD-0a38585d4a15100183acb293edcb9c69190c61db.tar.xz |
Merge LureModule into HGLureModule.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | 88 |
1 files changed, 18 insertions, 70 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index dfcf925..3dc9bf5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |||
@@ -49,7 +49,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
49 | private readonly List<Scene> m_scenes = new List<Scene>(); | 49 | private readonly List<Scene> m_scenes = new List<Scene>(); |
50 | 50 | ||
51 | private IMessageTransferModule m_TransferModule = null; | 51 | private IMessageTransferModule m_TransferModule = null; |
52 | private bool m_Enabled = false; | ||
53 | 52 | ||
54 | private string m_ThisGridURL; | 53 | private string m_ThisGridURL; |
55 | 54 | ||
@@ -59,24 +58,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
59 | { | 58 | { |
60 | if (config.Configs["Messaging"] != null) | 59 | if (config.Configs["Messaging"] != null) |
61 | { | 60 | { |
62 | if (config.Configs["Messaging"].GetString("LureModule", string.Empty) == "HGLureModule") | 61 | m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "Messaging" }, String.Empty); |
63 | { | ||
64 | m_Enabled = true; | ||
65 | |||
66 | m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", | ||
67 | new string[] { "Startup", "Hypergrid", "Messaging" }, String.Empty); | ||
68 | m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name); | ||
69 | } | ||
70 | // Legacy. Remove soon! | 62 | // Legacy. Remove soon! |
71 | //// m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL); | 63 | //// m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL); |
64 | m_log.DebugFormat("[HG LURE MODULE]: {0} enabled", Name); | ||
72 | } | 65 | } |
73 | } | 66 | } |
74 | 67 | ||
75 | public void AddRegion(Scene scene) | 68 | public void AddRegion(Scene scene) |
76 | { | 69 | { |
77 | if (!m_Enabled) | ||
78 | return; | ||
79 | |||
80 | lock (m_scenes) | 70 | lock (m_scenes) |
81 | { | 71 | { |
82 | m_scenes.Add(scene); | 72 | m_scenes.Add(scene); |
@@ -87,9 +77,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
87 | 77 | ||
88 | public void RegionLoaded(Scene scene) | 78 | public void RegionLoaded(Scene scene) |
89 | { | 79 | { |
90 | if (!m_Enabled) | ||
91 | return; | ||
92 | |||
93 | if (m_TransferModule == null) | 80 | if (m_TransferModule == null) |
94 | { | 81 | { |
95 | m_TransferModule = | 82 | m_TransferModule = |
@@ -97,9 +84,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
97 | 84 | ||
98 | if (m_TransferModule == null) | 85 | if (m_TransferModule == null) |
99 | { | 86 | { |
100 | m_log.Error("[LURE MODULE]: No message transfer module, lures will not work!"); | 87 | m_log.Error("[HG LURE MODULE]: No message transfer module, lures will not work!"); |
101 | |||
102 | m_Enabled = false; | ||
103 | m_scenes.Clear(); | 88 | m_scenes.Clear(); |
104 | scene.EventManager.OnNewClient -= OnNewClient; | 89 | scene.EventManager.OnNewClient -= OnNewClient; |
105 | scene.EventManager.OnIncomingInstantMessage -= OnIncomingInstantMessage; | 90 | scene.EventManager.OnIncomingInstantMessage -= OnIncomingInstantMessage; |
@@ -110,9 +95,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
110 | 95 | ||
111 | public void RemoveRegion(Scene scene) | 96 | public void RemoveRegion(Scene scene) |
112 | { | 97 | { |
113 | if (!m_Enabled) | ||
114 | return; | ||
115 | |||
116 | lock (m_scenes) | 98 | lock (m_scenes) |
117 | { | 99 | { |
118 | m_scenes.Remove(scene); | 100 | m_scenes.Remove(scene); |
@@ -154,17 +136,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
154 | { | 136 | { |
155 | if (im.dialog == (byte)InstantMessageDialog.RequestTeleport || im.dialog == (byte)InstantMessageDialog.GodLikeRequestTeleport) | 137 | if (im.dialog == (byte)InstantMessageDialog.RequestTeleport || im.dialog == (byte)InstantMessageDialog.GodLikeRequestTeleport) |
156 | { | 138 | { |
157 | if (1 == im.binaryBucket[0]) | 139 | UUID sessionID = new UUID(im.imSessionID); |
140 | if (!m_PendingLures.Contains(sessionID)) | ||
158 | { | 141 | { |
159 | UUID sessionID = new UUID(im.imSessionID); | 142 | m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", im.imSessionID, im.RegionID, im.message); |
160 | 143 | m_PendingLures.Add(sessionID, im, 7200); // 2 hours | |
161 | if (!m_PendingLures.Contains(sessionID)) | ||
162 | { | ||
163 | m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", im.imSessionID, im.RegionID, im.message); | ||
164 | m_PendingLures.Add(sessionID, im, 7200); // 2 hours | ||
165 | } | ||
166 | } | 144 | } |
167 | |||
168 | // Forward. We do this, because the IM module explicitly rejects IMs of this type | 145 | // Forward. We do this, because the IM module explicitly rejects IMs of this type |
169 | if (m_TransferModule != null) | 146 | if (m_TransferModule != null) |
170 | m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); | 147 | m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); |
@@ -180,45 +157,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
180 | ScenePresence presence = scene.GetScenePresence(client.AgentId); | 157 | ScenePresence presence = scene.GetScenePresence(client.AgentId); |
181 | ScenePresence target = scene.GetScenePresence(targetid); | 158 | ScenePresence target = scene.GetScenePresence(targetid); |
182 | Guid start = client.Scene.RegionInfo.RegionID.Guid; | 159 | Guid start = client.Scene.RegionInfo.RegionID.Guid; |
183 | UUID dest; | 160 | UUID dest = UUID.Random(); |
184 | byte reqType = (byte)InstantMessageDialog.RequestTeleport; | 161 | byte reqType = (byte)InstantMessageDialog.RequestTeleport; |
185 | byte[] bucket = new Byte[1]; | ||
186 | |||
187 | m_log.DebugFormat("[LURE MODULE]: TP invite with message {0}, type {1} {2} {3} {4}", message, lureType, scene.Permissions.IsAdministrator(client.AgentId), presence.IsViewerUIGod, (!scene.Permissions.IsAdministrator(targetid))); | ||
188 | |||
189 | GridInstantMessage m; | 162 | GridInstantMessage m; |
190 | 163 | ||
191 | GridRegion region = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, new UUID(start)); | 164 | GridRegion region = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, new UUID(start)); |
192 | if (region != null) | 165 | if (region != null) |
193 | { | 166 | { |
194 | bucket[0] = 0; | ||
195 | dest = Util.BuildFakeParcelID(scene.RegionInfo.RegionHandle, | ||
196 | (uint)presence.AbsolutePosition.X, (uint)presence.AbsolutePosition.Y, (uint)presence.AbsolutePosition.Z); | ||
197 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.IsViewerUIGod && (!scene.Permissions.IsAdministrator(targetid))) | 167 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.IsViewerUIGod && (!scene.Permissions.IsAdministrator(targetid))) |
198 | { | 168 | { |
199 | reqType = (byte)InstantMessageDialog.GodLikeRequestTeleport; | 169 | reqType = (byte)InstantMessageDialog.GodLikeRequestTeleport; |
200 | m_log.DebugFormat("[LURE MODULE]: TP FORCE GOD LURE with message {0}, type {1}", message, lureType); | 170 | m_log.DebugFormat("[HG LURE MODULE]: TP FORCE GOD LURE with message {0}, type {1}", message, lureType); |
201 | } | 171 | } |
202 | else | 172 | else |
203 | m_log.DebugFormat("[LURE MODULE]: TP lure with message {0}, type {1}", message, lureType); | 173 | m_log.DebugFormat("[HG LURE MODULE]: TP lure with message {0}, type {1}", message, lureType); |
204 | } | 174 | } |
205 | else | 175 | else |
206 | { | 176 | { |
207 | m_log.DebugFormat("[LURE MODULE]: HG lure with message {0}, type {1}", message, lureType); | 177 | m_log.DebugFormat("[HG LURE MODULE]: hypergrid TP lure with message {0}, type {1}", message, lureType); |
208 | bucket[0] = 1; | ||
209 | message += "@" + m_ThisGridURL; | 178 | message += "@" + m_ThisGridURL; |
210 | dest = UUID.Random(); | ||
211 | } | 179 | } |
212 | 180 | ||
213 | m = new GridInstantMessage(scene, client.AgentId, client.FirstName+" "+client.LastName, targetid, | 181 | m = new GridInstantMessage(scene, client.AgentId, client.FirstName+" "+client.LastName, targetid, |
214 | reqType, false, message, dest, false, presence.AbsolutePosition, bucket, true); | 182 | reqType, false, message, dest, false, presence.AbsolutePosition, new Byte[0], true); |
215 | 183 | m.RegionID = start; | |
216 | if (region == null) | 184 | m_PendingLures.Add(dest, m, 7200); // 2 hours |
217 | { | ||
218 | m.RegionID = start; | ||
219 | m_log.DebugFormat("[LURE MODULE]: Hypergrid RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message); | ||
220 | m_PendingLures.Add(dest, m, 7200); // 2 hours | ||
221 | } | ||
222 | 185 | ||
223 | if (m_TransferModule != null) | 186 | if (m_TransferModule != null) |
224 | { | 187 | { |
@@ -237,10 +200,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
237 | 200 | ||
238 | if (m_PendingLures.TryGetValue(lureID, out im)) | 201 | if (m_PendingLures.TryGetValue(lureID, out im)) |
239 | { | 202 | { |
203 | im.Position = im.Position + new Vector3(0.5f, 0.5f, 2f); | ||
240 | m_PendingLures.Remove(lureID); | 204 | m_PendingLures.Remove(lureID); |
241 | GridRegion region = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, new UUID(im.RegionID)); | 205 | GridRegion region = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, new UUID(im.RegionID)); |
242 | if (region != null) | 206 | if (region != null) |
243 | scene.RequestTeleportLocation(client, region.RegionHandle, im.Position + new Vector3(0.5f, 0.5f, 2f), Vector3.UnitX, teleportFlags); | 207 | scene.RequestTeleportLocation(client, region.RegionHandle, im.Position, Vector3.UnitX, teleportFlags); |
244 | else // we don't have that region here. Check if it's HG | 208 | else // we don't have that region here. Check if it's HG |
245 | { | 209 | { |
246 | string[] parts = im.message.Split(new char[] { '@' }); | 210 | string[] parts = im.message.Split(new char[] { '@' }); |
@@ -267,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
267 | if (message != null) | 231 | if (message != null) |
268 | sp.ControllingClient.SendAgentAlertMessage(message, true); | 232 | sp.ControllingClient.SendAgentAlertMessage(message, true); |
269 | 233 | ||
270 | transferMod.DoTeleport(sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 2f), Vector3.UnitX, teleportFlags); | 234 | transferMod.DoTeleport(sp, gatekeeper, finalDestination, im.Position, Vector3.UnitX, teleportFlags); |
271 | } | 235 | } |
272 | } | 236 | } |
273 | else | 237 | else |
@@ -280,23 +244,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
280 | } | 244 | } |
281 | } | 245 | } |
282 | else | 246 | else |
283 | { | 247 | m_log.DebugFormat("[HG LURE MODULE]: pending lure {0} not found", lureID); |
284 | ulong handle = 0; | ||
285 | uint x = 128; | ||
286 | uint y = 128; | ||
287 | uint z = 70; | ||
288 | |||
289 | Util.ParseFakeParcelID(lureID, out handle, out x, out y, out z); | ||
290 | |||
291 | Vector3 position = new Vector3(); | ||
292 | position.X = (float)x; | ||
293 | position.Y = (float)y; | ||
294 | position.Z = (float)z; | ||
295 | |||
296 | m_log.DebugFormat("[LURE MODULE]: Luring agent to local region {0}, position {1}", scene.Name, position); | ||
297 | scene.RequestTeleportLocation(client, handle, position + new Vector3(0.5f, 0.5f, 2f), Vector3.Zero, teleportFlags); | ||
298 | } | ||
299 | |||
300 | } | 248 | } |
301 | } | 249 | } |
302 | } | 250 | } |