Files
caliverse_server/GameServer/Contents/Friend/LockAction/ChangeFriendFolderLocationInterlockAction.cs
2025-05-01 07:20:41 +09:00

58 lines
1.7 KiB
C#

using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer;
public class ChangeFriendFolderLocationInterlockAction : FriendInterlockBase
{
private string m_folder_name;
public ChangeFriendFolderLocationInterlockAction(UserBase owner, string myGuid, string friendGuid, string folderName) : base(owner, myGuid, friendGuid)
{
m_folder_name = folderName;
}
public override async Task<Result> doAction()
{
var owner = getOwner();
var friend_folder_action = owner.getEntityAction<FriendFolderAction>();
var result = await owner.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "ChangeFriendFolderLocation", delegateChangeFriendFolderLocation);
if (result.isFail()) return result;
return result;
async Task<Result> delegateChangeFriendFolderLocation() => await changeFriendFolderLocation(owner);
}
private async Task<Result> changeFriendFolderLocation(Player owner)
{
var friend_folder_action = owner.getEntityAction<FriendFolderAction>();
var result = friend_folder_action.changeFriendFolderLocation(getMyGuid(), getFriendGuid(), m_folder_name);
var server_logic = GameServerApp.getServerLogic();
if (result.isFail()) return result;
var batch = new QueryBatchEx<QueryRunnerWithDocument>(owner, LogActionType.None, server_logic.getDynamoDbClient());
{
batch.addQuery(new DBQWriteToAttributeAllWithTransactionRunner());
}
result = await QueryHelper.sendQueryAndBusinessLog(batch);
if (result.isFail()) return result;
return result;
}
}