private void saveGear(bool resetUI) { if (GearTree.SelectedNode == null) { return; } // Do nothing if it is a category not an item. if (GearTree.SelectedNode.Children.Count > 0) { return; } InventoryEntry gear = GearTree.SelectedNode.GetEntry(); for (int Progress = 0; Progress < PartsGear.Items.Count; Progress++) { gear.Parts[Progress] = (string)PartsGear.Items[Progress]; } gear.UsesBigLevel = InventoryEntry.ItemgradePartUsesBigLevel((string)PartsGear.Items[0]); gear.Quantity = (int)QuantityGear.Value; gear.QualityIndex = QualityGear.Value; gear.EquippedSlot = EquippedSlotGear.SelectedIndex; gear.LevelIndex = LevelIndexGear.Value; // Recalculate the gear stats if (GearTree.SelectedNode.GetEntry().Type == InventoryType.Weapon) { gear.RecalculateDataWeapon(); } else if (GearTree.SelectedNode.GetEntry().Type == InventoryType.Item) { gear.RecalculateDataItem(); } gear.BuildName(); // When the item changes, it may not belong in the same location in // in the sorted tree because the name, level, or other sort key // has changed. Remove the node then place it back into the tree to // make sure it is relocated to the proper location, then select the // node and make sure it is visible so the user is focused on the new // location after the changes. if (resetUI) { GearTL.RemoveFromTreeView(GearTree.SelectedNode, false); GearTL.AddToTreeView(gear); GearTL.AdjustSelectionAfterAdd(); GearTree.EnsureVisible(GearTree.SelectedNode); } // Set the parts group page header to display the new name GearPartsGroup.Text = gear.Name; }
private void NewGear_Click(object sender, EventArgs e) { GearTL.AddNew(GearTL.Unsorted.invType);//Bank AddNewWeapon/Item GearTL.AdjustSelectionAfterAdd(); GearTree.EnsureVisible(GearTree.SelectedNode); }