{$UNDEF SCRIPT_ID}{$DEFINE SCRIPT_ID := '89354d20-c87d-4706-98d6-6b4f0a65f5f5'} {$UNDEF SCRIPT_REVISION}{$DEFINE SCRIPT_REVISION := '10'} {$IFDEF WINDOWS}{$DEFINE SCRIPT_GUI}{$ENDIF} {$I SRL-B/osr.simba} {$I BashLib/osr.simba} {$I BashLib/optional/handlers/teleports/transport.simba} {$IFDEF SCRIPT_GUI} {$I BashLib/optional/handlers/bashgui.simba} {$ENDIF} { ---------------------------------------------------------------------------------- ~~~ Need Support? Contact Me ~~~ Website: https://bashscripts.shop/ Discord Server: https://discord.gg/qsmKs5uKfR Email: thebigaussie@proton.me Github: https://github.com/BigAussie/BASH ---------------------------------------------------------------------------------- } var REDNORTHTEAM: Boolean = False; BLUESOUTHTEAM: Boolean = False; METHODTOUSE: String = ''; NPCSELECTION: String = ''; POWERFLETCHING: Boolean = False; STOPATPOINTSLIMIT: Boolean = False; DiscordUID: String = ''; PINGONTERMINATED: Boolean = False; //BIRDHOUSEENABLED: Boolean = False; // One day maybe BHOPENNESTS: Boolean = False; begin Login.PlayerIndex := 0; end; type EState = ( STATE_ENTER_GAME, STATE_WAITING_FOR_GAME, STATE_DO_WOODCUTTING, STATE_FILL_BUCKETS, STATE_DO_FLETCHING, STATE_GET_TOOLS, STATE_ENDGAME, STATE_FILL_BARK_HOPPER, STATE_FILL_WATER_HOPPER, STATE_LEAVE_UPPER_HOUSE, STATE_ENTER_UPPER_HOUSE, STATE_UNKNOWN ); ELocation = ( NORTHHOUSE, SOUTHHOUSE, INLOBBYBOX, INGAMEBOX, NORTHHOUSEUPPER, SOUTHHOUSEUPPER, OUTSIDEOFLOBBY ); TroubleBrewing = record (TBaseBankScript) CurrentState: EState; StartXP, TotalPiecesOfEight, TimeRemaining, TotalScrapeyLogs, CurrentXP, TotalPOEEarned, TotalWaterDeposited, BucketPointsLimit: Integer; TeamDetermined: Boolean; DisplayName: String; Slot: Int32; MyFullPos: TRSPosition; Timer: TStopWatch; LobbyWaitTimer: TStopWatch; LobbyWaitTimeout: Int32; TreeFilteredCoords: TPointArray; ScrappyTree, WorkBench, CopperLadderSouth, CopperLadderNorth, CopperLadderSouthUpper, CopperLadderNorthUpper, ScrapyBarkHopperSouth, ScrapyBarkHopperNorth, WaterPump, WaterHopperSouth, WaterHopperNorth: TRSObjectV2; HonestJimmy, FancyDan, SanFan, TeamNPC: TRSNPCV2; ScrapeyBark: TRSItem; ValidAxes: TRSItemArray; BambooPipeBox, BridgeSectionBox, BucketBox, AxeBox, LumberPatchBox: TBox; TorchBox, BowlBox, TinderboxBox, MeatBox, KnifeBox: TBox; end; var Timer: TStopWatch; Script: TroubleBrewing; InGameTimer: TStopWatch; procedure OnBreakStart(Task: PBreakTask); begin InGameTimer.Pause(); end; procedure OnBreakFinish(Task: PBreakTask); begin InGameTimer.Resume(); end; procedure OnSleepStart(Task: PSleepTask); begin InGameTimer.Pause(); end; procedure OnSleepFinish(Task: PSleepTask); begin InGameTimer.Resume(); end; procedure TAntiban.BioClick(button: Int32; max: Int32 = 3); override; begin Mouse.Click(button); Exit; end; function TWebGraphV2.FindObjectPath(me: TPoint; out p: TPoint): TPointArray; override; var i: Int32; cluster, best: TPointArray; begin for i := 0 to High(Self.WalkableClusters) do if Self.WalkableClusters[i].Contains(me) then cluster := Self.WalkableClusters[i]; if cluster = [] then Exit; best := Self.FindNearestNodesEx(p, 12); for i := 0 to High(best) do if cluster.Contains(best[i]) then begin p := best[i]; try Result := Self.PathBetweenEx(me, best[i], 0.2, 2); except TerminateScript(SRL.TimeStamp() + ':[WebGraph]:[Fatal]: Can''t find a walkable path to ' + p.ToString() + ' object.'); end; Break; end; end; function TWebGraphV2.PathBetween(p, q: TPoint; rnd: Double = 0): TPointArray; override; var n1, n2: Int32; nodes: TIntegerArray; begin if p.InRange(q, 4) then Exit([p, q]); n1 := Self.FindNearestNode(p); n2 := Self.FindNearestNode(q); nodes := Self.FindPath(n1, n2, rnd); Result += p; Result += NodesToPoints(nodes); Result += q; if Length(nodes) = 0 then Exit; end; function TWebGraphV2.PathBetweenEx(p, q: TPoint; rnd: Double = 0; attempts: Int32 = 3; safe: Boolean = True): TPointArray; override; var i, j: Int32; nS, nG, nodes: TIntegerArray; changed: Boolean; begin if not Self.WalkableSpace.Contains(p) or not Self.WalkableSpace.Contains(q) then begin p := RSTranslator.NormalizeDoor(p); q := RSTranslator.NormalizeDoor(q); changed := True; end; if changed then begin if not Self.WalkableSpace.Contains(p) then p := Self.NearestWalkablePoint(p); if not Self.WalkableSpace.Contains(q) then q := Self.NearestWalkablePoint(q); end; nS := Self.FindNearestNodes(p, attempts); nG := Self.FindNearestNodes(q, attempts); if nS[0] = nG[0] then Exit([p, q]); if (Length(nG) = 1) and (Length(Self.Paths[nG[0]]) = 0) then Exit; attempts -= 1; for i := 0 to High(nS) do for j := 0 to High(nG) do begin if nS[i] = nG[j] then Continue; nodes := Self.FindPath(nS[i],nG[j], rnd); if Length(nodes) > 0 then Break(2); end; if safe and (Length(nodes) = 0) then Exit; Result += p; Result += Self.NodesToPoints(nodes); Result += q; if Length(nodes) = 0 then Exit; end; function TRSMapObject.WalkHover(attempts: Int32 = 2): Boolean; override; var p, me: TPoint; path: TPointArray; same: Boolean; begin if ChooseOption.IsOpen() then begin if Self.Filter.UpText and ChooseOption.HasOption(Self.Name) then Exit(True); ChooseOption.Close(); end; if not Self.Filter.Walker then Exit; if Self.Walker = nil then TerminateScript(SRL.TimeStamp() + ':[TRSMapObject]:[Fatal]: "' + Self.Name + '" has no walker pointer set.'); if Self.Filter.UpText then Self.Walker^.TargetUpText := [Self.Name]; me := Self.Walker^.Position(); p := Self.Walker^.GetClosestPointEx(me, Self.Coordinates, path); //if the point is not reachable with the webgraph (like a banker behind a booth) then pick nearest node as target if path = [] then begin path := Self.Walker^.WebGraph^.FindObjectPath(me, p); if path = [] then Exit; same := True; end; // check if doors need to be passed to reach target if same or Self.Walker^.WebGraph^.WalkableClusters.InSameTPA(me, p) then begin if not Self.Walker^.MakePointVisible(p) and not Self.Walker^.WebWalkEx(me, p, 30, 0.15) then Exit; end else if not Self.Walker^.WebWalk(p, 30, 0.15) then Exit; Result := Self._WalkHoverHelper(attempts, Self.TrackTarget); end; function TRSMapObject._WalkHoverHelper(attempts: Int32; trackTarget: Boolean): Boolean; override; var shouldExit: Boolean; attempt: Int32; atpa: T2DPointArray; tpa, path: TPointArray; me, closest: TPoint; same: Boolean; begin if not Self.Filter.Walker then Exit(Self._HoverHelper(attempts, trackTarget)); Result := Self._WalkUpTextCheck(shouldExit); if shouldExit then Exit; for attempt := 0 to attempts do begin if Self.Find(atpa) then begin if attempt < 2 then tpa := atpa[0] else if Length(atpa) > (attempt - 2) then tpa := atpa[attempt - 2] else tpa := atpa.RandomValue(); if trackTarget then Mouse.OnMovingEx := @Self._UpdateTarget; Mouse.Move(tpa.RandomValue()); if not Self.Filter.UpText then Exit(True); end; if MainScreen.IsUpText(Self.Name) then Exit(True); me := Self.Walker^.Position(); closest := Self.Walker^.GetClosestPointEx(me, Self.Coordinates, path); if path = [] then begin path := Self.Walker^.WebGraph^.FindObjectPath(me, closest); if path = [] then Exit; same := True; end; if not Self.Walker^.InRangeEx(me, closest, 50) then begin Self.Walker^.WebWalkEx(me, closest, 30, 0.15); Continue; end; if attempt = (attempts - 1) then begin if not Self.Walker^.InRangeEx(me, closest, 25) then begin Self.Walker^.WebWalkEx(me, closest, 25, 0.15); Continue; end; Minimap.SetCompassAngle(Minimap.GetCompassAngle(), 50); end; end; end; {// CJ BIRDHOUSE ON START function TBirdHouseInclude.OnStart() : Boolean; override; var i : Int32; bankTimeout : TCountdown; begin ScriptWalker := @Script.RSW; if Self.AlwaysUseBestLog then begin Self.SuggestedLogType := BirdhouseRunner.GetLogForHunterLevel(Stats.GetLevel(ERSSkill.HUNTER)); if Self.LogType <> Self.SuggestedLogType then Self.LogType := Self.SuggestedLogType; end; bankTimeout.Init(60000); while not bankTimeout.IsFinished() and not Bank.IsOpen() do begin writeln('Attempting to open bank'); Banks.WalkOpen(); end; if not Bank.IsOpen() then begin Self.DebugLn("Failed to get to bank"); Exit(false); end; if Inventory.CountEmptySlots() < 28 then begin Bank.DepositAll(); WaitUntil(Inventory.CountEmptySlots() = 28, 150, 2000); end; if not Self.WithdrawNextRun() then begin writeln('Failed to get birdhouse run items from bank, disabling birdhouse runs.'); BirdhouseRunner.IsDisabled := true; Bank.DepositAll(); Exit(false); end; Bank.Close(); Options.SetNPCAttackOption(ERSAttackOption.HIDDEN); wait(500, 750); Options.SetZoomLevel(Random(10)); Result := true; end; procedure TBirdHouseInclude.OnComplete(); override; var transporter: TUniversalTransport; i : Int32; timeout : TCountDown; MyPos: TPoint; bankTimeout : TCountdown; Nests: TRSItemArray; begin Nests := ['5070', '5071', '5072', '5073', '5074']; ScriptWalker := @Script.RSW; if not transporter.Run(RSTeleports.MINIGAME_TROUBLE_BREWING) then begin Writeln('Teleporter could not get back'); TerminateScript(); Exit; end; wait(14000, 16000); // Replace with a real wait function if BHOPENNESTS then begin while Inventory.ContainsAny(Nests) do begin for i := 0 to High(Nests) do begin if Inventory.ContainsItem(Nests[i]) then begin writeln('Searching birds nests'); Wait(100, 200); Inventory.ClickItem(Nests[i]); if Inventory.IsFull() then Exit; end; end; end; end; bankTimeout.Init(60000); while not bankTimeout.IsFinished() and not Bank.IsOpen() do begin writeln('Attempting to open bank'); Banks.WalkOpen(); end; if bankTimeout.IsFinished() and not Bank.IsOpen() then begin TerminateScript("Failed to open the bank after birdrun."); end; Bank.DepositAll(); WaitUntil(not Inventory.IsFull(), 315, 5000); if not Bank.Close() then TerminateScript("Failed to close the bank after birdrun."); WaitUntil(not Bank.IsOpen(), 65, 5000); end;} procedure TroubleBrewing.SendWebhook(msg: String; FilePath: String = ''); var HTTP: Int32; Response, Payload: String; begin if WEBHOOKURL = "" then Exit; if DiscordUID <> '' then msg := '<@' + DiscordUID + '> ' + msg; // First attempt with JSON payload Payload := '{"content": "' + msg + '"}'; HTTP := InitializeHTTPClient(False); try SetHTTPHeader(HTTP, 'Content-Type', 'application/json'); Response := PostHTTPPage(HTTP, WEBHOOKURL, Payload); if Response = '' then WriteLn('Webhook successfully sent with JSON payload.') else WriteLn('Webhook sent with JSON payload. Response: ', Response); // Fallback to FORMS if JSON Fails - We had to fallback as some users had issues with JSON Thanks @Chandler for all the help testing this. if Pos('"code": 50006', Response) > 0 then begin FreeHTTPClient(HTTP); HTTP := InitializeHTTPClient(False); AddPostVariable(HTTP, 'content', msg); Response := PostHTTPPageEx(HTTP, WEBHOOKURL); if Response = '' then WriteLn('Webhook fallback successfully sent with form data after code 50006 error.') else WriteLn('Webhook fallback sent with form data after code 50006 error. Response: ', Response); end; finally FreeHTTPClient(HTTP); end; end; procedure TroubleBrewing.SendTerminationNotification(); begin Self.SendWebhook('Trouble Brewing for ' + DisplayName + ' has terminated or crashed.'); end; procedure TAntiban.Setup(); override; begin Antiban.Skills := [ERSSkill.TOTAL, ERSSKILL.FLETCHING]; Antiban.MinZoom := 10; Antiban.MaxZoom := 25; inherited; if OVERRIDEBREAKS then begin WriteLn('[ANTIBAN] Custom break override enabled:'); WriteLn(' - Break Interval: ', CUSTOMBREAKINTERVAL, ' minutes'); WriteLn(' - Break Duration: ', CUSTOMBREAKDURATION, ' minutes'); Self.Breaks := []; Self.AddBreak(CUSTOMBREAKINTERVAL * ONE_MINUTE, CUSTOMBREAKDURATION * ONE_MINUTE, 0.33, 0.15); WriteLn('[ANTIBAN] Custom breaks initialized successfully'); end else WriteLn('[ANTIBAN] Using WaspLib break system'); end; // Remove stupid BioClick and > stuff function TRSInventory.ClickItem(item: TRSItem; option: String = ''): Boolean; override; var upText: String; begin if Self.MouseItem(item) then begin upText := MainScreen.GetUpText(); if (option = '') or upText.Contains(option) then begin Mouse.Click(MOUSE_LEFT); Exit(True); end; Result := ChooseOption.Select(option) end; end; // more stupid bioclick removal function TRSInventory.ClickSlot(slot: Int32; options: TStringArray): Boolean; override; var upText: String; begin if Self.MouseSlot(slot) then begin upText := MainScreen.GetUpText(); if not options.Contains('>') and upText.Contains('>') then begin ChooseOption.Select('Cancel'); Exit; end; Result := ChooseOption.Select(options); end; end; procedure TRSXPBarSetup.Fix(); override; // Remove XPBarfix because it bugs with endgame interface. begin Exit; end; function TRSXPBarSetup.Open(): Boolean; override; // Remove XPBarfix because it bugs with endgame interface. begin Exit(True); end; // Thank you flight for this TakeScreenshot procedure procedure TroubleBrewing.TakeScreenshot(Name: String); var i: Int32; begin CreateDirectory('Screenshots/'); i := Length(GetFiles('Screenshots/', 'png')); SaveScreenshot('Screenshots/TroubleBrewing_' + Name + '_' + IntToStr(i) + '.png'); end; // full Credits to SkunkBUILDAGUIworks & Student for helping with this so we can see the portals. procedure TRSMinimap.RotateWithinAngles(min, max: Int32); var minMaxAvg: Int32 := Floor((min + max) div 2); preferredAngle: Int32 := SRL.SkewedRand(minMaxAvg, min, max); begin if preferredAngle < 0 then preferredAngle := preferredAngle + 360; if InRange(self.getCompassAngle(True), min, max) then Exit; //tztok Aussie fat cok Minimap.SetCompassAngle(preferredAngle); end; function TroubleBrewing.DetermineTeam(): Boolean; begin MyFullPos := Map.FullPosition; if MyFullPos.InBox([11116, 38354, 11152, 38390]) then begin writeln('North Team Setup'); REDNORTHTEAM := True; BLUESOUTHTEAM := False; end else if MyFullPos.InBox([11156, 38354, 11192, 38390]) then begin writeln('South Team Setup'); REDNORTHTEAM := False; BLUESOUTHTEAM := True; end else if MyFullPos.InBox([11012, 38402, 11260, 38522]) then begin writeln('North Team Setup'); REDNORTHTEAM := True; BLUESOUTHTEAM := False; end else if MyFullPos.InBox([11008, 38534, 11260, 38654]) then begin writeln('South Team Setup'); REDNORTHTEAM := False; BLUESOUTHTEAM := True; end; Self.SetupObjects(); Exit(True); end; procedure TroubleBrewing.CheckGameChatActive(); var ActiveButton: ERSChatButton; begin ActiveButton := ChatButtons.GetActive(); if ActiveButton <> ERSChatButton.GAME_CHAT then begin WriteLn('Game Chat is not active. Activating Game Chat...'); ChatButtons.Open(ERSChatButton.GAME_CHAT); end end; procedure TroubleBrewing.SetupObjects(); begin writeln('Setting up objects'); ScrappyTree := Objects.Get('Scrapey Tree'); WorkBench := Objects.Get(15934); with CopperLadderSouth do begin CopperLadderSouth := Objects.Get(15896); Finder.Colors := [CTS2(1004400, 17, 0.07, 1.42)]; Finder.Grow := 8; end; with CopperLadderNorth do begin CopperLadderNorth := Objects.Get(15899); Finder.Colors := [CTS2(1004400, 17, 0.07, 1.42)]; //Finder.ClusterDistance := 1; Finder.Grow := 8; end; with CopperLadderSouthUpper do begin CopperLadderSouthUpper := Objects.Get(15898); Finder.Colors := [CTS2(1004400, 17, 0.07, 1.42)]; Finder.Grow := 8; end; with CopperLadderNorthUpper do begin CopperLadderNorthUpper := Objects.Get(15901); Finder.Grow := 8; end; with ScrapyBarkHopperSouth do begin ScrapyBarkHopperSouth := Objects.Get(15873); Finder.Colors := [CTS2(2382456, 7, 0.02, 0.34)]; Finder.Grow := 4; end; with ScrapyBarkHopperNorth do begin ScrapyBarkHopperNorth := Objects.Get(15847); Finder.Colors := [CTS2(2382456, 7, 0.02, 0.34)]; Finder.Grow := 4; end; with WaterPump do begin WaterPump := Objects.Get(15936); Finder.Grow := 4; end; with WaterHopperSouth do begin WaterHopperSouth := Objects.Get(15873); Finder.Grow := 8; end; with WaterHopperNorth do begin WaterHopperNorth := Objects.Get(15847); Finder.Grow := 8; end; HonestJimmy := Npcs.Get('Honest Jimmy'); FancyDan := Npcs.Get('Fancy Dan'); SanFan := Npcs.Get('San Fan'); if NPCSELECTION = 'Red' then TeamNPC := FancyDan else if NPCSELECTION = 'Blue' then TeamNPC := SanFan else TeamNPC := HonestJimmy; if REDNORTHTEAM then begin writeln('Setting up for North/Red team.'); TreeFilteredCoords := [[11060, 38426], [11056, 38466]]; with ScrapyBarkHopperNorth do begin Coordinates := [[37268, 38418]]; Rotations := [0]; end; with CopperLadderNorth do begin Finder.Colors := [CTS2(2712452, 6, 0.06, 0.27)]; Finder.Grow := 4; end; with WaterPump do begin Coordinates := [[11128, 38442]]; Rotations := [0]; end; with WaterHopperNorth do begin Coordinates := [[37260, 38430]]; Rotations := [0]; end; end else if BLUESOUTHTEAM then begin writeln('Setting up for South/blue team'); TreeFilteredCoords := [[11084, 38642], [11044, 38606]]; with ScrapyBarkHopperSouth do begin Coordinates := [[37296, 38638]]; Rotations := [0]; end; with WaterPump do begin Coordinates := [[11132, 38614]]; Rotations := [0]; end; with WaterHopperSouth do begin Coordinates := [[37304, 38626]]; Rotations := [0]; end; end; with ScrappyTree do begin Finder.Colors := [CTS2(4948021, 1, 0.01, 0.01)]; SetupCoordinates(TreeFilteredCoords); Rotations := [0, 0]; end; end; procedure TroubleBrewing.DefineItemBoxes(); var BambooPipeCenter, BridgeSectionCenter, BucketCenter, AxeCenter, LumberPatchCenter: TPoint; TorchCenter, BowlCenter, TinderboxCenter, MeatCenter, KnifeCenter: TPoint; begin // Center cordinates for each item.. boom BambooPipeCenter := [91, 134]; BridgeSectionCenter := [178, 134]; BucketCenter := [263, 135]; AxeCenter := [348, 134]; LumberPatchCenter := [435, 135]; TorchCenter := [92, 236]; BowlCenter := [175, 235]; TinderboxCenter := [258, 236]; MeatCenter := [341, 235]; KnifeCenter := [428, 236]; // Define the boxes using the center coordinates and then make a box... BambooPipeBox := Box(BambooPipeCenter, 15, 15); BridgeSectionBox := Box(BridgeSectionCenter, 15, 15); BucketBox := Box(BucketCenter, 15, 15); AxeBox := Box(AxeCenter, 15, 15); LumberPatchBox := Box(LumberPatchCenter, 15, 15); TorchBox := Box(TorchCenter, 15, 15); BowlBox := Box(BowlCenter, 15, 15); TinderboxBox := Box(TinderboxCenter, 15, 15); MeatBox := Box(MeatCenter, 15, 15); KnifeBox := Box(KnifeCenter, 15, 15); end; // We could not use tor's interface open so this just searches for the close button on the screen. function TroubleBrewing.IsInterfaceOpen(): Boolean; var CloseButtonBox: TBox; begin CloseButtonBox := [460, 13, 484, 36]; Result := SRL.CountColor(39167, CloseButtonBox) > 80; end; procedure TroubleBrewing.CloseInterface(); var CloseButtonBox: TBox; begin CloseButtonBox := [460, 13, 484, 36]; if IsInterfaceOpen() then begin Mouse.Move(CloseButtonBox); if Mainscreen.IsUpText('Close') then Mouse.Click(MOUSE_LEFT); end; end; // Thank you king Rubix I mean CJ (BUY TEMPOROSS) For BruteForce and OCR help <3 function TroubleBrewing.IsEndGameInterfaceOpen(): Boolean; var EndGameCloseButtonBox: TBox; begin EndGameCloseButtonBox := [487, 9, 510, 31]; Result := SRL.CountColor(39167, EndGameCloseButtonBox) > 80; end; procedure TroubleBrewing.CloseEndGameInterface(); var EndGameCloseButtonBox: TBox; POEBox: TBox; POEEarnedText: String; POEEarned: Integer; ocrFilter: TOCRColorFilter; begin Self.TeamDetermined := False; Self.TotalWaterDeposited := 0; Self.BucketPointsLimit := 0; writeln('Resetting team determined'); POEBox := [314, 169, 337, 181]; ocrFilter := TOCRColorFilter.Create([537395], [1]); POEEarnedText := OCR.Recognize(POEBox, ocrFilter, RS_FONT_QUILL_8); POEEarned := StrToIntDef(POEEarnedText, 0); TotalPOEEarned := TotalPOEEarned + POEEarned; Writeln('Added POE: ' + POEEarnedText); EndGameCloseButtonBox := [487, 9, 510, 31]; if IsEndGameInterfaceOpen() then begin Mouse.Move(EndGameCloseButtonBox); if Mainscreen.IsUpText('Close') then Mouse.Click(MOUSE_LEFT); end; WL.Activity.Restart(); Self.DoAntiban(); WaitUntil(not IsEndGameInterfaceOpen(), 65, 10000); end; procedure TroubleBrewing.DO_ENDGAME(); begin if IsEndGameInterfaceOpen() then CloseEndGameInterface(); end; procedure TroubleBrewing.GET_TOOLS(); var i: Integer; begin writeln('Grabbing tools'); WorkBench.WalkSelectOption(['Take-Tool']); Minimap.WaitPlayerMoving; WaitUntil(IsInterfaceOpen, 65, 5000); if METHODTOUSE = 'Scrapy Bark' then begin if not IsInterfaceOpen() then Exit; Mouse.Move(KnifeBox); if Mainscreen.IsUpText('Knife') then Mouse.Click(MOUSE_LEFT); WaitUntil(Inventory.ContainsItem('Knife'), 65, 2000); if IsInterfaceOpen() then CloseInterface(); if (Inventory.FindItem('Knife', Slot)) and (Slot < 27) then if not Inventory.Drag(Slot, 27) then Exit; end else if METHODTOUSE = 'Buckets' then begin if not IsInterfaceOpen() then Exit; for i := 1 to 5 do begin Mouse.Move(BucketBox); if Mainscreen.IsUpText('Bucket') then begin Mouse.Click(MOUSE_RIGHT); ChooseOption.Select('Take-5'); Wait(250, 300); end; end; end; end; procedure TroubleBrewing.DO_ENTER_GAME(); var attempts: Integer; begin attempts := 0; while (Self.GetLocation() <> INLOBBYBOX) and (Self.GetLocation() = OUTSIDEOFLOBBY) do begin if IsEndGameInterfaceOpen() then CloseEndGameInterface(); if Inventory.ContainsItem('Brewin'' Guide') then begin writeln('Got book by accident, dropping it.'); Inventory.ShiftDrop(['Brewin'' Guide'], DROP_PATTERN_SNAKE); WaitUntil(not Inventory.ContainsItem('Brewin'' Guide'), 65, 4000); end; if Minimap.GetHPPercent() < 25 then begin writeln('LowHP Trying to join game, Probably being attacked. Attempting to run away.'); Map.Walker.WebWalk([11156, 38346]); HonestJimmy.WalkSelectOption(['Join-Team']); Continue; end; if attempts >= 30 then begin writeln('Failed to join team after 30 attempts, Joining random team.'); Map.Walker.WebWalk([11156, 38346]); HonestJimmy.WalkSelectOption(['Join-Team']); Exit; end; writeln('Attempting to join team'); TeamNPC.WalkSelectOption(['Join-Crew', 'Join-Team']); Minimap.WaitPlayerMoving; WaitUntil(Self.GetLocation() = INLOBBYBOX, 65, 1600); if Self.GetLocation() = INLOBBYBOX then Exit; Inc(attempts); if attempts mod 10 = 0 then begin Antiban.RandomRotate(); WL.Activity.Restart(); end; end; end; procedure TroubleBrewing.GET_TIME_REMAINING(); var i: Integer; TimeRemainingBox: TBox; begin // Define the boxe for our time remaining TimeRemainingBox := [372, 310, 478, 330]; // Use OCR to read remaining time in box // This works. TimeRemaining := OCR.RecognizeNumber(TimeRemainingBox, TOCRShadowFilter.Create(20), RS_FONT_PLAIN_12); end; procedure TroubleBrewing.DO_WAITING_FOR_GAME(); var AntibanTimer: TStopWatch; AntibanInterval: Int32; begin if Self.LobbyWaitTimeout = 0 then begin Self.LobbyWaitTimeout := Random(8 * ONE_MINUTE, 10 * ONE_MINUTE); Self.LobbyWaitTimer.Start(); writeln('Waiting for game. Will terminate if none starts within ' + SRL.MsToTime(Self.LobbyWaitTimeout, Time_Short) + '.'); end else if Self.LobbyWaitTimer.ElapsedTime >= Self.LobbyWaitTimeout then begin writeln('No game found after waiting in lobby for ' + SRL.MsToTime(Self.LobbyWaitTimer.ElapsedTime, Time_Short) + '. Terminating.'); TerminateScript(); end; if not Self.TeamDetermined then begin writeln('Detecting what team we are on.'); Self.DetermineTeam(); Self.TeamDetermined := True; end; WL.Activity.Restart(); AntibanTimer.Start(); AntibanInterval := Random(180000, 240000); if Chat.IsOpen() then Chat.ClickOption('Arr!', True); if AntibanTimer.ElapsedTime >= AntibanInterval then begin Antiban.doantiban(False, False); AntibanTimer.Reset(); end; end; procedure TroubleBrewing.DO_WOODCUTTING(); var XP: Integer; T: TStopWatch; WoodcuttingDuration: Int32; ItemsToKeep: TRSItemArray; UnwantedItemSlots: TIntegerArray; i: Integer; RandomX, RandomY: Integer; begin if IsEndGameInterfaceOpen() then CloseEndGameInterface(); XP := XPBar.Read(); if not Inventory.IsFull() then begin if Self.GetLocation() = INGAMEBOX then begin if BLUESOUTHTEAM then if not ScrappyTree.IsVisible() then begin writeln('Tree not visible'); Minimap.RotateWithinAngles(285, 345); RandomX := 11068 + RandomRange(-25, 25); RandomY := 38622 + RandomRange(-25, 25); Map.Walker.WebWalk([RandomX, RandomY]); end; if IsInterfaceOpen() or IsEndGameInterfaceOpen() then Exit; ScrappyTree.WalkClick(); Minimap.EnableSpec(100); end else begin writeln('We are not in the game anymore?'); // Rare issue if we were kicked or something. Exit; end; end; WoodcuttingDuration := RandomRange(250, 300); T.Start(); while (T.ElapsedTime < WoodcuttingDuration) and not Inventory.IsFull() do begin if IsEndGameInterfaceOpen() then CloseEndGameInterface(); if XPBar.Read() > XP then begin WL.Activity.Restart(); XP := XPBar.Read(); T.Start(); end; if SRL.PercentShift(MainScreen.GetPlayerBox(), 325) > 8 then T.Start(); Wait(100); end; // Check for unwanted items and drop them, mainly for tree if we misclick ItemsToKeep := ['Knife', 'Scrapey bark', 'Scrapey tree logs']; UnwantedItemSlots := Inventory.FindRandomItems(ItemsToKeep); begin writeln('Found unwanted items, dropping them.'); Inventory.ShiftDrop(UnwantedItemSlots, DROP_PATTERN_SNAKE); Wait(100, 200); end; end; procedure TroubleBrewing.DO_FLETCHING(); var KnifeSlot, LogSlots: TIntegerArray; begin if (Inventory.FindItem('Knife', Slot)) and (Slot < 27) then if not Inventory.Drag(Slot, 27) then Exit; if Inventory.IsFull then begin TotalScrapeyLogs += Inventory.CountItem('Scrapey tree logs'); if IsEndGameInterfaceOpen() then CloseEndGameInterface(); XpBar.Read(); while Inventory.FindItem('Scrapey tree logs', LogSlots) and (Length(LogSlots) > 1) do begin Inventory.SetSelectedItem('Knife'); Wait(100, 140); if Inventory.FindItem('Scrapey tree logs', LogSlots) then begin Mouse.Move(Inventory.GetSlotBox(LogSlots[High(LogSlots)])); Mouse.Click(MOUSE_LEFT); Wait(100, 140); end; end; if Inventory.ContainsItem('Scrapey bark') and POWERFLETCHING then begin while Inventory.ContainsItem('Scrapey bark') do Inventory.ShiftDrop(['Scrapey bark'], DROP_PATTERN_SNAKE); end; end; Mouse.RandomMovement(); if Inventory.FindItem('Scrapey tree logs', LogSlots) then begin Inventory.SetSelectedItem('Knife'); Wait(100, 140); Mouse.Move(Inventory.GetSlotBox(LogSlots[High(LogSlots)])); Mouse.Click(MOUSE_LEFT); Wait(100, 140); writeln('Extra log failsafe.'); end; end; procedure TroubleBrewing.DO_FILL_BUCKETS(); var BucketSlot: Integer; PumpCoords: T2DPointArray; begin // Walk to the tile next to the water pump if BLUESOUTHTEAM then Map.Walker.WalkBlind([11136, 38614]) else Map.Walker.WalkBlind([11128, 38442]); Minimap.WaitPlayerMoving; if Inventory.FindItem('Bucket', BucketSlot) then begin Inventory.SetSelectedSlot(BucketSlot); WL.Activity.Restart(); if WaterPump.Find(PumpCoords) then begin Mouse.Move(PumpCoords[0]); Mouse.Click(MOUSE_RIGHT); ChooseOption.Select('Pump'); WaitUntil(not Inventory.ContainsItem('Bucket'), 65, 20000); // 20 Second wait, increase if we need? end; end; end; procedure TroubleBrewing.DO_ENTER_UPPER_HOUSE(); var attempts: Integer; begin if IsInterfaceOpen() or IsEndGameInterfaceOpen() then Exit; attempts := 0; if MyFullPos.InBox([11008, 38538, 11248, 38654]) then begin writeln('Walking to South House'); while (attempts < 4) and (Self.GetLocation() <> SOUTHHOUSEUPPER) do begin if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; if (attempts = 3) and (Self.GetLocation() <> SOUTHHOUSEUPPER) then begin if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; writeln('Rotating camera to find South House ladder'); Minimap.RotateWithinAngles(205, 318); end; CopperLadderSouth.WalkClick(); WaitUntil(Self.GetLocation() = SOUTHHOUSEUPPER, 65, 3000); Inc(attempts); end; end else if MyFullPos.InBox([11008, 38406, 11248, 38530]) then begin writeln('Walking to North House'); while (attempts < 4) and (Self.GetLocation() <> NORTHHOUSEUPPER) do begin if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; if (attempts = 3) and (Self.GetLocation() <> NORTHHOUSEUPPER) then begin if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; writeln('Rotating camera to find North House ladder'); Minimap.RotateWithinAngles(37, 135); end; CopperLadderNorth.WalkClick(); WaitUntil(Self.GetLocation() = NORTHHOUSEUPPER, 65, 3000); Inc(attempts); end; end; end; procedure TroubleBrewing.DO_FILL_BARK_HOPPER(); var HopperCoords: T2DPointArray; BarkSlots: TIntegerArray; BarkDeposited: Integer; attempt: Integer; currentMessage: String; begin if (Self.GetLocation() = NORTHHOUSEUPPER) then begin Map.Walker.WalkBlind([37268, 38414]); Minimap.WaitPlayerMoving; end else if (Self.GetLocation() = SOUTHHOUSEUPPER) then begin Map.Walker.WalkBlind([37296, 38642]); Minimap.WaitPlayerMoving; end else Exit; BarkDeposited := Inventory.CountItem(ScrapeyBark); attempt := 0; while Inventory.FindItem(ScrapeyBark, BarkSlots) and (Length(BarkSlots) > 1) and (attempt < 30) do begin if IsEndGameInterfaceOpen() then Exit; if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; currentMessage := Chat.GetMessage(CHAT_INPUT_LINE - 1, [CHAT_COLOR_BLACK]); if ('own team' in currentMessage) then begin writeln('Error: Wrong team setup. Terminating script.'); TerminateScript(); Exit; end; if ('fire' in currentMessage) or ('nothing' in currentMessage) then begin writeln('Hopper is on fire or broken sad face, We just gonna wait a bit.'); Timer.Start(); while Timer.ElapsedTime < Random(60000, 120000) do begin Wait(1000); if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; end; end if (Self.GetLocation() = SOUTHHOUSEUPPER) then begin if ScrapyBarkHopperSouth.Find(HopperCoords) then begin Inventory.SetSelectedSlot(BarkSlots[High(BarkSlots)]); WL.Activity.Restart(); Mouse.Move(HopperCoords[0]); if Mainscreen.IsUpText('Hopper') then Mouse.Click(MOUSE_LEFT); end; end else if (Self.GetLocation() = NORTHHOUSEUPPER) then begin if ScrapyBarkHopperNorth.Find(HopperCoords) then begin Inventory.SetSelectedSlot(BarkSlots[High(BarkSlots)]); WL.Activity.Restart(); Mouse.Move(HopperCoords[0]); if Mainscreen.IsUpText('Hopper') then Mouse.Click(MOUSE_LEFT); end; end; Wait(250, 300); Inc(attempt); end; if Inventory.FindItem('Scrapey bark', BarkSlots) then begin writeln('Extra bark failsafe.'); if (Self.GetLocation() = SOUTHHOUSEUPPER) then begin if ScrapyBarkHopperSouth.Find(HopperCoords) then begin Inventory.SetSelectedSlot(BarkSlots[High(BarkSlots)]); Mouse.Move(HopperCoords[0]); if Mainscreen.IsUpText('Hopper') then Mouse.Click(MOUSE_LEFT); end; end else if (Self.GetLocation() = NORTHHOUSEUPPER) then begin if ScrapyBarkHopperNorth.Find(HopperCoords) then begin Inventory.SetSelectedSlot(BarkSlots[High(BarkSlots)]); Mouse.Move(HopperCoords[0]); if Mainscreen.IsUpText('Hopper') then Mouse.Click(MOUSE_LEFT); end; end else Exit; end; end; procedure TroubleBrewing.AFKUntilGameEnd(); var AntibanTimer: TStopWatch; AntibanInterval: Int32; begin writeln('AFK until the game ends.'); AntibanTimer.Start(); AntibanInterval := Random(60000, 120000); WL.Activity.Restart(); while (Self.GetLocation() = NORTHHOUSEUPPER) or (Self.GetLocation() = SOUTHHOUSEUPPER) do begin if IsEndGameInterfaceOpen() then Exit; if AntibanTimer.ElapsedTime >= AntibanInterval then begin Antiban.RandomRotate(); Antiban.doantiban(False, False); WL.Activity.Restart(); Self.Report(); AntibanTimer.Reset(); AntibanInterval := Random(60000, 120000); end; Wait(1000); end; end; function TroubleBrewing.HasReachedBucketLimit(): Boolean; begin Result := STOPATPOINTSLIMIT and (Self.BucketPointsLimit > 0) and (Self.TotalWaterDeposited >= Self.BucketPointsLimit); end; procedure TroubleBrewing.DO_FILL_WATER_HOPPER(); var HopperCoords: T2DPointArray; WaterSlots: TIntegerArray; WaterDeposited: Integer; attempt: Integer; begin if STOPATPOINTSLIMIT and (Self.BucketPointsLimit = 0) then begin Self.BucketPointsLimit := Random(100, 120); writeln('Bucket points limit this game: ' + IntToStr(Self.BucketPointsLimit)); end; if Self.HasReachedBucketLimit() then begin Self.AFKUntilGameEnd(); Exit; end; if (Self.GetLocation() = NORTHHOUSEUPPER) then begin Map.Walker.WalkBlind([37260, 38434]); Minimap.WaitPlayerMoving; end else if (Self.GetLocation() = SOUTHHOUSEUPPER) then begin Map.Walker.WalkBlind([37304, 38622]); Minimap.WaitPlayerMoving; end; WaterDeposited := Inventory.CountItem('Bucket of water'); attempt := 0; while Inventory.FindItem('Bucket of water', WaterSlots) do begin Inventory.SetSelectedSlot(WaterSlots[High(WaterSlots)]); if (Self.GetLocation() = SOUTHHOUSEUPPER) then begin if WaterHopperSouth.Find(HopperCoords) then begin Mouse.Move(HopperCoords[0]); Mouse.Click(MOUSE_RIGHT); ChooseOption.Select('Hopper'); end; end else if (Self.GetLocation() = NORTHHOUSEUPPER) then begin if WaterHopperNorth.Find(HopperCoords) then begin Mouse.Move(HopperCoords[0]); Mouse.Click(MOUSE_RIGHT); ChooseOption.Select('Hopper'); if Antiban.BioDice() then Antiban.LoseFocus(); end; end else Exit; WaitUntil(not Inventory.ContainsItem('Bucket of water'), 65, 40000); Inc(attempt); end; Self.TotalWaterDeposited += WaterDeposited; if STOPATPOINTSLIMIT then begin writeln('Buckets deposited this game: ' + IntToStr(Self.TotalWaterDeposited) + '/' + IntToStr(Self.BucketPointsLimit)); if Self.HasReachedBucketLimit() then begin writeln('Reached bucket points limit, AFK time.'); Self.AFKUntilGameEnd(); Exit; end; end; end; procedure TroubleBrewing.LEAVE_UPPER_HOUSE(); var attempts: Integer; begin attempts := 0; if (Self.GetLocation() = SOUTHHOUSEUPPER) then begin while (attempts < 6) and (Self.GetLocation() = SOUTHHOUSEUPPER) do begin if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; if (attempts = 3) and (Self.GetLocation() = SOUTHHOUSEUPPER) then begin writeln('Rotating camera to find South House upper ladder'); Antiban.RandomRotate(); end; CopperLadderSouthUpper.WalkClick(); WaitUntil(Self.GetLocation() = SOUTHHOUSE, 65, 3000); Inc(attempts); end; end else if (Self.GetLocation() = NORTHHOUSEUPPER) then begin while (attempts < 6) and (Self.GetLocation() = NORTHHOUSEUPPER) do begin if Self.GetLocation() = OUTSIDEOFLOBBY then Exit; if (attempts = 3) and (Self.GetLocation() = NORTHHOUSEUPPER) then begin writeln('Rotating camera to find North House upper ladder'); Antiban.RandomRotate(); end; CopperLadderNorthUpper.WalkClick(); WaitUntil(Self.GetLocation() = NORTHHOUSE, 65, 3000); Inc(attempts); end; end; end; function TroubleBrewing.DoAntiban(checkBreaks: Boolean = True; checkSleeps: Boolean = True): Boolean; override; begin Antiban.DismissRandom(); Self.TimeRunning.Pause(); Self.OnAntiban := True; checkBreaks := checkBreaks and (WLSettings.GetObject('antiban').getBoolean('breaks') or OVERRIDEBREAKS); checkSleeps := checkSleeps and WLSettings.GetObject('antiban').getJSONObject('sleep').getBoolean('enabled'); if WLSettings.GetObject('antiban').getJSONObject('tasks').getBoolean('enabled') or checkBreaks or checkSleeps then Result := Antiban.DoAntiban(checkBreaks, checkSleeps); Self.TimeRunning.Resume(); Self.OnAntiban := False; if not RSClient.IsLoggedIn() then Login.LoginPlayer(False); end; procedure TroubleBrewing.doAction(); begin if IsInterfaceOpen() then CloseInterface(); if IsEndGameInterfaceOpen() then CloseEndGameInterface(); if (not RSClient.IsLoggedIn()) then Login.LoginPlayer(False); {Self.GET_TIME_REMAINING(); writeln('Game Time remaining: ' + IntToStr(TimeRemaining)); if TimeRemaining = 1 then begin writeln('Game will end soon, AFK for the last bit'); WaitUntil(Self.GetLocation() <> INGAMEBOX, 65, 10000); end;} RSClient.Image.Clear; Self.CurrentState := Self.getState(); if (Self.CurrentState <> STATE_WAITING_FOR_GAME) and (Self.LobbyWaitTimeout <> 0) then Self.LobbyWaitTimeout := 0; case Self.GetState() of STATE_ENDGAME: DO_ENDGAME(); STATE_ENTER_GAME: DO_ENTER_GAME(); STATE_GET_TOOLS: GET_TOOLS(); STATE_DO_WOODCUTTING: DO_WOODCUTTING(); STATE_FILL_BUCKETS: DO_FILL_BUCKETS(); STATE_DO_FLETCHING: DO_FLETCHING(); STATE_WAITING_FOR_GAME: DO_WAITING_FOR_GAME(); STATE_ENTER_UPPER_HOUSE: DO_ENTER_UPPER_HOUSE(); STATE_FILL_BARK_HOPPER: DO_FILL_BARK_HOPPER(); STATE_FILL_WATER_HOPPER: DO_FILL_WATER_HOPPER(); STATE_LEAVE_UPPER_HOUSE: LEAVE_UPPER_HOUSE(); STATE_UNKNOWN: begin writeln('Location: ', Self.GetLocation(), ' State: ', Self.GetState()); TakeScreenshot('UnknownState'); end; end; end; function TroubleBrewing.GetLocation(): ELocation; begin if (not RSClient.IsLoggedIn) then Exit; MyFullPos := Map.FullPosition; if MyFullPos.Plane = 0 then begin if MyFullPos.InBox([11008, 38406, 11260, 38654]) then Exit(INGAMEBOX); if MyFullPos.InBox([11140, 38410, 11196, 38442]) then Exit(NORTHHOUSE); if MyFullPos.InBox([11144, 38614, 11200, 38646]) then Exit(SOUTHHOUSE); if MyFullPos.InBox([11116, 38354, 11192, 38390]) then Exit(INLOBBYBOX); end; if MyFullPos.Plane = 2 then begin if MyFullPos.InBox([37256, 38414, 37304, 38438]) then Exit(NORTHHOUSEUPPER); if MyFullPos.InBox([37260, 38618, 37308, 38642]) then Exit(SOUTHHOUSEUPPER); end; Exit(OUTSIDEOFLOBBY); end; function TroubleBrewing.GetState(): EState; begin if IsInterfaceOpen() or IsEndGameInterfaceOpen() then Exit; case Self.GetLocation() of OUTSIDEOFLOBBY: Exit(STATE_ENTER_GAME); INLOBBYBOX: Exit(STATE_WAITING_FOR_GAME); INGAMEBOX: if (METHODTOUSE = 'Scrapy Bark') then begin if not Inventory.ContainsItem('Knife') then Exit(STATE_GET_TOOLS); if not Inventory.IsFull() then Exit(STATE_DO_WOODCUTTING); if Inventory.ContainsItem('Scrapey tree logs') then Exit(STATE_DO_FLETCHING); if Inventory.ContainsItem('Scrapey bark') and inventory.IsFull then Exit(STATE_ENTER_UPPER_HOUSE); end else if (METHODTOUSE = 'Buckets') then begin if Self.HasReachedBucketLimit() then Exit(STATE_ENTER_UPPER_HOUSE); if (Inventory.CountItem('Bucket') < 24) and not Inventory.ContainsItem('Bucket of water') then Exit(STATE_GET_TOOLS); if Inventory.ContainsItem('Bucket') then Exit(STATE_FILL_BUCKETS); if Inventory.ContainsItem('Bucket of water') then Exit(STATE_ENTER_UPPER_HOUSE); end; SOUTHHOUSEUPPER, NORTHHOUSEUPPER: if Inventory.ContainsItem('Scrapey bark') then Exit(STATE_FILL_BARK_HOPPER) else if Inventory.ContainsItem('Bucket of water') then Exit(STATE_FILL_WATER_HOPPER) else if Self.HasReachedBucketLimit() then Exit(STATE_FILL_WATER_HOPPER) else Exit(STATE_LEAVE_UPPER_HOUSE); end; Exit(STATE_UNKNOWN); end; function FormatRoundedNumber(Number: Integer): String; begin // If the number is >= 1 million, format it with 1 decimal place and add "M" suffix if Number >= 1000000 then Result := FormatFloat('0.0M', Number / 1000000) // If the number is >= 1 thousand, format it with no decimal places and add "K" suffix else if Number >= 1000 then Result := FormatFloat('0K', Number / 1000) // For smaller numbers, use the regular SRL.FormatNumber function else Result := SRL.FormatNumber(Number); end; procedure TroubleBrewing.Report(); var Runtime: Integer; XPPerHour: Integer; CurrentXP: Integer; GainedXP: Integer; FletchingXP: Integer; CookingXP: Integer; begin if Self.GetState() <> STATE_WAITING_FOR_GAME then ClearDebug(); if IsEndGameInterfaceOpen() then CloseEndGameInterface(); CurrentXP := XPBar.Read(); GainedXP := CurrentXP - StartXP; XPPerHour := Round(((CurrentXP - StartXP) / Runtime) * 3600); FletchingXP := TotalScrapeyLogs * 50; CookingXP := TotalScrapeyLogs * 100; WriteLn('========================================'); WriteLn(' BASH Scripts Troublebrewing '); If SRL.dice(1) then WriteLn(' BASH Scripts & Rubix Troublebrewing '); WriteLn('========================================'); WriteLn(' Runtime: ' + SRL.MsToTime(GetTimeRunning, Time_Short)); if METHODTOUSE <> 'Buckets' then begin WriteLn(' XP Gained: ' + FormatRoundedNumber(GainedXP)); if not POWERFLETCHING then begin WriteLn(' Fletching XP: ' + FormatRoundedNumber(FletchingXP)); WriteLn(' Cooking XP: ' + FormatRoundedNumber(CookingXP)); end; WriteLn('----------------------------------------'); WriteLn(' XP/Hour: ' + FormatRoundedNumber(Round((GainedXP) / (GetTimeRunning / 3600000)))); if not POWERFLETCHING then begin WriteLn(' XP/Hour (Fletching): ' + FormatRoundedNumber(Round((FletchingXP) / (GetTimeRunning / 3600000)))); WriteLn(' XP/Hour (Cooking): ' + FormatRoundedNumber(Round((CookingXP) / (GetTimeRunning / 3600000)))); end; end; if TotalPOEEarned > 0 then WriteLn(' Total Pieces of Eight Earned: ' + IntToStr(TotalPOEEarned)); if (METHODTOUSE = 'Buckets') and STOPATPOINTSLIMIT and (Self.BucketPointsLimit > 0) then WriteLn(' Buckets this game: ' + IntToStr(Self.TotalWaterDeposited) + '/' + IntToStr(Self.BucketPointsLimit)); WriteLn(' Current State: ', Self.GetState()); WriteLn(' Current Location: ', Self.GetLocation()); WriteLn('========================================'); WriteLn(' BASH Scripts Troublebrewing '); WriteLn(' ', Antiban.BreakScheduleText()); WriteLn(' ', Antiban.SleepScheduleText()); WriteLn(' Version: ' + {$MACRO SCRIPT_REVISION}); WriteLn('========================================'); end; procedure TroubleBrewing.Init(MaxActions: UInt32; MaxTime: UInt64); override; begin inherited; Writeln('Setting up using ' + METHODTOUSE + ' method'); ScrapeyBark := 'Scrapey bark'; ValidAxes := ['Bronze axe', 'Iron axe', 'Steel axe', 'Black axe', 'Mithril axe', 'Adamant axe', 'Rune axe', 'Dragon axe', 'Crystal axe', 'Blessed axe', 'Gilded axe', '3rd age axe', 'Infernal axe']; TotalScrapeyLogs := 0; TotalPiecesOfEight := 0; RSClient.Image.Clear; Map.SetupChunkEx([58, 47, 60, 45], [0, 2]); Map.Loader.Graph.LoadNodesFromString('8hwAAHicZZnp0QYrCoVTuSEoiEssUzf/NOZrnuMrU/OTQpHlsDT9n977bP/47nP/+58/Iuwj9knC+h8Rbh/Rlv8Rox2IjzPmTMLPR/QGsT9ieBI9CUvRzVoe63Dyzhjc8SItxkc4AkYSdgpH74wUEEiLSGmzSNuI7jNFr3JsWxE9OTbz2BrvnWiIXlaI0987vaVxHWknjfNKtMGxvGOSlo+OKISnPb2P56ru7XmnexSOrU+dvooGC1cdS3s41lEUs8+uJuSx3ZGGgOAOrjI4uPc8IhqOXx8xb0g+3aZA4Z+AOPEcP1sJfZz5gBSrCAjFBw4mKArHC+co9J4aSHRqgEPQYF4kJjEIyVx5J160Z/cXhSnv5KNT4EuQz4GrEspXt50OIUvaOY/zRyZnvWPyDpwpUAx7rpLoA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/TKk='); Map.Loader.Graph.LoadNamesFromString('6AgAAHici1Y2iI0exaN4FI/iUTyKR/EoHoYYABFPUp0='); Objects.Setup(Map.Objects(), @Map.Walker); Npcs.Setup(Map.NPCs(), @Map.Walker); Self.SetupObjects(); Self.DefineItemBoxes(); Mouse.Distribution := MOUSE_DISTRIBUTION_GAUSS; Timer.Start(); StartXP := XPBar.Read(); DisplayName := Chat.GetDisplayName(); Mouse.Speed := SRL.NormalRange(22, 28); CheckGameChatActive(); if PINGONTERMINATED and ENABLEWEBHOOKS then AddOnTerminate(@Self.SendTerminationNotification); if not Equipment.ContainsAny(ValidAxes) and (METHODTOUSE = 'Scrapy Bark') then begin writeln('No axe found equipped, You must have an axe equipped!'); TerminateScript(); end; if Equipment.IsSlotUsed(ERSEquipmentSlot.HEAD) then begin if not (Equipment.ContainsItem('Pirate hat') or Equipment.ContainsItem('Pirate bandana')) then begin writeln('You must have no headgear equipped to enter trouble brewing!'); TerminateScript(); end; end; DetermineTeam(); end; procedure TroubleBrewing.Run(MaxActions: UInt32; MaxTime: UInt64); begin Self.Init(MaxActions, MaxTime); repeat Self.GetLocation(); Self.doAction(); if WL.Activity.IsFinished() then begin WriteLn('No activity detected in 5 minutes! Shutting down.'); Break; end; if not IsInterfaceOpen() or IsEndGameInterfaceOpen() then Self.Report(); until Self.ShouldStop(); end; {$IFDEF SCRIPT_GUI} const TB_TEAM_ITEMS: TStringArray = ['Red', 'Blue', 'Random']; TB_METHOD_ITEMS: TStringArray = ['Scrapy Bark', 'Buckets']; type TConfig = record(TBASHPremiumGUI) MethodDropBox, TeamDropBox: TLabeledComboBox; PowerFletchCheckBox, StopAtPointsLimitCheckBox: TLabeledCheckBox; DisplayNameLabel: TLabel; TeamSelection: String; DiscordUIDInfo: TLabel; DiscordUIDInput: TLabeledEdit; PingOnTerminatedCheckBox: TLabeledCheckBox; end; TScriptGUI = TConfig; procedure TConfig.InitGUI(); override; begin Self.BrandTitle := 'Trouble Brewing'; Self.WindowTitle := 'BASH Scripts Trouble Brewing'; Self.WebhookTestPrefix := 'Test message from BASH Scripts Trouble Brewing'; Self.HasFarm := False; Self.HasAIChat := False; Self.HasWorldHopping := False; Self.HasMaxActions := True; Self.HasStopAtLevel := False; Self.LegacyAntibanSection := ' Trouble Brewing Antiban'; end; procedure TConfig.MigrateLegacyWebhook(); var url, en: String; begin url := ReadINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'WebhookURL', BASH_GUI_SETTINGS_FILE); if url = '' then begin url := ReadINI(Self.Username + ' Webhook Settings', 'WebhookURL', BASH_GUI_SETTINGS_FILE); if url <> '' then WriteINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'WebhookURL', url, BASH_GUI_SETTINGS_FILE); end; en := ReadINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'EnableWebhooks', BASH_GUI_SETTINGS_FILE); if en = '' then begin en := ReadINI(Self.Username + ' Webhook Settings', 'EnableWebhooks', BASH_GUI_SETTINGS_FILE); if en <> '' then WriteINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'EnableWebhooks', en, BASH_GUI_SETTINGS_FILE); end; end; function TConfig.TeamIndexFromSelection(selection: String): Int32; begin if selection = 'Blue' then Result := 1 else if selection = 'Random' then Result := 2 else Result := 0; end; function TConfig.MethodIndexFromSelection(selection: String): Int32; begin if selection = 'Buckets' then Result := 1 else Result := 0; end; procedure TConfig.LoadActionSettings(); override; begin Self.MigrateLegacyWebhook(); Self.TeamSelection := ReadINI(Self.Username + ' BATrouble Brewing', 'TeamSelection', BASH_GUI_SETTINGS_FILE); METHODTOUSE := ReadINI(Self.Username + ' BATrouble Brewing', 'Method', BASH_GUI_SETTINGS_FILE); POWERFLETCHING := StrToBoolDef(ReadINI(Self.Username + ' BATrouble Brewing', 'PowerFletch', BASH_GUI_SETTINGS_FILE), False); STOPATPOINTSLIMIT := StrToBoolDef(ReadINI(Self.Username + ' BATrouble Brewing', 'StopAtPointsLimit', BASH_GUI_SETTINGS_FILE), False); end; procedure TConfig.PowerFletchCheckboxChanged(Sender: TObject); begin if Sender = nil then; POWERFLETCHING := Self.PowerFletchCheckBox.IsChecked(); end; procedure TConfig.StopAtPointsLimitCheckboxChanged(Sender: TObject); begin if Sender = nil then; STOPATPOINTSLIMIT := Self.StopAtPointsLimitCheckBox.IsChecked(); end; procedure TConfig.MethodDropBoxChanged(Sender: TObject); begin if Sender = nil then; Self.PowerFletchCheckBox.SetVisible(Self.MethodDropBox.GetItemIndex() = 0); Self.StopAtPointsLimitCheckBox.SetVisible(Self.MethodDropBox.GetItemIndex() = 1); METHODTOUSE := Self.MethodDropBox.GetText(); end; procedure TConfig.TeamDropBoxChanged(Sender: TObject); begin if Sender = nil then; Self.TeamSelection := Self.TeamDropBox.GetText(); end; procedure TConfig.BuildActionSection(); override; begin Self.AddHeader(Self.ActionSection, 'Action', 'Play Trouble Brewing with your chosen team and method.'); Self.AddCombo(Self.ActionSection, Self.TeamDropBox, 'lcb_tb_team', 'Select your team', 24, 110, TB_TEAM_ITEMS, Self.TeamIndexFromSelection(Self.TeamSelection)); Self.TeamDropBox.SetTooltip('Red Team can join a game in progress, Blue Team cannot.'); Self.TeamDropBox.ComboBox.SetOnChange(@Self.TeamDropBoxChanged); Self.DisplayNameLabel := Self.MakeLabel(Self.ActionSection, 'Display Name: ' + Chat.GetDisplayName(), BASH_GUI_COL2, 128, 10, BASH_GUI_MUTED, False); Self.AddCombo(Self.ActionSection, Self.MethodDropBox, 'lcb_tb_method', 'Choose method', 24, 190, TB_METHOD_ITEMS, Self.MethodIndexFromSelection(METHODTOUSE)); Self.MethodDropBox.SetTooltip('Choose the method you want to use.'); Self.MethodDropBox.ComboBox.SetOnChange(@Self.MethodDropBoxChanged); Self.AddCheck(Self.ActionSection, Self.PowerFletchCheckBox, 'cb_tb_powerfletch', 'Power Fletch', BASH_GUI_COL2, 208, POWERFLETCHING); Self.PowerFletchCheckBox.SetTooltip('Power fletching awards no pieces of eight or cooking XP, but more fletching XP'); Self.PowerFletchCheckBox.CheckBox.SetOnChange(@Self.PowerFletchCheckboxChanged); Self.PowerFletchCheckBox.SetVisible(False); Self.AddCheck(Self.ActionSection, Self.StopAtPointsLimitCheckBox, 'cb_tb_stop_points', 'Stop at points limit', BASH_GUI_COL2, 208, STOPATPOINTSLIMIT); Self.StopAtPointsLimitCheckBox.SetTooltip('After 100-120 buckets, AFK for the rest of the game instead of running more.'); Self.StopAtPointsLimitCheckBox.CheckBox.SetOnChange(@Self.StopAtPointsLimitCheckboxChanged); Self.StopAtPointsLimitCheckBox.SetVisible(False); Self.MethodDropBoxChanged(nil); end; procedure TConfig.OpenDiscordUIDHelp(Sender: TObject); begin if Sender = nil then; OpenWebPage('https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID'); end; procedure TConfig.WebhooksCheckboxChanged({$H-}sender: TObject); {$H+} override; var shown: Boolean; begin inherited; shown := Self.EnableWebhooksCheckBox.IsChecked(); if Assigned(Self.DiscordUIDInput) then Self.DiscordUIDInput.SetVisible(shown); if Assigned(Self.DiscordUIDInfo) then Self.DiscordUIDInfo.SetVisible(shown); if Assigned(Self.PingOnTerminatedCheckBox) then Self.PingOnTerminatedCheckBox.SetVisible(shown); end; procedure TConfig.BuildAccountsExtras(); override; var savedUID: String; savedPing: Boolean; begin savedUID := ReadINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'DiscordUID', BASH_GUI_SETTINGS_FILE); if savedUID = '' then savedUID := ReadINI(Self.Username + ' Webhook Settings', 'DiscordUID', BASH_GUI_SETTINGS_FILE); savedPing := StrToBoolDef(ReadINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'PingOnTerminated', BASH_GUI_SETTINGS_FILE), True); if ReadINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'PingOnTerminated', BASH_GUI_SETTINGS_FILE) = '' then savedPing := StrToBoolDef(ReadINI(Self.Username + ' Webhook Settings', 'PingOnTerminated', BASH_GUI_SETTINGS_FILE), True); Self.AddCheck(Self.AccountsSection, Self.PingOnTerminatedCheckBox, 'cb_tb_ping_term', 'Ping on script termination', BASH_GUI_COL2, 350, savedPing); Self.AddEdit(Self.AccountsSection, Self.DiscordUIDInput, 'le_tb_discord_uid', 'Discord UID (optional)', savedUID, 24, 490, 260); Self.DiscordUIDInfo := Self.MakeLabel(Self.AccountsSection, 'How to find your Discord User ID', BASH_GUI_COL2, 508, 10, BASH_GUI_LINK, False); Self.DiscordUIDInfo.SetOnClick(@Self.OpenDiscordUIDHelp); Self.DiscordUIDInfo.SetCursor(crHandPoint); Self.EnableWebhooksCheckBox.CheckBox.SetOnChange(@Self.WebhooksCheckboxChanged); Self.WebhooksCheckboxChanged(nil); end; procedure TConfig.ApplyActionSettings(); override; begin METHODTOUSE := Self.MethodDropBox.GetText(); POWERFLETCHING := Self.PowerFletchCheckBox.IsChecked(); STOPATPOINTSLIMIT := Self.StopAtPointsLimitCheckBox.IsChecked(); NPCSELECTION := Self.TeamDropBox.GetText(); Self.TeamSelection := NPCSELECTION; if Assigned(Self.PingOnTerminatedCheckBox) then PINGONTERMINATED := Self.PingOnTerminatedCheckBox.IsChecked(); if Assigned(Self.DiscordUIDInput) then DiscordUID := Self.DiscordUIDInput.GetText(); WriteINI(Self.Username + ' BATrouble Brewing', 'TeamSelection', Self.TeamSelection, BASH_GUI_SETTINGS_FILE); WriteINI(Self.Username + ' BATrouble Brewing', 'Method', METHODTOUSE, BASH_GUI_SETTINGS_FILE); WriteINI(Self.Username + ' BATrouble Brewing', 'PowerFletch', BoolToStr(POWERFLETCHING, 'true', 'false'), BASH_GUI_SETTINGS_FILE); WriteINI(Self.Username + ' BATrouble Brewing', 'StopAtPointsLimit', BoolToStr(STOPATPOINTSLIMIT, 'true', 'false'), BASH_GUI_SETTINGS_FILE); WriteINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'DiscordUID', DiscordUID, BASH_GUI_SETTINGS_FILE); WriteINI(Self.Username + BASH_GUI_WEBHOOK_SECTION, 'PingOnTerminated', BoolToStr(PINGONTERMINATED, 'true', 'false'), BASH_GUI_SETTINGS_FILE); end; procedure TConfig.StartScript(Sender: TObject); override; begin if Sender = nil then; try Self._WarmBuildCache(); except end; inherited; end; {$IFDEF SCRIPT_GUI} {$I BashLib/optional/handlers/bashgui_host_scriptgui.simba} {$ENDIF} var Config: TConfig; {$ENDIF} begin begin {$IFDEF SCRIPT_GUI} Sync(@Config.Run); {$ENDIF} Script.Run(WLSettings.MaxActions, WLSettings.MaxTime); end; end.