using System;
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 HG.Reflection;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("LensMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LensMod")]
[assembly: AssemblyTitle("LensMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace LensMod;
internal class LensItem
{
public GameObject ItemModel;
public Sprite ItemIcon;
public ItemDef Definition { get; private set; }
public LensItem()
{
LoadAssets();
Definition = BuildItemDefinition();
}
private void LoadAssets()
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LensMod.lensmod");
AssetBundle val = AssetBundle.LoadFromStream(stream);
ItemModel = val.LoadAsset<GameObject>("Assets/model.dae");
ItemIcon = val.LoadAsset<Sprite>("Assets/icon.png");
}
private ItemDef BuildItemDefinition()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
((Object)val).name = "LensMakersMagnifyingGlass";
val.deprecatedTier = (ItemTier)1;
val.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 };
val.pickupModelPrefab = ItemModel;
val.pickupIconSprite = ItemIcon;
val.nameToken = "Lens Maker's Magnifying Glass";
val.pickupToken = "Critical strike damage is increased";
val.descriptionToken = "<style=cIsDamage>Critical strike damage</style> is increased.";
val.loreToken = "The prototype for the lens but it didnt work so the lens maker brought it to the government and the government said no and lens man said arr and then killed someone with them";
return val;
}
public ItemDisplayRuleDict BuildDisplayRules()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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_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_0094: 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_00b0: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: 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_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: 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_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0338: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
//IL_040c: Unknown result type (might be due to invalid IL or missing references)
//IL_040d: Unknown result type (might be due to invalid IL or missing references)
//IL_0428: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_0460: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Unknown result type (might be due to invalid IL or missing references)
//IL_047b: Unknown result type (might be due to invalid IL or missing references)
//IL_0480: Unknown result type (might be due to invalid IL or missing references)
//IL_0496: Unknown result type (might be due to invalid IL or missing references)
//IL_049b: Unknown result type (might be due to invalid IL or missing references)
//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
//IL_050f: Unknown result type (might be due to invalid IL or missing references)
//IL_0514: Unknown result type (might be due to invalid IL or missing references)
//IL_052a: Unknown result type (might be due to invalid IL or missing references)
//IL_052f: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_0535: Unknown result type (might be due to invalid IL or missing references)
//IL_0550: Unknown result type (might be due to invalid IL or missing references)
//IL_0559: Unknown result type (might be due to invalid IL or missing references)
//IL_0588: Unknown result type (might be due to invalid IL or missing references)
//IL_058d: Unknown result type (might be due to invalid IL or missing references)
//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Unknown result type (might be due to invalid IL or missing references)
//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_0621: Unknown result type (might be due to invalid IL or missing references)
//IL_0637: Unknown result type (might be due to invalid IL or missing references)
//IL_063c: Unknown result type (might be due to invalid IL or missing references)
//IL_0652: Unknown result type (might be due to invalid IL or missing references)
//IL_0657: Unknown result type (might be due to invalid IL or missing references)
//IL_065c: Unknown result type (might be due to invalid IL or missing references)
//IL_065d: Unknown result type (might be due to invalid IL or missing references)
ItemDisplayRuleDict val = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
val.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(0.08832f, 0.15109f, -0.10412f),
localAngles = new Vector3(0f, 120f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(-0.00331f, 0.10582f, -0.09374f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(0.97156f, 4.02498f, -0.11258f),
localAngles = new Vector3(340f, 90f, 180f),
localScale = new Vector3(2f, 2f, 2f)
}
});
val.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(0.03088f, 0.02799f, -0.22667f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(-0.0121f, 0.23915f, -0.06297f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(-0.02027f, 0.20177f, -0.15007f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "FootBackL",
localPos = new Vector3(-0.10585f, 0.5113f, -0.00238f),
localAngles = new Vector3(0f, 90f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(0.0643f, 0.23763f, -0.0847f),
localAngles = new Vector3(0f, 330f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(0.16156f, 0.8883f, -1.25733f),
localAngles = new Vector3(15f, 0f, 0f),
localScale = new Vector3(2f, 2f, 2f)
}
});
val.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "CalfL",
localPos = new Vector3(0.00525f, 0.29403f, 0.10998f),
localAngles = new Vector3(345f, 0f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
val.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
{
new ItemDisplayRule
{
ruleType = (ItemDisplayRuleType)0,
followerPrefab = ItemModel,
childName = "ThighL",
localPos = new Vector3(-0.00035f, 0.32595f, 0.09654f),
localAngles = new Vector3(0f, 0f, 0f),
localScale = new Vector3(0.35f, 0.35f, 0.35f)
}
});
return val;
}
public void OnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
GameObject val = null;
if ((Object)(object)damageInfo.attacker != (Object)null)
{
val = damageInfo.attacker;
}
else
{
if (!((Object)(object)damageInfo.inflictor != (Object)null))
{
orig.Invoke(self, damageInfo);
return;
}
val = damageInfo.inflictor;
}
CharacterBody component = val.GetComponent<CharacterBody>();
if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null)
{
int itemCount = component.inventory.GetItemCount(Definition);
if (itemCount > 0 && damageInfo.crit)
{
float num = CalculateDamageModifier(itemCount) + 1f;
damageInfo.damage *= num;
}
}
orig.Invoke(self, damageInfo);
}
public static float CalculateDamageModifier(int item_count)
{
return -0.22f - -1.275f * (1f - (float)Math.Exp(-0.29f * (float)item_count));
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[R2APISubmoduleDependency(new string[] { "ItemAPI", "LanguageAPI" })]
[BepInPlugin("com.phreel.lensmodrevived", "LensModRevived", "1.0.1")]
public class LensMod : BaseUnityPlugin
{
private const string ModVer = "1.0.1";
private const string ModName = "LensModRevived";
private const string ModGuid = "com.phreel.lensmodrevived";
private LensItem item;
public void Awake()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
item = new LensItem();
AddItem(item);
HealthComponent.TakeDamage += new hook_TakeDamage(item.OnTakeDamage);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void AddItem(LensItem item)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
CustomItem val = new CustomItem(item.Definition, item.BuildDisplayRules());
if (!ItemAPI.Add(val))
{
((BaseUnityPlugin)this).Logger.LogError((object)"Unable to add lens item");
}
}
private static void AddLanguageTokens()
{
LanguageAPI.Add("LENSITEM_NAME", "Lens Maker's Magnifying Glass");
LanguageAPI.Add("LENSITEM_PICKUP", "Critical strike damage is increased");
LanguageAPI.Add("LENSITEM_DESC", "Critical strike damage is increased");
LanguageAPI.Add("LENSITEM_LORE", "The prototype for the lens but it didnt work so the lens maker brought it to the government and the government said no and he said arr and then killed someone with them");
}
}