Properly update last action times in Idle Notifier

- Properly update last action times in Idle Notifier right after the
action is changed/updated.
- Do not reset lastCombatCountdown in resetTimers()

Supersedes/closes #6241
Extracted from #5369

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-10-29 10:11:36 +01:00
parent 62cbc776da
commit 6515174e18
2 changed files with 9 additions and 4 deletions

View File

@@ -214,19 +214,23 @@ public class IdleNotifierPlugin extends Plugin
case SAND_COLLECTION:
resetTimers();
lastAnimation = animation;
lastAnimating = Instant.now();
break;
case MAGIC_LUNAR_SHARED:
if (graphic == GraphicID.BAKE_PIE)
{
resetTimers();
lastAnimation = animation;
lastAnimating = Instant.now();
break;
}
case IDLE:
lastAnimating = Instant.now();
break;
default:
// On unknown animation simply assume the animation is invalid and dont throw notification
lastAnimation = IDLE;
lastAnimating = null;
}
}
@@ -246,6 +250,10 @@ public class IdleNotifierPlugin extends Plugin
{
lastInteract = null;
}
else
{
lastInteracting = Instant.now();
}
final boolean isNpc = target instanceof NPC;
@@ -264,6 +272,7 @@ public class IdleNotifierPlugin extends Plugin
// Player is most likely in combat with attack-able NPC
resetTimers();
lastInteract = target;
lastInteracting = Instant.now();
}
}
@@ -553,9 +562,6 @@ public class IdleNotifierPlugin extends Plugin
{
final Player local = client.getLocalPlayer();
// Reset combat idle timer
lastCombatCountdown = 0;
// Reset animation idle timer
lastAnimating = null;
if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getAnimation() != lastAnimation)

View File

@@ -155,7 +155,6 @@ public class IdleNotifierPluginTest
AnimationChanged animationChanged = new AnimationChanged();
animationChanged.setActor(player);
plugin.onAnimationChanged(animationChanged);
plugin.onInteractingChanged(new InteractingChanged(player, monster));
plugin.onGameTick(new GameTick());
// Logout