using System;
namespace RynthCore.Plugin.RynthAi.ItemInfo;
///
/// Items RynthAi selects by itself (the looter picking an item up, a meta's selectitem), so the
/// selection-change handler can tell them from the player's own clicks: Item Info on select
/// prints only for the player's. goes right before Host.SelectItem.
///
internal static class SelfSelect
{
/// A selection change this soon after , for the same id, is ours.
internal const long WindowMs = 2000;
internal static Func Clock = () => Environment.TickCount64;
private static uint _id;
private static long _at;
internal static void Mark(uint id)
{
_at = Clock();
_id = id;
}
internal static bool IsOurs(uint id) => id != 0 && id == _id && Clock() - _at <= WindowMs;
}