Script:TargetNext.cs
Z AmonWiki
(Rozdíly mezi verzemi)
Řádka 30: | Řádka 30: | ||
if (mob.Distance > 17) | if (mob.Distance > 17) | ||
continue; | continue; | ||
- | if (Array.IndexOf(Filter, mob.Notoriety) < 0) | + | if (Filter.Length > 0 && Array.IndexOf(Filter, mob.Notoriety) < 0) |
continue; | continue; | ||
if (used.Contains(mob.Serial)) | if (used.Contains(mob.Serial)) |
Aktuální verze z 14. 12. 2010, 21:04
Jazyk: CSharp
Shard: Dark Paradise
Náhrada interního makra TargetNext, spolehlivější, s podporou filtrování.
Nastavuje mimojiné alias lastattack, tzn. netřeba aliasu laststatus.
Součástí základního balíku pro DP.
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) continue; if (Filter.Length > 0 && 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; } } } }