示例#1
0
        private IEnumerator HandleRequestSelectCharacterRoutine(LiteNetLibMessageHandler messageHandler)
        {
            long connectionId = messageHandler.connectionId;
            RequestSelectCharacterMessage message = messageHandler.ReadMessage <RequestSelectCharacterMessage>();

            ResponseSelectCharacterMessage.Error error = ResponseSelectCharacterMessage.Error.None;
            CentralServerPeerInfo mapServerPeerInfo    = null;
            CentralUserPeerInfo   userPeerInfo;

            if (!userPeers.TryGetValue(connectionId, out userPeerInfo))
            {
                error = ResponseSelectCharacterMessage.Error.NotLoggedin;
            }
            else
            {
                ReadCharacterJob job = new ReadCharacterJob(Database, userPeerInfo.userId, message.characterId, false, false, false, false, false, false, false, false, false);
                job.Start();
                yield return(StartCoroutine(job.WaitFor()));

                PlayerCharacterData character = job.result;
                if (character == null)
                {
                    error = ResponseSelectCharacterMessage.Error.InvalidCharacterData;
                }
                else if (!mapServerPeersBySceneName.TryGetValue(character.CurrentMapName, out mapServerPeerInfo))
                {
                    error = ResponseSelectCharacterMessage.Error.MapNotReady;
                }
            }
            ResponseSelectCharacterMessage responseMessage = new ResponseSelectCharacterMessage();

            responseMessage.ackId        = message.ackId;
            responseMessage.responseCode = error == ResponseSelectCharacterMessage.Error.None ? AckResponseCode.Success : AckResponseCode.Error;
            responseMessage.error        = error;
            if (mapServerPeerInfo != null)
            {
                responseMessage.sceneName      = mapServerPeerInfo.extra;
                responseMessage.networkAddress = mapServerPeerInfo.networkAddress;
                responseMessage.networkPort    = mapServerPeerInfo.networkPort;
                responseMessage.connectKey     = mapServerPeerInfo.connectKey;
            }
            ServerSendPacket(connectionId, DeliveryMethod.ReliableOrdered, MMOMessageTypes.ResponseSelectCharacter, responseMessage);
        }
    public UICharacter CreateUICharacter(PlayerCharacterData character, DataController data)
    {
        UICharacter member = new UICharacter();

        member.id    = character.id;
        member.name  = character.name;
        member.level = FormatCharacterLevel(character.level);
        if (character.offHand > -1)
        {
            member.weapon = GetWeaponName(character.weapon, data) + " / " + GetWeaponName(character.offHand, data);
        }
        else
        {
            member.weapon = GetWeaponName(character.weapon, data);
        }
        member.armor   = GetArmorName(character.armor);
        member.quality = ColorConvertQuality(character.quality);
        return(member);
    }
        public void AddChar(Byte ShowType, PlayerCharacterData Char)
        {
            PlayerTransactionData Tran;

            if ((Char == null))
            {
                return;
            }
            Tran = new PlayerTransactionData()
            {
                Types        = ShowType,
                TypeID       = Char.TypeID,
                Index        = Char.Index,
                PreviousQuan = 0,
                NewQuan      = 0,
                UCC          = String.Empty
            };
            this.AddInfo(Tran);
        }
        /// <summary>
        /// Warp to different map.
        /// </summary>
        /// <param name="playerCharacterEntity"></param>
        /// <param name="mapName"></param>
        /// <param name="position"></param>
        /// <param name="overrideRotation"></param>
        /// <param name="rotation"></param>
        /// <returns></returns>
        private async UniTaskVoid WarpCharacterRoutine(BasePlayerCharacterEntity playerCharacterEntity, string mapName, Vector3 position, bool overrideRotation, Vector3 rotation)
        {
            // If warping to different map
            long connectionId = playerCharacterEntity.ConnectionId;
            CentralServerPeerInfo peerInfo;
            BaseMapInfo           mapInfo;

            if (!string.IsNullOrEmpty(mapName) &&
                ServerUserHandlers.TryGetPlayerCharacter(connectionId, out _) &&
                mapServerConnectionIdsBySceneName.TryGetValue(mapName, out peerInfo) &&
                GameInstance.MapInfos.TryGetValue(mapName, out mapInfo) &&
                mapInfo.IsSceneSet())
            {
                // Add this character to warping list
                playerCharacterEntity.IsWarping = true;
                // Unregister player character
                UnregisterPlayerCharacter(connectionId);
                // Clone character data to save
                PlayerCharacterData savingCharacterData = new PlayerCharacterData();
                playerCharacterEntity.CloneTo(savingCharacterData);
                savingCharacterData.CurrentMapName  = mapName;
                savingCharacterData.CurrentPosition = position;
                if (overrideRotation)
                {
                    savingCharacterData.CurrentRotation = rotation;
                }
                while (savingCharacters.Contains(savingCharacterData.Id))
                {
                    await UniTask.Yield();
                }
                await SaveCharacterRoutine(savingCharacterData, playerCharacterEntity.UserId);

                // Remove this character from warping list
                playerCharacterEntity.IsWarping = false;
                // Destroy character from server
                playerCharacterEntity.NetworkDestroy();
                // Send message to client to warp
                MMOWarpMessage message = new MMOWarpMessage();
                message.networkAddress = peerInfo.networkAddress;
                message.networkPort    = peerInfo.networkPort;
                ServerSendPacket(connectionId, DeliveryMethod.ReliableOrdered, GameNetworkingConsts.Warp, message);
            }
        }
示例#5
0
 public void SaveCharacter(PlayerCharacterData character)
 {
     // edit the selected character based on the editcharacter id
     if (character.talents.Count != 0)
     {
         character.level = character.talents.Count;
     }
     else
     {
         character.level = 30;
     }
     for (int i = 0; i < allPlayerCharacterData.Length; i++)
     {
         if (allPlayerCharacterData[i].id == character.id)
         {
             allPlayerCharacterData[i] = character;
         }
     }
     SavePlayerData();
 }
示例#6
0
    public static List <PlayerCharacterData> LoadAllPersistentCharacterData()
    {
        var result = new List <PlayerCharacterData>();
        var path   = Application.persistentDataPath;
        var files  = Directory.GetFiles(path, "*.sav");

        Debug.Log("Characters loading from: " + path);
        foreach (var file in files)
        {
            // If filename is empty or this is not character save, skip it
            if (file.Length <= 4 || file.Contains("_world_"))
            {
                continue;
            }
            var characterData = new PlayerCharacterData();
            result.Add(characterData.LoadPersistentCharacterData(file));
        }
        Debug.Log("Characters loaded from: " + path);
        return(result);
    }
        private bool ReadCharacter(SQLiteRowsReader reader, out PlayerCharacterData result, bool resetReader = true)
        {
            if (resetReader)
            {
                reader.ResetReader();
            }

            if (reader.Read())
            {
                result                 = new PlayerCharacterData();
                result.Id              = reader.GetString("id");
                result.DataId          = reader.GetInt32("dataId");
                result.EntityId        = reader.GetInt32("entityId");
                result.FactionId       = reader.GetInt32("factionId");
                result.CharacterName   = reader.GetString("characterName");
                result.Level           = reader.GetInt16("level");
                result.Exp             = reader.GetInt32("exp");
                result.CurrentHp       = reader.GetInt32("currentHp");
                result.CurrentMp       = reader.GetInt32("currentMp");
                result.CurrentStamina  = reader.GetInt32("currentStamina");
                result.CurrentFood     = reader.GetInt32("currentFood");
                result.CurrentWater    = reader.GetInt32("currentWater");
                result.EquipWeaponSet  = reader.GetByte("equipWeaponSet");
                result.StatPoint       = reader.GetInt16("statPoint");
                result.SkillPoint      = reader.GetInt16("skillPoint");
                result.Gold            = reader.GetInt32("gold");
                result.PartyId         = reader.GetInt32("partyId");
                result.GuildId         = reader.GetInt32("guildId");
                result.GuildRole       = reader.GetByte("guildRole");
                result.SharedGuildExp  = reader.GetInt32("sharedGuildExp");
                result.CurrentMapName  = reader.GetString("currentMapName");
                result.CurrentPosition = new Vector3(reader.GetFloat("currentPositionX"), reader.GetFloat("currentPositionY"), reader.GetFloat("currentPositionZ"));
                result.RespawnMapName  = reader.GetString("respawnMapName");
                result.RespawnPosition = new Vector3(reader.GetFloat("respawnPositionX"), reader.GetFloat("respawnPositionY"), reader.GetFloat("respawnPositionZ"));
                result.MountDataId     = reader.GetInt32("mountDataId");
                result.LastUpdate      = (int)(reader.GetDateTime("updateAt").Ticks / System.TimeSpan.TicksPerMillisecond);
                return(true);
            }
            result = null;
            return(false);
        }
        /// <summary>
        /// Warp to different map. if `forceChangeMap` is `TRUE` it will change map server, even if it is same map
        /// </summary>
        /// <param name="playerCharacterEntity"></param>
        /// <param name="mapName"></param>
        /// <param name="position"></param>
        /// <param name="forceChangeMap"></param>
        /// <returns></returns>
        private IEnumerator WarpCharacterRoutine(BasePlayerCharacterEntity playerCharacterEntity, string mapName, Vector3 position, bool forceChangeMap)
        {
            // If warping to different map
            long connectionId = playerCharacterEntity.ConnectionId;
            CentralServerPeerInfo peerInfo;
            MapInfo mapInfo;

            if (!string.IsNullOrEmpty(mapName) &&
                (!mapName.Equals(playerCharacterEntity.CurrentMapName) || forceChangeMap) &&
                playerCharacters.ContainsKey(connectionId) &&
                mapServerConnectionIdsBySceneName.TryGetValue(mapName, out peerInfo) &&
                GameInstance.MapInfos.TryGetValue(mapName, out mapInfo) &&
                mapInfo.IsSceneSet())
            {
                // Add this character to warping list
                playerCharacterEntity.IsWarping = true;
                // Unregister player character
                UnregisterPlayerCharacter(connectionId);
                // Clone character data to save
                PlayerCharacterData savingCharacterData = new PlayerCharacterData();
                playerCharacterEntity.CloneTo(savingCharacterData);
                savingCharacterData.CurrentMapName  = mapName;
                savingCharacterData.CurrentPosition = position;
                while (savingCharacters.Contains(savingCharacterData.Id))
                {
                    yield return(0);
                }
                yield return(StartCoroutine(SaveCharacterRoutine(savingCharacterData)));

                // Remove this character from warping list
                playerCharacterEntity.IsWarping = false;
                // Destroy character from server
                playerCharacterEntity.NetworkDestroy();
                // Send message to client to warp
                MMOWarpMessage message = new MMOWarpMessage();
                message.networkAddress = peerInfo.networkAddress;
                message.networkPort    = peerInfo.networkPort;
                message.connectKey     = peerInfo.connectKey;
                ServerSendPacket(connectionId, DeliveryMethod.ReliableOrdered, MsgTypes.Warp, message);
            }
        }
示例#9
0
    private void OnClickCreate()
    {
        var gameInstance = GameInstance.Singleton;
        var selectedUI   = SelectionManager.SelectedUI;

        if (selectedUI == null)
        {
            UISceneGlobal.Singleton.ShowMessageDialog("Cannot create character", "Please select character class");
            Debug.LogWarning("Cannot create character, did not selected character class");
            return;
        }
        var dataId                 = selectedUI.dataId;
        var characterName          = inputCharacterName.text.Trim();
        var minCharacterNameLength = gameInstance.minCharacterNameLength;
        var maxCharacterNameLength = gameInstance.maxCharacterNameLength;

        if (characterName.Length < minCharacterNameLength)
        {
            UISceneGlobal.Singleton.ShowMessageDialog("Cannot create character", "Character name is too short");
            Debug.LogWarning("Cannot create character, character name is too short");
            return;
        }
        if (characterName.Length > maxCharacterNameLength)
        {
            UISceneGlobal.Singleton.ShowMessageDialog("Cannot create character", "Character name is too long");
            Debug.LogWarning("Cannot create character, character name is too long");
            return;
        }

        var characterId   = GenericUtils.GetUniqueId();
        var characterData = new PlayerCharacterData();

        characterData.Id = characterId;
        characterData.SetNewCharacterData(characterName, dataId);
        characterData.SavePersistentCharacterData();

        if (eventOnCreateCharacter != null)
        {
            eventOnCreateCharacter.Invoke();
        }
    }
        private async UniTask SaveCharacter(BasePlayerCharacterEntity playerCharacterEntity,
                                            bool changeMap   = false, string mapName = "",
                                            Vector3 position = new Vector3(), bool overrideRotation = false, Vector3 rotation = new Vector3())
        {
            PlayerCharacterData savingCharacterData = playerCharacterEntity.CloneTo(new PlayerCharacterData());

            if (changeMap)
            {
                savingCharacterData.CurrentMapName  = mapName;
                savingCharacterData.CurrentPosition = position;
                if (overrideRotation)
                {
                    savingCharacterData.CurrentRotation = rotation;
                }
            }
            List <CharacterBuff> summonBuffs = new List <CharacterBuff>();
            CharacterSummon      tempSummon;
            CharacterBuff        tempBuff;

            for (int i = 0; i < playerCharacterEntity.Summons.Count; ++i)
            {
                tempSummon = playerCharacterEntity.Summons[i];
                if (tempSummon == null || tempSummon.CacheEntity == null || tempSummon.CacheEntity.Buffs == null || tempSummon.CacheEntity.Buffs.Count == 0)
                {
                    continue;
                }
                for (int j = 0; j < tempSummon.CacheEntity.Buffs.Count; ++j)
                {
                    tempBuff = tempSummon.CacheEntity.Buffs[j];
                    summonBuffs.Add(new CharacterBuff()
                    {
                        id     = i + "_" + j,
                        type   = tempBuff.type,
                        dataId = tempBuff.dataId,
                        level  = tempBuff.level,
                        buffRemainsDuration = tempBuff.buffRemainsDuration,
                    });
                }
            }
            await SaveCharacterRoutine(savingCharacterData, summonBuffs);
        }
示例#11
0
    private void LoadCharacters()
    {
        SelectionManager.Clear();
        // Show list of characters that can be create
        var selectableCharacters = GameInstance.PlayerCharacters.Values.ToList();

        CacheList.Generate(selectableCharacters, (index, character, ui) =>
        {
            var dataId           = character.HashId;
            var characterData    = new PlayerCharacterData();
            characterData.DataId = dataId;
            characterData.SetNewCharacterData(character.title, character.HashId);
            var uiCharacter = ui.GetComponent <UICharacter>();
            uiCharacter.Setup(characterData, dataId);
            // Select trigger when add first entry so deactivate all models is okay beacause first model will active
            var characterModel = characterData.InstantiateModel(characterModelContainer);
            CharacterModels[characterData.dataId] = characterModel;
            characterModel.gameObject.SetActive(false);
            SelectionManager.Add(uiCharacter);
        });
    }
    public bool LivingMemberHasItemEquipped(string inId)
    {
        if (faction != Faction.PLAYER)
        {
            throw new System.Exception("This function cannot be called on an enemy team");
        }

        for (int i = 0; i < members.Count; i++)
        {
            if (!members[i].dead)
            {
                PlayerCharacterData pcd = (PlayerCharacterData)members[i];
                if (pcd.ItemOrVariantIsEquipped(inId))
                {
                    return(true);
                }
            }
        }

        return(false);
    }
示例#13
0
    // Use this for initialization
    void Start()
    {
        coloredTalents = new List <GameObject>();
        dataLoader     = new DataLoader();
        data           = dataLoader.LoadData();
        // TODO Fetch available talent trees and populate dropdown menu
        foreach (MenuTalentTreeData tree in data.GetTalentTreeData())
        {
            GameObject.Find("TalentTreeDropdown").GetComponent <TMP_Dropdown>().options.Add(new TMP_Dropdown.OptionData(tree.name));
        }
        // Dropdown bug is solved by this mess
        GameObject.Find("TalentTreeDropdown").GetComponent <TMP_Dropdown>().value = 1;
        GameObject.Find("TalentTreeDropdown").GetComponent <TMP_Dropdown>().value = 0;
        GameObject.Find("TalentTreeDropdown").GetComponent <TMP_Dropdown>().onValueChanged.AddListener(delegate { SwapTree(); });


        character = data.GetCharacter(data.GetEditCharacter());
        GameObject.Find("TotalTalents").GetComponent <TextMeshProUGUI>().text = "Total Talents: " + character.talents.Count;

        LoadNewTree();
    }
        private async UniTaskVoid WarpCharacterToInstanceRoutine(BasePlayerCharacterEntity playerCharacterEntity, string instanceId)
        {
            // If warping to different map
            long connectionId = playerCharacterEntity.ConnectionId;
            CentralServerPeerInfo      peerInfo;
            InstanceMapWarpingLocation warpingLocation;
            BaseMapInfo mapInfo;

            if (ServerUserHandlers.TryGetPlayerCharacter(connectionId, out _) &&
                instanceMapWarpingLocations.TryGetValue(instanceId, out warpingLocation) &&
                instanceMapServerConnectionIdsByInstanceId.TryGetValue(instanceId, out peerInfo) &&
                GameInstance.MapInfos.TryGetValue(warpingLocation.mapName, out mapInfo) &&
                mapInfo.IsSceneSet())
            {
                // Add this character to warping list
                playerCharacterEntity.IsWarping = true;
                // Unregister player character
                UnregisterPlayerCharacter(connectionId);
                // Clone character data to save
                PlayerCharacterData savingCharacterData = new PlayerCharacterData();
                playerCharacterEntity.CloneTo(savingCharacterData);
                // Wait to save character before move to instance map
                while (savingCharacters.Contains(savingCharacterData.Id))
                {
                    await UniTask.Yield();
                }
                await SaveCharacterRoutine(savingCharacterData, playerCharacterEntity.UserId);

                // Remove this character from warping list
                playerCharacterEntity.IsWarping = false;
                // Destroy character from server
                playerCharacterEntity.NetworkDestroy();
                // Send message to client to warp
                MMOWarpMessage message = new MMOWarpMessage();
                message.networkAddress = peerInfo.networkAddress;
                message.networkPort    = peerInfo.networkPort;
                ServerSendPacket(connectionId, DeliveryMethod.ReliableOrdered, GameNetworkingConsts.Warp, message);
            }
        }
        private IEnumerator WarpCharacterToInstanceRoutine(BasePlayerCharacterEntity playerCharacterEntity, string instanceId)
        {
            // If warping to different map
            long connectionId = playerCharacterEntity.ConnectionId;
            CentralServerPeerInfo          peerInfo;
            KeyValuePair <string, Vector3> warpingLocation;
            MapInfo mapInfo;

            if (playerCharacters.ContainsKey(connectionId) &&
                instanceMapWarpingLocations.TryGetValue(instanceId, out warpingLocation) &&
                instanceMapServerConnectionIdsByInstanceId.TryGetValue(instanceId, out peerInfo) &&
                GameInstance.MapInfos.TryGetValue(warpingLocation.Key, out mapInfo) &&
                mapInfo.IsSceneSet())
            {
                // Add this character to warping list
                playerCharacterEntity.IsWarping = true;
                // Unregister player character
                UnregisterPlayerCharacter(connectionId);
                // Clone character data to save
                PlayerCharacterData savingCharacterData = new PlayerCharacterData();
                playerCharacterEntity.CloneTo(savingCharacterData);
                while (savingCharacters.Contains(savingCharacterData.Id))
                {
                    yield return(0);
                }
                yield return(StartCoroutine(SaveCharacterRoutine(savingCharacterData)));

                // Remove this character from warping list
                playerCharacterEntity.IsWarping = false;
                // Destroy character from server
                playerCharacterEntity.NetworkDestroy();
                // Send message to client to warp
                MMOWarpMessage message = new MMOWarpMessage();
                message.networkAddress = peerInfo.networkAddress;
                message.networkPort    = peerInfo.networkPort;
                message.connectKey     = peerInfo.connectKey;
                ServerSendPacket(connectionId, DeliveryMethod.ReliableOrdered, MsgTypes.Warp, message);
            }
        }
示例#16
0
    public void GetObjectData(System.Object obj,
                              SerializationInfo info, StreamingContext context)
    {
        PlayerCharacterData data = (PlayerCharacterData)obj;

        info.AddValue("id", data.Id);
        info.AddValue("dataId", data.DataId);
        info.AddValue("entityId", data.EntityId);
        info.AddValue("characterName", data.CharacterName);
        info.AddValue("level", data.Level);
        info.AddValue("exp", data.Exp);
        info.AddValue("currentHp", data.CurrentHp);
        info.AddValue("currentMp", data.CurrentMp);
        info.AddValue("currentStamina", data.CurrentStamina);
        info.AddValue("currentFood", data.CurrentFood);
        info.AddValue("currentWater", data.CurrentWater);
        info.AddValue("equipWeapons", data.EquipWeapons);
        info.AddListValue("attributes", data.Attributes);
        info.AddListValue("skills", data.Skills);
        info.AddListValue("skillUsages", data.SkillUsages);
        info.AddListValue("buffs", data.Buffs);
        info.AddListValue("equipItems", data.EquipItems);
        info.AddListValue("nonEquipItems", data.NonEquipItems);
        info.AddListValue("summons", data.Summons);
        // Player Character
        info.AddValue("statPoint", data.StatPoint);
        info.AddValue("skillPoint", data.SkillPoint);
        info.AddValue("gold", data.Gold);
        info.AddValue("userGold", data.UserGold);
        info.AddValue("userCash", data.UserCash);
        info.AddValue("currentMapName", data.CurrentMapName);
        info.AddValue("currentPosition", data.CurrentPosition);
        info.AddValue("respawnMapName", data.RespawnMapName);
        info.AddValue("respawnPosition", data.RespawnPosition);
        info.AddValue("lastUpdate", data.LastUpdate);
        info.AddListValue("hotkeys", data.Hotkeys);
        info.AddListValue("quests", data.Quests);
        this.InvokeInstanceDevExtMethods("GetObjectData", obj, info, context);
    }
示例#17
0
    public void Reset()
    {
        scene = "";
        pos   = Vector2.zero;
        dir   = Vector2.zero;

        // Reset party members to default
        party.Clear();
        // Add Chip to party
        PlayerCharacterData dataChipFletcher = new PlayerCharacterData();

        dataChipFletcher.name    = "Chip";
        dataChipFletcher.level   = 1;
        dataChipFletcher.exp     = 0;
        dataChipFletcher.health  = 100;
        dataChipFletcher.gridPos = 0;
        party.Add(dataChipFletcher);
        PlayerCharacterData dataChipFletcher2 = new PlayerCharacterData();

        dataChipFletcher2.name    = "Chip";
        dataChipFletcher2.level   = 1;
        dataChipFletcher2.exp     = 0;
        dataChipFletcher2.health  = 100;
        dataChipFletcher2.gridPos = 2;
        party.Add(dataChipFletcher2);

        inventory.Clear();
        ItemData apple = new ItemData
        {
            name        = "Apple",
            quantity    = 1,
            isEquipment = false,
            isCatalyst  = false
        };

        inventory.Add(apple);
    }
        public void AddCharStatus(Byte ShowType, PlayerCharacterData Char)
        {
            PlayerTransactionData Tran;

            if ((Char == null))
            {
                return;
            }
            Tran = new PlayerTransactionData()
            {
                Types        = ShowType,
                TypeID       = Char.TypeID,
                Index        = Char.Index,
                PreviousQuan = 0,
                NewQuan      = 0,
                UCC          = string.Empty,
                C0_SLOT      = Char.Power,
                C1_SLOT      = Char.Control,
                C2_SLOT      = Char.Impact,
                C3_SLOT      = Char.Spin,
                C4_SLOT      = Char.Curve
            };
            this.AddInfo(Tran);
        }
        private IEnumerator WarpCharacterRoutine(BasePlayerCharacterEntity playerCharacterEntity, string mapName, Vector3 position)
        {
            // If warping to different map
            var connectId = playerCharacterEntity.ConnectionId;
            CentralServerPeerInfo peerInfo;

            if (!string.IsNullOrEmpty(mapName) &&
                !mapName.Equals(playerCharacterEntity.CurrentMapName) &&
                playerCharacters.ContainsKey(connectId) &&
                mapServerConnectionIdsBySceneName.TryGetValue(mapName, out peerInfo))
            {
                // Unregister player character
                UnregisterPlayerCharacter(connectId);
                // Clone character data to save
                var savingCharacterData = new PlayerCharacterData();
                playerCharacterEntity.CloneTo(savingCharacterData);
                // Save character current map / position
                savingCharacterData.CurrentMapName  = mapName;
                savingCharacterData.CurrentPosition = position;
                while (savingCharacters.Contains(savingCharacterData.Id))
                {
                    yield return(0);
                }
                yield return(StartCoroutine(SaveCharacterRoutine(savingCharacterData)));

                // Destroy character from server
                playerCharacterEntity.NetworkDestroy();
                // Send message to client to warp
                var message = new MMOWarpMessage();
                message.sceneName      = mapName;
                message.networkAddress = peerInfo.networkAddress;
                message.networkPort    = peerInfo.networkPort;
                message.connectKey     = peerInfo.connectKey;
                ServerSendPacket(connectId, SendOptions.ReliableOrdered, MsgTypes.Warp, message);
            }
        }
        private async UniTask SaveCharacterRoutine(PlayerCharacterData playerCharacterData, List <CharacterBuff> summonBuffs)
        {
            if (playerCharacterData != null && !savingCharacters.Contains(playerCharacterData.Id))
            {
                savingCharacters.Add(playerCharacterData.Id);
                // Update character
                await DbServiceClient.UpdateCharacterAsync(new UpdateCharacterReq()
                {
                    CharacterData = playerCharacterData,
                });

                await DbServiceClient.SetSummonBuffsAsync(new SetSummonBuffsReq()
                {
                    CharacterId = playerCharacterData.Id,
                    SummonBuffs = summonBuffs,
                });

                savingCharacters.Remove(playerCharacterData.Id);
                if (LogInfo)
                {
                    Logging.Log(LogTag, "Character [" + playerCharacterData.Id + "] Saved");
                }
            }
        }
        private async UniTaskVoid SetPlayerReadyRoutine(long connectionId, string userId, string selectCharacterId)
        {
            CharacterResp characterResp = await DbServiceClient.ReadCharacterAsync(new ReadCharacterReq()
            {
                UserId      = userId,
                CharacterId = selectCharacterId
            });

            PlayerCharacterData playerCharacterData = characterResp.CharacterData;

            // If data is empty / cannot find character, disconnect user
            if (playerCharacterData == null)
            {
                if (LogError)
                {
                    Logging.LogError(LogTag, "Cannot find select character: " + selectCharacterId + " for user: "******"Cannot find player character with entity Id: " + playerCharacterData.EntityId);
                    }
                    Transport.ServerDisconnect(connectionId);
                }
                else
                {
                    // Prepare saving location for this character
                    string  savingCurrentMapName  = playerCharacterData.CurrentMapName;
                    Vector3 savingCurrentPosition = playerCharacterData.CurrentPosition;

                    if (IsInstanceMap())
                    {
                        playerCharacterData.CurrentPosition = MapInstanceWarpToPosition;
                        if (MapInstanceWarpOverrideRotation)
                        {
                            playerCharacterData.CurrentRotation = MapInstanceWarpToRotation;
                        }
                    }

                    // Spawn character entity and set its data
                    Quaternion characterRotation = Quaternion.identity;
                    if (CurrentGameInstance.DimensionType == DimensionType.Dimension3D)
                    {
                        characterRotation = Quaternion.Euler(playerCharacterData.CurrentRotation);
                    }
                    GameObject spawnObj = Instantiate(entityPrefab.gameObject, playerCharacterData.CurrentPosition, characterRotation);
                    BasePlayerCharacterEntity playerCharacterEntity = spawnObj.GetComponent <BasePlayerCharacterEntity>();
                    playerCharacterData.CloneTo(playerCharacterEntity);
                    Assets.NetworkSpawn(spawnObj, 0, connectionId);

                    // Set currencies
                    // Gold
                    GoldResp getGoldResp = await DbServiceClient.GetGoldAsync(new GetGoldReq()
                    {
                        UserId = userId
                    });

                    playerCharacterEntity.UserGold = getGoldResp.Gold;
                    // Cash
                    CashResp getCashResp = await DbServiceClient.GetCashAsync(new GetCashReq()
                    {
                        UserId = userId
                    });

                    playerCharacterEntity.UserCash = getCashResp.Cash;

                    // Prepare saving location for this character
                    if (IsInstanceMap())
                    {
                        instanceMapCurrentLocations.TryAdd(playerCharacterEntity.ObjectId, new KeyValuePair <string, Vector3>(savingCurrentMapName, savingCurrentPosition));
                    }

                    // Set user Id
                    playerCharacterEntity.UserId = userId;

                    // Load user level
                    GetUserLevelResp getUserLevelResp = await DbServiceClient.GetUserLevelAsync(new GetUserLevelReq()
                    {
                        UserId = userId
                    });

                    playerCharacterEntity.UserLevel = getUserLevelResp.UserLevel;

                    // Load party data, if this map-server does not have party data
                    if (playerCharacterEntity.PartyId > 0)
                    {
                        if (!ServerPartyHandlers.ContainsParty(playerCharacterEntity.PartyId))
                        {
                            await LoadPartyRoutine(playerCharacterEntity.PartyId);
                        }
                        PartyData party;
                        if (ServerPartyHandlers.TryGetParty(playerCharacterEntity.PartyId, out party))
                        {
                            ServerGameMessageHandlers.SendSetPartyData(playerCharacterEntity.ConnectionId, party);
                            ServerGameMessageHandlers.SendAddPartyMembersToOne(playerCharacterEntity.ConnectionId, party);
                        }
                        else
                        {
                            playerCharacterEntity.ClearParty();
                        }
                    }

                    // Load guild data, if this map-server does not have guild data
                    if (playerCharacterEntity.GuildId > 0)
                    {
                        if (!ServerGuildHandlers.ContainsGuild(playerCharacterEntity.GuildId))
                        {
                            await LoadGuildRoutine(playerCharacterEntity.GuildId);
                        }
                        GuildData guild;
                        if (ServerGuildHandlers.TryGetGuild(playerCharacterEntity.GuildId, out guild))
                        {
                            playerCharacterEntity.GuildName = guild.guildName;
                            playerCharacterEntity.GuildRole = guild.GetMemberRole(playerCharacterEntity.Id);
                            ServerGameMessageHandlers.SendSetGuildData(playerCharacterEntity.ConnectionId, guild);
                            ServerGameMessageHandlers.SendAddGuildMembersToOne(playerCharacterEntity.ConnectionId, guild);
                            ServerGameMessageHandlers.SendSetGuildMessage(playerCharacterEntity.ConnectionId, guild);
                            ServerGameMessageHandlers.SendSetGuildRolesToOne(playerCharacterEntity.ConnectionId, guild);
                            ServerGameMessageHandlers.SendSetGuildMemberRolesToOne(playerCharacterEntity.ConnectionId, guild);
                            ServerGameMessageHandlers.SendSetGuildSkillLevelsToOne(playerCharacterEntity.ConnectionId, guild);
                            ServerGameMessageHandlers.SendSetGuildGold(playerCharacterEntity.ConnectionId, guild);
                            ServerGameMessageHandlers.SendSetGuildLevelExpSkillPoint(playerCharacterEntity.ConnectionId, guild);
                        }
                        else
                        {
                            playerCharacterEntity.ClearGuild();
                        }
                    }

                    // Summon saved summons
                    for (int i = 0; i < playerCharacterEntity.Summons.Count; ++i)
                    {
                        CharacterSummon summon = playerCharacterEntity.Summons[i];
                        summon.Summon(playerCharacterEntity, summon.Level, summon.summonRemainsDuration, summon.Exp, summon.CurrentHp, summon.CurrentMp);
                        playerCharacterEntity.Summons[i] = summon;
                    }

                    // Summon saved mount entity
                    if (GameInstance.VehicleEntities.ContainsKey(playerCharacterData.MountDataId))
                    {
                        playerCharacterEntity.Mount(GameInstance.VehicleEntities[playerCharacterData.MountDataId]);
                    }

                    // Force make caches, to calculate current stats to fill empty slots items
                    playerCharacterEntity.ForceMakeCaches();
                    playerCharacterEntity.FillEmptySlots();

                    // Notify clients that this character is spawn or dead
                    if (!playerCharacterEntity.IsDead())
                    {
                        playerCharacterEntity.CallAllOnRespawn();
                    }
                    else
                    {
                        playerCharacterEntity.CallAllOnDead();
                    }

                    // Register player character entity to the server
                    RegisterPlayerCharacter(connectionId, playerCharacterEntity);
                }
            }
        }
示例#22
0
        private void OnRequestedCharacters(ResponseHandlerData responseHandler, AckResponseCode responseCode, ResponseCharactersMessage response)
        {
            // Clear character list
            CacheCharacterSelectionManager.Clear();
            CacheCharacterList.HideAll();
            // Unable buttons
            buttonStart.gameObject.SetActive(false);
            buttonDelete.gameObject.SetActive(false);
            // Remove all models
            characterModelContainer.RemoveChildren();
            CharacterModelById.Clear();
            // Remove all cached data
            PlayerCharacterDataById.Clear();
            // Proceed response
            List <PlayerCharacterData> selectableCharacters = new List <PlayerCharacterData>();

            if (!responseCode.ShowUnhandledResponseMessageDialog(response.message))
            {
                // Success, so set selectable characters by response's data
                selectableCharacters = response.characters;
            }
            // Show list of created characters
            for (int i = selectableCharacters.Count - 1; i >= 0; --i)
            {
                PlayerCharacterData selectableCharacter = selectableCharacters[i];
                if (selectableCharacter == null ||
                    !GameInstance.PlayerCharacterEntities.ContainsKey(selectableCharacter.EntityId) ||
                    !GameInstance.PlayerCharacters.ContainsKey(selectableCharacter.DataId))
                {
                    // If invalid entity id or data id, remove from selectable character list
                    selectableCharacters.RemoveAt(i);
                }
            }

            if (GameInstance.Singleton.maxCharacterSaves > 0 &&
                selectableCharacters.Count >= GameInstance.Singleton.maxCharacterSaves)
            {
                eventOnNotAbleToCreateCharacter.Invoke();
            }
            else
            {
                eventOnAbleToCreateCharacter.Invoke();
            }

            // Clear selected character data, will select first in list if available
            selectedPlayerCharacterData = null;

            // Generate list entry by saved characters
            if (selectableCharacters.Count > 0)
            {
                selectableCharacters.Sort(new PlayerCharacterDataLastUpdateComparer().Desc());
                CacheCharacterList.Generate(selectableCharacters, (index, characterData, ui) =>
                {
                    // Cache player character to dictionary, we will use it later
                    PlayerCharacterDataById[characterData.Id] = characterData;
                    // Setup UIs
                    UICharacter uiCharacter = ui.GetComponent <UICharacter>();
                    uiCharacter.Data        = characterData;
                    // Select trigger when add first entry so deactivate all models is okay beacause first model will active
                    BaseCharacterModel characterModel = characterData.InstantiateModel(characterModelContainer);
                    if (characterModel != null)
                    {
                        CharacterModelById[characterData.Id] = characterModel;
                        characterModel.SetEquipWeapons(characterData.EquipWeapons);
                        characterModel.SetEquipItems(characterData.EquipItems);
                        characterModel.gameObject.SetActive(false);
                        CacheCharacterSelectionManager.Add(uiCharacter);
                    }
                });
            }
            else
            {
                eventOnNoCharacter.Invoke();
            }
        }
示例#23
0
 private void SerializeCreateCharacterExtra(PlayerCharacterData characterData, NetDataWriter writer)
 {
     this.InvokeInstanceDevExtMethods("SerializeCreateCharacterExtra", characterData, writer);
 }
示例#24
0
 private void DeserializeCreateCharacterExtra(PlayerCharacterData characterData, NetDataReader reader)
 {
     this.InvokeInstanceDevExtMethods("DeserializeCreateCharacterExtra", characterData, reader);
 }
        public override PlayerCharacterData ReadCharacter(
            string userId,
            string id,
            bool withEquipWeapons  = true,
            bool withAttributes    = true,
            bool withSkills        = true,
            bool withSkillUsages   = true,
            bool withBuffs         = true,
            bool withEquipItems    = true,
            bool withNonEquipItems = true,
            bool withSummons       = true,
            bool withHotkeys       = true,
            bool withQuests        = true)
        {
            var reader = ExecuteReader("SELECT * FROM characters WHERE id=@id AND userId=@userId LIMIT 1",
                                       new MySqlParameter("@id", id),
                                       new MySqlParameter("@userId", userId));
            var result = new PlayerCharacterData();

            if (ReadCharacter(reader, out result))
            {
                this.InvokeInstanceDevExtMethods("ReadCharacter",
                                                 userId,
                                                 id,
                                                 withEquipWeapons,
                                                 withAttributes,
                                                 withSkills,
                                                 withSkillUsages,
                                                 withBuffs,
                                                 withEquipItems,
                                                 withNonEquipItems,
                                                 withSummons,
                                                 withHotkeys,
                                                 withQuests);
                if (withEquipWeapons)
                {
                    result.EquipWeapons = ReadCharacterEquipWeapons(id);
                }
                if (withAttributes)
                {
                    result.Attributes = ReadCharacterAttributes(id);
                }
                if (withSkills)
                {
                    result.Skills = ReadCharacterSkills(id);
                }
                if (withSkillUsages)
                {
                    result.SkillUsages = ReadCharacterSkillUsages(id);
                }
                if (withBuffs)
                {
                    result.Buffs = ReadCharacterBuffs(id);
                }
                if (withEquipItems)
                {
                    result.EquipItems = ReadCharacterEquipItems(id);
                }
                if (withNonEquipItems)
                {
                    result.NonEquipItems = ReadCharacterNonEquipItems(id);
                }
                if (withSummons)
                {
                    result.Summons = ReadCharacterSummons(id);
                }
                if (withHotkeys)
                {
                    result.Hotkeys = ReadCharacterHotkeys(id);
                }
                if (withQuests)
                {
                    result.Quests = ReadCharacterQuests(id);
                }
                return(result);
            }
            return(null);
        }
示例#26
0
    private void EarnLootForCharacter(CharacterData inCharacter)
    {
        //REMOVED: local stat reporting

        if (inCharacter is EnemyCharacterData)
        {
            EnemyCharacterData enemy     = (EnemyCharacterData)inCharacter;
            LootBundle         enemyLoot = PoolManager.poolLootBundles.GetNext();

            //REMOVED: local stat reporting

            //only earn gold if the enemy isn't ore
            if (!enemy.isOre)
            {
                long goldDrop = enemy.GetGoldValue();
                goldDrop = adventure.BoostGoldByActiveMultipliers(goldDrop, true);
                enemyLoot.AddGold(goldDrop);
            }

            //were they holding essence?
            if (enemy.hasEssence)
            {
                long baseEssence  = enemy.GetEssence();
                long extraEssence = 0;

                //if the last skill used was strike, and it was from a player character, and they have an essence reaver equipped, +1 essence
                if ((activeSkillCommand.skill.id == SkillId.STRIKE || activeSkillCommand.skill.id == SkillId.DUAL_STRIKE) && activeSkillCommand.source is PlayerCharacterData)
                {
                    PlayerCharacterData pcd       = (PlayerCharacterData)activeSkillCommand.source;
                    int numEssenceReaversEquipped = pcd.NumItemOrVariantEquipped(ItemId.ESSENCE_REAVER);

                    //if the skill was a regular strike make sure we cap this back to 1: even if the character has two equipped they only get credit for both if dual strike was used
                    if (activeSkillCommand.skill.id == SkillId.STRIKE && numEssenceReaversEquipped > 1)
                    {
                        numEssenceReaversEquipped = 1;
                    }

                    if (numEssenceReaversEquipped > 0)
                    {
                        extraEssence += (long)(baseEssence * (numEssenceReaversEquipped * .15));
                    }
                }

                //check for essence boost from cook
                if (adventure.nextEnemyEssenceBoostPercent > 0)
                {
                    float extraFraction = (adventure.nextEnemyEssenceBoostPercent / 100f);
                    extraEssence += (long)(baseEssence * extraFraction);
                    adventure.nextEnemyEssenceBoostPercent = 0;
                }

                enemyLoot.AddEssence(baseEssence + extraEssence);
            }

            int dropChance = enemy.dropRate;

            //the default drop rate for enemies is currently 1 in 9
            //100 item find = an extra 10 drop chance (max 10)
            int additionalDropChance = playerTeam.teamItemFindBonus / 10;
            if (additionalDropChance > 10)
            {
                additionalDropChance = 10;
            }
            dropChance -= additionalDropChance;
            if (dropChance < 1)
            {
                dropChance = 1;
            }

            if (dropChance != 0)
            {
                //int roll = UnityEngine.Random.Range(1, dropChance);
                if (Utils.OneIn(dropChance))
                {
                    string itemDropId = "";

                    //chance to drop an item from this area. otherwise drop the enemy's material
                    bool enemyDropsAreaItem = Utils.PercentageChance(33);
                    if (enemy.dropRate == 1 || enemy.isOre)
                    {
                        enemyDropsAreaItem = false;                                     //ore always drops its material, and a native drop rate of "1" means the enemy is always meant to drop their item (1 in 1 chance)
                    }
                    if (enemy.HasItemDrops())
                    {
                        if (enemyDropsAreaItem)
                        {
                            itemDropId = adventure.RollItemForArea();
                        }
                        else
                        {
                            itemDropId = enemy.GetRandomItemDrop();
                        }
                    }
                    else
                    {
                        if (enemyDropsAreaItem)
                        {
                            itemDropId = adventure.RollItemForArea();
                        }
                        else
                        {
                            //no materials and no chance of area item drop? they get NOTHING
                        }
                    }

                    if (itemDropId != "")
                    {
                        int dropQuantity = 1;
                        if (enemy.isOre)
                        {
                            dropQuantity += adventure.nextOreBonusDrops;
                            adventure.nextOreBonusDrops = 0;
                        }
                        enemyLoot.AddLoot(LootType.ITEM, itemDropId, dropQuantity);
                    }
                }
            }

            int keysEarned = 0;
            if (curFile.FlagIsSet(Flag.SEEN_ADVENTURE_KEY))
            {
                if (enemy.rank == EnemyRank.MBOS || enemy.rank == EnemyRank.BOSS)
                {
                    int chance = 0;
                    if (adventure.battleNum < 100)
                    {
                        chance = 15;
                    }
                    else if (adventure.battleNum < 200)
                    {
                        chance = 10;
                    }
                    else if (adventure.battleNum < 250)
                    {
                        chance = 5;
                    }

                    if (enemy.rank == EnemyRank.BOSS)
                    {
                        chance += 10;
                    }

                    chance += adventure.playerTeam.teamKeyBonus;

                    //chance currently caps at 70%
                    if (chance > 70)
                    {
                        chance = 70;
                    }

                    if (Utils.PercentageChance(chance))
                    {
                        keysEarned++;
                    }
                }
            }
            else
            {
                //is it time to give them their first key?
                if (adventure.battleNum >= 25 && enemy.rank == EnemyRank.MBOS && curFile.FlagIsSet(Flag.SEEN_ALT_PATH) && !adventure.isInteractiveCutscene)
                {
                    keysEarned = 1;
                }
            }

            //chance to earn an enigmatic fragment/remnant?
            if (enemy.tempered && Utils.OneIn(100))
            {
                enemyLoot.AddLoot(LootType.ITEM, ItemId.ENIGMATIC_SHARD, 1);
            }

            //report what loot was earned
            if (EEnemyLootEarned != null)
            {
                EEnemyLootEarned(inCharacter, enemyLoot, keysEarned);
            }

            PoolManager.Recycle(enemyLoot);
        }
    }
        private void OnRequestedCharacters(AckResponseCode responseCode, BaseAckMessage message)
        {
            ResponseCharactersMessage castedMessage = (ResponseCharactersMessage)message;

            CacheCharacterSelectionManager.Clear();
            // Unenabled buttons
            buttonStart.gameObject.SetActive(false);
            buttonDelete.gameObject.SetActive(false);
            // Remove all models
            characterModelContainer.RemoveChildren();
            CharacterModelById.Clear();
            // Remove all cached data
            PlayerCharacterDataById.Clear();

            List <PlayerCharacterData> selectableCharacters = new List <PlayerCharacterData>();

            switch (responseCode)
            {
            case AckResponseCode.Error:
                string errorMessage = string.Empty;
                switch (castedMessage.error)
                {
                case ResponseCharactersMessage.Error.NotLoggedin:
                    errorMessage = LanguageManager.GetText(UILocaleKeys.UI_ERROR_NOT_LOGGED_IN.ToString());
                    break;
                }
                UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_LABEL_ERROR.ToString()), errorMessage);
                break;

            case AckResponseCode.Timeout:
                UISceneGlobal.Singleton.ShowMessageDialog(LanguageManager.GetText(UILocaleKeys.UI_LABEL_ERROR.ToString()), LanguageManager.GetText(UILocaleKeys.UI_ERROR_CONNECTION_TIMEOUT.ToString()));
                break;

            default:
                selectableCharacters = castedMessage.characters;
                break;
            }

            // Show list of created characters
            for (int i = selectableCharacters.Count - 1; i >= 0; --i)
            {
                PlayerCharacterData selectableCharacter = selectableCharacters[i];
                if (selectableCharacter == null || !GameInstance.PlayerCharacters.ContainsKey(selectableCharacter.DataId))
                {
                    selectableCharacters.RemoveAt(i);
                }
            }
            selectableCharacters.Sort(new PlayerCharacterDataLastUpdateComparer().Desc());
            CacheCharacterList.Generate(selectableCharacters, (index, characterData, ui) =>
            {
                // Cache player character to dictionary, we will use it later
                PlayerCharacterDataById[characterData.Id] = characterData;
                UICharacter uiCharacter = ui.GetComponent <UICharacter>();
                uiCharacter.Data        = characterData;
                // Select trigger when add first entry so deactivate all models is okay beacause first model will active
                BaseCharacterModel characterModel = characterData.InstantiateModel(characterModelContainer);
                if (characterModel != null)
                {
                    CharacterModelById[characterData.Id] = characterModel;
                    characterModel.gameObject.SetActive(false);
                    characterModel.SetEquipWeapons(characterData.EquipWeapons);
                    characterModel.SetEquipItems(characterData.EquipItems);
                    CacheCharacterSelectionManager.Add(uiCharacter);
                }
            });
        }
        public override async UniTask <PlayerCharacterData> ReadCharacter(
            string id,
            bool withEquipWeapons  = true,
            bool withAttributes    = true,
            bool withSkills        = true,
            bool withSkillUsages   = true,
            bool withBuffs         = true,
            bool withEquipItems    = true,
            bool withNonEquipItems = true,
            bool withSummons       = true,
            bool withHotkeys       = true,
            bool withQuests        = true,
            bool withCurrencies    = true)
        {
            PlayerCharacterData result = null;

            await ExecuteReader((reader) =>
            {
                ReadCharacter(reader, out result);
            }, "SELECT " +
                                "id, dataId, entityId, factionId, characterName, level, exp, " +
                                "currentHp, currentMp, currentStamina, currentFood, currentWater, " +
                                "equipWeaponSet, statPoint, skillPoint, gold, partyId, guildId, guildRole, sharedGuildExp, " +
                                "currentMapName, currentPositionX, currentPositionY, currentPositionZ, currentRotationX, currentRotationY, currentRotationZ," +
                                "respawnMapName, respawnPositionX, respawnPositionY, respawnPositionZ," +
                                "mountDataId, updateAt FROM characters WHERE id=@id LIMIT 1",
                                new MySqlParameter("@id", id));

            // Found character, then read its relates data
            if (result != null)
            {
                List <EquipWeapons>        selectableWeaponSets = new List <EquipWeapons>();
                List <CharacterAttribute>  attributes           = new List <CharacterAttribute>();
                List <CharacterSkill>      skills        = new List <CharacterSkill>();
                List <CharacterSkillUsage> skillUsages   = new List <CharacterSkillUsage>();
                List <CharacterBuff>       buffs         = new List <CharacterBuff>();
                List <CharacterItem>       equipItems    = new List <CharacterItem>();
                List <CharacterItem>       nonEquipItems = new List <CharacterItem>();
                List <CharacterSummon>     summons       = new List <CharacterSummon>();
                List <CharacterHotkey>     hotkeys       = new List <CharacterHotkey>();
                List <CharacterQuest>      quests        = new List <CharacterQuest>();
                List <CharacterCurrency>   currencies    = new List <CharacterCurrency>();
                // Read data
                List <UniTask> tasks = new List <UniTask>();
                if (withEquipWeapons)
                {
                    tasks.Add(ReadCharacterEquipWeapons(id, selectableWeaponSets));
                }
                if (withAttributes)
                {
                    tasks.Add(ReadCharacterAttributes(id, attributes));
                }
                if (withSkills)
                {
                    tasks.Add(ReadCharacterSkills(id, skills));
                }
                if (withSkillUsages)
                {
                    tasks.Add(ReadCharacterSkillUsages(id, skillUsages));
                }
                if (withBuffs)
                {
                    tasks.Add(ReadCharacterBuffs(id, buffs));
                }
                if (withEquipItems)
                {
                    tasks.Add(ReadCharacterEquipItems(id, equipItems));
                }
                if (withNonEquipItems)
                {
                    tasks.Add(ReadCharacterNonEquipItems(id, nonEquipItems));
                }
                if (withSummons)
                {
                    tasks.Add(ReadCharacterSummons(id, summons));
                }
                if (withHotkeys)
                {
                    tasks.Add(ReadCharacterHotkeys(id, hotkeys));
                }
                if (withQuests)
                {
                    tasks.Add(ReadCharacterQuests(id, quests));
                }
                if (withCurrencies)
                {
                    tasks.Add(ReadCharacterCurrencies(id, currencies));
                }
                await UniTask.WhenAll(tasks);

                // Assign read data
                if (withEquipWeapons)
                {
                    result.SelectableWeaponSets = selectableWeaponSets;
                }
                if (withAttributes)
                {
                    result.Attributes = attributes;
                }
                if (withSkills)
                {
                    result.Skills = skills;
                }
                if (withSkillUsages)
                {
                    result.SkillUsages = skillUsages;
                }
                if (withBuffs)
                {
                    result.Buffs = buffs;
                }
                if (withEquipItems)
                {
                    result.EquipItems = equipItems;
                }
                if (withNonEquipItems)
                {
                    result.NonEquipItems = nonEquipItems;
                }
                if (withSummons)
                {
                    result.Summons = summons;
                }
                if (withHotkeys)
                {
                    result.Hotkeys = hotkeys;
                }
                if (withQuests)
                {
                    result.Quests = quests;
                }
                if (withCurrencies)
                {
                    result.Currencies = currencies;
                }
                // Invoke dev extension methods
                this.InvokeInstanceDevExtMethods("ReadCharacter",
                                                 result,
                                                 withEquipWeapons,
                                                 withAttributes,
                                                 withSkills,
                                                 withSkillUsages,
                                                 withBuffs,
                                                 withEquipItems,
                                                 withNonEquipItems,
                                                 withSummons,
                                                 withHotkeys,
                                                 withQuests,
                                                 withCurrencies);
            }
            return(result);
        }
示例#29
0
 public void Deserialize(NetDataReader reader)
 {
     CharacterData = reader.GetValue <PlayerCharacterData>();
 }
示例#30
0
 public PlayerCharacter(PlayerCharacterData data, GameSession session) : base(data, session)
 {
 }