{$UNDEF SCRIPT_ID}{$DEFINE SCRIPT_ID := '6201fd4a-a3b1-408e-a420-13cfc8c218f7'} {$UNDEF SCRIPT_REVISION}{$DEFINE SCRIPT_REVISION := '5'} {$IFDEF WINDOWS}{$DEFINE SCRIPT_GUI}{$ENDIF} {$I SRL-B/osr.simba} {$I BashLib/osr.simba} {$I BashLib/optional/handlers/aichat.simba} { ---------------------------------------------------------------------------------- ~~~ Need Support? Contact Me ~~~ Discord ID: big.aussie Discord Server: https://discord.gg/qsmKs5uKfR Email: thebigaussie@proton.me Github: https://github.com/BigAussie/BASH ---------------------------------------------------------------------------------- } Const // Settings EXPERIMENTALWALK = True; ITEMSTOKEEP: TRSItemArray := ['Hammer', 'Barronite shards']; // Items to keep when depositing at bank. var RSW: TRSWalker; BarroniteMine : TWebGraph; begin Login.PlayerIndex := 1; end; type EState = ( STATE_MINEBARRONITE, STATE_WALKTOMINESPOTS, STATE_WALK_TO_ANVIL, STATE_WALK_TO_BANK, STATE_USEANVIL, STATE_BANKITEMS ); BarroniteMiner = record (TBaseBankScript) CurrentState: EState; MineSpot1: TPoint; BankLoc: TPoint; AnvilLoc: TPoint; Barronite: TRSitem; BarroniteShardsItem: TRSitem; BarroniteDeposit: TRSitem; NotedBasalt: TRSitem; HammerItem: TRSitem; StartXP: Integer; CurrentXP: Integer; BarroniteMined: Integer; TotalShardsMined: Integer; BarroniteRocks: TRSObject; Anvil: TRSObject; BankChest: TRSObject; FoundRareItems: TStringArray; end; var Timer: TStopWatch; // The traditional "WalkPath" but using a different formula for building paths // "BORROWED" from Flight <3 Shout-Out to flight. function TRSWalker.WalkPath(Path: TPointArray; WaitUntilDistance: Int32 = 0): Boolean; override; function BuildPath(TPA: TPointArray): TPointArray; var i,j: Int32; Line: TPointArray; begin if EXPERIMENTALWALK then begin for i := 1 to High(TPA) do Result += TPABetweenPoints(TPA[i-1], TPA[i], 15 + Random(-7,7), 7); end else begin for I := 1 to High(TPA) do begin Line := TPAFromLine(TPA[I-1], TPA[I]); J := 0; while J < High(Line) do begin Result += Line[J]; // keep the steps low, as mainscreen walking might just have a few tiles visible when NearZoomMode is set True if (Self.NearZoomMode) and ((Self.ScreenWalk) or (Self.AdaptiveWalk)) then Inc(J, Random(1, 4)) else Inc(J, Random(3, 12)); end; end; Result += TPA[High(TPA)]; end; end; function AdvancePath(var Index: Int32; PlayerPoint: TPoint): Boolean; var Angle: Double := Minimap.GetCompassAngle(False); Previous: Int32 := Index; Nearest, Furthest: Int32; begin Nearest := Self.Path.Find(Self.Path.Sorted(PlayerPoint)[0]); Self.PathIndex := Nearest; while (Nearest < High(Self.Path)) and (not Self.IsWalkable(Self.Path[Nearest+1], PlayerPoint, Angle)) do Inc(Nearest); Furthest := Nearest; while (Furthest < High(Self.Path)) and Self.IsWalkable(Self.Path[Furthest+1], PlayerPoint, Angle) do Inc(Furthest); Index := Furthest; // do the result check before randomness to avoid false error Result := (Index > Previous); // 15% chance of randomness else furthest if Random() < 0.15 then Index := Random(Nearest, Furthest); end; var PlayerPoint: TPoint; Index, Fails: Int32; begin Self.Enabled := True; PlayerPoint := Self.GetMyPos(); Self.Path := BuildPath([PlayerPoint] + Path); if Self.AdaptiveWalk then begin Self.AdaptiveToggleDistances.X := RSW_ADAPTIVE_SCREEN_TOGGLE_DISTANCES.X + Random(-6,6); Self.AdaptiveToggleDistances.Y := RSW_ADAPTIVE_SCREEN_TOGGLE_DISTANCES.Y + Random(-16,16); Self.AdaptiveWalkCheck(PlayerPoint); end; while Self.Enabled and (Fails < 10) do begin PlayerPoint := Self.GetMyPos(); if AdvancePath(Index, PlayerPoint) then Fails := 0 else begin Inc(Fails); // Likely haven't moved far enough to advance to next point if (Fails < 5) then begin Wait(300); Continue; end else begin // screen walking struggles, so disable it if Self.AdaptiveWalk then Self.ScreenWalk := False else if (Fails = 5) then case SRL.Dice(50) of True: Minimap.SetCompassAngle(Minimap.GetCompassAngle() - SRL.TruncatedGauss(30, 360, 3)); False: Minimap.SetCompassAngle(Minimap.GetCompassAngle() + SRL.TruncatedGauss(30, 360, 3)); end; end; if (Fails mod 2 = 0) then Minimap.WaitFlag(); end; if Distance(PlayerPoint, Self.Path[Index]) <= 20 then // The next step is very close, let's just MS walk Self.ScreenWalk := True; if Index = High(Self.Path) then begin if Self.WalkFinalStep(PlayerPoint, Self.Path[Index], WaitUntilDistance) then Exit(True); end else Self.WalkStep(PlayerPoint, Self.Path[Index]); end; if Fails = 10 then Self.DebugLn('Failed to advance path'); end; procedure OnWalkEvent(Sender: PRSWalker; Position: TPoint; Destination: TPoint); begin if SRL.Dice(5) then Mouse.RandomMovement; if EXPERIMENTALWALK then Sender^.ScreenWalk := SRL.Dice(35); Position := []; Destination := []; end; procedure TAntiban.Setup(); override; begin Antiban.Skills := [ERSSkill.TOTAL, ERSSKILL.MINING]; Antiban.MinZoom := 10; Antiban.MaxZoom := 50; inherited; end; procedure BarroniteMiner.SetupObjects(); begin with self.BarroniteRocks do begin SetupEx([2, 1, 10], [[1114, 3844], [1108, 3845], [1132, 3830], [1131, 3826]]); Setup(['Barronite rocks']); Finder.ColorClusters += [CTS2(10773907, 19, 0.13, 0.64), CTS2(5917267, 5, 0.13, 0.15), 5]; //Finder.Colors += CTS2(7295082, 5, 0.17, 0.27); - Barronite Ore Colour end; with self.Anvil do begin SetupEx([1, 1, 4], [[1190, 3839]]); Setup(['Barronite Crusher']); Finder.Colors += CTS2(3428964, 20, 0.07, 0.54); end; with self.BankChest do begin SetupEx([1, 1, 3], [[1282, 3873]]); Setup(['Bank chest']); Finder.ColorClusters += [CTS2(1776423, 2, 9.45, 2.65), CTS2(7757932, 12, 0.08, 0.13), 2]; end; end; procedure BarroniteMiner.WALK_TO_ANVIL(); begin writeln('Walking to Anvil'); Self.RSW.WebWalk(AnvilLoc); end; procedure BarroniteMiner.WALKTOMINESPOTS(); begin writeln('Walking to Mine Spot 1'); Self.RSW.WebWalk(MineSpot1); end; procedure BarroniteMiner.WALK_TO_BANK(); begin writeln('Walking to Bank Chest.'); Self.RSW.WebWalk(BankLoc); end; function BarroniteMiner.MINEBARRONITE(): Boolean; var PlayerBox: TBox; XP: Integer; T, ReportTimer: TStopWatch; MiningDuration: Int32; MinedShards: Integer; InitialShards: Integer; CurrentShards: Integer; begin WriteLn('Mining barronite.'); PlayerBox := MainScreen.GetPlayerBox(); XP := XPBar.Read(); ReportTimer.Start(); InitialShards := Inventory.CountItemStack('Barronite shards'); while not Inventory.IsFull() do begin if not BarroniteRocks.IsVisible() then begin writeln('Looking for rocks'); Antiban.RandomRotate(); end; if BarroniteRocks.IsVisible() then begin BarroniteRocks.Click(); MiningDuration := RandomRange(600, 750); T.Start(); while (T.ElapsedTime < MiningDuration) do begin if XPBar.Read() > XP then begin XP := XPBar.Read(); T.Start(); end; if (SRL.PercentShift(PlayerBox, 500) >= 14) then T.Start(); Wait(100); WL.Activity.Restart(); if ReportTimer.ElapsedTime >= 3000 then begin CurrentShards := Inventory.CountItemStack('Barronite shards'); if CurrentShards > InitialShards then begin Self.TotalShardsMined += CurrentShards - InitialShards; InitialShards := CurrentShards; end; Self.Report(); ReportTimer.Start(); end; end; end; end; Self.TotalShardsMined += Inventory.CountItemStack('Barronite shards') - InitialShards; Result := not Inventory.IsFull(); end; function BarroniteMiner.USEANVIL(): Boolean; var T, ReportTimer: TStopWatch; InitialShards: Integer; CurrentShards: Integer; begin InitialShards := Inventory.CountItemStack('Barronite shards'); ReportTimer.Start(); while not Anvil.IsVisible() do begin Antiban.RandomRotate(); Wait(500); end; if Anvil.IsVisible() then Anvil.Click(); while Inventory.ContainsItem('barronite deposit') do begin if ReportTimer.ElapsedTime >= 3000 then begin CurrentShards := Inventory.CountItemStack('Barronite shards'); if CurrentShards > InitialShards then begin Self.TotalShardsMined += CurrentShards - InitialShards; InitialShards := CurrentShards; end; Self.Report(); ReportTimer.Start(); end; Wait(RandomRange(600, 750)); end; Self.TotalShardsMined += Inventory.CountItemStack('Barronite shards') - InitialShards; end; function BarroniteMiner.BANKITEMS(): Boolean; begin while not BankChest.IsVisible() do begin Antiban.RandomRotate(); Wait(500); end; if not Bank.IsOpen() then begin for 1 to 3 do Repeat BankChest.Hover(); Until Mainscreen.IsUpText(['Bank chest']); BankChest.Click(); if not mainscreen.DidRedClick then Exit; WaitUntil(Bank.IsOpen(), 85, 3500); end; if Bank.IsOpen() then begin Bank.DepositRandomItems(ITEMSTOKEEP); WaitUntil(Inventory.Count() <= 2, 375, 2150); Bank.Close(); WaitUntil(not Bank.IsOpen(), 375, 3500); end; end; procedure BarroniteMiner.doAction(); begin WriteLn('Current state: ', Self.CurrentState); case Self.CurrentState of STATE_WALKTOMINESPOTS: begin WALKTOMINESPOTS(); if RSW.AtTile(MineSpot1, 15) then Self.CurrentState := STATE_MINEBARRONITE; end; STATE_MINEBARRONITE: begin MINEBARRONITE(); if Inventory.IsFull() then Self.CurrentState := STATE_WALK_TO_ANVIL; end; STATE_WALK_TO_ANVIL: begin WALK_TO_ANVIL(); if RSW.AtTile(AnvilLoc, 15) then Self.CurrentState := STATE_USEANVIL; end; STATE_USEANVIL: begin USEANVIL(); if not Inventory.ContainsRandomItems(ITEMSTOKEEP) then Self.CurrentState := STATE_WALKTOMINESPOTS else Self.CurrentState := STATE_WALK_TO_BANK; end; STATE_WALK_TO_BANK: begin WALK_TO_BANK(); if RSW.AtTile(BankLoc, 15) then Self.CurrentState := STATE_BANKITEMS; end; STATE_BANKITEMS: begin BANKITEMS(); if Inventory.Count() <= 2 then Self.CurrentState := STATE_WALKTOMINESPOTS; end; end; 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 BarroniteMiner.Report(); var Runtime: Integer; XPPerHour: Integer; CurrentXP: Integer; GainedXP: Integer; Profit: Integer; RareItems: array of string = ['Barronite head', 'Imcando hammer (broken)', 'Ancient astroscope', 'Ancient carcanet', 'Ancient globe', 'Ancient ledger', 'Ancient treatise']; i: Integer; RareItemFound: Boolean; begin ClearDebug(); CurrentXP := XPBar.Read(); GainedXP := CurrentXP - StartXP; Runtime := Timer.ElapsedTime; XPPerHour := Round(((CurrentXP - StartXP) / Runtime) * 3600); WriteLn('========================================'); WriteLn(' BigAussies Barronite Miner '); WriteLn('========================================'); WriteLn(' Runtime: ' + SRL.MsToTime(GetTimeRunning, Time_Short)); WriteLn(' XP Gained: ' + FormatRoundedNumber(GainedXP)); WriteLn(' Total Shards Mined: ' + IntToStr(Self.TotalShardsMined)); WriteLn('----------------------------------------'); WriteLn(' XP/Hour: ' + FormatRoundedNumber(Round((GainedXP) / (GetTimeRunning() / 3600000)))); WriteLn(' Shards/Hour Est.: ' + FormatRoundedNumber(Round((TotalShardsMined) / (GetTimeRunning() / 3600000)))); for i := 0 to High(RareItems) do begin if Inventory.ContainsItem(RareItems[i]) then begin if not Self.FoundRareItems.Contains(RareItems[i]) then Self.FoundRareItems += [RareItems[i]]; end; end; if Length(Self.FoundRareItems) > 0 then begin WriteLn(' Found Ancient Relics: '); for i := 0 to High(Self.FoundRareItems) do WriteLn(' - ' + Self.FoundRareItems[i]); end else WriteLn(' No Ancient Relics Found yet'); WriteLn('========================================'); WriteLn(' BigAussies Barronite Miner '); WriteLn(' Version: ' + {$MACRO SCRIPT_REVISION}); WriteLn('========================================'); end; procedure TRSWalker.InternalSetup(); override; begin inherited; BarroniteMine.LoadNodesFromString('VQEAAHicRdDbDcUwCAPQVe4I4RVglqr7r3FrR6V/RxY4KJfI2j8rq/uS1QEaWKSQGPAk+2GQjXSftXpYmD1l1aDa0GoYOtxfmuitBVail2nr+9qhf7RNxrumIkP1IR9OlGngssS9mphNNGjZcGHNSUGvB8twjjvLclInaxhkyPmSP2wYTPE='); BarroniteMine.LoadPathsFromString('xgAAAHicJY7bFUQxCAJboYRA3rVw7L+NJXs/UWfQLDeoTPSyMModszywyhO7vHDKG7d8wFa+YBg28FEEO5gzCgz8UnAOcEFvML9dJNxgNDxQPLxQREq70DMQoffD004onAaUN5SUBkUYizYUi84H/S0/jDsvKQ=='); BarroniteMine.LoadNamesFromString('hwAAAHici1Y2iI2mBXZKLCrKz8ssSfXNzEslqBwAqLQlMg=='); Self.WebGraph := BarroniteMine; end; procedure BarroniteMiner.Init(MaxActions: UInt32; MaxTime: UInt64); override; begin inherited; if AIChatbot.Enabled then begin WriteLn('[AI Chatbot] Enabled - initializing'); AIChatbot.Init(); end else WriteLn('[AI Chatbot] Disabled'); RSW.Setup([[923, 3649, 1678, 4096]]); self.SetupObjects(); Minespot1 := [1126, 3826]; AnvilLoc := [1194, 3838]; BankLoc := [1278, 3874]; BarroniteShardsItem := ('Barronite shards'); BarroniteDeposit := ('barronite deposit'); HammerItem := ('Hammer'); Options.SetZoomLevel(Random(10, 50)); StartXP := XPBar.Read(); end; procedure BarroniteMiner.Run(MaxActions: UInt32; MaxTime: UInt64); begin Self.Init(MaxActions, MaxTime); repeat Self.doAction(); if WL.Activity.IsFinished() then begin WriteLn('No activity detected in 5 minutes! Shutting down.'); Break; end; Self.DoAntiban; until Self.ShouldStop(); end; var Script: BarroniteMiner; {$IFDEF SCRIPT_GUI} const BM_GUI_NAV = $F0EBE4; BM_GUI_BG = $FFFFFF; BM_GUI_STATUS = $F7F4F1; BM_GUI_DIVIDER = $D4C9BC; BM_GUI_CARD = $F7F4F1; BM_GUI_ACCENT = $E0C9AE; BM_GUI_NAV_IDLE = $E7DED4; BM_GUI_START = $C9B094; BM_GUI_TEXT = $1C1C1E; BM_GUI_MUTED = $6B6B70; BM_GUI_W = 1120; BM_GUI_H = 700; BM_GUI_NAV_W = 190; BM_GUI_STATUS_H = 56; BM_GUI_BTN_H = 42; BM_GUI_EDIT_W = 260; BM_GUI_COL2 = 308; BM_GUI_BOTTOM_INSET = 34; type TConfig = record(TScriptForm) NavPanel, ContentPanel, StatusPanel, DividerPanel, StatusDivider, StatusPad: TPanel; BrandLabel: TLabel; ScriptNav, AccountsNav, AntibanNav, AIChatNav: TImage; StartChip: TImage; ActiveNav: TImage; ScriptSection, AccountsSection, AntibanSection, AIChatSection: TPanel; MaxActionsInput, MaxTimeInput: TLabeledEdit; end; function TConfig.MakePanel( parent: TWinControl; left, top, width, height, color: Int32 ): TPanel; begin Result.Create(parent); Result.SetLeft(TControl.AdjustToDPI(left)); Result.SetTop(TControl.AdjustToDPI(top)); Result.SetWidth(TControl.AdjustToDPI(width)); Result.SetHeight(TControl.AdjustToDPI(height)); Result.SetColor(color); Result.SetBevelOuter(bvNone); end; procedure TConfig.PaintRoundChip( img: TImage; labelText: String; fill, parentBg: Int32; selected: Boolean = False; centered: Boolean = False ); var bmp: TBitmap; c: TCanvas; w, h, r, tw, th, tx: Int32; begin w := img.GetWidth(); h := img.GetHeight(); if (w <= 0) or (h <= 0) then Exit; r := TControl.AdjustToDPI(6); if r * 2 > h then r := h div 2; if r * 2 > w then r := w div 2; bmp := img.GetPicture().GetBitmap(); bmp.SetWidth(w); bmp.SetHeight(h); c := bmp.GetCanvas(); c.GetBrush().SetColor(parentBg); c.GetPen().SetColor(parentBg); c.FillRect(0, 0, w, h); c.GetBrush().SetColor(fill); c.GetPen().SetColor(fill); c.RoundRect(0, 0, w - 1, h - 1, r * 2, r * 2); c.GetBrush().SetColor(fill); c.GetFont().SetColor(BM_GUI_TEXT); c.GetFont().SetSize(11); if selected then c.GetFont().SetStyle([fsBold]) else c.GetFont().SetStyle([]); tw := c.TextWidth(labelText); th := c.TextHeight(labelText); if centered then tx := (w - tw) div 2 else tx := TControl.AdjustToDPI(16); c.TextOut(tx, (h - th) div 2, labelText); img.SetHint(labelText); img.SetShowHint(False); img.Invalidate(); end; function TConfig.MakeNavItem( parent: TWinControl; labelText: String; left, top: Int32; selected: Boolean = False ): TImage; var fill: Int32; begin Result.Create(parent); Result.SetLeft(TControl.AdjustToDPI(left)); Result.SetTop(TControl.AdjustToDPI(top)); Result.SetWidth(TControl.AdjustToDPI(BM_GUI_NAV_W - 28)); Result.SetHeight(TControl.AdjustToDPI(BM_GUI_BTN_H)); Result.SetCursor(crHandPoint); if selected then fill := BM_GUI_ACCENT else fill := BM_GUI_NAV_IDLE; Self.PaintRoundChip(Result, labelText, fill, BM_GUI_NAV, selected); end; function TConfig.MakeLabel( parent: TWinControl; labelText: String; left, top, fontSize, fontColor: Int32; bold: Boolean = False ): TLabel; begin Result.Create(parent); Result.SetLeft(TControl.AdjustToDPI(left)); Result.SetTop(TControl.AdjustToDPI(top)); Result.SetCaption(labelText); Result.GetFont().SetSize(fontSize); Result.GetFont().SetColor(fontColor); if bold then Result.GetFont().SetStyle([fsBold]); end; procedure TConfig.AddEdit( parent: TWinControl; var box: TLabeledEdit; ctrlName, labelText, text: String; left, top, width: Int32 ); begin box.Create(parent); box.SetLeft(TControl.AdjustToDPI(left)); box.SetTop(TControl.AdjustToDPI(top)); box.SetWidth(TControl.AdjustToDPI(width)); box.SetName(ctrlName); box.SetCaption(labelText); box.SetText(text); box.SetFontColor(BM_GUI_TEXT); end; procedure TConfig.AddHeader(parent: TPanel; titleText, subtitleText: String); var header: TPanel; headerW: Int32; begin headerW := parent.GetWidth(); if headerW <= 0 then headerW := TControl.AdjustToDPI(BM_GUI_W - BM_GUI_NAV_W - 2); header := Self.MakePanel(parent, 0, 0, 1, 88, BM_GUI_CARD); header.SetWidth(headerW); header.SetHeight(TControl.AdjustToDPI(88)); Self.MakeLabel(header, titleText, 24, 18, 18, BM_GUI_TEXT, True); Self.MakeLabel(header, subtitleText, 24, 52, 10, BM_GUI_MUTED, False); end; procedure TConfig.StyleNav(selected: TImage); begin Self.ActiveNav := selected; Self.PaintRoundChip(Self.ScriptNav, Self.ScriptNav.GetHint(), BM_GUI_NAV_IDLE, BM_GUI_NAV, False); Self.PaintRoundChip(Self.AccountsNav, Self.AccountsNav.GetHint(), BM_GUI_NAV_IDLE, BM_GUI_NAV, False); Self.PaintRoundChip(Self.AntibanNav, Self.AntibanNav.GetHint(), BM_GUI_NAV_IDLE, BM_GUI_NAV, False); Self.PaintRoundChip(Self.AIChatNav, Self.AIChatNav.GetHint(), BM_GUI_NAV_IDLE, BM_GUI_NAV, False); Self.PaintRoundChip(selected, selected.GetHint(), BM_GUI_ACCENT, BM_GUI_NAV, True); end; procedure TConfig.ShowSection(section: TPanel; selected: TImage); begin Self.ScriptSection.SetVisible(False); Self.AccountsSection.SetVisible(False); Self.AntibanSection.SetVisible(False); Self.AIChatSection.SetVisible(False); section.SetVisible(True); Self.StyleNav(selected); end; procedure TConfig.ShowScript({$H-}sender: TObject); {$H+} begin Self.ShowSection(Self.ScriptSection, Self.ScriptNav); end; procedure TConfig.ShowAccounts({$H-}sender: TObject); {$H+} begin Self.ShowSection(Self.AccountsSection, Self.AccountsNav); end; procedure TConfig.ShowAntiban({$H-}sender: TObject); {$H+} begin Self.ShowSection(Self.AntibanSection, Self.AntibanNav); end; procedure TConfig.ShowAIChat({$H-}sender: TObject); {$H+} begin Self.ShowSection(Self.AIChatSection, Self.AIChatNav); end; procedure TConfig.StartScript(Sender: TObject); override; begin if Sender = nil then; WLSettings.Put('max_actions', StrToIntDef(Self.MaxActionsInput.GetText(), 0)); WLSettings.Put('max_time', StrToIntDef(Self.MaxTimeInput.GetText(), 0)); WLSettings.SaveConfig(); try Self._WarmBuildCache(); except end; AIChatbot.ApplyFromGUI(); Self.Form.SetOnClose(nil); Self.Form.Close(); end; procedure TConfig.BuildScriptSection(); var hint: TLabel; begin Self.AddHeader(Self.ScriptSection, 'Action', 'Mine barronite and crush deposits at the anvil.'); hint := Self.MakeLabel(Self.ScriptSection, 'Mines barronite rocks, uses the anvil, and banks shards.', 24, 110, 10, BM_GUI_MUTED, False); hint.SetWidth(TControl.AdjustToDPI(820)); hint := Self.MakeLabel(Self.ScriptSection, 'Configure your account and antiban options in the other tabs, then press Start.', 24, 140, 10, BM_GUI_MUTED, False); hint.SetWidth(TControl.AdjustToDPI(820)); end; procedure TConfig.BuildAccountsSection(); var am: TPanel; selectorPanel, userPanel, passPanel, pinPanel, worldsPanel: TPanel; addBtn, deleteBtn, generateBtn: TButton; leftColW, passW, pinW, worldsLeft, btnW, btnGap: Int32; begin Self.AddHeader(Self.AccountsSection, 'Accounts', 'Login account and hop worlds list.'); am := Self.CreateAccountManager(Self.AccountsSection); am.SetLeft(TControl.AdjustToDPI(16)); am.SetTop(TControl.AdjustToDPI(100)); am.SetColor(BM_GUI_BG); leftColW := TControl.AdjustToDPI(280); passW := Floor(leftColW * 0.6); pinW := Floor(leftColW * 0.3); selectorPanel := Self.Form.GetChild('am_selector_panel'); userPanel := Self.Form.GetChild('am_user_panel'); passPanel := Self.Form.GetChild('am_pass_panel'); pinPanel := Self.Form.GetChild('am_pin_panel'); worldsPanel := Self.Form.GetChild('am_worlds_panel'); if selectorPanel <> nil then selectorPanel.SetWidth(leftColW); if userPanel <> nil then userPanel.SetWidth(leftColW); if passPanel <> nil then passPanel.SetWidth(passW); if (pinPanel <> nil) and (selectorPanel <> nil) then begin pinPanel.SetWidth(pinW); pinPanel.SetLeft(selectorPanel.GetLeft() + leftColW - pinW); end; if (worldsPanel <> nil) and (selectorPanel <> nil) then begin worldsLeft := selectorPanel.GetLeft() + leftColW + TControl.AdjustToDPI(48); worldsPanel.SetLeft(worldsLeft); addBtn := Self.Form.GetChild('am_add_button'); deleteBtn := Self.Form.GetChild('am_delete_button'); generateBtn := Self.Form.GetChild('am_generate_worlds_button'); btnGap := TControl.AdjustToDPI(8); btnW := Floor((worldsPanel.GetWidth() - btnGap) / 2); if generateBtn <> nil then begin generateBtn.SetLeft(worldsLeft); generateBtn.SetWidth(worldsPanel.GetWidth()); end; if addBtn <> nil then begin addBtn.SetLeft(worldsLeft); addBtn.SetWidth(btnW); end; if deleteBtn <> nil then begin deleteBtn.SetLeft(worldsLeft + worldsPanel.GetWidth() - btnW - TControl.AdjustToDPI(1)); deleteBtn.SetWidth(btnW); end; end; end; procedure TConfig.BuildAntibanSection(SavedMaxActions, SavedMaxTime: Integer); begin Self.AddHeader(Self.AntibanSection, 'Antiban', 'Session limits.'); Self.AddEdit(Self.AntibanSection, Self.MaxActionsInput, 'le_bm_maxactions', 'Max actions (0 = unlimited)', IntToStr(SavedMaxActions), 24, 110, BM_GUI_EDIT_W); Self.MaxActionsInput.Edit.SetOnKeyPress(@Self.MaxActionsInput.Edit.NumberField); Self.AddEdit(Self.AntibanSection, Self.MaxTimeInput, 'le_bm_maxtime', 'Max time minutes (0 = unlimited)', IntToStr(SavedMaxTime), BM_GUI_COL2, 110, BM_GUI_EDIT_W); Self.MaxTimeInput.Edit.SetOnKeyPress(@Self.MaxTimeInput.Edit.NumberField); end; procedure TConfig.BuildShell(SavedMaxActions, SavedMaxTime: Integer); var tab: TTabSheet; contentH, startW, startH, shellW, shellH, statusTop, statusH, mainLeft, mainW, navW, bottomInset: Int32; begin Self.AddTab('Barronite Miner'); tab := Self.Tabs[High(Self.Tabs)]; Self.Start.SetAlign(alNone); Self.Start.SetVisible(False); Self.Start.SetHeight(0); Self.Start.SetWidth(0); bottomInset := TControl.AdjustToDPI(BM_GUI_BOTTOM_INSET); navW := TControl.AdjustToDPI(BM_GUI_NAV_W); statusH := TControl.AdjustToDPI(BM_GUI_STATUS_H); shellW := Self.Size.X; shellH := Self.Size.Y; mainLeft := navW + TControl.AdjustToDPI(2); mainW := shellW - mainLeft; statusTop := shellH - statusH - bottomInset; contentH := statusTop; startW := TControl.AdjustToDPI(132); startH := TControl.AdjustToDPI(BM_GUI_BTN_H); Self.NavPanel.Create(tab); Self.NavPanel.SetLeft(0); Self.NavPanel.SetTop(0); Self.NavPanel.SetWidth(navW); Self.NavPanel.SetHeight(shellH); Self.NavPanel.SetColor(BM_GUI_NAV); Self.NavPanel.SetBevelOuter(bvNone); Self.DividerPanel.Create(tab); Self.DividerPanel.SetLeft(navW); Self.DividerPanel.SetTop(0); Self.DividerPanel.SetWidth(TControl.AdjustToDPI(2)); Self.DividerPanel.SetHeight(shellH); Self.DividerPanel.SetColor(BM_GUI_DIVIDER); Self.DividerPanel.SetBevelOuter(bvNone); Self.ContentPanel.Create(tab); Self.ContentPanel.SetLeft(mainLeft); Self.ContentPanel.SetTop(0); Self.ContentPanel.SetWidth(mainW); Self.ContentPanel.SetHeight(contentH); Self.ContentPanel.SetColor(BM_GUI_BG); Self.ContentPanel.SetBevelOuter(bvNone); Self.StatusDivider.Create(tab); Self.StatusDivider.SetLeft(mainLeft); Self.StatusDivider.SetTop(statusTop); Self.StatusDivider.SetWidth(mainW); Self.StatusDivider.SetHeight(TControl.AdjustToDPI(2)); Self.StatusDivider.SetColor(BM_GUI_DIVIDER); Self.StatusDivider.SetBevelOuter(bvNone); Self.StatusPanel.Create(tab); Self.StatusPanel.SetLeft(mainLeft); Self.StatusPanel.SetTop(statusTop + Self.StatusDivider.GetHeight()); Self.StatusPanel.SetWidth(mainW); Self.StatusPanel.SetHeight(statusH - Self.StatusDivider.GetHeight()); Self.StatusPanel.SetColor(BM_GUI_STATUS); Self.StatusPanel.SetBevelOuter(bvNone); Self.StatusPad.Create(tab); Self.StatusPad.SetLeft(mainLeft); Self.StatusPad.SetTop(Self.StatusPanel.GetTop() + Self.StatusPanel.GetHeight()); Self.StatusPad.SetWidth(mainW); Self.StatusPad.SetHeight(shellH - Self.StatusPad.GetTop()); Self.StatusPad.SetColor(BM_GUI_STATUS); Self.StatusPad.SetBevelOuter(bvNone); Self.BrandLabel := Self.MakeLabel(Self.NavPanel, 'Barronite Miner', 16, 28, 14, BM_GUI_TEXT, True); Self.MakeLabel(Self.NavPanel, 'BigAussie', 16, 54, 9, BM_GUI_MUTED, False); Self.ScriptNav := Self.MakeNavItem(Self.NavPanel, 'Action', 12, 100, True); Self.AccountsNav := Self.MakeNavItem(Self.NavPanel, 'Accounts', 12, 152); Self.AntibanNav := Self.MakeNavItem(Self.NavPanel, 'Antiban', 12, 204); Self.AIChatNav := Self.MakeNavItem(Self.NavPanel, 'AI Chat', 12, 256); Self.ScriptSection := Self.MakePanel(Self.ContentPanel, 0, 0, 100, 100, BM_GUI_BG); Self.AccountsSection := Self.MakePanel(Self.ContentPanel, 0, 0, 100, 100, BM_GUI_BG); Self.AntibanSection := Self.MakePanel(Self.ContentPanel, 0, 0, 100, 100, BM_GUI_BG); Self.AIChatSection := Self.MakePanel(Self.ContentPanel, 0, 0, 100, 100, BM_GUI_BG); Self.ScriptSection.SetWidth(mainW); Self.ScriptSection.SetHeight(contentH); Self.AccountsSection.SetWidth(mainW); Self.AccountsSection.SetHeight(contentH); Self.AntibanSection.SetWidth(mainW); Self.AntibanSection.SetHeight(contentH); Self.AIChatSection.SetWidth(mainW); Self.AIChatSection.SetHeight(contentH); Self.BuildScriptSection(); Self.BuildAccountsSection(); Self.BuildAntibanSection(SavedMaxActions, SavedMaxTime); AIChatbot.BuildSettings(Self.AIChatSection, mainW); Self.ScriptNav.SetOnClick(@Self.ShowScript); Self.AccountsNav.SetOnClick(@Self.ShowAccounts); Self.AntibanNav.SetOnClick(@Self.ShowAntiban); Self.AIChatNav.SetOnClick(@Self.ShowAIChat); Self.StartChip.Create(Self.StatusPanel); Self.StartChip.SetLeft(mainW - startW - TControl.AdjustToDPI(24)); Self.StartChip.SetTop((Self.StatusPanel.GetHeight() - startH) div 2 + 2); Self.StartChip.SetWidth(startW); Self.StartChip.SetHeight(startH); Self.StartChip.SetCursor(crHandPoint); Self.PaintRoundChip(Self.StartChip, 'Start', BM_GUI_START, BM_GUI_STATUS, True, True); Self.StartChip.SetOnClick(@Self.StartScript); Self.ShowScript(Self.ScriptNav); end; procedure TConfig.Run(); override; var SavedMaxActions, SavedMaxTime: Integer; begin BashPromptIfUpdateAvailable(); if WLSettings.Has('max_actions') then SavedMaxActions := WLSettings.GetInt('max_actions') else SavedMaxActions := 0; if WLSettings.Has('max_time') then SavedMaxTime := WLSettings.GetInt('max_time') else SavedMaxTime := 0; AIChatbot.Setup('Gemini', ''); AIChatbot.Enabled := False; AIChatbot.LoadSettings(); AIChatbot.SetScriptDefaults('mining barronite'); Self.Setup('BigAussies Barronite Miner', [BM_GUI_W, BM_GUI_H], False); Self.BuildShell(SavedMaxActions, SavedMaxTime); inherited; end; var Config: TConfig; {$ENDIF} begin {$IFDEF SCRIPT_GUI} Sync(@Config.Run); {$ENDIF} Script.Run(WLSettings.MaxActions, WLSettings.MaxTime); end.