Advertisement
WarPie90

Item bitmap cleaner RS

Sep 15th, 2024 (edited)
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.32 KB | None | 0 0
  1. program new;
  2. {$DEFINE SRL_USE_REMOTEINPUT}
  3. {$I SRL-T/osr.simba}
  4.  
  5. function TRSInventory.CleanItemBitmap(slot: Int32): TMufasaBitmap;
  6. var
  7.   bounds,area: TBox;
  8.   x,y: Int32;
  9.   tmp: TMufasaBitmap;
  10.   shade,TPA,Black,Text1: TPointArray;
  11.   ATPA: T2DPointArray;
  12.   i: Int32;
  13. begin
  14.   area   := Self.GetSlotBox(slot);
  15.   bounds := [area.x1-2,area.y1-1,area.x2+2,area.y2+1]; //36x34
  16.  
  17.   tmp.FromClient(bounds);
  18.   tmp.FindColors(Black, 65536);
  19.   tmp.FindColors(Text1, 65535);   //add other text colors
  20.   tmp.FindColors(shade, 3355443); //add other shade colors
  21.  
  22.   TPA += Black+Text1;
  23.   TPA := TPA.Invert([0,0,tmp.GetHeight()-1,tmp.GetWidth()-1]);
  24.  
  25.   ATPA := NRSplitTPA(TPA, 1);
  26.   for i:=High(ATPA) downto 0 do
  27.     if Length(ATPA[i].Intersection(shade)) <> 0 then
  28.       ATPA.Del(i,1);
  29.  
  30.   Result.Init();
  31.   Result.SetSize(bounds.Width-1, bounds.Height-1);
  32.  
  33.   TPA := ATPA.Merge() + black;
  34.   for i:=0 to High(TPA) do
  35.     Result.SetPixel(TPA[i].x-2,TPA[i].y-1, tmp.GetPixel(TPA[i].x,TPA[i].y));
  36. end;
  37.  
  38. var
  39.   i: Int32;
  40.   muf: TMufasaBitmap;
  41. begin
  42.  
  43.   for i:=0 to 27 do
  44.   begin
  45.     muf := Inventory.CleanItemBitmap(i);
  46.     muf.Debug();
  47.     Sleep(1000);
  48.   end;
  49.  
  50.  
  51.   muf.FromClient(Inventory.GetSlotBox(11));
  52.   muf.Debug();
  53.   Sleep(1000);
  54.  
  55.   WriteLn ItemFinder.CleanItemBitmap(muf);
  56.   muf.Debug();
  57.  
  58.   Sleep(10000);
  59. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement