using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DroppableThings.Properties;
using HarmonyLib;
using R2API.Networking;
using R2API.Networking.Interfaces;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Artifacts;
using RoR2.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DroppableThings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DroppableThings")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dde6bced-877a-4e2a-b8ba-a7f4a52d3261")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DroppableThings
{
public static class ModdedScraps
{
public static void Register(ItemTier targetTier, PickupIndex scrapPickupIndex)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//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_0009: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
PickupIndex val = PickupCatalog.FindScrapIndexForItemTier(targetTier);
if (val != PickupIndex.none || Plugin.instance.moddedScraps.ContainsKey(targetTier))
{
Plugin.instance.logger.LogMessage((object)("This tier \"" + ((object)(ItemTier)(ref targetTier)).ToString() + "\" already has a scrap."));
}
else
{
Plugin.instance.moddedScraps.Add(targetTier, scrapPickupIndex);
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("bulletbot.droppablethings", "DroppableThings", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private static class RiskOfOptions
{
public static bool IsLoaded()
{
return Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
}
public static void OnAwake()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_009f: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
Bitmap icon = Resources.icon;
using (MemoryStream memoryStream = new MemoryStream())
{
((Image)icon).Save((Stream)memoryStream, ImageFormat.Png);
Texture2D val = new Texture2D(((Image)icon).Width, ((Image)icon).Height, (TextureFormat)5, false, false);
ImageConversion.LoadImage(val, memoryStream.ToArray());
((Texture)val).filterMode = (FilterMode)0;
ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)));
}
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.dropItems));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.dropEquipments));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.useCommandEssence));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.dropCoins));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.scrapItems));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.scrapDropOnGround));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.rightClick));
}
}
internal class ClickHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
{
public PickupIndex pickupIndex;
private void Awake()
{
if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<GraphicRaycaster>()))
{
((Component)this).gameObject.AddComponent<GraphicRaycaster>();
}
}
public void OnPointerClick(PointerEventData eventData)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Invalid comparison between Unknown and I4
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Invalid comparison between Unknown and I4
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Invalid comparison between Unknown and I4
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Invalid comparison between Unknown and I4
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
CharacterBody cachedBody = LocalUserManager.GetFirstLocalUser().cachedBody;
if (((PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex) == pickupIndex || PickupCatalog.FindPickupIndex(MiscPickups.VoidCoin.miscPickupIndex) == pickupIndex) && !instance.dropCoins.Value) || ((((int)eventData.button != 1 && instance.rightClick.Value) || ((int)eventData.button != 0 && !instance.rightClick.Value)) && pickupIndex != PickupIndex.none && (Object)(object)cachedBody != (Object)null && (Object)(object)cachedBody.currentVehicle == (Object)null))
{
return;
}
ItemIndex val = (ItemIndex)(-1);
GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
AllItemsEnumerator enumerator = allItems.GetEnumerator();
try
{
while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
{
ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
if (PickupCatalog.FindPickupIndex(current) == pickupIndex && (Object)(object)ItemTierCatalog.GetItemTierDef(ItemCatalog.GetItemDef(current).tier) != (Object)null)
{
val = current;
break;
}
}
}
finally
{
((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
}
if (Input.GetKey((KeyCode)308) && (int)val != -1)
{
if (instance.scrapItems.Value)
{
instance.TryScrap(cachedBody, val, instance.scrapDropOnGround.Value);
}
return;
}
EquipmentIndex val2 = (EquipmentIndex)(-1);
GenericStaticEnumerable<EquipmentIndex, AllEquipmentEnumerator> allEquipment = EquipmentCatalog.allEquipment;
AllEquipmentEnumerator enumerator2 = allEquipment.GetEnumerator();
try
{
while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext())
{
EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current;
if (PickupCatalog.FindPickupIndex(current2) == pickupIndex)
{
val2 = current2;
break;
}
}
}
finally
{
((IDisposable)(AllEquipmentEnumerator)(ref enumerator2)).Dispose();
}
if (((int)val == -1 || instance.dropItems.Value) && ((int)val2 == -1 || instance.dropEquipments.Value))
{
instance.TryDrop(cachedBody, pickupIndex, instance.useCommandEssence.Value);
}
}
}
internal class DropRequest : INetMessage, ISerializableObject
{
public CharacterBody body;
public PickupIndex pickupIndex;
public bool useCommandEssence;
public void Serialize(NetworkWriter writer)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
writer.Write(((Component)body).gameObject);
NetworkExtensions.Write(writer, pickupIndex);
writer.Write(useCommandEssence);
}
public void Deserialize(NetworkReader reader)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
body = reader.ReadGameObject().GetComponent<CharacterBody>();
pickupIndex = NetworkExtensions.ReadPickupIndex(reader);
useCommandEssence = reader.ReadBoolean();
}
public void OnReceived()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (NetworkServer.active)
{
instance.TryDrop(body, pickupIndex, useCommandEssence);
}
}
}
internal class ScrapRequest : INetMessage, ISerializableObject
{
public CharacterBody body;
public ItemIndex itemIndex;
public bool dropOnGround;
public void Serialize(NetworkWriter writer)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
writer.Write(((Component)body).gameObject);
NetworkExtensions.Write(writer, itemIndex);
writer.Write(dropOnGround);
}
public void Deserialize(NetworkReader reader)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
body = reader.ReadGameObject().GetComponent<CharacterBody>();
itemIndex = NetworkExtensions.ReadItemIndex(reader);
dropOnGround = reader.ReadBoolean();
}
public void OnReceived()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (NetworkServer.active)
{
instance.TryScrap(body, itemIndex, dropOnGround);
}
}
}
private const string modGUID = "bulletbot.droppablethings";
private const string modName = "DroppableThings";
private const string modVer = "1.0.0";
private const string riskOfOptionsModGUID = "com.rune580.riskofoptions";
internal static Plugin instance;
internal ManualLogSource logger;
private readonly Harmony harmony = new Harmony("bulletbot.droppablethings");
private ConfigEntry<bool> dropItems;
private ConfigEntry<bool> dropEquipments;
private ConfigEntry<bool> useCommandEssence;
private ConfigEntry<bool> dropCoins;
private ConfigEntry<bool> scrapItems;
private ConfigEntry<bool> scrapDropOnGround;
private ConfigEntry<bool> rightClick;
private Dictionary<EquipmentIcon, EquipmentIndex> equipmentIcons = new Dictionary<EquipmentIcon, EquipmentIndex>();
internal Dictionary<ItemTier, PickupIndex> moddedScraps = new Dictionary<ItemTier, PickupIndex>();
private void Awake()
{
instance = this;
logger = Logger.CreateLogSource("DroppableThings");
string text = "General";
dropItems = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Items", true, "Determines whether to be able to drop items.");
dropEquipments = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Equipments", true, "Determines whether to be able to drop equipments.");
useCommandEssence = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Use Command Essence", false, "Determines whether the dropped item becomes an essence when the Artifact of Command is enabled. Note: If the item didn't turn into an essence, only one item was available for selection.");
dropCoins = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Coins", true, "Determines whether to be able to drop coins.");
scrapItems = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Scrap Items", true, "Determines whether to be able to scrap items. Note: To scrap items, hold left-alt and click on them.");
scrapDropOnGround = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Scrap On Ground", true, "Determines whether the scrapped item should drop on the ground.");
rightClick = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Right-click Instead Of Left-click", false, "Determines whether to drop/scrap with right-click instead of left-click.");
NetworkingAPI.RegisterMessageType<DropRequest>();
NetworkingAPI.RegisterMessageType<ScrapRequest>();
if (RiskOfOptions.IsLoaded())
{
RiskOfOptions.OnAwake();
}
Stage.onStageStartGlobal += delegate
{
equipmentIcons.Clear();
};
harmony.PatchAll();
}
internal void HandleEquipmentIcon(EquipmentIcon equipmentIcon, EquipmentIndex equipmentIndex)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Invalid comparison between Unknown and I4
//IL_0073: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (!equipmentIcons.ContainsKey(equipmentIcon) || equipmentIcons[equipmentIcon] != equipmentIndex)
{
if ((int)equipmentIndex == -1)
{
OnEquipmentRemoved();
}
equipmentIcons[equipmentIcon] = equipmentIndex;
GameObject gameObject = ((Component)equipmentIcon).gameObject;
ClickHandler clickHandler = gameObject.GetComponent<ClickHandler>();
if ((Object)(object)clickHandler == (Object)null)
{
clickHandler = gameObject.AddComponent<ClickHandler>();
}
clickHandler.pickupIndex = (((int)equipmentIndex == -1) ? PickupIndex.none : PickupCatalog.FindPickupIndex(equipmentIndex));
}
}
private void OnEquipmentRemoved()
{
foreach (EquipmentIcon item in equipmentIcons.Select((KeyValuePair<EquipmentIcon, EquipmentIndex> x) => x.Key))
{
if (string.IsNullOrEmpty(item.tooltipProvider.titleToken))
{
item.tooltipProvider.overrideTitleText = "";
item.tooltipProvider.overrideBodyText = "";
EventSystem current2 = EventSystem.current;
TooltipController.RemoveTooltip((MPEventSystem)(object)((current2 is MPEventSystem) ? current2 : null), item.tooltipProvider);
}
}
}
private void TryDrop(CharacterBody body, PickupIndex pickupIndex, bool useCommandEssence)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//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_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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: 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_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: 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_01e4: 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)
if ((Object)(object)body == (Object)null || (Object)(object)body.currentVehicle != (Object)null)
{
return;
}
if (!NetworkServer.active)
{
NetMessageExtensions.Send((INetMessage)(object)new DropRequest
{
body = body,
pickupIndex = pickupIndex,
useCommandEssence = useCommandEssence
}, (NetworkDestination)2);
return;
}
CharacterMaster master = body.master;
if (PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex) == pickupIndex)
{
NetworkUser networkUser = master.playerCharacterMasterController.networkUser;
if (networkUser.lunarCoins == 0)
{
return;
}
networkUser.DeductLunarCoins(1u);
}
else if (PickupCatalog.FindPickupIndex(MiscPickups.VoidCoin.miscPickupIndex) == pickupIndex)
{
if (master.voidCoins == 0)
{
return;
}
uint voidCoins = master.voidCoins;
master.voidCoins = voidCoins - 1;
}
else
{
Inventory inventory = master.inventory;
bool flag = false;
GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
AllItemsEnumerator enumerator = allItems.GetEnumerator();
try
{
while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
{
ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
if (PickupCatalog.FindPickupIndex(current) == pickupIndex && (Object)(object)ItemTierCatalog.GetItemTierDef(ItemCatalog.GetItemDef(current).tier) != (Object)null)
{
if (inventory.GetItemCount(current) > 0)
{
inventory.RemoveItem(current, 1);
flag = true;
}
break;
}
}
}
finally
{
((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
}
GenericStaticEnumerable<EquipmentIndex, AllEquipmentEnumerator> allEquipment = EquipmentCatalog.allEquipment;
AllEquipmentEnumerator enumerator2 = allEquipment.GetEnumerator();
try
{
while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext())
{
EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current;
if (flag)
{
break;
}
if (!(PickupCatalog.FindPickupIndex(current2) == pickupIndex))
{
continue;
}
int num = -1;
for (uint num2 = 0u; num2 < inventory.GetEquipmentSlotCount(); num2++)
{
if (inventory.GetEquipment(num2).equipmentIndex == current2)
{
num = (int)num2;
break;
}
}
if (num != -1)
{
inventory.SetEquipmentIndexForSlot((EquipmentIndex)(-1), (uint)num);
flag = true;
break;
}
}
}
finally
{
((IDisposable)(AllEquipmentEnumerator)(ref enumerator2)).Dispose();
}
if (!flag)
{
return;
}
}
CreateDroplet(body, pickupIndex, useCommandEssence);
}
private void TryScrap(CharacterBody body, ItemIndex itemIndex, bool dropOnGround)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_003e: 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)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)body == (Object)null || (Object)(object)body.currentVehicle != (Object)null)
{
return;
}
if (!NetworkServer.active)
{
NetMessageExtensions.Send((INetMessage)(object)new ScrapRequest
{
body = body,
itemIndex = itemIndex,
dropOnGround = dropOnGround
}, (NetworkDestination)2);
return;
}
PickupIndex val = PickupIndex.none;
GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
AllItemsEnumerator enumerator = allItems.GetEnumerator();
try
{
while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
{
ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
if (itemIndex == current)
{
ItemTier tier = ItemCatalog.GetItemDef(itemIndex).tier;
val = PickupCatalog.FindScrapIndexForItemTier(tier);
if (val == PickupIndex.none && moddedScraps.ContainsKey(tier))
{
val = moddedScraps[tier];
}
break;
}
}
}
finally
{
((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose();
}
if (val == PickupIndex.none)
{
return;
}
ItemIndex itemIndex2 = PickupCatalog.GetPickupDef(val).itemIndex;
if (itemIndex2 != itemIndex)
{
Inventory inventory = body.inventory;
inventory.RemoveItem(itemIndex, 1);
if (dropOnGround)
{
CreateDroplet(body, val, useCommandEssence: false);
}
else
{
inventory.GiveItem(itemIndex2, 1);
}
}
}
private void CreateDroplet(CharacterBody body, PickupIndex pickupIndex, bool useCommandEssence)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0024: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0036: 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)
Vector3 position = ((Component)body).transform.position;
CreatePickupInfo val = default(CreatePickupInfo);
val.position = position;
val.rotation = Quaternion.identity;
((CreatePickupInfo)(ref val)).pickupIndex = pickupIndex;
CreatePickupInfo pickupInfo = val;
CreateDroplet(pickupInfo, position, body.inputBank.aimDirection, useCommandEssence);
}
private void CreateDroplet(CreatePickupInfo pickupInfo, Vector3 position, Vector3 direction, bool useCommandEssence)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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_008e: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
if (useCommandEssence && CommandArtifactManager.IsCommandArtifactEnabled)
{
Option[] array = (Option[])AccessTools.Method(typeof(PickupPickerController), "GetOptionsFromPickupIndex", (Type[])null, (Type[])null).Invoke(null, new object[1] { ((CreatePickupInfo)(ref pickupInfo)).pickupIndex });
if (array.Length > 1)
{
ref PickupArtifactFlag artifactFlag = ref pickupInfo.artifactFlag;
artifactFlag = (PickupArtifactFlag)((uint)artifactFlag | 1u);
}
}
GameObject val = Object.Instantiate<GameObject>((GameObject)AccessTools.Field(typeof(PickupDropletController), "pickupDropletPrefab").GetValue(null), position, Quaternion.identity);
PickupDropletController component = val.GetComponent<PickupDropletController>();
if ((Object)(object)component != (Object)null)
{
AccessTools.Field(typeof(PickupDropletController), "createPickupInfo").SetValue(component, pickupInfo);
component.NetworkpickupIndex = ((CreatePickupInfo)(ref pickupInfo)).pickupIndex;
}
Rigidbody component2 = val.GetComponent<Rigidbody>();
component2.velocity = Quaternion.AngleAxis(Vector3.SignedAngle(Vector3.forward, new Vector3(direction.x, 0f, direction.z), Vector3.up), Vector3.up) * (Vector3.up * 15f + Vector3.forward * 5f);
component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere);
NetworkServer.Spawn(val);
}
}
}
namespace DroppableThings.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("DroppableThings.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static Bitmap icon
{
get
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
object @object = ResourceManager.GetObject("icon", resourceCulture);
return (Bitmap)@object;
}
}
internal Resources()
{
}
}
}
namespace DroppableThings.Patches
{
[HarmonyPatch(typeof(ScoreboardStrip))]
internal class ScoreboardStripPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void Update(EquipmentIcon ___equipmentIcon, CharacterMaster ___userPlayerCharacterMasterController)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)LocalUserManager.GetFirstLocalUser().cachedMasterController != (Object)(object)___userPlayerCharacterMasterController) && (Object)(object)___equipmentIcon.targetInventory != (Object)null)
{
Plugin.instance.HandleEquipmentIcon(___equipmentIcon, ___equipmentIcon.targetInventory.GetEquipmentIndex());
}
}
}
[HarmonyPatch(typeof(EquipmentIcon))]
internal class EquipmentIconPatch
{
[HarmonyPatch("SetDisplayData")]
[HarmonyPostfix]
private static void SetDisplayData(EquipmentIcon __instance, CharacterMaster ___playerCharacterMasterController)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)LocalUserManager.GetFirstLocalUser().cachedMasterController != (Object)(object)___playerCharacterMasterController) && (Object)(object)__instance.targetEquipmentSlot != (Object)null)
{
Plugin.instance.HandleEquipmentIcon(__instance, __instance.targetEquipmentSlot.equipmentIndex);
}
}
}
[HarmonyPatch(typeof(ItemInventoryDisplay))]
internal class ItemInventoryDisplayPatch
{
[HarmonyPatch("UpdateDisplay")]
[HarmonyPostfix]
private static void UpdateDisplay(List<ItemIcon> ___itemIcons)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
foreach (ItemIcon ___itemIcon in ___itemIcons)
{
GameObject gameObject = ((Component)___itemIcon).gameObject;
Plugin.ClickHandler clickHandler = gameObject.GetComponent<Plugin.ClickHandler>();
if ((Object)(object)clickHandler == (Object)null)
{
clickHandler = gameObject.AddComponent<Plugin.ClickHandler>();
}
clickHandler.pickupIndex = PickupCatalog.FindPickupIndex((ItemIndex)AccessTools.Field(typeof(ItemIcon), "itemIndex").GetValue(___itemIcon));
}
}
}
[HarmonyPatch(typeof(HUD))]
internal class HUDPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void Awake(HUD __instance)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references)
__instance.lunarCoinContainer.AddComponent<Plugin.ClickHandler>().pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex);
__instance.voidCoinContainer.AddComponent<Plugin.ClickHandler>().pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.VoidCoin.miscPickupIndex);
}
}
}