mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2026-06-04 19:42:13 +00:00
4277 lines
189 KiB
C#
4277 lines
189 KiB
C#
using System.Text;
|
||
using System.Text.RegularExpressions;
|
||
using Microsoft.Extensions.Caching.Memory;
|
||
using Microsoft.Extensions.Logging;
|
||
using Milimoe.FunGame.Core.Api.Transmittal;
|
||
using Milimoe.FunGame.Core.Api.Utility;
|
||
using Milimoe.FunGame.Core.Entity;
|
||
using Milimoe.FunGame.Core.Library.Constant;
|
||
using Oshima.Core.Configs;
|
||
using Oshima.Core.Constant;
|
||
using Oshima.FunGame.OshimaModules.Models;
|
||
using Oshima.FunGame.OshimaServers.Model;
|
||
using Oshima.FunGame.OshimaServers.Service;
|
||
using Oshima.FunGame.WebAPI.Constant;
|
||
using Oshima.FunGame.WebAPI.Controllers;
|
||
using Oshima.FunGame.WebAPI.Model;
|
||
using Oshima.FunGame.WebAPI.Models;
|
||
|
||
namespace Oshima.FunGame.WebAPI.Services
|
||
{
|
||
public class RainBOTService(FunGameController controller, QQController qqcontroller, QQBotService service, ILogger<RainBOTService> logger, IMemoryCache memoryCache, TestController testController, CSBettingController bettingController)
|
||
{
|
||
private static List<string> FunGameItemType { get; } = ["卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"];
|
||
private bool FunGameSimulation { get; set; } = false;
|
||
private FunGameController Controller { get; } = controller;
|
||
private QQController QQController { get; } = qqcontroller;
|
||
private QQBotService Service { get; } = service;
|
||
private ILogger<RainBOTService> Logger { get; } = logger;
|
||
private IMemoryCache MemoryCache { get; set; } = memoryCache;
|
||
private TestController TestController { get; set; } = testController;
|
||
private CSBettingController BettingController { get; set; } = bettingController;
|
||
|
||
private async Task SendAsync(IBotMessage msg, string title, BotReply reply, int? msgSeq = null)
|
||
{
|
||
if (reply.Markdown != null)
|
||
{
|
||
// 发送 Markdown + 键盘
|
||
await SendMarkdownAsync(msg, title, reply.Markdown, reply.Keyboard, msgSeq);
|
||
}
|
||
else if (reply.Keyboard != null)
|
||
{
|
||
// 发送 文本 + 键盘
|
||
await SendMarkdownAsync(msg, title, new()
|
||
{
|
||
Content = reply.Text
|
||
}, reply.Keyboard, msgSeq);
|
||
}
|
||
else
|
||
{
|
||
// 发送纯文本
|
||
await SendTextAsync(msg, title, reply.Text ?? string.Empty, msgSeq: msgSeq);
|
||
}
|
||
}
|
||
|
||
private async Task SendTextAsync(IBotMessage msg, string title, string content, int msgType = 0, object? media = null, int? msgSeq = null)
|
||
{
|
||
Statics.RunningPlugin?.Controller.WriteLine(title, Milimoe.FunGame.Core.Library.Constant.LogLevel.Debug);
|
||
if (msg is ThirdPartyMessage third)
|
||
{
|
||
third.Result += "\r\n" + content.Trim();
|
||
third.IsCompleted = true;
|
||
}
|
||
else if (msg.IsGroup)
|
||
{
|
||
content = "\r\n" + content.Trim();
|
||
await Service.SendGroupMessageAsync(msg.OpenId, content, msgType, media, msg.Id, msgSeq);
|
||
}
|
||
else
|
||
{
|
||
content = content.Trim();
|
||
await Service.SendC2CMessageAsync(msg.OpenId, content, msgType, media, msg.Id, msgSeq);
|
||
}
|
||
await CheckOfflineNotice(msg);
|
||
}
|
||
|
||
private async Task SendMarkdownAsync(IBotMessage msg, string title, MarkdownMessage mdMsg, KeyboardMessage? kbMsg = null, int? msgSeq = null)
|
||
{
|
||
Statics.RunningPlugin?.Controller.WriteLine(title, Milimoe.FunGame.Core.Library.Constant.LogLevel.Debug);
|
||
if (msg is ThirdPartyMessage third)
|
||
{
|
||
third.Result += "\r\n" + mdMsg.Content?.Trim();
|
||
third.IsCompleted = true;
|
||
}
|
||
else if (msg.IsGroup)
|
||
{
|
||
await Service.SendGroupMarkdownAsync(msg.OpenId, mdMsg, kbMsg, msg.Id, msgSeq);
|
||
}
|
||
else
|
||
{
|
||
await Service.SendC2CMarkdownAsync(msg.OpenId, mdMsg, kbMsg, msg.Id, msgSeq);
|
||
}
|
||
await CheckOfflineNotice(msg);
|
||
}
|
||
|
||
private async Task CheckOfflineNotice(IBotMessage msg)
|
||
{
|
||
if (msg.UseNotice && msg.FunGameUID > 0 && FunGameService.UserNotice.TryGetValue(msg.FunGameUID, out HashSet<string>? msgs) && msgs != null)
|
||
{
|
||
FunGameService.UserNotice.Remove(msg.FunGameUID, out _);
|
||
await SendTextAsync(msg, "离线未读信箱", $"☆--- 离线未读信箱 ---☆\r\n{string.Join("\r\n", msgs)}", 0, null, 5);
|
||
}
|
||
}
|
||
|
||
private async Task SendHelp(IBotMessage e, Dictionary<string, string> helpDict, string helpName, int currentPage)
|
||
{
|
||
e.UseNotice = false;
|
||
if (currentPage <= 0) currentPage = 1;
|
||
int pageSize = 15;
|
||
int totalPages = helpDict.MaxPage(pageSize);
|
||
|
||
StringBuilder result = new($"《筽祀牻》{helpName}指令(第 {currentPage}/{totalPages} 页)\n");
|
||
|
||
int index = (currentPage - 1) * pageSize + 1;
|
||
foreach ((string cmd, string desc) in helpDict.GetPage(currentPage, pageSize))
|
||
{
|
||
result.AppendLine($"{index}. {cmd}{(desc != "" ? ":" + desc : "")}");
|
||
index++;
|
||
}
|
||
|
||
KeyboardMessage kb = new KeyboardMessage().AddPaginationRow(helpName, currentPage, totalPages);
|
||
|
||
await SendAsync(e, "筽祀牻", new BotReply()
|
||
{
|
||
Markdown = new()
|
||
{
|
||
Content = result.ToString()
|
||
},
|
||
Keyboard = kb
|
||
});
|
||
}
|
||
|
||
public async Task<bool> Handler(IBotMessage e, OtherData data)
|
||
{
|
||
bool result = true;
|
||
try
|
||
{
|
||
if (e is null)
|
||
{
|
||
return false;
|
||
}
|
||
|
||
string isGroup = e.IsGroup ? "群聊" : "私聊";
|
||
string openid = e.AuthorOpenId;
|
||
long uid = 0;
|
||
|
||
if (openid != "")
|
||
{
|
||
if (MemoryCache.TryGetValue(openid, out object? value) && value is long uidTemp)
|
||
{
|
||
uid = uidTemp;
|
||
e.FunGameUID = uid;
|
||
}
|
||
else
|
||
{
|
||
using SQLHelper? sql = Factory.OpenFactory.GetSQLHelper();
|
||
if (sql != null)
|
||
{
|
||
sql.ExecuteDataSet(FunGameService.Select_CheckAutoKey(sql, openid));
|
||
if (sql.Success)
|
||
{
|
||
User user = Factory.GetUser(sql.DataSet);
|
||
uid = user.Id;
|
||
e.FunGameUID = uid;
|
||
MemoryCache.Set(openid, uid, TimeSpan.FromMinutes(10));
|
||
FunGameService.UIDWithOpenID[uid] = openid;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (e.Detail == "重置状态")
|
||
{
|
||
FunGameService.ReleaseUserSemaphoreSlim(uid);
|
||
await SendAsync(e, "筽祀牻", "Done");
|
||
return result;
|
||
}
|
||
|
||
if (FunGameService.CheckSemaphoreSlim(uid))
|
||
{
|
||
await SendAsync(e, "筽祀牻", "检测到上一条指令尚未完成,若出现异常情况,请等待其执行完成,或者使用【重置状态】指令重置当前的指令执行状态。", msgSeq: 999);
|
||
return result;
|
||
}
|
||
|
||
//if (QQOpenID.QQAndOpenID.TryGetValue(openid, out long temp_qq))
|
||
//{
|
||
// qq = temp_qq;
|
||
//}
|
||
|
||
//if (e.Detail.StartsWith("绑定"))
|
||
//{
|
||
// string detail = e.Detail.Replace("绑定", "");
|
||
// string msg = "";
|
||
// if (long.TryParse(detail, out temp_qq))
|
||
// {
|
||
// msg = QQController.Bind(new(openid, temp_qq));
|
||
// }
|
||
// else
|
||
// {
|
||
// msg = "绑定失败,请提供一个正确的QQ号!";
|
||
// }
|
||
// await SendAsync(e, "绑定", msg);
|
||
//}
|
||
|
||
if (!e.IsGroup && e.Detail == "获取接入码")
|
||
{
|
||
e.UseNotice = false;
|
||
await SendAsync(e, "获取接入码", $"你的接入码为 {openid},请妥善保存!");
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail == "我的运势")
|
||
{
|
||
OpenUserDaily daily = new(openid, 0, "今日运势列表为空,请联系管理员设定");
|
||
if (QQOpenID.QQAndOpenID.TryGetValue(openid, out long qq) && qq != 0)
|
||
{
|
||
UserDaily qqDaily = UserDailyService.GetUserDaily(qq);
|
||
daily.type = qqDaily.type;
|
||
daily.daily = qqDaily.daily;
|
||
}
|
||
else
|
||
{
|
||
daily = UserDailyService.GetOpenUserDaily(openid);
|
||
}
|
||
|
||
if (daily.type != 0)
|
||
{
|
||
// 上传图片
|
||
string img = $@"{GeneralSettings.DailyImageServerUrl}/images/zi/";
|
||
img += daily.type switch
|
||
{
|
||
1 => "dj" + (new Random().Next(3) + 1) + ".png",
|
||
2 => "zj" + (new Random().Next(2) + 1) + ".png",
|
||
3 => "j" + (new Random().Next(4) + 1) + ".png",
|
||
4 => "mj" + (new Random().Next(2) + 1) + ".png",
|
||
5 => "x" + (new Random().Next(2) + 1) + ".png",
|
||
6 => "dx" + (new Random().Next(2) + 1) + ".png",
|
||
_ => ""
|
||
};
|
||
|
||
// 传统派已离场
|
||
//string? fi = "";
|
||
//string? err = "";
|
||
//try
|
||
//{
|
||
// UploadMediaResult uploadMediaResult = e.IsGroup ? await Service.UploadGroupMediaAsync(e.OpenId, 1, img) : await Service.UploadC2CMediaAsync(e.OpenId, 1, img);
|
||
// fi = uploadMediaResult.FileInfo;
|
||
// err = uploadMediaResult.Error;
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// err = ex.ToString();
|
||
//}
|
||
//if (string.IsNullOrEmpty(err))
|
||
//{
|
||
// await SendTextAsync(e, "每日运势", daily.daily, 7, new { file_info = fi });
|
||
//}
|
||
//else
|
||
//{
|
||
// if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError("上传图片失败:{error}", err);
|
||
// await SendAsync(e, "每日运势", daily.daily);
|
||
//}
|
||
|
||
// 使用md
|
||
await SendAsync(e, "每日运势", new BotReply()
|
||
{
|
||
Markdown = new()
|
||
{
|
||
Content = $"{daily.daily}\r\n"
|
||
}
|
||
});
|
||
|
||
BotReply rpy = Controller.GetUserDailyItem(uid, daily.daily);
|
||
await SendAsync(e, "运势幸运物发放", rpy, msgSeq: 3);
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "每日运势", daily.daily);
|
||
}
|
||
}
|
||
|
||
if (e.Detail == "公告")
|
||
{
|
||
e.UseNotice = false;
|
||
FunGameService.RefreshNotice();
|
||
List<string> msgs = [];
|
||
DateTime now = DateTime.Now;
|
||
foreach (NoticeModel notice in FunGameService.Notices.Values)
|
||
{
|
||
if (now >= notice.StartTime && now <= notice.EndTime)
|
||
{
|
||
msgs.Add(notice.ToString());
|
||
}
|
||
}
|
||
if (msgs.Count > 0)
|
||
{
|
||
await SendAsync(e, "公告", new BotReply()
|
||
{
|
||
Markdown = new()
|
||
{
|
||
Content = $"系统公告列表:\r\n```\r\n{string.Join("\r\n", msgs)}\r\n```"
|
||
}
|
||
});
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "公告", "当前没有任何系统公告。");
|
||
}
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail == "刷新公告")
|
||
{
|
||
e.UseNotice = false;
|
||
FunGameService.RefreshNotice();
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("添加公告"))
|
||
{
|
||
e.UseNotice = false;
|
||
string author = "FunGame";
|
||
FunGameConstant.UserIdAndUsername.TryGetValue(uid, out User? user);
|
||
if (user is null || (!user.IsAdmin && !user.IsOperator))
|
||
{
|
||
await SendAsync(e, "公告", "你没有权限使用此指令。");
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
author = user.Username;
|
||
}
|
||
string detail = e.Detail.Replace("添加公告", "").Trim();
|
||
string[] strings = detail.Split(["\r\n", "\r", "\n"], StringSplitOptions.RemoveEmptyEntries);
|
||
string title = $"#Unknown";
|
||
if (strings.Length > 1)
|
||
{
|
||
title = strings[0].Trim();
|
||
detail = strings[1].Trim();
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "添加公告", $"格式错误:添加公告 <标题>\r\n<内容> [有效期 <天数>]。");
|
||
return true;
|
||
}
|
||
strings = detail.Split("有效期");
|
||
int days = 1;
|
||
if (strings.Length > 1)
|
||
{
|
||
if (int.TryParse(strings[1].Trim(), out int d))
|
||
{
|
||
days = d;
|
||
}
|
||
detail = strings[0].Trim();
|
||
}
|
||
FunGameService.Notices.Add(title, new NoticeModel()
|
||
{
|
||
Title = title,
|
||
Author = author,
|
||
Content = detail,
|
||
StartTime = DateTime.Now,
|
||
EndTime = DateTime.Today.AddHours(3).AddMinutes(59).AddSeconds(59).AddDays(days)
|
||
});
|
||
FunGameService.Notices.SaveConfig();
|
||
FunGameService.RefreshNotice();
|
||
await SendAsync(e, "添加公告", $"添加完毕,请查看【公告】列表!");
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail == "查询服务器启动时间")
|
||
{
|
||
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("查询任务计划", ""));
|
||
await SendAsync(e, "查询任务计划", msg);
|
||
return true;
|
||
}
|
||
|
||
// 指令处理
|
||
if (e.Detail == "帮助")
|
||
{
|
||
e.UseNotice = false;
|
||
await SendAsync(e, "筽祀牻", new BotReply()
|
||
{
|
||
Markdown = new()
|
||
{
|
||
Content = @$"欢迎使用《筽祀牻》游戏指令帮助系统!
|
||
核心库版本号:{FunGameInfo.FunGame_Version}
|
||
《筽祀牻》是一款奇幻冒险回合制角色扮演游戏。
|
||
在游戏中,你可以和其他角色组成小队,收集物品,在数十个独具风格的地区中冒险并战斗。
|
||
因游戏内容、指令较多,我们将按游戏模块对指令分类,请输入以下指令查看具体分类的帮助内容:
|
||
1、<qqbot-cmd-input text=""存档帮助 "" show=""存档帮助""/>
|
||
2、<qqbot-cmd-input text=""角色帮助 "" show=""角色帮助""/>
|
||
3、<qqbot-cmd-input text=""物品帮助 "" show=""物品帮助""/>
|
||
4、<qqbot-cmd-input text=""战斗帮助 "" show=""战斗帮助""/>
|
||
5、<qqbot-cmd-input text=""玩法帮助 "" show=""玩法帮助""/>
|
||
6、<qqbot-cmd-input text=""社团帮助 "" show=""社团帮助""/>
|
||
7、<qqbot-cmd-input text=""活动帮助 "" show=""活动帮助""/>
|
||
8、<qqbot-cmd-input text=""商店帮助 "" show=""商店帮助""/>
|
||
在指令后面加数字即可跳转指定的页码,感谢游玩《筽祀牻》。"
|
||
}
|
||
});
|
||
}
|
||
|
||
if (e.Detail.StartsWith("存档帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.ArchiveHelp, "存档帮助", page);
|
||
}
|
||
else if (e.Detail.StartsWith("角色帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.CharacterHelp, "角色帮助", page);
|
||
}
|
||
else if (e.Detail.StartsWith("物品帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.ItemHelp, "物品帮助", page);
|
||
}
|
||
else if (e.Detail.StartsWith("战斗帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.BattleHelp, "战斗帮助", page);
|
||
}
|
||
else if (e.Detail.StartsWith("玩法帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.PlayHelp, "玩法帮助", page);
|
||
}
|
||
else if (e.Detail.StartsWith("社团帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.ClubHelp, "社团帮助", page);
|
||
}
|
||
else if (e.Detail.StartsWith("活动帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.ActivityHelp, "活动帮助", page);
|
||
}
|
||
else if (e.Detail.StartsWith("商店帮助"))
|
||
{
|
||
int page = e.Detail.Length > 4 && int.TryParse(e.Detail[4..], out int p) ? p : 1;
|
||
await SendHelp(e, FunGameOrderList.StoreHelp, "商店帮助", page);
|
||
}
|
||
|
||
if (e.Detail.StartsWith("FunGame模拟", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
if (!FunGameSimulation)
|
||
{
|
||
FunGameSimulation = true;
|
||
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: 0);
|
||
BotReply rpy = MergeToMarkdown("模拟结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("FunGame模拟", $"FunGame模拟"));
|
||
await SendAsync(e, "筽祀牻", rpy, msgSeq: 1);
|
||
FunGameSimulation = false;
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "筽祀牻", "游戏正在模拟中,请勿重复请求!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("个人地图模拟", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
if (!FunGameSimulation)
|
||
{
|
||
FunGameSimulation = true;
|
||
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: 0, hasMap: true);
|
||
BotReply rpy = MergeToMarkdown("模拟结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("个人地图模拟", $"个人地图模拟"));
|
||
await SendAsync(e, "筽祀牻", rpy, msgSeq: 1);
|
||
FunGameSimulation = false;
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "筽祀牻", "游戏正在模拟中,请勿重复请求!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("混战模拟"))
|
||
{
|
||
e.UseNotice = false;
|
||
int maxRespawnTimesMix = 1;
|
||
string detail = e.Detail.Replace("混战模拟", "").Trim();
|
||
if (int.TryParse(detail, out int times))
|
||
{
|
||
maxRespawnTimesMix = times;
|
||
}
|
||
if (!FunGameSimulation)
|
||
{
|
||
FunGameSimulation = true;
|
||
List<string> msgs = await Controller.GetTest(false, maxRespawnTimesMix: maxRespawnTimesMix);
|
||
BotReply rpy = MergeToMarkdown("模拟结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("混战模拟", $"混战模拟"));
|
||
await SendAsync(e, "筽祀牻", rpy, msgSeq: 1);
|
||
FunGameSimulation = false;
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "筽祀牻", "游戏正在模拟中,请勿重复请求!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "上次的完整日志")
|
||
{
|
||
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)
|
||
{
|
||
FunGameSimulation = true;
|
||
List<string> msgs = await Controller.GetTest(false, true);
|
||
BotReply rpy = MergeToMarkdown("模拟结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("FunGame团队模拟", $"FunGame团队模拟"));
|
||
await SendAsync(e, "筽祀牻", rpy, msgSeq: 1);
|
||
FunGameSimulation = false;
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "筽祀牻", "游戏正在模拟中,请勿重复请求!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("团队地图模拟", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
if (!FunGameSimulation)
|
||
{
|
||
FunGameSimulation = true;
|
||
List<string> msgs = await Controller.GetTest(false, true, hasMap: true);
|
||
BotReply rpy = MergeToMarkdown("模拟结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("团队地图模拟", $"团队地图模拟"));
|
||
await SendAsync(e, "筽祀牻", rpy, msgSeq: 1);
|
||
FunGameSimulation = false;
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "筽祀牻", "游戏正在模拟中,请勿重复请求!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("团队调试模拟", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
if (!FunGameSimulation)
|
||
{
|
||
FunGameSimulation = true;
|
||
List<string> msgs = await Controller.GetTestDebug(false, true, hasMap: true);
|
||
BotReply rpy = MergeToMarkdown("模拟结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("团队调试模拟", $"团队调试模拟"));
|
||
await SendAsync(e, "筽祀牻", rpy, msgSeq: 1);
|
||
FunGameSimulation = false;
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "筽祀牻", "游戏正在模拟中,请勿重复请求!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查数据", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
string detail = e.Detail.Replace("查数据", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = Controller.GetStats(id);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查数据", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查团队数据", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
string detail = e.Detail.Replace("查团队数据", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = Controller.GetTeamStats(id);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查团队数据", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查个人胜率", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
List<string> msgs = Controller.GetWinrateRank();
|
||
if (msgs.Count > 0)
|
||
{
|
||
await SendAsync(e, "查个人胜率", string.Join("\r\n\r\n", msgs));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查团队胜率", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
List<string> msgs = Controller.GetWinrateRank(true);
|
||
if (msgs.Count > 0)
|
||
{
|
||
await SendAsync(e, "查团队胜率", string.Join("\r\n\r\n", msgs));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查角色", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
string detail = e.Detail.Replace("查角色", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = Controller.GetCharacterInfo(id);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查角色", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查技能", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
string detail = e.Detail.Replace("查技能", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = Controller.GetSkillInfo(uid, id);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查技能", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string msg = Controller.GetSkillInfo_Name(uid, detail);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查技能", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查物品", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
e.UseNotice = false;
|
||
string detail = e.Detail.Replace("查物品", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = Controller.GetItemInfo(uid, id);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查物品", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string msg = Controller.GetItemInfo_Name(uid, detail);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查物品", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("生成指定"))
|
||
{
|
||
e.UseNotice = false;
|
||
string pattern = @"生成指定(\w+)魔法卡\s*(\d+)(?:(?:\s*(\d+)\s+(\d+)\s+(\d+)(?:\s+(\d+))?)|(?:\s*(\d+)(?!\s*\d)))?(?:\s*给\s*(\d+))?";
|
||
Regex regex = new(pattern, RegexOptions.IgnoreCase);
|
||
Match match = regex.Match(e.Detail);
|
||
|
||
if (match.Success && ((match.Groups[3].Success && match.Groups[4].Success && match.Groups[5].Success) || match.Groups[7].Success))
|
||
{
|
||
string quality = match.Groups[1].Value;
|
||
long magicID = long.Parse(match.Groups[2].Value);
|
||
int str = 0, agi = 0, intelligence = 0, count = 1;
|
||
long targetUserID = uid;
|
||
|
||
// 检查是否匹配到 str agi intelligence 模式 (Group 3, 4, 5)
|
||
if (match.Groups[3].Success && match.Groups[4].Success && match.Groups[5].Success)
|
||
{
|
||
str = int.Parse(match.Groups[3].Value);
|
||
agi = int.Parse(match.Groups[4].Value);
|
||
intelligence = int.Parse(match.Groups[5].Value);
|
||
|
||
// 如果此模式下有 count (Group 6)
|
||
if (match.Groups[6].Success)
|
||
{
|
||
count = int.Parse(match.Groups[6].Value);
|
||
}
|
||
}
|
||
// 否则,检查是否匹配到单独的 count 模式 (Group 7)
|
||
else if (match.Groups[7].Success)
|
||
{
|
||
count = int.Parse(match.Groups[7].Value);
|
||
}
|
||
|
||
if (count <= 0)
|
||
{
|
||
await SendAsync(e, "熟圣之力", "数量不能为 0 或负数,请重新输入。");
|
||
return result;
|
||
}
|
||
|
||
if (match.Groups[8].Success)
|
||
{
|
||
targetUserID = long.Parse(match.Groups[8].Value);
|
||
}
|
||
|
||
string msg = Controller.CreateMagicCard(uid, targetUserID, quality, magicID, count, str, agi, intelligence);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "熟圣之力", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "熟圣之力", "指令格式错误!请检查格式:\r\n1、生成指定<品质>魔法卡 <MagicID> [str agi intelligence] [count] [给 <TargetID>]\r\n" +
|
||
"2、生成指定<品质>魔法卡 <MagicID> [count] [给 <TargetID>]\r\n注意:[str agi intelligence] 可选块的三个参数都必须完整提供。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("生成"))
|
||
{
|
||
e.UseNotice = false;
|
||
string pattern = @"生成\s*(\d+)\s*个\s*([^给\s]+)(?:\s*给\s*(\d+))?";
|
||
Regex regex = new(pattern, RegexOptions.IgnoreCase);
|
||
Match match = regex.Match(e.Detail);
|
||
|
||
if (match.Success)
|
||
{
|
||
int count = int.Parse(match.Groups[1].Value);
|
||
string name = match.Groups[2].Value.Trim();
|
||
string target = match.Groups[3].Value;
|
||
long userid = uid;
|
||
|
||
if (!string.IsNullOrEmpty(target))
|
||
{
|
||
userid = long.Parse(target);
|
||
}
|
||
|
||
if (count > 0)
|
||
{
|
||
string msg = Controller.CreateItem(uid, name, count, userid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "熟圣之力", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "熟圣之力", "数量不能为 0,请重新输入。");
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
|
||
if (e.Detail == "预览魔法卡包")
|
||
{
|
||
e.UseNotice = false;
|
||
string msg = Controller.GenerateMagicCardPack();
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "预览魔法卡包", msg);
|
||
}
|
||
return result;
|
||
}
|
||
else if (e.Detail == "预览魔法卡")
|
||
{
|
||
e.UseNotice = false;
|
||
string msg = Controller.GenerateMagicCard();
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "预览魔法卡", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "创建存档")
|
||
{
|
||
e.UseNotice = false;
|
||
string msg = Controller.CreateSaved(uid, openid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "创建存档", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "我的存档")
|
||
{
|
||
BotReply rpy = Controller.ShowSaved(uid);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(3, [
|
||
Button.CreateCmdButton("签到", "签到"),
|
||
Button.CreateCmdButton("帮助", "帮助"),
|
||
Button.CreateCmdButton("运势", "我的运势"),
|
||
Button.CreateCmdButton("库存", "我的库存"),
|
||
Button.CreateCmdButton("任务", "任务列表"),
|
||
Button.CreateCmdButton("商店", "每日商店")
|
||
]);
|
||
await SendAsync(e, "我的存档", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "我的主战")
|
||
{
|
||
e.UseNotice = false;
|
||
string msg = Controller.GetCharacterInfoFromInventory(uid, 0);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "我的主战", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "我的状态")
|
||
{
|
||
e.UseNotice = false;
|
||
string msg = Controller.ShowMainCharacterOrSquadStatus(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "我的状态", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "小队状态" || e.Detail == "我的小队状态")
|
||
{
|
||
e.UseNotice = false;
|
||
string msg = Controller.ShowMainCharacterOrSquadStatus(uid, true);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "我的小队状态", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "我的小队")
|
||
{
|
||
e.UseNotice = false;
|
||
await SendAsync(e, "我的小队", Controller.ShowSquad(uid));
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "清空小队")
|
||
{
|
||
string msg = Controller.ClearSquad(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "清空小队", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "还原存档")
|
||
{
|
||
e.UseNotice = false;
|
||
await SendAsync(e, "还原存档", "\r\n请在该指令前添加【确认】二字,即使用【确认还原存档】指令。");
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "确认还原存档")
|
||
{
|
||
string msg = Controller.RestoreSaved(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "还原存档", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "生成自建角色")
|
||
{
|
||
string msg = Controller.NewCustomCharacter(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "生成自建角色", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "角色改名")
|
||
{
|
||
e.UseNotice = false;
|
||
BotReply rpy = "为防止玩家手误更改自己的昵称,请在该指令前添加【确认】二字,即使用【确认角色改名】指令。";
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("确认", "确认角色改名", false));
|
||
await SendAsync(e, "改名", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "确认角色改名")
|
||
{
|
||
BotReply rpy = Controller.ReName(uid);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("查询改名", "查询改名"));
|
||
await SendAsync(e, "改名", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "查询改名")
|
||
{
|
||
string msg = Controller.GetReNameInfo(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查询改名", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("改名审核"))
|
||
{
|
||
string detail = e.Detail.Replace("改名审核", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
msg = Controller.GetReNameExamines(uid, page);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetReNameExamines(uid);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "改名审核", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("改名拒绝"))
|
||
{
|
||
string detail = e.Detail.Replace("改名拒绝", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||
if (strings.Length > 0)
|
||
{
|
||
string reason = "";
|
||
if (strings.Length > 1)
|
||
{
|
||
reason = string.Join(" ", strings[1..]).Trim();
|
||
}
|
||
if (long.TryParse(strings[0], out long target))
|
||
{
|
||
msg = Controller.ApproveReName(uid, target, false, false, reason);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "改名拒绝", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("改名批准"))
|
||
{
|
||
string detail = e.Detail.Replace("改名批准", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long target))
|
||
{
|
||
msg = Controller.ApproveReName(uid, target);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "改名批准", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团改名拒绝"))
|
||
{
|
||
string detail = e.Detail.Replace("社团改名拒绝", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||
if (strings.Length > 0)
|
||
{
|
||
string reason = "";
|
||
if (strings.Length > 1)
|
||
{
|
||
reason = string.Join(" ", strings[1..]).Trim();
|
||
}
|
||
if (long.TryParse(strings[0], out long target))
|
||
{
|
||
msg = Controller.ApproveReName(uid, target, false, true, reason);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团改名拒绝", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团改名批准"))
|
||
{
|
||
string detail = e.Detail.Replace("社团改名批准", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long target))
|
||
{
|
||
msg = Controller.ApproveReName(uid, target, isClub: true);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团改名批准", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("自定义改名"))
|
||
{
|
||
e.UseNotice = false;
|
||
BotReply rpy = "自定义改名说明:自定义改名需要库存中存在至少一张未上锁、且未处于交易、市场出售状态的改名卡,提交改名申请后需要等待审核。" +
|
||
"在审核期间,改名卡将会被系统锁定,无法取消、重复提交申请,也不能解锁、分解、交易、出售该改名卡。如已知悉请在该指令前添加【确认】二字,即使用【确认自定义改名】指令。";
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("确认", "确认自定义改名", false));
|
||
await SendAsync(e, "改名", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("确认自定义改名"))
|
||
{
|
||
e.UseNotice = false;
|
||
string detail = e.Detail.Replace("确认自定义改名", "").Trim();
|
||
string msg = Controller.ReName_Custom(uid, detail);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "改名", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "角色重随")
|
||
{
|
||
BotReply rpy = Controller.RandomCustomCharacter(uid, false);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(2, [
|
||
Button.CreateCmdButton("取消角色重随", "取消角色重随", false, style: 0),
|
||
Button.CreateCmdButton("确认角色重随", "确认角色重随", false),
|
||
]);
|
||
await SendAsync(e, "角色重随", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "确认角色重随")
|
||
{
|
||
string msg = Controller.RandomCustomCharacter(uid, true);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "角色重随", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "取消角色重随")
|
||
{
|
||
BotReply rpy = Controller.CancelRandomCustomCharacter(uid);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("角色重随", "角色重随", false));
|
||
await SendAsync(e, "角色重随", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "抽卡")
|
||
{
|
||
List<string> msgs = Controller.DrawCard(uid);
|
||
if (msgs.Count > 0)
|
||
{
|
||
BotReply rpy = MergeToMarkdown("抽卡结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(2, [
|
||
Button.CreateCmdButton("抽卡", "抽卡"),
|
||
Button.CreateCmdButton("十连抽卡", "十连抽卡"),
|
||
]).AppendButtonsWithNewRow(2, [
|
||
Button.CreateCmdButton("钻石抽卡", "钻石抽卡"),
|
||
Button.CreateCmdButton("钻石十连抽卡", "钻石十连抽卡"),
|
||
]);
|
||
await SendAsync(e, "抽卡", rpy);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "十连抽卡")
|
||
{
|
||
List<string> msgs = Controller.DrawCards(uid);
|
||
if (msgs.Count > 0)
|
||
{
|
||
BotReply rpy = MergeToMarkdown("抽卡结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(2, [
|
||
Button.CreateCmdButton("抽卡", "抽卡"),
|
||
Button.CreateCmdButton("十连抽卡", "十连抽卡"),
|
||
]).AppendButtonsWithNewRow(2, [
|
||
Button.CreateCmdButton("钻石抽卡", "钻石抽卡"),
|
||
Button.CreateCmdButton("钻石十连抽卡", "钻石十连抽卡"),
|
||
]);
|
||
await SendAsync(e, "十连抽卡", rpy);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "钻石抽卡")
|
||
{
|
||
List<string> msgs = Controller.DrawCard_Material(uid);
|
||
if (msgs.Count > 0)
|
||
{
|
||
BotReply rpy = MergeToMarkdown("抽卡结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(2, [
|
||
Button.CreateCmdButton("抽卡", "抽卡"),
|
||
Button.CreateCmdButton("十连抽卡", "十连抽卡"),
|
||
]).AppendButtonsWithNewRow(2, [
|
||
Button.CreateCmdButton("钻石抽卡", "钻石抽卡"),
|
||
Button.CreateCmdButton("钻石十连抽卡", "钻石十连抽卡"),
|
||
]);
|
||
await SendAsync(e, "钻石抽卡", rpy);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "钻石十连抽卡")
|
||
{
|
||
List<string> msgs = Controller.DrawCards_Material(uid);
|
||
if (msgs.Count > 0)
|
||
{
|
||
BotReply rpy = MergeToMarkdown("抽卡结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(2, [
|
||
Button.CreateCmdButton("抽卡", "抽卡"),
|
||
Button.CreateCmdButton("十连抽卡", "十连抽卡"),
|
||
]).AppendButtonsWithNewRow(2, [
|
||
Button.CreateCmdButton("钻石抽卡", "钻石抽卡"),
|
||
Button.CreateCmdButton("钻石十连抽卡", "钻石十连抽卡"),
|
||
]);
|
||
await SendAsync(e, "钻石十连抽卡", rpy);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查看库存") || e.Detail.StartsWith("我的库存") || e.Detail.StartsWith("我的背包"))
|
||
{
|
||
string detail = e.Detail.Replace("查看库存", "").Replace("我的库存", "").Replace("我的背包", "").Trim();
|
||
BotReply reply;
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
reply = Controller.GetInventoryInfo2(uid, page, command: "我的库存");
|
||
}
|
||
else if (FunGameItemType.FirstOrDefault(detail.Contains) is string matchedType)
|
||
{
|
||
int typeIndex = FunGameItemType.IndexOf(matchedType);
|
||
string remain = detail.Replace(matchedType, "").Trim();
|
||
if (int.TryParse(remain, out page))
|
||
{
|
||
reply = Controller.GetInventoryInfo4(uid, page, typeIndex, command: "我的库存");
|
||
}
|
||
else
|
||
{
|
||
reply = Controller.GetInventoryInfo4(uid, 1, typeIndex, command: "我的库存");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
reply = Controller.GetInventoryInfo2(uid, 1, command: "我的库存");
|
||
}
|
||
await SendAsync(e, "查看库存", reply);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("物品库存"))
|
||
{
|
||
string detail = e.Detail.Replace("物品库存", "").Trim();
|
||
BotReply reply;
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
reply = Controller.GetInventoryInfo3(uid, page, 2, 2, command: "物品库存");
|
||
}
|
||
else
|
||
{
|
||
reply = Controller.GetInventoryInfo3(uid, 1, 2, 2, command: "物品库存");
|
||
}
|
||
await SendAsync(e, "查看分类库存", reply);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("角色库存"))
|
||
{
|
||
string detail = e.Detail.Replace("角色库存", "").Trim();
|
||
BotReply reply;
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
reply = Controller.GetInventoryInfo5(uid, page, command: "角色库存");
|
||
}
|
||
else
|
||
{
|
||
reply = Controller.GetInventoryInfo5(uid, 1, command: "角色库存");
|
||
}
|
||
await SendAsync(e, "查看角色库存", reply);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("分类库存"))
|
||
{
|
||
string detail = e.Detail.Replace("分类库存", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int t = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out t))
|
||
{
|
||
BotReply reply;
|
||
if (strings.Length > 1 && int.TryParse(strings[1].Trim(), out int page))
|
||
{
|
||
reply = Controller.GetInventoryInfo4(uid, page, t, command: "分类库存");
|
||
}
|
||
else
|
||
{
|
||
reply = Controller.GetInventoryInfo4(uid, 1, t, command: "分类库存");
|
||
}
|
||
await SendAsync(e, "查看分类库存", reply);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("库存搜索2", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("库存查询2", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("库存搜索2", "").Replace("库存查询2", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
string search = strings[0];
|
||
int page = 1;
|
||
if (strings.Length > 1 && int.TryParse(strings[1], out int p))
|
||
{
|
||
page = p;
|
||
}
|
||
BotReply reply = Controller.GetInventoryInfo6(uid, page, search, false, command: "库存搜索2 ");
|
||
await SendAsync(e, "搜索库存物品(带描述)", reply);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("库存搜索", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("库存查询", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("库存搜索", "").Replace("库存查询", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
string search = strings[0];
|
||
int page = 1;
|
||
if (strings.Length > 1 && int.TryParse(strings[1], out int p))
|
||
{
|
||
page = p;
|
||
}
|
||
BotReply reply = Controller.GetInventoryInfo6(uid, page, search, true, command: "库存搜索");
|
||
await SendAsync(e, "搜索库存物品", reply);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("我角色", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("我角色", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int seq))
|
||
{
|
||
msg = Controller.GetCharacterInfoFromInventory(uid, seq, true);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetCharacterInfoFromInventory(uid, 1, true);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查库存角色", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("我的角色", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("我的角色", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int seq))
|
||
{
|
||
msg = Controller.GetCharacterInfoFromInventory(uid, seq, false);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetCharacterInfoFromInventory(uid, 1, false);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查库存角色", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("角色技能", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("角色技能", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int seq))
|
||
{
|
||
msg = Controller.GetCharacterSkills(uid, seq);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetCharacterSkills(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "角色技能", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("角色物品", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("角色物品", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int seq))
|
||
{
|
||
msg = Controller.GetCharacterItems(uid, seq);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetCharacterItems(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "角色物品", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("设置主战", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("设置主战", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msg = Controller.SetMain(uid, cid);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.SetMain(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "设置主战角色", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("开启练级", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("开始练级", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("开启练级", "").Replace("开始练级", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msg = Controller.StartTraining(uid, cid);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.StartTraining(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "开启练级", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "练级信息")
|
||
{
|
||
string msg = Controller.GetTrainingInfo(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "练级信息", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "练级结算")
|
||
{
|
||
string msg = Controller.StopTraining(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "练级结算", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "任务列表")
|
||
{
|
||
BotReply rpy = Controller.CheckQuestList(uid);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("做任务", "做任务", false));
|
||
await SendAsync(e, "任务列表", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "任务信息")
|
||
{
|
||
string msg = Controller.CheckWorkingQuest(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "任务信息", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "任务结算")
|
||
{
|
||
string msg = Controller.SettleQuest(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "任务结算", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "签到")
|
||
{
|
||
string msg = Controller.SignIn(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "签到", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("开始任务", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("做任务", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("开始任务", "").Replace("做任务", "").Trim();
|
||
if (int.TryParse(detail, out int index))
|
||
{
|
||
List<string> msgs = Controller.AcceptQuest(uid, index);
|
||
await SendAsync(e, "开始任务", string.Join("\r\n", msgs));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("我的物品", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("我的物品", "").Trim();
|
||
string msg;
|
||
if (int.TryParse(detail, out int index))
|
||
{
|
||
msg = Controller.GetItemInfoFromInventory(uid, index);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查库存物品", msg);
|
||
return result;
|
||
}
|
||
}
|
||
msg = Controller.GetItemInfoFromInventory_Name(uid, detail);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查库存物品", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("兑换金币", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("兑换金币", "").Trim();
|
||
if (int.TryParse(detail, out int materials))
|
||
{
|
||
BotReply rpy = Controller.ExchangeCredits(uid, materials);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("继续兑换", "兑换金币", false));
|
||
await SendAsync(e, "兑换金币", rpy);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("取消装备", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("取消装备", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int c = -1, i = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out i))
|
||
{
|
||
if (c != -1 && i != -1)
|
||
{
|
||
string msg = Controller.UnEquipItem(uid, c, i);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "取消装备", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("装备", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("装备", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int c = -1, i = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out i))
|
||
{
|
||
if (c != -1 && i != -1)
|
||
{
|
||
string msg = Controller.EquipItem(uid, c, i);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "装备", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查看技能升级", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("查看技能升级", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int c = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1)
|
||
{
|
||
string s = strings[1].Trim();
|
||
if (c != -1 && s != "")
|
||
{
|
||
string msg = Controller.GetSkillLevelUpNeedy(uid, c, s);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查看技能升级", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("技能升级", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("技能升级", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int c = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out c) && strings.Length > 1)
|
||
{
|
||
string s = strings[1].Trim();
|
||
if (c != -1 && s != "")
|
||
{
|
||
string msg = Controller.SkillLevelUp(uid, c, s);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "技能升级", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("合成魔法卡", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("合成魔法卡", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int id1 = -1, id2 = -1, id3 = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out id1) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out id2) && strings.Length > 2 && int.TryParse(strings[2].Trim(), out id3))
|
||
{
|
||
if (id1 != -1 && id2 != -1 && id3 != -1)
|
||
{
|
||
string msg = Controller.ConflateMagicCardPack(uid, [id1, id2, id3]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "合成魔法卡", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("角色升级", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("角色升级", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msg = Controller.CharacterLevelUp(uid, cid);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.CharacterLevelUp(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "角色升级", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查看普攻升级", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("查看普攻升级", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msg = Controller.GetNormalAttackLevelUpNeedy(uid, cid);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetNormalAttackLevelUpNeedy(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "查看普攻升级", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("普攻升级", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("普攻升级", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msg = Controller.NormalAttackLevelUp(uid, cid);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.NormalAttackLevelUp(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "普攻升级", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("角色突破", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("角色突破", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msg = Controller.CharacterLevelBreak(uid, cid);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.CharacterLevelBreak(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "角色突破", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("突破信息", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("突破信息", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msg = Controller.GetLevelBreakNeedy(uid, cid);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetLevelBreakNeedy(uid, 1);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "突破信息", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("使用") || e.Detail.StartsWith("批量使用"))
|
||
{
|
||
if (e.Detail.StartsWith("批量使用"))
|
||
{
|
||
string detail = e.Detail.Replace("批量使用", "").Trim();
|
||
string pattern = @"\s*(?:角色\s*(?<characterId>\d+))?\s*(?<itemIds>[\d\s,,;;]+)";
|
||
Match match = Regex.Match(detail, pattern);
|
||
if (match.Success)
|
||
{
|
||
string itemIdsString = match.Groups["itemIds"].Value;
|
||
string characterId = match.Groups["characterId"].Value;
|
||
int[] characterIds = characterId != "" ? [int.Parse(characterId)] : [1];
|
||
int[] itemIds = [.. itemIdsString.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)];
|
||
if (itemIds.Length > 0)
|
||
{
|
||
string msg = Controller.UseItem4(uid, (itemIds, characterIds));
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "批量使用", msg);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else if (e.Detail.StartsWith("使用魔法卡"))
|
||
{
|
||
string detail = e.Detail.Replace("使用", "").Trim();
|
||
string pattern = @"\s*魔法卡\s*(?<itemId>\d+)(?:\s+(?:(?:角色\s*(?<characterId>\d+))|(?<packageId>\d+)))?";
|
||
Match match = Regex.Match(detail, pattern);
|
||
if (match.Success)
|
||
{
|
||
string itemId = match.Groups["itemId"].Value;
|
||
string characterId = match.Groups["characterId"].Value;
|
||
bool isCharacter = match.Groups["characterId"].Success;
|
||
string packageId = match.Groups["packageId"].Value;
|
||
if (int.TryParse(itemId, out int id) && id > 0)
|
||
{
|
||
int targetId = 0;
|
||
if (isCharacter && int.TryParse(characterId, out int charId) && charId > 0)
|
||
{
|
||
targetId = charId;
|
||
}
|
||
else if (!isCharacter && int.TryParse(packageId, out int pkgId) && pkgId > 0)
|
||
{
|
||
targetId = pkgId;
|
||
isCharacter = false;
|
||
}
|
||
if (targetId > 0)
|
||
{
|
||
string msg = Controller.UseItem3(uid, id, targetId, isCharacter);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "使用魔法卡", msg);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string detail = e.Detail.Replace("使用", "").Trim();
|
||
string pattern = @"^\s*(?:(?<itemId>\d+)|(?<itemPart>[^\d\s].*?))(?:\s+(?<countPart>\d+))?(?:\s*角色\s*(?<characterIds>[\d\s,,;;]*))?$";
|
||
Match match = Regex.Match(detail, pattern);
|
||
if (match.Success)
|
||
{
|
||
string itemId = match.Groups["itemId"].Value;
|
||
string itemPart = match.Groups["itemPart"].Value.Trim();
|
||
string countStr = match.Groups["countPart"].Value;
|
||
string characterIdsString = match.Groups["characterIds"].Value;
|
||
int[] characterIds = characterIdsString != "" ? [.. characterIdsString.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)] : [1];
|
||
int count = string.IsNullOrEmpty(countStr) ? 1 : int.Parse(countStr);
|
||
|
||
if (!string.IsNullOrEmpty(itemId) && int.TryParse(itemId, out int id))
|
||
{
|
||
string msg = Controller.UseItem(uid, id, count, characterIds);
|
||
if (!string.IsNullOrEmpty(msg))
|
||
{
|
||
await SendAsync(e, "使用", msg);
|
||
}
|
||
}
|
||
else if (!string.IsNullOrEmpty(itemPart))
|
||
{
|
||
string msg = Controller.UseItem2(uid, itemPart, count, characterIds);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "使用", msg);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("分解物品", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("分解物品", "").Trim();
|
||
List<int> ids = [];
|
||
foreach (string str in detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries))
|
||
{
|
||
if (int.TryParse(str, out int id))
|
||
{
|
||
ids.Add(id);
|
||
}
|
||
}
|
||
string msg = Controller.DecomposeItem(uid, [.. ids]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "分解物品", msg);
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("强制分解", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("强制分解", "").Trim();
|
||
string pattern = @"\s*(?<itemName>[^\d]+)\s*(?<count>\d+)\s*";
|
||
Match match = Regex.Match(detail, pattern);
|
||
if (match.Success)
|
||
{
|
||
string itemName = match.Groups["itemName"].Value.Trim();
|
||
if (int.TryParse(match.Groups["count"].Value, out int count))
|
||
{
|
||
string msg = Controller.DecomposeItem2(uid, itemName, count, true);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "分解", msg);
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("分解", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("分解", "").Trim();
|
||
string pattern = @"\s*(?<itemName>[^\d]+)\s*(?<count>\d+)\s*";
|
||
Match match = Regex.Match(detail, pattern);
|
||
if (match.Success)
|
||
{
|
||
string itemName = match.Groups["itemName"].Value.Trim();
|
||
if (int.TryParse(match.Groups["count"].Value, out int count))
|
||
{
|
||
string msg = Controller.DecomposeItem2(uid, itemName, count);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "分解", msg);
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("品质分解", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("品质分解", "").Trim();
|
||
if (int.TryParse(detail, out int q))
|
||
{
|
||
string msg = Controller.DecomposeItem3(uid, q);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "品质分解", msg);
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("熟圣之力", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("熟圣之力", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int count = -1;
|
||
if (strings.Length > 1 && int.TryParse(strings[1].Trim(), out count))
|
||
{
|
||
string name = strings[0].Trim();
|
||
if (count > 0)
|
||
{
|
||
long userid = uid;
|
||
if (strings.Length > 2 && long.TryParse(strings[2].Replace("@", "").Trim(), out long temp))
|
||
{
|
||
userid = temp;
|
||
}
|
||
string msg = Controller.CreateItem(uid, name, count, userid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "熟圣之力", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "熟圣之力", "数量不能为0,请重新输入。");
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("完整决斗", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("完整决斗", "").Replace("@", "").Trim();
|
||
List<string> msgs = [];
|
||
if (long.TryParse(detail.Trim(), out long eqq))
|
||
{
|
||
msgs = await Controller.FightCustom(uid, eqq, true);
|
||
}
|
||
else
|
||
{
|
||
msgs = await Controller.FightCustom2(uid, detail.Trim(), true);
|
||
}
|
||
BotReply rpy = MergeToMarkdown("战斗结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("再次决斗", $"完整决斗{eqq}"));
|
||
await SendAsync(e, "完整决斗", rpy, msgSeq: 1);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("决斗", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("决斗", "").Replace("@", "").Trim();
|
||
List<string> msgs = [];
|
||
if (long.TryParse(detail.Trim(), out long eqq))
|
||
{
|
||
msgs = await Controller.FightCustom(uid, eqq, false);
|
||
}
|
||
else
|
||
{
|
||
msgs = await Controller.FightCustom2(uid, detail.Trim(), false);
|
||
}
|
||
BotReply rpy = MergeToMarkdown("战斗结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("再次决斗", $"决斗{eqq}"));
|
||
await SendAsync(e, "决斗", rpy, msgSeq: 1);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("小队决斗", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("小队决斗", "").Replace("@", "").Trim();
|
||
List<string> msgs = [];
|
||
if (long.TryParse(detail.Trim(), out long eqq))
|
||
{
|
||
msgs = await Controller.FightCustomTeam(uid, eqq, true);
|
||
}
|
||
else
|
||
{
|
||
msgs = await Controller.FightCustomTeam2(uid, detail.Trim(), true);
|
||
}
|
||
BotReply rpy = MergeToMarkdown("战斗结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("再次决斗", $"小队决斗{eqq}"));
|
||
await SendAsync(e, "小队决斗", rpy, msgSeq: 1);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查询boss", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("查询boss", "").Trim();
|
||
List<string> msgs = [];
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
msgs = Controller.GetBoss(cid);
|
||
}
|
||
else
|
||
{
|
||
msgs = Controller.GetBoss();
|
||
}
|
||
if (msgs.Count > 0)
|
||
{
|
||
await SendAsync(e, "BOSS", string.Join("\r\n", msgs));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("小队讨伐boss", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("小队讨伐boss", "").Trim();
|
||
List<string> msgs = [];
|
||
if (int.TryParse(detail.Trim(), out int index))
|
||
{
|
||
await SendAsync(e, "BOSS", await Controller.FightBossTeam(uid, index, true), msgSeq: 1);
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "BOSS", "请输入正确的编号!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("讨伐boss", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("讨伐boss", "").Trim();
|
||
List<string> msgs = [];
|
||
if (int.TryParse(detail.Trim(), out int index))
|
||
{
|
||
msgs = await Controller.FightBoss(uid, index, true);
|
||
BotReply rpy = MergeToMarkdown("战斗结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(1, Button.CreateCmdButton("讨伐boss", $"讨伐boss"));
|
||
await SendAsync(e, "BOSS", rpy, msgSeq: 1);
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "BOSS", "请输入正确的编号!");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("小队添加", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("小队添加", "").Trim();
|
||
if (int.TryParse(detail, out int c))
|
||
{
|
||
await SendAsync(e, "小队", Controller.AddSquad(uid, c));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("小队移除", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("小队移除", "").Trim();
|
||
if (int.TryParse(detail, out int c))
|
||
{
|
||
await SendAsync(e, "小队", Controller.RemoveSquad(uid, c));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("设置小队") || e.Detail.StartsWith("重组小队"))
|
||
{
|
||
string detail = e.Detail.Replace("设置小队", "").Replace("重组小队", "").Trim();
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> cindexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
cindexs.Add(c);
|
||
}
|
||
}
|
||
await SendAsync(e, "小队", Controller.SetSquad(uid, [.. cindexs]));
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("加入社团", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("加入社团", "").Trim();
|
||
if (int.TryParse(detail, out int c))
|
||
{
|
||
string msg = Controller.ClubJoin(uid, c);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("邀请加入", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("邀请加入", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = Controller.ClubInvite(uid, id);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("取消邀请加入", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("取消邀请加入", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = Controller.ClubInvite(uid, id, true);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("创建社团", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("创建社团", "").Trim();
|
||
bool isPublic = true;
|
||
if (detail.Contains("私密"))
|
||
{
|
||
isPublic = false;
|
||
}
|
||
detail = detail.Replace("私密", "").Trim();
|
||
string msg = Controller.ClubCreate(uid, isPublic, detail);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "退出社团")
|
||
{
|
||
string msg = Controller.ClubQuit(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "我的社团")
|
||
{
|
||
string msg = Controller.ClubShowInfo(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团列表"))
|
||
{
|
||
string detail = e.Detail.Replace("社团列表", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
msg = Controller.ClubShowList(uid, page);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.ClubShowList(uid, 1);
|
||
}
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "解散社团")
|
||
{
|
||
string msg = Controller.ClubDisband(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查看社团成员"))
|
||
{
|
||
string detail = e.Detail.Replace("查看社团成员", "").Trim();
|
||
if (int.TryParse(detail, out int page) && page > 0)
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 0, page);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 0, 1);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查看社团管理"))
|
||
{
|
||
string detail = e.Detail.Replace("查看社团管理", "").Trim();
|
||
if (int.TryParse(detail, out int page) && page > 0)
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 1, page);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 1, 1);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查看申请人列表"))
|
||
{
|
||
string detail = e.Detail.Replace("查看申请人列表", "").Trim();
|
||
if (int.TryParse(detail, out int page) && page > 0)
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 2, page);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 2, 1);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查看受邀人列表"))
|
||
{
|
||
string detail = e.Detail.Replace("查看受邀人列表", "").Trim();
|
||
if (int.TryParse(detail, out int page) && page > 0)
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 3, page);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
string msg = Controller.ClubShowMemberList(uid, 3, 1);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", "\r\n" + msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团批准", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("社团批准", "").Replace("@", "").Trim();
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
string msg = Controller.ClubApprove(uid, id, true);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团拒绝", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("社团拒绝", "").Replace("@", "").Trim();
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
string msg = Controller.ClubApprove(uid, id, false);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团踢出", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("社团踢出", "").Replace("@", "").Trim();
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
string msg = Controller.ClubKick(uid, id);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团设置", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("社团设置", "").Trim();
|
||
string[] strings = detail.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
if (strings.Length > 0)
|
||
{
|
||
string part = strings[0].Trim() switch
|
||
{
|
||
"名称" => "name",
|
||
"前缀" => "prefix",
|
||
"描述" => "description",
|
||
"批准" => "isneedapproval",
|
||
"公开" => "ispublic",
|
||
"管理" => "setadmin",
|
||
"取消管理" => "setnotadmin",
|
||
"新社长" => "setmaster",
|
||
_ => "",
|
||
};
|
||
List<string> args = [];
|
||
if (strings.Length > 1)
|
||
{
|
||
args = [.. strings[1..]];
|
||
}
|
||
string msg = Controller.ClubChange(uid, part, [.. args]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团转让", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("社团转让", "").Replace("@", "").Trim();
|
||
List<string> args = [detail];
|
||
string msg = Controller.ClubChange(uid, "setmaster", [.. args]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("社团捐献"))
|
||
{
|
||
string detail = e.Detail.Replace("社团捐献", "").Trim();
|
||
string msg = "";
|
||
if (double.TryParse(detail, out double credits))
|
||
{
|
||
msg = Controller.ClubContribution(uid, credits);
|
||
}
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "社团", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "每日商店")
|
||
{
|
||
BotReply rpy = Controller.ShowDailyStore(uid);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(2, [
|
||
Button.CreateCmdButton("商店查看", "商店查看", false),
|
||
Button.CreateCmdButton("商店购买", "商店购买", false)
|
||
]);
|
||
await SendAsync(e, "商店", rpy);
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("商店购买", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
if (!FunGameConstant.UserLastVisitStore.TryGetValue(uid, out LastStoreModel? model) || model is null || (DateTime.Now - model.LastTime).TotalMinutes > 2)
|
||
{
|
||
await SendAsync(e, "商店购买", "为防止错误购买,请先打开一个商店,随后在 2 分钟内进行购买操作。");
|
||
return result;
|
||
}
|
||
string detail = e.Detail.Replace("商店购买", "").Trim();
|
||
string[] strings = detail.Split(' ', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out int id))
|
||
{
|
||
int count = 1;
|
||
if (strings.Length > 1 && int.TryParse(strings[1].Trim(), out int temp))
|
||
{
|
||
count = temp;
|
||
}
|
||
string msg = "";
|
||
if (model.IsDaily)
|
||
{
|
||
msg = Controller.DailyStoreBuy(uid, id, count);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.SystemStoreBuy(uid, model.StoreRegion, model.StoreName, id, count);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "商店购买", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("商店查看", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
if (!FunGameConstant.UserLastVisitStore.TryGetValue(uid, out LastStoreModel? model) || model is null || (DateTime.Now - model.LastTime).TotalMinutes > 2)
|
||
{
|
||
await SendAsync(e, "商店购买", "请先打开一个商店,随后在 2 分钟内进行查看操作。");
|
||
return result;
|
||
}
|
||
string detail = e.Detail.Replace("商店查看", "").Trim();
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
string msg = "";
|
||
if (model.IsDaily)
|
||
{
|
||
msg = Controller.DailyStoreShowInfo(uid, id);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.SystemStoreShowInfo(uid, model.StoreRegion, model.StoreName, id);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查地区", StringComparison.CurrentCultureIgnoreCase) || e.Detail.StartsWith("查询地区", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("查地区", "").Replace("查询地区", "").Trim();
|
||
List<string> msgs = [];
|
||
if (int.TryParse(detail, out int cid))
|
||
{
|
||
if (cid > 0 && cid <= 12)
|
||
{
|
||
msgs = Controller.GetRegion(cid);
|
||
}
|
||
else if (cid == 0 || cid > 12)
|
||
{
|
||
msgs = Controller.GetPlayerRegion(cid);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
msgs = Controller.GetRegion();
|
||
}
|
||
if (msgs.Count > 0)
|
||
{
|
||
await SendAsync(e, "查地区", string.Join("\r\n", msgs));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "主城" || e.Detail == "铎京")
|
||
{
|
||
List<string> msgs = Controller.GetPlayerRegion();
|
||
if (msgs.Count > 0)
|
||
{
|
||
await SendAsync(e, "铎京", string.Join("\r\n", msgs));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "世界地图")
|
||
{
|
||
List<string> msgs = Controller.GetRegion();
|
||
if (msgs.Count > 0)
|
||
{
|
||
await SendAsync(e, "世界地图", string.Join("\r\n", msgs));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "探索信息")
|
||
{
|
||
await SendAsync(e, "探索信息", Controller.GetExploreInfo(uid));
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "探索结算")
|
||
{
|
||
string msg = Controller.SettleExploreAll(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "探索结算", string.Join("\r\n", msg));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("探索") || e.Detail.StartsWith("前往"))
|
||
{
|
||
string originalDetail = e.Detail;
|
||
string detail = e.Detail.Replace("探索", "").Replace("前往", "").Trim();
|
||
BotReply reply = new();
|
||
string eid = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> cindexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
cindexs.Add(c);
|
||
}
|
||
}
|
||
if (cindexs.Count > 1 && cindexs.Count <= 5)
|
||
{
|
||
(reply, eid) = Controller.ExploreRegion(uid, cindexs[0], false, [.. cindexs.Skip(1).Select(id => (long)id)]);
|
||
await SendAsync(e, "探索", reply);
|
||
_ = Task.Run(async () =>
|
||
{
|
||
await Task.Delay(FunGameConstant.ExploreTime * 60 * 1000);
|
||
BotReply rpy = Controller.SettleExplore(eid, uid, originalDetail);
|
||
await SendAsync(e, "探索", rpy, msgSeq: 2);
|
||
});
|
||
}
|
||
else if (cindexs.Count > 5)
|
||
{
|
||
await SendAsync(e, "探索", "一次探索只能指定至多 4 个角色,需要注意:探索角色越多,奖励越多,但是会扣除相应的探索次数。");
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "探索", "探索指令格式错误,正确格式为:探索 <地区序号> <{角色序号...}>");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("小队探索"))
|
||
{
|
||
string originalDetail = e.Detail;
|
||
string detail = e.Detail.Replace("小队探索", "").Trim();
|
||
BotReply reply = "";
|
||
string eid = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> cindexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
cindexs.Add(c);
|
||
}
|
||
}
|
||
if (cindexs.Count > 0)
|
||
{
|
||
(reply, eid) = Controller.ExploreRegion(uid, cindexs[0], true);
|
||
await SendAsync(e, "探索", reply);
|
||
_ = Task.Run(async () =>
|
||
{
|
||
await Task.Delay(FunGameConstant.ExploreTime * 60 * 1000);
|
||
BotReply rpy = Controller.SettleExplore(eid, uid, originalDetail);
|
||
await SendAsync(e, "探索", rpy, msgSeq: 2);
|
||
});
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "探索", "探索指令格式错误,正确格式为:小队探索 <地区序号>");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "生命之泉")
|
||
{
|
||
string msg = Controller.SpringOfLife(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "生命之泉", string.Join("\r\n", msg));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "酒馆" || e.Detail == "上酒")
|
||
{
|
||
string msg = Controller.Pub(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "酒馆", string.Join("\r\n", msg));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "毕业礼包")
|
||
{
|
||
if (FunGameService.Activities.FirstOrDefault(a => a.Name == "毕业季") is Activity activity && activity.Status == ActivityState.InProgress)
|
||
{
|
||
string msg = Controller.CreateGiftBox(uid, "毕业礼包", true, 2);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "毕业礼包", string.Join("\r\n", msg));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "毕业礼包", "活动不存在或已过期。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "活动" || e.Detail == "活动中心")
|
||
{
|
||
string msg = Controller.GetEvents(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "活动中心", string.Join("\r\n", msg));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("查活动"))
|
||
{
|
||
string detail = e.Detail.Replace("查活动", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int eid))
|
||
{
|
||
msg = Controller.GetEvents(uid, eid);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "查活动", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("做活动任务", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("做活动任务", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int aid = -1, qid = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out aid) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out qid))
|
||
{
|
||
if (aid != -1 && qid != -1)
|
||
{
|
||
string msg = Controller.PerformEvent(uid, aid, qid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "做活动任务", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("领取奖励", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("领取奖励", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int aid = -1, qid = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out aid) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out qid))
|
||
{
|
||
if (aid != -1 && qid != -1)
|
||
{
|
||
string msg = Controller.ClaimEventPrize(uid, aid, qid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "领取奖励", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("批量锁定", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("批量锁定", "").Trim();
|
||
string pattern = @"\s*(?<itemName>[^\d]+)\s*(?<count>\d+)\s*";
|
||
Match match = Regex.Match(detail, pattern);
|
||
if (match.Success)
|
||
{
|
||
string itemName = match.Groups["itemName"].Value.Trim();
|
||
if (int.TryParse(match.Groups["count"].Value, out int count))
|
||
{
|
||
string msg = Controller.LockItems(uid, itemName, count, false);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "批量锁定", msg);
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("批量解锁", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("批量解锁", "").Trim();
|
||
string pattern = @"\s*(?<itemName>[^\d]+)\s*(?<count>\d+)\s*";
|
||
Match match = Regex.Match(detail, pattern);
|
||
if (match.Success)
|
||
{
|
||
string itemName = match.Groups["itemName"].Value.Trim();
|
||
if (int.TryParse(match.Groups["count"].Value, out int count))
|
||
{
|
||
string msg = Controller.LockItems(uid, itemName, count, true);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "批量解锁", msg);
|
||
}
|
||
}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("上锁") || e.Detail.StartsWith("锁定"))
|
||
{
|
||
string detail = e.Detail.Replace("上锁", "").Replace("锁定", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> indexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
indexs.Add(c);
|
||
}
|
||
}
|
||
if (indexs.Count > 0)
|
||
{
|
||
msg = Controller.LockItem(uid, false, [.. indexs]);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "上锁", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("解锁"))
|
||
{
|
||
string detail = e.Detail.Replace("解锁", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> indexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
indexs.Add(c);
|
||
}
|
||
}
|
||
if (indexs.Count > 0)
|
||
{
|
||
msg = Controller.LockItem(uid, true, [.. indexs]);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "解锁", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "创建报价"))
|
||
{
|
||
string detail = e.Detail.Replace("创建报价", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long target))
|
||
{
|
||
msg = Controller.MakeOffer(uid, target);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "创建报价", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "我的报价"))
|
||
{
|
||
string detail = e.Detail.Replace("我的报价", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
msg = Controller.GetOffer(uid, null, page);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.GetOffer(uid);
|
||
}
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "我的报价", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "查报价"))
|
||
{
|
||
string detail = e.Detail.Replace("查报价", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
msg = Controller.GetOffer(uid, id);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "查报价", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "发送报价"))
|
||
{
|
||
string detail = e.Detail.Replace("发送报价", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
msg = Controller.SendOffer(uid, id);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "发送报价", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "取消报价"))
|
||
{
|
||
string detail = e.Detail.Replace("取消报价", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
msg = Controller.CancelOffer(uid, id);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "取消报价", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "接受报价"))
|
||
{
|
||
string detail = e.Detail.Replace("接受报价", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
msg = Controller.RespondOffer(uid, id, true);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "接受报价", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "拒绝报价"))
|
||
{
|
||
string detail = e.Detail.Replace("拒绝报价", "").Trim();
|
||
string msg = "";
|
||
if (long.TryParse(detail, out long id))
|
||
{
|
||
msg = Controller.RespondOffer(uid, id, false);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "拒绝报价", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "报价添加物品"))
|
||
{
|
||
string detail = e.Detail.Replace("报价添加物品", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> indexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
indexs.Add(c);
|
||
}
|
||
}
|
||
if (indexs.Count > 1)
|
||
{
|
||
msg = Controller.AddOfferItems(uid, indexs[0], false, [.. indexs[1..]]);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "报价添加物品", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。";
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "报价添加对方物品"))
|
||
{
|
||
string detail = e.Detail.Replace("报价添加对方物品", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> indexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
indexs.Add(c);
|
||
}
|
||
}
|
||
if (indexs.Count > 1)
|
||
{
|
||
msg = Controller.AddOfferItems(uid, indexs[0], true, [.. indexs[1..]]);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "报价添加对方物品", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。";
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "报价移除物品"))
|
||
{
|
||
string detail = e.Detail.Replace("报价移除物品", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> indexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
indexs.Add(c);
|
||
}
|
||
}
|
||
if (indexs.Count > 1)
|
||
{
|
||
msg = Controller.RemoveOfferItems(uid, indexs[0], false, [.. indexs[1..]]);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "报价移除物品", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。";
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith(value: "报价移除对方物品"))
|
||
{
|
||
string detail = e.Detail.Replace("报价移除对方物品", "").Trim();
|
||
string msg = "";
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
List<int> indexs = [];
|
||
foreach (string s in strings)
|
||
{
|
||
if (int.TryParse(s, out int c))
|
||
{
|
||
indexs.Add(c);
|
||
}
|
||
}
|
||
if (indexs.Count > 1)
|
||
{
|
||
msg = Controller.RemoveOfferItems(uid, indexs[0], true, [.. indexs[1..]]);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "报价移除对方物品", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
msg = "格式不正确,请先输入报价序号再输入物品序号,使用空格隔开。";
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("商店出售", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string detail = e.Detail.Replace("商店出售", "").Trim();
|
||
List<int> ids = [];
|
||
foreach (string str in detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries))
|
||
{
|
||
if (int.TryParse(str, out int id))
|
||
{
|
||
ids.Add(id);
|
||
}
|
||
}
|
||
string msg = Controller.StoreSellItem(uid, [.. ids]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "商店出售", msg);
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("挑战金币秘境"))
|
||
{
|
||
string detail = e.Detail.Replace("挑战金币秘境", "").Trim();
|
||
if (int.TryParse(detail, out int diff))
|
||
{
|
||
await SendAsync(e, "挑战金币秘境", await Controller.FightInstance(uid, (int)InstanceType.Currency, diff));
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "挑战秘境", CreateMarkdownFromText("请在" + "指令".CreateCmdInput(e.Detail) + "后面输入难度系数(1-5)"));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("挑战钻石秘境"))
|
||
{
|
||
string detail = e.Detail.Replace("挑战钻石秘境", "").Trim();
|
||
if (int.TryParse(detail, out int diff))
|
||
{
|
||
await SendAsync(e, "挑战钻石秘境", await Controller.FightInstance(uid, (int)InstanceType.Material, diff));
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "挑战秘境", CreateMarkdownFromText("请在" + "指令".CreateCmdInput(e.Detail) + "后面输入难度系数(1-5)"));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("挑战经验秘境"))
|
||
{
|
||
string detail = e.Detail.Replace("挑战经验秘境", "").Trim();
|
||
if (int.TryParse(detail, out int diff))
|
||
{
|
||
await SendAsync(e, "挑战经验秘境", await Controller.FightInstance(uid, (int)InstanceType.EXP, diff));
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "挑战秘境", CreateMarkdownFromText("请在" + "指令".CreateCmdInput(e.Detail) + "后面输入难度系数(1-5)"));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("挑战地区秘境"))
|
||
{
|
||
string detail = e.Detail.Replace("挑战地区秘境", "").Trim();
|
||
if (int.TryParse(detail, out int diff))
|
||
{
|
||
await SendAsync(e, "挑战地区秘境", await Controller.FightInstance(uid, (int)InstanceType.RegionItem, diff));
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "挑战秘境", CreateMarkdownFromText("请在" + "指令".CreateCmdInput(e.Detail) + "后面输入难度系数(1-5)"));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("挑战突破秘境"))
|
||
{
|
||
string detail = e.Detail.Replace("挑战突破秘境", "").Trim();
|
||
if (int.TryParse(detail, out int diff))
|
||
{
|
||
await SendAsync(e, "挑战突破秘境", await Controller.FightInstance(uid, (int)InstanceType.CharacterLevelBreak, diff));
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "挑战秘境", CreateMarkdownFromText("请在" + "指令".CreateCmdInput(e.Detail) + "后面输入难度系数(1-5)"));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("挑战技能秘境"))
|
||
{
|
||
string detail = e.Detail.Replace("挑战技能秘境", "").Trim();
|
||
if (int.TryParse(detail, out int diff))
|
||
{
|
||
await SendAsync(e, "挑战技能秘境", await Controller.FightInstance(uid, (int)InstanceType.SkillLevelUp, diff));
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "挑战秘境", CreateMarkdownFromText("请在" + "指令".CreateCmdInput(e.Detail) + "后面输入难度系数(1-5)"));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("挑战魔法卡秘境"))
|
||
{
|
||
string detail = e.Detail.Replace("挑战魔法卡秘境", "").Trim();
|
||
if (int.TryParse(detail, out int diff))
|
||
{
|
||
await SendAsync(e, "挑战魔法卡秘境", await Controller.FightInstance(uid, (int)InstanceType.MagicCard, diff));
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "挑战秘境", CreateMarkdownFromText("请在" + "指令".CreateCmdInput(e.Detail) + "后面输入难度系数(1-5)"));
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "后勤部")
|
||
{
|
||
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_logistics");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "武器商会")
|
||
{
|
||
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_weapons");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "杂货铺")
|
||
{
|
||
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_yuki");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "基金会")
|
||
{
|
||
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_welfare");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "锻造商店")
|
||
{
|
||
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_forge");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "赛马商店")
|
||
{
|
||
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "共斗商店")
|
||
{
|
||
string msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("商店"))
|
||
{
|
||
string detail = e.Detail.Replace("商店", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int storeId))
|
||
{
|
||
switch (storeId)
|
||
{
|
||
case 1:
|
||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_logistics");
|
||
break;
|
||
case 2:
|
||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_weapons");
|
||
break;
|
||
case 3:
|
||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_yuki");
|
||
break;
|
||
case 4:
|
||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_welfare");
|
||
break;
|
||
case 5:
|
||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_forge");
|
||
break;
|
||
case 6:
|
||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_horseracing");
|
||
break;
|
||
case 7:
|
||
msg = Controller.ShowSystemStore(uid, "铎京城", "dokyo_cooperative");
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "商店", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("模拟锻造配方"))
|
||
{
|
||
string detail = e.Detail.Replace("模拟", "").Trim();
|
||
string pattern = @"锻造配方\s*(?:(?<itemName>[^\d]+?)\s*(?<count>\d+)\s*)+";
|
||
Dictionary<string, int> recipeItems = [];
|
||
|
||
MatchCollection matches = Regex.Matches(detail, pattern, RegexOptions.ExplicitCapture);
|
||
foreach (Match match in matches)
|
||
{
|
||
CaptureCollection itemNames = match.Groups["itemName"].Captures;
|
||
CaptureCollection counts = match.Groups["count"].Captures;
|
||
|
||
for (int i = 0; i < itemNames.Count; i++)
|
||
{
|
||
string itemName = itemNames[i].Value.Trim();
|
||
if (int.TryParse(counts[i].Value, out int count))
|
||
{
|
||
recipeItems[itemName] = count;
|
||
}
|
||
}
|
||
}
|
||
|
||
User user = Factory.GetUser();
|
||
ForgeModel model = new()
|
||
{
|
||
ForgeMaterials = recipeItems
|
||
};
|
||
FunGameService.GenerateForgeResult(user, model, true);
|
||
if (model.ResultString != "")
|
||
{
|
||
await SendAsync(e, "模拟锻造配方", model.ResultString);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("锻造配方"))
|
||
{
|
||
string pattern = @"锻造配方\s*(?:(?<itemName>[^\d]+?)\s*(?<count>\d+)\s*)+";
|
||
Dictionary<string, int> recipeItems = [];
|
||
|
||
MatchCollection matches = Regex.Matches(e.Detail, pattern, RegexOptions.ExplicitCapture);
|
||
foreach (Match match in matches)
|
||
{
|
||
CaptureCollection itemNames = match.Groups["itemName"].Captures;
|
||
CaptureCollection counts = match.Groups["count"].Captures;
|
||
|
||
for (int i = 0; i < itemNames.Count; i++)
|
||
{
|
||
string itemName = itemNames[i].Value.Trim();
|
||
if (int.TryParse(counts[i].Value, out int count))
|
||
{
|
||
recipeItems[itemName] = count;
|
||
}
|
||
}
|
||
}
|
||
|
||
string msg = Controller.ForgeItem_Create(uid, recipeItems);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "锻造配方", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("模拟锻造"))
|
||
{
|
||
string msg = Controller.ForgeItem_Simulate(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "模拟锻造", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("取消锻造"))
|
||
{
|
||
string msg = Controller.ForgeItem_Cancel(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "取消锻造", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("确认开始锻造"))
|
||
{
|
||
string msg = Controller.ForgeItem_Complete(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "确认开始锻造", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("锻造信息"))
|
||
{
|
||
string msg = Controller.ForgeItem_Info(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "锻造信息", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("大师锻造"))
|
||
{
|
||
string detail = e.Detail.Replace("大师锻造", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int r = -1, q = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out r) && strings.Length > 1 && int.TryParse(strings[1].Trim(), out q))
|
||
{
|
||
if (r != -1 && q != -1)
|
||
{
|
||
string msg = Controller.ForgeItem_Master(uid, r, q);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "大师锻造", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("市场出售"))
|
||
{
|
||
string detail = e.Detail.Replace("市场出售", "").Trim();
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
if (strings.Length < 2 || !double.TryParse(strings[^1], out double price))
|
||
{
|
||
await SendAsync(e, "市场出售", "格式不正确,请使用:市场出售 <{物品序号...}> <价格>。多个物品序号使用空格隔开。");
|
||
return result;
|
||
}
|
||
List<int> ids = [];
|
||
for (int i = 0; i < strings.Length; i++)
|
||
{
|
||
if (i != strings.Length - 1 && int.TryParse(strings[i], out int id))
|
||
{
|
||
ids.Add(id);
|
||
}
|
||
}
|
||
string msg = Controller.MarketSellItem(uid, price, [.. ids]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "市场出售", msg);
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("市场购买"))
|
||
{
|
||
string detail = e.Detail.Replace("市场购买", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
int id = -1;
|
||
if (strings.Length > 0 && int.TryParse(strings[0].Trim(), out id))
|
||
{
|
||
int count = 1;
|
||
if (strings.Length > 1) _ = int.TryParse(strings[1].Trim(), out count);
|
||
if (id != -1)
|
||
{
|
||
string msg = Controller.MarketBuyItem(uid, id, count);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "市场购买", msg);
|
||
}
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("市场查看"))
|
||
{
|
||
string detail = e.Detail.Replace("市场查看", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
msg = Controller.MarketItemInfo(uid, id);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "市场查看", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("市场下架"))
|
||
{
|
||
string detail = e.Detail.Replace("市场下架", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int id))
|
||
{
|
||
msg = Controller.MarketDelistItem(uid, id);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "市场下架", msg);
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("我的市场"))
|
||
{
|
||
string detail = e.Detail.Replace("我的市场", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
msg = Controller.MarketShowListMySells(uid, page);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.MarketShowListMySells(uid, 1);
|
||
}
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "我的市场", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("我的购买"))
|
||
{
|
||
string detail = e.Detail.Replace("我的购买", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
msg = Controller.MarketShowListMyBuys(uid, page);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.MarketShowListMyBuys(uid, 1);
|
||
}
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "我的购买", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("市场"))
|
||
{
|
||
string detail = e.Detail.Replace("市场", "").Trim();
|
||
string msg = "";
|
||
if (int.TryParse(detail, out int page))
|
||
{
|
||
msg = Controller.MarketShowList(uid, page);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.MarketShowList(uid, 1);
|
||
}
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "市场", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("私信"))
|
||
{
|
||
string detail = e.Detail.Replace("私信", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
long id = -1;
|
||
string name = "";
|
||
bool useId = false;
|
||
if (strings.Length > 0)
|
||
{
|
||
if (long.TryParse(strings[0].Trim(), out id))
|
||
{
|
||
useId = true;
|
||
}
|
||
else
|
||
{
|
||
name = strings[0].Trim();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "私信", "你输入的格式不正确,正确格式:私信 <对方UID/昵称> <内容>");
|
||
return result;
|
||
}
|
||
string content = "";
|
||
if (strings.Length > 1) content = string.Join(" ", strings[1..]);
|
||
string msg = "";
|
||
if (useId)
|
||
{
|
||
msg = Controller.Chat(uid, id, content);
|
||
}
|
||
else
|
||
{
|
||
msg = Controller.Chat_Name(uid, name, content);
|
||
}
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "私信", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "创建赛马")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string msg = Controller.RoomCreate(uid, "horseracing", "", groupId);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "赛马", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "赛马", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "创建共斗")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string msg = Controller.RoomCreate(uid, "cooperative", "", groupId);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "创建混战")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string msg = Controller.RoomCreate(uid, "mix", "", groupId);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "创建团战")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string msg = Controller.RoomCreate(uid, "team", "", groupId);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "加入赛马")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
if (FunGameConstant.Rooms.Values.FirstOrDefault(r => r.GameMap == groupId) is Room room)
|
||
{
|
||
string msg = Controller.RoomInto(uid, room.Roomid, "");
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "赛马", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "赛马", "本群还没有创建赛马房间,请使用【创建赛马】指令来创建一个房间。");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "赛马", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("创建房间"))
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string detail = e.Detail.Replace("创建房间", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.RemoveEmptyEntries);
|
||
string roomType = "", password = "";
|
||
if (strings.Length > 0) roomType = strings[0];
|
||
if (strings.Length > 1)
|
||
{
|
||
int firstSpaceIndex = detail.IndexOf(' ');
|
||
if (firstSpaceIndex != -1 && firstSpaceIndex + 1 < detail.Length)
|
||
{
|
||
password = detail[(firstSpaceIndex + 1)..].Trim();
|
||
}
|
||
}
|
||
string msg = Controller.RoomCreate(uid, roomType, password, groupId);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("加入房间"))
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string detail = e.Detail.Replace("加入房间", "").Trim();
|
||
string[] strings = detail.Split(" ", StringSplitOptions.RemoveEmptyEntries);
|
||
string roomid = "", password = "";
|
||
if (strings.Length > 0) roomid = strings[0];
|
||
if (strings.Length > 1)
|
||
{
|
||
int firstSpaceIndex = detail.IndexOf(' ');
|
||
if (firstSpaceIndex != -1 && firstSpaceIndex + 1 < detail.Length)
|
||
{
|
||
password = detail[(firstSpaceIndex + 1)..].Trim();
|
||
}
|
||
}
|
||
string msg = Controller.RoomInto(uid, roomid, password);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "开始游戏" || e.Detail == "开始赛马")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
if (e.Detail == "开始赛马" && (!FunGameConstant.UsersInRoom.TryGetValue(uid, out Room? value) || value is null || value.Name != "赛马房间"))
|
||
{
|
||
await SendAsync(e, "房间", "你不在房间中或者所在的房间不是赛马房间,请使用【开始游戏】指令。注意:只有房主才可以开始游戏。");
|
||
return result;
|
||
}
|
||
(Room room, List<string> msgs) = await Controller.RoomRunGame(uid);
|
||
BotReply rpy = MergeToMarkdown("该局游戏结果如下:", msgs);
|
||
rpy.Keyboard = new KeyboardMessage().AppendButtons(2, [
|
||
Button.CreateCmdButton("退出房间", $"退出房间", false),
|
||
Button.CreateCmdButton("房间列表", $"房间列表"),
|
||
Button.CreateCmdButton("生命之泉", $"生命之泉"),
|
||
Button.CreateCmdButton("快速重新开始", $"开始游戏")
|
||
]);
|
||
await SendAsync(e, "房间", rpy, msgSeq: 1);
|
||
OnlineService.ReSetRoomState(room.Roomid);
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "退出房间")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string msg = Controller.RoomQuit(uid);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "房间列表")
|
||
{
|
||
string groupId = "";
|
||
if (e.IsGroup && e is GroupAtMessage groupAtMessage && groupAtMessage.GroupOpenId != "")
|
||
{
|
||
groupId = groupAtMessage.GroupOpenId;
|
||
}
|
||
else if (e.IsGroup && e is ThirdPartyMessage thirdPartyMessage && thirdPartyMessage.GroupOpenId != "")
|
||
{
|
||
groupId = thirdPartyMessage.GroupOpenId;
|
||
}
|
||
if (groupId != "")
|
||
{
|
||
string msg = Controller.RoomShowList(uid, groupId);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "房间", "请在群聊中进行多人游戏。");
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "房间信息")
|
||
{
|
||
string msg = Controller.RoomInfo(uid);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "房间", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "排行榜" || e.Detail == "养成排行榜")
|
||
{
|
||
string msg = Controller.GetRanking(uid, 2);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "排行榜", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == $"{General.GameplayEquilibriumConstant.InGameCurrency}排行榜")
|
||
{
|
||
string msg = Controller.GetRanking(uid, 0);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "排行榜", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == $"{General.GameplayEquilibriumConstant.InGameMaterial}排行榜")
|
||
{
|
||
string msg = Controller.GetRanking(uid, 1);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "排行榜", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == $"赛马排行榜")
|
||
{
|
||
string msg = Controller.GetRanking(uid, 3);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "排行榜", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == $"共斗排行榜")
|
||
{
|
||
string msg = Controller.GetRanking(uid, 4);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "排行榜", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == $"锻造排行榜")
|
||
{
|
||
string msg = Controller.GetRanking(uid, 5);
|
||
if (msg.Trim() != "")
|
||
{
|
||
await SendAsync(e, "排行榜", msg);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("加物") || e.Detail.StartsWith("添加背包物品"))
|
||
{
|
||
string detail = e.Detail.Replace("加物", "").Replace("添加背包物品", "").Trim();
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
if (strings.Length < 2)
|
||
{
|
||
await SendAsync(e, "加物", "格式不正确,请使用:加物 <角色> <{库存物品序号...}>。多个物品序号使用空格隔开。");
|
||
return result;
|
||
}
|
||
List<int> ids = [];
|
||
int cid = -999;
|
||
for (int i = 0; i < strings.Length; i++)
|
||
{
|
||
if (int.TryParse(strings[i], out int id))
|
||
{
|
||
if (i != 0) ids.Add(id);
|
||
else cid = id;
|
||
}
|
||
}
|
||
string msg = Controller.AddItemsToCharacter(uid, cid, [.. ids]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "加物", msg);
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("减物") || e.Detail.StartsWith("移除背包物品"))
|
||
{
|
||
string detail = e.Detail.Replace("减物", "").Replace("移除背包物品", "").Trim();
|
||
string[] strings = detail.Split(FunGameConstant.SplitChars, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||
if (strings.Length < 2)
|
||
{
|
||
await SendAsync(e, "减物", "格式不正确,请使用:减物 <角色> <{库存物品序号...}>。多个物品序号使用空格隔开。");
|
||
return result;
|
||
}
|
||
List<int> ids = [];
|
||
int cid = -999;
|
||
for (int i = 0; i < strings.Length; i++)
|
||
{
|
||
if (int.TryParse(strings[i], out int id))
|
||
{
|
||
if (i != 0) ids.Add(id);
|
||
else cid = id;
|
||
}
|
||
}
|
||
string msg = Controller.RemoveItemsFromCharacter(uid, cid, [.. ids]);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "减物", msg);
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
if (e.Detail == "竞猜帮助")
|
||
{
|
||
e.UseNotice = false;
|
||
BotReply reply = new()
|
||
{
|
||
Markdown = new MarkdownMessage
|
||
{
|
||
Content = "🎮 CS赛事竞猜帮助:\r\n"
|
||
+ $"✨ {"赛事列表".CreateCmdInput()} - 查看所有赛事\r\n"
|
||
+ $"✨ {"我的竞猜".CreateCmdInput()} - 查看我的投注记录\r\n"
|
||
+ $"✨ {"竞猜领奖".CreateCmdInput()} - 领取竞猜奖励\r\n"
|
||
+ $"✨ {"比赛详情".CreateCmdInput()} - 查看单场比赛并投注"
|
||
},
|
||
Keyboard = new KeyboardMessage()
|
||
.AppendButtons(2,
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"),
|
||
Button.CreateCmdButton("📜 我的竞猜", "我的竞猜"),
|
||
Button.CreateCmdButton("💰 竞猜领奖", "竞猜领奖"),
|
||
Button.CreateCmdButton("❓ 竞猜帮助", "竞猜帮助"))
|
||
};
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
return true;
|
||
}
|
||
|
||
// 赛事列表
|
||
if (e.Detail == "赛事列表")
|
||
{
|
||
BotReply reply = BettingController.GetEventsOverview();
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("比赛详情"))
|
||
{
|
||
string detail = e.Detail.Replace("比赛详情", "").Trim();
|
||
if (int.TryParse(detail, out int matchId))
|
||
{
|
||
BotReply reply = BettingController.GetMatchDetail(matchId);
|
||
// 构建投注键盘(填充“竞猜 <matchId> <选项> ”)
|
||
reply.Keyboard = new KeyboardMessage()
|
||
.AppendButtons(2,
|
||
Button.CreateCmdButton("⚔️ 队伍1胜", $"竞猜 {matchId} team1 ", enter: false),
|
||
Button.CreateCmdButton("🛡️ 队伍2胜", $"竞猜 {matchId} team2 ", enter: false),
|
||
Button.CreateCmdButton("🎯 精确比分", $"竞猜 {matchId} score:", enter: false),
|
||
Button.CreateCmdButton("🏆 MVP", $"竞猜 {matchId} mvp:", enter: false))
|
||
.AppendButtonsWithNewRow(2,
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"),
|
||
Button.CreateCmdButton("💰 竞猜领奖", "竞猜领奖"));
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
}
|
||
else
|
||
{
|
||
await SendAsync(e, "CS赛事竞猜", "格式:比赛详情 <比赛ID>");
|
||
}
|
||
return true;
|
||
}
|
||
|
||
// 赛事详情:用于查看某一赛事下的所有比赛
|
||
if (e.Detail.StartsWith("赛事详情"))
|
||
{
|
||
string detail = e.Detail.Replace("赛事详情", "").Trim();
|
||
if (int.TryParse(detail, out int eventId))
|
||
{
|
||
// 调用控制器获取详情(返回BotReply)
|
||
BotReply reply = BettingController.GetEventDetail(eventId);
|
||
reply.Keyboard = new KeyboardMessage()
|
||
.AppendButtons(2,
|
||
Button.CreateCmdButton("🔍 比赛详情 ", "比赛详情 ", enter: false),
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"),
|
||
Button.CreateCmdButton("📜 我的竞猜", "我的竞猜"),
|
||
Button.CreateCmdButton("💰 竞猜领奖", "竞猜领奖"));
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
}
|
||
else
|
||
{
|
||
BotReply reply = new()
|
||
{
|
||
Markdown = new()
|
||
{
|
||
Content = "格式:赛事详情 <赛事ID>"
|
||
},
|
||
Keyboard = new KeyboardMessage()
|
||
.AppendButtons(2,
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"),
|
||
Button.CreateCmdButton("❓ 竞猜帮助", "竞猜帮助"))
|
||
};
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
}
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail == "我的竞猜")
|
||
{
|
||
BotReply reply = BettingController.GetMyBets(uid);
|
||
reply.Keyboard = new KeyboardMessage()
|
||
.AppendButtons(3,
|
||
Button.CreateCmdButton("💰 竞猜领奖", "竞猜领奖", enter: true),
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"),
|
||
Button.CreateCmdButton("❓ 竞猜帮助", "竞猜帮助"));
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail == "竞猜领奖")
|
||
{
|
||
BotReply reply = BettingController.ClaimRewards(uid);
|
||
reply.Keyboard = new KeyboardMessage()
|
||
.AppendButtons(2,
|
||
Button.CreateCmdButton("📜 我的竞猜", "我的竞猜"),
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"));
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
return true;
|
||
}
|
||
|
||
if (e.Detail.StartsWith("竞猜"))
|
||
{
|
||
string detail = e.Detail.Replace("竞猜", "").Trim();
|
||
string[] parts = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||
if (parts.Length < 3 || !int.TryParse(parts[0], out int mid) || !long.TryParse(parts[^1], out long amt))
|
||
{
|
||
await SendAsync(e, "CS赛事竞猜", "格式:竞猜 <比赛ID> <选项> <金额>\r\n选项:team1 / team2 / score:16:14 / mvp:选手UID");
|
||
return true;
|
||
}
|
||
string option = string.Join(" ", parts[1..^1]).ToLower();
|
||
|
||
BotReply reply = BettingController.PlaceBet(uid, mid, option, amt);
|
||
|
||
// 根据控制器返回的消息判断投注结果(简单判断是否包含"成功")
|
||
bool success = reply.Markdown?.Content?.Contains("成功") ?? false;
|
||
|
||
KeyboardMessage kb = new();
|
||
// 成功与失败通用的按钮
|
||
kb.AppendButtons(3,
|
||
Button.CreateCmdButton("📜 我的竞猜", "我的竞猜"),
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"),
|
||
Button.CreateCmdButton("❓ 竞猜帮助", "竞猜帮助"));
|
||
|
||
// 成功时追加“继续查看该场比赛”按钮(填充指令)
|
||
if (success)
|
||
{
|
||
kb.AppendButtonsWithNewRow(2,
|
||
Button.CreateCmdButton("🔄 再次投注", e.Detail, enter: false),
|
||
Button.CreateCmdButton("🔍 比赛详情", $"比赛详情 {mid}"));
|
||
}
|
||
|
||
reply.Keyboard = kb;
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
return true;
|
||
}
|
||
|
||
// 管理员结算
|
||
if (e.Detail.StartsWith("结算比赛"))
|
||
{
|
||
string detail = e.Detail.Replace("结算比赛", "").Trim();
|
||
string[] parts = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||
if (parts.Length >= 2 && int.TryParse(parts[0], out int mid))
|
||
{
|
||
string winner = "", mResult = "";
|
||
foreach (var p in parts[1..])
|
||
{
|
||
if (p.StartsWith("winner=")) winner = p[7..];
|
||
if (p.StartsWith("result=")) mResult = p[7..];
|
||
}
|
||
BotReply reply = BettingController.SettleMatch(uid, mid, winner, mResult);
|
||
reply.Keyboard = new KeyboardMessage()
|
||
.AppendButtons(2,
|
||
Button.CreateCmdButton("📋 赛事列表", "赛事列表"),
|
||
Button.CreateCmdButton("⚙️ 继续结算", "结算比赛 ", enter: false));
|
||
await SendAsync(e, "CS赛事竞猜", reply);
|
||
}
|
||
else
|
||
await SendAsync(e, "CS赛事竞猜", "格式:结算比赛 <比赛ID> winner=team1 result=16:14");
|
||
return true;
|
||
}
|
||
|
||
// 指令:创建赛事 <名称> <开始时间> <结束时间>
|
||
// 示例:创建赛事 春季赛 2026-03-01 2026-03-10
|
||
// 示例:创建赛事 总决赛 2026-04-01 2026-04-05 1001,1002
|
||
if (e.Detail.StartsWith("创建赛事"))
|
||
{
|
||
e.UseNotice = false;
|
||
if (!FunGameConstant.UserIdAndUsername.TryGetValue(uid, out User? user) || (!user.IsAdmin && !user.IsOperator))
|
||
{
|
||
await SendAsync(e, "创建赛事", "你没有权限执行此操作。");
|
||
return true;
|
||
}
|
||
|
||
string detail = e.Detail.Replace("创建赛事", "").Trim();
|
||
string[] parts = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||
if (parts.Length < 3)
|
||
{
|
||
await SendAsync(e, "创建赛事", "格式:创建赛事 <名称> <开始时间> <结束时间>\r\n" +
|
||
"时间格式:yyyy-MM-dd HH:mm 或 yyyy-MM-dd(默认00:00)\r\n" +
|
||
"示例:创建赛事 春季赛 2026-03-01 2026-03-10\r\n" +
|
||
"示例:创建赛事 总决赛 2026-04-01 12:00 2026-04-05 18:00");
|
||
return true;
|
||
}
|
||
|
||
string name = parts[0];
|
||
if (name.Length > 100)
|
||
{
|
||
await SendAsync(e, "创建赛事", "赛事名称不能超过100个字符。");
|
||
return true;
|
||
}
|
||
|
||
// 尝试解析时间(支持 yyyy-MM-dd 或 yyyy-MM-dd HH:mm)
|
||
string startStr = parts[1] + (parts[2].Contains(':') ? " " + parts[2] : " 00:00");
|
||
int nextIndex = parts[2].Contains(':') ? 3 : 2;
|
||
string endStr = parts[nextIndex] + (parts.Length > nextIndex + 1 && parts[nextIndex + 1].Contains(':') ? " " + parts[nextIndex + 1] : " 00:00");
|
||
int mvpStart = parts[nextIndex].Contains(':') ? nextIndex + 2 : nextIndex + 1;
|
||
|
||
if (!DateTime.TryParseExact(startStr, new[] { "yyyy-MM-dd HH:mm", "yyyy-MM-dd" }, null, System.Globalization.DateTimeStyles.None, out DateTime startTime) ||
|
||
!DateTime.TryParseExact(endStr, new[] { "yyyy-MM-dd HH:mm", "yyyy-MM-dd" }, null, System.Globalization.DateTimeStyles.None, out DateTime endTime))
|
||
{
|
||
await SendAsync(e, "创建赛事", "时间格式错误,请使用 yyyy-MM-dd 或 yyyy-MM-dd HH:mm。");
|
||
return true;
|
||
}
|
||
|
||
BotReply reply = BettingController.CreateEvent(new CreateEventRequest
|
||
{
|
||
Uid = uid,
|
||
Name = name,
|
||
StartTime = startTime,
|
||
EndTime = endTime
|
||
});
|
||
await SendAsync(e, "创建赛事", reply);
|
||
return true;
|
||
}
|
||
|
||
// 指令:创建比赛 <赛事ID> <队伍1> <队伍2> <阶段> <开始时间> <投注截止时间> [选项列表(逗号分隔)]
|
||
// 示例:创建比赛 1 NAVI FaZe Quarter-final 2026-03-05 14:00 2026-03-05 13:55
|
||
// 示例:创建比赛 1 G2 Vitality Semi-final 2026-04-02 18:00 2026-04-02 17:55 team1_win,team2_win,score
|
||
if (e.Detail.StartsWith("创建比赛"))
|
||
{
|
||
e.UseNotice = false;
|
||
if (!FunGameConstant.UserIdAndUsername.TryGetValue(uid, out User? user) || (!user.IsAdmin && !user.IsOperator))
|
||
{
|
||
await SendAsync(e, "创建比赛", "你没有权限执行此操作。");
|
||
return true;
|
||
}
|
||
|
||
string detail = e.Detail.Replace("创建比赛", "").Trim();
|
||
string[] parts = detail.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||
if (parts.Length < 7) // 最少需要 eventId, team1, team2, stage, start date, start time, deadline date, deadline time
|
||
{
|
||
await SendAsync(e, "创建比赛",
|
||
"格式:创建比赛 <赛事ID> <队伍1> <队伍2> <阶段> <开始时间> <投注截止时间> [选项列表(逗号分隔)]\r\n" +
|
||
"时间格式:yyyy-MM-dd HH:mm(开始/截止各占两段)\r\n" +
|
||
"示例:创建比赛 1 NAVI FaZe Quarter-final 2026-03-05 14:00 2026-03-05 13:55\r\n" +
|
||
"选项默认 team1_win,team2_win ,可额外添加 score,mvp");
|
||
return true;
|
||
}
|
||
|
||
if (!int.TryParse(parts[0], out int eventId))
|
||
{
|
||
await SendAsync(e, "创建比赛", "赛事ID必须为数字。");
|
||
return true;
|
||
}
|
||
|
||
string team1 = parts[1];
|
||
string team2 = parts[2];
|
||
string stage = parts[3];
|
||
|
||
// 开始时间(parts[4] + parts[5])
|
||
string startDate = parts[4];
|
||
string startTime = parts[5];
|
||
// 截止时间(parts[6] + parts[7] 如果存在)
|
||
if (parts.Length < 8)
|
||
{
|
||
await SendAsync(e, "创建比赛", "投注截止时间需要完整日期和时间,示例:2026-03-05 13:55");
|
||
return true;
|
||
}
|
||
string deadlineDate = parts[6];
|
||
string deadlineTime = parts[7];
|
||
|
||
if (!DateTime.TryParseExact(startDate + " " + startTime, "yyyy-MM-dd HH:mm", null, System.Globalization.DateTimeStyles.None, out DateTime startDt) ||
|
||
!DateTime.TryParseExact(deadlineDate + " " + deadlineTime, "yyyy-MM-dd HH:mm", null, System.Globalization.DateTimeStyles.None, out DateTime deadlineDt))
|
||
{
|
||
await SendAsync(e, "创建比赛", "时间格式错误,请使用 yyyy-MM-dd HH:mm(开始时间和截止时间各两段)。");
|
||
return true;
|
||
}
|
||
|
||
string options = "team1_win,team2_win";
|
||
if (parts.Length > 8)
|
||
{
|
||
options = string.Join(",", parts[8..]); // 剩余部分视为选项列表
|
||
}
|
||
|
||
BotReply reply = BettingController.CreateMatch(new CreateMatchRequest
|
||
{
|
||
Uid = uid,
|
||
EventId = eventId,
|
||
Team1Name = team1,
|
||
Team2Name = team2,
|
||
Stage = stage,
|
||
StartTime = startDt,
|
||
BetDeadline = deadlineDt,
|
||
AvailableOptions = options
|
||
});
|
||
await SendAsync(e, "创建比赛", reply);
|
||
return true;
|
||
}
|
||
|
||
if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
|
||
{
|
||
string msg = Controller.Relaod(uid);
|
||
if (msg != "")
|
||
{
|
||
await SendAsync(e, "重载FunGame", msg);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError("Error: {ex}", ex);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
public async Task<bool> HandlerByConsole(IBotMessage e, OtherData data)
|
||
{
|
||
if (MemoryCache.Get(e.AuthorOpenId) is null)
|
||
{
|
||
MemoryCache.Set(e.AuthorOpenId, 1L, TimeSpan.FromMinutes(10));
|
||
}
|
||
return await Handler(e, data);
|
||
}
|
||
|
||
public BotReply MergeToMarkdown(string subtitle, List<string> msgs)
|
||
{
|
||
if (msgs.Count > 30)
|
||
{
|
||
msgs = [.. msgs[..15], .. msgs[^15..]];
|
||
}
|
||
return new()
|
||
{
|
||
Markdown = new()
|
||
{
|
||
Content = $"{subtitle}\r\n```\r\n{string.Join("\r\n", msgs)}\r\n```"
|
||
}
|
||
};
|
||
}
|
||
|
||
public List<string> MergeMessages(List<string> msgs)
|
||
{
|
||
List<string> real = [];
|
||
if (msgs.Count > 1)
|
||
{
|
||
if (msgs.Count > 20)
|
||
{
|
||
msgs = [msgs[0], .. msgs[^20..]];
|
||
}
|
||
int perMergeLength = msgs.Count > 5 ? 5 : msgs.Count;
|
||
int remain = perMergeLength;
|
||
string merge = "";
|
||
for (int i = 0; i < msgs.Count; i++)
|
||
{
|
||
remain--;
|
||
merge += msgs[i] + "\r\n";
|
||
if (remain == 0 || i == msgs.Count - 1)
|
||
{
|
||
real.Add(merge);
|
||
merge = "";
|
||
if (msgs.Count < perMergeLength)
|
||
{
|
||
remain = msgs.Count;
|
||
}
|
||
else remain = perMergeLength;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
real = msgs;
|
||
}
|
||
if (real.Count >= 3)
|
||
{
|
||
real = [real[0], .. real[^2..]];
|
||
}
|
||
return real;
|
||
}
|
||
|
||
public BotReply CreateMarkdownFromText(string text)
|
||
{
|
||
return new()
|
||
{
|
||
Markdown = new()
|
||
{
|
||
Content = text
|
||
}
|
||
};
|
||
}
|
||
}
|
||
}
|