TargetNext
Z AmonWiki
(Rozdíly mezi verzemi)
(Založena nová stránka: <source lang="csharp" remoteFile="http://www.amonthia.com/mikee/TargetNext.cs"></source>) |
|||
Řádka 1: | Řádka 1: | ||
- | <source lang="csharp" | + | <source lang="csharp"> |
+ | 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; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </source> |
Aktuální verze z 13. 2. 2010, 17:53
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; } } } }