Example #1
0
        private InventoryItem[] ReadInventoryArray(int listPointer, bool excludeEmpty)
        {
            var list    = new List <InventoryItem>();
            int maxCnt  = _client.Mem.ReadInt(listPointer, 0x14);
            int pointer = _client.Mem.ResolveNestedPointer(listPointer, 0xC);

            for (int i = 0; i < maxCnt; i++)
            {
                var ins = _client.Mem.ReadStruct <InventoryItemStruct>(pointer, i * 4, 0);

                if (excludeEmpty && ins.Id == 0)
                {
                    continue;
                }

                list.Add(_client.StructToObject <InventoryItem>(ins));
            }

            return(list.ToArray());
        }
Example #2
0
 public Mob[] GetMobs(bool undeadOnly = false)
 {
     return(GetMobStructs()
            .Where(m => m.Type == 6)
            .Select(m => _client.StructToObject <Mob>(m))
            .Where(m => !undeadOnly || m.Action != MobAction.Death)
            .OrderBy(m => m.Distance)
            .ToArray());
 }