Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Botbases/RSBot.Training/Bundle/Loop/LoopBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace RSBot.Training.Bundle.Loop;

internal class LoopBundle : IBundle
{
private System.DateTime _lastAutopathAttempt = System.DateTime.MinValue;

/// <summary>
/// Gets the configuration.
/// </summary>
Expand Down Expand Up @@ -78,6 +80,7 @@ public void Stop()
ShoppingManager.Stop();

Running = false;
_lastAutopathAttempt = System.DateTime.MinValue;
}

/// <summary>
Expand Down Expand Up @@ -165,6 +168,14 @@ public void CheckForWalkbackScript(bool startFromTown = false)

if (Config.WalkScript == null || !File.Exists(Config.WalkScript))
{
if (Container.Bot.Area.Position.DistanceToPlayer() <= Container.Bot.Area.Radius + 50)
return;

if (System.DateTime.UtcNow - _lastAutopathAttempt < System.TimeSpan.FromSeconds(30))
return;

_lastAutopathAttempt = System.DateTime.UtcNow;

Log.Notify("No walkback script found. Attempting to generate a dynamic path...");
if (NavigationManager.CalculatePathToTrainingArea())
{
Expand Down
4 changes: 2 additions & 2 deletions Botbases/RSBot.Training/TrainingBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using RSBot.Core;
using RSBot.Core.Components;
using RSBot.Core.Objects;
Expand Down Expand Up @@ -34,7 +34,7 @@ public void Tick()
return;

//Begin the loopback if needed
if (Container.Bot.Area.Position.DistanceToPlayer() > 80)
if (Container.Bot.Area.Position.DistanceToPlayer() > Container.Bot.Area.Radius + 50)
Bundles.Loop.Start();

if (Bundles.Loop.Running)
Expand Down
Loading