From 4658b3612103235c8d332a931dfe37d6dcdd4764 Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 14 Nov 2024 00:26:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20CharacterBuilder=EF=BC=9B?= =?UTF-8?q?=E4=B8=BA=20Item=20=E6=B7=BB=E5=8A=A0=E4=BA=86=20Guid=EF=BC=9B?= =?UTF-8?q?=E5=BC=80=E5=B7=A5=E5=BA=93=E5=AD=98=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Main.cs | 100 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 94 insertions(+), 6 deletions(-) diff --git a/Library/Main.cs b/Library/Main.cs index 27787d9..fb4ad66 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -1,8 +1,10 @@ using System.Diagnostics; using System.Text; +using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Oshima.Core.Utils; using Oshima.FunGame.OshimaModules; +using Oshima.FunGame.OshimaModules.Skills; CharacterModule cm = new(); cm.Load(); @@ -11,11 +13,97 @@ sm.Load(); ItemModule im = new(); im.Load(); -FunGameSimulation.InitCharacter(); -List strings = FunGameSimulation.StartGame(false, false, true); -strings.ForEach(Console.WriteLine); +FunGameSimulation.InitFunGame(); +//List strings = FunGameSimulation.StartGame(false, false, true); +//strings.ForEach(Console.WriteLine); + +User user = Factory.GetUser(1, "Mili"); +PluginConfig pc = new("saved", user.Id.ToString()); +// 读取存档 +pc.LoadConfig(); + +if (pc.Count == 0) +{ + Character originalCharacter = FunGameSimulation.Characters[1].Copy(); + Character exampleCharacter = originalCharacter.Copy(); + exampleCharacter.Level = 30; + Skill xlzh = new 心灵之火 + { + Character = exampleCharacter, + Level = 1 + }; + exampleCharacter.Skills.Add(xlzh); + Skill tczl = new 天赐之力 + { + Character = exampleCharacter, + Level = 3 + }; + exampleCharacter.Skills.Add(tczl); + + List 魔法卡 = FunGameSimulation.GenerateMagicCards(3, Milimoe.FunGame.Core.Library.Constant.QualityType.Orange); + Item? 魔法卡包 = FunGameSimulation.ConflateMagicCardPack(魔法卡); + if (魔法卡包 != null) + { + exampleCharacter.Equip(魔法卡包); + Console.WriteLine(魔法卡包.ToString(false, true)); + } + + Item[] 饰品 = FunGameSimulation.Equipment.Where(i => i.Id.ToString().StartsWith("14")).ToArray(); + Item sp = 饰品[Random.Shared.Next(饰品.Length)].Copy(); + exampleCharacter.Equip(sp); + + Console.WriteLine(exampleCharacter.GetInfo()); + + pc.Add("original", originalCharacter); + user.Inventory.Characters.Add(exampleCharacter.GetName(), exampleCharacter); + Item mfk = FunGameSimulation.GenerateMagicCard(); + user.Inventory.Items[mfk.Guid.ToString()] = mfk; + mfk = FunGameSimulation.GenerateMagicCard(); + user.Inventory.Items[mfk.Guid.ToString()] = mfk; + mfk = FunGameSimulation.GenerateMagicCard(); + user.Inventory.Items[mfk.Guid.ToString()] = mfk; + pc.Add("user", user); +} +else +{ + user = pc.Get("user") ?? Factory.GetUser(); + Character originalCharacter = pc.Get("original") ?? Factory.GetCharacter(); + Character exampleCharacter = user.Inventory.Characters.Values.First(); + exampleCharacter.Respawn(originalCharacter); + + Console.WriteLine(exampleCharacter.GetInfo()); +} + +// 保存存档 +pc.SaveConfig(); +//Item[] 武器 = FunGameSimulation.Equipment.Where(i => i.Id.ToString().StartsWith("11")).ToArray(); +//Item[] 防具 = FunGameSimulation.Equipment.Where(i => i.Id.ToString().StartsWith("12")).ToArray(); +//Item[] 鞋子 = FunGameSimulation.Equipment.Where(i => i.Id.ToString().StartsWith("13")).ToArray(); +//Item[] 饰品 = FunGameSimulation.Equipment.Where(i => i.Id.ToString().StartsWith("14")).ToArray(); +//Item? a = null, b = null, c = null, d = null; +//if (武器.Length > 0) +//{ +// a = 武器[Random.Shared.Next(武器.Length)]; +// exampleCharacter.Equip(a.Copy()); +//} +//if (防具.Length > 0) +//{ +// b = 防具[Random.Shared.Next(防具.Length)]; +// exampleCharacter.Equip(b.Copy()); +//} +//if (鞋子.Length > 0) +//{ +// c = 鞋子[Random.Shared.Next(鞋子.Length)]; +// exampleCharacter.Equip(c.Copy()); +//} +//if (饰品.Length > 0) +//{ +// d = 饰品[Random.Shared.Next(饰品.Length)]; +// exampleCharacter.Equip(d.Copy()); +// d = 饰品[Random.Shared.Next(饰品.Length)]; +// exampleCharacter.Equip(d.Copy()); +//} -//Character c = FunGameSimulation.Characters[1].Copy(); //foreach (Skill s in FunGameSimulation.Magics) //{ // Skill s2 = s.Copy(); @@ -111,7 +199,7 @@ while (true) builder.AppendLine($"总计冠军数:{stats.Wins}"); builder.AppendLine($"总计前三数:{stats.Top3s}"); builder.AppendLine($"总计败场数:{stats.Loses}"); - + List names = [.. FunGameSimulation.TeamCharacterStatistics.OrderByDescending(kv => kv.Value.Winrates).Select(kv => kv.Key.GetName())]; builder.AppendLine($"胜率:{stats.Winrates * 100:0.##}%(#{names.IndexOf(character.GetName()) + 1})"); @@ -158,7 +246,7 @@ while (true) builder.AppendLine($"总计冠军数:{stats.Wins}"); builder.AppendLine($"总计前三数:{stats.Top3s}"); builder.AppendLine($"总计败场数:{stats.Loses}"); - + List names = [.. FunGameSimulation.CharacterStatistics.OrderByDescending(kv => kv.Value.Winrates).Select(kv => kv.Key.GetName())]; builder.AppendLine($"胜率:{stats.Winrates * 100:0.##}%(#{names.IndexOf(character.GetName()) + 1})"); builder.AppendLine($"前三率:{stats.Top3rates * 100:0.##}%");