private void MonsterCreateButton_Click(object sender, EventArgs e) { if (MudData.Current == null) return; if (MudData.Current.Archetypes == null) return; var archetype = new MudData.Archetype(); archetype.name = "MONSTER_unnamed"; archetype.properties["Title"] = "TEXT:UNNAMED"; MudData.Current.Archetypes.Add(archetype); RefreshMonstersTab(); MonstersListBox.SelectedItem = archetype; MonsterNameTextBox.Focus(); MonsterNameTextBox.SelectAll(); }
private void MonsterApplyButton_Click(object sender, EventArgs e) { if (MudData.Current == null) return; if (MudData.Current.Archetypes == null) return; if (MonstersListBox.SelectedItem == null) return; MudData.Current.Archetypes.Remove(MonstersListBox.SelectedItem as MudData.Archetype); var archetype = new MudData.Archetype(); archetype.name = MonsterNameTextBox.Text; archetype.properties["Title"] = MonsterTextTokenCombo.Text; foreach (DataGridViewRow row in MonsterPropertyDataGrid.Rows) { if (row.Cells.Count != 2) continue; if (row.Cells[0].Value == null) continue; if (row.Cells[1].Value == null) continue; string key = row.Cells[0].Value.ToString(); string value = row.Cells[1].Value.ToString(); archetype.properties[key] = value; } MudData.Current.Archetypes.Add(archetype); RefreshMonstersTab(); AutoSave(); UnhighlightCommitButton(MonsterApplyButton); MonstersListBox.SelectedItem = archetype; }