吃东西会吃腻

This commit is contained in:
ZouJin
2023-08-11 01:48:27 +10:00
parent b7034e7a1b
commit 2c7e01db2b
5 changed files with 77 additions and 11 deletions

View File

@ -127,6 +127,19 @@ namespace VPet_Simulator.Windows.Interface
sb.AppendLine().Append(Desc.Translate()); sb.AppendLine().Append(Desc.Translate());
desc = sb.ToString(); desc = sb.ToString();
} }
DateTime now = DateTime.Now;
DateTime eattime = imw.Set.PetData.GetDateTime("buytime_" + Name, now);
double eattimes = 0;
string descs;
if (eattime <= now)
{
if (Type == FoodType.Meal || Type == FoodType.Snack || Type == FoodType.Drink)
descs = "腻味程度".Translate();
}
else
{
eattimes = (eattime - now).TotalHours;
}
return desc; return desc;
} }
} }
@ -143,6 +156,9 @@ namespace VPet_Simulator.Windows.Interface
/// </summary> /// </summary>
[Line(ignoreCase: true)] [Line(ignoreCase: true)]
public string Image; public string Image;
private IMainWindow imw;
/// <summary> /// <summary>
/// 加载物品图片 /// 加载物品图片
/// </summary> /// </summary>
@ -150,6 +166,7 @@ namespace VPet_Simulator.Windows.Interface
{ {
ImageSource = imw.ImageSources.FindImage(Image ?? Name, "food"); ImageSource = imw.ImageSources.FindImage(Image ?? Name, "food");
Star = imw.Set["betterbuy"]["star"].GetInfos().Contains(Name); Star = imw.Set["betterbuy"]["star"].GetInfos().Contains(Name);
this.imw = imw;
} }
} }
} }

View File

@ -15,11 +15,12 @@ namespace VPet_Simulator.Windows
{ {
public class CoreMOD public class CoreMOD
{ {
public static List<string> LoadedDLL { get; } = new List<string>() public static HashSet<string> LoadedDLL { get; } = new HashSet<string>()
{ {
"ChatGPT.API.Framework.dll","Panuon.WPF.dll","steam_api.dll","Panuon.WPF.UI.dll","steam_api64.dll", "ChatGPT.API.Framework.dll","Panuon.WPF.dll","steam_api.dll","Panuon.WPF.UI.dll","steam_api64.dll",
"LinePutScript.dll","Newtonsoft.Json.dll","Facepunch.Steamworks.Win32.dll", "Facepunch.Steamworks.Win64.dll", "LinePutScript.dll","Newtonsoft.Json.dll","Facepunch.Steamworks.Win32.dll", "Facepunch.Steamworks.Win64.dll",
"VPet-Simulator.Core.dll","VPet-Simulator.Windows.Interface.dll","LinePutScript.Localization.WPF.dll" "VPet-Simulator.Core.dll","VPet-Simulator.Windows.Interface.dll","LinePutScript.Localization.WPF.dll",
"CSCore.dll"
}; };
public static string NowLoading = null; public static string NowLoading = null;
public string Name; public string Name;
@ -257,6 +258,30 @@ namespace VPet_Simulator.Windows
} }
public static class ExtensionSetting public static class ExtensionSetting
{ {
/// <summary>
/// 吃食物 附带倍率
/// </summary>
/// <param name="save">存档</param>
/// <param name="food">食物</param>
/// <param name="buff">默认1倍</param>
public static void EatFood(this GameSave save, IFood food, double buff)
{
save.Exp += food.Exp * buff;
var tmp = food.Strength / 2 * buff;
save.StrengthChange(tmp);
save.StoreStrength += tmp;
tmp = food.StrengthFood / 2 * buff;
save.StrengthChangeFood(tmp);
save.StoreStrengthFood += tmp;
tmp = food.StrengthDrink / 2 * buff;
save.StrengthChangeDrink(tmp);
save.StoreStrengthDrink += tmp;
tmp = food.Feeling / 2 * buff;
save.FeelingChange(tmp);
save.StoreFeeling += tmp * buff;
save.Health += food.Health * buff;
save.Likability += food.Likability * buff;
}
public static bool IsOnMod(this Setting t, string ModName) public static bool IsOnMod(this Setting t, string ModName)
{ {
if (ModName == "Core") if (ModName == "Core")

View File

@ -4,10 +4,8 @@ using LinePutScript;
using LinePutScript.Localization.WPF; using LinePutScript.Localization.WPF;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers; using System.Timers;
@ -346,7 +344,7 @@ namespace VPet_Simulator.Windows
switch (Main.State) switch (Main.State)
{ {
case Main.WorkingState.Work: case Main.WorkingState.Work:
if (Core.Graph.GraphConfig.Works[Main.StateID].Type == GraphHelper.Work.WorkType.Work) if (Main.nowWork.Type == GraphHelper.Work.WorkType.Work)
stat[(gi64)"stat_work_time"] += (int)Set.LogicInterval; stat[(gi64)"stat_work_time"] += (int)Set.LogicInterval;
else else
stat[(gi64)"stat_study_time"] += (int)Set.LogicInterval; stat[(gi64)"stat_study_time"] += (int)Set.LogicInterval;
@ -459,11 +457,13 @@ namespace VPet_Simulator.Windows
} }
private void MusicTimer_Elapsed(object sender, ElapsedEventArgs e) private void MusicTimer_Elapsed(object sender, ElapsedEventArgs e)
{ {
if (catch_MusicVolCount >= 10) catch_MusicVolSum += AudioPlayingVolume();
catch_MusicVolCount++;
if (catch_MusicVolCount >= 20)
{ {
double ans = catch_MusicVolSum / catch_MusicVolCount; double ans = catch_MusicVolSum / catch_MusicVolCount;
catch_MusicVolSum = 0; catch_MusicVolSum /= 4;
catch_MusicVolCount = 0; catch_MusicVolCount /= 4;
if (ans > Set.MusicCatch) if (ans > Set.MusicCatch)
{ {
var bef = CurrMusicType; var bef = CurrMusicType;

View File

@ -288,7 +288,7 @@ namespace VPet_Simulator.Windows
Set["CGPT"].Remove(cgpteb); Set["CGPT"].Remove(cgpteb);
} }
//音乐识别timer加载 //音乐识别timer加载
MusicTimer = new System.Timers.Timer(200) MusicTimer = new System.Timers.Timer(100)
{ {
AutoReset = false AutoReset = false
}; };

View File

@ -19,6 +19,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using VPet_Simulator.Core; using VPet_Simulator.Core;
using VPet_Simulator.Windows.Interface; using VPet_Simulator.Windows.Interface;
using static System.Windows.Forms.LinkLabel;
using static VPet_Simulator.Core.GraphCore; using static VPet_Simulator.Core.GraphCore;
using static VPet_Simulator.Core.GraphInfo; using static VPet_Simulator.Core.GraphInfo;
using static VPet_Simulator.Core.IGraph; using static VPet_Simulator.Core.IGraph;
@ -173,8 +174,26 @@ namespace VPet_Simulator.Windows
, "金钱不足".Translate()); , "金钱不足".Translate());
return; return;
} }
//获取吃腻时间
DateTime now = DateTime.Now;
DateTime eattime = mw.Set.PetData.GetDateTime("buytime_" + item.Name, now);
double eattimes = 0;
if (eattime <= now)
{
eattime = now;
}
else
{
eattimes = (eattime - now).TotalHours;
}
//开始加点 //开始加点
mw.Core.Save.EatFood(item); mw.Core.Save.EatFood(item, Math.Max(0.5, 1 - Math.Sqrt(eattimes) * 0.01));
//吃腻了
eattimes += 2;
mw.Set.PetData.SetDateTime("buytime_" + item.Name, now.AddHours(eattimes));
mw.Core.Save.Money -= item.Price; mw.Core.Save.Money -= item.Price;
//统计 //统计
mw.Set.Statistics[(gint)("buy_" + item.Name)]++; mw.Set.Statistics[(gint)("buy_" + item.Name)]++;
@ -203,13 +222,18 @@ namespace VPet_Simulator.Windows
mw.Set.Statistics[(gdbe)"stat_bb_gift"] += item.Price; mw.Set.Statistics[(gdbe)"stat_bb_gift"] += item.Price;
break; break;
} }
} }
if (!_puswitch.IsChecked.Value) if (!_puswitch.IsChecked.Value)
TryClose(); TryClose();
var name = mw.Core.Graph.FindName(item.Type == Food.FoodType.Drink ? GraphType.Drink : GraphType.Eat); var name = mw.Core.Graph.FindName(item.Type == Food.FoodType.Drink ? GraphType.Drink : GraphType.Eat);
var ig = mw.Core.Graph.FindGraph(name, AnimatType.Single, mw.Core.Save.Mode); var ig = mw.Core.Graph.FindGraph(name, AnimatType.Single, mw.Core.Save.Mode);
var b = mw.Main.FindDisplayBorder(ig); var b = mw.Main.FindDisplayBorder(ig);
ig.Run(b, item.ImageSource, mw.Main.DisplayToNomal); ig.Run(b, item.ImageSource, () =>
{
mw.Main.EventTimer_Elapsed();
mw.Main.DisplayToNomal();
});
} }
private void BtnSearch_Click(object sender, RoutedEventArgs e) private void BtnSearch_Click(object sender, RoutedEventArgs e)