1
0

TestClient.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Net;
  30. using System.Reflection;
  31. using System.Threading;
  32. using log4net;
  33. using OpenMetaverse;
  34. using OpenMetaverse.Packets;
  35. using OpenSim.Framework;
  36. using OpenSim.Region.Framework.Interfaces;
  37. using OpenSim.Region.Framework.Scenes;
  38. namespace OpenSim.Tests.Common.Mock
  39. {
  40. public class TestClient : IClientAPI
  41. {
  42. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  43. // Mock testing variables
  44. public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
  45. public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
  46. EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
  47. // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
  48. // methods on when a teleport is requested
  49. public Scene TeleportTargetScene;
  50. private TestClient TeleportSceneClient;
  51. private IScene m_scene;
  52. // disable warning: public events, part of the public API
  53. #pragma warning disable 67
  54. public event Action<IClientAPI> OnLogout;
  55. public event ObjectPermissions OnObjectPermissions;
  56. public event MoneyTransferRequest OnMoneyTransferRequest;
  57. public event ParcelBuy OnParcelBuy;
  58. public event Action<IClientAPI> OnConnectionClosed;
  59. public event ImprovedInstantMessage OnInstantMessage;
  60. public event ChatMessage OnChatFromClient;
  61. public event TextureRequest OnRequestTexture;
  62. public event RezObject OnRezObject;
  63. public event ModifyTerrain OnModifyTerrain;
  64. public event BakeTerrain OnBakeTerrain;
  65. public event SetAppearance OnSetAppearance;
  66. public event AvatarNowWearing OnAvatarNowWearing;
  67. public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
  68. public event UUIDNameRequest OnDetachAttachmentIntoInv;
  69. public event ObjectAttach OnObjectAttach;
  70. public event ObjectDeselect OnObjectDetach;
  71. public event ObjectDrop OnObjectDrop;
  72. public event StartAnim OnStartAnim;
  73. public event StopAnim OnStopAnim;
  74. public event LinkObjects OnLinkObjects;
  75. public event DelinkObjects OnDelinkObjects;
  76. public event RequestMapBlocks OnRequestMapBlocks;
  77. public event RequestMapName OnMapNameRequest;
  78. public event TeleportLocationRequest OnTeleportLocationRequest;
  79. public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
  80. public event DisconnectUser OnDisconnectUser;
  81. public event RequestAvatarProperties OnRequestAvatarProperties;
  82. public event SetAlwaysRun OnSetAlwaysRun;
  83. public event DeRezObject OnDeRezObject;
  84. public event Action<IClientAPI> OnRegionHandShakeReply;
  85. public event GenericCall2 OnRequestWearables;
  86. public event GenericCall2 OnCompleteMovementToRegion;
  87. public event UpdateAgent OnAgentUpdate;
  88. public event AgentRequestSit OnAgentRequestSit;
  89. public event AgentSit OnAgentSit;
  90. public event AvatarPickerRequest OnAvatarPickerRequest;
  91. public event Action<IClientAPI> OnRequestAvatarsData;
  92. public event AddNewPrim OnAddPrim;
  93. public event RequestGodlikePowers OnRequestGodlikePowers;
  94. public event GodKickUser OnGodKickUser;
  95. public event ObjectDuplicate OnObjectDuplicate;
  96. public event GrabObject OnGrabObject;
  97. public event ObjectSelect OnDeGrabObject;
  98. public event MoveObject OnGrabUpdate;
  99. public event ViewerEffectEventHandler OnViewerEffect;
  100. public event FetchInventory OnAgentDataUpdateRequest;
  101. public event TeleportLocationRequest OnSetStartLocationRequest;
  102. public event UpdateShape OnUpdatePrimShape;
  103. public event ObjectExtraParams OnUpdateExtraParams;
  104. public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
  105. public event ObjectSelect OnObjectSelect;
  106. public event GenericCall7 OnObjectDescription;
  107. public event GenericCall7 OnObjectName;
  108. public event GenericCall7 OnObjectClickAction;
  109. public event GenericCall7 OnObjectMaterial;
  110. public event UpdatePrimFlags OnUpdatePrimFlags;
  111. public event UpdatePrimTexture OnUpdatePrimTexture;
  112. public event UpdateVector OnUpdatePrimGroupPosition;
  113. public event UpdateVector OnUpdatePrimSinglePosition;
  114. public event UpdatePrimRotation OnUpdatePrimGroupRotation;
  115. public event UpdatePrimSingleRotation OnUpdatePrimSingleRotation;
  116. public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
  117. public event UpdateVector OnUpdatePrimScale;
  118. public event UpdateVector OnUpdatePrimGroupScale;
  119. public event StatusChange OnChildAgentStatus;
  120. public event GenericCall2 OnStopMovement;
  121. public event Action<UUID> OnRemoveAvatar;
  122. public event CreateNewInventoryItem OnCreateNewInventoryItem;
  123. public event CreateInventoryFolder OnCreateNewInventoryFolder;
  124. public event UpdateInventoryFolder OnUpdateInventoryFolder;
  125. public event MoveInventoryFolder OnMoveInventoryFolder;
  126. public event RemoveInventoryFolder OnRemoveInventoryFolder;
  127. public event RemoveInventoryItem OnRemoveInventoryItem;
  128. public event FetchInventoryDescendents OnFetchInventoryDescendents;
  129. public event PurgeInventoryDescendents OnPurgeInventoryDescendents;
  130. public event FetchInventory OnFetchInventory;
  131. public event RequestTaskInventory OnRequestTaskInventory;
  132. public event UpdateInventoryItem OnUpdateInventoryItem;
  133. public event CopyInventoryItem OnCopyInventoryItem;
  134. public event MoveInventoryItem OnMoveInventoryItem;
  135. public event UDPAssetUploadRequest OnAssetUploadRequest;
  136. public event RequestTerrain OnRequestTerrain;
  137. public event RequestTerrain OnUploadTerrain;
  138. public event XferReceive OnXferReceive;
  139. public event RequestXfer OnRequestXfer;
  140. public event ConfirmXfer OnConfirmXfer;
  141. public event AbortXfer OnAbortXfer;
  142. public event RezScript OnRezScript;
  143. public event UpdateTaskInventory OnUpdateTaskInventory;
  144. public event MoveTaskInventory OnMoveTaskItem;
  145. public event RemoveTaskInventory OnRemoveTaskItem;
  146. public event RequestAsset OnRequestAsset;
  147. public event GenericMessage OnGenericMessage;
  148. public event UUIDNameRequest OnNameFromUUIDRequest;
  149. public event UUIDNameRequest OnUUIDGroupNameRequest;
  150. public event ParcelPropertiesRequest OnParcelPropertiesRequest;
  151. public event ParcelDivideRequest OnParcelDivideRequest;
  152. public event ParcelJoinRequest OnParcelJoinRequest;
  153. public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
  154. public event ParcelAbandonRequest OnParcelAbandonRequest;
  155. public event ParcelGodForceOwner OnParcelGodForceOwner;
  156. public event ParcelReclaim OnParcelReclaim;
  157. public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest;
  158. public event ParcelAccessListRequest OnParcelAccessListRequest;
  159. public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
  160. public event ParcelSelectObjects OnParcelSelectObjects;
  161. public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
  162. public event ObjectDeselect OnObjectDeselect;
  163. public event RegionInfoRequest OnRegionInfoRequest;
  164. public event EstateCovenantRequest OnEstateCovenantRequest;
  165. public event EstateChangeInfo OnEstateChangeInfo;
  166. public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
  167. public event FriendActionDelegate OnApproveFriendRequest;
  168. public event FriendActionDelegate OnDenyFriendRequest;
  169. public event FriendshipTermination OnTerminateFriendship;
  170. public event EconomyDataRequest OnEconomyDataRequest;
  171. public event MoneyBalanceRequest OnMoneyBalanceRequest;
  172. public event UpdateAvatarProperties OnUpdateAvatarProperties;
  173. public event ObjectIncludeInSearch OnObjectIncludeInSearch;
  174. public event UUIDNameRequest OnTeleportHomeRequest;
  175. public event ScriptAnswer OnScriptAnswer;
  176. public event RequestPayPrice OnRequestPayPrice;
  177. public event ObjectSaleInfo OnObjectSaleInfo;
  178. public event ObjectBuy OnObjectBuy;
  179. public event BuyObjectInventory OnBuyObjectInventory;
  180. public event AgentSit OnUndo;
  181. public event ForceReleaseControls OnForceReleaseControls;
  182. public event GodLandStatRequest OnLandStatRequest;
  183. public event RequestObjectPropertiesFamily OnObjectGroupRequest;
  184. public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
  185. public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
  186. public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
  187. public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
  188. public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
  189. public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
  190. public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
  191. public event EstateRestartSimRequest OnEstateRestartSimRequest;
  192. public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
  193. public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
  194. public event SimulatorBlueBoxMessageRequest OnSimulatorBlueBoxMessageRequest;
  195. public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
  196. public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
  197. public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
  198. public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
  199. public event ScriptReset OnScriptReset;
  200. public event GetScriptRunning OnGetScriptRunning;
  201. public event SetScriptRunning OnSetScriptRunning;
  202. public event UpdateVector OnAutoPilotGo;
  203. public event TerrainUnacked OnUnackedTerrain;
  204. public event RegionHandleRequest OnRegionHandleRequest;
  205. public event ParcelInfoRequest OnParcelInfoRequest;
  206. public event ActivateGesture OnActivateGesture;
  207. public event DeactivateGesture OnDeactivateGesture;
  208. public event ObjectOwner OnObjectOwner;
  209. public event DirPlacesQuery OnDirPlacesQuery;
  210. public event DirFindQuery OnDirFindQuery;
  211. public event DirLandQuery OnDirLandQuery;
  212. public event DirPopularQuery OnDirPopularQuery;
  213. public event DirClassifiedQuery OnDirClassifiedQuery;
  214. public event EventInfoRequest OnEventInfoRequest;
  215. public event ParcelSetOtherCleanTime OnParcelSetOtherCleanTime;
  216. public event MapItemRequest OnMapItemRequest;
  217. public event OfferCallingCard OnOfferCallingCard;
  218. public event AcceptCallingCard OnAcceptCallingCard;
  219. public event DeclineCallingCard OnDeclineCallingCard;
  220. public event SoundTrigger OnSoundTrigger;
  221. public event StartLure OnStartLure;
  222. public event TeleportLureRequest OnTeleportLureRequest;
  223. public event NetworkStats OnNetworkStatsUpdate;
  224. public event ClassifiedInfoRequest OnClassifiedInfoRequest;
  225. public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
  226. public event ClassifiedDelete OnClassifiedDelete;
  227. public event ClassifiedDelete OnClassifiedGodDelete;
  228. public event EventNotificationAddRequest OnEventNotificationAddRequest;
  229. public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
  230. public event EventGodDelete OnEventGodDelete;
  231. public event ParcelDwellRequest OnParcelDwellRequest;
  232. public event UserInfoRequest OnUserInfoRequest;
  233. public event UpdateUserInfo OnUpdateUserInfo;
  234. public event RetrieveInstantMessages OnRetrieveInstantMessages;
  235. #pragma warning restore 67
  236. /// <value>
  237. /// This agent's UUID
  238. /// </value>
  239. private UUID m_agentId;
  240. /// <value>
  241. /// The last caps seed url that this client was given.
  242. /// </value>
  243. public string CapsSeedUrl;
  244. private Vector3 startPos = new Vector3(128, 128, 2);
  245. public virtual Vector3 StartPos
  246. {
  247. get { return startPos; }
  248. set { }
  249. }
  250. public virtual UUID AgentId
  251. {
  252. get { return m_agentId; }
  253. }
  254. public UUID SessionId
  255. {
  256. get { return UUID.Zero; }
  257. }
  258. public UUID SecureSessionId
  259. {
  260. get { return UUID.Zero; }
  261. }
  262. public virtual string FirstName
  263. {
  264. get { return m_firstName; }
  265. }
  266. private string m_firstName;
  267. public virtual string LastName
  268. {
  269. get { return m_lastName; }
  270. }
  271. private string m_lastName;
  272. public virtual String Name
  273. {
  274. get { return FirstName + " " + LastName; }
  275. }
  276. public bool IsActive
  277. {
  278. get { return true; }
  279. set { }
  280. }
  281. public UUID ActiveGroupId
  282. {
  283. get { return UUID.Zero; }
  284. }
  285. public string ActiveGroupName
  286. {
  287. get { return String.Empty; }
  288. }
  289. public ulong ActiveGroupPowers
  290. {
  291. get { return 0; }
  292. }
  293. public bool IsGroupMember(UUID groupID)
  294. {
  295. return false;
  296. }
  297. public ulong GetGroupPowers(UUID groupID)
  298. {
  299. return 0;
  300. }
  301. public virtual int NextAnimationSequenceNumber
  302. {
  303. get { return 1; }
  304. }
  305. public IScene Scene
  306. {
  307. get { return m_scene; }
  308. }
  309. public bool SendLogoutPacketWhenClosing
  310. {
  311. set { }
  312. }
  313. private uint m_circuitCode;
  314. public uint CircuitCode
  315. {
  316. get { return m_circuitCode; }
  317. set { m_circuitCode = value; }
  318. }
  319. /// <summary>
  320. /// Constructor
  321. /// </summary>
  322. /// <param name="agentData"></param>
  323. /// <param name="scene"></param>
  324. public TestClient(AgentCircuitData agentData, IScene scene)
  325. {
  326. m_agentId = agentData.AgentID;
  327. m_firstName = agentData.firstname;
  328. m_lastName = agentData.lastname;
  329. m_circuitCode = agentData.circuitcode;
  330. m_scene = scene;
  331. CapsSeedUrl = agentData.CapsPath;
  332. }
  333. /// <summary>
  334. /// Attempt a teleport to the given region.
  335. /// </summary>
  336. /// <param name="regionHandle"></param>
  337. /// <param name="position"></param>
  338. /// <param name="lookAt"></param>
  339. public void Teleport(ulong regionHandle, Vector3 position, Vector3 lookAt)
  340. {
  341. OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16);
  342. }
  343. public void CompleteMovement()
  344. {
  345. OnCompleteMovementToRegion();
  346. }
  347. public virtual void ActivateGesture(UUID assetId, UUID gestureId)
  348. {
  349. }
  350. public virtual void SendWearables(AvatarWearable[] wearables, int serial)
  351. {
  352. }
  353. public virtual void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
  354. {
  355. }
  356. public virtual void Kick(string message)
  357. {
  358. }
  359. public virtual void SendStartPingCheck(byte seq)
  360. {
  361. }
  362. public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data)
  363. {
  364. }
  365. public virtual void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
  366. {
  367. }
  368. public virtual void SendKillObject(ulong regionHandle, uint localID)
  369. {
  370. }
  371. public virtual void SetChildAgentThrottle(byte[] throttle)
  372. {
  373. }
  374. public byte[] GetThrottlesPacked(float multiplier)
  375. {
  376. return new byte[0];
  377. }
  378. public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
  379. {
  380. }
  381. public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName,
  382. UUID fromAgentID, byte source, byte audible)
  383. {
  384. }
  385. public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName,
  386. UUID fromAgentID, byte source, byte audible)
  387. {
  388. }
  389. public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
  390. {
  391. }
  392. public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transactionID, bool fromGroup, byte[] binaryBucket)
  393. {
  394. }
  395. public void SendGenericMessage(string method, List<string> message)
  396. {
  397. }
  398. public virtual void SendLayerData(float[] map)
  399. {
  400. }
  401. public virtual void SendLayerData(int px, int py, float[] map)
  402. {
  403. }
  404. public virtual void SendLayerData(int px, int py, float[] map, bool track)
  405. {
  406. }
  407. public virtual void SendWindData(Vector2[] windSpeeds) { }
  408. public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
  409. {
  410. }
  411. public virtual AgentCircuitData RequestClientInfo()
  412. {
  413. AgentCircuitData agentData = new AgentCircuitData();
  414. agentData.AgentID = AgentId;
  415. agentData.SessionID = UUID.Zero;
  416. agentData.SecureSessionID = UUID.Zero;
  417. agentData.circuitcode = m_circuitCode;
  418. agentData.child = false;
  419. agentData.firstname = m_firstName;
  420. agentData.lastname = m_lastName;
  421. ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
  422. agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
  423. agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
  424. return agentData;
  425. }
  426. public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
  427. {
  428. m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour");
  429. // In response to this message, we are going to make a teleport to the scene we've previous been told
  430. // about by test code (this needs to be improved).
  431. AgentCircuitData newAgent = RequestClientInfo();
  432. // Stage 2: add the new client as a child agent to the scene
  433. TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene);
  434. TeleportTargetScene.AddNewClient(TeleportSceneClient);
  435. }
  436. public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
  437. uint locationID, uint flags, string capsURL)
  438. {
  439. m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport");
  440. CapsSeedUrl = capsURL;
  441. TeleportSceneClient.CompleteMovement();
  442. //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
  443. }
  444. public virtual void SendTeleportFailed(string reason)
  445. {
  446. m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason);
  447. }
  448. public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
  449. IPEndPoint newRegionExternalEndPoint, string capsURL)
  450. {
  451. // This is supposed to send a packet to the client telling it's ready to start region crossing.
  452. // Instead I will just signal I'm ready, mimicking the communication behavior.
  453. // It's ugly, but avoids needless communication setup. This is used in ScenePresenceTests.cs.
  454. // Arthur V.
  455. wh.Set();
  456. }
  457. public virtual void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
  458. {
  459. }
  460. public virtual void SendLocalTeleport(Vector3 position, Vector3 lookAt, uint flags)
  461. {
  462. }
  463. public virtual void SendTeleportLocationStart()
  464. {
  465. }
  466. public virtual void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance)
  467. {
  468. }
  469. public virtual void SendPayPrice(UUID objectID, int[] payPrice)
  470. {
  471. }
  472. public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
  473. uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
  474. {
  475. }
  476. public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
  477. Vector3 position, Vector3 velocity, Quaternion rotation)
  478. {
  479. }
  480. public virtual void SendCoarseLocationUpdate(List<Vector3> CoarseLocations)
  481. {
  482. }
  483. public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID)
  484. {
  485. }
  486. public virtual void SendDialog(string objectname, UUID objectID, UUID ownerID, string msg, UUID textureID, int ch, string[] buttonlabels)
  487. {
  488. }
  489. public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
  490. PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
  491. Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
  492. UUID objectID, UUID ownerID, string text, byte[] color,
  493. uint parentID,
  494. byte[] particleSystem, byte clickAction, byte material)
  495. {
  496. }
  497. public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
  498. PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
  499. Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
  500. UUID objectID, UUID ownerID, string text, byte[] color,
  501. uint parentID,
  502. byte[] particleSystem, byte clickAction, byte material, byte[] textureanimation,
  503. bool attachment, uint AttachmentPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
  504. {
  505. }
  506. public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
  507. Vector3 position, Quaternion rotation, Vector3 velocity,
  508. Vector3 rotationalvelocity, byte state, UUID AssetId,
  509. UUID ownerID, int attachPoint)
  510. {
  511. }
  512. public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
  513. List<InventoryItemBase> items,
  514. List<InventoryFolderBase> folders,
  515. bool fetchFolders,
  516. bool fetchItems)
  517. {
  518. }
  519. public virtual void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item)
  520. {
  521. }
  522. public virtual void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackID)
  523. {
  524. }
  525. public virtual void SendRemoveInventoryItem(UUID itemID)
  526. {
  527. }
  528. public virtual void SendBulkUpdateInventory(InventoryNodeBase node)
  529. {
  530. }
  531. public UUID GetDefaultAnimation(string name)
  532. {
  533. return UUID.Zero;
  534. }
  535. public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
  536. {
  537. }
  538. public virtual void SendTaskInventory(UUID taskID, short serial, byte[] fileName)
  539. {
  540. }
  541. public virtual void SendXferPacket(ulong xferID, uint packet, byte[] data)
  542. {
  543. }
  544. public virtual void SendEconomyData(float EnergyEfficiency, int ObjectCapacity, int ObjectCount, int PriceEnergyUnit,
  545. int PriceGroupCreate, int PriceObjectClaim, float PriceObjectRent, float PriceObjectScaleFactor,
  546. int PriceParcelClaim, float PriceParcelClaimFactor, int PriceParcelRent, int PricePublicObjectDecay,
  547. int PricePublicObjectDelete, int PriceRentLight, int PriceUpload, int TeleportMinPrice, float TeleportPriceExponent)
  548. {
  549. }
  550. public virtual void SendNameReply(UUID profileId, string firstname, string lastname)
  551. {
  552. }
  553. public virtual void SendPreLoadSound(UUID objectID, UUID ownerID, UUID soundID)
  554. {
  555. }
  556. public virtual void SendPlayAttachedSound(UUID soundID, UUID objectID, UUID ownerID, float gain,
  557. byte flags)
  558. {
  559. }
  560. public void SendTriggeredSound(UUID soundID, UUID ownerID, UUID objectID, UUID parentID, ulong handle, Vector3 position, float gain)
  561. {
  562. }
  563. public void SendAttachedSoundGainChange(UUID objectID, float gain)
  564. {
  565. }
  566. public void SendAlertMessage(string message)
  567. {
  568. }
  569. public void SendAgentAlertMessage(string message, bool modal)
  570. {
  571. }
  572. public void SendSystemAlertMessage(string message)
  573. {
  574. }
  575. public void SendLoadURL(string objectname, UUID objectID, UUID ownerID, bool groupOwned, string message,
  576. string url)
  577. {
  578. }
  579. public virtual void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args)
  580. {
  581. if (OnRegionHandShakeReply != null)
  582. {
  583. OnRegionHandShakeReply(this);
  584. }
  585. if (OnCompleteMovementToRegion != null)
  586. {
  587. OnCompleteMovementToRegion();
  588. }
  589. }
  590. public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
  591. {
  592. }
  593. public void SendConfirmXfer(ulong xferID, uint PacketID)
  594. {
  595. }
  596. public void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName)
  597. {
  598. }
  599. public void SendInitiateDownload(string simFileName, string clientFileName)
  600. {
  601. }
  602. public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
  603. {
  604. ImageDataPacket im = new ImageDataPacket();
  605. im.Header.Reliable = false;
  606. im.ImageID.Packets = numParts;
  607. im.ImageID.ID = ImageUUID;
  608. if (ImageSize > 0)
  609. im.ImageID.Size = ImageSize;
  610. im.ImageData.Data = ImageData;
  611. im.ImageID.Codec = imageCodec;
  612. im.Header.Zerocoded = true;
  613. sentdatapkt.Add(im);
  614. }
  615. public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
  616. {
  617. ImagePacketPacket im = new ImagePacketPacket();
  618. im.Header.Reliable = false;
  619. im.ImageID.Packet = partNumber;
  620. im.ImageID.ID = imageUuid;
  621. im.ImageData.Data = imageData;
  622. sentpktpkt.Add(im);
  623. }
  624. public void SendImageNotFound(UUID imageid)
  625. {
  626. }
  627. public void SendShutdownConnectionNotice()
  628. {
  629. }
  630. public void SendSimStats(SimStats stats)
  631. {
  632. }
  633. public void SendObjectPropertiesFamilyData(uint RequestFlags, UUID ObjectUUID, UUID OwnerID, UUID GroupID,
  634. uint BaseMask, uint OwnerMask, uint GroupMask, uint EveryoneMask,
  635. uint NextOwnerMask, int OwnershipCost, byte SaleType,int SalePrice, uint Category,
  636. UUID LastOwnerID, string ObjectName, string Description)
  637. {
  638. }
  639. public void SendObjectPropertiesReply(UUID ItemID, ulong CreationDate, UUID CreatorUUID, UUID FolderUUID, UUID FromTaskUUID,
  640. UUID GroupUUID, short InventorySerial, UUID LastOwnerUUID, UUID ObjectUUID,
  641. UUID OwnerUUID, string TouchTitle, byte[] TextureID, string SitTitle, string ItemName,
  642. string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
  643. uint BaseMask, byte saleType, int salePrice)
  644. {
  645. }
  646. public void SendAgentOffline(UUID[] agentIDs)
  647. {
  648. }
  649. public void SendAgentOnline(UUID[] agentIDs)
  650. {
  651. }
  652. public void SendSitResponse(UUID TargetID, Vector3 OffsetPos, Quaternion SitOrientation, bool autopilot,
  653. Vector3 CameraAtOffset, Vector3 CameraEyeOffset, bool ForceMouseLook)
  654. {
  655. }
  656. public void SendAdminResponse(UUID Token, uint AdminLevel)
  657. {
  658. }
  659. public void SendGroupMembership(GroupMembershipData[] GroupMembership)
  660. {
  661. }
  662. public bool AddMoney(int debit)
  663. {
  664. return false;
  665. }
  666. public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong time, uint dlen, uint ylen, float phase)
  667. {
  668. }
  669. public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
  670. {
  671. }
  672. public void SendViewerTime(int phase)
  673. {
  674. }
  675. public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember,
  676. string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL,
  677. UUID partnerID)
  678. {
  679. }
  680. public void SetDebugPacketLevel(int newDebug)
  681. {
  682. }
  683. public void InPacket(object NewPack)
  684. {
  685. }
  686. public void ProcessInPacket(Packet NewPack)
  687. {
  688. }
  689. public void Close(bool ShutdownCircuit)
  690. {
  691. m_scene.RemoveClient(AgentId);
  692. }
  693. public void Start()
  694. {
  695. }
  696. public void Stop()
  697. {
  698. }
  699. public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
  700. {
  701. }
  702. public void SendLogoutPacket()
  703. {
  704. }
  705. public void Terminate()
  706. {
  707. }
  708. public ClientInfo GetClientInfo()
  709. {
  710. return null;
  711. }
  712. public void SetClientInfo(ClientInfo info)
  713. {
  714. }
  715. public void SendScriptQuestion(UUID objectID, string taskName, string ownerName, UUID itemID, int question)
  716. {
  717. }
  718. public void SendHealth(float health)
  719. {
  720. }
  721. public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID)
  722. {
  723. }
  724. public void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID)
  725. {
  726. }
  727. public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
  728. {
  729. }
  730. public void SendEstateCovenantInformation(UUID covenant)
  731. {
  732. }
  733. public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
  734. {
  735. }
  736. public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
  737. {
  738. }
  739. public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)
  740. {
  741. }
  742. public void SendForceClientSelectObjects(List<uint> objectIDs)
  743. {
  744. }
  745. public void SendLandObjectOwners(Dictionary<UUID, int> ownersAndCount)
  746. {
  747. }
  748. public void SendLandParcelOverlay(byte[] data, int sequence_id)
  749. {
  750. }
  751. public void SendParcelMediaCommand(uint flags, ParcelMediaCommandEnum command, float time)
  752. {
  753. }
  754. public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, byte autoScale, string mediaType,
  755. string mediaDesc, int mediaWidth, int mediaHeight, byte mediaLoop)
  756. {
  757. }
  758. public void SendGroupNameReply(UUID groupLLUID, string GroupName)
  759. {
  760. }
  761. public void SendLandStatReply(uint reportType, uint requestFlags, uint resultCount, LandStatReportItem[] lsrpia)
  762. {
  763. }
  764. public void SendScriptRunningReply(UUID objectID, UUID itemID, bool running)
  765. {
  766. }
  767. public void SendAsset(AssetRequestToClient req)
  768. {
  769. }
  770. public void SendTexture(AssetBase TextureAsset)
  771. {
  772. }
  773. public void SendSetFollowCamProperties (UUID objectID, SortedDictionary<int, float> parameters)
  774. {
  775. }
  776. public void SendClearFollowCamProperties (UUID objectID)
  777. {
  778. }
  779. public void SendRegionHandle (UUID regoinID, ulong handle)
  780. {
  781. }
  782. public void SendParcelInfo (RegionInfo info, LandData land, UUID parcelID, uint x, uint y)
  783. {
  784. }
  785. public void SetClientOption(string option, string value)
  786. {
  787. }
  788. public string GetClientOption(string option)
  789. {
  790. return string.Empty;
  791. }
  792. public void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt)
  793. {
  794. }
  795. public void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data)
  796. {
  797. }
  798. public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data)
  799. {
  800. }
  801. public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data)
  802. {
  803. }
  804. public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data)
  805. {
  806. }
  807. public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data)
  808. {
  809. }
  810. public void SendDirLandReply(UUID queryID, DirLandReplyData[] data)
  811. {
  812. }
  813. public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data)
  814. {
  815. }
  816. public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
  817. {
  818. }
  819. public void KillEndDone()
  820. {
  821. }
  822. public void SendEventInfoReply (EventData info)
  823. {
  824. }
  825. public void SendOfferCallingCard (UUID destID, UUID transactionID)
  826. {
  827. }
  828. public void SendAcceptCallingCard (UUID transactionID)
  829. {
  830. }
  831. public void SendDeclineCallingCard (UUID transactionID)
  832. {
  833. }
  834. public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data)
  835. {
  836. }
  837. public void SendJoinGroupReply(UUID groupID, bool success)
  838. {
  839. }
  840. public void SendEjectGroupMemberReply(UUID agentID, UUID groupID, bool succss)
  841. {
  842. }
  843. public void SendLeaveGroupReply(UUID groupID, bool success)
  844. {
  845. }
  846. public void SendTerminateFriend(UUID exFriendID)
  847. {
  848. }
  849. public bool AddGenericPacketHandler(string MethodName, GenericMessage handler)
  850. {
  851. //throw new NotImplementedException();
  852. return false;
  853. }
  854. public void SendAvatarClassifiedReply(UUID targetID, UUID[] classifiedID, string[] name)
  855. {
  856. }
  857. 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)
  858. {
  859. }
  860. public void SendAgentDropGroup(UUID groupID)
  861. {
  862. }
  863. public void SendAvatarNotesReply(UUID targetID, string text)
  864. {
  865. }
  866. public void SendAvatarPicksReply(UUID targetID, Dictionary<UUID, string> picks)
  867. {
  868. }
  869. public void SendAvatarClassifiedReply(UUID targetID, Dictionary<UUID, string> classifieds)
  870. {
  871. }
  872. public void SendParcelDwellReply(int localID, UUID parcelID, float dwell)
  873. {
  874. }
  875. public void SendUserInfoReply(bool imViaEmail, bool visible, string email)
  876. {
  877. }
  878. }
  879. }