public static void TargetMonster(this BotClient Client) { try { Monster[] Mons = (from v in Client.Monsters where v.EntityType == MapEntity.Type.Monster orderby v.HPPercent ascending select v).ToArray(); if (Mons.Length > 0) { for (int i = 0; i < Mons.Length; i++) { try { if (Client.CanTarget(Mons[i])) { Client.AttackTargetSerial = Mons[i].Serial; return; } } catch { continue; } } } } catch { } Client.AttackTargetSerial = 0; }
public static List <uint> TargetMonsters(this BotClient Client) { List <uint> Serials = new List <uint>(); try { Monster[] Mons = (from v in Client.Monsters where v.EntityType == MapEntity.Type.Monster orderby v.HPPercent ascending select v).ToArray(); if (Mons.Length == 0) { return(Serials); } for (int i = 0; i < Mons.Length; i++) { if ((Mons[i] != null) && Client.CanTarget(Mons[i])) { Serials.Add(Mons[i].Serial); } } } catch { } return(Serials); }