using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AutoItemQueue")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Auto Item Queue mod for Risk of Rain 2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AutoItemQueue")]
[assembly: AssemblyTitle("AutoItemQueue")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace AutoItemQueue
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "AutoItemQueue";
public const string PLUGIN_NAME = "AutoItemQueue";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace AutoCommandEssencePickup
{
[BepInPlugin("com.gogogadgetjustice.autopickup", "Auto Pickup", "1.6.0")]
public class AutoEssencePickup : BaseUnityPlugin
{
public const string PluginGUID = "com.gogogadgetjustice.autopickup";
public const string PluginName = "Auto Pickup";
public const string PluginVersion = "1.6.0";
private ConfigEntry<float> pickupRange;
private ConfigEntry<float> scanRadius;
private const short ChatCommandMsgId = 9001;
public void Awake()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
pickupRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PickupRange", 2.5f, "Maximum distance from a player at which a pickup will be auto‑collected.");
scanRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ScanRadius", 1.5f, "Radius around the player that the auto‑interaction scan uses.");
((BaseUnityPlugin)this).Logger.LogInfo((object)"AutoEssencePickup loaded with chat‑hook commands.");
Chat.CCSay += new hook_CCSay(Chat_CCSay);
if (NetworkServer.active)
{
NetworkServer.RegisterHandler((short)9001, new NetworkMessageDelegate(OnChatCommandMessage));
}
}
public void Update()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
if ((Object)(object)((firstLocalUser != null) ? firstLocalUser.cachedBody : null) == (Object)null)
{
return;
}
CharacterBody cachedBody = firstLocalUser.cachedBody;
Interactor component = ((Component)cachedBody).GetComponent<Interactor>();
if ((Object)(object)component == (Object)null)
{
return;
}
Vector3 position = cachedBody.transform.position;
Collider[] array = Physics.OverlapSphere(position, scanRadius.Value);
Collider[] array2 = array;
foreach (Collider val in array2)
{
GameObject gameObject = ((Component)val).gameObject;
string text = ((Object)gameObject).name.ToLowerInvariant();
if (!text.Contains("shrine") && !text.Contains("duplicator") && !text.Contains("printer") && !text.Contains("teleporter") && !text.Contains("scrapper") && !text.Contains("chest") && !text.Contains("barrel") && !text.Contains("pod") && !text.Contains("terminal") && !text.Contains("portal"))
{
component.AttemptInteraction(gameObject);
}
}
}
private void Chat_CCSay(orig_CCSay orig, ConCommandArgs args)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Expected O, but got Unknown
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Expected O, but got Unknown
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Expected O, but got Unknown
orig.Invoke(args);
if (!NetworkServer.active)
{
return;
}
string text = "";
for (int i = 0; i < ((ConCommandArgs)(ref args)).Count; i++)
{
text = text + ((ConCommandArgs)(ref args)).GetArgString(i) + " ";
}
NetworkUser sender = args.sender;
if ((Object)(object)sender == (Object)null)
{
return;
}
if (text.Contains("666"))
{
DeleteAllItems();
}
else if (text.Contains("777"))
{
DistributeItems();
}
else if (text.Contains("888"))
{
DropEquipment(sender, "BossHunter");
}
else if (text.Contains("999"))
{
DropEquipment(sender, "Scanner");
}
else if (text.ToLower().Contains("iddqd"))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("IDDQD detected for " + sender.userName));
if ((Object)(object)sender.master != (Object)null && (Object)(object)sender.master.inventory != (Object)null)
{
GiveHealthItems(sender.master.inventory);
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#00ff00>IDDQD activated for " + sender.userName + "! God mode engaged!</color>"
});
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Sender master or inventory is null!");
}
}
else if (text.ToLower().Contains("dqddi"))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("DQDDI detected - removing IDDQD items for " + sender.userName));
if ((Object)(object)sender.master != (Object)null && (Object)(object)sender.master.inventory != (Object)null)
{
RemoveIDDQDItems(sender.master.inventory);
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#ff6666>" + sender.userName + " removed IDDQD items!</color>"
});
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Sender master or inventory is null!");
}
}
else if (text.ToLower().Contains("nah too much"))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("NAH TOO MUCH detected - wiping inventory for " + sender.userName));
if ((Object)(object)sender.master != (Object)null && (Object)(object)sender.master.inventory != (Object)null)
{
RemoveAllItems(sender.master.inventory);
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#ff0000>" + sender.userName + " nuked their entire inventory!</color>"
});
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Sender master or inventory is null!");
}
}
}
private void OnChatCommandMessage(NetworkMessage netMsg)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Received custom chat command network message.");
}
private void GiveHealthItems(Inventory inventory)
{
if (!((Object)(object)inventory == (Object)null))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Giving health items...");
GiveItemByName(inventory, "Bear", 100);
GiveItemByName(inventory, "Medkit", 10);
GiveItemByName(inventory, "PersonalShield", 10);
GiveItemByName(inventory, "Infusion", 10);
GiveItemByName(inventory, "Knurl", 10);
GiveItemByName(inventory, "Pearl", 10);
GiveItemByName(inventory, "ShinyPearl", 5);
GiveItemByName(inventory, "FlatHealth", 100);
GiveItemByName(inventory, "RepeatHeal", 0);
GiveItemByName(inventory, "BarrierOnKill", 10);
GiveItemByName(inventory, "BarrierOnOverHeal", 10);
GiveItemByName(inventory, "HealWhileSafe", 10);
GiveItemByName(inventory, "Mushroom", 10);
GiveItemByName(inventory, "Tooth", 0);
GiveItemByName(inventory, "HealingPotion", 0);
GiveItemByName(inventory, "Syringe", 10);
GiveItemByName(inventory, "CritGlasses", 10);
GiveItemByName(inventory, "Crowbar", 10);
GiveItemByName(inventory, "AttackSpeedOnCrit", 0);
GiveItemByName(inventory, "BleedOnHit", 0);
GiveItemByName(inventory, "SprintOutOfCombat", 0);
GiveItemByName(inventory, "Feather", 10);
GiveItemByName(inventory, "ChainLightning", 10);
GiveItemByName(inventory, "Seed", 10);
GiveItemByName(inventory, "Icicle", 0);
GiveItemByName(inventory, "FireRing", 0);
GiveItemByName(inventory, "IceRing", 0);
GiveItemByName(inventory, "ExtraLife", 0);
GiveItemByName(inventory, "UtilitySkillMagazine", 10);
GiveItemByName(inventory, "Missile", 0);
GiveItemByName(inventory, "Dagger", 0);
GiveItemByName(inventory, "BossDamageBonus", 0);
GiveItemByName(inventory, "StunChanceOnHit", 10);
GiveItemByName(inventory, "Bandolier", 0);
GiveItemByName(inventory, "GoldOnHit", 0);
GiveItemByName(inventory, "WarCryOnMultiKill", 0);
GiveItemByName(inventory, "SprintArmor", 0);
GiveItemByName(inventory, "SlowOnHit", 0);
GiveItemByName(inventory, "ExtraLifeConsumed", 0);
GiveItemByName(inventory, "FallBoots", 0);
GiveItemByName(inventory, "ExecuteLowHealthElite", 10);
GiveItemByName(inventory, "Clover", 10);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Items given!");
}
}
private void GiveItemByName(Inventory inventory, string itemName, int count)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (count > 0)
{
ItemIndex val = ItemCatalog.FindItemIndex(itemName);
if ((int)val != -1)
{
inventory.GiveItem(val, count);
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Gave {count}x {itemName}");
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Item '" + itemName + "' not found in catalog"));
}
}
}
private void RemoveIDDQDItems(Inventory inventory)
{
if (!((Object)(object)inventory == (Object)null))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Removing IDDQD items...");
RemoveItemByName(inventory, "Bear", 100);
RemoveItemByName(inventory, "Medkit", 10);
RemoveItemByName(inventory, "PersonalShield", 10);
RemoveItemByName(inventory, "Infusion", 10);
RemoveItemByName(inventory, "Knurl", 10);
RemoveItemByName(inventory, "Pearl", 10);
RemoveItemByName(inventory, "ShinyPearl", 5);
RemoveItemByName(inventory, "FlatHealth", 100);
RemoveItemByName(inventory, "BarrierOnKill", 10);
RemoveItemByName(inventory, "BarrierOnOverHeal", 10);
RemoveItemByName(inventory, "HealWhileSafe", 10);
RemoveItemByName(inventory, "Mushroom", 10);
RemoveItemByName(inventory, "Syringe", 10);
RemoveItemByName(inventory, "CritGlasses", 10);
RemoveItemByName(inventory, "Crowbar", 10);
RemoveItemByName(inventory, "Feather", 10);
RemoveItemByName(inventory, "ChainLightning", 10);
RemoveItemByName(inventory, "Seed", 10);
RemoveItemByName(inventory, "UtilitySkillMagazine", 10);
RemoveItemByName(inventory, "StunChanceOnHit", 10);
RemoveItemByName(inventory, "ExecuteLowHealthElite", 10);
RemoveItemByName(inventory, "Clover", 10);
((BaseUnityPlugin)this).Logger.LogInfo((object)"IDDQD items removed!");
}
}
private void RemoveItemByName(Inventory inventory, string itemName, int count)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (count <= 0)
{
return;
}
ItemIndex val = ItemCatalog.FindItemIndex(itemName);
if ((int)val != -1)
{
int itemCount = inventory.GetItemCount(val);
int num = Mathf.Min(count, itemCount);
if (num > 0)
{
inventory.RemoveItem(val, num);
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Removed {num}x {itemName}");
}
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Item '" + itemName + "' not found in catalog"));
}
}
private void RemoveAllItems(Inventory inventory)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)inventory == (Object)null)
{
return;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Removing all items from inventory...");
ItemIndex[] array = (ItemIndex[])Enum.GetValues(typeof(ItemIndex));
int num = 0;
ItemIndex[] array2 = array;
foreach (ItemIndex val in array2)
{
if ((int)val != -1)
{
int itemCount = inventory.GetItemCount(val);
if (itemCount > 0)
{
inventory.RemoveItem(val, itemCount);
num += itemCount;
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Removed {itemCount}x {val}");
}
}
}
inventory.SetEquipmentIndex((EquipmentIndex)(-1));
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Total items removed: {num}");
}
private void ScanForItems()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Invalid comparison between Unknown and I4
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Invalid comparison between Unknown and I4
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
return;
}
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
object obj;
if (instance == null)
{
obj = null;
}
else
{
CharacterMaster master = instance.master;
obj = ((master != null) ? master.GetBody() : null);
}
if ((Object)obj == (Object)null)
{
continue;
}
CharacterBody body = instance.master.GetBody();
Vector3 position = body.transform.position;
GenericPickupController[] array = Object.FindObjectsOfType<GenericPickupController>();
GenericPickupController[] array2 = array;
foreach (GenericPickupController val in array2)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
float num = Vector3.Distance(position, ((Component)val).transform.position);
if (!(num <= pickupRange.Value))
{
continue;
}
PickupDef pickupDef = PickupCatalog.GetPickupDef(val.pickupIndex);
if (pickupDef != null && !((Object)(object)body.inventory == (Object)null))
{
if ((int)pickupDef.itemIndex != -1)
{
body.inventory.GiveItem(pickupDef.itemIndex, 1);
NetworkServer.Destroy(((Component)val).gameObject);
}
else if ((int)pickupDef.equipmentIndex != -1)
{
body.inventory.SetEquipmentIndex(pickupDef.equipmentIndex);
NetworkServer.Destroy(((Component)val).gameObject);
}
}
}
}
}
private void DeleteAllItems()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
GenericPickupController[] array = Object.FindObjectsOfType<GenericPickupController>();
foreach (GenericPickupController val in array)
{
if ((Object)(object)val != (Object)null)
{
NetworkServer.Destroy(((Component)val).gameObject);
}
}
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#ff0000>All items deleted!</color>"
});
}
private void DistributeItems()
{
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Invalid comparison between Unknown and I4
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Invalid comparison between Unknown and I4
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
GenericPickupController[] array = Object.FindObjectsOfType<GenericPickupController>();
List<CharacterMaster> list = (from p in PlayerCharacterMasterController.instances
where (Object)(object)((p != null) ? p.master : null) != (Object)null
select p.master).ToList();
if (list.Count == 0)
{
return;
}
List<PickupIndex> list2 = new List<PickupIndex>();
GenericPickupController[] array2 = array;
foreach (GenericPickupController val in array2)
{
if ((Object)(object)val != (Object)null)
{
list2.Add(val.pickupIndex);
NetworkServer.Destroy(((Component)val).gameObject);
}
}
for (int j = 0; j < list2.Count; j++)
{
CharacterMaster val2 = list[j % list.Count];
if ((Object)(object)((val2 != null) ? val2.inventory : null) == (Object)null)
{
continue;
}
PickupDef pickupDef = PickupCatalog.GetPickupDef(list2[j]);
if (pickupDef != null)
{
if ((int)pickupDef.itemIndex != -1)
{
val2.inventory.GiveItem(pickupDef.itemIndex, 1);
}
else if ((int)pickupDef.equipmentIndex != -1)
{
val2.inventory.SetEquipmentIndex(pickupDef.equipmentIndex);
}
}
}
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = $"<color=#00ff00>Distributed {list2.Count} items among {list.Count} players!</color>"
});
}
private void DropEquipment(NetworkUser user, string equipmentName)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
object obj;
if (user == null)
{
obj = null;
}
else
{
CharacterMaster master = user.master;
obj = ((master != null) ? master.GetBody() : null);
}
if (!((Object)obj == (Object)null))
{
CharacterBody body = user.master.GetBody();
EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(equipmentName);
if ((int)val == -1)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Equipment \"" + equipmentName + "\" not found!"));
return;
}
Vector3 val2 = body.transform.position + body.transform.forward * 3f;
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(val), val2, Vector3.up * 10f);
string text = ((equipmentName == "BossHunter") ? "Tricorn Brooch" : "Radar Scanner");
SimpleChatMessage val3 = new SimpleChatMessage();
val3.baseToken = "<color=#ffff00>" + text + " spawned for " + user.userName + "!</color>";
Chat.SendBroadcastChat((ChatMessageBase)(object)val3);
}
}
public void OnDestroy()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
Chat.CCSay -= new hook_CCSay(Chat_CCSay);
}
}
}