public static string SetMainAgentHealth(List <string> strings) { if (Campaign.Current == null) { return("Campaign was not started."); } int num; if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings) || !int.TryParse(strings[0], out num)) { return("Format is \"mission.set_main_agent_health [Integer]\"."); } if (Mission.Current == null) { return("You are not in a mission."); } if (Agent.Main == null) { return("No main agent found."); } if (num < 0) { num = 0; } if (num > 10000000) { num = 10000000; } if ((float)num > Agent.Main.HealthLimit) { Agent.Main.HealthLimit = (float)num; } Agent.Main.Health = (float)num; return(string.Format("Set main agent health to {0}", num)); }
public static string OpenScreen(List <string> strings) { if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return("Format is \"ui.open_screen [TypeName]\"."); } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Func <Type, bool> modify_by_why; modify_by_why = null; for (int i = 0; i < assemblies.Length; i++) { IEnumerable <Type> types = assemblies[i].GetTypes(); Func <Type, bool> predicate; if ((predicate = modify_by_why) == null) { predicate = (modify_by_why = ((Type t) => t.Name == strings[0])); } Type type = types.FirstOrDefault(predicate); if (type != null && type.BaseType == typeof(ScreenBase)) { MethodInfo methodInfo = typeof(ViewCreatorManager).GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo m) => m.Name == "CreateScreenView" && m.GetParameters().Length == 0); ScreenBase screenBase = ((methodInfo != null) ? methodInfo.MakeGenericMethod(new Type[] { type }).Invoke(null, null) : null) as ScreenBase; if (screenBase != null) { ScreenManager.PushScreen(screenBase); return("Pushed Screen " + type.Name + "."); } } } return("Could not find screen with name " + strings[0] + "."); }
public static string CompleteQuest(List <string> strings) { if (Campaign.Current == null) { return("Campaign was not started."); } if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return("Format is \"campaign.complete_active_quest [QuestName]\"."); } string questName = string.Join(" ", strings.ToArray()).Trim(new char[] { '"' }); QuestBase questBase = Campaign.Current.QuestManager.Quests.FirstOrDefault((QuestBase q) => q.Title.ToString().ToLower().Contains(questName.ToLower())); if (questBase == null) { return("Failed to find active quest with name \"" + questName + "\""); } MethodInfo method = questBase.GetType().GetMethod("CompleteQuestWithSuccess", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method == null) { return("Failed to locate method."); } method.Invoke(questBase, null); return(string.Format("{0} has been completed.", questBase.Title)); }
public static string SpawnProp(List <string> strings) { if (Campaign.Current == null) { return("Campaign was not started."); } if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return("Format is \"mission.spawn_prop [PropId]\"."); } if (Mission.Current == null) { return("You are not in a mission."); } GameEntity gameEntity; if (Agent.Main == null) { MissionScreen missionScreen = ScreenManager.TopScreen as MissionScreen; if (missionScreen != null && missionScreen.CombatCamera != null) { gameEntity = GameEntity.Instantiate(Mission.Current.Scene, strings[0], missionScreen.CombatCamera.Frame); goto IL_99; } } gameEntity = GameEntity.Instantiate(Mission.Current.Scene, strings[0], Agent.Main.Frame); IL_99: if (gameEntity == null) { return("Failed to spawn prop with id \"" + strings[0] + "\""); } return("Spawned " + gameEntity.Name + "."); }
public static string FillUp(List <string> strings) { if (Campaign.Current == null) { return("Campaign is null"); } if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return("Format is \"campaign.fill_up [Hero Name]\""); } switch (strings.Count) { case 1 when strings.Single().Trim() == "all": return(Utils.Handle(Utils.NpcHeros, Utils.FillUp)); case 2 when strings.First().Trim() == "all" && int.TryParse(strings.Last().Trim(), out var skillValue): return(Utils.Handle(Utils.NpcHeros, hero => Utils.FillUp(hero, skillValue))); default: if (int.TryParse(strings.Last().Trim(), out var skillValue2)) { return(Utils.Handle(strings, hero => Utils.FillUp(hero, skillValue2))); } return(Utils.Handle(strings, Utils.FillUp)); } }
private static string FormAlliance(List <string> strings) { if (!CampaignCheats.CheckCheatUsage(ref CampaignCheats.ErrorType)) { return(CampaignCheats.ErrorType); } if (!CampaignCheats.CheckParameters(strings, 2) || CampaignCheats.CheckHelp(strings)) { return("Format uses 2 kingdom ID parameters without spaces: diplomacy.form_alliance [Kingdom1] [Kingdom2]"); } var b1 = strings[0].ToLower(); var b2 = strings[1].ToLower(); if (b1 == b2) { return("Cannot ally a kingdom to itself!"); } Kingdom?kingdom1 = null; Kingdom?kingdom2 = null; foreach (var k in Kingdom.All) { var id = k.Name.ToString().ToLower().Replace(" ", ""); if (id == b1) { kingdom1 = k; } else if (id == b2) { kingdom2 = k; } } if (kingdom1 is null && kingdom2 is null) { return("Could not find either required kingdom!"); } if (kingdom1 is null) { return("1st kingdom ID not found: " + b1); } if (kingdom2 is null) { return("2nd kingdom ID not found: " + b2); } DeclareAllianceAction.Apply(kingdom1, kingdom2, bypassCosts: true); return($"Alliance formed between {kingdom1.Name} and {kingdom2.Name}!"); }
public static string Respec_1Hero(List <string> strings) { if (Campaign.Current == null) { return("Campaign is null"); } if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return("Format is \"campaign.respec_companion [Hero Name]\""); } return(Utils.Handle(strings, Utils.RespecHero)); }
public static string Age(List <string> strings) { if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return($"{FormatMsgHeader} \"dcc.age [{AgeText}]\"."); } if (!int.TryParse(strings[0], out int num)) { return(EnterAgeMsg.ToString()); } CharacterBodyManager.ResetBirthDayForAge(Hero.MainHero.CharacterObject, num, true); return(SuccessMsg.ToString()); }
public static string Age(List <string> strings) { if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return($"{FormatMsgHeader} \"dcc.age [{AgeText}]\"."); } if (!int.TryParse(strings[0], out int num)) { return(EnterAgeMsg.ToString()); } Hero.MainHero.BirthDay = HeroHelper.GetRandomBirthDayForAge(num); return(SuccessMsg.ToString()); }
public static string Age(List <string> strings) { if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return("Format is \"dcc.age [Age]\"."); } int num = 1; if (!int.TryParse(strings[0], out num)) { return("Please enter a age"); } Hero.MainHero.BirthDay = HeroHelper.GetRandomBirthDayForAge((float)num); return("Success"); }
public static string FormAlliance(List <string> strings) { if (!CampaignCheats.CheckCheatUsage(ref CampaignCheats.ErrorType)) { return(CampaignCheats.ErrorType); } if (!CampaignCheats.CheckParameters(strings, 2) || CampaignCheats.CheckHelp(strings)) { return("Format is faction names without space \"campaign.form_alliance [Faction1] [Faction2]\"."); } string b = strings[0].ToLower(); string b2 = strings[1].ToLower(); Kingdom faction = null; Kingdom faction2 = null; foreach (Kingdom faction3 in Campaign.Current.Kingdoms) { string a = faction3.Name.ToString().ToLower().Replace(" ", ""); if (a == b) { faction = faction3; } else if (a == b2) { faction2 = faction3; } } if (faction != null && faction2 != null) { DeclareAllianceAction.Apply(faction as Kingdom, faction2 as Kingdom, bypassCosts: true); return(string.Concat(new object[] { "Alliance declared between ", faction.Name, " and ", faction2.Name })); } if (faction == null) { return("Faction is not found: " + faction); } return("Faction is not found: " + faction2); }
public static string AgeHero(List <string> strings) { if (!CampaignCheats.CheckParameters(strings, 2) || CampaignCheats.CheckHelp(strings)) { return($"{FormatMsgHeader} \"dcc.age_hero [{HeroNameText}] [{AgeText}]\"."); } Hero hero = CampaignCheats.GetHero(strings[0].Replace('_', ' ')); if (hero == null) { return(HeroNotFoundMsg.ToString()); } if (!int.TryParse(strings[1], out int num)) { return(EnterAgeMsg.ToString()); } CharacterBodyManager.ResetBirthDayForAge(hero.CharacterObject, num, true); return(SuccessMsg.ToString()); }
public static string AgeHero(List <string> strings) { if (!CampaignCheats.CheckParameters(strings, 2) || CampaignCheats.CheckHelp(strings)) { return($"{FormatMsgHeader.ToString()} \"dcc.age_hero [{HeroNameText.ToString()}] [{AgeText.ToString()}]\"."); } Hero hero = CampaignCheats.GetHero(strings[0].Replace('_', ' ')); if (hero == null) { return(HeroNotFoundMsg.ToString()); } if (!int.TryParse(strings[1], out int num)) { return(EnterAgeMsg.ToString()); } hero.BirthDay = HeroHelper.GetRandomBirthDayForAge(num); return(SuccessMsg.ToString()); }
public static string AgeHero(List <string> strings) { if (!CampaignCheats.CheckParameters(strings, 2) || CampaignCheats.CheckHelp(strings)) { return("Format is \"dcc.age_hero [HeroName] [Age]\"."); } Hero hero = CampaignCheats.GetHero(strings[0].Replace('_', ' ')); if (hero == null) { return("Hero is not found"); } int num; if (!int.TryParse(strings[1], out num)) { return("Please enter a age"); } hero.BirthDay = HeroHelper.GetRandomBirthDayForAge((float)num); return("Success"); }
public static string CancelQuest(List <string> strings) { if (Campaign.Current == null) { return("Campaign was not started."); } if (CampaignCheats.CheckParameters(strings, 0) || CampaignCheats.CheckHelp(strings)) { return("Format is \"campaign.cancel_active_quest [QuestName]\"."); } string questName = string.Join(" ", strings.ToArray()).Trim(new char[] { '"' }); QuestBase questBase = Campaign.Current.QuestManager.Quests.FirstOrDefault((QuestBase q) => q.Title.ToString().ToLower().Contains(questName.ToLower())); if (questBase == null) { return("Failed to find active quest with name \"" + questName + "\""); } questBase.CompleteQuestWithCancel(null); return(string.Format("{0} has been cancelled.", questBase.Title)); }