Bionicle
2010-04-02 19:30:20
{*******************************************************************************
function PriceScreenOpen: Boolean;
By: Bionicle1800
Description: Checks to see if the price checking screen is open.
*******************************************************************************}
function PriceScreenOpen: Boolean;
begin
Result := FindTextTPA(2070783, 5, 214, 28, 307, 41, 'rice', UpChars, nothing);
end;
{*******************************************************************************
function OpenPriceScreen: Boolean;
By: Bionicle1800
Description: Opens the price checking screen and returns a boolean.
*******************************************************************************}
function OpenPriceScreen: Boolean;
var
X, Y: Integer;
begin
if not PriceScreenOpen then
begin
GameTab(Tab_Equip);
MMouse(RandomRange(625, 660), RandomRange(415, 450), 0, 0);
Wait(300+Random(200));
end;
if GetColor(630, 425) = 2634812 then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, true);
Wait(1000+Random(500));
end;
Result := PriceScreenOpen;
end;
{*******************************************************************************
function PriceCheckOne(InvSlot: Integer; Stacked: Boolean; MoneyType: String): Integer;
By: Bionicle1800
Description: Checks the price of one item in the inventory specified by the integer
InvSlot. If stacked is true, then it will check all the items that
are stacked. Valid arguments for MoneyType are 'gp'; returns the amount
in normal gp form, 'k'; returns the amount in thousands, 'm'; returns
the amount in millions, 'b'; returns the amount in billions. Any other
will return in the normal gp form.
*******************************************************************************}
function PriceCheckOne(InvSlot: Integer; Stacked: Boolean; MoneyType: String): Integer;
var
X, Y, RD: Integer;
TB: TBox;
begin
if not InRange(InvSlot, 1, 28) then
begin
srl_Warn('PriceCheckOne', 'Inventory slot ' + IntToStr(InvSlot)
+ ' is not valid.', Warn_AllVersions);
exit;
end;
case Lowercase(MoneyType) of
('gp'): RD := 1;
('k'): RD := 1000;
('m'): RD := 1000000;
('b'): RD := 1000000000;
else
RD := 1;
end;
if not OpenPriceScreen then
begin
Writeln('Error opening the price checking screen.');
exit;
end;
TB := InvBox(InvSlot);
if Stacked then
begin
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, 2);
WaitOption('ll', 500);
end else
begin
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, 1);
Wait(300+Random(500));
end;
Wait(1000+Random(500));
Result := StrToInt(Replace(GetTextAtEx(50, 310, 3, StatChars, false, false, 0,
2, 16777215, 30, true, tr_Digits), ' ', '')) / RD;
end;
{*******************************************************************************
function PriceCheckAll(Stacked: Boolean; MoneyType: String): Integer;
By: Bionicle1800
Description: Checks the price of all items in the inventory. If stacked is true,
then it will check all the items that are stacked. Valid arguments
for MoneyType are 'gp'; returns the amount in normal gp form, 'k';
returns the amount in thousands, 'm'; returns the amount in millions,
'b'; returns the amount in billions. Any other will return in the
normal gp form.
*******************************************************************************}
function PriceCheckAll(Stacked: Boolean; MoneyType: String): Integer;
var
X, Y, I, RD: Integer;
TB: TBox;
begin
case Lowercase(MoneyType) of
('gp'): RD := 1;
('k'): RD := 1000;
('m'): RD := 1000000;
('b'): RD := 1000000000;
else
RD := 1;
end;
if not OpenPriceScreen then
begin
Writeln('Error opening the price checking screen.');
exit;
end;
for I := 1 to 28 do
begin
TB := InvBox(I);
if FindColor(X, Y, srl_outline_black, TB.X1, TB.Y1, TB.X2, TB.Y2) then
begin
if Stacked then
begin
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, 2);
WaitOption('ll', 500);
end else
begin
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, 1);
Wait(300+Random(500));
end;
Wait(1000+Random(500));
end;
end;
Result := StrToInt(Replace(GetTextAtEx(50, 310, 3, StatChars, false, false, 0,
2, 16777215, 30, true, tr_Digits), ' ', '')) / RD;
end;