Hello, use this plugin:
using System.ComponentModel;
using System.Threading;
using System.Windows.Forms;
using robotManager.Helpful;
using wManager;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
public class Main : wManager.Plugin.IPlugin
{
const int HearthstoneItemID = 6948;
const int MaxStuckCount = 3;
public void Initialize()
{
wManager.Events.MovementEvents.OnPulseStuckResolver += MovementEventsOnOnPulseStuckResolver;
Logging.Write("[HearthstoneWhenStuck] Loadded.");
}
public void Dispose()
{
Logging.Write("[HearthstoneWhenStuck] Disposed.");
}
public void Settings()
{
MessageBox.Show("[HearthstoneWhenStuck] No settings for this plugin.");
}
private void MovementEventsOnOnPulseStuckResolver(CancelEventArgs cancelable)
{
if (Statistics.Stucks >= MaxStuckCount)
{
Logging.WriteDebug("[HearthstoneWhenStuck] Use Hearthstone.");
var o = wManagerSetting.CurrentSetting.CloseIfPlayerTeleported;
wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = false;
MovementManager.StopMove();
Thread.Sleep(Usefuls.Latency + 150);
Lua.LuaDoString("local itemName, _, _, _, _, _, _, _ = GetItemInfo("+ HearthstoneItemID + "); RunMacroText('/use ' .. itemName);");
Thread.Sleep(Usefuls.Latency + 500);
if (ObjectManager.Me.IsCast)
{
Usefuls.WaitIsCasting();
Thread.Sleep(Usefuls.Latency + 10000); // wait load screen
}
wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = o;
Statistics.Stucks = 0;
cancelable.Cancel = true;
}
}
}
You can change item id and stucks count lines 11 and 12
HearthstoneWhenStuck.cs