Jump to content

Evaexe

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by Evaexe

  1. Hi,
    With ur code Zero i modified my code to write that :
     

    public void SerpentStingsSkill2()
        {
            Dictionary<uint, Aura> auras = new Dictionary<uint, Aura>();
            foreach (Aura aura in BuffManager.GetAuras(Fight.CurrentTarget.GetBaseAddress))
            {
                if (aura.Owner == ObjectManager.Me.Guid)
                auras[aura.SpellId] = aura;
               
            }
            if (!auras.ContainsKey(49001)) //Check if the target don't have te debuff Serpent Sting
            {
                Logging.Write($"{ObjectManager.Me.Guid} - SERPENT STING"); // Pas nécessaire pour le fonctionnement de la fonction
    
                SerpentSting.Launch();
            }
        }

    That will be better than my precedent code ?

     

    Thanks

  2. Hi,
    To ger debuff of a target i use this code, but its seem to be very slow :

     

    public void SerpentStingskill()
        {
            List<Aura> peon = Fight.CurrentTarget.GetAllBuff();
            bool shouldCastSerpentSting = true;
            //SERPENT STING
            foreach (Aura a in peon)
            {
                if (a.SpellId == 49001 && a.Owner == ObjectManager.Me.Guid && isTargetGood())
                {
                    shouldCastSerpentSting = false;
                    break;
                }
            }
    
            if (shouldCastSerpentSting)
            {
    
                Logging.Write($"{ObjectManager.Me.Guid} - SERPENT STING");
    
                SerpentSting.Launch();
            }
        }
    }

     

  3. Hello Wrobot community,

    I'm currently working on a C# script for WoW 3.3.5a using the Wrobot framework. I've encountered an issue with my CanCast function, where it returns true even if the player is too far away from the target. Here's my original code:

    internal static bool CanCast(Spell spell, WoWUnit target, bool canMove = true, bool tank = false)
    {
        // Check if the caster is not stunned, not dead, not casting, the target is alive, the spell is usable,
        // the distance to the target is good, and there is no line of sight issue
        if (!ObjectManager.Me.IsStunned && !ObjectManager.Me.IsDead && !ObjectManager.Me.IsCast && !target.IsDead && spell.IsSpellUsable && spell.IsDistanceGood && !TraceLine.TraceLineGo(target.Position) && !target.IsMounted)
        {
            if (target.MaxHealth - target.Health != 0 || tank)
            {
                return true;
            }
        }
    
        // Return false, indicating the spell cannot be cast
        return false;
    }
     
    }

    The problem seems to be related to the spell.IsDistanceGood condition, which does not seem to be working as intended. I'd appreciate it if anyone could help me identify the issue and suggest a solution.

    Thank you in advance for your assistance!

  4. Hello Wrobot Community,

    I am currently working on a script for WoW 3.3.5a private server, and I need some assistance in making my function asynchronous to ensure it is executed properly. Here's the code snippet I am using:

     
    public static bool WildGrowthHeal(WowPlayerExtended player)
    {
        if (CanCast(Main.WildGrowth, player.OriginalPlayer))
        {
            SpellManager.CastSpellByNameOn("Wild Growth", player.OriginalPlayer.Name);
            Logging.WriteDebug($"{player.OriginalPlayer.Name}Wild Growth");
            return true;
        }
        return false;
    }

    &&

    internal static bool CanCast(Spell spell, WoWUnit target, bool canMove = true, bool tank = false)
    		{
    			// Check if the caster is not stunned, not dead, not casting, the target is alive, the spell is usable,
    			// the distance to the target is good, and there is no line of sight issue
    			if (!ObjectManager.Me.IsStunned && !ObjectManager.Me.IsDead && !ObjectManager.Me.IsCast && !target.IsDead && spell.IsSpellUsable && spell.IsDistanceGood && !TraceLine.TraceLineGo(target.Position))
    			{
    				if (target.MaxHealth - target.Health != 0 || tank)
    				{
    					// Log the spell cast and the target's health percentage
    					Logging.WriteDebug($"Cast: {spell.NameInGame} on {target.Name} because life had less than {target.MaxHealth - target.Health} PV and he is a {target.WowClass}");
    
    					// Return true, indicating the spell can be cast
    					return true;
    				}
    			}
    
    			// Return false, indicating the spell cannot be cast
    			return false;
    		}

     

    This function checks if "Wild Growth" can be cast on a player and casts the spell if possible. However, I want to make sure that the function waits for the spell to be cast before proceeding further. I am aware that using Thread.Sleep is not the best solution, as it can block the thread and cause other issues.

    Instead, I would like to make this function asynchronous using async and await, but I'm not sure how to do this with the current SpellManager.CastSpellByNameOn method, which is not asynchronous.

    Could anyone please provide guidance on how to make this function asynchronous or suggest an alternative way to ensure that the spell is cast before the function proceeds further? Any help would be greatly appreciated

     

    Thank you in advance for your assistance!

  5. I would like to thank the Wholsome Discord for their help. It turns out that my debuffAuraType was in the third position, when it should have been in the fourth position in UnitDebuff.

    Here is the modified code:

     

    public bool CanPurify(string playerName)
    {
        var lua = $@"
    canPurify = false
    for i = 1, 40 do
        local name, _, _, _, debuffAuraType, _, _, _, _ = UnitDebuff(""{playerName}"", i);
        print(""{playerName}"")
        print(name)
        print(debuffAuraType)
        if (name and debuffAuraType) and (debuffAuraType == 'Magic' or debuffAuraType == 'Disease' or debuffAuraType == 'Poison') then
            canPurify = true
            break
        end
    end
    return canPurify
    ";
        Logging.Write($"Checking if {playerName} can be purified...");
        bool result = Lua.LuaDoString<bool>(lua);
        Logging.Write($"Result: {result}");
        return result;
    }
    
    public void Purify(WoWUnit p)
    {
        while (CanPurify(p.Name) && CastHeal(Cleanse, p, 100))
        {
            SpellManager.CastSpellByNameOn("Holy Light", p.Name);
        }
    }

     

  6. Hello Droidz,

    Unfortunately, the code is not working. I am playing on WoW 3.3.5a.

    At the moment, I have added some print statements:

     
    csharp
     
    var lua = $@" canPurify = false for i = 1, 40 do local name, _, _, debuffAuraType, _, _, _, _, _ = UnitDebuff(""{unit}"", i); print(""{unit}"") print(name) print(debuffAuraType) if (name and debuffAuraType) and (debuffAuraType == 'Magic' or debuffAuraType == 'Disease' or debuffAuraType == 'Poison') then canPurify = true break end end return canPurify ";

     

    Here is the output:

    image.png.905de3bd6c53cec0b4d01e1e2a1d6cdf.png

    Thank you.

     
  7.  

    Hello Wrobot community,

    I'm having an issue with the CanPurify function in my code, and I was hoping someone could help me figure out what's going on. Currently, no matter what, the function always returns false, even when the player has a debuff that should be able to be purified.

    Here is the current code for the function:

        public bool CanPurify(string playerName)
        {
            var lua = $@"
        canPurify = false
        for i = 1, 40 do
            local name, _, _, debuffAuraType, _, _, _, _, _ = UnitDebuff(""{playerName}"", i);
            if (name and debuffAuraType) and (debuffAuraType == 'Magic' or debuffAuraType == 'Disease' or debuffAuraType == 'Poison') then
                canPurify = true
                break
            end
        end
        return canPurify
    ";
            Logging.Write($"Checking if {playerName} can be purified...");
            bool result = Lua.LuaDoString<bool>(lua);
            Logging.Write($"Result: {result}");
            return result;

     

    If anyone has any idea what might be causing this issue, or any suggestions for how I can fix it, I would really appreciate it. Thank you in advance for your help!

    Best regards,

  8. Hello !

     

    I'm trying to add smelting type of npc in my db.

    But i have an issue.

    When bot is launched, i go to dev tool -> NPC database -> select smelting on "Type", left "Name" blank, click on the button and nothing append
    When bot is paused, i go to dev tool -> NPC database -> select smelting on "Type", left "Name" blank, click on the button and nothing append
    When bot is stoped, i go to dev tool -> NPC database -> select smelting on "Type", left "Name" blank, click on the button and nothing append

    When i put someting in the field name and clic on it appear a message box "Object not found." so the button seem work.

     

    Thanks

×
×
  • Create New...