Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.05 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.Linq;
  4. using Styx.CommonBot.Frames;
  5. using Styx.Plugins;
  6. using Styx.WoWInternals.WoWObjects;
  7.  
  8. namespace Styx
  9. {
  10.     public class HerbHelperThing : HBPlugin
  11.     {
  12.         public override string Author => "EchoTiger";
  13.         public override string Name => "HerbMountHelper2";
  14.         public override Version Version => new Version(1, 0);
  15.         public override bool WantButton => false;
  16.         private readonly Stopwatch _delayTimer = new Stopwatch();
  17.  
  18.         private const int LeystoneHoofPlates = 123956;
  19.         private const int LeystoneHoofPlatesAura = 182993;
  20.  
  21.         private const int StonehideLeatherbarding = 131746;
  22.         private const int StonehideLeatherbardingAura = 208705;
  23.  
  24.         private const int DemonsteelStirrups = 136708;
  25.         private const int DemonsteelStirrupsAura = 209563;
  26.  
  27.         public override void Pulse()
  28.         {
  29.             if (!_delayTimer.IsRunning) _delayTimer.Start();
  30.             if (_delayTimer.Elapsed < TimeSpan.FromMilliseconds(3500)) return;
  31.             _delayTimer.Restart();
  32.             if (StyxWoW.Me == null || !StyxWoW.Me.IsValid || !StyxWoW.Me.IsAlive || StyxWoW.Me.IsActuallyInCombat || MerchantFrame.Instance.IsVisible) return;
  33.             if (!StyxWoW.Me.HasAura(LeystoneHoofPlatesAura))
  34.             {
  35.                 UseItem(LeystoneHoofPlates);
  36.                 return;
  37.             }
  38.             if (!StyxWoW.Me.HasAura(StonehideLeatherbardingAura))
  39.             {
  40.                 UseItem(StonehideLeatherbarding);
  41.                 return;
  42.             }
  43.             if (!StyxWoW.Me.HasAura(DemonsteelStirrupsAura))
  44.                 UseItem(DemonsteelStirrups);
  45.         }
  46.         private static void UseItem(int itemEntry)
  47.         {
  48.             WoWItem getItem = StyxWoW.Me.BagItems.FirstOrDefault(bagItem => bagItem.Entry == itemEntry);
  49.             if (getItem == null) return;
  50.             if (getItem.CooldownTimeLeft != TimeSpan.Zero) return;
  51.             if (!getItem.Usable) return;
  52.             getItem.Use();
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement