Пример #1
0
        public override void CreateChildren()
        {
            CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                      "经验值",
                                                      unchecked (_newChildrenArgs.HeroAttributesAddress + 0x8C),
                                                      AddressListValueType.Integer));
            CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                      "力量",
                                                      unchecked (_newChildrenArgs.HeroAttributesAddress + 0x94),
                                                      AddressListValueType.Integer));
            CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                      "敏捷",
                                                      unchecked (_newChildrenArgs.HeroAttributesAddress + 0xA8),
                                                      AddressListValueType.Integer));

            using (WindowsApi.ProcessMemory mem = new WindowsApi.ProcessMemory(_gameContext.ProcessId))
            {
                UInt32 tmpAddress1;
                Int32  tmpValue1;
                tmpValue1   = mem.ReadInt32((IntPtr) unchecked (_newChildrenArgs.HeroAttributesAddress + 0x7C + 2 * 4));
                tmpAddress1 = War3Common.ReadGameValue1(
                    mem, _gameContext, _newChildrenArgs,
                    tmpValue1);
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "智力",
                                                          tmpAddress1,
                                                          AddressListValueType.Integer));
            }

            CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                      "可用技能点",
                                                      unchecked (_newChildrenArgs.HeroAttributesAddress + 0x90),
                                                      AddressListValueType.Integer));

            for (UInt32 LearningAbilityIndex = 1; LearningAbilityIndex <= 5; LearningAbilityIndex++)
            {
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "学习技能" + LearningAbilityIndex.ToString() + " - 名称",
                                                          unchecked (_newChildrenArgs.HeroAttributesAddress + 0xF0 + LearningAbilityIndex * 4),
                                                          AddressListValueType.Char4));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "学习技能" + LearningAbilityIndex.ToString() + " - 等级",
                                                          unchecked (_newChildrenArgs.HeroAttributesAddress + 0x108 + LearningAbilityIndex * 4),
                                                          AddressListValueType.Integer));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "学习技能" + LearningAbilityIndex.ToString() + " - 要求",
                                                          unchecked (_newChildrenArgs.HeroAttributesAddress + 0x120 + LearningAbilityIndex * 4),
                                                          AddressListValueType.Integer));
            }
        }
Пример #2
0
        public override void CreateChildren()
        {
            using (WindowsApi.ProcessMemory mem = new WindowsApi.ProcessMemory(_gameContext.ProcessId))
            {
                _newChildrenArgs.AttackAttributesAddress = mem.ReadUInt32((IntPtr) unchecked (_newChildrenArgs.ThisUnitAddress + _gameContext.AttackAttributesOffset));
                _newChildrenArgs.HeroAttributesAddress   = mem.ReadUInt32((IntPtr) unchecked (_newChildrenArgs.ThisUnitAddress + _gameContext.HeroAttributesOffset));

                if (_newChildrenArgs.AttackAttributesAddress > 0)
                {
                    base.CreateChild(TrainerNodeType.AttackAttributes, NodeIndex);
                    // base.CreateChild(TrainerNodeType.UnitAbility, NodeIndex);
                    base.CreateChild(TrainerNodeType.AllItems, NodeIndex);
                }

                if (_newChildrenArgs.HeroAttributesAddress > 0)
                {
                    base.CreateChild(TrainerNodeType.HeroAttributes, NodeIndex);
                }

                // Unit self propety(s)
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "单位名称",
                                                          unchecked (_newChildrenArgs.ThisUnitAddress + 0x30),
                                                          AddressListValueType.Char4));

                UInt32 tmpAddress1, tmpAddress2;
                Int32  tmpValue1, tmpValue2;
                tmpValue1   = mem.ReadInt32((IntPtr) unchecked (_newChildrenArgs.ThisUnitAddress + 0x98 + 0x8));
                tmpAddress1 = War3Common.ReadFromGameMemory(
                    mem, _gameContext, _newChildrenArgs,
                    tmpValue1);
                tmpAddress1 = unchecked (tmpAddress1 + 0x84);
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "HP - 目前",
                                                          unchecked (tmpAddress1 - 0xC),
                                                          AddressListValueType.Float));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "HP - 最大",
                                                          tmpAddress1,
                                                          AddressListValueType.Float));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "HP - 回复率",
                                                          unchecked (_newChildrenArgs.ThisUnitAddress + 0xB0),
                                                          AddressListValueType.Float));

                tmpValue1   = mem.ReadInt32((IntPtr) unchecked (_newChildrenArgs.ThisUnitAddress + 0x98 + 0x28));
                tmpAddress1 = War3Common.ReadFromGameMemory(
                    mem, _gameContext, _newChildrenArgs,
                    tmpValue1);
                tmpAddress1 = unchecked (tmpAddress1 + 0x84);
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "MP - 目前",
                                                          unchecked (tmpAddress1 - 0xC),
                                                          AddressListValueType.Float));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "MP - 最大",
                                                          tmpAddress1,
                                                          AddressListValueType.Float));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "MP - 回复率",
                                                          unchecked (_newChildrenArgs.ThisUnitAddress + 0xD4),
                                                          AddressListValueType.Float));

                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "盔甲 - 数量",
                                                          unchecked (_newChildrenArgs.ThisUnitAddress + 0xE0),
                                                          AddressListValueType.Float));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "盔甲 - 种类",
                                                          unchecked (_newChildrenArgs.ThisUnitAddress + 0xE4),
                                                          AddressListValueType.Integer));

                // Move speed
                tmpAddress1 = unchecked (_newChildrenArgs.ThisUnitAddress + _gameContext.MoveSpeedOffset - 0x24);
                do
                {
                    tmpValue1   = mem.ReadInt32((IntPtr) unchecked (tmpAddress1 + 0x24));
                    tmpAddress1 = War3Common.ReadGameValue2(
                        mem, _gameContext, _newChildrenArgs,
                        tmpValue1);
                    tmpAddress2 = mem.ReadUInt32((IntPtr) unchecked (tmpAddress1 + 0));
                    tmpValue1   = mem.ReadInt32((IntPtr) unchecked (tmpAddress1 + 0x24));
                    tmpValue2   = mem.ReadInt32((IntPtr) unchecked (tmpAddress1 + 0x28));

                    // Note: If new game version released, set breakpoint here
                    //       and check tmpAddress2. Set this value as War3AddressMoveSpeed
                    tmpAddress2 = mem.ReadUInt32((IntPtr) unchecked (tmpAddress2 + 0x2D4));
                    if (_gameContext.MoveSpeedAddress == tmpAddress2)
                    {
                        CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                                  "移动速度",
                                                                  unchecked (tmpAddress1 + 0x70), // +70 or +78 are both OK
                                                                  AddressListValueType.Float));
                    }
                } while (tmpValue1 > 0 && tmpValue2 > 0);

                // Coordinate
                tmpValue1   = mem.ReadInt32((IntPtr) unchecked (_newChildrenArgs.ThisUnitAddress + 0x164 + 8));
                tmpAddress1 = War3Common.ReadGameValue1(
                    mem, _gameContext, _newChildrenArgs,
                    tmpValue1);
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "坐标 - X",
                                                          tmpAddress1,
                                                          AddressListValueType.Float));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "坐标 - Y",
                                                          unchecked (tmpAddress1 + 4),
                                                          AddressListValueType.Float));
            }
        }