Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of OigsItems v3.2.1
oigsItems.dll
Decompiled 2 years agousing System; 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.Bootstrap; using BepInEx.Configuration; using On.RoR2; using On.RoR2.UI.LogBook; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Achievements; using RoR2.UI.LogBook; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using oigsItemsMod.Base_Classes; using oigsItemsMod.Buffs; using oigsItemsMod.Items; using oigsItemsMod.SoftDependencies; using oigsItemsMod.Utils; [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("oigsItemsMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("oigsItemsMod")] [assembly: AssemblyTitle("oigsItemsMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace oigsItemsMod { public static class ConfigManager { public static ConfigEntry<bool> customStatsOn; public static ConfigValues bloodyPillowValues; public static ConfigValues clownNoseValues; public static ConfigValues companyShieldGeneratorValues; public static ConfigValues contractOfCommandValues; public static ConfigValues devouringJarValues; public static ConfigValues eternalDreadValues; public static ConfigValues prettyStopwatchValues; public static ConfigValues quantumBonsaiTreeValues; public static ConfigValues relentlessMaliceValues; public static ConfigValues shatteredBladeValues; public static ConfigValues taintedWillValues; public static ConfigValues telescopicSightValues; public static ConfigValues twilightSpearValues; public static ConfigValues weedWackerValues; private static Dictionary<string, ConfigEntry<bool>> itemsEnabled = new Dictionary<string, ConfigEntry<bool>>(); public static void Init(ConfigFile config) { if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.Init(); } customStatsOn = config.Bind<bool>("Items", "use custom stats", false, "you must enable this if you want to use custom config values for items"); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(customStatsOn, delegate(bool newValue) { customStatsOn.Value = newValue; }); } bloodyPillowValues = new ConfigValues(customStatsOn, "on killing an enemy there is a 50% chance of gaining or losing <style=cIsUtility>percentStat%</style><style=cStack>(+percentStat% per stack)</style> attack, health, attack speed, or speed. there is an equal chance for each to occur.", new string[1] { "percentStat.float*100" }); clownNoseValues = new ConfigValues(customStatsOn, "increase attack by <style=cIsDamage>percentDamage%</style> <style=cStack>(+percentDamageStack% per stack)</style> BUT if you take damage from <style=cIsUtility>damageSources</style> enemies within <style=cIsUtility>damageSourcesTime</style> <style=cStack>(+damageSourcesTimeStack per stack)</style> seconds the game crashes", new string[5] { "percentDamageStack.float*100", "percentDamage.float*100", "damageSourcesTimeStack.float*1", "damageSourcesTime.float*1", "damageSources.int*" }); companyShieldGeneratorValues = new ConfigValues(customStatsOn, "hitting an enemy at max health gives you <style=cIsHealth>barrier</style> equal to <style=cIsDamage>percentStack%</style><style=cStack> (+percentStack% per stack)</style> of the damage dealt", new string[1] { "percentStack.float*100" }); contractOfCommandValues = new ConfigValues(customStatsOn, "on taking damage deal <style=cIsDamage>allyDamage%</style> of damage taken to allies <style=cIsUtility>radiusm</style> <style=cStack>(+radiusm per stack)</style> away from you and gain <style=cIsDamage>attackGain%</style> <style=cStack>(+attackGain% per stack)</style> damage and <style=cIsUtility>speedGain%</style> <style=cStack>(+speedGain% per stack)</style> speed per ally damaged", new string[4] { "allyDamage.float*100", "attackGain.float*100", "speedGain.float*100", "radius.float*1" }); devouringJarValues = new ConfigValues(customStatsOn, "build up buff stacks based on damage taken, at 100 stacks gain <style=cIsUtility>armorAmount</style> <style=cStack>(+armorAmount per stack)</style> armor and your next hit applies <style=cIsDamage>blotAmount</style> <style=cStack>(+blotAmount per stack)</style> blot and removes 100 buff stacks", new string[2] { "armorAmount.float*1", "blotAmount.int*" }); eternalDreadValues = new ConfigValues(customStatsOn, "every hitInterval hits apply <style=cIsDamage>blotAmount</style> <style=cStack>(+blotAmount per stack)</style> blot on hit and heal <style=cIsHealing>healAmount</style> <style=cStack>(+healAmount per stack)</style> per 10 blot on the target", new string[3] { "blotAmount.int*", "hitInterval.int*", "healAmount.float*1" }); prettyStopwatchValues = new ConfigValues(customStatsOn, "increase movement speed by <style=cIsUtility>percentSpeed%</style> <style=cStack>(+percentSpeed% per stack)</style> every speedTime seconds, the next time you deal damage deal bonus damage equal to (speed * buff stacks * <style=cIsDamage>damageIncreasePerStack</style> <style=cStack>(+damageIncreasePerStack per stack)</style>)% of attack", new string[3] { "percentSpeed.float*100", "speedTime.float*1", "damageIncreasePerStack.float*1" }); quantumBonsaiTreeValues = new ConfigValues(customStatsOn, "<style=cIsUtility>baseDamageChance%</style> chance to heal <style=cIsHealing>percentHeal%</style> <style=cStack>(+percentHeal% per stack)</style> of your max health on hit. the chance increases by <style=cIsUtility>1%</style> for each <style=cIsDamage>overDamageChance%</style> damage over 100% dealt", new string[3] { "baseDamageChance.float*1", "overDamageChance.float*1", "percentHeal.float*100" }); relentlessMaliceValues = new ConfigValues(customStatsOn, "gain a stacking buff that gives <style=cIsDamage>attackSpeedMult%</style> attack speed when hitting enemies with blot, max <style=cIsUtility>maxStacks</style> <style=cStack>(+maxStacks per stack)</style> stacks, gain more stacks per hit based on missing health\n\ngain a blotChance% chance to apply blot to enemies hit", new string[3] { "attackSpeedMult.float*100", "maxStacks.int*", "blotChance.float*1" }); shatteredBladeValues = new ConfigValues(customStatsOn, "<style=cIsUtility>blotChance%</style> <style=cStack>(+blotChance% per stack)</style> chance to apply blot on hit. blot inflicts damage equal to blot times 40% of attacker's base damage when taking damage", new string[1] { "blotChance.float*1" }); taintedWillValues = new ConfigValues(customStatsOn, "reduce damage taken from enemies with blot by <style=cIsUtility>damageReductionStack%</style> <style=cStack>(+damageReductionStack% per stack)</style> (approaches 50%)\n\nyou have a blotChance% chance to apply blot to enemies that damage you", new string[2] { "damageReductionStack.float*100", "blotChance.float*1" }); telescopicSightValues = new ConfigValues(customStatsOn, "deal <style=cIsDamage>distanceDamage%</style> <style=cStack>(+distanceDamage% per stack)</style> bonus damage per distanceIntervalm away from the enemy you are", new string[2] { "distanceInterval.float*1", "distanceDamage.float*100" }); twilightSpearValues = new ConfigValues(customStatsOn, "when hitting an enemy above percentHealth% health apply <style=cIsDamage>blotAmount</style> <style=cStack>(+blotAmount per stack)</style> blot", new string[2] { "blotAmount.int*", "percentHealth.float*100" }); weedWackerValues = new ConfigValues(customStatsOn, "every hitInterval hits deal <style=cIsDamage>baseDamage</style> <style=cStack>(+baseDamage per stack)</style> bonus damage, each time this occurs increase it's damage by <style=cIsDamage>damageIncrease</style> <style=cStack>(+damageIncrease per stack)</style> until the next stage", new string[3] { "hitInterval.int*", "baseDamage.float*1", "damageIncrease.float*1" }); itemsEnabled.Add("BloodyPillow", config.Bind<bool>("Items", "enable Bloody Pillow", true, "enable this item in game")); bloodyPillowValues.AddValue<ConfigEntry<float>>("percentStat", config.Bind<float>("Items", "Bloody Pillow stat change", 0.05f, "percent stat change")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["BloodyPillow"], delegate(bool newValue) { itemsEnabled["BloodyPillow"].Value = newValue; }); } itemsEnabled.Add("ClownNose", config.Bind<bool>("Items", "enable Clown Nose", false, "enable this item in game")); clownNoseValues.AddValue<ConfigEntry<float>>("percentDamage", config.Bind<float>("Items", "Clown Nose percent damage", 10f, "percent damage increase")); clownNoseValues.AddValue<ConfigEntry<float>>("percentDamageStack", config.Bind<float>("Items", "Clown Nose percent damage stack", 5f, "percent damage increase per stack")); clownNoseValues.AddValue<ConfigEntry<int>>("damageSources", config.Bind<int>("Items", "Clown Nose damage sources", 3, "number of damage sources")); clownNoseValues.AddValue<ConfigEntry<float>>("damageSourcesTime", config.Bind<float>("Items", "Clown Nose damage source time", 4f, "time until damage sources resets")); clownNoseValues.AddValue<ConfigEntry<float>>("damageSourcesTimeStack", config.Bind<float>("Items", "Clown Nose damage course time stack", 2f, "damage source time increase per stack")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["ClownNose"], delegate(bool newValue) { itemsEnabled["ClownNose"].Value = newValue; }); } itemsEnabled.Add("CompanyShieldGenerator", config.Bind<bool>("Items", "enable Company Shield Generator", true, "enable this item in game")); companyShieldGeneratorValues.AddValue<ConfigEntry<float>>("percentStack", config.Bind<float>("Items", "Company Shield Generator percent damage", 0.2f, "percent of damage to give barrier")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["CompanyShieldGenerator"], delegate(bool newValue) { itemsEnabled["CompanyShieldGenerator"].Value = newValue; }); } itemsEnabled.Add("ContractOfCommand", config.Bind<bool>("Items", "enable Contract Of Command", true, "enable this item in game")); contractOfCommandValues.AddValue<ConfigEntry<float>>("allyDamage", config.Bind<float>("Items", "Contract of Command damage to allies", 0.5f, "percent of damage taken dealt to allies")); contractOfCommandValues.AddValue<ConfigEntry<float>>("attackGain", config.Bind<float>("Items", "Contract of Command attack increase", 0.5f, "percent attack increase")); contractOfCommandValues.AddValue<ConfigEntry<float>>("speedGain", config.Bind<float>("Items", "Contract of Command speed increase", 0.5f, "percent speed increase")); contractOfCommandValues.AddValue<ConfigEntry<float>>("radius", config.Bind<float>("Items", "Contract of Command ally damage radius", 10f, "damage allies up to this distance away")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["ContractOfCommand"], delegate(bool newValue) { itemsEnabled["ContractOfCommand"].Value = newValue; }); } itemsEnabled.Add("DevouringJar", config.Bind<bool>("Items", "enable Devouring Jar", true, "enable this item in game")); devouringJarValues.AddValue<ConfigEntry<float>>("armorAmount", config.Bind<float>("Items", "Devouring Jar armor amount", 100f, "armor at 100 buff stacks")); devouringJarValues.AddValue<ConfigEntry<int>>("blotAmount", config.Bind<int>("Items", "Devouring Jar blot amount", 50, "blot applied at 100 buff stacks")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["DevouringJar"], delegate(bool newValue) { itemsEnabled["DevouringJar"].Value = newValue; }); } itemsEnabled.Add("EternalDread", config.Bind<bool>("Items", "enable Eternal Dread", true, "enable this item in game")); eternalDreadValues.AddValue<ConfigEntry<int>>("blotAmount", config.Bind<int>("Items", "Eternal Dread blot amount", 10, "blot applied")); eternalDreadValues.AddValue<ConfigEntry<int>>("hitInterval", config.Bind<int>("Items", "Eternal Dread hit interval", 3, "number of hits required to apply blot")); eternalDreadValues.AddValue<ConfigEntry<float>>("healAmount", config.Bind<float>("Items", "Eternal Dread heal amount", 5f, "amount to heal per 10 blot")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["EternalDread"], delegate(bool newValue) { itemsEnabled["EternalDread"].Value = newValue; }); } itemsEnabled.Add("PrettyStopwatch", config.Bind<bool>("Items", "enable Pretty Stopwatch", true, "enable this item in game")); prettyStopwatchValues.AddValue<ConfigEntry<float>>("percentSpeed", config.Bind<float>("Items", "Pretty Stopwatch percent speed", 0.05f, "percent speed increase per item stack")); prettyStopwatchValues.AddValue<ConfigEntry<float>>("speedTime", config.Bind<float>("Items", "Pretty Stopwatch speed increase time", 3f, "seconds between gaining a buff stack")); prettyStopwatchValues.AddValue<ConfigEntry<float>>("damageIncreasePerStack", config.Bind<float>("Items", "Pretty Stopwatch damage increase per stack", 4f, "multiplier for speed damage per item stack")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["PrettyStopwatch"], delegate(bool newValue) { itemsEnabled["PrettyStopwatch"].Value = newValue; }); } itemsEnabled.Add("QuantumBonsaiTree", config.Bind<bool>("Items", "enable Quantum Bonsai Tree", true, "enable this item in game")); quantumBonsaiTreeValues.AddValue<ConfigEntry<float>>("baseDamageChance", config.Bind<float>("Items", "Quantum Bonsai Tree base damage chance", 5f, "base percent chance of healing")); quantumBonsaiTreeValues.AddValue<ConfigEntry<float>>("overDamageChance", config.Bind<float>("Items", "Quantum Bonsai Tree damage chance", 100f, "per percent damage to increase heal chance")); quantumBonsaiTreeValues.AddValue<ConfigEntry<float>>("percentHeal", config.Bind<float>("Items", "Quantum Bonsai heal", 0.3f, "percent of max health to heal")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["QuantumBonsaiTree"], delegate(bool newValue) { itemsEnabled["QuantumBonsaiTree"].Value = newValue; }); } itemsEnabled.Add("RelentlessMalice", config.Bind<bool>("Items", "enable Relentless Malice", true, "enable this item in game")); relentlessMaliceValues.AddValue<ConfigEntry<int>>("attackSpeedMult", config.Bind<float>("Items", "Relentless Malice attack speed", 0.04f, "attack speed increase per buff stack")); relentlessMaliceValues.AddValue<ConfigEntry<int>>("maxStacks", config.Bind<int>("Items", "Relentless Malice max stacks", 10, "max buff stacks per item stack")); relentlessMaliceValues.AddValue<ConfigEntry<float>>("blotChance", config.Bind<float>("Items", "Relentless Malice blot chance", 5f, "chance to apply blot on hit")); relentlessMaliceValues.AddValue<ConfigEntry<float>>("timer", config.Bind<float>("Items", "Relentless Malice timer", 3f, "time buff is applied for")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["RelentlessMalice"], delegate(bool newValue) { itemsEnabled["RelentlessMalice"].Value = newValue; }); } itemsEnabled.Add("ShatteredBlade", config.Bind<bool>("Items", "enable Shattered Blade", true, "enable this item in game")); shatteredBladeValues.AddValue<ConfigEntry<float>>("blotChance", config.Bind<float>("Items", "Shattered Blade blot chance", 20f, "chance to apply blot")); shatteredBladeValues.AddValue<ConfigEntry<int>>("blightAmount", config.Bind<int>("Items", "Shattered Blade blot amount", 1, "blot applied")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["ShatteredBlade"], delegate(bool newValue) { itemsEnabled["ShatteredBlade"].Value = newValue; }); } itemsEnabled.Add("TaintedWill", config.Bind<bool>("Items", "enable Tainted Will", true, "enable this item in game")); taintedWillValues.AddValue<ConfigEntry<float>>("damageReductionStack", config.Bind<float>("Items", "Tainted Will damage reduction stack", 0.05f, "damage reduction increase per stack")); taintedWillValues.AddValue<ConfigEntry<float>>("blotChance", config.Bind<float>("Items", "Tainted Will blot chance", 10f, "chance to apply blot on damage taken")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["TaintedWill"], delegate(bool newValue) { itemsEnabled["TaintedWill"].Value = newValue; }); } itemsEnabled.Add("TelescopicSight", config.Bind<bool>("Items", "enable Telescopic Sight", true, "enable this item in game")); telescopicSightValues.AddValue<ConfigEntry<float>>("distanceInterval", config.Bind<float>("Items", "Telescopic Sight distance interval", 20f, "distance interval of damage bonus")); telescopicSightValues.AddValue<ConfigEntry<float>>("distanceDamage", config.Bind<float>("Items", "Telescopic Sight distance damage", 0.2f, "damage per distance interval")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["TelescopicSight"], delegate(bool newValue) { itemsEnabled["TelescopicSight"].Value = newValue; }); } itemsEnabled.Add("TwilightSpear", config.Bind<bool>("Items", "enable Twilight Spear", true, "enable this item in game")); twilightSpearValues.AddValue<ConfigEntry<int>>("blotAmount", config.Bind<int>("Items", "Twilight Spear blot amount", 1, "blot applied")); twilightSpearValues.AddValue<ConfigEntry<float>>("percentHealth", config.Bind<float>("Items", "Twilight Spear percent health", 0.5f, "percent health to apply blot at")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["TwilightSpear"], delegate(bool newValue) { itemsEnabled["TwilightSpear"].Value = newValue; }); } itemsEnabled.Add("WeedWacker", config.Bind<bool>("Items", "enable Weed Wacker", true, "enable this item in game")); weedWackerValues.AddValue<ConfigEntry<int>>("hitInterval", config.Bind<int>("Items", "Weed Wacker hit interval", 5, "number attacks required for effect to occur")); weedWackerValues.AddValue<ConfigEntry<float>>("baseDamage", config.Bind<float>("Items", "Weed Wacker damage", 20f, "damage dealt when effect occurs")); weedWackerValues.AddValue<ConfigEntry<float>>("damageIncrease", config.Bind<float>("Items", "Weed Wacker damage increase", 2f, "damage increase when effect occurs")); if (RiskOfOptionsDep.enabled) { RiskOfOptionsDep.AddCheckBoxOption(itemsEnabled["WeedWacker"], delegate(bool newValue) { itemsEnabled["WeedWacker"].Value = newValue; }); } Run.onRunSetRuleBookGlobal += delegate(Run run, RuleBook rulebook) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<string, ConfigEntry<bool>> item in itemsEnabled) { if (!item.Value.Value && run.availableItems.Contains(Main.ItemDict[item.Key].itemIndex)) { run.availableItems.Remove(Main.ItemDict[item.Key].itemIndex); } } }; } } public class ConfigValues { private Dictionary<string, ConfigEntry<float>> floatEntries; private Dictionary<string, ConfigEntry<int>> intEntries; private Dictionary<string, ConfigEntry<bool>> boolEntries; private ConfigEntry<bool> useCustomStats; private string descTemplate; private string[] descPlaceHolders; public string Description { get { string text = descTemplate; for (int i = 0; i < descPlaceHolders.Length; i++) { string text2 = descPlaceHolders[i].Substring(descPlaceHolders[i].IndexOf('.'), descPlaceHolders[i].IndexOf('*') - descPlaceHolders[i].IndexOf('.')); string text3 = descPlaceHolders[i].Substring(0, descPlaceHolders[i].IndexOf('.')); string s = descPlaceHolders[i].Substring(descPlaceHolders[i].IndexOf('*') + 1); switch (text2) { case ".float": text = text.Replace(text3, (GetFloat(text3) * float.Parse(s)).ToString()); break; case ".int": text = text.Replace(text3, GetInt(text3).ToString()); break; case ".bool": text = text.Replace(text3, GetBool(text3).ToString()); break; } } return text; } } public ConfigValues(ConfigEntry<bool> useCustomStats, string descTemplate, string[] descPlaceHolders) { floatEntries = new Dictionary<string, ConfigEntry<float>>(); intEntries = new Dictionary<string, ConfigEntry<int>>(); boolEntries = new Dictionary<string, ConfigEntry<bool>>(); this.useCustomStats = useCustomStats; this.descTemplate = descTemplate; this.descPlaceHolders = descPlaceHolders; } public void AddValue<T>(string name, ConfigEntry<float> configEntry) { floatEntries.Add(name, configEntry); } public void AddValue<T>(string name, ConfigEntry<bool> configEntry) { boolEntries.Add(name, configEntry); } public void AddValue<T>(string name, ConfigEntry<int> configEntry) { intEntries.Add(name, configEntry); } public ConfigEntry<float> GetFloatConfig(string name) { return floatEntries[name]; } public ConfigEntry<bool> GetBoolConfig(string name) { return boolEntries[name]; } public ConfigEntry<int> GetIntConfig(string name) { return intEntries[name]; } public float GetFloat(string name) { if (useCustomStats != null && useCustomStats.Value) { return floatEntries[name].Value; } return (float)((ConfigEntryBase)floatEntries[name]).DefaultValue; } public int GetInt(string name) { if (useCustomStats != null && useCustomStats.Value) { return intEntries[name].Value; } return (int)((ConfigEntryBase)intEntries[name]).DefaultValue; } public bool GetBool(string name) { if (useCustomStats != null && useCustomStats.Value) { return boolEntries[name].Value; } return (bool)((ConfigEntryBase)boolEntries[name]).DefaultValue; } } [BepInDependency("com.bepis.r2api", "5.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.oig.oigsItems", "oigs items", "3.0.0")] public class Main : BaseUnityPlugin { public const string ModGUID = "com.oig.oigsItems"; public const string ModName = "oigs items"; public const string ModVersion = "3.0.0"; public static AssetBundle Assets; public static Dictionary<string, BuffDef> BuffDict = new Dictionary<string, BuffDef>(); public static Dictionary<string, ItemDef> ItemDict = new Dictionary<string, ItemDef>(); public void Awake() { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("oigsItemsMod.oigsitemsbundle")) { if (stream != null) { Assets = AssetBundle.LoadFromStream(stream); } } SoftDepManager.Init(); OigsExtraEvents.Init(); Configs(); Instantiate(); Hooks(); } public void Configs() { ConfigManager.Init(((BaseUnityPlugin)this).Config); } public void Hooks() { } public void Instantiate() { VerifyItems(new TelescopicSight()); VerifyItems(new QuantumBonsaiTree()); VerifyItems(new CompanyShieldGenerator()); VerifyItems(new BloodyPillow()); VerifyItems(new ContractOfCommand()); VerifyItems(new ClownNose()); VerifyItems(new WeedWacker()); VerifyItems(new PrettyStopwatch()); VerifyItems(new DevouringJar()); VerifyItems(new EternalDread()); VerifyItems(new RelentlessMalice()); VerifyItems(new ShatteredBlade()); VerifyItems(new TaintedWill()); VerifyItems(new TwilightSpear()); VerifyBuffs(new ContractBuff()); VerifyBuffs(new WeedHitBuff()); VerifyBuffs(new WeedDamageBuff()); VerifyBuffs(new ClownNoseDebuff()); VerifyBuffs(new PrettyTimeBuff()); VerifyBuffs(new Blot()); VerifyBuffs(new DreadHitBuff()); VerifyBuffs(new DevouringJarBuff()); VerifyBuffs(new RelentlessMaliceBuff()); } public void VerifyItems(ItemBase item) { item.Init(); ItemDict.Add(item.ItemLangTokenName, item.itemDef); } public void VerifyBuffs(BaseBuff buff) { buff.Init(); BuffDict.Add(buff.BuffName, buff.buffDef); } public void VerifyAchievements(AchievementBase achievement) { if (((BaseUnityPlugin)this).Config.Bind<bool>("Items", "enable" + achievement.AchievementNameToken, true, "Enable this achievement in game? Default: true").Value) { achievement.Init(((BaseUnityPlugin)this).Config); } } } internal class OigsExtraEvents { public delegate void OigsDamageEventHandler(DamageInfo damageInfo, CharacterBody attackerBody, CharacterBody victimBody); public class OigsDamageEvents : MonoBehaviour, IOnIncomingDamageServerReceiver { public HealthComponent healthComponent; public CharacterBody victimBody; public void Start() { healthComponent = ((Component)this).GetComponent<HealthComponent>(); if (!Object.op_Implicit((Object)(object)healthComponent)) { Object.Destroy((Object)(object)this); } else { victimBody = healthComponent.body; } } public void OnIncomingDamageServer(DamageInfo damageInfo) { CharacterBody attackerBody = null; if (Object.op_Implicit((Object)(object)damageInfo.attacker)) { attackerBody = damageInfo.attacker.GetComponent<CharacterBody>(); } OigsExtraEvents.BeforeDamageTaken?.Invoke(damageInfo, attackerBody, victimBody); } } public static event OigsDamageEventHandler BeforeDamageTaken; public static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.Awake += new hook_Awake(HealthComponent_Awake); } private static void HealthComponent_Awake(orig_Awake orig, HealthComponent self) { ((Component)self).gameObject.AddComponent<OigsDamageEvents>(); orig.Invoke(self); } } } namespace oigsItemsMod.Utils { public static class ArrayHelper { public static T[] Append<T>(ref T[] array, List<T> list) { int num = array.Length; int count = list.Count; Array.Resize(ref array, num + count); list.CopyTo(array, num); return array; } public static Func<T[], T[]> AppendDel<T>(List<T> list) { return (T[] r) => Append(ref r, list); } } internal class ItemHelper { public static RendererInfo[] ItemDisplaySetup(GameObject obj) { //IL_001a: 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_0049: 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) MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>(); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { defaultMaterial = ((Renderer)componentsInChildren[i]).material, renderer = (Renderer)(object)componentsInChildren[i], defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } return array; } } } namespace oigsItemsMod.SoftDependencies { internal class BetterUIDep { } public static class RiskOfOptionsDep { public static bool enabled; private static bool reloadLogBook; public static void Init() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown ModSettingsManager.SetModDescription("oig's items settings", "com.oig.oigsItems", "oigs items"); ModSettingsManager.SetModIcon(Main.Assets.LoadAsset<Sprite>("Assets/profile/OigsItemsIcon.png")); LogBookController.Awake += new hook_Awake(LogBookController_Awake); } private static void LogBookController_Awake(orig_Awake orig, LogBookController self) { orig.Invoke(self); if (reloadLogBook) { reloadLogBook = false; LogBookController.BuildStaticData(); } } public static void AddCheckBoxOption(ConfigEntry<bool> configEntry, Action<bool> onChanged = null) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown if (onChanged != null) { configEntry.SettingChanged += delegate { onChanged(configEntry.Value); reloadLogBook = true; }; onChanged(configEntry.Value); reloadLogBook = true; } ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntry), "com.oig.oigsItems", "oigs items"); } public static void AddIntOption(ConfigEntry<int> configEntry, int min, int max, Action<int> onChanged = null) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0077: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown if (onChanged != null) { configEntry.SettingChanged += delegate { onChanged(configEntry.Value); reloadLogBook = true; }; onChanged(configEntry.Value); reloadLogBook = true; } ModSettingsManager.AddOption((BaseOption)new IntSliderOption(configEntry, new IntSliderConfig { min = min, max = max }), "com.oig.oigsItems", "oigs items"); } public static void AddFloatOption(ConfigEntry<float> configEntry, float min, float max, Action<float> onChanged = null) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (onChanged != null) { configEntry.SettingChanged += delegate { onChanged(configEntry.Value); reloadLogBook = true; }; onChanged(configEntry.Value); reloadLogBook = true; } ModSettingsManager.AddOption((BaseOption)new StepSliderOption(configEntry, new StepSliderConfig { min = min, max = max, increment = 0.01f }), "com.oig.oigsItems", "oigs items"); } } public static class SoftDepManager { public static void Init() { Dictionary<string, PluginInfo> pluginInfos = Chainloader.PluginInfos; if (pluginInfos.ContainsKey("com.rune580.riskofoptions")) { RiskOfOptionsDep.enabled = true; } } } } namespace oigsItemsMod.Items { internal class BloodyPillow : ItemBase { public override string ItemName => "Bloody Pillow"; public override string ItemLangTokenName => "BloodyPillow"; public override string ItemPickupDesc => "when killing an enemy randomly gain or lose attack, health, attack speed, or speed."; public override string ItemFullDescription => ConfigManager.bloodyPillowValues.Description; public override string ItemLore => "we all feel shame, the levels of shame vary though. somtimes by a lot and i mean A LOT."; public override ItemTier Tier => (ItemTier)3; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)6 }; public override string ItemModelPath => "Assets/items/bloodypillow/BloodyPillow.prefab"; public override string ItemIconPath => "Assets/items/bloodypillow/BloodyPillow.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { if (Object.op_Implicit((Object)(object)body.inventory)) { ((Component)body.inventory).gameObject.AddComponent<BloodyPillowTracker>(); } } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory) && GetCount(sender) > 0) { BloodyPillowTracker component = ((Component)sender.inventory).GetComponent<BloodyPillowTracker>(); if (Object.op_Implicit((Object)(object)component)) { args.damageMultAdd += component.pillowStats[0]; args.healthMultAdd += component.pillowStats[1]; args.moveSpeedMultAdd += component.pillowStats[2]; args.attackSpeedMultAdd += component.pillowStats[3]; } } } private void GlobalEventManager_onCharacterDeathGlobal(DamageReport report) { if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0) { BloodyPillowTracker component = ((Component)attackerBody.inventory).GetComponent<BloodyPillowTracker>(); if (Object.op_Implicit((Object)(object)component)) { int num = Random.Range(0, 4); bool flag = Util.CheckRoll(50f, attackerBody.master); component.pillowStats[num] += (flag ? ConfigManager.bloodyPillowValues.GetFloat("percentStat") : (ConfigManager.bloodyPillowValues.GetFloat("percentStat") * -1f)); } } } } internal class BloodyPillowTracker : MonoBehaviour { public float[] pillowStats = new float[4]; } internal class ClownNose : ItemBase { public override string ItemName => "Clown Nose"; public override string ItemLangTokenName => "ClownNose"; public override string ItemPickupDesc => "increase attack by a lot BUT if you take damage from multiple enemies in a short time the game crashes"; public override string ItemFullDescription => ConfigManager.clownNoseValues.Description; public override string ItemLore => "i swear it's funny"; public override ItemTier Tier => (ItemTier)3; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/clownnose/ClownNose.prefab"; public override string ItemIconPath => "Assets/items/clownnose/ClownNose.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { if (Object.op_Implicit((Object)(object)body.inventory)) { ((Component)body.inventory).gameObject.AddComponent<ClownNoseTracker>(); } } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory) && GetCount(sender) > 0) { args.damageMultAdd += ConfigManager.clownNoseValues.GetFloat("percentDamage") + ConfigManager.clownNoseValues.GetFloat("percentDamageStack") * (float)(GetCount(sender) - 1); } } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)victimBody) || !victimBody.isPlayerControlled || !Object.op_Implicit((Object)(object)victimBody.inventory) || GetCount(victimBody) <= 0) { return; } ClownNoseTracker component = ((Component)victimBody.inventory).GetComponent<ClownNoseTracker>(); if (Object.op_Implicit((Object)(object)component) && !component.sources.Contains(attackerBody)) { component.sources.Add(attackerBody); component.timeLeft = ConfigManager.clownNoseValues.GetFloat("damageSourcesTime") + ConfigManager.clownNoseValues.GetFloat("damageSourcesTimeStack") * (float)(GetCount(victimBody) - 1); if (NetworkServer.active) { victimBody.AddTimedBuff(Main.BuffDict["ClownNoseDebuff"], component.timeLeft); } } } } internal class ClownNoseTracker : MonoBehaviour { public List<CharacterBody> sources = new List<CharacterBody>(); public float timeLeft = 0f; public TeamIndex team; private void FixedUpdate() { if (timeLeft > 0f) { timeLeft -= Time.fixedDeltaTime; if (timeLeft <= 0f) { sources.Clear(); } if (sources.Count >= ConfigManager.clownNoseValues.GetInt("damageSources")) { Application.Quit(); } } } } internal class CompanyShieldGenerator : ItemBase { private const float percentStackDefault = 0.2f; private float percentStack = 0.2f; public override string ItemName => "Company Shield Generator"; public override string ItemLangTokenName => "CompanyShieldGenerator"; public override string ItemPickupDesc => "hitting enemies that are at max health gives you barrier."; public override string ItemFullDescription => ConfigManager.companyShieldGeneratorValues.Description; public override string ItemLore => "personal projects are for building yourself up, company projects are for destroying the competition"; public override ItemTier Tier => (ItemTier)0; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)2 }; public override string ItemModelPath => "Assets/items/companyshieldgenerator/CompanyShieldGenerator.prefab"; public override string ItemIconPath => "Assets/items/companyshieldgenerator/CompanyShieldGenerator.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient != 0f && !report.damageInfo.rejected) { CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0 && report.combinedHealthBeforeDamage >= victimBody.maxHealth) { attackerBody.healthComponent.AddBarrier(report.damageDealt * ConfigManager.companyShieldGeneratorValues.GetFloat("percentStack") * (float)GetCount(attackerBody)); } } } } internal class ContractOfCommand : ItemBase { private float timer = 5f; public override string ItemName => "Contract of Command"; public override string ItemLangTokenName => "ContractOfCommand"; public override string ItemPickupDesc => "on taking damage deal damage to nearby allies, gain damage and speed for a few seconds based on number of nearby alies"; public override string ItemFullDescription => ConfigManager.contractOfCommandValues.Description; public override string ItemLore => "a true commander is contractually obligated to fight for a cause that they believe in because it pays good money"; public override ItemTier Tier => (ItemTier)3; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)3 }; public override string ItemModelPath => "Assets/items/contractofcommand/ContractOfCommand.prefab"; public override string ItemIconPath => "Assets/items/contractofcommand/ContractOfCommand.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { if (Object.op_Implicit((Object)(object)body.inventory)) { ((Component)body.inventory).gameObject.AddComponent<ContractOfCommandTracker>(); } } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00f2: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) if (report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimBody.inventory) || GetCount(victimBody) <= 0 || attackerBody.teamComponent.teamIndex == victimBody.teamComponent.teamIndex) { return; } ContractOfCommandTracker component = ((Component)victimBody.inventory).gameObject.GetComponent<ContractOfCommandTracker>(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.attack = ConfigManager.contractOfCommandValues.GetFloat("attackGain") * (float)GetCount(victimBody); component.speed = ConfigManager.contractOfCommandValues.GetFloat("speedGain") * (float)GetCount(victimBody); TeamMask val = default(TeamMask); ((TeamMask)(ref val)).AddTeam(victimBody.teamComponent.teamIndex); HurtBox[] hurtBoxes = new SphereSearch { radius = ConfigManager.contractOfCommandValues.GetFloat("radius") * (float)GetCount(victimBody), origin = victimBody.corePosition, queryTriggerInteraction = (QueryTriggerInteraction)2, mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask }.RefreshCandidates().FilterCandidatesByDistinctHurtBoxEntities().FilterCandidatesByHurtBoxTeam(val) .GetHurtBoxes(); List<HealthComponent> list = new List<HealthComponent>(); HurtBox[] array = hurtBoxes; foreach (HurtBox val2 in array) { if (!list.Contains(val2.healthComponent) && (Object)(object)val2.healthComponent != (Object)(object)victimBody.healthComponent) { list.Add(val2.healthComponent); DamageInfo val3 = new DamageInfo(); val3.damage = report.damageDealt * ConfigManager.contractOfCommandValues.GetFloat("allyDamage"); val3.attacker = ((Component)victimBody).gameObject; val3.procCoefficient = 0f; val3.procChainMask = default(ProcChainMask); val3.crit = false; val3.position = ((Component)val2).transform.position; val3.damageColorIndex = (DamageColorIndex)3; val3.inflictor = ((Component)victimBody).gameObject; val3.damageType = DamageTypeCombo.op_Implicit((DamageType)0); val2.healthComponent.TakeDamage(val3); if (NetworkServer.active) { victimBody.AddTimedBuff(Main.BuffDict["ContractBuff"], timer); } } } } } internal class ContractOfCommandTracker : MonoBehaviour { public float attack = 0f; public float speed = 0f; } internal class DevouringJar : ItemBase { public override string ItemName => "Devouring Jar"; public override string ItemLangTokenName => "DevouringJar"; public override string ItemPickupDesc => "build up buff stacks to gain armor and apply blot at 100 stacks"; public override string ItemFullDescription => ConfigManager.devouringJarValues.Description; public override string ItemLore => "hey look, there's a little dude in this jar, he just eats everything i put in there\nhis name is Zar"; public override ItemTier Tier => (ItemTier)2; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)1 }; public override string ItemModelPath => "Assets/items/devouringjar/DevouringJar.prefab"; public override string ItemIconPath => "Assets/items/devouringjar/DevouringJar.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)victimBody.healthComponent) || !Object.op_Implicit((Object)(object)victimBody.inventory) || GetCount(victimBody) <= 0) { return; } int num = Mathf.FloorToInt(report.damageDealt / victimBody.maxHealth * 100f); if (NetworkServer.active) { for (int i = 0; i < num; i++) { victimBody.AddBuff(Main.BuffDict["DevouringJarBuff"]); } } } } internal class EternalDread : ItemBase { public override string ItemName => "Eternal Dread"; public override string ItemLangTokenName => "EternalDread"; public override string ItemPickupDesc => "apply blot and heal based on blot on enemy every 3 hits"; public override string ItemFullDescription => ConfigManager.eternalDreadValues.Description; public override string ItemLore => ""; public override ItemTier Tier => (ItemTier)2; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/eternaldread/EternalDread.prefab"; public override string ItemIconPath => "Assets/items/eternaldread/EternalDread.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient != 0f && !report.damageInfo.rejected) { CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.healthComponent) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0 && NetworkServer.active) { attackerBody.AddBuff(Main.BuffDict["DreadHitBuff"]); } } } } internal class PrettyStopwatch : ItemBase { public override string ItemName => "Pretty Stopwatch"; public override string ItemLangTokenName => "PrettyStopwatch"; public override string ItemPickupDesc => "increase movement speed every few seconds, the next time you deal damage deal bonus damage based on movement speed"; public override string ItemFullDescription => ConfigManager.prettyStopwatchValues.Description; public override string ItemLore => "assassinate in style"; public override ItemTier Tier => (ItemTier)2; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)3 }; public override string ItemModelPath => "Assets/items/prettystopwatch/PrettyStopWatch.prefab"; public override string ItemIconPath => "Assets/items/prettystopwatch/PrettyStopwatch.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { CharacterBody.onBodyInventoryChangedGlobal += CharacterBody_onBodyInventoryChangedGlobal; } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); } private void CharacterBody_onBodyInventoryChangedGlobal(CharacterBody body) { body.AddItemBehavior<PrettyStopwatchTracker>(GetCount(body)); } } internal class PrettyStopwatchTracker : ItemBehavior { public float timerMax = 0f; private float timer = 0f; private void Start() { timerMax = ConfigManager.prettyStopwatchValues.GetFloat("speedTime"); } private void FixedUpdate() { if (!Object.op_Implicit((Object)(object)base.body) || base.stack <= 0) { return; } timer += Time.fixedDeltaTime; if (timer >= timerMax) { if (NetworkServer.active) { base.body.AddBuff(Main.BuffDict["PrettyTimeBuff"]); } timer = 0f; } } } internal class QuantumBonsaiTree : ItemBase { public override string ItemName => "Quantum Bonsai Tree"; public override string ItemLangTokenName => "QuantumBonsaiTree"; public override string ItemPickupDesc => "Chance to heal after dealing damage, chance increases with more damage."; public override string ItemFullDescription => ConfigManager.quantumBonsaiTreeValues.Description; public override string ItemLore => "idk man, i strapped a quantum computer to a bonsai tree, dont worry about it"; public override ItemTier Tier => (ItemTier)2; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)2 }; public override string ItemModelPath => "Assets/items/quantumbonsaitree/QuantumBonsaiTree.prefab"; public override string ItemIconPath => "Assets/items/quantumbonsaitree/QuantumBonsaiTree.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { //IL_00e7: 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) if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0) { float num = report.damageDealt / attackerBody.damage * 100f - 100f; if (Util.CheckRoll(ConfigManager.quantumBonsaiTreeValues.GetFloat("baseDamageChance") + (float)((num > 0f) ? ((int)Math.Floor(num / ConfigManager.quantumBonsaiTreeValues.GetFloat("overDamageChance"))) : 0), attackerBody.master)) { attackerBody.healthComponent.Heal(ConfigManager.quantumBonsaiTreeValues.GetFloat("percentHeal") * (float)GetCount(attackerBody) * attackerBody.maxHealth, default(ProcChainMask), true); } } } } internal class RelentlessMalice : ItemBase { public override string ItemName => "Relentless Malice"; public override string ItemLangTokenName => "RelentlessMalice"; public override string ItemPickupDesc => "gain stacking attack speed when hitting enemies with blot, gain more stacks at lower health"; public override string ItemFullDescription => ConfigManager.relentlessMaliceValues.Description; public override string ItemLore => ""; public override ItemTier Tier => (ItemTier)1; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/relentlessmalice/RelentlessMalice.prefab"; public override string ItemIconPath => "Assets/items/relentlessmalice/RelentlessMalice.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)attackerBody.inventory) || GetCount(attackerBody) <= 0) { return; } if (Util.CheckRoll(ConfigManager.relentlessMaliceValues.GetFloat("blotChance"), attackerBody.master) && NetworkServer.active) { victimBody.AddBuff(Main.BuffDict["Blot"]); } if (!victimBody.HasBuff(Main.BuffDict["Blot"]) || !Object.op_Implicit((Object)(object)attackerBody.healthComponent)) { return; } int num = Mathf.FloorToInt(1f + 9f / (attackerBody.healthComponent.fullHealth * -0.9f) * (attackerBody.healthComponent.health - attackerBody.healthComponent.fullHealth)); num = Mathf.Clamp(num, 1, 10); if (!NetworkServer.active) { return; } for (int i = 0; i < num; i++) { if (attackerBody.GetBuffCount(Main.BuffDict["RelentlessMaliceBuff"]) < ConfigManager.relentlessMaliceValues.GetInt("maxStacks") * GetCount(attackerBody)) { attackerBody.AddTimedBuff(Main.BuffDict["RelentlessMaliceBuff"], ConfigManager.relentlessMaliceValues.GetFloat("timer")); } } } } internal class ShatteredBlade : ItemBase { public override string ItemName => "Shattered Blade"; public override string ItemLangTokenName => "ShatteredBlade"; public override string ItemPickupDesc => "chance to apply blot on hit"; public override string ItemFullDescription => ConfigManager.shatteredBladeValues.Description; public override string ItemLore => "oops, i hope no one notices i broke the merchandise"; public override ItemTier Tier => (ItemTier)0; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/shatteredblade/ShatteredBlade.prefab"; public override string ItemIconPath => "Assets/items/shatteredblade/ShatteredBlade.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient != 0f && !report.damageInfo.rejected) { CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0 && Util.CheckRoll(ConfigManager.shatteredBladeValues.GetFloat("blotChance"), attackerBody.master) && NetworkServer.active) { victimBody.AddBuff(Main.BuffDict["Blot"]); } } } } internal class TaintedWill : ItemBase { public override string ItemName => "Tainted Will"; public override string ItemLangTokenName => "TaintedWill"; public override string ItemPickupDesc => "reduce damage taken from enemies with blot"; public override string ItemFullDescription => ConfigManager.taintedWillValues.Description; public override string ItemLore => "hey why won't this bracelet come off"; public override ItemTier Tier => (ItemTier)0; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/taintedwill/TaintedWill.prefab"; public override string ItemIconPath => "Assets/items/taintedwill/TaintedWill.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { OigsExtraEvents.BeforeDamageTaken += OigsExtraEvents_BeforeDamageTaken; } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); } private void OigsExtraEvents_BeforeDamageTaken(DamageInfo damageInfo, CharacterBody attackerBody, CharacterBody victimBody) { if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.inventory) && GetCount(victimBody) > 0) { if (Util.CheckRoll(ConfigManager.taintedWillValues.GetFloat("blotChance"), victimBody.master) && NetworkServer.active) { attackerBody.AddBuff(Main.BuffDict["Blot"]); } if (attackerBody.HasBuff(Main.BuffDict["Blot"])) { float num = 0.05f * (float)GetCount(victimBody) / (0.1f * (float)GetCount(victimBody) + 1f); damageInfo.damage *= 1f - num; } } } } internal class TelescopicSight : ItemBase { public override string ItemName => "Telescopic Sight"; public override string ItemLangTokenName => "TelescopicSight"; public override string ItemPickupDesc => "Deal bonus damage based on how far your attack travels"; public override string ItemFullDescription => ConfigManager.telescopicSightValues.Description; public override string ItemLore => "its like from the first game but a completely different item"; public override ItemTier Tier => (ItemTier)1; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/telescopicsight/TelescopicSight.prefab"; public override string ItemIconPath => "Assets/items/telescopicsight/TelescopicSight.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { //IL_0064: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0) { float num = Vector3.Distance(attackerBody.corePosition, victimBody.corePosition); if (num >= ConfigManager.telescopicSightValues.GetFloat("distanceInterval")) { int num2 = (int)Math.Floor(num / ConfigManager.telescopicSightValues.GetFloat("distanceInterval")); DamageInfo val = new DamageInfo(); val.attacker = ((Component)attackerBody).gameObject; val.damageType = DamageTypeCombo.op_Implicit((DamageType)0); val.damage = report.damageDealt * (ConfigManager.telescopicSightValues.GetFloat("distanceDamage") * (float)GetCount(attackerBody) * (float)num2); val.crit = false; val.damageColorIndex = (DamageColorIndex)12; val.procCoefficient = 0f; val.position = victimBody.corePosition; val.procChainMask = default(ProcChainMask); victimBody.healthComponent.TakeDamage(val); } } } } internal class TwilightSpear : ItemBase { public override string ItemName => "Twilight Spear"; public override string ItemLangTokenName => "TwilightSpear"; public override string ItemPickupDesc => "apply blot when hitting an enemy near full health"; public override string ItemFullDescription => ConfigManager.twilightSpearValues.Description; public override string ItemLore => "isn't that just a regular spear?\nno, no, no, look how cool the spear head looks, it has to be special"; public override ItemTier Tier => (ItemTier)1; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/twilightspear/TwilightSpear.prefab"; public override string ItemIconPath => "Assets/items/twilightspear/TwilightSpear.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.healthComponent) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0 && report.combinedHealthBeforeDamage > victimBody.healthComponent.fullHealth * ConfigManager.twilightSpearValues.GetFloat("percentHealth") && NetworkServer.active) { for (int i = 0; i < ConfigManager.twilightSpearValues.GetInt("blotAmount") * GetCount(attackerBody); i++) { victimBody.AddBuff(Main.BuffDict["Blot"]); } } } } internal class WeedWacker : ItemBase { public override string ItemName => "Weed Wacker"; public override string ItemLangTokenName => "WeedWacker"; public override string ItemPickupDesc => "every three hits deal bonus damage, each time this occurs increase the damage until the next stage"; public override string ItemFullDescription => ConfigManager.weedWackerValues.Description; public override string ItemLore => "mow 'em down"; public override ItemTier Tier => (ItemTier)1; public override ItemTag[] ItemTags => (ItemTag[])(object)new ItemTag[1] { (ItemTag)1 }; public override string ItemModelPath => "Assets/items/weedwacker/WeedWacker.prefab"; public override string ItemIconPath => "Assets/items/weedwacker/WeedWacker.png"; public override ItemDisplayRuleDict CreateItemDisplayRules() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemBase.ItemBodyModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); ItemDisplay val = ItemBase.ItemBodyModelPrefab.AddComponent<ItemDisplay>(); val.rendererInfos = ItemHelper.ItemDisplaySetup(ItemBase.ItemBodyModelPrefab); return new ItemDisplayRuleDict((ItemDisplayRule[])null); } public override void Hooks() { } public override void Init() { CreateItemDisplayRules(); CreateLang(); CreateItem(); Hooks(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient != 0f && !report.damageInfo.rejected) { CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody.healthComponent) && Object.op_Implicit((Object)(object)attackerBody.inventory) && GetCount(attackerBody) > 0 && NetworkServer.active) { attackerBody.AddBuff(Main.BuffDict["WeedHitBuff"]); } } } } } namespace oigsItemsMod.Examples { internal class EXAMPLE_ACHIEVEMENT : AchievementBase { public override string AchievementIdentifier => "EXAMPLE_CLASS_ACH_ID"; public override string UnlockableIdentifier => "EXAMPLE_CLASS_UNLK_ID"; public override string AchievementNameToken => "EXAMPLE_CLASS_ACH_NAME"; public override string PrerequisiteUnlockableIdentifier => ""; public override string UnlockableNameToken => "EXAMPLE_CLASS_UNLK_NAME"; public override string AchievementDescToken => "EXAMPLE_CLASS_ACH_DECS"; public override Sprite Sprite { get { throw new NotImplementedException(); } } public override Func<string> GetHowToUnlock { get; } = () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2] { Language.GetString("EXAMPLE_CLASS_ACH_NAME"), Language.GetString("EXAMPLE_CLASS_ACH_DECS") }); public override Func<string> GetUnlocked { get; } = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString("EXAMPLE_CLASS_ACH_NAME"), Language.GetString("EXAMPLE_CLASS_ACH_DECS") }); public override void Config(ConfigFile config) { } public override void Init(ConfigFile config) { Config(config); CreateAchievement(); } public override void OnInstall() { base.OnInstall(); } public override void OnUninstall() { base.OnUninstall(); } } } namespace oigsItemsMod.Buffs { internal class Blot : BaseBuff { public override string BuffName => "Blot"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => true; public override string BuffIconPath => "Assets/buffs/blot/Blot.png"; public override void Hooks() { GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (report.damageInfo.procCoefficient != 0f && !report.damageInfo.rejected) { CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.healthComponent) && victimBody.HasBuff(buffDef)) { DamageInfo val = new DamageInfo(); val.damageType = DamageTypeCombo.op_Implicit((DamageType)0); val.damage = (Object.op_Implicit((Object)(object)attackerBody) ? ((float)victimBody.GetBuffCount(buffDef) * 0.4f * attackerBody.baseDamage) : ((float)victimBody.GetBuffCount(buffDef))) * report.damageInfo.procCoefficient; val.crit = false; val.damageColorIndex = (DamageColorIndex)3; val.procCoefficient = 0f; val.position = victimBody.corePosition; val.procChainMask = default(ProcChainMask); victimBody.healthComponent.TakeDamage(val); } } } } internal class ClownNoseDebuff : BaseBuff { public override string BuffName => "ClownNoseDebuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => true; public override string BuffIconPath => "Assets/items/clownnose/ClownNoseDebuff.png"; public override void Hooks() { } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } } internal class ContractBuff : BaseBuff { public override string BuffName => "ContractBuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => false; public override string BuffIconPath => "Assets/items/contractofcommand/ContractBuff.png"; public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(buffDef) && Object.op_Implicit((Object)(object)sender.inventory)) { ContractOfCommandTracker component = ((Component)sender.inventory).GetComponent<ContractOfCommandTracker>(); if (Object.op_Implicit((Object)(object)component)) { args.damageMultAdd += component.attack * (float)sender.GetBuffCount(buffDef); args.moveSpeedMultAdd += component.speed * (float)sender.GetBuffCount(buffDef); } } } } internal class DevouringJarBuff : BaseBuff { public override string BuffName => "DevouringJarBuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => false; public override string BuffIconPath => "Assets/items/devouringjar/DevouringJarBuff.png"; public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(buffDef) && sender.GetBuffCount(buffDef) >= 100 && Object.op_Implicit((Object)(object)sender.inventory)) { args.armorAdd += ConfigManager.devouringJarValues.GetFloat("armorAmount") * (float)sender.inventory.GetItemCount(Main.ItemDict["DevouringJar"]); } } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)attackerBody.inventory) && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.healthComponent) && attackerBody.HasBuff(buffDef) && attackerBody.GetBuffCount(buffDef) >= 100) { int buffCount = attackerBody.GetBuffCount(buffDef); for (int i = 0; i < 100; i++) { attackerBody.RemoveBuff(buffDef); } for (int j = 0; j < ConfigManager.devouringJarValues.GetInt("blotAmount") * attackerBody.inventory.GetItemCount(Main.ItemDict["DevouringJar"]); j++) { victimBody.AddBuff(Main.BuffDict["Blot"]); } } } } internal class DreadHitBuff : BaseBuff { public override string BuffName => "DreadHitBuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => false; public override string BuffIconPath => "Assets/items/eternaldread/DreadHitBuff.png"; public override void Hooks() { GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { //IL_017b: Unknown result type (might be due to invalid IL or missing references) if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)attackerBody.inventory) || !Object.op_Implicit((Object)(object)attackerBody.healthComponent) || !Object.op_Implicit((Object)(object)victimBody.healthComponent)) { return; } int itemCount = attackerBody.inventory.GetItemCount(Main.ItemDict["EternalDread"]); int buffCount = attackerBody.GetBuffCount(buffDef); if (!attackerBody.HasBuff(buffDef) || buffCount < ConfigManager.eternalDreadValues.GetInt("hitInterval")) { return; } if (NetworkServer.active) { for (int i = 0; i < buffCount; i++) { attackerBody.RemoveBuff(buffDef); } for (int j = 0; j < ConfigManager.eternalDreadValues.GetInt("blotAmount") * itemCount; j++) { victimBody.AddBuff(Main.BuffDict["Blot"]); } } attackerBody.healthComponent.Heal(Mathf.Floor((float)victimBody.GetBuffCount(Main.BuffDict["Blot"]) / 10f) * ConfigManager.eternalDreadValues.GetFloat("healAmount"), report.damageInfo.procChainMask, true); } } internal class PrettyTimeBuff : BaseBuff { public override string BuffName => "PrettyTimeBuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => false; public override string BuffIconPath => "Assets/items/prettystopwatch/PrettyTimeBuff.png"; public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(buffDef) && Object.op_Implicit((Object)(object)sender.inventory)) { args.moveSpeedMultAdd += ConfigManager.prettyStopwatchValues.GetFloat("percentSpeed") * (float)sender.GetBuffCount(buffDef) + ConfigManager.prettyStopwatchValues.GetFloat("percentSpeed") * (float)sender.GetBuffCount(buffDef) * (float)(sender.inventory.GetItemCount(Main.ItemDict["PrettyStopwatch"]) - 1); } } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)attackerBody.inventory)) { return; } int itemCount = attackerBody.inventory.GetItemCount(Main.ItemDict["PrettyStopwatch"]); if (!attackerBody.HasBuff(buffDef)) { return; } int buffCount = attackerBody.GetBuffCount(buffDef); DamageInfo val = new DamageInfo(); val.attacker = ((Component)attackerBody).gameObject; val.damageType = DamageTypeCombo.op_Implicit((DamageType)0); val.damage = attackerBody.damage * (attackerBody.moveSpeed * (float)buffCount * (ConfigManager.prettyStopwatchValues.GetFloat("damageIncreasePerStack") + ConfigManager.prettyStopwatchValues.GetFloat("damageIncreasePerStack") * (float)(itemCount - 1)) / 100f); val.crit = false; val.damageColorIndex = (DamageColorIndex)3; val.procCoefficient = 0f; val.position = victimBody.corePosition; val.procChainMask = default(ProcChainMask); victimBody.healthComponent.TakeDamage(val); if (NetworkServer.active) { for (int i = 0; i < buffCount; i++) { attackerBody.RemoveBuff(buffDef); } } } } internal class RelentlessMaliceBuff : BaseBuff { public override string BuffName => "RelentlessMaliceBuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => false; public override string BuffIconPath => "Assets/items/relentlessmalice/RelentlessMaliceBuff.png"; public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(buffDef) && Object.op_Implicit((Object)(object)sender.inventory)) { args.attackSpeedMultAdd += (float)sender.GetBuffCount(buffDef) * ConfigManager.relentlessMaliceValues.GetFloat("attackSpeedMult"); } } } internal class WeedDamageBuff : BaseBuff { public override string BuffName => "WeedDamageBuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => false; public override string BuffIconPath => "Assets/items/weedwacker/WeedDamageBuff.png"; public override void Hooks() { } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } } internal class WeedHitBuff : BaseBuff { public override string BuffName => "WeedHitBuff"; public override Color BuffColor => Color.white; public override bool CanStack => true; public override bool IsDebuff => false; public override string BuffIconPath => "Assets/items/weedwacker/WeedHitBuff.png"; public override void Hooks() { GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; } public override void Init() { CreateLang(); CreateBuff(); Hooks(); } private void GlobalEventManager_onServerDamageDealt(DamageReport report) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) if (report.damageInfo.procCoefficient == 0f || report.damageInfo.rejected) { return; } CharacterBody attackerBody = report.attackerBody; CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)attackerBody.inventory) || !Object.op_Implicit((Object)(object)victimBody.healthComponent)) { return; } int itemCount = attackerBody.inventory.GetItemCount(Main.ItemDict["WeedWacker"]); int buffCount = attackerBody.GetBuffCount(buffDef); if (!attackerBody.HasBuff(buffDef) || buffCount < ConfigManager.weedWackerValues.GetInt("hitInterval")) { return; } DamageInfo val = new DamageInfo(); val.attacker = ((Component)attackerBody).gameObject; val.damageType = DamageTypeCombo.op_Implicit((DamageType)0); val.damage = ConfigManager.weedWackerValues.GetFloat("baseDamage") + ConfigManager.weedWackerValues.GetFloat("baseDamage") * (float)(itemCount - 1) + (ConfigManager.weedWackerValues.GetFloat("damageIncrease") + ConfigManager.weedWackerValues.GetFloat("damageIncrease") * (float)(itemCount - 1)) * (float)(attackerBody.HasBuff(Main.BuffDict["WeedDamageBuff"]) ? attackerBody.GetBuffCount(Main.BuffDict["WeedDamageBuff"]) : 0); val.crit = false; val.damageColorIndex = (DamageColorIndex)3; val.procCoefficient = 0f; val.position = victimBody.corePosition; val.procChainMask = default(ProcChainMask); victimBody.healthComponent.TakeDamage(val); if (NetworkServer.active) { for (int i = 0; i < buffCount; i++) { attackerBody.RemoveBuff(buffDef); } attackerBody.AddBuff(Main.BuffDict["WeedDamageBuff"]); } } } } namespace oigsItemsMod.Base_Classes { public abstract class AchievementBase : BaseAchievement, IModdedUnlockableDataProvider { private static readonly MethodInfo GenericAddUnlock = typeof(UnlockableAPI).GetMethod("AddUnlockable"); public abstract string AchievementIdentifier { get; } public abstract string UnlockableIdentifier { get; } public abstract string AchievementNameToken { get; } public abstract string PrerequisiteUnlockableIdentifier { get; } public abstract string UnlockableNameToken { get; } public abstract string AchievementDescToken { get; } public abstract Sprite Sprite { get; } public abstract Func<string> GetHowToUnlock { get; } public abstract Func<string> GetUnlocked { get; } public void Revoke() { if (((BaseAchievement)this).userProfile.HasAchievement(AchievementIdentifier)) { ((BaseAchievement)this).userProfile.RevokeAchievement(AchievementIdentifier); } ((BaseAchievement)this).userProfile.RevokeUnlockable(UnlockableCatalog.GetUnlockableDef(UnlockableIdentifier)); } public abstract void Init(ConfigFile config); public abstract void Config(ConfigFile config); protected void CreateAchievement() { GenericAddUnlock.MakeGenericMethod(((object)this).GetType()).Invoke(null, new object[1] { true }); } public override void OnGranted() { ((BaseAchievement)this).OnGranted(); } public override void OnInstall() { ((BaseAchievement)this).OnInstall(); } public override void OnUninstall() { ((BaseAchievement)this).OnUninstall(); } public override float ProgressForAchievement() { return ((BaseAchievement)this).ProgressForAchievement(); } } public abstract class BaseBuff { public BuffDef buffDef = ScriptableObject.CreateInstance<BuffDef>(); public abstract string BuffName { get; } public abstract Color BuffColor { get; } public abstract bool CanStack { get; } public abstract string BuffIconPath { get; } public abstract bool IsDebuff { get; } public abstract void Init(); protected void CreateLang() { LanguageAPI.Add("BUFF_" + BuffName + "_NAME", BuffName); } protected void CreateBuff() { //IL_001a: 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) ((Object)buffDef).name = BuffName; buffDef.buffColor = BuffColor; buffDef.canStack = CanStack; buffDef.iconSprite = Main.Assets.LoadAsset<Sprite>(BuffIconPath); buffDef.isDebuff = IsDebuff; ContentAddition.AddBuffDef(buffDef); } public abstract void Hooks(); } public abstract class ItemBase { public static GameObject ItemBodyModelPrefab; public ItemDef itemDef = ScriptableObject.CreateInstance<ItemDef>(); public abstract string ItemName { get; } public abstract string ItemLangTokenName { get; } public abstract string ItemPickupDesc { get; } public abstract string ItemFullDescription { get; } public abstract string ItemLore { get; } public abstract ItemTier Tier { get; } public virtual ItemTag[] ItemTags { get; } = (ItemTag[])(object)new ItemTag[0]; public abstract string ItemModelPath { get; } public abstract string ItemIconPath { get; } public virtual bool CanRemove { get; } public virtual bool Hidden { get; } public virtual bool HasUnlockable { get; } public virtual UnlockableDef ItemPreReq { get; } public abstract void Init(); protected void CreateLang() { LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_NAME", ItemName); LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_PICKUP", ItemPickupDesc); LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_DESCRIPTION", ItemFullDescription); LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore); } public abstract ItemDisplayRuleDict CreateItemDisplayRules(); protected void CreateItem() { //IL_010d: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown ((Object)itemDef).name = "ITEM_" + ItemLangTokenName; itemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME"; itemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP"; itemDef.descriptionToken = "ITEM_" + ItemLangTokenName + "_DESCRIPTION"; itemDef.loreToken = "ITEM_" + ItemLangTokenName + "_LORE"; itemDef.pickupModelPrefab = Main.Assets.LoadAsset<GameObject>(ItemModelPath); itemDef.pickupIconSprite = Main.Assets.LoadAsset<Sprite>(ItemIconPath); itemDef.hidden = Hidden; itemDef.tags = ItemTags; itemDef.canRemove = CanRemove; itemDef.tier = Tier; itemDef.unlockableDef = ItemPreReq; itemDef.canRemove = true; itemDef.deprecatedTier = Tier; ItemDisplayRuleDict val = CreateItemDisplayRules(); ItemAPI.Add(new CustomItem(itemDef, CreateItemDisplayRules())); } public abstract void Hooks(); public int GetCount(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return 0; } return body.inventory.GetItemCount(itemDef); } public int GetCount(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory)) { return 0; } return master.inventory.GetItemCount(itemDef); } } }