What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Request Hearth Plugin

Beast

Member
Joined
Apr 22, 2010
Messages
618
Reaction score
6
Im looking for a simple addon ( I would make if i knew how) that simply uses your hearth stone if you are in the same location for "X" ammount of time. I know how to change the X just not the rest.
Thanks in advance
 
Im looking for a simple addon ( I would make if i knew how) that simply uses your hearth stone if you are in the same location for "X" ammount of time. I know how to change the X just not the rest.
Thanks in advance

do i have to alter anything or will it work out of the box?
 
Will work out of the box. You could read the code and tweak some variables if you want to change anything.
 
well I also just worked really quickly on something cuz I was bored =P Its completely untested btw.

Code:
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();
            }



        }
    }
}
 
Back
Top