Jump to content

Recommended Posts

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

Link to comment
https://wrobot.eu/forums/topic/5025-bot-stucked/#findComment-23263
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...