public async UniTaskVoid HandleRequestChangeMemberGuildRole(RequestHandlerData requestHandler, RequestChangeMemberGuildRoleMessage request, RequestProceedResultDelegate <ResponseChangeMemberGuildRoleMessage> result) { #if UNITY_STANDALONE && !CLIENT_BUILD await UniTask.Yield(); IPlayerCharacterData playerCharacter; if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter)) { result.InvokeError(new ResponseChangeMemberGuildRoleMessage() { message = UITextKeys.UI_ERROR_NOT_LOGGED_IN, }); return; } ValidateGuildRequestResult validateResult = GameInstance.ServerGuildHandlers.CanChangeGuildMemberRole(playerCharacter, request.memberId); if (!validateResult.IsSuccess) { result.InvokeError(new ResponseChangeMemberGuildRoleMessage() { message = validateResult.GameMessage, }); return; } // Save to database AsyncResponseData <GuildResp> updateResp = await DbServiceClient.UpdateGuildMemberRoleAsync(new UpdateGuildMemberRoleReq() { GuildId = validateResult.GuildId, MemberCharacterId = request.memberId, GuildRole = request.guildRole }); if (!updateResp.IsSuccess) { result.InvokeError(new ResponseChangeMemberGuildRoleMessage() { message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR, }); return; } // Update cache validateResult.Guild.SetMemberRole(request.memberId, request.guildRole); GameInstance.ServerGuildHandlers.SetGuild(validateResult.GuildId, validateResult.Guild); IPlayerCharacterData memberCharacter; if (GameInstance.ServerUserHandlers.TryGetPlayerCharacterById(request.memberId, out memberCharacter)) { memberCharacter.GuildRole = request.guildRole; memberCharacter.SharedGuildExp = validateResult.Guild.GetRole(request.guildRole).shareExpPercentage; } // Broadcast via chat server if (ClusterClient.IsNetworkActive) { ClusterClient.SendSetGuildMemberRole(MMOMessageTypes.UpdateGuild, validateResult.GuildId, request.memberId, request.guildRole); } GameInstance.ServerGameMessageHandlers.SendSetGuildMemberRoleToMembers(validateResult.Guild, request.memberId, request.guildRole); result.InvokeSuccess(new ResponseChangeMemberGuildRoleMessage()); #endif }