mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 13:43:58 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e628a010be | ||
|
|
738a7d4e14 | ||
|
|
0058ba0db6 | ||
|
|
46d945f3ce | ||
|
|
e5ecdc7f2a | ||
|
|
30c52b6aa8 | ||
|
|
3ffb7ebf29 |
27
Common/Data/Excel/SupportAffixExcel.cs
Normal file
27
Common/Data/Excel/SupportAffixExcel.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace MikuSB.Data.Excel;
|
||||||
|
|
||||||
|
[ResourceEntity("item/support/affix.json")]
|
||||||
|
public class SupportAffixExcel : ExcelResource
|
||||||
|
{
|
||||||
|
[JsonProperty("ID")] public int Id { get; set; }
|
||||||
|
[JsonExtensionData] public IDictionary<string, JToken> ExtraData { get; set; } = new Dictionary<string, JToken>();
|
||||||
|
|
||||||
|
public int TierCount =>
|
||||||
|
ExtraData
|
||||||
|
.Where(x => x.Key != "ID" && x.Key != "Sift" && x.Key != "Comment")
|
||||||
|
.Select(x => x.Value)
|
||||||
|
.OfType<JObject>()
|
||||||
|
.Select(x => x.Count)
|
||||||
|
.DefaultIfEmpty(0)
|
||||||
|
.Max();
|
||||||
|
|
||||||
|
public override uint GetId() => (uint)Id;
|
||||||
|
|
||||||
|
public override void Loaded()
|
||||||
|
{
|
||||||
|
GameData.SupportAffixData[Id] = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
Common/Data/Excel/SupportAffixPoolExcel.cs
Normal file
35
Common/Data/Excel/SupportAffixPoolExcel.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace MikuSB.Data.Excel;
|
||||||
|
|
||||||
|
[ResourceEntity("item/support/affix_pool.json")]
|
||||||
|
public class SupportAffixPoolExcel : ExcelResource
|
||||||
|
{
|
||||||
|
[JsonProperty("ID")] public int Id { get; set; }
|
||||||
|
public List<int> AffixGroup1 { get; set; } = [];
|
||||||
|
public int Weight1 { get; set; }
|
||||||
|
public List<int> AffixGroup2 { get; set; } = [];
|
||||||
|
public int Weight2 { get; set; }
|
||||||
|
public List<int> AffixGroup3 { get; set; } = [];
|
||||||
|
public int Weight3 { get; set; }
|
||||||
|
public List<int> AffixGroup4 { get; set; } = [];
|
||||||
|
public int Weight4 { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<(IReadOnlyList<int> Affixs, int Weight)> Groups
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (AffixGroup1.Count > 0 && Weight1 > 0) yield return (AffixGroup1, Weight1);
|
||||||
|
if (AffixGroup2.Count > 0 && Weight2 > 0) yield return (AffixGroup2, Weight2);
|
||||||
|
if (AffixGroup3.Count > 0 && Weight3 > 0) yield return (AffixGroup3, Weight3);
|
||||||
|
if (AffixGroup4.Count > 0 && Weight4 > 0) yield return (AffixGroup4, Weight4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override uint GetId() => (uint)Id;
|
||||||
|
|
||||||
|
public override void Loaded()
|
||||||
|
{
|
||||||
|
GameData.SupportAffixPoolData[Id] = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,9 @@ public class SupportCardExcel : ExcelResource
|
|||||||
public uint Level { get; set; }
|
public uint Level { get; set; }
|
||||||
public uint Icon { get; set; }
|
public uint Icon { get; set; }
|
||||||
public uint ProvideExp { get; set; }
|
public uint ProvideExp { get; set; }
|
||||||
|
public uint Color { get; set; }
|
||||||
[JsonProperty("LevelLimitID")] public int LevelLimitId { get; set; }
|
[JsonProperty("LevelLimitID")] public int LevelLimitId { get; set; }
|
||||||
|
[JsonProperty("AffixPool")] public List<int> AffixPool { get; set; } = [];
|
||||||
|
|
||||||
public uint MaxLevel => LevelLimitId switch
|
public uint MaxLevel => LevelLimitId switch
|
||||||
{
|
{
|
||||||
@@ -21,6 +23,12 @@ public class SupportCardExcel : ExcelResource
|
|||||||
_ => 10
|
_ => 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Number of affixes granted initially
|
||||||
|
public int InitialAffixCount => Color >= 5 ? 2 : 1;
|
||||||
|
|
||||||
|
// Total maximum affixes (including ones unlocked at max level)
|
||||||
|
public int TotalAffixCount => Color >= 5 ? 3 : 2;
|
||||||
|
|
||||||
public ulong TemplateId => GameResourceTemplateId.FromGdpl(Genre, Detail, Particular, Level);
|
public ulong TemplateId => GameResourceTemplateId.FromGdpl(Genre, Detail, Particular, Level);
|
||||||
|
|
||||||
public override uint GetId() => Icon;
|
public override uint GetId() => Icon;
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ public static class GameData
|
|||||||
public static Dictionary<uint, SpineExcel> SpineData { get; private set; } = [];
|
public static Dictionary<uint, SpineExcel> SpineData { get; private set; } = [];
|
||||||
public static Dictionary<uint, NodeConditionExcel> NodeConditionData { get; private set; } = [];
|
public static Dictionary<uint, NodeConditionExcel> NodeConditionData { get; private set; } = [];
|
||||||
public static List<SupportCardExcel> SupportCardData { get; private set; } = [];
|
public static List<SupportCardExcel> SupportCardData { get; private set; } = [];
|
||||||
|
public static Dictionary<int, SupportAffixExcel> SupportAffixData { get; private set; } = [];
|
||||||
|
public static Dictionary<int, SupportAffixPoolExcel> SupportAffixPoolData { get; private set; } = [];
|
||||||
public static Dictionary<uint, WeaponSkinExcel> WeaponSkinData { get; private set; } = [];
|
public static Dictionary<uint, WeaponSkinExcel> WeaponSkinData { get; private set; } = [];
|
||||||
public static Dictionary<uint, DailyLevelExcel> DailyLevelData { get; private set; } = [];
|
public static Dictionary<uint, DailyLevelExcel> DailyLevelData { get; private set; } = [];
|
||||||
public static Dictionary<uint, ProfileExcel> ProfileData { get; private set; } = [];
|
public static Dictionary<uint, ProfileExcel> ProfileData { get; private set; } = [];
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ public class GameSkinInfo : BaseGameItemInfo
|
|||||||
public class GameSupportCardInfo : BaseGameItemInfo
|
public class GameSupportCardInfo : BaseGameItemInfo
|
||||||
{
|
{
|
||||||
public uint AffixId { get; set; }
|
public uint AffixId { get; set; }
|
||||||
|
[SugarColumn(IsJson = true)] public List<uint> Affixs { get; set; } = [];
|
||||||
|
|
||||||
public override Item ToProto()
|
public override Item ToProto()
|
||||||
{
|
{
|
||||||
var proto = new Item
|
var proto = new Item
|
||||||
@@ -120,6 +122,7 @@ public class GameSupportCardInfo : BaseGameItemInfo
|
|||||||
Exp = Exp
|
Exp = Exp
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
proto.Enhance.Affixs.AddRange(Affixs);
|
||||||
proto.Slots[(uint)ItemSupportCardSlotTypeEnum.SLOT_AFFIXINDEX] = AffixId;
|
proto.Slots[(uint)ItemSupportCardSlotTypeEnum.SLOT_AFFIXINDEX] = AffixId;
|
||||||
return proto;
|
return proto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,9 +222,16 @@ public class HelpTextCHS
|
|||||||
public class AccountTextCHS
|
public class AccountTextCHS
|
||||||
{
|
{
|
||||||
public string Desc => "管理 SDK 登录使用的账号映射";
|
public string Desc => "管理 SDK 登录使用的账号映射";
|
||||||
public string Usage => "用法: /account create <邮箱> <UID>";
|
public string Usage =>
|
||||||
|
"用法: /account create <邮箱> <UID>\n" +
|
||||||
|
"用法: /account delete <邮箱|UID>\n" +
|
||||||
|
"用法: /account list";
|
||||||
public string Created => "已创建账号映射: {0} -> UID {1}";
|
public string Created => "已创建账号映射: {0} -> UID {1}";
|
||||||
public string CreateFailed => "创建账号映射失败: {0}";
|
public string CreateFailed => "创建账号映射失败: {0}";
|
||||||
|
public string Deleted => "已删除账号映射: {0} -> UID {1}";
|
||||||
|
public string DeleteFailed => "删除账号映射失败: {0}";
|
||||||
|
public string DeleteOnline => "账号在线时无法删除: {0} -> UID {1}";
|
||||||
|
public string NotFound => "未找到账号: {0}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -222,9 +222,16 @@ public class HelpTextCHT
|
|||||||
public class AccountTextCHT
|
public class AccountTextCHT
|
||||||
{
|
{
|
||||||
public string Desc => "管理 SDK 登入使用的帳號映射";
|
public string Desc => "管理 SDK 登入使用的帳號映射";
|
||||||
public string Usage => "用法: /account create <郵箱> <UID>";
|
public string Usage =>
|
||||||
|
"用法: /account create <郵箱> <UID>\n" +
|
||||||
|
"用法: /account delete <郵箱|UID>\n" +
|
||||||
|
"用法: /account list";
|
||||||
public string Created => "已建立帳號映射: {0} -> UID {1}";
|
public string Created => "已建立帳號映射: {0} -> UID {1}";
|
||||||
public string CreateFailed => "建立帳號映射失敗: {0}";
|
public string CreateFailed => "建立帳號映射失敗: {0}";
|
||||||
|
public string Deleted => "已刪除帳號映射: {0} -> UID {1}";
|
||||||
|
public string DeleteFailed => "刪除帳號映射失敗: {0}";
|
||||||
|
public string DeleteOnline => "帳號在線時無法刪除: {0} -> UID {1}";
|
||||||
|
public string NotFound => "未找到帳號: {0}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -188,9 +188,16 @@ public class HelpTextEN
|
|||||||
public class AccountTextEN
|
public class AccountTextEN
|
||||||
{
|
{
|
||||||
public string Desc => "Manage account mappings for SDK logins";
|
public string Desc => "Manage account mappings for SDK logins";
|
||||||
public string Usage => "Usage: /account create <email> <uid>";
|
public string Usage =>
|
||||||
|
"Usage: /account create <email> <uid>\n" +
|
||||||
|
"Usage: /account delete <email|uid>\n" +
|
||||||
|
"Usage: /account list";
|
||||||
public string Created => "Created account mapping: {0} -> UID {1}";
|
public string Created => "Created account mapping: {0} -> UID {1}";
|
||||||
public string CreateFailed => "Failed to create account mapping: {0}";
|
public string CreateFailed => "Failed to create account mapping: {0}";
|
||||||
|
public string Deleted => "Deleted account mapping: {0} -> UID {1}";
|
||||||
|
public string DeleteFailed => "Failed to delete account mapping: {0}";
|
||||||
|
public string DeleteOnline => "Cannot delete account while online: {0} -> UID {1}";
|
||||||
|
public string NotFound => "Account not found: {0}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using MikuSB.Database;
|
|||||||
using MikuSB.Database.Account;
|
using MikuSB.Database.Account;
|
||||||
using MikuSB.Enums.Player;
|
using MikuSB.Enums.Player;
|
||||||
using MikuSB.Internationalization;
|
using MikuSB.Internationalization;
|
||||||
|
using MikuSB.GameServer.Server;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace MikuSB.GameServer.Command.Commands;
|
namespace MikuSB.GameServer.Command.Commands;
|
||||||
@@ -37,6 +38,42 @@ public class CommandAccount : ICommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CommandMethod("delete")]
|
||||||
|
public async ValueTask Delete(CommandArg arg)
|
||||||
|
{
|
||||||
|
if (!await arg.CheckArgCnt(1))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var identifier = arg.Args[0].Trim();
|
||||||
|
var account = int.TryParse(identifier, out var uid) && uid > 0
|
||||||
|
? AccountData.GetAccountByUid(uid)
|
||||||
|
: AccountData.GetAccountByUserName(identifier);
|
||||||
|
|
||||||
|
if (account == null)
|
||||||
|
{
|
||||||
|
await arg.SendMsg(I18NManager.Translate("Game.Command.Account.NotFound", identifier));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Listener.GetActiveConnection(account.Uid) != null)
|
||||||
|
{
|
||||||
|
await arg.SendMsg(I18NManager.Translate("Game.Command.Account.DeleteOnline", account.Username,
|
||||||
|
account.Uid.ToString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccountData.DeleteAccount(account.Uid);
|
||||||
|
await arg.SendMsg(I18NManager.Translate("Game.Command.Account.Deleted", account.Username,
|
||||||
|
account.Uid.ToString()));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await arg.SendMsg(I18NManager.Translate("Game.Command.Account.DeleteFailed", ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[CommandMethod("list")]
|
[CommandMethod("list")]
|
||||||
public async ValueTask List(CommandArg arg)
|
public async ValueTask List(CommandArg arg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using MikuSB.Database;
|
|||||||
using MikuSB.Database.Inventory;
|
using MikuSB.Database.Inventory;
|
||||||
using MikuSB.Enums.Item;
|
using MikuSB.Enums.Item;
|
||||||
using MikuSB.GameServer.Game.Player;
|
using MikuSB.GameServer.Game.Player;
|
||||||
|
using MikuSB.GameServer.Game.Support;
|
||||||
using MikuSB.GameServer.Server.Packet.Send.Misc;
|
using MikuSB.GameServer.Server.Packet.Send.Misc;
|
||||||
|
|
||||||
namespace MikuSB.GameServer.Game.Inventory;
|
namespace MikuSB.GameServer.Game.Inventory;
|
||||||
@@ -135,7 +136,18 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
|||||||
ItemType = genre,
|
ItemType = genre,
|
||||||
ItemCount = 1,
|
ItemCount = 1,
|
||||||
Level = cardLevel,
|
Level = cardLevel,
|
||||||
|
AffixId = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var affixCount = cardLevel >= spCard.MaxLevel ? spCard.TotalAffixCount : spCard.InitialAffixCount;
|
||||||
|
for (int i = 0; i < affixCount && i < spCard.AffixPool.Count; i++)
|
||||||
|
{
|
||||||
|
var (affixId, tier) = SupportAffixService.GenerateRandomAffix(spCard.AffixPool[i]);
|
||||||
|
if (affixId == 0) continue;
|
||||||
|
info.Affixs.Add(affixId);
|
||||||
|
info.Affixs.Add(tier);
|
||||||
|
}
|
||||||
|
|
||||||
InventoryData.SupportCards[info.UniqueId] = info;
|
InventoryData.SupportCards[info.UniqueId] = info;
|
||||||
|
|
||||||
if (sendPacket) await Player.SendPacket(new PacketNtfCallScript([info]));
|
if (sendPacket) await Player.SendPacket(new PacketNtfCallScript([info]));
|
||||||
|
|||||||
40
GameServer/Game/Support/SupportAffixService.cs
Normal file
40
GameServer/Game/Support/SupportAffixService.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using MikuSB.Data;
|
||||||
|
|
||||||
|
namespace MikuSB.GameServer.Game.Support;
|
||||||
|
|
||||||
|
public static class SupportAffixService
|
||||||
|
{
|
||||||
|
// Returns (affixId, tier) - both 1-based. Returns (0,0) if pool not found.
|
||||||
|
public static (uint AffixId, uint Tier) GenerateRandomAffix(int poolId)
|
||||||
|
{
|
||||||
|
if (!GameData.SupportAffixPoolData.TryGetValue(poolId, out var pool))
|
||||||
|
return (0, 0);
|
||||||
|
|
||||||
|
var groups = pool.Groups.ToList();
|
||||||
|
if (groups.Count == 0)
|
||||||
|
return (0, 0);
|
||||||
|
|
||||||
|
var totalWeight = groups.Sum(x => x.Weight);
|
||||||
|
var roll = Random.Shared.Next(totalWeight);
|
||||||
|
var cumulative = 0;
|
||||||
|
var selectedAffixs = groups[0].Affixs;
|
||||||
|
|
||||||
|
foreach (var (affixIds, weight) in groups)
|
||||||
|
{
|
||||||
|
cumulative += weight;
|
||||||
|
if (roll < cumulative)
|
||||||
|
{
|
||||||
|
selectedAffixs = affixIds;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedAffixs.Count == 0)
|
||||||
|
return (0, 0);
|
||||||
|
|
||||||
|
var affixId = selectedAffixs[Random.Shared.Next(selectedAffixs.Count)];
|
||||||
|
var tierCount = GameData.SupportAffixData.GetValueOrDefault(affixId)?.TierCount ?? 5;
|
||||||
|
var tier = (uint)(Random.Shared.Next(tierCount) + 1);
|
||||||
|
return ((uint)affixId, tier);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using MikuSB.Data;
|
using MikuSB.Data;
|
||||||
using MikuSB.Database;
|
using MikuSB.Database;
|
||||||
|
using MikuSB.GameServer.Game.Support;
|
||||||
using MikuSB.Proto;
|
using MikuSB.Proto;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
@@ -19,7 +20,7 @@ public class SupporterCard_Upgrade : ICallGSHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportCard = player.InventoryManager.InventoryData.Items.GetValueOrDefault((uint)req.SupportCardUid);
|
var supportCard = player.InventoryManager.GetSupportCardItem((uint)req.SupportCardUid);
|
||||||
if (supportCard == null)
|
if (supportCard == null)
|
||||||
{
|
{
|
||||||
await CallGSRouter.SendScript(connection, "Logistics_Upgrade", "{}");
|
await CallGSRouter.SendScript(connection, "Logistics_Upgrade", "{}");
|
||||||
@@ -68,10 +69,11 @@ public class SupporterCard_Upgrade : ICallGSHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply exp and level up
|
// Apply exp and level up
|
||||||
|
if (supportCard.Level == 0) supportCard.Level = 1;
|
||||||
supportCard.Exp += gainedExp;
|
supportCard.Exp += gainedExp;
|
||||||
while (supportCard.Level < maxLevel)
|
while (supportCard.Level < maxLevel)
|
||||||
{
|
{
|
||||||
var expNeeded = GetExpNeeded(supportCard.Level + 1);
|
var expNeeded = GetExpNeeded(supportCard.Level);
|
||||||
if (expNeeded == 0 || supportCard.Exp < expNeeded) break;
|
if (expNeeded == 0 || supportCard.Exp < expNeeded) break;
|
||||||
supportCard.Exp -= expNeeded;
|
supportCard.Exp -= expNeeded;
|
||||||
supportCard.Level++;
|
supportCard.Level++;
|
||||||
@@ -80,6 +82,23 @@ public class SupporterCard_Upgrade : ICallGSHandler
|
|||||||
{
|
{
|
||||||
supportCard.Exp = 0;
|
supportCard.Exp = 0;
|
||||||
supportCard.Level = maxLevel;
|
supportCard.Level = maxLevel;
|
||||||
|
|
||||||
|
// Unlock next affix slot when reaching max level for the first time
|
||||||
|
if (supportCardExcel != null)
|
||||||
|
{
|
||||||
|
var currentSlots = supportCard.Affixs.Count / 2;
|
||||||
|
var totalSlots = supportCardExcel.TotalAffixCount;
|
||||||
|
if (currentSlots < totalSlots && currentSlots < supportCardExcel.AffixPool.Count)
|
||||||
|
{
|
||||||
|
var poolId = supportCardExcel.AffixPool[currentSlots];
|
||||||
|
var (affixId, tier) = SupportAffixService.GenerateRandomAffix(poolId);
|
||||||
|
if (affixId > 0)
|
||||||
|
{
|
||||||
|
supportCard.Affixs.Add(affixId);
|
||||||
|
supportCard.Affixs.Add(tier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
syncItems.Add(supportCard.ToProto());
|
syncItems.Add(supportCard.ToProto());
|
||||||
|
|||||||
@@ -22,16 +22,35 @@ public class LoaderManager : MikuSB
|
|||||||
public static void InitConfig()
|
public static void InitConfig()
|
||||||
{
|
{
|
||||||
// Initialize log
|
// Initialize log
|
||||||
var counter = 0;
|
var logDir = ConfigManager.Config.Path.LogPath;
|
||||||
FileInfo file;
|
var logFile = new FileInfo(Path.Combine(logDir, "Server.log"));
|
||||||
while (true)
|
logFile.Directory?.Create();
|
||||||
|
|
||||||
|
if (logFile.Exists)
|
||||||
{
|
{
|
||||||
file = new FileInfo(ConfigManager.Config.Path.LogPath + $"/{DateTime.Now:yyyy-MM-dd}-{++counter}.log");
|
// Read start time from first log line, fall back to file creation time
|
||||||
if (file is not { Exists: false, Directory: not null }) continue;
|
DateTime logStartTime;
|
||||||
file.Directory.Create();
|
try
|
||||||
break;
|
{
|
||||||
|
var firstLine = File.ReadLines(logFile.FullName).FirstOrDefault() ?? "";
|
||||||
|
// Format: [HH:mm:ss] ...
|
||||||
|
var timeStr = firstLine.Length >= 10 ? firstLine[1..9] : "";
|
||||||
|
var dateStr = logFile.CreationTime.ToString("yyyy-MM-dd");
|
||||||
|
logStartTime = DateTime.TryParse($"{dateStr} {timeStr}", out var parsed)
|
||||||
|
? parsed
|
||||||
|
: logFile.CreationTime;
|
||||||
}
|
}
|
||||||
Logger.SetLogFile(file);
|
catch
|
||||||
|
{
|
||||||
|
logStartTime = logFile.CreationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
var backupName = $"Server-backup-{logStartTime:yyyy.MM.dd-HH.mm.ss}.log";
|
||||||
|
var backupFile = new FileInfo(Path.Combine(logDir, backupName));
|
||||||
|
logFile.MoveTo(backupFile.FullName, overwrite: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.SetLogFile(new FileInfo(Path.Combine(logDir, "Server.log")));
|
||||||
|
|
||||||
// Init all directories
|
// Init all directories
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -270,13 +270,13 @@ public class RouteController : ControllerBase
|
|||||||
var finalEmail = email ?? form_email ?? await GetJsonBodyValue("email");
|
var finalEmail = email ?? form_email ?? await GetJsonBodyValue("email");
|
||||||
if (!string.IsNullOrWhiteSpace(finalEmail))
|
if (!string.IsNullOrWhiteSpace(finalEmail))
|
||||||
{
|
{
|
||||||
var username = finalEmail.Split('@')[0];
|
var normalizedEmail = finalEmail.Trim();
|
||||||
var accountData = AccountData.GetAccountByUserName(username);
|
var accountData = AccountData.GetAccountByEmail(normalizedEmail);
|
||||||
if (accountData == null)
|
if (accountData == null)
|
||||||
{
|
{
|
||||||
if (!ConfigManager.Config.ServerOption.AutoCreateUser) return BuildLoginFailedResponse("Account not found.");
|
if (!ConfigManager.Config.ServerOption.AutoCreateUser) return BuildLoginFailedResponse("Account not found.");
|
||||||
AccountData.CreateAccount(username, 0, "123456");
|
AccountData.CreateAccount(normalizedEmail, 0, "123456");
|
||||||
accountData = AccountData.GetAccountByUserName(username)!;
|
accountData = AccountData.GetAccountByEmail(normalizedEmail)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
var finalUidValue = accountData.Uid.ToString();
|
var finalUidValue = accountData.Uid.ToString();
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v=3.0
|
v=3.1
|
||||||
Reference in New Issue
Block a user