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 UseJewleryInfo UseJewlery(string title, Graphic graphic, UOColor color, string layerStr) { Layer layer = (Layer)Enum.Parse(typeof(Layer), layerStr); List <Serial> usedList = new List <Serial>(); string key = graphic.ToString() + "|" + color.ToString(); if (UniversalUsedList.ContainsKey(key)) { usedList = UniversalUsedList[key]; } else { UniversalUsedList.Add(key, usedList); } return(UseJewlery(title, graphic, color, layer, ref usedList)); }
//--------------------------------------------------------------------------------------------- public UseJewleryInfo UseJewlery(string title, Graphic graphic, UOColor color, Layer l, ref List <Serial> usedList) { List <UOItem> jewelries = new List <UOItem>(); List <Serial> outOfCharges = new List <Serial>(); UOItem jewelry = null; UseJewleryInfo result = new UseJewleryInfo(); string key = graphic.ToString() + "|" + color.ToString(); if (UniversalOutOfCharges.ContainsKey(key)) { outOfCharges = UniversalOutOfCharges[key]; } else { UniversalOutOfCharges.Add(key, outOfCharges); } foreach (UOItem item in World.Player.Backpack.AllItems) { if (item.Graphic == graphic && item.Color == color && !outOfCharges.Contains(item.Serial)) { jewelries.Add(item); } } Game.PrintMessage(title + ": " + jewelries.Count + " Used: " + usedList.Count + " Out:" + outOfCharges.Count); foreach (UOItem item in jewelries) { if (!usedList.Contains(item.Serial)) { jewelry = item; break; } } if (jewelry == null) { usedList.Clear(); Game.PrintMessage(title + " reset"); if (jewelries.Count > 0) { jewelry = jewelries[0]; } } if (jewelry != null) { usedList.Add(jewelry.Serial); result = UseRemoveJewlery(jewelry, l); result.LastInRow = jewelries.Count == usedList.Count; result.Title = title; if (result.OutOfCharges) { outOfCharges.Add(jewelry.Serial); } result.Depleted = jewelries.Count == outOfCharges.Count; } if (result.Success) { World.Player.PrintMessage(String.Format("{0} [{1}/{2}] OK", title, usedList.Count, jewelries.Count)); } else { World.Player.PrintMessage(String.Format("{0} [{1}/{2}] Fail", title, usedList.Count, jewelries.Count), (ushort)Game.Val_LightGreen); } return(result); }