Bot.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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.Text;
  30. using System.IO;
  31. using System.Reflection;
  32. using System.Threading;
  33. using System.Timers;
  34. using log4net;
  35. using OpenMetaverse;
  36. using OpenMetaverse.Assets;
  37. using Nini.Config;
  38. using OpenSim.Framework;
  39. using OpenSim.Framework.Console;
  40. using pCampBot.Interfaces;
  41. using Timer = System.Timers.Timer;
  42. using PermissionMask = OpenSim.Framework.PermissionMask;
  43. namespace pCampBot
  44. {
  45. public enum ConnectionState
  46. {
  47. Disconnected,
  48. Connecting,
  49. Connected,
  50. Disconnecting
  51. }
  52. public class Bot
  53. {
  54. private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  55. public delegate void AnEvent(Bot callbot, EventType someevent); // event delegate for bot events
  56. /// <summary>
  57. /// Controls whether bots request textures for the object information they receive
  58. /// </summary>
  59. public bool RequestObjectTextures { get; set; }
  60. /// <summary>
  61. /// Bot manager.
  62. /// </summary>
  63. public BotManager Manager { get; private set; }
  64. /// <summary>
  65. /// Behaviours implemented by this bot.
  66. /// </summary>
  67. /// <remarks>
  68. /// Lock this list before manipulating it.
  69. /// </remarks>
  70. public List<IBehaviour> Behaviours { get; private set; }
  71. /// <summary>
  72. /// Objects that the bot has discovered.
  73. /// </summary>
  74. /// <remarks>
  75. /// Returns a list copy. Inserting new objects manually will have no effect.
  76. /// </remarks>
  77. public Dictionary<UUID, Primitive> Objects
  78. {
  79. get
  80. {
  81. lock (m_objects)
  82. return new Dictionary<UUID, Primitive>(m_objects);
  83. }
  84. }
  85. private Dictionary<UUID, Primitive> m_objects = new Dictionary<UUID, Primitive>();
  86. /// <summary>
  87. /// Is this bot connected to the grid?
  88. /// </summary>
  89. public ConnectionState ConnectionState { get; private set; }
  90. public List<Simulator> Simulators
  91. {
  92. get
  93. {
  94. lock (Client.Network.Simulators)
  95. return new List<Simulator>(Client.Network.Simulators);
  96. }
  97. }
  98. /// <summary>
  99. /// The number of connections that this bot has to different simulators.
  100. /// </summary>
  101. /// <value>Includes both root and child connections.</value>
  102. public int SimulatorsCount
  103. {
  104. get
  105. {
  106. lock (Client.Network.Simulators)
  107. return Client.Network.Simulators.Count;
  108. }
  109. }
  110. public string FirstName { get; private set; }
  111. public string LastName { get; private set; }
  112. public string Name { get; private set; }
  113. public string Password { get; private set; }
  114. public string LoginUri { get; private set; }
  115. public string StartLocation { get; private set; }
  116. public string saveDir;
  117. public string wear;
  118. public event AnEvent OnConnected;
  119. public event AnEvent OnDisconnected;
  120. /// <summary>
  121. /// Keep a track of the continuously acting thread so that we can abort it.
  122. /// </summary>
  123. private Thread m_actionThread;
  124. protected List<uint> objectIDs = new List<uint>();
  125. /// <summary>
  126. /// Random number generator.
  127. /// </summary>
  128. public Random Random { get; private set; }
  129. /// <summary>
  130. /// New instance of a SecondLife client
  131. /// </summary>
  132. public GridClient Client { get; private set; }
  133. /// <summary>
  134. /// Constructor
  135. /// </summary>
  136. /// <param name="bm"></param>
  137. /// <param name="behaviours">Behaviours for this bot to perform</param>
  138. /// <param name="firstName"></param>
  139. /// <param name="lastName"></param>
  140. /// <param name="password"></param>
  141. /// <param name="loginUri"></param>
  142. /// <param name="behaviours"></param>
  143. public Bot(
  144. BotManager bm, List<IBehaviour> behaviours,
  145. string firstName, string lastName, string password, string startLocation, string loginUri)
  146. {
  147. ConnectionState = ConnectionState.Disconnected;
  148. behaviours.ForEach(b => b.Initialize(this));
  149. Random = new Random(Environment.TickCount);// We do stuff randomly here
  150. FirstName = firstName;
  151. LastName = lastName;
  152. Name = string.Format("{0} {1}", FirstName, LastName);
  153. Password = password;
  154. LoginUri = loginUri;
  155. StartLocation = startLocation;
  156. Manager = bm;
  157. Behaviours = behaviours;
  158. // Only calling for use as a template.
  159. CreateLibOmvClient();
  160. }
  161. private void CreateLibOmvClient()
  162. {
  163. GridClient newClient = new GridClient();
  164. if (Client != null)
  165. {
  166. newClient.Settings.LOGIN_SERVER = Client.Settings.LOGIN_SERVER;
  167. newClient.Settings.ALWAYS_DECODE_OBJECTS = Client.Settings.ALWAYS_DECODE_OBJECTS;
  168. newClient.Settings.AVATAR_TRACKING = Client.Settings.AVATAR_TRACKING;
  169. newClient.Settings.OBJECT_TRACKING = Client.Settings.OBJECT_TRACKING;
  170. newClient.Settings.SEND_AGENT_THROTTLE = Client.Settings.SEND_AGENT_THROTTLE;
  171. newClient.Settings.SEND_AGENT_UPDATES = Client.Settings.SEND_AGENT_UPDATES;
  172. newClient.Settings.SEND_PINGS = Client.Settings.SEND_PINGS;
  173. newClient.Settings.STORE_LAND_PATCHES = Client.Settings.STORE_LAND_PATCHES;
  174. newClient.Settings.USE_ASSET_CACHE = Client.Settings.USE_ASSET_CACHE;
  175. newClient.Settings.MULTIPLE_SIMS = Client.Settings.MULTIPLE_SIMS;
  176. newClient.Throttle.Asset = Client.Throttle.Asset;
  177. newClient.Throttle.Land = Client.Throttle.Land;
  178. newClient.Throttle.Task = Client.Throttle.Task;
  179. newClient.Throttle.Texture = Client.Throttle.Texture;
  180. newClient.Throttle.Wind = Client.Throttle.Wind;
  181. newClient.Throttle.Total = Client.Throttle.Total;
  182. }
  183. else
  184. {
  185. newClient.Settings.LOGIN_SERVER = LoginUri;
  186. newClient.Settings.ALWAYS_DECODE_OBJECTS = false;
  187. newClient.Settings.AVATAR_TRACKING = false;
  188. newClient.Settings.OBJECT_TRACKING = false;
  189. newClient.Settings.SEND_AGENT_THROTTLE = true;
  190. newClient.Settings.SEND_PINGS = true;
  191. newClient.Settings.STORE_LAND_PATCHES = false;
  192. newClient.Settings.USE_ASSET_CACHE = false;
  193. newClient.Settings.MULTIPLE_SIMS = true;
  194. newClient.Throttle.Asset = 100000;
  195. newClient.Throttle.Land = 100000;
  196. newClient.Throttle.Task = 100000;
  197. newClient.Throttle.Texture = 100000;
  198. newClient.Throttle.Wind = 100000;
  199. newClient.Throttle.Total = 400000;
  200. }
  201. newClient.Network.LoginProgress += this.Network_LoginProgress;
  202. newClient.Network.SimConnected += this.Network_SimConnected;
  203. newClient.Network.Disconnected += this.Network_OnDisconnected;
  204. newClient.Objects.ObjectUpdate += Objects_NewPrim;
  205. Client = newClient;
  206. }
  207. //We do our actions here. This is where one would
  208. //add additional steps and/or things the bot should do
  209. private void Action()
  210. {
  211. while (ConnectionState != ConnectionState.Disconnecting)
  212. lock (Behaviours)
  213. Behaviours.ForEach(
  214. b =>
  215. {
  216. Thread.Sleep(Random.Next(3000, 10000));
  217. // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
  218. b.Action();
  219. }
  220. );
  221. }
  222. /// <summary>
  223. /// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes.
  224. /// </summary>
  225. public void Disconnect()
  226. {
  227. ConnectionState = ConnectionState.Disconnecting;
  228. // if (m_actionThread != null)
  229. // m_actionThread.Abort();
  230. Client.Network.Logout();
  231. }
  232. public void Connect()
  233. {
  234. Thread connectThread = new Thread(ConnectInternal);
  235. connectThread.Name = Name;
  236. connectThread.IsBackground = true;
  237. connectThread.Start();
  238. }
  239. /// <summary>
  240. /// This is the bot startup loop.
  241. /// </summary>
  242. private void ConnectInternal()
  243. {
  244. ConnectionState = ConnectionState.Connecting;
  245. // Current create a new client on each connect. libomv doesn't seem to process new sim
  246. // information (e.g. EstablishAgentCommunication events) if connecting after a disceonnect with the same
  247. // client
  248. CreateLibOmvClient();
  249. if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", StartLocation, "Your name"))
  250. {
  251. ConnectionState = ConnectionState.Connected;
  252. Thread.Sleep(Random.Next(1000, 10000));
  253. m_actionThread = new Thread(Action);
  254. m_actionThread.Start();
  255. // OnConnected(this, EventType.CONNECTED);
  256. if (wear == "save")
  257. {
  258. Client.Appearance.SetPreviousAppearance();
  259. SaveDefaultAppearance();
  260. }
  261. else if (wear != "no")
  262. {
  263. MakeDefaultAppearance(wear);
  264. }
  265. // Extract nearby region information.
  266. Client.Grid.GridRegion += Manager.Grid_GridRegion;
  267. uint xUint, yUint;
  268. Utils.LongToUInts(Client.Network.CurrentSim.Handle, out xUint, out yUint);
  269. ushort minX, minY, maxX, maxY;
  270. minX = (ushort)Math.Min(0, xUint - 5);
  271. minY = (ushort)Math.Min(0, yUint - 5);
  272. maxX = (ushort)(xUint + 5);
  273. maxY = (ushort)(yUint + 5);
  274. Client.Grid.RequestMapBlocks(GridLayerType.Terrain, minX, minY, maxX, maxY, false);
  275. }
  276. else
  277. {
  278. ConnectionState = ConnectionState.Disconnected;
  279. m_log.ErrorFormat(
  280. "{0} {1} cannot login: {2}", FirstName, LastName, Client.Network.LoginMessage);
  281. if (OnDisconnected != null)
  282. {
  283. OnDisconnected(this, EventType.DISCONNECTED);
  284. }
  285. }
  286. }
  287. /// <summary>
  288. /// Sit this bot on the ground.
  289. /// </summary>
  290. public void SitOnGround()
  291. {
  292. if (ConnectionState == ConnectionState.Connected)
  293. Client.Self.SitOnGround();
  294. }
  295. /// <summary>
  296. /// Stand this bot
  297. /// </summary>
  298. public void Stand()
  299. {
  300. if (ConnectionState == ConnectionState.Connected)
  301. {
  302. // Unlike sit on ground, here libomv checks whether we have SEND_AGENT_UPDATES enabled.
  303. bool prevUpdatesSetting = Client.Settings.SEND_AGENT_UPDATES;
  304. Client.Settings.SEND_AGENT_UPDATES = true;
  305. Client.Self.Stand();
  306. Client.Settings.SEND_AGENT_UPDATES = prevUpdatesSetting;
  307. }
  308. }
  309. public void SaveDefaultAppearance()
  310. {
  311. saveDir = "MyAppearance/" + FirstName + "_" + LastName;
  312. if (!Directory.Exists(saveDir))
  313. {
  314. Directory.CreateDirectory(saveDir);
  315. }
  316. Array wtypes = Enum.GetValues(typeof(WearableType));
  317. foreach (WearableType wtype in wtypes)
  318. {
  319. UUID wearable = Client.Appearance.GetWearableAsset(wtype);
  320. if (wearable != UUID.Zero)
  321. {
  322. Client.Assets.RequestAsset(wearable, AssetType.Clothing, false, Asset_ReceivedCallback);
  323. Client.Assets.RequestAsset(wearable, AssetType.Bodypart, false, Asset_ReceivedCallback);
  324. }
  325. }
  326. }
  327. public void SaveAsset(AssetWearable asset)
  328. {
  329. if (asset != null)
  330. {
  331. try
  332. {
  333. if (asset.Decode())
  334. {
  335. File.WriteAllBytes(Path.Combine(saveDir, String.Format("{1}.{0}",
  336. asset.AssetType.ToString().ToLower(),
  337. asset.WearableType)), asset.AssetData);
  338. }
  339. else
  340. {
  341. m_log.WarnFormat("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID);
  342. }
  343. }
  344. catch (Exception e)
  345. {
  346. m_log.ErrorFormat("Exception: {0}{1}", e.Message, e.StackTrace);
  347. }
  348. }
  349. }
  350. public WearableType GetWearableType(string path)
  351. {
  352. string type = ((((path.Split('/'))[2]).Split('.'))[0]).Trim();
  353. switch (type)
  354. {
  355. case "Eyes":
  356. return WearableType.Eyes;
  357. case "Hair":
  358. return WearableType.Hair;
  359. case "Pants":
  360. return WearableType.Pants;
  361. case "Shape":
  362. return WearableType.Shape;
  363. case "Shirt":
  364. return WearableType.Shirt;
  365. case "Skin":
  366. return WearableType.Skin;
  367. default:
  368. return WearableType.Shape;
  369. }
  370. }
  371. public void MakeDefaultAppearance(string wear)
  372. {
  373. try
  374. {
  375. if (wear == "yes")
  376. {
  377. //TODO: Implement random outfit picking
  378. m_log.DebugFormat("Picks a random outfit. Not yet implemented.");
  379. }
  380. else if (wear != "save")
  381. saveDir = "MyAppearance/" + wear;
  382. saveDir = saveDir + "/";
  383. string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly);
  384. string[] bodyparts = Directory.GetFiles(saveDir, "*.bodypart", SearchOption.TopDirectoryOnly);
  385. InventoryFolder clothfolder = FindClothingFolder();
  386. UUID transid = UUID.Random();
  387. List<InventoryBase> listwearables = new List<InventoryBase>();
  388. for (int i = 0; i < clothing.Length; i++)
  389. {
  390. UUID assetID = UUID.Random();
  391. AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i]));
  392. asset.Decode();
  393. asset.Owner = Client.Self.AgentID;
  394. asset.WearableType = GetWearableType(clothing[i]);
  395. asset.Encode();
  396. transid = Client.Assets.RequestUpload(asset,true);
  397. Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing,
  398. transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask)PermissionMask.All, delegate(bool success, InventoryItem item)
  399. {
  400. if (success)
  401. {
  402. listwearables.Add(item);
  403. }
  404. else
  405. {
  406. m_log.WarnFormat("Failed to create item {0}", item.Name);
  407. }
  408. }
  409. );
  410. }
  411. for (int i = 0; i < bodyparts.Length; i++)
  412. {
  413. UUID assetID = UUID.Random();
  414. AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i]));
  415. asset.Decode();
  416. asset.Owner = Client.Self.AgentID;
  417. asset.WearableType = GetWearableType(bodyparts[i]);
  418. asset.Encode();
  419. transid = Client.Assets.RequestUpload(asset,true);
  420. Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart,
  421. transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask)PermissionMask.All, delegate(bool success, InventoryItem item)
  422. {
  423. if (success)
  424. {
  425. listwearables.Add(item);
  426. }
  427. else
  428. {
  429. m_log.WarnFormat("Failed to create item {0}", item.Name);
  430. }
  431. }
  432. );
  433. }
  434. Thread.Sleep(1000);
  435. if (listwearables == null || listwearables.Count == 0)
  436. {
  437. m_log.DebugFormat("Nothing to send on this folder!");
  438. }
  439. else
  440. {
  441. m_log.DebugFormat("Sending {0} wearables...", listwearables.Count);
  442. Client.Appearance.WearOutfit(listwearables, false);
  443. }
  444. }
  445. catch (Exception ex)
  446. {
  447. Console.WriteLine(ex.ToString());
  448. }
  449. }
  450. public InventoryFolder FindClothingFolder()
  451. {
  452. UUID rootfolder = Client.Inventory.Store.RootFolder.UUID;
  453. List<InventoryBase> listfolders = Client.Inventory.Store.GetContents(rootfolder);
  454. InventoryFolder clothfolder = new InventoryFolder(UUID.Random());
  455. foreach (InventoryBase folder in listfolders)
  456. {
  457. if (folder.Name == "Clothing")
  458. {
  459. clothfolder = (InventoryFolder)folder;
  460. break;
  461. }
  462. }
  463. return clothfolder;
  464. }
  465. public void Network_LoginProgress(object sender, LoginProgressEventArgs args)
  466. {
  467. m_log.DebugFormat("[BOT]: Bot {0} {1} in Network_LoginProcess", Name, args.Status);
  468. if (args.Status == LoginStatus.Success)
  469. {
  470. if (OnConnected != null)
  471. {
  472. OnConnected(this, EventType.CONNECTED);
  473. }
  474. }
  475. }
  476. public void Network_SimConnected(object sender, SimConnectedEventArgs args)
  477. {
  478. m_log.DebugFormat(
  479. "[BOT]: Bot {0} connected to {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint);
  480. }
  481. public void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
  482. {
  483. ConnectionState = ConnectionState.Disconnected;
  484. m_log.DebugFormat(
  485. "[BOT]: Bot {0} disconnected reason {1}, message {2}", Name, args.Reason, args.Message);
  486. // m_log.ErrorFormat("Fired Network_OnDisconnected");
  487. // if (
  488. // (args.Reason == NetworkManager.DisconnectType.SimShutdown
  489. // || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
  490. // && OnDisconnected != null)
  491. if (
  492. (args.Reason == NetworkManager.DisconnectType.ClientInitiated
  493. || args.Reason == NetworkManager.DisconnectType.ServerInitiated
  494. || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
  495. && OnDisconnected != null)
  496. // if (OnDisconnected != null)
  497. {
  498. OnDisconnected(this, EventType.DISCONNECTED);
  499. }
  500. }
  501. public void Objects_NewPrim(object sender, PrimEventArgs args)
  502. {
  503. if (!RequestObjectTextures)
  504. return;
  505. Primitive prim = args.Prim;
  506. if (prim != null)
  507. {
  508. lock (m_objects)
  509. m_objects[prim.ID] = prim;
  510. if (prim.Textures != null)
  511. {
  512. if (prim.Textures.DefaultTexture.TextureID != UUID.Zero)
  513. {
  514. GetTexture(prim.Textures.DefaultTexture.TextureID);
  515. }
  516. for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
  517. {
  518. Primitive.TextureEntryFace face = prim.Textures.FaceTextures[i];
  519. if (face != null)
  520. {
  521. UUID textureID = prim.Textures.FaceTextures[i].TextureID;
  522. if (textureID != UUID.Zero)
  523. GetTexture(textureID);
  524. }
  525. }
  526. }
  527. if (prim.Sculpt != null && prim.Sculpt.SculptTexture != UUID.Zero)
  528. GetTexture(prim.Sculpt.SculptTexture);
  529. }
  530. }
  531. private void GetTexture(UUID textureID)
  532. {
  533. lock (Manager.AssetsReceived)
  534. {
  535. // Don't request assets more than once.
  536. if (Manager.AssetsReceived.ContainsKey(textureID))
  537. return;
  538. Manager.AssetsReceived[textureID] = false;
  539. Client.Assets.RequestImage(textureID, ImageType.Normal, Asset_TextureCallback_Texture);
  540. }
  541. }
  542. public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture)
  543. {
  544. //TODO: Implement texture saving and applying
  545. }
  546. public void Asset_ReceivedCallback(AssetDownload transfer, Asset asset)
  547. {
  548. lock (Manager.AssetsReceived)
  549. Manager.AssetsReceived[asset.AssetID] = true;
  550. // if (wear == "save")
  551. // {
  552. // SaveAsset((AssetWearable) asset);
  553. // }
  554. }
  555. }
  556. }