mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 12:23:59 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a9ae13da0 | ||
|
|
1938095ea5 | ||
|
|
132355d76b |
14
Common/Data/Excel/RoleLevelExcel.cs
Normal file
14
Common/Data/Excel/RoleLevelExcel.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
namespace MikuSB.Data.Excel;
|
||||||
|
|
||||||
|
[ResourceEntity("challenge/role/level.json")]
|
||||||
|
public class RoleLevelExcel : ExcelResource
|
||||||
|
{
|
||||||
|
public uint ID { get; set; }
|
||||||
|
|
||||||
|
public override uint GetId() => ID;
|
||||||
|
|
||||||
|
public override void Loaded()
|
||||||
|
{
|
||||||
|
GameData.RoleLevelData[ID] = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ public static class GameData
|
|||||||
public static Dictionary<int, BreakLevelLimitExcel> BreakLevelLimitData { get; private set; } = [];
|
public static Dictionary<int, BreakLevelLimitExcel> BreakLevelLimitData { get; private set; } = [];
|
||||||
public static Dictionary<int, RecycleExcel> RecycleData { get; private set; } = [];
|
public static Dictionary<int, RecycleExcel> RecycleData { get; private set; } = [];
|
||||||
public static Dictionary<uint, ChapterLevelExcel> ChapterLevelData { get; private set; } = [];
|
public static Dictionary<uint, ChapterLevelExcel> ChapterLevelData { get; private set; } = [];
|
||||||
|
public static Dictionary<uint, RoleLevelExcel> RoleLevelData { get; private set; } = [];
|
||||||
public static Dictionary<uint, ArItemExcel> ArItemData { get; private set; } = [];
|
public static Dictionary<uint, ArItemExcel> ArItemData { get; private set; } = [];
|
||||||
public static Dictionary<uint, ManifestationExcel> ManifestationData { get; private set; } = [];
|
public static Dictionary<uint, ManifestationExcel> ManifestationData { get; private set; } = [];
|
||||||
public static Dictionary<uint, Rogue3DDifficultExcel> Rogue3DDifficultData { get; private set; } = [];
|
public static Dictionary<uint, Rogue3DDifficultExcel> Rogue3DDifficultData { get; private set; } = [];
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public class PlayerInstance(PlayerGameData data)
|
|||||||
return proto;
|
return proto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Proto.Player ToPlayerProto()
|
public Proto.Player ToPlayerProto(bool includeSupportCards = true)
|
||||||
{
|
{
|
||||||
BuildPlayerAttr();
|
BuildPlayerAttr();
|
||||||
var displayName = PlayerGameData.NormalizeDisplayName(Data.Name);
|
var displayName = PlayerGameData.NormalizeDisplayName(Data.Name);
|
||||||
@@ -217,7 +217,10 @@ public class PlayerInstance(PlayerGameData data)
|
|||||||
foreach (var item in InventoryManager.InventoryData.Items.Values) proto.Items.Add(item.ToProto());
|
foreach (var item in InventoryManager.InventoryData.Items.Values) proto.Items.Add(item.ToProto());
|
||||||
foreach (var skin in InventoryManager.InventoryData.Skins.Values) proto.Items.Add(skin.ToProto());
|
foreach (var skin in InventoryManager.InventoryData.Skins.Values) proto.Items.Add(skin.ToProto());
|
||||||
foreach (var weapon in InventoryManager.InventoryData.Weapons.Values) proto.Items.Add(weapon.ToProto());
|
foreach (var weapon in InventoryManager.InventoryData.Weapons.Values) proto.Items.Add(weapon.ToProto());
|
||||||
|
if (includeSupportCards)
|
||||||
|
{
|
||||||
foreach (var card in InventoryManager.InventoryData.SupportCards.Values) proto.Items.Add(card.ToProto());
|
foreach (var card in InventoryManager.InventoryData.SupportCards.Values) proto.Items.Add(card.ToProto());
|
||||||
|
}
|
||||||
foreach (var x in Data.Attrs)
|
foreach (var x in Data.Attrs)
|
||||||
{
|
{
|
||||||
uint gid = x.Gid;
|
uint gid = x.Gid;
|
||||||
@@ -422,6 +425,14 @@ public class PlayerInstance(PlayerGameData data)
|
|||||||
yield return (22, levelId, 1_700_000_000);
|
yield return (22, levelId, 1_700_000_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Role fragment chapters use Condition.PRE_LEVEL against Launch.GPASSID as well.
|
||||||
|
// Mark every role level as cleared so character-specific stages beyond the first one unlock.
|
||||||
|
foreach (var levelId in GameData.RoleLevelData.Keys)
|
||||||
|
{
|
||||||
|
yield return (21, levelId, 7);
|
||||||
|
yield return (22, levelId, 1_700_000_000);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var guide in GameData.GuideData.Values)
|
foreach (var guide in GameData.GuideData.Values)
|
||||||
{
|
{
|
||||||
yield return (4, guide.ID, 999);
|
yield return (4, guide.ID, 999);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace MikuSB.GameServer.Server.Packet.Recv.Login;
|
|||||||
public class HandlerReqLogin : Handler
|
public class HandlerReqLogin : Handler
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = new("ReqLogin");
|
private static readonly Logger Logger = new("ReqLogin");
|
||||||
|
private const int SupportCardLoginSplitThreshold = 2000;
|
||||||
|
|
||||||
private static string? ExtractSdkAuthToken(string? token)
|
private static string? ExtractSdkAuthToken(string? token)
|
||||||
{
|
{
|
||||||
@@ -80,7 +81,10 @@ public class HandlerReqLogin : Handler
|
|||||||
$"Debug-{DateTime.Now:yyyy-MM-dd HH-mm-ss}.log");
|
$"Debug-{DateTime.Now:yyyy-MM-dd HH-mm-ss}.log");
|
||||||
await connection.Player.OnEnterGame();
|
await connection.Player.OnEnterGame();
|
||||||
connection.Player.Connection = connection;
|
connection.Player.Connection = connection;
|
||||||
await connection.SendPacket(new PacketRspLogin(connection.Player!));
|
var splitSupportCards = connection.Player.InventoryManager.InventoryData.SupportCards.Count > SupportCardLoginSplitThreshold;
|
||||||
|
await connection.SendPacket(new PacketRspLogin(connection.Player!, !splitSupportCards));
|
||||||
|
if (splitSupportCards)
|
||||||
|
await SendSupportCardsOnLogin(connection);
|
||||||
await connection.SendPacket(new PacketNtfCallScript(connection.Player!));
|
await connection.SendPacket(new PacketNtfCallScript(connection.Player!));
|
||||||
await SendDebugLoginState(connection);
|
await SendDebugLoginState(connection);
|
||||||
|
|
||||||
@@ -90,6 +94,22 @@ public class HandlerReqLogin : Handler
|
|||||||
await SendGirlSkinTypeOnLogin(connection);
|
await SendGirlSkinTypeOnLogin(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async Task SendSupportCardsOnLogin(Connection connection)
|
||||||
|
{
|
||||||
|
var player = connection.Player;
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var supportCards = player.InventoryManager.InventoryData.SupportCards.Values.ToList();
|
||||||
|
Logger.Info($"Split support card sync on login: total={supportCards.Count}, chunkSize={SupportCardLoginSplitThreshold}");
|
||||||
|
|
||||||
|
foreach (var chunk in supportCards.Chunk(SupportCardLoginSplitThreshold))
|
||||||
|
{
|
||||||
|
var packet = new PacketNtfCallScript(chunk.ToList());
|
||||||
|
await connection.SendPacket(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void ApplySavedGirlSkinTypes(PlayerInstance player)
|
private static void ApplySavedGirlSkinTypes(PlayerInstance player)
|
||||||
{
|
{
|
||||||
var inventoryData = player.InventoryManager.InventoryData;
|
var inventoryData = player.InventoryManager.InventoryData;
|
||||||
|
|||||||
@@ -10,18 +10,41 @@ public class PacketRspLogin : BasePacket
|
|||||||
{
|
{
|
||||||
private static readonly Logger Logger = new("RspLogin");
|
private static readonly Logger Logger = new("RspLogin");
|
||||||
|
|
||||||
public PacketRspLogin(PlayerInstance player) : base(CmdIds.RspLogin)
|
public PacketRspLogin(PlayerInstance player, bool includeSupportCards = true) : base(CmdIds.RspLogin)
|
||||||
{
|
{
|
||||||
|
var characterCount = player.CharacterManager.CharacterData.Characters.Count;
|
||||||
|
var itemCount = player.InventoryManager.InventoryData.Items.Count;
|
||||||
|
var skinCount = player.InventoryManager.InventoryData.Skins.Count;
|
||||||
|
var weaponCount = player.InventoryManager.InventoryData.Weapons.Count;
|
||||||
|
var supportCardCount = player.InventoryManager.InventoryData.SupportCards.Count;
|
||||||
|
var attrCount = player.Data.Attrs.Count;
|
||||||
|
var strAttrCount = player.Data.StrAttrs.Count;
|
||||||
|
var showItemCount = player.Data.ShowItems.Count;
|
||||||
|
|
||||||
var proto = new RspLogin
|
var proto = new RspLogin
|
||||||
{
|
{
|
||||||
Timestamp = (uint)Extensions.GetUnixSec(),
|
Timestamp = (uint)Extensions.GetUnixSec(),
|
||||||
WorldChannel = 1,
|
WorldChannel = 1,
|
||||||
AreaId = 1,
|
AreaId = 1,
|
||||||
Data = player.ToPlayerProto(),
|
Data = player.ToPlayerProto(includeSupportCards),
|
||||||
NeedRename = false
|
NeedRename = false
|
||||||
};
|
};
|
||||||
|
|
||||||
var bytes = Google.Protobuf.MessageExtensions.ToByteArray(proto);
|
var bytes = Google.Protobuf.MessageExtensions.ToByteArray(proto);
|
||||||
|
Logger.Info(
|
||||||
|
"RspLogin content: " +
|
||||||
|
$"characters={characterCount}, " +
|
||||||
|
$"items={itemCount}, " +
|
||||||
|
$"skins={skinCount}, " +
|
||||||
|
$"weapons={weaponCount}, " +
|
||||||
|
$"supportCards={supportCardCount}, " +
|
||||||
|
$"supportCardsInRspLogin={(includeSupportCards ? supportCardCount : 0)}, " +
|
||||||
|
$"attrs={attrCount}, " +
|
||||||
|
$"strAttrs={strAttrCount}, " +
|
||||||
|
$"showItems={showItemCount}, " +
|
||||||
|
$"protoItems={proto.Data.Items.Count}, " +
|
||||||
|
$"protoAttrs={proto.Data.Attrs.Count}, " +
|
||||||
|
$"protoStrAttrs={proto.Data.StrAttrs.Count}");
|
||||||
Logger.Info($"RspLogin proto size: {bytes.Length} bytes");
|
Logger.Info($"RspLogin proto size: {bytes.Length} bytes");
|
||||||
|
|
||||||
SetData(bytes);
|
SetData(bytes);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v=3.4
|
v=3.6
|
||||||
Reference in New Issue
Block a user