各种修改

This commit is contained in:
milimoe 2025-01-22 01:24:56 +08:00
parent 739842b55b
commit 0b5bc3b713
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
11 changed files with 1203 additions and 1021 deletions

View File

@ -7,7 +7,6 @@
"ItemType": 1,
"WeaponType": 1,
"QualityType": 0,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -33,7 +32,6 @@
"ItemType": 1,
"WeaponType": 2,
"QualityType": 0,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -59,7 +57,6 @@
"ItemType": 1,
"WeaponType": 3,
"QualityType": 0,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -85,7 +82,6 @@
"ItemType": 1,
"WeaponType": 5,
"QualityType": 0,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -111,7 +107,6 @@
"ItemType": 1,
"WeaponType": 11,
"QualityType": 0,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -137,7 +132,6 @@
"ItemType": 1,
"WeaponType": 1,
"QualityType": 1,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -163,7 +157,6 @@
"ItemType": 1,
"WeaponType": 2,
"QualityType": 1,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -189,7 +182,6 @@
"ItemType": 1,
"WeaponType": 3,
"QualityType": 1,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -215,7 +207,6 @@
"ItemType": 1,
"WeaponType": 4,
"QualityType": 1,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [
@ -241,7 +232,6 @@
"ItemType": 1,
"WeaponType": 8,
"QualityType": 1,
"Price": 0,
"Skills": {
"Active": null,
"Passives": [

View File

@ -126,7 +126,7 @@ namespace Oshima.FunGame.OshimaServers
{
User user = FunGameService.GetUser(pc);
// 将用户存入缓存
FunGameService.UserIdAndUsername[user.Id] = user;
FunGameConstant.UserIdAndUsername[user.Id] = user;
// 任务结算
EntityModuleConfig<Quest> quests = new("quests", user.Id.ToString());
quests.LoadConfig();

View File

@ -1,12 +1,14 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Interface;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Common.Event;
using Oshima.Core;
using Oshima.Core.Constant;
using Oshima.FunGame.OshimaServers.Service;
namespace Oshima.FunGame.OshimaServers
{
public class OshimaServer : ServerPlugin
public class OshimaServer : ServerPlugin, IOpenStoreEvent
{
public override string Name => OshimaGameModuleConstant.Server;
@ -32,7 +34,28 @@ namespace Oshima.FunGame.OshimaServers
public override void AfterLoad(ServerPluginLoader loader, params object[] objs)
{
FunGameService.ServerPluginLoader ??= loader;
OSMCore.InitOSMCore();
}
public void BeforeOpenStoreEvent(object sender, GeneralEventArgs e)
{
if (e.EventMsg != "") Controller.WriteLine(e.EventMsg, Milimoe.FunGame.Core.Library.Constant.LogLevel.Debug);
}
public void AfterOpenStoreEvent(object sender, GeneralEventArgs e)
{
}
public void SucceedOpenStoreEvent(object sender, GeneralEventArgs e)
{
if (e.EventMsg != "") Controller.WriteLine(e.EventMsg, Milimoe.FunGame.Core.Library.Constant.LogLevel.Debug);
}
public void FailedOpenStoreEvent(object sender, GeneralEventArgs e)
{
}
}
}

View File

@ -98,7 +98,7 @@ namespace Oshima.FunGame.OshimaServers.Service
foreach (Skill skill in skillRewards)
{
Dictionary<string, object> effectArgs = [];
if (FunGameService.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary<string, object>? dict) && dict != null)
if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary<string, object>? dict) && dict != null)
{
effectArgs = new(dict);
}
@ -341,7 +341,7 @@ namespace Oshima.FunGame.OshimaServers.Service
foreach (Skill skill in skillRewards)
{
Dictionary<string, object> effectArgs = [];
if (FunGameService.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary<string, object>? dict) && dict != null)
if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary<string, object>? dict) && dict != null)
{
effectArgs = new(dict);
}

View File

@ -0,0 +1,511 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
using Oshima.FunGame.OshimaModules.Items;
namespace Oshima.FunGame.OshimaServers.Service
{
public class FunGameConstant
{
public const long CustomCharacterId = -1;
public static List<Character> Characters { get; } = [];
public static List<Skill> Skills { get; } = [];
public static List<Skill> PassiveSkills { get; } = [];
public static List<Skill> SuperSkills { get; } = [];
public static List<Skill> Magics { get; } = [];
public static List<Item> Equipment { get; } = [];
public static List<Item> Items { get; } = [];
public static List<Skill> ItemSkills { get; } = [];
public static List<Item> AllItems { get; } = [];
public static List<Skill> AllSkills { get; } = [];
public static Dictionary<long, User> UserIdAndUsername { get; } = [];
public static ItemType[] ItemCanUsed => [ItemType.Consumable, ItemType.MagicCard, ItemType.SpecialItem, ItemType.GiftBox, ItemType.Others];
public static Dictionary<int, Dictionary<string, int>> LevelBreakNeedyList
{
get
{
return new()
{
{
0, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 20 },
{ nameof(), 2 }
}
},
{
1, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 40 },
{ nameof(), 4 }
}
},
{
2, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 80 },
{ nameof(), 6 },
{ nameof(), 2 }
}
},
{
3, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 160 },
{ nameof(), 9 },
{ nameof(), 4 }
}
},
{
4, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 320 },
{ nameof(), 12 },
{ nameof(), 6 },
{ nameof(), 2 }
}
},
{
5, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 640 },
{ nameof(), 16 },
{ nameof(), 9 },
{ nameof(), 4 }
}
},
};
}
}
public static Dictionary<int, Dictionary<string, int>> SkillLevelUpList
{
get
{
return new()
{
{
1, new()
{
{ "角色等级", 1 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
2, new()
{
{ "角色等级", 12 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
3, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 4 },
{ nameof(), 1 },
}
},
{
4, new()
{
{ "角色等级", 36 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 6 },
{ nameof(), 2 },
}
},
{
5, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 9 },
{ nameof(), 4 },
{ nameof(), 1 }
}
},
{
6, new()
{
{ "角色等级", 60 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 6 },
{ nameof(), 2 }
}
}
};
}
}
public static Dictionary<int, Dictionary<string, int>> NormalAttackLevelUpList
{
get
{
return new()
{
{
2, new()
{
{ "角色等级", 8 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
3, new()
{
{ "角色等级", 16 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
4, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 4 },
{ nameof(), 1 },
}
},
{
5, new()
{
{ "角色等级", 32 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 6 },
{ nameof(), 2 },
}
},
{
6, new()
{
{ "角色等级", 40 },
{ "角色突破进度", 4 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 9 },
{ nameof(), 4 },
{ nameof(), 1 }
}
},
{
7, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 12 },
{ nameof(), 6 },
{ nameof(), 2 }
}
},
{
8, new()
{
{ "角色等级", 56 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 70000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 280 },
{ nameof(), 16 },
{ nameof(), 9 },
{ nameof(), 4 },
{ nameof(), 1 }
}
}
};
}
}
public static Dictionary<EffectID, Dictionary<string, object>> RoundRewards
{
get
{
return new()
{
{
EffectID.ExATK,
new()
{
{ "exatk", Random.Shared.Next(40, 80) }
}
},
{
EffectID.ExCritRate,
new()
{
{ "excr", Math.Clamp(Random.Shared.NextDouble(), 0.25, 0.5) }
}
},
{
EffectID.ExCritDMG,
new()
{
{ "excrd", Math.Clamp(Random.Shared.NextDouble(), 0.5, 1) }
}
},
{
EffectID.ExATK2,
new()
{
{ "exatk", Math.Clamp(Random.Shared.NextDouble(), 0.15, 0.3) }
}
},
{
EffectID.RecoverHP,
new()
{
{ "hp", Random.Shared.Next(160, 640) }
}
},
{
EffectID.RecoverMP,
new()
{
{ "mp", Random.Shared.Next(140, 490) }
}
},
{
EffectID.RecoverHP2,
new()
{
{ "hp", Math.Clamp(Random.Shared.NextDouble(), 0.04, 0.08) }
}
},
{
EffectID.RecoverMP2,
new()
{
{ "mp", Math.Clamp(Random.Shared.NextDouble(), 0.09, 0.18) }
}
},
{
EffectID.GetEP,
new()
{
{ "ep", Random.Shared.Next(20, 40) }
}
}
};
}
}
public static Dictionary<string, string> QuestList
{
get
{
return new()
{
{
"丢失的共享单车之谜",
"寻找被魔法传送走的共享单车。"
},
{
"咖啡店的神秘顾客",
"调查每天都点奇怪饮品的神秘顾客。"
},
{
"地铁里的幽灵乘客",
"找出在地铁里出没的半透明乘客。"
},
{
"公园的精灵涂鸦",
"清除公园里突然出现的精灵涂鸦。"
},
{
"手机信号的干扰源",
"找出干扰手机信号的魔法源头。"
},
{
"外卖小哥的奇遇",
"帮助外卖小哥找回被偷走的魔法外卖。"
},
{
"广场舞的魔法节奏",
"调查广场舞音乐中隐藏的魔法节奏。"
},
{
"自动贩卖机的秘密",
"找出自动贩卖机里突然出现的奇怪物品。"
},
{
"便利店的异次元入口",
"调查便利店里突然出现的异次元入口。"
},
{
"街头艺人的魔法表演",
"调查街头艺人表演中使用的魔法。"
},
{
"午夜电台的幽灵来电",
"调查午夜电台收到的奇怪来电。"
},
{
"高楼大厦的秘密通道",
"寻找隐藏在高楼大厦里的秘密通道。"
},
{
"城市下水道的神秘生物",
"调查城市下水道里出现的神秘生物。"
},
{
"废弃工厂的魔法实验",
"调查废弃工厂里进行的秘密魔法实验。"
},
{
"博物馆的活化雕像",
"调查博物馆里突然活化的雕像。"
},
{
"公园的都市传说",
"调查公园里流传的都市传说。"
},
{
"闹鬼公寓的真相",
"调查闹鬼公寓里的真相。"
},
{
"地下酒吧的秘密交易",
"调查地下酒吧里进行的秘密魔法交易。"
},
{
"旧书店的魔法书籍",
"寻找旧书店里隐藏的魔法书籍。"
},
{
"涂鸦墙的预言",
"解读涂鸦墙上出现的神秘预言。"
},
{
"黑客的魔法入侵",
"阻止黑客利用魔法入侵城市网络。"
},
{
"高科技魔法装备的测试",
"测试新型的高科技魔法装备。"
},
{
"无人机的魔法改造",
"改造无人机,使其拥有魔法能力。"
},
{
"人工智能的觉醒",
"调查人工智能觉醒的原因。"
},
{
"虚拟现实的魔法世界",
"探索虚拟现实中出现的魔法世界。"
},
{
"智能家居的魔法故障",
"修复智能家居的魔法故障。"
},
{
"能量饮料的魔法副作用",
"调查能量饮料的魔法副作用。"
},
{
"社交媒体的魔法病毒",
"清除社交媒体上出现的魔法病毒。"
},
{
"共享汽车的魔法漂移",
"调查共享汽车的魔法漂移现象。"
},
{
"城市监控的魔法干扰",
"修复城市监控的魔法干扰。"
},
{
"寻找丢失的魔法宠物",
"寻找在城市里走失的魔法宠物。"
},
{
"参加魔法美食节",
"参加城市举办的魔法美食节。"
},
{
"解开城市谜题",
"解开隐藏在城市各处的谜题。"
},
{
"参加魔法cosplay大赛",
"参加城市举办的魔法cosplay大赛。"
},
{
"寻找隐藏的魔法商店",
"寻找隐藏在城市里的魔法商店。"
},
{
"制作魔法主题的街头艺术",
"在城市里创作魔法主题的街头艺术。"
},
{
"举办一场魔法快闪活动",
"在城市里举办一场魔法快闪活动。"
},
{
"寻找失落的魔法乐器",
"寻找失落的魔法乐器,让城市充满音乐。"
},
{
"参加魔法运动会",
"参加城市举办的魔法运动会。"
},
{
"拯救被困在魔法结界里的市民",
"拯救被困在城市魔法结界里的市民。"
}
};
}
}
public static Dictionary<QualityType, double> DrawCardProbabilities
{
get
{
return new()
{
{ QualityType.White, 69.53 },
{ QualityType.Green, 15.35 },
{ QualityType.Blue, 9.48 },
{ QualityType.Purple, 4.25 },
{ QualityType.Orange, 1.33 },
{ QualityType.Red, 0.06 }
};
}
}
public static Dictionary<QualityType, (int Min, int Max)> PriceRanges
{
get
{
return new()
{
{ QualityType.White, (200, 2000) },
{ QualityType.Green, (1500, 15000) },
{ QualityType.Blue, (5000, 50000) },
{ QualityType.Purple, (10000, 100000) },
{ QualityType.Orange, (40000, 400000) },
{ QualityType.Red, (100000, 1000000) },
{ QualityType.Gold, (500000, 5000000) }
};
}
}
}
}

View File

@ -1,8 +1,8 @@
using System.Text;
using Milimoe.FunGame.Core.Api.Transmittal;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Oshima.Core.Configs;
using Oshima.Core.Constant;
using Oshima.FunGame.OshimaModules.Characters;
using Oshima.FunGame.OshimaModules.Effects.OpenEffects;
@ -13,70 +13,60 @@ namespace Oshima.FunGame.OshimaServers.Service
{
public class FunGameService
{
public static List<Character> Characters { get; } = [];
public static List<Skill> Skills { get; } = [];
public static List<Skill> PassiveSkills { get; } = [];
public static List<Skill> SuperSkills { get; } = [];
public static List<Skill> Magics { get; } = [];
public static List<Item> Equipment { get; } = [];
public static List<Item> Items { get; } = [];
public static List<Skill> ItemSkills { get; } = [];
public static List<Item> AllItems { get; } = [];
public static List<Skill> AllSkills { get; } = [];
public static Dictionary<long, User> UserIdAndUsername { get; } = [];
public static Dictionary<int, Character> Bosses { get; } = [];
public static ItemType[] ItemCanUsed => [ItemType.Consumable, ItemType.MagicCard, ItemType.SpecialItem, ItemType.GiftBox, ItemType.Others];
public static ServerPluginLoader? ServerPluginLoader { get; set; } = null;
public static WebAPIPluginLoader? WebAPIPluginLoader { get; set; } = null;
public static void InitFunGame()
{
Characters.Add(new OshimaShiya());
Characters.Add(new XinYin());
Characters.Add(new Yang());
Characters.Add(new NanGanYu());
Characters.Add(new NiuNan());
Characters.Add(new DokyoMayor());
Characters.Add(new MagicalGirl());
Characters.Add(new QingXiang());
Characters.Add(new QWQAQW());
Characters.Add(new ColdBlue());
Characters.Add(new dddovo());
Characters.Add(new Quduoduo());
FunGameConstant.Characters.Add(new OshimaShiya());
FunGameConstant.Characters.Add(new XinYin());
FunGameConstant.Characters.Add(new Yang());
FunGameConstant.Characters.Add(new NanGanYu());
FunGameConstant.Characters.Add(new NiuNan());
FunGameConstant.Characters.Add(new DokyoMayor());
FunGameConstant.Characters.Add(new MagicalGirl());
FunGameConstant.Characters.Add(new QingXiang());
FunGameConstant.Characters.Add(new QWQAQW());
FunGameConstant.Characters.Add(new ColdBlue());
FunGameConstant.Characters.Add(new dddovo());
FunGameConstant.Characters.Add(new Quduoduo());
Skills.AddRange([new ()]);
FunGameConstant.Skills.AddRange([new ()]);
SuperSkills.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new ()]);
FunGameConstant.SuperSkills.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new ()]);
PassiveSkills.AddRange([new META马(), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new ()]);
FunGameConstant.PassiveSkills.AddRange([new META马(), new (), new (), new (), new (), new (), new (), new (), new (), new (), new (), new ()]);
Magics.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (),
FunGameConstant.Magics.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (),
new (), new (), new (), new ()]);
Dictionary<string, Item> exItems = Factory.GetGameModuleInstances<Item>(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Item);
Equipment.AddRange(exItems.Values.Where(i => (int)i.ItemType >= 0 && (int)i.ItemType < 5));
Equipment.AddRange([new 8(), new 20(), new 35(), new 50()]);
FunGameConstant.Equipment.AddRange(exItems.Values.Where(i => (int)i.ItemType >= 0 && (int)i.ItemType < 5));
FunGameConstant.Equipment.AddRange([new 8(), new 20(), new 35(), new 50()]);
Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
Items.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (),
FunGameConstant.Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4));
FunGameConstant.Items.AddRange([new (), new (), new (), new (), new (), new (), new (), new (), new (), new (),
new (), new (), new (), new 1(), new 2(), new 3(), new 1(), new 2(), new 3()]);
AllItems.AddRange(Equipment);
AllItems.AddRange(Items);
FunGameConstant.AllItems.AddRange(FunGameConstant.Equipment);
FunGameConstant.AllItems.AddRange(FunGameConstant.Items);
Skill?[] activeSkills = [.. Equipment.Select(i => i.Skills.Active), .. Items.Select(i => i.Skills.Active)];
Skill?[] activeSkills = [.. FunGameConstant.Equipment.Select(i => i.Skills.Active), .. FunGameConstant.Items.Select(i => i.Skills.Active)];
foreach (Skill? skill in activeSkills)
{
if (skill != null)
{
ItemSkills.Add(skill);
FunGameConstant.ItemSkills.Add(skill);
}
}
ItemSkills.AddRange([.. Equipment.SelectMany(i => i.Skills.Passives), .. Items.SelectMany(i => i.Skills.Passives)]);
FunGameConstant.ItemSkills.AddRange([.. FunGameConstant.Equipment.SelectMany(i => i.Skills.Passives), .. FunGameConstant.Items.SelectMany(i => i.Skills.Passives)]);
AllSkills.AddRange(Magics);
AllSkills.AddRange(Skills);
AllSkills.AddRange(PassiveSkills);
AllSkills.AddRange(ItemSkills);
AllSkills.AddRange(SuperSkills);
FunGameConstant.AllSkills.AddRange(FunGameConstant.Magics);
FunGameConstant.AllSkills.AddRange(FunGameConstant.Skills);
FunGameConstant.AllSkills.AddRange(FunGameConstant.PassiveSkills);
FunGameConstant.AllSkills.AddRange(FunGameConstant.ItemSkills);
FunGameConstant.AllSkills.AddRange(FunGameConstant.SuperSkills);
}
public static List<Item> GenerateMagicCards(int count, QualityType? qualityType = null)
@ -140,7 +130,7 @@ namespace Oshima.FunGame.OshimaServers.Service
public static void GenerateAndAddSkillToMagicCard(Item item, int total)
{
Skill magic = Magics[Random.Shared.Next(Magics.Count)].Copy();
Skill magic = FunGameConstant.Magics[Random.Shared.Next(FunGameConstant.Magics.Count)].Copy();
magic.Guid = item.Guid;
magic.Level = (int)item.QualityType switch
{
@ -371,15 +361,15 @@ namespace Oshima.FunGame.OshimaServers.Service
public static void Reload()
{
Characters.Clear();
Equipment.Clear();
Skills.Clear();
SuperSkills.Clear();
PassiveSkills.Clear();
Magics.Clear();
AllItems.Clear();
ItemSkills.Clear();
AllSkills.Clear();
FunGameConstant.Characters.Clear();
FunGameConstant.Equipment.Clear();
FunGameConstant.Skills.Clear();
FunGameConstant.SuperSkills.Clear();
FunGameConstant.PassiveSkills.Clear();
FunGameConstant.Magics.Clear();
FunGameConstant.AllItems.Clear();
FunGameConstant.ItemSkills.Clear();
FunGameConstant.AllSkills.Clear();
InitFunGame();
}
@ -471,7 +461,7 @@ namespace Oshima.FunGame.OshimaServers.Service
foreach (Item inventoryItem in items)
{
Item realItem = inventoryItem.Copy(true, true, true, AllItems, AllSkills);
Item realItem = inventoryItem.Copy(true, true, true, FunGameConstant.AllItems, FunGameConstant.AllSkills);
realItem.User = user;
user.Inventory.Items.Add(realItem);
}
@ -495,7 +485,7 @@ namespace Oshima.FunGame.OshimaServers.Service
inventoryCharacter.InitialHR = tempCharacter.InitialHR;
inventoryCharacter.InitialMR = tempCharacter.InitialMR;
}
Character realCharacter = CharacterBuilder.Build(inventoryCharacter, false, true, user.Inventory, AllItems, AllSkills, false);
Character realCharacter = CharacterBuilder.Build(inventoryCharacter, false, true, user.Inventory, FunGameConstant.AllItems, FunGameConstant.AllSkills, false);
// 自动回血
DateTime now = DateTime.Now;
int seconds = (int)(now - user.LastTime).TotalSeconds;
@ -586,9 +576,9 @@ namespace Oshima.FunGame.OshimaServers.Service
int r = Random.Shared.Next(8);
double q = Random.Shared.NextDouble() * 100;
QualityType type = QualityType.White;
foreach (QualityType typeTemp in DrawCardProbabilities.Keys.OrderByDescending(o => (int)o))
foreach (QualityType typeTemp in FunGameConstant.DrawCardProbabilities.Keys.OrderByDescending(o => (int)o))
{
if (q <= DrawCardProbabilities[typeTemp])
if (q <= FunGameConstant.DrawCardProbabilities[typeTemp])
{
type = typeTemp;
break;
@ -599,7 +589,7 @@ namespace Oshima.FunGame.OshimaServers.Service
{
case 1:
if ((int)type > (int)QualityType.Orange) type = QualityType.Orange;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type).ToArray();
Item a = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(a);
user.Inventory.Items.Add(a);
@ -608,7 +598,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 2:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type).ToArray();
Item b = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(b);
user.Inventory.Items.Add(b);
@ -617,7 +607,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 3:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type).ToArray();
Item c = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(c);
user.Inventory.Items.Add(c);
@ -626,7 +616,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 4:
if ((int)type > (int)QualityType.Purple) type = QualityType.Purple;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type).ToArray();
Item d = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(d);
user.Inventory.Items.Add(d);
@ -634,7 +624,7 @@ namespace Oshima.FunGame.OshimaServers.Service
break;
case 5:
Character character = Characters[Random.Shared.Next(Characters.Count)].Copy();
Character character = FunGameConstant.Characters[Random.Shared.Next(FunGameConstant.Characters.Count)].Copy();
AddCharacterSkills(character, 1, 0, 0);
if (user.Inventory.Characters.Any(c => c.Id == character.Id))
{
@ -657,7 +647,7 @@ namespace Oshima.FunGame.OshimaServers.Service
break;
case 7:
Item = Items[Random.Shared.Next(Items.Count)].Copy();
Item = FunGameConstant.Items[Random.Shared.Next(FunGameConstant.Items.Count)].Copy();
SetSellAndTradeTime();
user.Inventory.Items.Add();
msg += ItemSet.GetQualityTypeName(.QualityType) + ItemSet.GetItemTypeName(.ItemType) + "【" + .Name + "】!\r\n" + .Description;
@ -693,7 +683,7 @@ namespace Oshima.FunGame.OshimaServers.Service
// 根据签到天数调整概率
double daysFactor = Math.Min(days * 0.02, 30);
Dictionary<QualityType, double> adjustedProbabilities = new(DrawCardProbabilities);
Dictionary<QualityType, double> adjustedProbabilities = new(FunGameConstant.DrawCardProbabilities);
foreach (QualityType typeTemp in adjustedProbabilities.Keys)
{
adjustedProbabilities[typeTemp] += daysFactor;
@ -715,7 +705,7 @@ namespace Oshima.FunGame.OshimaServers.Service
{
case 1:
if ((int)type > (int)QualityType.Orange) type = QualityType.Orange;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && i.QualityType == type).ToArray();
Item a = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(a);
user.Inventory.Items.Add(a);
@ -724,7 +714,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 2:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && i.QualityType == type).ToArray();
Item b = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(b);
user.Inventory.Items.Add(b);
@ -733,7 +723,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 3:
if ((int)type > (int)QualityType.Green) type = QualityType.Green;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && i.QualityType == type).ToArray();
Item c = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(c);
user.Inventory.Items.Add(c);
@ -742,7 +732,7 @@ namespace Oshima.FunGame.OshimaServers.Service
case 4:
if ((int)type > (int)QualityType.Purple) type = QualityType.Purple;
Item[] = Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && i.QualityType == type).ToArray();
Item d = [Random.Shared.Next(.Length)].Copy();
SetSellAndTradeTime(d);
user.Inventory.Items.Add(d);
@ -1052,7 +1042,7 @@ namespace Oshima.FunGame.OshimaServers.Service
{
break;
}
if (ItemCanUsed.Contains(item.ItemType))
if (FunGameConstant.ItemCanUsed.Contains(item.ItemType))
{
if (item.RemainUseTimes <= 0)
{
@ -1106,7 +1096,7 @@ namespace Oshima.FunGame.OshimaServers.Service
public static string GetLevelBreakNeedy(int levelBreak)
{
if (LevelBreakNeedyList.TryGetValue(levelBreak, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
if (FunGameConstant.LevelBreakNeedyList.TryGetValue(levelBreak, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
{
return string.Join("", needy.Select(kv => kv.Key + " * " + kv.Value));
}
@ -1205,7 +1195,7 @@ namespace Oshima.FunGame.OshimaServers.Service
public static string GetSkillLevelUpNeedy(int level)
{
if (SkillLevelUpList.TryGetValue(level, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
if (FunGameConstant.SkillLevelUpList.TryGetValue(level, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
{
return GetNeedyInfo(needy);
}
@ -1214,7 +1204,7 @@ namespace Oshima.FunGame.OshimaServers.Service
public static string GetNormalAttackLevelUpNeedy(int level)
{
if (NormalAttackLevelUpList.TryGetValue(level, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
if (FunGameConstant.NormalAttackLevelUpList.TryGetValue(level, out Dictionary<string, int>? needy) && needy != null && needy.Count > 0)
{
return GetNeedyInfo(needy);
}
@ -1270,10 +1260,10 @@ namespace Oshima.FunGame.OshimaServers.Service
boss.Level = cLevel;
boss.NormalAttack.Level = naLevel;
boss.NormalAttack.HardnessTime = 6;
Item[] weapons = Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 4).ToArray();
Item[] armors = Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 1).ToArray();
Item[] shoes = Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 1).ToArray();
Item[] accessory = Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 3).ToArray();
Item[] weapons = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 4).ToArray();
Item[] armors = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 1).ToArray();
Item[] shoes = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 1).ToArray();
Item[] accessory = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 3).ToArray();
Item? a = null, b = null, c = null, d = null, d2 = null;
if (weapons.Length > 0)
{
@ -1373,476 +1363,6 @@ namespace Oshima.FunGame.OshimaServers.Service
}
}
public static Dictionary<int, Dictionary<string, int>> LevelBreakNeedyList
{
get
{
return new()
{
{
0, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 80 },
{ nameof(), 10 }
}
},
{
1, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 400 },
{ nameof(), 20 }
}
},
{
2, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 960 },
{ nameof(), 30 },
{ nameof(), 10 }
}
},
{
3, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 1760 },
{ nameof(), 40 },
{ nameof(), 20 }
}
},
{
4, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 2800 },
{ nameof(), 50 },
{ nameof(), 30 },
{ nameof(), 10 }
}
},
{
5, new()
{
{ General.GameplayEquilibriumConstant.InGameMaterial, 4080 },
{ nameof(), 60 },
{ nameof(), 40 },
{ nameof(), 20 }
}
},
};
}
}
public static Dictionary<int, Dictionary<string, int>> SkillLevelUpList
{
get
{
return new()
{
{
1, new()
{
{ "角色等级", 1 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
2, new()
{
{ "角色等级", 12 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
3, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 3 },
{ nameof(), 1 },
}
},
{
4, new()
{
{ "角色等级", 36 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 4 },
{ nameof(), 2 },
}
},
{
5, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
},
{
6, new()
{
{ "角色等级", 60 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 4 },
{ nameof(), 2 }
}
}
};
}
}
public static Dictionary<int, Dictionary<string, int>> NormalAttackLevelUpList
{
get
{
return new()
{
{
2, new()
{
{ "角色等级", 8 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 2000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 10 },
{ nameof(), 1 },
}
},
{
3, new()
{
{ "角色等级", 16 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 5000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 30 },
{ nameof(), 2 },
}
},
{
4, new()
{
{ "角色等级", 24 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 10000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 60 },
{ nameof(), 3 },
{ nameof(), 1 },
}
},
{
5, new()
{
{ "角色等级", 32 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 18000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 100 },
{ nameof(), 4 },
{ nameof(), 2 },
}
},
{
6, new()
{
{ "角色等级", 40 },
{ "角色突破进度", 4 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 30000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 150 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
},
{
7, new()
{
{ "角色等级", 48 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 47000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 210 },
{ nameof(), 6 },
{ nameof(), 4 },
{ nameof(), 2 }
}
},
{
8, new()
{
{ "角色等级", 56 },
{ General.GameplayEquilibriumConstant.InGameCurrency, 70000 },
{ General.GameplayEquilibriumConstant.InGameMaterial, 280 },
{ nameof(), 7 },
{ nameof(), 5 },
{ nameof(), 3 },
{ nameof(), 1 }
}
}
};
}
}
public static Dictionary<EffectID, Dictionary<string, object>> RoundRewards
{
get
{
return new()
{
{
EffectID.ExATK,
new()
{
{ "exatk", Random.Shared.Next(40, 80) }
}
},
{
EffectID.ExCritRate,
new()
{
{ "excr", Math.Clamp(Random.Shared.NextDouble(), 0.25, 0.5) }
}
},
{
EffectID.ExCritDMG,
new()
{
{ "excrd", Math.Clamp(Random.Shared.NextDouble(), 0.5, 1) }
}
},
{
EffectID.ExATK2,
new()
{
{ "exatk", Math.Clamp(Random.Shared.NextDouble(), 0.15, 0.3) }
}
},
{
EffectID.RecoverHP,
new()
{
{ "hp", Random.Shared.Next(160, 640) }
}
},
{
EffectID.RecoverMP,
new()
{
{ "mp", Random.Shared.Next(140, 490) }
}
},
{
EffectID.RecoverHP2,
new()
{
{ "hp", Math.Clamp(Random.Shared.NextDouble(), 0.04, 0.08) }
}
},
{
EffectID.RecoverMP2,
new()
{
{ "mp", Math.Clamp(Random.Shared.NextDouble(), 0.09, 0.18) }
}
},
{
EffectID.GetEP,
new()
{
{ "ep", Random.Shared.Next(20, 40) }
}
}
};
}
}
public static Dictionary<string, string> QuestList
{
get
{
return new()
{
{
"丢失的共享单车之谜",
"寻找被魔法传送走的共享单车。"
},
{
"咖啡店的神秘顾客",
"调查每天都点奇怪饮品的神秘顾客。"
},
{
"地铁里的幽灵乘客",
"找出在地铁里出没的半透明乘客。"
},
{
"公园的精灵涂鸦",
"清除公园里突然出现的精灵涂鸦。"
},
{
"手机信号的干扰源",
"找出干扰手机信号的魔法源头。"
},
{
"外卖小哥的奇遇",
"帮助外卖小哥找回被偷走的魔法外卖。"
},
{
"广场舞的魔法节奏",
"调查广场舞音乐中隐藏的魔法节奏。"
},
{
"自动贩卖机的秘密",
"找出自动贩卖机里突然出现的奇怪物品。"
},
{
"便利店的异次元入口",
"调查便利店里突然出现的异次元入口。"
},
{
"街头艺人的魔法表演",
"调查街头艺人表演中使用的魔法。"
},
{
"午夜电台的幽灵来电",
"调查午夜电台收到的奇怪来电。"
},
{
"高楼大厦的秘密通道",
"寻找隐藏在高楼大厦里的秘密通道。"
},
{
"城市下水道的神秘生物",
"调查城市下水道里出现的神秘生物。"
},
{
"废弃工厂的魔法实验",
"调查废弃工厂里进行的秘密魔法实验。"
},
{
"博物馆的活化雕像",
"调查博物馆里突然活化的雕像。"
},
{
"公园的都市传说",
"调查公园里流传的都市传说。"
},
{
"闹鬼公寓的真相",
"调查闹鬼公寓里的真相。"
},
{
"地下酒吧的秘密交易",
"调查地下酒吧里进行的秘密魔法交易。"
},
{
"旧书店的魔法书籍",
"寻找旧书店里隐藏的魔法书籍。"
},
{
"涂鸦墙的预言",
"解读涂鸦墙上出现的神秘预言。"
},
{
"黑客的魔法入侵",
"阻止黑客利用魔法入侵城市网络。"
},
{
"高科技魔法装备的测试",
"测试新型的高科技魔法装备。"
},
{
"无人机的魔法改造",
"改造无人机,使其拥有魔法能力。"
},
{
"人工智能的觉醒",
"调查人工智能觉醒的原因。"
},
{
"虚拟现实的魔法世界",
"探索虚拟现实中出现的魔法世界。"
},
{
"智能家居的魔法故障",
"修复智能家居的魔法故障。"
},
{
"能量饮料的魔法副作用",
"调查能量饮料的魔法副作用。"
},
{
"社交媒体的魔法病毒",
"清除社交媒体上出现的魔法病毒。"
},
{
"共享汽车的魔法漂移",
"调查共享汽车的魔法漂移现象。"
},
{
"城市监控的魔法干扰",
"修复城市监控的魔法干扰。"
},
{
"寻找丢失的魔法宠物",
"寻找在城市里走失的魔法宠物。"
},
{
"参加魔法美食节",
"参加城市举办的魔法美食节。"
},
{
"解开城市谜题",
"解开隐藏在城市各处的谜题。"
},
{
"参加魔法cosplay大赛",
"参加城市举办的魔法cosplay大赛。"
},
{
"寻找隐藏的魔法商店",
"寻找隐藏在城市里的魔法商店。"
},
{
"制作魔法主题的街头艺术",
"在城市里创作魔法主题的街头艺术。"
},
{
"举办一场魔法快闪活动",
"在城市里举办一场魔法快闪活动。"
},
{
"寻找失落的魔法乐器",
"寻找失落的魔法乐器,让城市充满音乐。"
},
{
"参加魔法运动会",
"参加城市举办的魔法运动会。"
},
{
"拯救被困在魔法结界里的市民",
"拯救被困在城市魔法结界里的市民。"
}
};
}
}
public static Dictionary<QualityType, double> DrawCardProbabilities
{
get
{
return new()
{
{ QualityType.White, 69.53 },
{ QualityType.Green, 15.35 },
{ QualityType.Blue, 9.48 },
{ QualityType.Purple, 4.25 },
{ QualityType.Orange, 1.33 },
{ QualityType.Red, 0.06 }
};
}
}
public static Dictionary<int, List<Skill>> GenerateRoundRewards(int maxRound)
{
Dictionary<int, List<Skill>> roundRewards = [];
@ -1857,7 +1377,7 @@ namespace Oshima.FunGame.OshimaServers.Service
List<Skill> skills = [];
// 添加回合奖励特效
long effectID = (long)RoundRewards.Keys.ToArray()[Random.Shared.Next(RoundRewards.Count)];
long effectID = (long)FunGameConstant.RoundRewards.Keys.ToArray()[Random.Shared.Next(FunGameConstant.RoundRewards.Count)];
Dictionary<string, object> args = [];
if (effectID > (long)EffectID.Active_Start)
{
@ -1945,25 +1465,25 @@ namespace Oshima.FunGame.OshimaServers.Service
Dictionary<string, int> items = [];
items[General.GameplayEquilibriumConstant.InGameCurrency] = minutes * 20;
items[General.GameplayEquilibriumConstant.InGameMaterial] = minutes / 8 * 1;
int index = Random.Shared.Next(AllItems.Count);
Item item = AllItems[index];
int index = Random.Shared.Next(FunGameConstant.AllItems.Count);
Item item = FunGameConstant.AllItems[index];
items.Add(item.Name, 1);
while (true)
{
int index2 = Random.Shared.Next(AllItems.Count);
int index2 = Random.Shared.Next(FunGameConstant.AllItems.Count);
if (index2 != index)
{
Item item2 = AllItems[index2];
Item item2 = FunGameConstant.AllItems[index2];
items.Add(item2.Name, 1);
break;
}
}
string name = QuestList.Keys.OrderBy(o => Random.Shared.Next()).First();
string name = FunGameConstant.QuestList.Keys.OrderBy(o => Random.Shared.Next()).First();
Quest quest = new()
{
Id = quests.Count > 0 ? quests.Values.Max(q => q.Id) + 1 : 1,
Name = name,
Description = QuestList[name],
Description = FunGameConstant.QuestList[name],
EstimatedMinutes = minutes,
Awards = items
};
@ -2011,7 +1531,7 @@ namespace Oshima.FunGame.OshimaServers.Service
{
user.Inventory.Materials += quest.Awards[name];
}
else if (AllItems.FirstOrDefault(i => i.Name == name) is Item item)
else if (FunGameConstant.AllItems.FirstOrDefault(i => i.Name == name) is Item item)
{
Item newItem = item.Copy();
newItem.User = user;
@ -2026,17 +1546,26 @@ namespace Oshima.FunGame.OshimaServers.Service
return result;
}
public static string CheckDailyStore(EntityModuleConfig<Store> store)
public static string CheckDailyStore(EntityModuleConfig<Store> store, User? user = null)
{
if (store.Count == 0)
{
// 生成每日商店
Store daily = new("每日商店");
Store daily = new($"{(user != null ? user.Username + "" : "")}每日商店");
for (int i = 0; i < 4; i++)
{
int index = Random.Shared.Next(AllItems.Count);
Item item = AllItems[index].Copy();
double price = Random.Shared.NextDouble() * 10000 * (int)item.QualityType * Random.Shared.Next(5,20);
int index = Random.Shared.Next(FunGameConstant.AllItems.Count);
Item item = FunGameConstant.AllItems[index].Copy();
(int min, int max) = (0, 0);
if (FunGameConstant.PriceRanges.TryGetValue(item.QualityType, out (int Min, int Max) range))
{
(min, max) = (range.Min, range.Max);
}
double price = Random.Shared.Next(min, max);
if (price == 0)
{
price = (Random.Shared.NextDouble() + 0.1) * Random.Shared.Next(1000, 10000) * Random.Shared.Next((int)item.QualityType + 2, 6 + ((int)item.QualityType));
}
item.Price = Calculation.Round2Digits(price);
daily.AddItem(item, Random.Shared.Next(1, 3));
}
@ -2055,5 +1584,71 @@ namespace Oshima.FunGame.OshimaServers.Service
}
}
}
public static string StoreBuyItem(Store store, Goods goods, User user, int count)
{
string msg = "";
if (goods.Stock - count < 0)
{
return msg = $"此商品【{goods.Name}】库存不足,无法购买!\r\n你想要购买 {count} 件,但库存只有 {goods.Stock} 件。";
}
foreach (string needy in goods.Prices.Keys)
{
if (needy == General.GameplayEquilibriumConstant.InGameCurrency)
{
double reduce = Calculation.Round2Digits(goods.Prices[needy] * count);
if (user.Inventory.Credits >= reduce)
{
user.Inventory.Credits -= reduce;
}
else
{
return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameCurrency}不足 {reduce} 呢,无法购买【{goods.Name}】!");
}
}
else if (needy == General.GameplayEquilibriumConstant.InGameMaterial)
{
double reduce = Calculation.Round2Digits(goods.Prices[needy] * count);
if (user.Inventory.Materials >= reduce)
{
user.Inventory.Materials -= reduce;
}
else
{
return NetworkUtility.JsonSerialize($"你的{General.GameplayEquilibriumConstant.InGameMaterial}不足 {reduce} 呢,无法购买【{goods.Name}】!");
}
}
}
foreach (Item item in goods.Items)
{
for (int i = 0; i < count; i++)
{
Item newItem = item.Copy();
SetSellAndTradeTime(newItem);
if (goods.GetPrice(General.GameplayEquilibriumConstant.InGameCurrency, out double price) && price > 0)
{
newItem.Price = Calculation.Round2Digits(price * 0.35);
}
newItem.User = user;
user.Inventory.Items.Add(newItem);
}
}
goods.Stock -= count;
msg += $"恭喜你成功购买 {count} 件【{goods.Name}】!\r\n" +
$"总计消费:{(goods.Prices.Count > 0 ? string.Join("", goods.Prices.Select(kv => $"{kv.Value * count:0.##} {kv.Key}")) : "")}\r\n" +
$"包含物品:{string.Join("", goods.Items.Select(i => $"[{ItemSet.GetQualityTypeName(i.QualityType)}|{ItemSet.GetItemTypeName(i.ItemType)}] {i.Name} * {count}"))}";
return msg;
}
public static string Select_CheckAutoKey(SQLHelper SQLHelper, string AutoKey)
{
SQLHelper.Parameters["@AutoKey"] = AutoKey;
return $"{Milimoe.FunGame.Core.Library.SQLScript.Entity.UserQuery.Select_Users} {Milimoe.FunGame.Core.Library.SQLScript.Constant.Command_Where} {Milimoe.FunGame.Core.Library.SQLScript.Entity.UserQuery.Column_AutoKey} = @AutoKey";
}
}
}

View File

@ -24,7 +24,7 @@ namespace Oshima.FunGame.OshimaServers.Service
CharacterStatistics.Clear();
TeamCharacterStatistics.Clear();
foreach (Character c in FunGameService.Characters)
foreach (Character c in FunGameConstant.Characters)
{
CharacterStatistics.Add(c, new());
}
@ -38,7 +38,7 @@ namespace Oshima.FunGame.OshimaServers.Service
}
}
foreach (Character c in FunGameService.Characters)
foreach (Character c in FunGameConstant.Characters)
{
TeamCharacterStatistics.Add(c, new());
}
@ -76,7 +76,7 @@ namespace Oshima.FunGame.OshimaServers.Service
// M = 5, W = 0, P1 = 0, P3 = 2
// M = 5, W = 1, P1 = 0, P3 = 0
List<Character> list = new(FunGameService.Characters);
List<Character> list = new(FunGameConstant.Characters);
if (list.Count > 11)
{
@ -270,7 +270,7 @@ namespace Oshima.FunGame.OshimaServers.Service
foreach (Skill skill in skillRewards)
{
Dictionary<string, object> effectArgs = [];
if (FunGameService.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary<string, object>? dict) && dict != null)
if (FunGameConstant.RoundRewards.TryGetValue((EffectID)skill.Id, out Dictionary<string, object>? dict) && dict != null)
{
effectArgs = new(dict);
}
@ -589,10 +589,10 @@ namespace Oshima.FunGame.OshimaServers.Service
{
foreach (Character character in queue.Queue)
{
Item[] = FunGameService.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality).ToArray();
Item[] = FunGameService.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality).ToArray();
Item[] = FunGameService.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality).ToArray();
Item[] = FunGameService.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == wQuality).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == aQuality).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == sQuality).ToArray();
Item[] = FunGameConstant.Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == acQuality).ToArray();
Item? a = null, b = null, c = null, d = null;
if (.Length > 0)
{

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Milimoe.FunGame.Core.Api.Utility;
using Oshima.FunGame.WebAPI.Models;
using Oshima.FunGame.WebAPI.Services;
using Rebex.Security.Cryptography;
@ -20,7 +21,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
private RainBOTService FungameService { get; set; } = fungameService;
[HttpPost]
public async Task<IActionResult> Post([FromBody] Payload? payload)
public IActionResult Post([FromBody] Payload? payload)
{
if (payload is null)
{
@ -38,7 +39,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
else if (payload.Op == 0)
{
// 处理其他事件
return await HandleEventAsync(payload);
return HandleEventAsync(payload);
}
else
{
@ -93,7 +94,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
return Ok(response);
}
private async Task<IActionResult> HandleEventAsync(Payload payload)
private IActionResult HandleEventAsync(Payload payload)
{
Logger.LogDebug("处理事件:{EventType}, 数据:{Data}", payload.EventType, payload.Data);
@ -122,7 +123,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
//{
// _logger.LogError("上传图片失败:{error}", error);
//}
await FungameService.Handler(c2c: c2cMessage);
TaskUtility.NewTask(async () => await FungameService.Handler(c2c: c2cMessage));
}
else
{
@ -139,7 +140,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
Logger.LogInformation("收到来自群组 {groupAtMessage.GroupOpenId} 的消息:{groupAtMessage.Content}", groupAtMessage.GroupOpenId, groupAtMessage.Content);
// 回复消息
//await _service.SendGroupMessageAsync(groupAtMessage.GroupOpenId, $"你发送的消息是:{groupAtMessage.Content}", msgId: groupAtMessage.Id);
await FungameService.Handler(groupAt: groupAtMessage);
TaskUtility.NewTask(async () => await FungameService.Handler(groupAt: groupAtMessage));
}
else
{

View File

@ -1,10 +1,13 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Milimoe.FunGame.Core.Api.Transmittal;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Oshima.Core.Configs;
using Oshima.Core.Constant;
using Oshima.FunGame.OshimaServers.Service;
using Oshima.FunGame.WebAPI.Constant;
using Oshima.FunGame.WebAPI.Controllers;
using Oshima.FunGame.WebAPI.Models;
@ -27,16 +30,14 @@ namespace Oshima.FunGame.WebAPI
if (input == "test")
{
FunGameController controller = new(new Logger<FunGameController>(new LoggerFactory()));
Controller.WriteLine(Controller.JSON.GetObject<string>(controller.CreateSaved(1, "测试用户")) ?? "test");
Controller.WriteLine(Controller.JSON.GetObject<string>(controller.GetItemInfo_Name(1, "鸳鸯眼")) ?? "test");
Controller.WriteLine(Controller.JSON.GetObject<string>(controller.GetCharacterInfoFromInventory(1, 1, false)) ?? "test");
Controller.WriteLine(string.Join("\r\n", controller.GetBoss(1)));
Controller.WriteLine(Controller.JSON.GetObject<string>(controller.ShowDailyStore(1)) ?? "test");
}
}
public override void AfterLoad(WebAPIPluginLoader loader, params object[] objs)
{
Statics.RunningPlugin = this;
FunGameService.WebAPIPluginLoader ??= loader;
Controller.NewSQLHelper();
Controller.NewMailSender();
if (objs.Length > 0 && objs[0] is WebApplicationBuilder builder)
@ -46,6 +47,11 @@ namespace Oshima.FunGame.WebAPI
builder.Services.AddScoped<RainBOTService>();
builder.Services.AddScoped<FunGameController>();
builder.Services.AddScoped<QQController>();
builder.Services.AddTransient(provider => {
SQLHelper? sql = Factory.OpenFactory.GetSQLHelper();
if (sql != null) return sql;
throw new Milimoe.FunGame.SQLServiceException();
});
// 使用 Configure<BotConfig> 从配置源绑定
builder.Services.Configure<BotConfig>(builder.Configuration.GetSection("Bot"));
}

View File

@ -1,15 +1,18 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using Milimoe.FunGame.Core.Api.Transmittal;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Oshima.Core.Configs;
using Oshima.FunGame.OshimaServers.Service;
using Oshima.FunGame.WebAPI.Constant;
using Oshima.FunGame.WebAPI.Controllers;
using Oshima.FunGame.WebAPI.Models;
namespace Oshima.FunGame.WebAPI.Services
{
public class RainBOTService(FunGameController controller, QQController qqcontroller, QQBotService service, ILogger<RainBOTService> logger)
public class RainBOTService(FunGameController controller, QQController qqcontroller, QQBotService service, ILogger<RainBOTService> logger, IMemoryCache memoryCache)
{
private static List<string> FunGameItemType { get; } = ["卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"];
private bool FunGameSimulation { get; set; } = false;
@ -17,6 +20,7 @@ namespace Oshima.FunGame.WebAPI.Services
private QQController QQController { get; } = qqcontroller;
private QQBotService Service { get; } = service;
private ILogger<RainBOTService> Logger { get; } = logger;
private IMemoryCache MemoryCache { get; set; } = memoryCache;
private async Task SendAsync(IBotMessage msg, string title, string content, int msgType = 0, object? media = null, int? msgSeq = null)
{
@ -39,7 +43,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
IBotMessage? e = null;
string openid = "";
long qq = 0;
long uid = 0;
if (groupAt != null)
{
e = groupAt;
@ -57,29 +61,48 @@ namespace Oshima.FunGame.WebAPI.Services
string isGroup = e.IsGroup ? "群聊" : "私聊";
openid = e.AuthorOpenId;
if (QQOpenID.QQAndOpenID.TryGetValue(openid, out long temp_qq))
if (MemoryCache.TryGetValue(openid, out object? value) && value is long uidTemp)
{
qq = temp_qq;
uid = uidTemp;
}
else
{
using SQLHelper? sql = Factory.OpenFactory.GetSQLHelper();
if (sql != null)
{
sql.ExecuteDataSet(FunGameService.Select_CheckAutoKey(sql, openid));
if (sql.Success)
{
User user = Factory.GetUser(sql.DataSet);
uid = user.Id;
MemoryCache.Set(openid, uid, TimeSpan.FromMinutes(10));
}
}
}
if (e.Detail.StartsWith("绑定"))
{
string detail = e.Detail.Replace("绑定", "");
string msg = "";
if (long.TryParse(detail, out temp_qq))
{
msg = NetworkUtility.JsonDeserialize<string>(QQController.Bind(new(openid, temp_qq))) ?? "";
}
else
{
msg = "绑定失败请提供一个正确的QQ号";
}
await SendAsync(e, "绑定", msg);
}
//if (QQOpenID.QQAndOpenID.TryGetValue(openid, out long temp_qq))
//{
// qq = temp_qq;
//}
//if (e.Detail.StartsWith("绑定"))
//{
// string detail = e.Detail.Replace("绑定", "");
// string msg = "";
// if (long.TryParse(detail, out temp_qq))
// {
// msg = NetworkUtility.JsonDeserialize<string>(QQController.Bind(new(openid, temp_qq))) ?? "";
// }
// else
// {
// msg = "绑定失败请提供一个正确的QQ号";
// }
// await SendAsync(e, "绑定", msg);
//}
if (e.Detail == "帮助" || e.Detail == "帮助1")
{
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 6 页)
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 7 页)
11
2// []
3 <> []//////...
@ -97,7 +120,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助2")
{
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 2 / 6 页)
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 2 / 7 页)
12 <> <>
13 <> <>
* 1////1/2
@ -114,7 +137,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助3")
{
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 3 / 6 页)
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 3 / 7 页)
22 []
23 []
23 <> <>
@ -132,7 +155,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助4")
{
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 4 / 6 页)
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 4 / 7 页)
33 <>1=200
34
35
@ -148,7 +171,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助5")
{
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 5 / 6 页)
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 5 / 7 页)
43
44 <>
45
@ -163,7 +186,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "帮助6")
{
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 6 / 6 页)
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 6 / 7 页)
52
53 <>
54退
@ -175,7 +198,17 @@ namespace Oshima.FunGame.WebAPI.Services
59 <@>/<QQ号
60 <@>/<QQ号
61 <@>/<QQ号
62 <> <{...}>");
62 <> <{...}>
7 7 ");
}
if (e.Detail == "帮助7")
{
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 7 / 7 页)
63
64 <>
65 <>
66");
}
if (e.Detail.StartsWith("FunGame模拟", StringComparison.CurrentCultureIgnoreCase))
@ -345,7 +378,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("查技能", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetSkillInfo(qq, id)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetSkillInfo(uid, id)) ?? "";
if (msg != "")
{
await SendAsync(e, "查技能", msg);
@ -353,7 +386,7 @@ namespace Oshima.FunGame.WebAPI.Services
}
else
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetSkillInfo_Name(qq, detail)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetSkillInfo_Name(uid, detail)) ?? "";
if (msg != "")
{
await SendAsync(e, "查技能", msg);
@ -367,7 +400,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("查物品", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetItemInfo(qq, id)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetItemInfo(uid, id)) ?? "";
if (msg != "")
{
await SendAsync(e, "查物品", msg);
@ -375,7 +408,7 @@ namespace Oshima.FunGame.WebAPI.Services
}
else
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetItemInfo_Name(qq, detail)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetItemInfo_Name(uid, detail)) ?? "";
if (msg != "")
{
await SendAsync(e, "查物品", msg);
@ -395,7 +428,7 @@ namespace Oshima.FunGame.WebAPI.Services
int count = int.Parse(match.Groups[1].Value);
string name = match.Groups[2].Value.Trim();
string target = match.Groups[3].Value;
long userid = qq;
long userid = uid;
if (!string.IsNullOrEmpty(target))
{
@ -404,7 +437,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (count > 0)
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateItem(qq, name, count, userid)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateItem(uid, name, count, userid)) ?? "";
if (msg != "")
{
await SendAsync(e, "熟圣之力", msg);
@ -439,7 +472,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "创建存档")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateSaved(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateSaved(name: openid)) ?? "";
if (msg != "")
{
await SendAsync(e, "创建存档", "\r\n" + msg);
@ -449,7 +482,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "我的存档")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowSaved(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowSaved(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "我的存档", "\r\n" + msg);
@ -459,7 +492,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "我的主战")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(qq, 0)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(uid, 0)) ?? "";
if (msg != "")
{
await SendAsync(e, "我的主战", "\r\n" + msg);
@ -469,7 +502,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "我的状态")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowMainCharacterOrSquadStatus(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowMainCharacterOrSquadStatus(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "我的状态", "\r\n" + msg);
@ -479,7 +512,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "小队状态" || e.Detail == "我的小队状态")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowMainCharacterOrSquadStatus(qq, true)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowMainCharacterOrSquadStatus(uid, true)) ?? "";
if (msg != "")
{
await SendAsync(e, "我的小队状态", "\r\n" + msg);
@ -489,7 +522,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "我的小队")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowSquad(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowSquad(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "我的小队", "\r\n" + msg);
@ -499,7 +532,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "清空小队")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ClearSquad(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ClearSquad(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "清空小队", "\r\n" + msg);
@ -509,7 +542,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "还原存档")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RestoreSaved(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RestoreSaved(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "还原存档", "\r\n" + msg);
@ -519,7 +552,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "生成自建角色")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.NewCustomCharacter(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.NewCustomCharacter(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "抽卡", "\r\n" + msg);
@ -529,7 +562,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "角色改名")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ReName(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ReName(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "改名", "\r\n" + msg);
@ -539,7 +572,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "角色重随")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RandomCustomCharacter(qq, false)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RandomCustomCharacter(uid, false)) ?? "";
if (msg != "")
{
await SendAsync(e, "角色重随", "\r\n" + msg);
@ -549,7 +582,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "确认角色重随")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RandomCustomCharacter(qq, true)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RandomCustomCharacter(uid, true)) ?? "";
if (msg != "")
{
await SendAsync(e, "角色重随", "\r\n" + msg);
@ -559,7 +592,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "取消角色重随")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CancelRandomCustomCharacter(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CancelRandomCustomCharacter(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "角色重随", "\r\n" + msg);
@ -569,7 +602,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "抽卡")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DrawCard(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DrawCard(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "抽卡", "\r\n" + msg);
@ -579,7 +612,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "十连抽卡")
{
List<string> msgs = Controller.DrawCards(qq);
List<string> msgs = Controller.DrawCards(uid);
if (msgs.Count > 0)
{
await SendAsync(e, "十连抽卡", "\r\n" + string.Join("\r\n", msgs));
@ -589,7 +622,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "材料抽卡")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DrawCard_Material(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DrawCard_Material(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "材料抽卡", "\r\n" + msg);
@ -599,7 +632,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "材料十连抽卡")
{
List<string> msgs = Controller.DrawCards_Material(qq);
List<string> msgs = Controller.DrawCards_Material(uid);
if (msgs.Count > 0)
{
await SendAsync(e, "材料十连抽卡", "\r\n" + string.Join("\r\n", msgs));
@ -613,7 +646,7 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (int.TryParse(detail, out int page))
{
msgs = Controller.GetInventoryInfo2(qq, page);
msgs = Controller.GetInventoryInfo2(uid, page);
}
else if (FunGameItemType.FirstOrDefault(detail.Contains) is string matchedType)
{
@ -621,16 +654,16 @@ namespace Oshima.FunGame.WebAPI.Services
string remain = detail.Replace(matchedType, "").Trim();
if (int.TryParse(remain, out page))
{
msgs = Controller.GetInventoryInfo4(qq, page, typeIndex);
msgs = Controller.GetInventoryInfo4(uid, page, typeIndex);
}
else
{
msgs = Controller.GetInventoryInfo4(qq, 1, typeIndex);
msgs = Controller.GetInventoryInfo4(uid, 1, typeIndex);
}
}
else
{
msgs = Controller.GetInventoryInfo2(qq, 1);
msgs = Controller.GetInventoryInfo2(uid, 1);
}
if (msgs.Count > 0)
{
@ -645,11 +678,11 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (int.TryParse(detail, out int page))
{
msgs = Controller.GetInventoryInfo3(qq, page, 2, 2);
msgs = Controller.GetInventoryInfo3(uid, page, 2, 2);
}
else
{
msgs = Controller.GetInventoryInfo3(qq, 1, 2, 2);
msgs = Controller.GetInventoryInfo3(uid, 1, 2, 2);
}
if (msgs.Count > 0)
{
@ -664,11 +697,11 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (int.TryParse(detail, out int page))
{
msgs = Controller.GetInventoryInfo5(qq, page);
msgs = Controller.GetInventoryInfo5(uid, page);
}
else
{
msgs = Controller.GetInventoryInfo5(qq, 1);
msgs = Controller.GetInventoryInfo5(uid, 1);
}
if (msgs.Count > 0)
{
@ -687,11 +720,11 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (strings.Length > 1 && int.TryParse(strings[1].Trim(), out int page))
{
msgs = Controller.GetInventoryInfo4(qq, page, t);
msgs = Controller.GetInventoryInfo4(uid, page, t);
}
else
{
msgs = Controller.GetInventoryInfo4(qq, 1, t);
msgs = Controller.GetInventoryInfo4(uid, 1, t);
}
if (msgs.Count > 0)
{
@ -707,11 +740,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int seq))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(qq, seq, true)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(uid, seq, true)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(qq, 1, true)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(uid, 1, true)) ?? "";
}
if (msg != "")
{
@ -726,11 +759,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int seq))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(qq, seq, false)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(uid, seq, false)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(qq, 1, false)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterInfoFromInventory(uid, 1, false)) ?? "";
}
if (msg != "")
{
@ -745,11 +778,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int seq))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterSkills(qq, seq)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterSkills(uid, seq)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterSkills(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterSkills(uid, 1)) ?? "";
}
if (msg != "")
{
@ -764,11 +797,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int seq))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterItems(qq, seq)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterItems(uid, seq)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterItems(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetCharacterItems(uid, 1)) ?? "";
}
if (msg != "")
{
@ -783,11 +816,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int cid))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.SetMain(qq, cid)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.SetMain(uid, cid)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.SetMain(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.SetMain(uid, 1)) ?? "";
}
if (msg != "")
{
@ -802,11 +835,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int cid))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.StartTraining(qq, cid)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.StartTraining(uid, cid)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.StartTraining(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.StartTraining(uid, 1)) ?? "";
}
if (msg != "")
{
@ -817,7 +850,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "练级信息")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetTrainingInfo(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetTrainingInfo(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "练级信息", "\r\n" + msg);
@ -827,7 +860,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "练级结算")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.StopTraining(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.StopTraining(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "练级结算", "\r\n" + msg);
@ -837,7 +870,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "任务列表")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CheckQuestList(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CheckQuestList(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "任务列表", "\r\n" + msg);
@ -847,7 +880,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "任务信息")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CheckWorkingQuest(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CheckWorkingQuest(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "任务信息", "\r\n" + msg);
@ -857,7 +890,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "任务结算")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SettleQuest(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SettleQuest(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "任务结算", "\r\n" + msg);
@ -867,7 +900,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "签到")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SignIn(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SignIn(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "签到", "\r\n" + msg);
@ -880,7 +913,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("开始任务", "").Trim();
if (int.TryParse(detail, out int index))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.AcceptQuest(qq, index)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.AcceptQuest(uid, index)) ?? "";
if (msg != "")
{
await SendAsync(e, "开始任务", msg);
@ -894,7 +927,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("我的物品", "").Trim();
if (int.TryParse(detail, out int index))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetItemInfoFromInventory(qq, index)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetItemInfoFromInventory(uid, index)) ?? "";
if (msg != "")
{
await SendAsync(e, "查库存物品", msg);
@ -908,7 +941,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("兑换金币", "").Trim();
if (int.TryParse(detail, out int materials))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ExchangeCredits(qq, materials)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ExchangeCredits(uid, materials)) ?? "";
if (msg != "")
{
await SendAsync(e, "兑换金币", msg);
@ -926,7 +959,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
if (c != -1 && i != -1)
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UnEquipItem(qq, c, i)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UnEquipItem(uid, c, i)) ?? "";
if (msg != "")
{
await SendAsync(e, "取消装备", msg);
@ -945,7 +978,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
if (c != -1 && i != -1)
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.EquipItem(qq, c, i)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.EquipItem(uid, c, i)) ?? "";
if (msg != "")
{
await SendAsync(e, "装备", msg);
@ -965,7 +998,7 @@ namespace Oshima.FunGame.WebAPI.Services
string s = strings[1].Trim();
if (c != -1 && s != "")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetSkillLevelUpNeedy(qq, c, s)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.GetSkillLevelUpNeedy(uid, c, s)) ?? "";
if (msg != "")
{
await SendAsync(e, "查看技能升级", msg);
@ -985,7 +1018,7 @@ namespace Oshima.FunGame.WebAPI.Services
string s = strings[1].Trim();
if (c != -1 && s != "")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SkillLevelUp(qq, c, s)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SkillLevelUp(uid, c, s)) ?? "";
if (msg != "")
{
await SendAsync(e, "技能升级", msg);
@ -1004,7 +1037,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
if (id1 != -1 && id2 != -1 && id3 != -1)
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ConflateMagicCardPack(qq, [id1, id2, id3])) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ConflateMagicCardPack(uid, [id1, id2, id3])) ?? "";
if (msg != "")
{
await SendAsync(e, "合成魔法卡", msg);
@ -1020,11 +1053,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int cid))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelUp(qq, cid)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelUp(uid, cid)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelUp(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelUp(uid, 1)) ?? "";
}
if (msg != "")
{
@ -1039,11 +1072,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int cid))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetNormalAttackLevelUpNeedy(qq, cid)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetNormalAttackLevelUpNeedy(uid, cid)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetNormalAttackLevelUpNeedy(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetNormalAttackLevelUpNeedy(uid, 1)) ?? "";
}
if (msg != "")
{
@ -1058,11 +1091,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int cid))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.NormalAttackLevelUp(qq, cid)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.NormalAttackLevelUp(uid, cid)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.NormalAttackLevelUp(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.NormalAttackLevelUp(uid, 1)) ?? "";
}
if (msg != "")
{
@ -1077,11 +1110,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int cid))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelBreak(qq, cid)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelBreak(uid, cid)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelBreak(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.CharacterLevelBreak(uid, 1)) ?? "";
}
if (msg != "")
{
@ -1096,11 +1129,11 @@ namespace Oshima.FunGame.WebAPI.Services
string msg = "";
if (int.TryParse(detail, out int cid))
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetLevelBreakNeedy(qq, cid)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetLevelBreakNeedy(uid, cid)) ?? "";
}
else
{
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetLevelBreakNeedy(qq, 1)) ?? "";
msg = NetworkUtility.JsonDeserialize<string>(Controller.GetLevelBreakNeedy(uid, 1)) ?? "";
}
if (msg != "")
{
@ -1125,7 +1158,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
if (id > 0 && id2 > 0)
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem3(qq, id, id2, isCharacter)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem3(uid, id, id2, isCharacter)) ?? "";
if (msg != "")
{
await SendAsync(e, "使用魔法卡", msg);
@ -1146,7 +1179,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
string characterIdsString = match.Groups["characterIds"].Value;
int[] characterIds = characterIdsString != "" ? [.. characterIdsString.Split(chars, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)] : [1];
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem2(qq, itemName, count, characterIds)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem2(uid, itemName, count, characterIds)) ?? "";
if (msg != "")
{
await SendAsync(e, "使用", msg);
@ -1163,7 +1196,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
string characterIdsString = match.Groups["characterIds"].Value;
int[] characterIds = characterIdsString != "" ? [.. characterIdsString.Split(chars, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)] : [1];
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem(qq, itemId, characterIds)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem(uid, itemId, characterIds)) ?? "";
if (msg != "")
{
await SendAsync(e, "使用", msg);
@ -1179,7 +1212,7 @@ namespace Oshima.FunGame.WebAPI.Services
string itemName = match.Groups["itemName"].Value.Trim();
if (int.TryParse(match.Groups["count"].Value, out int count))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem2(qq, itemName, count)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem2(uid, itemName, count)) ?? "";
if (msg != "")
{
await SendAsync(e, "使用", msg);
@ -1194,7 +1227,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
if (int.TryParse(match.Groups["itemId"].Value, out int itemId))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem(qq, itemId)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.UseItem(uid, itemId)) ?? "";
if (msg != "")
{
await SendAsync(e, "使用", msg);
@ -1220,7 +1253,7 @@ namespace Oshima.FunGame.WebAPI.Services
ids.Add(id);
}
}
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DecomposeItem(qq, [.. ids])) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DecomposeItem(uid, [.. ids])) ?? "";
if (msg != "")
{
await SendAsync(e, "分解物品", msg);
@ -1239,7 +1272,7 @@ namespace Oshima.FunGame.WebAPI.Services
string itemName = match.Groups["itemName"].Value.Trim();
if (int.TryParse(match.Groups["count"].Value, out int count))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DecomposeItem2(qq, itemName, count)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DecomposeItem2(uid, itemName, count)) ?? "";
if (msg != "")
{
await SendAsync(e, "分解", msg);
@ -1255,7 +1288,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("品质分解", "").Trim();
if (int.TryParse(detail, out int q))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DecomposeItem3(qq, q)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DecomposeItem3(uid, q)) ?? "";
if (msg != "")
{
await SendAsync(e, "品质分解", msg);
@ -1275,12 +1308,12 @@ namespace Oshima.FunGame.WebAPI.Services
string name = strings[0].Trim();
if (count > 0)
{
long userid = qq;
long userid = uid;
if (strings.Length > 2 && long.TryParse(strings[2].Replace("@", "").Trim(), out long temp))
{
userid = temp;
}
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateItem(qq, name, count, userid)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateItem(uid, name, count, userid)) ?? "";
if (msg != "")
{
await SendAsync(e, "熟圣之力", msg);
@ -1300,11 +1333,11 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (long.TryParse(detail.Trim(), out long eqq))
{
msgs = Controller.FightCustom(qq, eqq, true);
msgs = Controller.FightCustom(uid, eqq, true);
}
else
{
msgs = Controller.FightCustom2(qq, detail.Trim(), true);
msgs = Controller.FightCustom2(uid, detail.Trim(), true);
}
List<string> real = [];
if (msgs.Count >= 2)
@ -1358,11 +1391,11 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (long.TryParse(detail.Trim(), out long eqq))
{
msgs = Controller.FightCustom(qq, eqq, false);
msgs = Controller.FightCustom(uid, eqq, false);
}
else
{
msgs = Controller.FightCustom2(qq, detail.Trim(), false);
msgs = Controller.FightCustom2(uid, detail.Trim(), false);
}
List<string> real = [];
if (msgs.Count > 2)
@ -1409,11 +1442,11 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (long.TryParse(detail.Trim(), out long eqq))
{
msgs = Controller.FightCustomTeam(qq, eqq, true);
msgs = Controller.FightCustomTeam(uid, eqq, true);
}
else
{
msgs = Controller.FightCustomTeam2(qq, detail.Trim(), true);
msgs = Controller.FightCustomTeam2(uid, detail.Trim(), true);
}
List<string> real = [];
if (msgs.Count >= 3)
@ -1487,7 +1520,7 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (int.TryParse(detail.Trim(), out int index))
{
msgs = Controller.FightBossTeam(qq, index, true);
msgs = Controller.FightBossTeam(uid, index, true);
List<string> real = [];
if (msgs.Count >= 3)
{
@ -1546,7 +1579,7 @@ namespace Oshima.FunGame.WebAPI.Services
List<string> msgs = [];
if (int.TryParse(detail.Trim(), out int index))
{
msgs = Controller.FightBoss(qq, index, true);
msgs = Controller.FightBoss(uid, index, true);
List<string> real = [];
if (msgs.Count >= 3)
{
@ -1604,7 +1637,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("小队添加", "").Trim();
if (int.TryParse(detail, out int c))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.AddSquad(qq, c)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.AddSquad(uid, c)) ?? "";
if (msg != "")
{
await SendAsync(e, "小队", msg);
@ -1618,7 +1651,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("小队移除", "").Trim();
if (int.TryParse(detail, out int c))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RemoveSquad(qq, c)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.RemoveSquad(uid, c)) ?? "";
if (msg != "")
{
await SendAsync(e, "小队", msg);
@ -1639,7 +1672,7 @@ namespace Oshima.FunGame.WebAPI.Services
cindexs.Add(c);
}
}
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SetSquad(qq, [.. cindexs])) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.SetSquad(uid, [.. cindexs])) ?? "";
if (msg != "")
{
await SendAsync(e, "小队", msg);
@ -1652,7 +1685,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("加入社团", "").Trim();
if (int.TryParse(detail, out int c))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.JoinClub(qq, c)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.JoinClub(uid, c)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", msg);
@ -1670,7 +1703,7 @@ namespace Oshima.FunGame.WebAPI.Services
isPublic = false;
}
detail = detail.Replace("私密", "").Trim();
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateClub(qq, isPublic, detail)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.CreateClub(uid, isPublic, detail)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", msg);
@ -1680,7 +1713,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "退出社团")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.QuitClub(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.QuitClub(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", "\r\n" + msg);
@ -1690,7 +1723,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "我的社团")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubInfo(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubInfo(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", "\r\n" + msg);
@ -1700,7 +1733,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "解散社团")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DisbandClub(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DisbandClub(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", "\r\n" + msg);
@ -1710,7 +1743,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "查看社团成员")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubMemberList(qq, 0)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubMemberList(uid, 0)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", "\r\n" + msg);
@ -1720,7 +1753,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "查看社团管理")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubMemberList(qq, 1)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubMemberList(uid, 1)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", "\r\n" + msg);
@ -1730,7 +1763,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "查看申请人列表")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubMemberList(qq, 2)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowClubMemberList(uid, 2)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", "\r\n" + msg);
@ -1743,7 +1776,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("社团批准", "").Replace("@", "").Trim();
if (long.TryParse(detail, out long id))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ApproveClub(qq, id, true)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ApproveClub(uid, id, true)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", msg);
@ -1757,7 +1790,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("社团拒绝", "").Replace("@", "").Trim();
if (long.TryParse(detail, out long id))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ApproveClub(qq, id, false)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ApproveClub(uid, id, false)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", msg);
@ -1771,7 +1804,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("社团踢出", "").Replace("@", "").Trim();
if (long.TryParse(detail, out long id))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.KickClub(qq, id)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.KickClub(uid, id)) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", msg);
@ -1803,7 +1836,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
args = [.. strings[1..]];
}
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ChangeClub(qq, part, [.. args])) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ChangeClub(uid, part, [.. args])) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", msg);
@ -1816,7 +1849,7 @@ namespace Oshima.FunGame.WebAPI.Services
{
string detail = e.Detail.Replace("社团转让", "").Replace("@", "").Trim();
List<string> args = [detail];
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ChangeClub(qq, "setmaster", [.. args])) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ChangeClub(uid, "setmaster", [.. args])) ?? "";
if (msg != "")
{
await SendAsync(e, "社团", msg);
@ -1826,7 +1859,7 @@ namespace Oshima.FunGame.WebAPI.Services
if (e.Detail == "每日商店")
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowDailyStore(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.ShowDailyStore(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "商店", "\r\n" + msg);
@ -1839,7 +1872,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("商店购买", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DailyStoreBuy(qq, id)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DailyStoreBuy(uid, id)) ?? "";
if (msg != "")
{
await SendAsync(e, "商店", msg);
@ -1853,7 +1886,7 @@ namespace Oshima.FunGame.WebAPI.Services
string detail = e.Detail.Replace("商店查看", "").Trim();
if (int.TryParse(detail, out int id))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DailyStoreShowInfo(qq, id)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.DailyStoreShowInfo(uid, id)) ?? "";
if (msg != "")
{
await SendAsync(e, "商店", msg);
@ -1862,9 +1895,9 @@ namespace Oshima.FunGame.WebAPI.Services
return result;
}
if (qq == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
if (uid == GeneralSettings.Master && e.Detail.StartsWith("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
{
string msg = NetworkUtility.JsonDeserialize<string>(Controller.Relaod(qq)) ?? "";
string msg = NetworkUtility.JsonDeserialize<string>(Controller.Relaod(uid)) ?? "";
if (msg != "")
{
await SendAsync(e, "重载FunGame", msg);