EventManager.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  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 OpenSim 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. using System;
  28. using System.Collections.Generic;
  29. using OpenMetaverse;
  30. using OpenSim.Framework;
  31. using OpenSim.Framework.Client;
  32. using OpenSim.Region.Framework.Interfaces;
  33. using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
  34. namespace OpenSim.Region.Framework.Scenes
  35. {
  36. /// <summary>
  37. /// A class for triggering remote scene events.
  38. /// </summary>
  39. public class EventManager
  40. {
  41. public delegate void OnFrameDelegate();
  42. public event OnFrameDelegate OnFrame;
  43. public delegate void ClientMovement(ScenePresence client);
  44. public event ClientMovement OnClientMovement;
  45. public delegate void OnTerrainTickDelegate();
  46. public event OnTerrainTickDelegate OnTerrainTick;
  47. public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
  48. public event OnBackupDelegate OnBackup;
  49. public delegate void OnClientConnectCoreDelegate(IClientCore client);
  50. public event OnClientConnectCoreDelegate OnClientConnect;
  51. public delegate void OnNewClientDelegate(IClientAPI client);
  52. /// <summary>
  53. /// Depreciated in favour of OnClientConnect.
  54. /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
  55. /// </summary>
  56. public event OnNewClientDelegate OnNewClient;
  57. public delegate void OnNewPresenceDelegate(ScenePresence presence);
  58. public event OnNewPresenceDelegate OnNewPresence;
  59. public delegate void OnRemovePresenceDelegate(UUID agentId);
  60. public event OnRemovePresenceDelegate OnRemovePresence;
  61. public delegate void OnParcelPrimCountUpdateDelegate();
  62. public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
  63. public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
  64. public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
  65. public delegate void OnPluginConsoleDelegate(string[] args);
  66. public event OnPluginConsoleDelegate OnPluginConsole;
  67. public delegate void OnShutdownDelegate();
  68. public event OnShutdownDelegate OnShutdown;
  69. public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  70. public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient);
  71. public delegate void ScriptResetDelegate(uint localID, UUID itemID);
  72. public delegate void OnPermissionErrorDelegate(UUID user, string reason);
  73. public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
  74. public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
  75. public event ObjectGrabDelegate OnObjectGrab;
  76. public event ObjectDeGrabDelegate OnObjectDeGrab;
  77. public event ScriptResetDelegate OnScriptReset;
  78. public event OnPermissionErrorDelegate OnPermissionError;
  79. public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
  80. public event NewRezScript OnRezScript;
  81. public delegate void RemoveScript(uint localID, UUID itemID);
  82. public event RemoveScript OnRemoveScript;
  83. public delegate void StartScript(uint localID, UUID itemID);
  84. public event StartScript OnStartScript;
  85. public delegate void StopScript(uint localID, UUID itemID);
  86. public event StopScript OnStopScript;
  87. public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
  88. public event SceneGroupMoved OnSceneGroupMove;
  89. public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
  90. public event SceneGroupGrabed OnSceneGroupGrab;
  91. public delegate void LandObjectAdded(ILandObject newParcel);
  92. public event LandObjectAdded OnLandObjectAdded;
  93. public delegate void LandObjectRemoved(UUID globalID);
  94. public event LandObjectRemoved OnLandObjectRemoved;
  95. public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
  96. public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
  97. public delegate void SignificantClientMovement(IClientAPI remote_client);
  98. public event SignificantClientMovement OnSignificantClientMovement;
  99. public delegate void IncomingInstantMessage(GridInstantMessage message);
  100. public event IncomingInstantMessage OnIncomingInstantMessage;
  101. public event IncomingInstantMessage OnUnhandledInstantMessage;
  102. public delegate void ClientClosed(UUID clientID);
  103. public event ClientClosed OnClientClosed;
  104. public delegate void ScriptChangedEvent(uint localID, uint change);
  105. public event ScriptChangedEvent OnScriptChangedEvent;
  106. public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed);
  107. public event ScriptControlEvent OnScriptControlEvent;
  108. public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
  109. public event ScriptAtTargetEvent OnScriptAtTargetEvent;
  110. public delegate void ScriptNotAtTargetEvent(uint localID);
  111. public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
  112. public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
  113. public event ScriptColliding OnScriptColliderStart;
  114. public event ScriptColliding OnScriptColliding;
  115. public event ScriptColliding OnScriptCollidingEnd;
  116. public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
  117. public event OnMakeChildAgentDelegate OnMakeChildAgent;
  118. public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
  119. public event OnMakeRootAgentDelegate OnMakeRootAgent;
  120. public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
  121. public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
  122. public delegate void RequestChangeWaterHeight(float height);
  123. public event RequestChangeWaterHeight OnRequestChangeWaterHeight;
  124. public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar);
  125. public event AvatarKillData OnAvatarKilled;
  126. public delegate void ScriptTimerEvent(uint localID, double timerinterval);
  127. public event ScriptTimerEvent OnScriptTimerEvent;
  128. public delegate void EstateToolsTimeUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
  129. public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
  130. public event EstateToolsTimeUpdate OnEstateToolsTimeUpdate;
  131. public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
  132. public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
  133. public delegate void NoticeNoLandDataFromStorage();
  134. public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
  135. public delegate void IncomingLandDataFromStorage(List<LandData> data);
  136. public event IncomingLandDataFromStorage OnIncomingLandDataFromStorage;
  137. public delegate void SetAllowForcefulBan(bool allow);
  138. public event SetAllowForcefulBan OnSetAllowForcefulBan;
  139. public delegate void RequestParcelPrimCountUpdate();
  140. public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
  141. public delegate void ParcelPrimCountTainted();
  142. public event ParcelPrimCountTainted OnParcelPrimCountTainted;
  143. public event GetScriptRunning OnGetScriptRunning;
  144. /// <summary>
  145. /// RegisterCapsEvent is called by Scene after the Caps object
  146. /// has been instantiated and before it is return to the
  147. /// client and provides region modules to add their caps.
  148. /// </summary>
  149. public delegate void RegisterCapsEvent(UUID agentID, Caps caps);
  150. public event RegisterCapsEvent OnRegisterCaps;
  151. /// <summary>
  152. /// DeregisterCapsEvent is called by Scene when the caps
  153. /// handler for an agent are removed.
  154. /// </summary>
  155. public delegate void DeregisterCapsEvent(UUID agentID, Caps caps);
  156. public event DeregisterCapsEvent OnDeregisterCaps;
  157. /// <summary>
  158. /// ChatFromWorldEvent is called via Scene when a chat message
  159. /// from world comes in.
  160. /// </summary>
  161. public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
  162. public event ChatFromWorldEvent OnChatFromWorld;
  163. /// <summary>
  164. /// ChatFromClientEvent is triggered via ChatModule (or
  165. /// substitutes thereof) when a chat message
  166. /// from the client comes in.
  167. /// </summary>
  168. public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
  169. public event ChatFromClientEvent OnChatFromClient;
  170. /// <summary>
  171. /// ChatBroadcastEvent is called via Scene when a broadcast chat message
  172. /// from world comes in
  173. /// </summary>
  174. public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
  175. public event ChatBroadcastEvent OnChatBroadcast;
  176. public delegate float SunLindenHour();
  177. public event SunLindenHour OnGetSunLindenHour;
  178. /// <summary>
  179. /// Called when oar file has finished loading, although
  180. /// the scripts may not have started yet
  181. /// Message is non empty string if there were problems loading the oar file
  182. /// </summary>
  183. public delegate void OarFileLoaded(string message);
  184. public event OarFileLoaded OnOarFileLoaded;
  185. /// <summary>
  186. /// Called when an oar file has finished saving
  187. /// Message is non empty string if there were problems saving the oar file
  188. /// </summary>
  189. public delegate void OarFileSaved(string message);
  190. public event OarFileSaved OnOarFileSaved;
  191. /// <summary>
  192. /// Called when the script compile queue becomes empty
  193. /// Returns the number of scripts which failed to start
  194. /// </summary>
  195. public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message);
  196. public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
  197. public class MoneyTransferArgs : EventArgs
  198. {
  199. public UUID sender;
  200. public UUID receiver;
  201. // Always false. The SL protocol sucks.
  202. public bool authenticated = false;
  203. public int amount;
  204. public int transactiontype;
  205. public string description;
  206. public MoneyTransferArgs(UUID asender, UUID areceiver, int aamount, int atransactiontype, string adescription)
  207. {
  208. sender = asender;
  209. receiver = areceiver;
  210. amount = aamount;
  211. transactiontype = atransactiontype;
  212. description = adescription;
  213. }
  214. }
  215. public class LandBuyArgs : EventArgs
  216. {
  217. public UUID agentId = UUID.Zero;
  218. public UUID groupId = UUID.Zero;
  219. public UUID parcelOwnerID = UUID.Zero;
  220. public bool final = false;
  221. public bool groupOwned = false;
  222. public bool removeContribution = false;
  223. public int parcelLocalID = 0;
  224. public int parcelArea = 0;
  225. public int parcelPrice = 0;
  226. public bool authenticated = false;
  227. public bool landValidated = false;
  228. public bool economyValidated = false;
  229. public int transactionID = 0;
  230. public int amountDebited = 0;
  231. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  232. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  233. bool pauthenticated)
  234. {
  235. agentId = pagentId;
  236. groupId = pgroupId;
  237. final = pfinal;
  238. groupOwned = pgroupOwned;
  239. removeContribution = premoveContribution;
  240. parcelLocalID = pparcelLocalID;
  241. parcelArea = pparcelArea;
  242. parcelPrice = pparcelPrice;
  243. authenticated = pauthenticated;
  244. }
  245. }
  246. public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
  247. public delegate void LandBuy(Object sender, LandBuyArgs e);
  248. public event MoneyTransferEvent OnMoneyTransfer;
  249. public event LandBuy OnLandBuy;
  250. public event LandBuy OnValidateLandBuy;
  251. /* Designated Event Deletage Instances */
  252. private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
  253. private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
  254. private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
  255. private ClientMovement handlerClientMovement = null; //OnClientMovement;
  256. private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
  257. private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
  258. private OnFrameDelegate handlerFrame = null; //OnFrame;
  259. private OnNewClientDelegate handlerNewClient = null; //OnNewClient;
  260. private OnClientConnectCoreDelegate handlerClientConnect = null; //OnClientConnect
  261. private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence;
  262. private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence;
  263. private OnBackupDelegate handlerBackup = null; //OnBackup;
  264. private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate;
  265. private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer;
  266. private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
  267. private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
  268. private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
  269. private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
  270. private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset
  271. private NewRezScript handlerRezScript = null; //OnRezScript;
  272. private RemoveScript handlerRemoveScript = null; //OnRemoveScript;
  273. private StartScript handlerStartScript = null; //OnStartScript;
  274. private StopScript handlerStopScript = null; //OnStopScript;
  275. private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
  276. private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab;
  277. private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
  278. private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
  279. private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
  280. private IncomingInstantMessage handlerIncomingInstantMessage = null; //OnIncomingInstantMessage;
  281. private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage;
  282. private ClientClosed handlerClientClosed = null; //OnClientClosed;
  283. private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
  284. private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
  285. private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
  286. private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
  287. private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
  288. private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld;
  289. private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient;
  290. private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast;
  291. private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
  292. private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight
  293. private ScriptControlEvent handlerScriptControlEvent = null;
  294. private SignificantClientMovement handlerSignificantClientMovement = null;
  295. private LandBuy handlerLandBuy = null;
  296. private LandBuy handlerValidateLandBuy = null;
  297. private AvatarKillData handlerAvatarKill = null;
  298. private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null;
  299. private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null;
  300. private SetAllowForcefulBan handlerSetAllowForcefulBan = null;
  301. private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
  302. private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
  303. private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
  304. private ScriptTimerEvent handlerScriptTimerEvent = null;
  305. private EstateToolsTimeUpdate handlerEstateToolsTimeUpdate = null;
  306. private ScriptColliding handlerCollidingStart = null;
  307. private ScriptColliding handlerColliding = null;
  308. private ScriptColliding handlerCollidingEnd = null;
  309. private GetScriptRunning handlerGetScriptRunning = null;
  310. private SunLindenHour handlerSunGetLindenHour = null;
  311. private OnSetRootAgentSceneDelegate handlerSetRootAgentScene = null;
  312. private OarFileLoaded handlerOarFileLoaded = null;
  313. private OarFileSaved handlerOarFileSaved = null;
  314. private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
  315. public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
  316. {
  317. handlerGetScriptRunning = OnGetScriptRunning;
  318. if (handlerGetScriptRunning != null)
  319. handlerGetScriptRunning(controllingClient, objectID, itemID);
  320. }
  321. public void TriggerOnScriptChangedEvent(uint localID, uint change)
  322. {
  323. handlerScriptChangedEvent = OnScriptChangedEvent;
  324. if (handlerScriptChangedEvent != null)
  325. handlerScriptChangedEvent(localID, change);
  326. }
  327. public void TriggerOnClientMovement(ScenePresence avatar)
  328. {
  329. handlerClientMovement = OnClientMovement;
  330. if (handlerClientMovement != null)
  331. handlerClientMovement(avatar);
  332. }
  333. public void TriggerPermissionError(UUID user, string reason)
  334. {
  335. handlerPermissionError = OnPermissionError;
  336. if (handlerPermissionError != null)
  337. handlerPermissionError(user, reason);
  338. }
  339. public void TriggerOnPluginConsole(string[] args)
  340. {
  341. handlerPluginConsole = OnPluginConsole;
  342. if (handlerPluginConsole != null)
  343. handlerPluginConsole(args);
  344. }
  345. public void TriggerOnFrame()
  346. {
  347. handlerFrame = OnFrame;
  348. if (handlerFrame != null)
  349. {
  350. handlerFrame();
  351. }
  352. }
  353. public void TriggerOnNewClient(IClientAPI client)
  354. {
  355. handlerNewClient = OnNewClient;
  356. if (handlerNewClient != null)
  357. handlerNewClient(client);
  358. if (client is IClientCore)
  359. {
  360. handlerClientConnect = OnClientConnect;
  361. handlerClientConnect((IClientCore) client);
  362. }
  363. }
  364. public void TriggerOnNewPresence(ScenePresence presence)
  365. {
  366. handlerNewPresence = OnNewPresence;
  367. if (handlerNewPresence != null)
  368. handlerNewPresence(presence);
  369. }
  370. public void TriggerOnRemovePresence(UUID agentId)
  371. {
  372. handlerRemovePresence = OnRemovePresence;
  373. if (handlerRemovePresence != null)
  374. {
  375. handlerRemovePresence(agentId);
  376. }
  377. }
  378. public void TriggerOnBackup(IRegionDataStore dstore)
  379. {
  380. handlerBackup = OnBackup;
  381. if (handlerBackup != null)
  382. {
  383. handlerBackup(dstore, false);
  384. }
  385. }
  386. public void TriggerParcelPrimCountUpdate()
  387. {
  388. handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate;
  389. if (handlerParcelPrimCountUpdate != null)
  390. {
  391. handlerParcelPrimCountUpdate();
  392. }
  393. }
  394. public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e)
  395. {
  396. handlerMoneyTransfer = OnMoneyTransfer;
  397. if (handlerMoneyTransfer != null)
  398. {
  399. handlerMoneyTransfer(sender, e);
  400. }
  401. }
  402. public void TriggerTerrainTick()
  403. {
  404. handlerTerrainTick = OnTerrainTick;
  405. if (handlerTerrainTick != null)
  406. {
  407. handlerTerrainTick();
  408. }
  409. }
  410. public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
  411. {
  412. handlerParcelPrimCountAdd = OnParcelPrimCountAdd;
  413. if (handlerParcelPrimCountAdd != null)
  414. {
  415. handlerParcelPrimCountAdd(obj);
  416. }
  417. }
  418. public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
  419. {
  420. handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  421. if (handlerObjectBeingRemovedFromScene != null)
  422. {
  423. handlerObjectBeingRemovedFromScene(obj);
  424. }
  425. }
  426. public void TriggerShutdown()
  427. {
  428. handlerShutdown = OnShutdown;
  429. if (handlerShutdown != null)
  430. handlerShutdown();
  431. }
  432. public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  433. {
  434. handlerObjectGrab = OnObjectGrab;
  435. if (handlerObjectGrab != null)
  436. {
  437. handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  438. }
  439. }
  440. public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient)
  441. {
  442. handlerObjectDeGrab = OnObjectDeGrab;
  443. if (handlerObjectDeGrab != null)
  444. {
  445. handlerObjectDeGrab(localID, originalID, remoteClient);
  446. }
  447. }
  448. public void TriggerScriptReset(uint localID, UUID itemID)
  449. {
  450. handlerScriptReset = OnScriptReset;
  451. if (handlerScriptReset != null)
  452. {
  453. handlerScriptReset(localID, itemID);
  454. }
  455. }
  456. public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
  457. {
  458. handlerRezScript = OnRezScript;
  459. if (handlerRezScript != null)
  460. {
  461. handlerRezScript(localID, itemID, script, startParam,
  462. postOnRez, engine, stateSource);
  463. }
  464. }
  465. public void TriggerStartScript(uint localID, UUID itemID)
  466. {
  467. handlerStartScript = OnStartScript;
  468. if (handlerStartScript != null)
  469. {
  470. handlerStartScript(localID, itemID);
  471. }
  472. }
  473. public void TriggerStopScript(uint localID, UUID itemID)
  474. {
  475. handlerStopScript = OnStopScript;
  476. if (handlerStopScript != null)
  477. {
  478. handlerStopScript(localID, itemID);
  479. }
  480. }
  481. public void TriggerRemoveScript(uint localID, UUID itemID)
  482. {
  483. handlerRemoveScript = OnRemoveScript;
  484. if (handlerRemoveScript != null)
  485. {
  486. handlerRemoveScript(localID, itemID);
  487. }
  488. }
  489. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  490. {
  491. handlerSceneGroupMove = OnSceneGroupMove;
  492. if (handlerSceneGroupMove != null)
  493. {
  494. return handlerSceneGroupMove(groupID, delta);
  495. }
  496. return true;
  497. }
  498. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  499. {
  500. handlerSceneGroupGrab = OnSceneGroupGrab;
  501. if (handlerSceneGroupGrab != null)
  502. {
  503. handlerSceneGroupGrab(groupID, offset, userID);
  504. }
  505. }
  506. public void TriggerLandObjectAdded(ILandObject newParcel)
  507. {
  508. handlerLandObjectAdded = OnLandObjectAdded;
  509. if (handlerLandObjectAdded != null)
  510. {
  511. handlerLandObjectAdded(newParcel);
  512. }
  513. }
  514. public void TriggerLandObjectRemoved(UUID globalID)
  515. {
  516. handlerLandObjectRemoved = OnLandObjectRemoved;
  517. if (handlerLandObjectRemoved != null)
  518. {
  519. handlerLandObjectRemoved(globalID);
  520. }
  521. }
  522. public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
  523. {
  524. //triggerLandObjectRemoved(localParcelID);
  525. TriggerLandObjectAdded(newParcel);
  526. }
  527. public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
  528. {
  529. handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  530. if (handlerAvatarEnteringNewParcel != null)
  531. {
  532. handlerAvatarEnteringNewParcel(avatar, localLandID, regionID);
  533. }
  534. }
  535. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  536. {
  537. handlerIncomingInstantMessage = OnIncomingInstantMessage;
  538. if (handlerIncomingInstantMessage != null)
  539. {
  540. handlerIncomingInstantMessage(message);
  541. }
  542. }
  543. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  544. {
  545. handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  546. if (handlerUnhandledInstantMessage != null)
  547. {
  548. handlerUnhandledInstantMessage(message);
  549. }
  550. }
  551. public void TriggerClientClosed(UUID ClientID)
  552. {
  553. handlerClientClosed = OnClientClosed;
  554. if (handlerClientClosed != null)
  555. {
  556. handlerClientClosed(ClientID);
  557. }
  558. }
  559. public void TriggerOnMakeChildAgent(ScenePresence presence)
  560. {
  561. handlerMakeChildAgent = OnMakeChildAgent;
  562. if (handlerMakeChildAgent != null)
  563. {
  564. handlerMakeChildAgent(presence);
  565. }
  566. }
  567. public void TriggerOnMakeRootAgent(ScenePresence presence)
  568. {
  569. handlerMakeRootAgent = OnMakeRootAgent;
  570. if (handlerMakeRootAgent != null)
  571. {
  572. handlerMakeRootAgent(presence);
  573. }
  574. }
  575. public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
  576. {
  577. handlerRegisterCaps = OnRegisterCaps;
  578. if (handlerRegisterCaps != null)
  579. {
  580. handlerRegisterCaps(agentID, caps);
  581. }
  582. }
  583. public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
  584. {
  585. handlerDeregisterCaps = OnDeregisterCaps;
  586. if (handlerDeregisterCaps != null)
  587. {
  588. handlerDeregisterCaps(agentID, caps);
  589. }
  590. }
  591. public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
  592. {
  593. handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
  594. if (handlerNewInventoryItemUpdateComplete != null)
  595. {
  596. handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel);
  597. }
  598. }
  599. public void TriggerLandBuy(Object sender, LandBuyArgs e)
  600. {
  601. handlerLandBuy = OnLandBuy;
  602. if (handlerLandBuy != null)
  603. {
  604. handlerLandBuy(sender, e);
  605. }
  606. }
  607. public void TriggerValidateLandBuy(Object sender, LandBuyArgs e)
  608. {
  609. handlerValidateLandBuy = OnValidateLandBuy;
  610. if (handlerValidateLandBuy != null)
  611. {
  612. handlerValidateLandBuy(sender, e);
  613. }
  614. }
  615. public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
  616. {
  617. handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  618. if (handlerScriptAtTargetEvent != null)
  619. {
  620. handlerScriptAtTargetEvent(localID, handle, targetpos, currentpos);
  621. }
  622. }
  623. public void TriggerNotAtTargetEvent(uint localID)
  624. {
  625. handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  626. if (handlerScriptNotAtTargetEvent != null)
  627. {
  628. handlerScriptNotAtTargetEvent(localID);
  629. }
  630. }
  631. public void TriggerRequestChangeWaterHeight(float height)
  632. {
  633. handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  634. if (handlerRequestChangeWaterHeight != null)
  635. {
  636. handlerRequestChangeWaterHeight(height);
  637. }
  638. }
  639. public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
  640. {
  641. handlerAvatarKill = OnAvatarKilled;
  642. if (handlerAvatarKill != null)
  643. {
  644. handlerAvatarKill(KillerObjectLocalID, DeadAvatar);
  645. }
  646. }
  647. public void TriggerSignificantClientMovement(IClientAPI client)
  648. {
  649. handlerSignificantClientMovement = OnSignificantClientMovement;
  650. if (handlerSignificantClientMovement != null)
  651. {
  652. handlerSignificantClientMovement(client);
  653. }
  654. }
  655. public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
  656. {
  657. handlerChatFromWorld = OnChatFromWorld;
  658. if (handlerChatFromWorld != null)
  659. {
  660. handlerChatFromWorld(sender, chat);
  661. }
  662. }
  663. public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
  664. {
  665. handlerChatFromClient = OnChatFromClient;
  666. if (handlerChatFromClient != null)
  667. {
  668. handlerChatFromClient(sender, chat);
  669. }
  670. }
  671. public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
  672. {
  673. handlerChatBroadcast = OnChatBroadcast;
  674. if (handlerChatBroadcast != null)
  675. {
  676. handlerChatBroadcast(sender, chat);
  677. }
  678. }
  679. internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
  680. {
  681. handlerScriptControlEvent = OnScriptControlEvent;
  682. if (handlerScriptControlEvent != null)
  683. {
  684. handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed);
  685. }
  686. }
  687. public void TriggerNoticeNoLandDataFromStorage()
  688. {
  689. handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
  690. if (handlerNoticeNoLandDataFromStorage != null)
  691. {
  692. handlerNoticeNoLandDataFromStorage();
  693. }
  694. }
  695. public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
  696. {
  697. handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
  698. if (handlerIncomingLandDataFromStorage != null)
  699. {
  700. handlerIncomingLandDataFromStorage(landData);
  701. }
  702. }
  703. public void TriggerSetAllowForcefulBan(bool allow)
  704. {
  705. handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
  706. if (handlerSetAllowForcefulBan != null)
  707. {
  708. handlerSetAllowForcefulBan(allow);
  709. }
  710. }
  711. public void TriggerRequestParcelPrimCountUpdate()
  712. {
  713. handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
  714. if (handlerRequestParcelPrimCountUpdate != null)
  715. {
  716. handlerRequestParcelPrimCountUpdate();
  717. }
  718. }
  719. public void TriggerParcelPrimCountTainted()
  720. {
  721. handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
  722. if (handlerParcelPrimCountTainted != null)
  723. {
  724. handlerParcelPrimCountTainted();
  725. }
  726. }
  727. // this lets us keep track of nasty script events like timer, etc.
  728. public void TriggerTimerEvent(uint objLocalID, double Interval)
  729. {
  730. handlerScriptTimerEvent = OnScriptTimerEvent;
  731. if (handlerScriptTimerEvent != null)
  732. {
  733. handlerScriptTimerEvent(objLocalID, Interval);
  734. }
  735. }
  736. public void TriggerEstateToolsTimeUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float LindenHour)
  737. {
  738. handlerEstateToolsTimeUpdate = OnEstateToolsTimeUpdate;
  739. if (handlerEstateToolsTimeUpdate != null)
  740. {
  741. handlerEstateToolsTimeUpdate(regionHandle, FixedTime, useEstateTime, LindenHour);
  742. }
  743. }
  744. public float GetSunLindenHour()
  745. {
  746. handlerSunGetLindenHour = OnGetSunLindenHour;
  747. if (handlerSunGetLindenHour != null)
  748. {
  749. return handlerSunGetLindenHour();
  750. }
  751. return 6;
  752. }
  753. public void TriggerOarFileLoaded(string message)
  754. {
  755. handlerOarFileLoaded = OnOarFileLoaded;
  756. if (handlerOarFileLoaded != null)
  757. handlerOarFileLoaded(message);
  758. }
  759. public void TriggerOarFileSaved(string message)
  760. {
  761. handlerOarFileSaved = OnOarFileSaved;
  762. if (handlerOarFileSaved != null)
  763. handlerOarFileSaved(message);
  764. }
  765. public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
  766. {
  767. handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue;
  768. if (handlerEmptyScriptCompileQueue != null)
  769. handlerEmptyScriptCompileQueue(numScriptsFailed, message);
  770. }
  771. public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
  772. {
  773. handlerCollidingStart = OnScriptColliderStart;
  774. if (handlerCollidingStart != null)
  775. handlerCollidingStart(localId, colliders);
  776. }
  777. public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
  778. {
  779. handlerColliding = OnScriptColliding;
  780. if (handlerColliding != null)
  781. handlerColliding(localId, colliders);
  782. }
  783. public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
  784. {
  785. handlerCollidingEnd = OnScriptCollidingEnd;
  786. if (handlerCollidingEnd != null)
  787. handlerCollidingEnd(localId, colliders);
  788. }
  789. public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
  790. {
  791. handlerSetRootAgentScene = OnSetRootAgentScene;
  792. if (handlerSetRootAgentScene != null)
  793. handlerSetRootAgentScene(agentID, scene);
  794. }
  795. }
  796. }