using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BrutalCompanyPlus.BCP;
using BrutalCompanyPlus.HarmPatches;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ExampleAssembly")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Biney")]
[assembly: AssemblyProduct("ExampleAssembly")]
[assembly: AssemblyCopyright("Copyright © Biney")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("251a7ff8-4d39-4f8b-9838-61124bf62f99")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BrutalCompanyPlus
{
[BepInPlugin("BrutalCompanyPlus", "BrutalCompanyPlus", "3.5.1")]
public class Plugin : BaseUnityPlugin
{
public static Dictionary<EventEnum, ConfigEntry<int>> eventWeightEntries = new Dictionary<EventEnum, ConfigEntry<int>>();
private bool brutalPlusInitialized;
public static List<string> correctEnemyNames = new List<string>
{
"Centipede", "Bunker Spider", "Hoarding bug", "Flowerman", "Crawler", "Blob", "Girl", "Puffer", "Nutcracker", "Spring",
"Jester", "Masked", "LassoMan"
};
private string configFilePath = Path.Combine(Paths.ConfigPath, "BrutalCompanyPlus.cfg");
public static ConfigEntry<string> ExperimentationLevelScrap { get; private set; }
public static ConfigEntry<string> AssuranceLevelScrap { get; private set; }
public static ConfigEntry<string> VowLevelScrap { get; private set; }
public static ConfigEntry<string> MarchLevelScrap { get; private set; }
public static ConfigEntry<string> RendLevelScrap { get; private set; }
public static ConfigEntry<string> DineLevelScrap { get; private set; }
public static ConfigEntry<string> OffenseLevelScrap { get; private set; }
public static ConfigEntry<string> TitanLevelScrap { get; private set; }
public static ConfigEntry<string> CustomLevelScrap { get; private set; }
public static ConfigEntry<bool> VanillaRaritySettings { get; private set; }
public static ConfigEntry<float> FactoryStartOfDaySpawnChance { get; private set; }
public static ConfigEntry<float> FactoryMidDaySpawnChance { get; private set; }
public static ConfigEntry<float> FactoryEndOfDaySpawnChance { get; private set; }
public static ConfigEntry<float> OutsideStartOfDaySpawnChance { get; private set; }
public static ConfigEntry<float> OutsideMidDaySpawnChance { get; private set; }
public static ConfigEntry<float> OutsideEndOfDaySpawnChance { get; private set; }
public static ConfigEntry<float> MoonHeatDecreaseRate { get; private set; }
public static ConfigEntry<float> MoonHeatIncreaseRate { get; private set; }
public static ConfigEntry<bool> EnableTurretModifications { get; private set; }
public static ConfigEntry<bool> EnableLandmineModifications { get; private set; }
public static ConfigEntry<float> TurretSpawnRate { get; private set; }
public static ConfigEntry<float> LandmineSpawnRate { get; private set; }
public static ConfigEntry<string> ExperimentationLevelRarities { get; private set; }
public static ConfigEntry<string> AssuranceLevelRarities { get; private set; }
public static ConfigEntry<string> VowLevelRarities { get; private set; }
public static ConfigEntry<string> MarchLevelRarities { get; private set; }
public static ConfigEntry<string> RendLevelRarities { get; private set; }
public static ConfigEntry<string> DineLevelRarities { get; private set; }
public static ConfigEntry<string> OffenseLevelRarities { get; private set; }
public static ConfigEntry<string> TitanLevelRarities { get; private set; }
public static ConfigEntry<bool> EnableFreeMoney { get; private set; }
public static ConfigEntry<int> FreeMoneyValue { get; private set; }
public static ConfigEntry<bool> EnableAllEnemy { get; private set; }
public static ConfigEntry<int> DeadlineDaysAmount { get; private set; }
public static ConfigEntry<int> StartingCredits { get; private set; }
public static ConfigEntry<int> StartingQuota { get; private set; }
public static ConfigEntry<float> BaseIncrease { get; private set; }
public static ConfigEntry<int> MinScrap { get; private set; }
public static ConfigEntry<int> MaxScrap { get; private set; }
public static ConfigEntry<int> MinTotalScrapValue { get; private set; }
public static ConfigEntry<int> MaxTotalScrapValue { get; private set; }
private void Awake()
{
InitializeVariables();
SetupPatches();
InitializeBCP_ConfigSettings();
InitializeDefaultEnemyRarities();
UpdateConfigurations();
RemoveConfigSection(configFilePath, "EventEnabledConfig");
RemoveConfigSection(configFilePath, "EnemySpawnSettings.Factory");
RemoveConfigSection(configFilePath, "EnemySpawnSettings.Outside");
RemoveConfigLines(configFilePath, "Chaos", "BadPlanet");
}
private void Start()
{
if (!brutalPlusInitialized)
{
CreateBrutalPlusGameObject();
brutalPlusInitialized = true;
}
}
private void OnDestroy()
{
if (!brutalPlusInitialized)
{
CreateBrutalPlusGameObject();
brutalPlusInitialized = true;
}
}
public static void UpdateConfigurations()
{
foreach (ConfigEntry<string> item in new List<ConfigEntry<string>> { ExperimentationLevelRarities, AssuranceLevelRarities, VowLevelRarities, MarchLevelRarities, RendLevelRarities, DineLevelRarities, OffenseLevelRarities, TitanLevelRarities })
{
Dictionary<string, string> dictionary = ParseConfigRarities(item.Value);
List<string> list = new List<string>();
foreach (string correctEnemyName in correctEnemyNames)
{
string value;
string text = (dictionary.TryGetValue(correctEnemyName, out value) ? value : "-1");
list.Add(correctEnemyName + ":" + text);
}
string text2 = string.Join(",", list);
if (item.Value != text2)
{
item.Value = text2;
BcpLogger.Log("Updated configuration for " + ((ConfigEntryBase)item).Definition.Section + ", " + ((ConfigEntryBase)item).Definition.Key + ": " + text2);
}
}
}
private static Dictionary<string, string> ParseConfigRarities(string configValue)
{
return (from part in configValue.Split(new char[1] { ',' })
select part.Split(new char[1] { ':' }) into parts
where parts.Length == 2
select parts).ToDictionary((string[] parts) => parts[0].Trim(), (string[] parts) => parts[1].Trim());
}
public void RemoveConfigLines(string filePath, params string[] variableNames)
{
try
{
List<string> list = File.ReadAllLines(filePath).ToList();
List<string> list2 = new List<string>();
foreach (string line in list)
{
if (!variableNames.Any((string variableName) => line.Trim().StartsWith(variableName + " =")))
{
list2.Add(line);
}
}
File.WriteAllLines(filePath, list2);
}
catch (Exception ex)
{
BcpLogger.Log("Error occurred: " + ex.Message);
}
}
public void RemoveConfigSection(string filePath, string sectionName)
{
try
{
List<string> list = File.ReadAllLines(filePath).ToList();
List<string> list2 = new List<string>();
bool flag = false;
foreach (string item in list)
{
if (item.Trim().Equals("[" + sectionName + "]"))
{
flag = true;
continue;
}
if (flag && item.StartsWith("["))
{
flag = false;
}
if (!flag)
{
list2.Add(item);
}
}
File.WriteAllLines(filePath, list2);
}
catch (Exception ex)
{
BcpLogger.Log("Error occurred: " + ex.Message);
}
}
public static void InitializeDefaultEnemyRarities()
{
Dictionary<string, int> value = new Dictionary<string, int>
{
{ "Centipede", 50 },
{ "Bunker Spider", 75 },
{ "Hoarding bug", 80 },
{ "Flowerman", 30 },
{ "Crawler", 15 },
{ "Blob", 25 },
{ "Girl", 2 },
{ "Puffer", 10 },
{ "Nutcracker", 15 },
{ "Spring", 5 },
{ "Jester", 1 },
{ "Masked", 1 },
{ "LassoMan", 1 }
};
Variables.DefaultEnemyRarities["ExperimentationLevel"] = value;
Dictionary<string, int> value2 = new Dictionary<string, int>
{
{ "Centipede", 50 },
{ "Bunker Spider", 40 },
{ "Hoarding bug", 50 },
{ "Flowerman", 30 },
{ "Crawler", 15 },
{ "Blob", 25 },
{ "Girl", 2 },
{ "Puffer", 40 },
{ "Nutcracker", 15 },
{ "Spring", 25 },
{ "Jester", 3 },
{ "Masked", 3 },
{ "LassoMan", 1 }
};
Variables.DefaultEnemyRarities["AssuranceLevel"] = value2;
Dictionary<string, int> value3 = new Dictionary<string, int>
{
{ "Centipede", 50 },
{ "Bunker Spider", 40 },
{ "Hoarding bug", 50 },
{ "Flowerman", 30 },
{ "Crawler", 20 },
{ "Blob", 25 },
{ "Girl", 5 },
{ "Puffer", 40 },
{ "Nutcracker", 20 },
{ "Spring", 40 },
{ "Jester", 15 },
{ "Masked", 10 },
{ "LassoMan", 0 }
};
Variables.DefaultEnemyRarities["VowLevel"] = value3;
Dictionary<string, int> value4 = new Dictionary<string, int>
{
{ "Centipede", 50 },
{ "Bunker Spider", 40 },
{ "Hoarding bug", 50 },
{ "Flowerman", 30 },
{ "Crawler", 20 },
{ "Blob", 25 },
{ "Girl", 5 },
{ "Puffer", 40 },
{ "Nutcracker", 20 },
{ "Spring", 40 },
{ "Jester", 15 },
{ "Masked", 10 },
{ "LassoMan", 0 }
};
Variables.DefaultEnemyRarities["OffenseLevel"] = value4;
Dictionary<string, int> value5 = new Dictionary<string, int>
{
{ "Centipede", 50 },
{ "Bunker Spider", 40 },
{ "Hoarding bug", 50 },
{ "Flowerman", 30 },
{ "Crawler", 20 },
{ "Blob", 25 },
{ "Girl", 10 },
{ "Puffer", 40 },
{ "Nutcracker", 20 },
{ "Spring", 40 },
{ "Jester", 15 },
{ "Masked", 10 },
{ "LassoMan", 0 }
};
Variables.DefaultEnemyRarities["MarchLevel"] = value5;
Dictionary<string, int> value6 = new Dictionary<string, int>
{
{ "Centipede", 35 },
{ "Bunker Spider", 25 },
{ "Hoarding bug", 30 },
{ "Flowerman", 56 },
{ "Crawler", 50 },
{ "Blob", 40 },
{ "Girl", 25 },
{ "Puffer", 40 },
{ "Nutcracker", 30 },
{ "Spring", 58 },
{ "Jester", 40 },
{ "Masked", 10 },
{ "LassoMan", 2 }
};
Variables.DefaultEnemyRarities["RendLevel"] = value6;
Dictionary<string, int> value7 = new Dictionary<string, int>
{
{ "Centipede", 35 },
{ "Bunker Spider", 25 },
{ "Hoarding bug", 30 },
{ "Flowerman", 56 },
{ "Crawler", 50 },
{ "Blob", 40 },
{ "Girl", 25 },
{ "Puffer", 40 },
{ "Nutcracker", 30 },
{ "Spring", 58 },
{ "Jester", 40 },
{ "Masked", 10 },
{ "LassoMan", 2 }
};
Variables.DefaultEnemyRarities["DineLevel"] = value7;
Dictionary<string, int> value8 = new Dictionary<string, int>
{
{ "Centipede", 35 },
{ "Bunker Spider", 25 },
{ "Hoarding bug", 30 },
{ "Flowerman", 56 },
{ "Crawler", 60 },
{ "Blob", 40 },
{ "Girl", 25 },
{ "Puffer", 40 },
{ "Nutcracker", 30 },
{ "Spring", 58 },
{ "Jester", 40 },
{ "Masked", 10 },
{ "LassoMan", 2 }
};
Variables.DefaultEnemyRarities["TitanLevel"] = value8;
}
public void InitializeBCP_ConfigSettings()
{
ExperimentationLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "ExperimentationLevelScrap", "6,25,400,1500", "Define min/max scrap pieces and min/max total scrap value for Experimentation Level ( -1 = Vanilla Value )");
AssuranceLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "AssuranceLevelScrap", "10,25,600,2500", "Define min/max scrap pieces and min/max total scrap value for Assurance Level ( -1 = Vanilla Value )");
VowLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "VowLevelScrap", "12,35,600,2500", "Define min/max scrap pieces and min/max total scrap value for Vow Level ( -1 = Vanilla Value )");
OffenseLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "OffenseLevelScrap", "15,35,800,3500", "Define min/max scrap pieces and min/max total scrap value for Offense Level ( -1 = Vanilla Value )");
MarchLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "MarchLevelScrap", "15,35,800,3500", "Define min/max scrap pieces and min/max total scrap value for March Level ( -1 = Vanilla Value )");
RendLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "RendLevelScrap", "20,60,1500,5000", "Define min/max scrap pieces and min/max total scrap value for Rend Level ( -1 = Vanilla Value )");
DineLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "DineScrap", "20,60,1500,5000", "Define min/max scrap pieces and min/max total scrap value for Dine Level ( -1 = Vanilla Value )");
TitanLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "TitanLevelScrap", "20,60,2000,6000", "Define min/max scrap pieces and min/max total scrap value for Titan Level ( -1 = Vanilla Value )");
CustomLevelScrap = ((BaseUnityPlugin)this).Config.Bind<string>("CustomScrapSettings", "CustomLevelScrap", "-1,-1,-1,-1", "Define min/max scrap pieces and min/max total scrap value for Any Custom Levels ( -1 = Vanilla Value )");
MoonHeatDecreaseRate = ((BaseUnityPlugin)this).Config.Bind<float>("MoonHeatSettings", "MoonHeatDecreaseRate", 10f, "Amount by which moon heat decreases when not visiting the planet");
MoonHeatIncreaseRate = ((BaseUnityPlugin)this).Config.Bind<float>("MoonHeatSettings", "MoonHeatIncreaseRate", 20f, "Amount by which moon heat increases when landing back on the same planet");
EnableTurretModifications = ((BaseUnityPlugin)this).Config.Bind<bool>("MapObjectModificationSettings", "EnableTurretModifications", true, "Enable modifications to turret spawn rates on every moon, False would default to game logic");
TurretSpawnRate = ((BaseUnityPlugin)this).Config.Bind<float>("MapObjectModificationSettings", "TurretSpawnRate", 8f, "Default spawn amount for turrets on every moon");
EnableLandmineModifications = ((BaseUnityPlugin)this).Config.Bind<bool>("MapObjectModificationSettings", "EnableLandmineModifications", true, "Enable modifications to landmine spawn rates on every moon, False would default to game logic");
LandmineSpawnRate = ((BaseUnityPlugin)this).Config.Bind<float>("MapObjectModificationSettings", "LandmineSpawnRate", 30f, "Default spawn amount for landmines on every moon");
VanillaRaritySettings = ((BaseUnityPlugin)this).Config.Bind<bool>("CustomLevelRarities", "VanillaRaritySettings", false, "If TRUE this will DISABLE overwriting Rarity Values for Factory Enemies");
ExperimentationLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "Experimentation", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for Experimentation (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
AssuranceLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "Assurance", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for Assurance (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
VowLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "Vow", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for Vow (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
MarchLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "March", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for March (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
RendLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "Rend", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for Rend (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
DineLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "Dine", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for Dine (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
OffenseLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "Offense", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for Offense (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
TitanLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("CustomLevelRarities", "Titan", "Centipede:-1,Bunker Spider:-1,Hoarding bug:-1,Flowerman:-1,Crawler:-1,Blob:-1,Girl:-1,Puffer:-1,Nutcracker:-1,Spring:-1,Jester:-1,Masked:-1,LassoMan:-1", "Define custom enemy rarities for Titan (0 = no spawn, 100 = max chance, -1 = default Brutals rarity, The spawn rate will also be impacted depnding on the Chance rate)");
EnableFreeMoney = ((BaseUnityPlugin)this).Config.Bind<bool>("EventOptions", "EnableFreeMoney", true, "This will give free money everytime survive and escape the planet");
FreeMoneyValue = ((BaseUnityPlugin)this).Config.Bind<int>("EventOptions", "FreeMoneyValue", 150, "This will control the amount of money you get when EnableFreeMoney is true");
EnableAllEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("EnemySettings", "EnableAllEnemy", true, "This will add every vanilla enemy type to each moon as a spawn chance");
DeadlineDaysAmount = ((BaseUnityPlugin)this).Config.Bind<int>("QuotaSettings", "DeadlineDaysAmount", 4, "Days available before deadline");
StartingCredits = ((BaseUnityPlugin)this).Config.Bind<int>("QuotaSettings", "StartingCredits", 200, "Credits at the start of a new session");
StartingQuota = ((BaseUnityPlugin)this).Config.Bind<int>("QuotaSettings", "StartingQuota", 400, "Starting quota amount in a new session");
BaseIncrease = ((BaseUnityPlugin)this).Config.Bind<float>("QuotaSettings", "BaseIncrease", 275f, "Quota increase after meeting the previous quota");
MinScrap = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSettings", "MinScrap", 10, "Minimum scraps that can spawn on each moon");
MaxScrap = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSettings", "MaxScrap", 40, "Maximum scraps that can spawn on each moon");
MinTotalScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSettings", "MinTotalScrapValue", 600, "Minimum total scrap value on the moon");
MaxTotalScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSettings", "MaxTotalScrapValue", 5000, "Maximum total scrap value on the moon");
eventWeightEntries[EventEnum.None] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "None", 100, "[Nothing Happened Today] Nothing special will happen (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.Turret] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "Turret", 100, "[Turret Terror] This will spawn turrets all over the place inside the factory (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.Delivery] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "Delivery", 100, "[ICE SCREAM] This will order between 3 - 9 random items from the shop (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.BlobEvolution] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "BlobEvolution", 100, "[They have EVOLVED] This will spawn Blobs inside and 1 outside and they can open doors and move much faster (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.Guards] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "Guards", 100, "[They gaurd this place] this will spawn nutcrackers outside (Set Chance between 0 -100)");
eventWeightEntries[EventEnum.SurfaceExplosion] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "SurfaceExplosion", 100, "[The Surface is explosive] Mines wills spawn at the feet of players not in the ship or factory, they also have a delayed fuse (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.FaceHuggers] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "FaceHuggers", 100, "[Bring a shovel] This will spawn MANY Centipedes into the factory (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.TheRumbling] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "TheRumbling", 100, "[The Rumbling] This will spawn MANY Forest Giants when the ship has fully landed (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.TheyWant2Play] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "TheyWant2Play", 100, "[The just want to play] This will spawn several Ghost girls into the level (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.BeastInside] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "BeastInside", 100, "[The Beasts Inside] This will spawn Eyeless Dogs into the Factory, spawn rate changes depending on moon (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.ShadowRealm] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "ShadowRealm", 100, "[The shadows are roaming] This will spawn several bracken outside along with a chance of Fog (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.Unfair] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "Unfair", 100, "[UNFAIR COMPANY] This will spawn several outside enemies and inside enemies at a significant rate (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.OutsideBox] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "OutsideBox", 100, "[Outside the box] This will spawn Jesters Outside (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.InstaJester] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "InstaJester", 100, "[Pop goes the... HOLY FUC-] This will spawn several jesters that have a short crank timer between 0 - 10 seconds instead of 30 - 45 seconds (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.InsideOut] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "InsideOut", 100, "[Spring Escape] This will spawn Coil heads outside, they will instantly roam around the ship (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.Landmine] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "Landmine", 100, "[Minescape Terror] This will spawn MANY landmines inside the factory (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.Sacrifice] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "Sacrifice", 100, "[The Hunger Games?] This will rotate through players at a given rate, when the selected player steps inside the factory.. They get choosen for death. (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.ShipTurret] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "ShipTurret", 100, "[When did we get this installed?!?] This will spawn a turret inside the ship facing the controls (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.HoardTown] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "HoardTown", 100, "[Hoarder Town] This will spawn MANY Hoarder Bugs inside the factory and outside (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.TheyAreShy] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "TheyAreShy", 100, "[Don't look... away!] This spawn several Spring Heads and Brackens inside & outside the factory (Set Chance between 0 - 100)");
eventWeightEntries[EventEnum.ResetHeat] = ((BaseUnityPlugin)this).Config.Bind<int>("EventChanceConfig", "ResetHeat", 100, "[All Moons Heat Reset] This will reset the moon heat for all moons (Set Chance between 0 - 100)");
}
private void InitializeVariables()
{
Variables.mls = Logger.CreateLogSource("BrutalCompanyPlus");
Variables.mls.LogWarning((object)"Loaded Brutal Company Plus and applying patches.");
Variables.mls = ((BaseUnityPlugin)this).Logger;
Variables.levelHeatVal = new Dictionary<SelectableLevel, float>();
Variables.enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>();
Variables.levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
Variables.enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>();
}
private void SetupPatches()
{
Variables._harmony.PatchAll(typeof(LevelEventsPatches));
Variables._harmony.PatchAll(typeof(QuotaPatches));
Variables._harmony.PatchAll(typeof(EnemyAIPatches));
}
private void CreateBrutalPlusGameObject()
{
//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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
try
{
Variables.mls.LogInfo((object)"Attempting to Initialize BrutalPlus");
GameObject val = new GameObject("BrutalPlus");
val.SetActive(true);
((Behaviour)val.AddComponent<BrutalPlus>()).enabled = true;
Object.DontDestroyOnLoad((Object)val);
Variables.loaded = true;
}
catch (Exception ex)
{
Variables.mls.LogInfo((object)("Exception in CreateBrutalPlusGameObject: " + ex.Message));
BcpLogger.Log("Exception in CreateBrutalPlusGameObject: " + ex.Message);
}
}
public static void CleanupAndResetAI()
{
Functions.CleanUpAllVariables();
BrutalPlus.CleanupAllSpawns();
}
public static void UpdateAIInNewLevel(SelectableLevel newLevel)
{
foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
{
GameObject enemyPrefab = enemy.enemyType.enemyPrefab;
foreach (Type item in Variables.aiPresence.Keys.ToList())
{
if ((Object)(object)enemyPrefab.GetComponent(item) != (Object)null)
{
Variables.aiPresence[item] = true;
}
}
}
}
public static void AddMissingAIToNewLevel(SelectableLevel newLevel)
{
if (!EnableAllEnemy.Value)
{
return;
}
SelectableLevel[] levels = StartOfRound.Instance.levels;
for (int i = 0; i < levels.Length; i++)
{
foreach (SpawnableEnemyWithRarity enemy in levels[i].Enemies)
{
GameObject enemyPrefab = enemy.enemyType.enemyPrefab;
foreach (Type item in Variables.aiPresence.Keys.ToList())
{
if ((Object)(object)enemyPrefab.GetComponent(item) != (Object)null && !Variables.aiPresence[item])
{
Variables.aiPresence[item] = true;
newLevel.Enemies.Add(enemy);
Variables.mls.LogWarning((object)("\n\nAdded Enemy: > " + ((Object)enemy.enemyType.enemyPrefab).name + " < to the Enemy list\n\n"));
}
}
}
}
}
public static EventEnum SelectRandomEvent()
{
var list = (from kvp in eventWeightEntries
where kvp.Value.Value > 0
select new
{
Event = kvp.Key,
Weight = kvp.Value.Value
}).ToList();
if (list.Count == 0)
{
return EventEnum.None;
}
int num = list.Sum(e => e.Weight);
int num2 = Random.Range(0, num);
int num3 = 0;
foreach (var item in list)
{
num3 += item.Weight;
if (num2 < num3)
{
Variables.lastEvent = item.Event;
return item.Event;
}
}
return EventEnum.None;
}
public static void ApplyCustomLevelEnemyRarities(List<SpawnableEnemyWithRarity> enemies, string levelName)
{
if (VanillaRaritySettings.Value)
{
return;
}
try
{
BcpLogger.Log("Applying custom rarities for level: " + levelName);
ConfigEntry<string> configForLevel = GetConfigForLevel(levelName);
BcpLogger.Log("Config for level " + levelName + ": " + configForLevel?.Value);
if (configForLevel == null || string.IsNullOrWhiteSpace(configForLevel.Value))
{
BcpLogger.Log("No custom config found or config is empty for level " + levelName + ". Using default rarities.");
return;
}
Dictionary<string, int> dictionary = (from r in configForLevel.Value.Split(new char[1] { ',' })
select r.Split(new char[1] { ':' }) into r
where r.Length == 2
select r).ToDictionary((string[] r) => r[0].Trim(), (string[] r) => int.Parse(r[1]));
if (!Variables.DefaultEnemyRarities.TryGetValue(levelName, out var value))
{
BcpLogger.Log("No default rarities found for level " + levelName);
return;
}
foreach (SpawnableEnemyWithRarity enemy in enemies)
{
int value4;
if (dictionary.TryGetValue(enemy.enemyType.enemyName, out var value2))
{
int value3;
if (value2 != -1)
{
BcpLogger.Log($"Setting custom rarity for {enemy.enemyType.enemyName} to {value2}");
enemy.rarity = value2;
}
else if (value.TryGetValue(enemy.enemyType.enemyName, out value3))
{
BcpLogger.Log($"Using default rarity for {enemy.enemyType.enemyName}: {value3}");
enemy.rarity = value3;
}
}
else if (value.TryGetValue(enemy.enemyType.enemyName, out value4))
{
BcpLogger.Log($"No custom rarity for {enemy.enemyType.enemyName}. Using default rarity: {value4}");
enemy.rarity = value4;
}
else
{
BcpLogger.Log("No rarity information found for " + enemy.enemyType.enemyName + ". Skipping.");
}
}
}
catch (Exception ex)
{
BcpLogger.Log("Exception in ApplyCustomLevelEnemyRarities: " + ex.ToString());
}
}
private static ConfigEntry<string> GetConfigForLevel(string levelName)
{
return (ConfigEntry<string>)(levelName switch
{
"ExperimentationLevel" => ExperimentationLevelRarities,
"AssuranceLevel" => AssuranceLevelRarities,
"VowLevel" => VowLevelRarities,
"MarchLevel" => MarchLevelRarities,
"RendLevel" => RendLevelRarities,
"DineLevel" => DineLevelRarities,
"OffenseLevel" => OffenseLevelRarities,
"TitanLevel" => TitanLevelRarities,
_ => null,
});
}
public static void UpdateLevelEnemies(SelectableLevel newLevel, float MoonHeat)
{
if (Variables.levelEnemySpawns.TryGetValue(newLevel, out var value))
{
ApplyCustomLevelEnemyRarities(value, ((Object)newLevel).name);
newLevel.Enemies = value;
}
}
public static void InitializeLevelHeatValues(SelectableLevel newLevel)
{
if (!Variables.levelHeatVal.ContainsKey(newLevel))
{
Variables.levelHeatVal.Add(newLevel, 0f);
}
if (Variables.levelEnemySpawns.ContainsKey(newLevel))
{
return;
}
List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
{
list.Add(enemy);
}
Variables.levelEnemySpawns.Add(newLevel, list);
}
public static void AdjustHeatValuesForAllLevels(EventEnum eventEnum, SelectableLevel newLevel)
{
foreach (SelectableLevel item in Variables.levelHeatVal.Keys.ToList())
{
if ((Object)(object)newLevel != (Object)(object)item)
{
Variables.levelHeatVal.TryGetValue(item, out var value);
Variables.levelHeatVal[item] = Mathf.Clamp(value - MoonHeatDecreaseRate.Value, 0f, 100f);
}
if (eventEnum == EventEnum.ResetHeat)
{
Variables.levelHeatVal[item] = 0f;
}
}
}
public static float DisplayHeatMessages(SelectableLevel newLevel)
{
Variables.levelHeatVal.TryGetValue(newLevel, out var value);
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer("<color=orange>MOON IS AT " + value + "% HEAT</color>", -1);
if (value >= 20f && value < 40f)
{
HUDManager.Instance.AddTextToChatOnServer("<size=11><color=blue>Moonheat is rising and caused it to rain. <color=white>\nVisit other moons to decrease your moon heat!</color></size>", -1);
}
if (value >= 40f && value < 60f)
{
HUDManager.Instance.AddTextToChatOnServer("<size=11><color=purple>Moonheat is rising causing a layer of fog. <color=white>\nVisit other moons to decrease your moon heat!</color></size>", -1);
}
if (value >= 60f && value < 80f)
{
HUDManager.Instance.AddTextToChatOnServer("<size=11><color=yellow>Moonheat is HOT, flooding the moon to cool it off. <color=white>\nVisit other moons to decrease your moon heat!</color></size>", -1);
}
if (value >= 80f && value < 100f)
{
HUDManager.Instance.AddTextToChatOnServer("<size=11><color=orange>Extremely high moonheat detected causing dangerous weather. <color=white>\nVisit other moons to decrease your moon heat!</color></size>", -1);
}
if (value >= 100f)
{
HUDManager.Instance.AddTextToChatOnServer("<size=11><color=red>The Moon is overheated and now hostile creatures roam it. <color=white>\nVisit other moons to decrease your moon heat!</color></size>", -1);
}
return value;
}
public static void HandleEventSpecificAdjustments(EventEnum eventEnum, SelectableLevel newLevel)
{
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
if (newLevel.sceneName == "CompanyBuilding")
{
HUDManager.Instance.AddTextToChatOnServer("<color=green>Welcome to the Company Buidling!</color>", -1);
return;
}
switch (eventEnum)
{
case EventEnum.None:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=green>Nothing Happened Today!</color>", -1);
break;
case EventEnum.Turret:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Turret Terror</color>", -1);
break;
case EventEnum.Landmine:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Minescape Terror</color>", -1);
break;
case EventEnum.InsideOut:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Spring Escape!</color>", -1);
Variables.SpawnInsideOut = true;
break;
case EventEnum.HoardTown:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Hoarder Town</color>", -1);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(HoarderBugAI), 8, SpawnLocation.Vent, forceinside: false, forceoutside: false));
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(HoarderBugAI), 8, SpawnLocation.Outside, forceinside: false, forceoutside: true));
break;
case EventEnum.ShadowRealm:
{
string text = "";
if (Random.Range(0, 1) == 1)
{
newLevel.currentWeather = (LevelWeatherType)3;
text = "in the mist!";
}
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>The shadows are roaming " + text + "</color>", -1);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(FlowermanAI), 6, SpawnLocation.Outside, forceinside: false, forceoutside: true));
break;
}
case EventEnum.BeastInside:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>The Beasts Inside!</color>", -1);
Functions.TheBeastsInside();
break;
case EventEnum.TheRumbling:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>The Rumbling!</color>", -1);
Functions.TheRumbling();
Variables.TheRumbling = true;
break;
case EventEnum.Sacrifice:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>The Hunger Games?</color>", -1);
Variables.Tribute = true;
break;
case EventEnum.OutsideBox:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Outside the box!</color>", -1);
Functions.FindEnemyPrefabByType(typeof(JesterAI), newLevel.Enemies, newLevel);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(JesterAI), 2, SpawnLocation.Outside, forceinside: false, forceoutside: true));
break;
case EventEnum.Guards:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>They gaurd this place!</color>", -1);
Functions.FindEnemyPrefabByType(typeof(NutcrackerEnemyAI), newLevel.Enemies, newLevel);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(NutcrackerEnemyAI), 4, SpawnLocation.Outside, forceinside: false, forceoutside: true));
break;
case EventEnum.Unfair:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>UNFAIR COMPANY</color>", -1);
break;
case EventEnum.FaceHuggers:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Bring a Shovel!!</color>", -1);
Variables.WaitUntilPlayerInside = true;
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(CentipedeAI), 15, SpawnLocation.Vent, forceinside: false, forceoutside: false));
break;
case EventEnum.BlobEvolution:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>They are EVOLVING?!?</color>", -1);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(BlobAI), 3, SpawnLocation.Vent, forceinside: false, forceoutside: false));
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(BlobAI), 1, SpawnLocation.Outside, forceinside: false, forceoutside: true));
Variables.BlobsHaveEvolved = true;
break;
case EventEnum.Delivery:
{
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=green>ICE SCREAM!!!</color>", -1);
int num = Random.Range(2, 9);
for (int i = 0; i < num; i++)
{
int item = Random.Range(0, 12);
Object.FindObjectOfType<Terminal>().orderedItemsFromTerminal.Add(item);
}
break;
}
case EventEnum.InstaJester:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Pop goes the.. HOLY FUC- </color>", -1);
Functions.FindEnemyPrefabByType(typeof(JesterAI), newLevel.Enemies, newLevel);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(JesterAI), 2, SpawnLocation.Vent, forceinside: false, forceoutside: false));
Variables.InstaJester = true;
break;
case EventEnum.TheyAreShy:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>Don't look... away?</color>", -1);
Functions.FindEnemyPrefabByType(typeof(FlowermanAI), newLevel.Enemies, newLevel);
Functions.FindEnemyPrefabByType(typeof(SpringManAI), newLevel.Enemies, newLevel);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(SpringManAI), 3, SpawnLocation.Vent, forceinside: false, forceoutside: false));
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(FlowermanAI), 3, SpawnLocation.Vent, forceinside: false, forceoutside: false));
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(FlowermanAI), 3, SpawnLocation.Outside, forceinside: false, forceoutside: true));
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(SpringManAI), 2, SpawnLocation.Outside, forceinside: false, forceoutside: true));
break;
case EventEnum.TheyWant2Play:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>They just wants to play!!</color>", -1);
Functions.FindEnemyPrefabByType(typeof(DressGirlAI), newLevel.Enemies, newLevel);
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(DressGirlAI), 5, SpawnLocation.Vent, forceinside: false, forceoutside: false));
break;
case EventEnum.SurfaceExplosion:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>The surface is explosive</color>", -1);
Variables.slSpawnTimer = -10f;
Variables.surpriseLandmines += 120;
break;
case EventEnum.ResetHeat:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=green>All Moons Heat Reset</color>", -1);
break;
case EventEnum.ShipTurret:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=red>When did we get this installed?!?</color>", -1);
Variables.shouldSpawnTurret = true;
break;
default:
HUDManager.Instance.AddTextToChatOnServer("<color=yellow>EVENT<color=white>:</color></color>\n<color=green>Nothing happened today!</color>", -1);
break;
}
}
public static void StoreOriginalEnemyList(SelectableLevel level)
{
if (!Variables.originalEnemyLists.ContainsKey(level))
{
Variables.originalEnemyLists[level] = new List<SpawnableEnemyWithRarity>(level.Enemies);
}
}
public static void ModifyCurrentLevelEnemies(SelectableLevel currentLevel, params Type[] keepEnemyTypes)
{
foreach (Type item in Variables.defaultRemovableEnemyTypes.Keys.ToList())
{
Variables.defaultRemovableEnemyTypes[item] = false;
}
foreach (Type key in keepEnemyTypes)
{
if (Variables.defaultRemovableEnemyTypes.ContainsKey(key))
{
Variables.defaultRemovableEnemyTypes[key] = true;
}
else
{
Variables.defaultRemovableEnemyTypes.Add(key, value: true);
}
}
currentLevel.Enemies.RemoveAll((SpawnableEnemyWithRarity enemy) => Variables.defaultRemovableEnemyTypes.TryGetValue(((object)enemy.enemyType).GetType(), out var value) && !value);
}
public static void RestoreOriginalEnemyList(SelectableLevel level)
{
if (Variables.originalEnemyLists.ContainsKey(level))
{
level.Enemies = Variables.originalEnemyLists[level];
Variables.originalEnemyLists.Remove(level);
}
}
public static void UpdateMapObjects(SelectableLevel newLevel, EventEnum eventEnum)
{
//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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: 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_0173: 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_0182: Expected O, but got Unknown
SpawnableMapObject[] spawnableMapObjects = newLevel.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
{
Variables.turret = val.prefabToSpawn;
if (eventEnum == EventEnum.Turret)
{
val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 200f),
new Keyframe(1f, 25f)
});
}
else if (EnableTurretModifications.Value)
{
val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 0f),
new Keyframe(1f, TurretSpawnRate.Value)
});
}
}
else if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null)
{
Variables.landmine = val.prefabToSpawn;
if (eventEnum == EventEnum.Landmine)
{
val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 300f),
new Keyframe(1f, 170f)
});
}
else if (EnableLandmineModifications.Value)
{
val.numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 0f),
new Keyframe(1f, LandmineSpawnRate.Value)
});
}
}
Variables.mls.LogInfo((object)((object)val.prefabToSpawn).ToString());
}
}
public static void LogEnemyInformation(SelectableLevel newLevel)
{
Variables.mls.LogWarning((object)"Map Objects");
SpawnableMapObject[] spawnableMapObjects = newLevel.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
Variables.mls.LogInfo((object)((object)val.prefabToSpawn).ToString());
}
Variables.mls.LogWarning((object)"Enemies");
foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
{
Variables.mls.LogInfo((object)(enemy.enemyType.enemyName + "--rarity = " + enemy.rarity));
}
}
public static void UpdateLevelProperties(SelectableLevel newLevel)
{
if (!Variables.levelsModified.Contains(newLevel))
{
Variables.levelsModified.Add(newLevel);
string[] array = GetConfigForScrapSettings(((Object)newLevel).name)?.Value.Split(new char[1] { ',' });
if (array != null && array.Length == 4)
{
newLevel.minScrap = ((array[0] != "-1") ? int.Parse(array[0]) : newLevel.minScrap);
newLevel.maxScrap = ((array[1] != "-1") ? int.Parse(array[1]) : newLevel.maxScrap);
newLevel.minTotalScrapValue = ((array[2] != "-1") ? int.Parse(array[2]) : newLevel.minTotalScrapValue);
newLevel.maxTotalScrapValue = ((array[3] != "-1") ? int.Parse(array[3]) : newLevel.maxTotalScrapValue);
}
newLevel.maxEnemyPowerCount += 150;
newLevel.maxOutsideEnemyPowerCount += 10;
newLevel.maxDaytimeEnemyPowerCount += 150;
}
}
private static ConfigEntry<string> GetConfigForScrapSettings(string levelName)
{
return (ConfigEntry<string>)(levelName switch
{
"ExperimentationLevel" => ExperimentationLevelScrap,
"AssuranceLevel" => AssuranceLevelScrap,
"VowLevel" => VowLevelScrap,
"MarchLevel" => MarchLevelScrap,
"RendLevel" => RendLevelScrap,
"DineLevel" => DineLevelScrap,
"OffenseLevel" => OffenseLevelScrap,
"TitanLevel" => TitanLevelScrap,
_ => CustomLevelScrap,
});
}
public static void ModifyEnemySpawnChances(SelectableLevel newLevel, EventEnum eventEnum, float MoonHeat)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Expected O, but got Unknown
newLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
{
new Keyframe(0f, 0.1f),
new Keyframe(0.5f, 10f),
new Keyframe(1f, 70f)
});
newLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
{
new Keyframe(0f, -30f),
new Keyframe(20f, -20f),
new Keyframe(21f, 10f)
});
if (eventEnum == EventEnum.Unfair)
{
newLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 999f),
new Keyframe(21f, 999f)
});
newLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 500f),
new Keyframe(0.5f, 500f)
});
}
}
}
}
namespace BrutalCompanyPlus.HarmPatches
{
public static class EnemyAIPatches
{
public static bool HoldState;
[HarmonyPatch(typeof(BlobAI), "Update")]
[HarmonyPostfix]
public static void BlobModifications(BlobAI __instance)
{
if (((EnemyAI)__instance).isOutside && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
if (Variables.BlobsHaveEvolved && ((NetworkBehaviour)RoundManager.Instance).IsHost)
{
if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
return;
}
((EnemyAI)__instance).agent.speed = 3.8f;
Functions.OpenDoors();
}
}
[HarmonyPatch(typeof(FlowermanAI), "Update")]
[HarmonyPostfix]
public static void FlowerManModifications(FlowermanAI __instance)
{
if (((EnemyAI)__instance).isOutside && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
}
[HarmonyPatch(typeof(HoarderBugAI), "Update")]
[HarmonyPostfix]
public static void HoarderBugModifications(HoarderBugAI __instance)
{
if (((EnemyAI)__instance).isOutside && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
}
[HarmonyPatch(typeof(JesterAI), "Update")]
[HarmonyPostfix]
public static void InsideOutJesterModifications(JesterAI __instance)
{
if (!((NetworkBehaviour)RoundManager.Instance).IsHost || !((EnemyAI)__instance).isOutside)
{
return;
}
if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
if (((EnemyAI)__instance).previousBehaviourStateIndex != 1 && !HoldState)
{
return;
}
((EnemyAI)__instance).SwitchToBehaviourState(2);
((EnemyAI)__instance).agent.stoppingDistance = 0f;
HoldState = true;
bool flag = true;
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (!StartOfRound.Instance.allPlayerScripts[i].isInsideFactory && StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled)
{
flag = false;
break;
}
}
if (flag || StartOfRound.Instance.shipIsLeaving)
{
((EnemyAI)__instance).previousBehaviourStateIndex = 0;
((EnemyAI)__instance).agent.stoppingDistance = 4f;
((EnemyAI)__instance).SwitchToBehaviourState(0);
HoldState = false;
}
}
[HarmonyPatch(typeof(SpringManAI), "Update")]
[HarmonyPostfix]
public static void InsideOutSpringManModifications(SpringManAI __instance)
{
if (((EnemyAI)__instance).isOutside && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
}
[HarmonyPatch(typeof(EnemyAI), "StartSearch")]
[HarmonyPrefix]
public static bool InsideOutStartSearchModification(EnemyAI __instance, ref Vector3 startOfSearch, AISearchRoutine newSearch)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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)
if (Variables.InsideOutOwnership && ((NetworkBehaviour)RoundManager.Instance).IsHost && Variables.SpawnedInsideOutID.Contains(((Object)__instance).GetInstanceID()))
{
Vector3 position = StartOfRound.Instance.playerSpawnPositions[0].position;
startOfSearch = Functions.GetNearbyLocation(position);
Variables.mls.LogError((object)"Changed Search Start Location of Enemy insideOut");
return true;
}
return true;
}
[HarmonyPatch(typeof(JesterAI), "Update")]
[HarmonyPostfix]
public static void InstaJesterModifications(JesterAI __instance)
{
if (Variables.InstaJester && ((NetworkBehaviour)RoundManager.Instance).IsHost)
{
if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId && ((EnemyAI)__instance).currentBehaviourStateIndex < 2)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
else if (((EnemyAI)__instance).currentBehaviourStateIndex == 1 && __instance.popUpTimer > 10f)
{
__instance.popUpTimer = Random.Range(0f, 10f);
}
}
}
[HarmonyPatch(typeof(ForestGiantAI), "Update")]
[HarmonyPostfix]
public static void RumblingForestGiantModifications(ForestGiantAI __instance, bool ___inEatingPlayerAnimation)
{
if (Variables.TheRumbling && ((NetworkBehaviour)RoundManager.Instance).IsHost)
{
if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId && ((EnemyAI)__instance).currentBehaviourStateIndex < 2)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
else if (((EnemyAI)__instance).currentBehaviourStateIndex == 1 && !___inEatingPlayerAnimation)
{
((EnemyAI)__instance).agent.speed = 6f;
}
}
}
[HarmonyPatch(typeof(MouthDogAI), "Update")]
[HarmonyPostfix]
public static void InsideMouthDogModifications(MouthDogAI __instance)
{
if (Variables.DogForceOwnership && ((NetworkBehaviour)RoundManager.Instance).IsHost && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
}
}
[HarmonyPatch(typeof(MouthDogAI), "OnCollideWithPlayer")]
[HarmonyPrefix]
public static bool MouthDogAIOnCollideWithPlayerPatch(MouthDogAI __instance, ref Collider other, bool ___inKillAnimation, Collider ___debugCollider, bool ___inLunge, Ray ___ray, RaycastHit ___rayHit, RoundManager ___roundManager)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: 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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
if (Variables.DogForceOwnership && ((NetworkBehaviour)RoundManager.Instance).IsHost)
{
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && !___inKillAnimation)
{
Vector3 val = Vector3.Normalize((((Component)__instance).transform.position + Vector3.up - ((Component)component.gameplayCamera).transform.position) * 100f);
RaycastHit val2 = default(RaycastHit);
if (Physics.Linecast(((Component)__instance).transform.position + Vector3.up + val * 0.5f, ((Component)component.gameplayCamera).transform.position, ref val2, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1))
{
if ((Object)(object)((RaycastHit)(ref val2)).collider == (Object)(object)___debugCollider)
{
return false;
}
___debugCollider = ((RaycastHit)(ref val2)).collider;
return false;
}
if (((EnemyAI)__instance).currentBehaviourStateIndex == 3)
{
component.inAnimationWithEnemy = (EnemyAI)(object)__instance;
__instance.KillPlayerServerRpc((int)component.playerClientId);
return false;
}
if (((EnemyAI)__instance).currentBehaviourStateIndex == 0 || ((EnemyAI)__instance).currentBehaviourStateIndex == 1)
{
((EnemyAI)__instance).SwitchToBehaviourState(2);
((EnemyAI)__instance).SetDestinationToPosition(((Component)component).transform.position, false);
return false;
}
if (((EnemyAI)__instance).currentBehaviourStateIndex == 2 && !___inLunge)
{
((Component)__instance).transform.LookAt(((Component)other).transform.position);
((Component)__instance).transform.localEulerAngles = new Vector3(0f, ((Component)__instance).transform.eulerAngles.y, 0f);
___inLunge = true;
Functions.EnterLunge(__instance, ___ray, ___rayHit, ___roundManager);
return false;
}
}
}
return true;
}
[HarmonyPatch(typeof(FlowermanAI), "OnCollideWithPlayer")]
[HarmonyPostfix]
public static void FlowerManAIOnCollideWithPlayerPatch(FlowermanAI __instance, ref Collider other, bool ___startingKillAnimationLocalClient)
{
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && !__instance.inKillAnimation && !((EnemyAI)__instance).isEnemyDead && !___startingKillAnimationLocalClient)
{
__instance.KillPlayerAnimationServerRpc((int)component.playerClientId);
___startingKillAnimationLocalClient = true;
}
}
[HarmonyPatch(typeof(JesterAI), "OnCollideWithPlayer")]
[HarmonyPostfix]
public static void JesterAIOnCollideWithPlayerPatch(JesterAI __instance, ref Collider other, bool ___inKillAnimation)
{
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && !___inKillAnimation && !((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).currentBehaviourStateIndex == 2)
{
__instance.KillPlayerServerRpc((int)component.playerClientId);
___inKillAnimation = true;
}
}
[HarmonyPatch(typeof(BlobAI), "OnCollideWithPlayer")]
[HarmonyPostfix]
public static void BlobAIOnCollideWithPlayerPatch(BlobAI __instance, ref Collider other)
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component != (Object)null) || component.isPlayerDead || !component.isPlayerControlled)
{
return;
}
Type typeFromHandle = typeof(BlobAI);
FieldInfo field = typeFromHandle.GetField("timeSinceHittingLocalPlayer", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field2 = typeFromHandle.GetField("tamedTimer", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field3 = typeFromHandle.GetField("angeredTimer", BindingFlags.Instance | BindingFlags.NonPublic);
if (!((float)field.GetValue(__instance) < 0.25f) && (!((float)field2.GetValue(__instance) > 0f) || !((float)field3.GetValue(__instance) < 0f)))
{
field.SetValue(__instance, 0);
component.DamagePlayer(35, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
if (component.isPlayerDead)
{
__instance.SlimeKillPlayerEffectServerRpc((int)component.playerClientId);
}
}
}
[HarmonyPatch(typeof(HoarderBugAI), "OnCollideWithPlayer")]
[HarmonyPostfix]
public static void HoarderBugAIOnCollideWithPlayerPatch(HoarderBugAI __instance, ref Collider other)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component != (Object)null) || component.isPlayerDead || !component.isPlayerControlled)
{
return;
}
Type typeFromHandle = typeof(HoarderBugAI);
FieldInfo field = typeFromHandle.GetField("timeSinceHittingPlayer", BindingFlags.Instance | BindingFlags.NonPublic);
if ((bool)typeFromHandle.GetField("inChase", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance) && !((float)field.GetValue(__instance) < 0.5f))
{
field.SetValue(__instance, 0);
component.DamagePlayer(30, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
if (component.isPlayerDead)
{
__instance.HitPlayerServerRpc();
}
}
}
}
public static class LevelEventsPatches
{
public static bool test;
public static bool test2;
public static bool test3;
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPrefix]
private static bool ModifyLevel(ref SelectableLevel newLevel)
{
if (!((NetworkBehaviour)RoundManager.Instance).IsHost)
{
return true;
}
Plugin.CleanupAndResetAI();
Plugin.UpdateAIInNewLevel(newLevel);
Plugin.AddMissingAIToNewLevel(newLevel);
Variables.CurrentLevel = newLevel;
EventEnum eventEnum = Plugin.SelectRandomEvent();
Plugin.InitializeLevelHeatValues(newLevel);
Plugin.AdjustHeatValuesForAllLevels(eventEnum, newLevel);
Variables.CurrentLevelHeatValue = Plugin.DisplayHeatMessages(newLevel);
Plugin.ApplyCustomLevelEnemyRarities(newLevel.Enemies, ((Object)newLevel).name);
Plugin.HandleEventSpecificAdjustments(eventEnum, newLevel);
Plugin.UpdateMapObjects(newLevel, eventEnum);
Plugin.LogEnemyInformation(newLevel);
Plugin.UpdateLevelProperties(newLevel);
Plugin.ModifyEnemySpawnChances(newLevel, eventEnum, Variables.CurrentLevelHeatValue);
Variables.levelHeatVal.TryGetValue(newLevel, out var value);
Variables.levelHeatVal[newLevel] = Mathf.Clamp(value + Plugin.MoonHeatIncreaseRate.Value, 0f, 100f);
return true;
}
}
public static class QuotaPatches
{
[HarmonyPatch(typeof(TimeOfDay), "Awake")]
[HarmonyPostfix]
private static void ModifyTimeOfDay(TimeOfDay __instance)
{
Variables.mls.LogWarning((object)"Modifying the Starting Quota Values based on Config");
__instance.quotaVariables.deadlineDaysAmount = Plugin.DeadlineDaysAmount.Value;
__instance.quotaVariables.startingCredits = Plugin.StartingCredits.Value;
__instance.quotaVariables.startingQuota = Plugin.StartingQuota.Value;
__instance.quotaVariables.baseIncrease = Plugin.BaseIncrease.Value;
}
[HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")]
[HarmonyPostfix]
public static void ResetMoonHeatOnFire(GameNetworkManager __instance)
{
foreach (SelectableLevel item in Variables.levelHeatVal.Keys.ToList())
{
if (Variables.levelHeatVal.Count != 0)
{
Variables.levelHeatVal[item] = 0f;
}
}
}
[HarmonyPatch(typeof(DeleteFileButton), "DeleteFile")]
[HarmonyPostfix]
public static void ResetMoonHeatOnDeleteFile(DeleteFileButton __instance)
{
foreach (SelectableLevel item in Variables.levelHeatVal.Keys.ToList())
{
if (Variables.levelHeatVal.Count != 0)
{
Variables.levelHeatVal[item] = 0f;
}
}
}
}
}
namespace BrutalCompanyPlus.BCP
{
public class BcpLogger
{
private static string logFilePath;
private const long MaxFileSize = 524288000L;
static BcpLogger()
{
try
{
logFilePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bcp_logDUMP.txt");
if (!File.Exists(logFilePath))
{
File.Create(logFilePath).Dispose();
}
}
catch (Exception ex)
{
Variables.mls.LogError((object)("Error in BcpLogger static constructor: " + ex.Message));
}
}
public static void Log(string message)
{
try
{
if (new FileInfo(logFilePath).Length > 524288000)
{
File.WriteAllText(logFilePath, "");
}
using StreamWriter streamWriter = File.AppendText(logFilePath);
streamWriter.WriteLine($"{DateTime.Now}: {message}\n");
}
catch (Exception ex)
{
Variables.mls.LogError((object)("--------- Error in logging: " + ex.Message + " ---------"));
}
}
public static void Close()
{
Log("---End of Session---");
}
public static void Start()
{
Log("---Start of Session---");
}
}
public static class Functions
{
public static void AddSpecificEnemiesForEvent(SelectableLevel newLevel, List<Type> enemyAITypes)
{
SelectableLevel[] levels = StartOfRound.Instance.levels;
for (int i = 0; i < levels.Length; i++)
{
foreach (SpawnableEnemyWithRarity enemy in levels[i].Enemies)
{
GameObject enemyPrefab = enemy.enemyType.enemyPrefab;
foreach (Type enemyAIType in enemyAITypes)
{
if ((Object)(object)enemyPrefab.GetComponent(enemyAIType) != (Object)null && !newLevel.Enemies.Any((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType.enemyPrefab == (Object)(object)enemyPrefab))
{
newLevel.Enemies.Add(enemy);
Variables.mls.LogInfo((object)("Added specific Enemy: > " + ((Object)enemy.enemyType.enemyPrefab).name + " < for event"));
}
}
}
}
}
public static GameObject FindEnemyPrefabByType(Type enemyType, List<SpawnableEnemyWithRarity> enemyList, SelectableLevel newLevel)
{
foreach (SpawnableEnemyWithRarity enemy in enemyList)
{
if ((Object)(object)enemy.enemyType.enemyPrefab.GetComponent(enemyType) != (Object)null)
{
return enemy.enemyType.enemyPrefab;
}
}
AddSpecificEnemiesForEvent(newLevel, new List<Type> { enemyType });
foreach (SpawnableEnemyWithRarity enemy2 in newLevel.Enemies)
{
if ((Object)(object)enemy2.enemyType.enemyPrefab.GetComponent(enemyType) != (Object)null)
{
return enemy2.enemyType.enemyPrefab;
}
}
throw new Exception("Enemy type " + enemyType.Name + " not found and could not be added.");
}
public static EnemyAI SpawnEnemyOutside(Type enemyType, bool ForceOutside)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
GameObject val = null;
val = ((!ForceOutside) ? FindEnemyPrefabByType(enemyType, RoundManager.Instance.currentLevel.OutsideEnemies, Variables.CurrentLevel) : FindEnemyPrefabByType(enemyType, RoundManager.Instance.currentLevel.Enemies, Variables.CurrentLevel));
GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
Vector3 position = array[Random.Range(0, array.Length)].transform.position;
GameObject obj = Object.Instantiate<GameObject>(val, position, Quaternion.identity);
obj.GetComponentInChildren<NetworkObject>().Spawn(true);
EnemyAI component = obj.GetComponent<EnemyAI>();
if (ForceOutside)
{
component.enemyType.isOutsideEnemy = true;
component.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
component.SyncPositionToClients();
}
RoundManager.Instance.SpawnedEnemies.Add(component);
return component;
}
public static EnemyAI SpawnEnemyFromVent(Type enemyType, bool ForceInside)
{
//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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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_0094: Unknown result type (might be due to invalid IL or missing references)
GameObject val = null;
val = ((!ForceInside) ? FindEnemyPrefabByType(enemyType, RoundManager.Instance.currentLevel.Enemies, Variables.CurrentLevel) : FindEnemyPrefabByType(enemyType, RoundManager.Instance.currentLevel.OutsideEnemies, Variables.CurrentLevel));
int num = Random.Range(0, RoundManager.Instance.allEnemyVents.Length);
Vector3 position = RoundManager.Instance.allEnemyVents[num].floorNode.position;
Quaternion val2 = Quaternion.Euler(0f, RoundManager.Instance.allEnemyVents[num].floorNode.eulerAngles.y, 0f);
GameObject obj = Object.Instantiate<GameObject>(val, position, val2);
obj.GetComponentInChildren<NetworkObject>().Spawn(true);
EnemyAI component = obj.GetComponent<EnemyAI>();
if (ForceInside)
{
component.enemyType.isOutsideEnemy = false;
component.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
component.SyncPositionToClients();
}
RoundManager.Instance.SpawnedEnemies.Add(component);
return component;
}
public static void SpawnMultipleEnemies(List<Variables.EnemySpawnInfo> enemiesToSpawn)
{
foreach (Variables.EnemySpawnInfo item in enemiesToSpawn)
{
for (int i = 0; i < item.Amount; i++)
{
switch (item.Location)
{
case SpawnLocation.Outside:
SpawnEnemyOutside(item.EnemyType, item.ForceOutside);
break;
case SpawnLocation.Vent:
SpawnEnemyFromVent(item.EnemyType, item.ForceInside);
break;
}
}
}
}
public static void TheBeastsInside()
{
string sceneName = Variables.CurrentLevel.sceneName;
int num = 0;
Variables.DogForceOwnership = true;
switch (sceneName)
{
case "Titan":
num = 6;
break;
case "Rend":
case "Dine":
num = 4;
break;
case "March":
case "Offense":
num = 3;
break;
default:
num = 2;
break;
}
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(MouthDogAI), num, SpawnLocation.Vent, forceinside: true, forceoutside: false));
}
public static void TheRumbling()
{
string sceneName = Variables.CurrentLevel.sceneName;
int num = 0;
switch (sceneName)
{
case "March":
case "Titan":
case "Offense":
case "Vow":
num = 8;
break;
case "Dine":
case "Rend":
num = 10;
break;
case "Experimentation":
num = 6;
break;
default:
num = 8;
break;
}
Variables.presetEnemiesToSpawn.Add(new Variables.EnemySpawnInfo(typeof(ForestGiantAI), num, SpawnLocation.Outside, forceinside: false, forceoutside: false));
}
public static void InsideOutEnemies()
{
Variables.InsideOutOwnership = true;
for (int i = 0; i < 4; i++)
{
EnemyAI val = SpawnEnemyOutside(typeof(SpringManAI), ForceOutside: true);
Variables.SpawnedInsideOutID.Add(((Object)val).GetInstanceID());
}
}
public static void SetLightningStrikeInterval()
{
Variables.lightningStrikeInterval = Random.Range(0f, 10f);
}
public static void LightningStrikeRandom()
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
if (Variables.Smite_outsideNodes == null || Variables.Smite_outsideNodes.Length == 0)
{
Variables.mls.LogError((object)"Smite_outsideNodes is null or empty.");
InitializeSmiteOutsideNodes();
if (Variables.Smite_outsideNodes == null || Variables.Smite_outsideNodes.Length == 0)
{
return;
}
}
try
{
Vector3 val;
if (Variables.Smite_seed.Next(0, 100) < 60 && (Variables.randomThunderTime - Variables.timeAtLastStrike) * (float)TimeOfDay.Instance.currentWeatherVariable < 3f)
{
val = Variables.lastRandomStrikePosition;
}
else
{
int num = Variables.Smite_seed.Next(0, Variables.Smite_outsideNodes.Length);
val = Variables.Smite_outsideNodes[num].transform.position;
val = (Variables.lastRandomStrikePosition = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(val, 15f, Variables.Smite_navHit, Variables.Smite_seed, -1));
}
if (StartOfRound.Instance.shipHasLanded)
{
RoundManager.Instance.LightningStrikeServerRpc(val);
}
}
catch (Exception ex)
{
Variables.mls.LogError((object)("Error in LightningStrikeRandom: " + ex.Message + "\nStack Trace: " + ex.StackTrace));
BcpLogger.Log("Error in LightningStrikeRandom: " + ex.Message + "\nStack Trace: " + ex.StackTrace);
}
}
public static void InitializeSmiteOutsideNodes()
{
Variables.Smite_outsideNodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
if (Variables.Smite_outsideNodes != null && Variables.Smite_outsideNodes.Length != 0)
{
Variables.mls.LogInfo((object)$"Found {Variables.Smite_outsideNodes.Length} OutsideAINode objects.");
}
else
{
Variables.mls.LogError((object)"No OutsideAINode objects found in the scene.");
}
}
public static void SurfaceExplosionLoop()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
if (Variables.slSpawnTimer > 0f)
{
Variables.slSpawnTimer = Random.Range(-4, -1);
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
PlayerControllerB val = allPlayerScripts[Random.Range(0, allPlayerScripts.Length)];
if ((Object)(object)val != (Object)null && !val.isInHangarShipRoom && !val.isInsideFactory)
{
if (Vector3.Distance(((Component)val).transform.position, new Vector3(9.33f, 5.2f, 1021f)) < 1f)
{
Variables.slSpawnTimer = 1f;
return;
}
GameObject val2 = Object.Instantiate<GameObject>(Variables.landmine, ((Component)val).transform.position, Quaternion.identity);
val2.transform.position = ((Component)val).transform.position;
Variables.mls.LogWarning((object)((Component)val).transform.position);
val2.GetComponent<NetworkObject>().Spawn(true);
Variables.objectsToCleanUp.Add(val2);
}
}
else
{
Variables.slSpawnTimer += Time.deltaTime;
}
}
public static void HungerGamesLoop()
{
if (Variables.sacrificeTargetChangeTimer >= Variables.TargetChangeInterval || (Object)(object)Variables.SacrificeTarget == (Object)null || !Variables.SacrificeTarget.isPlayerControlled)
{
PickNewSacrificeTarget();
Variables.sacrificeTargetChangeTimer = 0f;
}
if ((Object)(object)Variables.SacrificeTarget != (Object)null && Variables.SacrificeTarget.isInsideFactory)
{
ApplySacrificeEffect();
Variables.Tribute = false;
}
}
public static void PickNewSacrificeTarget()
{
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
if (allPlayerScripts.Length != 0)
{
Variables.SacrificeTarget = allPlayerScripts[Random.Range(0, allPlayerScripts.Length)];
}
}
public static void ApplySacrificeEffect()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
if (!Variables.SacrificeTarget.isPlayerDead)
{
HUDManager.Instance.AddTextToChatOnServer("<color=purple>" + Variables.SacrificeTarget.playerUsername + "</color> <color=orange>volunteered as Tribute!</color>", -1);
Variables.SacrificeTarget.DamagePlayerFromOtherClientServerRpc(500, default(Vector3), (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
}
}
public static void EnterLunge(MouthDogAI __instance, Ray ray, RaycastHit rayHit, RoundManager roundManager)
{
//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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0055: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)__instance).SwitchToBehaviourState(3);
__instance.endingLunge = false;
((Ray)(ref ray))..ctor(((Component)__instance).transform.position + Vector3.up, ((Component)__instance).transform.forward);
Vector3 val = ((!Physics.Raycast(ray, ref rayHit, 17f, StartOfRound.Instance.collidersAndRoomMask)) ? ((Ray)(ref ray)).GetPoint(17f) : ((RaycastHit)(ref rayHit)).point);
val = roundManager.GetNavMeshPosition(val, default(NavMeshHit), 5f, -1);
((EnemyAI)__instance).SetDestinationToPosition(val, false);
((EnemyAI)__instance).agent.speed = 13f;
}
public static Vector3 GetNearbyLocation(Vector3 baseLocation)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
float num = 10f;
Vector3 val = Random.insideUnitSphere * num;
return baseLocation + val;
}
public static void OpenDoors()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
DoorLock[] array = Object.FindObjectsOfType<DoorLock>();
foreach (DoorLock val in array)
{
Collider[] array2 = Physics.OverlapSphere(((Component)val).transform.position, 2f);
bool flag = false;
Collider[] array3 = array2;
for (int j = 0; j < array3.Length; j++)
{
if (((Component)array3[j]).CompareTag("Enemy"))
{
flag = true;
break;
}
}
if (flag)
{
FieldInfo field = typeof(DoorLock).GetField("isDoorOpened", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
break;
}
if (!val.isLocked && !(bool)field.GetValue(val))
{
val.OpenOrCloseDoor((PlayerControllerB)null);
}
}
}
}
public static void LogEnemyList(SelectableLevel level)
{
if (!((Object)(object)level != (Object)null) || level.Enemies.Count <= 0)
{
return;
}
foreach (SpawnableEnemyWithRarity enemy in level.Enemies)
{
BcpLogger.Log($"{enemy.enemyType.enemyName} with a Rarity of {enemy.rarity} on {level.sceneName}");
}
}
public static void CloneEnemyList(SelectableLevel level)
{
if (!((Object)(object)level != (Object)null) || level.Enemies.Count <= 0)
{
return;
}
foreach (SpawnableEnemyWithRarity enemy in level.Enemies)
{
Variables.OriginalEnemyListWithRarity.Add(enemy);
BcpLogger.Log($"{enemy.enemyType.enemyName} with a Rarity of {enemy.rarity} on {level.sceneName}");
}
}
public static void SetEnemyListOriginalState(SelectableLevel level)
{
if (!((Object)(object)level != (Object)null) || Variables.OriginalEnemyListWithRarity.Count <= 0)
{
return;
}
level.Enemies.Clear();
foreach (SpawnableEnemyWithRarity item in Variables.OriginalEnemyListWithRarity)
{
level.Enemies.Add(item);
BcpLogger.Log($"Reverting {item.enemyType.enemyName} with a Rarity of {item.rarity} on {level.sceneName}");
}
Variables.OriginalEnemyListWithRarity.Clear();
}
public static void CleanUpAllVariables()
{
Variables.DogForceOwnership = false;
Variables.InsideOutOwnership = false;
Variables.BlobsHaveEvolved = false;
Variables.InstaJester = false;
Variables.TheRumbling = false;
Variables.SmiteEnabled = false;
Variables.SacrificeTarget = null;
Variables.Tribute = false;
Variables.SpawnInsideOut = false;
Variables.WaitUntilPlayerInside = false;
Variables.Landed = false;
Variables.sacrificeTargetChangeTimer = 0f;
Variables.surpriseLandmines = -1;
Variables.SpawnedInsideOutID.Clear();
Variables.presetEnemiesToSpawn.Clear();
Variables.DogsSpawnedInside.Clear();
foreach (Type item in Variables.aiPresence.Keys.ToList())
{
Variables.aiPresence[item] = false;
}
}
}
public static class Variables
{
public struct EnemySpawnInfo
{
public Type EnemyType;
public int Amount;
public SpawnLocation Location;
public bool ForceInside;
public bool ForceOutside;
public EnemySpawnInfo(Type enemyType, int amount, SpawnLocation location, bool forceinside, bool forceoutside)
{
EnemyType = enemyType;
Amount = amount;
Location = location;
ForceInside = forceinside;
ForceOutside = forceoutside;
}
}
public static bool BlobsHaveEvolved = false;
public static bool InstaJester = false;
public static bool WaitUntilPlayerInside = false;
public static PlayerControllerB SacrificeTarget = null;
public static bool Tribute = false;
public static float sacrificeTargetChangeTimer = 0f;
public static float TargetChangeInterval = 30f;
public static HashSet<int> DogsSpawnedInside = new HashSet<int>();
public static bool DogForceOwnership = false;
public static bool SpawnDogsInside = false;
public static bool DogIsLunging = false;
public static HashSet<int> SpawnedInsideOutID = new HashSet<int>();
public static bool InsideOutOwnership = false;
public static bool SpawnInsideOut = false;
public static List<SpawnableEnemyWithRarity> OriginalEnemyListWithRarity = new List<SpawnableEnemyWithRarity>();
public static bool TheRumbling = false;
public static float timeNearDoor = 0f;
public static float requiredTime = 2f;
public static bool Landed = false;
public static bool TakeOffExecuted = false;
public static TimeOfDay TOD;
public static float messageTimer = 58f;
public static int surpriseLandmines;
public static GameObject landmine;
public static GameObject turret;
public static List<GameObject> objectsToCleanUp = new List<GameObject>();
public static float slSpawnTimer;
public static bool shouldSpawnTurret;
public static bool TurretSpawned = false;
public static bool loaded;
public static EventEnum lastEvent = EventEnum.None;
public static float CurrentLevelHeatValue = 0f;
public static readonly Harmony _harmony = new Harmony("BrutalCompanyPlus");
public static SelectableLevel CurrentLevel = null;
public static List<SelectableLevel> levelsModified = new List<SelectableLevel>();
public static Dictionary<SelectableLevel, float> levelHeatVal;
public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns;
public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys;
public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves;
public static ManualLogSource mls;
public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> originalEnemyLists = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
public static Dictionary<Type, bool> defaultRemovableEnemyTypes = new Dictionary<Type, bool>
{
{
typeof(BlobAI),
false
},
{
typeof(CentipedeAI),
false
},
{
typeof(CrawlerAI),
false
},
{
typeof(DressGirlAI),
false
},
{
typeof(FlowermanAI),
false
},
{
typeof(HoarderBugAI),
false
},
{
typeof(JesterAI),
false
},
{
typeof(PufferAI),
false
},
{
typeof(SandSpiderAI),
false
},
{
typeof(SpringManAI),
false
},
{
typeof(NutcrackerEnemyAI),
false
},
{
typeof(MaskedPlayerEnemy),
false
}
};
public static Dictionary<Type, bool> aiPresence = new Dictionary<Type, bool>
{
{
typeof(BaboonBirdAI),
false
},
{
typeof(BlobAI),
false
},
{
typeof(CentipedeAI),
false
},
{
typeof(CrawlerAI),
false
},
{
typeof(DoublewingAI),
false
},
{
typeof(DressGirlAI),
false
},
{
typeof(FlowermanAI),
false
},
{
typeof(ForestGiantAI),
false
},
{
typeof(HoarderBugAI),
false
},
{
typeof(JesterAI),
false
},
{
typeof(MouthDogAI),
false
},
{
typeof(PufferAI),
false
},
{
typeof(RedLocustBees),
false
},
{
typeof(SandSpiderAI),
false
},
{
typeof(SandWormAI),
false
},
{
typeof(SpringManAI),
false
},
{
typeof(NutcrackerEnemyAI),
false
},
{
typeof(MaskedPlayerEnemy),
false
}
};
public static Dictionary<string, Dictionary<string, int>> DefaultEnemyRarities = new Dictionary<string, Dictionary<string, int>>();
public static Random Smite_seed = new Random();
public static GameObject[] Smite_outsideNodes;
public static Vector3 lastRandomStrikePosition;
public static float timeAtLastStrike;
public static float randomThunderTime;
public static NavMeshHit Smite_navHit;
public static float lightningStrikeInterval = 3f;
public static float lastStrikeTime;
public static bool SmiteEnabled = false;
public static List<EnemySpawnInfo> presetEnemiesToSpawn = new List<EnemySpawnInfo>();
}
public class BrutalPlus : MonoBehaviour
{
public void Awake()
{
Variables.mls.LogWarning((object)"Brutal Plus is Awake");
}
public void Start()
{
BcpLogger.Start();
}
public void OnDestroy()
{
BcpLogger.Close();
}
private void Update()
{
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!((Object)(object)StartOfRound.Instance != (Object)null) || !((NetworkBehaviour)RoundManager.Instance).IsHost)
{
return;
}
if (Variables.SmiteEnabled)
{
Functions.SetLightningStrikeInterval();
if (Time.time - Variables.lastStrikeTime > Variables.lightningStrikeInterval)
{
Functions.LightningStrikeRandom();
Variables.lastStrikeTime = Time.time;
}
}
if (Variables.Tribute)
{
Functions.HungerGamesLoop();
}
if (Variables.surpriseLandmines > 0 && Variables.Landed)
{
Functions.SurfaceExplosionLoop();
}
if (Variables.shouldSpawnTurret & ((Object)(object)Variables.turret != (Object)null))
{
Variables.shouldSpawnTurret = false;
Variables.TurretSpawned = true;
GameObject val = Object.Instantiate<GameObject>(Variables.turret, new Vector3(3.87f, 0.84f, -14.23f), Quaternion.identity);
val.transform.position = new Vector3(3.87f, 0.84f, -14.23f);
val.transform.forward = new Vector3(1f, 0f, 0f);
val.GetComponent<NetworkObject>().Spawn(true);
Variables.objectsToCleanUp.Add(val);
}
if (Variables.presetEnemiesToSpawn.Count > 0 && Variables.WaitUntilPlayerInside)
{
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (StartOfRound.Instance.allPlayerScripts[i].isInsideFactory)
{
Functions.SpawnMultipleEnemies(Variables.presetEnemiesToSpawn);
Variables.presetEnemiesToSpawn.Clear();
}
}
}
if (StartOfRound.Instance.shipHasLanded && !Variables.Landed)
{
Variables.Landed = true;
if (Variables.presetEnemiesToSpawn.Count > 0 && !Variables.WaitUntilPlayerInside)
{
Functions.SpawnMultipleEnemies(Variables.presetEnemiesToSpawn);
}
if (Variables.SpawnInsideOut)
{
Functions.InsideOutEnemies();
}
}
if (StartOfRound.Instance.shipIsLeaving)
{
if (Variables.TakeOffExecuted)
{
return;
}
if (Plugin.EnableFreeMoney.Value)
{
if (!StartOfRound.Instance.allPlayersDead)
{
Terminal val2 = Object.FindObjectOfType<Terminal>();
val2.groupCredits += Plugin.FreeMoneyValue.Value;
val2.SyncGroupCreditsServerRpc(val2.groupCredits, val2.numberOfItemsInDropship);
HUDManager.Instance.AddTextToChatOnServer("\"<size=10><color=green> You survived another day! Here's free cash c: </color></size>", -1);
}
else
{
HUDManager.Instance.AddTextToChatOnServer("\"<size=10><color=red> That was Brutal! No free cash today :c </color></size>", -1);
}
}
if (Variables.TurretSpawned)
{
Variables.mls.LogWarning((object)"Disabling Turret due to ship leaving");
Turret[] array = Object.FindObjectsOfType<Turret>();
for (int j = 0; j < array.Length; j++)
{
array[j].ToggleTurretEnabled(false);
}
Variables.TurretSpawned = false;
}
Functions.CleanUpAllVariables();
Variables.TakeOffExecuted = true;
}
else
{
Variables.TakeOffExecuted = false;
}
}
catch (Exception ex)
{
Variables.mls.LogError((object)("Error in Update: " + ex.Message));
BcpLogger.Log("Error in Update: " + ex.Message);
}
}
public static void CleanupAllSpawns()
{
foreach (GameObject item in Variables.objectsToCleanUp)
{
if ((Object)(object)item != (Object)null)
{
item.GetComponent<NetworkObject>().Despawn(true);
}
}
Variables.objectsToCleanUp.Clear();
}
}
public enum EventEnum
{
None,
Turret,
Delivery,
BlobEvolution,
Guards,
SurfaceExplosion,
FaceHuggers,
TheRumbling,
TheyWant2Play,
BeastInside,
Unfair,
InsideOut,
OutsideBox,
InstaJester,
Landmine,
Sacrifice,
ShipTurret,
ShadowRealm,
HoardTown,
TheyAreShy,
ResetHeat
}
public enum InsideEnemyEnum
{
Centipede,
SandSpider,
HoarderBug,
FlowerMan,
Crawler,
Blob,
DressGirl,
Puffer,
SpringMan,
Jester
}
public enum OutsideEnemyEnum
{
MouthDog,
ForestGiant,
SandWorm,
RedLocustBees,
DoubleWing,
DocileLocustBees
}
public enum SpawnLocation
{
Outside,
Vent
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BrutalCompanyPlus";
public const string PLUGIN_NAME = "BrutalCompanyPlus";
public const string PLUGIN_VERSION = "3.5.1";
}
}