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(); }
public override void loadItemData(int aDefId) { gridSockets.Rows.Clear(); int flags = 0; DataTable dt = Database.getData("item_rune_map", "item_def_id", aDefId, null); if (dt == null) { return; } if (dt.Rows.Count == 0) { return; } foreach (DataRowView rowView in dt.Rows) { int gridIndex = gridSockets.Rows.Add(); DataGridViewRow gridRow = gridSockets.Rows[gridIndex]; DataGridViewLinkCell cell = gridRow.Cells["slot_def_id"] as DataGridViewLinkCell; cell.Value = EditorFactory.getBrowseInfo(EditorSystemType.Slot, rowView, "slot_def_id"); flags = (int)rowView["flags"]; gridRow.Tag = (int)rowView["item_rune_map_id"]; } dt.Dispose(); chkIsRemovable.Checked = ((flags & Globals.RUNE_FLAG_Removable) != 0) ? true : false; }
private void loadAbilitiesGrid(int aId) { gridAbilities.Rows.Clear(); DataTable dt = Database.getData("npc_ability_map", "npc_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridAbilities.Rows.Add(); DataGridViewRow gridRow = gridAbilities.Rows[gridIndex]; DataGridViewLinkCell cellAbility = gridRow.Cells["ability_def_id"] as DataGridViewLinkCell; cellAbility.Value = EditorFactory.getBrowseInfo(EditorSystemType.Ability, rowView, "ability_def_id"); DataGridViewCheckBoxCell cellDefault = gridRow.Cells["is_default"] as DataGridViewCheckBoxCell; if (rowView["is_default"] != DBNull.Value) { cellDefault.Value = (bool)rowView["is_default"]; } gridRow.Tag = (int)rowView["npc_ability_map_id"]; } dt.Dispose(); }
private void loadItemGrid(int aId) { gridItems.Rows.Clear(); DataTable dt = Database.getData("space_item_map", "space_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridItems.Rows.Add(); DataGridViewRow gridRow = gridItems.Rows[gridIndex]; DataGridViewLinkCell cellItem = gridRow.Cells["item_def_id"] as DataGridViewLinkCell; cellItem.Value = EditorFactory.getBrowseInfo(EditorSystemType.Item, rowView, "item_def_id"); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellQty = gridRow.Cells["quantity"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; cellQty.Value = (int)rowView["quantity"]; gridRow.Tag = (int)rowView["space_item_map_id"]; } dt.Dispose(); }
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 loadStatisticsGrid(int aId) { gridStatistics.Rows.Clear(); DataTable dt = Database.getData("npc_statistic_map", "npc_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridStatistics.Rows.Add(); DataGridViewRow gridRow = gridStatistics.Rows[gridIndex]; DataGridViewLinkCell cellStat = gridRow.Cells["statistic_def_id"] as DataGridViewLinkCell; cellStat.Value = EditorFactory.getBrowseInfo(EditorSystemType.Statistic, rowView, "statistic_def_id"); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellValue = gridRow.Cells["value"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; cellValue.Value = (int)rowView["value"]; gridRow.Tag = (int)rowView["npc_statistic_map_id"]; } dt.Dispose(); }
void gridItems_CurrentCellDirtyStateChanged(object sender, EventArgs e) { if (gridItems.CurrentCell == null) { return; } if (gridItems.CurrentCell is DataGridViewTypedLinkCell) { // Find the slot information EditorBrowseInfo itemDefIdBrowseInfo = gridItems.CurrentRow.Cells["item_def_id"].Value as EditorBrowseInfo; int itemDefId = itemDefIdBrowseInfo.Id; DataTable dt = Database.getData("item_slot_map", "item_def_id", itemDefId, null); if (dt == null) { return; } if (dt.Rows.Count == 0) { return; } DataRow dataRow = dt.Rows[0]; DataGridViewLinkCell cellSlot = gridItems.CurrentRow.Cells["slot_def_id"] as DataGridViewLinkCell; cellSlot.Value = EditorFactory.getBrowseInfo(EditorSystemType.Slot, dataRow, "slot_def_id"); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellQty = gridItems.CurrentRow.Cells["quantity"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; cellQty.Value = (int)1; } }
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 loadAmalgamStatGrid(int aId) { gridAmalgamStats.Rows.Clear(); DataTable dt = Database.getData("statistic_amalgam_map", "statistic_def_id", aId, null); if (dt == null) { return; } if (dt.Rows.Count == 0) { lblAmalgam.Visible = true; gridAmalgamStats.Visible = true; } else { foreach (DataRow rowView in dt.Rows) { int gridIndex = gridAmalgamStats.Rows.Add(); DataGridViewRow gridRow = gridAmalgamStats.Rows[gridIndex]; DataGridViewLinkCell cellStat = gridRow.Cells["statistic_def_id"] as DataGridViewLinkCell; cellStat.Value = EditorFactory.getBrowseInfo(EditorSystemType.Statistic, rowView, "amalgam_statistic_def_id"); gridRow.Tag = (int)rowView["statistic_amalgam_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 loadTablesGrid(int aId) { gridTables.Rows.Clear(); DataTable dt = Database.getData("treasure_table_map", "treasure_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridTables.Rows.Add(); DataGridViewRow gridRow = gridTables.Rows[gridIndex]; DataGridViewLinkCell cellTable = gridRow.Cells["treasure_table_def_id"] as DataGridViewLinkCell; cellTable.Value = EditorFactory.getBrowseInfo(EditorSystemType.TreasureTable, rowView, "treasure_table_def_id"); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellQty = gridRow.Cells["item_quantity"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; if (rowView["item_quantity"] != System.DBNull.Value) { cellQty.Value = (int)rowView["item_quantity"]; } DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellMin = gridRow.Cells["min_coin"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; if (rowView["min_coin"] != System.DBNull.Value) { cellMin.Value = (int)rowView["min_coin"]; } DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellMax = gridRow.Cells["max_coin"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; if (rowView["max_coin"] != System.DBNull.Value) { cellMax.Value = (int)rowView["max_coin"]; } gridRow.Tag = (int)rowView["treasure_table_map_id"]; } dt.Dispose(); }
private void loadTerrainGrid(int aId) { gridTerrain.Rows.Clear(); DataTable dt = Database.getData("item_vehicle_terrain_map", "item_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridTerrain.Rows.Add(); DataGridViewRow gridRow = gridTerrain.Rows[gridIndex]; DataGridViewLinkCell cellTerrain = gridRow.Cells["terrain_def_id"] as DataGridViewLinkCell; cellTerrain.Value = EditorFactory.getBrowseInfo(EditorSystemType.Terrain, rowView, "terrain_def_id"); gridRow.Tag = (int)rowView["item_vehicle_terrain_map_id"]; } dt.Dispose(); }
private void loadEffectsGrid(int aId) { gridEffects.Rows.Clear(); DataTable dt = Database.getData("space_effect_map", "space_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridEffects.Rows.Add(); DataGridViewRow gridRow = gridEffects.Rows[gridIndex]; DataGridViewLinkCell cell = gridRow.Cells["space_effect_def_id"] as DataGridViewLinkCell; cell.Value = EditorFactory.getBrowseInfo(EditorSystemType.SpaceEffect, rowView, "space_effect_def_id"); gridRow.Tag = (int)rowView["space_effect_map_id"]; } dt.Dispose(); }
private void loadConversationsGrid(int aId) { gridConversations.Rows.Clear(); DataTable dt = Database.getData("npc_conversation_map", "npc_def_id", aId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridConversations.Rows.Add(); DataGridViewRow gridRow = gridConversations.Rows[gridIndex]; DataGridViewTextBoxCell cellKeyword = gridRow.Cells["keyword"] as DataGridViewTextBoxCell; cellKeyword.MaxInputLength = Database.getColumnLength("npc_conversation_map", "keyword"); cellKeyword.Value = rowView["keyword"].ToString(); DataGridViewTextBoxCell cellText = gridRow.Cells["conversation"] as DataGridViewTextBoxCell; cellText.MaxInputLength = Database.getColumnLength("npc_conversation_map", "conversation"); cellText.Value = rowView["conversation"].ToString(); DataGridViewCheckBoxCell cellDefault = gridRow.Cells["is_default"] as DataGridViewCheckBoxCell; if (rowView["is_default"] != DBNull.Value) { cellDefault.Value = (bool)rowView["is_default"]; } DataGridViewLinkCell cellFaction = gridRow.Cells["faction_def_id"] as DataGridViewLinkCell; cellFaction.Value = EditorFactory.getBrowseInfo(EditorSystemType.Faction, rowView, "faction_def_id"); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cellRep = gridRow.Cells["faction_reputation"] as DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell; cellRep.Value = (int)rowView["faction_reputation"]; gridRow.Tag = (int)rowView["npc_conversation_map_id"]; } dt.Dispose(); }
private void loadAccessLevelsGrid(int aDefId) { gridAccessLevels.Rows.Clear(); DataTable dt = Database.getData("zone_access_map", "zone_def_id", aDefId, null); if (dt == null) { return; } foreach (DataRow rowView in dt.Rows) { int gridIndex = gridAccessLevels.Rows.Add(); DataGridViewRow gridRow = gridAccessLevels.Rows[gridIndex]; DataGridViewLinkCell cell = gridRow.Cells["access_def_id"] as DataGridViewLinkCell; cell.Value = EditorFactory.getBrowseInfo(EditorSystemType.AccessLevel, rowView, "access_def_id"); gridRow.Tag = (int)rowView["zone_access_map_id"]; } dt.Dispose(); }