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 RoR2;
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.0")]
public class IDodgedThatPlugin : BaseUnityPlugin
{
public const string Author = "Viliger";
public const string ModName = "IDodgedThat";
public const string Version = "1.0.0";
public const string GUID = "com.Viliger.IDodgedThat";
public const string LanguageFolder = "Language";
private void Awake()
{
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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Expected O, but got Unknown
if ((int)damageReport.victimTeamIndex == 1 && Object.op_Implicit((Object)(object)damageReport.victimBody) && damageReport.victimBody.isPlayerControlled)
{
string text = Language.GetString("WHAT_KILLED_ME_SOMETHING");
if (Object.op_Implicit((Object)(object)damageReport.attackerBody))
{
text = Util.GetBestBodyName(((Component)damageReport.attackerBody).gameObject);
}
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 = "";
}
else if (IsDamageVoidDeath(damageReport.damageInfo))
{
baseToken = "WHAT_KILLED_ME_JAILED";
}
else if (damageReport.isFallDamage)
{
baseToken = "WHAT_KILLED_ME_WEAK_ASS_KNEES";
text = "";
}
string bestMasterName = Util.GetBestMasterName(damageReport.victimMaster);
SimpleChatMessage val = new SimpleChatMessage();
val.baseToken = baseToken;
val.paramTokens = new string[4]
{
bestMasterName,
text,
damageReport.damageDealt.ToString("F0"),
damageReport.combinedHealthBeforeDamage.ToString("F0")
};
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 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"));
}
}