From 59836e5e694a8e92f3c953cb8ca4f5bef793a1c6 Mon Sep 17 00:00:00 2001 From: milimoe Date: Fri, 25 Jul 2025 01:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AC=AC=E4=BA=8C=E8=B4=A7?= =?UTF-8?q?=E5=B8=81=E7=9A=84=E5=90=8D=E7=A7=B0=EF=BC=9B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=94=BB=E9=80=A0=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaModules/Modules/SkillModule.cs | 1 + OshimaServers/Model/ForgeModel.cs | 23 +++ OshimaServers/Service/FunGameConstant.cs | 46 +++++- OshimaServers/Service/FunGameOrderList.cs | 35 +++-- OshimaServers/Service/FunGameService.cs | 142 +++++++++++++++++- OshimaWebAPI/Controllers/FunGameController.cs | 6 +- OshimaWebAPI/Services/RainBOTService.cs | 58 ++++++- 7 files changed, 282 insertions(+), 29 deletions(-) create mode 100644 OshimaServers/Model/ForgeModel.cs diff --git a/OshimaModules/Modules/SkillModule.cs b/OshimaModules/Modules/SkillModule.cs index 725764b..e6650e3 100644 --- a/OshimaModules/Modules/SkillModule.cs +++ b/OshimaModules/Modules/SkillModule.cs @@ -36,6 +36,7 @@ namespace Oshima.FunGame.OshimaModules protected override void AfterLoad() { General.GameplayEquilibriumConstant.InGameTime = "秒"; + General.GameplayEquilibriumConstant.InGameMaterial = "钻石"; General.GameplayEquilibriumConstant.UseMagicType = [MagicType.None]; } diff --git a/OshimaServers/Model/ForgeModel.cs b/OshimaServers/Model/ForgeModel.cs new file mode 100644 index 0000000..9cef327 --- /dev/null +++ b/OshimaServers/Model/ForgeModel.cs @@ -0,0 +1,23 @@ +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaServers.Model +{ + public class ForgeModel + { + public Guid Guid { get; set; } = Guid.NewGuid(); + public bool MasterForge { get; set; } = false; + public Dictionary ForgeMaterials { get; set; } = []; + public long TargetRegionId { get; set; } = 0; + public QualityType TargetQuality { get; set; } = QualityType.White; + public Dictionary RegionProbabilities { get; set; } = []; + public bool Result { get; set; } = false; + public QualityType ResultQuality { get; set; } = QualityType.White; + public string ResultItem { get; set; } = ""; + public long ResultRegion { get; set; } = 0; + public string ResultString { get; set; } = ""; + public double ResultPoints => ResultPointsGeneral + ResultPointsSuccess + ResultPointsFail; + public double ResultPointsGeneral { get; set; } = 0; + public double ResultPointsSuccess { get; set; } = 0; + public double ResultPointsFail { get; set; } = 0; + } +} diff --git a/OshimaServers/Service/FunGameConstant.cs b/OshimaServers/Service/FunGameConstant.cs index 84084a7..2ceddaf 100644 --- a/OshimaServers/Service/FunGameConstant.cs +++ b/OshimaServers/Service/FunGameConstant.cs @@ -374,7 +374,9 @@ namespace Oshima.FunGame.OshimaServers.Service "{2}的低语在风中消散,但留在你手中的是闪耀的{0}!", "恭喜你!成功在荒野中迷路!奖励…等等,好像是:{0}?至少不是空手而归…", "你凝视着远方,远方也凝视着你…然后,你获得了:{0}!这大概就是命运吧。", - "探索结果:空气,阳光,还有…奖励:{0}!看来今天运气还不错?" + "探索结果:空气,阳光,还有…奖励:{0}!看来今天运气还不错?", + "你随手拨开{4}的草丛,惊喜地发现{0}在阳光下闪闪发光!", + "{3}在{4}的微光中低语,指引你走向了意外的{0}!" ] }, { @@ -383,7 +385,12 @@ namespace Oshima.FunGame.OshimaServers.Service "{4}地牢里的封印纹丝未动,仿佛在嘲笑着你的徒劳……(什么也没有获得)", "在你的注视下,{4}的宝藏已被{2}掠夺一空。(什么也没有获得)", "你对着空地发呆了半天,只剩冰冷的{4}和你的失望。(什么也没有获得)", - "在空荡的回响中传来讥笑,原来{4}的秘宝不过是个传说。(什么也没有获得)" + "在空荡的回响中传来讥笑,原来{4}的秘宝不过是个传说。(什么也没有获得)", + "{4}的废墟中只有风声作伴,{3}也无法指引你找到任何东西。(什么也没有获得)", + "你翻遍了{4}的每个角落,{2}的笑声仿佛在嘲笑你的空手而归。(什么也没有获得)", + "{6}的阴影笼罩着{4},但无论你如何寻找,宝藏依然无踪。(什么也没有获得)", + "在{4}的荒凉中,你只找到了一堆无用的碎石和失望。(什么也没有获得)", + "{3}的光芒在{4}中黯淡,仿佛连它都不愿理会你的探索。(什么也没有获得)" ] }, { @@ -392,7 +399,12 @@ namespace Oshima.FunGame.OshimaServers.Service "当你触碰{3}时,{1}的咆哮震撼着{4}!", "原来这里真的有危险……是{1}守卫着{4},不得不战了!", "在探索{4}的某处时,身旁的墙突然破裂,{1}从阴影中降临!", - "你惊动了{1}!{4}瞬间化作战场!" + "你惊动了{1}!{4}瞬间化作战场!", + "{1}从{4}的黑暗中冲出,{3}的光芒成了战斗的信号!", + "{4}的宁静被打破,{1}的怒吼在{6}回荡,战斗一触即发!", + "当你靠近{3}时,{1}从{4}的迷雾中现身,剑拔弩张!", + "{4}的深处传来低吼,{1}正守候着,你别无选择只能应战!", + "你踏入{4}的禁地,{1}的咆哮宣告了战斗的开始!" ] }, { @@ -401,7 +413,12 @@ namespace Oshima.FunGame.OshimaServers.Service "祝福应验!{4}深处的{0}为你所有!", "解开{4}地牢中的谜题后,{0}终于显现!", "屏障消散,至宝{0}光芒万丈,自觉地飞进了你的口袋!", - "在偶遇{1}和{2}的遭遇战时,你渔翁得利抢到了:{0}!" + "在偶遇{1}和{2}的遭遇战时,你渔翁得利抢到了:{0}!", + "{4}的古老祭坛发出光芒,{0}从{3}中缓缓升起,归于你手!", + "你无意间触碰{4}的机关,{0}如流星般落入你的怀抱!", + "{2}的指引让你在{4}的废墟中发现了闪耀的{0}!", + "在{6}的星光下,{3}为你揭示了{0}的藏身之处!", + "{4}的秘密通道在{3}的指引下开启,{0}赫然出现在你面前!" ] } }; @@ -430,13 +447,32 @@ namespace Oshima.FunGame.OshimaServers.Service public static Dictionary DecomposedMaterials { get; } = new() { { QualityType.Gold, 128 }, - { QualityType.Red, 6 }, + { QualityType.Red, 64 }, { QualityType.Orange, 32 }, { QualityType.Purple, 16 }, { QualityType.Blue, 8 }, { QualityType.Green, 3 }, { QualityType.White, 1 } }; + + public static Dictionary ForgeNeedy { get; } = new() + { + { QualityType.Red, 230 }, + { QualityType.Orange, 170 }, + { QualityType.Purple, 120 }, + { QualityType.Blue, 80 }, + { QualityType.Green, 50 }, + { QualityType.White, 30 } + }; + + public static Dictionary ForgeRegionCoefficient { get; } = new() + { + { RarityType.OneStar, 0.5 }, + { RarityType.TwoStar, 0.6 }, + { RarityType.ThreeStar, 0.7 }, + { RarityType.FourStar, 0.85 }, + { RarityType.FiveStar, 1 } + }; public static string[] GreekAlphabet { get; } = ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"]; diff --git a/OshimaServers/Service/FunGameOrderList.cs b/OshimaServers/Service/FunGameOrderList.cs index 6102313..3ceebda 100644 --- a/OshimaServers/Service/FunGameOrderList.cs +++ b/OshimaServers/Service/FunGameOrderList.cs @@ -35,7 +35,7 @@ {"小队状态", "查看小队所有角色状态"}, {"清空小队", "清空所有小队成员"}, {"生命之泉", "使用金币回复角色状态"}, - {"酒馆", "使用材料使角色获得满能量"}, + {"酒馆", "使用钻石使角色获得满能量"}, }; public static Dictionary ItemHelp { get; } = new() { @@ -46,8 +46,8 @@ {"角色库存 [页码]", "显示库存中所有角色"}, {"我的物品 <物品序号>", "查看指定物品详细信息"}, {"抽卡/十连抽卡", "金币抽卡(1000/次)"}, - {"材料抽卡/材料十连抽卡", "材料抽卡(5/次)"}, - {"兑换金币 <材料数>", "1材料=200金币"}, + {"钻石抽卡/钻石十连抽卡", "钻石抽卡(5/次)"}, + {"兑换金币 <钻石数>", "1钻石=200金币"}, {"使用 <物品名称> <数量> [角色] [角色序号]", "使用物品(可指定角色)举例:使用大经验书 100 角色1"}, {"使用 <物品序号> [使用次数] [角色] [角色序号]", "使用物品(可指定角色)"}, {"使用魔法卡 <物品序号> <卡包序号>", "使用指定魔法卡"}, @@ -56,6 +56,11 @@ {"分解 <物品名称> <数量>", "分解指定数量物品"}, {"强制分解 <物品名称> <数量>", "分解指定数量物品"}, {"品质分解 <品质索引>", "按品质分解(0-6:普通/优秀/稀有/史诗/传说/神话/不朽)"}, + {"锻造配方 <{<物品名称> <数量>...}>", "创建一个锻造配方" }, + {"锻造信息", "查看已经创建的锻造配方" }, + {"取消锻造", "取消已经创建的锻造配方" }, + {"模拟锻造", "模拟锻造结果" }, + {"确认开始锻造", "确认已经创建的锻造配方并开始锻造" }, }; public static Dictionary BattleHelp { get; } = new() { @@ -69,7 +74,7 @@ {"练级结算", "收取练级奖励,并且回血和复活"}, {"练级信息", "查看练级进度"}, {"生命之泉", "使用金币回复角色状态"}, - {"酒馆", "使用材料使角色获得满能量"}, + {"酒馆", "使用钻石使角色获得满能量"}, }; public static Dictionary PlayHelp { get; } = new() { @@ -83,11 +88,16 @@ {"探索 <地区序号> <{角色序号...}>", "探索指定地区(可多角色)"}, {"探索结算", "结算所有未完成的探索"}, {"挑战金币秘境 <难度>", "以小队挑战金币秘境,秘境难度1-5"}, - {"挑战材料秘境 <难度>", "以小队挑战材料秘境,秘境难度1-5"}, + {"挑战钻石秘境 <难度>", "以小队挑战钻石秘境,秘境难度1-5"}, {"挑战经验秘境 <难度>", "以小队挑战经验秘境,秘境难度1-5"}, {"挑战地区秘境 <难度>", "以小队挑战地区锻造材料秘境,秘境难度1-5"}, {"挑战突破秘境 <难度>", "以小队挑战角色突破材料秘境,秘境难度1-5"}, {"挑战技能秘境 <难度>", "以小队挑战技能升级材料秘境,秘境难度1-5"}, + {"锻造配方 <{<物品名称> <数量>...}>", "创建一个锻造配方" }, + {"锻造信息", "查看已经创建的锻造配方" }, + {"取消锻造", "取消已经创建的锻造配方" }, + {"模拟锻造", "模拟锻造结果" }, + {"确认开始锻造", "确认已经创建的锻造配方并开始锻造" }, }; public static Dictionary ClubHelp { get; } = new() { @@ -132,16 +142,10 @@ {"商店2", "查看武器商会商品"}, {"商店3", "查看杂货铺商品"}, {"商店4", "查看慈善基金会商品"}, + {"锻造商店", "查看锻造积分商店商品"}, {"商店查看 <商品序号>", "查看指定商品详情,访问任意商店后2分钟内可用"}, {"商店购买 <商品序号>", "购买指定商品,访问任意商店后2分钟内可用"}, {"商店出售 <物品序号>", "向商店出售具有回收价的指定物品"}, - {"市场上架 <物品序号> <定价>", "将物品寄售到市场上,手续费15%"}, - {"市场下架 <市场物品序号>", "下架指定物品"}, - {"市场购买 <市场物品序号>", "购买指定物品"}, - {"社团市场上架 <物品序号> <定价>", "将物品寄售到社团市场上,手续费10%,并且8%进入社团基金"}, - {"社团市场下架 <市场物品序号>", "下架指定物品"}, - {"社团市场购买 <市场物品序号>", "购买指定物品"}, - {"社团市场清空", "管理员可下架所有物品"}, {"创建报价", "创建一个交易报价"}, {"我的报价 [页码]/查报价 <报价序号>", "查询指定报价详情"}, {"发送报价 <报价序号>", "仅发起方可操作"}, @@ -152,6 +156,13 @@ {"报价添加对方物品 <报价序号> <{物品序号}...>", "仅发起方可操作"}, {"报价移除物品 <报价序号> <{报价物品序号}...>", "仅发起方可操作"}, {"报价移除对方物品 <报价序号> <{报价物品序号}...>", "仅发起方可操作"}, + {"市场上架 <物品序号> <定价>", "将物品寄售到市场上,手续费15%"}, + {"市场下架 <市场物品序号>", "下架指定物品"}, + {"市场购买 <市场物品序号>", "购买指定物品"}, + {"社团市场上架 <物品序号> <定价>", "将物品寄售到社团市场上,手续费10%,并且8%进入社团基金"}, + {"社团市场下架 <市场物品序号>", "下架指定物品"}, + {"社团市场购买 <市场物品序号>", "购买指定物品"}, + {"社团市场清空", "管理员可下架所有物品"}, }; public static IEnumerable> GetPage(Dictionary dict, int page, int pageSize = 10) diff --git a/OshimaServers/Service/FunGameService.cs b/OshimaServers/Service/FunGameService.cs index b84b6b4..bdf5610 100644 --- a/OshimaServers/Service/FunGameService.cs +++ b/OshimaServers/Service/FunGameService.cs @@ -1387,7 +1387,7 @@ namespace Oshima.FunGame.OshimaServers.Service int original = has.Level; // 添加技能等级 has.Level += magic.Level; - // 补偿材料,1级10材料 + // 补偿钻石,1级10钻石 int diff = magic.Level - (has.Level - original); if (diff != 0) { @@ -3402,7 +3402,10 @@ namespace Oshima.FunGame.OshimaServers.Service Item newItem = item; if (copyNew) newItem = item.Copy(copyLevel); newItem.User = user; - if (hasLock && (newItem.QualityType >= QualityType.Orange || FunGameConstant.CharacterLevelBreakItems.Any(c => c.Id == item.Id)) || FunGameConstant.SkillLevelUpItems.Any(c => c.Id == item.Id)) newItem.IsLock = true; + if (hasLock && (newItem.QualityType >= QualityType.Orange || + FunGameConstant.ExploreItems.Values.SelectMany(i => i).Any(c => c.Id == item.Id) || + FunGameConstant.CharacterLevelBreakItems.Any(c => c.Id == item.Id) || + FunGameConstant.SkillLevelUpItems.Any(c => c.Id == item.Id))) newItem.IsLock = true; if (hasSellAndTradeTime) SetSellAndTradeTime(newItem); if (hasPrice) { @@ -3998,6 +4001,141 @@ namespace Oshima.FunGame.OshimaServers.Service return msg; } + public static void GenerateForgeResult(User user, ForgeModel model) + { + if (model.ForgeMaterials.Count == 0) + { + model.ResultString = "没有提交任何锻造材料,请重新提交。"; + return; + } + + Dictionary regionMaterialCount = []; + Dictionary regionMaterialEquivalent = []; + Dictionary regionContributions = []; + foreach (string key in model.ForgeMaterials.Keys) + { + int c = model.ForgeMaterials[key]; + OshimaRegion r = FunGameConstant.ExploreItems.FirstOrDefault(kv => kv.Value.Select(i => i.Name).Any(s => s == key)).Key; + if (r.Id == 0) continue; + if (!regionMaterialCount.TryAdd(r, c)) regionMaterialCount[r] += c; + double ce = c * FunGameConstant.ForgeRegionCoefficient[r.Difficulty]; + if (!regionMaterialEquivalent.TryAdd(key, ce)) regionMaterialEquivalent[key] += ce; + if (!regionContributions.TryAdd(r, ce)) regionContributions[r] += ce; + } + + if (regionMaterialCount.Count == 0) + { + model.ResultString = "提交的锻造材料均不属于任何地区,请重新提交。"; + return; + } + + OshimaRegion resultRegion; + bool isSimplyForge = regionMaterialCount.Count == 1; + int count = 0; + if (isSimplyForge) + { + OshimaRegion region = regionMaterialCount.Keys.First(); + count = regionMaterialCount[region]; + if (count < FunGameConstant.ForgeNeedy[QualityType.White]) + { + model.ResultString = $"提交的锻造材料不足 {FunGameConstant.ForgeNeedy[QualityType.White]} 个,请重新提交。"; + return; + } + resultRegion = FunGameConstant.ExploreItems.Keys.First(r => r.Id == region.Id); + } + else + { + count = (int)regionMaterialEquivalent.Values.Sum(); + if (count < FunGameConstant.ForgeNeedy[QualityType.White]) + { + model.ResultString = $"有效材料用量 ({count}) 不足最低要求 ({FunGameConstant.ForgeNeedy[QualityType.White]}),请重新提交!"; + return; + } + model.RegionProbabilities = regionContributions.ToDictionary(kv => kv.Key.Id, kv => kv.Value / count); + double randomValue = Random.Shared.NextDouble(); + double cumulative = 0; + resultRegion = regionContributions.Keys.First(); + foreach (OshimaRegion r in regionContributions.Keys) + { + cumulative += regionContributions[r] / count; + if (randomValue <= cumulative) + { + resultRegion = r; + break; + } + } + model.ResultRegion = resultRegion.Id; + } + + if (count >= FunGameConstant.ForgeNeedy[QualityType.Red]) + { + model.ResultQuality = QualityType.Red; + } + else if (count >= FunGameConstant.ForgeNeedy[QualityType.Orange]) + { + model.ResultQuality = QualityType.Orange; + } + else if (count >= FunGameConstant.ForgeNeedy[QualityType.Purple]) + { + model.ResultQuality = QualityType.Purple; + } + else if (count >= FunGameConstant.ForgeNeedy[QualityType.Blue]) + { + model.ResultQuality = QualityType.Blue; + } + else + { + model.ResultQuality = QualityType.White; + } + model.ResultPointsGeneral = count * 0.3; + + string resultItemString = ""; + Item? resultItem = resultRegion.Items.OrderBy(o => Random.Shared.Next()).First(i => i.QualityType == model.ResultQuality); + if (resultItem != null) + { + string itemquality = ItemSet.GetQualityTypeName(resultItem.QualityType); + string itemtype = ItemSet.GetItemTypeName(resultItem.ItemType) + (resultItem.ItemType == ItemType.Weapon && resultItem.WeaponType != WeaponType.None ? "-" + ItemSet.GetWeaponTypeName(resultItem.WeaponType) : ""); + if (itemtype != "") itemtype = $"|{itemtype}"; + resultItemString = $"{itemtype}{resultItem.Name}"; + model.ResultItem = resultItem.Name; + } + + if (isSimplyForge) + { + if (resultItem is null) + { + model.ResultPointsFail = count * 0.2; + model.ResultString = $"锻造失败!本次锻造物品的品质为:{ItemSet.GetQualityTypeName(model.ResultQuality)},地区为:{resultRegion.Name},该地区不存在该品质的物品!\r\n" + + $"本次提交 {count} 个地区 [ {resultRegion.Name} ] 的锻造材料,获得 {model.ResultPoints:0.##} 点锻造积分。"; + } + else + { + model.Result = true; + model.ResultPointsSuccess = count - FunGameConstant.ForgeNeedy[model.ResultQuality]; + model.ResultString = $"锻造成功!本次锻造物品的品质为:{ItemSet.GetQualityTypeName(model.ResultQuality)},地区为:{resultRegion.Name},获得了:{resultItemString}!\r\n" + + $"本次提交 {count} 个地区 [ {resultRegion.Name} ] 的锻造材料,获得 {model.ResultPoints:0.##} 点锻造积分。"; + AddItemToUserInventory(user, resultItem); + } + } + else + { + if (resultItem is null) + { + model.ResultPointsFail = count * 0.2; + model.ResultString = $"锻造失败!本次锻造物品的品质为:{ItemSet.GetQualityTypeName(model.ResultQuality)},地区为:{resultRegion.Name},该地区不存在该品质的物品!\r\n" + + $"本次提交 {regionContributions.Count} 个地区的锻造材料({string.Join("、", regionMaterialCount.Select(kv => $"{kv.Value} 个来自{kv.Key}"))}),总共 {count} 有效材料用量,获得 {model.ResultPoints:0.##} 点锻造积分。"; + } + else + { + model.Result = true; + model.ResultPointsSuccess = count - FunGameConstant.ForgeNeedy[model.ResultQuality]; + model.ResultString = $"锻造成功!本次锻造物品的品质为:{ItemSet.GetQualityTypeName(model.ResultQuality)},地区为:{resultRegion.Name},获得了:{resultItemString}!\r\n" + + $"本次提交 {regionContributions.Count} 个地区的锻造材料({string.Join("、", regionMaterialCount.Select(kv => $"{kv.Value} 个来自{kv.Key}"))}),总共 {count} 有效材料用量,获得 {model.ResultPoints:0.##} 点锻造积分。"; + AddItemToUserInventory(user, resultItem); + } + } + } + public static void RefreshNotice() { Notices.LoadConfig(); diff --git a/OshimaWebAPI/Controllers/FunGameController.cs b/OshimaWebAPI/Controllers/FunGameController.cs index 69d3628..89d54bf 100644 --- a/OshimaWebAPI/Controllers/FunGameController.cs +++ b/OshimaWebAPI/Controllers/FunGameController.cs @@ -3908,7 +3908,7 @@ namespace Oshima.FunGame.WebAPI.Controllers FunGameService.Bosses.Remove(bossIndex); double gained = boss.Level; user.Inventory.Materials += gained; - msgs.Add($"恭喜你击败了 Boss,获得 {gained} 材料奖励!"); + msgs.Add($"恭喜你击败了 Boss,获得 {gained} {General.GameplayEquilibriumConstant.InGameMaterial}奖励!"); } else { @@ -4178,7 +4178,7 @@ namespace Oshima.FunGame.WebAPI.Controllers FunGameService.Bosses.Remove(bossIndex); double gained = boss.Level; user.Inventory.Materials += gained; - msgs.Add($"恭喜你击败了 Boss,获得 {gained} 材料奖励!"); + msgs.Add($"恭喜你击败了 Boss,获得 {gained} {General.GameplayEquilibriumConstant.InGameMaterial}奖励!"); } else { @@ -7141,7 +7141,7 @@ namespace Oshima.FunGame.WebAPI.Controllers stores.LoadConfig(); string msg = ""; - Store? store = stores.Get(storeName); + Store? store = FunGameService.GetRegionStore(stores, user, storeRegion, storeName); if (store != null) { if (store.Goods.Values.FirstOrDefault(g => g.Id == goodid && (!g.ExpireTime.HasValue || g.ExpireTime.Value > DateTime.Now)) is Goods good) diff --git a/OshimaWebAPI/Services/RainBOTService.cs b/OshimaWebAPI/Services/RainBOTService.cs index 05b2d3b..512d9b7 100644 --- a/OshimaWebAPI/Services/RainBOTService.cs +++ b/OshimaWebAPI/Services/RainBOTService.cs @@ -950,22 +950,22 @@ namespace Oshima.FunGame.WebAPI.Services return result; } - if (e.Detail == "材料抽卡") + if (e.Detail == "钻石抽卡") { List msgs = Controller.DrawCard_Material(uid); if (msgs.Count > 0) { - await SendAsync(e, "材料抽卡", "\r\n" + string.Join("\r\n", msgs)); + await SendAsync(e, "钻石抽卡", "\r\n" + string.Join("\r\n", msgs)); } return result; } - if (e.Detail == "材料十连抽卡") + if (e.Detail == "钻石十连抽卡") { List msgs = Controller.DrawCards_Material(uid); if (msgs.Count > 0) { - await SendAsync(e, "材料十连抽卡", "\r\n" + string.Join("\r\n", msgs)); + await SendAsync(e, "钻石十连抽卡", "\r\n" + string.Join("\r\n", msgs)); } return result; } @@ -2830,16 +2830,16 @@ namespace Oshima.FunGame.WebAPI.Services return result; } - if (e.Detail.StartsWith("挑战材料秘境")) + if (e.Detail.StartsWith("挑战钻石秘境")) { - string detail = e.Detail.Replace("挑战材料秘境", "").Trim(); + string detail = e.Detail.Replace("挑战钻石秘境", "").Trim(); string msg = ""; if (int.TryParse(detail, out int diff)) { msg = await Controller.FightInstance(uid, (int)InstanceType.Material, diff); if (msg.Trim() != "") { - await SendAsync(e, "挑战材料秘境", msg); + await SendAsync(e, "挑战钻石秘境", msg); } } return result; @@ -2905,6 +2905,7 @@ namespace Oshima.FunGame.WebAPI.Services return result; } + if (e.Detail.StartsWith("商店")) { string detail = e.Detail.Replace("商店", "").Trim(); @@ -2925,6 +2926,9 @@ namespace Oshima.FunGame.WebAPI.Services case 4: msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_welfare"); break; + case 5: + msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_forge"); + break; default: break; } @@ -2936,6 +2940,46 @@ namespace Oshima.FunGame.WebAPI.Services return result; } + if (e.Detail.StartsWith("锻造配方")) + { + string pattern = @"锻造配方\s*(?:(?[^\d\s][^\d]*?)\s+(?\d+)\s*)+"; + Dictionary recipeItems = []; + + StringBuilder builder = new(); + MatchCollection matches = Regex.Matches(e.Detail, pattern, RegexOptions.ExplicitCapture); + foreach (Match match in matches) + { + CaptureCollection itemNames = match.Groups["itemName"].Captures; + CaptureCollection counts = match.Groups["count"].Captures; + + for (int i = 0; i < itemNames.Count; i++) + { + string itemName = itemNames[i].Value.Trim(); + if (int.TryParse(counts[i].Value, out int count)) + { + recipeItems[itemName] = count; + builder.AppendLine($"{itemName} x{count}"); + } + } + } + + User user = Factory.GetUser(); + ForgeModel model = new() + { + ForgeMaterials = recipeItems + }; + FunGameService.GenerateForgeResult(user, model); + if (model.ResultString != "") + { + await SendAsync(e, "锻造配方", model.ResultString); + } + else + { + await SendAsync(e, "锻造配方", $"失败了……\r\n{builder}"); + } + return result; + } + if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase)) { string msg = Controller.Relaod(uid);