去除年度报告数据溢出限制 & 修复年度报告经验显示错误

This commit is contained in:
ZouJin 2024-03-28 21:25:05 +08:00
parent fa9a62eb90
commit 692e3ad450
2 changed files with 20 additions and 2 deletions

View File

@ -64,6 +64,24 @@ public class GameSave_VPet : IGameSave
} }
} }
/// <summary> /// <summary>
/// 玩家总共获得的经验值数量
/// </summary>
public double TotalExpGained()
{
double totalExp = 0;
// 首先添加LevelMax的经验值
for (int i = 1; i <= LevelMax; i++)
{
for (int j = 100 * i + 1; j <= 1000 + 100 * i; j++)
totalExp += 200 * j - 100;
}
// 然后,添加当前等级的经验值
totalExp += (Level - 100 * LevelMax) * (200 * (Level - 1) - 100);
// 最后,添加剩余的经验值
totalExp += Exp;
return totalExp;
}
/// <summary>
/// 升级所需经验值 /// 升级所需经验值
/// </summary> /// </summary>
public int LevelUpNeed() => 200 * Level - 100; public int LevelUpNeed() => 200 * Level - 100;

View File

@ -43,7 +43,7 @@ namespace VPet_Simulator.Windows
DataGridStatic.ItemsSource = StatList; DataGridStatic.ItemsSource = StatList;
mw.GameSavesData.Statistics.StatisticChanged += Statistics_StatisticChanged; mw.GameSavesData.Statistics.StatisticChanged += Statistics_StatisticChanged;
if (mw.GameSavesData.HashCheck && mw.GameSavesData.GameSave.Exp < int.MaxValue && mw.GameSavesData.GameSave.Money < int.MaxValue) if (mw.GameSavesData.HashCheck)
{ {
cb_NoCheat.IsEnabled = true; cb_NoCheat.IsEnabled = true;
if (mw.IsSteamUser) if (mw.IsSteamUser)
@ -639,7 +639,7 @@ namespace VPet_Simulator.Windows
r_i_timelength.Source = new BitmapImage(new Uri($"pack://application:,,,/Res/img/r_timelength_{timelength_i}.png")); r_i_timelength.Source = new BitmapImage(new Uri($"pack://application:,,,/Res/img/r_timelength_{timelength_i}.png"));
r_r_level.Text = mw.GameSavesData.GameSave.Level.ToString(); r_r_level.Text = mw.GameSavesData.GameSave.Level.ToString();
r_r_exp.Text = mw.GameSavesData.GameSave.Exp.ToString("f0"); r_r_exp.Text = mw.GameSavesData.GameSave.TotalExpGained().ToString("f0");
r_r_studytime.Text = (mw.GameSavesData.Statistics[(gint)"stat_study_time"] / 60).ToString(); r_r_studytime.Text = (mw.GameSavesData.Statistics[(gint)"stat_study_time"] / 60).ToString();
r_r_studytext.Text = studytext; r_r_studytext.Text = studytext;
r_i_exp.Source = new BitmapImage(new Uri($"pack://application:,,,/Res/img/r_level_{study_i}.png")); r_i_exp.Source = new BitmapImage(new Uri($"pack://application:,,,/Res/img/r_level_{study_i}.png"));