using System;
using System.Diagnostics;
using Styx.Logic.Combat;
using Styx.Logic.Pathing;
using Styx.Plugins.PluginClass;
using Styx.WoWInternals;
namespace PluginIdleHearth
{
class IdleHearth : HBPlugin
{
public override string Name { get { return "IdleHearth"; } }
public override string Author { get { return "Sychotix"; } }
public override Version Version { get { return _version; } }
private readonly Version _version = new Version(1, 0, 0, 0);
// Editable Variables //
private const double WaitTime = 5.0; // In Minutes
private const double MaxDist = 10.0;
// Editable Variables //
private static Stopwatch _timer = new Stopwatch();
private static WoWPoint _point = new WoWPoint();
public override void Pulse()
{
//If Timer Not running, start it.
if (!_timer.IsRunning) _timer.Start();
//If moved far enough from last saved position, reset
if (_point.Distance(ObjectManager.Me.GetPosition()) > MaxDist)
{
_point = ObjectManager.Me.GetPosition();
_timer.Reset();
_timer.Start();
}
//Check if we need to hearth
else if (_timer.ElapsedMilliseconds > WaitTime*60000)
{
SpellManager.Cast("Hearthstone");
_timer.Reset();
_timer.Start();
}
}
}
}