private void initOppositionGrid() { { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Faction; col.Name = "target_faction_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Faction"; col.CellTemplate = cell; gridOpposition.Columns.Add(col); } { DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); col.Name = "ref_faction_relationship_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Relationship"; col.CellTemplate = cell; ComboUtils.fillComboCellWithRefTable(cell, "ref_faction_relationship", "ref_faction_relationship_id", "name"); col.ValueMember = "Value"; col.DisplayMember = "Name"; gridOpposition.Columns.Add(col); } }
private void loadNodesGrid(int aId) { gridNodes.Rows.Clear(); DataTable dt = Database.getData("npc_node_map", "npc_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridNodes.Rows.Add(); DataGridViewRow gridRow = gridNodes.Rows[gridIndex]; DataGridViewComboBoxCell cellState = gridRow.Cells["ref_npc_node_type_id"] as DataGridViewComboBoxCell; ComboUtils.fillComboCellWithRefTable(cellState, "ref_npc_node_type", "ref_npc_node_type_id", "name", Database.getNullableId(rowView, "ref_npc_node_type_id")); DataGridViewLinkCell cellItem = gridRow.Cells["item_def_id"] as DataGridViewLinkCell; cellItem.Value = EditorFactory.getBrowseInfo(EditorSystemType.Item, rowView, "item_def_id"); gridRow.Tag = (int)rowView["npc_node_map_id"]; } dt.Dispose(); }
private void loadOppositionGrid(int aId) { gridOpposition.Rows.Clear(); DataTable dt = Database.getData("faction_opposition_map", "faction_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridOpposition.Rows.Add(); DataGridViewRow gridRow = gridOpposition.Rows[gridIndex]; DataGridViewLinkCell cellFaction = gridRow.Cells["target_faction_def_id"] as DataGridViewLinkCell; cellFaction.Value = EditorFactory.getBrowseInfo(EditorSystemType.Faction, rowView, "target_faction_def_id"); DataGridViewComboBoxCell cellType = gridRow.Cells["ref_faction_relationship_id"] as DataGridViewComboBoxCell; ComboUtils.fillComboCellWithRefTable(cellType, "ref_faction_relationship", "ref_faction_relationship_id", "name", Database.getNullableId(rowView, "ref_faction_relationship_id")); gridRow.Tag = (int)rowView["faction_opposition_map_id"]; } dt.Dispose(); }
private void loadResourcesGrid(int aDefId) { gridResources.Rows.Clear(); DataTable dt = Database.getData("item_resource_node_map", "item_def_id", aDefId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridResources.Rows.Add(); DataGridViewRow gridRow = gridResources.Rows[gridIndex]; DataGridViewComboBoxCell cellType = gridRow.Cells["ref_tool_type_id"] as DataGridViewComboBoxCell; ComboUtils.fillComboCellWithRefTable(cellType, "ref_tool_type", "ref_tool_type_id", "name", Database.getNullableId(rowView, "ref_tool_type_id")); DataGridViewLinkCell cellStat = gridRow.Cells["statistic_def_id"] as DataGridViewLinkCell; cellStat.Value = EditorFactory.getBrowseInfo(EditorSystemType.Statistic, rowView, "statistic_def_id"); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellSkill = gridRow.Cells["min_skill"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; cellSkill.Value = (int)rowView["min_skill"]; DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellGather = gridRow.Cells["gather_amount"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; cellGather.Value = (int)rowView["gather_amount"]; DataGridViewLinkCell cellResource = gridRow.Cells["resource_def_id"] as DataGridViewLinkCell; cellResource.Value = EditorFactory.getBrowseInfo(EditorSystemType.Item, rowView, "resource_def_id"); gridRow.Tag = (int)rowView["item_resource_node_map_id"]; } dt.Dispose(); }
private void initNodesGrid() { { DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); col.Name = "ref_npc_node_type_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 25; col.HeaderText = "Node Type"; col.CellTemplate = cell; ComboUtils.fillComboCellWithRefTable(cell, "ref_npc_node_type", "ref_npc_node_type_id", "name"); col.ValueMember = "Value"; col.DisplayMember = "Name"; gridNodes.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Item; col.Name = "item_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Resource Node"; col.CellTemplate = cell; gridNodes.Columns.Add(col); } }
private void loadItemTypesGrid(int aId) { gridItemTypes.Rows.Clear(); DataTable dt = Database.getData("shop_item_type_map", "shop_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridItemTypes.Rows.Add(); DataGridViewRow gridRow = gridItemTypes.Rows[gridIndex]; DataGridViewComboBoxCell cellItemType = gridRow.Cells["ref_item_type_id"] as DataGridViewComboBoxCell; if (Database.getNullableId(rowView, "ref_item_type_id") == 0) { ComboUtils.fillComboCellWithRefTable(cellItemType, "ref_item_type", "ref_item_type_id", "name", 6); } //cellItemType.Value = 6; // None else { ComboUtils.fillComboCellWithRefTable(cellItemType, "ref_item_type", "ref_item_type_id", "name", Database.getNullableId(rowView, "ref_item_type_id")); } gridRow.Tag = (int)rowView["shop_item_type_map_id"]; } dt.Dispose(); }
private void initNpcsGrid() { { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); col.Name = "npc_def_id"; cell.SystemType = EditorSystemType.Npc; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 75; col.HeaderText = "Npcs"; col.CellTemplate = cell; gridNpcs.Columns.Add(col); } { DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); col.Name = "ref_behavior_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 25; col.HeaderText = "Behavior"; col.CellTemplate = cell; ComboUtils.fillComboCellWithRefTable(cell, "ref_behavior", "ref_behavior_id", "name"); col.ValueMember = "Value"; col.DisplayMember = "Name"; gridNpcs.Columns.Add(col); } }
private void loadNpcGrid(int aId) { gridNpcs.Rows.Clear(); DataTable dt = Database.getData("spawn_npc_map", "spawn_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridNpcs.Rows.Add(); DataGridViewRow gridRow = gridNpcs.Rows[gridIndex]; DataGridViewLinkCell cell = gridRow.Cells["npc_def_id"] as DataGridViewLinkCell; cell.Value = EditorFactory.getBrowseInfo(EditorSystemType.Npc, rowView, "npc_def_id"); DataGridViewComboBoxCell cellBehavior = gridRow.Cells["ref_behavior_id"] as DataGridViewComboBoxCell; if (Database.getNullableId(rowView, "ref_behavior_id") == 0) { ComboUtils.fillComboCellWithRefTable(cellBehavior, "ref_behavior", "ref_behavior_id", "name", 1); } //cellBehavior.Value = 1; // Aggressive else { ComboUtils.fillComboCellWithRefTable(cellBehavior, "ref_behavior", "ref_behavior_id", "name", Database.getNullableId(rowView, "ref_behavior_id")); } gridRow.Tag = (int)rowView["spawn_npc_map_id"]; } dt.Dispose(); }
private void loadExitGrid(int aId) { gridExits.Rows.Clear(); DataTable dt = Database.getData("space_exit_map", "space_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridExits.Rows.Add(); DataGridViewRow gridRow = gridExits.Rows[gridIndex]; DataGridViewComboBoxCell cellDirection = gridRow.Cells["ref_direction_id"] as DataGridViewComboBoxCell; ComboUtils.fillComboCellWithRefTable(cellDirection, "ref_direction", "ref_direction_id", "name", (int)rowView["ref_direction_id"]); DataGridViewLinkCell cellSpace = gridRow.Cells["destination_space_def_id"] as DataGridViewLinkCell; cellSpace.Value = EditorFactory.getBrowseInfo(EditorSystemType.Space, rowView, "destination_space_def_id"); int flags = (int)rowView["flags"]; DataGridViewCheckBoxCell cellHidden = gridRow.Cells["is_hidden"] as DataGridViewCheckBoxCell; cellHidden.Value = ((flags & Globals.EXIT_FLAG_Hidden) != 0) ? true : false; DataGridViewCheckBoxCell cellOneWay = gridRow.Cells["is_oneway"] as DataGridViewCheckBoxCell; cellOneWay.Value = ((flags & Globals.EXIT_FLAG_OneWay) != 0) ? true : false; DataGridViewCheckBoxCell cellTransparent = gridRow.Cells["is_transparent"] as DataGridViewCheckBoxCell; cellTransparent.Value = ((flags & Globals.EXIT_FLAG_Transparent) != 0) ? true : false; DataGridViewComboBoxCell cellDifficulty = gridRow.Cells["ref_difficulty_id"] as DataGridViewComboBoxCell; if (Database.getNullableId(rowView, "ref_difficulty_id") == 0) { ComboUtils.fillComboCellWithRefTable(cellDifficulty, "ref_difficulty", "ref_difficulty_id", "name", 6); } //cellDifficulty.Value = 6; // None else { ComboUtils.fillComboCellWithRefTable(cellDifficulty, "ref_difficulty", "ref_difficulty_id", "name", Database.getNullableId(rowView, "ref_difficulty_id")); } DataGridViewLinkCell cellBarrier = gridRow.Cells["barrier_def_id"] as DataGridViewLinkCell; cellBarrier.Value = EditorFactory.getBrowseInfo(EditorSystemType.Barrier, rowView, "barrier_def_id"); gridRow.Tag = (int)rowView["space_exit_map_id"]; } dt.Dispose(); }
private void initItemTypesGrid() { { DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); col.Name = "ref_item_type_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Item Type"; col.CellTemplate = cell; ComboUtils.fillComboCellWithRefTable(cell, "ref_item_type", "ref_item_type_id", "name"); col.ValueMember = "Value"; col.DisplayMember = "Name"; gridItemTypes.Columns.Add(col); } }
private void initResourcesGrid() { { DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); col.Name = "ref_tool_type_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Tool Type"; col.CellTemplate = cell; ComboUtils.fillComboCellWithRefTable(cell, "ref_tool_type", "ref_tool_type_id", "name"); col.ValueMember = "Value"; col.DisplayMember = "Name"; gridResources.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Statistic; col.Name = "statistic_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Statistic"; col.CellTemplate = cell; gridResources.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "min_skill"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Min Skill"; col.CellTemplate = cell; col.Maximum = 9999; col.Minimum = 1; gridResources.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "gather_amount"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Gather Amount"; col.CellTemplate = cell; col.Maximum = 9999; col.Minimum = 1; gridResources.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Item; col.Name = "resource_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Resource"; col.CellTemplate = cell; gridResources.Columns.Add(col); } }
private void initExitGrid() { { DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); col.Name = "ref_direction_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Direction"; col.CellTemplate = cell; ComboUtils.fillComboCellWithRefTable(cell, "ref_direction", "ref_direction_id", "name"); col.ValueMember = "Value"; col.DisplayMember = "Name"; gridExits.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Space; col.Name = "destination_space_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Space"; col.CellTemplate = cell; gridExits.Columns.Add(col); } { DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn(); DataGridViewCheckBoxCell cell = new DataGridViewCheckBoxCell(); col.Name = "is_hidden"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 50; col.HeaderText = "Is Secret"; col.CellTemplate = cell; gridExits.CurrentCellDirtyStateChanged += new EventHandler(gridExits_CurrentCellDirtyStateChanged); gridExits.Columns.Add(col); } { DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); col.Name = "ref_difficulty_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 60; col.HeaderText = "Difficulty"; col.CellTemplate = cell; ComboUtils.fillComboCellWithRefTable(cell, "ref_difficulty", "ref_difficulty_id", "name"); col.ValueMember = "Value"; col.DisplayMember = "Name"; gridExits.Columns.Add(col); } { DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn(); DataGridViewCheckBoxCell cell = new DataGridViewCheckBoxCell(); col.Name = "is_oneway"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 50; col.HeaderText = "Is One-Way"; col.CellTemplate = cell; gridExits.CurrentCellDirtyStateChanged += new EventHandler(gridExits_CurrentCellDirtyStateChanged); gridExits.Columns.Add(col); } { DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn(); DataGridViewCheckBoxCell cell = new DataGridViewCheckBoxCell(); col.Name = "is_transparent"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 50; col.HeaderText = "Is Transparent"; col.CellTemplate = cell; gridExits.CurrentCellDirtyStateChanged += new EventHandler(gridExits_CurrentCellDirtyStateChanged); gridExits.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Barrier; col.Name = "barrier_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Barrier"; col.CellTemplate = cell; gridExits.Columns.Add(col); } }