munk
2008-04-14 04:37:07
function countInvStack(slot:integer):integer;
var
i:integer;
str:string;
tpa:TpointArray;
cols:TintegerArray;
slotBox,textBox:Tbox;
begin
if not loggedIn then exit;
if existsItem(slot) then
begin
cols:=[65535,16777215,8453888];
slotBox:=invBox(slot);
for i:=low(cols) to high(cols) do
begin
findColorsTolerance(tpa,cols[i],slotBox.x1,slotBox.y1,slotBox.x2,slotBox.y2,0);
if length(tpa)<1 then continue;
textBox:=getTPAbounds(tpa);
str:=trim(getTextAtEx(textBox.x1-1,textBox.y1-1,0,statChars,false,false,0,2,cols[i],7,true,tr_AlphaNumericChars));
if str<>'' then
begin
case uppercase(getLetters(str)) of
'K': result:=strToInt(trimLetters(str))*1000;
'M': result:=strToInt(trimLetters(str))*1000000;
else result:=strToInt(str);
end;
exit;
end;
end;
end;
end;