// IltFellowshipCommands.cs - Infinite Leaftide's fellowship chat commands (ACECustom /fship).
//
// ACECustom (Source/ACE.Server/Command/Handlers/PlayerCommands.cs, "fship") adds these on top
// of retail's fellowship panel; its fellowships hold up to 29 (Fellowship.MaxFellows). The list
// is kept in the shared "servercommands" form (Plugins/Shared/ServerCommandShare.cs) and drawn by
// RynthILT's fellowship window (IltFellowshipUi, "/ilt fellow").
// A name with spaces is sent quoted; ACE's command parser joins "two words". Pure: no ImGui, no host.
using System;
using System.Collections.Generic;
using RynthCore.Plugin.Shared;
namespace RynthCore.Plugin.RynthILT.IltFellowship;
internal static class IltFellowshipCommands
{
/// The RynthCore section the commands belong to.
public const string Section = "fellowship";
/// RynthCore's server id for Infinite Leaftide.
public const string ServerId = "ilt";
/// The server's display name.
public const string ServerName = "Infinite Leaftide";
/// ACECustom's fellowship size (Fellowship.MaxFellows; retail is 9).
public const int MaxFellows = 29;
/// The /fship commands, in button order.
public static readonly IReadOnlyList Commands = new[]
{
new ServerCommand("Create", "/fship create", "A",
"Create a fellowship with the name in the box (you lead it). Up to " + MaxFellows + " members on ILT."),
new ServerCommand("Invite", "/fship add", "a",
"Invite the player named in the box, or your selected player when the box is empty."),
new ServerCommand("Dismiss", "/fship remove", "ac",
"Leader: remove the player named in the box, or your selected player when the box is empty."),
new ServerCommand("Invite landblock", "/fship landblock", "c",
"Invite every player in your landblock (not in the Marketplace). Over level 50, only level 50+ players are invited."),
new ServerCommand("List nearby", "/fship list", "",
"The fellowships in your area and their leaders (wider in VOD and T10). Once every 10 seconds."),
new ServerCommand("Leave", "/fship leave", "c",
"Leave your fellowship."),
new ServerCommand("Disband", "/fship disband", "c",
"Leader: disband your fellowship."),
new ServerCommand("Help", "/fship", "",
"The server's /fship help."),
};
/// The set while ILT is active; with no commands when it isn't (a receiver drops it).
public static ServerCommandSet Set(bool active) =>
new(Section, ServerId, ServerName, active ? Commands : Array.Empty());
/// The "servercommands" payload for .
public static string Payload(bool active) => ServerCommandShare.Build(Set(active));
///
/// ILT is active: RynthCore's verdict once it has sent one (),
/// else the world name has "Leaftide" in it (RynthCore's default ILT names).
///
public static bool IsActive(bool? engineActive, string? worldName) =>
engineActive ?? (worldName ?? string.Empty).IndexOf("Leaftide", StringComparison.OrdinalIgnoreCase) >= 0;
}