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 initItemGrid() { { 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 = "Items"; col.CellTemplate = cell; gridItems.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "quantity"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Quantity"; col.CellTemplate = cell; col.Maximum = 9999; col.Minimum = 1; gridItems.Columns.Add(col); } }
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 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(); }
private void initStatisticsGrid() { { 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; gridStatistics.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "value"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Stat Value"; col.CellTemplate = cell; col.Maximum = 10000000; col.Minimum = 1; gridStatistics.Columns.Add(col); } }
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 initConversationsGrid() { { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell(); col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.Name = "keyword"; col.HeaderText = "Keywords"; col.CellTemplate = cell; gridConversations.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell(); col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 250; col.Name = "conversation"; col.HeaderText = "Text"; col.CellTemplate = cell; gridConversations.Columns.Add(col); } { DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn(); DataGridViewCheckBoxCell cell = new DataGridViewCheckBoxCell(); col.Name = "is_default"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 25; col.HeaderText = "Is Default"; col.CellTemplate = cell; gridConversations.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Slot; col.Name = "faction_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Faction"; col.CellTemplate = cell; gridConversations.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "faction_reputation"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 60; col.HeaderText = "Reputation"; col.CellTemplate = cell; col.Maximum = 9999; col.Minimum = 0; cell.Value = 0; gridConversations.Columns.Add(col); } }
private void initTablesGrid() { { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.TreasureTable; col.Name = "treasure_table_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Treasure Table"; col.CellTemplate = cell; gridTables.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "item_quantity"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Quantity"; col.CellTemplate = cell; col.Maximum = 99; col.Minimum = 1; cell.Value = 1; gridTables.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "min_coin"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Min Coin"; col.CellTemplate = cell; col.Maximum = 9999999; col.Minimum = 0; cell.Value = 0; gridTables.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "max_coin"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Max Coin"; col.CellTemplate = cell; col.Maximum = 9999999; col.Minimum = 0; cell.Value = 0; gridTables.Columns.Add(col); } }
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 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 initItemsGrid() { { 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 = "Item"; col.CellTemplate = cell; gridItems.CurrentCellDirtyStateChanged += new EventHandler(gridItems_CurrentCellDirtyStateChanged); gridItems.Columns.Add(col); } { DataGridViewColumn col = new DataGridViewColumn(); DataGridViewTypedLinkCell cell = new DataGridViewTypedLinkCell(); cell.SystemType = EditorSystemType.Slot; col.Name = "slot_def_id"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 100; col.HeaderText = "Slot"; col.CellTemplate = cell; gridItems.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "quantity"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 40; col.HeaderText = "Quantity"; col.CellTemplate = cell; col.Maximum = 9999; col.Minimum = 1; cell.Value = 1; gridItems.Columns.Add(col); } }
private void initStatsGrid() { { 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; gridStatistics.Columns.Add(col); } { DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn col = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownColumn(); DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell cell = new DataGridViewNumericUpDownElements.DataGridViewNumericUpDownCell(); col.Name = "value"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.Width = 50; col.HeaderText = "Starting Value"; col.CellTemplate = cell; col.Maximum = 99999; col.Minimum = -99999; gridStatistics.Columns.Add(col); } { DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn(); DataGridViewCheckBoxCell cell = new DataGridViewCheckBoxCell(); col.Name = "is_exempt"; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.FillWeight = 25; col.HeaderText = "Is Exempt"; col.CellTemplate = cell; gridStatistics.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); } }