namespace RynthCore.Plugin.RynthAi;
///
/// Patrol On Login and Hunt On Login (2026-11-11): what starts once the character is in the world.
/// The two are one choice: ticking one clears the other (). A profile that has
/// both on anyway (edited by hand, or from a sender that only knows one of them) gets the one that
/// fits where the character is: the Dungeon Patrol in a dungeon, the Outdoor Hunt outdoors
/// (). Both turn the macro on themselves, so Start Macro On Login isn't needed.
/// Pure, for the tests.
///
internal static class LoginAutoStart
{
internal enum Start { None, Patrol, Hunt }
internal const string HuntOnLoginTip =
"Starts the Outdoor Hunt from where you are once you're in the world (and the macro with it).\n" +
"In a dungeon, or without RynthNav: it doesn't start, and says why in chat.\n" +
"One or the other: ticking it clears Patrol On Login.";
/// What runs at login. only matters with both on.
internal static Start Choose(bool patrolOnLogin, bool huntOnLogin, bool inDungeon) =>
patrolOnLogin && huntOnLogin ? (inDungeon ? Start.Patrol : Start.Hunt)
: patrolOnLogin ? Start.Patrol
: huntOnLogin ? Start.Hunt
: Start.None;
///
/// The two boxes after a change: the one just turned on wins and the other goes off. Both turned
/// on in one change (no way to tell which was meant): the patrol, as before Hunt On Login existed.
/// Turning one off leaves the other as it was.
///
internal static (bool Patrol, bool Hunt) Exclusive(bool wasPatrol, bool wasHunt, bool patrol, bool hunt)
{
bool patrolTurnedOn = patrol && !wasPatrol;
bool huntTurnedOn = hunt && !wasHunt;
if (patrolTurnedOn) return (true, false);
if (huntTurnedOn) return (false, true);
return (patrol, hunt);
}
}