Initial commit

This commit is contained in:
Mikhail Thompson
2024-06-26 19:03:44 +03:00
commit 838240de58
72 changed files with 4171 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.LobbyServer.Msgs.User
{
[PacketPath("/User/SetScenarioComplete")]
public class SetScenarioCompleted : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
var req = await ReadData<ReqSetScenarioComplete>();
var response = new ResSetScenarioComplete();
// Mark the story "scenario" as completed.
// TODO: Get rewards by making a database of them from actual server.
response.Reward = new NetRewardData();
var user = JsonDb.GetUser(UserId);
if (user == null)
{
throw new Exception("null user in SetScenarioComplete command");
}
user.CompletedScenarios.Add(req.ScenarioId);
JsonDb.Save();
WriteData(response);
}
}
}