Jump to content

iMod

Elite user
  • Posts

    581
  • Joined

  • Last visited

Posts posted by iMod

  1. 11 minutes ago, james83gw said:

    i just had to click on the string with the character name on the bot window. Unfortunately im not used to this bot, so had no idea i had to do that. anyway thx again for your help.

    Damn and i thought about to write it :D

  2. Thanks for you answer but i'm using the focus for the tank so i'm not able to use your way.

    I wrote another method for it wich works fine. The only problem i noticed is that i always need a target to get the bot starting the routine. If i dont have a target the bot does nothing.

    Heal method:

            /// <summary>
            /// Cast a heal
            /// </summary>
            /// <param name="spell">The heal you want to cast</param>
            /// <param name="target">The target you want to heal</param>
            /// <param name="healthProcent">The health procent we want to heal</param>
            /// <param name="buffTimeLeft">Recast if buff is under the given time</param>
            /// <param name="stacks">How much stacks you want at the target</param>
            /// <param name="debuff">The debuff we are looking for</param>
            /// <param name="owner">Flag that determines if we need to be the owner</param>
            /// <returns>Returns true if we can cast the spell otherwise false</returns>
            public static bool CastHeal(Spell spell, WoWUnit target, int healthProcent, int buffTimeLeft = 0, int stacks = 0, Spell debuff = null, bool owner = true)
            {
                // Need heal?
                if (target.HealthPercent > healthProcent)
                {
                    // Skip
                    return false;
                }
    
                // Wait until global cooldown is done
                Thread.Sleep(SpellManager.GlobalCooldownTimeLeft());
    
                bool hasDebuff;
                if (debuff != null)
                {
                    hasDebuff = Functions.HasBuff(debuff, target, buffTimeLeft, stacks, owner);
                }
                else
                {
                    hasDebuff = Functions.HasBuff(spell, target, buffTimeLeft, stacks, owner);
                }
    
                // Validate spell
                if (!ObjectManager.Me.IsStunned && !ObjectManager.Me.IsDead && !ObjectManager.Me.IsCast && !target.IsDead && spell.KnownSpell && spell.IsSpellUsable && spell.IsDistanceGood && !hasDebuff)
                {
                    if (target.Guid == ObjectManager.Me.Guid)
                    {
                        // Cast on self
                        Lua.LuaDoString($"CastSpellByID({spell.Id}, \"player\")");
                    }
                    else
                    {
                        // Cast on target
                        Lua.LuaDoString($"CastSpellByID({spell.Id}, \"{target.Name}\")");
                    }
    
                    // Log
                    Logging.WriteDebug($"Cast: {spell.NameInGame}");
    
                    // Return
                    return true;
                }
    
                // Return
                return false;
            }


    HasBuff method:

            /// <summary>
            /// Determines if the given target has the buff with the given conditions
            /// </summary>
            /// <param name="spell">The spell you want to check</param>
            /// <param name="target">The target you want to check</param>
            /// <param name="buffTimeLeft">Recast if buff time is under the given time</param>
            /// <param name="stacks">How much stacks you want at the target</param>
            /// <param name="owner">Flag that determines if we need to be the owner</param>
            /// <returns>Returns true if the target has the spell on it with the given conditions otherwise false</returns>
            public static bool HasBuff(Spell spell, WoWUnit target, int buffTimeLeft = 0, int stacks = 0, bool owner = true)
            {
                // Get target auras
                List<Aura> auraList = target.GetAllBuff();
    
                // Get aura
                Aura aura = null;
                if (owner)
                {
                    // Set
                    aura = auraList.Where(s => s.ToString().Contains(spell.Name) && s.Owner == ObjectManager.Me.Guid).FirstOrDefault();
                }
                else
                {
                    // Set
                    aura = auraList.FirstOrDefault(s => s.ToString().Contains(spell.Name));
                }
    
                // Any found?
                if (aura != null)
                {
                    // Validate
                    if (aura.TimeLeftSeconde > buffTimeLeft && aura.Stack >= stacks)
                    {
                        // Return
                        return true;
                    }
                }
    
                // Return
                return false;
            }


    Hope it will help some people who dealing with stuff like that :)

    Info: It wont work with copy & paste, you need to correct some lines, i'm sorry for that but this are just snippets out of my own framework.

  3. I tried 

    CastSpellByID(spellID, "targetName")

    sometimes it works but sometimes it is doing strange stuff and target my toon or is casting at my current target.
    May someone got a idea how i can realize it lie healbot for example that i don't need a target selected to heal it?

    UPDATE:
    I found a solution for it but my problem now is that the bot only starts healing if he has a target doesn*t matter what. Any tipps?

  4. i wrote a small method for it, may it helps someone. Not tested yet but should work in the theory.

            /// <summary>
            /// Determines if the given target has the buff with the given conditions
            /// </summary>
            /// <param name="spell">The spell you want to check</param>
            /// <param name="target">The target you want to check</param>
            /// <param name="buffTimeLeft">Recast if buff time is under the given time</param>
            /// <param name="stacks">How much stacks you want at the target</param>
            /// <param name="owner">Flag that determines if we need to be the owner</param>
            /// <returns>Returns true if the target has the spell on it with the given conditions otherwise false</returns>
            public static bool HasBuff(Spell spell, WoWUnit target, int buffTimeLeft = 0, int stacks = 0, bool owner = true)
            {
                // Get target auras
                List<Aura> auraList = target.GetAllBuff();
    
                // Get aura
                Aura aura = null;
                if(owner)
                {
                    // Set
                    aura = auraList.SingleOrDefault(s => s.GetSpell.Id == spell.Id && s.Owner == ObjectManager.Me.Guid);
                }
                else
                {
                    // Set
                    aura = auraList.FirstOrDefault(s => s.GetSpell.Id == spell.Id);
                }
    
                // Any found?
                if (aura != null)
                {
                    // Validate
                    if (aura.TimeLeftSeconde > buffTimeLeft || aura.Stack >= stacks)
                    {
                        // Return
                        return true;
                    }
                }
    
                // Return
                return false;
            }

    My brain is fked up a bit, so i can be possible that the conditions are not 100% right.

  5. 5 hours ago, AudreyH said:

    Pour l'arene oui, cela reste une rotation comme une autre, par contre ca necessite d'optimiser ca aux ptits oignons, pour entre autre prendre en compte les talents d'honneurs

    IMod: good point, but it was not my intention to correct the code, just show how to add spells and make it run

    
    WoWPlayer healTarget =  members.First();

    Tu peux modifier le code comme écrit ci-dessus

    Yeah i saw it, the code is kinda messi :wub: no offense.
    What part doesn't work maybe i can help you out.

  6. 1 hour ago, Nikrom2 said:

    Hi there i bought the private server key, but when i try to use it it tells me

    this license key is for an other WRobot program, Please check your key here: Http://wrobot.eu.clients/purchases

    Using: http://download.wrobot.eu/wrobot/oldversion/WRobot_6.2.3_20886_FINAL.zip

    And if you check http://wrobot.eu/clients/purchases/ ? What kind of product key do you see? something like "WRobot for Private Server"?

×
×
  • Create New...