mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-12-05 16:16:35 +00:00
修复市场分页BUG;添加魔法卡秘境;移植我的运势功能;其他优化
This commit is contained in:
parent
12f6c35b62
commit
878fab93fb
@ -11,6 +11,8 @@ namespace Oshima.Core.Configs
|
||||
|
||||
public static Dictionary<long, string> UserDailys { get; } = [];
|
||||
|
||||
public static Dictionary<string, string> OpenUserDailys { get; } = [];
|
||||
|
||||
public static List<string> GreatFortune { get; set; } = [];
|
||||
|
||||
public static List<string> ModerateFortune { get; set; } = [];
|
||||
@ -29,6 +31,8 @@ namespace Oshima.Core.Configs
|
||||
|
||||
public static PluginConfig Configs { get; set; } = new("rainbot", "userdaliys");
|
||||
|
||||
public static PluginConfig OpenConfigs { get; set; } = new("rainbot", "openuserdaliys");
|
||||
|
||||
public static void InitDaily()
|
||||
{
|
||||
DailyContent.LoadConfig();
|
||||
@ -93,6 +97,16 @@ namespace Oshima.Core.Configs
|
||||
}
|
||||
}
|
||||
SaveDaily();
|
||||
OpenConfigs.LoadConfig();
|
||||
foreach (string str in OpenConfigs.Keys)
|
||||
{
|
||||
if (OpenConfigs.TryGetValue(str, out object? value2) && value2 != null && !OpenUserDailys.ContainsKey(str))
|
||||
{
|
||||
OpenUserDailys.Add(str, value2.ToString() ?? "");
|
||||
if (OpenUserDailys[str] == "") OpenUserDailys.Remove(str);
|
||||
}
|
||||
}
|
||||
SaveOpenDaily();
|
||||
}
|
||||
|
||||
public static void SaveDaily()
|
||||
@ -108,10 +122,25 @@ namespace Oshima.Core.Configs
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveOpenDaily()
|
||||
{
|
||||
lock (OpenConfigs)
|
||||
{
|
||||
OpenConfigs.Clear();
|
||||
foreach (string openid in OpenUserDailys.Keys)
|
||||
{
|
||||
OpenConfigs.Add(openid.ToString(), OpenUserDailys[openid]);
|
||||
}
|
||||
OpenConfigs.SaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ClearDaily()
|
||||
{
|
||||
UserDailys.Clear();
|
||||
OpenUserDailys.Clear();
|
||||
SaveDaily();
|
||||
SaveOpenDaily();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,8 @@ namespace Oshima.Core.Configs
|
||||
|
||||
public static List<string> TokenList { get; set; } = [];
|
||||
|
||||
public static string DailyImageServerUrl { get; set; } = "";
|
||||
|
||||
public static PluginConfig Configs { get; set; } = new("rainbot", "config");
|
||||
|
||||
public static void LoadSetting()
|
||||
@ -44,6 +46,10 @@ namespace Oshima.Core.Configs
|
||||
{
|
||||
TokenList = (List<string>)value;
|
||||
}
|
||||
if (configs.TryGetValue("DailyImageServerUrl", out value) && value != null)
|
||||
{
|
||||
DailyImageServerUrl = (string)value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveConfig()
|
||||
@ -53,6 +59,7 @@ namespace Oshima.Core.Configs
|
||||
Configs.Add("BlackTimes", BlackTimes);
|
||||
Configs.Add("BlackFrozenTime", BlackFrozenTime);
|
||||
Configs.Add("TokenList", TokenList);
|
||||
Configs.Add("DailyImageServerUrl", DailyImageServerUrl);
|
||||
Configs.SaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,17 @@
|
||||
SkillLevelUp,
|
||||
RogueLike,
|
||||
Team,
|
||||
PVP
|
||||
PVP,
|
||||
MagicCard
|
||||
}
|
||||
|
||||
public enum CardPackModuleType
|
||||
{
|
||||
魔法组,
|
||||
自适应超频模块,
|
||||
同频共振,
|
||||
神经校准,
|
||||
勇气指令,
|
||||
灵魂绑定
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,50 @@
|
||||
法则精粹 = 18013,
|
||||
大师锻造券 = 18014,
|
||||
钻石 = 18998,
|
||||
探索许可 = 18999
|
||||
探索许可 = 18999,
|
||||
青松 = 18921,
|
||||
流星石 = 18922,
|
||||
向日葵 = 18923,
|
||||
金铃花 = 18924,
|
||||
琉璃珠 = 18925,
|
||||
鸣草 = 18926,
|
||||
马尾 = 18927,
|
||||
鬼兜虫 = 18928,
|
||||
烈焰花花蕊 = 18929,
|
||||
堇瓜 = 18930,
|
||||
水晶球 = 18931,
|
||||
薰衣草 = 18932,
|
||||
青石 = 18933,
|
||||
莲花 = 18934,
|
||||
陶罐 = 18935,
|
||||
海灵芝 = 18936,
|
||||
四叶草 = 18937,
|
||||
露珠 = 18938,
|
||||
茉莉花 = 18939,
|
||||
绿萝 = 18940,
|
||||
檀木扇 = 18941,
|
||||
鸟蛋 = 18942,
|
||||
竹笋 = 18943,
|
||||
晶核 = 18944,
|
||||
手工围巾 = 18945,
|
||||
柳条篮 = 18946,
|
||||
风筝 = 18947,
|
||||
羽毛 = 18948,
|
||||
发光髓 = 18949,
|
||||
紫罗兰 = 18950,
|
||||
松果 = 18951,
|
||||
电气水晶 = 18952,
|
||||
薄荷 = 18953,
|
||||
竹节 = 18954,
|
||||
铁砧 = 18955,
|
||||
冰雾花 = 18956,
|
||||
海草 = 18957,
|
||||
磐石 = 18958,
|
||||
砂砾 = 18959,
|
||||
铁甲贝壳 = 18960,
|
||||
蜥蜴尾巴 = 18961,
|
||||
古老钟摆 = 18962,
|
||||
枯藤 = 18963
|
||||
}
|
||||
|
||||
public enum GiftBoxID : long
|
||||
|
||||
349
OshimaModules/Items/SpecialItem/幸运物.cs
Normal file
349
OshimaModules/Items/SpecialItem/幸运物.cs
Normal file
@ -0,0 +1,349 @@
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Oshima.FunGame.OshimaModules.Items
|
||||
{
|
||||
public class 青松() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.青松;
|
||||
public override string Name => nameof(青松);
|
||||
public override string Description => "青松即使在风雪中也保持着生命的坚韧,象征着永不放弃的精神。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 流星石() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.流星石;
|
||||
public override string Name => nameof(流星石);
|
||||
public override string Description => "据说,捕捉到流星的人,能实现一个愿望。不妨许下心愿,心诚则灵。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 向日葵() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.向日葵;
|
||||
public override string Name => nameof(向日葵);
|
||||
public override string Description => "向日葵永远追随太阳,就像你的好运追随着你的每一步。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 金铃花() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.金铃花;
|
||||
public override string Name => nameof(金铃花);
|
||||
public override string Description => "金铃花象征着辉煌与幸运,提醒你要抓住每一个闪光的时刻。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 琉璃珠() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.琉璃珠;
|
||||
public override string Name => nameof(琉璃珠);
|
||||
public override string Description => "琉璃珠晶莹剔透,代表着纯净与希望,预示着你的好运将如彩虹般绚丽。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 鸣草() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.鸣草;
|
||||
public override string Name => nameof(鸣草);
|
||||
public override string Description => "向往着雷神大人的青睐,只在稻妻列岛上生长。摘下鸣草时酥酥麻麻的触感,据说和幸福的滋味很像。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 马尾() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.马尾;
|
||||
public override string Name => nameof(马尾);
|
||||
public override string Description => "马尾随大片荻草生长,但却更为挺拔。与傲然挺立于此世的你一定很是相配。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 鬼兜虫() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.鬼兜虫;
|
||||
public override string Name => nameof(鬼兜虫);
|
||||
public override string Description => "鬼兜虫是爱好和平、不愿意争斗的小生物。这份追求平和的心一定能为你带来幸福吧。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 烈焰花花蕊() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.烈焰花花蕊;
|
||||
public override string Name => nameof(烈焰花花蕊);
|
||||
public override string Description => "烈焰花的炙热来自于火辣辣的花心。万事顺利是因为心中自有一条明路。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 堇瓜() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.堇瓜;
|
||||
public override string Name => nameof(堇瓜);
|
||||
public override string Description => "人们常说表里如一是美德,但堇瓜明艳的外貌下隐藏着的是谦卑而甘甜的内在。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 水晶球() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.水晶球;
|
||||
public override string Name => nameof(水晶球);
|
||||
public override string Description => "水晶象征着纯净与洞察力,帮助你看清未来的路。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 薰衣草() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.薰衣草;
|
||||
public override string Name => nameof(薰衣草);
|
||||
public override string Description => "薰衣草的香气能安抚心灵,象征着宁静与放松,提醒你要在忙碌中找到内心的平和。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 青石() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.青石;
|
||||
public override string Name => nameof(青石);
|
||||
public override string Description => "青石虽不起眼,却象征着坚韧与持久,寓意着你脚踏实地的每一步都会累积成未来的成功。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 莲花() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.莲花;
|
||||
public override string Name => nameof(莲花);
|
||||
public override string Description => "莲花在泥中绽放,象征着净化与重生,愿你心中平和坚定。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 陶罐() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.陶罐;
|
||||
public override string Name => nameof(陶罐);
|
||||
public override string Description => "陶罐虽不起眼,却有着悠久的历史和稳定的实用性,寓意安稳平和。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 海灵芝() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.海灵芝;
|
||||
public override string Name => nameof(海灵芝);
|
||||
public override string Description => "弱小的海灵芝虫经历多年的风风雨雨,才能结成海灵芝。为目标而努力前行的人们,最终也必将拥有胜利的果实。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 四叶草() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.四叶草;
|
||||
public override string Name => nameof(四叶草);
|
||||
public override string Description => "四叶草的每一片叶子都代表着好运、健康、爱情和财富。带上一片四叶草,收获一整天的幸运吧。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 露珠() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.露珠;
|
||||
public override string Name => nameof(露珠);
|
||||
public override string Description => "露珠是清晨的祝福,虽然短暂,但每一滴都晶莹剔透。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 茉莉花() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.茉莉花;
|
||||
public override string Name => nameof(茉莉花);
|
||||
public override string Description => "茉莉花的香气淡雅而持久,给人宁静与舒适的感觉。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 绿萝() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.绿萝;
|
||||
public override string Name => nameof(绿萝);
|
||||
public override string Description => "绿萝坚韧耐阴,象征着生命的顽强与希望,提醒你在平静中也能找到力量。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 檀木扇() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.檀木扇;
|
||||
public override string Name => nameof(檀木扇);
|
||||
public override string Description => "檀木扇散发着淡雅的香气,象征着沉稳与内敛,让你在宁静中感受力量。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 鸟蛋() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.鸟蛋;
|
||||
public override string Name => nameof(鸟蛋);
|
||||
public override string Description => "鸟蛋孕育着无限的可能性,是未来之种。反过来,这个世界对鸟蛋中的生命而言,也充满了令其兴奋的未知事物吧。要温柔对待鸟蛋喔。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 竹笋() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.竹笋;
|
||||
public override string Name => nameof(竹笋);
|
||||
public override string Description => "竹笋拥有着无限的潜力,没有人知道一颗竹笋,到底能长成多高的竹子。看着竹笋,会让人不由自主期待起未来吧。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 晶核() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.晶核;
|
||||
public override string Name => nameof(晶核);
|
||||
public override string Description => "晶蝶是凝聚天地间的元素,而长成的细小生物。而元素是这个世界许以天地当中的人们的祝福。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 手工围巾() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.手工围巾;
|
||||
public override string Name => nameof(手工围巾);
|
||||
public override string Description => "手工围巾的每一针每一线都饱含着爱意,提醒你要珍惜眼前的人。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 柳条篮() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.柳条篮;
|
||||
public override string Name => nameof(柳条篮);
|
||||
public override string Description => "柳条篮细密结实,寓意着人与人之间的深厚情感,提醒你珍惜生活中的点滴温情。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 风筝() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.风筝;
|
||||
public override string Name => nameof(风筝);
|
||||
public override string Description => "风筝在天空中自由翱翔,提醒你即使在平凡的日子里,也要心怀梦想,勇敢飞翔。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 羽毛() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.羽毛;
|
||||
public override string Name => nameof(羽毛);
|
||||
public override string Description => "羽毛虽轻,但象征着自由与轻盈,提醒你在轻松中前行。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 发光髓() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.发光髓;
|
||||
public override string Name => nameof(发光髓);
|
||||
public override string Description => "发光髓努力地发出微弱的光芒。虽然比不过其他光源,但看清前路也够用了。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 紫罗兰() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.紫罗兰;
|
||||
public override string Name => nameof(紫罗兰);
|
||||
public override string Description => "紫罗兰象征着谦逊和内在的力量,即使在逆境中也能默默绽放。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 松果() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.松果;
|
||||
public override string Name => nameof(松果);
|
||||
public override string Description => "并不是所有的松果都能长成高大的松树,成长需要适宜的环境,更需要一点运气。所以不用给自己过多压力,耐心等待彩虹吧。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 电气水晶() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.电气水晶;
|
||||
public override string Name => nameof(电气水晶);
|
||||
public override string Description => "电气水晶蕴含着无限的能量。如果能够好好导引这股能量,说不定就能成就什么事业。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 薄荷() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.薄荷;
|
||||
public override string Name => nameof(薄荷);
|
||||
public override string Description => "只要有草木生长的空间,就一定有薄荷。这么看来,薄荷是世界上最强韧的生灵。据说连蒙德的雪山上也长着薄荷呢。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 竹节() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.竹节;
|
||||
public override string Name => nameof(竹节);
|
||||
public override string Description => "竹节虽然看似脆弱,但却有着极强的韧性,提醒你在困难面前要保持坚毅的心态。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 铁砧() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.铁砧;
|
||||
public override string Name => nameof(铁砧);
|
||||
public override string Description => "铁砧坚固无比,象征着在困境中保持坚强的信念,提醒你在风雨中不动摇。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 冰雾花() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.冰雾花;
|
||||
public override string Name => nameof(冰雾花);
|
||||
public override string Description => "冰雾花散发着「生人勿进」的寒气。但有时冰冷的气质,也能让人的心情与头脑冷静下来。据此采取正确的判断,明智地行动。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 海草() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.海草;
|
||||
public override string Name => nameof(海草);
|
||||
public override string Description => "海草是相当温柔而坚强的植物,即使在苦涩的海水中,也不愿改变自己。即使在逆境中,也不要放弃温柔的心灵。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 磐石() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.磐石;
|
||||
public override string Name => nameof(磐石);
|
||||
public override string Description => "磐石虽沉重,但象征着稳定与耐心,今天你需要的正是这份定力。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 砂砾() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.砂砾;
|
||||
public override string Name => nameof(砂砾);
|
||||
public override string Description => "砂砾虽微小,却是坚固大地的一部分,提醒你在困难中也要保持坚韧。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 铁甲贝壳() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.铁甲贝壳;
|
||||
public override string Name => nameof(铁甲贝壳);
|
||||
public override string Description => "坚硬的外壳保护着脆弱的内心。有时适当的防护,能让你更加安全。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 蜥蜴尾巴() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.蜥蜴尾巴;
|
||||
public override string Name => nameof(蜥蜴尾巴);
|
||||
public override string Description => "蜥蜴遇到潜在的危险时,大多数会断尾求生。若是遇到无法整理的情绪,那么该断则断吧。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 古老钟摆() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.古老钟摆;
|
||||
public override string Name => nameof(古老钟摆);
|
||||
public override string Description => "尽管钟摆已停,但时间仍在前行。即使眼下步履维艰,也终会走出黑暗。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
|
||||
public class 枯藤() : Item(ItemType.SpecialItem)
|
||||
{
|
||||
public override long Id => (long)SpecialItemID.枯藤;
|
||||
public override string Name => nameof(枯藤);
|
||||
public override string Description => "枯藤虽已失去生机,但春天的复苏指日可待,提醒你在低谷中也要坚守希望。";
|
||||
public override QualityType QualityType => QualityType.White;
|
||||
}
|
||||
}
|
||||
@ -32,6 +32,7 @@ namespace Oshima.FunGame.OshimaModules.Models
|
||||
public static List<Item> CharacterLevelBreakItems { get; } = [];
|
||||
public static List<Item> SkillLevelUpItems { get; } = [];
|
||||
public static Dictionary<OshimaRegion, List<Item>> ExploreItems { get; } = [];
|
||||
public static List<Item> UserDailyItems { get; } = [];
|
||||
public static List<Skill> ItemSkills { get; } = [];
|
||||
public static List<Item> AllItems { get; } = [];
|
||||
public static List<Skill> AllSkills { get; } = [];
|
||||
|
||||
@ -59,6 +59,49 @@ namespace Oshima.FunGame.OshimaModules
|
||||
(long)SpecialItemID.创生之印 => new 创生之印(),
|
||||
(long)SpecialItemID.法则精粹 => new 法则精粹(),
|
||||
(long)SpecialItemID.大师锻造券 => new 大师锻造券(),
|
||||
(long)SpecialItemID.青松 => new 青松(),
|
||||
(long)SpecialItemID.流星石 => new 流星石(),
|
||||
(long)SpecialItemID.向日葵 => new 向日葵(),
|
||||
(long)SpecialItemID.金铃花 => new 金铃花(),
|
||||
(long)SpecialItemID.琉璃珠 => new 琉璃珠(),
|
||||
(long)SpecialItemID.鸣草 => new 鸣草(),
|
||||
(long)SpecialItemID.马尾 => new 马尾(),
|
||||
(long)SpecialItemID.鬼兜虫 => new 鬼兜虫(),
|
||||
(long)SpecialItemID.烈焰花花蕊 => new 烈焰花花蕊(),
|
||||
(long)SpecialItemID.堇瓜 => new 堇瓜(),
|
||||
(long)SpecialItemID.水晶球 => new 水晶球(),
|
||||
(long)SpecialItemID.薰衣草 => new 薰衣草(),
|
||||
(long)SpecialItemID.青石 => new 青石(),
|
||||
(long)SpecialItemID.莲花 => new 莲花(),
|
||||
(long)SpecialItemID.陶罐 => new 陶罐(),
|
||||
(long)SpecialItemID.海灵芝 => new 海灵芝(),
|
||||
(long)SpecialItemID.四叶草 => new 四叶草(),
|
||||
(long)SpecialItemID.露珠 => new 露珠(),
|
||||
(long)SpecialItemID.茉莉花 => new 茉莉花(),
|
||||
(long)SpecialItemID.绿萝 => new 绿萝(),
|
||||
(long)SpecialItemID.檀木扇 => new 檀木扇(),
|
||||
(long)SpecialItemID.鸟蛋 => new 鸟蛋(),
|
||||
(long)SpecialItemID.竹笋 => new 竹笋(),
|
||||
(long)SpecialItemID.晶核 => new 晶核(),
|
||||
(long)SpecialItemID.手工围巾 => new 手工围巾(),
|
||||
(long)SpecialItemID.柳条篮 => new 柳条篮(),
|
||||
(long)SpecialItemID.风筝 => new 风筝(),
|
||||
(long)SpecialItemID.羽毛 => new 羽毛(),
|
||||
(long)SpecialItemID.发光髓 => new 发光髓(),
|
||||
(long)SpecialItemID.紫罗兰 => new 紫罗兰(),
|
||||
(long)SpecialItemID.松果 => new 松果(),
|
||||
(long)SpecialItemID.电气水晶 => new 电气水晶(),
|
||||
(long)SpecialItemID.薄荷 => new 薄荷(),
|
||||
(long)SpecialItemID.竹节 => new 竹节(),
|
||||
(long)SpecialItemID.铁砧 => new 铁砧(),
|
||||
(long)SpecialItemID.冰雾花 => new 冰雾花(),
|
||||
(long)SpecialItemID.海草 => new 海草(),
|
||||
(long)SpecialItemID.磐石 => new 磐石(),
|
||||
(long)SpecialItemID.砂砾 => new 砂砾(),
|
||||
(long)SpecialItemID.铁甲贝壳 => new 铁甲贝壳(),
|
||||
(long)SpecialItemID.蜥蜴尾巴 => new 蜥蜴尾巴(),
|
||||
(long)SpecialItemID.古老钟摆 => new 古老钟摆(),
|
||||
(long)SpecialItemID.枯藤 => new 枯藤(),
|
||||
(long)SpecialItemID.钻石 => new 钻石(),
|
||||
(long)SpecialItemID.探索许可 => new 探索许可(),
|
||||
(long)ConsumableID.小回复药 => new 小回复药(),
|
||||
|
||||
@ -102,6 +102,7 @@
|
||||
{"挑战地区秘境 <难度>", "以小队挑战地区锻造材料秘境,秘境难度1-5"},
|
||||
{"挑战突破秘境 <难度>", "以小队挑战角色突破材料秘境,秘境难度1-5"},
|
||||
{"挑战技能秘境 <难度>", "以小队挑战技能升级材料秘境,秘境难度1-5"},
|
||||
{"挑战魔法卡秘境 <难度>", "以小队挑战魔法卡秘境,秘境难度1-5"},
|
||||
{"锻造配方 <{<物品名称> <数量>...}>", "创建一个锻造配方" },
|
||||
{"锻造信息", "查看已经创建的锻造配方" },
|
||||
{"取消锻造", "取消已经创建的锻造配方" },
|
||||
|
||||
@ -70,8 +70,13 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
new 复苏药1(), new 复苏药2(), new 复苏药3(), new 全回复药(), new 魔法卡礼包(), new 奖券(), new 十连奖券(), new 改名卡(), new 原初之印(), new 创生之印(), new 法则精粹(), new 大师锻造券()
|
||||
]);
|
||||
|
||||
FunGameConstant.UserDailyItems.AddRange([new 青松(), new 流星石(), new 向日葵(), new 金铃花(), new 琉璃珠(), new 鸣草(), new 马尾(), new 鬼兜虫(), new 烈焰花花蕊(), new 堇瓜(), new 水晶球(), new 薰衣草(),
|
||||
new 青石(), new 莲花(), new 陶罐(), new 海灵芝(), new 四叶草(), new 露珠(), new 茉莉花(), new 绿萝(), new 檀木扇(), new 鸟蛋(), new 竹笋(), new 晶核(), new 手工围巾(), new 柳条篮(), new 风筝(), new 羽毛(), new 发光髓(),
|
||||
new 紫罗兰(), new 松果(), new 电气水晶(), new 薄荷(), new 竹节(), new 铁砧(), new 冰雾花(), new 海草(), new 磐石(), new 砂砾(), new 铁甲贝壳(), new 蜥蜴尾巴(), new 古老钟摆(), new 枯藤()]);
|
||||
|
||||
FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment);
|
||||
FunGameConstant.AllItems.AddRange(FunGameConstant.Items);
|
||||
FunGameConstant.AllItems.AddRange(FunGameConstant.UserDailyItems);
|
||||
|
||||
foreach (OshimaRegion region in FunGameConstant.Regions)
|
||||
{
|
||||
@ -79,7 +84,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
FunGameConstant.ExploreItems.Add(region, items);
|
||||
}
|
||||
|
||||
FunGameConstant.DrawCardItems.AddRange(FunGameConstant.AllItems.Where(i => !FunGameConstant.ItemCanNotDrawCard.Contains(i.ItemType)));
|
||||
long[] userDailyItemIds = [.. FunGameConstant.UserDailyItems.Select(i => i.Id)];
|
||||
FunGameConstant.DrawCardItems.AddRange(FunGameConstant.AllItems.Where(i => !FunGameConstant.ItemCanNotDrawCard.Contains(i.ItemType) && !userDailyItemIds.Contains(i.Id)));
|
||||
FunGameConstant.CharacterLevelBreakItems.AddRange([new 升华之印(), new 流光之印(), new 永恒之印(), new 原初之印(), new 创生之印()]);
|
||||
FunGameConstant.SkillLevelUpItems.AddRange([new 技能卷轴(), new 智慧之果(), new 奥术符文(), new 混沌之核(), new 法则精粹()]);
|
||||
|
||||
@ -176,6 +182,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (qualityType != null)
|
||||
{
|
||||
item.QualityType = qualityType.Value;
|
||||
if (item.QualityType > QualityType.Gold) item.QualityType = QualityType.Gold;
|
||||
total = item.QualityType switch
|
||||
{
|
||||
QualityType.Green => Random.Shared.Next(7, 13),
|
||||
@ -299,7 +306,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
item.Skills.Active = magic;
|
||||
|
||||
Skill skill = Factory.OpenFactory.GetInstance<Skill>(item.Id, item.Name, []);
|
||||
Skill skill = Factory.OpenFactory.GetInstance<Skill>(item.Id, "自适应超频模块", []);
|
||||
GenerateAndAddEffectsToMagicCard(skill, str, agi, intelligence);
|
||||
|
||||
skill.Level = 1;
|
||||
@ -3639,11 +3646,11 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
switch (difficulty)
|
||||
{
|
||||
case 5:
|
||||
rW[4] = 30;
|
||||
rW[4] = 40;
|
||||
rW[3] = 30;
|
||||
rW[2] = 15;
|
||||
rW[1] = 15;
|
||||
rW[0] = 10;
|
||||
rW[1] = 10;
|
||||
rW[0] = 5;
|
||||
break;
|
||||
case 4:
|
||||
rW[4] = 10;
|
||||
@ -3698,6 +3705,17 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
}
|
||||
}
|
||||
totalWeight = FunGameConstant.Regions.Sum(r => rW[(int)r.Difficulty]);
|
||||
foreach (OshimaRegion region in FunGameConstant.Regions)
|
||||
{
|
||||
if (rW.TryGetValue((int)region.Difficulty, out double weight))
|
||||
{
|
||||
foreach (Item item in region.Crops)
|
||||
{
|
||||
pRegionItem[item] = weight / totalWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item[] weapons = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 5)];
|
||||
Item[] armors = [.. FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 5)];
|
||||
@ -3723,6 +3741,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
InstanceType.RegionItem => "地区锻造材料",
|
||||
InstanceType.CharacterLevelBreak => "角色等阶突破材料",
|
||||
InstanceType.SkillLevelUp => "技能等级升级材料",
|
||||
InstanceType.MagicCard => "魔法卡",
|
||||
_ => ""
|
||||
} + "秘境";
|
||||
Team team2 = new(team2Name, enemys);
|
||||
@ -3919,6 +3938,43 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
builder.AppendLine($"{string.Join("、", skillLevelUpItems)}!");
|
||||
break;
|
||||
case InstanceType.MagicCard:
|
||||
Dictionary<string, int> magicCards = [];
|
||||
// 根据(敌人数量-1)产出,每多个一个角色多一张
|
||||
for (int i = 0; i < characterCount + enemyCount - 1; i++)
|
||||
{
|
||||
int roll = Random.Shared.Next(100);
|
||||
double cumulativeProbability = 0.0;
|
||||
RarityType rarityType = RarityType.OneStar;
|
||||
foreach (int loop in rW.Keys)
|
||||
{
|
||||
cumulativeProbability += rW[loop];
|
||||
if (roll < cumulativeProbability)
|
||||
{
|
||||
rarityType = (RarityType)loop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 从优秀开始
|
||||
QualityType qualityType = (QualityType)((int)rarityType + 1);
|
||||
if (Random.Shared.NextDouble() < 0.09)
|
||||
{
|
||||
// 9%概率提升一个稀有度(可达到不朽)
|
||||
qualityType++;
|
||||
}
|
||||
Item item = GenerateMagicCard(qualityType);
|
||||
AddItemToUserInventory(user, item, copyLevel: true);
|
||||
if (magicCards.TryGetValue(ItemSet.GetQualityTypeName(item.QualityType), out int count))
|
||||
{
|
||||
magicCards[ItemSet.GetQualityTypeName(item.QualityType)] = count + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
magicCards[ItemSet.GetQualityTypeName(item.QualityType)] = 1;
|
||||
}
|
||||
}
|
||||
builder.AppendLine($"{string.Join("、", magicCards.Select(kv => $"{kv.Value} 张{kv.Key}魔法卡"))}!");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4107,6 +4163,37 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
builder.AppendLine($"{string.Join("、", skillLevelUpItems)}!");
|
||||
break;
|
||||
case InstanceType.MagicCard:
|
||||
Dictionary<string, int> magicCards = [];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int roll = Random.Shared.Next(100);
|
||||
double cumulativeProbability = 0.0;
|
||||
RarityType rarityType = RarityType.OneStar;
|
||||
foreach (int loop in rW.Keys)
|
||||
{
|
||||
cumulativeProbability += rW[loop];
|
||||
if (roll < cumulativeProbability)
|
||||
{
|
||||
rarityType = (RarityType)loop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 从优秀开始
|
||||
QualityType qualityType = (QualityType)((int)rarityType + 1);
|
||||
Item item = GenerateMagicCard(qualityType);
|
||||
AddItemToUserInventory(user, item, copyLevel: true);
|
||||
if (magicCards.TryGetValue(ItemSet.GetQualityTypeName(item.QualityType), out int qCount))
|
||||
{
|
||||
magicCards[ItemSet.GetQualityTypeName(item.QualityType)] = qCount + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
magicCards[ItemSet.GetQualityTypeName(item.QualityType)] = 1;
|
||||
}
|
||||
}
|
||||
builder.AppendLine($"{string.Join("、", magicCards.Select(kv => $"{kv.Value} 张{kv.Key}魔法卡"))}!");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -4346,9 +4433,11 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
public static string GetMarketInfo(Market market, User? user = null, int page = 1, bool simply = false, bool showListed = true)
|
||||
{
|
||||
if (page <= 0) page = 1;
|
||||
IEnumerable<MarketItem> marketItems = market.MarketItems.Values;
|
||||
if (showListed) marketItems = marketItems.Where(g => g.Status == MarketItemState.Listed);
|
||||
int maxPage = market.MarketItems.Values.MaxPage(8);
|
||||
if (page > maxPage) page = maxPage;
|
||||
IEnumerable<MarketItem> marketItems = market.MarketItems.Values.GetPage(page, 8);
|
||||
marketItems = market.MarketItems.Values.GetPage(page, 8);
|
||||
|
||||
StringBuilder builder = new();
|
||||
|
||||
@ -4403,15 +4492,13 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
builder.AppendLine($"市场现在不在交易时间内。");
|
||||
}
|
||||
builder.AppendLine($"☆--- 市场商品列表 ---☆");
|
||||
MarketItem[] MarketItemsValid = [.. market.MarketItems.Values];
|
||||
if (showListed) MarketItemsValid = [.. MarketItemsValid.Where(g => g.Status == MarketItemState.Listed)];
|
||||
if (MarketItemsValid.Length == 0)
|
||||
if (!marketItems.Any())
|
||||
{
|
||||
builder.AppendLine("当前没有商品可供购买,过一段时间再来吧。");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (MarketItem marketItem in MarketItemsValid)
|
||||
foreach (MarketItem marketItem in marketItems)
|
||||
{
|
||||
builder.AppendLine(GetMarketItemInfo(marketItem, simply, user ?? General.UnknownUserInstance));
|
||||
}
|
||||
|
||||
@ -454,7 +454,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.LogInformation("[Reg] 接入ID:{openid}", openid);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information)) Logger.LogInformation("[Reg] 接入ID:{openid}", openid);
|
||||
sqlHelper.ExecuteDataSet(FunGameService.Select_CheckAutoKey(sqlHelper, openid));
|
||||
if (sqlHelper.Success)
|
||||
{
|
||||
@ -513,7 +513,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
sqlHelper.Rollback();
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
}
|
||||
return "无法处理注册,创建存档失败!";
|
||||
}
|
||||
@ -693,7 +693,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1492,7 +1492,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1536,7 +1536,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1580,7 +1580,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1617,7 +1617,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1729,7 +1729,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1786,7 +1786,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1816,7 +1816,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1868,7 +1868,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -1924,7 +1924,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
FunGameService.ReleaseUserSemaphoreSlim(eqq.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return [busy];
|
||||
}
|
||||
}
|
||||
@ -1947,7 +1947,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return [busy];
|
||||
}
|
||||
}
|
||||
@ -2020,7 +2020,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
FunGameService.ReleaseUserSemaphoreSlim(eqq.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return [busy];
|
||||
}
|
||||
}
|
||||
@ -2043,7 +2043,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return [busy];
|
||||
}
|
||||
}
|
||||
@ -2115,7 +2115,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
|
||||
@ -2160,7 +2160,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -2253,7 +2253,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -2312,7 +2312,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
|
||||
@ -2394,7 +2394,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -2490,7 +2490,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
|
||||
@ -2552,7 +2552,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -2623,7 +2623,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -2763,7 +2763,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3073,7 +3073,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3148,7 +3148,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3216,7 +3216,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3298,7 +3298,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3341,7 +3341,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3390,7 +3390,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3468,7 +3468,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3515,7 +3515,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3714,7 +3714,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -3887,7 +3887,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -4028,7 +4028,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -4077,7 +4077,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -4124,7 +4124,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -4156,7 +4156,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -4183,7 +4183,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -5621,7 +5621,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -6064,7 +6064,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return (busy, exploreId);
|
||||
}
|
||||
}
|
||||
@ -6389,7 +6389,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
|
||||
@ -6442,7 +6442,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6536,7 +6536,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6585,7 +6585,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6628,7 +6628,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6661,7 +6661,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6702,7 +6702,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6825,7 +6825,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6867,7 +6867,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6900,7 +6900,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -6990,7 +6990,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(uid.ToString() ?? "");
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7052,7 +7052,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7149,7 +7149,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7303,7 +7303,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(target);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7415,7 +7415,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseMarketSemaphoreSlim();
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7453,7 +7453,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseMarketSemaphoreSlim();
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7479,9 +7479,9 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
if (marketItems.Length > 0)
|
||||
{
|
||||
if (page <= 0) page = 1;
|
||||
int maxPage = market.MarketItems.Values.MaxPage(8);
|
||||
int maxPage = marketItems.MaxPage(8);
|
||||
if (page > maxPage) page = maxPage;
|
||||
marketItems = [.. market.MarketItems.Values.GetPage(page, 8)];
|
||||
marketItems = [.. marketItems.GetPage(page, 8)];
|
||||
foreach (MarketItem marketItem in marketItems)
|
||||
{
|
||||
msg += FunGameService.GetMarketItemInfo(marketItem, true, user) + "\r\n";
|
||||
@ -7505,7 +7505,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseMarketSemaphoreSlim();
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7551,7 +7551,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseMarketSemaphoreSlim();
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7598,7 +7598,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid2);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -7621,7 +7621,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseMarketSemaphoreSlim();
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7675,7 +7675,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
FunGameService.ReleaseMarketSemaphoreSlim();
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7696,7 +7696,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
User user = FunGameService.GetUser(pc);
|
||||
int exploreTimes = 0;
|
||||
|
||||
int[] supportedInstanceType = [(int)InstanceType.Currency, (int)InstanceType.Material, (int)InstanceType.EXP, (int)InstanceType.RegionItem, (int)InstanceType.CharacterLevelBreak, (int)InstanceType.SkillLevelUp];
|
||||
int[] supportedInstanceType = [(int)InstanceType.Currency, (int)InstanceType.Material, (int)InstanceType.EXP, (int)InstanceType.RegionItem, (int)InstanceType.CharacterLevelBreak, (int)InstanceType.SkillLevelUp, (int)InstanceType.MagicCard];
|
||||
if (!supportedInstanceType.Contains(type))
|
||||
{
|
||||
msg = $"秘境类型无效。";
|
||||
@ -7767,7 +7767,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
catch (Exception e)
|
||||
{
|
||||
FunGameService.ReleaseUserSemaphoreSlim(userid);
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
}
|
||||
@ -7958,7 +7958,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8025,7 +8025,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8081,7 +8081,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8130,7 +8130,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8178,7 +8178,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8268,7 +8268,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8327,7 +8327,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8392,7 +8392,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8436,7 +8436,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8473,7 +8473,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8510,7 +8510,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8547,7 +8547,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8588,7 +8588,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8626,7 +8626,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return (room, [busy]);
|
||||
}
|
||||
finally
|
||||
@ -8763,7 +8763,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8864,7 +8864,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8945,7 +8945,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
@ -8980,7 +8980,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "Error: {e}", e);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError(e, "Error: {e}", e);
|
||||
return busy;
|
||||
}
|
||||
finally
|
||||
|
||||
@ -29,7 +29,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
return BadRequest("Payload 格式无效");
|
||||
}
|
||||
|
||||
Logger.LogDebug("收到 Webhook 请求:{payload.Op}", payload.Op);
|
||||
if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("收到 Webhook 请求:{payload.Op}", payload.Op);
|
||||
|
||||
try
|
||||
{
|
||||
@ -44,13 +44,13 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("未处理操作码:{payload.Op}", payload.Op);
|
||||
if (Logger.IsEnabled(LogLevel.Warning)) Logger.LogWarning("未处理操作码:{payload.Op}", payload.Op);
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError("Error: {e}", e);
|
||||
if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("Error: {e}", e);
|
||||
return StatusCode(500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
@ -60,7 +60,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
ValidationRequest? validationPayload = JsonSerializer.Deserialize<ValidationRequest>(payload.Data.ToString() ?? "");
|
||||
if (validationPayload is null)
|
||||
{
|
||||
Logger.LogError("反序列化验证 Payload 失败");
|
||||
if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("反序列化验证 Payload 失败");
|
||||
return BadRequest("无效的验证 Payload 格式");
|
||||
}
|
||||
string seed = BotConfig.Secret;
|
||||
@ -91,16 +91,21 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
Signature = signature
|
||||
};
|
||||
string responseJson = JsonSerializer.Serialize(response);
|
||||
Logger.LogDebug("验证相应:{responseJson}", responseJson);
|
||||
if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("验证相应:{responseJson}", responseJson);
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
private IActionResult HandleEventAsync(Payload payload)
|
||||
{
|
||||
Logger.LogDebug("处理事件:{EventType}, 数据:{Data}", payload.EventType, payload.Data);
|
||||
if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("处理事件:{EventType}, 数据:{Data}", payload.EventType, payload.Data);
|
||||
|
||||
try
|
||||
{
|
||||
OtherData data = new()
|
||||
{
|
||||
RequestUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}"
|
||||
};
|
||||
|
||||
switch (payload.EventType)
|
||||
{
|
||||
case "C2C_MESSAGE_CREATE":
|
||||
@ -113,11 +118,11 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
c2cMessage.Detail = c2cMessage.Detail[1..];
|
||||
}
|
||||
// TODO
|
||||
Logger.LogInformation("收到来自用户 {c2cMessage.Author.UserOpenId} 的消息:{c2cMessage.Content}", c2cMessage.Author.UserOpenId, c2cMessage.Content);
|
||||
if (Logger.IsEnabled(LogLevel.Information)) Logger.LogInformation("收到来自用户 {c2cMessage.Author.UserOpenId} 的消息:{c2cMessage.Content}", c2cMessage.Author.UserOpenId, c2cMessage.Content);
|
||||
//// 上传图片
|
||||
//string url = $"{Request.Scheme}://{Request.Host}{Request.PathBase}/images/zi/dj1.png";
|
||||
//var (fileUuid, fileInfo, ttl, error) = await _service.UploadC2CMediaAsync(c2cMessage.Author.UserOpenId, 1, url);
|
||||
//_logger.LogDebug("发送的图片地址:{url}", url);
|
||||
//_if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("发送的图片地址:{url}", url);
|
||||
//if (string.IsNullOrEmpty(error))
|
||||
//{
|
||||
// // 回复消息
|
||||
@ -127,13 +132,13 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// _logger.LogError("上传图片失败:{error}", error);
|
||||
// _if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("上传图片失败:{error}", error);
|
||||
//}
|
||||
TaskUtility.NewTask(async () => await FungameService.Handler(c2cMessage));
|
||||
TaskUtility.NewTask(async () => await FungameService.Handler(c2cMessage, data));
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError("反序列化 C2C 消息数据失败");
|
||||
if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("反序列化 C2C 消息数据失败");
|
||||
return BadRequest("无效的 C2C 消息数据格式");
|
||||
}
|
||||
break;
|
||||
@ -147,31 +152,31 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
groupAtMessage.Detail = groupAtMessage.Detail[1..];
|
||||
}
|
||||
// TODO
|
||||
Logger.LogInformation("收到来自群组 {groupAtMessage.GroupOpenId} 的消息:{groupAtMessage.Content}", groupAtMessage.GroupOpenId, groupAtMessage.Content);
|
||||
if (Logger.IsEnabled(LogLevel.Information)) Logger.LogInformation("收到来自群组 {groupAtMessage.GroupOpenId} 的消息:{groupAtMessage.Content}", groupAtMessage.GroupOpenId, groupAtMessage.Content);
|
||||
// 回复消息
|
||||
//await _service.SendGroupMessageAsync(groupAtMessage.GroupOpenId, $"你发送的消息是:{groupAtMessage.Content}", msgId: groupAtMessage.Id);
|
||||
TaskUtility.NewTask(async () => await FungameService.Handler(groupAtMessage));
|
||||
TaskUtility.NewTask(async () => await FungameService.Handler(groupAtMessage, data));
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError("反序列化群聊消息数据失败");
|
||||
if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("反序列化群聊消息数据失败");
|
||||
return BadRequest("无效的群聊消息数据格式");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Logger.LogWarning("未定义事件:{EventType}", payload.EventType);
|
||||
if (Logger.IsEnabled(LogLevel.Warning)) Logger.LogWarning("未定义事件:{EventType}", payload.EventType);
|
||||
break;
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
catch (JsonException e)
|
||||
{
|
||||
Logger.LogError("反序列化过程遇到错误:{e}", e);
|
||||
if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("反序列化过程遇到错误:{e}", e);
|
||||
return BadRequest("Invalid JSON format");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError("Error: {e}", e);
|
||||
if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("Error: {e}", e);
|
||||
return StatusCode(500, "服务器内部错误");
|
||||
}
|
||||
}
|
||||
@ -182,7 +187,12 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
if (msg is null) return Ok("");
|
||||
|
||||
bool result = await FungameService.Handler(msg);
|
||||
OtherData data = new()
|
||||
{
|
||||
RequestUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}"
|
||||
};
|
||||
|
||||
bool result = await FungameService.Handler(msg, data);
|
||||
|
||||
if (!result || msg.IsCompleted)
|
||||
{
|
||||
@ -208,7 +218,12 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
};
|
||||
|
||||
bool result = await FungameService.Handler(message);
|
||||
OtherData data = new()
|
||||
{
|
||||
RequestUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}"
|
||||
};
|
||||
|
||||
bool result = await FungameService.Handler(message, data);
|
||||
|
||||
if (!result || message.IsCompleted)
|
||||
{
|
||||
|
||||
@ -25,13 +25,17 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("open/{open_id}", Name = "GetOpenUserDaily")]
|
||||
public UserDaily Open(string open_id)
|
||||
public OpenUserDaily Open(string open_id)
|
||||
{
|
||||
if (QQOpenID.QQAndOpenID.TryGetValue(open_id, out long qq) && qq != 0)
|
||||
{
|
||||
return UserDailyService.GetUserDaily(qq);
|
||||
UserDaily daily = UserDailyService.GetUserDaily(qq);
|
||||
return new(open_id, daily.type, daily.daily);
|
||||
}
|
||||
else
|
||||
{
|
||||
return UserDailyService.GetOpenUserDaily(open_id);
|
||||
}
|
||||
return new(0, 0, "你似乎没有绑定QQ呢,请先发送【绑定+QQ号】(如:绑定123456789)再使用哦!");
|
||||
}
|
||||
|
||||
[HttpPost("remove/{user_id}", Name = "RemoveUserDaily")]
|
||||
|
||||
@ -84,6 +84,7 @@ namespace Oshima.FunGame.WebAPI.Models
|
||||
public string AuthorOpenId { get; }
|
||||
public long FunGameUID { get; set; }
|
||||
public bool UseNotice { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
}
|
||||
|
||||
public class ThirdPartyMessage : IBotMessage
|
||||
@ -120,6 +121,9 @@ namespace Oshima.FunGame.WebAPI.Models
|
||||
|
||||
[JsonIgnore]
|
||||
public bool UseNotice { get; set; } = true;
|
||||
|
||||
[JsonIgnore]
|
||||
public string ImageUrl { get; set; } = "";
|
||||
}
|
||||
|
||||
public class C2CMessage : IBotMessage
|
||||
@ -145,6 +149,9 @@ namespace Oshima.FunGame.WebAPI.Models
|
||||
[JsonIgnore]
|
||||
public bool UseNotice { get; set; } = true;
|
||||
|
||||
[JsonIgnore]
|
||||
public string ImageUrl { get; set; } = "";
|
||||
|
||||
public string Detail
|
||||
{
|
||||
get => Content;
|
||||
@ -181,6 +188,9 @@ namespace Oshima.FunGame.WebAPI.Models
|
||||
[JsonIgnore]
|
||||
public bool UseNotice { get; set; } = true;
|
||||
|
||||
[JsonIgnore]
|
||||
public string ImageUrl { get; set; } = "";
|
||||
|
||||
public string Detail
|
||||
{
|
||||
get => Content;
|
||||
@ -211,4 +221,9 @@ namespace Oshima.FunGame.WebAPI.Models
|
||||
[JsonPropertyName("expires_in")]
|
||||
public string ExpiresIn { get; set; } = "";
|
||||
}
|
||||
|
||||
public class OtherData
|
||||
{
|
||||
public string RequestUrl { get; set; } = "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
namespace Oshima.FunGame.WebAPI.Models
|
||||
{
|
||||
public class UserDaily(long user_id, long type, string daily)
|
||||
public class UserDaily(long user_id, long type, string daily) : BaseUserDaily(type, daily)
|
||||
{
|
||||
public long user_id { get; set; } = user_id;
|
||||
}
|
||||
|
||||
public class OpenUserDaily(string user_id, long type, string daily) : BaseUserDaily(type, daily)
|
||||
{
|
||||
public string user_id { get; set; } = user_id;
|
||||
}
|
||||
|
||||
public class BaseUserDaily(long type, string daily)
|
||||
{
|
||||
public long type { get; set; } = type;
|
||||
public string daily { get; set; } = daily;
|
||||
}
|
||||
|
||||
@ -57,8 +57,9 @@ namespace Oshima.FunGame.WebAPI
|
||||
Id = "1",
|
||||
Timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
};
|
||||
OtherData data = new();
|
||||
|
||||
bool result = bot.HandlerByConsole(message).GetAwaiter().GetResult();
|
||||
bool result = bot.HandlerByConsole(message, data).GetAwaiter().GetResult();
|
||||
|
||||
if (!result || message.IsCompleted)
|
||||
{
|
||||
|
||||
@ -11,12 +11,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<NoWarn>1701;1702;IDE0130;CA1822;IDE1006</NoWarn>
|
||||
<NoWarn>1701;1702;IDE0130;CA1822;IDE1006;CA1873</NoWarn>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<NoWarn>1701;1702;IDE0130;CA1822;IDE1006</NoWarn>
|
||||
<NoWarn>1701;1702;IDE0130;CA1822;IDE1006;CA1873</NoWarn>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
string accessToken = await GetAccessTokenAsync();
|
||||
HttpRequestMessage request = new(HttpMethod.Post, $"https://api.sgroup.qq.com{url}");
|
||||
request.Headers.Authorization = new AuthenticationHeaderValue("QQBot", accessToken);
|
||||
Logger.LogDebug("使用的 Access Token:{accessToken}", accessToken);
|
||||
if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("使用的 Access Token:{accessToken}", accessToken);
|
||||
Dictionary<string, object> requestBody = new()
|
||||
{
|
||||
{ "content", content },
|
||||
@ -55,7 +55,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
string errorBody = await response.Content.ReadAsStringAsync();
|
||||
Logger.LogError("状态码:{response.StatusCode},错误信息:{errorBody}", response.StatusCode, errorBody);
|
||||
if (Logger.IsEnabled(LogLevel.Error)) Logger.LogError("状态码:{response.StatusCode},错误信息:{errorBody}", response.StatusCode, errorBody);
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
string accessToken = await GetAccessTokenAsync();
|
||||
HttpRequestMessage request = new(HttpMethod.Post, $"https://api.sgroup.qq.com{url}");
|
||||
request.Headers.Authorization = new AuthenticationHeaderValue("QQBot", accessToken);
|
||||
Logger.LogDebug("使用的 Access Token:{accessToken}", accessToken);
|
||||
if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("使用的 Access Token:{accessToken}", accessToken);
|
||||
Dictionary<string, object> requestBody = new()
|
||||
{
|
||||
{ "file_type", fileType },
|
||||
@ -87,7 +87,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
string errorBody = await response.Content.ReadAsStringAsync();
|
||||
return (null, null, 0, $"状态码:{response.StatusCode},错误信息:{errorBody}");
|
||||
return (null, null, 0, $"状态码:{response.StatusCode},错误信息:{errorBody},多媒体URL地址:{fileUrl}");
|
||||
}
|
||||
string responseBody = await response.Content.ReadAsStringAsync();
|
||||
MediaResponse? mediaResponse = JsonSerializer.Deserialize<MediaResponse>(responseBody);
|
||||
@ -95,7 +95,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
{
|
||||
return (null, null, 0, "反序列化富媒体消息失败。");
|
||||
}
|
||||
Logger.LogDebug("接收到的富媒体消息:{mediaResponse.FileInfo},有效时间:{mediaResponse.Ttl}", mediaResponse.FileInfo, mediaResponse.Ttl);
|
||||
if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("接收到的富媒体消息:{mediaResponse.FileInfo},有效时间:{mediaResponse.Ttl}", mediaResponse.FileInfo, mediaResponse.Ttl);
|
||||
return (mediaResponse.FileUuid, mediaResponse.FileInfo, mediaResponse.Ttl, null);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
throw new Exception("获取 Access Token 失败!");
|
||||
}
|
||||
MemoryCache.Set(AccessTokenCacheKey, tokenResponse.AccessToken, TimeSpan.FromSeconds(expiresIn - 60));
|
||||
Logger.LogDebug("获取到 Access Token:{tokenResponse.AccessToken}", tokenResponse.AccessToken);
|
||||
if (Logger.IsEnabled(LogLevel.Debug)) Logger.LogDebug("获取到 Access Token:{tokenResponse.AccessToken}", tokenResponse.AccessToken);
|
||||
return tokenResponse.AccessToken;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
if (msg.UseNotice && msg.FunGameUID > 0 && FunGameService.UserNotice.TryGetValue(msg.FunGameUID, out HashSet<string>? msgs) && msgs != null)
|
||||
{
|
||||
FunGameService.UserNotice.Remove(msg.FunGameUID);
|
||||
await SendAsync(msg, "离线未读信箱", $"☆--- 离线未读信箱 ---☆\r\n{string.Join("\r\n", msgs)}", msgType, media, 5);
|
||||
await SendAsync(msg, "离线未读信箱", $"☆--- 离线未读信箱 ---☆\r\n{string.Join("\r\n", msgs)}", msgType, null, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
await SendAsync(e, "筽祀牻", result.ToString());
|
||||
}
|
||||
|
||||
public async Task<bool> Handler(IBotMessage e)
|
||||
public async Task<bool> Handler(IBotMessage e, OtherData data)
|
||||
{
|
||||
bool result = true;
|
||||
try
|
||||
@ -153,6 +153,51 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
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",
|
||||
_ => ""
|
||||
};
|
||||
|
||||
var (fileUuid, fileInfo, ttl, error) = e.IsGroup && e is GroupAtMessage ge ? await Service.UploadGroupMediaAsync(ge.GroupOpenId, 1, img) : await Service.UploadC2CMediaAsync(e.OpenId, 1, img);
|
||||
if (string.IsNullOrEmpty(error))
|
||||
{
|
||||
await SendAsync(e, "每日运势", daily.daily, 7, new { file_info = fileInfo });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError("上传图片失败:{error}", error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await SendAsync(e, "每日运势", daily.daily);
|
||||
}
|
||||
}
|
||||
|
||||
if (e.Detail == "公告")
|
||||
{
|
||||
e.UseNotice = false;
|
||||
@ -2814,6 +2859,21 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (e.Detail.StartsWith("挑战魔法卡秘境"))
|
||||
{
|
||||
string detail = e.Detail.Replace("挑战魔法卡秘境", "").Trim();
|
||||
string msg = "";
|
||||
if (int.TryParse(detail, out int diff))
|
||||
{
|
||||
msg = await Controller.FightInstance(uid, (int)InstanceType.MagicCard, diff);
|
||||
if (msg.Trim() != "")
|
||||
{
|
||||
await SendAsync(e, "挑战魔法卡秘境", msg);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (e.Detail == "后勤部")
|
||||
{
|
||||
@ -3642,19 +3702,19 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error: {ex}", ex);
|
||||
if (Logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Error)) Logger.LogError("Error: {ex}", ex);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public async Task<bool> HandlerByConsole(IBotMessage e)
|
||||
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);
|
||||
return await Handler(e, data);
|
||||
}
|
||||
|
||||
public List<string> MergeMessages(List<string> msgs)
|
||||
|
||||
@ -16,34 +16,63 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Daily.GreatFortune.Count == 0 && Daily.ModerateFortune.Count == 0 && Daily.GoodFortune.Count == 0 &&
|
||||
Daily.MinorFortune.Count == 0 && Daily.Misfortune.Count == 0 && Daily.GreatMisfortune.Count == 0)
|
||||
BaseUserDaily daily = GetUserDaily();
|
||||
if (daily.daily != "")
|
||||
{
|
||||
return new UserDaily(0, 0, "今日运势列表为空,请联系管理员设定。");
|
||||
}
|
||||
|
||||
// 抽个运势
|
||||
DailyType type = Daily.DailyTypes[Random.Shared.Next(Daily.DailyTypes.Count)];
|
||||
string text = type switch
|
||||
{
|
||||
DailyType.GreatFortune => Daily.GreatFortune[Random.Shared.Next(Daily.GreatFortune.Count)],
|
||||
DailyType.ModerateFortune => Daily.ModerateFortune[Random.Shared.Next(Daily.ModerateFortune.Count)],
|
||||
DailyType.GoodFortune => Daily.GoodFortune[Random.Shared.Next(Daily.GoodFortune.Count)],
|
||||
DailyType.MinorFortune => Daily.MinorFortune[Random.Shared.Next(Daily.MinorFortune.Count)],
|
||||
DailyType.Misfortune => Daily.Misfortune[Random.Shared.Next(Daily.Misfortune.Count)],
|
||||
DailyType.GreatMisfortune => Daily.GreatMisfortune[Random.Shared.Next(Daily.GreatMisfortune.Count)],
|
||||
_ => "",
|
||||
};
|
||||
if (text != "")
|
||||
{
|
||||
Daily.UserDailys.Add(user_id, text);
|
||||
string daily = "你的今日运势是:\r\n" + text;
|
||||
Daily.UserDailys.Add(user_id, daily.daily);
|
||||
Daily.SaveDaily();
|
||||
return new UserDaily(user_id, (int)type, daily);
|
||||
return new UserDaily(user_id, (int)daily.type, "你的今日运势是:\r\n" + daily.daily);
|
||||
}
|
||||
return new UserDaily(0, 0, "今日运势列表为空,请联系管理员设定。");
|
||||
}
|
||||
}
|
||||
|
||||
public static OpenUserDaily GetOpenUserDaily(string user_id)
|
||||
{
|
||||
if (Daily.OpenUserDailys.TryGetValue(user_id, out string? value) && value != null && value.Trim() != "")
|
||||
{
|
||||
string daily = "你已看过你的今日运势:\r\n" + value;
|
||||
return new OpenUserDaily(user_id, 0, daily);
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseUserDaily daily = GetUserDaily();
|
||||
if (daily.daily != "")
|
||||
{
|
||||
Daily.OpenUserDailys.Add(user_id, daily.daily);
|
||||
Daily.SaveOpenDaily();
|
||||
return new OpenUserDaily(user_id, (int)daily.type, "你的今日运势是:\r\n" + daily.daily);
|
||||
}
|
||||
return new OpenUserDaily(user_id, 0, "今日运势列表为空,请联系管理员设定。");
|
||||
}
|
||||
}
|
||||
|
||||
private static BaseUserDaily GetUserDaily()
|
||||
{
|
||||
if (Daily.GreatFortune.Count == 0 && Daily.ModerateFortune.Count == 0 && Daily.GoodFortune.Count == 0 &&
|
||||
Daily.MinorFortune.Count == 0 && Daily.Misfortune.Count == 0 && Daily.GreatMisfortune.Count == 0)
|
||||
{
|
||||
return new BaseUserDaily(0, "今日运势列表为空,请联系管理员设定。");
|
||||
}
|
||||
|
||||
// 抽个运势
|
||||
DailyType type = Daily.DailyTypes[Random.Shared.Next(Daily.DailyTypes.Count)];
|
||||
string text = type switch
|
||||
{
|
||||
DailyType.GreatFortune => Daily.GreatFortune[Random.Shared.Next(Daily.GreatFortune.Count)],
|
||||
DailyType.ModerateFortune => Daily.ModerateFortune[Random.Shared.Next(Daily.ModerateFortune.Count)],
|
||||
DailyType.GoodFortune => Daily.GoodFortune[Random.Shared.Next(Daily.GoodFortune.Count)],
|
||||
DailyType.MinorFortune => Daily.MinorFortune[Random.Shared.Next(Daily.MinorFortune.Count)],
|
||||
DailyType.Misfortune => Daily.Misfortune[Random.Shared.Next(Daily.Misfortune.Count)],
|
||||
DailyType.GreatMisfortune => Daily.GreatMisfortune[Random.Shared.Next(Daily.GreatMisfortune.Count)],
|
||||
_ => "",
|
||||
};
|
||||
if (text != "")
|
||||
{
|
||||
return new BaseUserDaily((int)type, text);
|
||||
}
|
||||
return new BaseUserDaily(0, "今日运势列表为空,请联系管理员设定。");
|
||||
}
|
||||
|
||||
public static UserDaily ViewUserDaily(long user_id)
|
||||
{
|
||||
@ -57,11 +86,30 @@ namespace Oshima.FunGame.WebAPI.Services
|
||||
}
|
||||
}
|
||||
|
||||
public static OpenUserDaily ViewOpenUserDaily(string user_id)
|
||||
{
|
||||
if (Daily.OpenUserDailys.TryGetValue(user_id, out string? value) && value != null && value.Trim() != "")
|
||||
{
|
||||
return new OpenUserDaily(user_id, 0, "TA今天的运势是:\r\n" + value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new OpenUserDaily(user_id, 0, "TA还没有抽取今日运势哦,快去提醒TA发送【我的运势】抽取运势吧!");
|
||||
}
|
||||
}
|
||||
|
||||
public static string RemoveDaily(long user_id)
|
||||
{
|
||||
Daily.UserDailys.Remove(user_id);
|
||||
Daily.SaveDaily();
|
||||
return NetworkUtility.JsonSerialize("你的今日运势已重置。");
|
||||
}
|
||||
|
||||
public static string RemoveOpenDaily(string user_id)
|
||||
{
|
||||
Daily.OpenUserDailys.Remove(user_id);
|
||||
Daily.SaveOpenDaily();
|
||||
return NetworkUtility.JsonSerialize("你的今日运势已重置。");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user