using System;
using System.Collections;
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("autopickup")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("autopickup")]
[assembly: AssemblyTitle("autopickup")]
[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 AutoCommandEssencePickup
{
[BepInPlugin("com.gogogadgetjustice.autopickup", "Auto Pickup", "2.0.0")]
public class AutoEssencePickup : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <KeepDroppingBossHunters>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public AutoEssencePickup <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <KeepDroppingBossHunters>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)<>4__this.currentBossHunterUser != (Object)null && (Object)(object)<>4__this.currentBossHunterUser.master != (Object)null)
{
<>4__this.DropSpecificEquipment(<>4__this.currentBossHunterUser, "BossHunter");
}
<>2__current = (object)new WaitForSeconds(2.5f);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public const string PluginGUID = "com.gogogadgetjustice.autopickup";
public const string PluginName = "Auto Pickup";
public const string PluginVersion = "2.0.0";
private ConfigEntry<float> scanRadius;
private ConfigEntry<bool> modEnabled;
private float drifterBagTimer = 0f;
private const float DRIFTER_BAG_DELAY = 3f;
private Coroutine bossHunterCoroutine = null;
private NetworkUser currentBossHunterUser = null;
public void Awake()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Is the auto-pickup active?");
scanRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ScanRadius", 1.5f, "Radius for interaction scan.");
((BaseUnityPlugin)this).Logger.LogInfo((object)"AutoEssencePickup 2.0.0: Legendary Chests, IDDQD, and IDKFA Loaded.");
Chat.CCSay += new hook_CCSay(Chat_CCSay);
Stage.Start += new hook_Start(Stage_Start);
}
private IEnumerator Stage_Start(orig_Start orig, Stage self)
{
drifterBagTimer = 0f;
return orig.Invoke(self);
}
public void Update()
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Invalid comparison between Unknown and I4
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Invalid comparison between Unknown and I4
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Invalid comparison between Unknown and I4
if (!modEnabled.Value || !NetworkServer.active)
{
return;
}
LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
if ((Object)(object)((firstLocalUser != null) ? firstLocalUser.cachedBody : null) == (Object)null)
{
return;
}
CharacterBody cachedBody = firstLocalUser.cachedBody;
bool flag = cachedBody.baseNameToken == "DRIFTER_BODY_NAME";
if (flag && drifterBagTimer < 3f)
{
drifterBagTimer += Time.deltaTime;
return;
}
Interactor component = ((Component)cachedBody).GetComponent<Interactor>();
if ((Object)(object)component == (Object)null)
{
return;
}
Collider[] array = Physics.OverlapSphere(((Component)cachedBody).transform.position, scanRadius.Value);
Collider[] array2 = array;
foreach (Collider val in array2)
{
GameObject gameObject = ((Component)val).gameObject;
string text = ((Object)gameObject).name.ToLowerInvariant();
if ((flag && (text.Contains("drifter") || text.Contains("scrap") || text.Contains("consume") || text.Contains("bag"))) || 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") || text.Contains("equipmentpickup") || text.Contains("commandcube") || text.Contains("command") || text.Contains("optioncube") || text.Contains("pickupdroplet"))
{
continue;
}
GenericPickupController component2 = gameObject.GetComponent<GenericPickupController>();
if ((Object)(object)component2 != (Object)null)
{
PickupDef pickupDef = PickupCatalog.GetPickupDef(component2.pickupIndex);
if (pickupDef != null && (int)pickupDef.equipmentIndex != -1)
{
continue;
}
if (pickupDef != null && (int)pickupDef.itemIndex != -1)
{
ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
if ((Object)(object)itemDef != (Object)null && (int)itemDef.tier == 4)
{
continue;
}
}
}
if (!((Object)(object)gameObject.GetComponent<PickupPickerController>() != (Object)null))
{
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_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Expected O, but got Unknown
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Expected O, but got Unknown
//IL_0204: Expected O, but got Unknown
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Expected O, but got Unknown
//IL_0872: Unknown result type (might be due to invalid IL or missing references)
//IL_0877: Unknown result type (might be due to invalid IL or missing references)
//IL_0879: Unknown result type (might be due to invalid IL or missing references)
//IL_087c: Invalid comparison between Unknown and I4
//IL_0889: Unknown result type (might be due to invalid IL or missing references)
//IL_08b4: Unknown result type (might be due to invalid IL or missing references)
//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
//IL_08c8: Unknown result type (might be due to invalid IL or missing references)
//IL_08d8: Expected O, but got Unknown
//IL_0939: Unknown result type (might be due to invalid IL or missing references)
//IL_093e: Unknown result type (might be due to invalid IL or missing references)
//IL_094e: Expected O, but got Unknown
//IL_099f: Unknown result type (might be due to invalid IL or missing references)
//IL_09a4: Unknown result type (might be due to invalid IL or missing references)
//IL_09b4: Expected O, but got Unknown
orig.Invoke(args);
if (!NetworkServer.active)
{
return;
}
string text = string.Join(" ", args.userArgs).ToLower().Trim();
NetworkUser sender = args.sender;
if ((Object)(object)((sender != null) ? sender.master : null) == (Object)null)
{
return;
}
Inventory inventory = sender.master.inventory;
if (text == "666")
{
List<GenericPickupController> list = InstanceTracker.GetInstancesList<GenericPickupController>().ToList();
foreach (GenericPickupController item in list)
{
if (Object.op_Implicit((Object)(object)item))
{
NetworkServer.Destroy(((Component)item).gameObject);
}
}
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#ff0000>Items Purged.</color>"
});
return;
}
if (text == "777")
{
DistributeItems();
return;
}
if (text.Contains("mountain") || text.Contains("oh hey"))
{
if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
{
TeleporterInteraction.instance.AddShrineStack();
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bd6aff>" + sender.userName + " invoked the mountain!</color>"
});
}
return;
}
if (text.Contains("what's in the box"))
{
CharacterBody body = sender.master.GetBody();
SpawnCard val = Resources.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/iscGoldChest");
if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)val))
{
DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule
{
placementMode = (PlacementMode)0,
position = ((Component)body).transform.position + ((Component)body).transform.forward * 4f
}, new Xoroshiro128Plus(0uL)));
}
return;
}
switch (text)
{
case "iddqd":
GiveKit(inventory, new string[8] { "Bear", "Aegis", "Medkit", "FlatHealth", "Clover", "ItemDropChanceOnKill", "Knurl", "ShinyPearl" }, 20, "\"We do it wrong, being so majestical,\r\nTo offer it the show of violence,\r\nFor it is as the air, invulnerable,\r\nAnd our vain blows malicious mockery.\"");
return;
case "dqddi":
GiveKit(inventory, new string[8] { "Bear", "Aegis", "Medkit", "FlatHealth", "Clover", "ItemDropChanceOnKill", "Knurl", "ShinyPearl" }, -20, "Alas.");
return;
case "idkfa":
GiveKit(inventory, new string[14]
{
"IgniteOnKill", "ChainLightning", "ChainLightning", "Mushroom", "BleedOnHit", "Thorns", "Dagger", "ExplodeOnDeath", "Missile", "BleedOnHit",
"Behemoth", "Headhunter", "Seed", "MoreMissle"
}, 20, "idkfa");
return;
case "afkdi":
GiveKit(inventory, new string[14]
{
"IgniteOnKill", "ChainLightning", "ChainLightning", "Mushroom", "BleedOnHit", "Thorns", "Dagger", "ExplodeOnDeath", "Missile", "BleedOnHit",
"Behemoth", "HeadHunter", "Seed", "MoreMissile"
}, -20, "afkdi");
return;
case "idspispopd":
GiveKit(inventory, new string[11]
{
"Syringe", "CritGlasses", "Crowbar", "Missle", "Syringe", "CritGlasses", "CritDamage", "Crowbar", "Missile", "AttackSpeedOnCrit",
"ExecuteLowHealthElite"
}, 10, "If you prick us, do we not bleed?");
return;
case "idspud":
GiveKit(inventory, new string[11]
{
"Syringe", "CritGlasses", "Crowbar", "Missle", "Syringe", "CritGlasses", "CritDamage", "Crowbar", "Missile", "AttackSpeedOnCrit",
"ExecuteLowHealthElite"
}, -10, "Stop bleeding everywhere");
return;
case "dpopsipsdi":
GiveKit(inventory, new string[11]
{
"Syringe", "CritGlasses", "Crowbar", "Missle", "Syringe", "CritGlasses", "CritDamage", "Crowbar", "Missile", "AttackSpeedOnCrit",
"ExecuteLowHealthElite"
}, -10, "Stop bleeding every where");
return;
case "idclip":
GiveKit(inventory, new string[7] { "SprintBoost", "JumpBoost", "Feather", "StealthOnHeal", "Hoof", "SprintBonus", "SprintOutOfCombat" }, 20, "Clip loaded");
return;
case "pilcdi":
GiveKit(inventory, new string[7] { "SprintBoost", "JumpBoost", "Feather", "StealthOnHeal", "Hoof", "SprintBonus", "SprintOutOfCombat" }, -20, "Clip ejected");
return;
case "idfa":
GiveKit(inventory, new string[19]
{
"Bear", "Aegis", "Medkit", "FlatHealth", "Clover", "Gasoline", "Ukulele", "ChainLightning", "Mushroom", "BleedOnHit",
"Thorns", "Syringe", "CritGlasses", "Crowbar", "Missle", "SprintBoost", "JumpBoost", "Feather", "StealthOnHeal"
}, 5, "To take arms against a sea of troubles");
return;
case "afdi":
GiveKit(inventory, new string[19]
{
"Bear", "Aegis", "Medkit", "FlatHealth", "Clover", "Gasoline", "Ukulele", "ChainLightning", "Mushroom", "BleedOnHit",
"Thorns", "Syringe", "CritGlasses", "Crowbar", "Missle", "SprintBoost", "JumpBoost", "Feather", "StealthOnHeal"
}, -5, "And by opposing end them?");
return;
case "look around you":
DropSpecificEquipment(sender, "Scanner");
return;
}
if (text.Contains("cowards die many times") || text.Contains("coward"))
{
EquipmentIndex val2 = EquipmentCatalog.FindEquipmentIndex("HealAndRevive");
if ((int)val2 == -1)
{
return;
}
inventory.SetEquipmentIndex(val2);
CharacterBody body2 = sender.master.GetBody();
if (body2 != null)
{
HealthComponent healthComponent = body2.healthComponent;
if (healthComponent != null)
{
healthComponent.Heal(99999f, default(ProcChainMask), true);
}
}
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#99ff99>Cowards die many times before their deaths. The valiant never taste of death but once.</color>"
});
}
else if (text == "chauncey, my rancor rifle" || text.Contains("chauncey"))
{
if (bossHunterCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(bossHunterCoroutine);
}
currentBossHunterUser = sender;
bossHunterCoroutine = ((MonoBehaviour)this).StartCoroutine(KeepDroppingBossHunters());
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#ff6600>Right away, sir. Rancor rifles incoming!</color>"
});
}
else if ((text == "that'll do nicely, chauncey" || text.Contains("enough")) && bossHunterCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(bossHunterCoroutine);
bossHunterCoroutine = null;
currentBossHunterUser = null;
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#ff6600>Very good, sir.</color>"
});
}
}
[IteratorStateMachine(typeof(<KeepDroppingBossHunters>d__13))]
private IEnumerator KeepDroppingBossHunters()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <KeepDroppingBossHunters>d__13(0)
{
<>4__this = this
};
}
private void GiveKit(Inventory inventory, string[] items, int amount, string msg)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0016: Invalid comparison between Unknown and I4
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
foreach (string text in items)
{
ItemIndex val = ItemCatalog.FindItemIndex(text);
if ((int)val != -1)
{
if (amount > 0)
{
inventory.GiveItem(val, amount);
}
else
{
inventory.RemoveItem(val, inventory.GetItemCount(val));
}
}
}
if (!string.IsNullOrEmpty(msg))
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#ffff00>" + msg + "</color>"
});
}
}
private void DistributeItems()
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Invalid comparison between Unknown and I4
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Invalid comparison between Unknown and I4
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
List<GenericPickupController> list = InstanceTracker.GetInstancesList<GenericPickupController>().ToList();
List<CharacterMaster> list2 = (from p in PlayerCharacterMasterController.instances
where (Object)(object)((p != null) ? p.master : null) != (Object)null
select p.master).ToList();
if (list2.Count == 0)
{
return;
}
for (int i = 0; i < list.Count; i++)
{
PickupDef pickupDef = PickupCatalog.GetPickupDef(list[i].pickupIndex);
CharacterMaster val = list2[i % list2.Count];
if ((int)pickupDef.itemIndex != -1)
{
val.inventory.GiveItem(pickupDef.itemIndex, 1);
}
else if ((int)pickupDef.equipmentIndex != -1)
{
val.inventory.SetEquipmentIndex(pickupDef.equipmentIndex);
}
NetworkServer.Destroy(((Component)list[i]).gameObject);
}
}
private void DropSpecificEquipment(NetworkUser user, string equipName)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Invalid comparison between Unknown and I4
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(equipName);
if ((int)val != -1 && Object.op_Implicit((Object)(object)user.master.GetBody()))
{
PickupIndex val2 = PickupCatalog.FindPickupIndex(val);
PickupDropletController.CreatePickupDroplet(val2, ((Component)user.master.GetBody()).transform.position + Vector3.up * 3f, ((Component)user.master.GetBody()).transform.forward * 10f);
}
}
public void OnDestroy()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
Chat.CCSay -= new hook_CCSay(Chat_CCSay);
Stage.Start -= new hook_Start(Stage_Start);
}
}
}