void UpdatePlayerValues() { // Handle leveling up if (PlayerEntity.ReadyToLevelUp) { leveling = true; DaggerfallUI.Instance.PlayOneShot(levelUpSound); int bonusPool; if (!PlayerEntity.OghmaLevelUp) { bonusPool = FormulaHelper.BonusPool(); PlayerEntity.Level++; PlayerEntity.MaxHealth = PlayerEntity.RawMaxHealth + FormulaHelper.CalculateHitPointsPerLevelUp(PlayerEntity); } else { bonusPool = oghmaBonusPool; } // Add stats rollout for leveling up NativePanel.Components.Add(statsRollout); this.statsRollout.StartingStats = PlayerEntity.Stats.Clone(); this.statsRollout.WorkingStats = PlayerEntity.Stats.Clone(); this.statsRollout.BonusPool = bonusPool; PlayerEntity.ReadyToLevelUp = false; PlayerEntity.OghmaLevelUp = false; } // Update main labels nameLabel.Text = PlayerEntity.Name; raceLabel.Text = PlayerEntity.RaceTemplate.Name; classLabel.Text = PlayerEntity.Career.Name; levelLabel.Text = PlayerEntity.Level.ToString(); goldLabel.Text = PlayerEntity.GetGoldAmount().ToString(); fatigueLabel.Text = string.Format("{0}/{1}", PlayerEntity.CurrentFatigue / DaggerfallEntity.FatigueMultiplier, PlayerEntity.MaxFatigue / DaggerfallEntity.FatigueMultiplier); healthLabel.Text = string.Format("{0}/{1}", PlayerEntity.CurrentHealth, PlayerEntity.MaxHealth); encumbranceLabel.Text = string.Format("{0}/{1}", (int)PlayerEntity.CarriedWeight, PlayerEntity.MaxEncumbrance); // Update stat labels for (int i = 0; i < DaggerfallStats.Count; i++) { if (!leveling) { statLabels[i].Text = PlayerEntity.Stats.GetLiveStatValue(i).ToString(); } else { statLabels[i].Text = ""; // If leveling, statsRollout will fill in the stat labels. } // Handle stat colour changes if (PlayerEntity.Stats.GetLiveStatValue(i) < PlayerEntity.Stats.GetPermanentStatValue(i)) { statLabels[i].TextColor = DaggerfallUI.DaggerfallUnityStatDrainedTextColor; } else if (PlayerEntity.Stats.GetLiveStatValue(i) > PlayerEntity.Stats.GetPermanentStatValue(i)) { statLabels[i].TextColor = DaggerfallUI.DaggerfallUnityStatIncreasedTextColor; } else { statLabels[i].TextColor = DaggerfallUI.DaggerfallDefaultTextColor; } } }