Various bug fixes

Fix sim room system error
Added stub for obtain item in field
Properly save tutorial data
This commit is contained in:
Mikhail
2024-07-05 09:51:26 -04:00
parent 18102b9922
commit b4cc603343
9 changed files with 121 additions and 15 deletions

View File

@@ -123,12 +123,13 @@ namespace nksrv.LobbyServer
};
// Restore completed tutorials. GroupID is the first 4 digits of the Table ID.
foreach (var item in user.ClearedTutorials)
// Restore completed tutorials.
foreach (var item in user.ClearedTutorialData)
{
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 });
int groupId = item.Value.GroupId;
int version = item.Value.VersionGroup;
ret.Tutorials.Add(new NetTutorialData() { GroupId = groupId, LastClearedTid = groupId, LastClearedVersion = version });
}
return ret;

View File

@@ -0,0 +1,26 @@
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.LobbyServer.Msgs.Campaign
{
[PacketPath("/campaign/obtain/item")]
public class ObtainItem : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
var req = await ReadData<ReqObtainCampaignItem>();
var user = GetUser();
var response = new ResObtainCampaignItem();
// TODO
response.Reward = new();
WriteData(response);
}
}
}

View File

@@ -0,0 +1,22 @@
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.LobbyServer.Msgs.Simroom
{
[PacketPath("/simroom/get")]
public class GetSimRoomData : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
var req = await ReadData<ReqGetSimRoom>();
var response = new ResGetSimRoom();
// TODO
WriteData(response);
}
}
}

View File

@@ -34,12 +34,14 @@ namespace nksrv.LobbyServer.Msgs.User
response.LastClearedNormalMainStageId = user.LastNormalStageCleared;
// Restore completed tutorials. GroupID is the first 4 digits of the Table ID.
foreach (var item in user.ClearedTutorials)
foreach (var item in user.ClearedTutorialData)
{
var groupId = int.Parse(item.ToString().Substring(0, 4));
int tutorialVersion = item == 1020101 ? 1 : 0; // TODO
response.User.Tutorials.Add(new NetTutorialData() { GroupId = groupId, LastClearedTid = item, LastClearedVersion = tutorialVersion });
int groupId = item.Value.GroupId;
int version = item.Value.VersionGroup;
response.User.Tutorials.Add(new NetTutorialData() { GroupId = groupId, LastClearedTid = groupId, LastClearedVersion = version });
}
response.CommanderRoomJukeboxBgm = new NetJukeboxBgm() { JukeboxTableId = 2, Type = NetJukeboxBgmType.JukeboxTableId, Location = NetJukeboxLocation.CommanderRoom };
response.LobbyJukeboxBgm = new NetJukeboxBgm() { JukeboxTableId = 2, Type = NetJukeboxBgmType.JukeboxTableId, Location = NetJukeboxLocation.Lobby };

View File

@@ -1,4 +1,5 @@
using nksrv.Utils;
using nksrv.StaticInfo;
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,8 +15,12 @@ namespace nksrv.LobbyServer.Msgs.User.Tutorial
{
var req = await ReadData<ReqSetTutorial>();
var user = GetUser();
if (!user.ClearedTutorials.Contains(req.LastClearedTid))
user.ClearedTutorials.Add(req.LastClearedTid);
if (!user.ClearedTutorialData.ContainsKey(req.LastClearedTid))
{
var cleared = StaticDataParser.Instance.GetTutorialDataById(req.LastClearedTid);
user.ClearedTutorialData.Add(req.LastClearedTid, cleared);
}
JsonDb.Save();
var response = new ResSetTutorial();