词法修正和代码清理

This commit is contained in:
milimoe 2025-11-17 21:48:36 +08:00
parent 878fab93fb
commit 7b64ec028a
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
17 changed files with 172 additions and 175 deletions

View File

@ -21,7 +21,7 @@ namespace Oshima.FunGame.OshimaModules.Characters
int reduceGrowth = 0;
if (primaryAttribute != PrimaryAttribute.None)
{
int attribute= Random.Shared.Next(15, 31);
int attribute = Random.Shared.Next(15, 31);
int growth = Random.Shared.Next(15, 31);
switch (primaryAttribute)
{

View File

@ -1,5 +1,4 @@
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.Core.Constant;
namespace Oshima.FunGame.OshimaModules.Regions
{

View File

@ -1,7 +1,6 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
using Oshima.FunGame.OshimaModules.Effects.SkillEffects;
namespace Oshima.FunGame.OshimaModules.Skills
{

View File

@ -1,7 +1,6 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
using Oshima.FunGame.OshimaModules.Effects.SkillEffects;
namespace Oshima.FunGame.OshimaModules.Skills
{

View File

@ -470,7 +470,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
do
{
username = "FunOsm-" + Verification.CreateVerifyCode(VerifyCodeType.MixVerifyCode, 8);
if (sqlHelper.ExecuteDataRow(UserQuery.Select_IsExistUsername(sqlHelper, username)) is null)
if (sqlHelper.ExecuteDataRow(UserQuery.Select_UserByUsername(sqlHelper, username)) is null)
{
exist = false;
}
@ -7834,8 +7834,8 @@ namespace Oshima.FunGame.WebAPI.Controllers
}
else
{
string msg2 = FunGameService.CheckRegionStore(stores, pc, user, storeRegion, storeName, out bool exist);
msg = exist ? $"正在获取最新商店数据,请稍后查看。" : msg2;
string msg2 = FunGameService.CheckRegionStore(stores, pc, user, storeRegion, storeName, out bool exists);
msg = exists ? $"正在获取最新商店数据,请稍后查看。" : msg2;
}
FunGameService.SetUserConfigAndReleaseSemaphoreSlim(userid, pc, user);

View File

@ -53,9 +53,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
private async Task SendHelp(IBotMessage e, Dictionary<string, string> helpDict, string helpName, int currentPage)
{
e.UseNotice = false;
int pageSize = 15;
{
e.UseNotice = false;
int pageSize = 15;
int totalPages = (helpDict.Count + pageSize - 1) / pageSize;
StringBuilder result = new($"《筽祀牻》{helpName}指令(第 {currentPage}/{totalPages} 页)\n");
@ -149,7 +149,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (!e.IsGroup && e.Detail == "获取接入码")
{
e.UseNotice = false;
await SendAsync(e, "获取接入码", $"你的接入码为 {openid},请妥善保存!");
await SendAsync(e, "获取接入码", $"你的接入码为 {openid},请妥善保存!");
return true;
}
@ -199,8 +199,8 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "公告")
{
e.UseNotice = false;
{
e.UseNotice = false;
FunGameService.RefreshNotice();
if (FunGameService.Notices.Count > 0)
{
@ -223,15 +223,15 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "刷新公告")
{
e.UseNotice = false;
FunGameService.RefreshNotice();
{
e.UseNotice = false;
FunGameService.RefreshNotice();
return true;
}
if (e.Detail.StartsWith("添加公告"))
{
e.UseNotice = false;
{
e.UseNotice = false;
string author = "FunGame";
FunGameConstant.UserIdAndUsername.TryGetValue(uid, out User? user);
if (user is null || (!user.IsAdmin && !user.IsOperator))
@ -281,26 +281,26 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "查询服务器启动时间")
{
e.UseNotice = false;
string msg = TestController.GetLastLoginTime();
{
e.UseNotice = false;
string msg = TestController.GetLastLoginTime();
await SendAsync(e, "查询服务器启动时间", msg);
return true;
}
if (e.Detail.StartsWith("查询任务计划"))
{
e.UseNotice = false;
string msg = TestController.GetTaskScheduler(e.Detail.Replace("查询任务计划", ""));
{
e.UseNotice = false;
string msg = TestController.GetTaskScheduler(e.Detail.Replace("查询任务计划", ""));
await SendAsync(e, "查询任务计划", msg);
return true;
}
// 指令处理
if (e.Detail == "帮助")
{
e.UseNotice = false;
await SendAsync(e, "筽祀牻", @$"欢迎使用《筽祀牻》游戏指令帮助系统!
{
e.UseNotice = false;
await SendAsync(e, "筽祀牻", @$"欢迎使用《筽祀牻》游戏指令帮助系统!
{FunGameInfo.FunGame_Version}
@ -358,9 +358,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("FunGame模拟", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
if (!FunGameSimulation)
{
e.UseNotice = false;
if (!FunGameSimulation)
{
FunGameSimulation = true;
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: 0);
@ -381,9 +381,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("混战模拟"))
{
e.UseNotice = false;
int maxRespawnTimesMix = 1;
{
e.UseNotice = false;
int maxRespawnTimesMix = 1;
string detail = e.Detail.Replace("混战模拟", "").Trim();
if (int.TryParse(detail, out int times))
{
@ -410,16 +410,16 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "上次的完整日志")
{
e.UseNotice = false;
await SendAsync(e, "筽祀牻", string.Join("\r\n", Controller.GetLast()));
{
e.UseNotice = false;
await SendAsync(e, "筽祀牻", string.Join("\r\n", Controller.GetLast()));
return result;
}
if (e.Detail.StartsWith("FunGame团队模拟", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
if (!FunGameSimulation)
{
e.UseNotice = false;
if (!FunGameSimulation)
{
FunGameSimulation = true;
List<string> msgs = await Controller.GetTest(false, true);
@ -440,9 +440,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("查数据", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
string detail = e.Detail.Replace("查数据", "").Trim();
{
e.UseNotice = false;
string detail = e.Detail.Replace("查数据", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = Controller.GetStats(id);
@ -455,9 +455,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("查团队数据", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
string detail = e.Detail.Replace("查团队数据", "").Trim();
{
e.UseNotice = false;
string detail = e.Detail.Replace("查团队数据", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = Controller.GetTeamStats(id);
@ -470,9 +470,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("查个人胜率", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
List<string> msgs = Controller.GetWinrateRank();
{
e.UseNotice = false;
List<string> msgs = Controller.GetWinrateRank();
if (msgs.Count > 0)
{
await SendAsync(e, "查个人胜率", string.Join("\r\n\r\n", msgs));
@ -481,9 +481,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("查团队胜率", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
List<string> msgs = Controller.GetWinrateRank(true);
{
e.UseNotice = false;
List<string> msgs = Controller.GetWinrateRank(true);
if (msgs.Count > 0)
{
await SendAsync(e, "查团队胜率", string.Join("\r\n\r\n", msgs));
@ -492,9 +492,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("查角色", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
string detail = e.Detail.Replace("查角色", "").Trim();
{
e.UseNotice = false;
string detail = e.Detail.Replace("查角色", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = Controller.GetCharacterInfo(id);
@ -507,9 +507,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("查技能", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
string detail = e.Detail.Replace("查技能", "").Trim();
{
e.UseNotice = false;
string detail = e.Detail.Replace("查技能", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = Controller.GetSkillInfo(uid, id);
@ -530,9 +530,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail.StartsWith("查物品", StringComparison.CurrentCultureIgnoreCase))
{
e.UseNotice = false;
string detail = e.Detail.Replace("查物品", "").Trim();
{
e.UseNotice = false;
string detail = e.Detail.Replace("查物品", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = Controller.GetItemInfo(uid, id);
@ -646,9 +646,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "预览魔法卡包")
{
e.UseNotice = false;
string msg = Controller.GenerateMagicCardPack();
{
e.UseNotice = false;
string msg = Controller.GenerateMagicCardPack();
if (msg != "")
{
await SendAsync(e, "预览魔法卡包", msg);
@ -656,9 +656,9 @@ namespace Oshima.FunGame.WebAPI.Services
return result;
}
else if (e.Detail == "预览魔法卡")
{
e.UseNotice = false;
string msg = Controller.GenerateMagicCard();
{
e.UseNotice = false;
string msg = Controller.GenerateMagicCard();
if (msg != "")
{
await SendAsync(e, "预览魔法卡", msg);
@ -667,9 +667,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "创建存档")
{
e.UseNotice = false;
string msg = Controller.CreateSaved(uid, openid);
{
e.UseNotice = false;
string msg = Controller.CreateSaved(uid, openid);
if (msg != "")
{
await SendAsync(e, "创建存档", "\r\n" + msg);
@ -688,9 +688,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "我的主战")
{
e.UseNotice = false;
string msg = Controller.GetCharacterInfoFromInventory(uid, 0);
{
e.UseNotice = false;
string msg = Controller.GetCharacterInfoFromInventory(uid, 0);
if (msg != "")
{
await SendAsync(e, "我的主战", "\r\n" + msg);
@ -699,9 +699,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "我的状态")
{
e.UseNotice = false;
string msg = Controller.ShowMainCharacterOrSquadStatus(uid);
{
e.UseNotice = false;
string msg = Controller.ShowMainCharacterOrSquadStatus(uid);
if (msg != "")
{
await SendAsync(e, "我的状态", "\r\n" + msg);
@ -710,9 +710,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "小队状态" || e.Detail == "我的小队状态")
{
e.UseNotice = false;
string msg = Controller.ShowMainCharacterOrSquadStatus(uid, true);
{
e.UseNotice = false;
string msg = Controller.ShowMainCharacterOrSquadStatus(uid, true);
if (msg != "")
{
await SendAsync(e, "我的小队状态", "\r\n" + msg);
@ -721,9 +721,9 @@ namespace Oshima.FunGame.WebAPI.Services
}
if (e.Detail == "我的小队")
{
e.UseNotice = false;
string msg = Controller.ShowSquad(uid);
{
e.UseNotice = false;
string msg = Controller.ShowSquad(uid);
if (msg != "")
{
await SendAsync(e, "我的小队", "\r\n" + msg);
@ -1567,7 +1567,7 @@ namespace Oshima.FunGame.WebAPI.Services
await SendAsync(e, "使用", msg);
}
}
else if(!string.IsNullOrEmpty(itemPart))
else if (!string.IsNullOrEmpty(itemPart))
{
string msg = Controller.UseItem2(uid, itemPart, count, characterIds);
if (msg != "")