public bool ReloadData() { if (!statsOnly) { if (activeItem.Data.GetType().FullName.EndsWith("SimpleItemData")) { //SimpleItemData parsing this.Text = activeItem.ItemName + " (Simple Item)"; basicInfoGroupBox.Enabled = true; quickActionsGroupBox.Enabled = false; if (detailsTabControl.TabPages.Contains(modInfoTab)) { detailsTabControl.TabPages.Remove(modInfoTab); } var data = (ItemData.SimpleItemData)activeItem.Data; quantityUpDown.Value = data.Quantity; } else { //ModableItemData parsing this.Text = activeItem.ItemName + " (Modable Item)"; basicInfoGroupBox.Enabled = false; quickActionsGroupBox.Enabled = true; var data = (ItemData.ModableItemData)activeItem.Data; quantityUpDown.Value = 1; modsBaseIdBox.Text = data.TdbId1.Raw64.ToString(); modsTreeView.Nodes.Clear(); var rootNode = modsTreeView.Nodes.Add(data.RootNode.AttachmentSlotName, data.RootNode.AttachmentSlotName + " :: " + data.RootNode.ItemName + " [" + data.RootNode.ChildrenCount.ToString() + "]"); rootNode.Tag = data.RootNode; IterativeBuildModTree(data.RootNode, rootNode); } if (activeItem.Data.GetType() == typeof(ItemData.ModableItemWithQuantityData)) { basicInfoGroupBox.Enabled = true; quantityUpDown.Value = ((ItemData.ModableItemWithQuantityData)activeItem.Data).Quantity; } } //Stats parsing if (activeSaveFile.GetItemStatData(activeItem) == null) { if (detailsTabControl.TabPages.Contains(statsTab)) { detailsTabControl.TabPages.Remove(statsTab); } } else { statsListView.Items.Clear(); var listRows = new List <ListViewItem>(); var statsData = activeSaveFile.GetItemStatData(activeItem); if (statsData.StatModifiers != null) { foreach (Handle <GameStatModifierData> modifier in statsData.StatModifiers) { var row = new string[] { "Constant", modifier.Value.ModifierType.ToString(), modifier.Value.StatType.ToString(), "" }; if (modifier.Value.GetType().Name == "GameCombinedStatModifierData") { row[0] = "Combined"; row[3] = ((GameCombinedStatModifierData)modifier.Value).Value.ToString(); } else if (modifier.Value.GetType().Name == "GameConstantStatModifierData") { row[3] = ((GameConstantStatModifierData)modifier.Value).Value.ToString(); } else { row[0] = "Curve"; } var newItem = new ListViewItem(row); newItem.Tag = modifier; listRows.Add(newItem); } statsListView.BeginUpdate(); statsListView.Items.AddRange(listRows.ToArray()); statsListView.EndUpdate(); } else { statsData.StatModifiers = new Handle <GameStatModifierData> [0]; } } if (!statsOnly) { unknownFlag1CheckBox.Checked = activeItem.Flags.IsNotUnequippable; questItemCheckBox.Checked = activeItem.Flags.IsQuestItem; } return(true); }
public bool ReloadData() { if (!statsOnly) { if (activeItem.Data is SimpleItemData simpleData) { //SimpleItemData parsing this.Text = activeItem.ItemTdbId.ResolvedText + " (Simple Item)"; if (detailsTabControl.TabPages.Contains(modInfoTab)) { detailsTabControl.TabPages.Remove(modInfoTab); } quantityUpDown.Value = simpleData.Quantity; } if (activeItem.Data is ModableItemData modableData) { //ModableItemData parsing this.Text = activeItem.ItemTdbId.ResolvedText + " (Modable Item)"; if (activeItem.Data is ModableItemWithQuantityData modableQuantityData) { quantityUpDown.Value = modableQuantityData.Quantity; } else { basicInfoGroupBox.Enabled = false; quantityUpDown.Value = 1; } quickActionsGroupBox.Enabled = true; modsBaseIdBox.Text = ((ulong)modableData.TdbId1).ToString(); modsTreeView.Nodes.Clear(); var rootNode = modsTreeView.Nodes.Add(modableData.RootNode.AttachmentSlotTdbId.ResolvedText, modableData.RootNode.AttachmentSlotTdbId.ResolvedText + " :: " + modableData.RootNode.ItemTdbId.ResolvedText + " [" + modableData.RootNode.Children.Count.ToString() + "]"); rootNode.Tag = modableData.RootNode; IterativeBuildModTree(modableData.RootNode, rootNode); } } //Stats parsing if (Form1.statsSystemEnabled) { if (activeSaveFile.GetItemStatData(activeItem) == null) { detailsTabControl.TabPages.Remove(statsTab); } else { detailsTabControl.TabPages.Remove(statsPlaceholderTab); statsListView.Items.Clear(); var listRows = new List <ListViewItem>(); var statsData = activeSaveFile.GetItemStatData(activeItem); if (statsData.StatModifiers != null) { foreach (CHandle <gameStatModifierData_Deprecated> modifier in statsData.StatModifiers) { var row = new string[] { "Constant", modifier.Chunk.ModifierType.ToString(), modifier.Chunk.StatType.ToString(), "" }; if (modifier.Chunk is gameCombinedStatModifierData_Deprecated combinedData) { row[0] = "Combined"; row[3] = combinedData.Value.ToString(); } else if (modifier.Chunk is gameConstantStatModifierData_Deprecated constantData) { row[3] = constantData.Value.ToString(); } else { row[0] = "Curve"; } var newItem = new ListViewItem(row); newItem.Tag = modifier; listRows.Add(newItem); } statsListView.BeginUpdate(); statsListView.Items.AddRange(listRows.ToArray()); statsListView.EndUpdate(); } else { statsData.StatModifiers = new(); } } } else { detailsTabControl.TabPages.Remove(statsTab); detailsTabControl.TabPages.Remove(statsPlaceholderTab); } if (!statsOnly) { unknownFlag1CheckBox.Checked = activeItem.Flags.HasFlag(ItemFlag.IsNotUnequippable); questItemCheckBox.Checked = activeItem.Flags.HasFlag(ItemFlag.IsQuestItem); } return(true); }