Пример #1
0
        public override void CreateChildren()
        {
            // This function will fill the following value(s):
            //      _newChildrenArgs.ThisGame
            //      _newChildrenArgs.ThisGameMemory
            War3Common.GetGameMemory(
                _gameContext,
                ref _newChildrenArgs);

            base.CreateChild(TrainerNodeType.Introduction, NodeIndex);
            base.CreateChild(TrainerNodeType.Cash, NodeIndex);
            base.CreateChild(TrainerNodeType.AllSelectedUnits, NodeIndex);
        }
Пример #2
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));
            }
        }
Пример #3
0
        public override void CreateChildren()
        {
            UInt32 upperAddress;

            using (WindowsApi.ProcessMemory mem = new WindowsApi.ProcessMemory(_gameContext.ProcessId))
            {
                upperAddress = War3Common.ReadFromGameMemory(
                    mem, _gameContext, _newChildrenArgs,
                    1) & 0xFFFF0000;
            }
            if (upperAddress == 0)
            {
                return;
            }

            UInt32[] playerSourceBaseAddress = new UInt32[]
            {
                0,  // To skip index 0
                0x0190, 0x1410, 0x26A0, 0x3920, 0x4BB0,
                0x5E30, 0x70C0, 0x8350, 0x95D0, 0xA860,
                0xBAE0, 0xCD70
            };

            for (int i = 1; i <= 12; i++)
            {
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "P" + i.ToString() + " - 金",
                                                          unchecked (upperAddress + playerSourceBaseAddress[i] + 0),
                                                          AddressListValueType.Integer,
                                                          10));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "P" + i.ToString() + " - 木",
                                                          unchecked (upperAddress + playerSourceBaseAddress[i] + 0x80),
                                                          AddressListValueType.Integer,
                                                          10));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "P" + i.ToString() + " - 最大人口",
                                                          unchecked (upperAddress + playerSourceBaseAddress[i] + 0x180),
                                                          AddressListValueType.Integer));
                CreateAddress(new NewAddressListEventArgs(_nodeIndex,
                                                          "P" + i.ToString() + " - 当前人口",
                                                          unchecked (upperAddress + playerSourceBaseAddress[i] + 0x200),
                                                          AddressListValueType.Integer));
            }
        }
Пример #4
0
        /************************************************************************/
        /* Debug                                                                */
        /************************************************************************/
        private void menuDebug1_Click(object sender, EventArgs e)
        {
            string strIndex = Microsoft.VisualBasic.Interaction.InputBox(
                "nIndex = 0x?",
                "War3Common.ReadFromGameMemory(nIndex)",
                "0", -1, -1);

            if (String.IsNullOrEmpty(strIndex))
            {
                return;
            }

            Int32 nIndex;

            if (!Int32.TryParse(
                    strIndex,
                    System.Globalization.NumberStyles.HexNumber,
                    System.Globalization.NumberFormatInfo.InvariantInfo,
                    out nIndex))
            {
                nIndex = 0;
            }

            try
            {
                UInt32 result = 0;
                using (WindowsApi.ProcessMemory mem = new WindowsApi.ProcessMemory(_currentGameContext.ProcessId))
                {
                    NewChildrenEventArgs args = new NewChildrenEventArgs();
                    War3Common.GetGameMemory(
                        _currentGameContext, ref args);
                    result = War3Common.ReadFromGameMemory(
                        mem, _currentGameContext, args,
                        nIndex);
                }
                MessageBox.Show(
                    "0x" + result.ToString("X"),
                    "War3Common.ReadFromGameMemory(0x" + strIndex + ")");
            }
            catch (WindowsApi.BadProcessIdException ex)
            {
                ReportProcessIdFailure(ex.ProcessId);
            }
        }
Пример #5
0
        public override void CreateChildren()
        {
            using (WindowsApi.ProcessMemory mem = new WindowsApi.ProcessMemory(_gameContext.ProcessId))
            {
                Int32 list = mem.ReadInt32((IntPtr) unchecked (_newChildrenArgs.ThisUnitAddress + _gameContext.ItemsListOffset));
                if (list != 0)
                {
                    for (Int32 itemIndex = 0; itemIndex < 6; itemIndex++)
                    {
                        UInt32 currentItem = 0;

                        // We assume ItemIndex never go out of bounds to the List
                        Int32 tmpValue1 = mem.ReadInt32((IntPtr) unchecked (list + 0xC * itemIndex + 0x70));
                        if (tmpValue1 > 0)
                        {
                            UInt32 RawItem = War3Common.ReadFromGameMemory(
                                mem, _gameContext, _newChildrenArgs,
                                tmpValue1);
                            if (RawItem != 0)
                            {
                                UInt32 tmpValue2 = mem.ReadUInt32((IntPtr) unchecked (RawItem + 0x20));
                                if (tmpValue2 == 0)
                                {
                                    currentItem = mem.ReadUInt32((IntPtr) unchecked (RawItem + 0x54));
                                }
                            }
                            if (currentItem != 0)
                            {
                                _newChildrenArgs.CurrentItemPackAddress = currentItem;
                                base.CreateChild(TrainerNodeType.OneItem, NodeIndex);
                            }
                        }
                    } // foreach items
                }     // Item list exists
            }         // mem
        }             // CreateChildren()
Пример #6
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));
            }
        }