private async Task <bool> DoControlLogic() { if (!initialized) { init(); } var npc = GuardianNPC; if (npc != null && NeedToMove == false) { if (npc.Location.DistanceSqr(Core.Player.Location) > LeashSquared) { if (Core.Player.CurrentHealthPercent < 50) { NeedToMove = true; } if (!Core.Player.InCombat) { NeedToMove = true; } } } if (Core.Player.CurrentHealthPercent <= 30) { foreach (var potion in Potions) { if (Actionmanager.ItemUseable(potion, null)) { Logging.Write("[SimpleDuty] Player below 30% heath using potion id {0}", potion); Actionmanager.DoAction(ActionType.Item, potion, null); break; } } } while (NeedToMove) { if (QuestLogManager.InCutscene) { continue; } if (NeedToMove && (npc == null || !npc.IsValid || npc.Location.Distance2D(Core.Player.Location) <= 6)) { NeedToMove = false; } else { await movementComposite.ExecuteCoroutine(npc); } } return(false); }