Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. public bool Validate (TradeOffer offer)
  2. {
  3.     Log.Warn("getting trade offer items");
  4.     Log.Warn("getting MY offer items");
  5.     if (offer.Items.GetMyItems() != null)
  6.     {
  7.         Bot.GetInventory();
  8.         foreach (var a in offer.Items.GetMyItems())
  9.         {
  10.             Inventory.Item item = null;
  11.             try
  12.             {
  13.                 for (int i = 0; i < 5; i++)
  14.                 {
  15.                     item = Bot.MyInventory.GetItem((ulong)a.AssetId);
  16.                     if (item != null) break;
  17.                 }
  18.                 Log.Info("Defindex:{5}, AppID:{0}, ContextID:{1}, Amount:{2}, AssetID:{3}, CurrencyID:{4}", a.AppId, a.ContextId, a.Amount, a.AssetId, a.CurrencyId, item.Defindex);
  19.             }
  20.             catch (System.Net.WebException e)
  21.             {
  22.                 Log.Warn("Failed to get inventory items.");
  23.                 //return false;
  24.             }
  25.         }
  26.     }
  27.  
  28.     Log.Warn("getting THEIR offer items");
  29.     if (offer.Items.GetTheirItems() != null)
  30.     {
  31.         GetOtherInventory();
  32.         foreach (var a in offer.Items.GetTheirItems())
  33.         {
  34.             Inventory.Item item = null;
  35.             try
  36.             {
  37.                 for (int i = 0; i < 5; i++)
  38.                 {
  39.                     item = OtherInventory.GetItem((ulong)a.AssetId);
  40.                     if (item != null) break;
  41.                 }
  42.                 Log.Info("Defindex:{5}, AppID:{0}, ContextID:{1}, Amount:{2}, AssetID:{3}, CurrencyID:{4}", a.AppId, a.ContextId, a.Amount, a.AssetId, a.CurrencyId, item.Defindex);
  43.             }
  44.             catch (System.Net.WebException e)
  45.             {
  46.                 Log.Warn("Failed to get inventory items.");
  47.                 //return false;
  48.             }
  49.         }
  50.     }
  51.  
  52.     return false;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement