SCAR Code:
// * function IsXPBarOpen: Boolean; // by Narcle & IceFire908
// * function ToggleXPBar(Open: Boolean): Boolean; // by Narcle & IceFire908
// * function GetXPBarTotal: LongInt; // by Narcle & IceFire908
// * function ResetXPTotal: Boolean; // by Narcle & IceFire908
//*****************************************************************//
{*******************************************************************************
function IsXPBarOpen: Boolean;
By: Narcle & IceFire908
Description: Results True if the XP Bar is showing.
*******************************************************************************}
function IsXPBarOpen: Boolean;
begin
Result := CountColor(clWhite, 342, 55, 510, 69) > 40;
end;
{*******************************************************************************
function ToggleXPBar(Open: Boolean): Boolean;
By: Narcle & IceFire908
Description: Opens or closes the XP Bar, true if had to toggle.
*******************************************************************************}
function ToggleXPBar(Open: Boolean): Boolean;
var
TPA: TPointArray;
P: TPoint;
begin
Result := IsXPBarOpen <> Open;
if (not (Result)) then
Exit;
TPA := TPAFromBox(IntToBox(521, 51, 546, 75));
FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);
P := TPA[Random(Length(TPA))];
Mouse(P.X, P.Y, 0, 0, True);
end;
{*******************************************************************************
function GetXPBarTotal: LongInt;
By: Narcle & IceFire908
Description: Returns the number from your XP Bar.
*******************************************************************************}
function GetXPBarTotal: LongInt;
var
Previous: Boolean;
TPA: TPointArray;
P: TPoint;
B: TBox;
begin
Previous := IsXPBarOpen;
if (ToggleXPBar(True)) then
WaitFunc(@IsXPBarOpen, 10, 1500);
FindColorsTolerance(TPA, clWhite, 342, 55, 510, 69, 1);
B := GetTPABounds(TPA);
B := IntToBox(B.X1 - 2, B.Y1 - 2, B.X2 + 2, B.Y2 + 2);
{$IFDEF Simba}
Result := StrToInt(ExtractFromStr(GetTextAtExWrap(B.X1, B.Y1, B.X2, B.Y2, 0, 5, 4, clWhite, 0, 'XPChars'), Numbers));
{$ELSE}
IsTextInAreaEx(B.X1, B.Y1, B.X2, B.Y2, P.X, P.Y, 'XP', 0, XPChars, False, False, 0, 1, clWhite);
Result := StrToIntDef(GetNumbers(GetTextAtEx(P.X, P.Y, 1, XPChars, False, False, 0, 2, clWhite, 60, False, tr_AllChars)), 0);
{$ENDIF}
if (not (Previous)) then
Wait(RandomRange(500, 1500));
ToggleXPBar(Previous);
end;
{*******************************************************************************
function ResetXPTotal: Boolean;
By: Narcle & IceFire908
Description: Resets the XP Bar.
*******************************************************************************}
function ResetXPTotal: Boolean;
var
TPA: TPointArray;
P: TPoint;
begin
TPA := TPAFromBox(IntToBox(521, 51, 546, 75));
FilterPointsPie(TPA, 0, 360, 0, 12, 534, 63);
P := TPA[Random(Length(TPA))];
Mouse(P.X, P.Y, 0, 0, False);
Result := WaitOptionMulti(['Res', 'ese', 'set'], 1000);
end;