添加商店和商品列表

This commit is contained in:
milimoe 2025-01-21 01:36:09 +08:00
parent e4520a1953
commit d178efe633
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
6 changed files with 441 additions and 157 deletions

View File

@ -7,6 +7,8 @@ using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Core.Library.Constant;
using Oshima.Core.Configs; using Oshima.Core.Configs;
using Oshima.Core.Constant; using Oshima.Core.Constant;
using Oshima.FunGame.OshimaServers.Service;
using TaskScheduler = Milimoe.FunGame.Core.Api.Utility.TaskScheduler;
namespace Oshima.FunGame.OshimaServers namespace Oshima.FunGame.OshimaServers
{ {
@ -58,7 +60,7 @@ namespace Oshima.FunGame.OshimaServers
public override bool StartAnonymousServer(IServerModel model, Dictionary<string, object> data) public override bool StartAnonymousServer(IServerModel model, Dictionary<string, object> data)
{ {
// 可以做验证处理 // 可以做验证处理
string access_token = NetworkUtility.JsonDeserializeFromDictionary<string>(data, "access_token") ?? ""; string access_token = Controller.JSON.GetObject<string>(data, "access_token") ?? "";
if (GeneralSettings.TokenList.Contains(access_token)) if (GeneralSettings.TokenList.Contains(access_token))
{ {
// 添加当前单例 // 添加当前单例
@ -92,6 +94,106 @@ namespace Oshima.FunGame.OshimaServers
{ {
Controller.NewSQLHelper(); Controller.NewSQLHelper();
Controller.NewMailSender(); 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<Quest> 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<Quest> 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> 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);
} }
/// <summary> /// <summary>
@ -119,7 +221,7 @@ namespace Oshima.FunGame.OshimaServers
Dictionary<string, object> result = []; Dictionary<string, object> result = [];
Controller.WriteLine("接收匿名服务器消息", LogLevel.Debug); Controller.WriteLine("接收匿名服务器消息", LogLevel.Debug);
long groupid = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "groupid"); long groupid = Controller.JSON.GetObject<long>(data, "groupid");
if (groupid > 0) if (groupid > 0)
{ {
result["groupid"] = groupid; result["groupid"] = groupid;
@ -128,7 +230,7 @@ namespace Oshima.FunGame.OshimaServers
if (data.Count > 0) if (data.Count > 0)
{ {
// 根据服务器和客户端的数据传输约定,自行处理 data并返回。 // 根据服务器和客户端的数据传输约定,自行处理 data并返回。
string command = NetworkUtility.JsonDeserializeFromDictionary<string>(data, "command") ?? ""; string command = Controller.JSON.GetObject<string>(data, "command") ?? "";
switch (command.Trim().ToLower()) switch (command.Trim().ToLower())
{ {
case "scadd": case "scadd":
@ -157,49 +259,42 @@ namespace Oshima.FunGame.OshimaServers
{ {
string result = ""; string result = "";
SQLHelper? sql = Factory.OpenFactory.GetSQLHelper(); using SQLHelper? sql = Controller.GetSQLHelper();
if (sql != null) if (sql != null)
{ {
using (sql) try
{ {
try long qq = Controller.JSON.GetObject<long>(data, "qq");
double sc = Controller.JSON.GetObject<double>(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<long>(data, "qq"); sql.Script = "update saints set sc = sc + @sc where qq = @qq";
double sc = NetworkUtility.JsonDeserializeFromDictionary<double>(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();
}
} }
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(); sql.Rollback();
} }
finally }
{ catch (Exception e)
sql.Close(); {
} result = e.ToString();
sql.Rollback();
} }
} }
else result = "无法调用此接口SQL 服务不可用。"; else result = "无法调用此接口SQL 服务不可用。";

View File

@ -1,12 +1,8 @@
using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.Core; using Oshima.Core;
using Oshima.Core.Configs;
using Oshima.Core.Constant; using Oshima.Core.Constant;
using Oshima.FunGame.OshimaServers.Service; using Oshima.FunGame.OshimaServers.Service;
using TaskScheduler = Milimoe.FunGame.Core.Api.Utility.TaskScheduler;
namespace Oshima.FunGame.OshimaServers namespace Oshima.FunGame.OshimaServers
{ {
@ -22,12 +18,12 @@ namespace Oshima.FunGame.OshimaServers
public override void ProcessInput(string input) public override void ProcessInput(string input)
{ {
if (input.StartsWith("fungametest")) if (input == "fungametest")
{ {
FunGameSimulation.StartSimulationGame(true, true); FunGameSimulation.StartSimulationGame(true, true);
} }
// OSM指令 // 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); //MasterCommand.Execute(read, GeneralSettings.Master, false, GeneralSettings.Master, false);
Controller.WriteLine("试图使用 .osm 指令:" + input); Controller.WriteLine("试图使用 .osm 指令:" + input);
@ -36,94 +32,7 @@ namespace Oshima.FunGame.OshimaServers
public override void AfterLoad(ServerPluginLoader loader, params object[] objs) public override void AfterLoad(ServerPluginLoader loader, params object[] objs)
{ {
Controller.NewSQLHelper();
Controller.NewMailSender();
OSMCore.InitOSMCore(); 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<Quest> 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<Quest> 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);
} }
} }
} }

View File

@ -1978,7 +1978,7 @@ namespace Oshima.FunGame.OshimaServers.Service
} }
else else
{ {
return "任务列表为空,请等待刷新"; return "任务列表为空,请使用【任务列表】指令来获取任务列表";
} }
} }
} }
@ -2024,5 +2024,34 @@ namespace Oshima.FunGame.OshimaServers.Service
} }
return result; return result;
} }
public static string CheckDailyStore(EntityModuleConfig<Store> 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 "商品列表为空,请使用【每日商店】指令来获取商品列表!";
}
}
}
} }
} }

View File

@ -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> 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> 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> 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")] [HttpGet("reload")]
public string Relaod([FromQuery] long? master = null) public string Relaod([FromQuery] long? master = null)
{ {

View File

@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Common.Addon;
using Oshima.Core.Configs; using Oshima.Core.Configs;
using Oshima.Core.Constant; using Oshima.Core.Constant;
using Oshima.FunGame.OshimaServers.Service;
using Oshima.FunGame.WebAPI.Constant; using Oshima.FunGame.WebAPI.Constant;
using Oshima.FunGame.WebAPI.Controllers; using Oshima.FunGame.WebAPI.Controllers;
using Oshima.FunGame.WebAPI.Models; using Oshima.FunGame.WebAPI.Models;
@ -24,15 +24,13 @@ namespace Oshima.FunGame.WebAPI
public override void ProcessInput(string input) public override void ProcessInput(string input)
{ {
if (input.StartsWith("fungametest")) if (input == "test")
{ {
FunGameSimulation.StartSimulationGame(true, true); FunGameController controller = new(new Logger<FunGameController>(new LoggerFactory()));
} Controller.WriteLine(Controller.JSON.GetObject<string>(controller.CreateSaved(1, "测试用户")) ?? "test");
// OSM指令 Controller.WriteLine(Controller.JSON.GetObject<string>(controller.GetItemInfo_Name(1, "鸳鸯眼")) ?? "test");
if (input.Length >= 4 && input[..4].Equals(".osm", StringComparison.CurrentCultureIgnoreCase)) Controller.WriteLine(Controller.JSON.GetObject<string>(controller.GetCharacterInfoFromInventory(1, 1, false)) ?? "test");
{ Controller.WriteLine(string.Join("\r\n", controller.GetBoss(1)));
//MasterCommand.Execute(read, GeneralSettings.Master, false, GeneralSettings.Master, false);
Controller.WriteLine("试图使用 .osm 指令:" + input);
} }
} }

View File

@ -18,17 +18,17 @@ namespace Oshima.FunGame.WebAPI.Services
private QQBotService Service { get; } = service; private QQBotService Service { get; } = service;
private ILogger<RainBOTService> Logger { get; } = logger; private ILogger<RainBOTService> 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); Statics.RunningPlugin?.Controller.WriteLine(title, Milimoe.FunGame.Core.Library.Constant.LogLevel.Debug);
if (msg.IsGroup) 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 else
{ {
content = content.Trim(); 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") if (e.Detail == "帮助" || e.Detail == "帮助1")
{ {
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 5 页) await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 6 页)
11 11
2// [] 2// []
3 <> []//////... 3 <> []//////...
@ -97,7 +97,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助2") if (e.Detail == "帮助2")
{ {
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 2 / 5 页) await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 2 / 6 页)
12 <> <> 12 <> <>
13 <> <> 13 <> <>
* 1////1/2 * 1////1/2
@ -114,7 +114,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助3") if (e.Detail == "帮助3")
{ {
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 3 / 5 页) await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 3 / 6 页)
22 [] 22 []
23 [] 23 []
23 <> <> 23 <> <>
@ -132,7 +132,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助4") if (e.Detail == "帮助4")
{ {
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 4 / 5 页) await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 4 / 6 页)
33 <>1=200 33 <>1=200
34 34
35 35
@ -148,13 +148,34 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助5") if (e.Detail == "帮助5")
{ {
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 5 / 5 页) await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 5 / 6 页)
43 43
44 <> 44 <>
45 45
46 46
47 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 <@>/<QQ号
59 <@>/<QQ号
60 <@>/<QQ号
61 <@>/<QQ号
62 <> <{...}>");
} }
if (e.Detail.StartsWith("FunGame模拟", StringComparison.CurrentCultureIgnoreCase)) if (e.Detail.StartsWith("FunGame模拟", StringComparison.CurrentCultureIgnoreCase))
@ -190,9 +211,10 @@ namespace Oshima.FunGame.WebAPI.Services
{ {
real = real[^3..]; real = real[^3..];
} }
int count = 1;
foreach (string msg in real) foreach (string msg in real)
{ {
await SendAsync(e, "饭给木", msg.Trim()); await SendAsync(e, "饭给木", msg.Trim(), msgSeq: count++);
await Task.Delay(5500); await Task.Delay(5500);
} }
FunGameSimulation = false; FunGameSimulation = false;
@ -241,9 +263,10 @@ namespace Oshima.FunGame.WebAPI.Services
{ {
real = real[^3..]; real = real[^3..];
} }
int count = 1;
foreach (string msg in real) foreach (string msg in real)
{ {
await SendAsync(e, "饭给木", msg.Trim()); await SendAsync(e, "饭给木", msg.Trim(), msgSeq: count++);
await Task.Delay(5500); await Task.Delay(5500);
} }
FunGameSimulation = false; FunGameSimulation = false;
@ -1320,9 +1343,10 @@ namespace Oshima.FunGame.WebAPI.Services
{ {
real = real[^3..]; real = real[^3..];
} }
int count = 1;
foreach (string msg in real) foreach (string msg in real)
{ {
await SendAsync(e, "完整决斗", msg.Trim()); await SendAsync(e, "完整决斗", msg.Trim(), msgSeq: count++);
await Task.Delay(1500); await Task.Delay(1500);
} }
return result; return result;
@ -1370,9 +1394,10 @@ namespace Oshima.FunGame.WebAPI.Services
{ {
real = real[^3..]; real = real[^3..];
} }
int count = 1;
foreach (string msg in real) foreach (string msg in real)
{ {
await SendAsync(e, "决斗", msg.Trim()); await SendAsync(e, "决斗", msg.Trim(), msgSeq: count++);
await Task.Delay(1500); await Task.Delay(1500);
} }
return result; return result;
@ -1428,9 +1453,10 @@ namespace Oshima.FunGame.WebAPI.Services
{ {
real = real[^3..]; real = real[^3..];
} }
int count = 1;
foreach (string msg in real) foreach (string msg in real)
{ {
await SendAsync(e, "完整决斗", msg.Trim()); await SendAsync(e, "完整决斗", msg.Trim(), msgSeq: count++);
await Task.Delay(1500); await Task.Delay(1500);
} }
return result; return result;
@ -1500,9 +1526,10 @@ namespace Oshima.FunGame.WebAPI.Services
{ {
real = real[^3..]; real = real[^3..];
} }
int count = 1;
foreach (string msg in real) foreach (string msg in real)
{ {
await SendAsync(e, "BOSS", msg.Trim()); await SendAsync(e, "BOSS", msg.Trim(), msgSeq: count++);
await Task.Delay(1500); await Task.Delay(1500);
} }
} }
@ -1558,9 +1585,10 @@ namespace Oshima.FunGame.WebAPI.Services
{ {
real = real[^3..]; real = real[^3..];
} }
int count = 1;
foreach (string msg in real) foreach (string msg in real)
{ {
await SendAsync(e, "BOSS", msg.Trim()); await SendAsync(e, "BOSS", msg.Trim(), msgSeq: count++);
await Task.Delay(1500); await Task.Delay(1500);
} }
} }
@ -1796,6 +1824,44 @@ namespace Oshima.FunGame.WebAPI.Services
return result; return result;
} }
if (e.Detail == "每日商店")
{
string msg = NetworkUtility.JsonDeserialize<string>(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<string>(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<string>(Controller.DailyStoreShowInfo(qq, id)) ?? "";
if (msg != "")
{
await SendAsync(e, "商店", msg);
}
}
return result;
}
if (qq == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase)) if (qq == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
{ {
string msg = NetworkUtility.JsonDeserialize<string>(Controller.Relaod(qq)) ?? ""; string msg = NetworkUtility.JsonDeserialize<string>(Controller.Relaod(qq)) ?? "";