private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { var character = (Model.Character)listBox1.SelectedItem; //var character = (from c in _chapterSave.Characters // where c.BinaryPosition == characterId // select c).FirstOrDefault(); _selectedCharacter = character; LoadCharacter(character); }
private string GetStatBytesString(Model.Character character) { var str = ""; if (Enum.IsDefined(typeof(Enums.Character), character.CharacterID) && Enum.IsDefined(typeof(Enums.Class), character.ClassID)) { var characterData = _characterDatabase.GetByID(character.CharacterID); var classData = _classDatabase.GetByID(character.ClassID); byte[] trueStats = new byte[] { (byte)(characterData.Base_HP + classData.Base_HP + character.StatBytes1[0]), (byte)(characterData.Base_Str + classData.Base_Str + character.StatBytes1[1]), (byte)(characterData.Base_Mag + classData.Base_Mag + character.StatBytes1[2]), (byte)(characterData.Base_Skl + classData.Base_Skl + character.StatBytes1[3]), (byte)(characterData.Base_Spd + classData.Base_Spd + character.StatBytes1[4]), (byte)(characterData.Base_Lck + classData.Base_Lck + character.StatBytes1[5]), (byte)(characterData.Base_Def + classData.Base_Def + character.StatBytes1[6]), (byte)(characterData.Base_Res + classData.Base_Res + character.StatBytes1[7]) }; byte[] caps = new byte[] { (byte)(classData.Max_HP + characterData.Modifier_HP + character.StatueBonuses[0]), (byte)(classData.Max_Str + characterData.Modifier_Str + character.StatueBonuses[1]), (byte)(classData.Max_Mag + characterData.Modifier_Mag + character.StatueBonuses[2]), (byte)(classData.Max_Skl + characterData.Modifier_Skl + character.StatueBonuses[3]), (byte)(classData.Max_Spd + characterData.Modifier_Spd + character.StatueBonuses[4]), (byte)(classData.Max_Lck + characterData.Modifier_Lck + character.StatueBonuses[5]), (byte)(classData.Max_Def + characterData.Modifier_Def + character.StatueBonuses[6]), (byte)(classData.Max_Res + characterData.Modifier_Res + character.StatueBonuses[7]) }; for (int i = 0; i < 8; i++) { if (trueStats[i] < caps[i]) { str += trueStats[i].ToString() + '-'; } else { str += caps[i].ToString() + '-'; } } } else { str += BitConverter.ToString((byte[])(Array)character.StatBytes1); str += Environment.NewLine; str += BitConverter.ToString((byte[])(Array)character.StatBytes2); } return(str); }
private void LoadCharacter(Model.Character character) { if (Enum.IsDefined(typeof(Enums.Character), character.CharacterID)) { lblName.Text = _characterDatabase.GetByID(character.CharacterID).DisplayName; } else { lblName.Text = character.CharacterID.ToString(); } if (Enum.IsDefined(typeof(Enums.Class), character.ClassID)) { cmbClass.Text = _classDatabase.GetByID(character.ClassID).DisplayName; } else { cmbClass.Text = character.ClassID.ToString(); } numLevel.Value = character.Level; numExperience.Value = character.Experience; numBoots.Value = Model.Character.FixBoots(character.Boots); chkDeployed.Checked = character.IsDeployed; chkDead.Checked = character.IsDead; chkEinherjar.Checked = character.IsEinherjar; chkRecruited.Checked = character.IsRecruited; cmbSkill1.Text = _skillDatabase.GetByID(character.EquippedSkill_1).DisplayName; pictSkill1.Image = GetSkillImage(character.EquippedSkill_1); cmbSkill2.Text = _skillDatabase.GetByID(character.EquippedSkill_2).DisplayName; pictSkill2.Image = GetSkillImage(character.EquippedSkill_2); cmbSkill3.Text = _skillDatabase.GetByID(character.EquippedSkill_3).DisplayName; pictSkill3.Image = GetSkillImage(character.EquippedSkill_3); cmbSkill4.Text = _skillDatabase.GetByID(character.EquippedSkill_4).DisplayName; pictSkill4.Image = GetSkillImage(character.EquippedSkill_4); cmbSkill5.Text = _skillDatabase.GetByID(character.EquippedSkill_5).DisplayName; pictSkill5.Image = GetSkillImage(character.EquippedSkill_5); cmbHeadwear.Text = character.Headwear.ToString(); cmbFacewear.Text = character.Facewear.ToString(); cmbArmwear.Text = character.Armwear.ToString(); cmbUnderwear.Text = character.Underwear.ToString(); numSword.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Sword); numLance.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Lance); numAxe.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Axe); numShuriken.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Shuriken); numBow.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Bow); numTome.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Tome); numStaff.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Staff); numStone.Value = Model.Character.FixWeaponExperience(character.WeaponExperience_Stone); lblInventory1.Text = GetItemString(character.Item_1); lblInventory2.Text = GetItemString(character.Item_2); lblInventory3.Text = GetItemString(character.Item_3); lblInventory4.Text = GetItemString(character.Item_4); lblInventory5.Text = GetItemString(character.Item_5); txtStatBytes.Text = GetStatBytesString(character); numBattles.Value = character.BattleCount; numVictories.Value = character.VictoryCount; //EnableControls(); }