Example #1
0
        public UnitReader(
            IProcessMemoryReader reader,
            GameMemoryTable memory,
            IStringReader stringReader,
            ISkillReader skillReader
            )
        {
            this.reader       = reader;
            this.stringReader = stringReader;
            this.skillReader  = skillReader;

            cachedItemData     = new Dictionary <IntPtr, D2ItemData>();
            cachedDescriptions = new Dictionary <int, D2ItemDescription>();

            globals          = reader.Read <D2GlobalData>(reader.ReadAddress32(memory.GlobalData));
            lowQualityTable  = reader.Read <D2SafeArray>(memory.LowQualityItems);
            descriptionTable = reader.Read <D2SafeArray>(memory.ItemDescriptions);
            magicModifiers   = reader.Read <ModifierTable>(memory.MagicModifierTable);
            rareModifiers    = reader.Read <ModifierTable>(memory.RareModifierTable);
            if (globals != null)
            {
                opNestings = reader.ReadArray <ushort>(globals.OpStatNesting, (int)globals.OpStatNestingCount);

                if (ItemStatCost == null && !globals.ItemStatCost.IsNull)
                {
                    ItemStatCost = reader.ReadArray <D2ItemStatCost>(globals.ItemStatCost, (int)globals.ItemStatCostCount);
                }
            }
        }
Example #2
0
        public SkillReader(IProcessMemoryReader reader, GameMemoryTable memory)
        {
            this.reader = reader;

            globals      = reader.Read <D2GlobalData>(reader.ReadAddress32(memory.GlobalData));
            stringReader = new StringReader(reader, memory);
        }
Example #3
0
        public ItemReader(ProcessMemoryReader reader, D2MemoryTable memory) : base(reader, memory)
        {
            cachedItemData     = new Dictionary <IntPtr, D2ItemData>();
            cachedDescriptions = new Dictionary <int, D2ItemDescription>();

            globals          = reader.Read <D2GlobalData>(reader.ReadAddress32(memory.Address.GlobalData, AddressingMode.Relative));
            lowQualityTable  = reader.Read <D2SafeArray>(memory.Address.LowQualityItems, AddressingMode.Relative);
            descriptionTable = reader.Read <D2SafeArray>(memory.Address.ItemDescriptions, AddressingMode.Relative);
            magicModifiers   = reader.Read <ModifierTable>(memory.Address.MagicModifierTable, AddressingMode.Relative);
            rareModifiers    = reader.Read <ModifierTable>(memory.Address.RareModifierTable, AddressingMode.Relative);
            if (globals != null)
            {
                opNestings = reader.ReadArray <ushort>(globals.OpStatNesting, (int)globals.OpStatNestingCount);

                if (ItemStatCost == null && !globals.ItemStatCost.IsNull)
                {
                    ItemStatCost = reader.ReadArray <D2ItemStatCost>(globals.ItemStatCost, (int)globals.ItemStatCostCount);
                }
            }
        }