public async UniTaskVoid HandleRequestDepositGuildGold(RequestHandlerData requestHandler, RequestDepositGuildGoldMessage request, RequestProceedResultDelegate <ResponseDepositGuildGoldMessage> result) { #if UNITY_STANDALONE && !CLIENT_BUILD IPlayerCharacterData playerCharacter; if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter)) { result.InvokeError(new ResponseDepositGuildGoldMessage() { message = UITextKeys.UI_ERROR_NOT_LOGGED_IN, }); return; } GuildData guild; if (!GameInstance.ServerGuildHandlers.TryGetGuild(playerCharacter.GuildId, out guild)) { result.InvokeError(new ResponseDepositGuildGoldMessage() { message = UITextKeys.UI_ERROR_NOT_JOINED_GUILD, }); return; } if (playerCharacter.Gold - request.gold < 0) { result.InvokeError(new ResponseDepositGuildGoldMessage() { message = UITextKeys.UI_ERROR_NOT_ENOUGH_GOLD_TO_DEPOSIT, }); return; } // Update gold AsyncResponseData <GuildGoldResp> changeGoldResp = await DbServiceClient.ChangeGuildGoldAsync(new ChangeGuildGoldReq() { GuildId = playerCharacter.GuildId, ChangeAmount = request.gold }); if (!changeGoldResp.IsSuccess) { result.InvokeError(new ResponseDepositGuildGoldMessage() { message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR, }); return; } guild.gold = changeGoldResp.Response.GuildGold; playerCharacter.Gold -= request.gold; GameInstance.ServerGuildHandlers.SetGuild(playerCharacter.GuildId, guild); // Broadcast via chat server if (ClusterClient.IsNetworkActive) { ClusterClient.SendSetGuildGold(MMOMessageTypes.UpdateGuild, guild.id, guild.gold); } GameInstance.ServerGameMessageHandlers.SendSetGuildGoldToMembers(guild); result.InvokeSuccess(new ResponseDepositGuildGoldMessage()); #endif }