MXPClientView.cs 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541
  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.Net;
  30. using System.Reflection;
  31. using System.Text;
  32. using log4net;
  33. using MXP;
  34. using MXP.Messages;
  35. using OpenMetaverse;
  36. using OpenMetaverse.Packets;
  37. using OpenSim.Framework;
  38. using OpenSim.Framework.Client;
  39. using Packet=OpenMetaverse.Packets.Packet;
  40. using MXP.Extentions.OpenMetaverseFragments.Proto;
  41. using MXP.Util;
  42. using MXP.Fragments;
  43. namespace OpenSim.Client.MXP.ClientStack
  44. {
  45. class MXPClientView : IClientAPI, IClientCore
  46. {
  47. internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  48. #region Constants
  49. private Vector3 FORWARD = new Vector3(1, 0, 0);
  50. private Vector3 BACKWARD = new Vector3(-1, 0, 0);
  51. private Vector3 LEFT = new Vector3(0, 1, 0);
  52. private Vector3 RIGHT = new Vector3(0, -1, 0);
  53. private Vector3 UP = new Vector3(0, 0, 1);
  54. private Vector3 DOWN = new Vector3(0, 0, -1);
  55. #endregion
  56. #region Fields
  57. private readonly Session m_session;
  58. private readonly UUID m_sessionID;
  59. private readonly UUID m_userID;
  60. private readonly IScene m_scene;
  61. private readonly string m_firstName;
  62. private readonly string m_lastName;
  63. private Vector3 m_startPosition=new Vector3(128f, 128f, 128f);
  64. private int m_debugLevel;
  65. #endregion
  66. #region Properties
  67. public Session Session
  68. {
  69. get { return m_session; }
  70. }
  71. public Vector3 StartPos
  72. {
  73. get { return m_startPosition; }
  74. set { m_startPosition = value; }
  75. }
  76. public UUID AgentId
  77. {
  78. get { return m_userID; }
  79. }
  80. public UUID SessionId
  81. {
  82. get { return m_sessionID; }
  83. }
  84. public UUID SecureSessionId
  85. {
  86. get { return m_sessionID; }
  87. }
  88. public UUID ActiveGroupId
  89. {
  90. get { return UUID.Zero; }
  91. }
  92. public string ActiveGroupName
  93. {
  94. get { return ""; }
  95. }
  96. public ulong ActiveGroupPowers
  97. {
  98. get { return 0; }
  99. }
  100. public ulong GetGroupPowers(UUID groupID)
  101. {
  102. return 0;
  103. }
  104. public bool IsGroupMember(UUID GroupID)
  105. {
  106. return false;
  107. }
  108. public string FirstName
  109. {
  110. get { return m_firstName; }
  111. }
  112. public string LastName
  113. {
  114. get { return m_lastName; }
  115. }
  116. public IScene Scene
  117. {
  118. get { return m_scene; }
  119. }
  120. public int NextAnimationSequenceNumber
  121. {
  122. get { return 0; }
  123. }
  124. public string Name
  125. {
  126. get { return FirstName; }
  127. }
  128. public bool IsActive
  129. {
  130. get { return Session.SessionState == SessionState.Connected; }
  131. set
  132. {
  133. if (!value)
  134. Stop();
  135. }
  136. }
  137. #endregion
  138. #region Constructors
  139. public MXPClientView(Session mxpSession, UUID mxpSessionID, UUID userID, IScene mxpHostBubble, string mxpFirstName, string mxpLastName)
  140. {
  141. this.m_session = mxpSession;
  142. this.m_userID = userID;
  143. this.m_firstName = mxpFirstName;
  144. this.m_lastName = mxpLastName;
  145. this.m_scene = mxpHostBubble;
  146. this.m_sessionID = mxpSessionID;
  147. }
  148. #endregion
  149. #region MXP Incoming Message Processing
  150. public void MXPPRocessMessage(Message message)
  151. {
  152. if (message.GetType() == typeof(ModifyRequestMessage))
  153. {
  154. MXPProcessModifyRequest((ModifyRequestMessage)message);
  155. }
  156. else
  157. {
  158. m_log.Warn("[MXP] Received messaged unhandled: " + message);
  159. }
  160. }
  161. private void MXPProcessModifyRequest(ModifyRequestMessage modifyRequest)
  162. {
  163. m_log.Debug("Received modify request for: " + modifyRequest.ObjectFragment.ObjectName);
  164. ObjectFragment objectFragment=modifyRequest.ObjectFragment;
  165. if (objectFragment.ObjectId == m_userID.Guid)
  166. {
  167. OmAvatarExt avatarExt = modifyRequest.GetExtension<OmAvatarExt>();
  168. AgentUpdateArgs agentUpdate = new AgentUpdateArgs();
  169. agentUpdate.AgentID = new UUID(objectFragment.ObjectId);
  170. agentUpdate.SessionID = m_sessionID;
  171. agentUpdate.State = (byte)avatarExt.State;
  172. Quaternion avatarOrientation = FromOmQuaternion(objectFragment.Orientation);
  173. if (avatarOrientation.X == 0 && avatarOrientation.Y == 0 && avatarOrientation.Z == 0 && avatarOrientation.W == 0)
  174. {
  175. avatarOrientation = Quaternion.Identity;
  176. }
  177. Vector3 avatarLocation=FromOmVector(objectFragment.Location);
  178. if (avatarExt.MovementDirection != null)
  179. {
  180. Vector3 direction = FromOmVector(avatarExt.MovementDirection);
  181. direction = direction * Quaternion.Inverse(avatarOrientation);
  182. if ((direction - FORWARD).Length() < 0.5)
  183. {
  184. agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
  185. }
  186. if ((direction - BACKWARD).Length() < 0.5)
  187. {
  188. agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG;
  189. }
  190. if ((direction - LEFT).Length() < 0.5)
  191. {
  192. agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS;
  193. }
  194. if ((direction - RIGHT).Length() < 0.5)
  195. {
  196. agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG;
  197. }
  198. if ((direction - UP).Length() < 0.5)
  199. {
  200. agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
  201. }
  202. if ((direction - DOWN).Length() < 0.5)
  203. {
  204. agentUpdate.ControlFlags += (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG;
  205. }
  206. }
  207. if (avatarExt.TargetOrientation != null)
  208. {
  209. agentUpdate.BodyRotation = FromOmQuaternion(avatarExt.TargetOrientation);
  210. }
  211. else
  212. {
  213. agentUpdate.BodyRotation = FromOmQuaternion(objectFragment.Orientation);
  214. }
  215. if (avatarExt.Body != null)
  216. {
  217. agentUpdate.HeadRotation = FromOmQuaternion(avatarExt.Body.HeadOrientation);
  218. }
  219. else
  220. {
  221. agentUpdate.HeadRotation = Quaternion.Identity;
  222. }
  223. if (avatarExt.Camera != null)
  224. {
  225. Quaternion cameraOrientation = FromOmQuaternion(avatarExt.Camera.Orientation);
  226. agentUpdate.CameraCenter = FromOmVector(avatarExt.Camera.Location);
  227. agentUpdate.CameraAtAxis = FORWARD * cameraOrientation;
  228. agentUpdate.CameraLeftAxis = LEFT * cameraOrientation;
  229. agentUpdate.CameraUpAxis = UP * cameraOrientation;
  230. }
  231. else
  232. {
  233. agentUpdate.CameraCenter = avatarLocation;
  234. agentUpdate.CameraAtAxis = FORWARD * avatarOrientation;
  235. agentUpdate.CameraLeftAxis = LEFT * avatarOrientation;
  236. agentUpdate.CameraUpAxis = UP * avatarOrientation;
  237. }
  238. OnAgentUpdate(this, agentUpdate);
  239. ModifyResponseMessage modifyResponse = new ModifyResponseMessage();
  240. modifyResponse.FailureCode = MxpResponseCodes.SUCCESS;
  241. modifyResponse.RequestMessageId = modifyRequest.MessageId;
  242. m_session.Send(modifyResponse);
  243. }
  244. else
  245. {
  246. ModifyResponseMessage modifyResponse = new ModifyResponseMessage();
  247. modifyResponse.FailureCode = MxpResponseCodes.UNAUTHORIZED_OPERATION;
  248. modifyResponse.RequestMessageId = modifyRequest.MessageId;
  249. m_session.Send(modifyResponse);
  250. }
  251. }
  252. #endregion
  253. #region MXP Outgoing Message Processing
  254. private void MXPSendPrimitive(uint localID, UUID ownerID, Vector3 acc, Vector3 rvel, PrimitiveBaseShape primShape, Vector3 pos, UUID objectID, Vector3 vel, Quaternion rotation, uint flags, string text, byte[] textColor, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim)
  255. {
  256. String typeName = ToOmType(primShape.PCode);
  257. m_log.Info("[MXP] Transmitting Primitive" + typeName);
  258. PerceptionEventMessage pe = new PerceptionEventMessage();
  259. pe.ObjectFragment.ObjectId = objectID.Guid;
  260. // TODO Resolve ParentID
  261. pe.ObjectFragment.ParentObjectId = Guid.Empty;
  262. pe.ObjectFragment.ObjectIndex = localID;
  263. pe.ObjectFragment.ObjectName = typeName + " Object";
  264. pe.ObjectFragment.OwnerId = ownerID.Guid;
  265. pe.ObjectFragment.TypeId = Guid.Empty;
  266. pe.ObjectFragment.TypeName = typeName;
  267. pe.ObjectFragment.Acceleration = new float[] { acc.X, acc.Y, acc.Z };
  268. pe.ObjectFragment.AngularAcceleration = new float[4];
  269. pe.ObjectFragment.AngularVelocity = new float[] { rvel.X, rvel.Y, rvel.Z, 0.0f };
  270. pe.ObjectFragment.BoundingSphereRadius = primShape.Scale.Length();
  271. pe.ObjectFragment.Location = new float[] { pos.X, pos.Y, pos.Z };
  272. pe.ObjectFragment.Mass = 1.0f;
  273. pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
  274. pe.ObjectFragment.Velocity = new float[] { vel.X, vel.Y, vel.Z };
  275. OmSlPrimitiveExt ext = new OmSlPrimitiveExt();
  276. if (!((primShape.PCode == (byte)PCode.NewTree) || (primShape.PCode == (byte)PCode.Tree) || (primShape.PCode == (byte)PCode.Grass)))
  277. {
  278. ext.PathBegin = primShape.PathBegin;
  279. ext.PathEnd = primShape.PathEnd;
  280. ext.PathScaleX = primShape.PathScaleX;
  281. ext.PathScaleY = primShape.PathScaleY;
  282. ext.PathShearX = primShape.PathShearX;
  283. ext.PathShearY = primShape.PathShearY;
  284. ext.PathSkew = primShape.PathSkew;
  285. ext.ProfileBegin = primShape.ProfileBegin;
  286. ext.ProfileEnd = primShape.ProfileEnd;
  287. ext.PathCurve = primShape.PathCurve;
  288. ext.ProfileCurve = primShape.ProfileCurve;
  289. ext.ProfileHollow = primShape.ProfileHollow;
  290. ext.PathRadiusOffset = primShape.PathRadiusOffset;
  291. ext.PathRevolutions = primShape.PathRevolutions;
  292. ext.PathTaperX = primShape.PathTaperX;
  293. ext.PathTaperY = primShape.PathTaperY;
  294. ext.PathTwist = primShape.PathTwist;
  295. ext.PathTwistBegin = primShape.PathTwistBegin;
  296. }
  297. ext.UpdateFlags = flags;
  298. ext.ExtraParams = primShape.ExtraParams;
  299. ext.State = primShape.State;
  300. ext.TextureEntry = primShape.TextureEntry;
  301. ext.TextureAnim = textureanim;
  302. ext.Scale = ToOmVector(primShape.Scale);
  303. ext.Text = text;
  304. ext.TextColor = ToOmColor(textColor);
  305. ext.PSBlock = particleSystem;
  306. ext.ClickAction = clickAction;
  307. ext.Material = material;
  308. pe.SetExtension<OmSlPrimitiveExt>(ext);
  309. Session.Send(pe);
  310. }
  311. public void MXPSendAvatarData(string participantName, UUID ownerID, UUID parentId, UUID avatarID, uint avatarLocalID, Vector3 position, Quaternion rotation)
  312. {
  313. m_log.Info("[MXP] Transmitting Avatar Data " + participantName);
  314. PerceptionEventMessage pe = new PerceptionEventMessage();
  315. pe.ObjectFragment.ObjectId = avatarID.Guid;
  316. // TODO Resolve ParentID
  317. pe.ObjectFragment.ParentObjectId = parentId.Guid;
  318. pe.ObjectFragment.ObjectIndex = avatarLocalID;
  319. pe.ObjectFragment.ObjectName = participantName;
  320. pe.ObjectFragment.OwnerId = ownerID.Guid;
  321. pe.ObjectFragment.TypeId = Guid.Empty;
  322. pe.ObjectFragment.TypeName = "Avatar";
  323. pe.ObjectFragment.Acceleration = new float[3];
  324. pe.ObjectFragment.AngularAcceleration = new float[4];
  325. pe.ObjectFragment.AngularVelocity = new float[4];
  326. pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value
  327. pe.ObjectFragment.Location = new float[] { position.X, position.Y, position.Z };
  328. pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value
  329. pe.ObjectFragment.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
  330. pe.ObjectFragment.Velocity = new float[3];
  331. Session.Send(pe);
  332. }
  333. public void MXPSendTerrain(float[] map)
  334. {
  335. m_log.Info("[MXP] Transmitting terrain for " + m_scene.RegionInfo.RegionName);
  336. PerceptionEventMessage pe = new PerceptionEventMessage();
  337. // Hacking terrain object uuid to zero and index to hashcode of regionuuid
  338. pe.ObjectFragment.ObjectId = m_scene.RegionInfo.RegionSettings.RegionUUID.Guid;
  339. pe.ObjectFragment.ObjectIndex = (uint)(m_scene.RegionInfo.RegionSettings.RegionUUID.GetHashCode() + ((long)int.MaxValue) / 2);
  340. pe.ObjectFragment.ParentObjectId = UUID.Zero.Guid;
  341. pe.ObjectFragment.ObjectName = "Terrain of " + m_scene.RegionInfo.RegionName;
  342. pe.ObjectFragment.OwnerId = m_scene.RegionInfo.MasterAvatarAssignedUUID.Guid;
  343. pe.ObjectFragment.TypeId = Guid.Empty;
  344. pe.ObjectFragment.TypeName = "Terrain";
  345. pe.ObjectFragment.Acceleration = new float[3];
  346. pe.ObjectFragment.AngularAcceleration = new float[4];
  347. pe.ObjectFragment.AngularVelocity = new float[4];
  348. pe.ObjectFragment.BoundingSphereRadius = 1; // TODO Fill in appropriate value
  349. pe.ObjectFragment.Location = new float[] { 0, 0, 0 };
  350. pe.ObjectFragment.Mass = 1.0f; // TODO Fill in appropriate value
  351. pe.ObjectFragment.Orientation = new float[] { 0, 0, 0, 0 };
  352. pe.ObjectFragment.Velocity = new float[3];
  353. OmBitmapTerrainExt terrainExt = new OmBitmapTerrainExt();
  354. terrainExt.Width = 256;
  355. terrainExt.Height = 256;
  356. terrainExt.WaterLevel = (float) m_scene.RegionInfo.RegionSettings.WaterHeight;
  357. terrainExt.Offset = 0;
  358. terrainExt.Scale = 10;
  359. terrainExt.HeightMap = CompressionUtil.CompressHeightMap(map, 0, 10);
  360. pe.SetExtension<OmBitmapTerrainExt>(terrainExt);
  361. Session.Send(pe);
  362. }
  363. #endregion
  364. #region MXP Conversions
  365. private OmVector3f ToOmVector(Vector3 value)
  366. {
  367. OmVector3f encodedValue = new OmVector3f();
  368. encodedValue.X = value.X;
  369. encodedValue.Y = value.Y;
  370. encodedValue.Z = value.Z;
  371. return encodedValue;
  372. }
  373. private Vector3 FromOmVector(OmVector3f vector)
  374. {
  375. return new Vector3(vector.X, vector.Y, vector.Z);
  376. }
  377. private Vector3 FromOmVector(float[] vector)
  378. {
  379. return new Vector3(vector[0], vector[1], vector[2]);
  380. }
  381. private Quaternion FromOmQuaternion(OmQuaternion4f quaternion)
  382. {
  383. return new Quaternion(quaternion.X, quaternion.Y, quaternion.Z, quaternion.W);
  384. }
  385. private Quaternion FromOmQuaternion(float[] quaternion)
  386. {
  387. return new Quaternion(quaternion[0], quaternion[1], quaternion[2], quaternion[3]);
  388. }
  389. private OmColor4f ToOmColor(byte[] value)
  390. {
  391. OmColor4f encodedValue = new OmColor4f();
  392. encodedValue.R = value[0];
  393. encodedValue.G = value[1];
  394. encodedValue.B = value[2];
  395. encodedValue.A = value[3];
  396. return encodedValue;
  397. }
  398. private string ToOmType(byte value)
  399. {
  400. if (value == (byte)PCodeEnum.Avatar)
  401. {
  402. return "Avatar";
  403. }
  404. if (value == (byte)PCodeEnum.Grass)
  405. {
  406. return "Grass";
  407. }
  408. if (value == (byte)PCodeEnum.NewTree)
  409. {
  410. return "NewTree";
  411. }
  412. if (value == (byte)PCodeEnum.ParticleSystem)
  413. {
  414. return "ParticleSystem";
  415. }
  416. if (value == (byte)PCodeEnum.Primitive)
  417. {
  418. return "Primitive";
  419. }
  420. if (value == (byte)PCodeEnum.Tree)
  421. {
  422. return "Tree";
  423. }
  424. throw new Exception("Unsupported PCode value: " + value);
  425. }
  426. #endregion
  427. #region OpenSim Event Handlers
  428. #pragma warning disable 67
  429. public event GenericMessage OnGenericMessage;
  430. public event ImprovedInstantMessage OnInstantMessage;
  431. public event ChatMessage OnChatFromClient;
  432. public event TextureRequest OnRequestTexture;
  433. public event RezObject OnRezObject;
  434. public event ModifyTerrain OnModifyTerrain;
  435. public event BakeTerrain OnBakeTerrain;
  436. public event EstateChangeInfo OnEstateChangeInfo;
  437. public event SetAppearance OnSetAppearance;
  438. public event AvatarNowWearing OnAvatarNowWearing;
  439. public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
  440. public event UUIDNameRequest OnDetachAttachmentIntoInv;
  441. public event ObjectAttach OnObjectAttach;
  442. public event ObjectDeselect OnObjectDetach;
  443. public event ObjectDrop OnObjectDrop;
  444. public event StartAnim OnStartAnim;
  445. public event StopAnim OnStopAnim;
  446. public event LinkObjects OnLinkObjects;
  447. public event DelinkObjects OnDelinkObjects;
  448. public event RequestMapBlocks OnRequestMapBlocks;
  449. public event RequestMapName OnMapNameRequest;
  450. public event TeleportLocationRequest OnTeleportLocationRequest;
  451. public event DisconnectUser OnDisconnectUser;
  452. public event RequestAvatarProperties OnRequestAvatarProperties;
  453. public event SetAlwaysRun OnSetAlwaysRun;
  454. public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
  455. public event DeRezObject OnDeRezObject;
  456. public event Action<IClientAPI> OnRegionHandShakeReply;
  457. public event GenericCall2 OnRequestWearables;
  458. public event GenericCall2 OnCompleteMovementToRegion;
  459. public event UpdateAgent OnAgentUpdate;
  460. public event AgentRequestSit OnAgentRequestSit;
  461. public event AgentSit OnAgentSit;
  462. public event AvatarPickerRequest OnAvatarPickerRequest;
  463. public event Action<IClientAPI> OnRequestAvatarsData;
  464. public event AddNewPrim OnAddPrim;
  465. public event FetchInventory OnAgentDataUpdateRequest;
  466. public event TeleportLocationRequest OnSetStartLocationRequest;
  467. public event RequestGodlikePowers OnRequestGodlikePowers;
  468. public event GodKickUser OnGodKickUser;
  469. public event ObjectDuplicate OnObjectDuplicate;
  470. public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
  471. public event GrabObject OnGrabObject;
  472. public event ObjectSelect OnDeGrabObject;
  473. public event MoveObject OnGrabUpdate;
  474. public event UpdateShape OnUpdatePrimShape;
  475. public event ObjectExtraParams OnUpdateExtraParams;
  476. public event ObjectSelect OnObjectSelect;
  477. public event ObjectDeselect OnObjectDeselect;
  478. public event GenericCall7 OnObjectDescription;
  479. public event GenericCall7 OnObjectName;
  480. public event GenericCall7 OnObjectClickAction;
  481. public event GenericCall7 OnObjectMaterial;
  482. public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
  483. public event UpdatePrimFlags OnUpdatePrimFlags;
  484. public event UpdatePrimTexture OnUpdatePrimTexture;
  485. public event UpdateVector OnUpdatePrimGroupPosition;
  486. public event UpdateVector OnUpdatePrimSinglePosition;
  487. public event UpdatePrimRotation OnUpdatePrimGroupRotation;
  488. public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
  489. public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
  490. public event UpdateVector OnUpdatePrimScale;
  491. public event UpdateVector OnUpdatePrimGroupScale;
  492. public event StatusChange OnChildAgentStatus;
  493. public event GenericCall2 OnStopMovement;
  494. public event Action<UUID> OnRemoveAvatar;
  495. public event ObjectPermissions OnObjectPermissions;
  496. public event CreateNewInventoryItem OnCreateNewInventoryItem;
  497. public event CreateInventoryFolder OnCreateNewInventoryFolder;
  498. public event UpdateInventoryFolder OnUpdateInventoryFolder;
  499. public event MoveInventoryFolder OnMoveInventoryFolder;
  500. public event FetchInventoryDescendents OnFetchInventoryDescendents;
  501. public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
  502. public event FetchInventory OnFetchInventory;
  503. public event RequestTaskInventory OnRequestTaskInventory;
  504. public event UpdateInventoryItem OnUpdateInventoryItem;
  505. public event CopyInventoryItem OnCopyInventoryItem;
  506. public event MoveInventoryItem OnMoveInventoryItem;
  507. public event RemoveInventoryFolder OnRemoveInventoryFolder;
  508. public event RemoveInventoryItem OnRemoveInventoryItem;
  509. public event UDPAssetUploadRequest OnAssetUploadRequest;
  510. public event XferReceive OnXferReceive;
  511. public event RequestXfer OnRequestXfer;
  512. public event ConfirmXfer OnConfirmXfer;
  513. public event AbortXfer OnAbortXfer;
  514. public event RezScript OnRezScript;
  515. public event UpdateTaskInventory OnUpdateTaskInventory;
  516. public event MoveTaskInventory OnMoveTaskItem;
  517. public event RemoveTaskInventory OnRemoveTaskItem;
  518. public event RequestAsset OnRequestAsset;
  519. public event UUIDNameRequest OnNameFromUUIDRequest;
  520. public event ParcelAccessListRequest OnParcelAccessListRequest;
  521. public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
  522. public event ParcelPropertiesRequest OnParcelPropertiesRequest;
  523. public event ParcelDivideRequest OnParcelDivideRequest;
  524. public event ParcelJoinRequest OnParcelJoinRequest;
  525. public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
  526. public event ParcelSelectObjects OnParcelSelectObjects;
  527. public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
  528. public event ParcelAbandonRequest OnParcelAbandonRequest;
  529. public event ParcelGodForceOwner OnParcelGodForceOwner;
  530. public event ParcelReclaim OnParcelReclaim;
  531. public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
  532. public event RegionInfoRequest OnRegionInfoRequest;
  533. public event EstateCovenantRequest OnEstateCovenantRequest;
  534. public event FriendActionDelegate OnApproveFriendRequest;
  535. public event FriendActionDelegate OnDenyFriendRequest;
  536. public event FriendshipTermination OnTerminateFriendship;
  537. public event MoneyTransferRequest OnMoneyTransferRequest;
  538. public event EconomyDataRequest OnEconomyDataRequest;
  539. public event MoneyBalanceRequest OnMoneyBalanceRequest;
  540. public event UpdateAvatarProperties OnUpdateAvatarProperties;
  541. public event ParcelBuy OnParcelBuy;
  542. public event RequestPayPrice OnRequestPayPrice;
  543. public event ObjectSaleInfo OnObjectSaleInfo;
  544. public event ObjectBuy OnObjectBuy;
  545. public event BuyObjectInventory OnBuyObjectInventory;
  546. public event RequestTerrain OnRequestTerrain;
  547. public event RequestTerrain OnUploadTerrain;
  548. public event ObjectIncludeInSearch OnObjectIncludeInSearch;
  549. public event UUIDNameRequest OnTeleportHomeRequest;
  550. public event ScriptAnswer OnScriptAnswer;
  551. public event AgentSit OnUndo;
  552. public event ForceReleaseControls OnForceReleaseControls;
  553. public event GodLandStatRequest OnLandStatRequest;
  554. public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
  555. public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
  556. public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
  557. public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
  558. public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
  559. public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
  560. public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
  561. public event EstateRestartSimRequest OnEstateRestartSimRequest;
  562. public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
  563. public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
  564. public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
  565. public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
  566. public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
  567. public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
  568. public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
  569. public event UUIDNameRequest OnUUIDGroupNameRequest;
  570. public event RegionHandleRequest OnRegionHandleRequest;
  571. public event ParcelInfoRequest OnParcelInfoRequest;
  572. public event RequestObjectPropertiesFamily OnObjectGroupRequest;
  573. public event ScriptReset OnScriptReset;
  574. public event GetScriptRunning OnGetScriptRunning;
  575. public event SetScriptRunning OnSetScriptRunning;
  576. public event UpdateVector OnAutoPilotGo;
  577. public event TerrainUnacked OnUnackedTerrain;
  578. public event ActivateGesture OnActivateGesture;
  579. public event DeactivateGesture OnDeactivateGesture;
  580. public event ObjectOwner OnObjectOwner;
  581. public event DirPlacesQuery OnDirPlacesQuery;
  582. public event DirFindQuery OnDirFindQuery;
  583. public event DirLandQuery OnDirLandQuery;
  584. public event DirPopularQuery OnDirPopularQuery;
  585. public event DirClassifiedQuery OnDirClassifiedQuery;
  586. public event EventInfoRequest OnEventInfoRequest;
  587. public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
  588. public event MapItemRequest OnMapItemRequest;
  589. public event OfferCallingCard OnOfferCallingCard;
  590. public event AcceptCallingCard OnAcceptCallingCard;
  591. public event DeclineCallingCard OnDeclineCallingCard;
  592. public event SoundTrigger OnSoundTrigger;
  593. public event StartLure OnStartLure;
  594. public event TeleportLureRequest OnTeleportLureRequest;
  595. public event NetworkStats OnNetworkStatsUpdate;
  596. public event ClassifiedInfoRequest OnClassifiedInfoRequest;
  597. public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
  598. public event ClassifiedDelete OnClassifiedDelete;
  599. public event ClassifiedDelete OnClassifiedGodDelete;
  600. public event EventNotificationAddRequest OnEventNotificationAddRequest;
  601. public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
  602. public event EventGodDelete OnEventGodDelete;
  603. public event ParcelDwellRequest OnParcelDwellRequest;
  604. public event UserInfoRequest OnUserInfoRequest;
  605. public event UpdateUserInfo OnUpdateUserInfo;
  606. public event ViewerEffectEventHandler OnViewerEffect;
  607. public event Action<IClientAPI> OnLogout;
  608. public event Action<IClientAPI> OnConnectionClosed;
  609. public event RetrieveInstantMessages OnRetrieveInstantMessages;
  610. #pragma warning restore 67
  611. #endregion
  612. #region OpenSim ClientView Public Methods
  613. // Do we need this?
  614. public bool SendLogoutPacketWhenClosing
  615. {
  616. set { }
  617. }
  618. public uint CircuitCode
  619. {
  620. get { return m_sessionID.CRC(); }
  621. }
  622. public void SetDebugPacketLevel(int newDebug)
  623. {
  624. m_debugLevel = newDebug;
  625. }
  626. public void InPacket(object NewPack)
  627. {
  628. //throw new System.NotImplementedException();
  629. }
  630. public void ProcessInPacket(Packet NewPack)
  631. {
  632. //throw new System.NotImplementedException();
  633. }
  634. public void Close(bool ShutdownCircuit)
  635. {
  636. m_log.Info("[MXP ClientStack] Close Called with SC=" + ShutdownCircuit);
  637. // Tell the client to go
  638. SendLogoutPacket();
  639. // Let MXPPacketServer clean it up
  640. if (Session.SessionState != SessionState.Disconnected)
  641. {
  642. Session.SetStateDisconnected();
  643. }
  644. // Handle OpenSim cleanup
  645. if (ShutdownCircuit)
  646. {
  647. if (OnConnectionClosed != null)
  648. OnConnectionClosed(this);
  649. }
  650. else
  651. {
  652. Scene.RemoveClient(AgentId);
  653. }
  654. }
  655. public void Kick(string message)
  656. {
  657. Close(false);
  658. }
  659. public void Start()
  660. {
  661. Scene.AddNewClient(this);
  662. /*foreach (ScenePresence presence in ((Scene)Scene).GetScenePresences())
  663. {
  664. if (presence.Appearance!=null)
  665. {
  666. AvatarAppearance avatar = presence.Appearance;
  667. if (presence.Appearance.Owner == m_userID)
  668. {
  669. MXPSendAvatarData(m_firstName + " " + m_lastName, presence.Appearance.Owner, UUID.Zero, presence.UUID, presence.LocalId, presence.AbsolutePosition, presence.Rotation);
  670. }
  671. }
  672. }*/
  673. }
  674. public void Stop()
  675. {
  676. // Nor this
  677. }
  678. public void SendWearables(AvatarWearable[] wearables, int serial)
  679. {
  680. // Need to translate to MXP somehow
  681. }
  682. public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
  683. {
  684. // Need to translate to MXP somehow
  685. }
  686. public void SendStartPingCheck(byte seq)
  687. {
  688. // Need to translate to MXP somehow
  689. }
  690. public void SendKillObject(ulong regionHandle, uint localID)
  691. {
  692. DisappearanceEventMessage de = new DisappearanceEventMessage();
  693. de.ObjectIndex = localID;
  694. Session.Send(de);
  695. }
  696. public void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
  697. {
  698. // Need to translate to MXP somehow
  699. }
  700. public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
  701. {
  702. m_log.Info("[MXP] Completing Handshake to Region");
  703. if (OnRegionHandShakeReply != null)
  704. {
  705. OnRegionHandShakeReply(this);
  706. }
  707. if (OnCompleteMovementToRegion != null)
  708. {
  709. OnCompleteMovementToRegion();
  710. }
  711. // Need to translate to MXP somehow
  712. }
  713. public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, byte audible)
  714. {
  715. ActionEventMessage chatActionEvent = new ActionEventMessage();
  716. chatActionEvent.ActionFragment.ActionName = "Chat";
  717. chatActionEvent.ActionFragment.SourceObjectId = fromAgentID.Guid;
  718. chatActionEvent.ActionFragment.ObservationRadius = 180.0f;
  719. chatActionEvent.ActionFragment.ActionPayloadDialect = "TEXT";
  720. chatActionEvent.SetPayloadData(Encoding.UTF8.GetBytes(message));
  721. chatActionEvent.ActionFragment.ActionPayloadLength = (uint)chatActionEvent.GetPayloadData().Length;
  722. Session.Send(chatActionEvent);
  723. }
  724. public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
  725. {
  726. // Need to translate to MXP somehow
  727. }
  728. public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transactionID, bool fromGroup, byte[] binaryBucket)
  729. {
  730. // Need to translate to MXP somehow
  731. }
  732. public void SendGenericMessage(string method, List<string> message)
  733. {
  734. // Need to translate to MXP somehow
  735. }
  736. public void SendLayerData(float[] map)
  737. {
  738. MXPSendTerrain(map);
  739. }
  740. public void SendLayerData(int px, int py, float[] map)
  741. {
  742. }
  743. public void SendWindData(Vector2[] windSpeeds)
  744. {
  745. // Need to translate to MXP somehow
  746. }
  747. public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
  748. {
  749. //throw new System.NotImplementedException();
  750. }
  751. public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
  752. {
  753. //throw new System.NotImplementedException();
  754. }
  755. public AgentCircuitData RequestClientInfo()
  756. {
  757. AgentCircuitData clientinfo = new AgentCircuitData();
  758. clientinfo.AgentID = AgentId;
  759. clientinfo.Appearance = new AvatarAppearance();
  760. clientinfo.BaseFolder = UUID.Zero;
  761. clientinfo.CapsPath = "";
  762. clientinfo.child = false;
  763. clientinfo.ChildrenCapSeeds = new Dictionary<ulong, string>();
  764. clientinfo.circuitcode = CircuitCode;
  765. clientinfo.firstname = FirstName;
  766. clientinfo.InventoryFolder = UUID.Zero;
  767. clientinfo.lastname = LastName;
  768. clientinfo.SecureSessionID = SecureSessionId;
  769. clientinfo.SessionID = SessionId;
  770. clientinfo.startpos = StartPos;
  771. return clientinfo;
  772. }
  773. public void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL)
  774. {
  775. // TODO: We'll want to get this one working.
  776. // Need to translate to MXP somehow
  777. }
  778. public void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
  779. {
  780. // Need to translate to MXP somehow
  781. }
  782. public void SendLocalTeleport(Vector3 position, Vector3 lookAt, uint flags)
  783. {
  784. //throw new System.NotImplementedException();
  785. }
  786. public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL)
  787. {
  788. // Need to translate to MXP somehow
  789. }
  790. public void SendTeleportFailed(string reason)
  791. {
  792. // Need to translate to MXP somehow
  793. }
  794. public void SendTeleportLocationStart()
  795. {
  796. // Need to translate to MXP somehow
  797. }
  798. public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
  799. {
  800. // Need to translate to MXP somehow
  801. }
  802. public void SendPayPrice(UUID objectID, int[] payPrice)
  803. {
  804. // Need to translate to MXP somehow
  805. }
  806. public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 position, byte[] textureEntry, uint parentID, Quaternion rotation)
  807. {
  808. //ScenePresence presence=((Scene)this.Scene).GetScenePresence(avatarID);
  809. UUID ownerID = avatarID;
  810. MXPSendAvatarData(firstName + " " + lastName, ownerID, UUID.Zero, avatarID, avatarLocalID, position, rotation);
  811. }
  812. public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation)
  813. {
  814. MovementEventMessage me = new MovementEventMessage();
  815. me.ObjectIndex = localID;
  816. me.Location = new float[] { position.X, position.Y, position.Z };
  817. me.Orientation = new float[] { rotation.X, rotation.Y, rotation.Z, rotation.W };
  818. Session.Send(me);
  819. }
  820. public void SendCoarseLocationUpdate(List<Vector3> CoarseLocations)
  821. {
  822. // Minimap function, not used.
  823. }
  824. public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
  825. {
  826. // Need to translate to MXP somehow
  827. }
  828. public void SetChildAgentThrottle(byte[] throttle)
  829. {
  830. // Need to translate to MXP somehow
  831. }
  832. public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim, bool attachment, uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
  833. {
  834. MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation, flags,text,color,parentID,particleSystem,clickAction,material,textureanim);
  835. }
  836. public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material)
  837. {
  838. MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation, flags, text, color, parentID, particleSystem, clickAction, material, new byte[0]);
  839. }
  840. public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID owner, int attachPoint)
  841. {
  842. MovementEventMessage me = new MovementEventMessage();
  843. me.ObjectIndex = localID;
  844. me.Location = new float[] {position.X, position.Y, position.Z};
  845. me.Orientation = new float[] {rotation.X, rotation.Y, rotation.Z, rotation.W};
  846. Session.Send(me);
  847. }
  848. public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, bool fetchFolders, bool fetchItems)
  849. {
  850. // Need to translate to MXP somehow
  851. }
  852. public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
  853. {
  854. // Need to translate to MXP somehow
  855. }
  856. public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId)
  857. {
  858. // Need to translate to MXP somehow
  859. }
  860. public void SendRemoveInventoryItem(UUID itemID)
  861. {
  862. // Need to translate to MXP somehow
  863. }
  864. public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
  865. {
  866. // Need to translate to MXP somehow
  867. }
  868. public void SendTaskInventory(UUID taskID, short serial, byte[] fileName)
  869. {
  870. // Need to translate to MXP somehow
  871. }
  872. public void SendBulkUpdateInventory(InventoryNodeBase node)
  873. {
  874. // Need to translate to MXP somehow
  875. }
  876. public void SendXferPacket(ulong xferID, uint packet, byte[] data)
  877. {
  878. // SL Specific, Ignore. (Remove from IClient)
  879. }
  880. public void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit, int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor, int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay, int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
  881. {
  882. // SL Specific, Ignore. (Remove from IClient)
  883. }
  884. public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
  885. {
  886. // Need to translate to MXP somehow
  887. }
  888. public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
  889. {
  890. // Need to translate to MXP somehow
  891. // TODO: This may need doing - involves displaying the users avatar name
  892. }
  893. public void SendPreLoadSound(UUID objectID, UUID ownerID, UUID soundID)
  894. {
  895. // Need to translate to MXP somehow
  896. }
  897. public void SendPlayAttachedSound(UUID soundID, UUID objectID, UUID ownerID, float gain, byte flags)
  898. {
  899. // Need to translate to MXP somehow
  900. }
  901. public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
  902. {
  903. // Need to translate to MXP somehow
  904. }
  905. public void SendAttachedSoundGainChange(UUID objectID, float gain)
  906. {
  907. // Need to translate to MXP somehow
  908. }
  909. public void SendNameReply(UUID profileId, string firstname, string lastname)
  910. {
  911. // SL Specific
  912. }
  913. public void SendAlertMessage(string message)
  914. {
  915. SendChatMessage(message, 0, Vector3.Zero, "System", UUID.Zero, 0, 0);
  916. }
  917. public void SendAgentAlertMessage(string message, bool modal)
  918. {
  919. SendChatMessage(message, 0, Vector3.Zero, "System" + (modal ? " Notice" : ""), UUID.Zero, 0, 0);
  920. }
  921. public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message, string url)
  922. {
  923. // TODO: Probably can do this better
  924. SendChatMessage("Please visit: " + url, 0, Vector3.Zero, objectname, UUID.Zero, 0, 0);
  925. }
  926. public void SendDialog(string objectname, UUID objectID, UUID ownerID, string msg, UUID textureID, int ch, string[] buttonlabels)
  927. {
  928. // TODO: Probably can do this better
  929. SendChatMessage("Dialog: " + msg, 0, Vector3.Zero, objectname, UUID.Zero, 0, 0);
  930. }
  931. public bool AddMoney(int debit)
  932. {
  933. SendChatMessage("You were paid: " + debit, 0, Vector3.Zero, "System", UUID.Zero, 0, 0);
  934. return true;
  935. }
  936. public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition)
  937. {
  938. // Need to translate to MXP somehow
  939. // Send a light object?
  940. }
  941. public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
  942. {
  943. // Need to translate to MXP somehow
  944. }
  945. public void SendViewerTime(int phase)
  946. {
  947. // Need to translate to MXP somehow
  948. }
  949. public UUID GetDefaultAnimation(string name)
  950. {
  951. return UUID.Zero;
  952. }
  953. public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID)
  954. {
  955. // Need to translate to MXP somehow
  956. }
  957. public void SendScriptQuestion(UUID taskID, string taskName, string ownerName, UUID itemID, int question)
  958. {
  959. // Need to translate to MXP somehow
  960. }
  961. public void SendHealth(float health)
  962. {
  963. // Need to translate to MXP somehow
  964. }
  965. public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID)
  966. {
  967. // Need to translate to MXP somehow
  968. }
  969. public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
  970. {
  971. // Need to translate to MXP somehow
  972. }
  973. public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
  974. {
  975. // Need to translate to MXP somehow
  976. }
  977. public void SendEstateCovenantInformation(UUID covenant)
  978. {
  979. // Need to translate to MXP somehow
  980. }
  981. public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
  982. {
  983. // Need to translate to MXP somehow
  984. }
  985. public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
  986. {
  987. // Need to translate to MXP somehow
  988. }
  989. public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
  990. {
  991. // Need to translate to MXP somehow
  992. }
  993. public void SendForceClientSelectObjects(List<uint> objectIDs)
  994. {
  995. // Need to translate to MXP somehow
  996. }
  997. public void SendLandObjectOwners(Dictionary<UUID, int> ownersAndCount)
  998. {
  999. // Need to translate to MXP somehow
  1000. }
  1001. public void SendLandParcelOverlay(byte[] data, int sequence_id)
  1002. {
  1003. // Need to translate to MXP somehow
  1004. }
  1005. public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time)
  1006. {
  1007. // Need to translate to MXP somehow
  1008. }
  1009. public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, byte autoScale, string mediaType, string mediaDesc, int mediaWidth, int mediaHeight, byte mediaLoop)
  1010. {
  1011. // Need to translate to MXP somehow
  1012. }
  1013. public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
  1014. {
  1015. // Need to translate to MXP somehow
  1016. }
  1017. public void SendConfirmXfer(ulong xferID, uint PacketID)
  1018. {
  1019. // Need to translate to MXP somehow
  1020. }
  1021. public void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName)
  1022. {
  1023. // Need to translate to MXP somehow
  1024. }
  1025. public void SendInitiateDownload(string simFileName, string clientFileName)
  1026. {
  1027. // Need to translate to MXP somehow
  1028. }
  1029. public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
  1030. {
  1031. // Need to translate to MXP somehow
  1032. }
  1033. public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
  1034. {
  1035. // Need to translate to MXP somehow
  1036. }
  1037. public void SendImageNotFound(UUID imageid)
  1038. {
  1039. // Need to translate to MXP somehow
  1040. }
  1041. public void SendShutdownConnectionNotice()
  1042. {
  1043. // Need to translate to MXP somehow
  1044. }
  1045. public void SendSimStats(SimStats stats)
  1046. {
  1047. // Need to translate to MXP somehow
  1048. }
  1049. public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID, uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask, uint NextOwnerMask, int OwnershipCost, byte SaleType, int SalePrice, uint Category, UUID LastOwnerID, string ObjectName, string Description)
  1050. {
  1051. //throw new System.NotImplementedException();
  1052. }
  1053. public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID, UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID, UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName, string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, uint BaseMask, byte saleType, int salePrice)
  1054. {
  1055. //throw new System.NotImplementedException();
  1056. }
  1057. public void SendAgentOffline(UUID[] agentIDs)
  1058. {
  1059. // Need to translate to MXP somehow (Friends List)
  1060. }
  1061. public void SendAgentOnline(UUID[] agentIDs)
  1062. {
  1063. // Need to translate to MXP somehow (Friends List)
  1064. }
  1065. public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot, Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
  1066. {
  1067. // Need to translate to MXP somehow
  1068. }
  1069. public void SendAdminResponse(UUID Token, uint AdminLevel)
  1070. {
  1071. // Need to translate to MXP somehow
  1072. }
  1073. public void SendGroupMembership(GroupMembershipData[] GroupMembership)
  1074. {
  1075. // Need to translate to MXP somehow
  1076. }
  1077. public void SendGroupNameReply(UUID groupLLUID, string GroupName)
  1078. {
  1079. // Need to translate to MXP somehow
  1080. }
  1081. public void SendJoinGroupReply(UUID groupID, bool success)
  1082. {
  1083. // Need to translate to MXP somehow
  1084. }
  1085. public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool success)
  1086. {
  1087. // Need to translate to MXP somehow
  1088. }
  1089. public void SendLeaveGroupReply(UUID groupID, bool success)
  1090. {
  1091. // Need to translate to MXP somehow
  1092. }
  1093. public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
  1094. {
  1095. // Need to translate to MXP somehow
  1096. }
  1097. public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
  1098. {
  1099. // Need to translate to MXP somehow
  1100. }
  1101. public void SendAsset(AssetRequestToClient req)
  1102. {
  1103. // Need to translate to MXP somehow
  1104. }
  1105. public void SendTexture(AssetBase TextureAsset)
  1106. {
  1107. // Need to translate to MXP somehow
  1108. }
  1109. public byte[] GetThrottlesPacked(float multiplier)
  1110. {
  1111. // LL Specific, get out of IClientAPI
  1112. const int singlefloat = 4;
  1113. float tResend = multiplier;
  1114. float tLand = multiplier;
  1115. float tWind = multiplier;
  1116. float tCloud = multiplier;
  1117. float tTask = multiplier;
  1118. float tTexture = multiplier;
  1119. float tAsset = multiplier;
  1120. byte[] throttles = new byte[singlefloat * 7];
  1121. int i = 0;
  1122. Buffer.BlockCopy(BitConverter.GetBytes(tResend), 0, throttles, singlefloat * i, singlefloat);
  1123. i++;
  1124. Buffer.BlockCopy(BitConverter.GetBytes(tLand), 0, throttles, singlefloat * i, singlefloat);
  1125. i++;
  1126. Buffer.BlockCopy(BitConverter.GetBytes(tWind), 0, throttles, singlefloat * i, singlefloat);
  1127. i++;
  1128. Buffer.BlockCopy(BitConverter.GetBytes(tCloud), 0, throttles, singlefloat * i, singlefloat);
  1129. i++;
  1130. Buffer.BlockCopy(BitConverter.GetBytes(tTask), 0, throttles, singlefloat * i, singlefloat);
  1131. i++;
  1132. Buffer.BlockCopy(BitConverter.GetBytes(tTexture), 0, throttles, singlefloat * i, singlefloat);
  1133. i++;
  1134. Buffer.BlockCopy(BitConverter.GetBytes(tAsset), 0, throttles, singlefloat * i, singlefloat);
  1135. return throttles;
  1136. }
  1137. public void SendBlueBoxMessage(UUID FromAvatarID, string FromAvatarName, string Message)
  1138. {
  1139. SendChatMessage(Message, 0, Vector3.Zero, FromAvatarName, UUID.Zero, 0, 0);
  1140. }
  1141. public void SendLogoutPacket()
  1142. {
  1143. LeaveRequestMessage lrm = new LeaveRequestMessage();
  1144. Session.Send(lrm);
  1145. }
  1146. public ClientInfo GetClientInfo()
  1147. {
  1148. return null;
  1149. //throw new System.NotImplementedException();
  1150. }
  1151. public void SetClientInfo(ClientInfo info)
  1152. {
  1153. //throw new System.NotImplementedException();
  1154. }
  1155. public void SetClientOption(string option, string value)
  1156. {
  1157. // Need to translate to MXP somehow
  1158. }
  1159. public string GetClientOption(string option)
  1160. {
  1161. // Need to translate to MXP somehow
  1162. return "";
  1163. }
  1164. public void Terminate()
  1165. {
  1166. Close(false);
  1167. }
  1168. public void SendSetFollowCamProperties(UUID objectID, SortedDictionary<int, float> parameters)
  1169. {
  1170. // Need to translate to MXP somehow
  1171. }
  1172. public void SendClearFollowCamProperties(UUID objectID)
  1173. {
  1174. // Need to translate to MXP somehow
  1175. }
  1176. public void SendRegionHandle(UUID regoinID, ulong handle)
  1177. {
  1178. // Need to translate to MXP somehow
  1179. }
  1180. public void SendParcelInfo(RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
  1181. {
  1182. // Need to translate to MXP somehow
  1183. }
  1184. public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt)
  1185. {
  1186. // Need to translate to MXP somehow
  1187. }
  1188. public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
  1189. {
  1190. // Need to translate to MXP somehow
  1191. }
  1192. public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
  1193. {
  1194. // Need to translate to MXP somehow
  1195. }
  1196. public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
  1197. {
  1198. // Need to translate to MXP somehow
  1199. }
  1200. public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
  1201. {
  1202. // Need to translate to MXP somehow
  1203. }
  1204. public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
  1205. {
  1206. // Need to translate to MXP somehow
  1207. }
  1208. public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
  1209. {
  1210. // Need to translate to MXP somehow
  1211. }
  1212. public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
  1213. {
  1214. // Need to translate to MXP somehow
  1215. }
  1216. public void SendEventInfoReply(EventData info)
  1217. {
  1218. // Need to translate to MXP somehow
  1219. }
  1220. public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
  1221. {
  1222. // Need to translate to MXP somehow
  1223. }
  1224. public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
  1225. {
  1226. // Need to translate to MXP somehow
  1227. }
  1228. public void SendOfferCallingCard(UUID srcID, UUID transactionID)
  1229. {
  1230. // Need to translate to MXP somehow
  1231. }
  1232. public void SendAcceptCallingCard(UUID transactionID)
  1233. {
  1234. // Need to translate to MXP somehow
  1235. }
  1236. public void SendDeclineCallingCard(UUID transactionID)
  1237. {
  1238. // Need to translate to MXP somehow
  1239. }
  1240. public void SendTerminateFriend(UUID exFriendID)
  1241. {
  1242. // Need to translate to MXP somehow
  1243. }
  1244. public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
  1245. {
  1246. // Need to translate to MXP somehow
  1247. }
  1248. public void SendClassifiedInfoReply(UUID classifiedID, UUID creatorID, uint creationDate, uint expirationDate, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, string simName, Vector3 globalPos, string parcelName, byte classifiedFlags, int price)
  1249. {
  1250. // Need to translate to MXP somehow
  1251. }
  1252. public void SendAgentDropGroup(UUID groupID)
  1253. {
  1254. // Need to translate to MXP somehow
  1255. }
  1256. public void SendAvatarNotesReply(UUID targetID, string text)
  1257. {
  1258. // Need to translate to MXP somehow
  1259. }
  1260. public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
  1261. {
  1262. // Need to translate to MXP somehow
  1263. }
  1264. public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
  1265. {
  1266. // Need to translate to MXP somehow
  1267. }
  1268. public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
  1269. {
  1270. // Need to translate to MXP somehow
  1271. }
  1272. public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
  1273. {
  1274. // Need to translate to MXP somehow
  1275. }
  1276. public void KillEndDone()
  1277. {
  1278. Stop();
  1279. }
  1280. public bool AddGenericPacketHandler(string MethodName, GenericMessage handler)
  1281. {
  1282. // Need to translate to MXP somehow
  1283. return true;
  1284. }
  1285. #endregion
  1286. #region IClientCore
  1287. public bool TryGet<T>(out T iface)
  1288. {
  1289. iface = default(T);
  1290. return false;
  1291. }
  1292. public T Get<T>()
  1293. {
  1294. return default(T);
  1295. }
  1296. #endregion
  1297. }
  1298. }