Janilabo

Untitled

Aug 20th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.20 KB | None | 0 0
  1. function MapPos(var map_pt: TPoint): Boolean;
  2. var
  3.   old_client, minimap, map, w, h: Integer;
  4. begin
  5.   old_client := GetImageTarget;
  6.   minimap := CreateBitmap(155, 115);
  7.   CopyClientToBitmap(minimap, 353, 72, 508, 187);
  8.   FastReplaceColor(minimap, 16777215, 0); // Whitedot player
  9.   FastReplaceColor(minimap, 16711422, 0); // Whitedot player
  10.   FastReplaceColor(minimap, 18440 , 0);   // Whitedot player
  11.   FastReplaceColor(minimap, 255, 0);      // Items on map
  12.   FastReplaceColor(minimap, 65535, 0);    // NPCs on map
  13.   SaveBitmap(minimap, (AppPath + 'MAPS\minimap.bmp'));
  14.   map := LoadBitmap(AppPath + '\MAPS\Map.bmp');
  15.   FastReplaceColor(map, 24495, 16776960);
  16.   FastReplaceColor(map, 40960, 16776960);
  17.   SetTransparentColor(map, 0);
  18.   SetTargetBitmap(map);
  19.   GetClientDimensions(w, h);
  20.   Result := FindBitmapToleranceIn(minimap, map_pt.X, map_pt.Y, 0, 0, (w - 1), (h - 1), 10);
  21.   if Result then
  22.   begin
  23.     CopyClientToBitmap(minimap, map_pt.X, map_pt.Y, (map_pt.X + 154), (map_pt.Y + 114));
  24.     SaveBitmap(minimap, (AppPath + 'MAPS\minimap.bmp'));
  25.   end else
  26.   begin
  27.     map_pt.X := -1;
  28.     map_pt.Y := -1;
  29.   end;
  30.   SetImageTarget(old_client);
  31.   FreeBitmap(map);
  32.   FreeBitmap(minimap);
  33. end;
Advertisement
Add Comment
Please, Sign In to add comment