Program MobFarm const RangeCheck 40 Tiles range for mob finding Skinni

  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
Program MobFarm;
const
RangeCheck = 40; //(Tiles); range for mob finding
Skinning_Tool = $40132669; //(Cardinal) id;
{$Region 'Script'}
type
TMob = record
Name : String;
_Type : Word;
end;
var
Mobs : Array of TMob;
Corpses : Array of Cardinal;
i : Integer;
procedure ReadMobArray;
var
iniFile : TIniFile;
i, MobsCount : Integer;
begin
iniFile := TIniFile.Create(StealthPath + 'Mobs.ini');
MobsCount := iniFile.ReadInteger('General', 'MobsCount', 0);
if MobsCount > 0 then
begin
SetLength(Mobs, MobsCount);
for i := 0 to MobsCount-1 do
with iniFile do
begin
Mobs[i]._Type := ReadInteger('Mobs' + IntToStr(i), 'MobType', -1);
Mobs[i].Name := ReadString('Mobs' + IntToStr(i), 'MobName', 'No Name');
end;
end
else
AddToSystemJournal('Mob list is empty! Add more mobs with configurator.exe');
end;
function FindMob : Cardinal;
var
i : Integer;
begin
Result := 0;
FindDistance := RangeCheck;
if Length(Mobs) > 0 then
for i := Low(Mobs) to High(Mobs) do
if FindType(Mobs[i]._Type, Ground) > 0 then
Result := FindItem;
end;
procedure WaitLag(WaitMS : Integer);
begin
CheckLag(60000);
Wait(WaitMS);
end;
function InCorpseList(ID : Cardinal) : Boolean;
var
i : Integer;
begin
Result := False;
if Length(Corpses) > 0 then
begin
for i := Low(Corpses) to High(Corpses) do
if Corpses[i] = ID then
begin
Result := True;
SetLength(Corpses, Length(Corpses) + 1);
Corpses[High(Corpses)] := ID;
end;
end
else
begin
SetLength(Corpses, 1);
Corpses[High(Corpses)] := ID;
end;
end;
procedure LootCorpse;
var
Corpse : Cardinal;
begin
FindDistance := 1;
if (FindType($2006, Ground) > 0) then
if Not InCorpseList(FindItem) then
begin
Corpse := FindItem;
UseObject(Skinning_Tool);
WaitLag(100);
if WaitForTarget(5000) then
TargetToObject(FindItem);
WaitLag(100);
UseObject(FindItem);
WaitLag(100);
while FindType($FFFF, Corpse) > 0 do
begin
MoveItem(FindItem, 0, Backpack, 0,0,0);
WaitLag(500);
end;
end;
end;
procedure KillMob;
var
Mob : Cardinal;
begin
while FindMob > 0 do
begin
Mob := FindMob;
while IsObjectExists(Mob) do
begin
NewMoveXY(GetX(Mob), GetY(Mob), true, 1, true);
Attack(Mob);
WaitLag(1000);
end;
end;
LootCorpse;
end;
{$EndRegion}
begin
ReadMobArray;
MoveOpenDoor := True;
if Length(Mobs) > 0 then
for i := Low(Mobs) to High(Mobs) do
AddToSystemJournal(Mobs[i].Name);
KillMob;
end.