Advertisement
sibble

Search Method

Sep 16th, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.82 KB | None | 0 0
  1.  
  2.         public static void LootCorpse(Corpse _corpse)
  3.         {
  4.             _corpse.Use();
  5.  
  6.             Thread.Sleep(500);
  7.  
  8.             //Container _container = new Container(Container.Serial.Value);
  9.  
  10.             Stopwatch _lootTimer = new Stopwatch();
  11.  
  12.             _lootTimer.Start();
  13.             #region New Search
  14.             var _weapons = Item.Find(typeof(BaseWeapon), _corpse.Serial.Value, false);
  15.             var _armor = Item.Find(typeof(BaseArmor), _corpse.Serial.Value, false);
  16.             var _jewelry = Item.Find(typeof(BaseJewel), _corpse.Serial.Value, false);
  17.             foreach (BaseWeapon _i in _weapons)
  18.             {
  19.                 if (_i.WeaponAttributes.SplinteringWeapon > 15)
  20.                 {
  21.                     if (_i.Brittle)
  22.                         ConsoleMessage("Found brittle splintering weapon", ConsoleColor.Yellow);
  23.                     else
  24.                         ConsoleMessage("Found clean splintering weapon", ConsoleColor.Yellow);
  25.                 }
  26.                 if (_i.LootValue.Equals(LootValue.LegendaryArtifact))
  27.                     ConsoleMessage("Found legendary weapon", ConsoleColor.Yellow);
  28.                 else if (_i.LootValue.Equals(LootValue.MajorArtifact))
  29.                     ConsoleMessage("Found legendary weapon", ConsoleColor.Yellow);
  30.             }
  31.             foreach (BaseArmor _i in _armor)
  32.             {
  33.  
  34.                 if (_i.LootValue.Equals(LootValue.LegendaryArtifact))
  35.                     ConsoleMessage("Found legendary armor", ConsoleColor.Yellow);
  36.                 else if (_i.LootValue.Equals(LootValue.MajorArtifact))
  37.                     ConsoleMessage("Found legendary armor", ConsoleColor.Yellow);
  38.             }
  39.             foreach (BaseJewel _i in _jewelry)
  40.             {
  41.  
  42.                 if (_i.LootValue.Equals(LootValue.LegendaryArtifact))
  43.                     ConsoleMessage("Found legendary jewelry", ConsoleColor.Yellow);
  44.                 else if (_i.LootValue.Equals(LootValue.MajorArtifact))
  45.                     ConsoleMessage("Found legendary jewelry", ConsoleColor.Yellow);
  46.             }
  47.             #endregion
  48.             _lootTimer.Stop();
  49.             ConsoleMessage("New search took {0}", ConsoleColor.Green, _lootTimer.Elapsed);
  50.            
  51.             _lootTimer.Restart();
  52.             #region Old Search
  53.             List<Item> _container = new List<Item>();
  54.             List<uint> _findList = new List<uint>();
  55.  
  56.             Stealth.Client.FindTypeEx(0xFFFF, 0xFFFF, _corpse.Serial.Value, true);
  57.             if (!(Stealth.Client.GetFindCount() == 0))
  58.                 _findList = Stealth.Client.GetFindList();
  59.  
  60.             foreach (uint _item in _findList)
  61.             {
  62.                 _container.Add(new Item(new Serial(_item)));
  63.             }
  64.             Thread.Sleep(500);
  65.  
  66.             List<Loot> _toLootList = new List<Loot>();
  67.             Regex _splinter = new Regex(@"splintering weapon [2,3][0,5]%", RegexOptions.IgnoreCase);
  68.  
  69.             List<uint> _firstList = new List<uint>();
  70.  
  71.             foreach (Item _loot in _container)
  72.             {
  73.                 //ConsoleMessage("parsing item: " + _loot.Serial.Value);
  74.                 bool _cursed = false;
  75.                 bool _antique = false;
  76.                 bool _legendary = false;
  77.                 bool _major = false;
  78.                 bool _splintering = false;
  79.  
  80.                 string[] _tooltip = _loot.Tooltip.Split('|');
  81.                 //ConsoleMessage(_loot.Tooltip);
  82.                 foreach (string _s in _tooltip)
  83.                 {
  84.                     if (Regex.IsMatch(_s, "cursed", RegexOptions.IgnoreCase))
  85.                         _cursed = true;
  86.                     if (Regex.IsMatch(_s, "antique", RegexOptions.IgnoreCase))
  87.                         _antique = true;
  88.                     if (Regex.IsMatch(_s, "major artifact", RegexOptions.IgnoreCase))
  89.                         _major = true;
  90.                     if (Regex.IsMatch(_s, "legendary", RegexOptions.IgnoreCase))
  91.                         _legendary = true;
  92.                     if (_splinter.IsMatch(_s))
  93.                         _splintering = true;
  94.                 }
  95.  
  96.                 if (_cursed || _antique)
  97.                     continue;
  98.                 else if (_major)
  99.                     _toLootList.Add(new Loot(_loot.Serial, "Major Artifact"));
  100.                 else if (_legendary)
  101.                     _toLootList.Add(new Loot(_loot.Serial, "Legendary Artifact"));
  102.                 else if (_splintering)
  103.                     _toLootList.Add(new Loot(_loot.Serial, "Splintering Weapon"));
  104.  
  105.                 Scanner.Ignore(_loot.Serial);
  106.  
  107.             }
  108.             #endregion
  109.             _lootTimer.Stop();
  110.             ConsoleMessage("Old search took {0}", ConsoleColor.Green, _lootTimer.Elapsed);
  111.            
  112.             if (_toLootList.Count() > 0)
  113.                 LootItems(_toLootList);
  114.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement