EventManager.cs 33 KB

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