using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HG;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using ThievingElite.thieving;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ThievingElite")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bf70ad059b785eeacd2902c196dfdf9893414494")]
[assembly: AssemblyProduct("ThievingElite")]
[assembly: AssemblyTitle("ThievingElite")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ThievingElite
{
public static class Asset
{
public static AssetBundle mainBundle;
public const string bundleName = "thievingelite_assets";
public const string assetBundleFolder = "assetbundles";
public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(Main.PInfo.Location), "thievingelite_assets");
public static void Init()
{
mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
string[] allAssetNames = mainBundle.GetAllAssetNames();
foreach (string text in allAssetNames)
{
}
Sprite val = mainBundle.LoadAsset<Sprite>("ThievingIcon.png");
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Horse5333.ThievingElite", "ThievingElite", "0.0.1")]
public class Main : BaseUnityPlugin
{
public const string PluginGUID = "Horse5333.ThievingElite";
public const string PluginAuthor = "Horse5333";
public const string PluginName = "ThievingElite";
public const string PluginVersion = "0.0.1";
private List<ItemDef> stolenItems = new List<ItemDef>();
public static PluginInfo PInfo { get; private set; }
public void Awake()
{
PInfo = ((BaseUnityPlugin)this).Info;
Asset.Init();
new Thieving();
GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
Stage.onServerStageComplete += Stage_onServerStageComplete;
}
private void Update()
{
}
private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
{
//IL_0044: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Invalid comparison between Unknown and I4
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Invalid comparison between Unknown and I4
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Invalid comparison between Unknown and I4
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Invalid comparison between Unknown and I4
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Invalid comparison between Unknown and I4
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Invalid comparison between Unknown and I4
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Invalid comparison between Unknown and I4
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Invalid comparison between Unknown and I4
if ((Object)(object)damageReport.attackerBody == (Object)null || !damageReport.victimBody.isPlayerControlled)
{
return;
}
CharacterBody component = damageReport.attacker.GetComponent<CharacterBody>();
BuffIndex val = BuffCatalog.FindBuffIndex("EliteThievingBuff");
if (!component.HasBuff(val))
{
return;
}
CharacterBody victimBody = damageReport.victimBody;
float num = damageReport.damageDealt * 100f / damageReport.victimBody.maxHealth;
Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ItemDef current = enumerator.Current;
int itemCount = victimBody.inventory.GetItemCount(current);
if (itemCount <= 0)
{
continue;
}
float num2 = 100f;
if ((int)current.tier == 0 || (int)current.tier == 6)
{
num2 = 100f - Mathf.Floor(1250f / (num + 30f));
}
else if ((int)current.tier == 1 || (int)current.tier == 7)
{
num2 = 100f - Mathf.Min(100f, -1500f / (num - 100f));
}
else if ((int)current.tier == 2 || (int)current.tier == 8)
{
num2 = 100f - 0.75f * (num - 15f);
}
else if ((int)current.tier == 3 || (int)current.tier == 4 || (int)current.tier == 9)
{
num2 = 100f - num;
}
for (int i = 0; i < itemCount; i++)
{
if (!Util.CheckRoll(num2, victimBody.master))
{
victimBody.inventory.RemoveItem(current, 1);
damageReport.attackerBody.inventory.GiveItem(current, 1);
stolenItems.Add(current);
}
}
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
}
private void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport)
{
//IL_0012: 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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
CharacterBody component = ((Component)damageReport.victim).GetComponent<CharacterBody>();
BuffIndex val = BuffCatalog.FindBuffIndex("EliteThievingBuff");
if (!component.HasBuff(val))
{
return;
}
List<ItemDef> list = new List<ItemDef>();
foreach (ItemDef stolenItem in stolenItems)
{
if (component.inventory.GetItemCount(stolenItem) > 0)
{
component.inventory.RemoveItem(stolenItem, 1);
PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(stolenItem.itemIndex), component.corePosition, new Vector3(7f * (Random.value - 0.5f), 25f, 7f * (Random.value - 0.5f)));
list.Add(stolenItem);
}
}
foreach (ItemDef item in list)
{
if (!stolenItems.Remove(item))
{
}
}
}
private void Stage_onServerStageComplete(Stage stage)
{
stolenItems.Clear();
}
}
}
namespace ThievingElite.thieving
{
public class Thieving
{
public enum EliteTier
{
None,
T1,
T1Honor,
T1GuildedHonor,
T1Guilded,
T2,
Lunar
}
public static Color AffixThievingColor = new Color(0f, 0f, 0f);
public static EquipmentDef AffixThievingEquipment;
public static CustomEquipment CustomThievingEquipment;
public static BuffDef AffixThievingBuff;
public static EliteDef AffixThievingElite;
public static CustomElite CustomThievingElite;
public static CustomElite CustomThievingEliteHonor;
public ItemStealController itemStealController;
public static float healthMult = 4f;
public static float damageMult = 3f;
public static float affixDropChance = 0.00025f;
private static Material ThievingMat = Asset.mainBundle.LoadAsset<Material>("ThievingMaterial.mat");
public static Texture2D eliteRamp = Asset.mainBundle.LoadAsset<Texture2D>("ThievingRamp.png");
private static Sprite eliteIcon = Asset.mainBundle.LoadAsset<Sprite>("ThievingIcon.png");
public Thieving()
{
AddLanguageTokens();
SetupBuff();
SetupEquipment();
SetupElite();
AddContent();
ItemAPI.Add(CustomThievingEquipment);
}
private void AddContent()
{
EliteAPI.Add(CustomThievingElite);
EliteAPI.Add(CustomThievingEliteHonor);
ContentAddition.AddBuffDef(AffixThievingBuff);
}
private void SetupBuff()
{
//IL_0050: 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)
AffixThievingBuff = ScriptableObject.CreateInstance<BuffDef>();
((Object)AffixThievingBuff).name = "EliteThievingBuff";
AffixThievingBuff.canStack = false;
AffixThievingBuff.isCooldown = false;
AffixThievingBuff.isDebuff = false;
AffixThievingBuff.buffColor = new Color(1f, 1f, 1f);
AffixThievingBuff.iconSprite = eliteIcon;
}
private void SetupEquipment()
{
//IL_003d: 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_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected O, but got Unknown
AffixThievingEquipment = ScriptableObject.CreateInstance<EquipmentDef>();
AffixThievingEquipment.appearsInMultiPlayer = true;
AffixThievingEquipment.appearsInSinglePlayer = true;
AffixThievingEquipment.canBeRandomlyTriggered = false;
AffixThievingEquipment.canDrop = false;
AffixThievingEquipment.colorIndex = (ColorIndex)5;
AffixThievingEquipment.cooldown = 0f;
AffixThievingEquipment.isLunar = false;
AffixThievingEquipment.isBoss = false;
AffixThievingEquipment.passiveBuffDef = AffixThievingBuff;
AffixThievingEquipment.dropOnDeathChance = affixDropChance;
AffixThievingEquipment.enigmaCompatible = false;
AffixThievingEquipment.pickupModelPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteFire/PickupEliteFire.prefab").WaitForCompletion(), "PickupAffixThieving", false);
Renderer[] componentsInChildren = AffixThievingEquipment.pickupModelPrefab.GetComponentsInChildren<Renderer>();
foreach (Renderer val in componentsInChildren)
{
val.material = ThievingMat;
}
AffixThievingEquipment.nameToken = "EQUIPMENT_AFFIX_THIEVING_NAME";
AffixThievingEquipment.descriptionToken = "EQUIPMENT_AFFIX_THIEVING_DESC";
AffixThievingEquipment.pickupToken = "EQUIPMENT_AFFIX_THIEVING_PICKUP";
AffixThievingEquipment.loreToken = "EQUIPMENT_AFFIX_THIEVING_LORE";
((Object)AffixThievingEquipment).name = "AffixTHIEVING";
CustomThievingEquipment = new CustomEquipment(AffixThievingEquipment, new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()));
}
private void SetupElite()
{
//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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//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)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
AffixThievingElite = ScriptableObject.CreateInstance<EliteDef>();
AffixThievingElite.color = Color32.op_Implicit(AffixThievingColor);
AffixThievingElite.eliteEquipmentDef = AffixThievingEquipment;
AffixThievingElite.modifierToken = "ELITE_MODIFIER_THIEVING";
((Object)AffixThievingElite).name = "EliteThieving";
AffixThievingElite.healthBoostCoefficient = 2f;
AffixThievingElite.damageBoostCoefficient = 4f;
AffixThievingBuff.eliteDef = AffixThievingElite;
CustomThievingElite = new CustomElite(AffixThievingElite, GetVanillaEliteTierDef(EliteTier.T1), eliteRamp);
CustomThievingEliteHonor = new CustomElite("EliteThievingHonor", AffixThievingEquipment, Color32.op_Implicit(AffixThievingColor), "ELITE_MODIFIER_THIEVING", GetVanillaEliteTierDef(EliteTier.T1Honor), eliteRamp);
CustomThievingEliteHonor.EliteDef.healthBoostCoefficient = 1.5f;
CustomThievingEliteHonor.EliteDef.damageBoostCoefficient = 2.5f;
}
private void AddLanguageTokens()
{
LanguageAPI.Add("ELITE_MODIFIER_THIEVING", "Thieving {0}");
LanguageAPI.Add("EQUIPMENT_AFFIX_THIEVING_NAME", "Thieving Aspect");
LanguageAPI.Add("EQUIPMENT_AFFIX_THIEVING_PICKUP", "Become an aspect of Thieving");
LanguageAPI.Add("EQUIPMENT_AFFIX_THIEVING_DESC", "Become an aspect of Thieving");
LanguageAPI.Add("EQUIPMENT_AFFIX_THIEVING_LORE", "Thieving Aspect Lore");
}
private IEnumerable<EliteTierDef> GetVanillaEliteTierDef(EliteTier tier)
{
if (1 == 0)
{
}
IEnumerable<EliteTierDef> result = tier switch
{
EliteTier.None => null,
EliteTier.T1 => new <>z__ReadOnlyArray<EliteTierDef>((EliteTierDef[])(object)new EliteTierDef[2]
{
EliteAPI.VanillaEliteTiers[1],
EliteAPI.VanillaEliteTiers[4]
}),
EliteTier.T1Honor => new <>z__ReadOnlyArray<EliteTierDef>((EliteTierDef[])(object)new EliteTierDef[2]
{
EliteAPI.VanillaEliteTiers[2],
EliteAPI.VanillaEliteTiers[3]
}),
_ => new <>z__ReadOnlySingleElementList<EliteTierDef>(EliteAPI.VanillaEliteTiers[(int)tier]),
};
if (1 == 0)
{
}
return result;
}
}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
int ICollection.Count => _items.Length;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => _items.Length;
T IReadOnlyList<T>.this[int index] => _items[index];
int ICollection<T>.Count => _items.Length;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlyArray(T[] items)
{
_items = items;
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)_items).GetEnumerator();
}
void ICollection.CopyTo(Array array, int index)
{
((ICollection)_items).CopyTo(array, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return ((IList)_items).Contains(value);
}
int IList.IndexOf(object value)
{
return ((IList)_items).IndexOf(value);
}
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 ((IEnumerable<T>)_items).GetEnumerator();
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return ((ICollection<T>)_items).Contains(item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
((ICollection<T>)_items).CopyTo(array, arrayIndex);
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return ((IList<T>)_items).IndexOf(item);
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}
[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()
{
return !_moveNextCalled && (_moveNextCalled = true);
}
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)
{
return (!EqualityComparer<T>.Default.Equals(_item, (T)value)) ? (-1) : 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)
{
return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0;
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}