Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program new;
- {$h-}
- {$I SRL/OSR.simba}
- {$R-}
- function TRSInventory.GetItemPoints(idx:Int32): TPointArray;
- var
- cl: Integer;
- queue: TPointArray;
- muf: TMufasaBitmap;
- face: TPointArray;
- B: TBox;
- procedure GetAdjacent(var adj:TPointArray; n:TPoint);
- begin
- adj[0] := Point(n.x,n.y+1);
- adj[1] := Point(n.x+1,n.y);
- adj[2] := Point(n.x,n.y-1);
- adj[3] := Point(n.x-1,n.y);
- end;
- function FF(start:TPoint): TIntegerArray;
- var c,wid,hei,j,x,y:Int32;
- begin
- wid := muf.GetWidth();
- hei := muf.GetHeight();
- SetLength(face, 4);
- queue += start;
- while Length(queue) > 0 do
- begin
- GetAdjacent(face, queue.Pop());
- for j:=0 to 3 do
- begin
- x := face[j].x;
- y := face[j].y;
- if (x >= 0) and (y >= 0) and (x < wid) and (y < hei) then
- if (muf.GetPixel(x,y) <> $010000) then
- begin
- c := muf.GetPixel(x,y);
- if Result.Find(c) = -1 then Result += c;
- muf.SetPixel(x,y, $010000);
- queue += face[j];
- end;
- end;
- end;
- end;
- begin
- B := Inventory.GetSlotBox(idx);
- muf := GetMufasaBitmap(BitmapFromClient(B));
- for cl in FF(Point(0,0)) do
- begin
- FindColorsTolerance(queue, cl, B, 0); //worst case, some tolerance is needed.
- Result += queue;
- end;
- Result := ReturnPointsNotInTPA(Result, B);
- muf.Free();
- end;
- var
- BMP, i: Integer;
- TPA:TPointArray;
- begin
- bmp := LoadBitmap('C:/Simba/Scripts/Harrier/Screen2.png');
- SetTargetBitmap(bmp);
- for i:=0 to Inventory.HighSlot do
- begin
- TPA := Inventory.GetItemPoints(i);
- DrawTPABitmap(BMP, TPA, Random($FFFFFF));
- end;
- GetMufasaBitmap(bmp).Debug();
- try
- FreeBitmap(bmp);
- except
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement