World.PacketHandlers.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using libsecondlife;
  5. using libsecondlife.Packets;
  6. using OpenSim.Physics.Manager;
  7. using OpenSim.Framework.Interfaces;
  8. using OpenSim.Framework.Types;
  9. using OpenSim.Framework.Inventory;
  10. using OpenSim.Framework.Utilities;
  11. namespace OpenSim.world
  12. {
  13. public partial class World
  14. {
  15. /// <summary>
  16. ///
  17. /// </summary>
  18. /// <param name="action"></param>
  19. /// <param name="north"></param>
  20. /// <param name="west"></param>
  21. public void ModifyTerrain(byte action, float north, float west)
  22. {
  23. switch (action)
  24. {
  25. case 1:
  26. // raise terrain
  27. Terrain.raise(north, west, 10.0, 0.001);
  28. RegenerateTerrain(true, (int)north, (int)west);
  29. break;
  30. case 2:
  31. //lower terrain
  32. Terrain.lower(north, west, 10.0, 0.001);
  33. RegenerateTerrain(true, (int)north, (int)west);
  34. break;
  35. }
  36. return;
  37. }
  38. /// <summary>
  39. ///
  40. /// </summary>
  41. /// <param name="message"></param>
  42. /// <param name="type"></param>
  43. /// <param name="fromPos"></param>
  44. /// <param name="fromName"></param>
  45. /// <param name="fromAgentID"></param>
  46. public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
  47. {
  48. Console.WriteLine("Chat message");
  49. Avatar avatar = null;
  50. foreach (IClientAPI client in m_clientThreads.Values)
  51. {
  52. int dis = -1000;
  53. if (this.Avatars.ContainsKey(client.AgentId))
  54. {
  55. avatar = this.Avatars[client.AgentId];
  56. // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
  57. dis= (int)avatar.Pos.GetDistanceTo(fromPos);
  58. Console.WriteLine("found avatar at " +dis);
  59. }
  60. switch (type)
  61. {
  62. case 0: // Whisper
  63. if ((dis < 10) && (dis > -10))
  64. {
  65. //should change so the message is sent through the avatar rather than direct to the ClientView
  66. client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
  67. }
  68. break;
  69. case 1: // Say
  70. if ((dis < 30) && (dis > -30))
  71. {
  72. Console.WriteLine("sending chat");
  73. client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
  74. }
  75. break;
  76. case 2: // Shout
  77. if ((dis < 100) && (dis > -100))
  78. {
  79. client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
  80. }
  81. break;
  82. case 0xff: // Broadcast
  83. client.SendChatMessage(message, type, fromPos, fromName, fromAgentID);
  84. break;
  85. }
  86. }
  87. }
  88. /// <summary>
  89. ///
  90. /// </summary>
  91. /// <param name="primAsset"></param>
  92. /// <param name="pos"></param>
  93. public void RezObject(AssetBase primAsset, LLVector3 pos)
  94. {
  95. }
  96. /// <summary>
  97. ///
  98. /// </summary>
  99. /// <param name="packet"></param>
  100. /// <param name="simClient"></param>
  101. public void DeRezObject(Packet packet, IClientAPI simClient)
  102. {
  103. }
  104. /// <summary>
  105. ///
  106. /// </summary>
  107. /// <param name="remoteClient"></param>
  108. public void SendAvatarsToClient(IClientAPI remoteClient)
  109. {
  110. }
  111. /// <summary>
  112. ///
  113. /// </summary>
  114. /// <param name="parentPrim"></param>
  115. /// <param name="childPrims"></param>
  116. public void LinkObjects(uint parentPrim, List<uint> childPrims)
  117. {
  118. }
  119. /// <summary>
  120. ///
  121. /// </summary>
  122. /// <param name="primLocalID"></param>
  123. /// <param name="shapeBlock"></param>
  124. public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
  125. {
  126. }
  127. /// <summary>
  128. ///
  129. /// </summary>
  130. /// <param name="primLocalID"></param>
  131. /// <param name="remoteClient"></param>
  132. public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
  133. {
  134. }
  135. /// <summary>
  136. ///
  137. /// </summary>
  138. /// <param name="localID"></param>
  139. /// <param name="packet"></param>
  140. /// <param name="remoteClient"></param>
  141. public void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient)
  142. {
  143. }
  144. /// <summary>
  145. ///
  146. /// </summary>
  147. /// <param name="localID"></param>
  148. /// <param name="texture"></param>
  149. /// <param name="remoteClient"></param>
  150. public void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
  151. {
  152. }
  153. /// <summary>
  154. ///
  155. /// </summary>
  156. /// <param name="localID"></param>
  157. /// <param name="pos"></param>
  158. /// <param name="remoteClient"></param>
  159. public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
  160. {
  161. }
  162. /// <summary>
  163. ///
  164. /// </summary>
  165. /// <param name="localID"></param>
  166. /// <param name="rot"></param>
  167. /// <param name="remoteClient"></param>
  168. public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
  169. {
  170. }
  171. /// <summary>
  172. ///
  173. /// </summary>
  174. /// <param name="localID"></param>
  175. /// <param name="scale"></param>
  176. /// <param name="remoteClient"></param>
  177. public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
  178. {
  179. }
  180. /// <summary>
  181. /// Sends prims to a client
  182. /// </summary>
  183. /// <param name="RemoteClient">Client to send to</param>
  184. public void GetInitialPrims(IClientAPI RemoteClient)
  185. {
  186. }
  187. }
  188. }