Example #1
0
        public List <D2Stat> GetStats(D2Unit unit)
        {
            if (unit == null)
            {
                return(null);
            }
            if (unit.StatListNode.IsNull)
            {
                return(null);
            }

            var node = reader.Read <D2StatListEx>(unit.StatListNode);

            // Get the best available stat array.
            D2StatArray statArray = node.BaseStats;

            if (node.ListFlags.HasFlag(StatListFlag.HasCompleteStats))
            {
                statArray = node.FullStats;
            }

            // Empty list.
            if (node.FullStats.Length == 0)
            {
                return(new List <D2Stat>());
            }

            // Return the array data and return as list.
            var stats = reader.ReadArray <D2Stat>(statArray.Address, statArray.Length);

            return(new List <D2Stat>(stats));
        }
Example #2
0
        public List <D2Stat> GetStats(D2Unit unit)
        {
            if (unit == null || unit.StatListNode.IsNull)
            {
                return(new List <D2Stat>(0));
            }

            var statsListNode = reader.Read <D2StatListEx>(unit.StatListNode);

            // Get the best available stat array.
            D2StatArray statArray = statsListNode.BestStatsArray();

            // Return the array data and return as list.
            var stats = reader.ReadArray <D2Stat>(statArray.Address, statArray.Length);

            return(new List <D2Stat>(stats));
        }