feat(S8-P2-commands): register 17 economy commands and finalize P0-P2 gameplay

This commit is contained in:
2026-11-10 00:50:13 +08:00
parent eb5227bd9e
commit c69fa53d37
6 changed files with 351 additions and 23 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ public sealed class CommandFrameworkTests
{ {
(CommandRouter router, _, _, _) = CreateRouter(); (CommandRouter router, _, _, _) = CreateRouter();
BotReply? reply = await router.RouteAsync(Message("/玩法帮助"), new OtherData()); BotReply? reply = await router.RouteAsync(Message("/绑定", isGroup: true), new OtherData());
Assert.NotNull(reply); Assert.NotNull(reply);
string content = reply!.Markdown!.Content!; string content = reply!.Markdown!.Content!;
+160
View File
@@ -0,0 +1,160 @@
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using OshimaBot.Commands;
using OshimaBot.Data;
using OshimaBot.Game.Services;
using OshimaBot.Gameplay;
using OshimaBot.Models;
using OshimaBot.Security;
using Xunit;
namespace OshimaBot.Tests;
/// <summary>P2 指令层:真实 SQLite + CommandRouter 的端到端验证。</summary>
public sealed class EconomyCommandTests
{
private const long UserId = 42;
[Fact]
public void Registry_ResolvesP2VerbsAndKeepsPurchaseDistinct()
{
using EconomyCommandDatabase db = new();
CommandRegistry registry = CommandCatalog.Build(db.Dependencies);
Assert.Equal(66, registry.All.Count);
Assert.Equal("shop", registry.Resolve("/商店")!.Command.Key);
Assert.Equal("buy", registry.Resolve("/购买 @1 x2")!.Command.Key);
Assert.Equal(new[] { "@1", "x2" }, registry.Resolve("/购买 @1 x2")!.Args);
Assert.Equal("market-buy", registry.Resolve("/购买市场 @1")!.Command.Key);
Assert.Equal("boss", registry.Resolve("/Boss")!.Command.Key);
Assert.Equal("rank", registry.Resolve("/排行榜 战绩")!.Command.Key);
Assert.Equal("list-item", registry.Resolve("/上架 @1 200")!.Command.Key);
}
[Fact]
public async Task Router_StoreBuyAndMarketLifecycle()
{
using EconomyCommandDatabase db = new();
CommandRouter router = db.CreateRouter();
string shop = await RouteAsync(router, "/商店");
Assert.Contains("补给包", shop);
Assert.Contains("@1", shop);
Assert.Contains("购买成功", await RouteAsync(router, "/购买 @1"));
Assert.Contains("上架成功", await RouteAsync(router, "/上架 @1 200"));
Assert.Contains("200 金币", await RouteAsync(router, "/市场"));
Assert.Contains("不能购买自己的挂单", await RouteAsync(router, "/购买市场 @1"));
Assert.Contains("已下架", await RouteAsync(router, "/下架 @1"));
Assert.Contains("市场暂时空着", await RouteAsync(router, "/市场"));
}
[Fact]
public async Task Router_OffersInstanceBossDuelAndRanking()
{
using EconomyCommandDatabase db = new();
CommandRouter router = db.CreateRouter();
Assert.Contains("报价单已发布", await RouteAsync(router, "/报价 @1 300"));
Assert.Contains("300 金币", await RouteAsync(router, "/报价列表"));
Assert.Contains("不能接受自己的报价单", await RouteAsync(router, "/接受报价 @1"));
Assert.Contains("报价已撤回", await RouteAsync(router, "/撤回报价 @1"));
Assert.Contains("材料数量不足", await RouteAsync(router, "/锻造 @1 1"));
Assert.Contains("进入秘境", await RouteAsync(router, "/秘境 精英"));
Assert.Contains("尚未结束", await RouteAsync(router, "/收取秘境"));
Assert.Contains("Boss 讨伐成功", await RouteAsync(router, "/Boss"));
Assert.Contains("今天已经挑战过", await RouteAsync(router, "/Boss"));
Assert.Contains("决斗", await RouteAsync(router, "/决斗"));
string rank = await RouteAsync(router, "/排行榜 战绩");
Assert.Contains("战绩榜", rank);
Assert.Contains("@1", rank);
}
[Fact]
public async Task Router_LookAndHelpReflectP2()
{
using EconomyCommandDatabase db = new();
CommandRouter router = db.CreateRouter();
string look = await RouteAsync(router, "/观察");
Assert.Contains("补给站", look);
Assert.Contains("交易摊", look);
string help = await RouteAsync(router, "/帮助 p11");
Assert.Contains("11/11", help);
Assert.Contains("经济战斗", help);
string legacy = await RouteAsync(router, "/玩法帮助");
Assert.Contains("P0", legacy);
Assert.Contains("P1", legacy);
Assert.Contains("P2", legacy);
}
private static async Task<string> RouteAsync(CommandRouter router, string command)
{
BotReply? reply = await router.RouteAsync(Message(command), new OtherData());
Assert.NotNull(reply);
return reply!.Markdown?.Content ?? reply.Text ?? "";
}
private static ThirdPartyMessage Message(string detail)
=> new()
{
Id = "MSG-P2", Detail = detail, IsGroup = false, OpenId = "USER",
AuthorOpenId = "USER", FunGameUID = UserId, Timestamp = "2026-11-10 00:40:00"
};
private sealed class EconomyCommandDatabase : IDisposable
{
public SqliteConnection Connection { get; }
public ServiceProvider Provider { get; }
public CommandDependencies Dependencies { get; }
public EconomyCommandDatabase()
{
FunGameRuntime.EnsureInitialized();
Connection = new SqliteConnection("Data Source=:memory:");
Connection.Open();
ServiceCollection services = new();
services.AddLogging();
services.AddMemoryCache();
services.AddDbContext<BotDbContext>(options => options.UseSqlite(Connection));
services.AddSingleton(Options.Create(new ServerOptions()));
services.AddSingleton(Options.Create(new DatabaseOptions { ApplyMigrationsOnStartup = false }));
services.AddSingleton<IUserDirectory, UserDirectory>();
services.AddSingleton<IUserSessionService, UserSessionService>();
services.AddSingleton<IPlayerService, PlayerService>();
services.AddSingleton<IEconomyService, EconomyService>();
Provider = services.BuildServiceProvider();
using IServiceScope scope = Provider.CreateScope();
scope.ServiceProvider.GetRequiredService<BotDbContext>().Database.EnsureCreated();
Dependencies = new CommandDependencies(
null!, null!, null!,
Provider.GetRequiredService<IUserSessionService>(),
Provider.GetRequiredService<IPlayerService>(),
Provider.GetRequiredService<IEconomyService>(),
NullLogger.Instance);
}
public CommandRouter CreateRouter() => new(
CommandCatalog.Build(Dependencies), Dependencies,
Provider.GetRequiredService<IServiceScopeFactory>(),
Provider.GetRequiredService<IMemoryCache>(),
NullLogger<CommandRouter>.Instance);
public void Dispose()
{
Provider.Dispose();
Connection.Dispose();
}
}
}
+7 -9
View File
@@ -26,7 +26,7 @@ public sealed class GameplayCommandTests
using GameplayCommandDatabase db = new(); using GameplayCommandDatabase db = new();
CommandRegistry registry = CommandCatalog.Build(db.Dependencies); CommandRegistry registry = CommandCatalog.Build(db.Dependencies);
Assert.Equal(49, registry.All.Count); Assert.Equal(66, registry.All.Count);
Assert.Equal("status", registry.Resolve("/状态")!.Command.Key); Assert.Equal("status", registry.Resolve("/状态")!.Command.Key);
Assert.Equal("status", registry.Resolve("存档")!.Command.Key); Assert.Equal("status", registry.Resolve("存档")!.Command.Key);
Assert.Equal("gacha-ten", registry.Resolve("/十连抽卡")!.Command.Key); Assert.Equal("gacha-ten", registry.Resolve("/十连抽卡")!.Command.Key);
@@ -93,19 +93,17 @@ public sealed class GameplayCommandTests
} }
[Fact] [Fact]
public async Task Help_LastPageContainsP1Group() public async Task Help_LastPageContainsP2Group()
{ {
using GameplayCommandDatabase db = new(); using GameplayCommandDatabase db = new();
CommandRouter router = db.CreateRouter(); CommandRouter router = db.CreateRouter();
string content = await RouteAsync(router, "/帮助 p9"); string content = await RouteAsync(router, "/帮助 p11");
Assert.Contains("9/9", content); Assert.Contains("11/11", content);
bool hasP1 = content.Contains("/状态", StringComparison.Ordinal) bool hasP2 = content.Contains("/排行榜", StringComparison.Ordinal)
|| content.Contains("/抽卡", StringComparison.Ordinal) || content.Contains("经济战斗", StringComparison.Ordinal);
|| content.Contains("/每日任务", StringComparison.Ordinal) Assert.True(hasP2, content);
|| content.Contains("旅人存档", StringComparison.Ordinal);
Assert.True(hasP1, content);
} }
[Fact] [Fact]
+178 -8
View File
@@ -1,3 +1,4 @@
using System.Globalization;
using FunGame.Core.Library.Constant; using FunGame.Core.Library.Constant;
using OshimaBot.Game.Services; using OshimaBot.Game.Services;
using OshimaBot.Gameplay; using OshimaBot.Gameplay;
@@ -25,7 +26,12 @@ public static class CommandCatalog
"register", "status", "look", "notice", "fortune", "signin", "register", "status", "look", "notice", "fortune", "signin",
"quests", "quest-claim", "gacha", "gacha-ten", "bag", "quests", "quest-claim", "gacha", "gacha-ten", "bag",
"use", "salvage", "lock", "unlock", "equip", "unequip", "use", "salvage", "lock", "unlock", "equip", "unequip",
"characters", "set-main", "levelup", "break", "train", "train-claim", "party" "characters", "set-main", "levelup", "break", "train", "train-claim", "party",
// ---- P2:经济与战斗 ----
"shop", "buy", "market", "list-item", "delist", "market-buy",
"offers", "offer", "offer-accept", "offer-cancel",
"forge", "forge-claim", "instance", "instance-claim",
"duel", "boss", "rank"
]; ];
public static CommandRegistry Build(CommandDependencies deps) public static CommandRegistry Build(CommandDependencies deps)
@@ -73,7 +79,8 @@ public static class CommandCatalog
{ {
if (context.IsGroup) if (context.IsGroup)
{ {
return CommandReplies.Error("群聊不能签发绑定码", "没有生成任何码", "请在与机器人的单聊里发送 /绑定"); return CommandReplies.Error("群聊不能签发绑定码", "没有生成任何码",
"请在与机器人的单聊里发送 /绑定", "/帮助");
} }
if (context.UserId <= 0) if (context.UserId <= 0)
{ {
@@ -97,10 +104,15 @@ public static class CommandCatalog
"legacy-help" => new DelegateCommand( "legacy-help" => new DelegateCommand(
key: "legacy-help", name: "玩法帮助", aliases: ["存档帮助", "社团帮助", "活动帮助", "商店帮助", "legacy"], key: "legacy-help", name: "玩法帮助", aliases: ["存档帮助", "社团帮助", "活动帮助", "商店帮助", "legacy"],
usage: "/玩法帮助", description: "查看尚未迁移的模块", group: CommandGroups.Legacy, usage: "/玩法帮助", description: "查看当前开放的玩法范围", group: CommandGroups.Legacy,
handler: _ => Task.FromResult(CommandReplies.Error( handler: _ => Task.FromResult(CommandReplies.Compose("🧭 OshimaBot 版本状态",
"P2 模块尚未迁移", "商店、市场、交易、锻造、秘境与决斗暂不可用", "P0 至 P2 玩法已全部开放",
"P1 存档、角色、背包、签到、抽卡与练级已开放,输入 /状态 查看", "/状态"))), [
"- P0 角色/技能/物品查询、战斗模拟与统计排行",
"- P1 存档、背包、签到、抽卡、练级、每日任务",
"- P2 商店、市场、报价交易、锻造、秘境、决斗、Boss、排行榜",
"- P3(社团/赛马/赛事预测)按计划不在本轮范围"
], ["/帮助", "/状态", "/商店"]))),
// ---- P1:旅人存档(全部由显式 switch 注册)---- // ---- P1:旅人存档(全部由显式 switch 注册)----
"register" => new DelegateCommand( "register" => new DelegateCommand(
@@ -253,6 +265,106 @@ public static class CommandCatalog
handler: async context => CommandReplies.FromResult(await deps.Players.SquadAsync( handler: async context => CommandReplies.FromResult(await deps.Players.SquadAsync(
context.UserId, context.FirstArgument ?? "", RefIndex(context, 1), context.CancellationToken))), context.UserId, context.FirstArgument ?? "", RefIndex(context, 1), context.CancellationToken))),
// ---- P2:经济与战斗(全部由显式 switch 注册)----
"shop" => new DelegateCommand(
key: "shop", name: "商店", aliases: ["shop"], usage: "/商店 [p2]",
description: "铎京补给站货架", group: CommandGroups.Economy,
handler: context => ShopAsync(deps, context)),
"buy" => new DelegateCommand(
key: "buy", name: "购买", aliases: ["buy"], usage: "/购买 @1 [x2]",
description: "购买商店商品(最多 10 件)", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(await deps.Economy.BuyAsync(
context.UserId, RefIndex(context), Quantity(context, 1, 1), context.CancellationToken))),
"market" => new DelegateCommand(
key: "market", name: "市场", aliases: ["market"], usage: "/市场 [p2]",
description: "旅人挂单列表", group: CommandGroups.Economy,
handler: context => MarketAsync(deps, context)),
"list-item" => new DelegateCommand(
key: "list-item", name: "上架", aliases: ["list"], usage: "/上架 @1 <价格>",
description: "把背包物品挂到市场(收上架费)", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(await deps.Economy.ListOnMarketAsync(
context.UserId, RefIndex(context), Price(context), context.CancellationToken))),
"delist" => new DelegateCommand(
key: "delist", name: "下架", aliases: ["delist"], usage: "/下架 @1",
description: "撤回自己的挂单", group: CommandGroups.Economy,
handler: async context => CommandReplies.FromResult(await deps.Economy.DelistAsync(
context.UserId, RefIndex(context), context.CancellationToken))),
"market-buy" => new DelegateCommand(
key: "market-buy", name: "购买市场", aliases: ["marketbuy"], usage: "/购买市场 @1",
description: "购买市场挂单(买卖双方各记一笔账)", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(await deps.Economy.BuyMarketAsync(
context.UserId, RefIndex(context), context.CancellationToken))),
"offers" => new DelegateCommand(
key: "offers", name: "报价列表", aliases: ["offers"], usage: "/报价列表 [p2]",
description: "查看公开报价单", group: CommandGroups.Economy,
handler: context => OffersAsync(deps, context)),
"offer" => new DelegateCommand(
key: "offer", name: "报价", aliases: ["offer"], usage: "/报价 @1 <价格>",
description: "发布物品报价单(不收上架费)", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(await deps.Economy.CreateOfferAsync(
context.UserId, RefIndex(context), Price(context), context.CancellationToken))),
"offer-accept" => new DelegateCommand(
key: "offer-accept", name: "接受报价", aliases: ["offeraccept"], usage: "/接受报价 @1",
description: "按报价买下物品", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(await deps.Economy.AcceptOfferAsync(
context.UserId, RefIndex(context), context.CancellationToken))),
"offer-cancel" => new DelegateCommand(
key: "offer-cancel", name: "撤回报价", aliases: ["offercancel"], usage: "/撤回报价 @1",
description: "撤回自己发布的报价单", group: CommandGroups.Economy,
handler: async context => CommandReplies.FromResult(await deps.Economy.CancelOfferAsync(
context.UserId, RefIndex(context), context.CancellationToken))),
"forge" => new DelegateCommand(
key: "forge", name: "锻造", aliases: ["forge"], usage: "/锻造 @1 [分钟]",
description: "消耗 2 个同类材料 + 金币开始锻造", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(await deps.Economy.ForgeAsync(
context.UserId, RefIndex(context),
Quantity(context, 1, GameplayRules.ForgeDefaultMinutes), context.CancellationToken))),
"forge-claim" => new DelegateCommand(
key: "forge-claim", name: "收取锻造", aliases: ["forgeclaim"], usage: "/收取锻造",
description: "结算已完成的锻造", group: CommandGroups.Economy,
handler: async context => CommandReplies.FromResult(
await deps.Economy.ClaimForgeAsync(context.UserId, context.CancellationToken))),
"instance" => new DelegateCommand(
key: "instance", name: "秘境", aliases: ["instance"], usage: "/秘境 [难度]",
description: "进入秘境探索(定时结算)", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(await deps.Economy.InstanceAsync(
context.UserId, context.FirstArgument ?? "", context.CancellationToken))),
"instance-claim" => new DelegateCommand(
key: "instance-claim", name: "收取秘境", aliases: ["instanceclaim"], usage: "/收取秘境",
description: "结算秘境经验、金币与掉落", group: CommandGroups.Economy,
handler: async context => CommandReplies.FromResult(
await deps.Economy.ClaimInstanceAsync(context.UserId, context.CancellationToken))),
"duel" => new DelegateCommand(
key: "duel", name: "决斗", aliases: ["duel"], usage: "/决斗",
description: "即时决斗,胜负都累计战绩", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(
await deps.Economy.DuelAsync(context.UserId, context.CancellationToken))),
"boss" => new DelegateCommand(
key: "boss", name: "Boss", aliases: ["挑战Boss"], usage: "/Boss",
description: "每日一次 Boss 讨伐", group: CommandGroups.Economy, audit: true,
handler: async context => CommandReplies.FromResult(
await deps.Economy.BossAsync(context.UserId, context.CancellationToken))),
"rank" => new DelegateCommand(
key: "rank", name: "排行榜", aliases: ["rank", "ranklist"], usage: "/排行榜 [金币|等级|战绩]",
description: "查看服务器排行榜", group: CommandGroups.Economy,
handler: context => RankAsync(deps, context)),
// ---- 查询 ---- // ---- 查询 ----
"magic-card" => new DelegateCommand( "magic-card" => new DelegateCommand(
key: "magic-card", name: "预览魔法卡", aliases: ["魔法卡", "card"], usage: "/预览魔法卡", key: "magic-card", name: "预览魔法卡", aliases: ["魔法卡", "card"], usage: "/预览魔法卡",
@@ -494,10 +606,13 @@ public static class CommandCatalog
"- 抽卡屋 @2 碰碰手气(/抽卡 · /十连抽卡)", "- 抽卡屋 @2 碰碰手气(/抽卡 · /十连抽卡)",
"- 训练场 @3 锻炼角色(/练级 @1 · /收取练级)", "- 训练场 @3 锻炼角色(/练级 @1 · /收取练级)",
"- 仓库  @4 整理背包(/背包)", "- 仓库  @4 整理背包(/背包)",
"- 补给站 @5 /商店 · /购买 @1",
"- 交易摊 @6 /市场 · /上架 @1 200",
"- 锻造炉 @7 /锻造 @1 · /收取锻造",
"", "",
"商店与交易摊位还蒙着布——那是下一批工匠的活。" "补给站和交易摊已经开张,铁匠的炉火也重新烧起来了。"
], ],
["/签到", "/每日任务", "/抽卡", "/练级 @1 1", "/背包"]); ["/签到", "/每日任务", "/商店", "/市场", "/背包"]);
} }
private static async Task<BotReply> QuestsAsync(CommandDependencies deps, CommandContext context) private static async Task<BotReply> QuestsAsync(CommandDependencies deps, CommandContext context)
@@ -543,4 +658,59 @@ public static class CommandCatalog
return CommandReplies.ListPage("👤 我的角色", $"{characters.Count} 名", lines, context.Page, return CommandReplies.ListPage("👤 我的角色", $"{characters.Count} 名", lines, context.Page,
"/我的角色", ["/状态", "/背包"]); "/我的角色", ["/状态", "/背包"]);
} }
// ---- P2 指令辅助 ----
private static long Price(CommandContext context, int position = 1)
=> position < context.Args.Count && long.TryParse(context.Args[position], out long value)
? value : 0; // 0 会被仓储的价格范围校验拦下并给出三段式提示
private static async Task<BotReply> ShopAsync(CommandDependencies deps, CommandContext context)
{
IReadOnlyList<StoreEntry> goods = await deps.Economy.GetStoreAsync(
context.UserId, context.CancellationToken);
List<string> lines = goods.Select(good =>
$"- @{good.Index} {good.Name} {good.Price} 金币 库存 {(good.Stock < 0 ? "无限" : good.Stock.ToString(CultureInfo.InvariantCulture))}").ToList();
lines.Add("- /购买 @编号 [x数量] · 同名物品会自动堆叠");
return CommandReplies.ListPage("🏪 铎京补给站", $"{goods.Count} 种商品", lines,
context.Page, "/商店", ["/背包", "/状态"]);
}
private static async Task<BotReply> MarketAsync(CommandDependencies deps, CommandContext context)
{
IReadOnlyList<MarketEntry> listings = await deps.Economy.GetMarketAsync(
context.UserId, context.CancellationToken);
List<string> lines = listings.Select(listing =>
$"- @{listing.Index} {GameplayRules.QualityName(listing.Quality)} · {listing.ItemName}"
+ $" {listing.Price} 金币 卖家 {listing.SellerHandle}{(listing.IsMine ? "(我的)" : "")}").ToList();
if (lines.Count == 0) lines.Add("- 市场暂时空着,用 /上架 @编号 <价格> 挂出第一件物品");
lines.Add("- /上架 @编号 <价格> · /购买市场 @编号 · /下架 @编号");
return CommandReplies.ListPage("🏷️ 旅人市场", $"{listings.Count} 件在售", lines,
context.Page, "/市场", ["/背包", "/状态"]);
}
private static async Task<BotReply> OffersAsync(CommandDependencies deps, CommandContext context)
{
IReadOnlyList<OfferEntry> offers = await deps.Economy.GetOffersAsync(
context.UserId, context.CancellationToken);
List<string> lines = offers.Select(offer =>
$"- @{offer.Index} {offer.ItemName} {offer.Price} 金币"
+ $" 发起 {offer.SellerHandle}{(offer.IsMine ? "(我的)" : "")}").ToList();
if (lines.Count == 0) lines.Add("- 暂无报价单,用 /报价 @编号 <价格> 发布");
lines.Add("- /报价 @编号 <价格> · /接受报价 @编号 · /撤回报价 @编号");
return CommandReplies.ListPage("📝 公开报价", $"{offers.Count} 份报价", lines,
context.Page, "/报价列表", ["/市场", "/背包"]);
}
private static async Task<BotReply> RankAsync(CommandDependencies deps, CommandContext context)
{
string board = context.FirstArgument ?? "credits";
IReadOnlyList<RankEntry> ranks = await deps.Economy.GetRankingAsync(
board, context.CancellationToken);
List<string> lines = ranks.Select(rank =>
$"- @{rank.Index} {rank.Handle} {rank.Value}").ToList();
if (lines.Count == 0) lines.Add("- 榜单还没有数据,先去 /决斗 或 /Boss 攒点战绩");
return CommandReplies.ListPage("🏆 排行榜", GameplayRules.RankingBoardName(board), lines,
context.Page, $"/排行榜 {board}", ["/决斗", "/Boss", "/状态"]);
}
} }
+2 -1
View File
@@ -14,7 +14,8 @@ public static class CommandGroups
public const string Stats = "统计"; public const string Stats = "统计";
public const string Simulation = "战斗模拟"; public const string Simulation = "战斗模拟";
public const string Player = "旅人存档"; public const string Player = "旅人存档";
public const string Legacy = "待迁移"; public const string Economy = "经济战斗";
public const string Legacy = "版本状态";
} }
/// <summary>命令工厂所需的全部依赖,全部由 DI 显式传入,不做反射扫描。</summary> /// <summary>命令工厂所需的全部依赖,全部由 DI 显式传入,不做反射扫描。</summary>
+3 -4
View File
@@ -164,11 +164,10 @@ public static class GameplayRules
("史诗遗物匣", 500, 20) ("史诗遗物匣", 500, 20)
]; ];
public static string RankingBoardName(string board) => board switch public static string RankingBoardName(string board) => board.ToLowerInvariant() switch
{ {
"credits" => "金币榜", "level" or "等级" => "等级榜",
"level" => "等级榜", "points" or "战绩" => "战绩榜",
"points" => "战绩榜",
_ => "金币榜" _ => "金币榜"
}; };