using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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.Bootstrap;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.IL2CPP;
using BepInEx.Logging;
using ChatCommands;
using CrabDevKit.Utilities;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 RightToBearArms
{
public class ItemsCommand : BaseCommand
{
public ItemsCommand()
{
//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_004d: Unknown result type (might be due to invalid IL or missing references)
base.id = "items";
base.description = "Lists all of the items that can be given.";
base.args = new CommandArguments((CommandArgument[])(object)new CommandArgument[1]
{
new CommandArgument(new Type[1] { typeof(int) }, "page", false)
});
}
public BaseCommandResponse ShowItemsPage(BaseExecutionMethod executionMethod, int page = 1)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Expected O, but got Unknown
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
if (page >= 1)
{
int num = 1;
int num2 = 0;
List<string> list = new List<string>(1) { string.Empty };
ValueCollection<int, ItemData> values = MonoBehaviourPublicDi2InItidGamoObInUnique.idToItem.Values;
int num3 = 0;
ItemData[] array = (ItemData[])(object)new ItemData[values.Count];
Enumerator<int, ItemData> enumerator = values.GetEnumerator();
while (enumerator.MoveNext())
{
ItemData current = enumerator.Current;
array[num3] = current;
num3++;
}
ItemData[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
string text = array2[i].itemName;
if (i != array2.Length - 1)
{
text += ", ";
}
if (list[num2].Length + text.Length - 1 > executionMethod.MaxResponseLength)
{
num2++;
if (num2 == 3)
{
if (num + 1 > page)
{
break;
}
num++;
num2 = 0;
list = new List<string>();
}
list.Add(string.Empty);
}
list[num2] += text;
}
if (page == num)
{
return (BaseCommandResponse)new StyledCommandResponse($"Items Page #{page}", list.ToArray(), (CommandResponseType)1, true);
}
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You didn't specify a valid page number." }, (CommandResponseType)1);
}
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You didn't specify a valid page number." }, (CommandResponseType)1);
}
public override BaseCommandResponse Execute(BaseExecutionMethod executionMethod, object executorDetails, string args, bool ignorePermissions = false)
{
//IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (args.Length == 0)
{
return ShowItemsPage(executionMethod);
}
ParsedResult<int> val = Api.CommandArgumentParser.Parse<int>(args);
if (val.successful)
{
return ShowItemsPage(executionMethod, val.result);
}
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You didn't specify a valid page number." }, (CommandResponseType)1);
}
}
public class GiveCommand : BaseCommand
{
public GiveCommand()
{
//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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_009f: 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)
base.id = "give";
base.description = "Gives players an item.";
base.args = new CommandArguments((CommandArgument[])(object)new CommandArgument[3]
{
new CommandArgument(new Type[2]
{
typeof(OnlineClientId[]),
typeof(OnlineClientId)
}, "player(s)", true),
new CommandArgument(new Type[1] { typeof(ItemData) }, "item", true),
new CommandArgument(new Type[1] { typeof(int) }, "ammo", false)
});
}
public override BaseCommandResponse Execute(BaseExecutionMethod executionMethod, object executorDetails, string args, bool ignorePermissions = false)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_008e: 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_0053: 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_00c7: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_00f9: 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_00ed: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: 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)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Expected O, but got Unknown
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance == (Object)null))
{
if (args.Length != 0)
{
ParsedResult<OnlineClientId[]> val = Api.CommandArgumentParser.Parse<OnlineClientId[]>(args);
IEnumerable<ulong> enumerable;
if (val.successful)
{
enumerable = val.result.Select((OnlineClientId clientId) => OnlineClientId.op_Implicit(clientId));
args = val.newArgs;
}
else
{
ParsedResult<OnlineClientId> val2 = Api.CommandArgumentParser.Parse<OnlineClientId>(args);
if (!val2.successful)
{
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You did not select any players." }, (CommandResponseType)1);
}
enumerable = new <>z__ReadOnlySingleElementList<ulong>(OnlineClientId.op_Implicit(val2.result));
args = val2.newArgs;
}
if (args.Length != 0)
{
ParsedResult<ItemData> val3 = Api.CommandArgumentParser.Parse<ItemData>(args);
if (val3.successful)
{
int num = val3.result.currentAmmo;
ParsedResult<int> val4 = Api.CommandArgumentParser.Parse<int>(val3.newArgs);
if (val4.successful)
{
if (num < 0)
{
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You didn't specify a positive ammo count." }, (CommandResponseType)1);
}
num = val4.result;
}
foreach (ulong item in enumerable)
{
if (MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers.ContainsKey(item) && !MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers[item].dead)
{
GiveUtil.GiveItem(item, val3.result.itemID, num);
}
}
return (BaseCommandResponse)new BasicCommandResponse(Array.Empty<string>(), (CommandResponseType)1);
}
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You didn't specify an existing item." }, (CommandResponseType)1);
}
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "An item is required for the second argument." }, (CommandResponseType)1);
}
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "A player selector or player is required for the first argument." }, (CommandResponseType)1);
}
return (BaseCommandResponse)new BasicCommandResponse(new string[1] { "You cannot give items to players right now." }, (CommandResponseType)1);
}
}
internal static class ChatCommandsCompatibility
{
internal static bool? enabled;
internal static bool Enabled
{
get
{
if (enabled.HasValue)
{
return enabled.Value;
}
bool? flag = (enabled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("lammas123.ChatCommands"));
return flag.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
internal static void RegisterCommand(Type commandType)
{
((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins["lammas123.ChatCommands"].Instance.GetType().Assembly.GetType("ChatCommands.Api").GetMethod("RegisterCommand", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[1] { Activator.CreateInstance(commandType) });
}
}
internal static class Patches
{
[HarmonyPatch(typeof(MonoBehaviourPublicGataInefObInUnique), "Method_Private_Void_GameObject_Boolean_Vector3_Quaternion_0")]
[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "Method_Private_Void_0")]
[HarmonyPrefix]
internal static bool PreBepinexDetection()
{
return false;
}
[HarmonyPatch(typeof(MonoBehaviourPublicDi2InItidGamoObInUnique), "Awake")]
[HarmonyPostfix]
internal static void PostItemManagerAwake()
{
MonoBehaviourPublicDi2InItidGamoObInUnique.idToItem[0].itemName = "AK";
MonoBehaviourPublicDi2InItidGamoObInUnique.idToItem[3].itemName = "Dual Shotgun";
MonoBehaviourPublicDi2InItidGamoObInUnique.idToItem[11].type = (EnumNPublicSealedvaPrSeMeThOtAm7vUnique)3;
MonoBehaviourPublicDi2InItidGamoObInUnique.idToItem[12].itemName = "Pizza Steve";
MonoBehaviourPublicDi2InItidGamoObInUnique.idToItem[12].type = (EnumNPublicSealedvaPrSeMeThOtAm7vUnique)3;
}
}
[BepInPlugin("lammas123.RightToBearArms", "RightToBearArms", "1.2.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class RightToBearArms : BasePlugin
{
public override void Load()
{
//IL_0064: 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_0089: Expected O, but got Unknown
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
if (ChatCommandsCompatibility.Enabled)
{
Assembly assembly = typeof(RightToBearArms).Assembly;
Type type = assembly.GetType("RightToBearArms.ItemsCommand");
Type? type2 = assembly.GetType("RightToBearArms.GiveCommand");
ChatCommandsCompatibility.RegisterCommand(type);
ChatCommandsCompatibility.RegisterCommand(type2);
}
new Harmony("RightToBearArms").PatchAll(typeof(Patches));
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initialized [");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("RightToBearArms");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.2.1");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
}
log.LogInfo(val);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "lammas123.RightToBearArms";
public const string PLUGIN_NAME = "RightToBearArms";
public const string PLUGIN_VERSION = "1.2.1";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
{
object IEnumerator.Current => _item;
T IEnumerator<T>.Current => _item;
public Enumerator(T item)
{
_item = item;
}
bool IEnumerator.MoveNext()
{
if (!_moveNextCalled)
{
return _moveNextCalled = true;
}
return false;
}
void IEnumerator.Reset()
{
_moveNextCalled = false;
}
void IDisposable.Dispose()
{
}
}
int ICollection.Count => 1;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => 1;
T IReadOnlyList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
}
int ICollection<T>.Count => 1;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlySingleElementList(T item)
{
_item = item;
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection.CopyTo(Array array, int index)
{
array.SetValue(_item, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return EqualityComparer<T>.Default.Equals(_item, (T)value);
}
int IList.IndexOf(object value)
{
if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
{
return -1;
}
return 0;
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return EqualityComparer<T>.Default.Equals(_item, item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
array[arrayIndex] = _item;
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
if (!EqualityComparer<T>.Default.Equals(_item, item))
{
return -1;
}
return 0;
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}