Advertisement
tiagofmcosta

RepCollector

Nov 9th, 2012
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 12.51 KB | None | 0 0
  1. /*
  2.  * Big thanks to cdmichaelb (http://www.thebuddyforum.com/members/61405-cdmichaelb.html)
  3.  * for sending me all the necessary ids for the objects on the Lost And Found achievement.
  4.  */
  5.  
  6. #region REFERENCES
  7.  
  8. using System;
  9. using System.Linq;
  10. using System.Threading;
  11. using System.Windows.Media;
  12.  
  13. using Styx;
  14. using Styx.Common;
  15. using Styx.Pathing;
  16. using Styx.Plugins;
  17. using Styx.WoWInternals;
  18. using Styx.WoWInternals.WoWObjects;
  19.  
  20. #endregion
  21.  
  22. namespace RepCollector
  23. {
  24.     internal class RepCollector : HBPlugin
  25.     {
  26.         public override string Name
  27.         {
  28.             get { return "Rep Collector"; }
  29.         }
  30.  
  31.         public override string Author
  32.         {
  33.             get { return "Hazard +tiagofmcosta"; }
  34.         }
  35.  
  36.         public override Version Version
  37.         {
  38.             get { return new Version(1, 1, 2); }
  39.         }
  40.  
  41.         public static LocalPlayer Me
  42.         {
  43.             get { return StyxWoW.Me; }
  44.         }
  45.  
  46.         public override void Pulse()
  47.         {
  48.             Thread.Sleep(1 / 30);
  49.             try
  50.             {
  51.                 if (Me.Combat || Me.IsDead) return;
  52.  
  53.                 OnyxEgg();
  54.                 NetherwingEgg();
  55.                 DarkSoil();
  56.                 AncientGuoLaiCache();
  57.                 LostAndFound();
  58.             }
  59.             catch (ThreadAbortException) {}
  60.         }
  61.  
  62.         private static bool AncientGuoLaiCacheKey() { return Me.BagItems.FirstOrDefault(o => o.Entry == 87779) != null; }
  63.  
  64.         public static void MoveToLocation(WoWPoint loc)
  65.         {
  66.             while (loc.Distance(Me.Location) > 3)
  67.             {
  68.                 if (!Flightor.MountHelper.Mounted)
  69.                     Flightor.MountHelper.MountUp();
  70.  
  71.                 if (!Me.IsMoving)
  72.                     Flightor.MoveTo(loc);
  73.             }
  74.         }
  75.  
  76.         public static void OnyxEgg()
  77.         {
  78.             if (Me.GetReputationLevelWith(1271).Equals(WoWUnitReaction.Exalted))
  79.                 return;
  80.  
  81.             ObjectManager.Update();
  82.             var objList = ObjectManager.GetObjectsOfType<WoWGameObject>()
  83.                 .Where(onyxegg => (onyxegg.Distance2D <= 40 && (onyxegg.Entry == 214945))).OrderBy(onyxegg => onyxegg.Distance).ToList();
  84.             foreach (var onyxegg in objList)
  85.             {
  86.                 if (!onyxegg.InLineOfSight) return;
  87.                 if (Me.Combat) return;
  88.                 MoveToLocation(WoWMovement.CalculatePointFrom(onyxegg.Location, 3));
  89.                 if (!Me.HasAura(40120) && !Me.HasAura(33943))
  90.                     Flightor.MountHelper.Dismount();
  91.                 Thread.Sleep(1000);
  92.                 onyxegg.Interact();
  93.                 Thread.Sleep(2000);
  94.                 Logging.Write(Colors.Blue, "1x Onyx Egg collected!");
  95.                 if (!Flightor.MountHelper.Mounted)
  96.                     Flightor.MountHelper.MountUp();
  97.                 return;
  98.             }
  99.         }
  100.  
  101.         public static void NetherwingEgg()
  102.         {
  103.             if (Me.GetReputationLevelWith(1015).Equals(WoWUnitReaction.Exalted))
  104.                 return;
  105.  
  106.             ObjectManager.Update();
  107.             var objList = ObjectManager.GetObjectsOfType<WoWGameObject>()
  108.                 .Where(netherwingegg => (netherwingegg.Distance2D <= 40 && (netherwingegg.Entry == 185915))).OrderBy(netherwingegg => netherwingegg.Distance).ToList();
  109.             foreach (var netherwingegg in objList)
  110.             {
  111.                 if (!netherwingegg.InLineOfSight) return;
  112.                 if (Me.Combat) return;
  113.                 MoveToLocation(WoWMovement.CalculatePointFrom(netherwingegg.Location, 3));
  114.                 if (!Me.HasAura(40120) && !Me.HasAura(33943))
  115.                     Flightor.MountHelper.Dismount();
  116.                 Thread.Sleep(1000);
  117.                 netherwingegg.Interact();
  118.                 Thread.Sleep(2000);
  119.                 Logging.Write(Colors.Blue, "1x Netherwing Egg collected!");
  120.                 if (!Flightor.MountHelper.Mounted)
  121.                     Flightor.MountHelper.MountUp();
  122.                 return;
  123.             }
  124.         }
  125.  
  126.         public static void DarkSoil()
  127.         {
  128.             if (Me.GetReputationLevelWith(1272).Equals(WoWUnitReaction.Exalted))
  129.                 return;
  130.  
  131.             ObjectManager.Update();
  132.             var objList = ObjectManager.GetObjectsOfType<WoWGameObject>()
  133.                 .Where(darksoil => (darksoil.Distance2D <= 40 && (darksoil.Entry == 210565))).OrderBy(darksoil => darksoil.Distance).ToList();
  134.             foreach (var darksoil in objList)
  135.             {
  136.                 if (!darksoil.InLineOfSight) return;
  137.                 if (Me.Combat) return;
  138.                 MoveToLocation(WoWMovement.CalculatePointFrom(darksoil.Location, 3));
  139.                 if (!Me.HasAura(40120) && !Me.HasAura(33943))
  140.                     Flightor.MountHelper.Dismount();
  141.                 Thread.Sleep(2000);
  142.                 darksoil.Interact();
  143.                 Thread.Sleep(3000);
  144.                 Logging.Write(Colors.Blue, "1x Dark Soil collected!");
  145.                 if (!Flightor.MountHelper.Mounted)
  146.                     Flightor.MountHelper.MountUp();
  147.                 return;
  148.             }
  149.         }
  150.  
  151.         public static void AncientGuoLaiCache()
  152.         {
  153.             if (Me.GetReputationLevelWith(1269).Equals(WoWUnitReaction.Exalted))
  154.                 return;
  155.  
  156.             ObjectManager.Update();
  157.             var objList = ObjectManager.GetObjectsOfType<WoWGameObject>()
  158.                 .Where(ancientguolaicache => (ancientguolaicache.Distance2D <= 40 && (ancientguolaicache.Entry == 214388))).OrderBy(ancientguolaicache => ancientguolaicache.Distance).ToList();
  159.             foreach (var ancientguolaicache in objList)
  160.             {
  161.                 if (!AncientGuoLaiCacheKey()) return;
  162.                 if (!ancientguolaicache.InLineOfSight) return;
  163.                 if (Me.Combat) return;
  164.                 MoveToLocation(WoWMovement.CalculatePointFrom(ancientguolaicache.Location, 3));
  165.                 if (!Me.HasAura(40120) && !Me.HasAura(33943))
  166.                     Flightor.MountHelper.Dismount();
  167.                 Thread.Sleep(1000);
  168.                 ancientguolaicache.Interact();
  169.                 Thread.Sleep(3000);
  170.                 Logging.Write(Colors.Blue, "1x Ancient Guo-Lai Cache opened!");
  171.                 if (!Flightor.MountHelper.Mounted)
  172.                     Flightor.MountHelper.MountUp();
  173.                 return;
  174.             }
  175.         }
  176.  
  177.         public static void LostAndFound()
  178.         {
  179.             ObjectManager.Update();
  180.             var objList = ObjectManager.GetObjectsOfType<WoWGameObject>()
  181.                 .Where(lostAndFound => (lostAndFound.Distance2D <= 40 && (
  182.                                                                              lostAndFound.Entry == 213364
  183.                                                                              || lostAndFound.Entry == 213972
  184.                                                                              || lostAndFound.Entry == 213967
  185.                                                                              || lostAndFound.Entry == 213970
  186.                                                                              || lostAndFound.Entry == 213969
  187.                                                                              || lostAndFound.Entry == 213966
  188.                                                                              || lostAndFound.Entry == 213964
  189.                                                                              || lostAndFound.Entry == 213968
  190.                                                                              || lostAndFound.Entry == 213971
  191.                                                                              || lostAndFound.Entry == 213962
  192.                                                                              || lostAndFound.Entry == 213337
  193.                                                                              || lostAndFound.Entry == 214439
  194.                                                                              || lostAndFound.Entry == 213651
  195.                                                                              || lostAndFound.Entry == 214403
  196.                                                                              || lostAndFound.Entry == 213750
  197.                                                                              || lostAndFound.Entry == 213653
  198.                                                                              || lostAndFound.Entry == 213768
  199.                                                                              || lostAndFound.Entry == 213751
  200.                                                                              || lostAndFound.Entry == 213842
  201.                                                                              || lostAndFound.Entry == 213765
  202.                                                                              || lostAndFound.Entry == 214438
  203.                                                                              || lostAndFound.Entry == 213769
  204.                                                                              || lostAndFound.Entry == 213774
  205.                                                                              || lostAndFound.Entry == 214407
  206.                                                                              || lostAndFound.Entry == 213793
  207.                                                                              || lostAndFound.Entry == 213771
  208.                                                                              || lostAndFound.Entry == 213770
  209.                                                                              || lostAndFound.Entry == 213782
  210.                                                                              || lostAndFound.Entry == 213741
  211.                                                                              || lostAndFound.Entry == 213742
  212.                                                                              || lostAndFound.Entry == 213363
  213.                                                                              || lostAndFound.Entry == 213366
  214.                                                                              || lostAndFound.Entry == 213368
  215.                                                                              || lostAndFound.Entry == 214338
  216.                                                                              || lostAndFound.Entry == 213748
  217.                                                                              || lostAndFound.Entry == 213362
  218.                                                                              || lostAndFound.Entry == 214325
  219.                                                                              || lostAndFound.Entry == 213845
  220.                                                                              || lostAndFound.Entry == 213960
  221.                                                                              || lostAndFound.Entry == 213961
  222.                                                                              || lostAndFound.Entry == 213844
  223.                                                                              || lostAndFound.Entry == 213956
  224.                                                                              || lostAndFound.Entry == 213959
  225.                                                                              || lostAndFound.Entry == 213749
  226.                                                                              || lostAndFound.Entry == 213649
  227.                                                                              || lostAndFound.Entry == 214340
  228.                                                                              || lostAndFound.Entry == 213650
  229.                                                                          ))).OrderBy(lostAndFound => lostAndFound.Distance).ToList();
  230.             foreach (var lostAndFound in objList)
  231.             {
  232.                 if (!lostAndFound.InLineOfSight) return;
  233.                 if (Me.Combat) return;
  234.                 MoveToLocation(WoWMovement.CalculatePointFrom(lostAndFound.Location, 3));
  235.                 if (!Me.HasAura(40120) && !Me.HasAura(33943))
  236.                     Flightor.MountHelper.Dismount();
  237.                 Thread.Sleep(1000);
  238.                 lostAndFound.Interact();
  239.                 Thread.Sleep(3000);
  240.                 Logging.Write(Colors.Blue, "1x Lost and Found object collected!");
  241.                 if (!Flightor.MountHelper.Mounted)
  242.                     Flightor.MountHelper.MountUp();
  243.                 return;
  244.             }
  245.         }
  246.     }
  247. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement