mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2025-04-22 11:59:35 +08:00
优化任务计划、更新游戏平衡常数、添加经验值显示等
This commit is contained in:
parent
cfc21eb960
commit
154f837962
@ -1124,7 +1124,7 @@ namespace Oshima.Core.Controllers
|
||||
Character character = user.Inventory.Characters.ToList()[cIndex - 1];
|
||||
if (isSimple)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize($"这是你库存中序号为 {cIndex} 的角色简略信息:\r\n{character.GetSimpleInfo().Trim()}");
|
||||
return NetworkUtility.JsonSerialize($"这是你库存中序号为 {cIndex} 的角色简略信息:\r\n{character.GetSimpleInfo(showEXP: true).Trim()}");
|
||||
}
|
||||
return NetworkUtility.JsonSerialize($"这是你库存中序号为 {cIndex} 的角色详细信息:\r\n{character.GetInfo().Trim()}");
|
||||
}
|
||||
@ -1340,7 +1340,7 @@ namespace Oshima.Core.Controllers
|
||||
return [$"对方似乎还没有自建角色,请发送【生成自建角色】创建!"];
|
||||
}
|
||||
|
||||
return FunGameActionQueue.StartGame([character1, character2], false, false, false, false);
|
||||
return FunGameActionQueue.StartGame([character1, character2], false, false, false, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1381,7 +1381,7 @@ namespace Oshima.Core.Controllers
|
||||
if (master != null && master == GeneralSettings.Master)
|
||||
{
|
||||
FunGameService.Reload();
|
||||
FunGameActionQueue.InitFunGame();
|
||||
FunGameActionQueue.InitFunGameActionQueue();
|
||||
return NetworkUtility.JsonSerialize("FunGame已重新加载。");
|
||||
}
|
||||
return NetworkUtility.JsonSerialize("提供的参数不正确。");
|
||||
|
@ -3,9 +3,11 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Library.Exception;
|
||||
using Milimoe.FunGame.Core.Library.SQLScript.Common;
|
||||
using Oshima.Core.Constant;
|
||||
using TaskScheduler = Milimoe.FunGame.Core.Api.Utility.TaskScheduler;
|
||||
|
||||
namespace Oshima.Core.Controllers
|
||||
{
|
||||
@ -51,5 +53,11 @@ namespace Oshima.Core.Controllers
|
||||
}
|
||||
return NetworkUtility.JsonSerialize("无法调用此接口。原因:与 SQL 服务器通信失败。");
|
||||
}
|
||||
|
||||
[HttpGet("gettask")]
|
||||
public string GetTaskScheduler(string name)
|
||||
{
|
||||
return NetworkUtility.JsonSerialize(TaskScheduler.Shared.GetRunTimeInfo(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Core.Library.Common.Addon;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Oshima.Core.Configs;
|
||||
using Oshima.Core.Constant;
|
||||
using Oshima.Core.Utils;
|
||||
using Oshima.FunGame.OshimaModules;
|
||||
using TaskScheduler = Milimoe.FunGame.Core.Api.Utility.TaskScheduler;
|
||||
|
||||
namespace Oshima.Core.WebAPI
|
||||
{
|
||||
@ -45,78 +47,39 @@ namespace Oshima.Core.WebAPI
|
||||
SayNo.InitSayNo();
|
||||
Ignore.InitIgnore();
|
||||
FunGameService.InitFunGame();
|
||||
FunGameActionQueue.InitFunGame();
|
||||
Task taskTime = Task.Factory.StartNew(async () =>
|
||||
FunGameActionQueue.InitFunGameActionQueue();
|
||||
List<(int start, int end, double expPerLevel)> levelRanges = [
|
||||
(1, 9, 1000),
|
||||
(10, 19, 1500),
|
||||
(20, 29, 2000),
|
||||
(30, 39, 3000),
|
||||
(40, 49, 4000),
|
||||
(50, 59, 5000)
|
||||
];
|
||||
foreach (var (start, end, expPerLevel) in levelRanges)
|
||||
{
|
||||
bool check9 = true;
|
||||
bool check15 = true;
|
||||
while (true)
|
||||
for (int level = start; level <= end; level++)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
if (now.Hour == 8 && now.Minute == 30 && !Daily.DailyNews)
|
||||
{
|
||||
Daily.DailyNews = true;
|
||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
General.GameplayEquilibriumConstant.EXPUpperLimit[level] = expPerLevel;
|
||||
}
|
||||
if (now.Hour == 8 && now.Minute == 31)
|
||||
{
|
||||
Daily.DailyNews = false;
|
||||
}
|
||||
if (now.Hour == 0 && now.Minute == 0 && Daily.ClearDailys)
|
||||
General.GameplayEquilibriumConstant.EXPUpperLimit[60] = 9999999999999;
|
||||
TaskScheduler.Shared.AddTask("重置每日运势", new TimeSpan(0, 0, 0), () =>
|
||||
{
|
||||
Daily.ClearDailys = false;
|
||||
// 清空运势
|
||||
Controller.WriteLine("已重置所有人的今日运势");
|
||||
Daily.ClearDaily();
|
||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
||||
Console.WriteLine("\r已重置所有人的今日运势。");
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Write("\r> ");
|
||||
}
|
||||
if (now.Hour == 0 && now.Minute == 1)
|
||||
{
|
||||
Daily.ClearDailys = true;
|
||||
}
|
||||
if (now.Hour == 9 && now.Minute == 0 && check9)
|
||||
{
|
||||
check9 = false;
|
||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
||||
Console.WriteLine("\r重置物品交易冷却时间。");
|
||||
await FunGameService.AllowSellAndTrade();
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Write("\r> ");
|
||||
}
|
||||
if (now.Hour == 9 && now.Minute == 1)
|
||||
{
|
||||
check9 = true;
|
||||
}
|
||||
if (now.Hour == 15 && now.Minute == 0 && check15)
|
||||
{
|
||||
check15 = false;
|
||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
||||
Console.WriteLine("\r重置物品交易冷却时间。");
|
||||
await FunGameService.AllowSellAndTrade();
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Write("\r> ");
|
||||
}
|
||||
if (now.Hour == 15 && now.Minute == 1)
|
||||
{
|
||||
check15 = true;
|
||||
}
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("\r" + e);
|
||||
Console.ForegroundColor = ConsoleColor.Gray;
|
||||
Console.Write("\r> ");
|
||||
}
|
||||
}
|
||||
});
|
||||
Milimoe.FunGame.Core.Api.Utility.TaskScheduler.Shared.AddRecurringTask("刷新存档缓存", TimeSpan.FromSeconds(20), () =>
|
||||
TaskScheduler.Shared.AddTask("重置交易冷却1", new TimeSpan(9, 0, 0), () =>
|
||||
{
|
||||
Controller.WriteLine("重置物品交易冷却时间");
|
||||
_ = FunGameService.AllowSellAndTrade();
|
||||
});
|
||||
TaskScheduler.Shared.AddTask("重置交易冷却2", new TimeSpan(15, 0, 0), () =>
|
||||
{
|
||||
Controller.WriteLine("重置物品交易冷却时间");
|
||||
_ = FunGameService.AllowSellAndTrade();
|
||||
});
|
||||
TaskScheduler.Shared.AddRecurringTask("刷新存档缓存", TimeSpan.FromSeconds(20), () =>
|
||||
{
|
||||
string directoryPath = $@"{AppDomain.CurrentDomain.BaseDirectory}configs/saved";
|
||||
if (Directory.Exists(directoryPath))
|
||||
|
@ -20,7 +20,7 @@ namespace Oshima.Core.Utils
|
||||
public static bool DeathMatchRoundDetail { get; set; } = false;
|
||||
public static string Msg { get; set; } = "";
|
||||
|
||||
public static void InitFunGame()
|
||||
public static void InitFunGameActionQueue()
|
||||
{
|
||||
CharacterStatistics.Clear();
|
||||
TeamCharacterStatistics.Clear();
|
||||
@ -387,6 +387,22 @@ namespace Oshima.Core.Utils
|
||||
|
||||
// 赛后统计
|
||||
GetCharacterRating(actionQueue.CharacterStatistics, isTeam, actionQueue.EliminatedTeams);
|
||||
|
||||
// 统计技术得分,评选 MVP
|
||||
Character? mvp = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
||||
StringBuilder mvpBuilder = new();
|
||||
if (mvp != null)
|
||||
{
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[mvp];
|
||||
stats.MVPs++;
|
||||
mvpBuilder.AppendLine($"{(isTeam ? "[ " + actionQueue.GetTeamFromEliminated(mvp)?.Name + " ] " : "")}[ {mvp.ToStringWithLevel()} ]");
|
||||
mvpBuilder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}");
|
||||
mvpBuilder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
||||
mvpBuilder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}");
|
||||
mvpBuilder.AppendLine($"总承受伤害:{stats.TotalTakenDamage} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage} / 总承受魔法伤害:{stats.TotalTakenMagicDamage}");
|
||||
mvpBuilder.Append($"每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}");
|
||||
}
|
||||
|
||||
int top = isWeb ? actionQueue.CharacterStatistics.Count : 0; // 回执多少个角色的统计信息
|
||||
int count = 1;
|
||||
if (isWeb)
|
||||
@ -398,28 +414,14 @@ namespace Oshima.Core.Utils
|
||||
{
|
||||
WriteLine("=== 本场比赛最佳角色 ===");
|
||||
Msg = $"=== 本场比赛最佳角色 ===\r\n";
|
||||
// 统计技术得分
|
||||
Character? character = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
||||
if (character != null)
|
||||
{
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[character];
|
||||
stats.MVPs++;
|
||||
StringBuilder builder = new();
|
||||
builder.AppendLine($"{(isWeb ? count + "." : (isTeam ? "[ " + actionQueue.GetTeamFromEliminated(character)?.Name + " ]" ?? "" : ""))} [ {character.ToStringWithLevel()} ]");
|
||||
builder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}");
|
||||
builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
||||
builder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}");
|
||||
builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage} / 总承受魔法伤害:{stats.TotalTakenMagicDamage}");
|
||||
builder.Append($"每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}");
|
||||
WriteLine(builder.ToString());
|
||||
}
|
||||
}
|
||||
WriteLine(mvpBuilder.ToString());
|
||||
|
||||
if (PrintOut)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("=== 技术得分排行榜 ===");
|
||||
}
|
||||
}
|
||||
|
||||
if (isTeam)
|
||||
{
|
||||
@ -559,7 +561,7 @@ namespace Oshima.Core.Utils
|
||||
}
|
||||
}
|
||||
|
||||
public static List<string> StartGame(List<Character> characters, bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false)
|
||||
public static List<string> StartGame(List<Character> characters, bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false)
|
||||
{
|
||||
PrintOut = printout;
|
||||
IsWeb = isWeb;
|
||||
@ -739,7 +741,7 @@ namespace Oshima.Core.Utils
|
||||
break;
|
||||
}
|
||||
|
||||
actionQueue.DisplayQueue();
|
||||
if (showRoundEndDetail) actionQueue.DisplayQueue();
|
||||
WriteLine("");
|
||||
}
|
||||
|
||||
@ -777,43 +779,24 @@ namespace Oshima.Core.Utils
|
||||
|
||||
// 赛后统计
|
||||
GetCharacterRating(actionQueue.CharacterStatistics, isTeam, actionQueue.EliminatedTeams);
|
||||
|
||||
// 统计技术得分,评选 MVP
|
||||
Character? mvp = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
||||
StringBuilder mvpBuilder = new();
|
||||
if (mvp != null)
|
||||
{
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[mvp];
|
||||
stats.MVPs++;
|
||||
mvpBuilder.AppendLine($"{(isTeam ? "[ " + actionQueue.GetTeamFromEliminated(mvp)?.Name + " ] " : "")}[ {mvp.ToStringWithLevel()} ]");
|
||||
mvpBuilder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}");
|
||||
mvpBuilder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
||||
mvpBuilder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}");
|
||||
mvpBuilder.AppendLine($"总承受伤害:{stats.TotalTakenDamage} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage} / 总承受魔法伤害:{stats.TotalTakenMagicDamage}");
|
||||
mvpBuilder.Append($"每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}");
|
||||
}
|
||||
|
||||
int top = isWeb ? actionQueue.CharacterStatistics.Count : 2; // 回执多少个角色的统计信息
|
||||
int count = 1;
|
||||
if (isWeb)
|
||||
{
|
||||
WriteLine("=== 技术得分排行榜 ==="); // 这是输出在界面上的
|
||||
Msg = $"=== 技术得分排行榜 TOP{top} ===\r\n"; // 这个是下一条给Result回执的标题,覆盖掉上面方法里的赋值了
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isTeam)
|
||||
{
|
||||
WriteLine("=== 本场比赛最佳角色 ===");
|
||||
Msg = $"=== 本场比赛最佳角色 ===\r\n";
|
||||
// 统计技术得分
|
||||
Character? character = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault();
|
||||
if (character != null)
|
||||
{
|
||||
CharacterStatistics stats = actionQueue.CharacterStatistics[character];
|
||||
stats.MVPs++;
|
||||
StringBuilder builder = new();
|
||||
builder.AppendLine($"{(isTeam ? "[ " + actionQueue.GetTeamFromEliminated(character)?.Name + " ] " : "")}[ {character.ToStringWithLevel()} ]");
|
||||
builder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}");
|
||||
builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
|
||||
builder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}");
|
||||
builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage} / 总承受魔法伤害:{stats.TotalTakenMagicDamage}");
|
||||
builder.Append($"每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}");
|
||||
WriteLine(builder.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PrintOut)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("=== 技术得分排行榜 ===");
|
||||
}
|
||||
|
||||
Msg = $"=== 技术得分排行榜 TOP{top} ===\r\n";
|
||||
|
||||
if (isTeam)
|
||||
|
@ -357,6 +357,8 @@ namespace Oshima.Core.Utils
|
||||
Equipment.Clear();
|
||||
Skills.Clear();
|
||||
Magics.Clear();
|
||||
AllItems.Clear();
|
||||
ItemSkills.Clear();
|
||||
|
||||
InitFunGame();
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace Oshima.FunGame.OshimaModules.Characters
|
||||
Name = name;
|
||||
FirstName = firstname;
|
||||
NickName = nickname;
|
||||
PrimaryAttribute = (PrimaryAttribute)Random.Shared.Next(4);
|
||||
PrimaryAttribute = (PrimaryAttribute)Random.Shared.Next(1, 4);
|
||||
InitialATK = Random.Shared.Next(15, 26);
|
||||
InitialHP = Random.Shared.Next(40, 86);
|
||||
InitialMP = Random.Shared.Next(20, 56);
|
||||
|
Loading…
x
Reference in New Issue
Block a user