unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, sSkinManager, StdCtrls, sButton, ComCtrls, acProgressBar, sLabel,
sComboBox, sEdit, sTrackBar, ToolWin, sToolBar, Mask, sMaskEdit,
sCustomComboEdit, sComboEdit, sGauge, acPathDialog, Menus, ExtCtrls,IniFiles;
type
TForm1 = class(TForm)
sSkinManager1: TsSkinManager;
sButton1: TsButton;
sButton2: TsButton;
sLabel1: TsLabel;
sLabel2: TsLabel;
sComboBox1: TsComboBox;
sComboBox2: TsComboBox;
sGauge1: TsGauge;
sGauge2: TsGauge;
MainMenu1: TMainMenu;
N2: TMenuItem;
N1: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
Button1: TButton;
Timer1: TTimer;
Timer2: TTimer;
Timer3: TTimer;
Timer4: TTimer;
sTrackBar1: TsTrackBar;
sLabel3: TsLabel;
sEdit1: TsEdit;
sTrackBar2: TsTrackBar;
sLabel4: TsLabel;
sEdit2: TsEdit;
sLabel5: TsLabel;
sLabel6: TsLabel;
sTrackBar3: TsTrackBar;
sLabel7: TsLabel;
sLabel8: TsLabel;
sLabel9: TsLabel;
Timer5: TTimer;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure sButton1Click(Sender: TObject);
procedure sButton2Click(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure sTrackBar1Change(Sender: TObject);
procedure sTrackBar2Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer5Timer(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
KlientWindow: hWnd;
ProcessId:Integer;
hProcess:Integer; //Идентификатор объекта
HPMinValue:Integer; //Минимальное значение ХП (из Edit1)
MPMinValue:Integer; //Минимальное значение МП (из Edit2)
WindowOn:boolean;
Wnd: hWnd;
buff: array[0..127] of Char;
HP,HPMax,MP,MPMax:Integer;
WHP,WHPMax,WMP,WMPMax,NoB
Word;
implementation
uses Unit2;
{$R *.dfm}
procedure SimulateKeystroke(Key : byte; extra : DWORD);
begin
keybd_event(Key,extra,0,0);
keybd_event(Key,extra,KEYEVENTF_KEYUP,0);
end;
procedure SimulateKeyDown(Key : byte);
begin
keybd_event(Key, 0, 0, 0);
end;
procedure SimulateKeyUp(Key : byte);
begin
keybd_event(Key, 0, KEYEVENTF_KEYUP, 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
F: TIniFile;
begin
sskinmanager1.skinname:=' wmp11 ' ;
// обработка настроек
F := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'settings.ini');
sTrackBar2.Position:=F.ReadInteger('tools', 'sTrackBar2',80);
sedit2.Text:=inttostr(strackBar2.Position);
sTrackBar1.Position:=F.ReadInteger('tools', 'sTrackBar1',80);
sedit1.Text:=inttostr(strackBar1.Position);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
KlientWindow := GetForegroundWindow(); //Находим Handle активного окна
GetWindowThreadProcessId(KlientWindow,@ProcessId); //Получаем И.П.
hProcess := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId); //Открываем процесс с возможностью записи
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
// Максимальное хп
ReadProcessMemory (hProcess, Pointer($00D12A84), @WHPMax, sizeof(WHPMax), NoB);
ReadProcessMemory (hProcess, Pointer(WHPMax+$2C), @WHPMax, sizeof(WHPMax), NoB);
ReadProcessMemory (hProcess, Pointer(WHPMax+$2A4), @WHPMax, sizeof(WHPMax), NoB); //Читаем значение MaxHP
HPMax := Integer(WHPMax); //Переводим Integer
// Текущее хп
ReadProcessMemory (hProcess, Pointer($00D12A84), @WHP, sizeof(WHP), NoB);
ReadProcessMemory (hProcess, Pointer(WHP+$2C), @WHP, sizeof(WHP), NoB);
ReadProcessMemory (hProcess, Pointer(WHP+$280), @WHP, sizeof(WHP), NoB);
HP := Integer(WHP); //Переводим Integer
// Максимальное МП
ReadProcessMemory (hProcess, Pointer($00D12A84), @WMPMax, sizeof(WMPMax), NoB);
ReadProcessMemory (hProcess, Pointer(WMPMax+$2C), @WMPMax, sizeof(WMPMax), NoB);
ReadProcessMemory (hProcess, Pointer(WMPMax+$2A8), @WMPMax, sizeof(WMPMax), NoB);
MPMax := Integer(WMPMax); //Переводим Integer
// Текущее МП
ReadProcessMemory (hProcess, Pointer($00D12A84), @WMP, sizeof(WMP), NoB);
ReadProcessMemory (hProcess, Pointer(WMP+$2C), @WMP, sizeof(WMP), NoB);
ReadProcessMemory (hProcess, Pointer(WMP+$284), @WMP, sizeof(WMP), NoB);
MP := Integer(WMP); //Переводим Integer
// процентные показатели
if (hp>0) and (mp>0) and (HPMAX>0)and(MPMAX>0) then
begin
sGauge1.Progress := round(HP * 100 / HPMax); //Присваиваем процентное значение HP Gauge1.Progress
sGauge2.Progress := round(MP * 100 / MPMax); //Присваиваем процентное значение MP Gauge2.Progress
end;
end;
procedure TForm1.sButton1Click(Sender: TObject);
begin
timer3.Enabled:=true;
sButton2.Enabled:=true;
sButton1.Enabled:=false ;
end;
procedure TForm1.sButton2Click(Sender: TObject);
begin
timer3.Enabled:=false;
sButton2.Enabled:=false;
sButton1.Enabled:=true ;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
Wnd := GetForegroundWindow();
GetWindowText(Wnd, buff, sizeof(buff));
// если мало хп
if sgauge1.Progress<strtoint(sEdit2.Text) then
begin
if scombobox1.ItemIndex=0 then
SimulateKeystroke($70,0);
if scombobox1.ItemIndex=1 then
SimulateKeystroke($71,0);
if scombobox1.ItemIndex=2 then
SimulateKeystroke($72,0);
if scombobox1.ItemIndex=3 then
SimulateKeystroke($73,0);
if scombobox1.ItemIndex=4 then
SimulateKeystroke($74,0);
if scombobox1.ItemIndex=5 then
SimulateKeystroke($75,0);
if scombobox1.ItemIndex=6 then
SimulateKeystroke($76,0);
if scombobox1.ItemIndex=7 then
SimulateKeystroke($77,0);
if scombobox1.ItemIndex=8 then
SimulateKeystroke($30,0);
if scombobox1.ItemIndex=9 then
SimulateKeystroke($31,0);
if scombobox1.ItemIndex=10 then
SimulateKeystroke($32,0);
if scombobox1.ItemIndex=11 then
SimulateKeystroke($33,0);
if scombobox1.ItemIndex=12 then
SimulateKeystroke($34,0);
if scombobox1.ItemIndex=13 then
SimulateKeystroke($35,0);
if scombobox1.ItemIndex=14 then
SimulateKeystroke($36,0);
if scombobox1.ItemIndex=15 then
SimulateKeystroke($37,0);
if scombobox1.ItemIndex=16 then
SimulateKeystroke($38,0);
if scombobox1.ItemIndex=17 then
SimulateKeystroke($39,0);
end;
// если мало мп
if sgauge2.Progress<strtoint(sEdit1.Text) then
begin
if scombobox2.ItemIndex=0 then
SimulateKeystroke($70,0);
if scombobox2.ItemIndex=1 then
SimulateKeystroke($71,0);
if scombobox2.ItemIndex=2 then
SimulateKeystroke($72,0);
if scombobox2.ItemIndex=3 then
SimulateKeystroke($73,0);
if scombobox2.ItemIndex=4 then
SimulateKeystroke($74,0);
if scombobox2.ItemIndex=5 then
SimulateKeystroke($75,0);
if scombobox2.ItemIndex=6 then
SimulateKeystroke($76,0);
if scombobox2.ItemIndex=7 then
SimulateKeystroke($77,0);
if scombobox2.ItemIndex=8 then
SimulateKeystroke($30,0);
if scombobox2.ItemIndex=9 then
SimulateKeystroke($31,0);
if scombobox2.ItemIndex=10 then
SimulateKeystroke($32,0);
if scombobox2.ItemIndex=11 then
SimulateKeystroke($33,0);
if scombobox2.ItemIndex=12 then
SimulateKeystroke($34,0);
if scombobox2.ItemIndex=13 then
SimulateKeystroke($35,0);
if scombobox2.ItemIndex=14 then
SimulateKeystroke($36,0);
if scombobox2.ItemIndex=15 then
SimulateKeystroke($37,0);
if scombobox2.ItemIndex=16 then
SimulateKeystroke($38,0);
if scombobox2.ItemIndex=17 then
SimulateKeystroke($39,0);
end;
end;
procedure TForm1.Timer4Timer(Sender: TObject);
var
Wnd: hWnd;
buff: array[0..127] of Char;
begin
Wnd := GetForegroundWindow();
GetWindowText(Wnd, buff, sizeof(buff));
if buff<>'Jade Dynasty' then
begin
timer1.Enabled:=false;
timer2.Enabled:=false;
timer5.Enabled:=false;
timer3.Enabled:=false;
end
else
begin
timer1.Enabled:=True;
timer2.Enabled:=True;
if sbutton1.Enabled=false then
begin
timer3.Enabled:=True;
timer5.Enabled:=true;
end;
end;
end;
procedure TForm1.sTrackBar1Change(Sender: TObject);
begin
sedit1.Text:=inttostr(strackBar1.Position);
end;
procedure TForm1.sTrackBar2Change(Sender: TObject);
begin
sedit2.Text:=inttostr(strackBar2.Position);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
form2.show;
form1.Visible:=false;
end;
procedure TForm1.Timer5Timer(Sender: TObject);
begin
timer3.Interval:=sTrackBar3.Position;
end;
procedure TForm1.FormDestroy(Sender: TObject);
var
F: TIniFile;
begin
//сохранение настроек
F := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'settings.ini');
F.WriteString('tools', 'sTrackBar2',inttostr( sTrackBar2.Position));
F.WriteString('tools', 'sTrackBar1',inttostr( sTrackBar1.Position));
F.Free;
end;
end.
грубый вариант но както так..... можно было бы проще но я спешыл... например IF убрать итд)
ну а с этой основы при минемальном знание делпхи создадите своё
P.S это исходник к проге выше