commit code from airplane

This commit is contained in:
Mikhail Thompson
2024-06-30 12:24:36 -04:00
parent 2e3ed14c93
commit e81893c8f2
20 changed files with 317 additions and 145 deletions

View File

@@ -3,6 +3,7 @@ using EmbedIO;
using Google.Protobuf;
using nksrv.Utils;
using Swan.Logging;
using static Google.Rpc.Context.AttributeContext.Types;
namespace nksrv.LobbyServer
{
@@ -105,6 +106,47 @@ namespace nksrv.LobbyServer
{
// By calling this function, we force .NET to initialize handler dictanary to catch errors early on.
}
public static NetUserData CreateNetUserDataFromUser(User user)
{
NetUserData ret = new()
{
Lv = 1,
CommanderRoomJukebox = 5,
CostumeLv = 1,
Frame = 1,
Icon = user.ProfileIconId,
IconPrism = user.ProfileIconIsPrism,
LobbyJukebox = 2,
InfraCoreExp = user.InfraCoreExp,
InfraCoreLv = user.InfraCoreLvl,
};
// Restore completed tutorials. GroupID is the first 4 digits of the Table ID.
foreach (var item in user.ClearedTutorials)
{
var groupId = int.Parse(item.ToString().Substring(0, 4));
int tutorialVersion = item == 1020101 ? 1 : 0; // TODO: Read from static data
ret.Tutorials.Add(new NetTutorialData() { GroupId = groupId, LastClearedTid = item, LastClearedVersion = tutorialVersion });
}
return ret;
}
public static NetWholeUserData CreateWholeUserDataFromDbUser(User user)
{
var ret = new NetWholeUserData()
{
Lv = 1,
Frame = 1,
Icon = user.ProfileIconId,
IconPrism = user.ProfileIconIsPrism,
Nickname = user.Nickname,
Usn = (long)user.ID
};
return ret;
}
}
public class GameClientInfo