diff --git a/OshimaServers/AnonymousServer.cs b/OshimaServers/AnonymousServer.cs index 3ccabe1..f36caa7 100644 --- a/OshimaServers/AnonymousServer.cs +++ b/OshimaServers/AnonymousServer.cs @@ -7,6 +7,8 @@ using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Constant; using Oshima.Core.Configs; using Oshima.Core.Constant; +using Oshima.FunGame.OshimaServers.Service; +using TaskScheduler = Milimoe.FunGame.Core.Api.Utility.TaskScheduler; namespace Oshima.FunGame.OshimaServers { @@ -58,7 +60,7 @@ namespace Oshima.FunGame.OshimaServers public override bool StartAnonymousServer(IServerModel model, Dictionary data) { // 可以做验证处理 - string access_token = NetworkUtility.JsonDeserializeFromDictionary(data, "access_token") ?? ""; + string access_token = Controller.JSON.GetObject(data, "access_token") ?? ""; if (GeneralSettings.TokenList.Contains(access_token)) { // 添加当前单例 @@ -92,6 +94,106 @@ namespace Oshima.FunGame.OshimaServers { Controller.NewSQLHelper(); Controller.NewMailSender(); + FunGameService.InitFunGame(); + FunGameSimulation.InitFunGameSimulation(); + TaskScheduler.Shared.AddTask("重置每日运势", new TimeSpan(0, 0, 0), () => + { + Controller.WriteLine("已重置所有人的今日运势"); + Daily.ClearDaily(); + }); + TaskScheduler.Shared.AddTask("重置交易冷却1", new TimeSpan(9, 0, 0), () => + { + Controller.WriteLine("重置物品交易冷却时间"); + _ = FunGameService.AllowSellAndTrade(); + }); + TaskScheduler.Shared.AddTask("重置交易冷却2", new TimeSpan(15, 0, 0), () => + { + Controller.WriteLine("重置物品交易冷却时间"); + _ = FunGameService.AllowSellAndTrade(); + }); + TaskScheduler.Shared.AddRecurringTask("刷新存档缓存", TimeSpan.FromMinutes(1), () => + { + string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/saved"; + if (Directory.Exists(directoryPath)) + { + string[] filePaths = Directory.GetFiles(directoryPath); + foreach (string filePath in filePaths) + { + string fileName = Path.GetFileNameWithoutExtension(filePath); + PluginConfig pc = new("saved", fileName); + pc.LoadConfig(); + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + // 将用户存入缓存 + FunGameService.UserIdAndUsername[user.Id] = user; + // 任务结算 + EntityModuleConfig quests = new("quests", user.Id.ToString()); + quests.LoadConfig(); + if (quests.Count > 0 && FunGameService.SettleQuest(user, quests)) + { + quests.SaveConfig(); + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + } + } + } + Controller.WriteLine("读取 FunGame 存档缓存", LogLevel.Debug); + } + }, true); + TaskScheduler.Shared.AddTask("刷新每日任务", new TimeSpan(4, 0, 0), () => + { + string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/quests"; + if (Directory.Exists(directoryPath)) + { + string[] filePaths = Directory.GetFiles(directoryPath); + foreach (string filePath in filePaths) + { + string fileName = Path.GetFileNameWithoutExtension(filePath); + EntityModuleConfig quests = new("quests", fileName); + quests.Clear(); + FunGameService.CheckQuestList(quests); + quests.SaveConfig(); + } + Controller.WriteLine("刷新每日任务"); + } + // 刷新签到 + directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/saved"; + if (Directory.Exists(directoryPath)) + { + string[] filePaths = Directory.GetFiles(directoryPath); + foreach (string filePath in filePaths) + { + string fileName = Path.GetFileNameWithoutExtension(filePath); + PluginConfig pc = new("saved", fileName); + pc.LoadConfig(); + pc.Add("signed", false); + pc.SaveConfig(); + } + Controller.WriteLine("刷新签到"); + } + // 刷新商店 + directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/stores"; + if (Directory.Exists(directoryPath)) + { + string[] filePaths = Directory.GetFiles(directoryPath); + foreach (string filePath in filePaths) + { + string fileName = Path.GetFileNameWithoutExtension(filePath); + EntityModuleConfig store = new("stores", fileName); + store.Clear(); + FunGameService.CheckDailyStore(store); + store.SaveConfig(); + } + Controller.WriteLine("刷新签到"); + } + }); + TaskScheduler.Shared.AddRecurringTask("刷新boss", TimeSpan.FromHours(1), () => + { + FunGameService.GenerateBoss(); + Controller.WriteLine("刷新boss"); + }, true); } /// @@ -119,7 +221,7 @@ namespace Oshima.FunGame.OshimaServers Dictionary result = []; Controller.WriteLine("接收匿名服务器消息", LogLevel.Debug); - long groupid = NetworkUtility.JsonDeserializeFromDictionary(data, "groupid"); + long groupid = Controller.JSON.GetObject(data, "groupid"); if (groupid > 0) { result["groupid"] = groupid; @@ -128,7 +230,7 @@ namespace Oshima.FunGame.OshimaServers if (data.Count > 0) { // 根据服务器和客户端的数据传输约定,自行处理 data,并返回。 - string command = NetworkUtility.JsonDeserializeFromDictionary(data, "command") ?? ""; + string command = Controller.JSON.GetObject(data, "command") ?? ""; switch (command.Trim().ToLower()) { case "scadd": @@ -157,49 +259,42 @@ namespace Oshima.FunGame.OshimaServers { string result = ""; - SQLHelper? sql = Factory.OpenFactory.GetSQLHelper(); + using SQLHelper? sql = Controller.GetSQLHelper(); if (sql != null) { - using (sql) + try { - try + long qq = Controller.JSON.GetObject(data, "qq"); + double sc = Controller.JSON.GetObject(data, "sc"); + sql.NewTransaction(); + sql.Script = "select * from saints where qq = @qq"; + sql.Parameters.Add("qq", qq); + sql.ExecuteDataSet(); + sql.Parameters.Add("sc", sc); + sql.Parameters.Add("qq", qq); + if (sql.Success) { - long qq = NetworkUtility.JsonDeserializeFromDictionary(data, "qq"); - double sc = NetworkUtility.JsonDeserializeFromDictionary(data, "sc"); - sql.NewTransaction(); - sql.Script = "select * from saints where qq = @qq"; - sql.Parameters.Add("qq", qq); - sql.ExecuteDataSet(); - sql.Parameters.Add("sc", sc); - sql.Parameters.Add("qq", qq); - if (sql.Success) - { - sql.Script = "update saints set sc = sc + @sc where qq = @qq"; - } - else - { - sql.Script = "insert into saints(qq, sc) values(@qq, @sc)"; - } - sql.Execute(); - if (sql.Success) - { - Controller.WriteLine($"用户 {qq} 的圣人点数增加了 {sc}", LogLevel.Debug); - sql.Commit(); - } - else - { - sql.Rollback(); - } + sql.Script = "update saints set sc = sc + @sc where qq = @qq"; } - catch (Exception e) + else + { + sql.Script = "insert into saints(qq, sc) values(@qq, @sc)"; + } + sql.Execute(); + if (sql.Success) + { + Controller.WriteLine($"用户 {qq} 的圣人点数增加了 {sc}", LogLevel.Debug); + sql.Commit(); + } + else { - result = e.ToString(); sql.Rollback(); } - finally - { - sql.Close(); - } + } + catch (Exception e) + { + result = e.ToString(); + sql.Rollback(); } } else result = "无法调用此接口:SQL 服务不可用。"; diff --git a/OshimaServers/OshimaServer.cs b/OshimaServers/OshimaServer.cs index 16ed62c..4b9b989 100644 --- a/OshimaServers/OshimaServer.cs +++ b/OshimaServers/OshimaServer.cs @@ -1,12 +1,8 @@ using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Constant; using Oshima.Core; -using Oshima.Core.Configs; using Oshima.Core.Constant; using Oshima.FunGame.OshimaServers.Service; -using TaskScheduler = Milimoe.FunGame.Core.Api.Utility.TaskScheduler; namespace Oshima.FunGame.OshimaServers { @@ -22,12 +18,12 @@ namespace Oshima.FunGame.OshimaServers public override void ProcessInput(string input) { - if (input.StartsWith("fungametest")) + if (input == "fungametest") { FunGameSimulation.StartSimulationGame(true, true); } // OSM指令 - if (input.Length >= 4 && input[..4].Equals(".osm", StringComparison.CurrentCultureIgnoreCase)) + if (input.StartsWith(".osm", StringComparison.CurrentCultureIgnoreCase)) { //MasterCommand.Execute(read, GeneralSettings.Master, false, GeneralSettings.Master, false); Controller.WriteLine("试图使用 .osm 指令:" + input); @@ -36,94 +32,7 @@ namespace Oshima.FunGame.OshimaServers public override void AfterLoad(ServerPluginLoader loader, params object[] objs) { - Controller.NewSQLHelper(); - Controller.NewMailSender(); OSMCore.InitOSMCore(); - FunGameService.InitFunGame(); - FunGameSimulation.InitFunGameSimulation(); - TaskScheduler.Shared.AddTask("重置每日运势", new TimeSpan(0, 0, 0), () => - { - Controller.WriteLine("已重置所有人的今日运势"); - Daily.ClearDaily(); - }); - TaskScheduler.Shared.AddTask("重置交易冷却1", new TimeSpan(9, 0, 0), () => - { - Controller.WriteLine("重置物品交易冷却时间"); - _ = FunGameService.AllowSellAndTrade(); - }); - TaskScheduler.Shared.AddTask("重置交易冷却2", new TimeSpan(15, 0, 0), () => - { - Controller.WriteLine("重置物品交易冷却时间"); - _ = FunGameService.AllowSellAndTrade(); - }); - TaskScheduler.Shared.AddRecurringTask("刷新存档缓存", TimeSpan.FromMinutes(1), () => - { - string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/saved"; - if (Directory.Exists(directoryPath)) - { - string[] filePaths = Directory.GetFiles(directoryPath); - foreach (string filePath in filePaths) - { - string fileName = Path.GetFileNameWithoutExtension(filePath); - PluginConfig pc = new("saved", fileName); - pc.LoadConfig(); - if (pc.Count > 0) - { - User user = FunGameService.GetUser(pc); - // 将用户存入缓存 - FunGameService.UserIdAndUsername[user.Id] = user; - // 任务结算 - EntityModuleConfig quests = new("quests", user.Id.ToString()); - quests.LoadConfig(); - if (quests.Count > 0 && FunGameService.SettleQuest(user, quests)) - { - quests.SaveConfig(); - user.LastTime = DateTime.Now; - pc.Add("user", user); - pc.SaveConfig(); - } - } - } - Controller.WriteLine("读取 FunGame 存档缓存", LogLevel.Debug); - } - }, true); - TaskScheduler.Shared.AddTask("刷新每日任务", new TimeSpan(4, 0, 0), () => - { - string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/quests"; - if (Directory.Exists(directoryPath)) - { - string[] filePaths = Directory.GetFiles(directoryPath); - foreach (string filePath in filePaths) - { - string fileName = Path.GetFileNameWithoutExtension(filePath); - EntityModuleConfig quests = new("quests", fileName); - quests.Clear(); - FunGameService.CheckQuestList(quests); - quests.SaveConfig(); - } - Controller.WriteLine("刷新每日任务"); - } - // 刷新签到 - directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/saved"; - if (Directory.Exists(directoryPath)) - { - string[] filePaths = Directory.GetFiles(directoryPath); - foreach (string filePath in filePaths) - { - string fileName = Path.GetFileNameWithoutExtension(filePath); - PluginConfig pc = new("saved", fileName); - pc.LoadConfig(); - pc.Add("signed", false); - pc.SaveConfig(); - } - Controller.WriteLine("刷新签到"); - } - }); - TaskScheduler.Shared.AddRecurringTask("刷新boss", TimeSpan.FromHours(1), () => - { - FunGameService.GenerateBoss(); - Controller.WriteLine("刷新boss"); - }, true); } } } diff --git a/OshimaServers/Service/FunGameService.cs b/OshimaServers/Service/FunGameService.cs index d160acb..4375c78 100644 --- a/OshimaServers/Service/FunGameService.cs +++ b/OshimaServers/Service/FunGameService.cs @@ -1978,7 +1978,7 @@ namespace Oshima.FunGame.OshimaServers.Service } else { - return "任务列表为空,请等待刷新!"; + return "任务列表为空,请使用【任务列表】指令来获取任务列表!"; } } } @@ -2024,5 +2024,34 @@ namespace Oshima.FunGame.OshimaServers.Service } return result; } + + public static string CheckDailyStore(EntityModuleConfig store) + { + if (store.Count == 0) + { + // 生成每日商店 + Store daily = new("每日商店"); + for (int i = 0; i < 4; i++) + { + int index = Random.Shared.Next(AllItems.Count); + Item item = AllItems[index]; + double price = Random.Shared.NextDouble() * 10000 * (int)item.QualityType * 20; + daily.AddItem(item, Random.Shared.Next(3)); + } + store.Add("daily", daily); + return store.ToString() + "\r\n温馨提示:使用【商店查看+序号】查看物品详细信息,使用【商店购买+序号】购买物品!每天 4:00 刷新每日商店。"; + } + else + { + if (store.Count > 0) + { + return store.ToString() + "\r\n温馨提示:使用【商店查看+序号】查看物品详细信息,使用【商店购买+序号】购买物品!每天 4:00 刷新每日商店。"; + } + else + { + return "商品列表为空,请使用【每日商店】指令来获取商品列表!"; + } + } + } } } diff --git a/OshimaWebAPI/Controllers/FunGameController.cs b/OshimaWebAPI/Controllers/FunGameController.cs index 6fd190f..8856419 100644 --- a/OshimaWebAPI/Controllers/FunGameController.cs +++ b/OshimaWebAPI/Controllers/FunGameController.cs @@ -4551,6 +4551,193 @@ namespace Oshima.FunGame.WebAPI.Controllers } } + [HttpPost("showdailystore")] + public string ShowDailyStore([FromQuery] long? qq = null) + { + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + EntityModuleConfig store = new("stores", userid.ToString()); + store.LoadConfig(); + string msg = FunGameService.CheckDailyStore(store); + store.SaveConfig(); + + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + + return NetworkUtility.JsonSerialize(msg); + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + + [HttpPost("dailystorebuy")] + public string DailyStoreBuy([FromQuery] long? qq = null, [FromQuery] long? id = null) + { + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + long goodid = id ?? 0; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + EntityModuleConfig store = new("stores", userid.ToString()); + store.LoadConfig(); + FunGameService.CheckDailyStore(store); + store.SaveConfig(); + + string msg = ""; + Store? daily = store.Get("daily"); + if (daily != null) + { + if (daily.Goods.Values.FirstOrDefault(g => g.Id == goodid) is Goods good) + { + if (good.Stock <= 0) + { + return NetworkUtility.JsonSerialize($"此商品【{good.Name}】库存不足,无法购买!"); + } + + foreach (string needy in good.Prices.Keys) + { + if (needy == General.GameplayEquilibriumConstant.InGameCurrency) + { + double reduce = good.Prices[needy]; + if (user.Inventory.Credits >= reduce) + { + user.Inventory.Credits -= reduce; + } + else + { + return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameCurrency}不足 {reduce} 呢,无法购买【{good.Name}】!"); + } + } + else if (needy == General.GameplayEquilibriumConstant.InGameMaterial) + { + double reduce = good.Prices[needy]; + if (user.Inventory.Materials >= reduce) + { + user.Inventory.Materials -= reduce; + } + else + { + return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameMaterial}不足 {reduce} 呢,无法购买【{good.Name}】!"); + } + } + } + + foreach (Item item in good.Items) + { + Item newItem = item.Copy(); + FunGameService.SetSellAndTradeTime(newItem); + if (good.GetPrice(General.GameplayEquilibriumConstant.InGameCurrency, out double price)) + { + newItem.Price = Calculation.Round2Digits(price * 0.35); + } + newItem.User = user; + user.Inventory.Items.Add(newItem); + } + + good.Stock--; + + msg += $"恭喜你成功购买【${good.Name}】!" + + $"总计消费:{string.Join("、", good.Prices.Select(kv => $"{kv.Value} {kv.Key}"))}" + + $"包含物品:{string.Join("、", good.Items.Select(i => $"[{ItemSet.GetQualityTypeName(i.QualityType)}|{ItemSet.GetItemTypeName(i.ItemType)}] {i.Name}"))}"; + } + else + { + return NetworkUtility.JsonSerialize($"没有对应编号的商品!"); + } + + } + else + { + return NetworkUtility.JsonSerialize($"商品列表不存在,请刷新!"); + } + + store.Add("daily", daily); + store.SaveConfig(); + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + return NetworkUtility.JsonSerialize(msg); + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + + [HttpPost("dailystoreshowinfo")] + public string DailyStoreShowInfo([FromQuery] long? qq = null, [FromQuery] long? id = null) + { + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + long goodid = id ?? 0; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + EntityModuleConfig store = new("stores", userid.ToString()); + store.LoadConfig(); + FunGameService.CheckDailyStore(store); + store.SaveConfig(); + + string msg = ""; + Store? daily = store.Get("daily"); + if (daily != null) + { + if (daily.Goods.Values.FirstOrDefault(g => g.Id == goodid) is Goods good) + { + int count = 0; + string itemMsg = ""; + foreach (Item item in good.Items) + { + count++; + itemMsg += $"[ {count} ] -> {item.ToString(false, true)}\r\n"; + } + msg += $"{good.Id}. {good.Name}\r\n" + + $"商品描述:{good.Description}\r\n" + + $"商品售价:{string.Join("、", good.Prices.Select(kv => $"{kv.Value} {kv.Key}"))}\r\n" + + $"包含物品:\r\n" + itemMsg + + $"剩余库存:{good.Stock}"; + } + else + { + return NetworkUtility.JsonSerialize($"没有对应编号的物品!"); + } + + } + else + { + return NetworkUtility.JsonSerialize($"商品列表不存在,请刷新!"); + } + + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + return NetworkUtility.JsonSerialize(msg); + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + [HttpGet("reload")] public string Relaod([FromQuery] long? master = null) { diff --git a/OshimaWebAPI/OshimaWebAPI.cs b/OshimaWebAPI/OshimaWebAPI.cs index db7d4b7..8ba21ab 100644 --- a/OshimaWebAPI/OshimaWebAPI.cs +++ b/OshimaWebAPI/OshimaWebAPI.cs @@ -1,10 +1,10 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Library.Common.Addon; using Oshima.Core.Configs; using Oshima.Core.Constant; -using Oshima.FunGame.OshimaServers.Service; using Oshima.FunGame.WebAPI.Constant; using Oshima.FunGame.WebAPI.Controllers; using Oshima.FunGame.WebAPI.Models; @@ -24,15 +24,13 @@ namespace Oshima.FunGame.WebAPI public override void ProcessInput(string input) { - if (input.StartsWith("fungametest")) + if (input == "test") { - FunGameSimulation.StartSimulationGame(true, true); - } - // OSM指令 - if (input.Length >= 4 && input[..4].Equals(".osm", StringComparison.CurrentCultureIgnoreCase)) - { - //MasterCommand.Execute(read, GeneralSettings.Master, false, GeneralSettings.Master, false); - Controller.WriteLine("试图使用 .osm 指令:" + input); + FunGameController controller = new(new Logger(new LoggerFactory())); + Controller.WriteLine(Controller.JSON.GetObject(controller.CreateSaved(1, "测试用户")) ?? "test"); + Controller.WriteLine(Controller.JSON.GetObject(controller.GetItemInfo_Name(1, "鸳鸯眼")) ?? "test"); + Controller.WriteLine(Controller.JSON.GetObject(controller.GetCharacterInfoFromInventory(1, 1, false)) ?? "test"); + Controller.WriteLine(string.Join("\r\n", controller.GetBoss(1))); } } diff --git a/OshimaWebAPI/Services/RainBOTService.cs b/OshimaWebAPI/Services/RainBOTService.cs index eb1e2c5..6f1ff59 100644 --- a/OshimaWebAPI/Services/RainBOTService.cs +++ b/OshimaWebAPI/Services/RainBOTService.cs @@ -18,17 +18,17 @@ namespace Oshima.FunGame.WebAPI.Services private QQBotService Service { get; } = service; private ILogger Logger { get; } = logger; - private async Task SendAsync(IBotMessage msg, string title, string content, int msgType = 0, object? media = null) + private async Task SendAsync(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.IsGroup) { - await Service.SendGroupMessageAsync(msg.OpenId, content, msgType, media, msg.Id); + 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); + await Service.SendC2CMessageAsync(msg.OpenId, content, msgType, media, msg.Id, msgSeq); } } @@ -79,7 +79,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "帮助" || e.Detail == "帮助1") { - await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 5 页) + await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 6 页) 1、创建存档:创建存档,生成随机一个自建角色(序号固定为1) 2、我的库存/我的背包/查看库存 [页码]:显示所有角色、物品库存,每个角色和物品都有一个专属序号 3、我的库存 <物品类型> [页码]:卡包/武器/防具/鞋子/饰品/消耗品/魔法卡等... @@ -97,7 +97,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "帮助2") { - await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 2 / 5 页) + await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 2 / 6 页) 12、装备 <角色序号> <物品序号>:装备指定物品给指定角色 13、取消装备 <角色序号> <装备槽序号>:卸下角色指定装备槽上的物品 * 装备槽序号从1开始,卡包/武器/防具/鞋子/饰品1/饰品2 @@ -114,7 +114,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "帮助3") { - await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 3 / 5 页) + await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 3 / 6 页) 22、普攻升级 [角色序号]:升级普攻等级 23、查看普攻升级 [角色序号]:查看下一次普攻升级信息 23、技能升级 <角色序号> <技能名称>:升级技能等级 @@ -132,7 +132,7 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "帮助4") { - await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 4 / 5 页) + await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 4 / 6 页) 33、兑换金币 <材料数>:1材料=200金币 34、还原存档:没有后悔药 35、我的主战:查看当前主战角色 @@ -148,13 +148,34 @@ namespace Oshima.FunGame.WebAPI.Services if (e.Detail == "帮助5") { - await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 5 / 5 页) + await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 5 / 6 页) 43:任务列表:查看今日任务列表 44:开始任务 <任务序号> 45、任务信息:查看进行中任务的详细信息 46、任务结算:对进行中的任务进行结算 47、我的状态:查看主战角色状态 -48、小队状态/我的小队状态:查看小队所有角色的状态"); +48、小队状态/我的小队状态:查看小队所有角色的状态 +49、小队添加 <角色序号>:将角色加入小队 +50、小队移除 <角色序号>:将角色移出小队 +51、清空小队 +发送【帮助6】查看第 6 页"); + } + + if (e.Detail == "帮助6") + { + await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 6 / 6 页) +52、我的社团:查看社团信息 +53、加入社团 <社团编号>:申请加入社团 +54、退出社团 +55、创建社团 <社团前缀>:创建一个公开社团,若指令中包含私密一词,将创建私密社团 +社团前缀:3-4个字符,允许:英文字母和数字、部分特殊字符 +56、查看社团成员/查看社团管理/查看申请人列表:查看对应列表 +57、解散社团 +58、社团批准 <@对方>//// <{参数...}>"); } if (e.Detail.StartsWith("FunGame模拟", StringComparison.CurrentCultureIgnoreCase)) @@ -190,9 +211,10 @@ namespace Oshima.FunGame.WebAPI.Services { real = real[^3..]; } + int count = 1; foreach (string msg in real) { - await SendAsync(e, "饭给木", msg.Trim()); + await SendAsync(e, "饭给木", msg.Trim(), msgSeq: count++); await Task.Delay(5500); } FunGameSimulation = false; @@ -241,9 +263,10 @@ namespace Oshima.FunGame.WebAPI.Services { real = real[^3..]; } + int count = 1; foreach (string msg in real) { - await SendAsync(e, "饭给木", msg.Trim()); + await SendAsync(e, "饭给木", msg.Trim(), msgSeq: count++); await Task.Delay(5500); } FunGameSimulation = false; @@ -1320,9 +1343,10 @@ namespace Oshima.FunGame.WebAPI.Services { real = real[^3..]; } + int count = 1; foreach (string msg in real) { - await SendAsync(e, "完整决斗", msg.Trim()); + await SendAsync(e, "完整决斗", msg.Trim(), msgSeq: count++); await Task.Delay(1500); } return result; @@ -1370,9 +1394,10 @@ namespace Oshima.FunGame.WebAPI.Services { real = real[^3..]; } + int count = 1; foreach (string msg in real) { - await SendAsync(e, "决斗", msg.Trim()); + await SendAsync(e, "决斗", msg.Trim(), msgSeq: count++); await Task.Delay(1500); } return result; @@ -1428,9 +1453,10 @@ namespace Oshima.FunGame.WebAPI.Services { real = real[^3..]; } + int count = 1; foreach (string msg in real) { - await SendAsync(e, "完整决斗", msg.Trim()); + await SendAsync(e, "完整决斗", msg.Trim(), msgSeq: count++); await Task.Delay(1500); } return result; @@ -1500,9 +1526,10 @@ namespace Oshima.FunGame.WebAPI.Services { real = real[^3..]; } + int count = 1; foreach (string msg in real) { - await SendAsync(e, "BOSS", msg.Trim()); + await SendAsync(e, "BOSS", msg.Trim(), msgSeq: count++); await Task.Delay(1500); } } @@ -1558,9 +1585,10 @@ namespace Oshima.FunGame.WebAPI.Services { real = real[^3..]; } + int count = 1; foreach (string msg in real) { - await SendAsync(e, "BOSS", msg.Trim()); + await SendAsync(e, "BOSS", msg.Trim(), msgSeq: count++); await Task.Delay(1500); } } @@ -1796,6 +1824,44 @@ namespace Oshima.FunGame.WebAPI.Services return result; } + if (e.Detail == "每日商店") + { + string msg = NetworkUtility.JsonDeserialize(Controller.ShowDailyStore(qq)) ?? ""; + if (msg != "") + { + await SendAsync(e, "商店", "\r\n" + msg); + } + return result; + } + + if (e.Detail.StartsWith("商店购买", StringComparison.CurrentCultureIgnoreCase)) + { + string detail = e.Detail.Replace("商店购买", "").Trim(); + if (int.TryParse(detail, out int id)) + { + string msg = NetworkUtility.JsonDeserialize(Controller.DailyStoreBuy(qq, 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 = NetworkUtility.JsonDeserialize(Controller.DailyStoreShowInfo(qq, id)) ?? ""; + if (msg != "") + { + await SendAsync(e, "商店", msg); + } + } + return result; + } + if (qq == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase)) { string msg = NetworkUtility.JsonDeserialize(Controller.Relaod(qq)) ?? "";