29 using System.Collections.Generic;
30 using System.Reflection;
35 using OpenSim.Framework;
36 using OpenSim.Region.Framework.Interfaces;
37 using OpenSim.Region.Framework.Scenes;
41 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"LureModule")]
44 private static readonly ILog m_log = LogManager.GetLogger(
45 MethodBase.GetCurrentMethod().DeclaringType);
47 private readonly List<Scene> m_scenes =
new List<Scene>();
50 private bool m_Enabled =
false;
54 if (config.Configs[
"Messaging"] != null)
56 if (config.Configs[
"Messaging"].GetString(
57 "LureModule",
"LureModule") ==
61 m_log.DebugFormat(
"[LURE MODULE]: {0} enabled", Name);
74 scene.EventManager.OnNewClient += OnNewClient;
75 scene.EventManager.OnIncomingInstantMessage +=
85 if (m_TransferModule == null)
90 if (m_TransferModule == null)
92 m_log.Error(
"[INSTANT MESSAGE]: No message transfer module, "+
93 "lures will not work!");
97 scene.EventManager.OnNewClient -= OnNewClient;
98 scene.EventManager.OnIncomingInstantMessage -=
112 m_scenes.Remove(scene);
113 scene.EventManager.OnNewClient -= OnNewClient;
114 scene.EventManager.OnIncomingInstantMessage -=
115 OnGridInstantMessage;
121 client.OnInstantMessage += OnInstantMessage;
122 client.OnStartLure += OnStartLure;
123 client.OnTeleportLureRequest += OnTeleportLureRequest;
136 get {
return "LureModule"; }
139 public Type ReplaceableInterface
153 Scene scene = (Scene)(client.
Scene);
154 ScenePresence presence = scene.GetScenePresence(client.AgentId);
162 UUID dest = Util.BuildFakeParcelID(
163 scene.RegionInfo.RegionHandle,
165 (uint)presence.AbsolutePosition.Y,
168 m_log.DebugFormat(
"[LURE MODULE]: TP invite with message {0}, type {1}", message, lureType);
176 (byte)InstantMessageDialog.GodLikeRequestTeleport,
false,
184 (byte)InstantMessageDialog.RequestTeleport,
false,
189 if (m_TransferModule != null)
191 m_TransferModule.SendInstantMessage(m,
192 delegate(
bool success) { });
201 Scene scene = (Scene)(client.
Scene);
208 Util.ParseFakeParcelID(lureID, out handle, out x, out y, out z);
210 Vector3 position =
new Vector3();
211 position.X = (float)x;
212 position.Y = (float)y;
213 position.Z = (float)z;
215 scene.RequestTeleportLocation(client, handle, position,
216 Vector3.Zero, teleportFlags);
223 if (msg.
dialog != (byte)InstantMessageDialog.RequestTeleport &&
224 msg.
dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport)
227 if (m_TransferModule != null)
229 m_TransferModule.SendInstantMessage(msg,
230 delegate(
bool success) { });
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void OnStartLure(byte lureType, string message, UUID targetid, IClientAPI client)
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
override Vector3 AbsolutePosition
Position of this avatar relative to the region the avatar is in
ScenePermissions Permissions
void OnInstantMessage(IClientAPI client, GridInstantMessage im)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
bool IsAdministrator(UUID user)
void OnTeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client)
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...