Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of BossDiversity v1.0.0
BossDiversity.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("BossDiversity")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a9ee47c436cc65307864ea07f6ee4ed9b0d4fb24")] [assembly: AssemblyProduct("BossDiversity")] [assembly: AssemblyTitle("BossDiversity")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BossDiversity { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Lawlzee.BossDiversity", "BossDiversity", "1.0.0")] public class BossDiversityPlugin : BaseUnityPlugin { public const string PluginGUID = "Lawlzee.BossDiversity"; public const string PluginAuthor = "Lawlzee"; public const string PluginName = "BossDiversity"; public const string PluginVersion = "1.0.0"; private bool _isBossWave; public static ConfigEntry<bool> ModEnabled; public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); CombatDirector.SetNextSpawnAsBoss += new hook_SetNextSpawnAsBoss(CombatDirector_SetNextSpawnAsBoss); CombatDirector.Simulate += new hook_Simulate(CombatDirector_Simulate); BossGroup.OnMemberDefeatedServer += new hook_OnMemberDefeatedServer(BossGroup_OnMemberDefeatedServer); ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Configuration", "Mod enabled", true, "Mod enabled"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ModEnabled)); ModSettingsManager.SetModIcon(LoadIconSprite()); } private Sprite LoadIconSprite() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon.png"))); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f)); } private void CombatDirector_SetNextSpawnAsBoss(orig_SetNextSpawnAsBoss orig, CombatDirector self) { orig.Invoke(self); if (ModEnabled.Value && !_isBossWave && (Object)(object)TeleporterInteraction.instance?.bossDirector == (Object)(object)self) { Log.Debug("Spawn wave started"); _isBossWave = true; } } private void CombatDirector_Simulate(orig_Simulate orig, CombatDirector self, float deltaTime) { orig.Invoke(self, deltaTime); if (ModEnabled.Value) { if (_isBossWave && (Object)(object)TeleporterInteraction.instance?.bossDirector == (Object)(object)self) { if (self.currentMonsterCard == null) { Log.Debug("Boss wave spawn ended"); _isBossWave = false; return; } Log.Debug("Replacing boss spawn"); float monsterSpawnTimer = self.monsterSpawnTimer; int spawnCountInCurrentWave = self.spawnCountInCurrentWave; self.SetNextSpawnAsBoss(); self.monsterSpawnTimer = monsterSpawnTimer; self.spawnCountInCurrentWave = spawnCountInCurrentWave; } } else { _isBossWave = false; } } private void BossGroup_OnMemberDefeatedServer(orig_OnMemberDefeatedServer orig, BossGroup self, CharacterMaster memberMaster, DamageReport damageReport) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, memberMaster, damageReport); if (!ModEnabled.Value) { return; } for (int i = 0; i < self.bossMemoryCount; i++) { BossMemory val = self.bossMemories[i]; if (Object.op_Implicit((Object)(object)val.cachedBody) && Object.op_Implicit((Object)(object)val.cachedBody.healthComponent) && val.cachedBody.healthComponent.alive) { self.bestObservedName = Util.GetBestBodyName(((Component)val.cachedBody).gameObject); self.bestObservedSubtitle = val.cachedBody.GetSubtitle(); if (self.bestObservedSubtitle.Length == 0) { self.bestObservedSubtitle = Language.GetString("NULL_SUBTITLE"); } self.bestObservedSubtitle = "<sprite name=\"CloudLeft\" tint=1> " + self.bestObservedSubtitle + "<sprite name=\"CloudRight\" tint=1>"; Log.Debug("Health bar label updated"); break; } } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }