1
0

EventManager.cs 97 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546
  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 System.Reflection;
  30. using log4net;
  31. using OpenMetaverse;
  32. using OpenSim.Framework;
  33. using OpenSim.Framework.Client;
  34. using OpenSim.Region.Framework.Interfaces;
  35. using Caps = OpenSim.Framework.Capabilities.Caps;
  36. using GridRegion = OpenSim.Services.Interfaces.GridRegion;
  37. namespace OpenSim.Region.Framework.Scenes
  38. {
  39. /// <summary>
  40. /// A class for triggering remote scene events.
  41. /// </summary>
  42. public class EventManager
  43. {
  44. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  45. public delegate void OnFrameDelegate();
  46. public event OnFrameDelegate OnFrame;
  47. public delegate void ClientMovement(ScenePresence client);
  48. public event ClientMovement OnClientMovement;
  49. public delegate void OnTerrainTickDelegate();
  50. public event OnTerrainTickDelegate OnTerrainTick;
  51. public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
  52. public event OnBackupDelegate OnBackup;
  53. public delegate void OnClientConnectCoreDelegate(IClientCore client);
  54. public event OnClientConnectCoreDelegate OnClientConnect;
  55. public delegate void OnNewClientDelegate(IClientAPI client);
  56. /// <summary>
  57. /// Triggered when a new client is added to the scene.
  58. /// </summary>
  59. /// <remarks>
  60. /// This is triggered for both child and root agent client connections.
  61. /// Triggered before OnClientLogin.
  62. /// </remarks>
  63. public event OnNewClientDelegate OnNewClient;
  64. /// <summary>
  65. /// Fired if the client entering this sim is doing so as a new login
  66. /// </summary>
  67. public event Action<IClientAPI> OnClientLogin;
  68. public delegate void OnNewPresenceDelegate(ScenePresence presence);
  69. public event OnNewPresenceDelegate OnNewPresence;
  70. public delegate void OnRemovePresenceDelegate(UUID agentId);
  71. public event OnRemovePresenceDelegate OnRemovePresence;
  72. public delegate void OnParcelPrimCountUpdateDelegate();
  73. public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
  74. public delegate void OnParcelPrimCountAddDelegate(SceneObjectGroup obj);
  75. public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
  76. public delegate void OnPluginConsoleDelegate(string[] args);
  77. public event OnPluginConsoleDelegate OnPluginConsole;
  78. /// <summary>
  79. /// Triggered when the entire simulator is shutdown.
  80. /// </summary>
  81. public event Action OnShutdown;
  82. public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  83. public delegate void ScriptResetDelegate(uint localID, UUID itemID);
  84. public delegate void OnPermissionErrorDelegate(UUID user, string reason);
  85. public delegate void OnSetRootAgentSceneDelegate(UUID agentID, Scene scene);
  86. public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
  87. public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
  88. /// <summary>
  89. /// Triggered when an individual scene is shutdown.
  90. /// </summary>
  91. /// <remarks>
  92. /// This does not automatically mean that the entire simulator is shutting down. Listen to OnShutdown for that
  93. /// notification.
  94. /// </remarks>
  95. public event Action<Scene> OnSceneShuttingDown;
  96. /// <summary>
  97. /// Fired when an object is touched/grabbed.
  98. /// </summary>
  99. /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of
  100. /// the root part.
  101. public event ObjectGrabDelegate OnObjectGrab;
  102. public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs);
  103. public event ObjectGrabDelegate OnObjectGrabbing;
  104. public event ObjectDeGrabDelegate OnObjectDeGrab;
  105. public event ScriptResetDelegate OnScriptReset;
  106. public event OnPermissionErrorDelegate OnPermissionError;
  107. /// <summary>
  108. /// Fired when a script is run.
  109. /// </summary>
  110. /// <remarks>
  111. /// Occurs after OnNewScript.
  112. /// </remarks>
  113. public event NewRezScript OnRezScript;
  114. public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource);
  115. public delegate void RemoveScript(uint localID, UUID itemID);
  116. public event RemoveScript OnRemoveScript;
  117. public delegate void StartScript(uint localID, UUID itemID);
  118. public event StartScript OnStartScript;
  119. public delegate void StopScript(uint localID, UUID itemID);
  120. public event StopScript OnStopScript;
  121. public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta);
  122. public event SceneGroupMoved OnSceneGroupMove;
  123. public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID);
  124. public event SceneGroupGrabed OnSceneGroupGrab;
  125. public delegate bool SceneGroupSpinStarted(UUID groupID);
  126. public event SceneGroupSpinStarted OnSceneGroupSpinStart;
  127. public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation);
  128. public event SceneGroupSpun OnSceneGroupSpin;
  129. public delegate void LandObjectAdded(ILandObject newParcel);
  130. public event LandObjectAdded OnLandObjectAdded;
  131. public delegate void LandObjectRemoved(UUID globalID);
  132. public event LandObjectRemoved OnLandObjectRemoved;
  133. public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
  134. public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
  135. public delegate void AvatarAppearanceChange(ScenePresence avatar);
  136. public event AvatarAppearanceChange OnAvatarAppearanceChange;
  137. public event Action<ScenePresence> OnSignificantClientMovement;
  138. public delegate void IncomingInstantMessage(GridInstantMessage message);
  139. public event IncomingInstantMessage OnIncomingInstantMessage;
  140. public event IncomingInstantMessage OnUnhandledInstantMessage;
  141. public delegate void ClientClosed(UUID clientID, Scene scene);
  142. /// <summary>
  143. /// Fired when a client is removed from a scene whether it's a child or a root agent.
  144. /// </summary>
  145. /// <remarks>
  146. /// At the point of firing, the scene still contains the client's scene presence.
  147. /// </remarks>
  148. public event ClientClosed OnClientClosed;
  149. public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID);
  150. /// <summary>
  151. /// Fired when a script is created.
  152. /// </summary>
  153. /// <remarks>
  154. /// Occurs before OnRezScript
  155. /// </remarks>
  156. public event NewScript OnNewScript;
  157. public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID)
  158. {
  159. NewScript handlerNewScript = OnNewScript;
  160. if (handlerNewScript != null)
  161. {
  162. foreach (NewScript d in handlerNewScript.GetInvocationList())
  163. {
  164. try
  165. {
  166. d(clientID, part, itemID);
  167. }
  168. catch (Exception e)
  169. {
  170. m_log.ErrorFormat(
  171. "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}",
  172. e.Message, e.StackTrace);
  173. }
  174. }
  175. }
  176. }
  177. public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID);
  178. /// <summary>
  179. /// An indication that the script has changed.
  180. /// </summary>
  181. /// <remarks>
  182. /// Triggered after the scene receives a client's upload of an updated script and has stored it in an asset.
  183. /// </remarks>
  184. public event UpdateScript OnUpdateScript;
  185. public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID)
  186. {
  187. UpdateScript handlerUpdateScript = OnUpdateScript;
  188. if (handlerUpdateScript != null)
  189. {
  190. foreach (UpdateScript d in handlerUpdateScript.GetInvocationList())
  191. {
  192. try
  193. {
  194. d(clientId, itemId, primId, isScriptRunning, newAssetID);
  195. }
  196. catch (Exception e)
  197. {
  198. m_log.ErrorFormat(
  199. "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}",
  200. e.Message, e.StackTrace);
  201. }
  202. }
  203. }
  204. }
  205. /// <summary>
  206. /// ScriptChangedEvent is fired when a scene object property that a script might be interested
  207. /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event.
  208. /// This is not an indication that the script has changed (see OnUpdateScript for that).
  209. /// This event is sent to a script to tell it that some property changed on
  210. /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed .
  211. /// </summary>
  212. public event ScriptChangedEvent OnScriptChangedEvent;
  213. public delegate void ScriptChangedEvent(uint localID, uint change);
  214. public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed);
  215. public event ScriptControlEvent OnScriptControlEvent;
  216. public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos);
  217. public event ScriptAtTargetEvent OnScriptAtTargetEvent;
  218. public delegate void ScriptNotAtTargetEvent(uint localID);
  219. public event ScriptNotAtTargetEvent OnScriptNotAtTargetEvent;
  220. public delegate void ScriptAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion atrot);
  221. public event ScriptAtRotTargetEvent OnScriptAtRotTargetEvent;
  222. public delegate void ScriptNotAtRotTargetEvent(uint localID);
  223. public event ScriptNotAtRotTargetEvent OnScriptNotAtRotTargetEvent;
  224. public delegate void ScriptColliding(uint localID, ColliderArgs colliders);
  225. public event ScriptColliding OnScriptColliderStart;
  226. public event ScriptColliding OnScriptColliding;
  227. public event ScriptColliding OnScriptCollidingEnd;
  228. public event ScriptColliding OnScriptLandColliderStart;
  229. public event ScriptColliding OnScriptLandColliding;
  230. public event ScriptColliding OnScriptLandColliderEnd;
  231. public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
  232. public event OnMakeChildAgentDelegate OnMakeChildAgent;
  233. public delegate void OnSaveNewWindlightProfileDelegate();
  234. public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionLightShareData wl, UUID user);
  235. /// <summary>
  236. /// This event is on the critical path for transferring an avatar from one region to another. Try and do
  237. /// as little work on this event as possible, or do work asynchronously.
  238. /// </summary>
  239. public event Action<ScenePresence> OnMakeRootAgent;
  240. public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted;
  241. public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
  242. /// <summary>
  243. /// Triggered when an object or attachment enters a scene
  244. /// </summary>
  245. public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
  246. public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
  247. public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
  248. public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
  249. public delegate void RequestChangeWaterHeight(float height);
  250. public event RequestChangeWaterHeight OnRequestChangeWaterHeight;
  251. /// <summary>
  252. /// Fired if any avatar is 'killed' due to its health falling to zero
  253. /// </summary>
  254. public event AvatarKillData OnAvatarKilled;
  255. public delegate void AvatarKillData(uint KillerLocalID, ScenePresence avatar);
  256. // public delegate void ScriptTimerEvent(uint localID, double timerinterval);
  257. // public event ScriptTimerEvent OnScriptTimerEvent;
  258. public delegate void EstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool EstateSun, float LindenHour);
  259. public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
  260. public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
  261. /// <summary>
  262. /// Triggered when an object is added to the scene.
  263. /// </summary>
  264. public event Action<SceneObjectGroup> OnObjectAddedToScene;
  265. /// <summary>
  266. /// Triggered when an object is removed from the scene.
  267. /// </summary>
  268. public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
  269. public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
  270. public delegate void NoticeNoLandDataFromStorage();
  271. public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
  272. public delegate void IncomingLandDataFromStorage(List<LandData> data);
  273. public event IncomingLandDataFromStorage OnIncomingLandDataFromStorage;
  274. public delegate void SetAllowForcefulBan(bool allow);
  275. public event SetAllowForcefulBan OnSetAllowForcefulBan;
  276. public delegate void RequestParcelPrimCountUpdate();
  277. public event RequestParcelPrimCountUpdate OnRequestParcelPrimCountUpdate;
  278. public delegate void ParcelPrimCountTainted();
  279. public event ParcelPrimCountTainted OnParcelPrimCountTainted;
  280. public event GetScriptRunning OnGetScriptRunning;
  281. /// <summary>
  282. /// RegisterCapsEvent is called by Scene after the Caps object
  283. /// has been instantiated and before it is return to the
  284. /// client and provides region modules to add their caps.
  285. /// </summary>
  286. public delegate void RegisterCapsEvent(UUID agentID, Caps caps);
  287. public event RegisterCapsEvent OnRegisterCaps;
  288. /// <summary>
  289. /// DeregisterCapsEvent is called by Scene when the caps
  290. /// handler for an agent are removed.
  291. /// </summary>
  292. public delegate void DeregisterCapsEvent(UUID agentID, Caps caps);
  293. public event DeregisterCapsEvent OnDeregisterCaps;
  294. /// <summary>
  295. /// ChatFromWorldEvent is called via Scene when a chat message
  296. /// from world comes in.
  297. /// </summary>
  298. public delegate void ChatFromWorldEvent(Object sender, OSChatMessage chat);
  299. public event ChatFromWorldEvent OnChatFromWorld;
  300. /// <summary>
  301. /// ChatFromClientEvent is triggered via ChatModule (or
  302. /// substitutes thereof) when a chat message
  303. /// from the client comes in.
  304. /// </summary>
  305. public delegate void ChatFromClientEvent(Object sender, OSChatMessage chat);
  306. public event ChatFromClientEvent OnChatFromClient;
  307. /// <summary>
  308. /// ChatToClientsEvent is triggered via ChatModule (or
  309. /// substitutes thereof) when a chat message is actually sent to clients. Clients will only be sent a
  310. /// received chat message if they satisfy various conditions (within audible range, etc.)
  311. /// </summary>
  312. public delegate void ChatToClientsEvent(
  313. UUID senderID, HashSet<UUID> receiverIDs,
  314. string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
  315. ChatSourceType src, ChatAudibleLevel level);
  316. public event ChatToClientsEvent OnChatToClients;
  317. /// <summary>
  318. /// ChatBroadcastEvent is called via Scene when a broadcast chat message
  319. /// from world comes in
  320. /// </summary>
  321. public delegate void ChatBroadcastEvent(Object sender, OSChatMessage chat);
  322. public event ChatBroadcastEvent OnChatBroadcast;
  323. public delegate float SunLindenHour();
  324. public event SunLindenHour OnGetCurrentTimeAsLindenSunHour;
  325. /// <summary>
  326. /// Called when oar file has finished loading, although
  327. /// the scripts may not have started yet
  328. /// Message is non empty string if there were problems loading the oar file
  329. /// </summary>
  330. public delegate void OarFileLoaded(Guid guid, string message);
  331. public event OarFileLoaded OnOarFileLoaded;
  332. /// <summary>
  333. /// Called when an oar file has finished saving
  334. /// Message is non empty string if there were problems saving the oar file
  335. /// If a guid was supplied on the original call to identify, the request, this is returned. Otherwise
  336. /// Guid.Empty is returned.
  337. /// </summary>
  338. public delegate void OarFileSaved(Guid guid, string message);
  339. public event OarFileSaved OnOarFileSaved;
  340. /// <summary>
  341. /// Called when the script compile queue becomes empty
  342. /// Returns the number of scripts which failed to start
  343. /// </summary>
  344. public delegate void EmptyScriptCompileQueue(int numScriptsFailed, string message);
  345. public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
  346. /// <summary>
  347. /// Called whenever an object is attached, or detached from an in-world presence.
  348. /// </summary>
  349. /// If the object is being attached, then the avatarID will be present. If the object is being detached then
  350. /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
  351. public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
  352. public event Attach OnAttach;
  353. /// <summary>
  354. /// Called immediately after an object is loaded from storage.
  355. /// </summary>
  356. public event SceneObjectDelegate OnSceneObjectLoaded;
  357. public delegate void SceneObjectDelegate(SceneObjectGroup so);
  358. /// <summary>
  359. /// Called immediately before an object is saved to storage.
  360. /// </summary>
  361. /// <param name="persistingSo">
  362. /// The scene object being persisted.
  363. /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory.
  364. /// </param>
  365. /// <param name="originalSo">
  366. /// The original scene object being persisted. Changes here will stay in memory but will not be saved to storage on this save.
  367. /// </param>
  368. public event SceneObjectPreSaveDelegate OnSceneObjectPreSave;
  369. public delegate void SceneObjectPreSaveDelegate(SceneObjectGroup persistingSo, SceneObjectGroup originalSo);
  370. /// <summary>
  371. /// Called when a scene object part is cloned within the region.
  372. /// </summary>
  373. /// <param name="copy"></param>
  374. /// <param name="original"></param>
  375. /// <param name="userExposed">True if the duplicate will immediately be in the scene, false otherwise</param>
  376. public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy;
  377. public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
  378. public delegate void SceneObjectPartUpdated(SceneObjectPart sop);
  379. public event SceneObjectPartUpdated OnSceneObjectPartUpdated;
  380. public delegate void RegionUp(GridRegion region);
  381. public event RegionUp OnRegionUp;
  382. public delegate void RegionStarted(Scene scene);
  383. public event RegionStarted OnRegionStarted;
  384. public delegate void RegionHeartbeatEnd(Scene scene);
  385. public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
  386. /// <summary>
  387. /// Fired when logins to a region are enabled or disabled.
  388. /// </summary>
  389. /// <remarks>
  390. ///
  391. /// </remarks>
  392. /// Fired
  393. public event RegionLoginsStatusChange OnRegionLoginsStatusChange;
  394. public delegate void RegionLoginsStatusChange(IScene scene);
  395. /// <summary>
  396. /// Fired when a region is considered ready for use.
  397. /// </summary>
  398. /// <remarks>
  399. /// A region is considered ready when startup operations such as loading of scripts already on the region
  400. /// have been completed.
  401. /// </remarks>
  402. public event Action<IScene> OnRegionReadyStatusChange;
  403. public delegate void PrimsLoaded(Scene s);
  404. public event PrimsLoaded OnPrimsLoaded;
  405. public delegate void TeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout);
  406. public event TeleportStart OnTeleportStart;
  407. public delegate void TeleportFail(IClientAPI client, bool gridLogout);
  408. public event TeleportFail OnTeleportFail;
  409. public class MoneyTransferArgs : EventArgs
  410. {
  411. public UUID sender;
  412. public UUID receiver;
  413. // Always false. The SL protocol sucks.
  414. public bool authenticated = false;
  415. public int amount;
  416. public int transactiontype;
  417. public string description;
  418. public MoneyTransferArgs(UUID asender, UUID areceiver, int aamount, int atransactiontype, string adescription)
  419. {
  420. sender = asender;
  421. receiver = areceiver;
  422. amount = aamount;
  423. transactiontype = atransactiontype;
  424. description = adescription;
  425. }
  426. }
  427. public class LandBuyArgs : EventArgs
  428. {
  429. public UUID agentId = UUID.Zero;
  430. public UUID groupId = UUID.Zero;
  431. public UUID parcelOwnerID = UUID.Zero;
  432. public bool final = false;
  433. public bool groupOwned = false;
  434. public bool removeContribution = false;
  435. public int parcelLocalID = 0;
  436. public int parcelArea = 0;
  437. public int parcelPrice = 0;
  438. public bool authenticated = false;
  439. public bool landValidated = false;
  440. public bool economyValidated = false;
  441. public int transactionID = 0;
  442. public int amountDebited = 0;
  443. public LandBuyArgs(UUID pagentId, UUID pgroupId, bool pfinal, bool pgroupOwned,
  444. bool premoveContribution, int pparcelLocalID, int pparcelArea, int pparcelPrice,
  445. bool pauthenticated)
  446. {
  447. agentId = pagentId;
  448. groupId = pgroupId;
  449. final = pfinal;
  450. groupOwned = pgroupOwned;
  451. removeContribution = premoveContribution;
  452. parcelLocalID = pparcelLocalID;
  453. parcelArea = pparcelArea;
  454. parcelPrice = pparcelPrice;
  455. authenticated = pauthenticated;
  456. }
  457. }
  458. public delegate void MoneyTransferEvent(Object sender, MoneyTransferArgs e);
  459. public delegate void LandBuy(Object sender, LandBuyArgs e);
  460. public event MoneyTransferEvent OnMoneyTransfer;
  461. public event LandBuy OnLandBuy;
  462. public event LandBuy OnValidateLandBuy;
  463. public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
  464. {
  465. Attach handlerOnAttach = OnAttach;
  466. if (handlerOnAttach != null)
  467. {
  468. foreach (Attach d in handlerOnAttach.GetInvocationList())
  469. {
  470. try
  471. {
  472. d(localID, itemID, avatarID);
  473. }
  474. catch (Exception e)
  475. {
  476. m_log.ErrorFormat(
  477. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  478. e.Message, e.StackTrace);
  479. }
  480. }
  481. }
  482. }
  483. public void TriggerGetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
  484. {
  485. GetScriptRunning handlerGetScriptRunning = OnGetScriptRunning;
  486. if (handlerGetScriptRunning != null)
  487. {
  488. foreach (GetScriptRunning d in handlerGetScriptRunning.GetInvocationList())
  489. {
  490. try
  491. {
  492. d(controllingClient, objectID, itemID);
  493. }
  494. catch (Exception e)
  495. {
  496. m_log.ErrorFormat(
  497. "[EVENT MANAGER]: Delegate for TriggerGetScriptRunning failed - continuing. {0} {1}",
  498. e.Message, e.StackTrace);
  499. }
  500. }
  501. }
  502. }
  503. public void TriggerOnScriptChangedEvent(uint localID, uint change)
  504. {
  505. ScriptChangedEvent handlerScriptChangedEvent = OnScriptChangedEvent;
  506. if (handlerScriptChangedEvent != null)
  507. {
  508. foreach (ScriptChangedEvent d in handlerScriptChangedEvent.GetInvocationList())
  509. {
  510. try
  511. {
  512. d(localID, change);
  513. }
  514. catch (Exception e)
  515. {
  516. m_log.ErrorFormat(
  517. "[EVENT MANAGER]: Delegate for TriggerOnScriptChangedEvent failed - continuing. {0} {1}",
  518. e.Message, e.StackTrace);
  519. }
  520. }
  521. }
  522. }
  523. public void TriggerOnClientMovement(ScenePresence avatar)
  524. {
  525. ClientMovement handlerClientMovement = OnClientMovement;
  526. if (handlerClientMovement != null)
  527. {
  528. foreach (ClientMovement d in handlerClientMovement.GetInvocationList())
  529. {
  530. try
  531. {
  532. d(avatar);
  533. }
  534. catch (Exception e)
  535. {
  536. m_log.ErrorFormat(
  537. "[EVENT MANAGER]: Delegate for TriggerOnClientMovement failed - continuing. {0} {1}",
  538. e.Message, e.StackTrace);
  539. }
  540. }
  541. }
  542. }
  543. public void TriggerPermissionError(UUID user, string reason)
  544. {
  545. OnPermissionErrorDelegate handlerPermissionError = OnPermissionError;
  546. if (handlerPermissionError != null)
  547. {
  548. foreach (OnPermissionErrorDelegate d in handlerPermissionError.GetInvocationList())
  549. {
  550. try
  551. {
  552. d(user, reason);
  553. }
  554. catch (Exception e)
  555. {
  556. m_log.ErrorFormat(
  557. "[EVENT MANAGER]: Delegate for TriggerPermissionError failed - continuing. {0} {1}",
  558. e.Message, e.StackTrace);
  559. }
  560. }
  561. }
  562. }
  563. public void TriggerOnPluginConsole(string[] args)
  564. {
  565. OnPluginConsoleDelegate handlerPluginConsole = OnPluginConsole;
  566. if (handlerPluginConsole != null)
  567. {
  568. foreach (OnPluginConsoleDelegate d in handlerPluginConsole.GetInvocationList())
  569. {
  570. try
  571. {
  572. d(args);
  573. }
  574. catch (Exception e)
  575. {
  576. m_log.ErrorFormat(
  577. "[EVENT MANAGER]: Delegate for TriggerOnPluginConsole failed - continuing. {0} {1}",
  578. e.Message, e.StackTrace);
  579. }
  580. }
  581. }
  582. }
  583. public void TriggerOnFrame()
  584. {
  585. OnFrameDelegate handlerFrame = OnFrame;
  586. if (handlerFrame != null)
  587. {
  588. foreach (OnFrameDelegate d in handlerFrame.GetInvocationList())
  589. {
  590. try
  591. {
  592. d();
  593. }
  594. catch (Exception e)
  595. {
  596. m_log.ErrorFormat(
  597. "[EVENT MANAGER]: Delegate for TriggerOnFrame failed - continuing. {0} {1}",
  598. e.Message, e.StackTrace);
  599. }
  600. }
  601. }
  602. }
  603. public void TriggerOnNewClient(IClientAPI client)
  604. {
  605. OnNewClientDelegate handlerNewClient = OnNewClient;
  606. if (handlerNewClient != null)
  607. {
  608. foreach (OnNewClientDelegate d in handlerNewClient.GetInvocationList())
  609. {
  610. try
  611. {
  612. d(client);
  613. }
  614. catch (Exception e)
  615. {
  616. m_log.ErrorFormat(
  617. "[EVENT MANAGER]: Delegate for TriggerOnNewClient failed - continuing. {0} {1}",
  618. e.Message, e.StackTrace);
  619. }
  620. }
  621. }
  622. if (client is IClientCore)
  623. {
  624. OnClientConnectCoreDelegate handlerClientConnect = OnClientConnect;
  625. if (handlerClientConnect != null)
  626. {
  627. foreach (OnClientConnectCoreDelegate d in handlerClientConnect.GetInvocationList())
  628. {
  629. try
  630. {
  631. d((IClientCore)client);
  632. }
  633. catch (Exception e)
  634. {
  635. m_log.ErrorFormat(
  636. "[EVENT MANAGER]: Delegate for TriggerOnNewClient (IClientCore) failed - continuing. {0} {1}",
  637. e.Message, e.StackTrace);
  638. }
  639. }
  640. }
  641. }
  642. }
  643. public void TriggerOnClientLogin(IClientAPI client)
  644. {
  645. Action<IClientAPI> handlerClientLogin = OnClientLogin;
  646. if (handlerClientLogin != null)
  647. {
  648. foreach (Action<IClientAPI> d in handlerClientLogin.GetInvocationList())
  649. {
  650. try
  651. {
  652. d(client);
  653. }
  654. catch (Exception e)
  655. {
  656. m_log.ErrorFormat(
  657. "[EVENT MANAGER]: Delegate for TriggerOnClientLogin failed - continuing. {0} {1}",
  658. e.Message, e.StackTrace);
  659. }
  660. }
  661. }
  662. }
  663. public void TriggerOnNewPresence(ScenePresence presence)
  664. {
  665. OnNewPresenceDelegate handlerNewPresence = OnNewPresence;
  666. if (handlerNewPresence != null)
  667. {
  668. foreach (OnNewPresenceDelegate d in handlerNewPresence.GetInvocationList())
  669. {
  670. try
  671. {
  672. d(presence);
  673. }
  674. catch (Exception e)
  675. {
  676. m_log.ErrorFormat(
  677. "[EVENT MANAGER]: Delegate for TriggerOnNewPresence failed - continuing. {0} {1}",
  678. e.Message, e.StackTrace);
  679. }
  680. }
  681. }
  682. }
  683. public void TriggerOnRemovePresence(UUID agentId)
  684. {
  685. OnRemovePresenceDelegate handlerRemovePresence = OnRemovePresence;
  686. if (handlerRemovePresence != null)
  687. {
  688. foreach (OnRemovePresenceDelegate d in handlerRemovePresence.GetInvocationList())
  689. {
  690. try
  691. {
  692. d(agentId);
  693. }
  694. catch (Exception e)
  695. {
  696. m_log.ErrorFormat(
  697. "[EVENT MANAGER]: Delegate for TriggerOnRemovePresence failed - continuing. {0} {1}",
  698. e.Message, e.StackTrace);
  699. }
  700. }
  701. }
  702. }
  703. public void TriggerOnBackup(ISimulationDataService dstore, bool forced)
  704. {
  705. OnBackupDelegate handlerOnAttach = OnBackup;
  706. if (handlerOnAttach != null)
  707. {
  708. foreach (OnBackupDelegate d in handlerOnAttach.GetInvocationList())
  709. {
  710. try
  711. {
  712. d(dstore, forced);
  713. }
  714. catch (Exception e)
  715. {
  716. m_log.ErrorFormat(
  717. "[EVENT MANAGER]: Delegate for TriggerOnBackup failed - continuing. {0} {1}",
  718. e.Message, e.StackTrace);
  719. }
  720. }
  721. }
  722. }
  723. public void TriggerParcelPrimCountUpdate()
  724. {
  725. OnParcelPrimCountUpdateDelegate handlerParcelPrimCountUpdate = OnParcelPrimCountUpdate;
  726. if (handlerParcelPrimCountUpdate != null)
  727. {
  728. foreach (OnParcelPrimCountUpdateDelegate d in handlerParcelPrimCountUpdate.GetInvocationList())
  729. {
  730. try
  731. {
  732. d();
  733. }
  734. catch (Exception e)
  735. {
  736. m_log.ErrorFormat(
  737. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountUpdate failed - continuing. {0} {1}",
  738. e.Message, e.StackTrace);
  739. }
  740. }
  741. }
  742. }
  743. public void TriggerMoneyTransfer(Object sender, MoneyTransferArgs args)
  744. {
  745. MoneyTransferEvent handlerMoneyTransfer = OnMoneyTransfer;
  746. if (handlerMoneyTransfer != null)
  747. {
  748. foreach (MoneyTransferEvent d in handlerMoneyTransfer.GetInvocationList())
  749. {
  750. try
  751. {
  752. d(sender, args);
  753. }
  754. catch (Exception e)
  755. {
  756. m_log.ErrorFormat(
  757. "[EVENT MANAGER]: Delegate for TriggerMoneyTransfer failed - continuing. {0} {1}",
  758. e.Message, e.StackTrace);
  759. }
  760. }
  761. }
  762. }
  763. public void TriggerTerrainTick()
  764. {
  765. OnTerrainTickDelegate handlerTerrainTick = OnTerrainTick;
  766. if (handlerTerrainTick != null)
  767. {
  768. foreach (OnTerrainTickDelegate d in handlerTerrainTick.GetInvocationList())
  769. {
  770. try
  771. {
  772. d();
  773. }
  774. catch (Exception e)
  775. {
  776. m_log.ErrorFormat(
  777. "[EVENT MANAGER]: Delegate for TriggerTerrainTick failed - continuing. {0} {1}",
  778. e.Message, e.StackTrace);
  779. }
  780. }
  781. }
  782. }
  783. public void TriggerParcelPrimCountAdd(SceneObjectGroup obj)
  784. {
  785. OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = OnParcelPrimCountAdd;
  786. if (handlerParcelPrimCountAdd != null)
  787. {
  788. foreach (OnParcelPrimCountAddDelegate d in handlerParcelPrimCountAdd.GetInvocationList())
  789. {
  790. try
  791. {
  792. d(obj);
  793. }
  794. catch (Exception e)
  795. {
  796. m_log.ErrorFormat(
  797. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountAdd failed - continuing. {0} {1}",
  798. e.Message, e.StackTrace);
  799. }
  800. }
  801. }
  802. }
  803. public void TriggerObjectAddedToScene(SceneObjectGroup obj)
  804. {
  805. Action<SceneObjectGroup> handler = OnObjectAddedToScene;
  806. if (handler != null)
  807. {
  808. foreach (Action<SceneObjectGroup> d in handler.GetInvocationList())
  809. {
  810. try
  811. {
  812. d(obj);
  813. }
  814. catch (Exception e)
  815. {
  816. m_log.ErrorFormat(
  817. "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
  818. e.Message, e.StackTrace);
  819. }
  820. }
  821. }
  822. }
  823. public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
  824. {
  825. ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
  826. if (handlerObjectBeingRemovedFromScene != null)
  827. {
  828. foreach (ObjectBeingRemovedFromScene d in handlerObjectBeingRemovedFromScene.GetInvocationList())
  829. {
  830. try
  831. {
  832. d(obj);
  833. }
  834. catch (Exception e)
  835. {
  836. m_log.ErrorFormat(
  837. "[EVENT MANAGER]: Delegate for TriggerObjectBeingRemovedFromScene failed - continuing. {0} {1}",
  838. e.Message, e.StackTrace);
  839. }
  840. }
  841. }
  842. }
  843. public void TriggerShutdown()
  844. {
  845. Action handlerShutdown = OnShutdown;
  846. if (handlerShutdown != null)
  847. {
  848. foreach (Action d in handlerShutdown.GetInvocationList())
  849. {
  850. try
  851. {
  852. d();
  853. }
  854. catch (Exception e)
  855. {
  856. m_log.ErrorFormat(
  857. "[EVENT MANAGER]: Delegate for TriggerShutdown failed - continuing. {0} {1}",
  858. e.Message, e.StackTrace);
  859. }
  860. }
  861. }
  862. }
  863. public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  864. {
  865. ObjectGrabDelegate handlerObjectGrab = OnObjectGrab;
  866. if (handlerObjectGrab != null)
  867. {
  868. foreach (ObjectGrabDelegate d in handlerObjectGrab.GetInvocationList())
  869. {
  870. try
  871. {
  872. d(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  873. }
  874. catch (Exception e)
  875. {
  876. m_log.ErrorFormat(
  877. "[EVENT MANAGER]: Delegate for TriggerObjectGrab failed - continuing. {0} {1}",
  878. e.Message, e.StackTrace);
  879. }
  880. }
  881. }
  882. }
  883. public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  884. {
  885. ObjectGrabDelegate handlerObjectGrabbing = OnObjectGrabbing;
  886. if (handlerObjectGrabbing != null)
  887. {
  888. foreach (ObjectGrabDelegate d in handlerObjectGrabbing.GetInvocationList())
  889. {
  890. try
  891. {
  892. d(localID, originalID, offsetPos, remoteClient, surfaceArgs);
  893. }
  894. catch (Exception e)
  895. {
  896. m_log.ErrorFormat(
  897. "[EVENT MANAGER]: Delegate for TriggerObjectGrabbing failed - continuing. {0} {1}",
  898. e.Message, e.StackTrace);
  899. }
  900. }
  901. }
  902. }
  903. public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
  904. {
  905. ObjectDeGrabDelegate handlerObjectDeGrab = OnObjectDeGrab;
  906. if (handlerObjectDeGrab != null)
  907. {
  908. foreach (ObjectDeGrabDelegate d in handlerObjectDeGrab.GetInvocationList())
  909. {
  910. try
  911. {
  912. d(localID, originalID, remoteClient, surfaceArgs);
  913. }
  914. catch (Exception e)
  915. {
  916. m_log.ErrorFormat(
  917. "[EVENT MANAGER]: Delegate for TriggerObjectDeGrab failed - continuing. {0} {1}",
  918. e.Message, e.StackTrace);
  919. }
  920. }
  921. }
  922. }
  923. public void TriggerScriptReset(uint localID, UUID itemID)
  924. {
  925. ScriptResetDelegate handlerScriptReset = OnScriptReset;
  926. if (handlerScriptReset != null)
  927. {
  928. foreach (ScriptResetDelegate d in handlerScriptReset.GetInvocationList())
  929. {
  930. try
  931. {
  932. d(localID, itemID);
  933. }
  934. catch (Exception e)
  935. {
  936. m_log.ErrorFormat(
  937. "[EVENT MANAGER]: Delegate for TriggerScriptReset failed - continuing. {0} {1}",
  938. e.Message, e.StackTrace);
  939. }
  940. }
  941. }
  942. }
  943. public void TriggerRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
  944. {
  945. NewRezScript handlerRezScript = OnRezScript;
  946. if (handlerRezScript != null)
  947. {
  948. foreach (NewRezScript d in handlerRezScript.GetInvocationList())
  949. {
  950. try
  951. {
  952. d(localID, itemID, script, startParam, postOnRez, engine, stateSource);
  953. }
  954. catch (Exception e)
  955. {
  956. m_log.ErrorFormat(
  957. "[EVENT MANAGER]: Delegate for TriggerRezScript failed - continuing. {0} {1}",
  958. e.Message, e.StackTrace);
  959. }
  960. }
  961. }
  962. }
  963. public void TriggerStartScript(uint localID, UUID itemID)
  964. {
  965. StartScript handlerStartScript = OnStartScript;
  966. if (handlerStartScript != null)
  967. {
  968. foreach (StartScript d in handlerStartScript.GetInvocationList())
  969. {
  970. try
  971. {
  972. d(localID, itemID);
  973. }
  974. catch (Exception e)
  975. {
  976. m_log.ErrorFormat(
  977. "[EVENT MANAGER]: Delegate for TriggerStartScript failed - continuing. {0} {1}",
  978. e.Message, e.StackTrace);
  979. }
  980. }
  981. }
  982. }
  983. public void TriggerStopScript(uint localID, UUID itemID)
  984. {
  985. StopScript handlerStopScript = OnStopScript;
  986. if (handlerStopScript != null)
  987. {
  988. foreach (StopScript d in handlerStopScript.GetInvocationList())
  989. {
  990. try
  991. {
  992. d(localID, itemID);
  993. }
  994. catch (Exception e)
  995. {
  996. m_log.ErrorFormat(
  997. "[EVENT MANAGER]: Delegate for TriggerStopScript failed - continuing. {0} {1}",
  998. e.Message, e.StackTrace);
  999. }
  1000. }
  1001. }
  1002. }
  1003. public void TriggerRemoveScript(uint localID, UUID itemID)
  1004. {
  1005. RemoveScript handlerRemoveScript = OnRemoveScript;
  1006. if (handlerRemoveScript != null)
  1007. {
  1008. foreach (RemoveScript d in handlerRemoveScript.GetInvocationList())
  1009. {
  1010. try
  1011. {
  1012. d(localID, itemID);
  1013. }
  1014. catch (Exception e)
  1015. {
  1016. m_log.ErrorFormat(
  1017. "[EVENT MANAGER]: Delegate for TriggerRemoveScript failed - continuing. {0} {1}",
  1018. e.Message, e.StackTrace);
  1019. }
  1020. }
  1021. }
  1022. }
  1023. public bool TriggerGroupMove(UUID groupID, Vector3 delta)
  1024. {
  1025. bool result = true;
  1026. SceneGroupMoved handlerSceneGroupMove = OnSceneGroupMove;
  1027. if (handlerSceneGroupMove != null)
  1028. {
  1029. foreach (SceneGroupMoved d in handlerSceneGroupMove.GetInvocationList())
  1030. {
  1031. try
  1032. {
  1033. if (d(groupID, delta) == false)
  1034. result = false;
  1035. }
  1036. catch (Exception e)
  1037. {
  1038. m_log.ErrorFormat(
  1039. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  1040. e.Message, e.StackTrace);
  1041. }
  1042. }
  1043. }
  1044. return result;
  1045. }
  1046. public bool TriggerGroupSpinStart(UUID groupID)
  1047. {
  1048. bool result = true;
  1049. SceneGroupSpinStarted handlerSceneGroupSpinStarted = OnSceneGroupSpinStart;
  1050. if (handlerSceneGroupSpinStarted != null)
  1051. {
  1052. foreach (SceneGroupSpinStarted d in handlerSceneGroupSpinStarted.GetInvocationList())
  1053. {
  1054. try
  1055. {
  1056. if (d(groupID) == false)
  1057. result = false;
  1058. }
  1059. catch (Exception e)
  1060. {
  1061. m_log.ErrorFormat(
  1062. "[EVENT MANAGER]: Delegate for TriggerGroupSpinStart failed - continuing. {0} {1}",
  1063. e.Message, e.StackTrace);
  1064. }
  1065. }
  1066. }
  1067. return result;
  1068. }
  1069. public bool TriggerGroupSpin(UUID groupID, Quaternion rotation)
  1070. {
  1071. bool result = true;
  1072. SceneGroupSpun handlerSceneGroupSpin = OnSceneGroupSpin;
  1073. if (handlerSceneGroupSpin != null)
  1074. {
  1075. foreach (SceneGroupSpun d in handlerSceneGroupSpin.GetInvocationList())
  1076. {
  1077. try
  1078. {
  1079. if (d(groupID, rotation) == false)
  1080. result = false;
  1081. }
  1082. catch (Exception e)
  1083. {
  1084. m_log.ErrorFormat(
  1085. "[EVENT MANAGER]: Delegate for TriggerGroupSpin failed - continuing. {0} {1}",
  1086. e.Message, e.StackTrace);
  1087. }
  1088. }
  1089. }
  1090. return result;
  1091. }
  1092. public void TriggerGroupGrab(UUID groupID, Vector3 offset, UUID userID)
  1093. {
  1094. SceneGroupGrabed handlerSceneGroupGrab = OnSceneGroupGrab;
  1095. if (handlerSceneGroupGrab != null)
  1096. {
  1097. foreach (SceneGroupGrabed d in handlerSceneGroupGrab.GetInvocationList())
  1098. {
  1099. try
  1100. {
  1101. d(groupID, offset, userID);
  1102. }
  1103. catch (Exception e)
  1104. {
  1105. m_log.ErrorFormat(
  1106. "[EVENT MANAGER]: Delegate for TriggerGroupGrab failed - continuing. {0} {1}",
  1107. e.Message, e.StackTrace);
  1108. }
  1109. }
  1110. }
  1111. }
  1112. public void TriggerLandObjectAdded(ILandObject newParcel)
  1113. {
  1114. LandObjectAdded handlerLandObjectAdded = OnLandObjectAdded;
  1115. if (handlerLandObjectAdded != null)
  1116. {
  1117. foreach (LandObjectAdded d in handlerLandObjectAdded.GetInvocationList())
  1118. {
  1119. try
  1120. {
  1121. d(newParcel);
  1122. }
  1123. catch (Exception e)
  1124. {
  1125. m_log.ErrorFormat(
  1126. "[EVENT MANAGER]: Delegate for TriggerLandObjectAdded failed - continuing. {0} {1}",
  1127. e.Message, e.StackTrace);
  1128. }
  1129. }
  1130. }
  1131. }
  1132. public void TriggerLandObjectRemoved(UUID globalID)
  1133. {
  1134. LandObjectRemoved handlerLandObjectRemoved = OnLandObjectRemoved;
  1135. if (handlerLandObjectRemoved != null)
  1136. {
  1137. foreach (LandObjectRemoved d in handlerLandObjectRemoved.GetInvocationList())
  1138. {
  1139. try
  1140. {
  1141. d(globalID);
  1142. }
  1143. catch (Exception e)
  1144. {
  1145. m_log.ErrorFormat(
  1146. "[EVENT MANAGER]: Delegate for TriggerLandObjectRemoved failed - continuing. {0} {1}",
  1147. e.Message, e.StackTrace);
  1148. }
  1149. }
  1150. }
  1151. }
  1152. public void TriggerLandObjectUpdated(uint localParcelID, ILandObject newParcel)
  1153. {
  1154. TriggerLandObjectAdded(newParcel);
  1155. }
  1156. public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
  1157. {
  1158. AvatarEnteringNewParcel handlerAvatarEnteringNewParcel = OnAvatarEnteringNewParcel;
  1159. if (handlerAvatarEnteringNewParcel != null)
  1160. {
  1161. foreach (AvatarEnteringNewParcel d in handlerAvatarEnteringNewParcel.GetInvocationList())
  1162. {
  1163. try
  1164. {
  1165. d(avatar, localLandID, regionID);
  1166. }
  1167. catch (Exception e)
  1168. {
  1169. m_log.ErrorFormat(
  1170. "[EVENT MANAGER]: Delegate for TriggerAvatarEnteringNewParcel failed - continuing. {0} {1}",
  1171. e.Message, e.StackTrace);
  1172. }
  1173. }
  1174. }
  1175. }
  1176. public void TriggerAvatarAppearanceChanged(ScenePresence avatar)
  1177. {
  1178. AvatarAppearanceChange handler = OnAvatarAppearanceChange;
  1179. if (handler != null)
  1180. {
  1181. foreach (AvatarAppearanceChange d in handler.GetInvocationList())
  1182. {
  1183. try
  1184. {
  1185. d(avatar);
  1186. }
  1187. catch (Exception e)
  1188. {
  1189. m_log.ErrorFormat(
  1190. "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}",
  1191. e.Message, e.StackTrace);
  1192. }
  1193. }
  1194. }
  1195. }
  1196. public void TriggerIncomingInstantMessage(GridInstantMessage message)
  1197. {
  1198. IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
  1199. if (handlerIncomingInstantMessage != null)
  1200. {
  1201. foreach (IncomingInstantMessage d in handlerIncomingInstantMessage.GetInvocationList())
  1202. {
  1203. try
  1204. {
  1205. d(message);
  1206. }
  1207. catch (Exception e)
  1208. {
  1209. m_log.ErrorFormat(
  1210. "[EVENT MANAGER]: Delegate for TriggerIncomingInstantMessage failed - continuing. {0} {1}",
  1211. e.Message, e.StackTrace);
  1212. }
  1213. }
  1214. }
  1215. }
  1216. public void TriggerUnhandledInstantMessage(GridInstantMessage message)
  1217. {
  1218. IncomingInstantMessage handlerUnhandledInstantMessage = OnUnhandledInstantMessage;
  1219. if (handlerUnhandledInstantMessage != null)
  1220. {
  1221. foreach (IncomingInstantMessage d in handlerUnhandledInstantMessage.GetInvocationList())
  1222. {
  1223. try
  1224. {
  1225. d(message);
  1226. }
  1227. catch (Exception e)
  1228. {
  1229. m_log.ErrorFormat(
  1230. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  1231. e.Message, e.StackTrace);
  1232. }
  1233. }
  1234. }
  1235. }
  1236. public void TriggerClientClosed(UUID ClientID, Scene scene)
  1237. {
  1238. ClientClosed handlerClientClosed = OnClientClosed;
  1239. if (handlerClientClosed != null)
  1240. {
  1241. foreach (ClientClosed d in handlerClientClosed.GetInvocationList())
  1242. {
  1243. try
  1244. {
  1245. d(ClientID, scene);
  1246. }
  1247. catch (Exception e)
  1248. {
  1249. m_log.ErrorFormat(
  1250. "[EVENT MANAGER]: Delegate for TriggerClientClosed failed - continuing. {0} {1}",
  1251. e.Message, e.StackTrace);
  1252. }
  1253. }
  1254. }
  1255. }
  1256. public void TriggerOnMakeChildAgent(ScenePresence presence)
  1257. {
  1258. OnMakeChildAgentDelegate handlerMakeChildAgent = OnMakeChildAgent;
  1259. if (handlerMakeChildAgent != null)
  1260. {
  1261. foreach (OnMakeChildAgentDelegate d in handlerMakeChildAgent.GetInvocationList())
  1262. {
  1263. try
  1264. {
  1265. d(presence);
  1266. }
  1267. catch (Exception e)
  1268. {
  1269. m_log.ErrorFormat(
  1270. "[EVENT MANAGER]: Delegate for TriggerOnMakeChildAgent failed - continuing. {0} {1}",
  1271. e.Message, e.StackTrace);
  1272. }
  1273. }
  1274. }
  1275. }
  1276. public void TriggerOnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID user)
  1277. {
  1278. OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted;
  1279. if (handlerSendNewWindlightProfileTargeted != null)
  1280. {
  1281. handlerSendNewWindlightProfileTargeted(wl, user);
  1282. }
  1283. }
  1284. public void TriggerOnSaveNewWindlightProfile()
  1285. {
  1286. OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile;
  1287. if (handlerSaveNewWindlightProfile != null)
  1288. {
  1289. handlerSaveNewWindlightProfile();
  1290. }
  1291. }
  1292. public void TriggerOnMakeRootAgent(ScenePresence presence)
  1293. {
  1294. Action<ScenePresence> handlerMakeRootAgent = OnMakeRootAgent;
  1295. if (handlerMakeRootAgent != null)
  1296. {
  1297. foreach (Action<ScenePresence> d in handlerMakeRootAgent.GetInvocationList())
  1298. {
  1299. try
  1300. {
  1301. d(presence);
  1302. }
  1303. catch (Exception e)
  1304. {
  1305. m_log.ErrorFormat(
  1306. "[EVENT MANAGER]: Delegate for TriggerOnMakeRootAgent failed - continuing. {0} {1}",
  1307. e.Message, e.StackTrace);
  1308. }
  1309. }
  1310. }
  1311. }
  1312. public void TriggerOnIncomingSceneObject(SceneObjectGroup so)
  1313. {
  1314. OnIncomingSceneObjectDelegate handlerIncomingSceneObject = OnIncomingSceneObject;
  1315. if (handlerIncomingSceneObject != null)
  1316. {
  1317. foreach (OnIncomingSceneObjectDelegate d in handlerIncomingSceneObject.GetInvocationList())
  1318. {
  1319. try
  1320. {
  1321. d(so);
  1322. }
  1323. catch (Exception e)
  1324. {
  1325. m_log.ErrorFormat(
  1326. "[EVENT MANAGER]: Delegate for TriggerOnIncomingSceneObject failed - continuing. {0} {1}",
  1327. e.Message, e.StackTrace);
  1328. }
  1329. }
  1330. }
  1331. }
  1332. public void TriggerOnRegisterCaps(UUID agentID, Caps caps)
  1333. {
  1334. RegisterCapsEvent handlerRegisterCaps = OnRegisterCaps;
  1335. if (handlerRegisterCaps != null)
  1336. {
  1337. foreach (RegisterCapsEvent d in handlerRegisterCaps.GetInvocationList())
  1338. {
  1339. try
  1340. {
  1341. d(agentID, caps);
  1342. }
  1343. catch (Exception e)
  1344. {
  1345. m_log.ErrorFormat(
  1346. "[EVENT MANAGER]: Delegate for TriggerOnRegisterCaps failed - continuing. {0} {1}",
  1347. e.Message, e.StackTrace);
  1348. }
  1349. }
  1350. }
  1351. }
  1352. public void TriggerOnDeregisterCaps(UUID agentID, Caps caps)
  1353. {
  1354. DeregisterCapsEvent handlerDeregisterCaps = OnDeregisterCaps;
  1355. if (handlerDeregisterCaps != null)
  1356. {
  1357. foreach (DeregisterCapsEvent d in handlerDeregisterCaps.GetInvocationList())
  1358. {
  1359. try
  1360. {
  1361. d(agentID, caps);
  1362. }
  1363. catch (Exception e)
  1364. {
  1365. m_log.ErrorFormat(
  1366. "[EVENT MANAGER]: Delegate for TriggerOnDeregisterCaps failed - continuing. {0} {1}",
  1367. e.Message, e.StackTrace);
  1368. }
  1369. }
  1370. }
  1371. }
  1372. public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel)
  1373. {
  1374. NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
  1375. if (handlerNewInventoryItemUpdateComplete != null)
  1376. {
  1377. foreach (NewInventoryItemUploadComplete d in handlerNewInventoryItemUpdateComplete.GetInvocationList())
  1378. {
  1379. try
  1380. {
  1381. d(agentID, AssetID, AssetName, userlevel);
  1382. }
  1383. catch (Exception e)
  1384. {
  1385. m_log.ErrorFormat(
  1386. "[EVENT MANAGER]: Delegate for TriggerOnNewInventoryItemUploadComplete failed - continuing. {0} {1}",
  1387. e.Message, e.StackTrace);
  1388. }
  1389. }
  1390. }
  1391. }
  1392. public void TriggerLandBuy(Object sender, LandBuyArgs args)
  1393. {
  1394. LandBuy handlerLandBuy = OnLandBuy;
  1395. if (handlerLandBuy != null)
  1396. {
  1397. foreach (LandBuy d in handlerLandBuy.GetInvocationList())
  1398. {
  1399. try
  1400. {
  1401. d(sender, args);
  1402. }
  1403. catch (Exception e)
  1404. {
  1405. m_log.ErrorFormat(
  1406. "[EVENT MANAGER]: Delegate for TriggerLandBuy failed - continuing. {0} {1}",
  1407. e.Message, e.StackTrace);
  1408. }
  1409. }
  1410. }
  1411. }
  1412. public void TriggerValidateLandBuy(Object sender, LandBuyArgs args)
  1413. {
  1414. LandBuy handlerValidateLandBuy = OnValidateLandBuy;
  1415. if (handlerValidateLandBuy != null)
  1416. {
  1417. foreach (LandBuy d in handlerValidateLandBuy.GetInvocationList())
  1418. {
  1419. try
  1420. {
  1421. d(sender, args);
  1422. }
  1423. catch (Exception e)
  1424. {
  1425. m_log.ErrorFormat(
  1426. "[EVENT MANAGER]: Delegate for TriggerValidateLandBuy failed - continuing. {0} {1}",
  1427. e.Message, e.StackTrace);
  1428. }
  1429. }
  1430. }
  1431. }
  1432. public void TriggerAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 currentpos)
  1433. {
  1434. ScriptAtTargetEvent handlerScriptAtTargetEvent = OnScriptAtTargetEvent;
  1435. if (handlerScriptAtTargetEvent != null)
  1436. {
  1437. foreach (ScriptAtTargetEvent d in handlerScriptAtTargetEvent.GetInvocationList())
  1438. {
  1439. try
  1440. {
  1441. d(localID, handle, targetpos, currentpos);
  1442. }
  1443. catch (Exception e)
  1444. {
  1445. m_log.ErrorFormat(
  1446. "[EVENT MANAGER]: Delegate for TriggerAtTargetEvent failed - continuing. {0} {1}",
  1447. e.Message, e.StackTrace);
  1448. }
  1449. }
  1450. }
  1451. }
  1452. public void TriggerNotAtTargetEvent(uint localID)
  1453. {
  1454. ScriptNotAtTargetEvent handlerScriptNotAtTargetEvent = OnScriptNotAtTargetEvent;
  1455. if (handlerScriptNotAtTargetEvent != null)
  1456. {
  1457. foreach (ScriptNotAtTargetEvent d in handlerScriptNotAtTargetEvent.GetInvocationList())
  1458. {
  1459. try
  1460. {
  1461. d(localID);
  1462. }
  1463. catch (Exception e)
  1464. {
  1465. m_log.ErrorFormat(
  1466. "[EVENT MANAGER]: Delegate for TriggerNotAtTargetEvent failed - continuing. {0} {1}",
  1467. e.Message, e.StackTrace);
  1468. }
  1469. }
  1470. }
  1471. }
  1472. public void TriggerAtRotTargetEvent(uint localID, uint handle, Quaternion targetrot, Quaternion currentrot)
  1473. {
  1474. ScriptAtRotTargetEvent handlerScriptAtRotTargetEvent = OnScriptAtRotTargetEvent;
  1475. if (handlerScriptAtRotTargetEvent != null)
  1476. {
  1477. foreach (ScriptAtRotTargetEvent d in handlerScriptAtRotTargetEvent.GetInvocationList())
  1478. {
  1479. try
  1480. {
  1481. d(localID, handle, targetrot, currentrot);
  1482. }
  1483. catch (Exception e)
  1484. {
  1485. m_log.ErrorFormat(
  1486. "[EVENT MANAGER]: Delegate for TriggerAtRotTargetEvent failed - continuing. {0} {1}",
  1487. e.Message, e.StackTrace);
  1488. }
  1489. }
  1490. }
  1491. }
  1492. public void TriggerNotAtRotTargetEvent(uint localID)
  1493. {
  1494. ScriptNotAtRotTargetEvent handlerScriptNotAtRotTargetEvent = OnScriptNotAtRotTargetEvent;
  1495. if (handlerScriptNotAtRotTargetEvent != null)
  1496. {
  1497. foreach (ScriptNotAtRotTargetEvent d in handlerScriptNotAtRotTargetEvent.GetInvocationList())
  1498. {
  1499. try
  1500. {
  1501. d(localID);
  1502. }
  1503. catch (Exception e)
  1504. {
  1505. m_log.ErrorFormat(
  1506. "[EVENT MANAGER]: Delegate for TriggerNotAtRotTargetEvent failed - continuing. {0} {1}",
  1507. e.Message, e.StackTrace);
  1508. }
  1509. }
  1510. }
  1511. }
  1512. public void TriggerRequestChangeWaterHeight(float height)
  1513. {
  1514. if (height < 0)
  1515. {
  1516. // ignore negative water height
  1517. return;
  1518. }
  1519. RequestChangeWaterHeight handlerRequestChangeWaterHeight = OnRequestChangeWaterHeight;
  1520. if (handlerRequestChangeWaterHeight != null)
  1521. {
  1522. foreach (RequestChangeWaterHeight d in handlerRequestChangeWaterHeight.GetInvocationList())
  1523. {
  1524. try
  1525. {
  1526. d(height);
  1527. }
  1528. catch (Exception e)
  1529. {
  1530. m_log.ErrorFormat(
  1531. "[EVENT MANAGER]: Delegate for TriggerRequestChangeWaterHeight failed - continuing. {0} {1}",
  1532. e.Message, e.StackTrace);
  1533. }
  1534. }
  1535. }
  1536. }
  1537. public void TriggerAvatarKill(uint KillerObjectLocalID, ScenePresence DeadAvatar)
  1538. {
  1539. AvatarKillData handlerAvatarKill = OnAvatarKilled;
  1540. if (handlerAvatarKill != null)
  1541. {
  1542. foreach (AvatarKillData d in handlerAvatarKill.GetInvocationList())
  1543. {
  1544. try
  1545. {
  1546. d(KillerObjectLocalID, DeadAvatar);
  1547. }
  1548. catch (Exception e)
  1549. {
  1550. m_log.ErrorFormat(
  1551. "[EVENT MANAGER]: Delegate for TriggerAvatarKill failed - continuing. {0} {1}",
  1552. e.Message, e.StackTrace);
  1553. }
  1554. }
  1555. }
  1556. }
  1557. public void TriggerSignificantClientMovement(ScenePresence presence)
  1558. {
  1559. Action<ScenePresence> handlerSignificantClientMovement = OnSignificantClientMovement;
  1560. if (handlerSignificantClientMovement != null)
  1561. {
  1562. foreach (Action<ScenePresence> d in handlerSignificantClientMovement.GetInvocationList())
  1563. {
  1564. try
  1565. {
  1566. d(presence);
  1567. }
  1568. catch (Exception e)
  1569. {
  1570. m_log.ErrorFormat(
  1571. "[EVENT MANAGER]: Delegate for TriggerSignificantClientMovement failed - continuing. {0} {1}",
  1572. e.Message, e.StackTrace);
  1573. }
  1574. }
  1575. }
  1576. }
  1577. public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat)
  1578. {
  1579. ChatFromWorldEvent handlerChatFromWorld = OnChatFromWorld;
  1580. if (handlerChatFromWorld != null)
  1581. {
  1582. foreach (ChatFromWorldEvent d in handlerChatFromWorld.GetInvocationList())
  1583. {
  1584. try
  1585. {
  1586. d(sender, chat);
  1587. }
  1588. catch (Exception e)
  1589. {
  1590. m_log.ErrorFormat(
  1591. "[EVENT MANAGER]: Delegate for TriggerOnChatFromWorld failed - continuing. {0} {1}",
  1592. e.Message, e.StackTrace);
  1593. }
  1594. }
  1595. }
  1596. }
  1597. public void TriggerOnChatFromClient(Object sender, OSChatMessage chat)
  1598. {
  1599. ChatFromClientEvent handlerChatFromClient = OnChatFromClient;
  1600. if (handlerChatFromClient != null)
  1601. {
  1602. foreach (ChatFromClientEvent d in handlerChatFromClient.GetInvocationList())
  1603. {
  1604. try
  1605. {
  1606. d(sender, chat);
  1607. }
  1608. catch (Exception e)
  1609. {
  1610. m_log.ErrorFormat(
  1611. "[EVENT MANAGER]: Delegate for TriggerOnChatFromClient failed - continuing. {0} {1}",
  1612. e.Message, e.StackTrace);
  1613. }
  1614. }
  1615. }
  1616. }
  1617. public void TriggerOnChatToClients(
  1618. UUID senderID, HashSet<UUID> receiverIDs,
  1619. string message, ChatTypeEnum type, Vector3 fromPos, string fromName,
  1620. ChatSourceType src, ChatAudibleLevel level)
  1621. {
  1622. ChatToClientsEvent handler = OnChatToClients;
  1623. if (handler != null)
  1624. {
  1625. foreach (ChatToClientsEvent d in handler.GetInvocationList())
  1626. {
  1627. try
  1628. {
  1629. d(senderID, receiverIDs, message, type, fromPos, fromName, src, level);
  1630. }
  1631. catch (Exception e)
  1632. {
  1633. m_log.ErrorFormat(
  1634. "[EVENT MANAGER]: Delegate for TriggerOnChatToClients failed - continuing. {0} {1}",
  1635. e.Message, e.StackTrace);
  1636. }
  1637. }
  1638. }
  1639. }
  1640. public void TriggerOnChatBroadcast(Object sender, OSChatMessage chat)
  1641. {
  1642. ChatBroadcastEvent handlerChatBroadcast = OnChatBroadcast;
  1643. if (handlerChatBroadcast != null)
  1644. {
  1645. foreach (ChatBroadcastEvent d in handlerChatBroadcast.GetInvocationList())
  1646. {
  1647. try
  1648. {
  1649. d(sender, chat);
  1650. }
  1651. catch (Exception e)
  1652. {
  1653. m_log.ErrorFormat(
  1654. "[EVENT MANAGER]: Delegate for TriggerOnChatBroadcast failed - continuing. {0} {1}",
  1655. e.Message, e.StackTrace);
  1656. }
  1657. }
  1658. }
  1659. }
  1660. internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed)
  1661. {
  1662. ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent;
  1663. if (handlerScriptControlEvent != null)
  1664. {
  1665. foreach (ScriptControlEvent d in handlerScriptControlEvent.GetInvocationList())
  1666. {
  1667. try
  1668. {
  1669. d(scriptUUID, avatarID, held, _changed);
  1670. }
  1671. catch (Exception e)
  1672. {
  1673. m_log.ErrorFormat(
  1674. "[EVENT MANAGER]: Delegate for TriggerControlEvent failed - continuing. {0} {1}",
  1675. e.Message, e.StackTrace);
  1676. }
  1677. }
  1678. }
  1679. }
  1680. public void TriggerNoticeNoLandDataFromStorage()
  1681. {
  1682. NoticeNoLandDataFromStorage handlerNoticeNoLandDataFromStorage = OnNoticeNoLandDataFromStorage;
  1683. if (handlerNoticeNoLandDataFromStorage != null)
  1684. {
  1685. foreach (NoticeNoLandDataFromStorage d in handlerNoticeNoLandDataFromStorage.GetInvocationList())
  1686. {
  1687. try
  1688. {
  1689. d();
  1690. }
  1691. catch (Exception e)
  1692. {
  1693. m_log.ErrorFormat(
  1694. "[EVENT MANAGER]: Delegate for TriggerNoticeNoLandDataFromStorage failed - continuing. {0} {1}",
  1695. e.Message, e.StackTrace);
  1696. }
  1697. }
  1698. }
  1699. }
  1700. public void TriggerIncomingLandDataFromStorage(List<LandData> landData)
  1701. {
  1702. IncomingLandDataFromStorage handlerIncomingLandDataFromStorage = OnIncomingLandDataFromStorage;
  1703. if (handlerIncomingLandDataFromStorage != null)
  1704. {
  1705. foreach (IncomingLandDataFromStorage d in handlerIncomingLandDataFromStorage.GetInvocationList())
  1706. {
  1707. try
  1708. {
  1709. d(landData);
  1710. }
  1711. catch (Exception e)
  1712. {
  1713. m_log.ErrorFormat(
  1714. "[EVENT MANAGER]: Delegate for TriggerIncomingLandDataFromStorage failed - continuing. {0} {1}",
  1715. e.Message, e.StackTrace);
  1716. }
  1717. }
  1718. }
  1719. }
  1720. public void TriggerSetAllowForcefulBan(bool allow)
  1721. {
  1722. SetAllowForcefulBan handlerSetAllowForcefulBan = OnSetAllowForcefulBan;
  1723. if (handlerSetAllowForcefulBan != null)
  1724. {
  1725. foreach (SetAllowForcefulBan d in handlerSetAllowForcefulBan.GetInvocationList())
  1726. {
  1727. try
  1728. {
  1729. d(allow);
  1730. }
  1731. catch (Exception e)
  1732. {
  1733. m_log.ErrorFormat(
  1734. "[EVENT MANAGER]: Delegate for TriggerSetAllowForcefulBan failed - continuing. {0} {1}",
  1735. e.Message, e.StackTrace);
  1736. }
  1737. }
  1738. }
  1739. }
  1740. public void TriggerRequestParcelPrimCountUpdate()
  1741. {
  1742. RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = OnRequestParcelPrimCountUpdate;
  1743. if (handlerRequestParcelPrimCountUpdate != null)
  1744. {
  1745. foreach (RequestParcelPrimCountUpdate d in handlerRequestParcelPrimCountUpdate.GetInvocationList())
  1746. {
  1747. try
  1748. {
  1749. d();
  1750. }
  1751. catch (Exception e)
  1752. {
  1753. m_log.ErrorFormat(
  1754. "[EVENT MANAGER]: Delegate for TriggerRequestParcelPrimCountUpdate failed - continuing. {0} {1}",
  1755. e.Message, e.StackTrace);
  1756. }
  1757. }
  1758. }
  1759. }
  1760. public void TriggerParcelPrimCountTainted()
  1761. {
  1762. ParcelPrimCountTainted handlerParcelPrimCountTainted = OnParcelPrimCountTainted;
  1763. if (handlerParcelPrimCountTainted != null)
  1764. {
  1765. foreach (ParcelPrimCountTainted d in handlerParcelPrimCountTainted.GetInvocationList())
  1766. {
  1767. try
  1768. {
  1769. d();
  1770. }
  1771. catch (Exception e)
  1772. {
  1773. m_log.ErrorFormat(
  1774. "[EVENT MANAGER]: Delegate for TriggerParcelPrimCountTainted failed - continuing. {0} {1}",
  1775. e.Message, e.StackTrace);
  1776. }
  1777. }
  1778. }
  1779. }
  1780. // this lets us keep track of nasty script events like timer, etc.
  1781. public void TriggerTimerEvent(uint objLocalID, double Interval)
  1782. {
  1783. 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");
  1784. //handlerScriptTimerEvent = OnScriptTimerEvent;
  1785. //if (handlerScriptTimerEvent != null)
  1786. //{
  1787. // handlerScriptTimerEvent(objLocalID, Interval);
  1788. //}
  1789. }
  1790. /// <summary>
  1791. /// Updates the system as to how the position of the sun should be handled.
  1792. /// </summary>
  1793. /// <param name="regionHandle"></param>
  1794. /// <param name="FixedTime">True if the Sun Position is fixed</param>
  1795. /// <param name="useEstateTime">True if the Estate Settings should be used instead of region</param>
  1796. /// <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>
  1797. public void TriggerEstateToolsSunUpdate(ulong regionHandle, bool FixedTime, bool useEstateTime, float FixedSunHour)
  1798. {
  1799. EstateToolsSunUpdate handlerEstateToolsSunUpdate = OnEstateToolsSunUpdate;
  1800. if (handlerEstateToolsSunUpdate != null)
  1801. {
  1802. foreach (EstateToolsSunUpdate d in handlerEstateToolsSunUpdate.GetInvocationList())
  1803. {
  1804. try
  1805. {
  1806. d(regionHandle, FixedTime, useEstateTime, FixedSunHour);
  1807. }
  1808. catch (Exception e)
  1809. {
  1810. m_log.ErrorFormat(
  1811. "[EVENT MANAGER]: Delegate for TriggerEstateToolsSunUpdate failed - continuing. {0} {1}",
  1812. e.Message, e.StackTrace);
  1813. }
  1814. }
  1815. }
  1816. }
  1817. public float GetCurrentTimeAsSunLindenHour()
  1818. {
  1819. SunLindenHour handlerCurrentTimeAsLindenSunHour = OnGetCurrentTimeAsLindenSunHour;
  1820. if (handlerCurrentTimeAsLindenSunHour != null)
  1821. {
  1822. foreach (SunLindenHour d in handlerCurrentTimeAsLindenSunHour.GetInvocationList())
  1823. {
  1824. try
  1825. {
  1826. return d();
  1827. }
  1828. catch (Exception e)
  1829. {
  1830. m_log.ErrorFormat(
  1831. "[EVENT MANAGER]: Delegate for TriggerOnAttach failed - continuing. {0} {1}",
  1832. e.Message, e.StackTrace);
  1833. }
  1834. }
  1835. }
  1836. return 6;
  1837. }
  1838. public void TriggerOarFileLoaded(Guid requestId, string message)
  1839. {
  1840. OarFileLoaded handlerOarFileLoaded = OnOarFileLoaded;
  1841. if (handlerOarFileLoaded != null)
  1842. {
  1843. foreach (OarFileLoaded d in handlerOarFileLoaded.GetInvocationList())
  1844. {
  1845. try
  1846. {
  1847. d(requestId, message);
  1848. }
  1849. catch (Exception e)
  1850. {
  1851. m_log.ErrorFormat(
  1852. "[EVENT MANAGER]: Delegate for TriggerOarFileLoaded failed - continuing. {0} {1}",
  1853. e.Message, e.StackTrace);
  1854. }
  1855. }
  1856. }
  1857. }
  1858. public void TriggerOarFileSaved(Guid requestId, string message)
  1859. {
  1860. OarFileSaved handlerOarFileSaved = OnOarFileSaved;
  1861. if (handlerOarFileSaved != null)
  1862. {
  1863. foreach (OarFileSaved d in handlerOarFileSaved.GetInvocationList())
  1864. {
  1865. try
  1866. {
  1867. d(requestId, message);
  1868. }
  1869. catch (Exception e)
  1870. {
  1871. m_log.ErrorFormat(
  1872. "[EVENT MANAGER]: Delegate for TriggerOarFileSaved failed - continuing. {0} {1}",
  1873. e.Message, e.StackTrace);
  1874. }
  1875. }
  1876. }
  1877. }
  1878. public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
  1879. {
  1880. EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = OnEmptyScriptCompileQueue;
  1881. if (handlerEmptyScriptCompileQueue != null)
  1882. {
  1883. foreach (EmptyScriptCompileQueue d in handlerEmptyScriptCompileQueue.GetInvocationList())
  1884. {
  1885. try
  1886. {
  1887. d(numScriptsFailed, message);
  1888. }
  1889. catch (Exception e)
  1890. {
  1891. m_log.ErrorFormat(
  1892. "[EVENT MANAGER]: Delegate for TriggerEmptyScriptCompileQueue failed - continuing. {0} {1}",
  1893. e.Message, e.StackTrace);
  1894. }
  1895. }
  1896. }
  1897. }
  1898. public void TriggerScriptCollidingStart(uint localId, ColliderArgs colliders)
  1899. {
  1900. ScriptColliding handlerCollidingStart = OnScriptColliderStart;
  1901. if (handlerCollidingStart != null)
  1902. {
  1903. foreach (ScriptColliding d in handlerCollidingStart.GetInvocationList())
  1904. {
  1905. try
  1906. {
  1907. d(localId, colliders);
  1908. }
  1909. catch (Exception e)
  1910. {
  1911. m_log.ErrorFormat(
  1912. "[EVENT MANAGER]: Delegate for TriggerScriptCollidingStart failed - continuing. {0} {1}",
  1913. e.Message, e.StackTrace);
  1914. }
  1915. }
  1916. }
  1917. }
  1918. public void TriggerScriptColliding(uint localId, ColliderArgs colliders)
  1919. {
  1920. ScriptColliding handlerColliding = OnScriptColliding;
  1921. if (handlerColliding != null)
  1922. {
  1923. foreach (ScriptColliding d in handlerColliding.GetInvocationList())
  1924. {
  1925. try
  1926. {
  1927. d(localId, colliders);
  1928. }
  1929. catch (Exception e)
  1930. {
  1931. m_log.ErrorFormat(
  1932. "[EVENT MANAGER]: Delegate for TriggerScriptColliding failed - continuing. {0} {1}",
  1933. e.Message, e.StackTrace);
  1934. }
  1935. }
  1936. }
  1937. }
  1938. public void TriggerScriptCollidingEnd(uint localId, ColliderArgs colliders)
  1939. {
  1940. ScriptColliding handlerCollidingEnd = OnScriptCollidingEnd;
  1941. if (handlerCollidingEnd != null)
  1942. {
  1943. foreach (ScriptColliding d in handlerCollidingEnd.GetInvocationList())
  1944. {
  1945. try
  1946. {
  1947. d(localId, colliders);
  1948. }
  1949. catch (Exception e)
  1950. {
  1951. m_log.ErrorFormat(
  1952. "[EVENT MANAGER]: Delegate for TriggerScriptCollidingEnd failed - continuing. {0} {1}",
  1953. e.Message, e.StackTrace);
  1954. }
  1955. }
  1956. }
  1957. }
  1958. public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
  1959. {
  1960. ScriptColliding handlerLandCollidingStart = OnScriptLandColliderStart;
  1961. if (handlerLandCollidingStart != null)
  1962. {
  1963. foreach (ScriptColliding d in handlerLandCollidingStart.GetInvocationList())
  1964. {
  1965. try
  1966. {
  1967. d(localId, colliders);
  1968. }
  1969. catch (Exception e)
  1970. {
  1971. m_log.ErrorFormat(
  1972. "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingStart failed - continuing. {0} {1}",
  1973. e.Message, e.StackTrace);
  1974. }
  1975. }
  1976. }
  1977. }
  1978. public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
  1979. {
  1980. ScriptColliding handlerLandColliding = OnScriptLandColliding;
  1981. if (handlerLandColliding != null)
  1982. {
  1983. foreach (ScriptColliding d in handlerLandColliding.GetInvocationList())
  1984. {
  1985. try
  1986. {
  1987. d(localId, colliders);
  1988. }
  1989. catch (Exception e)
  1990. {
  1991. m_log.ErrorFormat(
  1992. "[EVENT MANAGER]: Delegate for TriggerScriptLandColliding failed - continuing. {0} {1}",
  1993. e.Message, e.StackTrace);
  1994. }
  1995. }
  1996. }
  1997. }
  1998. public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
  1999. {
  2000. ScriptColliding handlerLandCollidingEnd = OnScriptLandColliderEnd;
  2001. if (handlerLandCollidingEnd != null)
  2002. {
  2003. foreach (ScriptColliding d in handlerLandCollidingEnd.GetInvocationList())
  2004. {
  2005. try
  2006. {
  2007. d(localId, colliders);
  2008. }
  2009. catch (Exception e)
  2010. {
  2011. m_log.ErrorFormat(
  2012. "[EVENT MANAGER]: Delegate for TriggerScriptLandCollidingEnd failed - continuing. {0} {1}",
  2013. e.Message, e.StackTrace);
  2014. }
  2015. }
  2016. }
  2017. }
  2018. public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
  2019. {
  2020. OnSetRootAgentSceneDelegate handlerSetRootAgentScene = OnSetRootAgentScene;
  2021. if (handlerSetRootAgentScene != null)
  2022. {
  2023. foreach (OnSetRootAgentSceneDelegate d in handlerSetRootAgentScene.GetInvocationList())
  2024. {
  2025. try
  2026. {
  2027. d(agentID, scene);
  2028. }
  2029. catch (Exception e)
  2030. {
  2031. m_log.ErrorFormat(
  2032. "[EVENT MANAGER]: Delegate for TriggerSetRootAgentScene failed - continuing. {0} {1}",
  2033. e.Message, e.StackTrace);
  2034. }
  2035. }
  2036. }
  2037. }
  2038. public void TriggerOnRegionUp(GridRegion otherRegion)
  2039. {
  2040. RegionUp handlerOnRegionUp = OnRegionUp;
  2041. if (handlerOnRegionUp != null)
  2042. {
  2043. foreach (RegionUp d in handlerOnRegionUp.GetInvocationList())
  2044. {
  2045. try
  2046. {
  2047. d(otherRegion);
  2048. }
  2049. catch (Exception e)
  2050. {
  2051. m_log.ErrorFormat(
  2052. "[EVENT MANAGER]: Delegate for TriggerOnRegionUp failed - continuing. {0} {1}",
  2053. e.Message, e.StackTrace);
  2054. }
  2055. }
  2056. }
  2057. }
  2058. public void TriggerOnSceneObjectLoaded(SceneObjectGroup so)
  2059. {
  2060. SceneObjectDelegate handler = OnSceneObjectLoaded;
  2061. if (handler != null)
  2062. {
  2063. foreach (SceneObjectDelegate d in handler.GetInvocationList())
  2064. {
  2065. try
  2066. {
  2067. d(so);
  2068. }
  2069. catch (Exception e)
  2070. {
  2071. m_log.ErrorFormat(
  2072. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectLoaded failed - continuing. {0} {1}",
  2073. e.Message, e.StackTrace);
  2074. }
  2075. }
  2076. }
  2077. }
  2078. public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
  2079. {
  2080. SceneObjectPreSaveDelegate handler = OnSceneObjectPreSave;
  2081. if (handler != null)
  2082. {
  2083. foreach (SceneObjectPreSaveDelegate d in handler.GetInvocationList())
  2084. {
  2085. try
  2086. {
  2087. d(persistingSo, originalSo);
  2088. }
  2089. catch (Exception e)
  2090. {
  2091. m_log.ErrorFormat(
  2092. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPreSave failed - continuing. {0} {1}",
  2093. e.Message, e.StackTrace);
  2094. }
  2095. }
  2096. }
  2097. }
  2098. public void TriggerOnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
  2099. {
  2100. SceneObjectPartCopyDelegate handler = OnSceneObjectPartCopy;
  2101. if (handler != null)
  2102. {
  2103. foreach (SceneObjectPartCopyDelegate d in handler.GetInvocationList())
  2104. {
  2105. try
  2106. {
  2107. d(copy, original, userExposed);
  2108. }
  2109. catch (Exception e)
  2110. {
  2111. m_log.ErrorFormat(
  2112. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
  2113. e.Message, e.StackTrace);
  2114. }
  2115. }
  2116. }
  2117. }
  2118. public void TriggerSceneObjectPartUpdated(SceneObjectPart sop)
  2119. {
  2120. SceneObjectPartUpdated handler = OnSceneObjectPartUpdated;
  2121. if (handler != null)
  2122. {
  2123. foreach (SceneObjectPartUpdated d in handler.GetInvocationList())
  2124. {
  2125. try
  2126. {
  2127. d(sop);
  2128. }
  2129. catch (Exception e)
  2130. {
  2131. m_log.ErrorFormat(
  2132. "[EVENT MANAGER]: Delegate for TriggerSceneObjectPartUpdated failed - continuing. {0} {1}",
  2133. e.Message, e.StackTrace);
  2134. }
  2135. }
  2136. }
  2137. }
  2138. public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
  2139. int local_id, IClientAPI remote_client)
  2140. {
  2141. ParcelPropertiesUpdateRequest handler = OnParcelPropertiesUpdateRequest;
  2142. if (handler != null)
  2143. {
  2144. foreach (ParcelPropertiesUpdateRequest d in handler.GetInvocationList())
  2145. {
  2146. try
  2147. {
  2148. d(args, local_id, remote_client);
  2149. }
  2150. catch (Exception e)
  2151. {
  2152. m_log.ErrorFormat(
  2153. "[EVENT MANAGER]: Delegate for TriggerOnSceneObjectPartCopy failed - continuing. {0} {1}",
  2154. e.Message, e.StackTrace);
  2155. }
  2156. }
  2157. }
  2158. }
  2159. public void TriggerSceneShuttingDown(Scene s)
  2160. {
  2161. Action<Scene> handler = OnSceneShuttingDown;
  2162. if (handler != null)
  2163. {
  2164. foreach (Action<Scene> d in handler.GetInvocationList())
  2165. {
  2166. try
  2167. {
  2168. d(s);
  2169. }
  2170. catch (Exception e)
  2171. {
  2172. m_log.ErrorFormat(
  2173. "[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
  2174. e.Message, e.StackTrace);
  2175. }
  2176. }
  2177. }
  2178. }
  2179. public void TriggerOnRegionStarted(Scene scene)
  2180. {
  2181. RegionStarted handler = OnRegionStarted;
  2182. if (handler != null)
  2183. {
  2184. foreach (RegionStarted d in handler.GetInvocationList())
  2185. {
  2186. try
  2187. {
  2188. d(scene);
  2189. }
  2190. catch (Exception e)
  2191. {
  2192. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for RegionStarted failed - continuing {0} - {1}",
  2193. e.Message, e.StackTrace);
  2194. }
  2195. }
  2196. }
  2197. }
  2198. public void TriggerRegionHeartbeatEnd(Scene scene)
  2199. {
  2200. RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
  2201. if (handler != null)
  2202. {
  2203. foreach (RegionHeartbeatEnd d in handler.GetInvocationList())
  2204. {
  2205. try
  2206. {
  2207. d(scene);
  2208. }
  2209. catch (Exception e)
  2210. {
  2211. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatEnd failed - continuing {0} - {1}",
  2212. e.Message, e.StackTrace);
  2213. }
  2214. }
  2215. }
  2216. }
  2217. public void TriggerRegionLoginsStatusChange(IScene scene)
  2218. {
  2219. RegionLoginsStatusChange handler = OnRegionLoginsStatusChange;
  2220. if (handler != null)
  2221. {
  2222. foreach (RegionLoginsStatusChange d in handler.GetInvocationList())
  2223. {
  2224. try
  2225. {
  2226. d(scene);
  2227. }
  2228. catch (Exception e)
  2229. {
  2230. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}",
  2231. e.Message, e.StackTrace);
  2232. }
  2233. }
  2234. }
  2235. }
  2236. public void TriggerRegionReadyStatusChange(IScene scene)
  2237. {
  2238. Action<IScene> handler = OnRegionReadyStatusChange;
  2239. if (handler != null)
  2240. {
  2241. foreach (Action<IScene> d in handler.GetInvocationList())
  2242. {
  2243. try
  2244. {
  2245. d(scene);
  2246. }
  2247. catch (Exception e)
  2248. {
  2249. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}",
  2250. e.Message, e.StackTrace);
  2251. }
  2252. }
  2253. }
  2254. }
  2255. public void TriggerPrimsLoaded(Scene s)
  2256. {
  2257. PrimsLoaded handler = OnPrimsLoaded;
  2258. if (handler != null)
  2259. {
  2260. foreach (PrimsLoaded d in handler.GetInvocationList())
  2261. {
  2262. try
  2263. {
  2264. d(s);
  2265. }
  2266. catch (Exception e)
  2267. {
  2268. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for PrimsLoaded failed - continuing {0} - {1}",
  2269. e.Message, e.StackTrace);
  2270. }
  2271. }
  2272. }
  2273. }
  2274. public void TriggerTeleportStart(IClientAPI client, GridRegion destination, GridRegion finalDestination, uint teleportFlags, bool gridLogout)
  2275. {
  2276. TeleportStart handler = OnTeleportStart;
  2277. if (handler != null)
  2278. {
  2279. foreach (TeleportStart d in handler.GetInvocationList())
  2280. {
  2281. try
  2282. {
  2283. d(client, destination, finalDestination, teleportFlags, gridLogout);
  2284. }
  2285. catch (Exception e)
  2286. {
  2287. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportStart failed - continuing {0} - {1}",
  2288. e.Message, e.StackTrace);
  2289. }
  2290. }
  2291. }
  2292. }
  2293. public void TriggerTeleportFail(IClientAPI client, bool gridLogout)
  2294. {
  2295. TeleportFail handler = OnTeleportFail;
  2296. if (handler != null)
  2297. {
  2298. foreach (TeleportFail d in handler.GetInvocationList())
  2299. {
  2300. try
  2301. {
  2302. d(client, gridLogout);
  2303. }
  2304. catch (Exception e)
  2305. {
  2306. m_log.ErrorFormat("[EVENT MANAGER]: Delegate for TeleportFail failed - continuing {0} - {1}",
  2307. e.Message, e.StackTrace);
  2308. }
  2309. }
  2310. }
  2311. }
  2312. }
  2313. }