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 BLOODMOON v6.6.8
BepInEx/Plugins/BloodMoon/ExamplePlugin.dll
Decompiled a day 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.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.SceneManagement; [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("ExamplePlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ExamplePlugin")] [assembly: AssemblyTitle("ExamplePlugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 ExamplePlugin { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("YourName.BloodMoon", "BloodMoon", "1.0.3")] public class ExamplePlugin : BaseUnityPlugin { public const string PluginGUID = "YourName.BloodMoon"; public const string PluginName = "BloodMoon"; public const string PluginVersion = "1.0.3"; private const float EquipmentDuration = 30f; private const float EquipmentCooldown = 45f; private const float VisualFadeDuration = 5f; private const int BloodMoonMultiplier = 3; private const int UnknownMultiplier = 10; private const int BloodMoonID = 0; private const int UnknownID = 1; private static EquipmentDef bloodMoonEquipmentDef; private static EquipmentDef unknownEquipmentDef; private static Texture2D bloodMoonIconTexture; private static Sprite bloodMoonIconSprite; private static float bloodMoonEndTime; private static float unknownEndTime; private static float bloodMoonVisualEndTime; private static float unknownVisualEndTime; private static Material originalSkybox; private static Material activeSkybox; private static Color originalAmbientLight; private static Color originalFogColor; private static float originalAmbientIntensity; private static float originalReflectionIntensity; private static int visualSceneHandle = -1; private static int currentVisualType = -1; private static readonly Color BloodMoonRed = new Color(0.65f, 0.08f, 0.08f); private static readonly Color BloodMoonFog = new Color(0.45f, 0.06f, 0.06f); private static readonly Color VoidBlack = Color.black; private static bool visualTransitionActive; private static float visualTransitionStartTime; private static float currentTransitionDuration; private static Color transitionStartAmbient; private static Color transitionTargetAmbient; private static Color transitionStartFog; private static Color transitionTargetFog; private static float transitionStartAmbientIntensity; private static float transitionTargetAmbientIntensity; private static float transitionStartReflectionIntensity; private static float transitionTargetReflectionIntensity; private static readonly string[] SkyboxColorProperties = new string[5] { "_Tint", "_SkyTint", "_Color", "_GroundColor", "_SkyColor" }; private static readonly Color[] transitionStartSkyboxColors = (Color[])(object)new Color[5]; private static readonly Color[] transitionTargetSkyboxColors = (Color[])(object)new Color[5]; private static readonly bool[] transitionSkyboxHasProperty = new bool[5]; private static bool transitionHasExposure; private static float transitionStartExposure; private static float transitionTargetExposure; public void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); NetworkingAPI.RegisterMessageType<BloodMoonGrantRequest>(); NetworkingAPI.RegisterMessageType<BloodMoonSkySync>(); LoadBloodMoonIcon(); CreateEquipment(); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(EquipmentSlot_PerformEquipmentAction); DirectorCore.TrySpawnObject += new hook_TrySpawnObject(DirectorCore_TrySpawnObject); Log.Info("Blood Moon mod loaded!"); } private void LoadBloodMoonIcon() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) string text = null; string[] manifestResourceNames = typeof(ExamplePlugin).Assembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith(".Assets.BloodMoonIcon.png", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (text == null) { Log.Error("Could not find embedded BloodMoonIcon.png!"); return; } using (Stream stream = typeof(ExamplePlugin).Assembly.GetManifestResourceStream(text)) { if (stream == null) { Log.Error("Could not open BloodMoonIcon.png!"); return; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); bloodMoonIconTexture = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(bloodMoonIconTexture, memoryStream.ToArray())) { Log.Error("Failed to load BloodMoonIcon.png!"); return; } bloodMoonIconSprite = Sprite.Create(bloodMoonIconTexture, new Rect(0f, 0f, (float)((Texture)bloodMoonIconTexture).width, (float)((Texture)bloodMoonIconTexture).height), new Vector2(0.5f, 0.5f)); } Log.Info("Blood Moon icon loaded!"); } private void CreateEquipment() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Expected O, but got Unknown Sprite val = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); GameObject pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); bloodMoonEquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>(); ((Object)bloodMoonEquipmentDef).name = "BLOODMOON_EQUIPMENT"; bloodMoonEquipmentDef.nameToken = "BLOODMOON_NAME"; bloodMoonEquipmentDef.pickupToken = "BLOODMOON_PICKUP"; bloodMoonEquipmentDef.descriptionToken = "BLOODMOON_DESC"; bloodMoonEquipmentDef.loreToken = "BLOODMOON_LORE"; bloodMoonEquipmentDef.cooldown = 45f; bloodMoonEquipmentDef.canDrop = true; bloodMoonEquipmentDef.enigmaCompatible = false; bloodMoonEquipmentDef.isBoss = false; bloodMoonEquipmentDef.isLunar = false; bloodMoonEquipmentDef.appearsInSinglePlayer = true; bloodMoonEquipmentDef.appearsInMultiPlayer = true; bloodMoonEquipmentDef.pickupIconSprite = (((Object)(object)bloodMoonIconSprite != (Object)null) ? bloodMoonIconSprite : val); bloodMoonEquipmentDef.pickupModelPrefab = pickupModelPrefab; LanguageAPI.Add("BLOODMOON_NAME", "Blood Moon"); LanguageAPI.Add("BLOODMOON_PICKUP", "Temporarily triples enemy spawns."); LanguageAPI.Add("BLOODMOON_DESC", "Blood flows through the core of the planet. Triples enemy spawns for 30 seconds."); LanguageAPI.Add("BLOODMOON_LORE", "The moon turns a deep red. Something stirs."); LanguageAPI.Add("BLOODMOON_ANNOUNCEMENT", "<color=#fa1a1a>The moon turns a deep red. Something stirs...</color>"); LanguageAPI.Add("BLOODMOON_END", "<color=#fa1a1a>The blood fades...</color>"); ItemAPI.Add(new CustomEquipment(bloodMoonEquipmentDef, new ItemDisplayRuleDict((ItemDisplayRule[])null))); unknownEquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>(); ((Object)unknownEquipmentDef).name = "UNKNOWN_EQUIPMENT"; unknownEquipmentDef.nameToken = "UNKNOWN_NAME"; unknownEquipmentDef.pickupToken = "UNKNOWN_PICKUP"; unknownEquipmentDef.descriptionToken = "UNKNOWN_DESC"; unknownEquipmentDef.loreToken = "UNKNOWN_LORE"; unknownEquipmentDef.cooldown = 45f; unknownEquipmentDef.canDrop = true; unknownEquipmentDef.enigmaCompatible = false; unknownEquipmentDef.isBoss = false; unknownEquipmentDef.isLunar = true; unknownEquipmentDef.appearsInSinglePlayer = true; unknownEquipmentDef.appearsInMultiPlayer = true; unknownEquipmentDef.pickupIconSprite = val; unknownEquipmentDef.pickupModelPrefab = pickupModelPrefab; LanguageAPI.Add("UNKNOWN_NAME", "???"); LanguageAPI.Add("UNKNOWN_PICKUP", "STOP. STOP. STOP. STOP."); LanguageAPI.Add("UNKNOWN_DESC", "??? ??? ???. It knows you are here. Why did you look? Enemy spawns increase 10x for 30 seconds."); LanguageAPI.Add("UNKNOWN_LORE", "??? ??? ???\n\nIt knows you are here.\nWhy did you look?"); LanguageAPI.Add("UNKNOWN_ANNOUNCEMENT", "<color=#000000>RUN. RU. R\u0337U\u0337N\u0337. R\u0338U\u0338>!? N\u0337\u0334RU>!? N\u0337\u0334 И\u0338 И\u0338∴ ⌁\u0337 N\u0338\u0334 ...</color>"); LanguageAPI.Add("UNKNOWN_END", "<color=#777777>It is not over.</color>"); ItemAPI.Add(new CustomEquipment(unknownEquipmentDef, new ItemDisplayRuleDict((ItemDisplayRule[])null))); Log.Info("Both equipment items registered!"); } private bool EquipmentSlot_PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown if ((Object)(object)equipmentDef == (Object)(object)bloodMoonEquipmentDef) { if (NetworkServer.active) { bloodMoonEndTime = Time.time + 30f; ApplyEffectVisual(0, 30f); NetMessageExtensions.Send((INetMessage)(object)new BloodMoonSkySync(0, 30f), (NetworkDestination)1); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "BLOODMOON_ANNOUNCEMENT" }); Log.Info("Blood Moon activated!"); } return true; } if ((Object)(object)equipmentDef == (Object)(object)unknownEquipmentDef) { if (NetworkServer.active) { unknownEndTime = Time.time + 30f; ApplyEffectVisual(1, 30f); NetMessageExtensions.Send((INetMessage)(object)new BloodMoonSkySync(1, 30f), (NetworkDestination)1); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "UNKNOWN_ANNOUNCEMENT" }); Log.Info("??? activated!"); } return true; } return orig.Invoke(self, equipmentDef); } private static int GetCurrentSpawnMultiplier() { if (!NetworkServer.active) { return 1; } bool flag = Time.time < bloodMoonEndTime; if (Time.time < unknownEndTime) { return 10; } if (flag) { return 3; } return 1; } private GameObject DirectorCore_TrySpawnObject(orig_TrySpawnObject orig, DirectorCore self, DirectorSpawnRequest directorSpawnRequest) { if (!(directorSpawnRequest.spawnCard is CharacterSpawnCard)) { return orig.Invoke(self, directorSpawnRequest); } int currentSpawnMultiplier = GetCurrentSpawnMultiplier(); if (currentSpawnMultiplier <= 1) { return orig.Invoke(self, directorSpawnRequest); } GameObject val = null; for (int i = 0; i < currentSpawnMultiplier; i++) { GameObject val2 = orig.Invoke(self, directorSpawnRequest); if ((Object)(object)val == (Object)null && (Object)(object)val2 != (Object)null) { val = val2; } } return val; } public static void ApplyEffectVisual(int effectType, float duration) { float num = Time.time + duration; switch (effectType) { case 0: bloodMoonVisualEndTime = num; break; case 1: unknownVisualEndTime = num; break; } UpdateVisualEffect(); } public static void ApplyBloodMoonVisual(float duration) { ApplyEffectVisual(0, duration); } private static int GetCurrentVisualType() { bool flag = Time.time < bloodMoonVisualEndTime; if (Time.time < unknownVisualEndTime) { return 1; } if (flag) { return 0; } return -1; } private static void UpdateVisualEffect() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); int handle = ((Scene)(ref activeScene)).handle; if (handle != visualSceneHandle) { CaptureOriginalVisuals(); currentVisualType = -1; visualTransitionActive = false; } int num = GetCurrentVisualType(); if (num != currentVisualType) { BeginVisualTransition(num); } if (visualTransitionActive) { UpdateVisualTransition(); } } private static void CaptureOriginalVisuals() { //IL_0011: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) DestroyActiveSkybox(); originalSkybox = RenderSettings.skybox; originalAmbientLight = RenderSettings.ambientLight; originalFogColor = RenderSettings.fogColor; originalAmbientIntensity = RenderSettings.ambientIntensity; originalReflectionIntensity = RenderSettings.reflectionIntensity; Scene activeScene = SceneManager.GetActiveScene(); visualSceneHandle = ((Scene)(ref activeScene)).handle; } private static void BeginVisualTransition(int effectType) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //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_0124: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) bool flag = visualTransitionActive; int num = currentVisualType; int num2 = visualSceneHandle; Scene activeScene = SceneManager.GetActiveScene(); if (num2 != ((Scene)(ref activeScene)).handle) { CaptureOriginalVisuals(); num = -1; flag = false; } if ((Object)(object)originalSkybox != (Object)null && (Object)(object)activeSkybox == (Object)null) { activeSkybox = new Material(originalSkybox); RenderSettings.skybox = activeSkybox; } transitionStartAmbient = RenderSettings.ambientLight; transitionStartFog = RenderSettings.fogColor; transitionStartAmbientIntensity = RenderSettings.ambientIntensity; transitionStartReflectionIntensity = RenderSettings.reflectionIntensity; switch (effectType) { case 1: transitionTargetAmbient = Color.black; transitionTargetFog = VoidBlack; transitionTargetAmbientIntensity = 0f; transitionTargetReflectionIntensity = 0f; break; case 0: transitionTargetAmbient = Color.Lerp(originalAmbientLight, BloodMoonRed, 0.65f); transitionTargetFog = Color.Lerp(originalFogColor, BloodMoonFog, 0.7f); transitionTargetAmbientIntensity = originalAmbientIntensity; transitionTargetReflectionIntensity = originalReflectionIntensity; break; default: transitionTargetAmbient = originalAmbientLight; transitionTargetFog = originalFogColor; transitionTargetAmbientIntensity = originalAmbientIntensity; transitionTargetReflectionIntensity = originalReflectionIntensity; break; } for (int i = 0; i < SkyboxColorProperties.Length; i++) { string text = SkyboxColorProperties[i]; transitionSkyboxHasProperty[i] = (Object)(object)activeSkybox != (Object)null && activeSkybox.HasProperty(text); if (!transitionSkyboxHasProperty[i]) { continue; } transitionStartSkyboxColors[i] = activeSkybox.GetColor(text); switch (effectType) { case 1: transitionTargetSkyboxColors[i] = VoidBlack; continue; case 0: transitionTargetSkyboxColors[i] = BloodMoonRed; continue; } if ((Object)(object)originalSkybox != (Object)null && originalSkybox.HasProperty(text)) { transitionTargetSkyboxColors[i] = originalSkybox.GetColor(text); } else { transitionTargetSkyboxColors[i] = transitionStartSkyboxColors[i]; } } transitionHasExposure = (Object)(object)activeSkybox != (Object)null && activeSkybox.HasProperty("_Exposure"); if (transitionHasExposure) { transitionStartExposure = activeSkybox.GetFloat("_Exposure"); if (effectType == 1) { transitionTargetExposure = -10f; } else if ((Object)(object)originalSkybox != (Object)null && originalSkybox.HasProperty("_Exposure")) { transitionTargetExposure = originalSkybox.GetFloat("_Exposure"); } else { transitionTargetExposure = transitionStartExposure; } } if (effectType == -1 || num != -1 || flag) { currentTransitionDuration = 5f; } else { currentTransitionDuration = 0f; } currentVisualType = effectType; visualTransitionStartTime = Time.time; visualTransitionActive = true; Log.Info(effectType switch { 0 => "The sky has turned red.", 1 => "The sky has turned black.", _ => "The sky is fading back to normal.", }); } private static void UpdateVisualTransition() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) float num; if (currentTransitionDuration <= 0f) { num = 1f; } else { float num2 = Time.time - visualTransitionStartTime; num = Mathf.Clamp01(num2 / currentTransitionDuration); } float num3 = num * num * (3f - 2f * num); RenderSettings.ambientLight = Color.Lerp(transitionStartAmbient, transitionTargetAmbient, num3); RenderSettings.fogColor = Color.Lerp(transitionStartFog, transitionTargetFog, num3); RenderSettings.ambientIntensity = Mathf.Lerp(transitionStartAmbientIntensity, transitionTargetAmbientIntensity, num3); RenderSettings.reflectionIntensity = Mathf.Lerp(transitionStartReflectionIntensity, transitionTargetReflectionIntensity, num3); if ((Object)(object)activeSkybox != (Object)null) { for (int i = 0; i < SkyboxColorProperties.Length; i++) { if (transitionSkyboxHasProperty[i]) { activeSkybox.SetColor(SkyboxColorProperties[i], Color.Lerp(transitionStartSkyboxColors[i], transitionTargetSkyboxColors[i], num3)); } } if (transitionHasExposure) { activeSkybox.SetFloat("_Exposure", Mathf.Lerp(transitionStartExposure, transitionTargetExposure, num3)); } } if (num >= 1f) { visualTransitionActive = false; if (currentVisualType == -1) { RestoreOriginalVisuals(); } else { DynamicGI.UpdateEnvironment(); } } } private static void RestoreOriginalVisuals() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RenderSettings.skybox == (Object)(object)activeSkybox) { RenderSettings.skybox = originalSkybox; } RenderSettings.ambientLight = originalAmbientLight; RenderSettings.fogColor = originalFogColor; RenderSettings.ambientIntensity = originalAmbientIntensity; RenderSettings.reflectionIntensity = originalReflectionIntensity; DestroyActiveSkybox(); currentVisualType = -1; visualTransitionActive = false; DynamicGI.UpdateEnvironment(); Log.Info("Original sky and lighting restored."); } private static void DestroyActiveSkybox() { if ((Object)(object)activeSkybox != (Object)null) { Object.Destroy((Object)(object)activeSkybox); activeSkybox = null; } } public static void HandleGrantRequest(CharacterBody body, int equipmentType) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && !((Object)(object)body == (Object)null) && !((Object)(object)body.master == (Object)null) && !((Object)(object)body.master.inventory == (Object)null)) { EquipmentDef val = ((equipmentType == 1) ? unknownEquipmentDef : bloodMoonEquipmentDef); if (!((Object)(object)val == (Object)null)) { body.master.inventory.SetEquipmentIndex(val.equipmentIndex); Log.Info((equipmentType == 1) ? "??? granted through test key!" : "Blood Moon granted through test key!"); } } } private void UpdateEquipmentExpiration() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if (NetworkServer.active) { if (bloodMoonEndTime > 0f && Time.time >= bloodMoonEndTime) { bloodMoonEndTime = 0f; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "BLOODMOON_END" }); Log.Info("Blood Moon expired."); } if (unknownEndTime > 0f && Time.time >= unknownEndTime) { unknownEndTime = 0f; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "UNKNOWN_END" }); Log.Info("??? expired."); } } } private void Update() { UpdateEquipmentExpiration(); if (currentVisualType != -1 || visualTransitionActive || Time.time < bloodMoonVisualEndTime || Time.time < unknownVisualEndTime) { UpdateVisualEffect(); } if (Input.GetKeyDown((KeyCode)283)) { RequestEquipmentGrant(0); } if (Input.GetKeyDown((KeyCode)284)) { RequestEquipmentGrant(1); } } private void RequestEquipmentGrant(int equipmentType) { if (PlayerCharacterMasterController.instances.Count == 0) { return; } CharacterMaster master = PlayerCharacterMasterController.instances[0].master; if (!((Object)(object)master == (Object)null) && !((Object)(object)master.GetBody() == (Object)null)) { CharacterBody body = master.GetBody(); if (NetworkServer.active) { HandleGrantRequest(body, equipmentType); } else { NetMessageExtensions.Send((INetMessage)(object)new BloodMoonGrantRequest(body, equipmentType), (NetworkDestination)2); } Log.Info((equipmentType == 1) ? "F3 pressed: ??? grant requested!" : "F2 pressed: Blood Moon grant requested!"); } } } public class BloodMoonGrantRequest : INetMessage, ISerializableObject { private CharacterBody body; private int equipmentType; public BloodMoonGrantRequest() { } public BloodMoonGrantRequest(CharacterBody body, int equipmentType) { this.body = body; this.equipmentType = equipmentType; } public void Serialize(NetworkWriter writer) { writer.Write(((Component)body).gameObject); writer.Write(equipmentType); } public void Deserialize(NetworkReader reader) { GameObject val = reader.ReadGameObject(); body = (((Object)(object)val != (Object)null) ? val.GetComponent<CharacterBody>() : null); equipmentType = reader.ReadInt32(); } public void OnReceived() { if (NetworkServer.active) { ExamplePlugin.HandleGrantRequest(body, equipmentType); } } } public class BloodMoonSkySync : INetMessage, ISerializableObject { private int effectType; private float duration; public BloodMoonSkySync() { } public BloodMoonSkySync(int effectType, float duration) { this.effectType = effectType; this.duration = duration; } public void Serialize(NetworkWriter writer) { writer.Write(effectType); writer.Write(duration); } public void Deserialize(NetworkReader reader) { effectType = reader.ReadInt32(); duration = reader.ReadSingle(); } public void OnReceived() { if (!NetworkServer.active) { ExamplePlugin.ApplyEffectVisual(effectType, duration); } } } 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); } } }