From 76f8eb5918b469b74f39bd6f0e93656182529ce7 Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 26 Dec 2024 01:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=99=AE=E6=94=BB=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaCore/Controllers/FunGameController.cs | 180 +++++++++++++++++- OshimaCore/OshimaWebAPI.cs | 1 - OshimaCore/Utils/FunGameService.cs | 78 ++++++-- OshimaModules/Items/ItemID.cs | 1 + OshimaModules/Items/SpecialItem/混沌之核.cs | 13 ++ OshimaModules/Modules/ItemModule.cs | 1 + .../oshima-studios/oshima.fungame.items.json | 25 +++ 7 files changed, 280 insertions(+), 19 deletions(-) create mode 100644 OshimaModules/Items/SpecialItem/混沌之核.cs diff --git a/OshimaCore/Controllers/FunGameController.cs b/OshimaCore/Controllers/FunGameController.cs index c3bd6d3..0f9ab26 100644 --- a/OshimaCore/Controllers/FunGameController.cs +++ b/OshimaCore/Controllers/FunGameController.cs @@ -266,7 +266,7 @@ namespace Oshima.Core.Controllers [HttpGet("iteminfo")] public string GetItemInfo([FromQuery] long? id = null) { - IEnumerable items = FunGameService.Equipment; + IEnumerable items = FunGameService.AllItems; if (id != null) { List msg = []; @@ -2470,7 +2470,7 @@ namespace Oshima.Core.Controllers return NetworkUtility.JsonSerialize($"˼ܡ{skill.Name}Ѿ"); } - return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ġ{skill.Name}ܵȼ{skill.Level}/{General.GameplayEquilibriumConstant.MaxSkillLevel}" + + return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ġ{skill.Name}ܵȼ{skill.Level} / {General.GameplayEquilibriumConstant.MaxSkillLevel}" + $"\r\nһϣ\r\n" + FunGameService.GetSkillLevelUpNeedy(skill.Level + 1)); } return NetworkUtility.JsonSerialize($"˼޷"); @@ -2485,7 +2485,7 @@ namespace Oshima.Core.Controllers return NetworkUtility.JsonSerialize(noSaved); } } - + [HttpPost("skilllevelup")] public string SkillLevelUp([FromQuery] long? qq = null, [FromQuery] int? c = null, [FromQuery] string? s = null) { @@ -2535,6 +2535,13 @@ namespace Oshima.Core.Controllers return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ȼ {needCount} ޷{isStudy}˼ܣ"); } } + else if (key == "ɫͻƽ") + { + if (character.LevelBreak < needCount) + { + return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ȼͻƽȲ {needCount} Ƚף޷{isStudy}˼ܣ"); + } + } else if (key == General.GameplayEquilibriumConstant.InGameCurrency) { if (user.Inventory.Credits >= needCount) @@ -2583,6 +2590,8 @@ namespace Oshima.Core.Controllers user.LastTime = DateTime.Now; pc.Add("user", user); pc.SaveConfig(); + needy.Remove("ɫȼ"); + needy.Remove("ɫͻƽ"); string msg = $"{isStudy}ܳɹģ{string.Join("", needy.Select(kv => kv.Key + " * " + kv.Value))}ɹ{skill.Name} {skill.Level} "; if (skill.Level == General.GameplayEquilibriumConstant.MaxSkillLevel) @@ -2618,6 +2627,171 @@ namespace Oshima.Core.Controllers } } + [HttpPost("getnormalattacklevelupneedy")] + public string GetNormalAttackLevelUpNeedy([FromQuery] long? qq = null, [FromQuery] int? c = null) + { + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + int characterIndex = c ?? 0; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + Character? character; + if (characterIndex > 0 && characterIndex <= user.Inventory.Characters.Count) + { + character = user.Inventory.Characters.ToList()[characterIndex - 1]; + } + else + { + return NetworkUtility.JsonSerialize($"ûҵӦĽɫ"); + } + + NormalAttack na = character.NormalAttack; + + if (na.Level + 1 == General.GameplayEquilibriumConstant.MaxNormalAttackLevel) + { + return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ġ{na.Name}Ѿ"); + } + return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ġ{na.Name}ȼ{na.Level} / {General.GameplayEquilibriumConstant.MaxNormalAttackLevel}" + + $"\r\nһϣ\r\n" + FunGameService.GetNormalAttackLevelUpNeedy(na.Level + 1)); + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + + [HttpPost("normalattacklevelup")] + public string NormalAttackLevelUp([FromQuery] long? qq = null, [FromQuery] int? c = null) + { + try + { + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + int characterIndex = c ?? 0; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + Character? character = null; + if (characterIndex > 0 && characterIndex <= user.Inventory.Characters.Count) + { + character = user.Inventory.Characters.ToList()[characterIndex - 1]; + } + else + { + return NetworkUtility.JsonSerialize($"ûҵӦĽɫ"); + } + + NormalAttack na = character.NormalAttack; + if (na.Level == General.GameplayEquilibriumConstant.MaxNormalAttackLevel) + { + return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ġ{na.Name}Ѿ"); + } + + if (FunGameService.NormalAttackLevelUpList.TryGetValue(na.Level + 1, out Dictionary? needy) && needy != null && needy.Count > 0) + { + foreach (string key in needy.Keys) + { + int needCount = needy[key]; + if (key == "ɫȼ") + { + if (character.Level < needCount) + { + return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ȼ {needCount} ޷˼ܣ"); + } + } + else if (key == "ɫͻƽ") + { + if (character.LevelBreak < needCount) + { + return NetworkUtility.JsonSerialize($"ɫ [ {character} ] ȼͻƽȲ {needCount} Ƚף޷˼ܣ"); + } + } + else if (key == General.GameplayEquilibriumConstant.InGameCurrency) + { + if (user.Inventory.Credits >= needCount) + { + user.Inventory.Credits -= needCount; + } + else + { + return NetworkUtility.JsonSerialize($"{General.GameplayEquilibriumConstant.InGameCurrency} {needCount} أ"); + } + } + else if (key == General.GameplayEquilibriumConstant.InGameMaterial) + { + if (user.Inventory.Materials >= needCount) + { + user.Inventory.Materials -= needCount; + } + else + { + return NetworkUtility.JsonSerialize($"{General.GameplayEquilibriumConstant.InGameMaterial} {needCount} أ"); + } + } + else + { + if (needCount > 0) + { + IEnumerable items = user.Inventory.Items.Where(i => i.Name == key); + if (items.Count() >= needCount) + { + items = items.TakeLast(needCount); + foreach (Item item in items) + { + user.Inventory.Items.Remove(item); + } + } + else + { + return NetworkUtility.JsonSerialize($"Ʒ{key} {needCount} أ"); + } + } + } + } + + na.Level += 1; + + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + needy.Remove("ɫȼ"); + needy.Remove("ɫͻƽ"); + string msg = $"ɫ [ {character} ] {na.Name}ɹģ{string.Join("", needy.Select(kv => kv.Key + " * " + kv.Value))}ɹ{na.Name} {na.Level} "; + + if (na.Level == General.GameplayEquilibriumConstant.MaxNormalAttackLevel) + { + msg += $"\r\n{na.Name}Ѿϲ"; + } + else + { + msg += $"\r\nһϣ\r\n" + FunGameService.GetNormalAttackLevelUpNeedy(na.Level + 1); + } + + return NetworkUtility.JsonSerialize(msg); + } + + return NetworkUtility.JsonSerialize($"{na.Name}ʧܣɫ [ {character} ] ġ{na.Name}ǰȼ{na.Level}/{General.GameplayEquilibriumConstant.MaxNormalAttackLevel}" + + $"\r\nһϣ\r\n" + FunGameService.GetSkillLevelUpNeedy(na.Level + 1)); + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + catch (Exception e) + { + return NetworkUtility.JsonSerialize(e.ToString()); + } + } + [HttpGet("reload")] public string Relaod([FromQuery] long? master = null) { diff --git a/OshimaCore/OshimaWebAPI.cs b/OshimaCore/OshimaWebAPI.cs index fbafb44..4b7a6dd 100644 --- a/OshimaCore/OshimaWebAPI.cs +++ b/OshimaCore/OshimaWebAPI.cs @@ -1,7 +1,6 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Constant; using Oshima.Core.Configs; using Oshima.Core.Constant; using Oshima.Core.Utils; diff --git a/OshimaCore/Utils/FunGameService.cs b/OshimaCore/Utils/FunGameService.cs index ad4bee4..ba29856 100644 --- a/OshimaCore/Utils/FunGameService.cs +++ b/OshimaCore/Utils/FunGameService.cs @@ -78,7 +78,7 @@ namespace Oshima.Core.Utils }; } } - public static Dictionary> SuperSkillLevelUpList + public static Dictionary> SkillLevelUpList { get { @@ -147,32 +147,32 @@ namespace Oshima.Core.Utils }; } } - public static Dictionary> SkillLevelUpList + public static Dictionary> NormalAttackLevelUpList { get { return new() { { - 1, new() + 2, new() { - { "角色等级", 6 }, + { "角色等级", 8 }, { General.GameplayEquilibriumConstant.InGameCurrency, 2000 }, { General.GameplayEquilibriumConstant.InGameMaterial, 10 }, { nameof(技能卷轴), 1 }, } }, { - 2, new() + 3, new() { - { "角色等级", 12 }, + { "角色等级", 16 }, { General.GameplayEquilibriumConstant.InGameCurrency, 5000 }, { General.GameplayEquilibriumConstant.InGameMaterial, 30 }, { nameof(技能卷轴), 2 }, } }, { - 3, new() + 4, new() { { "角色等级", 24 }, { General.GameplayEquilibriumConstant.InGameCurrency, 10000 }, @@ -182,9 +182,9 @@ namespace Oshima.Core.Utils } }, { - 4, new() + 5, new() { - { "角色等级", 36 }, + { "角色等级", 32 }, { General.GameplayEquilibriumConstant.InGameCurrency, 18000 }, { General.GameplayEquilibriumConstant.InGameMaterial, 100 }, { nameof(技能卷轴), 4 }, @@ -192,9 +192,10 @@ namespace Oshima.Core.Utils } }, { - 5, new() + 6, new() { - { "角色等级", 48 }, + { "角色等级", 40 }, + { "角色突破进度", 4 }, { General.GameplayEquilibriumConstant.InGameCurrency, 30000 }, { General.GameplayEquilibriumConstant.InGameMaterial, 150 }, { nameof(技能卷轴), 5 }, @@ -203,15 +204,27 @@ namespace Oshima.Core.Utils } }, { - 6, new() + 7, new() { - { "角色等级", 60 }, + { "角色等级", 48 }, { General.GameplayEquilibriumConstant.InGameCurrency, 47000 }, { General.GameplayEquilibriumConstant.InGameMaterial, 210 }, { nameof(技能卷轴), 6 }, { nameof(智慧之果), 4 }, { nameof(奥术符文), 2 } } + }, + { + 8, new() + { + { "角色等级", 56 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 70000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 280 }, + { nameof(技能卷轴), 7 }, + { nameof(智慧之果), 5 }, + { nameof(奥术符文), 3 }, + { nameof(混沌之核), 1 } + } } }; } @@ -242,7 +255,7 @@ namespace Oshima.Core.Utils Equipment.AddRange([new 攻击之爪5(), new 攻击之爪15(), new 攻击之爪25(), new 攻击之爪35()]); Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4)); - Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书(), new 升华之印(), new 流光之印(), new 永恒之印(), new 技能卷轴(), new 智慧之果(), new 奥术符文()]); + Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书(), new 升华之印(), new 流光之印(), new 永恒之印(), new 技能卷轴(), new 智慧之果(), new 奥术符文(), new 混沌之核()]); AllItems.AddRange(Equipment); AllItems.AddRange(Items); @@ -1161,9 +1174,44 @@ namespace Oshima.Core.Utils { if (SkillLevelUpList.TryGetValue(level, out Dictionary? needy) && needy != null && needy.Count > 0) { - return string.Join(",", needy.Select(kv => kv.Key + " * " + kv.Value)); + return GetNeedyInfo(needy); } return ""; } + + public static string GetNormalAttackLevelUpNeedy(int level) + { + if (NormalAttackLevelUpList.TryGetValue(level, out Dictionary? needy) && needy != null && needy.Count > 0) + { + return GetNeedyInfo(needy); + } + return ""; + } + + public static string GetNeedyInfo(Dictionary needy) + { + string str = ""; + foreach (string key in needy.Keys) + { + int needCount = needy[key]; + if (str != "") + { + str += ","; + } + if (key == "角色等级") + { + str += $"角色等级 {needCount} 级"; + } + else if (key == "角色突破进度") + { + str += $"角色突破进度 {needCount} 等阶"; + } + else + { + str += $"{key} * {needCount}"; + } + } + return str; + } } } diff --git a/OshimaModules/Items/ItemID.cs b/OshimaModules/Items/ItemID.cs index ff8cee3..1d08379 100644 --- a/OshimaModules/Items/ItemID.cs +++ b/OshimaModules/Items/ItemID.cs @@ -23,5 +23,6 @@ 技能卷轴 = 18004, 智慧之果 = 18005, 奥术符文 = 18006, + 混沌之核 = 18007, } } diff --git a/OshimaModules/Items/SpecialItem/混沌之核.cs b/OshimaModules/Items/SpecialItem/混沌之核.cs new file mode 100644 index 0000000..7a64651 --- /dev/null +++ b/OshimaModules/Items/SpecialItem/混沌之核.cs @@ -0,0 +1,13 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Items +{ + public class 混沌之核() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.混沌之核; + public override string Name => "混沌之核"; + public override string Description => "升级技能必备的终级材料。"; + public override QualityType QualityType => QualityType.Purple; + } +} diff --git a/OshimaModules/Modules/ItemModule.cs b/OshimaModules/Modules/ItemModule.cs index ffc27da..73010c9 100644 --- a/OshimaModules/Modules/ItemModule.cs +++ b/OshimaModules/Modules/ItemModule.cs @@ -38,6 +38,7 @@ namespace Oshima.FunGame.OshimaModules (long)SpecialItemID.技能卷轴 => new 技能卷轴(), (long)SpecialItemID.智慧之果 => new 智慧之果(), (long)SpecialItemID.奥术符文 => new 奥术符文(), + (long)SpecialItemID.混沌之核 => new 混沌之核(), _ => null, }; }; diff --git a/OshimaModules/configs/oshima-studios/oshima.fungame.items.json b/OshimaModules/configs/oshima-studios/oshima.fungame.items.json index 7a30c84..70fb795 100644 --- a/OshimaModules/configs/oshima-studios/oshima.fungame.items.json +++ b/OshimaModules/configs/oshima-studios/oshima.fungame.items.json @@ -1350,5 +1350,30 @@ } ] } + }, + "YukiのCalfSocks-圣诞限定": { + "Id": 14515, + "Name": "YukiのCalfSocks-圣诞限定", + "Description": "增加角色 50% 暴击伤害。", + "BackgroundStory": "小雪的圣诞限定小腿袜,结合了圣诞树的红绿色,还有铃铛和鹿角的装饰。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7315, + "Name": "YukiのCalfSocks-圣诞限定", + "SkillType": 3, + "Effects": [ + { + "Id": 8015, + "excrd": 0.5 + } + ] + } + ] + } } }