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(); } }