add additional messages

This commit is contained in:
Mikhail
2024-07-20 11:02:19 -04:00
parent 22d19cf38b
commit dea8d98db4
9 changed files with 160 additions and 6 deletions

View File

@@ -114,7 +114,6 @@ namespace nksrv.LobbyServer
LobbyJukebox = 2,
InfraCoreExp = user.InfraCoreExp,
InfraCoreLv = user.InfraCoreLvl,
};

View File

@@ -0,0 +1,30 @@
using nksrv.Net;
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.LobbyServer.Msgs.Liberate
{
[PacketPath("/liberate/choosecharacter")]
public class ChooseCharacter : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
var req = await ReadData<ChooseLiberateCharacterRequest>();
var user = GetUser();
var response = new ChooseLiberateCharacterResponse();
// TODO
response.Data = new NetLiberateData() { CharacterId = req.CharacterId };
response.Data.MissionData.Add(new NetLiberateMissionData() { MissionState = LiberateMissionState.Running, Id = 1 });
response.Data.MissionData.Add(new NetLiberateMissionData() { MissionState = LiberateMissionState.Running, Id = 2 });
response.Data.MissionData.Add(new NetLiberateMissionData() { MissionState = LiberateMissionState.Running, Id = 3 });
await WriteDataAsync(response);
}
}
}

View File

@@ -0,0 +1,26 @@
using nksrv.Net;
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.LobbyServer.Msgs.Liberate
{
[PacketPath("/liberate/getprogresslist")]
public class GetProgressList : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
var req = await ReadData<GetLiberateProgressListRequest>();
var user = GetUser();
var response = new GetLiberateProgressListResponse();
// TODO
await WriteDataAsync(response);
}
}
}

View File

@@ -10,7 +10,7 @@ namespace nksrv.LobbyServer.Msgs.Shop
{
try
{
var x = await ReadData<ReqGetJupiterProductList>(); //todo: causes crash
var x = await ReadData<ReqGetJupiterProductList>();
var response = new ResGetJupiterProductList();
foreach (var item in x.ProductIdList)

View File

@@ -0,0 +1,25 @@
using nksrv.Net;
using nksrv.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.LobbyServer.Msgs.Shop
{
[PacketPath("/shop/get")]
public class GetShop : LobbyMsgHandler
{
protected override async Task HandleAsync()
{
var x = await ReadData<GetShopRequest>();
var response = new GetShopResponse();
// TODO
await WriteDataAsync(response);
}
}
}

View File

@@ -0,0 +1,34 @@
syntax = "proto3";
option csharp_namespace = "nksrv.Net";
import "google/protobuf/timestamp.proto";
import "google/protobuf/Duration.proto";
import "Protos/allmsgs.proto";
enum LiberateDataExpiredError {
LIBERATE_DATA_EXPIRED_ERROR_SUCCESS = 0;
LIBERATE_DATA_EXPIRED_ERROR_EXPIRED = 1;
}
message NetLiberateProgressData {
int32 CharacterId = 1;
int32 Step = 2;
int32 ProgressPoint = 3;
int32 RewardedCount = 4;
bool IsCompleted = 5;
}
message GetLiberateProgressListRequest {}
message GetLiberateProgressListResponse {
repeated NetLiberateProgressData ProgressData = 1;
}
message ChooseLiberateCharacterRequest {
int32 CharacterId = 2;
}
message ChooseLiberateCharacterResponse {
NetLiberateData data = 1;
LiberateDataExpiredError Error = 2;
}

35
nksrv/Protos/shop.proto Normal file
View File

@@ -0,0 +1,35 @@
syntax = "proto3";
option csharp_namespace = "nksrv.Net";
import "google/protobuf/timestamp.proto";
import "google/protobuf/Duration.proto";
message NetShopProductInfoData {
int32 Order = 1;
int32 ProductId = 2;
int32 BuyLimitCount = 3;
int32 BuyCount = 4;
int32 CorpType = 5;
int32 Discount = 6;
int64 EndAt = 7;
bool UseDateCondition = 8;
}
message NetShopProductData {
int32 ShopTid = 1;
int32 ShopCategory = 2;
int32 RenewCount = 3;
int64 RenewAt = 4;
int64 NextRenewAt = 5;
int32 FreeRenewCount = 6;
repeated NetShopProductInfoData List = 7;
}
message GetShopRequest {
int32 ShopCategory = 1;
}
message GetShopResponse {
NetShopProductData Shop = 1;
}

View File

@@ -25,7 +25,6 @@ namespace nksrv.Utils
public class Character
{
// TODO
public int Csn = 0;
public int Tid = 0;
public int CostumeId = 0;
@@ -86,8 +85,7 @@ namespace nksrv.Utils
public Dictionary<string, FieldInfoNew> FieldInfoNew = [];
public Dictionary<string, string> MapJson = [];
public Dictionary<CurrencyType, long> Currency = new() {
{ CurrencyType.ContentStamina, 2 },
{ CurrencyType.CharPremiumTicket, 999999 }
{ CurrencyType.ContentStamina, 2 }
};
public List<ItemData> Items = new();
@@ -206,8 +204,10 @@ namespace nksrv.Utils
internal class JsonDb
{
public static CoreInfo Instance { get; internal set; }
// Note: change this in sodium
public static byte[] ServerPrivateKey = Convert.FromBase64String("FSUY8Ohd942n5LWAfxn6slK3YGwc8OqmyJoJup9nNos=");
public static byte[] ServerPublicKey = Convert.FromBase64String("04hFDd1e/BOEF2h4b0MdkX2h6W5REeqyW+0r9+eSeh0="); // Note: change this in sodium
public static byte[] ServerPublicKey = Convert.FromBase64String("04hFDd1e/BOEF2h4b0MdkX2h6W5REeqyW+0r9+eSeh0=");
static JsonDb()
{

View File

@@ -29,6 +29,11 @@
<Protobuf Include="Protos\*.*" GrpcServices="Server" />
</ItemGroup>
<ItemGroup>
<None Remove="Protos\liberate.proto" />
<None Remove="Protos\shop.proto" />
</ItemGroup>
<ItemGroup>
<None Update="gameconfig.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>