October 26, 20169 yr Hello, i try to detec if the target has frostfever from me and everything was fine until the update. Pseudocode: if(!ObjectManager.Me.TargetObject.BuffCastedByAll(FrostFever.Name).Contains(ObjectManager.Me.Guid)) { use spell.... } resul = it is spamming frostfever Thanks in advance, iMod
October 26, 20169 yr Try that : public static bool myDebuffExists(String debuff) { var auras = ObjectManager.Target.GetAllBuff(); foreach(var a in auras) { string aura = a.ToString(); if (aura.Contains(debuff) && (aura.Contains(ObjectManager.Me.Guid.ToString()) || aura.Contains(ObjectManager.Me.Guid128.ToString()))) return true; } return false; }
October 27, 20169 yr Author Thanks i was hoping that i dont need to change my methods but thanks for the hint about the auras.
October 27, 20169 yr Author 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.
October 27, 20169 yr Author Well failure detected... stacks is not working anymore after the update. Reported.
October 27, 20169 yr Author 34 minutes ago, Droidz said: Seem works, can you give me spell names SpellName: Frost Fever I'll check that later again and report. Stange now it works for some reasons.... sorry for the trouble -.- You can delete the post.
October 27, 20169 yr Author I have no clue why my old method stoped working but i found a mistake in the new one and the problem is solved now. Thanks for your time. If you want you can delete the thread.
Create an account or sign in to comment