Jump to content

iMod

Elite user
  • Posts

    581
  • Joined

  • Last visited

Community Answers

  1. iMod's post in Range between two players was marked as the answer   
    WoWPlayer one = new WoWPlayer(); WoWPlayer two = new WoWPlayer(); // Get distance between 2 objects float distance = one.Position.DistanceTo(two.Position); If you are looking for party stuff take a look at "wManager.Wow.Helpers.Party"
    Hope i understood the question right ?
    Do you want to be able to check if the whole group is near or just one of them?
  2. iMod's post in Get skinnable mobs was marked as the answer   
    Hm could be a reason. Replace it with
    ObjectManager.GetObjectWoWUnit().Count(u => u.Skinnable && u.GetDistance2D <= 40); If you just want dead units that are skinnable you need to add "&& u.IsDead"
    Hope that helps
  3. iMod's post in Making Combat Routine More Efficient C# (Help) was marked as the answer   
    /// <summary> /// Determines if the spell is known or not /// </summary> /// <param name="spell">The spell we want to check</param> /// <returns>Returns true if the spell is known otherwise false</returns> public static bool IsSpellKnown(Spell spell) { // Check spell bool isSpellKnown = Lua.LuaDoString<bool>($"return IsSpellKnown({spell.Id});"); // Return return isSpellKnown; } /// <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, double 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; } /// <summary> /// Cast a spell /// </summary> /// <param name="spell">The spell you want to cast</param> /// <param name="target">The target you want to cast at</param> /// <param name="debuff">The debuff we are looking for</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> /// <param name="force">Force use the skill and ignore debuffs</param> /// <returns>Returns true if we can cast the spell otherwise false</returns> public static bool CastSpell(Spell spell, WoWUnit target, double buffTimeLeft = 0, int stacks = 0, Spell debuff = null, bool owner = true, bool force = false) { // Check if the spell is known if (!IsSpellKnown(spell)) { // Skip return false; } // Wait until global cooldown is done Thread.Sleep(SpellManager.GlobalCooldownTimeLeft()); // Check if buff exists 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.IsSpellUsable && spell.IsDistanceGood && (force || !hasDebuff) && !TraceLine.TraceLineGo(target.Position)) { 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\")"); } // Log Logging.WriteDebug($"Cast: {spell.NameInGame}"); // Return return true; } // Return return false; } Short answer: Check if you are currently casting with "ObjectManager.Me.IsCast". I would recommend to put all the validations into a method.
    Another way would be to use @Droidz inbuild engine.

    Have fun.

    PS: If a method is missing just call me, I just copied it right out of my framework.

    BTW: It is used for WOTLK and I'm not sure if there where changes in the lua commands. But at the end it should give you an idea how it could be done. There are allways multi ways to reach the goal.
  4. iMod's post in How Can I Find Game Object Distance? was marked as the answer   
    It depend at what kind ID you want to use. If you want to use the mob id this could be something for you.
     
    ObjectManager.GetWoWGameObjectByyId(1234).FirstOrDefault()?.GetDistance < 75  
  5. iMod's post in How to target in fight class was marked as the answer   
    // Get target you want to WoWUnit target = any target you want // Target the target Interact.InteractGameObject(target.GetBaseAddress, !ObjectManager.Me.GetMove); This would be one way how you target something.
  6. iMod's post in how to create a player object from player name was marked as the answer   
    Get player object by name:
    WoWPlayer player = ObjectManager.GetObjectWoWPlayer().Where(p => p.IsValid && p.Name == "PlayerName").FirstOrDefault();  
    Target player:
    Interact.InteractGameObject(player.GetBaseAddress, true); Cast spell at the specified target:
    string targetName = "blubb"; int spellID = 999; Lua.LuaDoString($"CastSpellByID({spellID}, \"{targetName}\")");  
    Hope it helps.
  7. iMod's post in Druid Mangle (Bear) problem was marked as the answer   
    Well i will answer my self. Restart the game and the bot and you should be fine.
    Thanks goes to betterSister for the tipp.
  8. iMod's post in Targeting tanks target and casting spells on it was marked as the answer   
    var tank = getTanks(); WoWUnit target = ; Interact.InteractGameObject(target.GetBaseAddress); _wrath.Launch(); Thats why i said don't use var ^_-
    // Get all available tanks List<WoWPlayer> tankList = getTanks(); // Get the first tank in the list WoWPlayer tank = tankList.First(); // Get the target of the tank WoWUnit target = tank.TargetObject; // Focus at target Interact.InteractGameObject(target.GetBaseAddress, true); // Use the skill _wrath.Launch(); It is way essiert to read ^_-
×
×
  • Create New...