public async UniTaskVoid HandleRequestChangePartyLeader(RequestHandlerData requestHandler, RequestChangePartyLeaderMessage request, RequestProceedResultDelegate <ResponseChangePartyLeaderMessage> result) { #if UNITY_STANDALONE && !CLIENT_BUILD await UniTask.Yield(); IPlayerCharacterData playerCharacter; if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter)) { result.InvokeError(new ResponseChangePartyLeaderMessage() { message = UITextKeys.UI_ERROR_NOT_LOGGED_IN, }); return; } ValidatePartyRequestResult validateResult = GameInstance.ServerPartyHandlers.CanChangePartyLeader(playerCharacter, request.memberId); if (!validateResult.IsSuccess) { result.InvokeError(new ResponseChangePartyLeaderMessage() { message = validateResult.GameMessage, }); return; } // Save to database AsyncResponseData <PartyResp> updateResp = await DbServiceClient.UpdatePartyLeaderAsync(new UpdatePartyLeaderReq() { PartyId = validateResult.PartyId, LeaderCharacterId = request.memberId, }); if (!updateResp.IsSuccess) { result.InvokeError(new ResponseChangePartyLeaderMessage() { message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR, }); return; } // Update cache validateResult.Party.SetLeader(request.memberId); GameInstance.ServerPartyHandlers.SetParty(validateResult.PartyId, validateResult.Party); // Broadcast via chat server if (ClusterClient.IsNetworkActive) { ClusterClient.SendChangePartyLeader(MMOMessageTypes.UpdateParty, validateResult.PartyId, request.memberId); } GameInstance.ServerGameMessageHandlers.SendSetPartyLeaderToMembers(validateResult.Party); result.InvokeSuccess(new ResponseChangePartyLeaderMessage()); #endif }