protected static void SetRemoveSlotItem(string key, SlotItem item) { Graphic g = 0; UOColor c = 0; Serial s = 0; lock (SyncRoot) { if (item == null) { if (Slots.ContainsKey(key)) { SlotKeyList.Remove(key); Slots.Remove(key); } Config.Profile.UserSettings.SetAttribute(g.ToString(), "Graphic", "SlotForm_Slots_" + key); Config.Profile.UserSettings.SetAttribute(c.ToString(), "UOColor", "SlotForm_Slots_" + key); Config.Profile.UserSettings.SetAttribute(s.ToString(), "Serial", "SlotForm_Slots_" + key); } else { if (Slots.ContainsKey(key)) { Slots[key] = item; } else { SlotKeyList.Add(key); Slots.Add(key, item); } } } }
//--------------------------------------------------------------------------------------------- public static void PrintHitsMessage(this UOCharacter character, string message, params object[] args) { string test = message + String.Empty; bool needBranches = test.Contains("["); bool needSpaces = test.Contains("..") || test.Contains(".") || test.Contains("[ "); test = test.Replace("[", "").Replace("]", "").Replace("....", "").Replace("...", "").Replace("..", "").Replace(".", "").Trim(new char[] { ' ' }); //.ToLower(); //if (needBranches) // test = test.ToLower(); if (!String.IsNullOrEmpty(test) && needBranches) { test = "[" + (needSpaces ? " " : "") + test + (needSpaces ? " " : "") + "]"; } UOColor color = Game.Val_GreenBlue; if (character.Notoriety == Notoriety.Murderer || character.Notoriety == Notoriety.Enemy) { color = Game.GetEnemyColorByHits(character); } else { color = Game.GetAlieColorByHits(character); } //character.Print("");//reset 1 //character.Print("");//reset 2 character.Print(color, test, args); }
/// <summary> /// Initializes a new instance of the <see cref="T:SupplyCounter"/> class. /// </summary> public SupplyCounter(UOObject container, Graphic type, UOColor color) { if (!container.Serial.IsValid) { throw new ArgumentException("container"); } if (type.IsInvariant || type == 0) { throw new ArgumentOutOfRangeException("type"); } this.container = container; this.type = type; this.color = color; if (container is UOItem) { collection = ((UOItem)container).AllItems; } else if (container is UOCharacter) { collection = ((UOCharacter)container).Layers; } else { throw new ArgumentException("Invalid container type."); } container.Changed += new ObjectChangedEventHandler(container_Changed); // Init count Recalc(); }
public SpeechMacroCommand(UOColor color, string text) { this.color = color; this.text = text; useColor = true; }
public ItemCount(ISupplyCounter counter, Graphic graphic, UOColor color, bool stock, Point offset) { if (counter == null) { throw new ArgumentNullException("counter"); } if (graphic == 0) { throw new ArgumentOutOfRangeException("type"); } this.counter = counter; this.graphic = graphic; this.color = color; InitializeComponent(); image.Stocked = stock; image.DataIndex = graphic; if (color > 0 && color.IsConstant) { image.UseHue = true; image.HueIndex = color; } Point loc = image.Location; loc.Offset(offset); image.Location = loc; }
public static UOItem FindType(this UOPlayer player, Graphic graphic, UOColor color, Serial serial) { UOItem searchItem = new UOItem(Serial.Invalid); if (serial.IsValid) { List <UOItem> search = new List <UOItem>(); search.AddRange(player.Backpack.AllItems.ToArray()); search.AddRange(player.Layers.ToArray()); foreach (UOItem itm in search) { if (itm.Serial.IsValid && itm.Exist && itm.Serial == serial) { searchItem = itm; break; } } } if (!searchItem.Serial.IsValidCust() || !searchItem.Exist) { searchItem = color.IsConstant ? player.Backpack.Items.FindType(graphic, color) : player.Backpack.Items.FindType(graphic); if (!searchItem.Serial.IsValidCust() || !searchItem.Exist) { searchItem = color.IsConstant ? player.Backpack.AllItems.FindType(graphic, color) : player.Backpack.AllItems.FindType(graphic); if (!searchItem.Serial.IsValidCust() || !searchItem.Exist) { searchItem = color.IsConstant ? player.Layers.FindType(graphic, color) : player.Layers.FindType(graphic); } } } return(searchItem); }
public static void MassMove(Graphic graphic, UOColor color, Serial sourceContainer, Serial destination) { UOItem source = World.GetItem(sourceContainer); if (!source.Exist) { ScriptErrorException.Throw("Invalid source container."); return; } if (!destination.IsValid) { ScriptErrorException.Throw("Invalid destination."); return; } UO.PrintInformation("Moving items of type {0} {1} from {2} to {3}", graphic, color, sourceContainer, destination); foreach (UOItem item in source.Items) { if (item.Graphic == graphic && item.Color == color) { using (ItemUpdateEventWaiter ew = new ItemUpdateEventWaiter(item)) { item.Move(0, destination); ew.Wait(2000); UO.Wait(200); } } } UO.PrintInformation("MassMove finished."); }
public Reagent(Graphic gra, UOColor col, string name, string shortName) { this.graphic = gra; this.color = col; this.name = name; this.shortName = shortName; }
//--------------------------------------------------------------------------------------------- public static void PrintMessage(this UOObject obj, string message, UOColor color, bool supperssPrevMessages, params object[] args) { string test = message + String.Empty; bool needBranches = test.Contains("["); bool needSpaces = test.Contains("..") || test.Contains("..") || test.Contains("[ "); test = test.Replace("[", "").Replace("]", "").Replace("....", "").Replace("...", "").Replace("..", "").Trim(new char[] { ' ' }); //.ToLower(); //if (needBranches) // test = test.ToLower(); if (!String.IsNullOrEmpty(test) && needBranches) { test = "[" + (needSpaces ? " " : "") + test + (needSpaces ? " " : "") + "]"; } if (obj.Serial.IsValidCust()) { if (supperssPrevMessages) { UO.PrintObject(obj.Serial, color, "", args); //reset 1 UO.PrintObject(obj.Serial, color, "", args); //reset 2 } UO.PrintObject(obj.Serial, color, test, args); } else { UO.Print(color, test, args); } }
public SpeechMacroCommand(UOColor color, string text) { this.color = color; this.text = text; useColor = true; }
//--------------------------------------------------------------------------------------------- public static void TrainTinkering(UOColor color, Graphic product, params string[] menus) { UO.Print("Vyber container z ingoty:"); UOItem containerFrom = new UOItem(UIManager.TargetObject()); if (containerFrom.Exist) { UO.Print("containerFrom.Exist:"); UOItem ingotSource = new UOItem(Serial.Invalid); UOItem ingot = new UOItem(Serial.Invalid); if (!(ingot = Mining2.FindIngot(UO.Backpack.Items, (int)Mining2.OreColor.Iron)).Exist || ingot.Amount < 20) { ingot = Mining2.FindIngot(containerFrom.Items, (int)Mining2.OreColor.Iron); ingot.Move(20, UO.Backpack.Serial); Game.Wait(); } UO.Print("while.Exist:" + color); while ((ingotSource = Mining2.FindIngot(containerFrom.Items, color)).Exist) { UO.Print("while.Exist:"); ingotSource.Move(100, UO.Backpack.Serial); Game.Wait(); while ((ingot = Mining2.FindIngot(UO.Backpack.Items, color)).Exist) { UO.Print("while2.Exist:"); JournalEventWaiter jew = new JournalEventWaiter(true, "You put the", "Tinkering failed"); UO.WaitMenu(menus); UOItem tools = UO.Backpack.Items.FindType(TinkersTools); if (tools.Exist) { tools.Use(); jew.Wait(7500); if (Journal.Contains(true, "You can't make anything with what you have")) { Journal.Clear(); break; } } else { UO.Print("Nejsou toolsy."); break; } } UOItem hinge = UO.Backpack.Items.FindType(product); if (hinge.Exist) { hinge.Move(1000, containerFrom.Serial); Game.Wait(); } } } UO.Print("Konec"); }
//--------------------------------------------------------------------------------------------- public static bool IsLog(UOItem ingot, UOColor color) { if (ingot.Graphic == LogGraphic && ingot.Color == color) { return(true); } return(false); }
public static bool ListContains(Graphic graphic, UOColor color, List <IUOItemType> items) { foreach (IUOItemType itemType in items) { if (graphic == itemType.Graphic && color == itemType.Color) { return(true); } } return(false); }
public void Add(Graphic type, Graphic graphic, UOColor color, bool stock, Point offset, bool flowBreak) { var sc = new SupplyCounter(World.Player.Backpack, type, color); var c = new ItemCount(sc, graphic, color, stock, offset); c.Size = ItemSize; container.Controls.Add(c); container.SetFlowBreak(c, flowBreak); }
//--------------------------------------------------------------------------------------------- public static UOItem FindLog(ItemsCollection items, UOColor color) { foreach (UOItem item in items) { if (IsLog(item, color)) { return(item); } } return(new UOItem(Serial.Invalid)); }
//--------------------------------------------------------------------------------------------- public bool Contains(Graphic graphic, UOColor color) { foreach (UOItemType item in this) { if (item.Graphic == graphic && item.Color == color) { return(true); } } return(false); }
//--------------------------------------------------------------------------------------------- public static NecromancySpell GetNecromancySpellFromScroll(Graphic graphic, UOColor color) { foreach (KeyValuePair <NecromancySpell, IUOItemType> kvp in SpellScrool) { if (kvp.Value.Graphic == graphic && kvp.Value.Color == color && kvp.Key != NecromancySpell.Invalid) { return(kvp.Key); } } return(NecromancySpell.Invalid); }
//--------------------------------------------------------------------------------------------- public UOItemType FindItem(Graphic graphic, UOColor color) { UOItemTypeCollection items = FindItems(graphic, color); if (items.Count > 0) { return(items[0]); } return(null); }
public bool UseReflexRing() { List <string> types = new List <string>(); if (World.Player.Backpack.AllItems.FindType(GRR.Graphic, GRR.Color).Exist) { types.Add("GRR"); } if (World.Player.Backpack.AllItems.FindType(GRR2.Graphic, GRR2.Color).Exist) { types.Add("GRR2"); } if (World.Player.Backpack.AllItems.FindType(RR.Graphic, RR.Color).Exist) { types.Add("RR"); } string useType = "GRR"; UOColor c = GRR.Color; int index = 0; for (int i = 0; i < types.Count; i++) { if (lastRRInfo != null && lastRRInfo.Title == types[i] && i < types.Count - 1) { index = i + 1; break; } } if (types.Count > index) { useType = types[index]; } if (useType == "GRR") { c = GRR.Color; } else if (useType == "GRR2") { c = GRR2.Color; } else { c = RR.Color; } lastRRInfo = UseJewlery(useType, 0x108A, c, "Ring"); return(lastRRInfo.Success); }
protected ObjectCommandBase(Serial serial) { this.serial = serial; RealItem item = World.GetRealItem(serial); if (item.Serial != World.InvalidSerial) { graphic = item.Graphic; color = item.Color; } CommandTarget = "Object"; }
//--------------------------------------------------------------------------------------------- public bool Contains(Graphic graphic, UOColor color) { foreach (Reagent r in this) { if (r.Graphic == graphic && r.Color == color) { return(true); } } return(false); }
public UOItem FindType(Graphic graphic, UOColor color) { foreach (UOItem item in this) { if (item.Graphic == graphic && item.Color == color && Array.IndexOf <Layer>(allowedLayers, item.Layer) >= 0) { return(item); } } return(new UOItem(Serial.Invalid)); }
public static void MakeDust(ushort amount, UOColor ingotColor) { if (!AdaHammer.Exist) { World.Player.PrintMessage("Nemas kladivo", MessageType.Error); return; } if (!World.Player.FindType(0x1BEF, ingotColor).Exist) { World.Player.PrintMessage("Nemas Ingoty", MessageType.Error); return; } if (!World.Player.FindType(0x1BEF, ingotColor).Move(amount, World.Player.X, World.Player.Y, World.Player.Z)) { World.Player.PrintMessage("Nepovedl se drop", MessageType.Error); return; } Game.Wait(250); UOItem ingot = World.Ground.OrderBy(i => i.Distance).FirstOrDefault(i => i.Graphic == 0x1BEF && i.Color == ingotColor);//.FindType(0x1BEF, ingotColor); if (ingot != null && ingot.Distance > 1) { World.Player.PrintMessage("Ingot moc daleko " + ingot.Distance, MessageType.Error); ingot.PrintMessage("Tento!", MessageType.Error); return; } Journal.Clear(); UO.WaitTargetObject(ingot); AdaHammer.Use(); Journal.WaitForText(true, 500, "Rozbils ingot na kouzelne shardy!"); Game.Wait(250); if (Journal.Contains(true, "at your feet. It is too heavy..")) { World.Player.PrintMessage("[ too heavy.. ]", MessageType.Warning); } UOItemExtInfo info = ItemHelper.GetItemExtInfo(AdaHammer); Game.PrintMessage("Nabiti kladiva " + info.PlusValue); }
protected ObjectCommandBase(Serial serial) { this.serial = serial; RealItem item = World.GetRealItem(serial); if (item.Serial != World.InvalidSerial) { graphic = item.Graphic; color = item.Color; } CommandTarget = "Object"; }
//--------------------------------------------------------------------------------------------- public UOItemTypeCollection FindItems(Graphic graphic, UOColor color) { UOItemTypeCollection items = new UOItemTypeCollection(); foreach (UOItemType item in this) { if (item.Graphic == graphic && item.Color == color) { items.Add(item); } } return(items); }
//--------------------------------------------------------------------------------------------- public static UOColor GetGlobalConfigValueOrDefault(string xpath, string attrName, UOColor defaultValue) { string val = GetGlobalConfigValue(xpath, attrName); if (val != null) { try { UOColor c = UOColor.Parse(val); return(c); } catch { } } return(defaultValue); }
public void AddItem(string name, Graphic type, UOColor color) { var sc = new SupplyCounter(UO.Backpack, type, color); var item = new ItemInfo { Name = name, Amount = sc.CurrentAmount }; data.Add(item); sc.AmountChanged += delegate(object sender, EventArgs e) { item.Amount = sc.CurrentAmount; UpdateText(); }; }
//--------------------------------------------------------------------------------------------- public static UOItem FindType(this UOPlayer player, Graphic graphic, UOColor color) { UOItem searchItem = new UOItem(Serial.Invalid); searchItem = color.IsConstant ? player.Backpack.Items.FindType(graphic, color) : player.Backpack.Items.FindType(graphic); if (!searchItem.Serial.IsValidCust() || !searchItem.Exist) { searchItem = color.IsConstant ? player.Backpack.AllItems.FindType(graphic, color) : player.Backpack.AllItems.FindType(graphic); if (!searchItem.Serial.IsValidCust() || !searchItem.Exist) { searchItem = color.IsConstant ? player.Layers.FindType(graphic, color) : player.Layers.FindType(graphic); } } return(searchItem); }
//--------------------------------------------------------------------------------------------- public static void PrintMessage(this UOObject obj, string message, UOColor color, bool supperssPrevMessages, params object[] args) { if (obj.Serial.IsValidCust()) { if (supperssPrevMessages) { UO.PrintObject(obj.Serial, color, "", args); //reset 1 UO.PrintObject(obj.Serial, color, "", args); //reset 2 } UO.PrintObject(obj.Serial, color, message, args); } else { UO.Print(color, message, args); } }
//--------------------------------------------------------------------------------------------- public static UOItem FindReagentAll(Serial container, Graphic graphic, UOColor color, int?amount) { UOItem cont = new UOItem(container); if (cont.Exist) { foreach (UOItem item in cont.AllItems) { if (item.Graphic == graphic && item.Color == color && (!amount.HasValue || (item.Amount == amount.Value || item.Amount > amount.Value))) { return(item); } } //return cont.AllItems.FindType(graphic, color); } return(new UOItem(Serial.Invalid)); }
//--------------------------------------------------------------------------------------------- public static UOItem FindType(this ItemsCollection items, UOColor color) { foreach (UOItem item in items) { if (item.Color == color) { return(item); } } return(new UOItem(Serial.Invalid)); //if (typeOnly)//!itemType.Color.IsConstant)//Spis ==0x000 0 nebo 0xFFFF // return items.FindType(itemType.Graphic); //else // return items.FindType(itemType.Graphic, itemType.Color); }
//--------------------------------------------------------------------------------------------- public static void PrintHitsMessage(this UOCharacter character, string message, params object[] args) { UOColor color = Game.Val_GreenBlue; if (character.Notoriety == Notoriety.Murderer || character.Notoriety == Notoriety.Enemy) { color = Game.GetEnemyColorByHits(character); } else { color = Game.GetAlieColorByHits(character); } //character.Print("");//reset 1 //character.Print("");//reset 2 character.Print(color, message, args); }
public static void UseType(Graphic graphic, UOColor color) { UOItem item = World.Player.Layers.FindType(graphic, color); if (item.Serial.IsValid) UO.UseObject(item); else ScriptErrorException.Throw("Type not found."); }
public static IRequestResult WaitTargetType(Graphic graphic, UOColor color) { UOItem item = World.Player.Layers.FindType(graphic, color); if (item.Serial.IsValid) return WaitTargetObject(item); else { ScriptErrorException.Throw("Type not found."); return UIManager.FailedResult; } }
public static UOItem FindType(string objectName, Graphic graphic, UOColor color, Serial container) { UOItem foundItem; if (container != 0) { UOObject obj = World.GetObject(container); if (obj.Serial.IsValid) { if (obj is UOItem) foundItem = ((UOItem)obj).AllItems.FindType(graphic, color); else foundItem = ((UOCharacter)obj).Layers.FindType(graphic, color); } else { ScriptErrorException.Throw("Invalid container serial."); foundItem = new UOItem(Serial.Invalid); } } else { foundItem = World.Ground.FindType(graphic, color); } Aliases.SetObject(objectName, foundItem); return foundItem; }