📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Text.RegularExpressions;
using XPTable.Models;
using XPTable;
using Iislove.ClassLibrary;
namespace 完美辅助
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
const int GameBasc = 0x96C9B8;//游戏基址
const int Exd = 0x96C9D4;//人物基址
const int huanjingOffset = 0x8;//周围环境基址偏移
const int guaiwuOffset = 0x24;//怪物基址偏移
const int wupinOffset = 0x28;//地面物品基址偏移
const int NameOffset = 0x5BC;//人物名偏移
const int LvOffset = 0x448;//等级偏移
const int HpOffset = 0x450;//当前血偏移
const int MaxHpOffset = 0x478;//血上限偏移
const int MpOffset = 0x454;//当前蓝偏移
const int MaxMpOffset = 0x47C;//蓝上限偏移
const int YSOffset = 0x45C; //原神偏移
const int DSOffset = 0x460;//升级剩余点数
const int TZOffset = 0x468;//体质偏移
const int NLLOffset = 0x46C;//灵力偏移
const int LLOffset = 0x470;//力量偏移
const int MJOffset = 0x474;//敏捷偏移
const int jl1 = 0xB9C;
const int jlx = 0xB98;
const int xOffset = 0x3C;//X坐标偏移
const int yOffset = 0x44;//Y坐标偏移
const int zOffset = 0x40;//高度偏移
const int ExpOffset = 0x458;//当前经验偏移
const int MaxExpOffset = 1208;//总经验偏移
const int MoneyOffset = 0x4FC;//金钱偏移
Process p;
int Basc;//人物基址
int newBasc;
int huanjing;//周围环境基址
int guaiwu;//怪物基址
int wupin;//地面物品基址
int namebasc;//人名
int hProcess;
int lv, hp, maxhp, mp, maxmp, ys, ds, tz, nll, ll, mj, jl2, jl3, jl4, jl5, jl6, jl7, jl8, jl9, jlb, NAD, xp, yp, zp, exp, maxexp,money;
float x, y, z;//人物临时坐标
float gw_x, gw_y, gw_z,//怪物临时坐标
gw_tmp_distance;//怪物临时距离
byte[] xName = new byte[32];
int gwMax,//怪物数组最大值
gwNum,//怪物数量
gwFirst,//怪物数组首地址
gwBase,//怪物偏移
gwInfo,//怪物信息指针
gwID,//怪物ID
gwNameAddr,//怪物名称地址
gwCategory,//怪物分类
gw_xp, gw_yp, gw_zp,//怪物坐标
gw_hp,//怪物当前血
gw_maxhp,//怪物最大血
gw_distance;//怪物距离
byte[] gwTmpName = new byte[32];//怪物临时名称
string[] r;
string gw_ZB;
string gw_Str_Category;
/*BT功能地址和值 国服403*/
const int cqEdx = 0x0402418B;
int cqfz = 1099547353;
int cqhf = 1099547097;
const int ftEdx = 0x04077A59;
int ftfz = 37008;
int fthf = 4468;
const int mbEdx = 0x04080FD0;
int mbfz = 31349;
int mbhf = 3348;
private int Hotkey1, Hotkey2, Hotkey3, Hotkey4;
/*BT功能地址和值 国服403*/
private void Form1_Load(object sender, EventArgs e)
{
GameStart();
Hotkey hotkey;
hotkey = new Hotkey(this.Handle);
Hotkey1 = hotkey.RegisterHotkey(Keys.F9, Hotkey.KeyFlags.MOD_NONE);
Hotkey2 = hotkey.RegisterHotkey(Keys.F10, Hotkey.KeyFlags.MOD_NONE);
Hotkey3 = hotkey.RegisterHotkey(Keys.F11, Hotkey.KeyFlags.MOD_NONE);
Hotkey4 = hotkey.RegisterHotkey(Keys.F12, Hotkey.KeyFlags.MOD_NONE);
hotkey.OnHotkey += new HotkeyEventHandler(OnHotkey);
API.ReadProcessMemory(hProcess, Exd, out Basc, 4, 0);
API.ReadProcessMemory(hProcess, Basc + 0x20, out Basc, 4, 0);//人物基址
API.ReadProcessMemory(hProcess, GameBasc + 0x1C, out newBasc, 4, 0);
API.ReadProcessMemory(hProcess, newBasc + huanjingOffset, out huanjing, 4, 0);//周围环境基址
API.ReadProcessMemory(hProcess, huanjing + guaiwuOffset, out guaiwu, 4, 0);//怪物基址
API.ReadProcessMemory(hProcess, huanjing + wupinOffset, out wupin, 4, 0);//地面物品基址
this.ReadJN();
}
private void OnHotkey(int HotkeyID)
{
if (HotkeyID == Hotkey1)
{
if (checkBox2.CheckState == CheckState.Unchecked)
checkBox2.CheckState = CheckState.Checked;
else
checkBox2.CheckState = CheckState.Unchecked;
}
else if (HotkeyID == Hotkey2)
{
if (checkBox7.CheckState == CheckState.Unchecked)
checkBox7.CheckState = CheckState.Checked;
else
checkBox7.CheckState = CheckState.Unchecked;
}
else if (HotkeyID == Hotkey3)
{
if (checkBox3.CheckState == CheckState.Unchecked)
checkBox3.CheckState = CheckState.Checked;
else
checkBox3.CheckState = CheckState.Unchecked;
}
else if (HotkeyID == Hotkey4)
{
if (checkBox4.CheckState == CheckState.Unchecked)
checkBox4.CheckState = CheckState.Checked;
else
checkBox4.CheckState = CheckState.Unchecked;
}
}
/// <summary>
/// 怪物过滤
/// </summary>
/// <param name="GWmc">怪物名称</param>
/// <returns></returns>
private bool FiltrateGW(string GWmc)
{
string[] FiltrateList;
int i, j;
string f = Convert.ToString(FiltrateTxb);
FiltrateList = Regex.Split(f, ",");
i = FiltrateList.Length;
for (j = 0; j < i - 1; j++)
{
if (FiltrateList[j] == GWmc)
{
return false;
}
}
return true;
}
/// <summary>
/// 过滤只捡物品名称
/// </summary>
/// <param name="WPmc">物品名称</param>
/// <returns></returns>
private bool FiltrateWP(string WPmc)
{
string[] WPList;//过滤物品列表
int i, j;
string f = Convert.ToString(FiltrateWPTxb);
WPList = Regex.Split(f, ",");
i = WPList.Length;
for (j = 0; j < i - 1; j++)
{
if (WPList[j] == WPmc)
{
return true;
}
}
return false;
}
/// <summary>
/// 遍历怪物
/// </summary>
public void ReadGW()
{
API.ReadProcessMemory(hProcess, guaiwu + 0x14, out gwNum, 4, 0);//读怪物数量
API.ReadProcessMemory(hProcess, guaiwu + 0x24, out gwMax, 4, 0);//读怪物数组最大值
API.ReadProcessMemory(hProcess, guaiwu + 0x18, out gwFirst, 4, 0);//读怪物数组首地址
gw.Items.Clear();
for (int i=0; i <= gwMax-1; i++)
{
API.ReadProcessMemory(hProcess, gwFirst + 4 * i, out gwBase, 4, 0);//读怪物偏移
if (gwBase > 0)
{
API.ReadProcessMemory(hProcess, gwBase + 0x4, out gwInfo, 4, 0);//读怪物信息指针
API.ReadProcessMemory(hProcess, gwInfo + 0x11C, out gwID, 4, 0);//读怪物ID
API.ReadProcessMemory(hProcess, gwInfo + 0x230, out gwNameAddr, 4, 0);//读怪物名地址
API.ReadProcessMemory(hProcess, gwNameAddr, gwTmpName, 36, 0);
string gw_Str_Name = Encoding.Unicode.GetString(gwTmpName);
r= gw_Str_Name.Split('\0');
API.ReadProcessMemory(hProcess, gwInfo + 0xB4, out gwCategory, 4, 0);//读怪物分类,6为怪,7为NPC,9为宠物 A为GM
API.ReadProcessMemory(hProcess,gwInfo+0xF7,out gw_hp,4,0);//读怪物当前血
API.ReadProcessMemory(hProcess, gwInfo + 0x103, out gw_maxhp, 4, 0);//怪物最大血
if (gwCategory == 6)
{
gw_Str_Category = "[怪物]";
}
else if (gwCategory == 7)
{
gw_Str_Category = "[NPC]";
}
else if(gwCategory == 9)
{
gw_Str_Category = "[宠物]";
}
else if (gwCategory == 10)
{
gw_Str_Category = "[GM]";
}
API.ReadProcessMemory(hProcess, gwInfo + 0x3C, out gw_x, 4, 0);
API.ReadProcessMemory(hProcess, gwInfo + 0x44, out gw_y, 4, 0);
API.ReadProcessMemory(hProcess, gwInfo + 0x40, out gw_z, 4, 0);
API.ReadProcessMemory(hProcess,gwInfo+0x254,out gw_tmp_distance,4,0);//人怪距离
gw_xp = Convert.ToInt32(Math.Abs(gw_x / 10 + 400));
gw_yp = Convert.ToInt32(Math.Abs(gw_y / 10 + 550));
gw_zp = Convert.ToInt32(Math.Truncate(gw_z / 10));
gw_distance = Convert.ToInt32(Math.Truncate(gw_tmp_distance/10));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -