Do you guys see anything wrong with this code? I'm trying to fix Ultima to use Esuna, but only cast it if everyone's health is greater than 70%. I got the status IDs from XIVDB. Thanks in advance. I'm not getting any errors it just doesn't seem to work. Code: private async Task<bool> Esuna() { if (!Helpers.HealManager.Any(hm => hm.CurrentHealthPercent <= 70)) { var target = Helpers.PartyMembers.FirstOrDefault(pm => pm.Type == GameObjectType.Pc && pm.HasAura(1107) || pm.HasAura(988) || pm.HasAura(926) || pm.HasAura(801) || pm.HasAura(560) || pm.HasAura(275) || pm.HasAura(686) || pm.HasAura(623) || pm.HasAura(620) || pm.HasAura(559) || pm.HasAura(561) || pm.HasAura(559) || pm.HasAura(482) || pm.HasAura(442) || pm.HasAura(240) || pm.HasAura(216) || pm.HasAura(213) || pm.HasAura(17) || pm.HasAura(10) || pm.HasAura(9) || pm.HasAura(7) || pm.HasAura(6) || pm.HasAura(3)); if (target != null && Actionmanager.CanCast(MySpells.Esuna.Name, target)) { return await MySpells.Esuna.Cast(); } } return false; }
You need to pass who you want to cast the spell on to the cast function. Also, should filter units that you can only cast esuna on. And heres a better way to check for ids to remove. Code: private static HashSet<uint> RemoveableIds = new HashSet<uint>() { 1107, 988, 926, 801, 560, 275, 686, 623, 620, 559, 561, 559, 482, 442, 240, 216, 213, 17, 10, 9, 7, 6, 3 }; private async Task<bool> Esunaz() { if (!Helpers.HealManager.Any(hm => hm.CurrentHealthPercent <= 70)) { var target = Helpers.PartyMembers.FirstOrDefault(pm => pm.Type == GameObjectType.Pc && pm.Auras.Any(r=> RemoveableIds.Contains(r.Id)) && Actionmanager.CanCast(MySpells.Esuna.Name, pm)); if (target != null) { return await MySpells.Esuna.Cast(target); } } return false; } This should work, but i didn't test it cause i don't use ultima.
awesome TYVM Mastahg! I will give it a try and let you know I feel stupid about the (target), I thought I had it but must have pasted over it lol.
It worked!!! Thanks again Mastahg! I just needed to add using System.Collections.Generic; to the profile.