daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Jun 30th, 2018 127 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program ShilosVagCameLite;
  2. {$DEFINE SMART}
  3. {$i srl/srl.simba}
  4.  
  5. {$IFDEF SMART}
  6.   {$i srl/srl/misc/paintsmart.simba}
  7. {$ENDIF}
  8.  
  9. const
  10.   GEM_OPAL     = 0;
  11.   GEM_JADE     = 1;
  12.   GEM_TOPAZ    = 2;
  13.   GEM_SAPPHIRE = 3;
  14.   GEM_EMERALD  = 4;
  15.   GEM_RUBY     = 5;
  16.   GEM_DIAMOND  = 6;
  17.  
  18.   GEM_BL_UNCUT   = 70;
  19.   GEM_BL_CUT     = 62;
  20.   GEM_BL_CRUSHED = 75;
  21.  
  22.   GEM_ROCK_COLOR = 9319051;
  23.   GEM_ROCK_HUE = 0.08;
  24.   GEM_ROCK_SAT = 0.92;
  25.   GEM_ROCK_TOL = 23;
  26.  
  27.   SRLStatsUserName = '';
  28.   SRLStatsPassword = '';
  29.  
  30. type
  31.   TPlayer = record
  32.     Craft_Lvl, Mining_Lvl, Highest_Can_Cut : Integer;
  33.   end;
  34.  
  35.   TGem = record
  36.     Name, UpText : string;
  37.     Gem, Color, Tol : Integer;
  38.     Hue, Sat, CraftXP : Extended;
  39.   end;
  40.  
  41.   TReport = record
  42.     TimesBanked, LoadsDone, ItemsDropped : Integer;
  43.     OpalsMined, JadesMined, TopazMined, SapphiresMined, EmeraldsMined, RubiesMined, DiamondsMined : Integer;
  44.     OpalsCut, JadesCut, TopazCut, SapphiresCut, EmeraldsCut, RubiesCut, DiamondsCut : Integer;
  45.     GemsMined, GemsCut, GemsCrushed : Integer;
  46.     CraftingXP, MiningXP : Integer;
  47.   end;
  48.  
  49. var
  50.   Player : TPlayer;
  51.   Gems : array of TGem;
  52.   ReportVars : TReport;
  53.  
  54. procedure DeclarePlayers();
  55. begin
  56.   HowManyPlayers := 1;
  57.   NumberOfPlayers(HowManyPlayers);
  58.   CurrentPlayer := 0;
  59.  
  60.   with Players[0] do
  61.   begin
  62.     Name        := '';              // Your RuneScape Account Name
  63.     Pass        := '';              // Your RuneScape Account Password
  64.     Active      := True;            // Use in the Script. True / False.
  65.     Integers[0] := 1;               // How many Loads to do
  66.     Booleans[0] := False;           // Pickaxe in Inventory
  67.   end;
  68. end;
  69.  
  70. procedure SetupScript;
  71. begin
  72.   {$IFDEF SMART}
  73.     Smart_Server := 10;
  74.     Smart_Members := True;
  75.     Smart_Signed := True;
  76.   {$ENDIF}
  77.   SetupSRL();
  78.   SetupSRLStats(841, SRLStatsUserName, SRLStatsPassword);
  79.   ClearDebug();
  80.   ActivateClient();
  81.   DeclarePlayers();
  82.   LoginPlayer();
  83.   while(not(RSReady()))do
  84.     Wait(9000);
  85.   ClickNorth(SRL_ANGLE_HIGH);
  86.   GameTab(tab_Inv);
  87. end;
  88.  
  89. procedure SetupPlayer;
  90. {$IFDEF SMART}var i : Integer;{$ENDIF}
  91. begin
  92.   WriteLn('-[DEBUG]||[STARTING]- ***SetupPlayer***');
  93.  
  94.   Player.Craft_Lvl := GetSkillLevel(SKILL_CRAFTING);
  95.   Player.Mining_Lvl := GetSkillLevel(SKILL_MINING);
  96.  
  97.   WriteLn('-[DEBUG]- Crafting level is ' + IntToStr(Player.Craft_Lvl) + '.');
  98.   WriteLn('-[DEBUG]- Mining level is ' + IntToStr(Player.Mining_Lvl) + '.');
  99.  
  100.   GameTab(tab_Inv);
  101.  
  102.   case(Player.Craft_Lvl)of
  103.     1..12 : Player.Highest_Can_Cut := GEM_OPAL;
  104.     13..15: Player.Highest_Can_Cut := GEM_JADE;
  105.     16..19: Player.Highest_Can_Cut := GEM_TOPAZ;
  106.     20..26: Player.Highest_Can_Cut := GEM_SAPPHIRE;
  107.     27..33: Player.Highest_Can_Cut := GEM_EMERALD;
  108.     34..42: Player.Highest_Can_Cut := GEM_RUBY;
  109.     43..99: Player.Highest_Can_Cut := GEM_DIAMOND;
  110.   end;
  111.  
  112.   {$IFDEF SMART}
  113.     for i := (Integer(Players[CurrentPlayer].Booleans[0]) + 1) to 28 do
  114.       SMART_DrawBoxEx(False, InvBox(i), clYellow);
  115.   {$ENDIF}
  116.  
  117.   WriteLn('-[DEBUG]||[ENDING]- ***SetupPlayer***');
  118. end;
  119.  
  120. procedure SetupGems;
  121. begin
  122.   WriteLn('-[DEBUG]||[STARTING]- ***SetupGems***');
  123.   WriteLn('-[DEBUG]- Loading Gems.');
  124.  
  125.   SetLength(Gems, 7);
  126.  
  127.   with Gems[0] do
  128.   begin
  129.     Gem := GEM_OPAL;
  130.     Name := 'Uncut Opal';
  131.     UpText := 'opal';
  132.     Color := 7242628;
  133.     Hue := 0.06;
  134.     Sat := 0.19;
  135.     Tol := 14;
  136.     CraftXP := 15;
  137.   end;
  138.  
  139.   WriteLn('-[DEBUG]- Gem Opal is loaded.');
  140.  
  141.   with Gems[1] do
  142.   begin
  143.     Gem := GEM_JADE;
  144.     Name := 'Uncut Jade';
  145.     UpText := 'jade';
  146.     Color := 6979442;
  147.     Hue := 0.06;
  148.     Sat := 0.15;
  149.     Tol := 15;
  150.     CraftXP := 20;
  151.   end;
  152.  
  153.   WriteLn('-[DEBUG]- Gem Jade is loaded.');
  154.  
  155.   with Gems[2] do
  156.   begin
  157.     Gem := GEM_TOPAZ;
  158.     Name := 'Uncut Red Topaz';
  159.     UpText := 'topaz';
  160.     Color := 5247883;
  161.     Hue := 0.02;
  162.     Sat := 0.17;
  163.     Tol := 9;
  164.     CraftXP := 25;
  165.   end;
  166.  
  167.   WriteLn('-[DEBUG]- Gem Red Topaz is loaded.');
  168.  
  169.   with Gems[3] do
  170.   begin
  171.     Gem := GEM_SAPPHIRE;
  172.     Name := 'Uncut Sapphire';
  173.     UpText := 'sapphire';
  174.     Color := 7410191;
  175.     Hue := 0.02;
  176.     Sat := 0.16;
  177.     Tol := 8;
  178.     CraftXP := 50;
  179.   end;
  180.  
  181.   WriteLn('-[DEBUG]- Gem Sapphire is loaded.');
  182.  
  183.   with Gems[4] do
  184.   begin
  185.     Gem := GEM_EMERALD;
  186.     Name := 'Uncut Emerald';
  187.     UpText := 'emerald';
  188.     Color := 1074957;
  189.     Hue := 0.04;
  190.     Sat := 0.26;
  191.     Tol := 8;
  192.     CraftXP := 67.5;
  193.   end;
  194.  
  195.   WriteLn('-[DEBUG]- Gem Emerald is loaded.');
  196.  
  197.   with Gems[5] do
  198.   begin
  199.     Gem := GEM_RUBY;
  200.     Name := 'Uncut Ruby';
  201.     UpText := 'ruby';
  202.     Color := 725076;
  203.     Hue := 0.04;
  204.     Sat := 0.25;
  205.     Tol := 6;
  206.     CraftXP := 85;
  207.   end;
  208.  
  209.   WriteLn('-[DEBUG]- Gem Ruby is loaded.');
  210.  
  211.   with Gems[6] do
  212.   begin
  213.     Gem := GEM_DIAMOND;
  214.     Name := 'Uncut Diamond';
  215.     UpText := 'diamond';
  216.     Color := 8882064;
  217.     Hue := 0.16;
  218.     Sat := 0.12;
  219.     Tol := 18;
  220.     CraftXP := 107.5;
  221.   end;
  222.  
  223.   WriteLn('-[DEBUG]- Gem Diamond is loaded.');
  224.   WriteLn('-[DEBUG]- All gems are loaded.');
  225.   WriteLn('-[DEBUG]||[ENDING]- ***SetupGems***');
  226. end;
  227.  
  228. (*
  229.   Credit to RISK (Stole from his Range Guild script)
  230.   BenLand's function, modified by Flight(?) to have a paint trail, re-modified
  231.   by RISK to disable the paint option completely if the user is not using SMART
  232. *)
  233. procedure WindMouse2(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
  234. var
  235.   veloX, veloY, windX, windY, veloMag, dist, randomDist, lastDist, step: extended;
  236.   lastX, lastY: integer;
  237.   sqrt2, sqrt3, sqrt5: extended;
  238. begin
  239.   sqrt2:= sqrt(2);
  240.   sqrt3:= sqrt(3);
  241.   sqrt5:= sqrt(5);
  242.   while hypot(xs - xe, ys - ye) > 1 do
  243.   begin
  244.     dist:= hypot(xs - xe, ys - ye);
  245.     wind:= minE(wind, dist);
  246.     if dist >= targetArea then
  247.     begin
  248.       windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
  249.       windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
  250.     end else
  251.     begin
  252.       windX:= windX / sqrt2;
  253.       windY:= windY / sqrt2;
  254.       if (maxStep < 3) then
  255.       begin
  256.         maxStep:= random(3) + 3.0;
  257.       end else
  258.       begin
  259.         maxStep:= maxStep / sqrt5;
  260.       end;
  261.     end;
  262.     veloX:= veloX + windX;
  263.     veloY:= veloY + windY;
  264.     veloX:= veloX + gravity * (xe - xs) / dist;
  265.     veloY:= veloY + gravity * (ye - ys) / dist;
  266.     if hypot(veloX, veloY) > maxStep then
  267.     begin
  268.       randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
  269.       veloMag:= sqrt(veloX * veloX + veloY * veloY);
  270.       veloX:= (veloX / veloMag) * randomDist;
  271.       veloY:= (veloY / veloMag) * randomDist;
  272.     end;
  273.     lastX:= Round(xs);
  274.     lastY:= Round(ys);
  275.     xs:= xs + veloX;
  276.     ys:= ys + veloY;
  277.     if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
  278.       MoveMouse(Round(xs), Round(ys));
  279.     step:= hypot(xs - lastX, ys - lastY);
  280.     wait(round((maxWait - minWait) * (step / maxStep) + minWait));
  281.     lastdist:= dist;
  282.  
  283.     {$IFDEF SMART}
  284.     if(PointInBox(Point(lastX, lastY), IntToBox(MSX1, MSY1, MSX2, MSY2)))then
  285.       SMART_DrawDotsEx(False, [Point(lastX, lastY)], clWhite);
  286.     {$ENDIF}
  287.   end;
  288.   if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
  289.     MoveMouse(Round(xe), Round(ye));
  290. end;
  291.  
  292. (*
  293.    Credits to Flight
  294. *)
  295. procedure HumanMMouse(eX, eY, ranX, ranY: Integer);
  296. var
  297.   randSpeed: extended;
  298.   X,Y,X2,Y2,A,Dist,MP: integer;
  299. begin
  300.   A := MouseSpeed;
  301.   GetMousePos(X, Y);
  302.   Dist := Distance(X, Y, eX, eY);
  303.   MP := Round(Dist/150);
  304.   if MP < 0 then
  305.     MP := 1;
  306.  
  307.   randSpeed := (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
  308.   X2 := RandomRange(eX-(A*MP), eX+(A*MP));
  309.   Y2 := RandomRange(eY-(A*MP), eY+(A*MP));
  310.   WindMouse2(X, Y, X2, Y2, 11, 8, 10.0 / randSpeed, 12.0 / randSpeed, 10.0 * randSpeed, 10.0 * randSpeed);
  311.   GetMousePos(X, Y);
  312.   MMouse(eX, eY, ranX, ranY);
  313.   MouseSpeed := A;
  314. end;
  315.  
  316. procedure AntiBan();
  317. begin
  318.   if(not(LoggedIn))then Exit;
  319.  
  320.   WriteLn('-[DEBUG]||[STARTING]- ***Antiban***');
  321.   WriteLn('-[DEBUG]- Performing Antiban.');
  322.   FindNormalRandoms;
  323.  
  324.   case (Random(350)) of
  325.     0 : RandomRClick;
  326.     1 : HoverSkill('random', False);
  327.     2 : ExamineInv;
  328.     3 : MouseSpeed := (RandomRange(10, 12));
  329.     4 : begin HoverSkill('Mining', False); Wait(RandomRange(2000, 4000)); end;
  330.     5 : begin PickUpMouse; SleepAndMoveMouse(1500 + Random(500)); end;
  331.     6 : begin GameTab(tab_Stats); Wait(1500 + Random(500)); GameTab(tab_Inv); end;
  332.     7 .. 14 : HoverSkill('Crafting', False);
  333.     15 .. 40 : Wait(RandomRange(750, 2000));
  334.     41: BoredHuman;
  335.   end;
  336.  
  337.   WriteLn('-[DEBUG]||[ENDING]- ***Antiban***');
  338. end;
  339.  
  340. procedure IdentifyGem(invIndex : Integer);
  341. var
  342.   invB : TBox;
  343.   i, x, y : Integer;
  344.   TPA  : TPointArray;
  345.   tmpCTS : Integer;
  346. begin
  347.   if(not(LoggedIn))then Exit;
  348.  
  349.   WriteLn('-[DEBUG]||[STARTING]- ***IdentifyGem***');
  350.   invB := InvBox(invIndex);
  351.  
  352.   WriteLn('-[DEBUG]- Attempting to identify gem.');
  353.  
  354.   tmpCTS := GetColorToleranceSpeed;
  355.   ColorToleranceSpeed(2);
  356.  
  357.   for i := Low(Gems) to High(Gems) do
  358.   begin
  359.     SetColorSpeed2Modifiers(Gems[i].Hue, Gems[i].Sat);
  360.     if(FindColorsSpiralTolerance(x, y, TPA, Gems[i].Color, invB.X1, invB.Y1, invB.X2, invB.Y2, Gems[i].Tol))then
  361.     begin
  362.       {$IFDEF SMART}SMART_DrawBoxEx(False, invB, Gems[i].Color);{$ENDIF}
  363.       WriteLn('-[DEBUG]- Found "' + Gems[i].Name + '" in inventory slot #' + IntToStr(invIndex) + '.');
  364.  
  365.       Inc(ReportVars.GemsMined);
  366.       IncEx(ReportVars.MiningXP, 65);
  367.       case(Gems[i].Gem)of
  368.         GEM_OPAL : Inc(ReportVars.OpalsMined);
  369.         GEM_JADE : Inc(ReportVars.JadesMined);
  370.         GEM_TOPAZ : Inc(ReportVars.TopazMined);
  371.         GEM_SAPPHIRE : Inc(ReportVars.SapphiresMined);
  372.         GEM_EMERALD : Inc(ReportVars.EmeraldsMined);
  373.         GEM_RUBY : Inc(ReportVars.RubiesMined);
  374.         GEM_DIAMOND : Inc(ReportVars.DiamondsMined);
  375.       end;
  376.  
  377.       WriteLn('-[DEBUG]- Checking to see if this gem can be cut.');
  378.       if(Player.Highest_Can_Cut < Gems[i].Gem)then
  379.       begin
  380.         WriteLn('-[DEBUG]- Can not cut this gem, dropping it now.');
  381.         DropItem(invIndex);
  382.         Inc(ReportVars.ItemsDropped);
  383.         {$IFDEF SMART}SMART_DrawBoxEx(False, invB, clYellow);{$ENDIF}
  384.       end;
  385.       Break;
  386.     end;
  387.   end;
  388.  
  389.   ColorToleranceSpeed(tmpCTS);
  390.   SetColorSpeed2Modifiers(0.2, 0.2);
  391.   WriteLn('-[DEBUG]||[ENDING]- ***IdentifyGem***');
  392. end;
  393.  
  394. function FindGemRock(var x, y : Integer; All : Boolean) : Boolean;
  395. var
  396.   a, b, c : Integer;
  397.   TPA  : TPointArray;
  398.   ATPA : T2DPointArray;
  399.   MP   : TPoint;
  400.   tmpCTS : Integer;
  401.   Box  : TBox;
  402. begin
  403.   if(not(LoggedIn))then Exit;
  404.   WriteLn('-[DEBUG]||[STARTING]- ***FindGemRock(' + BoolToStr(All) + ')***');
  405.   WriteLn('-[DEBUG]- Searching for Gem rocks.');
  406.  
  407.   tmpCTS := GetColorToleranceSpeed;
  408.   ColorToleranceSpeed(2);
  409.   SetColorSpeed2Modifiers(GEM_ROCK_HUE, GEM_ROCK_SAT);
  410.  
  411.   FindColorsSpiralTolerance(b, c, TPA, GEM_ROCK_COLOR, MSX1, MSY1, MSX2, MSY2, GEM_ROCK_TOL);
  412.   SortTPAFrom(TPA, Point(MSCX, MSCY));
  413.   ATPA := TPAtoATPAEx(TPA, 20, 20);
  414.   for a := 0 to High(ATPA) do
  415.   begin
  416.     MP := MiddleTPA(ATPA[a]);
  417.     if(not(PointInBox(Point(MP.X, MP.Y) , IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15))))then
  418.     begin
  419.       Box := IntToBox((MP.X - 20), (MP.Y - 20), (MP.X + 20), (MP.Y + 20));
  420.       {$IFDEF SMART}SMART_DrawBoxEx(False, Box, GEM_ROCK_COLOR);{$ENDIF}
  421.       if(not(All))then
  422.       begin
  423.         HumanMMouse(MP.X, MP.Y, 2, 2);
  424.         if(WaitUptext('ine Gem', 750))then
  425.         begin
  426.           WriteLn('-[DEBUG]- Gem rock is found at point(' + IntToStr(MP.X) + ', ' + IntToStr(MP.Y) + ').');
  427.           x := MP.X; y := MP.Y;
  428.           Result := True;
  429.           {$IFDEF SMART}
  430.             SMART_ClearCanvasArea(Box);
  431.             SMART_DrawBoxEx(False, Box, clRed);
  432.           {$ENDIF}
  433.           Break;
  434.         end else
  435.           WriteLn('-[DEBUG]||[ERROR]- Color point(' + IntToStr(MP.X) + ', ' + IntToStr(MP.Y) + ') is not a Gem rock.');
  436.       end;
  437.     end;
  438.   end;
  439.  
  440.   ColorToleranceSpeed(tmpCTS);
  441.   SetColorSpeed2Modifiers(0.2, 0.2);
  442.   WriteLn('-[DEBUG]||[ENDING]- ***FindGemRock(' + BoolToStr(All) + ')***');
  443. end;
  444.  
  445. function isMining: Boolean;
  446. var
  447.   B: TBox;
  448.   APS : Integer;
  449. begin
  450.   WriteLn('-[DEBUG]||[STARTING]- ***isMining***');
  451.   B := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
  452.   APS := AveragePixelShift(B, 250, 250);
  453.   WriteLn('-[DEBUG]- Average Pixel Shift is ' + IntToStr(APS) + '.');
  454.   Result := (APS > 400);
  455.   WriteLn('-[DEBUG]- isMining equals ' + BoolToStr(Result) + '.');
  456.   WriteLn('-[DEBUG]||[ENDING]- ***isMining***');
  457. end;
  458.  
  459. procedure MineRock();
  460. var
  461.   x, y, t, i, mTime : Integer;
  462.   {$IFDEF SMART}Box : TBox;{$ENDIF}
  463. begin
  464.   if(not(LoggedIn))then Exit;
  465.  
  466.   WriteLn('-[DEBUG]||[STARTING]- ***MineRock***');
  467.   WriteLn('-[DEBUG]- Mining Gem rock.');
  468.  
  469.   repeat
  470.     i := InvCount + 1;
  471.     mTime := 4000 + RandomRange(500, 1500);
  472.     WriteLn('-[DEBUG]- mTime is ' + IntToStr(mTime) + 'ms.');
  473.  
  474.     if(FindGemRock(x, y, False))then
  475.     begin
  476.       Mouse(x, y, 2, 2, mouse_Left);
  477.       WriteLn('-[DEBUG]- Marking start time.');
  478.       MarkTime(t);
  479.       repeat
  480.         {$IFDEF SMART}
  481.           Box := IntToBox((x - 20), (y - 20), (x + 20), (y + 20));
  482.           SMART_ClearMS();
  483.           FindGemRock(x, y, True);
  484.         {$ENDIF}
  485.  
  486.         WriteLn('-[DEBUG]- Checking for Randoms.');
  487.         FindNormalRandoms();
  488.         ClickToContinue();
  489.  
  490.         WriteLn('-[DEBUG]- Checking time passed (' + IntToStr(TimeFromMark(t)) + 'ms have passed).');
  491.         if(TimeFromMark(t) > mTime)then
  492.           Break;
  493.  
  494.         WriteLn('-[DEBUG]- Checking if we are still mining.');
  495.         if(isMining)then
  496.         begin
  497.           WriteLn('-[DEBUG]- We are still mining.');
  498.           AntiBan();
  499.           WriteLn('-[DEBUG]- Resetting mTime.');
  500.           MarkTime(t);
  501.           Wait(500);
  502.         end;
  503.       until(InvCount = i) or (TimeFromMark(t) > mTime);
  504.  
  505.       if(InvCount = i)then
  506.         IdentifyGem(InvCount)
  507.       else
  508.         WriteLn('-[DEBUG]||[ERROR]- Failed to mine Gem rock, request timed out. Exceeded ' + IntToStr(mTime) + 'ms.');
  509.     end else
  510.     begin
  511.       WriteLn('-[DEBUG]- All gem rocks have been mined, waiting until respawn.');
  512.       while(not(FindGemRock(x, y, False)))do
  513.         AntiBan();
  514.     end;
  515.   until(InvFull);
  516.   WriteLn('-[DEBUG]||[ENDING]- ***MineRock***');
  517. end;
  518.  
  519. function FindSelection(): Boolean;
  520. begin
  521.   Result := (CountColor(srl_outline_black, MCX1, MCY1, MCX2, MCY2) > (GEM_BL_CUT - 3));
  522. end;
  523.  
  524. procedure CutGems();
  525. var
  526.   invB : TBox;
  527.   i, ii, j, x, y, a, b : Integer;
  528.   TPA  : TPointArray;
  529.   tmpCTS : Integer;
  530.   slots, g : T2DIntegerArray;
  531. begin
  532.   if(not(LoggedIn))then Exit;
  533.  
  534.   WriteLn('-[DEBUG]||[STARTING]- ***CutGems***');
  535.   WriteLn('-[DEBUG]- Scanning inventory.');
  536.  
  537.   tmpCTS := GetColorToleranceSpeed;
  538.   ColorToleranceSpeed(2);
  539.  
  540.   SetLength(slots, 7);
  541.   SetLength(g, 7);
  542.  
  543.   for i := Low(Gems) to High(Gems) do
  544.   begin
  545.     SetLength(slots[i], 2);
  546.     SetLength(g[i], 29);
  547.   end;
  548.  
  549.   for i := (Integer(Players[CurrentPlayer].Booleans[0]) + 1) to 28 do
  550.   begin
  551.     WriteLn('-[DEBUG]- Looking in inventory slot #' + IntToStr(i) + '.');
  552.     invB := InvBox(i);
  553.  
  554.     if(InRange(CountColor(srl_outline_black, invB.X1, invB.Y1, invB.X2, invB.Y2), (GEM_BL_UNCUT - 3), (GEM_BL_UNCUT + 3)))then
  555.     begin
  556.       WriteLn('-[DEBUG]- Uncut gem black list found.');
  557.       for ii := Low(Gems) to High(Gems) do
  558.       begin
  559.         SetColorSpeed2Modifiers(Gems[ii].Hue, Gems[ii].Sat);
  560.         if(FindColorsSpiralTolerance(x, y, TPA, Gems[ii].Color, invB.X1, invB.Y1, invB.X2, invB.Y2, Gems[ii].Tol))then
  561.         begin
  562.           if(slots[ii][0] = 0)then
  563.           begin
  564.             slots[ii][0] := Gems[ii].Gem;
  565.             slots[ii][1] := i;
  566.           end;
  567.  
  568.           {$IFDEF SMART}SMART_DrawBoxEx(False, invB, Gems[ii].Color);{$ENDIF}
  569.           Inc(j);
  570.  
  571.           g[ii][i] := i;
  572.  
  573.           case(Gems[ii].Gem)of
  574.             GEM_OPAL : begin Inc(ReportVars.OpalsCut); IncEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  575.             GEM_JADE : begin Inc(ReportVars.JadesCut); IncEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  576.             GEM_TOPAZ : begin Inc(ReportVars.TopazCut); IncEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  577.             GEM_SAPPHIRE : begin Inc(ReportVars.SapphiresCut); IncEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  578.             GEM_EMERALD : begin Inc(ReportVars.EmeraldsCut); IncEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  579.             GEM_RUBY : begin Inc(ReportVars.RubiesCut); IncEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  580.             GEM_DIAMOND : begin Inc(ReportVars.DiamondsCut); IncEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  581.           end;
  582.  
  583.           Break;
  584.         end;
  585.       end;
  586.     end;
  587.   end;
  588.   WriteLn('-[DEBUG]- Found ' + IntToStr(j) + ' gems in the inventory.');
  589.  
  590.   for i := Low(Gems) to High(Gems) do
  591.   begin
  592.     if(Gems[i].Gem = slots[i][0])then
  593.     begin
  594.       WriteLn('-[DEBUG]- Cutting "' + Gems[i].Name + '" in inventory slot #' + IntToStr(slots[i][1]) + '.');
  595.       invB := InvBox(slots[i][1]);
  596.       Mouse((invB.X1 + invB.X2) / 2, (invB.Y1 + invB.Y2) / 2, 5, 5, mouse_Left);
  597.       while(not(FindSelection()))do
  598.         Wait(RandomRange(250, 500));
  599.       Mouse(256, 432, 10, 10, mouse_Left);
  600.       repeat
  601.         SetColorSpeed2Modifiers(Gems[i].Hue, Gems[i].Sat);
  602.         for ii := (Integer(Players[CurrentPlayer].Booleans[0]) + 1) to 28 do
  603.         begin
  604.           invB := InvBox(ii);
  605.           if(FindColorsSpiralTolerance(x, y, TPA, Gems[i].Color, invB.X1, invB.Y1, invB.X2, invB.Y2, Gems[i].Tol))then
  606.           begin
  607.             Inc(a);
  608.             if(CountColor(srl_outline_black, invB.X1, invB.Y1, invB.X2, invB.Y2) > (GEM_BL_CUT - 3))then
  609.               Inc(b);
  610.  
  611.             Wait(RandomRange(500, 750));
  612.           end;
  613.         end;
  614.       until(a = b);
  615.     end;
  616.   end;
  617.  
  618.   WriteLn('-[DEBUG]- Searching for crushed gems.');
  619.  
  620.   j := 0;
  621.   for i := (Integer(Players[CurrentPlayer].Booleans[0]) + 1) to 28 do
  622.   begin
  623.     WriteLn('-[DEBUG]- Looking for crushed gems in inventory slot #' + IntToStr(i) + '.');
  624.     invB := InvBox(i);
  625.  
  626.     if(InRange(CountColor(srl_outline_black, invB.X1, invB.Y1, invB.X2, invB.Y2), (GEM_BL_CRUSHED - 3), (GEM_BL_CRUSHED + 3)))then
  627.     begin
  628.       WriteLn('-[DEBUG]- Crushed gem black list found.');
  629.       for ii := Low(Gems) to High(Gems) do
  630.       begin
  631.         a := 0;
  632.         for a := Low(g[ii]) to High(g[ii]) do
  633.         begin
  634.           if(g[ii][a] = i)then
  635.           begin
  636.             case(Gems[ii].Gem)of
  637.               GEM_OPAL : begin Dec(ReportVars.OpalsCut); DecEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  638.               GEM_JADE : begin Dec(ReportVars.JadesCut); DecEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  639.               GEM_TOPAZ : begin Dec(ReportVars.TopazCut); DecEx(ReportVars.CraftingXP, Round(Gems[ii].CraftXP)); end;
  640.             end;
  641.           end;
  642.         end;
  643.       end;
  644.  
  645.       {$IFDEF SMART}SMART_DrawBoxEx(False, invB, clWhite);{$ENDIF}
  646.       WriteLn('-[DEBUG]- Found crushed gem in inventory slot #' + IntToStr(i) + '.');
  647.       Inc(j);
  648.     end;
  649.   end;
  650.  
  651.   WriteLn('-[DEBUG]- Found ' + IntToStr(j) + ' crushed gems.');
  652.   IncEx(ReportVars.GemsCut, (28 - j));
  653.   IncEx(ReportVars.GemsCrushed, j);
  654.  
  655.   ColorToleranceSpeed(tmpCTS);
  656.   SetColorSpeed2Modifiers(0.2, 0.2);
  657.   WriteLn('-[DEBUG]||[ENDING]- ***CutGems***');
  658. end;
  659.  
  660. procedure DropGems();
  661. {$IFDEF SMART}
  662. var
  663.   i : Integer;
  664. {$ENDIF}
  665. begin
  666.   WriteLn('-[DEBUG]||[STARTING]- ***DropGems***');
  667.   WriteLn('-[DEBUG]- Dropping inventory.');
  668.   if(Players[CurrentPlayer].Booleans[0])then
  669.     DropAllExcept([1])
  670.   else
  671.     DropAll();
  672.   IncEx(ReportVars.ItemsDropped, 28 - (Integer(Players[CurrentPlayer].Booleans[0])));
  673.   {$IFDEF SMART}
  674.     for i := (Integer(Players[CurrentPlayer].Booleans[0]) + 1) to 28 do
  675.       SMART_DrawBoxEx(False, InvBox(i), clYellow);
  676.   {$ENDIF}
  677.   WriteLn('-[DEBUG]||[ENDING]- ***DropGems***');
  678. end;
  679.  
  680. procedure SendStats();
  681. begin
  682.   stats_IncVariable('Loads Done', ReportVars.LoadsDone);
  683.   stats_IncVariable('Mining EXP (Gained)', ReportVars.MiningXP);
  684.   stats_IncVariable('Crafting EXP (Gained)', ReportVars.CraftingXP);
  685.   stats_IncVariable('Items Dropped ', ReportVars.ItemsDropped);
  686.   stats_IncVariable('Opals (Mined)', ReportVars.OpalsMined);
  687.   stats_IncVariable('Jades (Mined)', ReportVars.JadesMined);
  688.   stats_IncVariable('Topaz (Mined)', ReportVars.TopazMined);
  689.   stats_IncVariable('Sapphires (Mined)', ReportVars.SapphiresMined);
  690.   stats_IncVariable('Emeralds (Mined)', ReportVars.EmeraldsMined);
  691.   stats_IncVariable('Rubies (Mined)', ReportVars.RubiesMined);
  692.   stats_IncVariable('Diamonds (Mined)', ReportVars.DiamondsMined);
  693.   stats_IncVariable('Gems (Mined)', ReportVars.GemsMined);
  694.   stats_IncVariable('Opals (Cut)', ReportVars.OpalsCut);
  695.   stats_IncVariable('Jades (Cut)', ReportVars.JadesCut);
  696.   stats_IncVariable('Topaz (Cut)', ReportVars.TopazCut);
  697.   stats_IncVariable('Sapphire Cut', ReportVars.SapphiresCut);
  698.   stats_IncVariable('Emerald Cut', ReportVars.EmeraldsCut);
  699.   stats_IncVariable('Ruby Cut', ReportVars.RubiesCut);
  700.   stats_IncVariable('Diamond Cut', ReportVars.DiamondsCut);
  701.   stats_IncVariable('Gems (Cut)', ReportVars.GemsCut);
  702.   stats_IncVariable('Gems (Crushed)', ReportVars.GemsCrushed);
  703.   Stats_Commit;
  704. end;
  705.  
  706. procedure Report();
  707. begin
  708.   WriteLn('-[DEBUG]||[STARTING]- ***Report***');
  709.   WriteLn('');
  710.   WriteLn('');
  711.   WriteLn('');
  712.   SendStats();
  713.   WriteLn('[REPORT]');
  714.   WriteLn('[-------------------------------------------]');
  715.   WriteLn('[           Shilo''s Vag Came Lite           ]');
  716.   WriteLn('[      Shilo''s [V]illage [A]mazing [G]em    ]');
  717.   WriteLn('[       [C]rafter [A]nd [M]iner [E]xtreme   ]');
  718.   WriteLn('[              by Kyle Undefined            ]');
  719.   WriteLn('[-------------------------------------------]');
  720.   WriteLn('[                                           ]');
  721.   WriteLn(PadR('[      Time Ran : ' + MsToTime(GetTimeRunning, TIME_ABBREV), 44) + ']');
  722.   WriteLn(PadR('[      Loads Done : ' + IntToStr(ReportVars.LoadsDone), 44) + ']');
  723.   WriteLn('[-------------------------------------------]');
  724.   WriteLn(PadR('[      Mining XP Gained : ' + IntToStr(ReportVars.MiningXP), 44) + ']');
  725.   WriteLn(PadR('[      Crafting XP Gained : ' + IntToStr(ReportVars.CraftingXP), 44) + ']');
  726.   WriteLn(PadR('[      Gems Mined : ' + IntToStr(ReportVars.GemsMined), 44) + ']');
  727.   WriteLn(PadR('[      Gems Cut : ' + IntToStr(ReportVars.GemsCut), 44) + ']');
  728.   WriteLn(PadR('[      Gems Crushed : ' + IntToStr(ReportVars.GemsCrushed), 44) + ']');
  729.   WriteLn(PadR('[      Items Dropped : ' + IntToStr(ReportVars.ItemsDropped), 44) + ']');
  730.   WriteLn('[-------------------------------------------]');
  731.   WriteLn(PadR('[      Opals Mined : ' + IntToStr(ReportVars.OpalsMined), 44) + ']');
  732.   WriteLn(PadR('[      Opals Cut : ' + IntToStr(ReportVars.OpalsCut), 44) + ']');
  733.   WriteLn('[-------------------------------------------]');
  734.   WriteLn(PadR('[      Jades Mined : ' + IntToStr(ReportVars.JadesMined), 44) + ']');
  735.   WriteLn(PadR('[      Jades Cut : ' + IntToStr(ReportVars.JadesCut), 44) + ']');
  736.   WriteLn('[-------------------------------------------]');
  737.   WriteLn(PadR('[      Topaz Mined : ' + IntToStr(ReportVars.TopazMined), 44) + ']');
  738.   WriteLn(PadR('[      Topaz Cut : ' + IntToStr(ReportVars.TopazCut), 44) + ']');
  739.   WriteLn('[-------------------------------------------]');
  740.   WriteLn(PadR('[      Sapphires Mined : ' + IntToStr(ReportVars.SapphiresMined), 44) + ']');
  741.   WriteLn(PadR('[      Sapphires Cut : ' + IntToStr(ReportVars.SapphiresCut), 44) + ']');
  742.   WriteLn('[-------------------------------------------]');
  743.   WriteLn(PadR('[      Emeralds Mined : ' + IntToStr(ReportVars.EmeraldsMined), 44) + ']');
  744.   WriteLn(PadR('[      Emeralds Cut : ' + IntToStr(ReportVars.EmeraldsCut), 44) + ']');
  745.   WriteLn('[-------------------------------------------]');
  746.   WriteLn(PadR('[      Rubies Mined : ' + IntToStr(ReportVars.RubiesMined), 44) + ']');
  747.   WriteLn(PadR('[      Rubies Cut : ' + IntToStr(ReportVars.RubiesCut), 44) + ']');
  748.   WriteLn('[-------------------------------------------]');
  749.   WriteLn(PadR('[      Diamonds Mined : ' + IntToStr(ReportVars.DiamondsMined), 44) + ']');
  750.   WriteLn(PadR('[      Diamonds Cut : ' + IntToStr(ReportVars.DiamondsCut), 44) + ']');
  751.   WriteLn('[                                           ]');
  752.   WriteLn('[-------------------------------------------]');
  753.   WriteLn('[/REPORT]');
  754.   WriteLn('');
  755.   WriteLn('');
  756.   WriteLn('');
  757.   WriteLn('-[DEBUG]||[ENDING]- ***Report***');
  758. end;
  759.  
  760. procedure MainLoop();
  761. var
  762.   i {$IFDEF SMART}, a {$ENDIF} : Integer;
  763. begin
  764.   SetupScript();
  765.   SetupPlayer();
  766.   SetupGems();
  767.   AddOnTerminate('Report');
  768.   for i := 1 to Players[CurrentPlayer].Integers[0] do
  769.   begin
  770.     WriteLn('-[DEBUG]||[STARTING]- Load ' + IntToStr(i) + ' out of ' + IntToStr(Players[CurrentPlayer].Integers[0]));
  771.     MineRock();
  772.     CutGems();
  773.     DropGems();
  774.     WriteLn('-[DEBUG]||[ENDING]- Load ' + IntToStr(i));
  775.     Inc(ReportVars.LoadsDone);
  776.     Report();
  777.     {$IFDEF SMART}
  778.       SMART_ClearCanvas();
  779.       for a := (Integer(Players[CurrentPlayer].Booleans[0]) + 1) to 28 do
  780.         SMART_DrawBoxEx(False, InvBox(a), clYellow);
  781.     {$ENDIF}
  782.   end;
  783. end;
  784.  
  785. begin
  786.   MainLoop();
  787. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top