Script:TargetNext.cs
Z AmonWiki
(Rozdíly mezi verzemi)
												
			
		m   | 
		|||
| Řádka 28: | Řádka 28: | ||
             // Projdi vsechno co je videt  |              // Projdi vsechno co je videt  | ||
             foreach (UOCharacter mob in World.Characters) {  |              foreach (UOCharacter mob in World.Characters) {  | ||
| - |                  if (mob.Distance > 17   | + |                  if (mob.Distance > 17)  | 
| + |                     continue;  | ||
| + |                 if (Array.IndexOf(Filter, mob.Notoriety) < 0)  | ||
                     continue;  |                      continue;  | ||
                 if (used.Contains(mob.Serial))  |                  if (used.Contains(mob.Serial))  | ||
Verze z 31. 3. 2010, 21:23
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 (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; } } } }
