Skip to content

Commit

Permalink
attempted fix to #2
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnpascual committed Mar 28, 2023
1 parent 1499360 commit 8f0e19e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ToF_Fishing_Bot/FishingThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class FishingThread
private bool APressed = false;
private bool DPressed = false;

private bool PlayerStamina_lagCompensationDone = false;
private DispatcherTimer LagCompensationDelay;

private System.Windows.Media.Color green = System.Windows.Media.Color.FromArgb(255, 0, 255, 0);

/*private System.Drawing.Point upperLeftSource;
Expand Down Expand Up @@ -158,10 +161,21 @@ public void Start()
switch (state)
{
case FishingState.NotFishing:
if (fishStaminaDetected && playerStaminaDetected) state = FishingState.Fishing;
if (fishStaminaDetected && playerStaminaDetected) {
state = FishingState.Fishing;
PlayerStamina_lagCompensationDone = false;
LagCompensationDelay = new DispatcherTimer(DispatcherPriority.Send, dis);
LagCompensationDelay.Interval = new TimeSpan(0,0,0,5);
LagCompensationDelay.Tick += (o, e) =>
{
PlayerStamina_lagCompensationDone = true;
LagCompensationDelay.Stop();
};
LagCompensationDelay.Start();
}
break;
case FishingState.Fishing:
if (!fishStaminaDetected && playerStaminaDetected)
if (!fishStaminaDetected && playerStaminaDetected && PlayerStamina_lagCompensationDone)
{
state = FishingState.ReelingStart;
ReelDelay = new DispatcherTimer(DispatcherPriority.Send, dis);
Expand Down

0 comments on commit 8f0e19e

Please sign in to comment.