59 lines
2.4 KiB
C
59 lines
2.4 KiB
C
// HQ administration belongs to AI; Core sees only ERR_AdminProvider.
|
|
class ERR_HQAdminProvider : ERR_AdminProvider
|
|
{
|
|
protected ERR_HQ m_HQ;
|
|
void ERR_HQAdminProvider(ERR_HQ hq) { m_HQ = hq; }
|
|
override string Id() { return "hq"; }
|
|
override void Capabilities(array<string> values) { values.Insert("supports=hq"); }
|
|
override string Setting(string section, string option)
|
|
{
|
|
if (section != "hq") return "";
|
|
if (option == "interval") return "reportIntervalSeconds";
|
|
if (option == "squads") return "supportSquadLimit";
|
|
if (option == "radius") return "responseRadiusMetres";
|
|
if (option == "stinger") return "stingerChanceOneIn";
|
|
return "";
|
|
}
|
|
override int JournalSequence()
|
|
{
|
|
if (!m_HQ || !m_HQ.Journal()) return -1;
|
|
return m_HQ.Journal().Sequence();
|
|
}
|
|
override bool ReadJournal(int after, array<string> lines, out int cursor, int limit = 8)
|
|
{
|
|
if (!m_HQ || !m_HQ.Journal()) return false;
|
|
m_HQ.Journal().Read(after, lines, cursor, limit);
|
|
return true;
|
|
}
|
|
override bool Execute(ERR_GameMode mode, string arguments, array<string> replies)
|
|
{
|
|
if (arguments != "status" && arguments != "hq show" && arguments != "hq log" && arguments != "hq memory" && arguments != "hq convoy show" && arguments != "hq convoy start") return false;
|
|
if (!m_HQ) { replies.Insert("HQ unavailable."); return true; }
|
|
if (arguments == "hq convoy start")
|
|
{
|
|
m_HQ.StartScenarioConvoy();
|
|
replies.Insert(m_HQ.ConvoyStatus());
|
|
return true;
|
|
}
|
|
if (arguments == "hq convoy show") { replies.Insert(m_HQ.ConvoyStatus()); return true; }
|
|
if (arguments == "hq memory") { m_HQ.MemoryStatus(replies); return true; }
|
|
if (arguments == "hq show" || arguments == "status") replies.Insert(m_HQ.Status());
|
|
else
|
|
{
|
|
int cursor;
|
|
ReadJournal(Math.Max(0, JournalSequence() - 8), replies, cursor);
|
|
if (replies.IsEmpty()) replies.Insert("HQ journal is empty.");
|
|
}
|
|
return true;
|
|
}
|
|
override bool Help(string topic, array<string> replies)
|
|
{
|
|
if (topic != "hq") return false;
|
|
replies.Insert("/esc hq show | hq memory | hq log show|next|set on|off | hq convoy show|start");
|
|
replies.Insert("/esc hq interval|squads|radius|stinger show|set N");
|
|
replies.Insert("Stinger: 0 off, 1 every eligible soldier, 2..10000 one in N; applies only before each actor rolls.");
|
|
replies.Insert("HQ assigns available physical squads through delivered reports. Convoy start uses the single finite initial deployment; losses are not replaced.");
|
|
return true;
|
|
}
|
|
}
|