using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using PressureDrop.Tweaks;
using Rewired;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("PressureDrop")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.5.1.0")]
[assembly: AssemblyInformationalVersion("1.5.1+f1c22b4401cfdf5517d2bcae3fc86dfc0430af18")]
[assembly: AssemblyProduct("PressureDrop")]
[assembly: AssemblyTitle("PressureDrop")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.1.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 PressureDrop
{
public static class ChatCommander
{
[CompilerGenerated]
private static class <>O
{
public static hook_RunCmd <0>__Console_RunCmd;
}
private static readonly Dictionary<string, Action<NetworkUser, string[]>> Commands = new Dictionary<string, Action<NetworkUser, string[]>>();
private static bool _hooked = false;
internal static void Hook()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
if (!_hooked)
{
_hooked = true;
object obj = <>O.<0>__Console_RunCmd;
if (obj == null)
{
hook_RunCmd val = Console_RunCmd;
<>O.<0>__Console_RunCmd = val;
obj = (object)val;
}
Console.RunCmd += (hook_RunCmd)obj;
}
}
private static void Console_RunCmd(orig_RunCmd orig, Console self, CmdSender sender, string concommandName, List<string> userArgs)
{
//IL_005b: 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_006a: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
string text = userArgs.FirstOrDefault();
string[] array = text?.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (!NetworkServer.active || !concommandName.Equals("say", StringComparison.InvariantCultureIgnoreCase) || string.IsNullOrWhiteSpace(text) || array == null || array.Length == 0 || !Commands.TryGetValue(array[0], out var value) || value == null)
{
orig.Invoke(self, sender, concommandName, userArgs);
return;
}
Chat.SendBroadcastChat((ChatMessageBase)new UserChatMessage
{
sender = ((Component)sender.networkUser).gameObject,
text = text
});
value(sender.networkUser, array);
}
public static bool Register(string token, Action<NetworkUser, string[]> action, bool replace = false)
{
if (Commands.ContainsKey(token))
{
if (!replace)
{
Plugin.Logger.LogWarning((object)("ChatCommander> A chat command is already registered under '" + token + "'"));
return false;
}
Plugin.Logger.LogWarning((object)("ChatCommander> '" + token + "' is replacing a previously registered chat command."));
}
Commands[token] = action;
string name = action.Method.DeclaringType.Assembly.GetName().Name;
name = ((name != typeof(ChatCommander).Assembly.GetName().Name) ? (" [from " + name + ".dll]") : "");
Plugin.Logger.LogInfo((object)("ChatCommander> Registering a chat command under '" + token + "'" + name));
return true;
}
public static bool Unregister(string token, Action<NetworkUser, string[]> action)
{
if (Commands.TryGetValue(token, out var value))
{
if (value == action)
{
Plugin.Logger.LogInfo((object)("ChatCommander> Unregistered '" + token + "' chat command."));
Commands.Remove(token);
return true;
}
Plugin.Logger.LogWarning((object)("ChatCommander> Could not unregister chat command '" + token + "' as the action does not match."));
}
else
{
Plugin.Logger.LogInfo((object)("ChatCommander> Could not unregister chat command '" + token + "' (not registered)."));
}
return false;
}
public static void Output(string message)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<style=cIsUtility>" + message + "</style>"
});
}
public static void OutputFail(string cmd, string message)
{
Output("<style=cDeath>Failed:</style> <color=#ffffff>" + cmd + "</color> " + message);
}
public static string GetColoredPickupLanguageString(ItemIndex itemIndex)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return GetColoredPickupLanguageString(PickupCatalog.FindPickupIndex(itemIndex));
}
public static string GetColoredPickupLanguageString(EquipmentIndex equipmentIndex)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return GetColoredPickupLanguageString(PickupCatalog.FindPickupIndex(equipmentIndex));
}
public static string GetColoredPickupLanguageString(PickupIndex pickupIndex)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return GetColoredPickupLanguageString(PickupCatalog.GetPickupDef(pickupIndex));
}
public static string GetColoredPickupLanguageString(PickupDef pickupDef)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
return Util.GenerateColoredString(Language.GetString(pickupDef.nameToken), Color32.op_Implicit(pickupDef.baseColor));
}
}
public sealed class Config
{
private readonly ConfigFile file;
private readonly ConfigEntry<float> pressurePlateTimer;
private readonly ConfigEntry<bool> dropEnabled;
private readonly ConfigEntry<bool> dropTeleporterEnabled;
private readonly ConfigEntry<bool> dropDeadEnabled;
private readonly ConfigEntry<bool> dropInvertDirection;
private readonly ConfigEntry<bool> dropVoidAllowed;
private readonly ConfigEntry<int> maxItemsToDropAtATime;
private readonly ConfigEntry<bool> dropRecyclableWhite;
private readonly ConfigEntry<bool> dropRecyclableGreen;
private readonly ConfigEntry<bool> dropRecyclableRed;
private readonly ConfigEntry<bool> dropRecyclableYellow;
private readonly ConfigEntry<bool> dropRecyclableLunar;
private readonly ConfigEntry<bool> dropRecyclableVoid;
private readonly ConfigEntry<bool> dropRecyclableEquipment;
private readonly ConfigEntry<bool> dropRecyclableEquipmentLunar;
private readonly ConfigEntry<bool> scoreboardShowChat;
private readonly ConfigEntry<bool> voidPickupConfirmAll;
private readonly ConfigEntry<bool> sendItemCostInChat;
private readonly ConfigEntry<bool> includeScrapInItemCost;
public float PressurePlateTimer => pressurePlateTimer.Value;
public bool DropEnabled => dropEnabled.Value;
public bool DropTeleporterEnabled => dropTeleporterEnabled.Value;
public bool DropDeadEnabled => dropDeadEnabled.Value;
public bool DropInvertDirection => dropInvertDirection.Value;
public bool DropVoidAllowed => dropVoidAllowed.Value;
public int MaxItemsToDropAtATime
{
get
{
if (maxItemsToDropAtATime.Value <= 0)
{
return 1;
}
return maxItemsToDropAtATime.Value;
}
}
public bool DropRecyclableWhite => dropRecyclableWhite.Value;
public bool DropRecyclableGreen => dropRecyclableGreen.Value;
public bool DropRecyclableRed => dropRecyclableRed.Value;
public bool DropRecyclableYellow => dropRecyclableYellow.Value;
public bool DropRecyclableLunar => dropRecyclableLunar.Value;
public bool DropRecyclableVoid => dropRecyclableVoid.Value;
public bool DropRecyclableEquipment => dropRecyclableEquipment.Value;
public bool DropRecyclableEquipmentLunar => dropRecyclableEquipmentLunar.Value;
public bool ScoreboardShowChat => scoreboardShowChat.Value;
public bool VoidPickupConfirmAll => voidPickupConfirmAll.Value;
public bool SendItemCostInChat => sendItemCostInChat.Value;
public bool IncludeScrapInItemCost => includeScrapInItemCost.Value;
internal void Reload()
{
Plugin.Logger.LogDebug((object)("Reloading " + file.ConfigFilePath.Substring(file.ConfigFilePath.LastIndexOf(Path.DirectorySeparatorChar) + 1)));
file.Reload();
}
public Config(ConfigFile config)
{
file = config;
pressurePlateTimer = config.Bind<float>("~Pressure Plates", "pressurePlateTimer", 30f, "The length of time (seconds) a pressure plate will remain pressed after being activated.\nZero disables time functionality (reverts to vanilla behaviour). Negative values prevent pressure plates from releasing once activated.");
dropEnabled = config.Bind<bool>("Drop Command", "dropEnabled", true, "Whether the /drop command should be enabled or not.");
dropTeleporterEnabled = config.Bind<bool>("Drop Command", "dropTeleporterEnabled", true, "Whether players should be able to send their drops to the Teleporter or not.");
dropDeadEnabled = config.Bind<bool>("Drop Command", "dropDeadEnabled", true, "Whether dead players should be able to drop items or not.\nRequires dropTeleporterEnabled to be true.");
dropVoidAllowed = config.Bind<bool>("Drop Command", "dropVoidAllowed", false, "Whether void items are allowed to be dropped or not.");
dropInvertDirection = config.Bind<bool>("Drop Command", "dropInvertDirection", false, "Whether items should be dropped opposite the aim direction or not.");
maxItemsToDropAtATime = config.Bind<int>("Drop Command", "maxItemsToDropAtATime", 10, "The maximum amount of items to drop from the player at a time (similar to Scrappers).\nMinimum value is 1.");
dropRecyclableWhite = config.Bind<bool>("Drop Recyclable", "dropRecyclableWhite", true, "Whether dropped white tier items should be recyclable.");
dropRecyclableGreen = config.Bind<bool>("Drop Recyclable", "dropRecyclableGreen", true, "Whether dropped green tier items should be recyclable.");
dropRecyclableRed = config.Bind<bool>("Drop Recyclable", "dropRecyclableRed", false, "Whether dropped red tier items should be recyclable.");
dropRecyclableYellow = config.Bind<bool>("Drop Recyclable", "dropRecyclableYellow", false, "Whether dropped yellow tier items should be recyclable.");
dropRecyclableLunar = config.Bind<bool>("Drop Recyclable", "dropRecyclableLunar", false, "Whether dropped lunar items should be recyclable.");
dropRecyclableVoid = config.Bind<bool>("Drop Recyclable", "dropRecyclableVoid", false, "Whether dropped void items should be recyclable.");
dropRecyclableEquipment = config.Bind<bool>("Drop Recyclable", "dropRecyclableEquipment", true, "Whether dropped equipment should be recyclable.");
dropRecyclableEquipmentLunar = config.Bind<bool>("Drop Recyclable", "dropRecyclableEquipmentLunar", false, "Whether dropped lunar equipment should be recyclable.");
scoreboardShowChat = config.Bind<bool>("Tweaks", "scoreboardShowChat", true, "Show chat history when the scoreboard is open. — [ client-side ]");
voidPickupConfirmAll = config.Bind<bool>("Tweaks", "voidPickupConfirmAll", true, "Always require confirmation to pick up void items.");
sendItemCostInChat = config.Bind<bool>("Tweaks", "sendItemCostInChat", true, "Send a chat notification listing the items that are consumed when using Scrapper, 3D Printer, Cleansing Pool, or Cauldron is used.");
includeScrapInItemCost = config.Bind<bool>("Tweaks", "includeScrapInItemCost", false, "Include Item Scrap in the list printed by sendItemCostInChat.");
}
}
public static class Drop
{
[CompilerGenerated]
private static class <>O
{
public static hook_CreatePickup <0>__GenericPickupController_CreatePickup;
}
private static readonly Quaternion identifier = new Quaternion(-2f, -4f, -8f, -16f);
private static bool _hooked = false;
private static Action<CreatePickupInfo, Vector3> _CreatePickupDroplet_Devotion;
private static Action<CreatePickupInfo, Vector3> CreatePickupDroplet_Devotion
{
get
{
if (_CreatePickupDroplet_Devotion == null)
{
Plugin.Logger.LogWarning((object)"MissingMethodException: Using Devotion Update version of PickupDropletController.CreatePickupDroplet");
_CreatePickupDroplet_Devotion = (Action<CreatePickupInfo, Vector3>)typeof(PickupDropletController).GetMethod("CreatePickupDroplet", new Type[2]
{
typeof(CreatePickupInfo),
typeof(Vector3)
}).CreateDelegate(typeof(Action<CreatePickupInfo, Vector3>));
}
return _CreatePickupDroplet_Devotion;
}
}
internal static void Hook()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
if (!_hooked)
{
_hooked = true;
object obj = <>O.<0>__GenericPickupController_CreatePickup;
if (obj == null)
{
hook_CreatePickup val = GenericPickupController_CreatePickup;
<>O.<0>__GenericPickupController_CreatePickup = val;
obj = (object)val;
}
GenericPickupController.CreatePickup += (hook_CreatePickup)obj;
DropCommand.Enable();
}
}
internal static void Unhook()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
if (_hooked)
{
_hooked = false;
object obj = <>O.<0>__GenericPickupController_CreatePickup;
if (obj == null)
{
hook_CreatePickup val = GenericPickupController_CreatePickup;
<>O.<0>__GenericPickupController_CreatePickup = val;
obj = (object)val;
}
GenericPickupController.CreatePickup -= (hook_CreatePickup)obj;
DropCommand.Disable();
}
}
private static GenericPickupController GenericPickupController_CreatePickup(orig_CreatePickup orig, ref CreatePickupInfo createPickupInfo)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (createPickupInfo.rotation == identifier)
{
createPickupInfo.rotation = Quaternion.identity;
GenericPickupController val = orig.Invoke(ref createPickupInfo);
if (!GetDropRecyclable(PickupCatalog.GetPickupDef(((CreatePickupInfo)(ref createPickupInfo)).pickupIndex)))
{
val.Recycled = true;
}
return val;
}
return orig.Invoke(ref createPickupInfo);
}
public static bool IsVoidTier(ItemTier tier)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Invalid comparison between Unknown and I4
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
if ((int)tier != 6 && (int)tier != 7 && (int)tier != 8)
{
return (int)tier == 9;
}
return true;
}
public static bool GetDropRecyclable(PickupDef def)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Invalid comparison between Unknown and I4
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
bool result = true;
if ((int)def.itemIndex != -1)
{
if (((int)def.itemTier == 0 && !Plugin.Config.DropRecyclableWhite) || ((int)def.itemTier == 1 && !Plugin.Config.DropRecyclableGreen) || ((int)def.itemTier == 2 && !Plugin.Config.DropRecyclableRed) || ((int)def.itemTier == 4 && !Plugin.Config.DropRecyclableYellow) || ((int)def.itemTier == 3 && !Plugin.Config.DropRecyclableLunar) || (!Plugin.Config.DropRecyclableVoid && IsVoidTier(def.itemTier)))
{
result = false;
}
}
else if ((int)def.equipmentIndex != -1)
{
if (def.isLunar)
{
if (!Plugin.Config.DropRecyclableEquipmentLunar)
{
result = false;
}
}
else if (!Plugin.Config.DropRecyclableEquipment)
{
result = false;
}
}
return result;
}
public static ItemIndex FindItemInInventory(this Inventory inventory, string query)
{
//IL_002a: 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)
List<ItemIndex> itemAcquisitionOrder = inventory.itemAcquisitionOrder;
if (itemAcquisitionOrder != null && itemAcquisitionOrder.Count > 0)
{
query = FormatStringForQuerying(query);
for (int num = itemAcquisitionOrder.Count - 1; num >= 0; num--)
{
ItemDef itemDef = ItemCatalog.GetItemDef(itemAcquisitionOrder[num]);
if (!itemDef.hidden && (itemDef.canRemove || InManualWhitelist(itemDef)) && FormatStringForQuerying(Language.GetString(itemDef.nameToken)).Contains(query))
{
return itemDef.itemIndex;
}
}
return (ItemIndex)(-1);
}
return (ItemIndex)(-1);
}
public static string FormatStringForQuerying(string input)
{
return Regex.Replace(input, "[ '_.,-]", string.Empty).ToLowerInvariant();
}
private static bool InManualWhitelist(ItemDef def)
{
if (!(def.nameToken == "ITEM_ONLEVELUPFREEUNLOCK_NAME"))
{
return false;
}
if (def.canRemove)
{
Plugin.Logger.LogWarning((object)("Item does not need to be manually whitelisted: ITEM_ONLEVELUPFREEUNLOCK_NAME | " + Language.GetString("ITEM_ONLEVELUPFREEUNLOCK_NAME")));
}
return true;
}
public static Vector3? GetAimDirection(CharacterBody body)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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)
InputBankTest val = ((body != null) ? body.inputBank : null);
if ((Object)(object)val == (Object)null)
{
return null;
}
Vector3 aimDirection = val.aimDirection;
aimDirection.y = 0f;
return ((Vector3)(ref aimDirection)).normalized;
}
public static void DropStyleChest(Transform target, PickupIndex dropPickup, int dropCount, float forwardVelocity = 2f, float upVelocity = 20f, Vector3? forwardOverride = null)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_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_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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_006a: 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_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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_0094: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
if (dropCount > 0)
{
float num = 360f / (float)dropCount;
Vector3 val = (Vector3)(((??)forwardOverride) ?? target.forward);
Vector3 position = target.position + Vector3.up * 1.5f;
Vector3 val2 = Vector3.up * upVelocity + val * forwardVelocity;
Quaternion val3 = Quaternion.AngleAxis(num, Vector3.up);
for (int i = 0; i < dropCount; i++)
{
CreatePickupInfo pickupInfo = default(CreatePickupInfo);
pickupInfo.position = position;
pickupInfo.rotation = identifier;
((CreatePickupInfo)(ref pickupInfo)).pickupIndex = dropPickup;
CreatePickupDroplet(pickupInfo, val2);
val2 = val3 * val2;
}
}
}
public static void DropStyleChest(Transform target, PickupIndex[] drops, float forwardVelocity = 2f, float upVelocity = 20f, Vector3? forwardOverride = null)
{
//IL_0028: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0043: 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_0049: 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_0054: 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)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//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_0073: 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_007c: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
if (drops.Length != 0)
{
float num = 360f / (float)drops.Length;
Vector3 val = (Vector3)(((??)forwardOverride) ?? target.forward);
Vector3 position = target.position + Vector3.up * 1.5f;
Vector3 val2 = Vector3.up * upVelocity + val * forwardVelocity;
Quaternion val3 = Quaternion.AngleAxis(num, Vector3.up);
for (int i = 0; i < drops.Length; i++)
{
CreatePickupInfo pickupInfo = default(CreatePickupInfo);
pickupInfo.position = position;
pickupInfo.rotation = identifier;
((CreatePickupInfo)(ref pickupInfo)).pickupIndex = drops[i];
CreatePickupDroplet(pickupInfo, val2);
val2 = val3 * val2;
}
}
}
private static void CreatePickupDroplet(CreatePickupInfo pickupInfo, Vector3 velocity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: 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_0010: Unknown result type (might be due to invalid IL or missing references)
try
{
CreatePickupDroplet_Wrapper(pickupInfo, velocity);
}
catch (MissingMethodException)
{
CreatePickupDroplet_Devotion(pickupInfo, velocity);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void CreatePickupDroplet_Wrapper(CreatePickupInfo pickupInfo, Vector3 velocity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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)
PickupDropletController.CreatePickupDroplet(pickupInfo, pickupInfo.position, velocity);
}
}
internal static class DropCommand
{
public static void Enable()
{
ChatCommander.Register("/d", Parse);
ChatCommander.Register("/drop", Parse);
}
public static void Disable()
{
ChatCommander.Unregister("/d", Parse);
ChatCommander.Unregister("/drop", Parse);
}
private static void Parse(NetworkUser user, string[] args)
{
//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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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)
if ((Object)(object)Run.instance == (Object)null)
{
return;
}
if (args.Length < 2)
{
ShowHelp(args);
return;
}
bool dropAtTeleporter = false;
if (args.Length > 2)
{
if (!(args[2] == "@"))
{
ShowHelp(args);
return;
}
dropAtTeleporter = true;
}
ItemIndex val = user.master.inventory.FindItemInInventory(args[1]);
if ((int)val == -1)
{
Feedback("Could not match '<color=#e5eefc>" + args[1] + "</color>' to an item in " + user.userName + "'s inventory.");
}
else
{
ItemDef itemDef = ItemCatalog.GetItemDef(val);
if ((Object)(object)itemDef == (Object)(object)Items.CaptainDefenseMatrix || (!Plugin.Config.DropVoidAllowed && Drop.IsVoidTier(itemDef.tier)))
{
Feedback(ChatCommander.GetColoredPickupLanguageString(itemDef.itemIndex) + " can not be dropped.");
}
else
{
Execute(user, itemDef, dropAtTeleporter);
}
}
}
private static void Execute(NetworkUser user, ItemDef itemDef, bool dropAtTeleporter)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
int num = user.master.inventory.GetItemCount(itemDef.itemIndex);
if (num > Plugin.Config.MaxItemsToDropAtATime)
{
num = Plugin.Config.MaxItemsToDropAtATime;
}
CharacterBody currentBody = user.GetCurrentBody();
Transform val = ((currentBody != null) ? ((Component)currentBody).gameObject.transform : null);
if ((Object)(object)val == (Object)null)
{
if (!Plugin.Config.DropDeadEnabled || !Plugin.Config.DropTeleporterEnabled)
{
Feedback("Dead players can't drop items <sprite name=\"Skull\" tint=1>");
return;
}
dropAtTeleporter = true;
}
if (dropAtTeleporter)
{
if (!Plugin.Config.DropTeleporterEnabled)
{
Feedback("Dropping at the Teleporter is disabled <sprite name=\"Skull\" tint=1>");
return;
}
TeleporterInteraction instance = TeleporterInteraction.instance;
Transform val2 = ((instance != null) ? ((Component)instance).transform : null);
if (!((Object)(object)val2 != (Object)null))
{
Feedback("There is no Teleporter to drop at <sprite name=\"Skull\" tint=1>");
return;
}
val = val2;
}
if ((Object)(object)val == (Object)null)
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<style=cUtility>No drop target <sprite name=\"Skull\" tint=1></style>"
});
return;
}
user.master.inventory.RemoveItem(itemDef.itemIndex, num);
Vector3? forwardOverride = Drop.GetAimDirection((user != null) ? user.GetCurrentBody() : null);
if (Plugin.Config.DropInvertDirection && forwardOverride.HasValue)
{
forwardOverride = -forwardOverride.Value;
}
Drop.DropStyleChest(val, PickupCatalog.FindPickupIndex(itemDef.itemIndex), num, 3.4f, 14f, forwardOverride);
Feedback(user, itemDef, num, dropAtTeleporter);
}
private static void Feedback(NetworkUser user, ItemDef item, int count, bool dropAtTeleporter)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
string coloredPickupLanguageString = ChatCommander.GetColoredPickupLanguageString(item.itemIndex);
string text = ((count != 1) ? $"({count})" : "");
string text2 = (dropAtTeleporter ? " at the Teleporter" : "");
Feedback(user.userName + " dropped " + coloredPickupLanguageString + text + text2);
}
private static void Feedback(string message)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<style=cEvent>" + message + "</color>"
});
}
private static void ShowHelp(string[] args)
{
ChatCommander.OutputFail(args[0], "expects an item name (without spaces).");
}
}
[BepInPlugin("itsschwer.PressureDrop", "PressureDrop", "1.5.1")]
public sealed class Plugin : BaseUnityPlugin
{
public const string GUID = "itsschwer.PressureDrop";
public const string Author = "itsschwer";
public const string Name = "PressureDrop";
public const string Version = "1.5.1";
private PressurePlateTimer pressure;
internal static ManualLogSource Logger { get; private set; }
public static Config Config { get; private set; }
private void Awake()
{
Logger.Sources.Remove((ILogSource)(object)((BaseUnityPlugin)this).Logger);
Logger = Logger.CreateLogSource("itsschwer.PressureDrop");
Config = new Config(((BaseUnityPlugin)this).Config);
ChatCommander.Hook();
Run.onRunStartGlobal += SetPluginActiveState;
Run.onRunDestroyGlobal += SetPluginActiveState;
SetPluginActiveState();
Logger.LogMessage((object)"~awake.");
}
private void OnEnable()
{
ManageHooks();
ChatCommander.Register("/reload", ReloadConfig, replace: true);
Logger.LogMessage((object)"~enabled.");
}
private void OnDisable()
{
ManageHooks();
ChatCommander.Unregister("/reload", ReloadConfig);
Logger.LogMessage((object)"~disabled.");
}
private void SetPluginActiveState(Run _ = null)
{
SetActive(NetworkServer.active);
}
private void SetActive(bool value)
{
((Behaviour)this).enabled = value;
if (Object.op_Implicit((Object)(object)pressure))
{
((Behaviour)pressure).enabled = value;
}
Logger.LogMessage((object)("~" + (value ? "active" : "inactive") + "."));
}
private void ReloadConfig(NetworkUser user, string[] args)
{
if (!((Object)(object)user != (Object)(object)LocalUserManager.GetFirstLocalUser().currentNetworkUser))
{
Config.Reload();
ManageHooks();
ChatCommander.Output("Reloaded configuration for <style=cWorldEvent>itsschwer.PressureDrop</style>");
}
}
private void ManageHooks()
{
ManagePressurePlateTimer();
ManageDropCommand();
ManageTweaks();
}
private void ManagePressurePlateTimer()
{
if (((Behaviour)this).enabled && Config.PressurePlateTimer != 0f)
{
if (!Object.op_Implicit((Object)(object)pressure))
{
pressure = ((Component)this).gameObject.AddComponent<PressurePlateTimer>();
}
}
else
{
Object.Destroy((Object)(object)pressure);
}
}
private void ManageDropCommand()
{
Drop.Unhook();
if (((Behaviour)this).enabled && Config.DropEnabled)
{
Drop.Hook();
}
}
private void ManageTweaks()
{
ScoreboardShowChat.Unhook();
if (((Behaviour)this).enabled && Config.ScoreboardShowChat)
{
ScoreboardShowChat.Hook();
}
VoidPickupConfirmAll.SetActive(((Behaviour)this).enabled && Config.VoidPickupConfirmAll);
SendItemCostInChat.Unhook();
if (((Behaviour)this).enabled && Config.SendItemCostInChat)
{
SendItemCostInChat.Hook();
}
}
}
internal sealed class PressurePlateTimer : MonoBehaviour
{
[CompilerGenerated]
private static class <>O
{
public static hook_SetSwitch <0>__PressurePlateController_SetSwitch;
}
private static readonly Dictionary<PressurePlateController, float> timers = new Dictionary<PressurePlateController, float>(2);
private void OnEnable()
{
//IL_0010: 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_001b: Expected O, but got Unknown
object obj = <>O.<0>__PressurePlateController_SetSwitch;
if (obj == null)
{
hook_SetSwitch val = PressurePlateController_SetSwitch;
<>O.<0>__PressurePlateController_SetSwitch = val;
obj = (object)val;
}
PressurePlateController.SetSwitch += (hook_SetSwitch)obj;
}
private void OnDisable()
{
//IL_0010: 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_001b: Expected O, but got Unknown
object obj = <>O.<0>__PressurePlateController_SetSwitch;
if (obj == null)
{
hook_SetSwitch val = PressurePlateController_SetSwitch;
<>O.<0>__PressurePlateController_SetSwitch = val;
obj = (object)val;
}
PressurePlateController.SetSwitch -= (hook_SetSwitch)obj;
}
private void Update()
{
foreach (PressurePlateController item in timers.Keys.ToList())
{
timers[item] -= Time.deltaTime;
if (timers[item] <= 0f)
{
timers.Remove(item);
}
}
}
private static void PressurePlateController_SetSwitch(orig_SetSwitch orig, PressurePlateController self, bool switchIsDown)
{
//IL_0088: 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)
//IL_009d: Expected O, but got Unknown
//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)
//IL_0055: Expected O, but got Unknown
float pressurePlateTimer = Plugin.Config.PressurePlateTimer;
if (switchIsDown)
{
if (switchIsDown != self.switchDown)
{
string text = (((double)Random.value <= 0.2) ? "Press your plate!" : "A pressure plate is pressed..");
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<style=cEvent>" + text + "</style>"
});
}
orig.Invoke(self, switchIsDown);
timers[self] = pressurePlateTimer;
}
else if (pressurePlateTimer > 0f && !timers.ContainsKey(self))
{
if (switchIsDown != self.switchDown)
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<style=cEvent>A pressure plate releases...</style>"
});
}
orig.Invoke(self, switchIsDown);
}
}
}
}
namespace PressureDrop.Tweaks
{
internal static class ScoreboardShowChat
{
[CompilerGenerated]
private static class <>O
{
public static hook_UpdateFade <0>__ChatBox_UpdateFade;
}
private static bool _hooked;
internal static void Hook()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
if (!_hooked)
{
_hooked = true;
object obj = <>O.<0>__ChatBox_UpdateFade;
if (obj == null)
{
hook_UpdateFade val = ChatBox_UpdateFade;
<>O.<0>__ChatBox_UpdateFade = val;
obj = (object)val;
}
ChatBox.UpdateFade += (hook_UpdateFade)obj;
}
}
internal static void Unhook()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
if (_hooked)
{
_hooked = false;
object obj = <>O.<0>__ChatBox_UpdateFade;
if (obj == null)
{
hook_UpdateFade val = ChatBox_UpdateFade;
<>O.<0>__ChatBox_UpdateFade = val;
obj = (object)val;
}
ChatBox.UpdateFade -= (hook_UpdateFade)obj;
}
}
private static void ChatBox_UpdateFade(orig_UpdateFade orig, ChatBox self, float deltaTime)
{
orig.Invoke(self, deltaTime);
if ((Object)(object)self.fadeGroup != (Object)null)
{
LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
Player val = ((firstLocalUser != null) ? firstLocalUser.inputPlayer : null);
if (val != null && val.GetButton("info"))
{
self.fadeGroup.alpha = 1f;
}
}
}
}
internal static class SendItemCostInChat
{
[CompilerGenerated]
private static class <>O
{
public static hook_PayCost <0>__CostTypeDef_PayCost;
public static hook_BeginScrapping <1>__ScrapperController_BeginScrapping;
}
private static bool _hooked;
internal static void Hook()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
if (!_hooked)
{
_hooked = true;
object obj = <>O.<0>__CostTypeDef_PayCost;
if (obj == null)
{
hook_PayCost val = CostTypeDef_PayCost;
<>O.<0>__CostTypeDef_PayCost = val;
obj = (object)val;
}
CostTypeDef.PayCost += (hook_PayCost)obj;
object obj2 = <>O.<1>__ScrapperController_BeginScrapping;
if (obj2 == null)
{
hook_BeginScrapping val2 = ScrapperController_BeginScrapping;
<>O.<1>__ScrapperController_BeginScrapping = val2;
obj2 = (object)val2;
}
ScrapperController.BeginScrapping += (hook_BeginScrapping)obj2;
}
}
internal static void Unhook()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
if (_hooked)
{
_hooked = false;
object obj = <>O.<0>__CostTypeDef_PayCost;
if (obj == null)
{
hook_PayCost val = CostTypeDef_PayCost;
<>O.<0>__CostTypeDef_PayCost = val;
obj = (object)val;
}
CostTypeDef.PayCost -= (hook_PayCost)obj;
object obj2 = <>O.<1>__ScrapperController_BeginScrapping;
if (obj2 == null)
{
hook_BeginScrapping val2 = ScrapperController_BeginScrapping;
<>O.<1>__ScrapperController_BeginScrapping = val2;
obj2 = (object)val2;
}
ScrapperController.BeginScrapping -= (hook_BeginScrapping)obj2;
}
}
private static PayCostResults CostTypeDef_PayCost(orig_PayCost orig, CostTypeDef self, int cost, Interactor activator, GameObject purchasedObject, Xoroshiro128Plus rng, ItemIndex avoidedItemIndex)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
PayCostResults val = orig.Invoke(self, cost, activator, purchasedObject, rng, avoidedItemIndex);
try
{
CostTypeDef_PayCost(val, activator, purchasedObject);
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)ex);
}
return val;
}
private static void CostTypeDef_PayCost(PayCostResults __result, Interactor activator, GameObject purchasedObject)
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_0097: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
PurchaseInteraction val = ((purchasedObject != null) ? purchasedObject.GetComponent<PurchaseInteraction>() : null);
if ((Object)(object)val == (Object)null)
{
return;
}
string purchaseInteractionVerb = GetPurchaseInteractionVerb(val);
if (string.IsNullOrEmpty(purchaseInteractionVerb))
{
return;
}
object obj;
if (activator == null)
{
obj = null;
}
else
{
CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
if (component == null)
{
obj = null;
}
else
{
CharacterMaster master = component.master;
if (master == null)
{
obj = null;
}
else
{
PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
obj = ((playerCharacterMasterController != null) ? playerCharacterMasterController.networkUser : null);
}
}
}
NetworkUser val2 = (NetworkUser)obj;
if ((Object)(object)val2 == (Object)null)
{
return;
}
Dictionary<PickupDef, int> dictionary = new Dictionary<PickupDef, int>();
foreach (ItemIndex item in __result.itemsTaken)
{
if (Plugin.Config.IncludeScrapInItemCost || !IsScrap(item))
{
PickupDef pickupDef = PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(item));
if (!dictionary.ContainsKey(pickupDef))
{
dictionary[pickupDef] = 0;
}
dictionary[pickupDef]++;
}
}
foreach (EquipmentIndex item2 in __result.equipmentTaken)
{
PickupDef pickupDef2 = PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(item2));
if (!dictionary.ContainsKey(pickupDef2))
{
dictionary[pickupDef2] = 0;
}
dictionary[pickupDef2]++;
}
AnnounceExchangedItems(dictionary, val2, purchaseInteractionVerb);
}
private static void ScrapperController_BeginScrapping(orig_BeginScrapping orig, ScrapperController self, int intPickupIndex)
{
//IL_0001: 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_007b: Unknown result type (might be due to invalid IL or missing references)
PickupDef pickupDef;
CharacterBody component;
int itemCount;
try
{
pickupDef = PickupCatalog.GetPickupDef(new PickupIndex(intPickupIndex));
component = ((Component)self.interactor).GetComponent<CharacterBody>();
itemCount = component.inventory.GetItemCount(pickupDef.itemIndex);
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)ex);
return;
}
finally
{
orig.Invoke(self, intPickupIndex);
}
object obj;
if (component == null)
{
obj = null;
}
else
{
CharacterMaster master = component.master;
if (master == null)
{
obj = null;
}
else
{
PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
obj = ((playerCharacterMasterController != null) ? playerCharacterMasterController.networkUser : null);
}
}
NetworkUser val = (NetworkUser)obj;
if (!((Object)(object)val == (Object)null))
{
int itemCount2 = component.inventory.GetItemCount(pickupDef.itemIndex);
AnnounceExchangedItems(new Dictionary<PickupDef, int> {
{
pickupDef,
itemCount - itemCount2
} }, val, "scrapped");
}
}
private static void AnnounceExchangedItems(Dictionary<PickupDef, int> exchanged, NetworkUser user, string action)
{
//IL_00aa: 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_00cc: Expected O, but got Unknown
if (exchanged.Count <= 0)
{
return;
}
StringBuilder stringBuilder = new StringBuilder();
List<PickupDef> list = exchanged.Keys.ToList();
for (int i = 0; i < list.Count; i++)
{
PickupDef val = list[i];
stringBuilder.Append(ChatCommander.GetColoredPickupLanguageString(val));
if (exchanged[val] != 1)
{
stringBuilder.Append($"({exchanged[val]})");
}
int num = list.Count - i;
if (num > 2)
{
stringBuilder.Append(", ");
}
else if (num > 1)
{
stringBuilder.Append((list.Count > 2) ? ", and " : " and ");
}
}
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = $"<style=cEvent>{user.userName} {action} {stringBuilder}</color>"
});
}
private static bool IsScrap(ItemIndex itemIndex)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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)
if (itemIndex != Items.ScrapWhite.itemIndex && itemIndex != Items.ScrapGreen.itemIndex && itemIndex != Items.ScrapRed.itemIndex && itemIndex != Items.ScrapYellow.itemIndex)
{
return itemIndex == Items.RegeneratingScrap.itemIndex;
}
return true;
}
private static string GetPurchaseInteractionVerb(PurchaseInteraction purchaseInteraction)
{
switch (purchaseInteraction.displayNameToken)
{
default:
return "";
case "BAZAAR_CAULDRON_NAME":
return "reforged";
case "SHRINE_CLEANSE_NAME":
return "cleansed themself of";
case "DUPLICATOR_NAME":
case "DUPLICATOR_MILITARY_NAME":
case "DUPLICATOR_WILD_NAME":
return "gave up";
}
}
}
internal static class VoidPickupConfirmAll
{
private static readonly Dictionary<ItemTier, PickupRules> originalRules = new Dictionary<ItemTier, PickupRules>();
public static void SetActive(bool value)
{
if (originalRules.Count > 0)
{
Revert();
originalRules.Clear();
}
if (value)
{
Apply();
}
}
private static void Apply()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000d: 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)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
Enumerator<ItemTierDef> enumerator = ItemTierCatalog.allItemTierDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemTierDef current = enumerator.Current;
if (Drop.IsVoidTier(current.tier))
{
originalRules[current.tier] = current.pickupRules;
current.pickupRules = (PickupRules)2;
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
Plugin.Logger.LogMessage((object)"VoidPickupConfirmAll> pickup rule applied.");
}
private static void Revert()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_002e: Unknown result type (might be due to invalid IL or missing references)
Enumerator<ItemTierDef> enumerator = ItemTierCatalog.allItemTierDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemTierDef current = enumerator.Current;
if (originalRules.TryGetValue(current.tier, out var value))
{
current.pickupRules = value;
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
Plugin.Logger.LogMessage((object)"VoidPickupConfirmAll> pickup rule reverted.");
}
}
}