EventManager.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  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 OpenMetaverse;
  29. using OpenSim.Framework;
  30. using OpenSim.Framework.Client;
  31. using OpenSim.Region.Environment.Interfaces;
  32. using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
  33. using System.Collections.Generic;
  34. namespace OpenSim.Region.Environment.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);
  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. public class MoneyTransferArgs : EventArgs
  179. {
  180. public UUID sender;
  181. public UUID receiver;
  182. // Always false. The SL protocol sucks.
  183. public bool authenticated = false;
  184. public int amount;
  185. public int transactiontype;
  186. public string description;
  187. public MoneyTransferArgs(UUID asender, UUID areceiver, int aamount, int atransactiontype, string adescription)
  188. {
  189. sender = asender;
  190. receiver = areceiver;
  191. amount = aamount;
  192. transactiontype = atransactiontype;
  193. description = adescription;
  194. }
  195. }
  196. public class LandBuyArgs : EventArgs
  197. {
  198. public UUID agentId = UUID.Zero;
  199. public UUID groupId = UUID.Zero;
  200. public UUID parcelOwnerID = UUID.Zero;
  201. public bool final = false;
  202. public bool groupOwned = false;
  203. public bool removeContribution = false;
  204. public int parcelLocalID = 0;
  205. public int parcelArea = 0;
  206. public int parcelPrice = 0;
  207. public bool authenticated = false;
  208. public bool landValidated = false;
  209. public bool economyValidated = false;
  210. public int transactionID = 0;
  211. public int amountDebited = 0;
  212. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  213. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  214. bool pauthenticated)
  215. {
  216. agentId = pagentId;
  217. groupId = pgroupId;
  218. final = pfinal;
  219. groupOwned = pgroupOwned;
  220. removeContribution = premoveContribution;
  221. parcelLocalID = pparcelLocalID;
  222. parcelArea = pparcelArea;
  223. parcelPrice = pparcelPrice;
  224. authenticated = pauthenticated;
  225. }
  226. }
  227. public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
  228. public delegate void LandBuy(Object sender, LandBuyArgs e);
  229. public event MoneyTransferEvent OnMoneyTransfer;
  230. public event LandBuy OnLandBuy;
  231. public event LandBuy OnValidateLandBuy;
  232. /* Designated Event Deletage Instances */
  233. private ScriptChangedEvent handlerScriptChangedEvent = null; //OnScriptChangedEvent;
  234. private ScriptAtTargetEvent handlerScriptAtTargetEvent = null;
  235. private ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = null;
  236. private ClientMovement handlerClientMovement = null; //OnClientMovement;
  237. private OnPermissionErrorDelegate handlerPermissionError = null; //OnPermissionError;
  238. private OnPluginConsoleDelegate handlerPluginConsole = null; //OnPluginConsole;
  239. private OnFrameDelegate handlerFrame = null; //OnFrame;
  240. private OnNewClientDelegate handlerNewClient = null; //OnNewClient;
  241. private OnClientConnectCoreDelegate handlerClientConnect = null; //OnClientConnect
  242. private OnNewPresenceDelegate handlerNewPresence = null; //OnNewPresence;
  243. private OnRemovePresenceDelegate handlerRemovePresence = null; //OnRemovePresence;
  244. private OnBackupDelegate handlerBackup = null; //OnBackup;
  245. private OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = null; //OnParcelPrimCountUpdate;
  246. private MoneyTransferEvent handlerMoneyTransfer = null; //OnMoneyTransfer;
  247. private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
  248. private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
  249. private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
  250. private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
  251. private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset
  252. private NewRezScript handlerRezScript = null; //OnRezScript;
  253. private RemoveScript handlerRemoveScript = null; //OnRemoveScript;
  254. private StartScript handlerStartScript = null; //OnStartScript;
  255. private StopScript handlerStopScript = null; //OnStopScript;
  256. private SceneGroupMoved handlerSceneGroupMove = null; //OnSceneGroupMove;
  257. private SceneGroupGrabed handlerSceneGroupGrab = null; //OnSceneGroupGrab;
  258. private LandObjectAdded handlerLandObjectAdded = null; //OnLandObjectAdded;
  259. private LandObjectRemoved handlerLandObjectRemoved = null; //OnLandObjectRemoved;
  260. private AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = null; //OnAvatarEnteringNewParcel;
  261. private IncomingInstantMessage handlerIncomingInstantMessage = null; //OnIncomingInstantMessage;
  262. private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage;
  263. private ClientClosed handlerClientClosed = null; //OnClientClosed;
  264. private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
  265. private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
  266. private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
  267. private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
  268. private DeregisterCapsEvent handlerDeregisterCaps = null; // OnDeregisterCaps;
  269. private ChatFromWorldEvent handlerChatFromWorld = null; // OnChatFromWorld;
  270. private ChatFromClientEvent handlerChatFromClient = null; // OnChatFromClient;
  271. private ChatBroadcastEvent handlerChatBroadcast = null; // OnChatBroadcast;
  272. private NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = null;
  273. private RequestChangeWaterHeight handlerRequestChangeWaterHeight = null; //OnRequestChangeWaterHeight
  274. private ScriptControlEvent handlerScriptControlEvent = null;
  275. private SignificantClientMovement handlerSignificantClientMovement = null;
  276. private LandBuy handlerLandBuy = null;
  277. private LandBuy handlerValidateLandBuy = null;
  278. private AvatarKillData handlerAvatarKill = null;
  279. private NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = null;
  280. private IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = null;
  281. private SetAllowForcefulBan handlerSetAllowForcefulBan = null;
  282. private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
  283. private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
  284. private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
  285. private ScriptTimerEvent handlerScriptTimerEvent = null;
  286. private EstateToolsTimeUpdate handlerEstateToolsTimeUpdate = null;
  287. private ScriptColliding handlerCollidingStart = null;
  288. private ScriptColliding handlerColliding = null;
  289. private ScriptColliding handlerCollidingEnd = null;
  290. private GetScriptRunning handlerGetScriptRunning = null;
  291. private SunLindenHour handlerSunGetLindenHour = null;
  292. private OnSetRootAgentSceneDelegate handlerSetRootAgentScene = null;
  293. public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
  294. {
  295. handlerGetScriptRunning = OnGetScriptRunning;
  296. if (handlerGetScriptRunning != null)
  297. handlerGetScriptRunning(controllingClient, objectID, itemID);
  298. }
  299. public void TriggerOnScriptChangedEvent(uint localID, uint change)
  300. {
  301. handlerScriptChangedEvent = OnScriptChangedEvent;
  302. if (handlerScriptChangedEvent != null)
  303. handlerScriptChangedEvent(localID, change);
  304. }
  305. public void TriggerOnClientMovement(ScenePresence avatar)
  306. {
  307. handlerClientMovement = OnClientMovement;
  308. if (handlerClientMovement != null)
  309. handlerClientMovement(avatar);
  310. }
  311. public void TriggerPermissionError(UUID user, string reason)
  312. {
  313. handlerPermissionError = OnPermissionError;
  314. if (handlerPermissionError != null)
  315. handlerPermissionError(user, reason);
  316. }
  317. public void TriggerOnPluginConsole(string[] args)
  318. {
  319. handlerPluginConsole = OnPluginConsole;
  320. if (handlerPluginConsole != null)
  321. handlerPluginConsole(args);
  322. }
  323. public void TriggerOnFrame()
  324. {
  325. handlerFrame = OnFrame;
  326. if (handlerFrame != null)
  327. {
  328. handlerFrame();
  329. }
  330. }
  331. public void TriggerOnNewClient(IClientAPI client)
  332. {
  333. handlerNewClient = OnNewClient;
  334. if (handlerNewClient != null)
  335. handlerNewClient(client);
  336. if (client is IClientCore)
  337. {
  338. handlerClientConnect = OnClientConnect;
  339. handlerClientConnect((IClientCore) client);
  340. }
  341. }
  342. public void TriggerOnNewPresence(ScenePresence presence)
  343. {
  344. handlerNewPresence = OnNewPresence;
  345. if (handlerNewPresence != null)
  346. handlerNewPresence(presence);
  347. }
  348. public void TriggerOnRemovePresence(UUID agentId)
  349. {
  350. handlerRemovePresence = OnRemovePresence;
  351. if (handlerRemovePresence != null)
  352. {
  353. handlerRemovePresence(agentId);
  354. }
  355. }
  356. public void TriggerOnBackup(IRegionDataStore dstore)
  357. {
  358. handlerBackup = OnBackup;
  359. if (handlerBackup != null)
  360. {
  361. handlerBackup(dstore);
  362. }
  363. }
  364. public void TriggerParcelPrimCountUpdate()
  365. {
  366. handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate;
  367. if (handlerParcelPrimCountUpdate != null)
  368. {
  369. handlerParcelPrimCountUpdate();
  370. }
  371. }
  372. public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs e)
  373. {
  374. handlerMoneyTransfer = OnMoneyTransfer;
  375. if (handlerMoneyTransfer != null)
  376. {
  377. handlerMoneyTransfer(sender, e);
  378. }
  379. }
  380. public void TriggerTerrainTick()
  381. {
  382. handlerTerrainTick = OnTerrainTick;
  383. if (handlerTerrainTick != null)
  384. {
  385. handlerTerrainTick();
  386. }
  387. }
  388. public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
  389. {
  390. handlerParcelPrimCountAdd = OnParcelPrimCountAdd;
  391. if (handlerParcelPrimCountAdd != null)
  392. {
  393. handlerParcelPrimCountAdd(obj);
  394. }
  395. }
  396. public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
  397. {
  398. handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  399. if (handlerObjectBeingRemovedFromScene != null)
  400. {
  401. handlerObjectBeingRemovedFromScene(obj);
  402. }
  403. }
  404. public void TriggerShutdown()
  405. {
  406. handlerShutdown = OnShutdown;
  407. if (handlerShutdown != null)
  408. handlerShutdown();
  409. }
  410. public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  411. {
  412. handlerObjectGrab = OnObjectGrab;
  413. if (handlerObjectGrab != null)
  414. {
  415. handlerObjectGrab(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  416. }
  417. }
  418. public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient)
  419. {
  420. handlerObjectDeGrab = OnObjectDeGrab;
  421. if (handlerObjectDeGrab != null)
  422. {
  423. handlerObjectDeGrab(localID, originalID, remoteClient);
  424. }
  425. }
  426. public void TriggerScriptReset(uint localID, UUID itemID)
  427. {
  428. handlerScriptReset = OnScriptReset;
  429. if (handlerScriptReset != null)
  430. {
  431. handlerScriptReset(localID, itemID);
  432. }
  433. }
  434. public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
  435. {
  436. handlerRezScript = OnRezScript;
  437. if (handlerRezScript != null)
  438. {
  439. handlerRezScript(localID, itemID, script, startParam,
  440. postOnRez, engine, stateSource);
  441. }
  442. }
  443. public void TriggerStartScript(uint localID, UUID itemID)
  444. {
  445. handlerStartScript = OnStartScript;
  446. if (handlerStartScript != null)
  447. {
  448. handlerStartScript(localID, itemID);
  449. }
  450. }
  451. public void TriggerStopScript(uint localID, UUID itemID)
  452. {
  453. handlerStopScript = OnStopScript;
  454. if (handlerStopScript != null)
  455. {
  456. handlerStopScript(localID, itemID);
  457. }
  458. }
  459. public void TriggerRemoveScript(uint localID, UUID itemID)
  460. {
  461. handlerRemoveScript = OnRemoveScript;
  462. if (handlerRemoveScript != null)
  463. {
  464. handlerRemoveScript(localID, itemID);
  465. }
  466. }
  467. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  468. {
  469. handlerSceneGroupMove = OnSceneGroupMove;
  470. if (handlerSceneGroupMove != null)
  471. {
  472. return handlerSceneGroupMove(groupID, delta);
  473. }
  474. return true;
  475. }
  476. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  477. {
  478. handlerSceneGroupGrab = OnSceneGroupGrab;
  479. if (handlerSceneGroupGrab != null)
  480. {
  481. handlerSceneGroupGrab(groupID, offset, userID);
  482. }
  483. }
  484. public void TriggerLandObjectAdded(ILandObject newParcel)
  485. {
  486. handlerLandObjectAdded = OnLandObjectAdded;
  487. if (handlerLandObjectAdded != null)
  488. {
  489. handlerLandObjectAdded(newParcel);
  490. }
  491. }
  492. public void TriggerLandObjectRemoved(UUID globalID)
  493. {
  494. handlerLandObjectRemoved = OnLandObjectRemoved;
  495. if (handlerLandObjectRemoved != null)
  496. {
  497. handlerLandObjectRemoved(globalID);
  498. }
  499. }
  500. public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
  501. {
  502. //triggerLandObjectRemoved(localParcelID);
  503. TriggerLandObjectAdded(newParcel);
  504. }
  505. public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
  506. {
  507. handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  508. if (handlerAvatarEnteringNewParcel != null)
  509. {
  510. handlerAvatarEnteringNewParcel(avatar, localLandID, regionID);
  511. }
  512. }
  513. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  514. {
  515. handlerIncomingInstantMessage = OnIncomingInstantMessage;
  516. if (handlerIncomingInstantMessage != null)
  517. {
  518. handlerIncomingInstantMessage(message);
  519. }
  520. }
  521. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  522. {
  523. handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  524. if (handlerUnhandledInstantMessage != null)
  525. {
  526. handlerUnhandledInstantMessage(message);
  527. }
  528. }
  529. public void TriggerClientClosed(UUID ClientID)
  530. {
  531. handlerClientClosed = OnClientClosed;
  532. if (handlerClientClosed != null)
  533. {
  534. handlerClientClosed(ClientID);
  535. }
  536. }
  537. public void TriggerOnMakeChildAgent(ScenePresence presence)
  538. {
  539. handlerMakeChildAgent = OnMakeChildAgent;
  540. if (handlerMakeChildAgent != null)
  541. {
  542. handlerMakeChildAgent(presence);
  543. }
  544. }
  545. public void TriggerOnMakeRootAgent(ScenePresence presence)
  546. {
  547. handlerMakeRootAgent = OnMakeRootAgent;
  548. if (handlerMakeRootAgent != null)
  549. {
  550. handlerMakeRootAgent(presence);
  551. }
  552. }
  553. public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
  554. {
  555. handlerRegisterCaps = OnRegisterCaps;
  556. if (handlerRegisterCaps != null)
  557. {
  558. handlerRegisterCaps(agentID, caps);
  559. }
  560. }
  561. public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
  562. {
  563. handlerDeregisterCaps = OnDeregisterCaps;
  564. if (handlerDeregisterCaps != null)
  565. {
  566. handlerDeregisterCaps(agentID, caps);
  567. }
  568. }
  569. public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
  570. {
  571. handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
  572. if (handlerNewInventoryItemUpdateComplete != null)
  573. {
  574. handlerNewInventoryItemUpdateComplete(agentID, AssetID, AssetName, userlevel);
  575. }
  576. }
  577. public void TriggerLandBuy(Object sender, LandBuyArgs e)
  578. {
  579. handlerLandBuy = OnLandBuy;
  580. if (handlerLandBuy != null)
  581. {
  582. handlerLandBuy(sender, e);
  583. }
  584. }
  585. public void TriggerValidateLandBuy(Object sender, LandBuyArgs e)
  586. {
  587. handlerValidateLandBuy = OnValidateLandBuy;
  588. if (handlerValidateLandBuy != null)
  589. {
  590. handlerValidateLandBuy(sender, e);
  591. }
  592. }
  593. public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
  594. {
  595. handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  596. if (handlerScriptAtTargetEvent != null)
  597. {
  598. handlerScriptAtTargetEvent(localID, handle, targetpos, currentpos);
  599. }
  600. }
  601. public void TriggerNotAtTargetEvent(uint localID)
  602. {
  603. handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  604. if (handlerScriptNotAtTargetEvent != null)
  605. {
  606. handlerScriptNotAtTargetEvent(localID);
  607. }
  608. }
  609. public void TriggerRequestChangeWaterHeight(float height)
  610. {
  611. handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  612. if (handlerRequestChangeWaterHeight != null)
  613. {
  614. handlerRequestChangeWaterHeight(height);
  615. }
  616. }
  617. public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
  618. {
  619. handlerAvatarKill = OnAvatarKilled;
  620. if (handlerAvatarKill != null)
  621. {
  622. handlerAvatarKill(KillerObjectLocalID, DeadAvatar);
  623. }
  624. }
  625. public void TriggerSignificantClientMovement(IClientAPI client)
  626. {
  627. handlerSignificantClientMovement = OnSignificantClientMovement;
  628. if (handlerSignificantClientMovement != null)
  629. {
  630. handlerSignificantClientMovement(client);
  631. }
  632. }
  633. public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
  634. {
  635. handlerChatFromWorld = OnChatFromWorld;
  636. if (handlerChatFromWorld != null)
  637. {
  638. handlerChatFromWorld(sender, chat);
  639. }
  640. }
  641. public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
  642. {
  643. handlerChatFromClient = OnChatFromClient;
  644. if (handlerChatFromClient != null)
  645. {
  646. handlerChatFromClient(sender, chat);
  647. }
  648. }
  649. public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
  650. {
  651. handlerChatBroadcast = OnChatBroadcast;
  652. if (handlerChatBroadcast != null)
  653. {
  654. handlerChatBroadcast(sender, chat);
  655. }
  656. }
  657. internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed)
  658. {
  659. handlerScriptControlEvent = OnScriptControlEvent;
  660. if (handlerScriptControlEvent != null)
  661. {
  662. handlerScriptControlEvent(p, scriptUUID, avatarID, held, _changed);
  663. }
  664. }
  665. public void TriggerNoticeNoLandDataFromStorage()
  666. {
  667. handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
  668. if (handlerNoticeNoLandDataFromStorage != null)
  669. {
  670. handlerNoticeNoLandDataFromStorage();
  671. }
  672. }
  673. public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
  674. {
  675. handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
  676. if (handlerIncomingLandDataFromStorage != null)
  677. {
  678. handlerIncomingLandDataFromStorage(landData);
  679. }
  680. }
  681. public void TriggerSetAllowForcefulBan(bool allow)
  682. {
  683. handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
  684. if (handlerSetAllowForcefulBan != null)
  685. {
  686. handlerSetAllowForcefulBan(allow);
  687. }
  688. }
  689. public void TriggerRequestParcelPrimCountUpdate()
  690. {
  691. handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
  692. if (handlerRequestParcelPrimCountUpdate != null)
  693. {
  694. handlerRequestParcelPrimCountUpdate();
  695. }
  696. }
  697. public void TriggerParcelPrimCountTainted()
  698. {
  699. handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
  700. if (handlerParcelPrimCountTainted != null)
  701. {
  702. handlerParcelPrimCountTainted();
  703. }
  704. }
  705. // this lets us keep track of nasty script events like timer, etc.
  706. public void TriggerTimerEvent(uint objLocalID, double Interval)
  707. {
  708. handlerScriptTimerEvent = OnScriptTimerEvent;
  709. if (handlerScriptTimerEvent != null)
  710. {
  711. handlerScriptTimerEvent(objLocalID, Interval);
  712. }
  713. }
  714. public void TriggerEstateToolsTimeUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float LindenHour)
  715. {
  716. handlerEstateToolsTimeUpdate = OnEstateToolsTimeUpdate;
  717. if (handlerEstateToolsTimeUpdate != null)
  718. {
  719. handlerEstateToolsTimeUpdate(regionHandle, FixedTime, useEstateTime, LindenHour);
  720. }
  721. }
  722. public float GetSunLindenHour()
  723. {
  724. handlerSunGetLindenHour = OnGetSunLindenHour;
  725. if (handlerSunGetLindenHour != null)
  726. {
  727. return handlerSunGetLindenHour();
  728. }
  729. return 6;
  730. }
  731. public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
  732. {
  733. handlerCollidingStart = OnScriptColliderStart;
  734. if (handlerCollidingStart != null)
  735. handlerCollidingStart(localId, colliders);
  736. }
  737. public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
  738. {
  739. handlerColliding = OnScriptColliding;
  740. if (handlerColliding != null)
  741. handlerColliding(localId, colliders);
  742. }
  743. public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
  744. {
  745. handlerCollidingEnd = OnScriptCollidingEnd;
  746. if (handlerCollidingEnd != null)
  747. handlerCollidingEnd(localId, colliders);
  748. }
  749. public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
  750. {
  751. handlerSetRootAgentScene = OnSetRootAgentScene;
  752. if (handlerSetRootAgentScene != null)
  753. handlerSetRootAgentScene(agentID, scene);
  754. }
  755. }
  756. }