基本信息
源码名称:dnf微调源码
源码大小:0.29M
文件格式:.zip
开发语言:C/C++
更新时间:2019-08-03
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using AGoPoEAPI;
using System.Threading;

namespace SimpleTool
{
    public partial class Form1 : Form
    {
        string[] args;
        public static Thread thread1 = new Thread(IntoPackThread);
        CheckBox[] chbox = new CheckBox[6];
        TextBox[] txbox = new TextBox[6];

        public Form1(string[] args)
        {
            InitializeComponent();
            this.args = args;
        }

        //声明常量
        private const int WM_HOTKEY = 0x312;    //窗口消息:热键
        private const int WM_CREATE = 0x1;      //窗口消息:创建
        private const int WM_DESTROY = 0x2;     //窗口消息:销毁

        private const int HotKeyID = 4444;      //热键ID(自定义)

        /// <summary>
        /// 重写系统方法WndProc
        /// </summary>
        /// <param name="msg"></param>
        protected override void WndProc(ref Message msg)
        {
            base.WndProc(ref msg);
            switch (msg.Msg)
            {
                case WM_HOTKEY: //窗口消息:热键
                    int tmpWParam = msg.WParam.ToInt32();
                    if (tmpWParam == HotKeyID)
                    {
                        HotKeyCallback();   //热键响应事件
                    }
                    break;
                case WM_CREATE: //窗口消息:创建
                    HotKeys.RegHotKey(this.Handle, HotKeyID, 0, Keys.F7); //注册热键F3
                    break;
                case WM_DESTROY: //窗口消息:销毁
                    HotKeys.UnRegHotKey(this.Handle, HotKeyID); //销毁热键
                    break;
                default:
                    break;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //检测命令行参数
            if (args.Length != 2 || args[0] != "Joken_rated" || args[1] != "start")
                Environment.Exit(0);

            try
            {
                //读取配置文件
                PublicValue.document = XDocument.Load(Environment.CurrentDirectory   "\\bin\\Configure.xml");               //从路径读取配置文件
                PublicValue.root = PublicValue.document.Root;
                PublicValue.process = PublicValue.root.Element("Process");
                PublicValue.proname = PublicValue.process.Element("ProcessName");
                PublicValue.frist = PublicValue.process.Element("Frist");
                PublicValue.G_proname = PublicValue.proname.Value;                              //进程名称
                PublicValue.baseadd = PublicValue.root.Element("BaseAddress");
                PublicValue.character = PublicValue.baseadd.Element("Character");
                PublicValue.decrypt = PublicValue.baseadd.Element("Decrypt");
                PublicValue.intopack = PublicValue.baseadd.Element("IntoPack");
                PublicValue.G_character = Convert.ToUInt32(PublicValue.character.Value, 16);    //人物基址
                PublicValue.G_decrypt = Convert.ToUInt32(PublicValue.decrypt.Value, 16);        //解密基址
                PublicValue.G_intopack = Convert.ToUInt32(PublicValue.intopack.Value, 16);      //自动捡物
                PublicValue.deviation = PublicValue.root.Element("Deviation");
                PublicValue.shoes = PublicValue.deviation.Element("Shoes");
                PublicValue.speed_move = PublicValue.deviation.Element("Move");
                PublicValue.speed_attack = PublicValue.deviation.Element("Attack");
                PublicValue.speed_cast = PublicValue.deviation.Element("Cast");
                PublicValue.power_attribute = PublicValue.deviation.Element("Power");
                PublicValue.attack_physics = PublicValue.deviation.Element("Physics");
                PublicValue.attack_magic = PublicValue.deviation.Element("Magic");
                PublicValue.G_shoes = Convert.ToUInt32(PublicValue.shoes.Value, 16);            //鞋子偏移
                PublicValue.G_micromodify[0] = Convert.ToUInt32(PublicValue.speed_move.Value, 16);          //移速偏移
                PublicValue.G_micromodify[1] = Convert.ToUInt32(PublicValue.speed_attack.Value, 16);        //攻速偏移
                PublicValue.G_micromodify[2] = Convert.ToUInt32(PublicValue.speed_cast.Value, 16);          //施速偏移
                PublicValue.G_micromodify[3] = Convert.ToUInt32(PublicValue.power_attribute.Value, 16);     //属强偏移
                PublicValue.G_micromodify[4] = Convert.ToUInt32(PublicValue.attack_physics.Value, 16);      //物攻偏移
                PublicValue.G_micromodify[5] = Convert.ToUInt32(PublicValue.attack_magic.Value, 16);        //魔攻偏移
                PublicValue.edition = PublicValue.root.Element("Edition");
                PublicValue.edit = PublicValue.edition.Element("Edit");                         //版本号
                PublicValue.hotkeys = PublicValue.root.Element("HotKeys");
                PublicValue.x_hkey = PublicValue.hotkeys.Element("HKey");                       //真实热键
                PublicValue.x_skey = PublicValue.hotkeys.Element("SKey");                       //显示热键
            }
            catch (Exception exc)
            {
                if (exc.Message.IndexOf("未能找到路径") != -1)
                    MessageBox.Show("未能找到Configure.xml\n请确认完整解压后再重新打开", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                else if (exc.Message == "未将对象引用设置到对象的实例。")
                    MessageBox.Show("Configure.xml文件内容不正确\n请确认完整解压后再重新打开", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                else
                    MessageBox.Show("发生未知错误:\n"   exc.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }



            //重新注册热键
            HotKeys.UnRegHotKey(this.Handle, HotKeyID); //销毁热键
            HotKeys.RegHotKey(this.Handle, HotKeyID, 0, (Keys)Enum.Parse(typeof(Keys), PublicValue.x_hkey.Value)); //注册新热键

  
            this.groupBox2.Enabled = false;
            this.timer1.Enabled = true;
            chbox[0] = this.CheckBox_Speed_Move;
            chbox[1] = this.CheckBox_Speed_Attack;
            chbox[2] = this.CheckBox_Speed_Cast;
            chbox[3] = this.CheckBox_Power_Attribute;
            chbox[4] = this.CheckBox_Attack_Physics;
            chbox[5] = this.CheckBox_Attack_Magic;
            txbox[0] = this.TextBox_Speed_Move;
            txbox[1] = this.TextBox_Speed_Attack;
            txbox[2] = this.TextBox_Speed_Cast;
            txbox[3] = this.TextBox_Power_Attribute;
            txbox[4] = this.TextBox_Attack_Physics;
            txbox[5] = this.TextBox_Attack_Magic;
            thread1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            PublicValue.G_proID = ProCtr.GetProcessID(PublicValue.G_proname);
            if (PublicValue.G_proID != -1)
                if (Math.Abs(ReadWrite.ReadMemInt(PublicValue.G_proID, PublicValue.G_character)) > 10000000)     //人物基址有值才生效
                {
                    this.timer1.Enabled = false;
                   
                    this.groupBox2.Enabled = true;
                    this.timer2.Enabled = true;
                }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            if (ReadWrite.ReadMemCode(PublicValue.G_proID, Convert.ToString(PublicValue.G_character)   " "   PublicValue.G_shoes   " 32") > 0)  //已穿戴鞋子
            {
                MicroModify();
                this.label2.Text = "完全免费";
            }
            else
                this.label2.Text = "未装备鞋子";
        }
        

        private void MicroModify()
        {
            for (int i = 0; i < 6; i  )
            {
                if (chbox[i].Checked)
                {
                    if (txbox[i].Focused == false)
                        EncDec.Encryption(PublicValue.G_proID, (uint)(ReadWrite.ReadMemCode(PublicValue.G_proID, Convert.ToString(PublicValue.G_character)   " "   PublicValue.G_shoes))   PublicValue.G_micromodify[i], Convert.ToInt32(txbox[i].Text), PublicValue.G_decrypt);
                }
                Thread.Sleep(30);
             }
        }


        /// <summary>
        /// 热键响应
        /// </summary>
        private void HotKeyCallback()
        {
           
                Attract();
        }


        /// <summary>
        /// 吸物
        /// </summary>
        private static bool Attract()
        {
            uint fristadd, lastadd, monsadd = 0;
            int monsmun, item_x, item_y, monstype = 0;

            if (ReadWrite.ReadMemCode(PublicValue.G_proID, PublicValue.G_character   " 188") == 0)
                return false;
            fristadd = Convert.ToUInt32(Math.Abs(ReadWrite.ReadMemCode(PublicValue.G_proID, PublicValue.G_character   " 188 192")));
            lastadd = Convert.ToUInt32(Math.Abs(ReadWrite.ReadMemCode(PublicValue.G_proID, PublicValue.G_character   " 188 196")));
            monsmun = (int)(lastadd - fristadd) / 4;
            for (uint i = 1; i <= monsmun; i  )
            {
                monsadd = (uint)Math.Abs(ReadWrite.ReadMemInt(PublicValue.G_proID, fristadd   4 * i));
                monstype = ReadWrite.ReadMemInt(PublicValue.G_proID, monsadd   152);

                if (monstype == 289)
                {
                    item_x = ReadWrite.ReadMemCode(PublicValue.G_proID, PublicValue.G_character   " 452");
                    item_y = ReadWrite.ReadMemCode(PublicValue.G_proID, PublicValue.G_character   " 456");
                    ReadWrite.WriteMemInt(PublicValue.G_proID, (uint)Math.Abs(ReadWrite.ReadMemInt(PublicValue.G_proID, monsadd   172))   16, item_x);
                    ReadWrite.WriteMemInt(PublicValue.G_proID, (uint)Math.Abs(ReadWrite.ReadMemInt(PublicValue.G_proID, monsadd   172))   20, item_y);
                }
            }
            return true;
        }

        //入包线程
        private static void IntoPackThread()
        {
            if (PublicValue.ch_intopack == true)
            {
                if (Attract())
                {
                    Thread.Sleep(100);
                    ReadWrite.WriteMemInt(PublicValue.G_proID, PublicValue.G_intopack, 1300959861);
                    Thread.Sleep(200);
                    ReadWrite.WriteMemInt(PublicValue.G_proID, PublicValue.G_intopack, 1300959860);
                }
            }
            Thread.Sleep(800);
            IntoPackThread();
        }



        private void 设置快捷键ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HotKeys.UnRegHotKey(this.Handle, HotKeyID); //销毁热键

            Form4 form4 = new Form4();
            form4.ShowDialog();

            HotKeys.RegHotKey(this.Handle, HotKeyID, 0, (Keys)Enum.Parse(typeof(Keys), PublicValue.x_hkey.Value)); //注册新热键
          
        }

        private void 设置基址ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.ShowDialog();
        }



        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            Environment.Exit(0);
        }
    }

    /// <summary>
    /// 类:全局变量
    /// </summary>
    public class PublicValue
    {
        public struct X_Element
        {
            public XElement formula;    //公式
            public XElement value;      //数值
            public XElement remark;     //备注
            public XElement floating;   //浮点
        }
        //声明全局变量
        public static string G_proname;
        public static uint G_character, G_decrypt, G_intopack, G_shoes;
        public static uint[] G_micromodify = new uint[6];
        public static int G_proID;
        public static bool ch_intopack = false;

        public static XDocument document;
        public static XElement root, process, proname, frist, baseadd, character, decrypt, intopack, deviation, shoes, speed_move, speed_attack, speed_cast, power_attribute, attack_physics, attack_magic, edition, edit, hotkeys, x_hkey, x_skey;
    }
}