jiraiyasm 1 Posted August 19, 2021 Share Posted August 19, 2021 hi anyone can help me have the correct setting for the fight class im making please. my FC doesn't cast Corruption because it already sees another lock's corruption as it's own. I highlighted the possible line that needs to be changed to it will buff Corruption to it's target. Thank you. if (Corruption.IsSpellUsable && Corruption.KnownSpell && Corruption.IsDistanceGood && SpellManager.GlobalCooldownTimeLeft() == 0 && !ObjectManager.Target.Rooted && !ObjectManager.Target.HaveBuff("Corruption") && ObjectManager.Me.HaveBuff("Life Tap")) { Corruption.Launch(); return; } Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/ Share on other sites More sharing options...
Talamin 138 Posted August 19, 2021 Share Posted August 19, 2021 13 minutes ago, jiraiyasm said: hi anyone can help me have the correct setting for the fight class im making please. my FC doesn't cast Corruption because it already sees another lock's corruption as it's own. I highlighted the possible line that needs to be changed to it will buff Corruption to it's target. Thank you. if (Corruption.IsSpellUsable && Corruption.KnownSpell && Corruption.IsDistanceGood && SpellManager.GlobalCooldownTimeLeft() == 0 && !ObjectManager.Target.Rooted && !ObjectManager.Target.HaveBuff("Corruption") && ObjectManager.Me.HaveBuff("Life Tap")) { Corruption.Launch(); return; } Add something like this, but you should think about moving all the casting checks into one Function and do the Checks only once. if (Corruption.IsSpellUsable && Corruption.KnownSpell && Corruption.IsDistanceGood && SpellManager.GlobalCooldownTimeLeft() == 0 && !ObjectManager.Target.Rooted && ObjectManager.Me.HaveBuff("Life Tap")) { if(!DebuffCheckOwner("Corruption") { Corruption.Launch(); return; } } public static bool DebuffCheckOwner(Spell spell, bool owner = true) { List<Aura> DebuffList = ObjectManager.Target.GetAllBuff(); Aura aura = null; if (owner) { aura = DebuffList.FirstOrDefault(s => s.GetSpell.Name == spell.Name && s.Owner == ObjectManager.Me.Guid); if (aura != null) { return true; } } return false; } jiraiyasm 1 Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63299 Share on other sites More sharing options...
jiraiyasm 1 Posted August 23, 2021 Author Share Posted August 23, 2021 Thank you so much for the help. i am still very new to this area. i tried having my lock to use grand spellstone but it doesn't "Left click" the spellstone to the weapon. i just based this on the snipets for rogue also. private void EnchantWeapon() { bool hasMainHandEnchant = Lua.LuaDoString<bool> (@"local hasMainHandEnchant, _, _, _, _, _, _, _, _ = GetWeaponEnchantInfo() if (hasMainHandEnchant) then return '1' else return '0' end"); if (!hasMainHandEnchant) { IEnumerable<uint> MP = InstantPoisonDictionary .Where(i => i.Key <= ObjectManager.Me.Level && ItemsManager.HasItemById(i.Value)) .OrderByDescending(i => i.Key) .Select(i => i.Value); if (MP.Any()) { MHPoison = MP.First(); ItemsManager.UseItem(MHPoison); Thread.Sleep(10); Lua.LuaDoString("/click PickupInventoryItem(16)"); Thread.Sleep(5000); return; } } } private static Dictionary<int, uint> InstantPoisonDictionary = new Dictionary<int, uint> { { 79, 41196 }, }; may i ask please how to check if the required item is available in the bag before casting the spell especially needed for casting buffs. Thank you @Talamin Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63340 Share on other sites More sharing options...
Talamin 138 Posted August 23, 2021 Share Posted August 23, 2021 The easiest way is: ItemsManager.GetItemCountByIdLUA(12345) >0 Instead of 12345 you have to enter a proper Item ID Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63343 Share on other sites More sharing options...
jiraiyasm 1 Posted August 23, 2021 Author Share Posted August 23, 2021 1 hour ago, Sye24 said: @jiraiyasmHello, i went ahead and cleaned up some of your code, this should work. let me know if you need any help. public static void EnchantWeapon() { try { if (hasMainHandEnchant || Fight.InFight || ObjectManager.Me.InCombatFlagOnly || ObjectManager.Me.IsDead) return; IEnumerable<uint> MainHandEnchant = InstantPoisonDictionary .Where(i => i.Key <= ObjectManager.Me.Level && ItemsManager.GetItemCountByIdLUA(i.Value) >= 1) .OrderByDescending(i => i.Key) .Select(i => i.Value); if (MainHandEnchant.Any()) { var MHPoison = MainHandEnchant.FirstOrDefault(); ItemsManager.UseItem(MHPoison); Thread.Sleep(10); Lua.LuaDoString("PickupInventoryItem(16);"); Thread.Sleep(5000); } } catch(Exception ex) { Logging.Write($"{ex}"); } } private static Dictionary<int, uint> InstantPoisonDictionary = new Dictionary<int, uint>() { { 79, 41196 }, }; private static Boolean hasMainHandEnchant => Lua.LuaDoString<Int32>("local GetWeaponEnchant = {GetWeaponEnchantInfo()}; return GetWeaponEnchant[1];") == 1; Yes it indeed worked. Thank you so much! Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63349 Share on other sites More sharing options...
jiraiyasm 1 Posted August 24, 2021 Author Share Posted August 24, 2021 hi @Sye24is it possible for my characters to move away from the ground debuff that doesn't show as a debuff on the player? will this snipet below work? wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { var me = wManager.Wow.ObjectManager.ObjectManager.Me; var target = wManager.Wow.ObjectManager.ObjectManager.Target; if (me.IsAlive && target.IsAlive && !me.IsCast && me.HaveBuff("Buff name")) { wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.STRAFELEFT, 1000 * 3); // strage left during 3 secondes } }; the debuff IDs are 69019 and 68863 which both hits the characters but no debuffs appears on them as they explode from the ground. Thank you. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63354 Share on other sites More sharing options...
jiraiyasm 1 Posted August 26, 2021 Author Share Posted August 26, 2021 @Sye24, may i ask how to make the string array option for the plug.in please? thank you. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63380 Share on other sites More sharing options...
jiraiyasm 1 Posted September 9, 2021 Author Share Posted September 9, 2021 On 9/2/2021 at 5:43 PM, Sye24 said: @jiraiyasmi dont follow, if you want to add Damaging spell names, do into settings . is it okay if i can ask for the code for this plugin? thank you. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63532 Share on other sites More sharing options...
jiraiyasm 1 Posted September 10, 2021 Author Share Posted September 10, 2021 15 hours ago, Sye24 said: Sorry but no, i improved a lot of the code and i am gonna use it in upcoming project. im making a fightclass for DK, how do i get it to use Death and Decay skills to be casted? it only use the skill but doesn't actually click on the ground. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63540 Share on other sites More sharing options...
jiraiyasm 1 Posted September 11, 2021 Author Share Posted September 11, 2021 14 hours ago, Sye24 said: Simple google search with words Wrobot Aoe Death and Decay will find a lot of help for you. tried using these code SpellManager.CastSpellByIDAndPosition(49936, ObjectManager.Target.Position ClickOnTerrain.Pulse(ObjectManager.Target.Position); but i get an error on vstudio. any way to correct these? Thank you. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63552 Share on other sites More sharing options...
jiraiyasm 1 Posted September 12, 2021 Author Share Posted September 12, 2021 4 hours ago, Sye24 said: Are you using using wManager.Wow.Helpers; using wManager.Wow.ObjectManager; use these references yes i used those references already but still getting errors. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63563 Share on other sites More sharing options...
jiraiyasm 1 Posted September 12, 2021 Author Share Posted September 12, 2021 8 hours ago, Sye24 said: Can you post a screenshot of your error? i cant really help without seeing the error. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63567 Share on other sites More sharing options...
Zan 99 Posted September 12, 2021 Share Posted September 12, 2021 2 hours ago, jiraiyasm said: Bool - Boolean structure type that represents a Boolean value, which can be either true or false. Void - Is a reference type of data type and used to specify the return type of a method in C#. If you don't understand the above, start here: https://www.youtube.com/watch?v=GhQdlIFylQ8 I do not know what spell 49936 is as it says it has been removed on Wowhead. Remove the SpellManager..... line from the if condition since it's not a boolean (bool). instead of DnD.Launch(); use ClickOnTerrain.Spell(43265, ObjectManager.Target.Position, false, false); if you want to check if the Target is on your DnD, then do something like this in the if condition (bool): ObjectManager.Target.BuffCastedByAll(DnD.Name).Contains(ObjectManager.Me.Guid) if you want to cast it on the Target if it isn't on your DnD then add a "!" to it. The "!" is a negation. AKA the opposite (bool): !ObjectManager.Target.BuffCastedByAll(DnD.Name).Contains(ObjectManager.Me.Guid) I forget if the debuff is the same as the spell. If it is, the last few lines will work. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63568 Share on other sites More sharing options...
jiraiyasm 1 Posted September 15, 2021 Author Share Posted September 15, 2021 On 9/13/2021 at 3:46 AM, Zan said: Bool - Boolean structure type that represents a Boolean value, which can be either true or false. Void - Is a reference type of data type and used to specify the return type of a method in C#. If you don't understand the above, start here: https://www.youtube.com/watch?v=GhQdlIFylQ8 I do not know what spell 49936 is as it says it has been removed on Wowhead. Remove the SpellManager..... line from the if condition since it's not a boolean (bool). instead of DnD.Launch(); use ClickOnTerrain.Spell(43265, ObjectManager.Target.Position, false, false); if you want to check if the Target is on your DnD, then do something like this in the if condition (bool): ObjectManager.Target.BuffCastedByAll(DnD.Name).Contains(ObjectManager.Me.Guid) if you want to cast it on the Target if it isn't on your DnD then add a "!" to it. The "!" is a negation. AKA the opposite (bool): !ObjectManager.Target.BuffCastedByAll(DnD.Name).Contains(ObjectManager.Me.Guid) I forget if the debuff is the same as the spell. If it is, the last few lines will work. thanks for the help. i haven't tried it yet as i got busy. Link to comment https://wrobot.eu/forums/topic/13382-correct-code-for-debuff/#findComment-63579 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now