public Item(int id, string name, string description, int attack, int defence, int speed, bool isConsumable, bool isEquipment, ItemEquipmentType equipmentType, ItemGender gender) { itemId = id; itemName = name; itemDescription = description; itemAttack = attack; itemDefence = defence; itemSpeed = speed; itemIsConsumable = isConsumable; itemIsEquipment = isEquipment; itemEquipmentType = equipmentType; itemGender = gender; var subSprites = Resources.LoadAll <Sprite> (itemGender + "/" + itemEquipmentType + "/" + itemName); itemIcon = subSprites [14]; }
public new void Show() { if (!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "OTwo.exe"))) { _ = MessageBox.Show("Cannot find game executable! (OTwo.exe)", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Hide(); return; } base.Show(); if (client == null) { client = new(); client.GetVersion("OTwo.exe"); MusicList.ItemsSource = null; } if (!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Image", client.Avatar))) { _ = MessageBox.Show( string.Format(CultureInfo.CurrentCulture, "Cannot find game avatar file! ({0})", client.Avatar), "Error", MessageBoxButton.OK, MessageBoxImage.Error ); Hide(); return; } if (parser != null) { IsHide = false; ReloadComboBox(); return; } gender = config.Value("Gender") == 1 ? ItemGender.Male : ItemGender.Female; _ = Instrument.Items.Add(new ComboBoxItem().Content = "None"); _ = Hair.Items.Add(new ComboBoxItem().Content = "None"); _ = Accessory.Items.Add(new ComboBoxItem().Content = "None"); _ = Glove.Items.Add(new ComboBoxItem().Content = "None"); _ = Necklace.Items.Add(new ComboBoxItem().Content = "None"); _ = Glass.Items.Add(new ComboBoxItem().Content = "None"); _ = Hat.Items.Add(new ComboBoxItem().Content = "None"); _ = Pant.Items.Add(new ComboBoxItem().Content = "None"); _ = Earring.Items.Add(new ComboBoxItem().Content = "None"); _ = Shoe.Items.Add(new ComboBoxItem().Content = "None"); _ = Wing.Items.Add(new ComboBoxItem().Content = "None"); _ = Pet.Items.Add(new ComboBoxItem().Content = "None"); parser = new(this); byte[] data = parser.GetRawOJS("Avatar", "Itemdata_China.dat"); if (data == null) { data = parser.GetRawOJS("Avatar", "ItemData_China.dat"); } parser.Destroy(); ItemLists = ItemListParser.LoadData(data, this); foreach (ItemList item in ItemLists) { if (item.Gender == ItemGender.Unknown) { continue; } if (item.ItemCategory is ItemCategory.InstrumentBass or ItemCategory.InstrumentDrum or ItemCategory.InstrumentGuitar or ItemCategory.InstrumentPiano) { _ = Instrument.Items.Add(new ComboBoxItem().Content = item.Name); } if (item.ItemCategory == ItemCategory.Hair) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Hair.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Hair.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory is ItemCategory.Accessory or ItemCategory.Accessory2) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Accessory.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Accessory.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Glove) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Glove.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Glove.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Necklace) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Necklace.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Necklace.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Hat) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Hat.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Hat.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Pant) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Pant.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Pant.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Glass) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Glass.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Glass.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Earring) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Earring.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Earring.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Shoe) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Shoe.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Shoe.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Wing) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Wing.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Wing.Items.Add(new ComboBoxItem().Content = item.Name); } } } if (item.ItemCategory == ItemCategory.Pet) { if (item.Gender != ItemGender.Both) { if (item.Gender == gender) { _ = Pet.Items.Add(new ComboBoxItem().Content = item.Name); } } else { if (item.Gender == ItemGender.Both) { _ = Pet.Items.Add(new ComboBoxItem().Content = item.Name); } } } } IsHide = false; ReloadComboBox(); LoadOJNList(); }