小标恢复和数据修复

This commit is contained in:
ZouJin 2024-06-23 16:21:27 +08:00
parent 2e8e4e6421
commit 7a0d7db836
3 changed files with 87 additions and 9 deletions

View File

@ -233,7 +233,7 @@ namespace VPet_Simulator.Core
{
windowMediaPlayerAvailable = false;
PlayingVoice = false;
MessageBoxX.Show("音频播放失败,已尝试自动切换到备用播放器. 如果问题持续,请检查是否已安装WindowsMediaPlayer".Translate(), "音频错误".Translate(), Panuon.WPF.UI.MessageBoxIcon.Warning);
MessageBoxX.Show("音频播放失败,已尝试自动切换到备用播放器. 如果问题持续,请检查是否已安装WindowsMediaPlayer".Translate(), "音频错误".Translate(), MessageBoxIcon.Warning);
}
private void Clock_Completed(object sender, EventArgs e)
{

View File

@ -7,9 +7,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI" d:DesignHeight="1000"
xmlns:system="clr-namespace:System;assembly=mscorlib" Width="{ll:Dbe SettingWidth_650, DefValue=650}"
Height="{ll:Dbe SettingHeight_550, DefValue=550}"
Closing="WindowX_Closing" FontSize="16" Style="{DynamicResource BaseWindowXStyle}" Topmost="True"
WindowStartupLocation="CenterScreen" mc:Ignorable="d">
Height="{ll:Dbe SettingHeight_550, DefValue=550}" Closing="WindowX_Closing" FontSize="16"
Style="{DynamicResource BaseWindowXStyle}" Topmost="True" WindowStartupLocation="CenterScreen" mc:Ignorable="d">
<!--<pu:WindowX.Resources>
<DataTemplate x:Key="DIYDataTemplate">
@ -20,12 +19,14 @@
<ColumnDefinition x:Name="SettingMenuWidth" Width="180" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBox x:Name="tb_seach_menu" FontSize="16" pu:TextBoxHelper.Watermark="{ll:Str 搜索设置}" BorderThickness="0,0,0,1" pu:TextBoxHelper.CornerRadius="0" BorderBrush="LightGray"
<TextBox x:Name="tb_seach_menu" FontSize="16" pu:TextBoxHelper.Watermark="{ll:Str 搜索设置}"
BorderThickness="0,0,0,1" pu:TextBoxHelper.CornerRadius="0" BorderBrush="LightGray"
Style="{DynamicResource StandardTextBoxStyle}" VerticalAlignment="Top" Margin="3,6,7,0"
TextChanged="tb_seach_menu_textchange" />
<ListBox x:Name="ListMenu" ScrollViewer.HorizontalScrollBarVisibility="Auto" BorderThickness="0"
ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="0,40,5,3"
pu:ListBoxHelper.ItemsPadding="15,8" pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}" pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}" />
ScrollViewer.VerticalScrollBarVisibility="Auto" Margin="0,40,5,3" pu:ListBoxHelper.ItemsPadding="15,8"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource DARKPrimary}"
pu:ListBoxHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}" />
<GridSplitter Margin="0,15" Background="LightGray">
<GridSplitter.Template>
<ControlTemplate TargetType="GridSplitter">
@ -402,7 +403,11 @@
ToolTip="{ll:Str '重新开始新游戏,重置统计等信息\&#13;对于想要获得脱离超模从而获得成就非常有帮助'}" Click="restart_click" />
<Button x:Name="btn_cleancache" Grid.Row="1" Grid.Column="2" Margin="4" Padding="1"
pu:ButtonHelper.CornerRadius="4" Background="{DynamicResource SecondaryLight}"
Click="cleancache_click" Content="{ll:Str 清理缓存}" ToolTip="{ll:Str '清理缓存的动画,声音文件'}" />
Click="cleancache_click" Content="{ll:Str 清理缓存}" ToolTip="{ll:Str '清理缓存的动画,声音文件'}" />
<Button x:Name="btn_fixdata" Grid.Row="1" Grid.Column="2" Margin="4" Padding="1"
pu:ButtonHelper.CornerRadius="4" Background="{DynamicResource SecondaryLight}"
Content="{ll:Str 数据修复}" ToolTip="{ll:Str '校准玩家游玩时间数据\&#13;为失去超模计算(Hash检查)小标玩家重新获得小标'}"
Click="btn_fixdata_Click" />
<TextBlock Margin="0,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"
Background="{x:Null}" TextWrapping="Wrap">
<Run FontSize="18" FontWeight="Bold" Text="{ll:Str 桌宠多开}" /> <LineBreak />

View File

@ -1,5 +1,6 @@
using LinePutScript;
using LinePutScript.Localization.WPF;
using NAudio.SoundFont;
using Panuon.WPF.UI;
using Steamworks;
using Steamworks.Ugc;
@ -8,8 +9,11 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -182,6 +186,7 @@ namespace VPet_Simulator.Windows
{
runUserName.Text = Environment.UserName;
runActivate.Text = "尚未激活 您可能需要启动Steam或去Steam上免费领个".Translate();
btn_fixdata.Visibility = Visibility.Collapsed;
}
//CGPT
if (mw.TalkAPI.Count > 0)
@ -1027,7 +1032,7 @@ namespace VPet_Simulator.Windows
{
if (!AllowChange)
return;
var petloader = mw.Pets.Find(x => x.Name == mw.Set.PetGraph);
petloader ??= mw.Pets[0];
@ -1580,6 +1585,74 @@ namespace VPet_Simulator.Windows
MessageBoxX.Show("已将当前选择 {0} 设为默认启动存档".Translate(str.Translate()));
}
private void btn_fixdata_Click(object sender, RoutedEventArgs e)
{
//先拿玩家游戏时间
int playtime;
try
{
string _url = "https://aiopen.exlb.net:5810/VPet/GetPlayTime?steamid=" + SteamClient.SteamId.Value;
#pragma warning disable SYSLIB0014 // 类型或成员已过时
var request = (HttpWebRequest)WebRequest.Create(_url);
#pragma warning restore SYSLIB0014 // 类型或成员已过时
request.Method = "GET";
string responseString;
using (var response = (HttpWebResponse)request.GetResponse())
{
responseString = new StreamReader(response.GetResponseStream(), Encoding.UTF8).ReadToEnd();
response.Dispose();
}
playtime = int.Parse(responseString);
}
catch
{
MessageBoxX.Show("获取玩家游戏时间失败,请检查网络连接或稍后再试".Translate());
return;
}
if (playtime == 0) return;
if (mw.GameSavesData.HashCheck)
{//对于
int hours = mw.GameSavesData.Statistics[(gint)"stat_total_time"] / 60;
if (hours < playtime)
{
mw.GameSavesData.Statistics[(gint)"stat_total_time"] = playtime * 60;
MessageBoxX.Show("陪伴时长已更新".Translate() + $"\n{hours}Min->{playtime}Min", "修复成功".Translate());
}
else
MessageBoxX.Show("当前游戏时间已经大于Steam服务器记录时间,无需修复".Translate());
}
else
{
GameSave_v2 ogs = mw.GameSavesData;
mw.GameSavesData = new GameSave_v2(ogs.GameSave.Name);
mw.GameSavesData.Statistics[(gint)"stat_total_time"] = playtime * 60;
//同步等级
//按2小时=1级进行计算
int newlevel = playtime / 120;
int newmaxlevel = 0;
if (newlevel > 0)
{
while (newlevel > (newmaxlevel * 100 + 1000))
{
newlevel -= (newmaxlevel * 100 + 1000);
newmaxlevel++;
}
mw.GameSavesData.GameSave.LevelMax = Math.Min(newmaxlevel, ogs.GameSave.LevelMax);
mw.GameSavesData.GameSave.Level = Math.Min(newlevel, ogs.GameSave.Level);
}
//同步金钱
//根据当前等级计算金钱
int newmoney = (200 * mw.GameSavesData.GameSave.Level - 100) * mw.GameSavesData.GameSave.LevelMax;
mw.GameSavesData.GameSave.Money = Math.Min(newmoney, ogs.GameSave.Money);
//同步好感度
mw.GameSavesData.GameSave.Likability = ogs.GameSave.Likability;
MessageBoxX.Show("数据修复成功".Translate());
}
}
private void SwitchHideFromTaskControl_OnChecked(object sender, RoutedEventArgs e)
{
if (!AllowChange)