mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-15 08:24:52 +01:00
Initial commit
This commit is contained in:
35
nksrv/LobbyServer/Msgs/User/SetScenarioCompleted.cs
Normal file
35
nksrv/LobbyServer/Msgs/User/SetScenarioCompleted.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user