public ItemEditorControl(object data, SaveFile saveFile) { if (!(data is ItemData)) { throw new Exception("Unexpected data type"); } InitializeComponent(); cbAttachmentSlot.DisplayMember = "NameWithoutGroup"; cbMod.DisplayMember = "ItemGameNameDescription"; _saveFile = saveFile; _itemData = (ItemData)data; lblGameName.Text = NameResolver.GetGameName(_itemData.ItemTdbId); lblItemName.Text = NameResolver.GetName(_itemData.ItemTdbId); cbQuestItem.Checked = _itemData.Flags.IsQuestItem; cbUnequippable.Checked = _itemData.Flags.IsNotUnequippable; nudQuantity.Maximum = uint.MaxValue; if (_itemData.Data is ItemData.SimpleItemData sid) { nudQuantity.Enabled = true; nudQuantity.Value = sid.Quantity; } else if (_itemData.Data is ItemData.ModableItemWithQuantityData miwqd) { nudQuantity.Enabled = true; nudQuantity.Value = miwqd.Quantity; } if (_itemData.Data is ItemData.ModableItemData mid) { partListBox.Enabled = true; statsSelect.Enabled = true; addStatButton.Enabled = true; btnDeleteMod.Enabled = true; btnAddMod.Enabled = true; cbAttachmentSlot.Enabled = true; cbModListSelect.Enabled = true; cbMod.Enabled = true; FillPartsList(mid); SelectedPartSeed = _itemData.Header.Seed; SelectedPartTweakDbId = _itemData.ItemTdbId; var statsNode = _saveFile.Nodes.FirstOrDefault(n => n.Name == Constants.NodeNames.STATS_SYSTEM); if (statsNode == null) { return; } _rootData = (GenericUnknownStruct)statsNode.Value; var mapStructure = _rootData.ClassList[0]; _mapStructure = mapStructure as GameStatsStateMapStructure ?? throw new Exception("Unexpected Structure"); FillStatsList(); } }
public string GetName(TweakDbId tdbid) { if (tdbid == null) { return("<null>"); } return(TdbIdIndex.Keys.Contains(tdbid.Raw64) ? TdbIdIndex[tdbid.Raw64].Name : $"Unknown_{tdbid}"); }
public string GetGameDescription(TweakDbId tdbid) { var entry = _cache.FirstOrDefault(_ => _.Hash == tdbid.Raw64); if (entry == null) { entry = TweakDbEntries.FirstOrDefault(_ => _.Hash == tdbid.Raw64); _cache.Add(entry); } return(entry?.GameDescription ?? ""); }
public string GetName(TweakDbId tdbid) { var entry = _cache.FirstOrDefault(_ => _.Hash == tdbid.Raw64); if (entry == null) { entry = TweakDbEntries.FirstOrDefault(_ => _.Hash == tdbid.Raw64); _cache.Add(entry); } return(entry?.Name ?? $"Unknown_{tdbid}"); }
public string GetGameDescription(TweakDbId tdbid) { if (tdbid == null) { return("<null>"); } if (_items.ContainsKey(tdbid.Raw64)) { return(_items[tdbid.Raw64].GameDescription); } return($""); }
public string GetName(TweakDbId tdbid) { if (tdbid == null) { return("<null>"); } if (_items.ContainsKey(tdbid.Raw64)) { return(_items[tdbid.Raw64].Name); } return($"Unknown_{tdbid}"); }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { var selected = partListBox.SelectedItem; if (selected is string) { SelectedPartSeed = _itemData.Header.Seed; SelectedPartTweakDbId = _itemData.ItemTdbId; } else if (selected is ItemData.ItemModData imd) { SelectedPartSeed = imd.Header.Seed; SelectedPartTweakDbId = imd.ItemTdbId; } FillStatsList(); }
public string GetGameName(TweakDbId tdbid) { if (tdbid == null) { return("<null>"); } if (TdbIdIndex.Keys.Contains(tdbid.Raw64) && TdbIdIndex[tdbid.Raw64].InfoOffset != 0) { br.BaseStream.Seek(TdbIdIndex[tdbid.Raw64].InfoOffset, SeekOrigin.Begin); return(br.ReadString()); } else { return(string.Empty); } }
public string GetGameName(TweakDbId tdbid) { if (tdbid == null) { return("<null>"); } if (TdbIdIndex.Keys.Contains(tdbid.Raw64) && TdbIdIndex[tdbid.Raw64].InfoOffset != 0) { using (var ms = new MemoryStream(decompressedData)) { using (var br = new BinaryReader(ms, Encoding.UTF8)) { br.BaseStream.Seek(TdbIdIndex[tdbid.Raw64].InfoOffset, SeekOrigin.Begin); return(br.ReadString()); } } } else { return(string.Empty); } }