using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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 HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using RandomEnemiesSize.Patches;
using Unity.Netcode;
using UnityEngine;
[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 = "")]
[assembly: AssemblyCompany("RandomEnemiesSizeHostOnly")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("RandomEnemiesSizeHostOnly")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+75712920aee5adf5d330bef520d40bc72777a90e")]
[assembly: AssemblyProduct("RandomEnemiesSizeHostOnly")]
[assembly: AssemblyTitle("RandomEnemiesSizeHostOnly")]
[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 RandomEnemiesSize
{
public class VanillaEnemies
{
public List<string> VanillaNames = new List<string>
{
"ForestGiant", "Baboon hawk", "Blob", "Butler", "Butler Bees", "Centipede", "Crawler", "Docile Locust Bees", "Manticoil", "Girl",
"Flowerman", "Tulip Snake", "Hoarding bug", "Jester", "Masked", "MouthDog", "Nutcracker", "Puffer", "RadMech", "Red Locust Bees",
"Bunker Spider", "Earth Leviathan", "Spring", "Clay Surgeon", "Bush Wolf"
};
public bool IsAVanillaEnemy(string name)
{
bool result = false;
foreach (string vanillaName in VanillaNames)
{
if (RandomEnemiesSizeHostOnly.instance.CompareEnemyName(name, vanillaName))
{
result = true;
}
}
return result;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("wexop.random_enemies_size_host_only", "RandomEnemiesSizeHostOnly", "1.0.2")]
public class RandomEnemiesSizeHostOnly : BaseUnityPlugin
{
private const string GUID = "wexop.random_enemies_size_host_only";
private const string NAME = "RandomEnemiesSizeHostOnly";
private const string VERSION = "1.0.2";
public static string LethalLevelLoaderReferenceChain = "imabatby.lethallevelloader";
public List<NetworkObject> mapHazardsInLevel = new List<NetworkObject>();
public static RandomEnemiesSizeHostOnly instance;
public bool LethalLevelLoaderIsHere;
public ConfigEntry<bool> customAffectMineEntry;
public ConfigEntry<bool> CustomAffectModEntry;
public ConfigEntry<bool> customAffectTurretEntry;
public ConfigEntry<bool> customAffectSpikeTrapEntry;
public ConfigEntry<bool> CustomAffectVanillaEntry;
public ConfigEntry<string> customEnemyEntry;
public ConfigEntry<string> customInteriorEntry;
public ConfigEntry<bool> devLogEntry;
public ConfigEntry<bool> funModeEntry;
public ConfigEntry<float> funModeHorizontalMaxEntry;
public ConfigEntry<float> funModeHorizontalMinEntry;
public ConfigEntry<bool> funModeLockHorizontalEnrty;
public ConfigEntry<float> maxSizeIndoorEntry;
public ConfigEntry<float> maxSizeMineEntry;
public ConfigEntry<float> maxSizeOutdoorEntry;
public ConfigEntry<float> maxSizeTurretEntry;
public ConfigEntry<float> minSizeIndoorEntry;
public ConfigEntry<float> minSizeMineEntry;
public ConfigEntry<float> minSizeOutdoorEntry;
public ConfigEntry<float> minSizeTurretEntry;
public ConfigEntry<float> minSizeSpikeTrapEntry;
public ConfigEntry<float> maxSizeSpikeTrapEntry;
public ConfigEntry<float> randomPercentChanceEntry;
private void Awake()
{
instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"RandomEnemiesSizeHostOnly starting....");
if (Chainloader.PluginInfos.ContainsKey(LethalLevelLoaderReferenceChain))
{
Debug.Log((object)"LethalLevelLoader found !");
LethalLevelLoaderIsHere = true;
}
randomPercentChanceEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ChanceOfRandomSize", 100f, "The chance for each monster to have a random size. 100% is always, 0% is never. No need to restart the game :)");
CreateFloatConfig(randomPercentChanceEntry, 0f, 100f);
minSizeIndoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinMonstersSizeIndoor", 0.4f, "Change the minimum size of monsters in the factory. No need to restart the game :)");
CreateFloatConfig(minSizeIndoorEntry);
maxSizeIndoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxMonstersSizeIndoor", 1.5f, "Change the maximum size of monsters in the factory. No need to restart the game :)");
CreateFloatConfig(maxSizeIndoorEntry);
minSizeOutdoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinMonstersSizeOutdoor", 0.5f, "Change the minimum size of monsters outside the factory. No need to restart the game :)");
CreateFloatConfig(minSizeOutdoorEntry);
maxSizeOutdoorEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxMonstersSizeOutdoor", 3f, "Change the maximum size of monsters outside the factory. No need to restart the game :)");
CreateFloatConfig(maxSizeOutdoorEntry);
CustomAffectVanillaEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom", "AffectVanillaEnemies", true, "Activate to make this mod affect vanilla enemies. No need to restart the game :)");
CreateBoolConfig(CustomAffectVanillaEntry);
CustomAffectModEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom", "AffectModdedEnemies", true, "Activate to make this mod affect modded enemies. No need to restart the game :)");
CreateBoolConfig(CustomAffectModEntry);
customEnemyEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Custom", "CustomEnemiesSize", "", "Custom the size for an enemy wanted with his EXACT name. RECOMMENDED: Go to the thunderstore mod page, you can find a generator to make easier this config. Manual example -> ForestGiant:0.4:5;FlowerMan:0.2:6. Dont forgot the separator ';' between each monsters. No need to restart the game :)");
CreateStringConfig(customEnemyEntry);
customInteriorEntry = ((BaseUnityPlugin)this).Config.Bind<string>("Custom", "CustomInteriorsSize", "", "THE MOD LethalLevelLoader IS REQUIRED FOR THIS FEATURE. Multiply the base size for an indoor enemy in an interior wanted with his EXACT name. RECOMMENDED: Go to the thunderstore mod page, you can find a generator to make easier this config. Manual example -> mansion#any:1.5,NutCracker:2;customInterior#any:3; No need to restart the game :)");
CreateInteriorStringConfig(customInteriorEntry);
customAffectTurretEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Turret", "AffectTurretSize", true, "Activate to make this mod affect turrets size. No need to restart the game :)");
CreateBoolConfig(customAffectTurretEntry);
minSizeTurretEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "MinTurretSize", 0.25f, "Change the minimum size of turrets. No need to restart the game :)");
CreateFloatConfig(minSizeTurretEntry, 0f, 3f);
maxSizeTurretEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "MaxTurretSize", 1.5f, "Change the maximum size of turrets. No need to restart the game :)");
CreateFloatConfig(maxSizeTurretEntry, 0f, 3f);
customAffectMineEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Landmine", "AffectLandMineSize", true, "Activate to make this mod affect land mines size. No need to restart the game :)");
CreateBoolConfig(customAffectMineEntry);
minSizeMineEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Landmine", "MinLandMinesSize", 0.2f, "Change the minimum size of land mines. No need to restart the game :)");
CreateFloatConfig(minSizeMineEntry, 0f, 5f);
maxSizeMineEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Landmine", "MaxLandMinesSize", 3f, "Change the maximum size of land mines. No need to restart the game :)");
CreateFloatConfig(maxSizeMineEntry, 0f, 5f);
customAffectSpikeTrapEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("SpikeTrap", "AffectSpikeTrapSize", true, "Activate to make this mod affect spike traps size. No need to restart the game :)");
CreateBoolConfig(customAffectSpikeTrapEntry);
minSizeSpikeTrapEntry = ((BaseUnityPlugin)this).Config.Bind<float>("SpikeTrap", "MinSpikeTrapSize", 0.3f, "Change the minimum size of spike traps. No need to restart the game :)");
CreateFloatConfig(minSizeSpikeTrapEntry, 0f, 5f);
maxSizeSpikeTrapEntry = ((BaseUnityPlugin)this).Config.Bind<float>("SpikeTrap", "MaxSpikeTrapSize", 2f, "Change the maximum size of spike traps. No need to restart the game :)");
CreateFloatConfig(maxSizeSpikeTrapEntry, 0f, 5f);
funModeEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("FunMode", "FunMode", false, "Activate the fun mode to randomize the size in every space directions (verticaly, horizontaly). No need to restart the game :)");
CreateBoolConfig(funModeEntry);
funModeHorizontalMinEntry = ((BaseUnityPlugin)this).Config.Bind<float>("FunMode", "FunModeHorizontalSizeMin", 0.5f, "If fun mode is activated, it will change the minimum horizontal size of monsters (axis x and z). No need to restart the game :)");
CreateFloatConfig(funModeHorizontalMinEntry);
funModeHorizontalMaxEntry = ((BaseUnityPlugin)this).Config.Bind<float>("FunMode", "FunModeHorizontalSizeMax", 1.5f, "If fun mode is activated, it will change the maximum horizontal size of monsters (axis x and z). No need to restart the game :)");
CreateFloatConfig(funModeHorizontalMaxEntry);
funModeLockHorizontalEnrty = ((BaseUnityPlugin)this).Config.Bind<bool>("FunMode", "LockHorizontalAxis", false, "If fun mode is activated, it will change the horizontal axis (x and z) with the same value. No need to restart the game :)");
CreateBoolConfig(funModeLockHorizontalEnrty);
devLogEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("DEV", "DevLogs", false, "Show the dev logs");
CreateBoolConfig(devLogEntry);
Harmony.CreateAndPatchAll(typeof(PatchEnemySize), (string)null);
Harmony.CreateAndPatchAll(typeof(PatchTurretSize), (string)null);
Harmony.CreateAndPatchAll(typeof(PatchLandmineSize), (string)null);
Harmony.CreateAndPatchAll(typeof(PatchSpikeTrapSize), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"RandomEnemiesSizeHostOnly Patched !!");
}
public static string GetDungeonName()
{
string text = "Facility";
if (!Chainloader.PluginInfos.ContainsKey(LethalLevelLoaderReferenceChain))
{
return text;
}
try
{
ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow;
if (((currentExtendedDungeonFlow != null) ? currentExtendedDungeonFlow.DungeonName : null) != null)
{
ExtendedDungeonFlow currentExtendedDungeonFlow2 = DungeonManager.CurrentExtendedDungeonFlow;
text = ((currentExtendedDungeonFlow2 != null) ? currentExtendedDungeonFlow2.DungeonName : null);
}
}
catch
{
return text;
}
if (instance.devLogEntry.Value)
{
Debug.Log((object)("INTERIOR FOUND: " + text));
}
return text;
}
private CanModifyResult CanModifyInterior()
{
//IL_0022: 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_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_002a: Unknown result type (might be due to invalid IL or missing references)
if (!LethalLevelLoaderIsHere)
{
return CanModifyResult.op_Implicit((false, "You need the mod LethalLevelLoader to use this feature !"));
}
return CanModifyResult.op_Implicit(true);
}
private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 30f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
FloatSliderOptions val = new FloatSliderOptions();
((BaseRangeOptions<float>)val).Min = min;
((BaseRangeOptions<float>)val).Max = max;
((BaseOptions)val).RequiresRestart = false;
FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
}
private void CreateStringConfig(ConfigEntry<string> configEntry)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
{
RequiresRestart = false
});
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
}
private void CreateInteriorStringConfig(ConfigEntry<string> configEntry)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_0021: Expected O, but got Unknown
//IL_0027: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
TextInputFieldConfigItem val = new TextInputFieldConfigItem(configEntry, new TextInputFieldOptions
{
RequiresRestart = false,
CanModifyCallback = new CanModifyDelegate(CanModifyInterior)
});
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
}
private void CreateBoolConfig(ConfigEntry<bool> configEntry)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Expected O, but got Unknown
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(configEntry, new BoolCheckBoxOptions
{
RequiresRestart = false
});
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
}
public bool CompareEnemyName(string name, string verifiedName)
{
string text = name.ToLower();
while (text.Contains(" "))
{
text = text.Replace(" ", "");
}
string text2 = verifiedName.ToLower();
while (text2.Contains(" "))
{
text2 = text2.Replace(" ", "");
}
return text.Contains(text2);
}
public CustomEnemySize GetCustomEnemySize(string nameValue)
{
CustomEnemySize customEnemySize = new CustomEnemySize();
string text = customEnemyEntry.Value.ToLower();
while (text.Contains(" "))
{
text = text.Replace(" ", "");
}
float result = 1f;
float result2 = 1f;
string text2 = nameValue.ToLower();
while (text2.Contains(" "))
{
text2 = text2.Replace(" ", "");
}
if (text.ToLower().Contains(text2))
{
string[] array = text.Split(";");
string[] array2 = array;
foreach (string text3 in array2)
{
string[] array3 = text3.Split(":");
if (array3[0].Contains(text2))
{
float.TryParse(array3[1], NumberStyles.Any, CultureInfo.InvariantCulture, out result);
float.TryParse(array3[2], NumberStyles.Any, CultureInfo.InvariantCulture, out result2);
customEnemySize.found = true;
customEnemySize.minValue = result;
customEnemySize.maxValue = result2;
}
}
}
return customEnemySize;
}
public float GetInteriorMultiplier(string enemyNameValue, string interiorNameValue)
{
string text = enemyNameValue.ToLower();
while (text.Contains(" "))
{
text = text.Replace(" ", "");
}
string text2 = interiorNameValue.ToLower();
while (text2.Contains(" "))
{
text2 = text2.Replace(" ", "");
}
string text3 = customInteriorEntry.Value.ToLower();
while (text3.Contains(" "))
{
text3 = text3.Replace(" ", "");
}
if ((text3.Contains(text) || text3.Contains("any")) && text3.Contains(text2))
{
float result = 1f;
string[] array = text3.Split(";");
string[] array2 = array;
foreach (string text4 in array2)
{
string[] array3 = text4.Split("#");
string text5 = array3[0];
if (!text5.Contains(text2))
{
continue;
}
string[] array4 = array3[1].Split(",");
string[] array5 = array4;
foreach (string text6 in array5)
{
string[] array6 = text6.Split(":");
string text7 = array6[0];
string s = array6[1];
if (text7 == "any" || text7 == text)
{
float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
}
}
return result;
}
return 1f;
}
}
public class CustomEnemySize
{
public bool found;
public float maxValue = 1f;
public float minValue = 1f;
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RandomEnemiesSizeHostOnly";
public const string PLUGIN_NAME = "RandomEnemiesSizeHostOnly";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace RandomEnemiesSize.Patches
{
[HarmonyPatch(typeof(EnemyAI))]
internal class PatchEnemySize
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void PatchStart(EnemyAI __instance)
{
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: 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_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner)
{
return;
}
bool flag = new VanillaEnemies().IsAVanillaEnemy(__instance.enemyType.enemyName);
if (__instance.enemyType.enemyName == "Red Locust Bees" || (flag && !RandomEnemiesSizeHostOnly.instance.CustomAffectVanillaEntry.Value) || (!flag && !RandomEnemiesSizeHostOnly.instance.CustomAffectModEntry.Value))
{
return;
}
float num = Random.Range(0f, 100f);
if (RandomEnemiesSizeHostOnly.instance.randomPercentChanceEntry.Value < num)
{
if (RandomEnemiesSizeHostOnly.instance.devLogEntry.Value)
{
Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
}
return;
}
float num2 = Random.Range(RandomEnemiesSizeHostOnly.instance.minSizeOutdoorEntry.Value, RandomEnemiesSizeHostOnly.instance.maxSizeOutdoorEntry.Value);
if (!__instance.isOutside)
{
num2 = Random.Range(RandomEnemiesSizeHostOnly.instance.minSizeIndoorEntry.Value, RandomEnemiesSizeHostOnly.instance.maxSizeIndoorEntry.Value);
}
CustomEnemySize customEnemySize = RandomEnemiesSizeHostOnly.instance.GetCustomEnemySize(__instance.enemyType.enemyName);
if (customEnemySize.found)
{
num2 = Random.Range(customEnemySize.minValue, customEnemySize.maxValue);
}
if (RandomEnemiesSizeHostOnly.instance.LethalLevelLoaderIsHere)
{
string dungeonName = RandomEnemiesSizeHostOnly.GetDungeonName();
if (!__instance.isOutside && dungeonName != null)
{
float interiorMultiplier = RandomEnemiesSizeHostOnly.instance.GetInteriorMultiplier(__instance.enemyType.enemyName, dungeonName);
num2 *= interiorMultiplier;
}
}
Vector3 localScale = ((Component)__instance).gameObject.transform.localScale;
Vector3 val = localScale * num2;
if (RandomEnemiesSizeHostOnly.instance.funModeEntry.Value)
{
float num3 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
float num4 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
if (RandomEnemiesSizeHostOnly.instance.funModeLockHorizontalEnrty.Value)
{
num4 = num3;
}
((Vector3)(ref val))..ctor(val.x * num3, val.y, val.z * num4);
}
((Component)__instance).gameObject.GetComponent<NetworkObject>().Despawn(false);
((Component)__instance).gameObject.transform.localScale = val;
((Component)__instance).gameObject.GetComponent<NetworkObject>().Spawn(false);
if (RandomEnemiesSizeHostOnly.instance.devLogEntry.Value)
{
Debug.Log((object)("ENEMY (" + ((Object)((Component)__instance).gameObject).name + ") SPAWNED WITH RANDOM SIZE " + ((object)(Vector3)(ref val)).ToString()));
}
}
}
[HarmonyPatch(typeof(Landmine))]
public class PatchLandmineSize
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void PatchStart(Landmine __instance)
{
//IL_00d7: 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_00dd: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: 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_0175: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner || !RandomEnemiesSizeHostOnly.instance.customAffectMineEntry.Value)
{
return;
}
float num = Random.Range(0f, 100f);
if (RandomEnemiesSizeHostOnly.instance.randomPercentChanceEntry.Value < num)
{
if (RandomEnemiesSizeHostOnly.instance.devLogEntry.Value)
{
Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
}
return;
}
float num2 = Random.Range(RandomEnemiesSizeHostOnly.instance.minSizeMineEntry.Value, RandomEnemiesSizeHostOnly.instance.maxSizeMineEntry.Value);
NetworkObject componentInParent = ((Component)__instance).gameObject.GetComponentInParent<NetworkObject>();
Vector3 localScale = ((Component)componentInParent).transform.localScale;
Vector3 val = localScale * num2;
if (RandomEnemiesSizeHostOnly.instance.funModeEntry.Value)
{
float num3 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
float num4 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
if (RandomEnemiesSizeHostOnly.instance.funModeLockHorizontalEnrty.Value)
{
num4 = num3;
}
((Vector3)(ref val))..ctor(val.x * num3, val.y, val.z * num4);
}
RandomEnemiesSizeHostOnly.instance.mapHazardsInLevel.Add(((NetworkBehaviour)__instance).NetworkObject);
((NetworkBehaviour)__instance).NetworkObject.SynchronizeTransform = true;
((Component)__instance).gameObject.transform.parent.localScale = val;
((NetworkBehaviour)__instance).NetworkObject.Despawn(false);
((NetworkBehaviour)__instance).NetworkObject.Spawn(false);
}
}
[HarmonyPatch(typeof(RoundManager))]
public class PatchRoundManager
{
[HarmonyPatch("LoadNewLevel")]
[HarmonyPrefix]
public static void PatchLoadLevel()
{
foreach (NetworkObject item in RandomEnemiesSizeHostOnly.instance.mapHazardsInLevel)
{
item.Despawn(true);
}
RandomEnemiesSizeHostOnly.instance.mapHazardsInLevel.Clear();
}
}
[HarmonyPatch(typeof(SpikeRoofTrap))]
public class PatchSpikeTrapSize
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void PatchStart(SpikeRoofTrap __instance)
{
//IL_00e7: 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_01c1: 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_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner || !RandomEnemiesSizeHostOnly.instance.customAffectSpikeTrapEntry.Value)
{
return;
}
float num = Random.Range(0f, 100f);
if (RandomEnemiesSizeHostOnly.instance.randomPercentChanceEntry.Value < num)
{
if (RandomEnemiesSizeHostOnly.instance.devLogEntry.Value)
{
Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
}
return;
}
float num2 = Random.Range(RandomEnemiesSizeHostOnly.instance.minSizeSpikeTrapEntry.Value, RandomEnemiesSizeHostOnly.instance.maxSizeSpikeTrapEntry.Value);
NetworkObject componentInParent = ((Component)__instance).gameObject.GetComponentInParent<NetworkObject>();
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(1f, 0f, 1f);
Vector3 val2 = val * num2;
if (RandomEnemiesSizeHostOnly.instance.funModeEntry.Value)
{
float num3 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
float num4 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
if (RandomEnemiesSizeHostOnly.instance.funModeLockHorizontalEnrty.Value)
{
num4 = num3;
}
((Vector3)(ref val2))..ctor(val2.x * num3, val2.y, val2.z * num4);
}
RandomEnemiesSizeHostOnly.instance.mapHazardsInLevel.Add(((NetworkBehaviour)__instance).NetworkObject);
((NetworkBehaviour)__instance).NetworkObject.SynchronizeTransform = true;
((Component)__instance).gameObject.transform.parent.localScale = val2;
((NetworkBehaviour)__instance).NetworkObject.Despawn(false);
((NetworkBehaviour)__instance).NetworkObject.Spawn(false);
}
}
[HarmonyPatch(typeof(Turret))]
public class PatchTurretSize
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void PatchStart(Turret __instance)
{
//IL_00d7: 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_00dd: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: 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_0175: Unknown result type (might be due to invalid IL or missing references)
if (!((NetworkBehaviour)__instance).IsServer || !((NetworkBehaviour)__instance).IsOwner || !RandomEnemiesSizeHostOnly.instance.customAffectTurretEntry.Value)
{
return;
}
float num = Random.Range(0f, 100f);
if (RandomEnemiesSizeHostOnly.instance.randomPercentChanceEntry.Value < num)
{
if (RandomEnemiesSizeHostOnly.instance.devLogEntry.Value)
{
Debug.Log((object)$"RANDOM PERCENT NOT RANDOM SIZE : {num} FOR ENEMY {((Object)((Component)__instance).gameObject).name}");
}
return;
}
float num2 = Random.Range(RandomEnemiesSizeHostOnly.instance.minSizeTurretEntry.Value, RandomEnemiesSizeHostOnly.instance.maxSizeTurretEntry.Value);
NetworkObject componentInParent = ((Component)__instance).gameObject.GetComponentInParent<NetworkObject>();
Vector3 localScale = ((Component)componentInParent).transform.localScale;
Vector3 val = localScale * num2;
if (RandomEnemiesSizeHostOnly.instance.funModeEntry.Value)
{
float num3 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
float num4 = Random.Range(RandomEnemiesSizeHostOnly.instance.funModeHorizontalMinEntry.Value, RandomEnemiesSizeHostOnly.instance.funModeHorizontalMaxEntry.Value);
if (RandomEnemiesSizeHostOnly.instance.funModeLockHorizontalEnrty.Value)
{
num4 = num3;
}
((Vector3)(ref val))..ctor(val.x * num3, val.y, val.z * num4);
}
RandomEnemiesSizeHostOnly.instance.mapHazardsInLevel.Add(((NetworkBehaviour)__instance).NetworkObject);
((NetworkBehaviour)__instance).NetworkObject.Despawn(false);
((Component)__instance).gameObject.transform.parent.localScale = val;
((NetworkBehaviour)__instance).NetworkObject.Spawn(false);
}
}
}