From d68a4c86ae85357209e44898200a496b698e1a7b Mon Sep 17 00:00:00 2001 From: milimoe Date: Tue, 4 Feb 2025 23:26:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A4=BC=E5=8C=85=EF=BC=9B?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E9=87=8D=E9=9A=8F=E6=B7=BB=E5=8A=A0=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=B1=9E=E6=80=A7=EF=BC=9B=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E7=89=A9=E5=93=81=E5=BA=8F=E5=8F=B7=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=9B=E7=A4=BE=E5=9B=A2=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5=E6=98=BE=E7=A4=BA=EF=BC=9B?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=B0=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaModules/Characters/CustomCharacter.cs | 27 +- OshimaModules/Characters/Organisms.cs | 7 + OshimaModules/Items/Consumable/回复药.cs | 12 +- OshimaModules/Items/Consumable/能量饮料.cs | 12 +- OshimaModules/Items/Consumable/魔力填充剂.cs | 12 +- OshimaModules/Items/GiftBox/礼包.cs | 155 +++ OshimaModules/Items/ItemID.cs | 7 + OshimaModules/Modules/ItemModule.cs | 3 + OshimaModules/Modules/SkillModule.cs | 1 + OshimaModules/Skills/SkillID.cs | 3 +- OshimaServers/Service/FunGameConstant.cs | 1184 ++++++++++------- OshimaServers/Service/FunGameService.cs | 205 ++- OshimaWebAPI/Controllers/FunGameController.cs | 520 ++++++-- OshimaWebAPI/Services/RainBOTService.cs | 105 +- 14 files changed, 1611 insertions(+), 642 deletions(-) create mode 100644 OshimaModules/Characters/Organisms.cs create mode 100644 OshimaModules/Items/GiftBox/礼包.cs diff --git a/OshimaModules/Characters/CustomCharacter.cs b/OshimaModules/Characters/CustomCharacter.cs index 7f29786..38ef19b 100644 --- a/OshimaModules/Characters/CustomCharacter.cs +++ b/OshimaModules/Characters/CustomCharacter.cs @@ -1,4 +1,5 @@ -using Milimoe.FunGame.Core.Api.Utility; +using System; +using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; @@ -47,5 +48,29 @@ namespace Oshima.FunGame.OshimaModules.Characters InitialHR = Random.Shared.Next(1, 6); InitialMR = Random.Shared.Next(1, 6); } + + public void SetPrimaryAttribute(PrimaryAttribute? value = null) + { + if (value != null && value.HasValue) + { + PrimaryAttribute = value.Value; + } + else + { + double max = Math.Max(Math.Max(STR, AGI), INT); + if (max == STR) + { + PrimaryAttribute = PrimaryAttribute.STR; + } + else if (max == AGI) + { + PrimaryAttribute = PrimaryAttribute.AGI; + } + else if (max == INT) + { + PrimaryAttribute = PrimaryAttribute.INT; + } + } + } } } diff --git a/OshimaModules/Characters/Organisms.cs b/OshimaModules/Characters/Organisms.cs new file mode 100644 index 0000000..bac9e0f --- /dev/null +++ b/OshimaModules/Characters/Organisms.cs @@ -0,0 +1,7 @@ +namespace Oshima.FunGame.OshimaModules.Characters +{ + public class Organisms + { + + } +} diff --git a/OshimaModules/Items/Consumable/回复药.cs b/OshimaModules/Items/Consumable/回复药.cs index 3c643ff..8eef00b 100644 --- a/OshimaModules/Items/Consumable/回复药.cs +++ b/OshimaModules/Items/Consumable/回复药.cs @@ -7,7 +7,7 @@ namespace Oshima.FunGame.OshimaModules.Items { public class 回复药 { - public interface HPBook + public interface HPRecovery { public double HP { get; set; } } @@ -27,7 +27,7 @@ namespace Oshima.FunGame.OshimaModules.Items { item.Skills.Active.OnSkillCasted([character]); string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; - if (item is HPBook hpBook) + if (item is HPRecovery hpBook) { msg += $"回复了 {hpBook.HP} 点生命值!"; } @@ -60,7 +60,7 @@ namespace Oshima.FunGame.OshimaModules.Items if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) { string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; - if (item is HPBook expBook) + if (item is HPRecovery expBook) { truemsg += $"回复了 {expBook.HP * count} 点生命值!"; } @@ -70,7 +70,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 小回复药 : Item, 回复药.HPBook + public class 小回复药 : Item, 回复药.HPRecovery { public override long Id => (long)ConsumableID.小回复药; public override string Name => "小回复药"; @@ -90,7 +90,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 中回复药 : Item, 回复药.HPBook + public class 中回复药 : Item, 回复药.HPRecovery { public override long Id => (long)ConsumableID.中回复药; public override string Name => "中回复药"; @@ -110,7 +110,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 大回复药 : Item, 回复药.HPBook + public class 大回复药 : Item, 回复药.HPRecovery { public override long Id => (long)ConsumableID.大回复药; public override string Name => "大回复药"; diff --git a/OshimaModules/Items/Consumable/能量饮料.cs b/OshimaModules/Items/Consumable/能量饮料.cs index 1e0af92..677c614 100644 --- a/OshimaModules/Items/Consumable/能量饮料.cs +++ b/OshimaModules/Items/Consumable/能量饮料.cs @@ -7,7 +7,7 @@ namespace Oshima.FunGame.OshimaModules.Items { public class 能量饮料 { - public interface EPBook + public interface EPAdd { public double EP { get; set; } } @@ -27,7 +27,7 @@ namespace Oshima.FunGame.OshimaModules.Items { item.Skills.Active.OnSkillCasted([character]); string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; - if (item is EPBook hpBook) + if (item is EPAdd hpBook) { msg += $"获得了 {hpBook.EP} 点能量值!"; } @@ -60,7 +60,7 @@ namespace Oshima.FunGame.OshimaModules.Items if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) { string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; - if (item is EPBook expBook) + if (item is EPAdd expBook) { truemsg += $"获得了 {expBook.EP * count} 点能量值!"; } @@ -70,7 +70,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 能量饮料1 : Item, 能量饮料.EPBook + public class 能量饮料1 : Item, 能量饮料.EPAdd { public override long Id => (long)ConsumableID.能量饮料1; public override string Name => "能量饮料"; @@ -90,7 +90,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 能量饮料2 : Item, 能量饮料.EPBook + public class 能量饮料2 : Item, 能量饮料.EPAdd { public override long Id => (long)ConsumableID.能量饮料2; public override string Name => "能量饮料 Pro"; @@ -110,7 +110,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 能量饮料3 : Item, 能量饮料.EPBook + public class 能量饮料3 : Item, 能量饮料.EPAdd { public override long Id => (long)ConsumableID.能量饮料3; public override string Name => "能量饮料 Pro Max"; diff --git a/OshimaModules/Items/Consumable/魔力填充剂.cs b/OshimaModules/Items/Consumable/魔力填充剂.cs index ae753ac..107728d 100644 --- a/OshimaModules/Items/Consumable/魔力填充剂.cs +++ b/OshimaModules/Items/Consumable/魔力填充剂.cs @@ -7,7 +7,7 @@ namespace Oshima.FunGame.OshimaModules.Items { public class 魔力填充剂 { - public interface MPBook + public interface MPRecovery { public double MP { get; set; } } @@ -27,7 +27,7 @@ namespace Oshima.FunGame.OshimaModules.Items { item.Skills.Active.OnSkillCasted([character]); string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; - if (item is MPBook hpBook) + if (item is MPRecovery hpBook) { msg += $"回复了 {hpBook.MP} 点魔法值!"; } @@ -60,7 +60,7 @@ namespace Oshima.FunGame.OshimaModules.Items if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) { string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; - if (item is MPBook expBook) + if (item is MPRecovery expBook) { truemsg += $"回复了 {expBook.MP * count} 点魔法值!"; } @@ -70,7 +70,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 魔力填充剂1 : Item, 魔力填充剂.MPBook + public class 魔力填充剂1 : Item, 魔力填充剂.MPRecovery { public override long Id => (long)ConsumableID.魔力填充剂1; public override string Name => "魔力填充剂Ⅰ型"; @@ -90,7 +90,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 魔力填充剂2 : Item, 魔力填充剂.MPBook + public class 魔力填充剂2 : Item, 魔力填充剂.MPRecovery { public override long Id => (long)ConsumableID.魔力填充剂2; public override string Name => "魔力填充剂Ⅱ型"; @@ -110,7 +110,7 @@ namespace Oshima.FunGame.OshimaModules.Items } } - public class 魔力填充剂3 : Item, 魔力填充剂.MPBook + public class 魔力填充剂3 : Item, 魔力填充剂.MPRecovery { public override long Id => (long)ConsumableID.魔力填充剂3; public override string Name => "魔力填充剂Ⅲ型"; diff --git a/OshimaModules/Items/GiftBox/礼包.cs b/OshimaModules/Items/GiftBox/礼包.cs new file mode 100644 index 0000000..a4440f6 --- /dev/null +++ b/OshimaModules/Items/GiftBox/礼包.cs @@ -0,0 +1,155 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; +using Oshima.FunGame.OshimaModules.Skills; + +namespace Oshima.FunGame.OshimaModules.Items +{ + public class 礼包 + { + public interface GiftBox + { + public Dictionary Gifts { get; set; } + } + + public static void Init(Item item, Dictionary gifts, int remainUseTimes = 1) + { + if (item is GiftBox box) + { + box.Gifts = gifts; + } + item.Skills.Active = new 礼包技能(item); + item.RemainUseTimes = remainUseTimes; + item.IsInGameItem = false; + item.IsReduceTimesAfterUse = true; + item.IsRemoveAfterUse = true; + } + + public static bool OnItemUsed(Item item, Dictionary args) + { + string msg = ""; + if (item is GiftBox box) + { + + } + args["msg"] = msg; + return msg.Trim() != ""; + } + } + + public class 年夜饭 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.年夜饭; + public override string Name => "年夜饭"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 年夜饭(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 100000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 2000 }, + { new 技能卷轴().Name, 20 }, + { new 升华之印().Name, 20 }, + { new 流光之印().Name, 10 }, + { new 大经验书().Name, 20 }, + { new 大回复药().Name, 5 }, + { new 魔力填充剂3().Name, 5 }, + { new 能量饮料3().Name, 5 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(Dictionary args) + { + return 礼包.OnItemUsed(this, args); + } + } + + public class 蛇年大吉 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.蛇年大吉; + public override string Name => "蛇年大吉"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 蛇年大吉(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 88888 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 888 }, + { new 技能卷轴().Name, 20 }, + { new 智慧之果().Name, 10 }, + { new 奥术符文().Name, 5 }, + { new 混沌之核().Name, 3 }, + { new 升华之印().Name, 20 }, + { new 流光之印().Name, 10 }, + { new 永恒之印().Name, 3 }, + { new 大经验书().Name, 20 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(Dictionary args) + { + return 礼包.OnItemUsed(this, args); + } + } + + public class 新春快乐 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.新春快乐; + public override string Name => "新春快乐"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 新春快乐(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 100000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 2000 }, + { new 技能卷轴().Name, 20 }, + { new 升华之印().Name, 20 }, + { new 流光之印().Name, 10 }, + { new 大经验书().Name, 20 }, + { new 大回复药().Name, 5 }, + { new 魔力填充剂3().Name, 5 }, + { new 能量饮料3().Name, 5 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(Dictionary args) + { + return 礼包.OnItemUsed(this, args); + } + } + + public class 礼包技能 : Skill + { + public override long Id => (long)ItemActiveID.礼包; + public override string Name => "礼包"; + public override string Description + { + get + { + if (Item is 礼包.GiftBox box && box.Gifts.Count > 0) + { + return "打开后可立即获得:" + string.Join(",", box.Gifts.Select(kv => $"{kv.Key} * {kv.Value}")); + } + return ""; + } + } + + public 礼包技能(Item? item = null) : base(SkillType.Item) + { + Level = 1; + Item = item; + } + } +} diff --git a/OshimaModules/Items/ItemID.cs b/OshimaModules/Items/ItemID.cs index c2a94ab..883daa0 100644 --- a/OshimaModules/Items/ItemID.cs +++ b/OshimaModules/Items/ItemID.cs @@ -34,4 +34,11 @@ 奥术符文 = 18006, 混沌之核 = 18007, } + + public enum GiftBoxID : long + { + 年夜饭 = 20001, + 蛇年大吉 = 20002, + 新春快乐 = 20003 + } } diff --git a/OshimaModules/Modules/ItemModule.cs b/OshimaModules/Modules/ItemModule.cs index d3d8129..7f30ba8 100644 --- a/OshimaModules/Modules/ItemModule.cs +++ b/OshimaModules/Modules/ItemModule.cs @@ -49,6 +49,9 @@ namespace Oshima.FunGame.OshimaModules (long)ConsumableID.能量饮料1 => new 能量饮料1(), (long)ConsumableID.能量饮料2 => new 能量饮料2(), (long)ConsumableID.能量饮料3 => new 能量饮料3(), + (long)GiftBoxID.年夜饭 => new 年夜饭(), + (long)GiftBoxID.蛇年大吉 => new 蛇年大吉(), + (long)GiftBoxID.新春快乐 => new 新春快乐(), _ => null, }; }; diff --git a/OshimaModules/Modules/SkillModule.cs b/OshimaModules/Modules/SkillModule.cs index b210e39..b56e35f 100644 --- a/OshimaModules/Modules/SkillModule.cs +++ b/OshimaModules/Modules/SkillModule.cs @@ -70,6 +70,7 @@ namespace Oshima.FunGame.OshimaModules (long)PassiveID.弱者猎手 => new 弱者猎手(), (long)ItemPassiveID.攻击之爪 => new 攻击之爪技能(), (long)ItemActiveID.经验书 => new 经验书技能(), + (long)ItemActiveID.礼包 => new 礼包技能(), _ => null }; }; diff --git a/OshimaModules/Skills/SkillID.cs b/OshimaModules/Skills/SkillID.cs index 35034d8..14bf267 100644 --- a/OshimaModules/Skills/SkillID.cs +++ b/OshimaModules/Skills/SkillID.cs @@ -107,6 +107,7 @@ 经验书 = 6001, 回复药 = 6002, 魔力填充剂 = 6003, - 能量饮料 = 6004 + 能量饮料 = 6004, + 礼包 = 6005 } } diff --git a/OshimaServers/Service/FunGameConstant.cs b/OshimaServers/Service/FunGameConstant.cs index 57ff0c5..5bf13e6 100644 --- a/OshimaServers/Service/FunGameConstant.cs +++ b/OshimaServers/Service/FunGameConstant.cs @@ -8,6 +8,8 @@ namespace Oshima.FunGame.OshimaServers.Service public class FunGameConstant { public const long CustomCharacterId = -1; + public const int ItemsPerPage1 = 6; + public const int ItemsPerPage2 = 10; public static List Characters { get; } = []; public static List Skills { get; } = []; public static List PassiveSkills { get; } = []; @@ -21,508 +23,752 @@ namespace Oshima.FunGame.OshimaServers.Service public static Dictionary UserIdAndUsername { get; } = []; public static ItemType[] ItemCanUsed => [ItemType.Consumable, ItemType.MagicCard, ItemType.SpecialItem, ItemType.GiftBox, ItemType.Others]; - public static Dictionary> LevelBreakNeedyList + public static Dictionary> LevelBreakNeedyList { get; } = new() { - get { - return new() + 0, new() { - { - 0, new() - { - { General.GameplayEquilibriumConstant.InGameMaterial, 20 }, - { nameof(升华之印), 2 } - } - }, - { - 1, new() - { - { General.GameplayEquilibriumConstant.InGameMaterial, 40 }, - { nameof(升华之印), 4 } - } - }, - { - 2, new() - { - { General.GameplayEquilibriumConstant.InGameMaterial, 80 }, - { nameof(升华之印), 6 }, - { nameof(流光之印), 2 } - } - }, - { - 3, new() - { - { General.GameplayEquilibriumConstant.InGameMaterial, 160 }, - { nameof(升华之印), 9 }, - { nameof(流光之印), 4 } - } - }, - { - 4, new() - { - { General.GameplayEquilibriumConstant.InGameMaterial, 320 }, - { nameof(升华之印), 12 }, - { nameof(流光之印), 6 }, - { nameof(永恒之印), 2 } - } - }, - { - 5, new() - { - { General.GameplayEquilibriumConstant.InGameMaterial, 640 }, - { nameof(升华之印), 16 }, - { nameof(流光之印), 9 }, - { nameof(永恒之印), 4 } - } - }, - }; - } - } + { General.GameplayEquilibriumConstant.InGameMaterial, 20 }, + { nameof(升华之印), 2 } + } + }, + { + 1, new() + { + { General.GameplayEquilibriumConstant.InGameMaterial, 40 }, + { nameof(升华之印), 4 } + } + }, + { + 2, new() + { + { General.GameplayEquilibriumConstant.InGameMaterial, 80 }, + { nameof(升华之印), 6 }, + { nameof(流光之印), 2 } + } + }, + { + 3, new() + { + { General.GameplayEquilibriumConstant.InGameMaterial, 160 }, + { nameof(升华之印), 9 }, + { nameof(流光之印), 4 } + } + }, + { + 4, new() + { + { General.GameplayEquilibriumConstant.InGameMaterial, 320 }, + { nameof(升华之印), 12 }, + { nameof(流光之印), 6 }, + { nameof(永恒之印), 2 } + } + }, + { + 5, new() + { + { General.GameplayEquilibriumConstant.InGameMaterial, 640 }, + { nameof(升华之印), 16 }, + { nameof(流光之印), 9 }, + { nameof(永恒之印), 4 } + } + }, + }; - public static Dictionary> SkillLevelUpList + public static Dictionary> SkillLevelUpList { get; } = new() { - get { - return new() + 1, new() { - { - 1, new() - { - { "角色等级", 1 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 2000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 10 }, - { nameof(技能卷轴), 1 }, - } - }, - { - 2, new() - { - { "角色等级", 12 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 5000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 30 }, - { nameof(技能卷轴), 2 }, - } - }, - { - 3, new() - { - { "角色等级", 24 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 10000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 60 }, - { nameof(技能卷轴), 4 }, - { nameof(智慧之果), 1 }, - } - }, - { - 4, new() - { - { "角色等级", 36 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 18000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 100 }, - { nameof(技能卷轴), 6 }, - { nameof(智慧之果), 2 }, - } - }, - { - 5, new() - { - { "角色等级", 48 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 30000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 150 }, - { nameof(技能卷轴), 9 }, - { nameof(智慧之果), 4 }, - { nameof(奥术符文), 1 } - } - }, - { - 6, new() - { - { "角色等级", 60 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 47000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 210 }, - { nameof(技能卷轴), 6 }, - { nameof(智慧之果), 6 }, - { nameof(奥术符文), 2 } - } - } - }; + { "角色等级", 1 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 2000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 10 }, + { nameof(技能卷轴), 1 }, + } + }, + { + 2, new() + { + { "角色等级", 12 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 5000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 30 }, + { nameof(技能卷轴), 2 }, + } + }, + { + 3, new() + { + { "角色等级", 24 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 10000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 60 }, + { nameof(技能卷轴), 4 }, + { nameof(智慧之果), 1 }, + } + }, + { + 4, new() + { + { "角色等级", 36 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 18000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 100 }, + { nameof(技能卷轴), 6 }, + { nameof(智慧之果), 2 }, + } + }, + { + 5, new() + { + { "角色等级", 48 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 30000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 150 }, + { nameof(技能卷轴), 9 }, + { nameof(智慧之果), 4 }, + { nameof(奥术符文), 1 } + } + }, + { + 6, new() + { + { "角色等级", 60 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 47000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 210 }, + { nameof(技能卷轴), 6 }, + { nameof(智慧之果), 6 }, + { nameof(奥术符文), 2 } + } } - } + }; - public static Dictionary> NormalAttackLevelUpList + public static Dictionary> NormalAttackLevelUpList { get; } = new() { - get { - return new() + 2, new() { - { - 2, new() - { - { "角色等级", 8 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 2000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 10 }, - { nameof(技能卷轴), 1 }, - } - }, - { - 3, new() - { - { "角色等级", 16 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 5000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 30 }, - { nameof(技能卷轴), 2 }, - } - }, - { - 4, new() - { - { "角色等级", 24 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 10000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 60 }, - { nameof(技能卷轴), 4 }, - { nameof(智慧之果), 1 }, - } - }, - { - 5, new() - { - { "角色等级", 32 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 18000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 100 }, - { nameof(技能卷轴), 6 }, - { nameof(智慧之果), 2 }, - } - }, - { - 6, new() - { - { "角色等级", 40 }, - { "角色突破进度", 4 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 30000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 150 }, - { nameof(技能卷轴), 9 }, - { nameof(智慧之果), 4 }, - { nameof(奥术符文), 1 } - } - }, - { - 7, new() - { - { "角色等级", 48 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 47000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 210 }, - { nameof(技能卷轴), 12 }, - { nameof(智慧之果), 6 }, - { nameof(奥术符文), 2 } - } - }, - { - 8, new() - { - { "角色等级", 56 }, - { General.GameplayEquilibriumConstant.InGameCurrency, 70000 }, - { General.GameplayEquilibriumConstant.InGameMaterial, 280 }, - { nameof(技能卷轴), 16 }, - { nameof(智慧之果), 9 }, - { nameof(奥术符文), 4 }, - { nameof(混沌之核), 1 } - } - } - }; + { "角色等级", 8 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 2000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 10 }, + { nameof(技能卷轴), 1 }, + } + }, + { + 3, new() + { + { "角色等级", 16 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 5000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 30 }, + { nameof(技能卷轴), 2 }, + } + }, + { + 4, new() + { + { "角色等级", 24 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 10000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 60 }, + { nameof(技能卷轴), 4 }, + { nameof(智慧之果), 1 }, + } + }, + { + 5, new() + { + { "角色等级", 32 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 18000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 100 }, + { nameof(技能卷轴), 6 }, + { nameof(智慧之果), 2 }, + } + }, + { + 6, new() + { + { "角色等级", 40 }, + { "角色突破进度", 4 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 30000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 150 }, + { nameof(技能卷轴), 9 }, + { nameof(智慧之果), 4 }, + { nameof(奥术符文), 1 } + } + }, + { + 7, new() + { + { "角色等级", 48 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 47000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 210 }, + { nameof(技能卷轴), 12 }, + { nameof(智慧之果), 6 }, + { nameof(奥术符文), 2 } + } + }, + { + 8, new() + { + { "角色等级", 56 }, + { General.GameplayEquilibriumConstant.InGameCurrency, 70000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 280 }, + { nameof(技能卷轴), 16 }, + { nameof(智慧之果), 9 }, + { nameof(奥术符文), 4 }, + { nameof(混沌之核), 1 } + } } - } + }; - public static Dictionary> RoundRewards + public static Dictionary> RoundRewards { get; } = new() { - get { - return new() + EffectID.ExATK, + new() { - { - EffectID.ExATK, - new() - { - { "exatk", Random.Shared.Next(40, 80) } - } - }, - { - EffectID.ExCritRate, - new() - { - { "excr", Math.Clamp(Random.Shared.NextDouble(), 0.25, 0.5) } - } - }, - { - EffectID.ExCritDMG, - new() - { - { "excrd", Math.Clamp(Random.Shared.NextDouble(), 0.5, 1) } - } - }, - { - EffectID.ExATK2, - new() - { - { "exatk", Math.Clamp(Random.Shared.NextDouble(), 0.15, 0.3) } - } - }, - { - EffectID.RecoverHP, - new() - { - { "hp", Random.Shared.Next(160, 640) } - } - }, - { - EffectID.RecoverMP, - new() - { - { "mp", Random.Shared.Next(140, 490) } - } - }, - { - EffectID.RecoverHP2, - new() - { - { "hp", Math.Clamp(Random.Shared.NextDouble(), 0.04, 0.08) } - } - }, - { - EffectID.RecoverMP2, - new() - { - { "mp", Math.Clamp(Random.Shared.NextDouble(), 0.09, 0.18) } - } - }, - { - EffectID.GetEP, - new() - { - { "ep", Random.Shared.Next(20, 40) } - } - } - }; + { "exatk", Random.Shared.Next(40, 80) } + } + }, + { + EffectID.ExCritRate, + new() + { + { "excr", Math.Clamp(Random.Shared.NextDouble(), 0.25, 0.5) } + } + }, + { + EffectID.ExCritDMG, + new() + { + { "excrd", Math.Clamp(Random.Shared.NextDouble(), 0.5, 1) } + } + }, + { + EffectID.ExATK2, + new() + { + { "exatk", Math.Clamp(Random.Shared.NextDouble(), 0.15, 0.3) } + } + }, + { + EffectID.RecoverHP, + new() + { + { "hp", Random.Shared.Next(160, 640) } + } + }, + { + EffectID.RecoverMP, + new() + { + { "mp", Random.Shared.Next(140, 490) } + } + }, + { + EffectID.RecoverHP2, + new() + { + { "hp", Math.Clamp(Random.Shared.NextDouble(), 0.04, 0.08) } + } + }, + { + EffectID.RecoverMP2, + new() + { + { "mp", Math.Clamp(Random.Shared.NextDouble(), 0.09, 0.18) } + } + }, + { + EffectID.GetEP, + new() + { + { "ep", Random.Shared.Next(20, 40) } + } } - } + }; - public static Dictionary QuestList + public static Dictionary ContinuousQuestList { get; } = new() { - get { - return new() - { - { - "丢失的共享单车之谜", - "寻找被魔法传送走的共享单车。" - }, - { - "咖啡店的神秘顾客", - "调查每天都点奇怪饮品的神秘顾客。" - }, - { - "地铁里的幽灵乘客", - "找出在地铁里出没的半透明乘客。" - }, - { - "公园的精灵涂鸦", - "清除公园里突然出现的精灵涂鸦。" - }, - { - "手机信号的干扰源", - "找出干扰手机信号的魔法源头。" - }, - { - "外卖小哥的奇遇", - "帮助外卖小哥找回被偷走的魔法外卖。" - }, - { - "广场舞的魔法节奏", - "调查广场舞音乐中隐藏的魔法节奏。" - }, - { - "自动贩卖机的秘密", - "找出自动贩卖机里突然出现的奇怪物品。" - }, - { - "便利店的异次元入口", - "调查便利店里突然出现的异次元入口。" - }, - { - "街头艺人的魔法表演", - "调查街头艺人表演中使用的魔法。" - }, - { - "午夜电台的幽灵来电", - "调查午夜电台收到的奇怪来电。" - }, - { - "高楼大厦的秘密通道", - "寻找隐藏在高楼大厦里的秘密通道。" - }, - { - "城市下水道的神秘生物", - "调查城市下水道里出现的神秘生物。" - }, - { - "废弃工厂的魔法实验", - "调查废弃工厂里进行的秘密魔法实验。" - }, - { - "博物馆的活化雕像", - "调查博物馆里突然活化的雕像。" - }, - { - "公园的都市传说", - "调查公园里流传的都市传说。" - }, - { - "闹鬼公寓的真相", - "调查闹鬼公寓里的真相。" - }, - { - "地下酒吧的秘密交易", - "调查地下酒吧里进行的秘密魔法交易。" - }, - { - "旧书店的魔法书籍", - "寻找旧书店里隐藏的魔法书籍。" - }, - { - "涂鸦墙的预言", - "解读涂鸦墙上出现的神秘预言。" - }, - { - "黑客的魔法入侵", - "阻止黑客利用魔法入侵城市网络。" - }, - { - "高科技魔法装备的测试", - "测试新型的高科技魔法装备。" - }, - { - "无人机的魔法改造", - "改造无人机,使其拥有魔法能力。" - }, - { - "人工智能的觉醒", - "调查人工智能觉醒的原因。" - }, - { - "虚拟现实的魔法世界", - "探索虚拟现实中出现的魔法世界。" - }, - { - "智能家居的魔法故障", - "修复智能家居的魔法故障。" - }, - { - "能量饮料的魔法副作用", - "调查能量饮料的魔法副作用。" - }, - { - "社交媒体的魔法病毒", - "清除社交媒体上出现的魔法病毒。" - }, - { - "共享汽车的魔法漂移", - "调查共享汽车的魔法漂移现象。" - }, - { - "城市监控的魔法干扰", - "修复城市监控的魔法干扰。" - }, - { - "寻找丢失的魔法宠物", - "寻找在城市里走失的魔法宠物。" - }, - { - "参加魔法美食节", - "参加城市举办的魔法美食节。" - }, - { - "解开城市谜题", - "解开隐藏在城市各处的谜题。" - }, - { - "参加魔法cosplay大赛", - "参加城市举办的魔法cosplay大赛。" - }, - { - "寻找隐藏的魔法商店", - "寻找隐藏在城市里的魔法商店。" - }, - { - "制作魔法主题的街头艺术", - "在城市里创作魔法主题的街头艺术。" - }, - { - "举办一场魔法快闪活动", - "在城市里举办一场魔法快闪活动。" - }, - { - "寻找失落的魔法乐器", - "寻找失落的魔法乐器,让城市充满音乐。" - }, - { - "参加魔法运动会", - "参加城市举办的魔法运动会。" - }, - { - "拯救被困在魔法结界里的市民", - "拯救被困在城市魔法结界里的市民。" - } - }; + "悖论引擎的暗涌之息", + "穿梭于银辉城流淌液态月光的街道,侦测悖论引擎释放的异常能量潮汐,揭开可能撕裂现实结构的危险谜团。" + }, + { + "林海深处的记忆协奏曲", + "在瑟兰薇歌林海水晶化的树冠建立观测站,记录春季地貌重组时树木根系发出的低频共振波,破译其与旋律古龙苏醒周期的关联。" + }, + { + "元素裂隙的熵增警告", + "使用抗魔探针扫描赫菲斯托斯之喉第47层矿道,绘制元素裂缝的扩张轨迹,评估其引发位面坍缩的风险等级。" + }, + { + "时间琥珀中的战争回响", + "在永霜裂痕建立时滞力场实验室,分析冻结在冰壁中的古代战争幻象,还原时霜药剂对观察者认知体系的扭曲机制。" + }, + { + "镜像维度的认知污染", + "佩戴反重力拘束装置潜入千瞳镜湖,测绘镜像城的拓扑结构,警惕瞳孔状传送门对记忆模块的逆向写入现象。" + }, + { + "雷霆王座的符文解读", + "攀登雷霆王座山脉,记录裁决尖碑在月圆之夜投射的泰坦符文,破译其蕴含的宇宙法则。" + }, + { + "流沙时计的昨日寻踪", + "在流沙时计荒漠中寻找海市蜃楼般的昨日之城,收集散落在其中的时间碎片,还原历史真相。" + }, + { + "腐萤沼渊的共生调查", + "深入腐萤沼渊,研究共生母体的生态系统,记录菌类模仿动物叫声的频率和模式。" + }, + { + "苍穹碎屿的星锚校准", + "前往苍穹碎屿的星锚之地,校准引雷柱的能量输出,防止星空巨兽挣脱束缚。" + }, + { + "齿与血回廊的改造逆转", + "潜入齿与血回廊的造物车间,研究其改造机制,寻找逆转改造的方法。" + }, + { + "穹顶之泪的星辉观测", + "在穹顶之泪湖畔建立观测点,记录星辉水母群在午夜重构水体重力法则时的变化。" + }, + { + "齿轮坟场的构装残骸", + "在齿轮坟场搜寻构装巨龙的残骸,分析其动力核心,寻找上古机械文明的线索。" + }, + { + "回音棱镜林的记忆共鸣", + "进入回音棱镜林,收集晶体化红杉中储存的亡者记忆,调查影狼嚎叫产生的空间褶皱。" + }, + { + "永燃坩埚的活体金属", + "在永燃坩埚的火山灰中采集活体金属苔藓样本,研究其生长特性。" + }, + { + "骨桥深渊的幽灵航线", + "调查骨桥深渊的幽灵船航线,收集桥底虚空中的能量波动数据。" + }, + { + "时漏沙漠的时凝液", + "在时漏沙漠中寻找沙漏仙人掌,采集其分泌的时凝液,研究其时间魔法特性。" + }, + { + "脉轮圣树的蜜蜡编码", + "攀登脉轮圣树,收集树液凝结的可编程蜜蜡,分析其编码模式。" + }, + { + "悲鸣矿脉的神经宝石", + "在悲鸣矿脉中采集神经宝石样本,研究其与山体剧痛的关联。" + }, + { + "双生月崖的湮灭边界", + "在双生月崖的边界处进行实验,研究跨越永昼和永夜界限时产生的湮灭现象。" + }, + { + "谵妄海市的梦境碎片", + "进入谵妄海市,收集可食用梦境碎片,分析其对认知的影响。" } - } + }; - public static Dictionary DrawCardProbabilities + public static Dictionary ImmediateQuestList { get; } = new() { - get { - return new() - { - { QualityType.White, 69.53 }, - { QualityType.Green, 15.35 }, - { QualityType.Blue, 9.48 }, - { QualityType.Purple, 4.25 }, - { QualityType.Orange, 1.33 }, - { QualityType.Red, 0.06 } - }; + "星银警戒协议·弎级响应", + "星银合金守卫在悖论引擎周边暴走,形成包围核心区的杀戮矩阵,必须在三刻钟内解除警戒协议" + }, + { + "音律囚笼突破作战", + "苏醒的旋律古龙释放出高频震波,将精灵们困在水晶共振牢笼中,需在下次地貌重组前切断声波共鸣节点" + }, + { + "深渊火种收容危机", + "矿道底层的深渊火钻因元素污染进入链式裂变,引发全矿道魔能过载,立即部署熵减力场遏制反应" + }, + { + "时霜逆流救援行动", + "科研小组被困在加速百倍的时间泡内,其肉体正以肉眼可见的速度衰老,必须校准哨塔时钟恢复时间流速" + }, + { + "镜像侵蚀净化指令", + "镜像守卫突破湖面屏障入侵现实维度,携带的认知病毒正在改写物理法则,启动银辉城防卫协议实施净化" + }, + { + "雷霆风暴紧急预警", + "雷霆王座山脉的悬浮岩块因磁场紊乱开始崩塌,必须在半小时内稳定磁场。" + }, + { + "流沙陷阱救援行动", + "一支探险队被困在流沙时计荒漠的昨日之城中,必须在沙暴来临前将其救出。" + }, + { + "沼泽毒气泄漏警报", + "腐萤沼渊的毒气浓度超标,必须立即启动通风系统,防止毒气扩散。" + }, + { + "星空巨兽挣脱危机", + "苍穹碎屿的星锚之地出现裂缝,星空巨兽即将挣脱束缚,必须立即加固引雷柱。" + }, + { + "活体建筑暴走事件", + "齿与血回廊的活体建筑开始失控,必须立即关闭其动力系统。" + }, + { + "水母重力失控事件", + "穹顶之泪湖的星辉水母群重力法则失控,必须立即稳定水体。" + }, + { + "构装巨龙苏醒警报", + "齿轮坟场的构装巨龙开始苏醒,必须立即启动防御系统。" + }, + { + "记忆共鸣失控事件", + "回音棱镜林的记忆共鸣失控,引发空间褶皱,必须立即稳定空间。" + }, + { + "活体金属苔藓异变", + "永燃坩埚的活体金属苔藓发生异变,开始吞噬周围的金属,必须立即遏制。" + }, + { + "幽灵船袭击事件", + "骨桥深渊的幽灵船开始袭击过往的船只,必须立即击退。" + }, + { + "时之蝎暴走事件", + "时漏沙漠的时之蝎因时凝液泄漏而暴走,必须立即控制。" + }, + { + "蜜蜡编码泄露危机", + "脉轮圣树的可编程蜜蜡编码泄露,引发未知危机,必须立即阻止。" + }, + { + "神经宝石共鸣危机", + "悲鸣矿脉的神经宝石发生共鸣,引发山体震荡,必须立即稳定。" + }, + { + "湮灭风暴预警", + "双生月崖的湮灭边界出现不稳定,引发湮灭风暴,必须立即撤离。" + }, + { + "思维寄生虫感染事件", + "谵妄海市的思维寄生虫开始感染居民,必须立即隔离。" } - } + }; - public static Dictionary PriceRanges + public static Dictionary ProgressiveQuestList { get; } = new() { - get { - return new() - { - { QualityType.White, (200, 2000) }, - { QualityType.Green, (1500, 15000) }, - { QualityType.Blue, (5000, 50000) }, - { QualityType.Purple, (10000, 100000) }, - { QualityType.Orange, (40000, 400000) }, - { QualityType.Red, (100000, 1000000) }, - { QualityType.Gold, (500000, 5000000) } - }; + "月光萃取计划", + "在星银合金建筑的沟壑中采集 {0} 份液态月光(注意避开月光洪流的高潮时段/每夜丑时三刻)。" + }, + { + "灵脉汁液采收行动", + "使用抗腐蚀容器收集 {0} 份瑟兰薇歌林海的荧蓝汁液(树木自卫系统激活时汁液会转化为神经毒素)。" + }, + { + "火钻精炼协议", + "在矿工灵魂烙印的指引下获取 {0} 颗深渊火钻(未烙印者触碰火钻将引发元素爆燃)。" + }, + { + "时霜逆向工程", + "通过时间镜像收集 {0} 份不同历史断片的时霜药剂样本(注意时空回响对记忆的覆盖效应)。" + }, + { + "瞳孔密钥重构计划", + "从 {0} 个瞳孔状传送门提取量子纠缠碎片(每个采集点需保持镜像对称操作以避免维度塌缩)。" + }, + { + "泰坦符文拓印", + "在雷霆王座山脉的裁决尖碑上拓印 {0} 份不同的泰坦符文(注意避开雷暴时段/每逢子时)。" + }, + { + "时间碎片收集", + "在流沙时计荒漠的昨日之城中收集 {0} 份不同的时间碎片(注意时间碎片会随机重组)。" + }, + { + "共生母体样本采集", + "从腐萤沼渊的共生母体上采集 {0} 份不同的菌类样本(注意菌类会释放麻痹毒素)。" + }, + { + "星锚能量校准", + "在苍穹碎屿的星锚之地校准 {0} 个不同的引雷柱(注意引雷柱会释放高压电流)。" + }, + { + "改造逆转实验", + "在齿与血回廊的造物车间进行 {0} 次不同的改造逆转实验(注意改造实验会引发身体异变)。" + }, + { + "星辉水母观测记录", + "在穹顶之泪湖记录 {0} 次星辉水母重构水体重力法则的完整过程(注意水母重构时会产生重力波动)。" + }, + { + "构装巨龙残骸分析", + "在齿轮坟场分析 {0} 个不同的构装巨龙残骸(注意残骸可能带有自毁装置)。" + }, + { + "亡者记忆提取", + "在回音棱镜林提取 {0} 份不同的亡者记忆(注意记忆提取会引发共感)。" + }, + { + "活体金属苔藓培养", + "在永燃坩埚培养 {0} 份不同的活体金属苔藓样本(注意苔藓会吸收金属)。" + }, + { + "幽灵船能量分析", + "在骨桥深渊收集 {0} 份幽灵船的能量波动数据(注意幽灵船会释放虚空能量)。" + }, + { + "时凝液提纯", + "在时漏沙漠提纯 {0} 份时凝液(注意时凝液会加速时间流速)。" + }, + { + "蜜蜡编码破解", + "在脉轮圣树破解 {0} 份不同的蜜蜡编码(注意编码会引发精神干扰)。" + }, + { + "神经宝石能量分析", + "在悲鸣矿脉分析 {0} 份不同的神经宝石能量(注意宝石会引发山体剧痛)。" + }, + { + "湮灭边界观察", + "在双生月崖观察 {0} 次不同的湮灭边界现象(注意湮灭边界会吞噬物质)。" + }, + { + "梦境碎片分析", + "在谵妄海市分析 {0} 份不同的梦境碎片(注意梦境碎片会引发幻觉)。" } - } + }; + + public static List Regions { get; } = [ + new Region() + { + Id = 1, + Name = "银辉城", + Description = "悬浮在云海中的倒三角金属都市,建筑由星银合金铸造,街道流淌着液态月光。核心区藏有能改写现实法则的「悖论引擎」", + Weather = "晴朗", + Temperature = 20, + Difficulty = RarityType.TwoStar + }, + new Region() + { + Id = 2, + Name = "瑟兰薇歌林海", + Description = "树木枝干中流淌荧蓝汁液,春季行走重组地貌,冬季化为水晶雕塑。深处沉睡着被精灵封印的「旋律古龙」", + Weather = "多云", + Temperature = 15, + Difficulty = RarityType.FourStar + }, + new Region() + { + Id = 3, + Name = "赫菲斯托斯之喉", + Description = "螺旋向下的火山矿井,底层矿工开采深渊火钻,矿道会突然熔化成通往元素位面的裂缝", + Weather = "炎热", + Temperature = 45, + Difficulty = RarityType.FourStar + }, + new Region() + { + Id = 4, + Name = "永霜裂痕", + Description = "冰晶峡谷冻结着不同时代的战争残影,哨塔时钟随机倒转/加速,需服用「时霜药剂」保持神智", + Weather = "极寒", + Temperature = -25, + Difficulty = RarityType.FiveStar + }, + new Region() + { + Id = 5, + Name = "千瞳镜湖", + Description = "湖面倒影展现平行时空,潜入会进入重力颠倒的镜像城,湖底布满瞳孔状传送门", + Weather = "阴沉", + Temperature = 10, + Difficulty = RarityType.TwoStar + }, + new Region() + { + Id = 6, + Name = "雷霆王座山脉", + Description = "悬浮岩块组成的三维迷宫,最高峰「裁决尖碑」在月圆之夜投射出泰坦调试世界的符文", + Weather = "雷暴", + Temperature = 5, + Difficulty = RarityType.FourStar + }, + new Region() + { + Id = 7, + Name = "流沙时计荒漠", + Description = "沙粒蕴含时间魔法,沙丘每小时重组地形,沙暴中会出现海市蜃楼般的「昨日之城」", + Weather = "沙尘暴", + Temperature = 35, + Difficulty = RarityType.ThreeStar + }, + new Region() + { + Id = 8, + Name = "腐萤沼渊", + Description = "荧光毒气沼泽,中心生长直径三公里的脑状肉瘤「共生母体」,菌类模仿动物叫声诱捕猎物", + Weather = "潮湿", + Temperature = 22, + Difficulty = RarityType.OneStar + }, + new Region() + { + Id = 9, + Name = "苍穹碎屿", + Description = "破碎天穹形成的浮空岛群,「星锚之地」竖立着束缚星空巨兽的引雷柱", + Weather = "晴朗", + Temperature = 18, + Difficulty = RarityType.ThreeStar + }, + new Region() + { + Id = 10, + Name = "齿与血回廊", + Description = "自我扩建的活体建筑群,齿轮血管输送液态魔力,「造物车间」会强制改造闯入者", + Weather = "阴暗", + Temperature = 12, + Difficulty = RarityType.FiveStar + }, + new Region() + { + Id = 11, + Name = "穹顶之泪湖", + Description = "破碎天穹下的倒影湖泊,折射多维星空,星辉水母群午夜重构水体重力法则", + Weather = "星光", + Temperature = 16, + Difficulty = RarityType.OneStar + }, + new Region() + { + Id = 12, + Name = "齿轮坟场", + Description = "堆积上古机械文明的金属荒漠,沙粒为微缩齿轮,构装巨龙在沙暴中游荡", + Weather = "沙尘", + Temperature = 30, + Difficulty = RarityType.ThreeStar + }, + new Region() + { + Id = 13, + Name = "回音棱镜林", + Description = "晶体化红杉储存亡者记忆,荧光孢子引发共感,影狼嚎叫产生空间褶皱", + Weather = "雾气", + Temperature = 14, + Difficulty = RarityType.FourStar + }, + new Region() + { + Id = 14, + Name = "永燃坩埚", + Description = "岩浆海上的球形锻造都市,岩浆鱿鱼游弋街道,火山灰培育活体金属苔藓", + Weather = "高温", + Temperature = 60, + Difficulty = RarityType.FiveStar + }, + new Region() + { + Id = 15, + Name = "骨桥深渊", + Description = "巨型骸骨形成的呼吸桥梁,幽灵船在桥底虚空航行,骸骨寄生神经蕨类", + Weather = "阴森", + Temperature = 8, + Difficulty = RarityType.ThreeStar + }, + new Region() + { + Id = 16, + Name = "时漏沙漠", + Description = "时间碎片组成的流沙领域,时之蝎加速局部时间,沙漏仙人掌分泌时凝液", + Weather = "不稳定", + Temperature = 38, + Difficulty = RarityType.TwoStar + }, + new Region() + { + Id = 17, + Name = "脉轮圣树", + Description = "树干直径十公里的螺旋巨树,年轮是立体城市,树液凝结可编程蜜蜡", + Weather = "晴朗", + Temperature = 24, + Difficulty = RarityType.ThreeStar + }, + new Region() + { + Id = 18, + Name = "悲鸣矿脉", + Description = "岩层嵌满神经宝石的活体矿山,开采引发山体剧痛,晶簇守卫实体化巡逻", + Weather = "幽暗", + Temperature = 10, + Difficulty = RarityType.FourStar + }, + new Region() + { + Id = 19, + Name = "双生月崖", + Description = "撕裂的悬浮山脉,永昼侧栖光鹰,永夜侧绽影玫瑰,跨越界限触发湮灭", + Weather = "昼夜交替", + Temperature = 15, + Difficulty = RarityType.FiveStar + }, + new Region() + { + Id = 20, + Name = "谵妄海市", + Description = "需认知干扰剂进入的幻觉城市,思维寄生虫伪装市民,贩卖可食用梦境碎片", + Weather = "迷幻", + Temperature = 20, + Difficulty = RarityType.FourStar + } + ]; + + public static Dictionary DrawCardProbabilities { get; } = new() + { + { QualityType.White, 69.53 }, + { QualityType.Green, 15.35 }, + { QualityType.Blue, 9.48 }, + { QualityType.Purple, 4.25 }, + { QualityType.Orange, 1.33 }, + { QualityType.Red, 0.06 } + }; + + public static Dictionary PriceRanges { get; } = new() + { + { QualityType.White, (200, 2000) }, + { QualityType.Green, (1500, 15000) }, + { QualityType.Blue, (5000, 50000) }, + { QualityType.Purple, (10000, 100000) }, + { QualityType.Orange, (40000, 400000) }, + { QualityType.Red, (100000, 1000000) }, + { QualityType.Gold, (500000, 5000000) } + }; public static string[] CommonSurnames { get; } = [ "顾", "沈", "陆", "楚", "白", "苏", "叶", "萧", "莫", "司马", "欧阳", - "上官", "慕容", "尉迟", "司徒", "轩辕", "端木", "南宫", "长孙", "百里", - "东方", "西门", "独孤", "公孙", "令狐", "宇文", "夏侯", "赫连", "皇甫", - "北堂", "安陵", "东篱", "花容", "夜", "柳", "云", "凌", "寒", "龙", - "凤", "蓝", "冷", "华", "蓝夜", "叶南", "墨", "君", "月", "子车", - "澹台", "钟离", "公羊", "闾丘", "仲孙", "司空", "羊舌", "亓官", "公冶", - "濮阳", "独月", "南风", "凤栖", "南门", "姬", "闻人", "花怜", "若", - "紫", "卿", "微", "清", "易", "月华", "霜", "兰", "岑", "语", "雪", - "夜阑", "梦", "洛", "江", "黎", "夜北", "唐", "水", "韩", "庄", - "夜雪", "夜凌", "君临", "青冥", "漠然", "林", "青", "岑", "容", - "墨", "柏", "安", "晏", "尉", "南", "轩", "竹", "晨", "桓", "晖", - "瑾", "溪", "汐", "沐", "玉", "汀", "归", "羽", "颜", "辰", "琦", - "芷", "尹", "施", "原", "孟", "尧", "荀", "单", "简", "植", "傅", - "司", "钟", "方", "谢" + "上官", "慕容", "尉迟", "司徒", "轩辕", "端木", "南宫", "长孙", "百里", + "东方", "西门", "独孤", "公孙", "令狐", "宇文", "夏侯", "赫连", "皇甫", + "北堂", "安陵", "东篱", "花容", "夜", "柳", "云", "凌", "寒", "龙", + "凤", "蓝", "冷", "华", "蓝夜", "叶南", "墨", "君", "月", "子车", + "澹台", "钟离", "公羊", "闾丘", "仲孙", "司空", "羊舌", "亓官", "公冶", + "濮阳", "独月", "南风", "凤栖", "南门", "姬", "闻人", "花怜", "若", + "紫", "卿", "微", "清", "易", "月华", "霜", "兰", "岑", "语", "雪", + "夜阑", "梦", "洛", "江", "黎", "夜北", "唐", "水", "韩", "庄", + "夜雪", "夜凌", "君临", "青冥", "漠然", "林", "青", "岑", "容", + "墨", "柏", "安", "晏", "尉", "南", "轩", "竹", "晨", "桓", "晖", + "瑾", "溪", "汐", "沐", "玉", "汀", "归", "羽", "颜", "辰", "琦", + "芷", "尹", "施", "原", "孟", "尧", "荀", "单", "简", "植", "傅", + "司", "钟", "方", "谢", + "赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "卫", "蒋", "沈", "韩", + "杨", "朱", "秦", "许", "何", "吕", "张", "孔", "曹", "严", "华", "金", "魏", "陶", + "姜", "谢", "罗", "徐", "林", "范", "方", "唐", "柳", "宋", "元", "萧", "程", "陆", + "顾", "楚", "白", "苏", "叶", "萧", "莫", "凌", "寒", "龙", "凤", "蓝", "冷", "华", + "唐", "韩", "庄", "青", "安", "晏", "尹", "施", "孟", "荀", "傅", "钟", "方", "谢", + "司马", "欧阳", "上官", "慕容", "尉迟", "司徒", "轩辕", "端木", "南宫", "长孙", + "百里", "东方", "西门", "独孤", "公孙", "令狐", "宇文", "夏侯", "赫连", "皇甫", + "墨", "君", "月", "紫", "卿", "微", "清", "易", "霜", "兰", "语", "雪", "璃", + "镜", "弦", "珏", "瑾", "璇", "绯", "霁", "溟", "澈", "归", "羽", "辰", "芷", + "风", "花", "江", "河", "湖", "海", "山", "川", "松", "竹", "梅", "菊", "枫", + "梧", "泉", "溪", "岚", "雾", "露", "霓", "霰", "星", "辰", + "沧", "溟", "无", "绝", "孤", "隐", "斩", "破", "惊", "鸿", "御", "玄", "冥", + "烬", "夙", "离", + "东篱", "南笙", "西楼", "北冥", "九歌", "长离", "扶摇", "青丘", "凌霄", "重光", + "子车", "亓官", "巫马", "拓跋", "叱干", "斛律", "沮渠", "秃发", "万俟", "仆固" ]; public static string CommonChineseCharacters { get; } = diff --git a/OshimaServers/Service/FunGameService.cs b/OshimaServers/Service/FunGameService.cs index c570fab..c41c7fa 100644 --- a/OshimaServers/Service/FunGameService.cs +++ b/OshimaServers/Service/FunGameService.cs @@ -47,7 +47,7 @@ namespace Oshima.FunGame.OshimaServers.Service FunGameConstant.Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4)); FunGameConstant.Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书(), new 升华之印(), new 流光之印(), new 永恒之印(), new 技能卷轴(), new 智慧之果(), new 奥术符文(), new 混沌之核(), - new 小回复药(), new 中回复药(), new 大回复药(), new 魔力填充剂1(), new 魔力填充剂2(), new 魔力填充剂3(), new 能量饮料1(), new 能量饮料2(), new 能量饮料3()]); + new 小回复药(), new 中回复药(), new 大回复药(), new 魔力填充剂1(), new 魔力填充剂2(), new 魔力填充剂3(), new 能量饮料1(), new 能量饮料2(), new 能量饮料3(), new 年夜饭(), new 蛇年大吉(), new 新春快乐()]); FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment); FunGameConstant.AllItems.AddRange(FunGameConstant.Items); @@ -1052,6 +1052,53 @@ namespace Oshima.FunGame.OshimaServers.Service public static bool UseItemCustom(Item item, User user, IEnumerable targets, out string msg) { msg = ""; + if (item.ItemType == ItemType.GiftBox) + { + if (item is 礼包.GiftBox box && box.Gifts.Count > 0) + { + foreach (string name in box.Gifts.Keys) + { + if (name == General.GameplayEquilibriumConstant.InGameCurrency) + { + user.Inventory.Credits += box.Gifts[name]; + } + if (name == General.GameplayEquilibriumConstant.InGameMaterial) + { + user.Inventory.Materials += box.Gifts[name]; + } + if (FunGameConstant.AllItems.FirstOrDefault(i => i.Name == name) is Item currentItem) + { + for (int i = 0; i < box.Gifts[name]; i++) + { + Item newItem = currentItem.Copy(); + SetSellAndTradeTime(newItem); + newItem.User = user; + user.Inventory.Items.Add(newItem); + } + } + } + msg = "打开礼包成功!获得了以下物品:\r\n" + string.Join(",", box.Gifts.Select(kv => $"{kv.Key} * {kv.Value}")); + if (item.Name == nameof(年夜饭)) + { + msg += "\r\n" + "热腾腾的除夕年夜饭,祝您阖家团圆,年味浓浓!"; + } + else if (item.Name == nameof(蛇年大吉)) + { + msg += "\r\n" + "金蛇送福,好运连连!!"; + } + else if (item.Name == nameof(新春快乐)) + { + msg += "\r\n" + "新春纳福,喜乐安康!!"; + } + item.RemainUseTimes--; + if (item.RemainUseTimes < 0) item.RemainUseTimes = 0; + if (item.RemainUseTimes == 0) + { + user.Inventory.Items.Remove(item); + } + return true; + } + } switch (item.Name) { default: @@ -1213,7 +1260,7 @@ namespace Oshima.FunGame.OshimaServers.Service { int nowIndex = Bosses.Count > 0 ? Bosses.Keys.Max() + 1 : 1; string bossName = GenerateRandomChineseUserName(); - Character boss = new CustomCharacter(nowIndex, bossName, "", bossName); + CustomCharacter boss = new(nowIndex, bossName, "", bossName); int cutRate = Random.Shared.Next(3) switch { 0 => 1, @@ -1324,6 +1371,7 @@ namespace Oshima.FunGame.OshimaServers.Service boss.Skills.Add(super); boss.Recovery(); + boss.SetPrimaryAttribute(); Bosses[nowIndex] = boss; } @@ -1428,41 +1476,110 @@ namespace Oshima.FunGame.OshimaServers.Service // 生成任务 for (int i = 0; i < 6; i++) { - int minutes = Random.Shared.Next(10, 41); - Dictionary items = []; - items[General.GameplayEquilibriumConstant.InGameCurrency] = minutes * 20; - items[General.GameplayEquilibriumConstant.InGameMaterial] = minutes / 8 * 1; - int index = Random.Shared.Next(FunGameConstant.AllItems.Count); - Item item = FunGameConstant.AllItems[index]; - items.Add(item.Name, 1); - while (true) + QuestType type = (QuestType)Random.Shared.Next(3); + long id = quests.Count > 0 ? quests.Values.Max(q => q.Id) + 1 : 1; + + Quest quest; + if (type == QuestType.Continuous) { - int index2 = Random.Shared.Next(FunGameConstant.AllItems.Count); - if (index2 != index) + string name = FunGameConstant.ContinuousQuestList.Keys.OrderBy(o => Random.Shared.Next()).First(); + int minutes = Random.Shared.Next(10, 41); + HashSet items = []; + Dictionary itemsCount = []; + int index = Random.Shared.Next(FunGameConstant.AllItems.Count); + Item item = FunGameConstant.AllItems[index]; + items.Add(item); + itemsCount[item.Name] = 1; + index = Random.Shared.Next(FunGameConstant.AllItems.Count); + Item item2 = FunGameConstant.AllItems[index]; + items.Add(item2); + if (!itemsCount.TryAdd(item2.Name, 1)) { - Item item2 = FunGameConstant.AllItems[index2]; - items.Add(item2.Name, 1); - break; + itemsCount[item2.Name]++; } + quest = new() + { + Id = id, + Name = name, + Description = FunGameConstant.ContinuousQuestList[name], + QuestType = QuestType.Continuous, + EstimatedMinutes = minutes, + CreditsAward = minutes * 20, + MaterialsAward = minutes / 8 * 1, + Awards = items, + AwardsCount = itemsCount + }; } - string name = FunGameConstant.QuestList.Keys.OrderBy(o => Random.Shared.Next()).First(); - Quest quest = new() + else if (type == QuestType.Immediate) { - Id = quests.Count > 0 ? quests.Values.Max(q => q.Id) + 1 : 1, - Name = name, - Description = FunGameConstant.QuestList[name], - EstimatedMinutes = minutes, - Awards = items - }; + string name = FunGameConstant.ImmediateQuestList.Keys.OrderBy(o => Random.Shared.Next()).First(); + int difficulty = Random.Shared.Next(3, 11); + HashSet items = []; + Dictionary itemsCount = []; + int index = Random.Shared.Next(FunGameConstant.AllItems.Count); + Item item = FunGameConstant.AllItems[index]; + items.Add(item); + itemsCount[item.Name] = 1; + index = Random.Shared.Next(FunGameConstant.AllItems.Count); + Item item2 = FunGameConstant.AllItems[index]; + items.Add(item2); + if (!itemsCount.TryAdd(item2.Name, 1)) + { + itemsCount[item2.Name]++; + } + quest = new() + { + Id = id, + Name = name, + Description = FunGameConstant.ImmediateQuestList[name], + QuestType = QuestType.Immediate, + CreditsAward = difficulty * 80, + MaterialsAward = difficulty / 2 * 1, + Awards = items, + AwardsCount = itemsCount + }; + } + else + { + string name = FunGameConstant.ProgressiveQuestList.Keys.OrderBy(o => Random.Shared.Next()).First(); + int maxProgress = Random.Shared.Next(3, 11); + HashSet items = []; + Dictionary itemsCount = []; + int index = Random.Shared.Next(FunGameConstant.AllItems.Count); + Item item = FunGameConstant.AllItems[index]; + items.Add(item); + itemsCount[item.Name] = 1; + index = Random.Shared.Next(FunGameConstant.AllItems.Count); + Item item2 = FunGameConstant.AllItems[index]; + items.Add(item2); + if (!itemsCount.TryAdd(item2.Name, 1)) + { + itemsCount[item2.Name]++; + } + quest = new() + { + Id = id, + Name = name, + Description = string.Format(FunGameConstant.ProgressiveQuestList[name], maxProgress), + QuestType = QuestType.Progressive, + Progress = 0, + MaxProgress = maxProgress, + CreditsAward = maxProgress * 80, + MaterialsAward = maxProgress / 2 * 1, + Awards = items, + AwardsCount = itemsCount + }; + } + quests.Add(quest.GetIdName(), quest); } - return "☆--- 今日任务列表 ---☆\r\n" + string.Join("\r\n", quests.Values.Select(q => q.ToString())) + "\r\n温馨提示:请务必在次日 4:00 前完成任务结算,未结算的任务都会被取消!"; + return "☆--- 今日任务列表 ---☆\r\n" + string.Join("\r\n", quests.Values.Select(q => q.ToString())) + "\r\n温馨提示:使用【做任务+任务序号】指令来进行任务。\r\n请务必在次日 4:00 前完成任务结算,未结算的任务都会被取消!"; } else { if (quests.Count > 0) { - return "☆--- 今日任务列表 ---☆\r\n" + string.Join("\r\n", quests.Values.Select(q => q.ToString())) + "\r\n温馨提示:请务必在次日 4:00 前完成任务结算,未结算的任务都会被取消!"; + return "☆--- 今日任务列表 ---☆\r\n" + string.Join("\r\n", quests.Values.Select(q => q.ToString())) + "\r\n温馨提示:使用【做任务+任务序号】指令来进行任务。\r\n请务必在次日 4:00 前完成任务结算,未结算的任务都会被取消!"; } else { @@ -1488,26 +1605,32 @@ namespace Oshima.FunGame.OshimaServers.Service { quest.Status = QuestState.Settled; quest.SettleTime = DateTime.Now; - foreach (string name in quest.Awards.Keys) + if (quest.CreditsAward > 0) { - if (name == General.GameplayEquilibriumConstant.InGameCurrency) + user.Inventory.Credits += quest.CreditsAward; + } + if (quest.MaterialsAward > 0) + { + user.Inventory.Materials += quest.MaterialsAward; + } + foreach (Item item in quest.Awards) + { + if (quest.AwardsCount.TryGetValue(item.Name, out int qty)) { - user.Inventory.Credits += quest.Awards[name]; - } - else if (name == General.GameplayEquilibriumConstant.InGameMaterial) - { - user.Inventory.Materials += quest.Awards[name]; - } - else if (FunGameConstant.AllItems.FirstOrDefault(i => i.Name == name) is Item item) - { - Item newItem = item.Copy(); - newItem.User = user; - SetSellAndTradeTime(newItem); - user.Inventory.Items.Add(newItem); + for (int i = 0; i < qty; i++) + { + if (FunGameConstant.AllItems.FirstOrDefault(i => i.Name == item.Name) != null) + { + Item newItem = item.Copy(); + newItem.User = user; + SetSellAndTradeTime(newItem); + user.Inventory.Items.Add(newItem); + } + } } } TaskUtility.NewTask(async () => await AnonymousServer.PushMessageToClients(user.AutoKey, $"FunGame Web API 推送:你的任务【{quest.Name}】已结算," + - $"获得奖励:【{string.Join(",", quest.Awards.Select(kv => kv.Key + " * " + kv.Value))}】!")); + $"获得奖励:【{quest.AwardsString}】!")); result = true; } return result; @@ -1531,7 +1654,7 @@ namespace Oshima.FunGame.OshimaServers.Service double price = Random.Shared.Next(min, max); if (price == 0) { - price = (Random.Shared.NextDouble() + 0.1) * Random.Shared.Next(1000, 10000) * Random.Shared.Next((int)item.QualityType + 2, 6 + ((int)item.QualityType)); + price = (Random.Shared.NextDouble() + 0.1) * Random.Shared.Next(1000, 5000) * Random.Shared.Next((int)item.QualityType + 2, 6 + ((int)item.QualityType)); } item.Price = Calculation.Round2Digits(price); daily.AddItem(item, Random.Shared.Next(1, 3)); diff --git a/OshimaWebAPI/Controllers/FunGameController.cs b/OshimaWebAPI/Controllers/FunGameController.cs index fea5a0e..dbf097c 100644 --- a/OshimaWebAPI/Controllers/FunGameController.cs +++ b/OshimaWebAPI/Controllers/FunGameController.cs @@ -505,28 +505,29 @@ namespace Oshima.FunGame.WebAPI.Controllers [HttpPost("restoresaved")] public string RestoreSaved([FromQuery] long? uid = null) { - long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + //long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); - PluginConfig pc = new("saved", userid.ToString()); - pc.LoadConfig(); + //PluginConfig pc = new("saved", userid.ToString()); + //pc.LoadConfig(); - if (pc.Count > 0) - { - User user = FunGameService.GetUser(pc); - user.Inventory.Credits = 5000; - user.Inventory.Materials = 0; - user.Inventory.Characters.Clear(); - user.Inventory.Items.Clear(); - user.Inventory.Characters.Add(new CustomCharacter(FunGameConstant.CustomCharacterId, user.Username)); - user.LastTime = DateTime.Now; - pc.Add("user", user); - pc.SaveConfig(); - return NetworkUtility.JsonSerialize($"你的存档已还原成功。"); - } - else - { - return NetworkUtility.JsonSerialize(noSaved); - } + //if (pc.Count > 0) + //{ + // User user = FunGameService.GetUser(pc); + // user.Inventory.Credits = 5000; + // user.Inventory.Materials = 0; + // user.Inventory.Characters.Clear(); + // user.Inventory.Items.Clear(); + // user.Inventory.Characters.Add(new CustomCharacter(FunGameConstant.CustomCharacterId, user.Username)); + // user.LastTime = DateTime.Now; + // pc.Add("user", user); + // pc.SaveConfig(); + // return NetworkUtility.JsonSerialize($"你的存档已还原成功。"); + //} + //else + //{ + // return NetworkUtility.JsonSerialize(noSaved); + //} + return NetworkUtility.JsonSerialize($"此功能维护中。"); } [HttpPost("showsaved")] @@ -543,6 +544,7 @@ namespace Oshima.FunGame.WebAPI.Controllers StringBuilder builder = new(); builder.AppendLine($"☆★☆ {user.Username}的存档信息 ☆★☆"); + builder.AppendLine($"UID:{user.Id}"); builder.AppendLine($"{General.GameplayEquilibriumConstant.InGameCurrency}:{user.Inventory.Credits:0.00}"); builder.AppendLine($"{General.GameplayEquilibriumConstant.InGameMaterial}:{user.Inventory.Materials:0.00}"); builder.AppendLine($"角色数量:{user.Inventory.Characters.Count}"); @@ -650,12 +652,18 @@ namespace Oshima.FunGame.WebAPI.Controllers if (user.Inventory.Characters.FirstOrDefault(c => c.Id == FunGameConstant.CustomCharacterId) is Character character) { PrimaryAttribute oldPA = character.PrimaryAttribute; + double oldHP = character.InitialHP; + double oldMP = character.InitialMP; + double oldATK = character.InitialATK; double oldSTR = character.InitialSTR; double oldAGI = character.InitialAGI; double oldINT = character.InitialINT; double oldSTRG = character.STRGrowth; double oldAGIG = character.AGIGrowth; double oldINTG = character.INTGrowth; + double oldSPD = character.InitialSPD; + double oldHR = character.InitialHR; + double oldMR = character.InitialMR; Character? newCustom = emc.Count > 0 ? emc.Get("newCustom") : null; if (isConfirm) @@ -663,12 +671,18 @@ namespace Oshima.FunGame.WebAPI.Controllers if (newCustom != null) { character.PrimaryAttribute = newCustom.PrimaryAttribute; + character.InitialHP = newCustom.InitialHP; + character.InitialMP = newCustom.InitialMP; + character.InitialATK = newCustom.InitialATK; character.InitialSTR = newCustom.InitialSTR; character.InitialAGI = newCustom.InitialAGI; character.InitialINT = newCustom.InitialINT; character.STRGrowth = newCustom.STRGrowth; character.AGIGrowth = newCustom.AGIGrowth; character.INTGrowth = newCustom.INTGrowth; + character.InitialSPD = newCustom.InitialSPD; + character.InitialHR = newCustom.InitialHR; + character.InitialMR = newCustom.InitialMR; user.LastTime = DateTime.Now; pc.Add("user", user); pc.SaveConfig(); @@ -676,9 +690,15 @@ namespace Oshima.FunGame.WebAPI.Controllers emc.SaveConfig(); return NetworkUtility.JsonSerialize($"你已完成重随属性确认,新的自建角色属性如下:\r\n" + $"核心属性:{CharacterSet.GetPrimaryAttributeName(oldPA)} => {CharacterSet.GetPrimaryAttributeName(character.PrimaryAttribute)}\r\n" + + $"初始生命:{oldHP} => {character.InitialHP}\r\n" + + $"初始魔法:{oldMP} => {character.InitialMP}\r\n" + + $"初始攻击:{oldATK} => {character.InitialATK}\r\n" + $"初始力量:{oldSTR}(+{oldSTRG}/Lv)=> {character.InitialSTR}(+{character.STRGrowth}/Lv)\r\n" + $"初始敏捷:{oldAGI}(+{oldAGIG}/Lv)=> {character.InitialAGI}(+{character.AGIGrowth}/Lv)\r\n" + - $"初始智力:{oldINT}(+{oldINTG}/Lv)=> {character.InitialINT}(+{character.INTGrowth}/Lv)"); + $"初始智力:{oldINT}(+{oldINTG}/Lv)=> {character.InitialINT}(+{character.INTGrowth}/Lv)\r\n" + + $"初始速度:{oldSPD} => {character.InitialSPD}\r\n" + + $"生命回复:{oldHR} => {character.InitialHR}\r\n" + + $"魔法回复:{oldMR} => {character.InitialMR}\r\n"); } else { @@ -699,6 +719,10 @@ namespace Oshima.FunGame.WebAPI.Controllers return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameMaterial}不足 {reduce} 呢,无法重随自建角色属性!"); } newCustom = new CustomCharacter(FunGameConstant.CustomCharacterId, ""); + if (newCustom is CustomCharacter temp) + { + temp.SetPrimaryAttribute(); + } user.LastTime = DateTime.Now; pc.Add("user", user); pc.SaveConfig(); @@ -706,18 +730,30 @@ namespace Oshima.FunGame.WebAPI.Controllers emc.SaveConfig(); return NetworkUtility.JsonSerialize($"消耗 {reduce} {General.GameplayEquilibriumConstant.InGameMaterial},获取到重随属性预览如下:\r\n" + $"核心属性:{CharacterSet.GetPrimaryAttributeName(oldPA)} => {CharacterSet.GetPrimaryAttributeName(newCustom.PrimaryAttribute)}\r\n" + + $"初始生命:{oldHP} => {newCustom.InitialHP}\r\n" + + $"初始魔法:{oldMP} => {newCustom.InitialMP}\r\n" + + $"初始攻击:{oldATK} => {newCustom.InitialATK}\r\n" + $"初始力量:{oldSTR}(+{oldSTRG}/Lv)=> {newCustom.InitialSTR}(+{newCustom.STRGrowth}/Lv)\r\n" + $"初始敏捷:{oldAGI}(+{oldAGIG}/Lv)=> {newCustom.InitialAGI}(+{newCustom.AGIGrowth}/Lv)\r\n" + $"初始智力:{oldINT}(+{oldINTG}/Lv)=> {newCustom.InitialINT}(+{newCustom.INTGrowth}/Lv)\r\n" + + $"初始速度:{oldSPD} => {newCustom.InitialSPD}\r\n" + + $"生命回复:{oldHR} => {newCustom.InitialHR}\r\n" + + $"魔法回复:{oldMR} => {newCustom.InitialMR}\r\n" + $"请发送【确认角色重随】来确认更新,或者发送【取消角色重随】来取消操作。"); } else if (newCustom.Id == FunGameConstant.CustomCharacterId) { return NetworkUtility.JsonSerialize($"你已经有一个待确认的重随属性如下:\r\n" + $"核心属性:{CharacterSet.GetPrimaryAttributeName(oldPA)} => {CharacterSet.GetPrimaryAttributeName(newCustom.PrimaryAttribute)}\r\n" + + $"初始生命:{oldHP} => {newCustom.InitialHP}\r\n" + + $"初始魔法:{oldMP} => {newCustom.InitialMP}\r\n" + + $"初始攻击:{oldATK} => {newCustom.InitialATK}\r\n" + $"初始力量:{oldSTR}(+{oldSTRG}/Lv)=> {newCustom.InitialSTR}(+{newCustom.STRGrowth}/Lv)\r\n" + $"初始敏捷:{oldAGI}(+{oldAGIG}/Lv)=> {newCustom.InitialAGI}(+{newCustom.AGIGrowth}/Lv)\r\n" + - $"初始智力:{oldINT}(+{oldINTG}/Lv)=> {newCustom.InitialINT}(+{newCustom.INTGrowth}/Lv)\r\n"+ + $"初始智力:{oldINT}(+{oldINTG}/Lv)=> {newCustom.InitialINT}(+{newCustom.INTGrowth}/Lv)\r\n" + + $"初始速度:{oldSPD} => {newCustom.InitialSPD}\r\n" + + $"生命回复:{oldHR} => {newCustom.InitialHR}\r\n" + + $"魔法回复:{oldMR} => {newCustom.InitialMR}\r\n" + $"请发送【确认角色重随】来确认更新,或者发送【取消角色重随】来取消操作。"); } else @@ -806,19 +842,19 @@ namespace Oshima.FunGame.WebAPI.Controllers List characters = [.. user.Inventory.Characters]; List items = [.. user.Inventory.Items]; int total = characters.Count + items.Count; - int maxPage = (int)Math.Ceiling((double)total / 10); + int maxPage = (int)Math.Ceiling((double)total / FunGameConstant.ItemsPerPage2); if (maxPage < 1) maxPage = 1; if (showPage <= maxPage) { List inventory = [.. characters, .. items]; Dictionary dict = inventory.Select((obj, index) => new { Index = index + 1, Value = obj }).ToDictionary(k => k.Index, v => v.Value); - List seq = [.. FunGameService.GetPage(dict.Keys, showPage, 10)]; + List seq = [.. FunGameService.GetPage(dict.Keys, showPage, FunGameConstant.ItemsPerPage2)]; bool showCharacter = true; bool showItem = true; int characterCount = 0; int itemCount = 0; - int prevSequence = dict.Take((showPage - 1) * 10).Count(); + int prevSequence = dict.Take((showPage - 1) * FunGameConstant.ItemsPerPage2).Count(); foreach (int index in seq) { @@ -917,11 +953,11 @@ namespace Oshima.FunGame.WebAPI.Controllers } } - int maxPage = (int)Math.Ceiling((double)itemCategory.Count / 10); + int maxPage = (int)Math.Ceiling((double)itemCategory.Count / FunGameConstant.ItemsPerPage1); if (maxPage < 1) maxPage = 1; if (showPage <= maxPage) { - List keys = [.. FunGameService.GetPage(itemCategory.Keys, showPage, 10)]; + List keys = [.. FunGameService.GetPage(itemCategory.Keys, showPage, FunGameConstant.ItemsPerPage1)]; int itemCount = 0; list.Add("======= 物品 ======="); foreach (string key in keys) @@ -936,10 +972,31 @@ namespace Oshima.FunGame.WebAPI.Controllers { itemsIndex = string.Join(",", objs.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; } + IEnumerable itemsEquipable = objs.Where(i => i.IsEquipment && i.Character is null); + string itemsEquipableIndex = string.Join(",", itemsEquipable.Select(i => items.IndexOf(i) + 1)); + if (itemsEquipable.Count() > 10) + { + itemsEquipableIndex = string.Join(",", itemsEquipable.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; + } + IEnumerable itemsSellable = objs.Where(i => i.IsSellable); + string itemsSellableIndex = string.Join(",", itemsSellable.Select(i => items.IndexOf(i) + 1)); + if (itemsSellable.Count() > 10) + { + itemsSellableIndex = string.Join(",", itemsSellable.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; + } + IEnumerable itemsTradable = objs.Where(i => i.IsTradable); + string itemsTradableIndex = string.Join(",", itemsTradable.Select(i => items.IndexOf(i) + 1)); + if (itemsTradable.Count() > 10) + { + itemsTradableIndex = string.Join(",", itemsTradable.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; + } str += $"物品序号:{itemsIndex}\r\n"; - str += $"拥有数量:{objs.Count}(" + (first.IsEquipment ? $"可装备数量:{objs.Count(i => i.Character is null)}," : "") + + if (itemsEquipableIndex != "") str += $"可装备序号:{itemsEquipableIndex}\r\n"; + if (itemsSellableIndex != "") str += $"可出售序号:{itemsSellableIndex}\r\n"; + if (itemsTradableIndex != "") str += $"可交易序号:{itemsTradableIndex}\r\n"; + str += $"拥有数量:{objs.Count}(" + (first.IsEquipment ? $"可装备数量:{itemsEquipable.Count()}," : "") + (FunGameConstant.ItemCanUsed.Contains(first.ItemType) ? $"可使用数量:{objs.Count(i => i.RemainUseTimes > 0)}," : "") + - $"可出售数量:{objs.Count(i => i.IsSellable)},可交易数量:{objs.Count(i => i.IsTradable)})"; + $"可出售数量:{itemsSellable.Count()},可交易数量:{itemsTradable.Count()})"; list.Add(str); } list.Add($"页数:{showPage} / {maxPage}"); @@ -1002,11 +1059,11 @@ namespace Oshima.FunGame.WebAPI.Controllers } } - int maxPage = (int)Math.Ceiling((double)itemCategory.Count / 10); + int maxPage = (int)Math.Ceiling((double)itemCategory.Count / FunGameConstant.ItemsPerPage1); if (maxPage < 1) maxPage = 1; if (showPage <= maxPage) { - List keys = [.. FunGameService.GetPage(itemCategory.Keys, showPage, 10)]; + List keys = [.. FunGameService.GetPage(itemCategory.Keys, showPage, FunGameConstant.ItemsPerPage1)]; int itemCount = 0; list.Add($"======= {ItemSet.GetItemTypeName((ItemType)itemtype)} ======="); foreach (string key in keys) @@ -1021,10 +1078,31 @@ namespace Oshima.FunGame.WebAPI.Controllers { itemsIndex = string.Join(",", objs.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; } + IEnumerable itemsEquipable = objs.Where(i => i.IsEquipment && i.Character is null); + string itemsEquipableIndex = string.Join(",", itemsEquipable.Select(i => items.IndexOf(i) + 1)); + if (itemsEquipable.Count() > 10) + { + itemsEquipableIndex = string.Join(",", itemsEquipable.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; + } + IEnumerable itemsSellable = objs.Where(i => i.IsSellable); + string itemsSellableIndex = string.Join(",", itemsSellable.Select(i => items.IndexOf(i) + 1)); + if (itemsSellable.Count() > 10) + { + itemsSellableIndex = string.Join(",", itemsSellable.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; + } + IEnumerable itemsTradable = objs.Where(i => i.IsTradable); + string itemsTradableIndex = string.Join(",", itemsTradable.Select(i => items.IndexOf(i) + 1)); + if (itemsTradable.Count() > 10) + { + itemsTradableIndex = string.Join(",", itemsTradable.Take(10).Select(i => items.IndexOf(i) + 1)) + ",..."; + } str += $"物品序号:{itemsIndex}\r\n"; - str += $"拥有数量:{objs.Count}(" + (first.IsEquipment ? $"可装备数量:{objs.Count(i => i.Character is null)}," : "") + + if (itemsEquipableIndex != "") str += $"可装备序号:{itemsEquipableIndex}\r\n"; + if (itemsSellableIndex != "") str += $"可出售序号:{itemsSellableIndex}\r\n"; + if (itemsTradableIndex != "") str += $"可交易序号:{itemsTradableIndex}\r\n"; + str += $"拥有数量:{objs.Count}(" + (first.IsEquipment ? $"可装备数量:{itemsEquipable.Count()}," : "") + (FunGameConstant.ItemCanUsed.Contains(first.ItemType) ? $"可使用数量:{objs.Count(i => i.RemainUseTimes > 0)}," : "") + - $"可出售数量:{objs.Count(i => i.IsSellable)},可交易数量:{objs.Count(i => i.IsTradable)})"; + $"可出售数量:{itemsSellable.Count()},可交易数量:{itemsTradable.Count()})"; list.Add(str); } list.Add($"页数:{showPage} / {maxPage}"); @@ -1060,17 +1138,17 @@ namespace Oshima.FunGame.WebAPI.Controllers list.Add($"{General.GameplayEquilibriumConstant.InGameMaterial}:{user.Inventory.Materials:0.00}"); List characters = [.. user.Inventory.Characters]; int total = characters.Count; - int maxPage = (int)Math.Ceiling((double)total / 6); + int maxPage = (int)Math.Ceiling((double)total / 15); if (maxPage < 1) maxPage = 1; if (showPage <= maxPage) { List inventory = [.. characters]; Dictionary dict = inventory.Select((obj, index) => new { Index = index + 1, Value = obj }).ToDictionary(k => k.Index, v => v.Value); - List seq = [.. FunGameService.GetPage(dict.Keys, showPage, 6)]; + List seq = [.. FunGameService.GetPage(dict.Keys, showPage, 15)]; bool showCharacter = true; int characterCount = 0; - int prevSequence = dict.Take((showPage - 1) * 6).Count(); + int prevSequence = dict.Take((showPage - 1) * 15).Count(); foreach (int index in seq) { @@ -1525,6 +1603,117 @@ namespace Oshima.FunGame.WebAPI.Controllers } } + [HttpPost("showiteminfoname")] + public string GetItemInfoFromInventory_Name([FromQuery] long? uid = null, [FromQuery] string? name = null, [FromQuery] int? page = null) + { + try + { + long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + string itemName = name ?? ""; + int showPage = page ?? 1; + if (showPage <= 0) showPage = 1; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + var objs = user.Inventory.Items.Select((item, index) => new { item, index }) + .Where(obj => obj.item.Name == itemName); + + Dictionary items = []; + if (objs.Any()) + { + items = objs.ToDictionary(d => d.index + 1, d => d.item); + } + else + { + return NetworkUtility.JsonSerialize($"你库存中没有任何名为【{itemName}】的物品!"); + } + + int total = items.Count; + int maxPage = (int)Math.Ceiling((double)total / 100); + if (maxPage < 1) maxPage = 1; + if (showPage <= maxPage) + { + IEnumerable showItems = FunGameService.GetPage(items.Keys, showPage, 100); + if (showItems.Any()) + { + int itemIndex = showItems.First(); + Item item = items[itemIndex]; + string str = $"☆--- [ {item.Name} ] ---☆\r\n"; + str += ItemSet.GetQualityTypeName(item.QualityType) + " " + + (item.WeaponType == WeaponType.None ? ItemSet.GetItemTypeName(item.ItemType) : ItemSet.GetItemTypeName(item.ItemType) + "-" + ItemSet.GetWeaponTypeName(item.WeaponType)); + str += $"\r\n物品描述:{item.Description}\r\n"; + + string itemsIndex = string.Join(",", items.Keys); + + var itemsEquipabled = items.Where(kv => kv.Value.Character != null); + var itemsEquipable = items.Where(kv => kv.Value.Character is null); + string itemsEquipabledIndex = ""; + string itemsEquipableIndex = ""; + if (item.IsEquipment) + { + itemsEquipabledIndex = string.Join(",", itemsEquipabled.Select(kv => kv.Key)); + itemsEquipableIndex = string.Join(",", itemsEquipable.Select(kv => kv.Key)); + } + + var itemsCanUsed = items.Where(kv => kv.Value.RemainUseTimes > 0); + string itemsCanUsedIndex = ""; + if (FunGameConstant.ItemCanUsed.Contains(item.ItemType)) + { + itemsCanUsedIndex = string.Join(",", itemsCanUsed.Select(kv => kv.Key)); + } + + var itemsSellable = items.Where(kv => kv.Value.IsSellable); + string itemsSellableIndex = string.Join(",", itemsSellable.Select(kv => kv.Key)); + + var itemsTradable = items.Where(kv => kv.Value.IsTradable); + string itemsTradableIndex = string.Join(",", itemsTradable.Select(kv => kv.Key)); + + str += $"物品序号:{itemsIndex}\r\n"; + if (itemsEquipabledIndex != "") str += $"已装备序号:{itemsEquipabledIndex}\r\n"; + if (itemsEquipableIndex != "") str += $"可装备序号:{itemsEquipableIndex}\r\n"; + if (itemsCanUsedIndex != "") str += $"可使用序号:{itemsCanUsedIndex}\r\n"; + if (itemsSellableIndex != "") str += $"可出售序号:{itemsSellableIndex}\r\n"; + if (itemsTradableIndex != "") str += $"可交易序号:{itemsTradableIndex}\r\n"; + + str += $"拥有数量:{items.Count}("; + if (item.IsEquipment) + { + str += $"已装备数量:{itemsEquipabled.Count()},可装备数量:{itemsEquipable.Count()},"; + } + if (FunGameConstant.ItemCanUsed.Contains(item.ItemType)) + { + str += $"可使用数量:{itemsCanUsed.Count()},"; + } + str += $"可出售数量:{itemsSellable.Count()},可交易数量:{itemsTradable.Count()})\r\n"; + str += $"页数:{showPage} / {maxPage}"; + return NetworkUtility.JsonSerialize(str.Trim()); + } + else + { + return NetworkUtility.JsonSerialize($"你库存中没有任何名为【{itemName}】的物品!"); + } + } + else + { + return NetworkUtility.JsonSerialize($"没有这么多页!当前总页数为 {maxPage},但你请求的是第 {showPage} 页。"); + } + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + catch (Exception e) + { + return NetworkUtility.JsonSerialize(e.ToString()); + } + } + [HttpPost("equipitem")] public string EquipItem([FromQuery] long? uid = null, [FromQuery] int? c = null, [FromQuery] int? i = null) { @@ -1780,7 +1969,7 @@ namespace Oshima.FunGame.WebAPI.Controllers character.Recovery(EP: 200); } Team team1 = new($"{user1.Username}的小队", squad1); - Team team2 = new($"{user2.Username}的小队", squad2); + Team team2 = new($"{user2.Username}的小队" + (userid == enemyid ? "2" : ""), squad2); return FunGameActionQueue.NewAndStartTeamGame([team1, team2], 0, 0, false, false, false, false, showAllRound); } else @@ -2963,7 +3152,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } else if (key == "角色突破进度") { - if (character.LevelBreak < needCount) + if (character.LevelBreak + 1 < needCount) { return NetworkUtility.JsonSerialize($"角色 [ {character} ] 等级突破进度不足 {needCount} 等阶,无法{isStudy}此技能!"); } @@ -3135,7 +3324,7 @@ namespace Oshima.FunGame.WebAPI.Controllers } else if (key == "角色突破进度") { - if (character.LevelBreak < needCount) + if (character.LevelBreak + 1 < needCount) { return NetworkUtility.JsonSerialize($"角色 [ {character} ] 等级突破进度不足 {needCount} 等阶,无法升级此技能!"); } @@ -3640,60 +3829,76 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("acceptquest")] - public string AcceptQuest([FromQuery] long? uid = null, [FromQuery] int? id = null) + public List AcceptQuest([FromQuery] long? uid = null, [FromQuery] int? id = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); int questid = id ?? 0; PluginConfig pc = new("saved", userid.ToString()); pc.LoadConfig(); - + + List msgs = []; if (pc.Count > 0) { User user = FunGameService.GetUser(pc); - string msg = ""; EntityModuleConfig quests = new("quests", userid.ToString()); quests.LoadConfig(); - if (quests.Count > 0) + if (quests.Count > 0 && quests.Values.FirstOrDefault(q => q.Id == questid) is Quest quest) { - if (quests.Values.FirstOrDefault(q => q.Status == QuestState.InProgress) is Quest quest) + if (quest.Status == QuestState.InProgress) { - msg = $"你正在进行任务【{quest.Name}】,无法开始新任务!\r\n{quest}"; + msgs.Add($"你正在进行任务【{quest.Name}】,无法开始新任务!\r\n{quest}"); } - else if (quests.Values.FirstOrDefault(q => q.Id == questid) is Quest quest2) + else if (quest.Status == QuestState.Completed) { - if (quest2.Status != 0) - { - msg = $"这个任务正在进行中,或已经完成,不能重复做任务!"; - } - else - { - quest2.StartTime = DateTime.Now; - quest2.Status = QuestState.InProgress; - quests.SaveConfig(); - msg = $"开始任务【{quest2.Name}】成功!任务信息如下:\r\n{quest2}\r\n预计完成时间:{DateTime.Now.AddMinutes(quest2.EstimatedMinutes).ToString(General.GeneralDateTimeFormatChinese)}"; - } + msgs.Add($"任务【{quest.Name}】已经完成了!\r\n{quest}"); + } + else if (quest.Status == QuestState.Settled) + { + msgs.Add($"任务【{quest.Name}】已经结算并发放奖励了哦!\r\n{quest}"); } else { - msg = $"没有找到序号为 {questid} 的任务!"; + quest.StartTime = DateTime.Now; + quest.Status = QuestState.InProgress; + if (quest.QuestType == QuestType.Continuous) + { + // 持续性任务会在持续时间结束后自动完成并结算 + msgs.Add($"开始任务【{quest.Name}】成功!任务信息如下:\r\n{quest}\r\n预计完成时间:{DateTime.Now.AddMinutes(quest.EstimatedMinutes).ToString(General.GeneralDateTimeFormatChinese)}"); + } + else if (quest.QuestType == QuestType.Immediate) + { + msgs.Add($"开始任务【{quest.Name}】成功!任务信息如下:\r\n{quest}"); + // TODO:实现任务逻辑 + quest.Status = QuestState.Completed; + msgs.Add("在任务过程中,你碰巧遇到了米莉,任务直接完成了!"); + } + else + { + msgs.Add($"开始任务【{quest.Name}】成功!任务信息如下:\r\n{quest}"); + // TODO:进度条任务需要完成任务的指标,实现任务逻辑 + quest.Progress = quest.MaxProgress; + quest.Status = QuestState.Completed; + msgs.Add("在任务过程中,你碰巧遇到了米莉,任务直接完成了!"); + } + quests.SaveConfig(); } } else { - msg = "任务列表为空,请等待刷新!"; + msgs.Add($"没有找到序号为 {questid} 的任务!请使用【任务列表】指令来检查你的任务列表!"); } user.LastTime = DateTime.Now; pc.Add("user", user); pc.SaveConfig(); - return NetworkUtility.JsonSerialize(msg); + return msgs; } else { - return NetworkUtility.JsonSerialize(noSaved); + return [noSaved]; } } @@ -4048,11 +4253,16 @@ namespace Oshima.FunGame.WebAPI.Controllers builer.AppendLine($"管理员数量:{club.Admins.Count}"); builer.AppendLine($"申请人数量:{club.Applicants.Count}"); builer.AppendLine($"社团基金:{club.ClubPoins}"); + if (club.Master?.Id == userid) + { + builer.AppendLine("你是此社团的社长"); + } if (club.Admins.ContainsKey(userid)) { builer.AppendLine("你是此社团的管理员"); } } + builer.AppendLine($"社团描述:{club.Description}"); msg = builer.ToString().Trim(); } else @@ -4069,10 +4279,12 @@ namespace Oshima.FunGame.WebAPI.Controllers } [HttpPost("showclubmemberlist")] - public string ShowClubMemberList([FromQuery] long? uid = null, [FromQuery] int? type = null) + public string ShowClubMemberList([FromQuery] long? uid = null, [FromQuery] int? type = null, [FromQuery] int? page = null) { long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); int showType = type ?? 0; + int showPage = page ?? 1; + if (showPage <= 0) showPage = 1; PluginConfig pc = new("saved", userid.ToString()); pc.LoadConfig(); @@ -4099,21 +4311,34 @@ namespace Oshima.FunGame.WebAPI.Controllers case 1: builer.AppendLine($"☆--- 社团 [ {club.Name} ] 管理员列表 ---☆"); count = 1; - List admins = [.. club.Admins.Keys]; + List admins = []; if (club.Master != null && club.Master.Id != 0) { admins.Add(club.Master.Id); } - foreach (long uid2 in admins) + admins.AddRange(club.Admins.Keys); + + int maxPage = (int)Math.Ceiling((double)admins.Count / FunGameConstant.ItemsPerPage2); + if (maxPage < 1) maxPage = 1; + if (showPage <= maxPage) { - if (FunGameConstant.UserIdAndUsername.TryGetValue(uid2, out User? user2) && user2 != null) + admins = [.. FunGameService.GetPage(admins, showPage, FunGameConstant.ItemsPerPage2)]; + foreach (long uid2 in admins) { - builer.AppendLine($"{count}."); - builer.AppendLine($"UID:{user2.Id}"); - builer.AppendLine($"玩家昵称:{user2.Username}"); - builer.AppendLine($"加入时间:{club.MemberJoinTime[user2.Id].ToString(General.GeneralDateTimeFormatChinese)}"); + if (FunGameConstant.UserIdAndUsername.TryGetValue(uid2, out User? user2) && user2 != null) + { + builer.AppendLine($"{count}."); + builer.AppendLine($"UID:{user2.Id}"); + builer.AppendLine($"玩家昵称:{user2.Username}"); + builer.AppendLine($"加入时间:{club.MemberJoinTime[user2.Id].ToString(General.GeneralDateTimeFormatChinese)}"); + } + count++; } - count++; + builer.AppendLine($"页数:{showPage} / {maxPage}"); + } + else + { + NetworkUtility.JsonSerialize($"没有这么多页!当前总页数为 {maxPage},但你请求的是第 {showPage} 页。"); } break; case 2: @@ -4121,16 +4346,27 @@ namespace Oshima.FunGame.WebAPI.Controllers { builer.AppendLine($"☆--- 社团 [ {club.Name} ] 申请人列表 ---☆"); count = 1; - foreach (long uid2 in club.Applicants.Keys) + maxPage = (int)Math.Ceiling((double)club.Applicants.Count / FunGameConstant.ItemsPerPage2); + if (maxPage < 1) maxPage = 1; + if (showPage <= maxPage) { - if (FunGameConstant.UserIdAndUsername.TryGetValue(uid2, out User? user2) && user2 != null) + IEnumerable applicants = FunGameService.GetPage(club.Applicants.Keys, showPage, FunGameConstant.ItemsPerPage2); + foreach (long uid2 in applicants) { - builer.AppendLine($"{count}."); - builer.AppendLine($"UID:{user2.Id}"); - builer.AppendLine($"玩家昵称:{user2.Username}"); - builer.AppendLine($"申请时间:{club.ApplicationTime[user2.Id].ToString(General.GeneralDateTimeFormatChinese)}"); + if (FunGameConstant.UserIdAndUsername.TryGetValue(uid2, out User? user2) && user2 != null) + { + builer.AppendLine($"{count}."); + builer.AppendLine($"UID:{user2.Id}"); + builer.AppendLine($"玩家昵称:{user2.Username}"); + builer.AppendLine($"申请时间:{club.ApplicationTime[user2.Id].ToString(General.GeneralDateTimeFormatChinese)}"); + } + count++; } - count++; + builer.AppendLine($"页数:{showPage} / {maxPage}"); + } + else + { + NetworkUtility.JsonSerialize($"没有这么多页!当前总页数为 {maxPage},但你请求的是第 {showPage} 页。"); } } else @@ -4142,26 +4378,37 @@ namespace Oshima.FunGame.WebAPI.Controllers default: builer.AppendLine($"☆--- 社团 [ {club.Name} ] 成员列表 ---☆"); count = 1; - foreach (long uid2 in club.Members.Keys) + maxPage = (int)Math.Ceiling((double)club.Members.Count / FunGameConstant.ItemsPerPage2); + if (maxPage < 1) maxPage = 1; + if (showPage <= maxPage) { - if (FunGameConstant.UserIdAndUsername.TryGetValue(uid2, out User? user2) && user2 != null) + IEnumerable members = FunGameService.GetPage(club.Members.Keys, showPage, FunGameConstant.ItemsPerPage2); + foreach (long uid2 in members) { - builer.AppendLine($"{count}."); - builer.AppendLine($"UID:{user2.Id}"); - builer.AppendLine($"玩家昵称:{user2.Username}"); - string userType = "社员"; - if (club.Master?.Id == user2.Id) + if (FunGameConstant.UserIdAndUsername.TryGetValue(uid2, out User? user2) && user2 != null) { - userType = "社长"; + builer.AppendLine($"{count}."); + builer.AppendLine($"UID:{user2.Id}"); + builer.AppendLine($"玩家昵称:{user2.Username}"); + string userType = "社员"; + if (club.Master?.Id == user2.Id) + { + userType = "社长"; + } + else if (club.Admins.ContainsKey(user2.Id)) + { + userType = "管理员"; + } + builer.AppendLine($"社团身份:{userType}"); + builer.AppendLine($"加入时间:{club.MemberJoinTime[user2.Id].ToString(General.GeneralDateTimeFormatChinese)}"); } - else if (club.Admins.ContainsKey(user2.Id)) - { - userType = "管理员"; - } - builer.AppendLine($"社团身份:{userType}"); - builer.AppendLine($"加入时间:{club.MemberJoinTime[user2.Id].ToString(General.GeneralDateTimeFormatChinese)}"); + count++; } - count++; + builer.AppendLine($"页数:{showPage} / {maxPage}"); + } + else + { + NetworkUtility.JsonSerialize($"没有这么多页!当前总页数为 {maxPage},但你请求的是第 {showPage} 页。"); } break; } @@ -4772,6 +5019,95 @@ namespace Oshima.FunGame.WebAPI.Controllers } } + [HttpPost("creategiftbox")] + public string CreateGiftBox([FromQuery] long? uid = null, [FromQuery] string? name = null) + { + long userid = uid ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + string itemName = name ?? ""; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + if (FunGameConstant.AllItems.FirstOrDefault(i => i.Name == itemName) is Item item) + { + PluginConfig pc2 = new("giftbox", "giftbox"); + pc2.LoadConfig(); + + List list = []; + if (pc2.TryGetValue(itemName, out object? value) && value is List tempList) + { + list = new(tempList); + } + + if (list.Contains(user.Id)) + { + return NetworkUtility.JsonSerialize($"你已经领取过这个礼包【{itemName}】啦,不能重复领取哦!"); + } + + Item newItem = item.Copy(); + newItem.IsSellable = false; + newItem.IsTradable = false; + newItem.User = user; + user.Inventory.Items.Add(newItem); + string msg = $"恭喜你获得礼包【{itemName}】一份!"; + + list.Add(user.Id); + pc2.Add(itemName, list); + pc2.SaveConfig(); + + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + + return NetworkUtility.JsonSerialize(msg); + } + else + { + return NetworkUtility.JsonSerialize("没有找到这个礼包,可能已经过期。"); + } + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + + [HttpGet("getregion")] + public List GetRegion([FromQuery] int? index = null) + { + List regions = []; + if (index != null) + { + if (FunGameConstant.Regions.FirstOrDefault(kv => kv.Id == index) is Region region) + { + regions.Add(region.ToString()); + } + else + { + regions.Add($"找不到指定编号的地区!"); + } + } + else if (FunGameConstant.Regions.Count > 0) + { + regions.Add($"世界地图:"); + for (int i = 0; i < FunGameConstant.Regions.Count; i++) + { + Region region = FunGameConstant.Regions[i]; + regions.Add($"{region.Id}. {region.Name}"); + } + regions.Add($"提示:使用【查地区+序号】指令来查看指定地区的信息。"); + } + else + { + regions.Add($"世界地图遇到了问题,暂时无法显示……"); + } + return regions; + } + [HttpGet("reload")] public string Relaod([FromQuery] long? master = null) { diff --git a/OshimaWebAPI/Services/RainBOTService.cs b/OshimaWebAPI/Services/RainBOTService.cs index 1efac0c..cb8278b 100644 --- a/OshimaWebAPI/Services/RainBOTService.cs +++ b/OshimaWebAPI/Services/RainBOTService.cs @@ -27,12 +27,13 @@ namespace Oshima.FunGame.WebAPI.Services Statics.RunningPlugin?.Controller.WriteLine(title, Milimoe.FunGame.Core.Library.Constant.LogLevel.Debug); if (msg is ThirdPartyMessage third) { - third.Result = content; + third.Result = "\r\n" + content.Trim(); third.IsCompleted = true; return; } if (msg.IsGroup) { + content = "\r\n" + content.Trim(); await Service.SendGroupMessageAsync(msg.OpenId, content, msgType, media, msg.Id, msgSeq); } else @@ -189,7 +190,7 @@ namespace Oshima.FunGame.WebAPI.Services { await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 5 / 7 页) 43:任务列表:查看今日任务列表 -44:开始任务 <任务序号> +44:开始任务/做任务 <任务序号> 45、任务信息:查看进行中任务的详细信息 46、任务结算:对进行中的任务进行结算 47、我的状态:查看主战角色状态 @@ -924,15 +925,17 @@ namespace Oshima.FunGame.WebAPI.Services return result; } - if (e.Detail.StartsWith("开始任务", StringComparison.CurrentCultureIgnoreCase)) + if (e.Detail.StartsWith("开始任务", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("做任务", StringComparison.CurrentCultureIgnoreCase)) { - string detail = e.Detail.Replace("开始任务", "").Trim(); + string detail = e.Detail.Replace("开始任务", "").Replace("做任务", "").Trim(); if (int.TryParse(detail, out int index)) { - string msg = NetworkUtility.JsonDeserialize(Controller.AcceptQuest(uid, index)) ?? ""; - if (msg != "") + List msgs = Controller.AcceptQuest(uid, index); + int count = 1; + foreach (string msg in msgs) { - await SendAsync(e, "开始任务", msg); + await SendAsync(e, "开始任务", msg, msgSeq: count++); + await Task.Delay(2000); } } return result; @@ -941,14 +944,21 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail.StartsWith("我的物品", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.Detail.Replace("我的物品", "").Trim(); + string msg; if (int.TryParse(detail, out int index)) { - string msg = NetworkUtility.JsonDeserialize(Controller.GetItemInfoFromInventory(uid, index)) ?? ""; + msg = NetworkUtility.JsonDeserialize(Controller.GetItemInfoFromInventory(uid, index)) ?? ""; if (msg != "") { await SendAsync(e, "查库存物品", msg); + return result; } } + msg = NetworkUtility.JsonDeserialize(Controller.GetItemInfoFromInventory_Name(uid, detail)) ?? ""; + if (msg != "") + { + await SendAsync(e, "查库存物品", msg); + } return result; } @@ -1757,32 +1767,68 @@ namespace Oshima.FunGame.WebAPI.Services return result; } - if (e.Detail == "查看社团成员") + if (e.Detail.StartsWith("查看社团成员")) { - string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 0)) ?? ""; - if (msg != "") + string detail = e.Detail.Replace("查看社团成员", "").Trim(); + if (int.TryParse(detail, out int page) && page > 0) { - await SendAsync(e, "社团", "\r\n" + msg); + string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 0, page)) ?? ""; + if (msg != "") + { + await SendAsync(e, "社团", "\r\n" + msg); + } + } + else + { + string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 0, 1)) ?? ""; + if (msg != "") + { + await SendAsync(e, "社团", "\r\n" + msg); + } } return result; } - if (e.Detail == "查看社团管理") + if (e.Detail.StartsWith("查看社团管理")) { - string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 1)) ?? ""; - if (msg != "") + string detail = e.Detail.Replace("查看社团管理", "").Trim(); + if (int.TryParse(detail, out int page) && page > 0) { - await SendAsync(e, "社团", "\r\n" + msg); + string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 1, page)) ?? ""; + if (msg != "") + { + await SendAsync(e, "社团", "\r\n" + msg); + } + } + else + { + string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 1, 1)) ?? ""; + if (msg != "") + { + await SendAsync(e, "社团", "\r\n" + msg); + } } return result; } - if (e.Detail == "查看申请人列表") + if (e.Detail.StartsWith("查看申请人列表")) { - string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 2)) ?? ""; - if (msg != "") + string detail = e.Detail.Replace("查看申请人列表", "").Trim(); + if (int.TryParse(detail, out int page) && page > 0) { - await SendAsync(e, "社团", "\r\n" + msg); + string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 2, page)) ?? ""; + if (msg != "") + { + await SendAsync(e, "社团", "\r\n" + msg); + } + } + else + { + string msg = NetworkUtility.JsonDeserialize(Controller.ShowClubMemberList(uid, 2, 1)) ?? ""; + if (msg != "") + { + await SendAsync(e, "社团", "\r\n" + msg); + } } return result; } @@ -1917,6 +1963,25 @@ namespace Oshima.FunGame.WebAPI.Services return result; } + if (e.Detail.StartsWith("查地区", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("查询地区", StringComparison.CurrentCultureIgnoreCase)) + { + string detail = e.Detail.Replace("查地区", "").Replace("查询地区", "").Trim(); + List msgs = []; + if (int.TryParse(detail, out int cid)) + { + msgs = Controller.GetRegion(cid); + } + else + { + msgs = Controller.GetRegion(); + } + if (msgs.Count > 0) + { + await SendAsync(e, "查地区", string.Join("\r\n", msgs)); + } + return result; + } + if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase)) { string msg = NetworkUtility.JsonDeserialize(Controller.Relaod(uid)) ?? "";