예제 #1
0
        public SkillReader(ProcessMemoryReader reader, GameMemoryTable memory)
        {
            this.reader = reader;

            globals      = reader.Read <D2GlobalData>(reader.ReadAddress32(memory.Address.GlobalData, AddressingMode.Relative));
            stringReader = new StringLookupTable(reader, memory.Address);
        }
예제 #2
0
        public string ToString(StringLookupTable stringLookupTable)
        {
            if (min == max)
            {
                // Example: "Adds 1 to minimum damage"
                return(_toString(stringLookupTable, new object[] { min }, equalStringId));
            }

            // Example: "Adds 1-2 damage"
            return(_toString(stringLookupTable, new object[] { min, max }, differStringId));
        }
예제 #3
0
 public UnitReader(
     ProcessMemoryReader reader,
     GameMemoryTable memory,
     StringLookupTable stringReader
     )
 {
     this.reader       = reader;
     this.memory       = memory;
     this.stringReader = stringReader;
     skillReader       = new SkillReader(reader, memory);
     inventoryReader   = createInventoryReader();
 }
예제 #4
0
        protected string _toString(StringLookupTable stringLookupTable, object[] args, ushort stringId)
        {
            string format = stringLookupTable.ConvertCFormatString(
                stringLookupTable.GetString(stringId),
                out int arguments
                );

            if (arguments != args.Length)
            {
                return(null);
            }
            return(string.Format(format, args).TrimEnd());
        }
예제 #5
0
        public new string ToString(StringLookupTable stringLookupTable)
        {
            int min = CalculatedDamage(this.min);
            int max = CalculatedDamage(this.max);

            if (min == max)
            {
                // Example: "6 Poison damage over 2 seconds"
                return(_toString(stringLookupTable, new object[] { min, CalculatedDuration() }, equalStringId));
            }

            // Example: "2-10 Poison damage over 2 seconds"
            return(_toString(stringLookupTable, new object[] { min, max, CalculatedDuration() }, differStringId));
        }
예제 #6
0
        public RangeStatData(StringLookupTable reader, List <D2Stat> stats)
        {
            stringReader = reader;

            damage          = new RangeStatDamage(StringConstants.DamageRange, StringConstants.DamageRange);
            damagePercent   = new RangeStatDamage(0, 0);
            fireDamage      = new RangeStatDamage(StringConstants.FireDamage, StringConstants.FireDamageRange);
            lightningDamage = new RangeStatDamage(StringConstants.LightningDamage, StringConstants.LightningDamageRange);
            coldDamage      = new RangeStatDamage(StringConstants.ColdDamage, StringConstants.ColdDamageRange);
            magicDamage     = new RangeStatDamage(StringConstants.MagicDamage, StringConstants.MagicDamageRange);
            poisonDamage    = new RangeStatPoisonDamage();

            ReadStatData(stats);
        }
예제 #7
0
        public ItemReader(
            ProcessMemoryReader reader,
            GameMemoryTable memory,
            StringLookupTable stringReader
            ) : base(reader, memory, stringReader)
        {
            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);
                }
            }
        }
예제 #8
0
 public UnitReader(ProcessMemoryReader reader, GameMemoryTable memory)
 {
     this.reader  = reader;
     this.memory  = memory;
     stringReader = new StringLookupTable(reader, memory.Address);
 }