private string GetMaleTexturePath(ItemType.Entry entry) { var textureF = Config.ConquerPath + $@"\c3\texture\{entry.ID}.dds"; if (!File.Exists(textureF)) { textureF = Config.ConquerPath + $@"\c3\texture\{entry.ID / 10 * 10}.dds"; } if (!File.Exists(textureF)) { textureF = Config.ConquerPath + $@"\c3\texture\00{entry.ID / 10 + 200000}0.dds"; } if (File.Exists(textureF)) { return(textureF); } if (WeaponReader.Entries.TryGetValue(entry.ID, out Weapon wep)) { textureF = Config.ConquerPath + $@"\c3\texture\{wep.TextureId}.dds"; } if (File.Exists(textureF)) { return(textureF); } if (ArmetReader.Entries.TryGetValue(entry.ID / 10 + 2100000, out Armet arm)) { textureF = Config.ConquerPath + $@"\c3\texture\{arm.TextureId}.dds"; } return(textureF); }
public unsafe void CopyFrom(ItemType.Entry entry) { if (ImportedFrom.ID == entry.ID) { return; } Id = entry.ID; ImportedFrom = entry; PriceBaseLine = entry.Price; Defense = entry.Defense; MinimumAttack = entry.MinAttack; MaximumAttack = entry.MaxAttack; MagicAttack = entry.MagicAttack; MagicDefense = entry.MagicDefence; Level = entry.RequiredLevel; Range = (byte)entry.Range; Dodge = entry.Dodge; RequiredAgility = entry.Dexterity; PotMp = entry.Mana; PotHp = entry.Life; RequiredSpeed = entry.RequiredSpeed; RequiredSex = entry.RequiredSex; RequiredProfession = entry.RequiredProfession; Name = ""; Description = ""; for (byte i = 0; i < 16; i++) { Name += (char)entry.Name[i]; } for (byte i = 0; i < 128; i++) { Description += (char)entry.Desc[i]; } Name = Name.Replace("\0", ""); Description = Description.Replace("\0", ""); if (FindItemMiniImage(entry, out string invIcon)) { InvIconImg = invIcon; } if (FindMapItemImage(entry, out string mapIcon)) { MapIconImg = mapIcon; } var textureF = GetFemaleTexturePath(entry); if (File.Exists(textureF)) { TextureF = textureF; } var textureM = GetMaleTexturePath(entry); if (File.Exists(textureM)) { TextureM = textureM; } }
private async void AddImage(ItemType.Entry entry) { var bmp = await Task.Run(() => { GetInvIcon(entry, out BitmapImage bitmapImage); return(bitmapImage); }); ItemImageField.Source = bmp; var bmp2 = await Task.Run(() => { GetMapIcon(entry, out BitmapImage bitmapImage); return(bitmapImage); }); MapImageField.Source = bmp2; var bmp3 = await Task.Run(() => { GetTextureF(entry, out BitmapImage bitmapImage); return(bitmapImage); }); TextureImageField.Source = bmp3; var bmp4 = await Task.Run(() => { GetTextureM(entry, out BitmapImage bitmapImage); return(bitmapImage); }); TextureMImageField.Source = bmp4; }
public ImportableItem(ItemType.Entry entry) { InitializeComponent(); Entry = entry; MouseDoubleClick += (sender, args) => { var parentWindow = (ItemImportWindow)Window.GetWindow(this); parentWindow?.Import(Entry); parentWindow?.Close(); }; unsafe { var name = ""; for (var i = 0; i < 16; i++) { name += (char)entry.Name[i]; } name = name.Replace("\0", ""); var quality = entry.ID % 10; var itemText = $"[{(ItemQuality)quality}] {name}"; ItemTextField.Text = itemText; ItemIdField.Text = entry.ID.ToString(); AddImage(entry); } }
private static bool FindMapItemImage(ItemType.Entry entry, out string image) { if (MapItemIcons.Entries.TryGetValue(entry.ID, out MapItemIcon mapItemIcon)) { image = Config.ConquerPath + mapItemIcon.Frames.Values.FirstOrDefault(); if (File.Exists(image)) { return(true); } MessageBox.Show("Item Map Icon referenced in ItemMinIcon.ani but not found at specified path!\r\n" + image, "FATAL!"); } image = Config.ConquerPath + @"\data\MapItemIcon\" + entry.ID + ".dds"; if (File.Exists(image)) { return(true); } image = Config.ConquerPath + @"\data\MapItemIcon\" + entry.ID / 10 * 10 + ".dds"; return(File.Exists(image)); }
private static void GetInvIcon(ItemType.Entry entry, out BitmapImage bitmapImage) { if (!FindItemMiniImage(entry, out string image)) { bitmapImage = null; return; } using (var stream = new MemoryStream(File.ReadAllBytes(image))) { var bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = stream; bitmap.CacheOption = BitmapCacheOption.OnLoad; bitmap.EndInit(); bitmap.Freeze(); bitmapImage = bitmap; } }
public void Import(ItemType.Entry entry) { _entry = entry; }