PageRenderTime 51ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Aurora/Framework/SceneInfo/EventManager.cs

https://bitbucket.org/VirtualReality/aurora-sim
C# | 1685 lines | 1482 code | 135 blank | 68 comment | 141 complexity | 15740f9d2fbfe256add0f80588c2899b MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using OpenMetaverse;
  6. using OpenMetaverse.StructuredData;
  7. using Aurora.Framework.Servers.HttpServer;
  8. using OpenSim.Services.Interfaces;
  9. using GridRegion = OpenSim.Services.Interfaces.GridRegion;
  10. namespace Aurora.Framework
  11. {/// <summary>
  12. /// A class for triggering remote scene events.
  13. /// </summary>
  14. public class EventManager
  15. {
  16. public delegate void OnFrameDelegate();
  17. public event OnFrameDelegate OnFrame;
  18. public delegate void OnNewClientDelegate(IClientAPI client);
  19. /// <summary>
  20. /// Deprecated in favour of OnClientConnect.
  21. /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces.
  22. /// </summary>
  23. public event OnNewClientDelegate OnNewClient;
  24. public event OnNewClientDelegate OnClosingClient;
  25. public delegate void OnClientLoginDelegate(IClientAPI client);
  26. public event OnClientLoginDelegate OnClientLogin;
  27. public delegate void OnNewPresenceDelegate(IScenePresence presence);
  28. public event OnNewPresenceDelegate OnNewPresence;
  29. public event OnNewPresenceDelegate OnRemovePresence;
  30. public delegate void OnPluginConsoleDelegate(string[] args);
  31. public event OnPluginConsoleDelegate OnPluginConsole;
  32. public delegate void OnPermissionErrorDelegate(UUID user, string reason);
  33. /// <summary>
  34. /// Fired when an object is touched/grabbed.
  35. /// </summary>
  36. /// The child is the part that was actually touched.
  37. public event ObjectGrabDelegate OnObjectGrab;
  38. public delegate void ObjectGrabDelegate(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  39. public event ObjectGrabDelegate OnObjectGrabbing;
  40. public event ObjectDeGrabDelegate OnObjectDeGrab;
  41. public delegate void ObjectDeGrabDelegate(ISceneChildEntity part, ISceneChildEntity child, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  42. public event OnPermissionErrorDelegate OnPermissionError;
  43. /// <summary>
  44. /// Fired when a new script is created.
  45. /// </summary>
  46. public event NewRezScripts OnRezScripts;
  47. public delegate void NewRezScripts(ISceneChildEntity part, TaskInventoryItem[] taskInventoryItem, int startParam, bool postOnRez, StateSource stateSource, UUID RezzedFrom, bool clearStateSaves);
  48. public delegate void RemoveScript(uint localID, UUID itemID);
  49. public event RemoveScript OnRemoveScript;
  50. public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
  51. public event SceneGroupMoved OnSceneGroupMove;
  52. public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
  53. public event SceneGroupGrabed OnSceneGroupGrab;
  54. public delegate bool SceneGroupSpinStarted(UUID groupID);
  55. public event SceneGroupSpinStarted OnSceneGroupSpinStart;
  56. public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
  57. public event SceneGroupSpun OnSceneGroupSpin;
  58. public delegate void LandObjectAdded(LandData newParcel);
  59. public event LandObjectAdded OnLandObjectAdded;
  60. public delegate void LandObjectRemoved(UUID RegionID, UUID globalID);
  61. public event LandObjectRemoved OnLandObjectRemoved;
  62. public delegate void AvatarEnteringNewParcel(IScenePresence avatar, ILandObject oldParcel);
  63. public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
  64. public delegate void SignificantClientMovement(IScenePresence sp);
  65. public event SignificantClientMovement OnSignificantClientMovement;
  66. public event SignificantClientMovement OnClientMovement;
  67. public delegate void SignificantObjectMovement(ISceneEntity group);
  68. public event SignificantObjectMovement OnSignificantObjectMovement;
  69. public delegate void IncomingInstantMessage(GridInstantMessage message);
  70. public event IncomingInstantMessage OnIncomingInstantMessage;
  71. public delegate string ChatSessionRequest(UUID agentID, OSDMap request);
  72. public event ChatSessionRequest OnChatSessionRequest;
  73. public event IncomingInstantMessage OnUnhandledInstantMessage;
  74. /// <summary>
  75. /// This is fired when a scene object property that a script might be interested in (such as color, scale or
  76. /// inventory) changes. Only enough information is sent for the LSL changed event
  77. /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed)
  78. /// </summary>
  79. public event ScriptChangedEvent OnScriptChangedEvent;
  80. public delegate void ScriptChangedEvent(ISceneChildEntity part, uint change);
  81. public event ScriptMovingStartEvent OnScriptMovingStartEvent;
  82. public delegate void ScriptMovingStartEvent(ISceneChildEntity part);
  83. public event ScriptMovingEndEvent OnScriptMovingEndEvent;
  84. public delegate void ScriptMovingEndEvent(ISceneChildEntity part);
  85. public delegate void ScriptControlEvent(ISceneChildEntity part, UUID item, UUID avatarID, uint held, uint changed);
  86. public event ScriptControlEvent OnScriptControlEvent;
  87. public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
  88. public event ScriptAtTargetEvent OnScriptAtTargetEvent;
  89. public delegate void ScriptNotAtTargetEvent(uint localID);
  90. public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
  91. public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
  92. public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
  93. public delegate void ScriptNotAtRotTargetEvent(uint localID);
  94. public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
  95. public delegate void ScriptColliding(ISceneChildEntity part, ColliderArgs colliders);
  96. public event ScriptColliding OnScriptColliderStart;
  97. public event ScriptColliding OnScriptColliding;
  98. public event ScriptColliding OnScriptCollidingEnd;
  99. public event ScriptColliding OnScriptLandColliderStart;
  100. public event ScriptColliding OnScriptLandColliding;
  101. public event ScriptColliding OnScriptLandColliderEnd;
  102. public delegate void OnMakeChildAgentDelegate(IScenePresence presence, GridRegion destination);
  103. public event OnMakeChildAgentDelegate OnMakeChildAgent;
  104. public event OnMakeChildAgentDelegate OnSetAgentLeaving;
  105. public delegate void OnMakeRootAgentDelegate(IScenePresence presence);
  106. public event OnMakeRootAgentDelegate OnMakeRootAgent;
  107. public event OnMakeRootAgentDelegate OnAgentFailedToLeave;
  108. public delegate void RequestChangeWaterHeight(float height);
  109. public event RequestChangeWaterHeight OnRequestChangeWaterHeight;
  110. public delegate void AddToStartupQueue(string name);
  111. public delegate void FinishedStartup(string name, List<string> data);
  112. public delegate void StartupComplete(IScene scene, List<string> data);
  113. public event FinishedStartup OnModuleFinishedStartup;
  114. public event AddToStartupQueue OnAddToStartupQueue;
  115. public event StartupComplete OnStartupComplete;
  116. //This is called after OnStartupComplete is done, it should ONLY be registered to the Scene
  117. public event StartupComplete OnStartupFullyComplete;
  118. public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
  119. public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
  120. public delegate void ObjectBeingRemovedFromScene(ISceneEntity obj);
  121. public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
  122. public event ObjectBeingRemovedFromScene OnObjectBeingAddedToScene;
  123. public delegate void IncomingLandDataFromStorage(List<LandData> data, Vector2 parcelOffset);
  124. public event IncomingLandDataFromStorage OnIncomingLandDataFromStorage;
  125. /// <summary>
  126. /// RegisterCapsEvent is called by Scene after the Caps object
  127. /// has been instantiated and before it is return to the
  128. /// client and provides region modules to add their caps.
  129. /// </summary>
  130. public delegate OSDMap RegisterCapsEvent(UUID agentID, IHttpServer httpServer);
  131. public event RegisterCapsEvent OnRegisterCaps;
  132. /// <summary>
  133. /// DeregisterCapsEvent is called by Scene when the caps
  134. /// handler for an agent are removed.
  135. /// </summary>
  136. public delegate void DeregisterCapsEvent(UUID agentID, IRegionClientCapsService caps);
  137. public event DeregisterCapsEvent OnDeregisterCaps;
  138. /// <summary>
  139. /// ChatFromWorldEvent is called via Scene when a chat message
  140. /// from world comes in.
  141. /// </summary>
  142. public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
  143. public event ChatFromWorldEvent OnChatFromWorld;
  144. /// <summary>
  145. /// ChatFromClientEvent is triggered via ChatModule (or
  146. /// substitutes thereof) when a chat message
  147. /// from the client comes in.
  148. /// </summary>
  149. public delegate void ChatFromClientEvent(IClientAPI sender, OSChatMessage chat);
  150. public event ChatFromClientEvent OnChatFromClient;
  151. /// <summary>
  152. /// ChatBroadcastEvent is called via Scene when a broadcast chat message
  153. /// from world comes in
  154. /// </summary>
  155. public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
  156. public event ChatBroadcastEvent OnChatBroadcast;
  157. /// <summary>
  158. /// Called when oar file has finished loading, although
  159. /// the scripts may not have started yet
  160. /// Message is non empty string if there were problems loading the oar file
  161. /// </summary>
  162. public delegate void OarFileLoaded(Guid guid, string message);
  163. public event OarFileLoaded OnOarFileLoaded;
  164. /// <summary>
  165. /// Called when an oar file has finished saving
  166. /// Message is non empty string if there were problems saving the oar file
  167. /// If a guid was supplied on the original call to identify, the request, this is returned. Otherwise
  168. /// Guid.Empty is returned.
  169. /// </summary>
  170. public delegate void OarFileSaved(Guid guid, string message);
  171. public event OarFileSaved OnOarFileSaved;
  172. /// <summary>
  173. /// Called when the script compile queue becomes empty
  174. /// Returns the number of scripts which failed to start
  175. /// </summary>
  176. public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message);
  177. public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
  178. /// <summary>
  179. /// Called whenever an object is attached, or detached from an in-world presence.
  180. /// </summary>
  181. /// If the object is being attached, then the avatarID will be present. If the object is being detached then
  182. /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
  183. public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
  184. public event Attach OnAttach;
  185. public delegate void RegionUp(GridRegion region);
  186. public event RegionUp OnRegionUp;
  187. public event RegionUp OnRegionDown;
  188. public class LandBuyArgs : EventArgs
  189. {
  190. public UUID agentId = UUID.Zero;
  191. public UUID groupId = UUID.Zero;
  192. public UUID parcelOwnerID = UUID.Zero;
  193. public bool final = false;
  194. public bool groupOwned = false;
  195. public bool removeContribution = false;
  196. public int parcelLocalID = 0;
  197. public int parcelArea = 0;
  198. public int parcelPrice = 0;
  199. public bool authenticated = false;
  200. public bool landValidated = false;
  201. public bool economyValidated = false;
  202. public int transactionID = 0;
  203. public int amountDebited = 0;
  204. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  205. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  206. bool pauthenticated, UUID pparcelOwnerID)
  207. {
  208. agentId = pagentId;
  209. groupId = pgroupId;
  210. final = pfinal;
  211. groupOwned = pgroupOwned;
  212. removeContribution = premoveContribution;
  213. parcelLocalID = pparcelLocalID;
  214. parcelArea = pparcelArea;
  215. parcelPrice = pparcelPrice;
  216. parcelOwnerID = pparcelOwnerID;
  217. authenticated = pauthenticated;
  218. }
  219. }
  220. public delegate bool LandBuy(LandBuyArgs e);
  221. public event LandBuy OnValidateBuyLand;
  222. public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
  223. {
  224. Attach handlerOnAttach = OnAttach;
  225. if (handlerOnAttach != null)
  226. {
  227. foreach (Attach d in handlerOnAttach.GetInvocationList())
  228. {
  229. try
  230. {
  231. d(localID, itemID, avatarID);
  232. }
  233. catch (Exception e)
  234. {
  235. MainConsole.Instance.ErrorFormat(
  236. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  237. e, e.StackTrace);
  238. }
  239. }
  240. }
  241. }
  242. public void TriggerOnScriptChangedEvent(ISceneChildEntity part, uint change)
  243. {
  244. ScriptChangedEvent handlerScriptChangedEvent = OnScriptChangedEvent;
  245. if (handlerScriptChangedEvent != null)
  246. {
  247. foreach (ScriptChangedEvent d in handlerScriptChangedEvent.GetInvocationList())
  248. {
  249. try
  250. {
  251. d(part, change);
  252. }
  253. catch (Exception e)
  254. {
  255. MainConsole.Instance.ErrorFormat(
  256. "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}",
  257. e, e.StackTrace);
  258. }
  259. }
  260. }
  261. }
  262. public void TriggerOnScriptMovingStartEvent(ISceneChildEntity part)
  263. {
  264. ScriptMovingStartEvent handlerScriptMovingStartEvent = OnScriptMovingStartEvent;
  265. if (handlerScriptMovingStartEvent != null)
  266. {
  267. foreach (ScriptMovingStartEvent d in handlerScriptMovingStartEvent.GetInvocationList())
  268. {
  269. try
  270. {
  271. d(part);
  272. }
  273. catch (Exception e)
  274. {
  275. MainConsole.Instance.ErrorFormat(
  276. "[EVENT MANAGER]: Delegate for TriggerOnScriptMovingStartEvent failed - continuing. {0} {1}",
  277. e, e.StackTrace);
  278. }
  279. }
  280. }
  281. }
  282. public void TriggerOnScriptMovingEndEvent(ISceneChildEntity part)
  283. {
  284. ScriptMovingEndEvent handlerScriptMovingEndEvent = OnScriptMovingEndEvent;
  285. if (handlerScriptMovingEndEvent != null)
  286. {
  287. foreach (ScriptMovingEndEvent d in handlerScriptMovingEndEvent.GetInvocationList())
  288. {
  289. try
  290. {
  291. d(part);
  292. }
  293. catch (Exception e)
  294. {
  295. MainConsole.Instance.ErrorFormat(
  296. "[EVENT MANAGER]: Delegate for TriggerOnScriptMovingEndEvent failed - continuing. {0} {1}",
  297. e, e.StackTrace);
  298. }
  299. }
  300. }
  301. }
  302. public void TriggerPermissionError(UUID user, string reason)
  303. {
  304. OnPermissionErrorDelegate handlerPermissionError = OnPermissionError;
  305. if (handlerPermissionError != null)
  306. {
  307. foreach (OnPermissionErrorDelegate d in handlerPermissionError.GetInvocationList())
  308. {
  309. try
  310. {
  311. d(user, reason);
  312. }
  313. catch (Exception e)
  314. {
  315. MainConsole.Instance.ErrorFormat(
  316. "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}",
  317. e, e.StackTrace);
  318. }
  319. }
  320. }
  321. }
  322. public void TriggerOnPluginConsole(string[] args)
  323. {
  324. OnPluginConsoleDelegate handlerPluginConsole = OnPluginConsole;
  325. if (handlerPluginConsole != null)
  326. {
  327. foreach (OnPluginConsoleDelegate d in handlerPluginConsole.GetInvocationList())
  328. {
  329. try
  330. {
  331. d(args);
  332. }
  333. catch (Exception e)
  334. {
  335. MainConsole.Instance.ErrorFormat(
  336. "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}",
  337. e, e.StackTrace);
  338. }
  339. }
  340. }
  341. }
  342. public void TriggerOnFrame()
  343. {
  344. OnFrameDelegate handlerFrame = OnFrame;
  345. if (handlerFrame != null)
  346. {
  347. foreach (OnFrameDelegate d in handlerFrame.GetInvocationList())
  348. {
  349. try
  350. {
  351. d();
  352. }
  353. catch (Exception e)
  354. {
  355. MainConsole.Instance.ErrorFormat(
  356. "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}",
  357. e, e.StackTrace);
  358. }
  359. }
  360. }
  361. }
  362. public void TriggerOnClosingClient(IClientAPI client)
  363. {
  364. OnNewClientDelegate handlerClosingClient = OnClosingClient;
  365. if (handlerClosingClient != null)
  366. {
  367. foreach (OnNewClientDelegate d in handlerClosingClient.GetInvocationList())
  368. {
  369. try
  370. {
  371. d(client);
  372. }
  373. catch (Exception e)
  374. {
  375. MainConsole.Instance.ErrorFormat(
  376. "[EVENT MANAGER]: Delegate for TriggerOnClosingClient failed - continuing. {0} {1}",
  377. e, e.StackTrace);
  378. }
  379. }
  380. }
  381. }
  382. public void TriggerOnNewClient(IClientAPI client)
  383. {
  384. OnNewClientDelegate handlerNewClient = OnNewClient;
  385. if (handlerNewClient != null)
  386. {
  387. foreach (OnNewClientDelegate d in handlerNewClient.GetInvocationList())
  388. {
  389. try
  390. {
  391. d(client);
  392. }
  393. catch (Exception e)
  394. {
  395. MainConsole.Instance.ErrorFormat(
  396. "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}",
  397. e, e.StackTrace);
  398. }
  399. }
  400. }
  401. }
  402. public void TriggerOnClientLogin(IClientAPI client)
  403. {
  404. OnClientLoginDelegate handlerClientLogin = OnClientLogin;
  405. if (handlerClientLogin != null)
  406. {
  407. foreach (OnClientLoginDelegate d in handlerClientLogin.GetInvocationList())
  408. {
  409. try
  410. {
  411. d(client);
  412. }
  413. catch (Exception e)
  414. {
  415. MainConsole.Instance.ErrorFormat(
  416. "[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing. {0} {1}",
  417. e, e.StackTrace);
  418. }
  419. }
  420. }
  421. }
  422. public void TriggerOnNewPresence(IScenePresence presence)
  423. {
  424. OnNewPresenceDelegate handlerNewPresence = OnNewPresence;
  425. if (handlerNewPresence != null)
  426. {
  427. foreach (OnNewPresenceDelegate d in handlerNewPresence.GetInvocationList())
  428. {
  429. try
  430. {
  431. d(presence);
  432. }
  433. catch (Exception e)
  434. {
  435. MainConsole.Instance.ErrorFormat(
  436. "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}",
  437. e, e.StackTrace);
  438. }
  439. }
  440. }
  441. }
  442. public void TriggerOnRemovePresence(IScenePresence presence)
  443. {
  444. OnNewPresenceDelegate handlerRemovePresence = OnRemovePresence;
  445. if (handlerRemovePresence != null)
  446. {
  447. foreach (OnNewPresenceDelegate d in handlerRemovePresence.GetInvocationList())
  448. {
  449. try
  450. {
  451. d(presence);
  452. }
  453. catch (Exception e)
  454. {
  455. MainConsole.Instance.ErrorFormat(
  456. "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}",
  457. e, e.StackTrace);
  458. }
  459. }
  460. }
  461. }
  462. public void TriggerObjectBeingAddedToScene(ISceneEntity obj)
  463. {
  464. ObjectBeingRemovedFromScene handlerObjectBeingAddedToScene = OnObjectBeingAddedToScene;
  465. if (handlerObjectBeingAddedToScene != null)
  466. {
  467. foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingAddedToScene.GetInvocationList())
  468. {
  469. try
  470. {
  471. d(obj);
  472. }
  473. catch (Exception e)
  474. {
  475. MainConsole.Instance.ErrorFormat(
  476. "[EVENT MANAGER]: Delegate for TriggerObjectBeingAddToScene failed - continuing. {0} {1}",
  477. e, e.StackTrace);
  478. }
  479. }
  480. }
  481. }
  482. public void TriggerObjectBeingRemovedFromScene(ISceneEntity obj)
  483. {
  484. ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  485. if (handlerObjectBeingRemovedFromScene != null)
  486. {
  487. foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingRemovedFromScene.GetInvocationList())
  488. {
  489. try
  490. {
  491. d(obj);
  492. }
  493. catch (Exception e)
  494. {
  495. MainConsole.Instance.ErrorFormat(
  496. "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}",
  497. e, e.StackTrace);
  498. }
  499. }
  500. }
  501. }
  502. public void TriggerObjectGrab(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  503. {
  504. ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
  505. if (handlerObjectGrab != null)
  506. {
  507. foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList())
  508. {
  509. try
  510. {
  511. d(part, child, offsetPos, remoteClient, surfaceArgs);
  512. }
  513. catch (Exception e)
  514. {
  515. MainConsole.Instance.ErrorFormat(
  516. "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}",
  517. e, e.StackTrace);
  518. }
  519. }
  520. }
  521. }
  522. public void TriggerObjectGrabbing(ISceneChildEntity part, ISceneChildEntity child, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  523. {
  524. ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
  525. if (handlerObjectGrabbing != null)
  526. {
  527. foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList())
  528. {
  529. try
  530. {
  531. d(part, child, offsetPos, remoteClient, surfaceArgs);
  532. }
  533. catch (Exception e)
  534. {
  535. MainConsole.Instance.ErrorFormat(
  536. "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}",
  537. e, e.StackTrace);
  538. }
  539. }
  540. }
  541. }
  542. public void TriggerObjectDeGrab(ISceneChildEntity part, ISceneChildEntity child, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  543. {
  544. ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
  545. if (handlerObjectDeGrab != null)
  546. {
  547. foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList())
  548. {
  549. try
  550. {
  551. d(part, child, remoteClient, surfaceArgs);
  552. }
  553. catch (Exception e)
  554. {
  555. MainConsole.Instance.ErrorFormat(
  556. "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}",
  557. e, e.StackTrace);
  558. }
  559. }
  560. }
  561. }
  562. public void TriggerRezScripts(ISceneChildEntity part, TaskInventoryItem[] taskInventoryItem, int startParam, bool postOnRez, StateSource stateSource, UUID RezzedFrom, bool clearStateSaves)
  563. {
  564. NewRezScripts handlerRezScripts = OnRezScripts;
  565. if (handlerRezScripts != null)
  566. {
  567. foreach (NewRezScripts d in handlerRezScripts.GetInvocationList())
  568. {
  569. try
  570. {
  571. d(part, taskInventoryItem, startParam, postOnRez, stateSource, RezzedFrom, clearStateSaves);
  572. }
  573. catch (Exception e)
  574. {
  575. MainConsole.Instance.ErrorFormat(
  576. "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}",
  577. e, e.StackTrace);
  578. }
  579. }
  580. }
  581. }
  582. public void TriggerRemoveScript(uint localID, UUID itemID)
  583. {
  584. RemoveScript handlerRemoveScript = OnRemoveScript;
  585. if (handlerRemoveScript != null)
  586. {
  587. foreach (RemoveScript d in handlerRemoveScript.GetInvocationList())
  588. {
  589. try
  590. {
  591. d(localID, itemID);
  592. }
  593. catch (Exception e)
  594. {
  595. MainConsole.Instance.ErrorFormat(
  596. "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}",
  597. e, e.StackTrace);
  598. }
  599. }
  600. }
  601. }
  602. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  603. {
  604. bool result = true;
  605. SceneGroupMoved handlerSceneGroupMove = OnSceneGroupMove;
  606. if (handlerSceneGroupMove != null)
  607. {
  608. foreach (SceneGroupMoved d in handlerSceneGroupMove.GetInvocationList())
  609. {
  610. try
  611. {
  612. if (d(groupID, delta) == false)
  613. result = false;
  614. }
  615. catch (Exception e)
  616. {
  617. MainConsole.Instance.ErrorFormat(
  618. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  619. e, e.StackTrace);
  620. }
  621. }
  622. }
  623. return result;
  624. }
  625. public bool TriggerGroupSpinStart(UUID groupID)
  626. {
  627. bool result = true;
  628. SceneGroupSpinStarted handlerSceneGroupSpinStarted = OnSceneGroupSpinStart;
  629. if (handlerSceneGroupSpinStarted != null)
  630. {
  631. foreach (SceneGroupSpinStarted d in handlerSceneGroupSpinStarted.GetInvocationList())
  632. {
  633. try
  634. {
  635. if (d(groupID) == false)
  636. result = false;
  637. }
  638. catch (Exception e)
  639. {
  640. MainConsole.Instance.ErrorFormat(
  641. "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}",
  642. e, e.StackTrace);
  643. }
  644. }
  645. }
  646. return result;
  647. }
  648. public bool TriggerGroupSpin(UUID groupID, Quaternion rotation)
  649. {
  650. bool result = true;
  651. SceneGroupSpun handlerSceneGroupSpin = OnSceneGroupSpin;
  652. if (handlerSceneGroupSpin != null)
  653. {
  654. foreach (SceneGroupSpun d in handlerSceneGroupSpin.GetInvocationList())
  655. {
  656. try
  657. {
  658. if (d(groupID, rotation) == false)
  659. result = false;
  660. }
  661. catch (Exception e)
  662. {
  663. MainConsole.Instance.ErrorFormat(
  664. "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}",
  665. e, e.StackTrace);
  666. }
  667. }
  668. }
  669. return result;
  670. }
  671. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  672. {
  673. SceneGroupGrabed handlerSceneGroupGrab = OnSceneGroupGrab;
  674. if (handlerSceneGroupGrab != null)
  675. {
  676. foreach (SceneGroupGrabed d in handlerSceneGroupGrab.GetInvocationList())
  677. {
  678. try
  679. {
  680. d(groupID, offset, userID);
  681. }
  682. catch (Exception e)
  683. {
  684. MainConsole.Instance.ErrorFormat(
  685. "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}",
  686. e, e.StackTrace);
  687. }
  688. }
  689. }
  690. }
  691. public void TriggerLandObjectAdded(LandData newParcel)
  692. {
  693. LandObjectAdded handlerLandObjectAdded = OnLandObjectAdded;
  694. if (handlerLandObjectAdded != null)
  695. {
  696. foreach (LandObjectAdded d in handlerLandObjectAdded.GetInvocationList())
  697. {
  698. try
  699. {
  700. d(newParcel);
  701. }
  702. catch (Exception e)
  703. {
  704. MainConsole.Instance.ErrorFormat(
  705. "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}",
  706. e, e.StackTrace);
  707. }
  708. }
  709. }
  710. }
  711. public void TriggerLandObjectRemoved(UUID regionID, UUID globalID)
  712. {
  713. LandObjectRemoved handlerLandObjectRemoved = OnLandObjectRemoved;
  714. if (handlerLandObjectRemoved != null)
  715. {
  716. foreach (LandObjectRemoved d in handlerLandObjectRemoved.GetInvocationList())
  717. {
  718. try
  719. {
  720. d(regionID, globalID);
  721. }
  722. catch (Exception e)
  723. {
  724. MainConsole.Instance.ErrorFormat(
  725. "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}",
  726. e, e.StackTrace);
  727. }
  728. }
  729. }
  730. }
  731. public void TriggerAvatarEnteringNewParcel(IScenePresence avatar, ILandObject oldParcel)
  732. {
  733. AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  734. if (handlerAvatarEnteringNewParcel != null)
  735. {
  736. foreach (AvatarEnteringNewParcel d in handlerAvatarEnteringNewParcel.GetInvocationList())
  737. {
  738. try
  739. {
  740. d(avatar, oldParcel);
  741. }
  742. catch (Exception e)
  743. {
  744. MainConsole.Instance.ErrorFormat(
  745. "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}",
  746. e, e.StackTrace);
  747. }
  748. }
  749. }
  750. }
  751. public string TriggerChatSessionRequest(UUID AgentID, OSDMap request)
  752. {
  753. ChatSessionRequest handlerChatSessionRequest = OnChatSessionRequest;
  754. if (handlerChatSessionRequest != null)
  755. {
  756. foreach (ChatSessionRequest d in handlerChatSessionRequest.GetInvocationList())
  757. {
  758. try
  759. {
  760. string resp = d(AgentID, request);
  761. if (resp != "")
  762. return resp;
  763. }
  764. catch (Exception e)
  765. {
  766. MainConsole.Instance.ErrorFormat(
  767. "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}",
  768. e, e.StackTrace);
  769. }
  770. }
  771. }
  772. return "";
  773. }
  774. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  775. {
  776. IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
  777. if (handlerIncomingInstantMessage != null)
  778. {
  779. foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList())
  780. {
  781. try
  782. {
  783. d(message);
  784. }
  785. catch (Exception e)
  786. {
  787. MainConsole.Instance.ErrorFormat(
  788. "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}",
  789. e, e.StackTrace);
  790. }
  791. }
  792. }
  793. }
  794. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  795. {
  796. IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  797. if (handlerUnhandledInstantMessage != null)
  798. {
  799. foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList())
  800. {
  801. try
  802. {
  803. d(message);
  804. }
  805. catch (Exception e)
  806. {
  807. MainConsole.Instance.ErrorFormat(
  808. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  809. e, e.StackTrace);
  810. }
  811. }
  812. }
  813. }
  814. public void TriggerOnMakeChildAgent(IScenePresence presence, GridRegion destination)
  815. {
  816. OnMakeChildAgentDelegate handlerMakeChildAgent = OnMakeChildAgent;
  817. if (handlerMakeChildAgent != null)
  818. {
  819. foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList())
  820. {
  821. try
  822. {
  823. d(presence, destination);
  824. }
  825. catch (Exception e)
  826. {
  827. MainConsole.Instance.ErrorFormat(
  828. "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}",
  829. e, e.StackTrace);
  830. }
  831. }
  832. }
  833. }
  834. public void TriggerOnAgentFailedToLeave(IScenePresence presence)
  835. {
  836. OnMakeRootAgentDelegate handlerMakeChildAgent = OnAgentFailedToLeave;
  837. if (handlerMakeChildAgent != null)
  838. {
  839. foreach (OnMakeRootAgentDelegate d in handlerMakeChildAgent.GetInvocationList())
  840. {
  841. try
  842. {
  843. d(presence);
  844. }
  845. catch (Exception e)
  846. {
  847. MainConsole.Instance.ErrorFormat(
  848. "[EVENT MANAGER]: Delegate for TriggerOnAgentFailedToLeave failed - continuing. {0} {1}",
  849. e, e.StackTrace);
  850. }
  851. }
  852. }
  853. }
  854. public void TriggerOnSetAgentLeaving(IScenePresence presence, GridRegion destination)
  855. {
  856. OnMakeChildAgentDelegate handlerMakeChildAgent = OnSetAgentLeaving;
  857. if (handlerMakeChildAgent != null)
  858. {
  859. foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList())
  860. {
  861. try
  862. {
  863. d(presence, destination);
  864. }
  865. catch (Exception e)
  866. {
  867. MainConsole.Instance.ErrorFormat(
  868. "[EVENT MANAGER]: Delegate for TriggerOnSetAgentLeaving failed - continuing. {0} {1}",
  869. e, e.StackTrace);
  870. }
  871. }
  872. }
  873. }
  874. public void TriggerOnMakeRootAgent(IScenePresence presence)
  875. {
  876. OnMakeRootAgentDelegate handlerMakeRootAgent = OnMakeRootAgent;
  877. if (handlerMakeRootAgent != null)
  878. {
  879. foreach (OnMakeRootAgentDelegate d in handlerMakeRootAgent.GetInvocationList())
  880. {
  881. try
  882. {
  883. d(presence);
  884. }
  885. catch (Exception e)
  886. {
  887. MainConsole.Instance.ErrorFormat(
  888. "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}",
  889. e, e.StackTrace);
  890. }
  891. }
  892. }
  893. }
  894. public OSDMap TriggerOnRegisterCaps(UUID agentID)
  895. {
  896. OSDMap retVal = new OSDMap();
  897. RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
  898. if (handlerRegisterCaps != null)
  899. {
  900. foreach (RegisterCapsEvent d in handlerRegisterCaps.GetInvocationList())
  901. {
  902. try
  903. {
  904. OSDMap r = d(agentID, MainServer.Instance);
  905. if (r != null)
  906. {
  907. foreach (KeyValuePair<string, OSD> kvp in r)
  908. {
  909. retVal[kvp.Key] = MainServer.Instance.ServerURI + kvp.Value;
  910. }
  911. }
  912. }
  913. catch (Exception e)
  914. {
  915. MainConsole.Instance.ErrorFormat(
  916. "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}",
  917. e, e.StackTrace);
  918. }
  919. }
  920. }
  921. return retVal;
  922. }
  923. public void TriggerOnDeregisterCaps(UUID agentID, IRegionClientCapsService caps)
  924. {
  925. DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps;
  926. if (handlerDeregisterCaps != null)
  927. {
  928. foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList())
  929. {
  930. try
  931. {
  932. d(agentID, caps);
  933. }
  934. catch (Exception e)
  935. {
  936. MainConsole.Instance.ErrorFormat(
  937. "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}",
  938. e, e.StackTrace);
  939. }
  940. }
  941. }
  942. }
  943. public bool TriggerValidateBuyLand(LandBuyArgs args)
  944. {
  945. LandBuy handlerLandBuy = OnValidateBuyLand;
  946. if (handlerLandBuy != null)
  947. {
  948. foreach (LandBuy d in handlerLandBuy.GetInvocationList())
  949. {
  950. try
  951. {
  952. if (!d(args))
  953. return false;
  954. }
  955. catch (Exception e)
  956. {
  957. MainConsole.Instance.ErrorFormat(
  958. "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}",
  959. e, e.StackTrace);
  960. }
  961. }
  962. }
  963. return true;
  964. }
  965. public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
  966. {
  967. ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  968. if (handlerScriptAtTargetEvent != null)
  969. {
  970. foreach (ScriptAtTargetEvent d in handlerScriptAtTargetEvent.GetInvocationList())
  971. {
  972. try
  973. {
  974. d(localID, handle, targetpos, currentpos);
  975. }
  976. catch (Exception e)
  977. {
  978. MainConsole.Instance.ErrorFormat(
  979. "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}",
  980. e, e.StackTrace);
  981. }
  982. }
  983. }
  984. }
  985. public void TriggerNotAtTargetEvent(uint localID)
  986. {
  987. ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  988. if (handlerScriptNotAtTargetEvent != null)
  989. {
  990. foreach (ScriptNotAtTargetEvent d in handlerScriptNotAtTargetEvent.GetInvocationList())
  991. {
  992. try
  993. {
  994. d(localID);
  995. }
  996. catch (Exception e)
  997. {
  998. MainConsole.Instance.ErrorFormat(
  999. "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}",
  1000. e, e.StackTrace);
  1001. }
  1002. }
  1003. }
  1004. }
  1005. public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
  1006. {
  1007. ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
  1008. if (handlerScriptAtRotTargetEvent != null)
  1009. {
  1010. foreach (ScriptAtRotTargetEvent d in handlerScriptAtRotTargetEvent.GetInvocationList())
  1011. {
  1012. try
  1013. {
  1014. d(localID, handle, targetrot, currentrot);
  1015. }
  1016. catch (Exception e)
  1017. {
  1018. MainConsole.Instance.ErrorFormat(
  1019. "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}",
  1020. e, e.StackTrace);
  1021. }
  1022. }
  1023. }
  1024. }
  1025. public void TriggerNotAtRotTargetEvent(uint localID)
  1026. {
  1027. ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent;
  1028. if (handlerScriptNotAtRotTargetEvent != null)
  1029. {
  1030. foreach (ScriptNotAtRotTargetEvent d in handlerScriptNotAtRotTargetEvent.GetInvocationList())
  1031. {
  1032. try
  1033. {
  1034. d(localID);
  1035. }
  1036. catch (Exception e)
  1037. {
  1038. MainConsole.Instance.ErrorFormat(
  1039. "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}",
  1040. e, e.StackTrace);
  1041. }
  1042. }
  1043. }
  1044. }
  1045. public void TriggerRequestChangeWaterHeight(float height)
  1046. {
  1047. RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  1048. if (handlerRequestChangeWaterHeight != null)
  1049. {
  1050. foreach (RequestChangeWaterHeight d in handlerRequestChangeWaterHeight.GetInvocationList())
  1051. {
  1052. try
  1053. {
  1054. d(height);
  1055. }
  1056. catch (Exception e)
  1057. {
  1058. MainConsole.Instance.ErrorFormat(
  1059. "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}",
  1060. e, e.StackTrace);
  1061. }
  1062. }
  1063. }
  1064. }
  1065. public void TriggerSignificantClientMovement(IScenePresence presence)
  1066. {
  1067. SignificantClientMovement handlerSignificantClientMovement = OnSignificantClientMovement;
  1068. if (handlerSignificantClientMovement != null)
  1069. {
  1070. foreach (SignificantClientMovement d in handlerSignificantClientMovement.GetInvocationList())
  1071. {
  1072. try
  1073. {
  1074. d(presence);
  1075. }
  1076. catch (Exception e)
  1077. {
  1078. MainConsole.Instance.ErrorFormat(
  1079. "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}",
  1080. e, e.StackTrace);
  1081. }
  1082. }
  1083. }
  1084. }
  1085. public void TriggerClientMovement(IScenePresence presence)
  1086. {
  1087. SignificantClientMovement handlerClientMovement = OnClientMovement;
  1088. if (handlerClientMovement != null)
  1089. {
  1090. foreach (SignificantClientMovement d in handlerClientMovement.GetInvocationList())
  1091. {
  1092. try
  1093. {
  1094. d(presence);
  1095. }
  1096. catch (Exception e)
  1097. {
  1098. MainConsole.Instance.ErrorFormat(
  1099. "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}",
  1100. e, e.StackTrace);
  1101. }
  1102. }
  1103. }
  1104. }
  1105. public void TriggerSignificantObjectMovement(ISceneEntity group)
  1106. {

Large files files are truncated, but you can click here to view the full file