161 lines
4.9 KiB
C#
161 lines
4.9 KiB
C#
using Amazon.DynamoDBv2.DocumentModel;
|
|
using GameServer;
|
|
using Google.Protobuf.WellKnownTypes;
|
|
using Nettention.Proud;
|
|
using Newtonsoft.Json;
|
|
using ServerCommon;
|
|
using ServerCommon.BusinessLogDomain;
|
|
using ServerCore; using ServerBase;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Dynamic;
|
|
using System.Numerics;
|
|
using static ClientToGameReq.Types;
|
|
|
|
namespace GameServer
|
|
{
|
|
public partial class ClientSession
|
|
{
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
private async Task processAfterReward(Object player, QuestBaseInfo baseInfo)
|
|
{
|
|
var questidList = baseInfo.AssignableQuestsAfterEnd;
|
|
|
|
List<int> mailQuests = new();
|
|
|
|
foreach (int nextQuestId in questidList)
|
|
{
|
|
|
|
if (nextQuesInfo.AssignType.Equals(nameof(EAssignType.MAIL)) && nextQuesInfo.ForceAccept == false)
|
|
{
|
|
mailQuests.Add(nextQuestId);
|
|
continue;
|
|
}
|
|
else if (nextQuesInfo.AssignType.Equals(nameof(EAssignType.MAIL)) && nextQuesInfo.ForceAccept == true)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
if (mailQuests.Count > 0)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
void HandleGetQuestMailReq(GetQuestMailReq req)
|
|
{
|
|
ClientToGame clientToGame = new();
|
|
clientToGame.Response = new();
|
|
clientToGame.Response.GetQuestMailRes = new();
|
|
clientToGame.Response.ErrorCode = ServerErrorCode.Success;
|
|
|
|
if (_selectedChar == null)
|
|
{
|
|
Log.getLogger().error("_selectedChar is null");
|
|
clientToGame.Response.ErrorCode = ServerErrorCode.ServerLogicError;
|
|
Send(RmiContext.ReliableSend, clientToGame);
|
|
return;
|
|
}
|
|
|
|
var questMails = _selectedChar.ownedQuestMail.GetQuestMailList();
|
|
clientToGame.Response.GetQuestMailRes.QuestMailList.AddRange(questMails);
|
|
|
|
Send(RmiContext.ReliableSend, clientToGame);
|
|
|
|
}
|
|
|
|
async Task HandleReadQuestMailReq(ReadQuestMailReq message)
|
|
{
|
|
ClientToGame clientToGame = new ClientToGame();
|
|
clientToGame.Response = new ClientToGameRes();
|
|
clientToGame.Response.ReadQuestMailRes = new ClientToGameRes.Types.ReadQuestMailRes();
|
|
|
|
if (_selectedChar == null)
|
|
{
|
|
Log.getLogger().error("_selectChar is null", ToString());
|
|
clientToGame.Response.ErrorCode = ServerErrorCode.ServerLogicError;
|
|
Send(RmiContext.ReliableSend, clientToGame);
|
|
return;
|
|
}
|
|
|
|
ServerErrorCode errorCode = _selectedChar.ownedQuestMail.ReadQuestMail(message.QuestId, out var newQuestMailEntity);
|
|
if (errorCode != ServerErrorCode.Success || newQuestMailEntity == null)
|
|
{
|
|
Log.getLogger().error($"HandleReadQuestMailReq Failed");
|
|
clientToGame.Response.ErrorCode = errorCode;
|
|
Send(RmiContext.ReliableSend, clientToGame);
|
|
return;
|
|
}
|
|
|
|
if (await GameServerApp.Instance.MainDB.UpdateQuestMail(new List<QuestMailEntity>() { newQuestMailEntity }) == false)
|
|
{
|
|
Log.getLogger().error($"DB UpdateMail Failed. questId : {message.QuestId}");
|
|
clientToGame.Response.ErrorCode = ServerErrorCode.DbUpdateFailed;
|
|
Send(RmiContext.ReliableSend, clientToGame);
|
|
return;
|
|
}
|
|
|
|
_selectedChar.ownedQuestMail.UpdateQuestMailToMemory(message.QuestId, newQuestMailEntity);
|
|
|
|
Send(RmiContext.ReliableSend, clientToGame);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task CheatQuestComplete(int questId)
|
|
{
|
|
if (_selectedChar is null)
|
|
{
|
|
Log.getLogger().error("HandleQuestReset _selectedChar is null");
|
|
return;
|
|
}
|
|
|
|
_selectedChar.ownedQuestList.cheatQuestComplete(questId, out var newQuestListEntity);
|
|
|
|
List<DBDocumentInfo> dBDocumentInfos = new();
|
|
Document newDocument = newQuestListEntity.DocumentForUpdate();
|
|
dBDocumentInfos.Add(new DBDocumentInfo(newDocument, EDBExecuteType.Update));
|
|
|
|
if (await GameServerApp.Instance.MainDB.Transaction(dBDocumentInfos, 2) == false)
|
|
{
|
|
Log.getLogger().error($"HandleQuestAcceptReq DB Update Failed.");
|
|
return;
|
|
}
|
|
_selectedChar.ownedQuestList.UpdateDBToMemory(newDocument);
|
|
|
|
|
|
}
|
|
|
|
public async Task cheatQuestMailSend(int questId)
|
|
{
|
|
if (_selectedChar is null)
|
|
{
|
|
Log.getLogger().error("HandleQuestReset _selectedChar is null");
|
|
return;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
}
|
|
}
|