Hold Shift and C keys to open the console in the game.
Scenario-only
#videomode <on/off>
hides/shows the UI
// useful to create screenshots with default F9-key
#followcam <on/off>
camera follows (/not) selected unit
// game freezes during AI-turn, so better don't use it
#freecam <on/off>
camera doesn't/does follow AI-actions
#hidedamage <on/off>
hides/shows floating damage-numbers
#igotnukes
instant (major) victory
// note that you can still miss objective-related rewards
#whiteflag
instant defeat
#orbitalcommand
disables fog-of-war
// not only for the Human-player, but also for allied and enemy AI-players
#johnconnor
disables AI
// AI-turns are basically skipped
#iamback
enables AI
// re-enables AI-turns should it be turned-off by #johnconnor
#warbonds <RP>
adds either 500 RP by default or specific <RP> (Resource Points) to own and allied factions
you can use negative numbers to substract RPs
#income <PR>
adds <RP> (Resource Points) income per turn to own and allied factions
#shockandawe
unlocks land-commander "Lieutenant Lena"
// ultimately shocks the enemy for every faction
#officerondeck <id>
unlocks commander <id>
// check commanders.txt for the id-numbers
#overtime <turns>
adds either 10 turns by default or specific <turns> to the scenario turn-limit
#variable <name> <number>
sets scenario-variables
// variable-names are best checked with the scenario-editor
#landcp <CP>
adds either 10 by default or specific Land-<CP> (Command Points)
#navalcp <CP>
adds either 10 by default or specific Naval-<CP> (Command Points)
#aircp <CP>
adds either 10 by default or specific Air-<CP> (Command Points)
#puppetmaster
supposedly takes control of all allied AI-factions?
// couldn't see this working yet
#stimpack <strength>
sets selected unit to either 1 strength by default or specific <strength>; 100 = 10, while 200 = 20 max.
// new strength is only updated after combat or ending the turn
#setaiteam <number>
sets selected unit to AI-Team <number>
// requires to check numbers with the scenario-editor what exactly which AI-behavior does in the specific scenario
#beammeup
undeploys selected unit to the Force-pool
// also works on enemy units
#ragequit
kills selected unit
// also works on own units
#trigger <number>
runs scenario-trigger <number>
// difficult to check in the scenario-editor as there are no numbers shown, but some are shown in the text_*.txt files of scenarios
#quackquack
spawns a "Rubber Duck" naval-unit on selected hex
// attack-animation is bugged, so better don't use it
Campaign-only
#variable <name> <number>
sets campaign-variables
// variable-names can usually be checked in text_*.txt of a campaign as tooltip, but more accurately with the scenario-editor
#epiphany <SP>
sets either 100 by default or specific <SP> (Specialisation Points) in the campaign's Specialisations-menu
#timetravel <?>
supposedly advances the campaign-date?
// unknown how it works, as it doesn't seem to affect the spec-tree's or the following scenario's date
Editor-only
#crop <new_width> <new_height> <offset_x> <offset_y>
changes map-size in the scenario-editor
// useful to modify the sizes of existing scenario-maps
#copyterrain
?
// unknown how it works
#dlc
?
// this better stays unknown
#stats
?
// something about faction-settings and unknown how it works
Main-menu only
#gimmeall
unlocks all campaign-scenarios to play as single-scenarios
#patch <x>
loads a game-update
// this used to work once upon a time for a single patch, but possible isn't supported and shouldn't be used anymore before someone messes up the game
#seed
?
// possible intended for a SP-skirmish mode that hasn't seen the light yet
#news <number>
displays news-article <number>; currently 1-20 possible with 7.1.4
// interesting to check on old game-update news
Misc
#counters
replaces unit 3d-models with 2d-counters
// counters look distorted and will freeze the game, so better don't use it
#host
multiplayer-host function?
// unknown how exactly it works and if at all
#join
multiplayer-client function?
// unknown how exactly it works and if at all
Code: Select all
public bool HandleCheat(string cheat)
{
Dictionary<Faction, int> factions;
string[] strArrays = cheat.Split(new char[] { " "[0] });
if (App.mode == App.modes.scenario)
{
if (strArrays[0] == "#videomode")
{
if ((int)strArrays.Length != 2)
{
App.map.cameraControl.videoMode = true;
App.map.cameraControl.freeCamera = true;
App.map.effectManager.damageEffectDisabled = true;
GeneralUI.gameUI.UItemplate.Hide();
GeneralUI.gameUI.minimap.visible = false;
}
else if (strArrays[1].Trim() == "on")
{
App.map.cameraControl.videoMode = true;
App.map.cameraControl.freeCamera = true;
App.map.effectManager.damageEffectDisabled = true;
GeneralUI.gameUI.UItemplate.Hide();
GeneralUI.gameUI.minimap.visible = false;
}
else if (strArrays[1].Trim() == "off")
{
App.map.cameraControl.videoMode = false;
App.map.cameraControl.freeCamera = false;
App.map.effectManager.damageEffectDisabled = false;
GeneralUI.gameUI.UItemplate.Show();
GeneralUI.gameUI.minimap.visible = true;
}
return true;
}
if (strArrays[0] == "#followcam")
{
Unit unitById = GeneralUI.gameUI.selectedUnit;
if (unitById == null)
{
int num = -1;
if ((int)strArrays.Length == 2)
{
int.TryParse(strArrays[1], out num);
}
if (num != -1)
{
unitById = App.game.scenario.GetUnitById(num, App.game.actualGameState);
App.map.cameraControl.followUnit = unitById.id;
return true;
}
App.map.cameraControl.followUnit = -1;
}
if ((int)strArrays.Length != 2)
{
App.map.cameraControl.followUnit = unitById.id;
}
else if (strArrays[1].Trim() == "on")
{
App.map.cameraControl.followUnit = unitById.id;
}
else if (strArrays[1].Trim() == "off")
{
App.map.cameraControl.followUnit = -1;
}
return true;
}
if (strArrays[0] == "#freecam")
{
if ((int)strArrays.Length != 2)
{
App.map.cameraControl.freeCamera = true;
}
else if (strArrays[1].Trim() == "on")
{
App.map.cameraControl.freeCamera = true;
}
else if (strArrays[1].Trim() == "off")
{
App.map.cameraControl.freeCamera = false;
}
return true;
}
if (strArrays[0] == "#hidedamage")
{
if ((int)strArrays.Length != 2)
{
App.map.effectManager.damageEffectDisabled = true;
}
else if (strArrays[1].Trim() == "on")
{
App.map.effectManager.damageEffectDisabled = true;
}
else if (strArrays[1].Trim() == "off")
{
App.map.effectManager.damageEffectDisabled = false;
}
return true;
}
if (App.game.gameType == App.gameTypes.SP || Application.isEditor)
{
CursorActions.SetSelectedUnit(null);
if (strArrays[0] == "#igotnukes")
{
App.game.scenario.giveWin = true;
ActionManager.AddAction(new RandomSeedAction((int)DateTime.Now.Ticks));
ActionManager.AddAction(new EndPhaseAction());
return true;
}
if (strArrays[0] == "#whiteflag")
{
App.game.scenario.outcome = 0;
GeneralUI.gameUI.OnGameOver();
return true;
}
if (strArrays[0] == "#orbitalcommand")
{
App.game.scenario.noFoW = true;
GameLOS.RevealAll(App.game.scenario.playerAlliance, App.game.actualGameState);
App.map.FoW.Update();
return true;
}
if (strArrays[0] == "#johnconnor")
{
AI.disabled = true;
return true;
}
if (strArrays[0] == "#iamback")
{
AI.disabled = false;
return true;
}
if (strArrays[0] == "#warbonds")
{
int num1 = 500;
if ((int)strArrays.Length > 1)
{
int.TryParse(strArrays[1], out num1);
}
Faction factionByName = null;
if ((int)strArrays.Length == 3)
{
factionByName = App.game.scenario.GetFactionByName(strArrays[2]);
}
if (factionByName == null)
{
foreach (Faction faction in App.game.scenario.playerAlliance.factions)
{
faction.AddResources(num1, App.game.actualGameState);
}
}
else
{
factionByName.AddResources(num1, App.game.actualGameState);
}
return true;
}
if (strArrays[0] == "#income")
{
int num2 = 10;
if ((int)strArrays.Length == 2)
{
int.TryParse(strArrays[1], out num2);
}
foreach (Faction faction1 in App.game.scenario.playerAlliance.factions)
{
faction1.AddIncome(num2, App.game.actualGameState);
}
return true;
}
if (strArrays[0] == "#shockandawe")
{
GameCommanders.UnlockCommander(App.GetCommanderTypeById(61), App.game.scenario.playerAlliance.factions[0], App.game.actualGameState);
return true;
}
if (strArrays[0] == "#officerondeck")
{
int num3 = -1;
if ((int)strArrays.Length != 2)
{
return false;
}
int.TryParse(strArrays[1], out num3);
Faction item = App.game.scenario.playerAlliance.factions[0];
if ((int)strArrays.Length == 3 && App.game.scenario.GetFactionByName(strArrays[2]) == null)
{
return false;
}
GameCommanders.UnlockCommander(App.GetCommanderTypeById(num3), App.game.scenario.playerAlliance.factions[0], App.game.actualGameState);
return true;
}
if (strArrays[0] == "#overtime")
{
int num4 = 10;
if ((int)strArrays.Length == 2)
{
int.TryParse(strArrays[1], out num4);
}
App.game.scenario.turnLimit += num4;
return true;
}
if (strArrays[0] == "#variable")
{
App.game.scenario.SetCampaignVariable(strArrays[1], int.Parse(strArrays[2]));
return true;
}
if (strArrays[0] == "#landcp")
{
int num5 = 10;
if ((int)strArrays.Length == 2)
{
int.TryParse(strArrays[1], out num5);
}
foreach (Faction item1 in App.game.scenario.playerAlliance.factions)
{
item1.SetState(App.game.actualGameState).command[0] = item1.state.command[0] + num5;
GeneralUI.gameUI.OnCommandPointsChange(item1, num5);
}
return true;
}
if (strArrays[0] == "#navalcp")
{
int num6 = 10;
if ((int)strArrays.Length == 2)
{
int.TryParse(strArrays[1], out num6);
}
foreach (Faction faction2 in App.game.scenario.playerAlliance.factions)
{
faction2.SetState(App.game.actualGameState).command[1] = faction2.state.command[1] + num6;
GeneralUI.gameUI.OnCommandPointsChange(faction2, num6);
}
return true;
}
if (strArrays[0] == "#aircp")
{
int num7 = 10;
if ((int)strArrays.Length == 2)
{
int.TryParse(strArrays[1], out num7);
}
foreach (Faction item2 in App.game.scenario.playerAlliance.factions)
{
item2.SetState(App.game.actualGameState).command[2] = item2.state.command[2] + num7;
GeneralUI.gameUI.OnCommandPointsChange(item2, num7);
}
return true;
}
if (strArrays[0] == "#puppetmaster")
{
App.scenarioController.controlAllAlliances = true;
return true;
}
if (strArrays[0] == "#stimpack")
{
int num8 = 10;
if ((int)strArrays.Length == 2 && int.TryParse(strArrays[1], out num8))
{
num8 *= 10;
}
Unit unit = null;
if (GeneralUI.gameUI.selectedUnit != null)
{
unit = GeneralUI.gameUI.selectedUnit;
}
else if (GeneralUI.gameUI.selectedHex != null)
{
unit = GeneralUI.gameUI.selectedHex.state.units[App.map.fieldView] ?? GeneralUI.gameUI.selectedHex.state.units[1 - App.map.fieldView];
}
if (unit != null)
{
unit.SetState(App.game.actualGameState).strength = num8;
if (unit.state.strength > 200)
{
unit.SetState(App.game.actualGameState).strength = 200;
}
}
return true;
}
if (strArrays[0] == "#setaiteam")
{
Unit aiTeamById = null;
if (GeneralUI.gameUI.selectedUnit != null)
{
aiTeamById = GeneralUI.gameUI.selectedUnit;
}
else if (GeneralUI.gameUI.selectedHex != null)
{
aiTeamById = GeneralUI.gameUI.selectedHex.state.units[App.map.fieldView] ?? GeneralUI.gameUI.selectedHex.state.units[1 - App.map.fieldView];
}
if (aiTeamById == null || (int)strArrays.Length <= 1)
{
return false;
}
aiTeamById.state.team = AI.GetAiTeamById(int.Parse(strArrays[1]));
Debug.Log(string.Concat("Unit ", aiTeamById.state.unitType.name, " set to ", aiTeamById.state.team.name));
return true;
}
if (strArrays[0] == "#beammeup")
{
Unit unit1 = null;
if (GeneralUI.gameUI.selectedUnit != null)
{
unit1 = GeneralUI.gameUI.selectedUnit;
}
else if (GeneralUI.gameUI.selectedHex != null)
{
unit1 = GeneralUI.gameUI.selectedHex.state.units[App.map.fieldView] ?? GeneralUI.gameUI.selectedHex.state.units[1 - App.map.fieldView];
}
if (unit1 != null)
{
unit1.Undeploy(App.game.actualGameState);
}
return true;
}
if (strArrays[0] == "#ragequit")
{
Unit unit2 = null;
if (GeneralUI.gameUI.selectedUnit != null)
{
unit2 = GeneralUI.gameUI.selectedUnit;
}
else if (GeneralUI.gameUI.selectedHex != null)
{
unit2 = GeneralUI.gameUI.selectedHex.state.units[App.map.fieldView] ?? GeneralUI.gameUI.selectedHex.state.units[1 - App.map.fieldView];
}
if (unit2 != null)
{
bool flag = unit2.IsDeployed();
unit2.Die(App.game.actualGameState);
if (flag)
{
(new List<List<int>>()).Add(new List<int>()
{
unit2.id
});
Map.GetAnimationControl().SetAnimationSequence(AnimationControl.Types.die, !unit2.state.hex.state.IsVisible(App.game.scenario.playerAlliance), unit2, null, Map.GetAnimationControl().currentSequence);
GeneralUI.gameUI.OnUnitDeath(unit2, unit2.state.carriedBy, unit2.state.hex);
}
}
return true;
}
if (strArrays[0] == "#trigger")
{
if ((int)strArrays.Length > 1)
{
if (strArrays[1] != "list")
{
int num9 = -1;
int.TryParse(strArrays[1], out num9);
string lower = strArrays[1].Trim().ToLower();
Trigger trigger = null;
foreach (Trigger trigger1 in App.game.scenario.triggers)
{
if (trigger1.id != num9 && !(trigger1.name.ToLower() == lower))
{
continue;
}
trigger = trigger1;
break;
}
if (trigger != null)
{
Debug.Log(string.Concat("Executing trigger: ", trigger.name));
trigger.Execute(Trigger.events.any);
return true;
}
}
else
{
foreach (Trigger trigger2 in App.game.scenario.triggers)
{
string str = string.Concat(new object[] { "[", trigger2.id, "] ", trigger2.name });
if (trigger2.active)
{
str = string.Concat(str, " [active]");
}
Debug.Log(str);
}
}
}
}
else if (strArrays[0] == "#quackquack")
{
if (!LockedModels.IsValid_RubberDuck())
{
return false;
}
Actions.PurchaseUnit(App.game.scenario.playerAlliance.factions[0], App.GetUnitTypeByName("floating_device"), null, -1);
Hex hex = GeneralUI.gameUI.selectedHex;
if (hex != null && hex.state.units[0] == null && hex.GetTerrainType().IsUnfrozenWater(App.game.actualGameState))
{
Unit item3 = App.game.scenario.playerAlliance.factions[0].state.units[App.game.scenario.playerAlliance.factions[0].state.units.Count - 1];
Actions.DeployUnit(item3, hex);
}
return true;
}
}
}
else if (App.mode == App.modes.campaign)
{
if (strArrays[0] == "#variable")
{
App.game.campaign.SetVariable(strArrays[1], int.Parse(strArrays[2]));
return true;
}
if (strArrays[0] == "#epiphany")
{
int num10 = 100;
if ((int)strArrays.Length > 1)
{
int.TryParse(strArrays[1], out num10);
}
foreach (Faction faction3 in App.game.campaign.cores[0].factions)
{
faction3.specialisationPoints = num10;
}
GeneralUI.campaignUI.specialisationPanel.SelectFaction(App.game.campaign.cores[0].factions[0]);
return true;
}
if (strArrays[0] == "#timetravel" && (int)strArrays.Length > 1)
{
int num11 = 1;
int.TryParse(strArrays[1], out num11);
App.game.campaign.currentDate.AdvanceDays((float)(num11 * 356));
return true;
}
}
else if (App.mode == App.modes.editor)
{
if (strArrays[0] == "#crop")
{
CropMap.Crop(int.Parse(strArrays[1]), int.Parse(strArrays[2]), int.Parse(strArrays[3]), int.Parse(strArrays[4]), GeneralUI.editorUI.newMapPanel.defaultTerrain);
return true;
}
if (strArrays[0] == "#copyterrain")
{
CopyTerrain.Copy(strArrays[1], string.Concat(App.docsFolder, "Scenarios/"), (strArrays[2] != "true" ? false : true));
return true;
}
if ((App.developer || Application.isEditor) && strArrays[0] == "#dlc")
{
App.game.content = ContentManager.GetContentByName(strArrays[1].Trim());
return true;
}
if (strArrays[0] == "#stats")
{
Dictionary<Faction, int> factions1 = new Dictionary<Faction, int>();
Dictionary<Faction, int> factions2 = new Dictionary<Faction, int>();
Dictionary<Faction, int> factions3 = new Dictionary<Faction, int>();
Dictionary<Faction, int> factions4 = new Dictionary<Faction, int>();
foreach (Faction faction4 in App.game.scenario.factions)
{
factions2.Add(faction4, 0);
factions1.Add(faction4, 0);
factions3.Add(faction4, 0);
factions4.Add(faction4, 0);
foreach (Unit unit3 in faction4.state.units)
{
if (unit3.core == -1)
{
Dictionary<Faction, int> item4 = factions1;
factions = item4;
Faction faction5 = faction4;
Faction faction6 = faction5;
item4[faction5] = factions[faction6] + GameProduction.GetUnitCost(unit3, App.game.actualGameState);
Dictionary<Faction, int> item5 = factions3;
factions = item5;
Faction faction7 = faction4;
Faction faction8 = faction7;
item5[faction7] = factions[faction8] + unit3.GetCommandCost(App.game.actualGameState);
}
else
{
Dictionary<Faction, int> factions5 = factions2;
factions = factions5;
Faction faction9 = faction4;
Faction faction10 = faction9;
factions5[faction9] = factions[faction10] + GameProduction.GetUnitCost(unit3, App.game.actualGameState);
Dictionary<Faction, int> item6 = factions4;
factions = item6;
Faction faction11 = faction4;
Faction faction12 = faction11;
item6[faction11] = factions[faction12] + unit3.GetCommandCost(App.game.actualGameState);
}
}
Debug.Log(string.Concat(new object[] { faction4.factionType.name, " RP: core = ", factions2[faction4], ", aux = ", factions1[faction4] }));
Debug.Log(string.Concat(new object[] { faction4.factionType.name, " CP: core = ", factions4[faction4], ", aux = ", factions3[faction4] }));
}
return true;
}
}
else if (App.mode == App.modes.menu)
{
if (strArrays[0] == "#gimmeall")
{
UnlockScenarios.UnlockAll();
GeneralUI.menuUI.singleplayerPanel.scenarioPanel.UpdateScenarios();
return true;
}
if (strArrays[0] == "#patch" && (int)strArrays.Length > 1)
{
bool flag1 = false;
if ((int)strArrays.Length > 2 && strArrays[2].Trim() == "instant")
{
flag1 = true;
}
(new Thread(() => AutoPatcher.DownloadUpdate(strArrays[1].Trim(), App.version, GeneralUI.emptyString, flag1))).Start();
return true;
}
if (strArrays[0] == "#seed")
{
if (GeneralUI.menuUI.singleplayerPanel.skirmishPanel.visible)
{
if ((int)strArrays.Length != 1)
{
GeneralUI.menuUI.singleplayerPanel.skirmishPanel.SetSeed(int.Parse(strArrays[1]));
}
else
{
GeneralUI.menuUI.singleplayerPanel.skirmishPanel.SetSeed(Random.Range(-2147483648, 2147483647));
}
}
else if (GeneralUI.menuUI.pbemPanel.gameSetupPanel.visible)
{
if ((int)strArrays.Length != 1)
{
GeneralUI.menuUI.pbemPanel.gameSetupPanel.SetSeed(int.Parse(strArrays[1]));
}
else
{
GeneralUI.menuUI.pbemPanel.gameSetupPanel.SetSeed(Random.Range(-2147483648, 2147483647));
}
}
else if (GeneralUI.menuUI.hotseatPanel.gameSetupPanel.visible)
{
if ((int)strArrays.Length != 1)
{
GeneralUI.menuUI.hotseatPanel.gameSetupPanel.SetSeed(int.Parse(strArrays[1]));
}
else
{
GeneralUI.menuUI.hotseatPanel.gameSetupPanel.SetSeed(Random.Range(-2147483648, 2147483647));
}
}
return true;
}
if (strArrays[0].Trim().ToLower() == "#news")
{
int num12 = -1;
if (int.TryParse(strArrays[1].Trim(), out num12))
{
GeneralUI.menuUI.onlineNews.GetNews(num12);
return true;
}
}
}
if (strArrays[0] == "#counters")
{
if ((int)strArrays.Length != 2)
{
OOBSettings.enableCounters = true;
}
else if (strArrays[1].Trim() == "on")
{
OOBSettings.enableCounters = true;
}
else if (strArrays[1].Trim() == "off")
{
OOBSettings.enableCounters = false;
}
return true;
}
if (strArrays[0] == "#host")
{
App.tcpip = new TCPIP()
{
chatGame = new Chat(true)
};
App.online.player = Player.NewTCPPlayer();
return true;
}
if (strArrays[0] != "#join")
{
return false;
}
if ((int)strArrays.Length == 2)
{
App.tcpip = new TCPIP()
{
chatGame = new Chat(true)
};
App.online.player = Player.NewTCPPlayer();
}
return true;
}