52 lines
2.0 KiB
C
52 lines
2.0 KiB
C
// Companion-specific commands extend Core's authenticated transport.
|
|
modded class ERR_AdminService
|
|
{
|
|
protected override string Setting(string section, string option)
|
|
{
|
|
if (section == "hq")
|
|
{
|
|
if (option == "interval") return "reportIntervalSeconds";
|
|
if (option == "squads") return "supportSquadLimit";
|
|
if (option == "radius") return "responseRadiusMetres";
|
|
}
|
|
if (section == "intel")
|
|
{
|
|
if (option == "carrying") return "aiIntelChancePercent";
|
|
}
|
|
return super.Setting(section, option);
|
|
}
|
|
protected override bool Extension(ERR_GameMode mode, string arguments, array<string> replies)
|
|
{
|
|
if (arguments == "intel show")
|
|
{
|
|
replies.Insert("aiIntelChancePercent=" + mode.Settings().Get("aiIntelChancePercent").ToString());
|
|
replies.Insert("intelRevealChancePercent=" + mode.Settings().Get("intelRevealChancePercent").ToString());
|
|
return true;
|
|
}
|
|
if (arguments == "intel reroll" || arguments == "intel reroll show")
|
|
{
|
|
ERR_IntelService intel = mode.Intel();
|
|
if (!intel) { replies.Insert("Intel service unavailable."); return true; }
|
|
if (arguments == "intel reroll" && !intel.BeginReroll())
|
|
replies.Insert("Intel reroll could not start. It requires an active round and no running reroll.");
|
|
replies.Insert(intel.RerollStatus());
|
|
return true;
|
|
}
|
|
if (arguments != "status" && arguments != "hq show" && arguments != "hq log") return super.Extension(mode, arguments, replies);
|
|
ERR_HQ hq = ERR_HQ.Cast(mode.Command());
|
|
if (!hq) { replies.Insert("HQ unavailable"); return true; }
|
|
if (arguments == "hq show" || arguments == "status") replies.Insert(hq.Status());
|
|
else
|
|
{
|
|
int cursor;
|
|
hq.Journal().Read(Math.Max(0, hq.Journal().Sequence() - 8), replies, cursor);
|
|
if (replies.IsEmpty()) replies.Insert("HQ journal is empty.");
|
|
}
|
|
return true;
|
|
}
|
|
protected override string Help()
|
|
{
|
|
return super.Help() + " | hq show|log | hq interval|squads|radius show|set N | intel show | intel carrying show|set N | intel reroll [show]";
|
|
}
|
|
}
|