private void updateButton_Click(object sender, EventArgs e) { MonsterInfo monster = (MonsterInfo)SelectMonsterComboBox.SelectedItem; if (monster == null) { return; } try { monster.Stats[Stat.HP] = int.Parse(HPTextBox.Text); monster.Effect = byte.Parse(EffectTextBox.Text); monster.Level = ushort.Parse(LevelTextBox.Text); monster.ViewRange = byte.Parse(ViewRangeTextBox.Text); monster.CoolEye = byte.Parse(CoolEyeTextBox.Text); monster.Stats[Stat.MinAC] = ushort.Parse(MinACTextBox.Text); monster.Stats[Stat.MaxAC] = ushort.Parse(MaxACTextBox.Text); monster.Stats[Stat.MinMAC] = ushort.Parse(MinMACTextBox.Text); monster.Stats[Stat.MaxMAC] = ushort.Parse(MaxMACTextBox.Text); monster.Stats[Stat.MinDC] = ushort.Parse(MinDCTextBox.Text); monster.Stats[Stat.MaxDC] = ushort.Parse(MaxDCTextBox.Text); monster.Stats[Stat.MinMC] = ushort.Parse(MinMCTextBox.Text); monster.Stats[Stat.MaxMC] = ushort.Parse(MaxMCTextBox.Text); monster.Stats[Stat.MinSC] = ushort.Parse(MinSCTextBox.Text); monster.Stats[Stat.MaxSC] = ushort.Parse(MaxSCTextBox.Text); monster.Stats[Stat.Accuracy] = byte.Parse(AccuracyTextBox.Text); monster.Stats[Stat.Agility] = byte.Parse(AgilityTextBox.Text); monster.AttackSpeed = ushort.Parse(ASpeedTextBox.Text); monster.MoveSpeed = ushort.Parse(MSpeedTextBox.Text); } catch { MessageBox.Show("值验证失败。请在更新前更正", "注意", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } foreach (var item in Envir.Objects) { if (item.Race != ObjectType.Monster) { continue; } MonsterObject mob = (MonsterObject)item; mob.RefreshAll(); } }
private void updateButton_Click(object sender, EventArgs e) { MonsterInfo monster = (MonsterInfo)SelectMonsterComboBox.SelectedItem; if (monster == null) { return; } try { monster.HP = uint.Parse(HPTextBox.Text); monster.Effect = byte.Parse(EffectTextBox.Text); monster.Level = ushort.Parse(LevelTextBox.Text); monster.ViewRange = byte.Parse(ViewRangeTextBox.Text); monster.CoolEye = byte.Parse(CoolEyeTextBox.Text); monster.MinAC = ushort.Parse(MinACTextBox.Text); monster.MaxAC = ushort.Parse(MaxACTextBox.Text); monster.MinMAC = ushort.Parse(MinMACTextBox.Text); monster.MaxMAC = ushort.Parse(MaxMACTextBox.Text); monster.MinDC = ushort.Parse(MinDCTextBox.Text); monster.MaxDC = ushort.Parse(MaxDCTextBox.Text); monster.MinMC = ushort.Parse(MinMCTextBox.Text); monster.MaxMC = ushort.Parse(MaxMCTextBox.Text); monster.MinSC = ushort.Parse(MinSCTextBox.Text); monster.MaxSC = ushort.Parse(MaxSCTextBox.Text); monster.Accuracy = byte.Parse(AccuracyTextBox.Text); monster.Agility = byte.Parse(AgilityTextBox.Text); monster.AttackSpeed = ushort.Parse(ASpeedTextBox.Text); monster.MoveSpeed = ushort.Parse(MSpeedTextBox.Text); } catch { MessageBox.Show("Value validation failed. Please correct before updating", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } foreach (var item in Envir.Objects) { if (item.Race != ObjectType.Monster) { continue; } MonsterObject mob = (MonsterObject)item; mob.RefreshAll(); } }