///////////////////////////////////////////////////////////////////////// // // www.ultima.smoce.net // Name: RR Switch // ///////////////////////////////////////////////////////////////////////// using System; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Text; using Phoenix; using Phoenix.WorldData; using System.Linq; using Phoenix.Communication; using Phoenix.Runtime; using Phoenix.Runtime.Reflection; namespace Scripts.smoce { public class ultima_smoce_net { /// /// Timer na změnu dalšího... /// public const int timer = 30; //sec /// /// Timer na změnu dalšího... /// public const int timer_remove = 10; //sec /// /// Zapnout PRINT hlasky: /// True - Ano /// False - Ne /// public const bool print = true; /// /// true - ano /// false - ne /// Sundavat pri stisknuti z ruky do backpacku RING /// public const bool unring = true; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// private const ushort ring_type = 0x108A; // all same is! private const ushort rr = 0x0496; // Name: "Reflex Ring (5 charges)" && Name: "Reflex Ring (0 charges)" private const ushort grr = 0x0B21; // Name: "Great Reflex Ring" private const ushort grrcharges = 0x0020; // Name: "Great Reflex Ring (9 charges)" // private const ushort grrchargess = 0x0000; // Name: "Great Gold Ring (6 charges)" private Dictionary pozite = new Dictionary(); private List prazdny = new List(); private DateTime timers; [Command] public void reflex() { //jeli timer u poziteho prstenu vetsi jak 180s smaze se. List itemsToRemove = new List(); foreach (var pair in pozite) { TimeSpan timer = DateTime.Now - pair.Value; if (timer.Seconds >= timer_remove) { itemsToRemove.Add(pair.Key); } } foreach (Serial item in itemsToRemove) { pozite.Remove(item); } string[] linesback; foreach (UOItem prsten in from c in World.Player.Backpack.AllItems where c.Graphic == ring_type && !prazdny.Contains(c.Serial) && !pozite.ContainsKey(c.Serial) && (c.Color == rr || c.Color == grr || c.Color == grrcharges ) select c)//|| c.Color == grrchargess { UO.DeleteJournal(); EnsureItem(prsten); string[] lines = prsten.Name.Split('('); if (lines.Length >= 2) { linesback = lines[1].Split(' '); } else { linesback = new string[] { "1" }; } if (Int32.Parse(linesback[0]) > 0 && linesback[0] != "") { prsten.Equip(); UO.Wait(500); if (World.Player.Layers[Layer.Ring] == prsten.Serial) { pozite.Add(prsten.Serial, DateTime.Now); timers = DateTime.Now; UO.Print("Nasazen: {0} Nabiti {1}", prsten.Name, linesback[0].ToString()); // sundava prsteny do backpacku unrings(); return; } if (UO.InJournal("It too soon to use it again") || UO.InJournal("The item should be equipped to use") || UO.InJournal("You have to wait")) { UO.Print("Jeste nemuzes pouzit REFLEX !"); // TimeSpan asds = DateTime.Now - timers; // string vystup; // if ((asds.Seconds - timer) <= 0) {vystup = "Nevim"; } else {vystup = (asds.Seconds - timer).ToString(); } // UO.Print("[Asi {0}]", vystup); return; } } else { if (Int32.Parse(linesback[0]) == 0) { prazdny.Add(prsten.Serial); } } } } private void unrings() { if (unring == true && World.Player.Weight <= (World.Player.MaxWeight - 20)) { World.Player.Layers[Layer.Ring].Move(0, World.Player.Backpack); } else { if (unring == true) { info("Mas vysokou vahu na sundani prstenu!", false); } } } private void info(string hlaska,bool hlava) { info(0x00baf, hlaska,hlava); } private void info(ushort color , string hlaska, bool hlava) { if (print) { if (!hlava) { UO.Print(color, "Reflex: {0}", hlaska); } else { World.Player.Print(color, "Reflex: {0}", hlaska); } } } public static void EnsureItem(UOItem item) { // if (String.IsNullOrEmpty(item.Name)) item.Click(); UO.Wait(100); } } }