コード例 #1
0
        private static BuildUrlData ParsePoeplannerData(PoeplannerData data)
        {
            var result = new BuildUrlData {
                Version = data.Version
            };

            // There is a small bug in poeplanner, where class and ascendancy bytes are missing, when no one node was selected.
            // Need to check length
            if (data.NodesData.Length == 0)
            {
                return(result);
            }

            result.CharacterClass    = (CharacterClass)(data.NodesData[0] & 15);
            result.AscendancyClassId = data.NodesData[0] >> 4 & 15;

            if (data.NodesData.Length < 2)
            {
                return(result);
            }

            result.Bandit = ConvertBanditId(data.NodesData[1] & 3);

            if (data.NodesData.Length < 4)
            {
                return(result);
            }

            var skilledNodesCount = data.NodesData[2] << 8 | data.NodesData[3];
            int i = 4;

            while (i < 2 * skilledNodesCount + 4)
            {
                result.SkilledNodesIds.Add((ushort)(data.NodesData[i++] << 8 | data.NodesData[i++]));
            }

            var jeweledNodesCount = data.NodesData[i++];

            for (var j = 0; j < jeweledNodesCount; j++)
            {
                var nodeId             = data.NodesData[i++] << 8 | data.NodesData[i++];
                var jewelsDataBuffSize = data.NodesData[i++];

                var rawJewelData = data.NodesData.Skip(i++).Take(jewelsDataBuffSize).ToList();
                i = i + (jewelsDataBuffSize - 1);
                result.Jewels[nodeId] = rawJewelData;
            }

            return(result);
        }
コード例 #2
0
 public SkillTreeSerializer(BuildUrlData buildUrlData)
 {
     _buildUrlData = buildUrlData;
 }
コード例 #3
0
 public SkillTreeSerializer(BuildUrlData buildUrlData, ICollection <ushort> skillNodes)
 {
     _buildUrlData = buildUrlData;
     _skillNodes   = skillNodes;
 }