Bad Boy JH
2010-11-30 19:00:03
well, here it is, its a withdrawing function, which uses Reflection. The code looks messy, but it works a damn treat
function R_WithdrawItemID(ID, Amount: Integer): Boolean;
var
I, WhichBankTab, ItemSlot: Integer;
BankTabItemIDs: TIntegerArray;
RelPoint: TPoint;
TabBox, ItemBox: TBox;
begin
for ItemSlot := 0 to 515 do
if ID = GetChildComponentID(INTERFACE_BANK, 93, ItemSlot) then
Break;
if GetChildComponentID(INTERFACE_BANK, 93, ItemSlot) = -1 then
begin
Writeln('ItemID ' + IntToStr(ID) + ' not found.');
Exit;
end;
if ItemSlot = 515 then
begin
Writeln('ItemID ' + IntToStr(ID) + ' not found.');
Exit;
end;
RelPoint.x := GetChildComponentRelativeX(INTERFACE_BANK, 93, ItemSlot);
RelPoint.y := GetChildComponentRelativeY(INTERFACE_BANK, 93, ItemSlot);
if (RelPoint.x = 0) then
begin
SetLength(BankTabItemIDs, 9);
for I := 1 to 9 do
BankTabItemIDs[I - 1] := GetInterfaceComponentID(INTERFACE_BANK, 47 + ((9 - I) * 2));
for I := ItemSlot downto 0 do
if InIntArrayEx(BankTabItemIds, WhichBankTab, GetChildComponentID(INTERFACE_BANK, 93, I)) then
Break;
TabBox.x1 := GetInterfaceComponentRelativeX(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2)) + 4;
TabBox.y1 := GetInterfaceComponentRelativeY(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2)) + 4;
TabBox.x2 := TabBox.x1 + GetInterfaceComponentWidth(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2));
TabBox.y2 := TabBox.y1 + GetInterfaceComponentHeight(INTERFACE_BANK, 47 + ((8 - WhichBankTab) * 2));
MouseBox(TabBox.x1, TabBox.y1, TabBox.x2, TabBox.y2, 1);
RelPoint.x := GetChildComponentRelativeX(INTERFACE_BANK, 93, ItemSlot);
RelPoint.y := GetChildComponentRelativeY(INTERFACE_BANK, 93, ItemSlot);
end;
ItemBox.x1 := RelPoint.x + GetInterfaceComponentRelativeX(INTERFACE_BANK, 93) + 4;
ItemBox.y1 := RelPoint.y + GetInterfaceComponentRelativeY(INTERFACE_BANK, 93) + 4;
ItemBox.x2 := ItemBox.x1 + GetChildComponentWidth(INTERFACE_BANK, 93, ItemSlot)
ItemBox.y2 := ItemBox.y1 + GetChildComponentHeight(INTERFACE_BANK, 93, ItemSlot)
if Amount = 1 then
begin
MouseBox(ItemBox.x1, ItemBox.y1, ItemBox.x2, ItemBox.y2, 1);
Result := True;
Exit;
end;
MouseBox(ItemBox.x1, ItemBox.y1, ItemBox.x2, ItemBox.y2, 2);
if Amount = 0 then
Result := R_ChooseOption('Withdraw-All') else
if OptionExists('Withdraw-' + IntToStr(Amount)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount)) else
begin
if R_ChooseOption('Withdraw-X') then
begin
Wait(RandomRange(1200, 1500));
//I personally don't like this, but its how both RSBot and Tribot does it
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;