using System;
using System.Collections.Generic;
using Phoenix;
using Phoenix.WorldData;
namespace Scripts
{
public class TargetNext
{
private readonly Notoriety[] Filter = new Notoriety[] {
Notoriety.Murderer,
Notoriety.Enemy
};
private readonly List<uint> used = new List<uint>();
[Command("targetnext")]
public void Find()
{
bool first = true;
tryagain:
// Projdi vsechno co je videt
foreach (UOCharacter mob in World.Characters) {
if (mob.Distance > 17 || Array.IndexOf(Filter, mob.Notoriety) < 0)
continue;
if (used.Contains(mob.Serial))
continue;
// Priste ho preskocime
used.Add(mob.Serial);
// Nastav alias
Aliases.LastAttack = mob.Serial;
// Oznac npc v klientovy
byte[] data = new byte[5];
data[0] = 0xAA;
ByteConverter.BigEndian.ToBytes((uint)mob.Serial, data, 1);
Core.SendToClient(data, false);
return;
}
// Reset, zaciname od znova
used.Clear();
if (first) {
first = false;
goto tryagain;
}
}
}
}