Jump to content

Recommended Posts

  • 3 months later...
I know that by modifying something this code, you could make a plot to use the bandages.
This code works with the scrolls
Could someone make the modification?
THANK YOU.

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel;
using System.Diagnostics;
using System.Threading;

using robotManager.Helpful;
using robotManager.Products;

using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : wManager.Plugin.IPlugin
{
    private bool isRunning;
    private BackgroundWorker pulseThread;
    private static WoWLocalPlayer Me = ObjectManager.Me;

    public void Start()
    {
        pulseThread = new BackgroundWorker();
        pulseThread.DoWork += Pulse;
        pulseThread.RunWorkerAsync();
    }

    public void Pulse(object sender, DoWorkEventArgs args)
    {
        try
        {
            while (isRunning)
            {
                if (!Products.InPause && Products.IsStarted)
                {
                    if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3012) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3012);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1477) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1477);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(4425) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(4425);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(10309) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(10309);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(27498) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(27498);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(33457) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(33457);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(43463) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(43463);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(43464) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(43464);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(955) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(955);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(2290) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(2290);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(4419) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(4419);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(10308) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(10308);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(27499) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(27499);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(33458) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(33458);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(37091) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(37091);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(37092) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(37092);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3013) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3013);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1478) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1478);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(4421) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(4421);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(10305) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(10305);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(27500) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(27500);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(33459) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(33459);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(43467) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(43467);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1181) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1181);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1712) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1712);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(4424) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(4424);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(10306) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(10306);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(27501) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(27501);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(33460) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(33460);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(37097) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(37097);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(37098) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(37098);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1180) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1180);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1711) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1711);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(4422) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(4422);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(10307) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(10307);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(27502) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(27502);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(33461) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(33461);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(37093) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(37093);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(37094) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(37094);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(954) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(954);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(2289) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(2289);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(4426) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(4426);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(10310) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(10310);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(27503) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(27503);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(33462) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(33462);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(43465) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(43465);
                        Logging.WriteDebug("Using consumable Scroll");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                }
                Thread.Sleep(20000);
            }
        }
        catch (Exception ex)
        {
            
        }
    }

    public void Dispose()
    {
        try
        {
            isRunning = false;
        }
        catch (Exception e)
        {

        }
    }

    public void Initialize()
    {
        isRunning = true;
        Start();
    }

    public void Settings()
    {
        
    }
}

 

With this code, use the bandages, but I need a code, so you can use them when you are below 80% of life and when you are not moving

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel;
using System.Diagnostics;
using System.Threading;

using robotManager.Helpful;
using robotManager.Products;

using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : wManager.Plugin.IPlugin
{
    private bool isRunning;
    private BackgroundWorker pulseThread;
    private static WoWLocalPlayer Me = ObjectManager.Me;

    public void Start()
    {
        pulseThread = new BackgroundWorker();
        pulseThread.DoWork += Pulse;
        pulseThread.RunWorkerAsync();
    }

    public void Pulse(object sender, DoWorkEventArgs args)
    {
        try
        {
            while (isRunning)
            {
                if (!Products.InPause && Products.IsStarted)
                {
                    if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(14530) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(14530);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(14529) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(14529);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3531) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3531);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3530) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3530);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(6451) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(6451);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(6450) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(6450);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3531) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3531);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3530) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3530);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(2581) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(2581);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1251) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1251);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                   
                   
                }
                Thread.Sleep(20000);
            }
        }
        catch (Exception ex)
        {
            
        }
    }

    public void Dispose()
    {
        try
        {
            isRunning = false;
        }
        catch (Exception e)
        {

        }
    }

    public void Initialize()
    {
        isRunning = true;
        Start();
    }

    public void Settings()
    {
        
    }
}

 

//  are below 80% of life and when you are not moving
if (ObjectManager.Me.HealthPercent <= 80 && !ObjectManager.Me.GetMove)
{
  	//Heavy Linen Bandage
	MovementMananager.StopMoveTo(false, 10000);
	ItemsManager.UseItem(2581);
	Thread.Sleep(Usefuls.Latency);
	Usefuls.WaitIsCasting();
}

 

//  are below 80% of life and when you are not moving
if (ObjectManager.Me.HealthPercent <= 80 && !ObjectManager.Me.GetMove && !ObjectManager.Me.InCombat)
{
  	//Heavy Linen Bandage
	MovementMananager.StopMoveTo(false, 10000);
	ItemsManager.UseItem(2581);
	Thread.Sleep(Usefuls.Latency);
	Usefuls.WaitIsCasting();
}

 

The code that I put if it works correctly. I just have to see why you do not stop to use the bandages and use them at 80% of life.

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel;
using System.Diagnostics;
using System.Threading;

using robotManager.Helpful;
using robotManager.Products;

using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : wManager.Plugin.IPlugin
{
    private bool isRunning;
    private BackgroundWorker pulseThread;
    private static WoWLocalPlayer Me = ObjectManager.Me;

    public void Start()
    {
        pulseThread = new BackgroundWorker();
        pulseThread.DoWork += Pulse;
        pulseThread.RunWorkerAsync();
    }

    public void Pulse(object sender, DoWorkEventArgs args)
    {
        try
        {
            while (isRunning)
            {
                if (!Products.InPause && Products.IsStarted)
                {
                    if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(14530) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(14530);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(14529) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(14529);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3531) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3531);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3530) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3530);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(6451) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(6451);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(6450) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(6450);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3531) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3531);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(3530) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(3530);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(2581) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(2581);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                    else if (!ObjectManager.Me.IsMounted && ItemsManager.HasItemById(1251) && !ObjectManager.Me.IsDeadMe)
                    {
                        ItemsManager.UseItem(1251);
                        Logging.WriteDebug("Using consumable bandage");
                        Thread.Sleep(Usefuls.Latency + 1000);
                    }
                   
                   
                }
                Thread.Sleep(20000);
            }
        }
        catch (Exception ex)
        {
            
        }
    }

    public void Dispose()
    {
        try
        {
            isRunning = false;
        }
        catch (Exception e)
        {

        }
    }

    public void Initialize()
    {
        isRunning = true;
        Start();
    }

    public void Settings()
    {
        
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel;
using System.Diagnostics;
using System.Threading;

using robotManager.Helpful;
using robotManager.Products;

using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

public class Main : wManager.Plugin.IPlugin
{
    private bool isRunning;
    private BackgroundWorker pulseThread;

    public void Start()
    {
        pulseThread = new BackgroundWorker();
        pulseThread.DoWork += Pulse;
        pulseThread.RunWorkerAsync();
    }

    public void Pulse(object sender, DoWorkEventArgs args)
    {
        try
        {
            // Loop
            while (isRunning)
            {
                // Valid?
                if (!Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Fight.InFight && !ObjectManager.Me.IsMounted && ObjectManager.Me.HealthPercent <= 80)
                {
                    uint[] items = new uint[] { 14530, 14529, 3531, 3530, 6451, 6450, 3531, 3530, 2581, 1251 };
                    uint? currentItemID = null;

                    // Get itemID
                    foreach (uint itemID in items)
                    {
                        // Exists?
                        if (ItemsManager.HasItemById(itemID))
                        {
                            // Set
                            currentItemID = itemID;
                            break;
                        }
                    }

                    // Any?
                    if (currentItemID.HasValue)
                    {
                        // Stop moving
                        MovementManager.StopMoveTo(false, 10000);

                        // Use item
                        ItemsManager.UseItem(currentItemID.Value);
                        Logging.WriteDebug("Using consumable bandage");

                        // Wait
                        Thread.Sleep(Usefuls.Latency);
                        Usefuls.WaitIsCasting();
                    }
                }

                // Wait
                Thread.Sleep(20000);
            }
        }
        catch (Exception ex)
        {
            Logging.WriteError(ex.ToString());
        }
    }

    public void Dispose()
    {
        try
        {
            isRunning = false;
            this.pulseThread.Dispose();
        }
        catch (Exception ex)
        {
           Logging.WriteError(ex.ToString());
        }
    }

    public void Initialize()
    {
        isRunning = true;
        Start();
    }

    public void Settings()
    {

    }
}

 

Edited by iMod
3 minutes ago, Hatmud said:

Good. I have tried the code that you have put, but it does not use the bandages. Thank you very much for your help.

Just add loggings and make sure it finds the items. I can't test that stuff since i'm at work.

Edited by iMod
5 minutes ago, Hatmud said:

Could you check your code ?. Thank you

I did and it looks fine for me. As i said add some logging lines and check by yourself what part is not working. If you are not able to work with this peace of code i'm sorry and you need to pay someone who creates the stuff for you.

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...