private static void TargetRemoveItem(ConCommandArgs args) { var localMaster = PlayerCharacterMasterController.instances[0].master; var component = HasComponent(localMaster); if (component && component.HasBody()) { var inventory = component.targetedBody.inventory; if (inventory) { //https://stackoverflow.com/questions/23563960/how-to-get-enum-value-by-string-or-int ItemIndex itemIndex = (ItemIndex)args.GetArgInt(0); var targetItemCount = inventory.GetItemCount(itemIndex); int itemCount = args.GetArgInt(1); if (itemCount < 0) { inventory.RemoveItem(itemIndex, targetItemCount); Chat.AddMessage("Removed " + itemIndex + " x" + itemCount + " from " + component.targetedBody.GetDisplayName()); } else { var amountToRemove = Mathf.Max(itemCount, targetItemCount); inventory.RemoveItem(itemIndex, amountToRemove); Chat.AddMessage("Removed " + itemIndex + " x" + amountToRemove + " from " + component.targetedBody.GetDisplayName()); } } } }
private static void FUCKsads(ConCommandArgs args) { for (int i = 0; i < args.GetArgInt(1); i++) { args.senderBody.AddTimedBuff((BuffIndex)args.GetArgInt(0), args.GetArgInt(2)); } }
private static void CCGiveLunar(ConCommandArgs args) { int amount = 1; if (args.Count > 0) { amount = args.GetArgInt(0); } if (amount == 0) { Log.Message("Nothing happened. Big suprise."); return; } NetworkUser target = Util.LookUpBodyNetworkUser(args.senderBody); if (amount > 0) { target.AwardLunarCoins((uint)amount); } if (amount < 0) { amount *= -1; target.DeductLunarCoins((uint)(amount)); } Log.Message(string.Format(MagicVars.GIVELUNAR_2, (amount > 0) ? "Gave" : "Deducted", amount)); }
private static void CCGiveLunar(ConCommandArgs args) { if (args.sender == null) { Log.Message("Can't modify Lunar coins of other users directly.", LogLevel.Error); return; } int amount = 1; if (args.Count > 0) { amount = args.GetArgInt(0); } string str = "Nothing happened. Big suprise."; NetworkUser target = RoR2.Util.LookUpBodyNetworkUser(args.senderBody); if (amount > 0) { target.AwardLunarCoins((uint)amount); str = string.Format(Lang.GIVELUNAR_2, "Gave", amount); } if (amount < 0) { amount *= -1; target.DeductLunarCoins((uint)(amount)); str = string.Format(Lang.GIVELUNAR_2, "Removed", amount); } Log.MessageNetworked(str, args); }
public static void ChangeLight(ConCommandArgs args) { if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "lobby") { Methods.ChangeLobbyLightColor(new Color32((byte)args.GetArgInt(0), (byte)args.GetArgInt(1), (byte)args.GetArgInt(2), (byte)args.GetArgInt(3))); } }
private static void TargetGiveItem(ConCommandArgs args) { var localMaster = PlayerCharacterMasterController.instances[0].master; var component = HasComponent(localMaster); if (component && component.HasBody()) { var inventory = component.targetedBody.inventory; if (inventory) { //https://stackoverflow.com/questions/23563960/how-to-get-enum-value-by-string-or-int ItemIndex itemIndex = (ItemIndex)args.GetArgInt(0); int itemCount = args.GetArgInt(1); inventory.GiveItem(itemIndex, itemCount); Chat.AddMessage("Gave " + itemIndex + " x" + itemCount + " to " + component.targetedBody.GetDisplayName()); } } }
public static void MyCommandName(ConCommandArgs args) { DotController.DotIndex index = (DotController.DotIndex)Array.FindIndex(DotController.dotDefs, (dotDef) => dotDef.associatedBuff == BuffIndex.OnFire); for (int y = 0; y < args.GetArgInt(0); y++) { DotController.InflictDot(args.senderBody.gameObject, args.senderBody.gameObject, index, args.GetArgInt(1), 0.25f); //args.senderBody.AddTimedBuffAuthority(BuffIndex.OnFire, args.GetArgInt(1)); } }
private static void TargetTakeDamage(ConCommandArgs args) { var localMaster = PlayerCharacterMasterController.instances[0].master; var component = HasComponent(localMaster); if (component && component.HasBody()) { var healthComponent = component.targetedBody.healthComponent; if (healthComponent) { healthComponent.TakeDamage(new DamageInfo { damage = args.GetArgInt(0), crit = args.GetArgBool(1), rejected = args.GetArgBool(2), damageType = (DamageType)args.GetArgInt(3) }); } } }
private static void SetEquipmentSlot(ConCommandArgs args) { var localMaster = PlayerCharacterMasterController.instances[0].master; var inventory = localMaster.inventory; if (inventory) { var value = (byte)args.GetArgInt(0); inventory.SetActiveEquipmentSlot(value); } }
private static void SetEquipmentSlotSafe(ConCommandArgs args) { var localMaster = PlayerCharacterMasterController.instances[0].master; var inventory = localMaster.inventory; var component = localMaster.GetComponent <Items.Backpack.BackpackComponent>(); if (inventory && component) { var value = (byte)args.GetArgInt(0); inventory.SetActiveEquipmentSlot(Math.Min(component.selectableSlot, value)); } }
private static void ModifyPresetScenePreview(ConCommandArgs args) { var value = args.GetArgInt(0); var pathSet = GetPathSet(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name); if (pathSet == null) { _logger.LogWarning($"Could not find chosen pathSet for current scene ({UnityEngine.SceneManagement.SceneManager.GetActiveScene().name})!"); return; } PatchScene(pathSet, 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 CCGiveLunar(ConCommandArgs args) { int amount = 1; if (args.Count > 0) { amount = args.GetArgInt(0); } string str = "Nothing happened. Big suprise."; NetworkUser target = Util.LookUpBodyNetworkUser(args.senderBody); if (amount > 0) { target.AwardLunarCoins((uint)amount); str = string.Format(Lang.GIVELUNAR_2, "Gave", amount); } if (amount < 0) { amount *= -1; target.DeductLunarCoins((uint)(amount)); str = string.Format(Lang.GIVELUNAR_2, "Removed", amount); } Log.Message(str, args); }
public static void CMD_ShowSkill(ConCommandArgs args) { FindObjectOfType <SkillPreview>().PlayAnim(args.GetArgInt(0)); }
private static void A(ConCommandArgs args) { damageColorOverride = args.GetArgInt(0); }