public void Initialize(Dictionary <EquipmentSlotType, EquipmentSlotControl> es) { FingerLimit = 2; EquipmentSlots = es; WeaponSlot = EquipmentSlots[EquipmentSlotType.Weapon]; OffhandSlot = EquipmentSlots[EquipmentSlotType.Offhand]; if (EquipmentSlots[EquipmentSlotType.Finger1].IsLocked) { FingerLimit--; } if (EquipmentSlots[EquipmentSlotType.Finger2].IsLocked) { FingerLimit--; } foreach (var set in DatasetManager.Dataset.Sets) { if (string.IsNullOrWhiteSpace(set.Value.WikiURL)) { continue; } int ml = 0; List <DDOAdventurePackData> apds = new List <DDOAdventurePackData>(); foreach (var item in set.Value.Items) { if (item.QuestFoundIn.Adpack != null && !apds.Contains(item.QuestFoundIn.Adpack)) { apds.Add(item.QuestFoundIn.Adpack); } if (!QuestSourceManager.IsItemAllowed(item)) { continue; } var mlp = item.Properties.Find(i => i.Property == "Minimum Level"); if (mlp != null && mlp.Value > ml) { ml = (int)mlp.Value; } } foreach (var apd in apds) { if (QuestSourceManager.IsAllowed(apd)) { Sets.Add(new NamedSetInfo { Name = set.Value.Name, ML = ml, WikiURL = set.Value.WikiURL, Set = set.Value }); break; } } } Sets.Sort((a, b) => a.ML < b.ML ? -1 : (a.ML > b.ML ? 1 : a.Name.CompareTo(b.Name))); lvSets.ItemsSource = Sets; SetFilter(CustomFilter); }
private static void OnSlotChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (SlotBGImages == null) { string[] names = Enum.GetNames(typeof(EquipmentSlotType)); SlotBGImages = new BitmapImage[names.Length]; // this skips EquipmentSlotType.None; for (int i = 1; i < names.Length; i++) { SlotBGImages[i] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_bg_" + names[i].ToLower() + ".png")); } } if (SlotFillImages == null) { SlotFillImages = new Dictionary <string, BitmapImage>(); SlotFillImages["back"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_back.png")); SlotFillImages["body_cloth"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_body_cloth.png")); SlotFillImages["body_light"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_body_light.png")); SlotFillImages["body_medium"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_body_medium.png")); SlotFillImages["body_heavy"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_body_heavy.png")); SlotFillImages["body_docent"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_body_docent.png")); SlotFillImages["eye"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_eye.png")); SlotFillImages["feet"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_feet.png")); SlotFillImages["finger"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_finger.png")); SlotFillImages["hand"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_hand.png")); SlotFillImages["head"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_head.png")); SlotFillImages["neck"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_neck.png")); SlotFillImages["offhand_buckler"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_offhand_buckler.png")); SlotFillImages["offhand_small"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_offhand_small.png")); SlotFillImages["offhand_large"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_offhand_large.png")); SlotFillImages["offhand_tower"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_offhand_tower.png")); SlotFillImages["offhand_orb"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_offhand_orb.png")); SlotFillImages["offhand_runearm"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_offhand_runearm.png")); SlotFillImages["trinket"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_trinket.png")); SlotFillImages["waist"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_waist.png")); SlotFillImages["weapon"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_weapon.png")); SlotFillImages["wrist"] = new BitmapImage(new Uri("pack://application:,,,/Resources/slot_fill_wrist.png")); } if (SlotBGImages != null) { EquipmentSlotControl esc = d as EquipmentSlotControl; esc.imgIcon.Source = SlotBGImages[(int)esc.Slot]; } }