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 doAction() { var owner = getOwner(); var result = await owner.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "ConfirmNewFriend", delegateConfirmNewFriend); return result; async Task delegateConfirmNewFriend() => await confirmNewFriend(owner, getMyGuid(), getFriendGuid()); } private async Task confirmNewFriend(Player owner, string myGuid, string guid) { var server_logic = GameServerApp.getServerLogic(); var friend_agent_action = owner.getEntityAction(); 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(); NullReferenceCheckHelper.throwIfNull(friend_attribute, () => $"friend_attribute is null !!!"); friend_attribute.IsNew = 0; friend_attribute.modifiedEntityAttribute(); var batch = new QueryBatchEx(owner, LogActionType.None, server_logic.getDynamoDbClient()); { batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner()); } var result = await QueryHelper.sendQueryAndBusinessLog(batch); return result; } } }