EventManager.cs 40 KB

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