实例介绍
【实例简介】
【实例截图】
【核心代码】
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;
}
}
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明


网友评论
我要评论