public static void CCListEnum(ConCommandArgs args) { args.CheckArgumentCount(1); Type t = null; foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) { if ((t = a.GetType(args[0], false, true)) != null) { break; } } if (t == null || !t.IsEnum) { Debug.LogFormat("Invalid type {0}", args[0]); return; } Debug.LogFormat("Names and values for Enum {0}", t.Name); foreach (string s in Enum.GetNames(t)) { Debug.Log(s); } }
public static void CCSubmodule(ConCommandArgs args) { args.CheckArgumentCount(1); string module = args.GetArgString(0); if (PluginEntry.Modules.ContainsKey(module)) { if (args.Count == 1) { Debug.LogFormat($"Module {module} is {(PluginEntry.Modules[module].IsEnabled ? "enabled" : "disabled")}."); return; } bool?value = args.TryGetArgBool(1); if (value.HasValue) { PluginEntry.Modules[module].IsEnabled = value.Value; } else { Debug.Log("Cannot parse second argument."); } } else { Debug.LogFormat("Module not found. Available modules: {0}", string.Join(", ", PluginEntry.Modules.Keys)); } }
public static void CCGiveDeployables(ConCommandArgs args) { args.CheckArgumentCount(1); ItemIndex item; int count = 1; if (!Enum.TryParse(args[0], true, out item)) { Debug.Log("Invalid item"); return; } if (args.Count > 1) { int.TryParse(args[1], out count); // ignore if it's not successfull, just give it 1. } CharacterMaster master = args.senderMasterObject.GetComponent <CharacterMaster>(); List <DeployableInfo> deployables = (List <DeployableInfo>)master.GetType().GetField("deployablesList", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance).GetValue(master); if (deployables == null) // this list can actually be null sometimes { return; } foreach (DeployableInfo d in deployables) { d.deployable.GetComponent <Inventory>().GiveItem(item, count); } }
private static void cc_mots(ConCommandArgs args) { args.CheckArgumentCount(1); if (!PluginEntry.Modules[ModuleName].IsEnabled) { Debug.LogWarning("The Motd module is not enabled."); } var MOTD = (MotD)PluginEntry.Modules[ModuleName]; string stage = args.GetArgString(0).ToLower(); if (args.Count < 2) { string mots = MOTD.GetMotS(args.GetArgString(0)); if (mots == "") { Debug.LogFormat("Stage '{0}' does not have any message set.", stage); } else { Debug.Log(mots); } return; } string newMessage = Util.Console.MergeArgs(args, 2); MOTD.SetMotS(stage, newMessage); Debug.Log("Something something mots set."); }
private static void CCUseSeed(ConCommandArgs args) { if (args.Count == 0) { string s = "Current Seed is "; if (PreGameController.instance) { s += PreGameController.instance.runSeed; } else { s += (seed == 0) ? "random" : seed.ToString(); } Log.Message(s); return; } args.CheckArgumentCount(1); if (!TextSerialization.TryParseInvariant(args[0], out ulong result)) { throw new ConCommandException("Specified seed is not a parsable uint64."); } if (PreGameController.instance) { PreGameController.instance.runSeed = (result == 0) ? RoR2Application.rng.nextUlong : result; } seed = result; Log.Message($"Seed set to {((seed == 0) ? "vanilla generation" : seed.ToString())}."); }
private static void CCRTSprintEnable(ConCommandArgs args) { try { args.CheckArgumentCount(1); if (Utils.TryParseBool(args[0], out bool result)) { RTAutoSprintEx.RT_enabled = (bool)result; Debug.Log($"{nameof(RTAutoSprintEx.RT_enabled)}={RTAutoSprintEx.RT_enabled}"); } } catch (Exception ex) { Debug.LogError(ex); } }
private static void CCCreatePickup(ConCommandArgs args) { args.CheckArgumentCount(1); Transform transform = args.senderBody.gameObject.transform; bool searchEquip = true, searchItem = true; if (args.Count == 2) { if (args[1].Equals("item", StringComparison.OrdinalIgnoreCase)) { searchEquip = false; } if (args[1].ToUpper().StartsWith("EQUIP")) { searchItem = false; } } PickupIndex final = PickupIndex.none; EquipmentIndex equipment = EquipmentIndex.None; ItemIndex item = ItemIndex.None; if (searchEquip) { equipment = Alias.Instance.GetEquipFromPartial(args[0]); final = PickupCatalog.FindPickupIndex(equipment); } if (searchItem) { item = Alias.Instance.GetItemFromPartial(args[0]); final = PickupCatalog.FindPickupIndex(item); } if (item != ItemIndex.None && equipment != EquipmentIndex.None) { Log.Message(string.Format(Lang.CREATEPICKUP_AMBIGIOUS_2, item, equipment), args, LogLevel.MessageClientOnly); return; } if (item == ItemIndex.None && equipment == EquipmentIndex.None) { if (args[0].ToUpper().Contains("COIN")) { final = PickupCatalog.FindPickupIndex("LunarCoin.Coin0"); } else { Log.Message(Lang.CREATEPICKUP_NOTFOUND, args, LogLevel.MessageClientOnly); return; } } Log.Message(string.Format(Lang.CREATEPICKUP_SUCCES_1, final), args); PickupDropletController.CreatePickupDroplet(final, transform.position, transform.forward * 40f); }
private static void CCRTFOV(ConCommandArgs args) { try { args.CheckArgumentCount(1); int? value = args.TryGetArgInt(0); if (value.HasValue) { if (value >= 1 && value <= 180) { CustomFOV.Value = (int)value; Debug.Log($"{nameof(CustomFOV)}={value}"); } } } catch (Exception ex) { Debug.LogError(ex); } }
private static void CCSetChestMulitplier(ConCommandArgs args) { args.CheckArgumentCount(1); if (!int.TryParse(args[0], out var multiplier)) { Debug.Log("Invalid Argument"); } else { Variables.interactableMultiplier.Value = multiplier; } }
public static void CCSpawnGeneral(ConCommandArgs args) { args.CheckArgumentCount(2); CharacterMaster master = args.senderMasterObject.GetComponent <CharacterMaster>(); TeamIndex team = master.teamIndex; if (args.Count >= 3) { Enum.TryParse(args[2], true, out team); } SpawnMasterWithBody(args[0], args[1], master.GetBody().transform.position, team, master.inventory); }
private static void CCsetAddRunTime(ConCommandArgs args) { args.CheckArgumentCount(1); if (!bool.TryParse(args[0], out var value)) { Debug.Log("Invalid argument."); } else { AddToRunTime.Value = value; Debug.Log($"Add to run time {AddToRunTime.Value}."); } }
private static void CCsetChatMsg(ConCommandArgs args) { args.CheckArgumentCount(1); if (!bool.TryParse(args[0], out var value)) { Debug.Log("Invalid argument."); } else { ShowMsg.Value = value; Debug.Log($"Show chat message {ShowMsg.Value}."); } }
private static void CCsetInstantCharge(ConCommandArgs args) { args.CheckArgumentCount(1); if (!bool.TryParse(args[0], out var value)) { Debug.Log("Invalid argument."); } else { InstantCharge.Value = value; Debug.Log($"Instant charge {InstantCharge.Value}."); } }
private static void CCCooldown(ConCommandArgs args) { args.CheckArgumentCount(1); if (!bool.TryParse(args[0], out var value)) { Debug.Log("Invalid argument."); } else { CooldownConfig.Value = value; Debug.Log($"Remove Cooldown is {CooldownConfig.Value}."); } }
private static void CCRunSetTime(ConCommandArgs args) { if (!Run.instance) { throw new ConCommandException("No run is currently in progress."); } args.CheckArgumentCount(1); float networkfixedTime; if (TextSerialization.TryParseInvariant(args[0], out networkfixedTime)) { Run.instance.NetworkfixedTime = networkfixedTime; } }
private static void CCsetChestAmount(ConCommandArgs args) { args.CheckArgumentCount(1); if (!float.TryParse(args[0], out var value)) { Debug.Log("Invalid argument."); } else { ChestAmount.Value = value; Debug.Log($"Chest amount set to {ChestAmount.Value}."); } }
private static void CCSetPercentage(ConCommandArgs args) { args.CheckArgumentCount(1); if (!int.TryParse(args[0], out var percentage)) { Debug.Log("Invalid argument."); } else { PercentageConfig.Value = percentage; Debug.Log($"Percentage set to {PercentageConfig.Value}."); } }
private static void CCNetworkEcho(ConCommandArgs args) { args.CheckArgumentCount(2); Log.Target target = (Log.Target)args.GetArgInt(0); //Some fancyspancy thing that concatenates all remaining arguments as a single string. StringBuilder s = new StringBuilder(); args.userArgs.RemoveAt(0); args.userArgs.ForEach((string temp) => { s.Append(temp + " "); }); string str = s.ToString().TrimEnd(' '); Log.Message(str, Log.LogLevel.Message, target); }
private static void CCChatDisplay(ConCommandArgs args) { args.CheckArgumentCount(1); if (!bool.TryParse(args[0], out var value)) { Debug.Log("Invalid argument."); } else { MessageConfig.Value = value; Debug.Log($"Chat Display is {MessageConfig.Value}."); } }
private static void CCsetChargeMulti(ConCommandArgs args) { args.CheckArgumentCount(1); if (!float.TryParse(args[0], out var value)) { Debug.Log("Invalid argument."); } else { ChargeMulti.Value = value; Debug.Log($"Charge multiplier set to {ChargeMulti.Value}."); UpdateInterval(); } }
public static void CCSetSkill(ConCommandArgs args) { args.CheckArgumentCount(2); SkillSlot slot; if (!Enum.TryParse(args[0], true, out slot)) { Debug.Log("Invalid slot. valid ones are"); foreach (string s in Enum.GetNames(typeof(SkillSlot))) { Debug.Log(s); } return; } if (slot == SkillSlot.None) { Debug.Log("no."); return; } var skillLocator = args.senderMasterObject.GetComponent <CharacterMaster>().GetBody().GetComponent <SkillLocator>(); var skill = skillLocator.FindSkill(args[1]); if (!skill) { Debug.Log("Invalid spell name. execute mod_list_skills to see all."); return; } switch (slot) { case SkillSlot.Primary: skillLocator.primary = skill; break; case SkillSlot.Secondary: skillLocator.secondary = skill; break; case SkillSlot.Special: skillLocator.special = skill; break; case SkillSlot.Utility: skillLocator.utility = skill; break; } }
private static void SetBuildIdCustom(ConCommandArgs args) { args.CheckArgumentCount(1); _buildId = args[0]; var instance = RoR2Application.instance; if (instance == null) { throw new ConCommandException("RoR2Application is null."); } var client = instance.steamworksClient; if (client == null) { throw new ConCommandException("SteamworksClient is null"); } client.Lobby?.CurrentLobbyData?.SetData("build_id", _buildId); Debug.Log($"BuildId set to {_buildId}"); }
public static void CCGiveSpawnedItem(ConCommandArgs args) { args.CheckArgumentCount(1); ItemIndex item; int count = 1; if (!Enum.TryParse(args[0], true, out item)) { return; } if (args.Count >= 2) { int.TryParse(args[1], out count); } foreach (CharacterMaster master in spawns) { if (master) { master.inventory.GiveItem(item, count); } } }
private static void CCCreatePickup(ConCommandArgs args) { args.CheckArgumentCount(1); Transform transform = args.senderBody.gameObject.transform; PickupIndex final = PickupIndex.none; if (args.Count == 1) { ItemIndex item; EquipmentIndex equipment; equipment = Alias.Instance.GetEquipFromPartial(args[0]); item = Alias.Instance.GetItemFromPartial(args[0]); if (item != ItemIndex.None && equipment != EquipmentIndex.None) { Log.Message(string.Format(MagicVars.CREATEPICKUP_AMBIGIOUS_2, item, equipment)); return; } if (equipment == EquipmentIndex.None && item != ItemIndex.None) { final = PickupCatalog.FindPickupIndex(item); } if (item == ItemIndex.None && equipment != EquipmentIndex.None) { final = PickupCatalog.FindPickupIndex(equipment); } if (item == ItemIndex.None && equipment == EquipmentIndex.None) { if (args[0].ToUpper().Contains("COIN")) { final = PickupCatalog.FindPickupIndex("LunarCoin.Coin0"); } else { Log.Message(MagicVars.CREATEPICKUP_NOTFOUND); return; } } } else { if (args[0].Equals("item", StringComparison.OrdinalIgnoreCase)) { ItemIndex itemName = Alias.Instance.GetItemFromPartial(args[1]); if (itemName == ItemIndex.None) { Log.Message(MagicVars.CREATEPICKUP_NOTFOUND); return; } final = PickupCatalog.FindPickupIndex(itemName); } if (args[0].ToUpper().StartsWith("EQUIP")) { EquipmentIndex equipName = Alias.Instance.GetEquipFromPartial(args[0]); if (equipName == EquipmentIndex.None) { Log.Message(MagicVars.CREATEPICKUP_NOTFOUND); return; } final = PickupCatalog.FindPickupIndex(equipName); } } Log.Message(string.Format(MagicVars.CREATEPICKUP_SUCCES_1, final)); PickupDropletController.CreatePickupDroplet(final, transform.position, transform.forward * 40f); }
private static void CCCreatePickup(ConCommandArgs args) { args.CheckArgumentCount(1); if (args.sender == null) { if (args.Count <= 3) { Log.Message(Lang.DS_REQUIREFULLQUALIFY, LogLevel.Error); return; } } NetworkUser player = args.sender; if (args.Count >= 3) { player = Util.GetNetUserFromString(args.userArgs, 2); if (player == null) { Log.Message(Lang.PLAYER_NOTFOUND, LogLevel.MessageClientOnly); if (args.sender == null) { return; } player = args.sender; } } Transform transform = player.GetCurrentBody().gameObject.transform; bool searchEquip = true, searchItem = true; if (args.Count == 2) { if (args[1].Equals("item", StringComparison.OrdinalIgnoreCase)) { searchEquip = false; } if (args[1].ToUpper().StartsWith("EQUIP")) { searchItem = false; } } PickupIndex final = PickupIndex.none; EquipmentIndex equipment = EquipmentIndex.None; ItemIndex item = ItemIndex.None; if (searchEquip) { equipment = StringFinder.Instance.GetEquipFromPartial(args[0]); final = PickupCatalog.FindPickupIndex(equipment); } if (searchItem) { item = StringFinder.Instance.GetItemFromPartial(args[0]); final = PickupCatalog.FindPickupIndex(item); } if (item != ItemIndex.None && equipment != EquipmentIndex.None) { Log.MessageNetworked(string.Format(Lang.CREATEPICKUP_AMBIGIOUS_2, item, equipment), args, LogLevel.MessageClientOnly); return; } if (item == ItemIndex.None && equipment == EquipmentIndex.None) { if (args[0].ToUpper().Contains("COIN")) { final = PickupCatalog.FindPickupIndex("LunarCoin.Coin0"); } else { Log.MessageNetworked(Lang.CREATEPICKUP_NOTFOUND, args, LogLevel.MessageClientOnly); return; } } Log.MessageNetworked(string.Format(Lang.CREATEPICKUP_SUCCES_1, final), args); PickupDropletController.CreatePickupDroplet(final, transform.position, transform.forward * 40f); }