From 2a4d2d70276ae19c5070628fb4e783923cb87736 Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 14 Nov 2024 22:50:33 +0800 Subject: [PATCH] .NET 9 --- Desktop/FunGame.Testing.Desktop.csproj | 4 +- .../Solutions/EntityCreator/SetConfigName.cs | 3 + Desktop/Solutions/EntityCreator/ShowList.cs | 5 +- Library/FunGame.Testing.csproj | 16 +-- Library/Main.cs | 100 +++++++++++++++--- 5 files changed, 102 insertions(+), 26 deletions(-) diff --git a/Desktop/FunGame.Testing.Desktop.csproj b/Desktop/FunGame.Testing.Desktop.csproj index e946b6e..a32b85c 100644 --- a/Desktop/FunGame.Testing.Desktop.csproj +++ b/Desktop/FunGame.Testing.Desktop.csproj @@ -2,7 +2,7 @@ WinExe - net8.0-windows + net9.0-windows7.0 enable true enable @@ -20,7 +20,7 @@ - ..\..\FunGame.Core\bin\Debug\net8.0\FunGame.Core.dll + ..\..\FunGame.Core\bin\Release\net9.0\FunGame.Core.dll diff --git a/Desktop/Solutions/EntityCreator/SetConfigName.cs b/Desktop/Solutions/EntityCreator/SetConfigName.cs index 5424094..2360f77 100644 --- a/Desktop/Solutions/EntityCreator/SetConfigName.cs +++ b/Desktop/Solutions/EntityCreator/SetConfigName.cs @@ -1,10 +1,13 @@ using Milimoe.FunGame.Core.Api.Utility; +using System.ComponentModel; namespace Milimoe.FunGame.Testing.Desktop.Solutions { public partial class SetConfigName : Form { + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string FileName { get; set; } = ""; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string ModuleName { get; set; } = ""; public CharacterManager CharacterManager { get; } public SkillManager SkillManager { get; } diff --git a/Desktop/Solutions/EntityCreator/ShowList.cs b/Desktop/Solutions/EntityCreator/ShowList.cs index 2f753bd..b4523f1 100644 --- a/Desktop/Solutions/EntityCreator/ShowList.cs +++ b/Desktop/Solutions/EntityCreator/ShowList.cs @@ -1,7 +1,10 @@ -namespace Milimoe.FunGame.Testing.Desktop.Solutions +using System.ComponentModel; + +namespace Milimoe.FunGame.Testing.Desktop.Solutions { public partial class ShowList : Form { + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SelectItem { get; set; } = ""; public ShowList() diff --git a/Library/FunGame.Testing.csproj b/Library/FunGame.Testing.csproj index ae4b497..cba56d9 100644 --- a/Library/FunGame.Testing.csproj +++ b/Library/FunGame.Testing.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 enable enable ..\bin\ @@ -18,19 +18,13 @@ - - ..\..\FunGame.Core\bin\Debug\net8.0\FunGame.Core.dll - - - - - - - - + + + + diff --git a/Library/Main.cs b/Library/Main.cs index fb4ad66..be74f91 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; using Oshima.Core.Utils; using Oshima.FunGame.OshimaModules; using Oshima.FunGame.OshimaModules.Skills; @@ -18,14 +19,15 @@ FunGameSimulation.InitFunGame(); //strings.ForEach(Console.WriteLine); User user = Factory.GetUser(1, "Mili"); +user.Inventory.Credits = 204824.59; +user.Inventory.Materials = 132415.2; PluginConfig pc = new("saved", user.Id.ToString()); // ¶ÁÈ¡´æµµ pc.LoadConfig(); if (pc.Count == 0) { - Character originalCharacter = FunGameSimulation.Characters[1].Copy(); - Character exampleCharacter = originalCharacter.Copy(); + Character exampleCharacter = FunGameSimulation.Characters[1].Copy(); exampleCharacter.Level = 30; Skill xlzh = new ÐÄÁéÖ®»ð { @@ -40,38 +42,112 @@ if (pc.Count == 0) }; exampleCharacter.Skills.Add(tczl); - List ħ·¨¿¨ = FunGameSimulation.GenerateMagicCards(3, Milimoe.FunGame.Core.Library.Constant.QualityType.Orange); + List ħ·¨¿¨ = FunGameSimulation.GenerateMagicCards(3, QualityType.Orange); Item? ħ·¨¿¨°ü = FunGameSimulation.ConflateMagicCardPack(ħ·¨¿¨); if (ħ·¨¿¨°ü != null) { + user.Inventory.Items.Add(ħ·¨¿¨°ü); 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(); + sp.IsSellable = false; + user.Inventory.Items.Add(sp); exampleCharacter.Equip(sp); + sp = ÊÎÆ·[Random.Shared.Next(ÊÎÆ·.Length)].Copy(); + sp.IsTradable = false; + user.Inventory.Items.Add(sp); + exampleCharacter.Equip(sp); + sp = ÊÎÆ·[Random.Shared.Next(ÊÎÆ·.Length)].Copy(); + sp.IsSellable = false; + sp.IsTradable = false; + user.Inventory.Items.Add(sp); + exampleCharacter.Equip(sp); + sp = ÊÎÆ·[Random.Shared.Next(ÊÎÆ·.Length)].Copy(); + sp.IsTradable = false; + sp.NextTradableTime = DateTimeUtility.GetTradableTime(); + user.Inventory.Items.Add(sp); + exampleCharacter.Equip(sp); + sp = ÊÎÆ·[Random.Shared.Next(ÊÎÆ·.Length)].Copy(); + user.Inventory.Items.Add(sp); + sp = ÊÎÆ·[Random.Shared.Next(ÊÎÆ·.Length)].Copy(); + user.Inventory.Items.Add(sp); Console.WriteLine(exampleCharacter.GetInfo()); - pc.Add("original", originalCharacter); - user.Inventory.Characters.Add(exampleCharacter.GetName(), exampleCharacter); + user.Inventory.Characters.Add(exampleCharacter); Item mfk = FunGameSimulation.GenerateMagicCard(); - user.Inventory.Items[mfk.Guid.ToString()] = mfk; + user.Inventory.Items.Add(mfk); mfk = FunGameSimulation.GenerateMagicCard(); - user.Inventory.Items[mfk.Guid.ToString()] = mfk; + user.Inventory.Items.Add(mfk); mfk = FunGameSimulation.GenerateMagicCard(); - user.Inventory.Items[mfk.Guid.ToString()] = mfk; + user.Inventory.Items.Add(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()); + List characters = new(user.Inventory.Characters); + List items = new(user.Inventory.Items); + user.Inventory.Characters.Clear(); + user.Inventory.Items.Clear(); + + foreach (Character inventoryCharacter in characters) + { + Character realCharacter = CharacterBuilder.Build(inventoryCharacter, false); + realCharacter.User = user; + user.Inventory.Characters.Add(realCharacter); + } + + foreach (Item inventoryItem in items) + { + Item realItem = inventoryItem.Copy(true, true); + if (realItem.IsEquipment) + { + IEnumerable has = user.Inventory.Characters.Where(character => + { + if (realItem.ItemType == ItemType.MagicCardPack && character.EquipSlot.MagicCardPack != null && realItem.Guid == character.EquipSlot.MagicCardPack.Guid) + { + return true; + } + if (realItem.ItemType == ItemType.Weapon && character.EquipSlot.Weapon != null && realItem.Guid == character.EquipSlot.Weapon.Guid) + { + return true; + } + if (realItem.ItemType == ItemType.Armor && character.EquipSlot.Armor != null && realItem.Guid == character.EquipSlot.Armor.Guid) + { + return true; + } + if (realItem.ItemType == ItemType.Shoes && character.EquipSlot.Shoes != null && realItem.Guid == character.EquipSlot.Shoes.Guid) + { + return true; + } + if (realItem.ItemType == ItemType.Accessory) + { + if (character.EquipSlot.Accessory1 != null && realItem.Guid == character.EquipSlot.Accessory1.Guid) + { + return true; + } + else if (character.EquipSlot.Accessory2 != null && realItem.Guid == character.EquipSlot.Accessory2.Guid) + { + return true; + } + } + return false; + }); + if (has.Any() && has.First() is Character character) + { + realItem.Character = character; + } + } + user.Inventory.Items.Add(realItem); + } + + Console.WriteLine(user.Inventory.ToString(false)); + Console.WriteLine(user.Inventory.ToString(true)); } // ±£´æ´æµµ