using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 GameNetcodeStuff;
using HarmonyLib;
using HullBreakerCompany.Events;
using HullBreakerCompany.Hull;
using Microsoft.CodeAnalysis;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HullBreakerCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Making it more challenging to work for the company")]
[assembly: AssemblyFileVersion("1.3.12.0")]
[assembly: AssemblyInformationalVersion("1.3.12+285b29308a0a3b5da203e4577e52ef9ba2a7b771")]
[assembly: AssemblyProduct("HullBreakerCompany")]
[assembly: AssemblyTitle("HullBreakerCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.12.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 HullBreakerCompany
{
[BepInPlugin("HullBreakerCompany", "HullBreakerCompany", "1.3.12")]
public class Plugin : BaseUnityPlugin
{
private static Dictionary<int, SelectableLevelState> _levelStates = new Dictionary<int, SelectableLevelState>();
private static bool _loaded;
public static ManualLogSource Mls;
public static bool OneForAllIsActive;
public static bool BountyIsActive;
public static int DaysPassed;
public static float BunkerEnemyScale;
public static float LandMineTurretScale;
public static bool UseShortChatMessages;
public static bool EnableEventMessages;
public static bool UseHullBreakerLevelSettings;
public static bool UseDefaultGameSettings;
public static int MaxEnemyPowerCount;
public static int MaxOutsideEnemyPowerCount;
public static int MaxDaytimeEnemyPowerCount;
public static int MinScrap;
public static int MaxScrap;
public static int MinTotalScrapValue;
public static int MaxTotalScrapValue;
public static bool ChangeQuotaValue;
public static int QuotaIncrease;
public static bool IncreaseEventCountPerDay;
public static int EventCount;
public static List<SpawnableItemWithRarity> NotModifiedSpawnableItemsWithRarity = new List<SpawnableItemWithRarity>();
public static string CurrentMessage = "";
public static Dictionary<string, Type> EnemyBase = new Dictionary<string, Type>
{
{
"flowerman",
typeof(FlowermanAI)
},
{
"hoarderbug",
typeof(HoarderBugAI)
},
{
"springman",
typeof(SpringManAI)
},
{
"crawler",
typeof(CrawlerAI)
},
{
"sandspider",
typeof(SandSpiderAI)
},
{
"jester",
typeof(JesterAI)
},
{
"centipede",
typeof(CentipedeAI)
},
{
"blobai",
typeof(BlobAI)
},
{
"dressgirl",
typeof(DressGirlAI)
},
{
"pufferenemy",
typeof(PufferAI)
},
{
"eyelessdogs",
typeof(MouthDogAI)
},
{
"forestgiant",
typeof(ForestGiantAI)
},
{
"sandworm",
typeof(SandWormAI)
},
{
"baboonbird",
typeof(BaboonBirdAI)
},
{
"nutcrackerenemy",
typeof(NutcrackerEnemyAI)
},
{
"maskedplayerenemy",
typeof(MaskedPlayerEnemy)
},
{
"butlerbeesenemy",
typeof(ButlerBeesEnemyAI)
}
};
public static List<HullEvent> EventDictionary = new List<HullEvent>
{
new FlowerManEvent(),
new LandMineEvent(),
new HoarderBugEvent(),
new SpringManEvent(),
new LizardsEvent(),
new ArachnophobiaEvent(),
new BeeEvent(),
new SlimeEvent(),
new DevochkaPizdecEvent(),
new EnemyBountyEvent(),
new OpenTheNoorEvent(),
new OnAPowderKegEvent(),
new OutSideEnemyDayEvent(),
new HellEvent(),
new NothingEvent(),
new HackedTurretsEvent(),
new BabkinPogrebEvent(),
new HullBreakEvent(),
new NutcrackerEvent(),
new JanitorEvent()
};
public static List<HullEvent> CurrentEvents = new List<HullEvent>();
private readonly Harmony _harmony = new Harmony("HULLBREAKER");
private void Awake()
{
Mls = Logger.CreateLogSource("HULLBREAKER 1.3.12");
Mls.LogInfo((object)"Ready to break hull; HullBreakerCompany");
_harmony.PatchAll(typeof(Plugin));
_harmony.PatchAll(typeof(EventsHandler));
if (!_loaded)
{
Initialize();
}
}
public void Start()
{
if (!_loaded)
{
Initialize();
}
}
public void OnDestroy()
{
if (!_loaded)
{
Initialize();
}
}
public void Initialize()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ConfigManager.SetConfigValue();
GameObject val = new GameObject("HullManager");
Object.DontDestroyOnLoad((Object)(object)val);
((Object)val).hideFlags = (HideFlags)61;
val.AddComponent<HullManager>();
Mls.LogInfo((object)"HullManager created");
CustomEventLoader.LoadCustomEvents();
_loaded = true;
}
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPrefix]
private static bool ModifiedLoad(ref SelectableLevel newLevel)
{
//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_03e1: Expected O, but got Unknown
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Expected O, but got Unknown
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_0493: Unknown result type (might be due to invalid IL or missing references)
//IL_0498: Unknown result type (might be due to invalid IL or missing references)
//IL_04a2: Expected O, but got Unknown
CurrentEvents.Clear();
Mls.LogInfo((object)("Client is host: " + ((NetworkBehaviour)RoundManager.Instance).IsHost));
if (!((NetworkBehaviour)RoundManager.Instance).IsHost)
{
return true;
}
CustomEventLoader.DebugLoadCustomEvents();
int levelID = newLevel.levelID;
if (!_levelStates.ContainsKey(levelID))
{
_levelStates[levelID] = new SelectableLevelState(newLevel);
}
else
{
_levelStates[levelID].RestoreState(newLevel);
}
if (newLevel.levelID == 3)
{
Mls.LogInfo((object)"Level is company, skipping");
CurrentMessage = "Events not found";
DaysPassed = 0;
return true;
}
DaysPassed++;
Mls.LogInfo((object)$"Days passed: {DaysPassed}");
BountyIsActive = false;
OneForAllIsActive = false;
ResetLevelUnits(newLevel);
SelectableLevel val = newLevel;
List<string> randomGameEvents = RandomSelector.GetRandomGameEvents();
Dictionary<Type, int> dictionary = new Dictionary<Type, int>();
Dictionary<Type, int> dictionary2 = new Dictionary<Type, int>();
dictionary.Clear();
NotModifiedSpawnableItemsWithRarity.Clear();
foreach (SpawnableItemWithRarity item in val.spawnableScrap)
{
NotModifiedSpawnableItemsWithRarity.Add(item);
}
if (EventCount != 0 && EnableEventMessages)
{
HUDManager.Instance.AddTextToChatOnServer("<color=red>NOTES ABOUT MOON:</color>\"", -1);
}
foreach (string gameEvent in randomGameEvents)
{
try
{
HullEvent hullEvent = EventDictionary.FirstOrDefault((HullEvent e) => e.ID() == gameEvent);
if (hullEvent != null)
{
hullEvent.Execute(newLevel, dictionary, dictionary2);
Mls.LogInfo((object)("Event: " + gameEvent));
UpdateRarity(newLevel.Enemies, dictionary);
UpdateRarity(newLevel.OutsideEnemies, dictionary2);
CurrentEvents.Add(hullEvent);
}
}
catch (NullReferenceException ex)
{
Mls.LogError((object)$"NullReferenceException caught while processing event: {gameEvent}. Exception message: {ex.Message}. Caused : {ex.InnerException}");
}
}
HullManager.LogEnemyRarity(newLevel.Enemies, "⬛⬛⬛⬛⬛⬛ENEMIES RARITY⬛⬛⬛⬛⬛⬛");
HullManager.LogEnemyRarity(newLevel.DaytimeEnemies, "⬛⬛⬛⬛⬛⬛DAYTIME ENEMIES RARITY⬛⬛⬛⬛⬛⬛");
HullManager.LogEnemyRarity(newLevel.OutsideEnemies, "⬛⬛⬛⬛⬛⬛OUTSIDE ENEMIES RARITY⬛⬛⬛⬛⬛⬛");
if (!randomGameEvents.Contains("Bee"))
{
using IEnumerator<SpawnableEnemyWithRarity> enumerator3 = val.DaytimeEnemies.Where((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<RedLocustBees>() != (Object)null).GetEnumerator();
if (enumerator3.MoveNext())
{
SpawnableEnemyWithRarity current2 = enumerator3.Current;
current2.rarity = 22;
}
}
if (UseHullBreakerLevelSettings)
{
val.maxEnemyPowerCount += 16;
val.maxOutsideEnemyPowerCount += 20;
val.maxScrap += Random.Range(6, 24);
val.maxTotalScrapValue += Random.Range(400, 800);
val.daytimeEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 5f),
new Keyframe(0.5f, 5f)
});
val.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[1]
{
new Keyframe(0f, 256f)
});
}
else if (UseDefaultGameSettings)
{
Mls.LogInfo((object)"Default settings");
}
else
{
val.maxEnemyPowerCount = MaxEnemyPowerCount;
val.maxOutsideEnemyPowerCount = MaxOutsideEnemyPowerCount;
val.maxDaytimeEnemyPowerCount = MaxDaytimeEnemyPowerCount;
val.minScrap = MinScrap;
val.maxScrap = MaxScrap;
val.minTotalScrapValue = MinTotalScrapValue;
val.maxTotalScrapValue = MaxTotalScrapValue;
val.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[1]
{
new Keyframe(0f, BunkerEnemyScale)
});
}
newLevel = val;
CurrentMessage = "Events not found";
CurrentMessage = "<color=green>Notes about the <color=white>" + newLevel.PlanetName + ":\n\n";
foreach (HullEvent currentEvent in CurrentEvents)
{
CurrentMessage = CurrentMessage + "<color=orange>" + currentEvent.ID() + ": <color=white> " + currentEvent.GetMessage() + "\n\n";
}
return true;
}
private static void UpdateRarity(List<SpawnableEnemyWithRarity> enemies, Dictionary<Type, int> componentRarity)
{
if (componentRarity.Count <= 0)
{
return;
}
foreach (SpawnableEnemyWithRarity unit in enemies)
{
foreach (KeyValuePair<Type, int> item in componentRarity)
{
if ((Object)(object)unit.enemyType.enemyPrefab.GetComponent(item.Key) == (Object)null)
{
continue;
}
if (enemies.Any((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)unit.enemyType))
{
unit.rarity = item.Value;
componentRarity.Remove(item.Key);
}
break;
}
}
}
public static void LevelUnits(SelectableLevel n, bool turret = false, bool landmine = false)
{
//IL_0034: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
Mls.LogInfo((object)$"Turret: {turret}, Landmine: {landmine}");
AnimationCurve numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, LandMineTurretScale),
new Keyframe(1f, 25f)
});
SpawnableMapObject[] spawnableMapObjects = n.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
Landmine componentInChildren = val.prefabToSpawn.GetComponentInChildren<Landmine>();
if ((Object)(object)componentInChildren != (Object)null)
{
val.numberToSpawn = numberToSpawn;
}
}
}
private static void ResetLevelUnits(SelectableLevel level)
{
//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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
SpawnableMapObject[] spawnableMapObjects = level.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
Landmine componentInChildren = val.prefabToSpawn.GetComponentInChildren<Landmine>();
if ((Object)(object)componentInChildren != (Object)null)
{
val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[1]
{
new Keyframe(0f, 2.5f)
});
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "HullBreakerCompany";
public const string PLUGIN_NAME = "HullBreakerCompany";
public const string PLUGIN_VERSION = "1.3.12";
}
}
namespace HullBreakerCompany.Hull
{
public class ConfigManager
{
private static string _configPath = Path.Combine(Paths.ConfigPath, "HullBreakerCompany.cfg");
private static ConfigFile _configFile;
public static T GetConfigValue<T>(string key, T defaultValue, string description = null)
{
EnsureConfigExists();
return _configFile.Bind<T>("Settings", key, defaultValue, description).Value;
}
public static void SetConfigValue()
{
Plugin.LandMineTurretScale = GetConfigValue("LandMineTurretScale", 64, "Should change amount of Landmines & Turrets when these events are active: (Landmine & Turret)");
Plugin.UseShortChatMessages = GetConfigValue("UseShortChatMessages", defaultValue: false, "Use short event message (one/two words), can add surprise effect & difficulty");
Plugin.EnableEventMessages = GetConfigValue("EnableEventMessages", defaultValue: true, "Enable chat event messages");
Plugin.UseHullBreakerLevelSettings = GetConfigValue("UseHullBreakerLevelSettings", defaultValue: true, "Use HullBreaker level settings, if false, use default level settings");
Plugin.UseDefaultGameSettings = GetConfigValue("UseDefaultLevelSettings", defaultValue: false, "Use default level settings, if false, you can change on one's own");
Plugin.ChangeQuotaValue = GetConfigValue("ChangeQuota", defaultValue: true, "Change quota");
Plugin.QuotaIncrease = GetConfigValue("IncreasedQuota", 256, "Increased quota");
Plugin.MaxEnemyPowerCount = GetConfigValue("MaxEnemyPowerCount", 10, "Max enemy power count");
Plugin.MaxOutsideEnemyPowerCount = GetConfigValue("MaxOutsideEnemyPowerCount", 10, "Max outside enemy power count");
Plugin.MaxDaytimeEnemyPowerCount = GetConfigValue("MaxDaytimeEnemyPowerCount", 20, "Max daytime enemy power count");
Plugin.MinScrap = GetConfigValue("MinScrap", 10, "Min scrap");
Plugin.MaxScrap = GetConfigValue("MaxScrap", 15, "Max scrap");
Plugin.MinTotalScrapValue = GetConfigValue("MinTotalScrapValue", 300, "Min total scrap value");
Plugin.MaxTotalScrapValue = GetConfigValue("MaxTotalScrapValue", 700, "Max total scrap value");
Plugin.BunkerEnemyScale = GetConfigValue("BunkerEnemyScale", 256, "Should change global bunker enemy spawn rate, not sure if its work");
Plugin.IncreaseEventCountPerDay = GetConfigValue("IncreaseEventCountPerDay", defaultValue: false, "The number of events will increase every day. Visit the company building to reset");
Plugin.EventCount = GetConfigValue("EventCount", 3, "The number of events that will be active at the same time");
}
public static Dictionary<string, int> GetWeights()
{
EnsureConfigExists();
Dictionary<string, int> dictionary = new Dictionary<string, int>();
foreach (HullEvent item in Plugin.EventDictionary)
{
dictionary[item.ID()] = _configFile.Bind<int>("Weights", item.ID(), item.GetWeight(), item.GetDescription()).Value;
}
return dictionary;
}
private static void EnsureConfigExists()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
if (_configFile == null)
{
if (!File.Exists(_configPath))
{
CreateDefaultConfigFile();
}
_configFile = new ConfigFile(_configPath, true);
}
}
private static void CreateDefaultConfigFile()
{
using StreamWriter streamWriter = File.CreateText(_configPath);
streamWriter.WriteLine("[Weights]");
foreach (HullEvent item in Plugin.EventDictionary)
{
streamWriter.WriteLine(item.ID() + "=" + item.GetWeight());
}
}
}
public class CustomEventLoader
{
public static void LoadCustomEvents()
{
List<Dictionary<string, string>> list = LoadEventDataFromCfgFiles();
if (list.Count == 0)
{
return;
}
foreach (Dictionary<string, string> item in list)
{
CustomEvent customEvent = new CustomEvent();
customEvent.SetID(item["EventID"]);
customEvent.SetWeight(int.Parse(item["EventWeight"]));
customEvent.Rarity = int.Parse(item["EnemyRarity"]);
if (item.ContainsKey("SpawnableEnemies"))
{
customEvent.EnemySpawnList = new HashSet<string>(item["SpawnableEnemies"].Split(',')).ToList();
}
if (item.ContainsKey("SpawnableOutsideEnemies"))
{
customEvent.OutsideSpawnList = new HashSet<string>(item["SpawnableOutsideEnemies"].Split(',')).ToList();
}
customEvent.SetMessage(item["InGameMessage"]);
customEvent.SetShortMessage(item["InGameShortMessage"]);
Plugin.EventDictionary.Add(customEvent);
}
}
private static List<Dictionary<string, string>> LoadEventDataFromCfgFiles()
{
string text = Paths.BepInExRootPath + "\\HullEvents";
if (!Directory.Exists(text))
{
Plugin.Mls.LogError((object)("Directory does not exist: " + text));
return new List<Dictionary<string, string>>();
}
string[] files = Directory.GetFiles(text, "*.cfg");
List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
string[] array = files;
foreach (string path in array)
{
string[] array2 = File.ReadAllLines(path);
Dictionary<string, string> dictionary = new Dictionary<string, string>();
string[] array3 = array2;
foreach (string text2 in array3)
{
if (!text2.StartsWith("[") && !string.IsNullOrWhiteSpace(text2))
{
string[] array4 = text2.Split('=');
if (array4.Length == 2)
{
string key = array4[0].Trim();
string value = array4[1].Trim();
dictionary[key] = value;
}
}
}
list.Add(dictionary);
Plugin.Mls.LogInfo((object)("Loaded event: " + dictionary["EventID"]));
}
return list;
}
public static void AddEvent(HullEvent newEvent)
{
Plugin.Mls.LogInfo((object)("Adding new event" + newEvent.ID() + " to dictionary"));
Plugin.EventDictionary.Add(newEvent);
}
public static void DebugLoadCustomEvents()
{
foreach (HullEvent item in Plugin.EventDictionary)
{
if (item is CustomEvent customEvent)
{
Plugin.Mls.LogInfo((object)("Event ID: " + customEvent.ID()));
Plugin.Mls.LogInfo((object)("Spawnable Enemies: " + string.Join(", ", customEvent.EnemySpawnList)));
Plugin.Mls.LogInfo((object)("Message: " + customEvent.GetMessage()));
}
}
}
}
public abstract class EventsHandler
{
[HarmonyPostfix]
[HarmonyPatch(typeof(EnemyAI), "KillEnemyServerRpc")]
private static void EnemyBounty()
{
Plugin.Mls.LogInfo((object)$"Enemy killed, bounty is active: {Plugin.BountyIsActive}");
if (Plugin.BountyIsActive)
{
Terminal val = Object.FindObjectOfType<Terminal>();
val.groupCredits += 30;
val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship);
HullManager.SendChatEventMessage("<color=green>+60 credits</color>");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")]
private static void OneForAll()
{
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
Plugin.Mls.LogInfo((object)$"Player killed, one for all is active: {Plugin.OneForAllIsActive}");
if (Plugin.OneForAllIsActive)
{
Plugin.OneForAllIsActive = false;
HullManager hullManager = Object.FindObjectOfType<HullManager>();
hullManager.timeOfDay.votedShipToLeaveEarlyThisRound = true;
hullManager.timeOfDay.SetShipLeaveEarlyServerRpc();
HullManager.SendChatEventMessage("<color=red>One of the workers died, the ship will go into orbit in an hour</color>");
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "StartHost")]
private static void ResetDayPassed()
{
Plugin.CurrentMessage = "Events not found";
Plugin.DaysPassed = 0;
}
}
public abstract class HullEvent
{
public abstract string ID();
public virtual int GetWeight()
{
return 1;
}
public virtual string GetDescription()
{
return "Default description";
}
public virtual string GetMessage()
{
return "Default message";
}
public virtual string GetShortMessage()
{
return "Short message";
}
public virtual void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
}
}
public class HullManager : MonoBehaviour
{
public TimeOfDay timeOfDay;
public static HullManager Instance { get; private set; }
public void Update()
{
if ((Object)(object)timeOfDay == (Object)null)
{
timeOfDay = Object.FindFirstObjectByType<TimeOfDay>();
}
else if (Plugin.ChangeQuotaValue)
{
timeOfDay.quotaVariables.baseIncrease = Plugin.QuotaIncrease;
}
}
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
else
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public void AddMoney(int amount)
{
Terminal val = Object.FindObjectOfType<Terminal>();
val.groupCredits += amount;
val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship);
}
public void ExecuteAfterDelay(Action action, float delay)
{
((MonoBehaviour)this).StartCoroutine(DelayedExecution(action, delay));
}
private IEnumerator DelayedExecution(Action action, float delay)
{
yield return (object)new WaitForSeconds(delay);
action();
}
public static void SendChatEventMessage(HullEvent hullEvent)
{
if ((Object)(object)HUDManager.Instance != (Object)null && hullEvent != null && Plugin.EnableEventMessages)
{
HUDManager.Instance.AddTextToChatOnServer(Plugin.UseShortChatMessages ? hullEvent.GetShortMessage() : hullEvent.GetMessage(), -1);
}
}
public static void SendChatEventMessage(string message)
{
if ((Object)(object)HUDManager.Instance != (Object)null && message != null && Plugin.EnableEventMessages)
{
HUDManager.Instance.AddTextToChatOnServer(message, -1);
}
}
public static void LogEnemyRarity(List<SpawnableEnemyWithRarity> enemies, string title)
{
Plugin.Mls.LogInfo((object)"");
Plugin.Mls.LogInfo((object)title);
foreach (SpawnableEnemyWithRarity enemy in enemies)
{
Plugin.Mls.LogInfo((object)$"{((Object)enemy.enemyType.enemyPrefab).name} - {enemy.rarity}");
}
}
}
public abstract class RandomSelector
{
private static Random _random = new Random();
public static List<string> GetRandomGameEvents()
{
int count = (Plugin.IncreaseEventCountPerDay ? Plugin.DaysPassed : Plugin.EventCount);
return GetWeightedRandomGameEvents(ConfigManager.GetWeights(), count);
}
private static List<T> GetWeightedRandomGameEvents<T>(Dictionary<T, int> weights, int count)
{
int maxValue = weights.Where((KeyValuePair<T, int> x) => x.Value > 0).Sum((KeyValuePair<T, int> x) => x.Value);
HashSet<T> hashSet = new HashSet<T>();
while (hashSet.Count < count)
{
int num = _random.Next(maxValue);
foreach (KeyValuePair<T, int> weight in weights)
{
if (weight.Value != 0)
{
if (num < weight.Value)
{
hashSet.Add(weight.Key);
break;
}
num -= weight.Value;
}
}
}
return hashSet.ToList();
}
private static void Shuffle<T>(IList<T> list)
{
int num = list.Count;
while (num > 1)
{
num--;
int num2 = _random.Next(num + 1);
int index = num2;
int index2 = num;
T value = list[num];
T value2 = list[num2];
list[index] = value;
list[index2] = value2;
}
}
}
public class SelectableLevelState
{
public int MinScrap;
public int MaxScrap;
public int MinTotalScrapValue;
public int MaxTotalScrapValue;
public int MaxEnemyPowerCount = 8;
public int MaxOutsideEnemyPowerCount = 15;
public int MaxDaytimeEnemyPowerCount = 20;
public AnimationCurve EnemySpawnChanceThroughoutDay;
public AnimationCurve OutsideEnemySpawnChanceThroughDay;
public AnimationCurve DaytimeEnemySpawnChanceThroughDay;
public List<SpawnableEnemyWithRarity> EnemyList = new List<SpawnableEnemyWithRarity>();
public List<SpawnableEnemyWithRarity> OutsideEnemyList = new List<SpawnableEnemyWithRarity>();
public List<SpawnableEnemyWithRarity> DaytimeEnemyList = new List<SpawnableEnemyWithRarity>();
public SelectableLevelState(SelectableLevel level)
{
MinScrap = level.minScrap;
MaxScrap = level.maxScrap;
MinTotalScrapValue = level.minTotalScrapValue;
MaxTotalScrapValue = level.maxTotalScrapValue;
MaxEnemyPowerCount = level.maxEnemyPowerCount;
MaxOutsideEnemyPowerCount = level.maxOutsideEnemyPowerCount;
MaxDaytimeEnemyPowerCount = level.maxDaytimeEnemyPowerCount;
EnemySpawnChanceThroughoutDay = level.enemySpawnChanceThroughoutDay;
OutsideEnemySpawnChanceThroughDay = level.outsideEnemySpawnChanceThroughDay;
DaytimeEnemySpawnChanceThroughDay = level.daytimeEnemySpawnChanceThroughDay;
CloneEnemies(level.Enemies, EnemyList);
CloneEnemies(level.OutsideEnemies, OutsideEnemyList);
CloneEnemies(level.DaytimeEnemies, DaytimeEnemyList);
}
public void RestoreState(SelectableLevel level)
{
level.minScrap = MinScrap;
level.maxScrap = MaxScrap;
level.minTotalScrapValue = MinTotalScrapValue;
level.maxTotalScrapValue = MaxTotalScrapValue;
level.maxEnemyPowerCount = MaxEnemyPowerCount;
level.maxOutsideEnemyPowerCount = MaxOutsideEnemyPowerCount;
level.maxDaytimeEnemyPowerCount = MaxDaytimeEnemyPowerCount;
level.enemySpawnChanceThroughoutDay = EnemySpawnChanceThroughoutDay;
level.outsideEnemySpawnChanceThroughDay = OutsideEnemySpawnChanceThroughDay;
level.daytimeEnemySpawnChanceThroughDay = DaytimeEnemySpawnChanceThroughDay;
level.Enemies.Clear();
CloneEnemies(EnemyList, level.Enemies);
level.OutsideEnemies.Clear();
CloneEnemies(OutsideEnemyList, level.OutsideEnemies);
level.DaytimeEnemies.Clear();
CloneEnemies(DaytimeEnemyList, level.DaytimeEnemies);
}
private void CloneEnemies(List<SpawnableEnemyWithRarity> source, List<SpawnableEnemyWithRarity> destination)
{
//IL_0014: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
foreach (SpawnableEnemyWithRarity item2 in source)
{
SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity
{
enemyType = item2.enemyType,
rarity = item2.rarity
};
destination.Add(item);
}
}
}
}
namespace HullBreakerCompany.Events
{
public class ArachnophobiaEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>Possible habitat of spiders</color>", "<color=white>Spider webs are everywhere</color>", "<color=white>Spiders are crawling everywhere</color>" };
public override string ID()
{
return "Arachnophobia";
}
public override int GetWeight()
{
return 20;
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetDescription()
{
return "Increased chance of spider spawning";
}
public override string GetShortMessage()
{
return "<color=white>ARACHNOPHOBIA</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<DressGirlAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(SandSpiderAI), 128);
HullManager.SendChatEventMessage(this);
}
}
}
public class BabkinPogrebEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>On the this moon, something strange happened with scrap...</color>", "<color=white>It seems that only jars of pickles spawn on this moon...</color>", "<color=white>It's a pickle moon...</color>" };
public override string ID()
{
return "BabkinPogreb";
}
public override int GetWeight()
{
return 10;
}
public override string GetDescription()
{
return "Only jars of pickles spawn on the moon";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>ITEM MYSTERY</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
try
{
if ((Object)(object)HullManager.Instance == (Object)null)
{
Plugin.Mls.LogError((object)"HullManager.Instance is null");
return;
}
if ((Object)(object)level == (Object)null)
{
Plugin.Mls.LogError((object)"level is null");
return;
}
level.spawnableScrap.RemoveAll((SpawnableItemWithRarity item) => item.spawnableItem.itemName != "Jar of pickles");
if (level.spawnableScrap.Count == 0)
{
Plugin.Mls.LogError((object)"No jars of pickles found in spawnableScrap list!");
DelayedReturnList(level);
return;
}
foreach (SpawnableItemWithRarity item in level.spawnableScrap.Where((SpawnableItemWithRarity item) => item.spawnableItem.itemName == "Jar of pickles"))
{
item.rarity = 100;
}
HullManager.Instance.ExecuteAfterDelay(delegate
{
DelayedReturnList(level);
}, 12f);
HullManager.SendChatEventMessage(this);
}
catch (ArgumentOutOfRangeException ex)
{
Plugin.Mls.LogError((object)("ArgumentOutOfRangeException caught in BabkinPogrebEvent.Execute: " + ex.Message));
}
}
private void DelayedReturnList(SelectableLevel level)
{
Plugin.Mls.LogInfo((object)"Resetting spawnable items...");
level.spawnableScrap.Clear();
foreach (SpawnableItemWithRarity item in Plugin.NotModifiedSpawnableItemsWithRarity)
{
level.spawnableScrap.Add(item);
}
}
}
public class BeeEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>Possibly a large amount of bee hives</color>", "<color=white>Bees are buzzing...</color>" };
public override string ID()
{
return "Bee";
}
public override int GetWeight()
{
return 20;
}
public override string GetDescription()
{
return "Increased chance of bee hives spawning";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>ANNOYING BUZZING</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
using (IEnumerator<SpawnableEnemyWithRarity> enumerator = level.DaytimeEnemies.Where((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<RedLocustBees>() != (Object)null).GetEnumerator())
{
if (enumerator.MoveNext())
{
SpawnableEnemyWithRarity current = enumerator.Current;
current.rarity = 128;
}
}
HullManager.SendChatEventMessage(this);
}
}
public class CustomEvent : HullEvent
{
private string _id;
private int _weight;
private string _message;
private string _shortMessage;
public List<string> EnemySpawnList = new List<string>();
public List<string> OutsideSpawnList = new List<string>();
public int Rarity = 1;
public override string ID()
{
return _id;
}
public void SetID(string value)
{
_id = value;
}
public void SetWeight(int value)
{
_weight = value;
}
public override int GetWeight()
{
return _weight;
}
public void SetMessage(string value)
{
_message = value;
}
public void SetShortMessage(string value)
{
_shortMessage = value;
}
public override string GetMessage()
{
return "<color=white>" + _message + "</color>";
}
public override string GetShortMessage()
{
return "<color=white>" + _shortMessage + "</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> componentRarity, Dictionary<Type, int> outsideComponentRarity)
{
foreach (string item in EnemySpawnList.TakeWhile((string enemy) => enemy != "off"))
{
if (Plugin.EnemyBase.TryGetValue(item, out var value))
{
componentRarity.Add(value, Rarity);
}
else
{
Plugin.Mls.LogError((object)("Enemy " + item + " not found in EnemyBase"));
}
}
foreach (string item2 in OutsideSpawnList.TakeWhile((string enemy) => enemy != "off"))
{
if (Plugin.EnemyBase.TryGetValue(item2, out var value2))
{
outsideComponentRarity.Add(value2, Rarity);
}
else
{
Plugin.Mls.LogError((object)("Enemy " + item2 + " not found in EnemyBase"));
}
}
HullManager.SendChatEventMessage(Plugin.UseShortChatMessages ? GetShortMessage() : GetMessage());
}
}
public class DevochkaPizdecEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>A lot of workers are going crazy here</color>", "<color=white>Phantom girl? We don't believe</color>" };
public override string ID()
{
return "DevochkaPizdec";
}
public override int GetWeight()
{
return 5;
}
public override string GetDescription()
{
return "Increased chance of phantom girl spawn";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>COTARD SYNDROME</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (level.Enemies.Exists((SpawnableEnemyWithRarity enemy) => ((object)enemy).GetType() == typeof(DressGirlAI)))
{
enemyComponentRarity.Add(typeof(DressGirlAI), 32);
HullManager.SendChatEventMessage(this);
}
}
}
public class EnemyBountyEvent : HullEvent
{
public override string ID()
{
return "EnemyBounty";
}
public override int GetWeight()
{
return 40;
}
public override string GetDescription()
{
return "Company pays money for killing the enemies / 60 per enemy";
}
public override string GetMessage()
{
return "<color=green>Company pays money for killing the enemies!</color>";
}
public override string GetShortMessage()
{
return "<color=green>ENEMY BOUNTY</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
Plugin.BountyIsActive = true;
HullManager.SendChatEventMessage(this);
}
}
public class FlowerManEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>So many eyes in the dark, carefully</color>", "<color=white>Something is sneaking in the dark</color>" };
public override string ID()
{
return "FlowerMan";
}
public override int GetWeight()
{
return 20;
}
public override string GetDescription()
{
return "Increased chance of flowerman spawn";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>WHITE EYES...</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<FlowermanAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(FlowermanAI), 256);
HullManager.SendChatEventMessage(this);
}
}
}
public class HackedTurretsEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>The company's hackers have disabled all turrets on this moon, you can breathe easy</color>", "<color=white>It seems that the turrets are not working, it's time to relax</color>" };
public override string ID()
{
return "HackedTurrets";
}
public override int GetWeight()
{
return 10;
}
public override string GetDescription()
{
return "Turrets dont work on the moon";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>SYSTEM FAILURE</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if ((Object)(object)HullManager.Instance == (Object)null)
{
Plugin.Mls.LogError((object)"HullManager.Instance is null");
return;
}
if ((Object)(object)level == (Object)null)
{
Plugin.Mls.LogError((object)"level is null");
return;
}
HullManager.Instance.ExecuteAfterDelay(delegate
{
HackTurrets();
}, 16f);
HullManager.SendChatEventMessage(this);
}
private void HackTurrets()
{
Turret[] array = Object.FindObjectsOfType<Turret>();
Turret[] array2 = array;
foreach (Turret val in array2)
{
val.ToggleTurretServerRpc(false);
}
}
}
public class HellEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=orange>It says here that there is total hell happening on the this moon</color>", "<color=orange>Heightened threat level on the moon, keep your eyes open</color>" };
public override string ID()
{
return "Hell";
}
public override int GetWeight()
{
return 1;
}
public override string GetDescription()
{
return "Increased chance of spawning Jester and more enemies";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>HELL</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<JesterAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(JesterAI), 64);
HullManager.SendChatEventMessage(this);
RoundManager.Instance.hourTimeBetweenEnemySpawnBatches = 1;
HullManager.Instance.ExecuteAfterDelay(delegate
{
Hell();
}, 16f);
}
}
private void Hell()
{
EnemyVent[] array = Object.FindObjectsOfType<EnemyVent>();
for (int i = 0; i < 8; i++)
{
if (array.Length != 0)
{
EnemyVent val = array[Random.Range(0, array.Length)];
RoundManager.Instance.SpawnEnemyFromVent(val);
}
}
}
}
public class HoarderBugEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>Keep an eye on the loot, Hoarding Bugs nearby</color>", "<color=white>Something is stealing the loot, look out</color>" };
public override string ID()
{
return "HoarderBug";
}
public override int GetWeight()
{
return 50;
}
public override string GetDescription()
{
return "Increased chance of hoarder bug spawn";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>BUG INVASION</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<HoarderBugAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(HoarderBugAI), 512);
HullManager.SendChatEventMessage(this);
}
}
}
public class HullBreakEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=green>Take a break, the company is sending money for visiting the moon</color>", "<color=green>The company is sending money for visiting the moon</color>" };
public override string ID()
{
return "HullBreak";
}
public override int GetWeight()
{
return 5;
}
public override string GetDescription()
{
return "Getting money for visiting this moon";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>TAKE A BREAK</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
HullManager.Instance.AddMoney(120);
HullManager.SendChatEventMessage(this);
}
}
public class JanitorEvent : HullEvent
{
public override string ID()
{
return "Janitor";
}
public override int GetWeight()
{
return 5;
}
public override string GetDescription()
{
return "Increased chance of ButlerBees spawn";
}
public override string GetMessage()
{
return "<color=white>Perfect cleanliness of the floor inside the complex</color>";
}
public override string GetShortMessage()
{
return "<color=orange>BUTLER THE JANITOR</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<ButlerEnemyAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(ButlerEnemyAI), 256);
HullManager.SendChatEventMessage(this);
}
}
}
public class LandMineEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>Watch your step, there are a lot of landmines</color>", "<color=white>Be careful, there are a lot of landmines</color>" };
public override string ID()
{
return "LandMine";
}
public override int GetWeight()
{
return 30;
}
public override string GetDescription()
{
return "Increased chance of landmines spawning";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>LANDMINE</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
Plugin.LevelUnits(level, turret: false, landmine: true);
HullManager.SendChatEventMessage(this);
}
}
public class LizardsEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>Horrible smell from toxic lizards</color>", "<color=white>Watch out for the lizards toxic clouds</color>" };
public override string ID()
{
return "Lizards";
}
public override int GetWeight()
{
return 15;
}
public override string GetDescription()
{
return "Increased chance of puffers spawn";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return "<color=white>LIZARDSSS</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<PufferAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(PufferAI), 64);
HullManager.SendChatEventMessage(this);
}
}
}
public class NothingEvent : HullEvent
{
public static List<string> MessagesList = new List<string> { "<color=white>...</color>", "<color=white>---</color>", "<color=white>DAMAGED...</color>", "<color=white>???</color>" };
public override string ID()
{
return "Nothing";
}
public override int GetWeight()
{
return 20;
}
public override string GetDescription()
{
return "Nothing happens";
}
public override string GetMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override string GetShortMessage()
{
return MessagesList[Random.Range(0, MessagesList.Count)];
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
HullManager.SendChatEventMessage(this);
}
}
public class NutcrackerEvent : HullEvent
{
public override string ID()
{
return "Nutcracker";
}
public override int GetWeight()
{
return 5;
}
public override string GetDescription()
{
return "Increased chance of NutCracker spawn";
}
public override string GetMessage()
{
return "<color=white>NutCrackers detected in the area!</color>";
}
public override string GetShortMessage()
{
return "<color=orange>NUTCRACKERS INCOMING</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<NutcrackerEnemyAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(NutcrackerEnemyAI), 64);
HullManager.SendChatEventMessage(this);
}
}
}
public class OnAPowderKegEvent : HullEvent
{
public override string ID()
{
return "OnAPowderKeg";
}
public override int GetWeight()
{
return 10;
}
public override string GetDescription()
{
return "Landmines can detonate at any time";
}
public override string GetMessage()
{
return "<color=red>CAUTION,</color> <color=white>landmines can detonate at any time</color>";
}
public override string GetShortMessage()
{
return "<color=red>ON A POWDER KEG</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
HullManager.Instance.ExecuteAfterDelay(delegate
{
DetonateLandMine();
}, Random.Range(30, 680));
HullManager.SendChatEventMessage(this);
}
private void DetonateLandMine()
{
Landmine[] array = Object.FindObjectsOfType<Landmine>();
Landmine[] array2 = array;
foreach (Landmine val in array2)
{
val.ExplodeMineServerRpc();
}
}
}
public class OneForAllEvent : HullEvent
{
public override string ID()
{
return "OneForAll";
}
public override int GetWeight()
{
return 5;
}
public override string GetDescription()
{
return "The ship will fly into orbit in an hour if one of the workers dies";
}
public override string GetMessage()
{
return "<color=white>The ship will fly into orbit in an hour if one of the workers dies</color>";
}
public override string GetShortMessage()
{
return "<color=red>ONE FOR ALL!</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
Plugin.OneForAllIsActive = true;
HullManager.SendChatEventMessage(this);
}
}
public class OpenTheNoorEvent : HullEvent
{
public override string ID()
{
return "OpenTheNoor";
}
public override int GetWeight()
{
return 15;
}
public override string GetDescription()
{
return "All big doors are locked in the level";
}
public override string GetMessage()
{
return "<color=white>All big doors are locked in the level</color>";
}
public override string GetShortMessage()
{
return "<color=white>OPEN THE NOOR...</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if ((Object)(object)HullManager.Instance == (Object)null)
{
Plugin.Mls.LogError((object)"HullManager.Instance is null");
return;
}
if ((Object)(object)level == (Object)null)
{
Plugin.Mls.LogError((object)"level is null");
return;
}
HullManager.Instance.ExecuteAfterDelay(delegate
{
CloseBigDoors();
}, 16f);
HullManager.SendChatEventMessage(this);
}
private void CloseBigDoors()
{
TerminalAccessibleObject[] array = Object.FindObjectsOfType<TerminalAccessibleObject>();
TerminalAccessibleObject[] array2 = array;
foreach (TerminalAccessibleObject val in array2)
{
val.SetDoorOpenServerRpc(false);
}
}
}
public class OutSideEnemyDayEvent : HullEvent
{
public override string ID()
{
return "OutSideEnemyDay";
}
public override int GetWeight()
{
return 3;
}
public override string GetDescription()
{
return "Increased amount of enemies on the surface during the daytime";
}
public override string GetMessage()
{
return "<color=white>Increased amount of enemies on the surface during the daytime</color>";
}
public override string GetShortMessage()
{
return "<color=red>SILENCE SEASON</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
//IL_0014: 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_0028: Expected O, but got Unknown
level.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[1]
{
new Keyframe(0f, 512f)
});
HullManager.SendChatEventMessage(this);
}
}
public class SlimeEvent : HullEvent
{
public override string ID()
{
return "Slime";
}
public override int GetWeight()
{
return 20;
}
public override string GetDescription()
{
return "Increased chance of slime spawn";
}
public override string GetMessage()
{
return "<color=white>Inhabited with slime</color>";
}
public override string GetShortMessage()
{
return "<color=white>SO SLIMY</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<BlobAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(BlobAI), 48);
HullManager.SendChatEventMessage(this);
}
}
}
public class SpringManEvent : HullEvent
{
public override string ID()
{
return "SpringMan";
}
public override int GetWeight()
{
return 10;
}
public override string GetDescription()
{
return "Increased chance of spring man spawning (coil-head)";
}
public override string GetMessage()
{
return "<color=white>It's impossible not to look at them</color>";
}
public override string GetShortMessage()
{
return "<color=white>SKULL COILS</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
if (!level.Enemies.All((SpawnableEnemyWithRarity unit) => (Object)(object)unit.enemyType.enemyPrefab.GetComponent<SpringManAI>() == (Object)null))
{
enemyComponentRarity.Add(typeof(SpringManAI), 128);
HullManager.SendChatEventMessage(this);
}
}
}
public class TurretEvent : HullEvent
{
public override string ID()
{
return "Turret";
}
public override int GetWeight()
{
return 5;
}
public override string GetDescription()
{
return "Increased chance of turrets spawning";
}
public override string GetMessage()
{
return "<color=white>Alert, turrets detected</color>";
}
public override string GetShortMessage()
{
return "<color=white>TURRETS</color>";
}
public override void Execute(SelectableLevel level, Dictionary<Type, int> enemyComponentRarity, Dictionary<Type, int> outsideComponentRarity)
{
Plugin.LevelUnits(level, turret: true);
HullManager.SendChatEventMessage(this);
}
}
}