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 IDodgedThat v1.0.4
plugins/viliger-IDodgedThat/IDodgedThat.dll
Decompiled 5 months 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.Configuration; using RoR2; using RoR2.Skills; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("IDodgedThat")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("IDodgedThat")] [assembly: AssemblyTitle("IDodgedThat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace WhatKilledMe; [BepInPlugin("com.Viliger.IDodgedThat", "IDodgedThat", "1.0.4")] public class IDodgedThatPlugin : BaseUnityPlugin { public const string Author = "Viliger"; public const string ModName = "IDodgedThat"; public const string Version = "1.0.4"; public const string GUID = "com.Viliger.IDodgedThat"; public const string LanguageFolder = "Language"; public static ConfigEntry<bool> UseSkillDefNames; private void Awake() { UseSkillDefNames = ((BaseUnityPlugin)this).Config.Bind<bool>("Death Log", "Output SkillDef Names", true, "Outputs SkillDef name if nameToken is null or empty for that skillDef."); GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } private void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown if ((int)damageReport.victimTeamIndex != 1 || !Object.op_Implicit((Object)(object)damageReport.victimBody) || !damageReport.victimBody.isPlayerControlled) { return; } string text = Language.GetString("WHAT_KILLED_ME_SOMETHING"); string text2 = ""; if (Object.op_Implicit((Object)(object)damageReport.attackerBody)) { text = Util.GetBestBodyName(((Component)damageReport.attackerBody).gameObject); string text3 = AttemptToGetSkill(damageReport); if (!Utility.IsNullOrWhiteSpace(text3)) { text2 = string.Format(Language.GetString("WHAT_KILLED_ME_DAMAGE_SOURCE"), text3); } } string baseToken = "WHAT_KILLED_ME_NORMAL_DEATH"; if (damageReport.isFriendlyFire) { baseToken = "WHAT_KILLED_ME_FRIENDLY_FIRE"; } else if (IsDamageVoidFog(damageReport.damageInfo)) { baseToken = "WHAT_KILLED_ME_VOID_FOG"; text = ""; text2 = ""; } else if (IsDamageVoidDeath(damageReport.damageInfo)) { baseToken = "WHAT_KILLED_ME_JAILED"; text2 = ""; } else if (damageReport.isFallDamage) { baseToken = "WHAT_KILLED_ME_WEAK_ASS_KNEES"; text = ""; text2 = ""; } string bestMasterName = Util.GetBestMasterName(damageReport.victimMaster); SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = baseToken; val.paramTokens = new string[5] { bestMasterName, text, damageReport.damageDealt.ToString("F0"), damageReport.combinedHealthBeforeDamage.ToString("F0"), text2 }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } private bool IsDamageVoidFog(DamageInfo damageInfo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 if ((int)damageInfo.damageColorIndex == 9 && (damageInfo.damageType.damageType & 2) == 2) { return (damageInfo.damageType.damageType & 0x40) == 64; } return false; } private string AttemptToGetSkill(DamageReport damageReport) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) CharacterBody attackerBody = damageReport.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)attackerBody.skillLocator)) { return ""; } if (((Enum)damageReport.damageInfo.damageType.damageSource).HasFlag((Enum)(object)(DamageSource)1)) { return GetSkillString(attackerBody.skillLocator.primary); } if (((Enum)damageReport.damageInfo.damageType.damageSource).HasFlag((Enum)(object)(DamageSource)2)) { return GetSkillString(attackerBody.skillLocator.secondary); } if (((Enum)damageReport.damageInfo.damageType.damageSource).HasFlag((Enum)(object)(DamageSource)4)) { return GetSkillString(attackerBody.skillLocator.utility); } if (((Enum)damageReport.damageInfo.damageType.damageSource).HasFlag((Enum)(object)(DamageSource)8)) { return GetSkillString(attackerBody.skillLocator.special); } return ""; } private string GetSkillString(GenericSkill skill) { if (Object.op_Implicit((Object)(object)skill)) { SkillDef val = ((skill.currentSkillOverride < 0) ? skill.skillDef : skill.skillOverrides[skill.currentSkillOverride].skillDef); if (Object.op_Implicit((Object)(object)val)) { if (!Utility.IsNullOrWhiteSpace(val.skillDescriptionToken)) { string @string = Language.GetString(skill.skillNameToken); if (!Utility.IsNullOrWhiteSpace(@string) && !@string.Equals(skill.skillNameToken)) { return @string; } if (UseSkillDefNames.Value) { return val.skillName; } } else if (UseSkillDefNames.Value) { return val.skillName; } } } return ""; } private bool IsDamageVoidDeath(DamageInfo damageInfo) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 return (damageInfo.damageType.damageType & 0x10000) == 65536; } private void Language_collectLanguageRootFolders(List<string> folders) { folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language")); } }