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.