Simba Code:
{ Name: EmPickpock
{ Author: Emaziz
{ Version: 0.70
{ How-to: Fill in DeclarePlayers with username and password, nothing else is
{ required at the moment as it detects all food and health and stuff
{ automatically. :)
{]]-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-[[}
{.include SRL\SRL\misc\SMART.SCAR}
{.include SRL\SRL.scar}
{.include reflection\reflection.simba}
{}
var
Level, XP: integer;
NPCTarget: TNPC;
FoodName: string;
TargetHitDamage: integer;
GoldStolen, PrevGold, StartGold: integer;
ExpGained: integer;
StartXP: integer;
const
World = 68;
Signed = True;
Members = True; // Duh!
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name :='';
Pass :='';
Nick :='';
Level[SKILL_HITPOINTS] := 10;
Active := True;
Strings[0] := 'Pike';
Integers[0] := 0; // Wanted EXP, 0 is continue 'til stopped.
Integers[1] := 70; // Amount of lifepoints your food heals
Booleans[1] := True; // Wanna take breaks?
Integers[2] := 50; // How many minutes between each break. +- 5 minutes.
Integers[3] := 10; // How many minutes to break for. +- 5 minutes.
Loc := 'DMF'; // Location as to where to pickpock, check valid locations at line 22+
end;
end;
// DO NOT CHANGE THE FOLLOWING CONSTS \\
const
XP_Man = 8;
XP_Farmer = 14.5;
XP_Warrior = 26;
XP_Guard = 46.8;
XP_MasterFarmer = 43;
DMG_Man = 10;
DMG_Farmer = 0;
DMG_Warrior = 0;
DMG_Guard = 30;
DMG_MasterFarmer = 30;
//\\\\\\\\\\\\\\\\\\///////////////////\\
function LoadPath(Path:String;Bank:Boolean): TTileArray;
begin
if (not Bank) then
begin
case Path of
'DMF':
begin
SetLength(Result, 2);
Result := [Tile(3092, 3243), Tile(3080, 3250)];
end;
'VPG':
begin
SetLength(Result, 8);
Result := [
Tile(3167, 3489), Tile(3177, 3489), Tile(3185, 3489),
Tile(3195, 3487), Tile(3196, 3480), Tile(3197, 3471),
Tile(3200, 3459), Tile(3212, 3462)];
end;
end;
end;
if (Bank) then
begin
case Path of
'DMF':
begin
SetLength(Result, 2);
Result := [Tile(3080, 3250), Tile(3092, 3243)];
end;
'VPG':
begin
SetLength(Result, 9);
Result := [
Tile(3212, 3463), Tile(3212, 3457), Tile(3202, 3457),
Tile(3197, 3465), Tile(3195, 3474), Tile(3191, 3482),
Tile(3188, 3487), Tile(3179, 3487), Tile(3172, 3488)];
end;
end;
end;
writeln('Loaded path');
end;
procedure Terminate;
begin
writeln('Terminating script...');
TerminateScript;
end;
procedure Walk(Bank : boolean);
begin
R_MakeCompass('N');
case Bank of
True: // To bank
WalkPath(LoadPath(Players[CurrentPlayer].Loc,True));
False: // To target NPCs
begin
WalkPath(LoadPath(Players[CurrentPlayer].Loc,False));
end;
end;
writeln('Done walking');
end;
function IsFood(Item: TInvItem):boolean;
begin
Result := False;
if Item.Name = Players[0].Strings[0] then
Result := True;
end;
function GetTargetHitDMG: integer;
begin
Result := -1;
case NPCTarget.Name of
'Guard': Result := DMG_Guard;
'Master Farmer': Result := DMG_MasterFarmer;
end;
if Result = -1 then
writeln('Returned -1 as HitDMG, why???');
end;
function GetTargetXP: Extended;
begin
Result := -1;
case NPCTarget.Name of
'Guard': Result := XP_Guard;
'Master Farmer': Result := XP_MasterFarmer;
end;
if Result = -1 then
writeln('Returned -1 as XP...');
end;
function PickFailed: boolean;
begin
Result := True;
if (PrevGold <> GoldStolen) then
begin
Result := False;
PrevGold := GoldStolen;
end;
end;
//Procedure Eat, eats first food available in inventory
procedure Eat;
var
i: integer;
begin
for i := 1 to 28 do
begin
if (IsFood(GetInvItemAt(i))) then
begin
R_ClickItem(i,True,'');
wait(1000);
i := 29;
end;
end;
end;
{*******************************************************************************
function InChatMulti(Text: TStringArray; var OutPut: string): Boolean;
By: IceFire908
Description: Grabs Last Chat Line and performs checks on occurence of text
*******************************************************************************}
function InChatMulti(Text: TStringArray; var OutPut: string): Boolean;
var
s: string;
I: Integer;
begin
S := GetBlackChatMessage;
for I := High(Text) downto 0 do
begin
Result := (Pos(Text[I], s) > 0);
if (Result) then
begin
OutPut := Text[I];
Exit;
end;
end;
end;
//Procedure CheckEat, checks whether LP is high enough to fail a pickpock without dying, eats if isn't.
procedure CheckEat;
begin
if R_GetMMLevels('hp') <= TargetHitDamage then
begin
Eat;
writeln('Eating once...');
end
else
begin
writeln('Did not have to eat.');
end;
end;
//Function GetGold, returns amount of coins there is in inventory.
function GetGold: integer;
var
G: TInvItem;
begin
Result := 0;
if R_ItemNameExists(G,'Coins') then
begin
Result := G.StackSize;
end;
end;
procedure AntiBan;
var
a: integer;
begin
a := random(150);
LevelUp;
case a of
0: HoverSkill('thieving',false);
1: PickUpMouse;
2: RandomMovement;
3: HoverSkill('thieving',false);
4: HoverSkill('random',false);
end;
end;
function eGetNPC(npc:string): TNPC;
var
A: TNPCArray;
begin
A := GetNPCs(npc);
try
Result := A[0];
except
Result := NULL_NPC;
end;
end;
//Function GetTarget, finds and stores the NPC according to Players[].Loc
function GetTarget: TNPC;
begin
case Players[CurrentPlayer].Loc of
'VPG':
Result := eGetNPC('Guard');
'DMF':
Result := eGetNPC('Master Farmer');
end;
TargetHitDamage := GetTargetHitDMG;
end;
//Function IsCloseToTarget, checks whether distance from target is less or equal to 10;
function IsCloseToTarget: boolean;
begin
Result := False;
if DistanceFrom(NPCTarget.Tile) <= 10 then
begin
Result := True;
end;
end;
//Function PickTarget, pickpocks the target NPC if pickpockable.
function PickTarget: boolean;
var TP: TPoint;
S: string;
begin
writeln('Picking...');
PrevGold := GoldStolen;
NPCTarget := GetTarget;
if (NPCTarget = NULL_NPC) then
begin
writeln('Could not find target!');
Walk(False);
Exit;
end;
TP := TileToMs(NPCTarget.Tile, NPCTarget.Height);
MMouse(TP.x,TP.y,0,0);
ClickMouse2(True);
LevelUp;
AntiBan;
if (InChatMulti(['een','unned'],s)) then
begin
wait(500+random(500));
end;
wait(100+random(1000));
end;
//Procedure BankOpen, opens the corrent bank according to Players[].Loc
procedure BankOpen;
begin
case Players[CurrentPlayer].Loc of
'VPG': OpenBankNPC;
'DMF': OpenBank('db',true,true);
end;
end;
//Procedure DepositStuff, deposits everything but coins
procedure DepositStuff;
begin
if (R_BankScreen) then
DepositAll
else
writeln('Tried to deposit stuff whilst bank was closed!');
end;
//Function WithdrawFood, withdraws 'All' of first slot in bank, which should be food
procedure WithdrawFood;
begin
if (R_BankScreen) then
Withdraw(0,0,14)
else
writeln('Tried to withdraw food whilst bank was closed!');
end;
procedure PrintStats;
begin
writeln('-~-~-~-~-~-~-~-~-~-~-~-~-~-~-');
writeln('Gold stolen: ' + IntToStr(GoldStolen));
writeln('-~-~-~-~-~-~-~-~-~-~-~-~-~-~-');
end;
//Function HasFood, checks whether there is anything eatable in inventory.
function HasFood: boolean;
var i: integer;
begin
result := False
for i := 2 to 28 do
begin
if (IsFood(GetInvItemAt(i))) then
begin
result := True;
end;
end;
end;
procedure MainLoop;
begin
while (true) do
begin
BankOpen;// Opens bank
DepositStuff; // Deposits anything but coins.
WithdrawFood; // Withdraws item from slot 1
CloseBank; // Closes bank
Walk(False); // Walks to pickpocking place
while (HasFood) do
begin
CheckEat; // Checks if LP is too low to risk a fail, eats if it is
PickTarget; // Pickpockets the target
GoldStolen := GetGold - StartGold; // Updates gold stats
end;
writeln('Returning to bank');
Walk(True); // Walks to bank
PrintStats; // Prints stats
if (StartXP + ExpGained > Players[0].Integers[0]) then
begin
Players[0].Active := False;
break;
end;
end;
if AllPlayersInactive then Terminate;
end;
begin
Smart_Server := World;
Smart_Members := Members;
Smart_Signed := Signed;
DeclarePlayers;
SetupSRL;
SetupReflectionEx(False);
LogInPlayer;
SetAngle(True);
StartGold := GetGold;
GoldStolen := GetGold - StartGold;
PrevGold := GoldStolen;
while ( true ) do
MainLoop;
end.