允许倍率时超过100级工作 & 修复net8打开问题

This commit is contained in:
ZouJin 2024-03-19 15:26:26 +08:00
parent 7ebf90bb22
commit eac5a74371
8 changed files with 43 additions and 28 deletions

View File

@ -51,14 +51,12 @@ namespace VPet_Simulator.Windows.Interface
/// <returns>是否超模</returns> /// <returns>是否超模</returns>
public static bool IsOverLoad(this Work work) public static bool IsOverLoad(this Work work)
{//判断这个工作是否超模 {//判断这个工作是否超模
if (work.LevelLimit > 100)
return true;
if (work.LevelLimit < 0) if (work.LevelLimit < 0)
work.LevelLimit = 0; work.LevelLimit = 0;
if (work.FinishBonus < 0) if (work.FinishBonus < 0)
work.FinishBonus = 0; work.FinishBonus = 0;
if (work.Type == Work.WorkType.Play && work.Feeling > 0) if (work.Type == Work.WorkType.Play && work.Feeling > 0)
work.Feeling *= -1; work.Feeling *= -1;//旧版本代码兼容
if (work.Time < 10) if (work.Time < 10)
work.Time = 10; work.Time = 10;
@ -86,12 +84,6 @@ namespace VPet_Simulator.Windows.Interface
for (int i = 0; i < maxIterations; i++) for (int i = 0; i < maxIterations; i++)
{ {
if (work.LevelLimit > 100)
work.LevelLimit = 100;
if (work.FinishBonus < 0)
work.FinishBonus = 0;
while (Math.Abs(work.Get()) > 1.1 * work.LevelLimit + 10) //等级获取速率限制 while (Math.Abs(work.Get()) > 1.1 * work.LevelLimit + 10) //等级获取速率限制
{ {
work.MoneyBase /= 2; work.MoneyBase /= 2;

View File

@ -374,7 +374,12 @@ namespace VPet_Simulator.Windows
{ {
try try
{ {
Process.Start(url); var psi = new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
};
Process.Start(psi);
} }
catch catch
{ {

View File

@ -1186,11 +1186,8 @@ namespace VPet_Simulator.Windows
//看看是否超模 //看看是否超模
if (HashCheck && work.IsOverLoad()) if (HashCheck && work.IsOverLoad())
{ {
double spend = work.Spend(); if (MessageBoxX.Show("当前工作数据属性超模,是否继续工作?\n超模工作可能会导致游戏发生不可预料的错误\n超模工作不影响大部分成就解锁\n可以在设置中开启自动计算自动为工作设置合理数值"
double get = work.Get(); .Translate(), "超模工作提醒".Translate(), MessageBoxButton.YesNo) != MessageBoxResult.Yes)
var rel = get / spend;
if (MessageBoxX.Show("当前工作数据属性超模,是否继续工作?\n超模工作可能会导致游戏发生不可预料的错误\n超模工作不影响大部分成就解锁\n当前数据比率 {0:f2} 推荐=0.5<0.75\n盈利速度:{1:f0} 推荐<{2}"
.Translate(rel, get, (work.LevelLimit + 4) * 3), "超模工作提醒".Translate(), MessageBoxButton.YesNo) != MessageBoxResult.Yes)
{ {
return false; return false;
} }
@ -1614,6 +1611,8 @@ namespace VPet_Simulator.Windows
{ {
foreach (var work in Core.Graph.GraphConfig.Works) foreach (var work in Core.Graph.GraphConfig.Works)
{ {
if (work.LevelLimit > 100)//导入的最大合理工作不能超过100级
work.LevelLimit = 100;
if (work.IsOverLoad()) if (work.IsOverLoad())
{ {
work.FixOverLoad(); work.FixOverLoad();

View File

@ -23,6 +23,8 @@ using Steamworks.Data;
using System.Windows.Controls; using System.Windows.Controls;
using ToolBar = VPet_Simulator.Core.ToolBar; using ToolBar = VPet_Simulator.Core.ToolBar;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Diagnostics;
using System.Reflection.Metadata;
namespace VPet_Simulator.Windows namespace VPet_Simulator.Windows
{ {
@ -361,7 +363,14 @@ namespace VPet_Simulator.Windows
catch { } catch { }
Save(); Save();
if (App.MainWindows.Count == 1) if (App.MainWindows.Count == 1)
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); {
var psi = new ProcessStartInfo
{
FileName = Path.ChangeExtension(System.Reflection.Assembly.GetExecutingAssembly().Location, "exe"),
UseShellExecute = true
};
Process.Start(psi);
}
else else
{ {
new MainWindow(PrefixSave).Show(); new MainWindow(PrefixSave).Show();

View File

@ -190,15 +190,15 @@ public partial class MPFriends : WindowX
petloader ??= Pets[0]; petloader ??= Pets[0];
//加载数据合理化:食物 ////加载数据合理化:食物
foreach (Food f in Foods) //foreach (Food f in Foods)
{ //{
if (f.IsOverLoad()) // if (f.IsOverLoad())
{ // {
f.Price = Math.Max((int)f.RealPrice, 1); // f.Price = Math.Max((int)f.RealPrice, 1);
f.isoverload = false; // f.isoverload = false;
} // }
} //}
await Dispatcher.InvokeAsync(new Action(() => await Dispatcher.InvokeAsync(new Action(() =>
{ {
LoadingText.Content = "尝试加载动画和生成缓存\n该步骤可能会耗时比较长\n请耐心等待".Translate(); LoadingText.Content = "尝试加载动画和生成缓存\n该步骤可能会耗时比较长\n请耐心等待".Translate();

View File

@ -11,6 +11,7 @@ using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection.Metadata;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -255,7 +256,12 @@ namespace VPet_Simulator.Windows
if (mw.IsSteamUser && cb_AgreeUpload.IsChecked == true) if (mw.IsSteamUser && cb_AgreeUpload.IsChecked == true)
SteamScreenshots.AddScreenshot(path, null, image.PixelWidth, image.PixelHeight); SteamScreenshots.AddScreenshot(path, null, image.PixelWidth, image.PixelHeight);
Process.Start(path); var psi = new ProcessStartInfo
{
FileName = path,
UseShellExecute = true
};
Process.Start(psi);
} }
} }

View File

@ -547,7 +547,12 @@ namespace VPet_Simulator.Windows
private void ButtonOpenModFolder_MouseDown(object sender, MouseButtonEventArgs e) private void ButtonOpenModFolder_MouseDown(object sender, MouseButtonEventArgs e)
{ {
Process.Start(mod.Path.FullName); var psi = new ProcessStartInfo
{
FileName = mod.Path.FullName,
UseShellExecute = true
};
Process.Start(psi);
} }
private void ButtonEnable_MouseDown(object sender, MouseButtonEventArgs e) private void ButtonEnable_MouseDown(object sender, MouseButtonEventArgs e)

View File

@ -31,7 +31,6 @@ public partial class winWorkMenu : Window
{ {
InitializeComponent(); InitializeComponent();
this.mw = mw; this.mw = mw;
mw.Main.WorkList(out ws, out ss, out ps); mw.Main.WorkList(out ws, out ss, out ps);
if (ws.Count == 0) if (ws.Count == 0)
tbc.Items.Remove(tiw); tbc.Items.Remove(tiw);