63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
using Google.Protobuf.WellKnownTypes;
|
|
using Nettention.Proud;
|
|
using ServerCommon;
|
|
using ServerCommon.Cache;
|
|
using ServerCore; using ServerBase;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace GameServer
|
|
{
|
|
public class ConfirmNewFriendInterlockAction : FriendInterlockBase
|
|
{
|
|
|
|
public ConfirmNewFriendInterlockAction(UserBase owner, string myGuid, string friendGuid) : base(owner, myGuid, friendGuid)
|
|
{
|
|
|
|
}
|
|
|
|
public override async Task<Result> doAction()
|
|
{
|
|
var owner = getOwner();
|
|
var result = await owner.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "ConfirmNewFriend", delegateConfirmNewFriend);
|
|
return result;
|
|
|
|
async Task<Result> delegateConfirmNewFriend() => await confirmNewFriend(owner, getMyGuid(), getFriendGuid());
|
|
}
|
|
|
|
private async Task<Result> confirmNewFriend(Player owner, string myGuid, string guid)
|
|
{
|
|
|
|
var server_logic = GameServerApp.getServerLogic();
|
|
|
|
var friend_agent_action = owner.getEntityAction<FriendAgentAction>();
|
|
|
|
if(myGuid.Equals(guid))
|
|
{
|
|
return new();
|
|
}
|
|
var owner_friend = friend_agent_action.getFriend(guid);
|
|
if(owner_friend == null)
|
|
{
|
|
return new();
|
|
}
|
|
|
|
var friend_attribute = owner_friend.getEntityAttribute<FriendAttribute>();
|
|
NullReferenceCheckHelper.throwIfNull(friend_attribute, () => $"friend_attribute is null !!!");
|
|
friend_attribute.IsNew = 0;
|
|
friend_attribute.modifiedEntityAttribute();
|
|
|
|
var batch = new QueryBatchEx<QueryRunnerWithDocument>(owner, LogActionType.None, server_logic.getDynamoDbClient());
|
|
{
|
|
batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner());
|
|
}
|
|
var result = await QueryHelper.sendQueryAndBusinessLog(batch);
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|