public static void CheckStackQuality(Terminal context) { context.AddString("CheckStackQuality"); if (ObjectDB.instance == null) { context.AddString("> ObjectDB is null"); return; } var count = 0; foreach (var itemObject in ObjectDB.instance.m_items) { var itemDrop = itemObject.GetComponent <ItemDrop>(); if (itemDrop == null) { continue; } var itemData = itemDrop.m_itemData; if (itemData.m_shared.m_maxStackSize > 1 && itemData.m_shared.m_maxQuality > 1) { count++; context.AddString($"> {itemDrop.name}"); } } if (count == 0) { context.AddString("> (none)"); } }
private static void SpawnLegendaryMagicItem(Terminal context, string[] args) { if (args.Length < 2) { context.AddString("> Specify legendaryID, itemID (optional)"); return; } var legendaryID = args[1]; var itemType = args.Length >= 3 ? args[2] : null; context.AddString($"magicitemlegendary - legendaryID:{legendaryID}"); SpawnLegendaryItemHelper(legendaryID, itemType, context); }
static bool Prefix(Terminal __instance) { if (!modEnabled.Value) { return(true); } string text = __instance.m_input.text; if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} reset")) { context.Config.Reload(); context.Config.Save(); __instance.AddString(text); __instance.AddString($"{context.Info.Metadata.Name} config reloaded"); return(false); } return(true); }
static bool Prefix(Terminal __instance) { if (!modEnabled.Value) { return(true); } string text = __instance.m_input.text; if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} reset")) { context.Config.Reload(); context.Config.Save(); __instance.AddString(text); Traverse.Create(EnvMan.instance).Field("m_dayLengthSec").SetValue((long)Mathf.Round(vanillaDayLengthSec / dayRate.Value)); __instance.AddString($"{context.Info.Metadata.Name} config reloaded"); return(false); } return(true); }
private static void SpawnMagicItemSet(Terminal terminal, string[] args) { if (args.Length < 2) { terminal.AddString("> Specify Set ID"); return; } var setID = args[1]; terminal.AddString($"magicitemset - setID:{setID}"); if (!UniqueLegendaryHelper.TryGetLegendarySetInfo(setID, out var setInfo)) { terminal.AddString($"> Could not find set info for setID: ({setID})"); return; } foreach (var legendaryID in setInfo.LegendaryIDs) { SpawnLegendaryItemHelper(legendaryID, null, terminal); } }
static bool Prefix(Terminal __instance) { if (!modEnabled.Value) { return(true); } string text = __instance.m_input.text; if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} reset")) { context.Config.Reload(); context.Config.Save(); __instance.AddString(text); __instance.AddString($"{context.Info.Metadata.Name} config reloaded"); return(false); } if (text.ToLower().Equals($"{typeof(BepInExPlugin).Namespace.ToLower()} demolish")) { __instance.AddString(text); int count = DemolishPieces(destroyRadius.Value); __instance.AddString($"{context.Info.Metadata.Name} demolished {count} pieces"); return(false); } if (text.ToLower().StartsWith($"{typeof(BepInExPlugin).Namespace.ToLower()} demolish ")) { __instance.AddString(text); if (int.TryParse(text.Split(' ')[2], out int radius)) { int count = DemolishPieces(radius); __instance.AddString($"{context.Info.Metadata.Name} demolished {count} pieces"); } else { __instance.AddString($"{context.Info.Metadata.Name} syntax error"); } return(false); } return(true); }
private static void SpawnLegendaryItemHelper(string legendaryID, string itemType, Terminal context) { if (!UniqueLegendaryHelper.TryGetLegendaryInfo(legendaryID, out var legendaryInfo)) { if (context != null) { context.AddString($"> Could not find info for legendaryID: ({legendaryID})"); } return; } if (string.IsNullOrEmpty(itemType)) { var dummyMagicItem = new MagicItem { Rarity = ItemRarity.Legendary }; var allowedItems = new List <ItemDrop>(); foreach (var itemName in GatedItemTypeHelper.ItemInfoByID.Keys) { var itemPrefab = ObjectDB.instance.GetItemPrefab(itemName); if (itemPrefab == null) { continue; } var itemDrop = itemPrefab.GetComponent <ItemDrop>(); if (itemDrop == null) { continue; } var itemData = itemDrop.m_itemData; if (legendaryInfo.Requirements.CheckRequirements(itemData, dummyMagicItem)) { allowedItems.Add(itemDrop); } } itemType = allowedItems.LastOrDefault()?.name; } if (string.IsNullOrEmpty(itemType)) { itemType = "Club"; } var loot = new LootTable { Object = "Console", Drops = new[] { new float[] { 1, 1 } }, Loot = new[] { new LootDrop { Item = itemType, Rarity = new float[] { 0, 0, 0, 1 } } } }; LootRoller.CheatForceLegendary = legendaryID; var previousDisableGatingState = LootRoller.CheatDisableGating; LootRoller.CheatDisableGating = true; var randomOffset = UnityEngine.Random.insideUnitSphere; var dropPoint = Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 3 + Vector3.up * 1.5f + randomOffset; LootRoller.RollLootTableAndSpawnObjects(loot, 1, loot.Object, dropPoint); LootRoller.CheatForceLegendary = null; LootRoller.CheatDisableGating = previousDisableGatingState; }
public static void SpawnMagicItemWithEffect(Terminal context, string[] args) { if (args.Length < 3) { EpicLoot.LogError("Specify effect and item name"); return; } if (Player.m_localPlayer == null) { return; } var effectArg = args[1]; var itemPrefabNameArg = args[2]; context.AddString($"magicitem - {itemPrefabNameArg} with effect: {effectArg}"); var magicItemEffectDef = MagicItemEffectDefinitions.Get(effectArg); if (magicItemEffectDef == null) { context.AddString($"> Could not find effect: {effectArg}"); return; } var itemPrefab = ObjectDB.instance.GetItemPrefab(itemPrefabNameArg); if (itemPrefab == null) { context.AddString($"> Could not find item: {itemPrefabNameArg}"); return; } var fromItemData = itemPrefab.GetComponent <ItemDrop>().m_itemData; if (!EpicLoot.CanBeMagicItem(fromItemData)) { context.AddString($"> Can't be magic item: {itemPrefabNameArg}"); return; } var effectRequirements = magicItemEffectDef.Requirements; var itemRarity = effectRequirements.AllowedRarities.Count == 0 ? ItemRarity.Magic : effectRequirements.AllowedRarities.First(); var rarityTable = GetRarityTable(itemRarity.ToString()); var loot = new LootTable { Object = "Console", Drops = new[] { new float[] { 1, 1 } }, Loot = new[] { new LootDrop { Item = itemPrefab.name, Rarity = rarityTable } } }; var randomOffset = UnityEngine.Random.insideUnitSphere; var dropPoint = Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 3 + Vector3.up * 1.5f + randomOffset; LootRoller.CheatForceMagicEffect = true; LootRoller.ForcedMagicEffect = effectArg; LootRoller.RollLootTableAndSpawnObjects(loot, 1, loot.Object, dropPoint); LootRoller.CheatForceMagicEffect = false; LootRoller.ForcedMagicEffect = string.Empty; }
public static void MagicItem(Terminal context, string[] args) { var rarityArg = args.Length >= 2 ? args[1] : "random"; var itemArg = args.Length >= 3 ? args[2] : "random"; var count = args.Length >= 4 ? int.Parse(args[3]) : 1; var effectCount = args.Length >= 5 ? int.Parse(args[4]) : -1; context.AddString($"magicitem - rarity:{rarityArg}, item:{itemArg}, count:{count}"); var allItemNames = ObjectDB.instance.m_items .Where(x => EpicLoot.CanBeMagicItem(x.GetComponent <ItemDrop>().m_itemData)) .Where(x => x.name != "HelmetDverger" && x.name != "BeltStrength" && x.name != "Wishbone") .Select(x => x.name) .ToList(); if (Player.m_localPlayer == null) { return; } LootRoller.CheatEffectCount = effectCount; for (var i = 0; i < count; i++) { var rarityTable = GetRarityTable(rarityArg); var item = itemArg; if (item == "random") { var weightedRandomTable = new WeightedRandomCollection <string>(_random, allItemNames, x => 1); item = weightedRandomTable.Roll(); } if (ObjectDB.instance.GetItemPrefab(item) == null) { context.AddString($"> Could not find item: {item}"); break; } context.AddString($"> {i + 1} - rarity: [{string.Join(", ", rarityTable)}], item: {item}"); var loot = new LootTable() { Object = "Console", Drops = new[] { new float[] { 1, 1 } }, Loot = new[] { new LootDrop() { Item = item, Rarity = rarityTable, Weight = 1 } } }; var randomOffset = UnityEngine.Random.insideUnitSphere; var dropPoint = Player.m_localPlayer.transform.position + Player.m_localPlayer.transform.forward * 3 + Vector3.up * 1.5f + randomOffset; LootRoller.RollLootTableAndSpawnObjects(loot, 1, loot.Object, dropPoint); } LootRoller.CheatEffectCount = -1; }
private static void ToggleAlwaysDrop(Terminal context) { EpicLoot.AlwaysDropCheat = !EpicLoot.AlwaysDropCheat; context.AddString($"> Always Drop: {EpicLoot.AlwaysDropCheat}"); }