// Testing... private void Button_Click(object sender, EventArgs e) { switch ((sender as Button).Name) { case "btnAttack": lblDamage.Text = _Player.CalculateDamage().ToString(); break; case "btnAddWeapon": int last = cboWeapon.SelectedIndex; _Player.PlayerInventory.AddItemToInventory(World.weapons[3], _Player, 1); cboWeapon.DataSource = _Player.PlayerInventory.Weapons; cboWeapon.SelectedIndex = last; break; case "btnBaseXP": uint plPlayerLevel = _Player.UnitLevel; uint giveExp = Experience.BaseGain(plPlayerLevel, plPlayerLevel); _Player.SetExperience(giveExp); UpdateDisplay(); break; default: break; } }
private void UpdateDisplay() { uint lvl = _Player.UnitLevel; uint plPlayerLevel = _Player.UnitLevel; Weapon CurrWeapon = _Player.CurrentWeapon; if (CurrWeapon == null) { lblCurrentWeapon.Text = ""; } else { lblCurrentWeapon.Text = CurrWeapon.Name.ToString(); } lblGain.Text = Experience.BaseGain(plPlayerLevel, plPlayerLevel).ToString(); lblXPNeeded.Text = Experience.XPRequired(_Player.UnitLevel).ToString(); lblPl_Level.Text = lvl.ToString(); lblCurrentEXP.Text = _Player.experiencePoints.ToString(); lblTime.Text = _Player.IsDead.ToString(); }