Jump to content

Recommended Posts

Hi, quick questions regarding this method to CheckPet() inside my fight class.  The code below is somewhat a derivative from converting the Fight Class Editor into C#.
The mana required to use the spell "Revive Pet" varies based on level, If the player does not have enough mana, It will just keep spamming the ability until their is enough.
Is there a way to keep this from happening?

I also am noticing the issue that when I mount or dismount, it will try and cast the Call Pet ability in that brief moment of getting on the mount, or jumping off every single
time (This also includes taxis). It even gets so bad that when I mount up and try to ride off, it dismounts me to use the ability, call pet again!

So far I have had to comment this sort of thing out of my fight class all together as it was just more of hassle than to worry about it. I do believe it is important though if I
plan on using any portion of the bot like Grinder, Quester, Automaton, etc...

Any help with the simple Pet Management would be greatly appreciated! Thanks!

internal void CheckPet()
{
    if (ObjectManager.Me.IsDeadMe || Me.IsMounted || Me.IsStunned || Me.Pacified || Me.GetMove) return;

    if (!ObjectManager.Pet.IsValid)
    {
        _callPet.Launch();                                      // Call Pet
    }
    if (!ObjectManager.Pet.IsValid || ObjectManager.Pet.IsDead)
    {
        //if (Me.Mana >= 1040)
            _revivePet.Launch(true);                            // Revive Pet
    }
}

 

Link to comment
https://wrobot.eu/forums/topic/7397-hunter-pet-management-fight-class/
Share on other sites

 

Quote

The mana required to use the spell "Revive Pet" varies based on level, If the player does not have enough mana, It will just keep spamming the ability until their is enough.
Is there a way to keep this from happening?

Hello, I assume you check if the spell is usable before.
So, I've looking on Russian Database (Wotlk) and it seems Take 80% of mana Player.

If is true by checking this way out, that gonna be ok

 

Edit: For the seconds part maybe because you're not Explicitly tell ObjectManager.Me.IsMounted .

I added a small sleep time before trying to launch the spell and it seems to help.

public static bool CallPet()
{
    try
    {
        if (!Me.IsCast &&
            !Me.IsMounted &&
            _callPet.KnownSpell &&
            _callPet.IsDistanceGood &&
            _callPet.IsSpellUsable)
        {
            Thread.Sleep(800);
            _callPet.Launch();
            Thread.Sleep(SpellManager.GlobalCooldownTimeLeft() + Usefuls.Latency);
            return true;
        }
    }
    catch (Exception e) { Logging.WriteError("CallPet() ERROR: " + Environment.NewLine + e); }
    return false;
}
public static bool RevivePet()
{
    try
    {
        if (!Me.IsCast &&
            !Me.IsMounted &&
            Me.ManaPercentage > 80 &&
            _revivePet.KnownSpell &&
            _revivePet.IsDistanceGood &&
            _revivePet.IsSpellUsable)
        {
            Thread.Sleep(800);
            _revivePet.Launch();
            Thread.Sleep(SpellManager.GlobalCooldownTimeLeft() + Usefuls.Latency);
            return true;
        }
    }
    catch (Exception e) { Logging.WriteError("RevivePet() ERROR: " + Environment.NewLine + e); }
    return false;
}

 

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