using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Game;
using Game.Agents;
using Game.Citizens;
using Game.Common;
using Game.Modding;
using Game.Tools;
using HarmonyLib;
using MassExodus.Systems;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Entities;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MassExodus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MassExodus")]
[assembly: AssemblyCopyright("Copyright © Ranthos 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3bddd99b-6a88-4137-8609-b89e978e476b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 MassExodus
{
[BepInPlugin("com.ranthos.CS2.MassExodus", "Mass Exodus", "1.0.1")]
[HarmonyPatch]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "com.ranthos.CS2.MassExodus";
private Mod _mod;
private void Awake()
{
_mod = new Mod(((BaseUnityPlugin)this).Logger);
_mod.OnLoad();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.ranthos.CS2.MassExodus");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.ranthos.CS2.MassExodus is loaded!");
}
[HarmonyPatch(typeof(SystemOrder), "Initialize")]
[HarmonyPostfix]
private static void InjectSystems(UpdateSystem updateSystem)
{
Mod.Instance.OnCreateWorld(updateSystem);
}
}
public sealed class Mod : IMod
{
public const string ModName = "Mass Exodus";
public static Mod Instance { get; private set; }
public ManualLogSource Logger { get; private set; }
public Mod(ManualLogSource Logger)
{
this.Logger = Logger;
base..ctor();
}
public void OnCreateWorld(UpdateSystem updateSystem)
{
((ComponentSystemBase)updateSystem).World.GetOrCreateSystemManaged<MassExodusSystem>();
updateSystem.UpdateAt<MassExodusSystem>((SystemUpdatePhase)12);
}
public void OnDispose()
{
}
public void OnLoad()
{
Instance = this;
}
}
}
namespace MassExodus.Systems
{
internal sealed class MassExodusSystem : GameSystemBase
{
private EntityQuery _mainQuery;
protected override void OnCreate()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
((GameSystemBase)this).OnCreate();
Mod.Instance.Logger.LogInfo((object)"OnCreate!");
EntityQueryDesc[] array = new EntityQueryDesc[1];
EntityQueryDesc val = new EntityQueryDesc();
val.All = (ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<Household>() };
val.None = (ComponentType[])(object)new ComponentType[3]
{
ComponentType.ReadOnly<MovingAway>(),
ComponentType.ReadOnly<Deleted>(),
ComponentType.ReadOnly<Temp>()
};
array[0] = val;
_mainQuery = ((ComponentSystemBase)this).GetEntityQuery((EntityQueryDesc[])(object)array);
((ComponentSystemBase)this).RequireForUpdate(_mainQuery);
}
protected override void OnDestroy()
{
Mod.Instance.Logger.LogInfo((object)"OnDestroy!");
((GameSystemBase)this).OnDestroy();
}
protected override void OnUpdate()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
uint num = 0u;
Enumerator<Entity> enumerator = ((EntityQuery)(ref _mainQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
num++;
EntityManager entityManager = ((ComponentSystemBase)this).EntityManager;
((EntityManager)(ref entityManager)).AddComponent<MovingAway>(current);
}
}
finally
{
((IDisposable)enumerator).Dispose();
}
if (num != 0)
{
Mod.Instance.Logger.LogInfo((object)$"Found {num} households!");
}
}
}
}