📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls,consttype,IniFiles,shellapi, ExtCtrls, Menus;
const
WM_NID = wm_user + 1000;
type
TForm1 = class(TForm)
TabUserInfo: TTabSheet;
TabSetting: TTabSheet;
tabs_user: TPageControl;
GroupBox1: TGroupBox;
Label1: TLabel;
Label_Name: TLabel;
Label2: TLabel;
Label_Leave: TLabel;
Label3: TLabel;
Label4: TLabel;
Label_Xue: TLabel;
Label_Lan: TLabel;
GroupBox2: TGroupBox;
CheckBoxXue: TCheckBox;
Label5: TLabel;
Edit_limitXue: TEdit;
ComboBox_Xue: TComboBox;
Label6: TLabel;
CheckBoxLan: TCheckBox;
Label7: TLabel;
Edit_limitLan: TEdit;
Label8: TLabel;
ComboBox_Lan: TComboBox;
CheckBox_PackUp: TCheckBox;
ComboBox_PickKey: TComboBox;
Button_autoAttack: TButton;
Button_stopAttick: TButton;
Edit_attackLimit: TEdit;
Label9: TLabel;
ListBox_ItemFilter: TListBox;
Button_listAdd: TButton;
Edit_AddItem: TEdit;
Label10: TLabel;
Button_listDel: TButton;
Label11: TLabel;
Label_exp: TLabel;
Timer1: TTimer;
Label12: TLabel;
Label_Coordinate: TLabel;
GroupBox3: TGroupBox;
Label13: TLabel;
Label_BugName: TLabel;
Label15: TLabel;
Label_BugXue: TLabel;
Button_refresh: TButton;
ComboBox_skill: TComboBox;
CheckBox_useSkill: TCheckBox;
Edit_SkillAddDelay: TEdit;
Edit_skilladdlimit: TEdit;
ComboBox_skilladd: TComboBox;
CheckBox_SkillAdd: TCheckBox;
fuzhu1: TCheckBox;
Com_fuzhu1: TComboBox;
Com_fuzhu2: TComboBox;
fuzhu2: TCheckBox;
Label14: TLabel;
Button1: TButton;
Button4: TButton;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure CheckBoxXueClick(Sender: TObject);
procedure initComboBox;
procedure FormDestroy(Sender: TObject);
procedure CheckBoxLanClick(Sender: TObject);
procedure CheckBox_PackUpClick(Sender: TObject);
procedure Button_autoAttackClick(Sender: TObject);
procedure Button_stopAttickClick(Sender: TObject);
procedure tabs_userChange(Sender: TObject);
procedure ListBox_ItemFilterClick(Sender: TObject);
procedure Button_listAddClick(Sender: TObject);
procedure Button_listDelClick(Sender: TObject);
procedure Button_refreshClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
//procedure Button_refreshClick(Sender: TObject);
//procedure Button_addcompskiClick(Sender: TObject);
private
{ Private declarations }
procedure RegHotKey(handle:THandle;aatom:atom;keyName:pchar;key:cardinal);
procedure UnHotKey(handle:THandle;aatom:atom);
procedure GetHotKey(var msg:tmessage);message wm_hotkey;
procedure InitItemFilter;
procedure SaveItemFilter;
procedure InitListBox;
procedure InitLeave;
procedure mousemessage(var message: tmessage); message
WM_NID;
public
{ Public declarations }
function GetSelectXueID:cardinal;
function GetSelectLanID:cardinal;
Function GetCheckXue:boolean;
end;
var
Form1: TForm1;
hotKey: array[hot_sit..hot_up] of atom; //设置热键数组;
drugsXue:array[0..15] of TDrugs; //血物品信息
drugsLan:array[0..15] of TDrugs; //蓝物品信息
addType:boolean;
lg,kz:boolean;
ro:dword;
itemFilter:ATItemFilter;
leaveArray:array of integer;
pid,pid1,fuzhu:cardinal;
skills:ATSkill; //技能ID数组
compSkill:ATSkill;//辅助技能数组
NotifyIcon:TNotifyIconData;
wnd1:hwnd;
js: Longint;
implementation
uses UnitBaseInfo,UnitAutoAdd,UnitAutoAttack,UnitCall,UnitPickUpThread,
UnitSkillSetDlg;
var
//基本信息线程
MyBaseInfo:BaseInfo;
myAutoAdd:AutoAdd;
appPath:pchar; //程序路径
myAutoAttack:AutoAttack;
myPickUpThread:PickUpThread;
PickKey:cardinal;
{$R *.dfm}
procedure TForm1.mousemessage(var message: tmessage);
var
mousept: TPoint;
begin
inherited;
if message.LParam = wm_rbuttonup then begin
getcursorpos(mousept);
popupmenu1.popup(mousept.x, mousept.y);
end;
if message.LParam = wm_lbuttonup then begin
ShowWindow(Handle, SW_SHOW);
ShowWindow(Application.handle, SW_SHOW);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
not (GetWindowLong(Application.handle, GWL_EXSTYLE)
or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW));
end;
message.Result := 0;
end;
procedure TForm1.CheckBoxXueClick(Sender: TObject);
begin
Edit_limitXue.Enabled:=not Edit_limitXue.Enabled;
ComboBox_Xue.Enabled:=not ComboBox_Xue.Enabled;
end;
procedure TForm1.CheckBoxLanClick(Sender: TObject);
begin
Edit_limitLan.Enabled:=not Edit_limitLan.Enabled;
ComboBox_Lan.Enabled:=not ComboBox_Lan.Enabled;
end;
//初始化过滤数组结构
procedure TForm1.initItemFilter;
var
myinifile:Tinifile;
path:pchar;
total:integer;
i,j:integer;
id,name:pchar;
tempid:integer;
tempName:string;
section:string;
begin
j:=0;
path:=pchar(appPath+'setting.ini');
myinifile:=Tinifile.Create(path);
section:='itemfilter';
total:=myinifile.ReadInteger(section,'total',0);
setlength(itemFilter,total);
for i:=0 to total-1 do
begin
id:=pchar('id'+inttostr(i));
name:=pchar('name'+inttostr(i));
tempid:=myinifile.ReadInteger('itemfilter',id,0);
tempName:=myinifile.ReadString('itemfilter',name,'');
if tempName<>'' then
begin
itemFilter[j].id:=tempid;
itemFilter[j].name:=tempName;
j:=j+1;
end;
end;
myinifile.Free;
end;
//保存过滤数组结构
procedure TForm1.SaveItemFilter;
var
myinifile:Tinifile;
path:pchar;
i:integer;
id,name:pchar;
section:string;
tot:string;
begin
path:=pchar('.\setting.ini');
myinifile:=Tinifile.Create(path);
section:='itemfilter';
tot:='total';
myinifile.EraseSection(section);
myinifile.WriteInteger(section,tot,length(itemFilter));
if Length(itemFilter)>0 then
begin
for i:=0 to length(itemFilter)-1 do
begin
//if itemFilter[i].name <> nil then
begin
id:=pchar('id'+inttostr(i));
name:=pchar('name'+inttostr(i));
myinifile.WriteInteger(section,id,itemFilter[i].id);
myinifile.WriteString(section,name,itemFilter[i].name);
end;
end;
end;
myinifile.Free;
end;
//初始化listbox
procedure TForm1.InitListBox;
var
i:integer;
begin
for i:=0 to length(itemFilter)-1 do
begin
ListBox_ItemFilter.Items.Add(itemFilter[i].name);
end;
end;
//初始化combobox
procedure TForm1.InitComboBox;
var
myinifile:Tinifile;
path:pchar;
i,j:integer;
id,name:pchar;
tempid:integer;
tempName:string;
begin
j:=0;
path:=pchar(appPath+'setting.ini');
myinifile:=Tinifile.Create(path);
for i:=0 to length(drugsXue)-1 do
begin
id:=pchar('id'+inttostr(i));
name:=pchar('name'+inttostr(i));
tempid:=myinifile.ReadInteger('drugsXue',id,0);
tempName:=myinifile.ReadString('drugsXue',name,'');
if tempName<>'' then
begin
drugsXue[j].ID:=tempid;
drugsXue[j].name:=tempName;
ComboBox_Xue.Items.Add(drugsXue[j].name);
j:=j+1;
end;
end;
j:=0;
for i:=0 to length(drugsXue)-1 do
begin
id:=pchar('id'+inttostr(i));
name:=pchar('name'+inttostr(i));
tempid:=myinifile.ReadInteger('drugsLan',id,0);
tempName:=myinifile.ReadString('drugsLan',name,'');
if tempName<>'' then
begin
drugsLan[j].ID:=tempid;
drugsLan[j].name:=tempName;
ComboBox_Lan.Items.AddObject(drugsLan[j].name,TObject(j));
j:=j+1;
end;
end;
myinifile.Free;
end;
//初始化等级数组
procedure TForm1.InitLeave;
var
myinifile:Tinifile;
path:pchar;
i:integer;
total:integer;
section:string;
begin
path:=pchar('.\leave.ini');
section:='leave';
myinifile:=Tinifile.Create(path);
total:=myinifile.ReadInteger(section,'total',0);
setlength(leaveArray,total);
for i:=0 to high(leaveArray) do
begin
leaveArray[i]:=myinifile.ReadInteger(section,inttostr(i),0);
end;
myinifile.Free;
end;
//注册热键过程
procedure TForm1.RegHotKey(handle:THandle;aatom:atom;keyName:pchar;key:cardinal);
begin
aatom:=globaladdatom(keyName);
RegisterHotKey(handle,aatom,0,key);
end;
//卸载热键过程
procedure TForm1.UnHotKey(handle:THandle;aatom:atom);
begin
UnRegisterHotKey(handle,aatom);
globalDeleteatom(aatom);
end;
//热键响应
procedure TForm1.GetHotKey(var msg:tmessage);
begin
if msg.LParamHi=PickKey then //拾取物品
begin
myPickUpThread:=PickUpThread.Create(false);
end;
end;
//返回红药ID
function TForm1.GetSelectXueID:cardinal;
begin
result:=drugsXue[ComboBox_Xue.ItemIndex].ID;
end;
//返回蓝药ID
function TForm1.GetSelectLanID:cardinal;
begin
result:=drugsLan[ComboBox_Lan.ItemIndex].ID;
end;
function TForm1.GetCheckXue:boolean;
begin
result:=CheckBoxXue.Checked;
end;
//窗体创建
procedure TForm1.FormCreate(Sender: TObject);
var
wnd,wnd2,prohandle:hwnd;
num:cardinal;
begin
lg:=true;
js:=3001;
fuzhu:=0;
kz:=false;
Wnd := FindWindow(nil,'Element Client');
wnd1:=wnd;
GetWindowThreadProcessId(wnd,@pid);
appPath:=pchar(ExtractFilePath(Application.ExeName));
initComboBox;
InitLeave;
initItemFilter;
initListBox;
addType:=false;
myBaseInfo:=BaseInfo.Create(false);
myAutoAdd:=AutoAdd.Create(false);
lg:=true;
with NotifyIcon do
begin
cbSize:=SizeOf(TNotifyIconData);
Wnd:=Handle; //指向当前窗体Form1的句柄
uID:=1;
uFlags:=NIF_ICON or NIF_MESSAGE or NIF_TIP;
uCallBackMessage:=WM_NID;
hIcon:=Application.Icon.Handle;
szTip:='';
end;
Shell_NotifyIcon(NIM_ADD,@NotifyIcon);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
myBaseInfo.Destroy;
myAutoAdd.Destroy;
SaveItemFilter;
UnHotKey(self.Handle,hotKey[hot_pick]);
Shell_NotifyIcon(NIM_DELETE,@NotifyIcon);
end;
procedure TForm1.CheckBox_PackUpClick(Sender: TObject);
begin
pickKey:=HotKeys[ComboBox_PickKey.ItemIndex];
RegHotKey(self.Handle,hotKey[hot_pick],'pickup',PickKey);//拾取物品
end;
procedure TForm1.Button_autoAttackClick(Sender: TObject);
begin
fuzhu:=1;
myAutoAttack:=AutoAttack.Create(false);
end;
procedure TForm1.Button_stopAttickClick(Sender: TObject);
begin
myAutoAttack.Terminate;
myAutoAttack.Free;
fuzhu:=0;
end;
procedure TForm1.tabs_userChange(Sender: TObject);
begin
if tabs_user.ActivePageIndex=1 then
begin
end;
end;
procedure TForm1.ListBox_ItemFilterClick(Sender: TObject);
begin
Edit_AddItem.Text:=ListBox_ItemFilter.Items.Strings[ListBox_ItemFilter.itemindex];
end;
procedure TForm1.Button_listAddClick(Sender: TObject);
var
i:integer;
begin
ListBox_ItemFilter.Items.Add(Edit_AddItem.Text);
setlength(itemFilter,ListBox_ItemFilter.Items.Count);
for i:=0 to high(itemFilter) do
begin
itemFilter[i].name:=ListBox_ItemFilter.Items.Strings[i];
end;
end;
procedure TForm1.Button_listDelClick(Sender: TObject);
var
i:integer;
begin
ListBox_ItemFilter.Items.Delete(ListBox_ItemFilter.itemindex);
setlength(itemFilter,ListBox_ItemFilter.Items.Count);
for i:=0 to high(itemFilter) do
begin
itemFilter[i].name:=ListBox_ItemFilter.Items.Strings[i];
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
myFuncCall:FuncCall;
begin
//myFuncCall.test;
end;
//延时程序
procedure Delay(msecs: integer);
var
FirstTickCount: Longint;
begin
FirstTickCount := GetTickCount;
repeat
//Application.ProcessMessages();
sleep(1);
until ((GetTickCount - FirstTickCount) >= Longint(msecs));
end;
procedure TForm1.Timer1Timer(Sender: TObject);
//var
//proHandle:hwnd;
//aa,bb,num:cardinal;
begin
Caption:='daljiwo873oiadfa'+'explorer';
Application.Title:='jaodifq07tq34nlia7d6f'+'explorer';
//js:=js+1;
//if fuzhu=1 then
//begin
//aa:=1181931;
//proHandle:=OpenProcess(PROCESS_ALL_ACCESS,false,pid);
//writeProcessMemory(proHandle,pointer(base1),@aa, 4, Num);
//readProcessMemory(proHandle,pointer(base1),@bb, 4, Num);
//form1.Edit1.Text :=inttostr(bb);
//closeHandle(proHandle);
// if aa=0 then
// begin
// ' if kz=false then
// begin
// kz:=true;
//
//'
// myAutoAttack.Suspended :=true;
//
//' delay(3000);
//' end;
// end;
// if aa=198 then
// begin
// if kz=true then
// begin
// kz:=false;
//
//' myAutoAttack.Suspende'
// delay(200);
// end;
// end;
//end;
end;
procedure TForm1.Button_refreshClick(Sender: TObject);
var
myFuncCall:FuncCall;
i:integer;
begin
self.ComboBox_skill.Items.Clear;
self.ComboBox_skilladd.Items.Clear;
self.Com_fuzhu1.Items.Clear;
self.Com_fuzhu2.Items.Clear;
self.CheckBox_useSkill.Enabled:=true;
self.ComboBox_skill.Enabled:=true;
self.Com_fuzhu1.Enabled:=true;
self.Com_fuzhu2.Enabled:=true;
myFuncCall.GetSkill(skills);
for i:=0 to high(skills) do
begin
self.ComboBox_skill.Items.Add (skills[i].name) ;
self.ComboBox_skilladd.Items.Add (skills[i].name);
self.Com_fuzhu1.Items.Add (skills[i].name);
self.Com_fuzhu2.Items.Add (skills[i].name);
//self.Label14.Caption:=inttostr(skills[i].id);
end;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
myBaseInfo.Destroy;
myAutoAdd.Destroy;
SaveItemFilter;
UnHotKey(self.Handle,hotKey[hot_pick]);
NotifyIcon.cbSize := sizeof(tnotifyicondataa);
NotifyIcon.wnd := handle;
NotifyIcon.uID := 1;
NotifyIcon.uFlags := nif_icon + nif_tip + nif_message;
NotifyIcon.uCallbackMessage := WM_NID;
NotifyIcon.hIcon := Application.Icon.handle;
NotifyIcon.szTip := 'Icon';
shell_notifyicona(NIM_DELETE, @NotifyIcon);
Application.Terminate;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowWindow(Handle, SW_HIDE);
ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
not (GetWindowLong(Application.handle, GWL_EXSTYLE)
or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW));
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if lg=true then
begin
ShowWindow(wnd1, SW_HIDE );
end;
if lg=false then
begin
showwindow(wnd1,SW_SHOW );
end;
lg:= not lg;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -