diff --git a/VPet-Simulator.Core/Display/MainLogic.cs b/VPet-Simulator.Core/Display/MainLogic.cs index 8c8e454..12d40c5 100644 --- a/VPet-Simulator.Core/Display/MainLogic.cs +++ b/VPet-Simulator.Core/Display/MainLogic.cs @@ -63,26 +63,6 @@ namespace VPet_Simulator.Core { Display(GraphCore.Helper.Convert(type, GraphCore.Helper.AnimatType.B_Loop), () => Saying(type)); } - int lowstrengthAskCountFood = 1; - int lowstrengthAskCountDrink = 1; - private void lowStrengthFood()//未来的Display - { - if (Function.Rnd.Next(lowstrengthAskCountFood--) == 0) - { - Display(GraphCore.GraphType.Switch_Thirsty, () => Say("肚子饿了,想吃东西", GraphCore.Helper.SayType.Serious, true));//TODO:不同的饥饿说话方式 - lowstrengthAskCountFood = 20; - } - - } - private void lowStrengthDrink()//未来的Display - { - if (Function.Rnd.Next(lowstrengthAskCountDrink--) == 0) - { - Display(GraphCore.GraphType.Switch_Thirsty, () => Say("渴了,想喝东西", GraphCore.Helper.SayType.Serious, true));//TODO:不同的饥饿说话方式 - lowstrengthAskCountDrink = 20; - } - - } /// /// 根据消耗计算相关数据 /// @@ -122,7 +102,6 @@ namespace VPet_Simulator.Core { Core.Save.Health -= TimePass; } - lowStrengthFood(); var addmoney = TimePass * 5; Core.Save.Money += addmoney; WorkTimer.GetCount += addmoney; @@ -152,7 +131,6 @@ namespace VPet_Simulator.Core { Core.Save.Health -= TimePass; } - lowStrengthFood(); var addmoney = TimePass * 10; Core.Save.Money += addmoney; WorkTimer.GetCount += addmoney; @@ -181,7 +159,6 @@ namespace VPet_Simulator.Core { Core.Save.Health -= TimePass; } - lowStrengthFood(); var addmoney = TimePass * (10 + Core.Save.Level); Core.Save.Exp += addmoney; WorkTimer.GetCount += addmoney; @@ -241,10 +218,11 @@ namespace VPet_Simulator.Core { Core.Save.Health -= Function.Rnd.Next(0, 1) * TimePass; Core.Save.Exp -= TimePass; - lowStrengthDrink(); } else if (Core.Save.StrengthDrink >= 75) Core.Save.Health += Function.Rnd.Next(0, 1) * TimePass; + + FunctionSpendHandle?.Invoke(); var newmod = Core.Save.CalMode(); if (Core.Save.Mode != newmod) { @@ -257,7 +235,7 @@ namespace VPet_Simulator.Core } } } - + public event Action FunctionSpendHandle; private void EventTimer_Elapsed(object sender, ElapsedEventArgs e) { //所有Handle diff --git a/VPet-Simulator.Windows.Interface/IMainWindow.cs b/VPet-Simulator.Windows.Interface/IMainWindow.cs index 3e60d15..d3ec585 100644 --- a/VPet-Simulator.Windows.Interface/IMainWindow.cs +++ b/VPet-Simulator.Windows.Interface/IMainWindow.cs @@ -50,6 +50,14 @@ namespace VPet_Simulator.Windows.Interface /// List Foods { get; } /// + /// 需要食物时会说的话 + /// + List LowFoodText { get; } + /// + /// 需要饮料时会说的话 + /// + List LowDrinkText { get; } + /// /// 图片资源 /// ImageResources ImageSources { get; } diff --git a/VPet-Simulator.Windows.Interface/Food.cs b/VPet-Simulator.Windows.Interface/Mod/Food.cs similarity index 100% rename from VPet-Simulator.Windows.Interface/Food.cs rename to VPet-Simulator.Windows.Interface/Mod/Food.cs diff --git a/VPet-Simulator.Windows.Interface/Mod/LowText.cs b/VPet-Simulator.Windows.Interface/Mod/LowText.cs new file mode 100644 index 0000000..258eacb --- /dev/null +++ b/VPet-Simulator.Windows.Interface/Mod/LowText.cs @@ -0,0 +1,86 @@ +using LinePutScript.Converter; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VPet_Simulator.Windows.Interface +{ + /// + /// 低状态自动说的话 + /// + public class LowText + { + /// + /// 状态 + /// + public enum ModeType + { + /// + /// 高状态: 开心/普通 + /// + H, + /// + /// 低状态: 低状态/生病 + /// + L, + } + /// + /// 状态 + /// + [Line(IgnoreCase = true)] public ModeType Mode { get; set; } = ModeType.L; + /// + /// 体力 + /// + public enum StrengthType + { + /// + /// 一般口渴/饥饿 + /// + L, + /// + /// 有点口渴/饥饿 + /// + M, + /// + /// 非常口渴/饥饿 + /// + S, + } + /// + /// 体力 + /// + [Line(IgnoreCase = true)] public StrengthType Strength { get; set; } = StrengthType.S; + /// + /// 好感度要求 + /// + public enum LikeType + { + /// + /// 不需要好感度 + /// + N, + /// + /// 低好感度需求 + /// + S, + /// + /// 中好感度需求 + /// + M, + /// + /// 高好感度 + /// + L, + } + /// + /// 好感度要求 + /// + [Line(IgnoreCase = true)] public LikeType Like { get; set; } = LikeType.N; + /// + /// 说话的内容 + /// + [Line(IgnoreCase = true)] public string Text { get; set; } + } +} diff --git a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj index 69b35d7..e48163f 100644 --- a/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj +++ b/VPet-Simulator.Windows.Interface/VPet-Simulator.Windows.Interface.csproj @@ -112,7 +112,8 @@ - + + diff --git a/VPet-Simulator.Windows/Function/CoreMOD.cs b/VPet-Simulator.Windows/Function/CoreMOD.cs index 500007b..3ee9999 100644 --- a/VPet-Simulator.Windows/Function/CoreMOD.cs +++ b/VPet-Simulator.Windows/Function/CoreMOD.cs @@ -126,6 +126,25 @@ namespace VPet_Simulator.Windows Content += "图片包\n"; LoadImage(mw, di); break; + case "text": + Content += "文本集\n"; + foreach (FileInfo fi in di.EnumerateFiles("*.lps")) + { + var tmp = new LpsDocument(File.ReadAllText(fi.FullName)); + foreach (ILine li in tmp) + { + switch (li.Name.ToLower()) + { + case "lowfoodtext": + mw.LowFoodText.Add(LPSConvert.DeserializeObject(li)); + break; + case "lowdrinktext": + mw.LowDrinkText.Add(LPSConvert.DeserializeObject(li)); + break; + } + } + } + break; case "plugin": Content += "代码插件\n"; SuccessLoad = true; diff --git a/VPet-Simulator.Windows/MainWindow.cs b/VPet-Simulator.Windows/MainWindow.cs index 190ccdf..ab2b502 100644 --- a/VPet-Simulator.Windows/MainWindow.cs +++ b/VPet-Simulator.Windows/MainWindow.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Threading.Tasks; using System.Windows; using VPet_Simulator.Core; using VPet_Simulator.Windows.Interface; @@ -39,6 +40,10 @@ namespace VPet_Simulator.Windows /// public string Verison => $"{verison / 100}.{verison % 100}"; + public List LowFoodText { get; set; } = new List(); + + public List LowDrinkText { get; set; } = new List(); + public void SetZoomLevel(double zl) { Set.ZoomLevel = zl; @@ -63,7 +68,7 @@ namespace VPet_Simulator.Windows Foods.FindAll(x => x.Star).ForEach(x => list.Add(x.Name)); Set["betterbuy"]["star"].info = string.Join(",", list); } - + if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + @"\Save.lps")) { File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\Setting.lps", Set.ToString()); @@ -77,7 +82,7 @@ namespace VPet_Simulator.Windows if (CGPTClient != null) File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ChatGPTSetting.json", CGPTClient.Save()); } - } + } } /// /// 重载DIY按钮区域 @@ -207,5 +212,108 @@ namespace VPet_Simulator.Windows break; } } + int lowstrengthAskCountFood = 1; + int lowstrengthAskCountDrink = 1; + private void lowStrength() + { + if (Core.Save.Mode == GameSave.ModeType.Happy || Core.Save.Mode == GameSave.ModeType.Nomal) + { + if (Core.Save.StrengthFood < 75 && Function.Rnd.Next(lowstrengthAskCountFood--) == 0) + { + lowstrengthAskCountFood = 20; + var like = Core.Save.Likability < 40 ? 0 : (Core.Save.Likability < 70 ? 1 : (Core.Save.Likability < 100 ? 2 : 3)); + var txt = LowFoodText.FindAll(x => x.Mode == LowText.ModeType.H && (int)x.Like < like); + if (Core.Save.StrengthFood > 60) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else if (Core.Save.StrengthFood > 40) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + Task.Run(() => Main.Display(GraphCore.GraphType.Switch_Thirsty, Main.DisplayToNomal)); + return; + } + if (Core.Save.StrengthDrink < 75 && Function.Rnd.Next(lowstrengthAskCountDrink--) == 0) + { + lowstrengthAskCountDrink = 20; + var like = Core.Save.Likability < 40 ? 0 : (Core.Save.Likability < 70 ? 1 : (Core.Save.Likability < 100 ? 2 : 3)); + var txt = LowDrinkText.FindAll(x => x.Mode == LowText.ModeType.H && (int)x.Like < like); + if (Core.Save.StrengthDrink > 60) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else if (Core.Save.StrengthDrink > 40) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + Task.Run(() => Main.Display(GraphCore.GraphType.Switch_Thirsty, Main.DisplayToNomal)); + return; + } + } + else + { + if (Core.Save.StrengthFood < 60 && Function.Rnd.Next(lowstrengthAskCountFood--) == 0) + { + var like = Core.Save.Likability < 40 ? 0 : (Core.Save.Likability < 70 ? 1 : (Core.Save.Likability < 100 ? 2 : 3)); + var txt = LowFoodText.FindAll(x => x.Mode == LowText.ModeType.L && (int)x.Like < like); + if (Core.Save.StrengthFood > 40) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else if (Core.Save.StrengthFood > 20) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + Task.Run(() => Main.Display(GraphCore.GraphType.Switch_Thirsty, Main.DisplayToNomal)); + return; + } + if (Core.Save.StrengthDrink < 60 && Function.Rnd.Next(lowstrengthAskCountDrink--) == 0) + { + var like = Core.Save.Likability < 40 ? 0 : (Core.Save.Likability < 70 ? 1 : (Core.Save.Likability < 100 ? 2 : 3)); + var txt = LowDrinkText.FindAll(x => x.Mode == LowText.ModeType.L && (int)x.Like < like); + if (Core.Save.StrengthDrink > 40) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.L); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else if (Core.Save.StrengthDrink > 20) + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.M); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + else + { + txt = txt.FindAll(x => x.Strength == LowText.StrengthType.S); + Main.Say(txt[Function.Rnd.Next(txt.Count)].Text, GraphCore.Helper.SayType.None); + } + Task.Run(() => Main.Display(GraphCore.GraphType.Switch_Thirsty, Main.DisplayToNomal)); + return; + } + } + + + } } } diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index 2472991..a9217d6 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -255,6 +255,7 @@ namespace VPet_Simulator.Windows winSetting.MainTab.SelectedIndex = 5; winSetting.Show(); }; + Main.FunctionSpendHandle += lowStrength; Main.ToolBar.MenuMODConfig.Items.Add(m); try { diff --git a/VPet-Simulator.Windows/mod/0000_core/text/LowText.lps b/VPet-Simulator.Windows/mod/0000_core/text/LowText.lps new file mode 100644 index 0000000..34e1550 --- /dev/null +++ b/VPet-Simulator.Windows/mod/0000_core/text/LowText.lps @@ -0,0 +1,46 @@ +LowFoodText:|Mode#H:|Strength#L:|Like#N:|Text#零食这种东西,总是主人给的更好吃呢,我还要~:| +LowFoodText:|Mode#H:|Strength#M:|Like#N:|Text#礼物?是好吃的吗!:| +LowFoodText:|Mode#H:|Strength#S:|Like#N:|Text#主人,我的午饭呢:| +LowFoodText:|Mode#H:|Strength#L:|Like#S:|Text#我最喜欢吃的东西是XX和XXX,记住了吗?对,就是更好买正在卖的那个喵。:| +LowFoodText:|Mode#H:|Strength#M:|Like#M:|Text#唔,好香啊,你学习资料里藏了什么好吃的吗?让我掏一掏!......欸,主人你怎么脸红了喵?:| +LowFoodText:|Mode#H:|Strength#S:|Like#L:|Text#主人主人,为什么你有这么多好吃的?给我吃好不好?!不可以吃吗?…喵喵!果然可以吃对吧?!今天也最喜欢主人了喵!:| +LowFoodText:|Mode#H:|Strength#L:|Like#N:|Text#事已至此,先吃饭吧:| +LowFoodText:|Mode#H:|Strength#M:|Like#N:|Text#主人,饿饿,饭饭:| +LowFoodText:|Mode#H:|Strength#S:|Like#N:|Text#好饿好饿好饿,我真的好饿~:| +LowFoodText:|Mode#H:|Strength#L:|Like#S:|Text#不好了主人!那边的便利店薯片半价!:| +LowFoodText:|Mode#H:|Strength#M:|Like#M:|Text#主人,你这瓜多少钱一斤啊?:| +LowFoodText:|Mode#H:|Strength#S:|Like#L:|Text#主人,我想吃烤山药。谢谢主人,主人真好。:| +LowFoodText:|Mode#L:|Strength#L:|Like#N:|Text#M属性爆发!主人我要吃麦O劳!:| +LowFoodText:|Mode#L:|Strength#M:|Like#N:|Text#我要饿死了。主人也饿吗?我好想吃一碗泡面。:| +LowFoodText:|Mode#L:|Strength#S:|Like#N:|Text#主人不会介意我拿走你的午餐吧?我的意思是,主人看起来不需要它了。:| +LowFoodText:|Mode#L:|Strength#L:|Like#S:|Text#主人做厚蛋烧时候不放糖!?吃煎蛋不加调味剂吗!?:| +LowFoodText:|Mode#L:|Strength#M:|Like#M:|Text#来一份握寿司套餐,拜托多加芥末!:| +LowFoodText:|Mode#L:|Strength#S:|Like#L:|Text#………芭菲……好想吃……:| +LowFoodText:|Mode#L:|Strength#L:|Like#N:|Text#还记得那天很好吃的葱饼吗?主人回来的时候帮我买点吧:| +LowFoodText:|Mode#L:|Strength#M:|Like#N:|Text#我们—生存。我们—吃。我们—腐烂。成为—食物...:| +LowFoodText:|Mode#L:|Strength#S:|Like#N:|Text#我们—生存。我们—吃—吃—吃—吃...:| +LowFoodText:|Mode#L:|Strength#L:|Like#S:|Text#晚上去吃烤肉吧:| +LowFoodText:|Mode#L:|Strength#M:|Like#M:|Text#我就是饿死,死外边,从这里跳下去,不会吃主人一点东西!:| +LowFoodText:|Mode#L:|Strength#S:|Like#L:|Text#好想再吃一次主人做的料理啊:| +LowDrinkText:|Mode#H:|Strength#L:|Like#N:|Text#喝!继续喝!还没尽兴呢!:| +LowDrinkText:|Mode#H:|Strength#M:|Like#N:|Text#大家好,我是本群的“提醒喝水小助手”希望此刻看到消息的人可以和我一起来喝一杯水。和我一起成为一天八杯水的人吧!:| +LowDrinkText:|Mode#H:|Strength#S:|Like#N:|Text#主人我的宠物快乐水呢!:| +LowDrinkText:|Mode#H:|Strength#L:|Like#S:|Text#渴了就喝水,别老扒拉我腿行不行呀:| +LowDrinkText:|Mode#H:|Strength#M:|Like#M:|Text#本人自愿放下水杯停止喝水, 没有受到客观阻碍,不能算喝水未遂,只能算喝水中止:| +LowDrinkText:|Mode#H:|Strength#S:|Like#M:|Text#我夸父只喝一口:| +LowDrinkText:|Mode#H:|Strength#L:|Like#N:|Text#主人该喝水了:| +LowDrinkText:|Mode#H:|Strength#M:|Like#N:|Text#你喝水了没有:| +LowDrinkText:|Mode#H:|Strength#S:|Like#N:|Text#太郎~呸主人~喝药~呸喝水啦~:| +LowDrinkText:|Mode#H:|Strength#L:|Like#S:|Text#这喝水,多是一件美事啊:| +LowDrinkText:|Mode#H:|Strength#M:|Like#M:|Text#才喝几罐就醉了,这个彬彬就是逊啦:| +LowDrinkText:|Mode#H:|Strength#S:|Like#M:|Text#电脑里有一款心胸狭隘不给宠物喝水的游戏:| +LowDrinkText:|Mode#L:|Strength#L:|Like#N:|Text#脸这么方怎么喝水啊:| +LowDrinkText:|Mode#L:|Strength#M:|Like#N:|Text#好渴哦:| +LowDrinkText:|Mode#L:|Strength#S:|Like#N:|Text#吨吨吨吨吨吨吨吨吨:| +LowDrinkText:|Mode#L:|Strength#S:|Like#M:|Text#他奶奶滴,为什么不喝!:| +LowDrinkText:|Mode#L:|Strength#L:|Like#N:|Text#多喝水:| +LowDrinkText:|Mode#L:|Strength#M:|Like#N:|Text#多喝热水:| +LowDrinkText:|Mode#L:|Strength#S:|Like#N:|Text#只有红茶可以吗:| +LowDrinkText:|Mode#L:|Strength#L:|Like#N:|Text#主人我渴了:| +LowDrinkText:|Mode#L:|Strength#M:|Like#N:|Text#主人我好难受,我想点喝水:| +LowDrinkText:|Mode#L:|Strength#S:|Like#N:|Text#主人,水。。。:|