unit SimpleLooter interface uses Winapi Windows Winapi Messages System

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
unit SimpleLooter;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
grptaming: TGroupBox;
edttamingdist: TEdit;
lbltamingdist: TLabel;
lblpetID: TLabel;
edtpetID: TEdit;
btnpetID: TButton;
chktamingactive: TCheckBox;
lbltamingdelay: TLabel;
edttamingdelay: TEdit;
btn1: TButton;
procedure chktamingactiveClick(Sender: TObject);
procedure btnpetIDClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private-Deklarationen }
procedure AssignPetID();
procedure Init();
procedure CheckHeal();
procedure Main();
public
BandageTickCount : Cardinal;
end;
var
Form1: TForm1;
implementation
uses stealth_script;
{$R *.dfm}
procedure TForm1.AssignPetID;
var
ID : Cardinal;
begin
ID := 0;
btnpetID.Enabled := False;
Script.Client.RequestObjectTarget();
while(Script.Client.TargetResponsePresent() and (ID = 0))do
begin
Script.Wait(10);
end;
while(Not Script.Client.TargetResponsePresent() )do
begin
Script.Wait(10);
end;
ID := Script.Client.TargetResponse().ID;
if(ID <> 0)then
begin
edtpetID.Text := IntToStr(ID);
end;
btnpetID.Enabled := True;
end;
procedure TForm1.btn1Click(Sender: TObject);
begin
StartScriptInThread(Main);
end;
procedure TForm1.btnpetIDClick(Sender: TObject);
begin
AssignPetID();
end;
procedure TForm1.CheckHeal;
var
PetID : Cardinal;
Distance : Integer;
Ticker : Cardinal;
begin
PetID := StrToInt(edtpetID.Text);
Distance := StrToInt(edttamingdist.Text);
Ticker := StrToInt(edttamingdelay.Text);
if(grptaming.Enabled)and(PetID >0)then
begin
if(GetTickCount()> BandageTickCount)then
begin
if(Script.UOObject.GetHP(PetID)< Script.UOObject.GetMaxHP(PetID))then
begin
if(Script.UOObject.GetDistance(PetID) <= Distance)then
begin
if(Script.FindEngine.FindTypeEx($0E21,0000,Script.Backpack,False)>0)then
begin
Script.UseObject(Script.FindEngine.FindItem);
if(Script.Target.WaitForTarget(1000))then
begin
if(Script.UOObject.GetDistance(PetID) <= Distance)then
begin
Script.Wait(50);
Script.Target.TargetToObject(PetID);
BandageTickCount := GetTickCount() + Ticker;
end else begin
Script.Target.CancelTarget();
end;
end;
end;
end;
end;
end;
end;
end;
procedure TForm1.chktamingactiveClick(Sender: TObject);
begin
grptaming.Enabled := chktamingactive.Checked;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
StartScriptInThread(Init);
StartScriptInThread(Main);
end;
procedure TForm1.Init;
begin
BandageTickCount := GetTickCount();
end;
procedure TForm1.Main;
begin
while(True)do
begin
CheckHeal();
Script.Wait(100);
end;
end;
end.