Exemplo n.º 1
0
        public async UniTask <bool> IncreaseStorageItems(StorageId storageId, CharacterItem addingItem)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            Storage storge = GetStorage(storageId, out _);
            AsyncResponseData <IncreaseStorageItemsResp> resp = await DbServiceClient.IncreaseStorageItemsAsync(new IncreaseStorageItemsReq()
            {
                StorageType    = storageId.storageType,
                StorageOwnerId = storageId.storageOwnerId,
                WeightLimit    = storge.weightLimit,
                SlotLimit      = storge.slotLimit,
                Item           = addingItem,
            });

            if (!resp.IsSuccess || UITextKeys.NONE != resp.Response.Error)
            {
                // Error ocurring, storage may overwhelming let's it drop items to ground
                return(false);
            }
            SetStorageItems(storageId, resp.Response.StorageCharacterItems);
            NotifyStorageItemsUpdated(storageId.storageType, storageId.storageOwnerId);
            return(true);
#else
            return(false);
#endif
        }
Exemplo n.º 2
0
        public async UniTaskVoid IncreaseGuildExp(IPlayerCharacterData playerCharacter, int exp)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            ValidateGuildRequestResult validateResult = this.CanIncreaseGuildExp(playerCharacter, exp);
            if (!validateResult.IsSuccess)
            {
                return;
            }
            AsyncResponseData <GuildResp> resp = await DbServiceClient.IncreaseGuildExpAsync(new IncreaseGuildExpReq()
            {
                GuildId = validateResult.GuildId,
                Exp     = exp,
            });

            if (!resp.IsSuccess)
            {
                return;
            }
            GuildData guild = resp.Response.GuildData;
            SetGuild(validateResult.GuildId, guild);
            // Broadcast via chat server
            if (ClusterClient.IsNetworkActive)
            {
                ClusterClient.SendSetGuildLevelExpSkillPoint(MMOMessageTypes.UpdateGuild, guild.id, guild.level, guild.exp, guild.skillPoint);
            }
            GameInstance.ServerGameMessageHandlers.SendSetGuildLevelExpSkillPointToMembers(guild);
#endif
        }
Exemplo n.º 3
0
        public async UniTaskVoid HandleRequestAcceptGuildInvitation(RequestHandlerData requestHandler, RequestAcceptGuildInvitationMessage request, RequestProceedResultDelegate <ResponseAcceptGuildInvitationMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            await UniTask.Yield();

            BasePlayerCharacterEntity playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseAcceptGuildInvitationMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            ValidateGuildRequestResult validateResult = GameInstance.ServerGuildHandlers.CanAcceptGuildInvitation(request.guildId, playerCharacter);
            if (!validateResult.IsSuccess)
            {
                result.InvokeError(new ResponseAcceptGuildInvitationMessage()
                {
                    message = validateResult.GameMessage,
                });
                return;
            }
            playerCharacter.GuildId = request.guildId;
            validateResult.Guild.AddMember(playerCharacter);
            GameInstance.ServerGuildHandlers.SetGuild(request.guildId, validateResult.Guild);
            GameInstance.ServerGuildHandlers.RemoveGuildInvitation(request.guildId, playerCharacter.Id);
            // Save to database
            AsyncResponseData <GuildResp> updateResp = await DbServiceClient.UpdateCharacterGuildAsync(new UpdateCharacterGuildReq()
            {
                SocialCharacterData = SocialCharacterData.Create(playerCharacter),
                GuildId             = request.guildId,
                GuildRole           = validateResult.Guild.GetMemberRole(playerCharacter.Id)
            });

            if (!updateResp.IsSuccess)
            {
                result.InvokeError(new ResponseAcceptGuildInvitationMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            // Broadcast via chat server
            if (ClusterClient.IsNetworkActive)
            {
                ClusterClient.SendAddSocialMember(MMOMessageTypes.UpdateGuildMember, request.guildId, playerCharacter.Id, playerCharacter.CharacterName, playerCharacter.DataId, playerCharacter.Level);
            }
            GameInstance.ServerGameMessageHandlers.SendSetGuildData(requestHandler.ConnectionId, validateResult.Guild);
            GameInstance.ServerGameMessageHandlers.SendAddGuildMembersToOne(requestHandler.ConnectionId, validateResult.Guild);
            GameInstance.ServerGameMessageHandlers.SendAddGuildMemberToMembers(validateResult.Guild, playerCharacter.Id, playerCharacter.CharacterName, playerCharacter.DataId, playerCharacter.Level);
            // Send message to inviter
            GameInstance.ServerGameMessageHandlers.SendGameMessageByCharacterId(request.inviterId, UITextKeys.UI_GUILD_INVITATION_ACCEPTED);
            // Response to invitee
            result.InvokeSuccess(new ResponseAcceptGuildInvitationMessage()
            {
                message = UITextKeys.UI_GUILD_INVITATION_ACCEPTED,
            });
#endif
        }
        protected async UniTaskVoid HandleRequestUserLogout(
            RequestHandlerData requestHandler,
            EmptyMessage request,
            RequestProceedResultDelegate <EmptyMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            long connectionId = requestHandler.ConnectionId;
            CentralUserPeerInfo userPeerInfo;
            if (userPeers.TryGetValue(connectionId, out userPeerInfo))
            {
                userPeersByUserId.Remove(userPeerInfo.userId);
                userPeers.Remove(connectionId);
                AsyncResponseData <EmptyMessage> updateAccessTokenResp = await DbServiceClient.UpdateAccessTokenAsync(new UpdateAccessTokenReq()
                {
                    UserId      = userPeerInfo.userId,
                    AccessToken = string.Empty
                });

                if (!updateAccessTokenResp.IsSuccess)
                {
                    result.InvokeError(EmptyMessage.Value);
                    return;
                }
            }
            // Response
            result.InvokeSuccess(EmptyMessage.Value);
#endif
        }
        public async UniTaskVoid HandleRequestAddFriend(RequestHandlerData requestHandler, RequestAddFriendMessage request, RequestProceedResultDelegate <ResponseAddFriendMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseAddFriendMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            AsyncResponseData <EmptyMessage> resp = await DbServiceClient.CreateFriendAsync(new CreateFriendReq()
            {
                Character1Id = playerCharacter.Id,
                Character2Id = request.friendId,
                State        = 0,
            });

            if (!resp.IsSuccess)
            {
                result.InvokeError(new ResponseAddFriendMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            result.InvokeSuccess(new ResponseAddFriendMessage()
            {
                message = UITextKeys.UI_FRIEND_ADDED,
            });
#endif
        }
Exemplo n.º 6
0
        protected async UniTaskVoid HandleRequestDeleteCharacter(
            RequestHandlerData requestHandler,
            RequestDeleteCharacterMessage request,
            RequestProceedResultDelegate <ResponseDeleteCharacterMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            long connectionId = requestHandler.ConnectionId;
            CentralUserPeerInfo userPeerInfo;
            if (!userPeers.TryGetValue(connectionId, out userPeerInfo))
            {
                result.InvokeError(new ResponseDeleteCharacterMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            AsyncResponseData <EmptyMessage> deleteResp = await DbServiceClient.DeleteCharacterAsync(new DeleteCharacterReq()
            {
                UserId      = userPeerInfo.userId,
                CharacterId = request.characterId
            });

            if (!deleteResp.IsSuccess)
            {
                result.InvokeError(new ResponseDeleteCharacterMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            // Response
            result.InvokeSuccess(new ResponseDeleteCharacterMessage());
#endif
        }
Exemplo n.º 7
0
        public async UniTaskVoid HandleRequestDeleteAllMails(RequestHandlerData requestHandler, EmptyMessage request, RequestProceedResultDelegate <ResponseDeleteAllMailsMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            string userId;
            if (!GameInstance.ServerUserHandlers.TryGetUserId(requestHandler.ConnectionId, out userId))
            {
                result.Invoke(AckResponseCode.Error, new ResponseDeleteAllMailsMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
            }
            AsyncResponseData <MailListResp> resp = await DbServiceClient.MailListAsync(new MailListReq()
            {
                UserId       = userId,
                OnlyNewMails = false,
            });

            if (!resp.IsSuccess)
            {
                result.Invoke(AckResponseCode.Error, new ResponseDeleteAllMailsMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            foreach (MailListEntry entry in resp.Response.List)
            {
                await DeleteMail(entry.Id, userId);
            }
            result.Invoke(AckResponseCode.Success, new ResponseDeleteAllMailsMessage());
#endif
        }
Exemplo n.º 8
0
        public async UniTask <DecreaseStorageItemsResult> DecreaseStorageItems(StorageId storageId, int dataId, short amount)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            Storage storge = GetStorage(storageId, out _);
            AsyncResponseData <DecreaseStorageItemsResp> resp = await DbServiceClient.DecreaseStorageItemsAsync(new DecreaseStorageItemsReq()
            {
                StorageType    = storageId.storageType,
                StorageOwnerId = storageId.storageOwnerId,
                WeightLimit    = storge.weightLimit,
                SlotLimit      = storge.slotLimit,
                DataId         = dataId,
                Amount         = amount,
            });

            if (!resp.IsSuccess || UITextKeys.NONE != resp.Response.Error)
            {
                // Error ocurring, storage may overwhelming let's it drop items to ground
                return(new DecreaseStorageItemsResult());
            }
            SetStorageItems(storageId, resp.Response.StorageCharacterItems);
            NotifyStorageItemsUpdated(storageId.storageType, storageId.storageOwnerId);
            Dictionary <int, short> decreasedItems = new Dictionary <int, short>();
            foreach (ItemIndexAmountMap entry in resp.Response.DecreasedItems)
            {
                decreasedItems.Add(entry.Index, (short)entry.Amount);
            }
            return(new DecreaseStorageItemsResult()
            {
                IsSuccess = true,
                DecreasedItems = decreasedItems,
            });
#else
            return(new DecreaseStorageItemsResult());
#endif
        }
Exemplo n.º 9
0
        public async UniTaskVoid HandleRequestMailList(RequestHandlerData requestHandler, RequestMailListMessage request, RequestProceedResultDelegate <ResponseMailListMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            List <MailListEntry> mails = new List <MailListEntry>();
            string userId;
            if (GameInstance.ServerUserHandlers.TryGetUserId(requestHandler.ConnectionId, out userId))
            {
                AsyncResponseData <MailListResp> resp = await DbServiceClient.MailListAsync(new MailListReq()
                {
                    UserId       = userId,
                    OnlyNewMails = request.onlyNewMails,
                });

                if (resp.IsSuccess)
                {
                    mails.AddRange(resp.Response.List);
                }
            }
            result.Invoke(AckResponseCode.Success, new ResponseMailListMessage()
            {
                onlyNewMails = request.onlyNewMails,
                mails        = mails,
            });
#endif
        }
        public async UniTaskVoid HandleRequestGetFriends(RequestHandlerData requestHandler, EmptyMessage request, RequestProceedResultDelegate <ResponseGetFriendsMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseGetFriendsMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            AsyncResponseData <SocialCharactersResp> resp = await DbServiceClient.ReadFriendsAsync(new ReadFriendsReq()
            {
                CharacterId = playerCharacter.Id,
                ReadById2   = false,
                State       = 0,
                Skip        = 0,
                Limit       = 50,
            });

            if (!resp.IsSuccess)
            {
                result.InvokeError(new ResponseGetFriendsMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            result.InvokeSuccess(new ResponseGetFriendsMessage()
            {
                friends = resp.Response.List,
            });
#endif
        }
Exemplo n.º 11
0
        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
        }
Exemplo n.º 12
0
        public async UniTaskVoid HandleRequestKickMemberFromGuild(RequestHandlerData requestHandler, RequestKickMemberFromGuildMessage request, RequestProceedResultDelegate <ResponseKickMemberFromGuildMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            await UniTask.Yield();

            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseKickMemberFromGuildMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            ValidateGuildRequestResult validateResult = GameInstance.ServerGuildHandlers.CanKickMemberFromGuild(playerCharacter, request.memberId);
            if (!validateResult.IsSuccess)
            {
                result.InvokeError(new ResponseKickMemberFromGuildMessage()
                {
                    message = validateResult.GameMessage,
                });
                return;
            }
            // Save to database
            AsyncResponseData <EmptyMessage> updateResp = await DbServiceClient.ClearCharacterGuildAsync(new ClearCharacterGuildReq()
            {
                CharacterId = request.memberId
            });

            if (!updateResp.IsSuccess)
            {
                result.InvokeError(new ResponseKickMemberFromGuildMessage()
                {
                    message = validateResult.GameMessage,
                });
                return;
            }
            // Delete from cache
            IPlayerCharacterData memberCharacter;
            long memberConnectionId;
            if (GameInstance.ServerUserHandlers.TryGetPlayerCharacterById(request.memberId, out memberCharacter) &&
                GameInstance.ServerUserHandlers.TryGetConnectionId(request.memberId, out memberConnectionId))
            {
                memberCharacter.ClearGuild();
                GameInstance.ServerGameMessageHandlers.SendClearGuildData(memberConnectionId, validateResult.GuildId);
            }
            validateResult.Guild.RemoveMember(request.memberId);
            GameInstance.ServerGuildHandlers.SetGuild(validateResult.GuildId, validateResult.Guild);
            // Broadcast via chat server
            if (ClusterClient.IsNetworkActive)
            {
                ClusterClient.SendRemoveSocialMember(MMOMessageTypes.UpdateGuildMember, validateResult.GuildId, request.memberId);
            }
            GameInstance.ServerGameMessageHandlers.SendRemoveGuildMemberToMembers(validateResult.Guild, request.memberId);
            result.InvokeSuccess(new ResponseKickMemberFromGuildMessage());
#endif
        }
Exemplo n.º 13
0
        protected async UniTaskVoid HandleRequestSelectCharacter(
            RequestHandlerData requestHandler,
            RequestSelectCharacterMessage request,
            RequestProceedResultDelegate <ResponseSelectCharacterMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            long connectionId = requestHandler.ConnectionId;
            CentralServerPeerInfo mapServerPeerInfo = default;
            CentralUserPeerInfo   userPeerInfo;
            if (!userPeers.TryGetValue(connectionId, out userPeerInfo))
            {
                result.InvokeError(new ResponseSelectCharacterMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            AsyncResponseData <CharacterResp> characterResp = await DbServiceClient.ReadCharacterAsync(new ReadCharacterReq()
            {
                UserId      = userPeerInfo.userId,
                CharacterId = request.characterId
            });

            if (!characterResp.IsSuccess)
            {
                result.InvokeError(new ResponseSelectCharacterMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            PlayerCharacterData character = characterResp.Response.CharacterData;
            if (character == null)
            {
                result.InvokeError(new ResponseSelectCharacterMessage()
                {
                    message = UITextKeys.UI_ERROR_INVALID_CHARACTER_DATA,
                });
                return;
            }
            if (!ClusterServer.MapServerPeersByMapId.TryGetValue(character.CurrentMapName, out mapServerPeerInfo))
            {
                result.InvokeError(new ResponseSelectCharacterMessage()
                {
                    message = UITextKeys.UI_ERROR_MAP_SERVER_NOT_READY,
                });
                return;
            }
            // Response
            result.InvokeSuccess(new ResponseSelectCharacterMessage()
            {
                sceneName      = mapServerPeerInfo.extra,
                networkAddress = mapServerPeerInfo.networkAddress,
                networkPort    = mapServerPeerInfo.networkPort,
            });
#endif
        }
        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
        }
        public async UniTaskVoid HandleRequestWithdrawUserGold(RequestHandlerData requestHandler, RequestWithdrawUserGoldMessage request, RequestProceedResultDelegate <ResponseWithdrawUserGoldMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseWithdrawUserGoldMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            // Get gold
            AsyncResponseData <GoldResp> goldResp = await DbServiceClient.GetGoldAsync(new GetGoldReq()
            {
                UserId = playerCharacter.UserId
            });

            if (!goldResp.IsSuccess)
            {
                result.InvokeError(new ResponseWithdrawUserGoldMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            if (goldResp.Response.Gold - request.gold < 0)
            {
                result.InvokeError(new ResponseWithdrawUserGoldMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_ENOUGH_GOLD_TO_WITHDRAW,
                });
                return;
            }
            // Update gold
            AsyncResponseData <GoldResp> changeGoldResp = await DbServiceClient.ChangeGoldAsync(new ChangeGoldReq()
            {
                UserId       = playerCharacter.UserId,
                ChangeAmount = -request.gold
            });

            if (!changeGoldResp.IsSuccess)
            {
                result.InvokeError(new ResponseWithdrawUserGoldMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            playerCharacter.UserGold = changeGoldResp.Response.Gold;
            playerCharacter.Gold     = playerCharacter.Gold.Increase(request.gold);
            result.InvokeSuccess(new ResponseWithdrawUserGoldMessage());
#endif
        }
        public async UniTaskVoid HandleRequestCreateParty(RequestHandlerData requestHandler, RequestCreatePartyMessage request, RequestProceedResultDelegate <ResponseCreatePartyMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            await UniTask.Yield();

            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseCreatePartyMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            ValidatePartyRequestResult validateResult = playerCharacter.CanCreateParty();
            if (!validateResult.IsSuccess)
            {
                result.InvokeError(new ResponseCreatePartyMessage()
                {
                    message = validateResult.GameMessage,
                });
                return;
            }
            AsyncResponseData <PartyResp> createPartyResp = await DbServiceClient.CreatePartyAsync(new CreatePartyReq()
            {
                LeaderCharacterId = playerCharacter.Id,
                ShareExp          = request.shareExp,
                ShareItem         = request.shareItem
            });

            if (!createPartyResp.IsSuccess)
            {
                result.InvokeError(new ResponseCreatePartyMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            // Update cache
            PartyData party = createPartyResp.Response.PartyData;
            GameInstance.ServerPartyHandlers.SetParty(party.id, party);
            playerCharacter.PartyId = party.id;
            // Broadcast via chat server
            if (ClusterClient.IsNetworkActive)
            {
                ClusterClient.SendCreateParty(MMOMessageTypes.UpdateParty, party.id, party.shareExp, party.shareItem, playerCharacter.Id);
                ClusterClient.SendAddSocialMember(MMOMessageTypes.UpdatePartyMember, party.id, playerCharacter.Id, playerCharacter.CharacterName, playerCharacter.DataId, playerCharacter.Level);
            }
            GameInstance.ServerGameMessageHandlers.SendSetPartyData(requestHandler.ConnectionId, party);
            GameInstance.ServerGameMessageHandlers.SendAddPartyMembersToOne(requestHandler.ConnectionId, party);
            result.InvokeSuccess(new ResponseCreatePartyMessage());
#endif
        }
Exemplo n.º 17
0
        public async UniTaskVoid HandleRequestIncreaseGuildSkillLevel(RequestHandlerData requestHandler, RequestIncreaseGuildSkillLevelMessage request, RequestProceedResultDelegate <ResponseIncreaseGuildSkillLevelMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            await UniTask.Yield();

            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseIncreaseGuildSkillLevelMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            ValidateGuildRequestResult validateResult = GameInstance.ServerGuildHandlers.CanIncreaseGuildSkillLevel(playerCharacter, request.dataId);
            if (!validateResult.IsSuccess)
            {
                result.InvokeError(new ResponseIncreaseGuildSkillLevelMessage()
                {
                    message = validateResult.GameMessage,
                });
                return;
            }
            // Save to database
            AsyncResponseData <GuildResp> updateResp = await DbServiceClient.AddGuildSkillAsync(new AddGuildSkillReq()
            {
                GuildId = validateResult.GuildId,
                SkillId = request.dataId,
            });

            if (!updateResp.IsSuccess)
            {
                result.InvokeError(new ResponseIncreaseGuildSkillLevelMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            GuildData guild = updateResp.Response.GuildData;
            GameInstance.ServerGuildHandlers.SetGuild(validateResult.GuildId, guild);
            // Broadcast via chat server
            if (ClusterClient.IsNetworkActive)
            {
                ClusterClient.SendSetGuildSkillLevel(MMOMessageTypes.UpdateGuild, validateResult.GuildId, request.dataId, guild.GetSkillLevel(request.dataId));
                ClusterClient.SendSetGuildLevelExpSkillPoint(MMOMessageTypes.UpdateGuild, validateResult.GuildId, guild.level, guild.exp, guild.skillPoint);
            }
            GameInstance.ServerGameMessageHandlers.SendSetGuildSkillLevelToMembers(guild, request.dataId);
            GameInstance.ServerGameMessageHandlers.SendSetGuildLevelExpSkillPointToMembers(guild);
            result.InvokeSuccess(new ResponseIncreaseGuildSkillLevelMessage());
#endif
        }
Exemplo n.º 18
0
        public async UniTaskVoid HandleRequestCashPackageBuyValidation(
            RequestHandlerData requestHandler, RequestCashPackageBuyValidationMessage request,
            RequestProceedResultDelegate <ResponseCashPackageBuyValidationMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            // TODO: Validate purchasing at server side
            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseCashPackageBuyValidationMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }

            CashPackage cashPackage;
            if (!GameInstance.CashPackages.TryGetValue(request.dataId, out cashPackage))
            {
                result.InvokeError(new ResponseCashPackageBuyValidationMessage()
                {
                    message = UITextKeys.UI_ERROR_CASH_PACKAGE_NOT_FOUND,
                });
                return;
            }

            AsyncResponseData <CashResp> changeCashResp = await DbServiceClient.ChangeCashAsync(new ChangeCashReq()
            {
                UserId       = playerCharacter.UserId,
                ChangeAmount = cashPackage.CashAmount
            });

            if (!changeCashResp.IsSuccess)
            {
                result.InvokeError(new ResponseCashPackageBuyValidationMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }

            // Sync cash to game clients
            playerCharacter.UserCash = changeCashResp.Response.Cash;

            result.InvokeSuccess(new ResponseCashPackageBuyValidationMessage()
            {
                dataId = request.dataId,
                cash   = changeCashResp.Response.Cash,
            });
#endif
        }
        public async UniTaskVoid HandleRequestChangePartySetting(RequestHandlerData requestHandler, RequestChangePartySettingMessage request, RequestProceedResultDelegate <ResponseChangePartySettingMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            await UniTask.Yield();

            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseChangePartySettingMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            ValidatePartyRequestResult validateResult = GameInstance.ServerPartyHandlers.CanChangePartySetting(playerCharacter);
            if (!validateResult.IsSuccess)
            {
                result.InvokeError(new ResponseChangePartySettingMessage()
                {
                    message = validateResult.GameMessage,
                });
                return;
            }
            // Save to database
            AsyncResponseData <PartyResp> updateResp = await DbServiceClient.UpdatePartyAsync(new UpdatePartyReq()
            {
                PartyId   = validateResult.PartyId,
                ShareExp  = request.shareExp,
                ShareItem = request.shareItem
            });

            if (!updateResp.IsSuccess)
            {
                result.InvokeError(new ResponseChangePartySettingMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            // Update cache
            validateResult.Party.Setting(request.shareExp, request.shareItem);
            GameInstance.ServerPartyHandlers.SetParty(validateResult.PartyId, validateResult.Party);
            // Broadcast via chat server
            if (ClusterClient.IsNetworkActive)
            {
                ClusterClient.SendPartySetting(MMOMessageTypes.UpdateParty, validateResult.PartyId, request.shareExp, request.shareItem);
            }
            GameInstance.ServerGameMessageHandlers.SendSetPartySettingToMembers(validateResult.Party);
            result.InvokeSuccess(new ResponseChangePartySettingMessage());
#endif
        }
Exemplo n.º 20
0
        public async UniTask <bool> SendMail(Mail mail)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            AsyncResponseData <SendMailResp> resp = await DbServiceClient.SendMailAsync(new SendMailReq()
            {
                Mail = mail,
            });

            if (resp.IsSuccess && resp.Response.Error == 0)
            {
                return(true);
            }
#endif
            return(false);
        }
Exemplo n.º 21
0
        public void PlayMp3FromUrl(string url, string text, Voice voice)
        {
            try
            {
                Text2Speech tts = new Text2Speech(FPT_TOKEN, "");

                AsyncResponseData responseData = tts.Speech(text, voice);

                DownloadFile(responseData.async, url);                
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 22
0
        private async UniTask <UITextKeys> DeleteMail(string mailId, string userId)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            AsyncResponseData <UpdateDeleteMailStateResp> resp = await DbServiceClient.UpdateDeleteMailStateAsync(new UpdateDeleteMailStateReq()
            {
                MailId = mailId,
                UserId = userId,
            });

            if (!resp.IsSuccess)
            {
                return(UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR);
            }
            return(resp.Response.Error);
#else
            return(UITextKeys.UI_ERROR_SERVICE_NOT_AVAILABLE);
#endif
        }
Exemplo n.º 23
0
        public void PlayMp3FromUrl(string url, string text, Voice voice, string mytoken)
        {
            Text2Speech tts = new Text2Speech(mytoken, url);

            AsyncResponseData responseData = tts.Speech(text, voice);

            // nhận một object chứa link của file Mp3.
            Console.WriteLine(responseData.audio_menv_url);

            WebClient wc = new WebClient();

            wc.DownloadFile(responseData.audio_menv_url ?? responseData.async, responseData.request_id + ".mp3");

            FileStream memoryStream = File.OpenRead(responseData.request_id + ".mp3");

            try
            {
                memoryStream.Position = 0;
                using (
                    WaveStream blockAlignedStream =
                        new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(new Mp3FileReader(memoryStream))))
                {
                    using (_waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
                    {
                        _waveOut.Init(blockAlignedStream);
                        InnerControl(false);
                        while (_waveOut.PlaybackState == PlaybackState.Playing)
                        {
                            Thread.Sleep(100);
                        }
                        InnerControl();
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }
            finally
            {
                InnerControl();
            }
        }
Exemplo n.º 24
0
        public void Post(HttpRequestMessage request)
        {
            try
            {
                JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                string            content           = request.Content.ReadAsStringAsync().Result;
                AsyncResponseData data       = jsonSerializer.Deserialize <AsyncResponseData>(content);
                string            forderPath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "Data");
                WebClient         webClient  = new WebClient();
                string            filename   = Path.GetFileName(data.audio_menv_url);
                string            filepath   = Path.Combine(forderPath, filename);
                webClient.DownloadFile(data.audio_menv_url, filepath);
                data.audio_menv_url = Path.Combine(DOMAIN, filename);

                File.WriteAllText(Path.Combine(forderPath, data.request_id + ".json"), jsonSerializer.Serialize(data));
            }
            catch
            {
                // ignored
            }
        }
Exemplo n.º 25
0
        public async UniTaskVoid HandleRequestReadMail(RequestHandlerData requestHandler, RequestReadMailMessage request, RequestProceedResultDelegate <ResponseReadMailMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            string userId;
            if (GameInstance.ServerUserHandlers.TryGetUserId(requestHandler.ConnectionId, out userId))
            {
                AsyncResponseData <UpdateReadMailStateResp> resp = await DbServiceClient.UpdateReadMailStateAsync(new UpdateReadMailStateReq()
                {
                    MailId = request.id,
                    UserId = userId,
                });

                if (!resp.IsSuccess)
                {
                    result.InvokeError(new ResponseReadMailMessage()
                    {
                        message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                    });
                    return;
                }
                UITextKeys message = resp.Response.Error;
                result.Invoke(
                    message == UITextKeys.NONE ? AckResponseCode.Success : AckResponseCode.Error,
                    new ResponseReadMailMessage()
                {
                    message = message,
                    mail    = resp.Response.Mail,
                });
            }
            else
            {
                result.Invoke(AckResponseCode.Error, new ResponseReadMailMessage()
                {
                    message = UITextKeys.UI_ERROR_SERVICE_NOT_AVAILABLE,
                });
            }
#endif
        }
        public async UniTaskVoid HandleRequestFriendRequestNotification(RequestHandlerData requestHandler, EmptyMessage request, RequestProceedResultDelegate <ResponseFriendRequestNotificationMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            int notificationCount = 0;
            IPlayerCharacterData playerCharacter;
            if (GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                AsyncResponseData <GetFriendRequestNotificationResp> resp = await DbServiceClient.GetFriendRequestNotificationAsync(new GetFriendRequestNotificationReq()
                {
                    CharacterId = playerCharacter.Id,
                });

                if (resp.IsSuccess)
                {
                    notificationCount = resp.Response.NotificationCount;
                }
            }
            result.Invoke(AckResponseCode.Success, new ResponseFriendRequestNotificationMessage()
            {
                notificationCount = notificationCount,
            });
#endif
        }
Exemplo n.º 27
0
        public async UniTaskVoid OpenStorage(long connectionId, IPlayerCharacterData playerCharacter, StorageId storageId)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            if (!CanAccessStorage(playerCharacter, storageId))
            {
                GameInstance.ServerGameMessageHandlers.SendGameMessage(connectionId, UITextKeys.UI_ERROR_CANNOT_ACCESS_STORAGE);
                return;
            }
            // Store storage usage states
            if (!usingStorageClients.ContainsKey(storageId))
            {
                usingStorageClients.TryAdd(storageId, new HashSet <long>());
            }
            usingStorageClients[storageId].Add(connectionId);
            usingStorageIds.TryRemove(connectionId, out _);
            usingStorageIds.TryAdd(connectionId, storageId);
            // Load storage items from database
            AsyncResponseData <ReadStorageItemsResp> resp = await DbServiceClient.ReadStorageItemsAsync(new ReadStorageItemsReq()
            {
                StorageType    = storageId.storageType,
                StorageOwnerId = storageId.storageOwnerId,
            });

            if (!resp.IsSuccess)
            {
                return;
            }
            List <CharacterItem> storageItems = resp.Response.StorageCharacterItems;
            SetStorageItems(storageId, storageItems);
            // Notify storage items to client
            uint    storageObjectId;
            Storage storage = GetStorage(storageId, out storageObjectId);
            GameInstance.ServerGameMessageHandlers.NotifyStorageOpened(connectionId, storageId.storageType, storageId.storageOwnerId, storageObjectId, storage.weightLimit, storage.slotLimit);
            storageItems.FillEmptySlots(storage.slotLimit > 0, storage.slotLimit);
            GameInstance.ServerGameMessageHandlers.NotifyStorageItems(connectionId, storageItems);
#endif
        }
Exemplo n.º 28
0
        public async UniTaskVoid HandleRequestGachaInfo(
            RequestHandlerData requestHandler, EmptyMessage request,
            RequestProceedResultDelegate <ResponseGachaInfoMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            string userId;
            if (!GameInstance.ServerUserHandlers.TryGetUserId(requestHandler.ConnectionId, out userId))
            {
                result.Invoke(AckResponseCode.Error, new ResponseGachaInfoMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }

            AsyncResponseData <CashResp> getCashResp = await DbServiceClient.GetCashAsync(new GetCashReq()
            {
                UserId = userId
            });

            if (!getCashResp.IsSuccess)
            {
                result.InvokeError(new ResponseGachaInfoMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }

            result.Invoke(AckResponseCode.Success, new ResponseGachaInfoMessage()
            {
                cash     = getCashResp.Response.Cash,
                gachaIds = new List <int>(GameInstance.Gachas.Keys),
            });
#endif
        }
        protected async UniTaskVoid HandleRequestFacebookLogin(
            RequestHandlerData requestHandler, RequestFacebookLoginMessage request,
            RequestProceedResultDelegate <ResponseUserLoginMessage> result)
        {
            string userId      = string.Empty;
            string accessToken = string.Empty;
            long   unbanTime   = 0;
            // Validate by facebook api
            string    url       = "https://graph.facebook.com/" + request.id + "?access_token=" + request.accessToken + "&fields=id,name,email";
            WebClient webClient = new WebClient();
            string    json      = webClient.DownloadString(url);

            json = json.Replace(@"\u0040", "@");
            Dictionary <string, object> dict = Json.Deserialize(json) as Dictionary <string, object>;

            if (dict.ContainsKey("id") && dict.ContainsKey("email"))
            {
                // Send request to database server
                AsyncResponseData <DbFacebookLoginResp> resp = await DbServiceClient.RequestDbFacebookLogin(new DbFacebookLoginReq()
                {
                    id    = request.id,
                    email = (string)dict["email"],
                });

                if (resp.ResponseCode == AckResponseCode.Success)
                {
                    userId = resp.Response.userId;
                }
            }
            // Response clients
            if (string.IsNullOrEmpty(userId))
            {
                result.Invoke(AckResponseCode.Error, new ResponseUserLoginMessage()
                {
                    message = UITextKeys.UI_ERROR_INVALID_USERNAME_OR_PASSWORD,
                });
                return;
            }
            if (userPeersByUserId.ContainsKey(userId) || MapContainsUser(userId))
            {
                result.Invoke(AckResponseCode.Error, new ResponseUserLoginMessage()
                {
                    message = UITextKeys.UI_ERROR_ALREADY_LOGGED_IN,
                });
                return;
            }
            AsyncResponseData <GetUserUnbanTimeResp> unbanTimeResp = await DbServiceClient.GetUserUnbanTimeAsync(new GetUserUnbanTimeReq()
            {
                UserId = userId
            });

            if (unbanTimeResp.ResponseCode != AckResponseCode.Success)
            {
                result.Invoke(AckResponseCode.Error, new ResponseUserLoginMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            unbanTime = unbanTimeResp.Response.UnbanTime;
            if (unbanTime > DateTimeOffset.UtcNow.ToUnixTimeSeconds())
            {
                result.Invoke(AckResponseCode.Error, new ResponseUserLoginMessage()
                {
                    message = UITextKeys.UI_ERROR_USER_BANNED,
                });
                return;
            }
            CentralUserPeerInfo userPeerInfo = new CentralUserPeerInfo();

            userPeerInfo.connectionId = requestHandler.ConnectionId;
            userPeerInfo.userId       = userId;
            userPeerInfo.accessToken  = accessToken = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", "");
            userPeersByUserId[userId] = userPeerInfo;
            userPeers[requestHandler.ConnectionId] = userPeerInfo;
            await DbServiceClient.UpdateAccessTokenAsync(new UpdateAccessTokenReq()
            {
                UserId      = userId,
                AccessToken = accessToken
            });

            // Response
            result.Invoke(AckResponseCode.Success,
                          new ResponseUserLoginMessage()
            {
                userId      = userId,
                accessToken = accessToken,
                unbanTime   = unbanTime,
            });
        }
Exemplo n.º 30
0
        public async UniTaskVoid HandleRequestMoveItemFromStorage(RequestHandlerData requestHandler, RequestMoveItemFromStorageMessage request, RequestProceedResultDelegate <ResponseMoveItemFromStorageMessage> result)
        {
#if UNITY_STANDALONE && !CLIENT_BUILD
            StorageId            storageId = new StorageId(request.storageType, request.storageOwnerId);
            IPlayerCharacterData playerCharacter;
            if (!GameInstance.ServerUserHandlers.TryGetPlayerCharacter(requestHandler.ConnectionId, out playerCharacter))
            {
                result.InvokeError(new ResponseMoveItemFromStorageMessage()
                {
                    message = UITextKeys.UI_ERROR_NOT_LOGGED_IN,
                });
                return;
            }
            if (!storageUsers.Add(playerCharacter.Id))
            {
                result.InvokeError(new ResponseMoveItemFromStorageMessage()
                {
                    message = UITextKeys.UI_ERROR_CONTENT_NOT_AVAILABLE,
                });
                return;
            }
            if (!GameInstance.ServerStorageHandlers.CanAccessStorage(playerCharacter, storageId))
            {
                storageUsers.Remove(playerCharacter.Id);
                result.InvokeError(new ResponseMoveItemFromStorageMessage()
                {
                    message = UITextKeys.UI_ERROR_CANNOT_ACCESS_STORAGE,
                });
                return;
            }
            Storage storage = GameInstance.ServerStorageHandlers.GetStorage(storageId, out _);
            AsyncResponseData <MoveItemFromStorageResp> resp = await DbServiceClient.MoveItemFromStorageAsync(new MoveItemFromStorageReq()
            {
                StorageType        = request.storageType,
                StorageOwnerId     = request.storageOwnerId,
                CharacterId        = playerCharacter.Id,
                WeightLimit        = storage.weightLimit,
                SlotLimit          = storage.slotLimit,
                StorageItemIndex   = request.storageItemIndex,
                StorageItemAmount  = request.storageItemAmount,
                InventoryItemIndex = request.inventoryItemIndex,
                Inventory          = new List <CharacterItem>(playerCharacter.NonEquipItems),
            });

            if (!resp.IsSuccess)
            {
                result.InvokeError(new ResponseMoveItemFromStorageMessage()
                {
                    message = UITextKeys.UI_ERROR_INTERNAL_SERVER_ERROR,
                });
                return;
            }
            UITextKeys message = resp.Response.Error;
            if (message != UITextKeys.NONE)
            {
                storageUsers.Remove(playerCharacter.Id);
                result.InvokeError(new ResponseMoveItemFromStorageMessage()
                {
                    message = message,
                });
                return;
            }
            playerCharacter.NonEquipItems = resp.Response.InventoryItemItems;
            GameInstance.ServerStorageHandlers.SetStorageItems(storageId, resp.Response.StorageCharacterItems);
            GameInstance.ServerStorageHandlers.NotifyStorageItemsUpdated(request.storageType, request.storageOwnerId);
            // Success
            storageUsers.Remove(playerCharacter.Id);
            result.InvokeSuccess(new ResponseMoveItemFromStorageMessage());
#endif
        }