using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using EntranceForge.Data;
using EntranceForge.Systems;
using EntranceForge.Utils;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.CastleBuilding;
using ProjectM.Gameplay.Systems;
using ProjectM.Shared;
using Stunlock.Core;
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: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("EntranceForge")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Fixes raiding issue, where you can breach bases faster by hitting the door frames.")]
[assembly: AssemblyFileVersion("0.1.10.0")]
[assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e")]
[assembly: AssemblyProduct("EntranceForge")]
[assembly: AssemblyTitle("EntranceForge")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.10.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace EntranceForge
{
[BepInPlugin("Entranceforge", "EntranceForge", "1.0.0")]
public class Plugin : BasePlugin
{
private Harmony _harmony;
public override void Load()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
_harmony = new Harmony("Entranceforge");
_harmony.PatchAll(typeof(Plugin).Assembly);
}
public override bool Unload()
{
if (_harmony != null)
{
_harmony.UnpatchSelf();
}
return true;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Entranceforge";
public const string PLUGIN_NAME = "EntranceForge";
public const string PLUGIN_VERSION = "1.0.0";
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "EntranceForge";
public const string PLUGIN_NAME = "EntranceForge";
public const string PLUGIN_VERSION = "0.1.10";
}
}
namespace EntranceForge.Utils
{
public static class EntityExtensions
{
private static EntityManager Em => VWorld.EntityManager;
public static bool Exists(this Entity entity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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)
int result;
if (entity.Index > 0)
{
EntityManager em = Em;
EntityManager val = default(EntityManager);
if (em != val)
{
val = Em;
result = (((EntityManager)(ref val)).Exists(entity) ? 1 : 0);
goto IL_0030;
}
}
result = 0;
goto IL_0030;
IL_0030:
return (byte)result != 0;
}
public static bool Has<T>(this Entity entity) where T : struct
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_001b: 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)
//IL_0041: 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 (!(entity == Entity.Null))
{
EntityManager em = Em;
EntityManager val = default(EntityManager);
if (!(em == val))
{
ComponentType val2 = default(ComponentType);
((ComponentType)(ref val2))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
val = Em;
return ((EntityManager)(ref val)).HasComponent(entity, val2);
}
}
return false;
}
public static bool HasBuffer<T>(this Entity entity) where T : struct
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (!(entity == Entity.Null))
{
EntityManager em = Em;
EntityManager val = default(EntityManager);
if (!(em == val))
{
val = Em;
return ((EntityManager)(ref val)).HasBuffer<T>(entity);
}
}
return false;
}
public static T Read<T>(this Entity entity) where T : struct
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_002c: Unknown result type (might be due to invalid IL or missing references)
EntityManager em = Em;
EntityManager val = default(EntityManager);
if (em == val)
{
return default(T);
}
val = Em;
return ((EntityManager)(ref val)).GetComponentData<T>(entity);
}
public static bool TryRead<T>(this Entity entity, out T component) where T : struct
{
//IL_0008: 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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
component = default(T);
if (entity.Exists() && entity.Has<T>())
{
try
{
EntityManager em = Em;
component = ((EntityManager)(ref em)).GetComponentData<T>(entity);
return true;
}
catch
{
return false;
}
}
return false;
}
public static void Write<T>(this Entity entity, T componentData) where T : struct
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
EntityManager em = Em;
EntityManager val = default(EntityManager);
if (!(em == val) && entity.Exists())
{
val = Em;
((EntityManager)(ref val)).SetComponentData<T>(entity, componentData);
}
}
public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_003e: 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_0054: Unknown result type (might be due to invalid IL or missing references)
EntityManager em = Em;
EntityManager val = default(EntityManager);
if (!(em == val) && entity.Exists())
{
val = Em;
if (((EntityManager)(ref val)).HasBuffer<T>(entity))
{
val = Em;
return ((EntityManager)(ref val)).GetBuffer<T>(entity, false);
}
}
return default(DynamicBuffer<T>);
}
public static PrefabGUID GetPrefabGUID(this Entity entity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0028: Unknown result type (might be due to invalid IL or missing references)
if (entity.Exists() && entity.Has<PrefabGUID>())
{
return entity.Read<PrefabGUID>();
}
return PrefabGUID.Empty;
}
}
public static class Helper
{
public static void DestroyEntity(Entity entity, DestroyReason destroyReason = 0, DestroyDebugReason destroyDebugReason = 0)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_0021: Unknown result type (might be due to invalid IL or missing references)
if (VWorld.IsServerWorldReady() && entity.Exists())
{
DestroyUtility.CreateDestroyEvent(VWorld.EntityManager, entity, destroyReason, destroyDebugReason);
}
}
}
public static class LoggingHelper
{
private static ManualLogSource _logger;
public static void Initialize(ManualLogSource logger)
{
_logger = logger;
}
public static void Debug(string message)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogDebug((object)message);
}
}
public static void Info(string message)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogInfo((object)message);
}
}
public static void Warning(string message)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogWarning((object)message);
}
}
public static void Error(string message)
{
ManualLogSource logger = _logger;
if (logger != null)
{
logger.LogError((object)message);
}
}
public static void Error(string message, Exception ex)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
ManualLogSource logger = _logger;
if (logger != null)
{
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(1, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
logger.LogError(val);
}
}
}
public static class VWorld
{
private static World _serverWorld;
private static EntityManager _entityManager;
public static World Server
{
get
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
if (_serverWorld != null && _serverWorld.IsCreated)
{
return _serverWorld;
}
_serverWorld = GetWorld("Server");
if (_serverWorld != null)
{
_entityManager = _serverWorld.EntityManager;
}
else
{
_entityManager = default(EntityManager);
}
return _serverWorld;
}
}
public static EntityManager EntityManager
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0072: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
if (_entityManager != default(EntityManager) && (_serverWorld == null || !_serverWorld.IsCreated))
{
_entityManager = default(EntityManager);
}
if (_entityManager == default(EntityManager) && Server != null)
{
_entityManager = Server.EntityManager;
}
return _entityManager;
}
}
private static World GetWorld(string name)
{
if (World.s_AllWorlds == null)
{
return null;
}
Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current.Name == name && current.IsCreated)
{
return current;
}
}
return null;
}
public static bool IsServerWorldReady()
{
//IL_0014: 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_0021: Unknown result type (might be due to invalid IL or missing references)
return Server != null && Server.IsCreated && EntityManager != default(EntityManager);
}
}
}
namespace EntranceForge.Systems
{
public static class EntranceDefenseRules
{
public static readonly Dictionary<PrefabGUID, float> WatchedGolemAbilities = new Dictionary<PrefabGUID, float>
{
{
PrefabGuids.AB_Shapesfhit_Golem_T02_MeleeAttack_Hit,
50f
},
{
PrefabGuids.AB_Shapesfhit_Golem_T02_FistSlam_Hit,
75f
},
{
PrefabGuids.AB_Shapeshift_Golem_T02_GroundSlam_Hit,
150f
},
{
PrefabGuids.AB_Shapeshift_Golem_T02_Ranged_Projectile,
100f
}
};
public static readonly HashSet<PrefabGUID> ProtectedEntranceGuids = new HashSet<PrefabGUID>
{
PrefabGuids.TM_Castle_Wall_Tier02_Stone_Entrance,
PrefabGuids.TM_Castle_Wall_Tier02_Stone_EntranceWide
};
public static bool IsAbilityWatched(PrefabGUID abilityGuid)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return WatchedGolemAbilities.ContainsKey(abilityGuid);
}
public static bool IsEntranceProtectedType(PrefabGUID entranceGuid)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return ProtectedEntranceGuids.Contains(entranceGuid);
}
}
public class TypeRegistrationSystem : SystemBase
{
public override void OnCreate()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
try
{
TypeIndex typeIndex = TypeManager.GetTypeIndex<DynamicBuffer<CastleBuildingAttachedChildrenBuffer>>();
}
catch (Exception)
{
}
}
public override void OnUpdate()
{
((ComponentSystemBase)this).Enabled = false;
}
}
}
namespace EntranceForge.Patches
{
[HarmonyPatch(typeof(StatChangeSystem), "OnUpdate")]
public static class StatChangeSystem_DamageToEntrances_Patch
{
[HarmonyPrefix]
private static bool Prefix(StatChangeSystem __instance)
{
//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_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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_007d: 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_009e: 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_00a5: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: 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_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: 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_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: 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)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
if (!VWorld.IsServerWorldReady())
{
return true;
}
EntityManager entityManager = VWorld.EntityManager;
EntityQuery query = __instance._Query;
NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator = val.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (!current.Exists() || !current.Has<StatChangeEvent>())
{
continue;
}
StatChangeEvent val2 = current.Read<StatChangeEvent>();
if ((int)val2.StatType != 0 || val2.Change >= 0f)
{
continue;
}
Entity entity = val2.Entity;
Entity source = val2.Source;
if (!entity.Exists() || !entity.Has<CastleHeartConnection>())
{
continue;
}
CastleHeartConnection val3 = entity.Read<CastleHeartConnection>();
Entity entity2 = val3.CastleHeartEntity._Entity;
if (!entity2.Exists() || !entity.Has<PrefabGUID>())
{
continue;
}
PrefabGUID entranceGuid = entity.Read<PrefabGUID>();
if (!EntranceDefenseRules.IsEntranceProtectedType(entranceGuid))
{
continue;
}
PrefabGUID val4 = default(PrefabGUID);
if (source.Exists() && source.Has<PrefabGUID>())
{
val4 = source.Read<PrefabGUID>();
}
else
{
if (!source.Exists() || !source.Has<EntityOwner>())
{
continue;
}
Entity owner = source.Read<EntityOwner>().Owner;
if (!owner.Exists() || !owner.Has<PrefabGUID>())
{
continue;
}
val4 = owner.Read<PrefabGUID>();
}
if (!EntranceDefenseRules.IsAbilityWatched(val4))
{
continue;
}
bool flag = false;
if (entity.HasBuffer<CastleBuildingAttachedChildrenBuffer>())
{
Enumerator<CastleBuildingAttachedChildrenBuffer> enumerator2 = entity.ReadBuffer<CastleBuildingAttachedChildrenBuffer>().GetEnumerator();
while (enumerator2.MoveNext())
{
CastleBuildingAttachedChildrenBuffer current2 = enumerator2.Current;
Entity entity3 = current2.ChildEntity._Entity;
if (entity3.Exists() && entity3.Has<Door>())
{
flag = true;
break;
}
}
}
if (flag)
{
StatChangeEvent componentData = val2;
componentData.Change = -0.01f;
componentData.StatChangeFlags = 0;
if (current.Exists())
{
current.Write<StatChangeEvent>(componentData);
}
}
}
}
catch (Exception)
{
}
finally
{
if (val.IsCreated)
{
val.Dispose();
}
}
return true;
}
}
}
namespace EntranceForge.Managers
{
public static class RaidEntrancesFixManager
{
private static readonly Dictionary<PrefabGUID, float> WatchedGolemAbilities = new Dictionary<PrefabGUID, float>
{
{
PrefabGuids.AB_Shapesfhit_Golem_T02_MeleeAttack_Hit,
50f
},
{
PrefabGuids.AB_Shapesfhit_Golem_T02_FistSlam_Hit,
75f
},
{
PrefabGuids.AB_Shapeshift_Golem_T02_GroundSlam_Hit,
150f
},
{
PrefabGuids.AB_Shapeshift_Golem_T02_Ranged_Projectile,
100f
}
};
private static readonly HashSet<PrefabGUID> ProtectedEntranceGuids = new HashSet<PrefabGUID>
{
PrefabGuids.TM_Castle_Wall_Tier02_Stone_Entrance,
PrefabGuids.TM_Castle_Wall_Tier02_Stone_EntranceWide
};
public static void Initialize()
{
EntranceForgeCustomEvents.OnUnitHealthChanged += HandleOnUnitHealthChanged;
}
public static void Dispose()
{
EntranceForgeCustomEvents.OnUnitHealthChanged -= HandleOnUnitHealthChanged;
}
public static void HandleOnUnitHealthChanged(Entity sourceEntity, Entity eventEntity, Entity target, PrefabGUID ability)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_005b: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: 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)
//IL_00cd: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if (!VWorld.IsServerWorldReady() || !target.Exists() || !target.Has<CastleHeartConnection>())
{
return;
}
CastleHeartConnection val = target.Read<CastleHeartConnection>();
Entity entity = val.CastleHeartEntity._Entity;
if (!entity.Exists())
{
return;
}
PrefabGUID prefabGUID = target.GetPrefabGUID();
if (prefabGUID == PrefabGUID.Empty || !ProtectedEntranceGuids.Contains(prefabGUID) || !WatchedGolemAbilities.ContainsKey(ability))
{
return;
}
bool flag = false;
if (target.HasBuffer<CastleBuildingAttachedChildrenBuffer>())
{
Enumerator<CastleBuildingAttachedChildrenBuffer> enumerator = target.ReadBuffer<CastleBuildingAttachedChildrenBuffer>().GetEnumerator();
while (enumerator.MoveNext())
{
CastleBuildingAttachedChildrenBuffer current = enumerator.Current;
Entity entity2 = current.ChildEntity._Entity;
if (entity2.Exists() && entity2.Has<Door>())
{
flag = true;
break;
}
}
}
if (flag && eventEntity.Exists())
{
Helper.DestroyEntity(eventEntity, (DestroyReason)0, (DestroyDebugReason)0);
}
}
}
public static class EntranceForgeCustomEvents
{
public static event Action<Entity, Entity, Entity, PrefabGUID> OnUnitHealthChanged;
public static void Invoke(Entity s, Entity e, Entity t, PrefabGUID a)
{
//IL_000b: 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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
EntranceForgeCustomEvents.OnUnitHealthChanged?.Invoke(s, e, t, a);
}
}
}
namespace EntranceForge.Data
{
public static class PrefabGuids
{
public static readonly PrefabGUID AB_Shapesfhit_Golem_T02_MeleeAttack_Hit = new PrefabGUID(106246702);
public static readonly PrefabGUID AB_Shapesfhit_Golem_T02_FistSlam_Hit = new PrefabGUID(385944154);
public static readonly PrefabGUID AB_Shapeshift_Golem_T02_GroundSlam_Hit = new PrefabGUID(548495076);
public static readonly PrefabGUID AB_Shapeshift_Golem_T02_Ranged_Projectile = new PrefabGUID(2058619860);
public static readonly PrefabGUID TM_Castle_Wall_Tier02_Stone_Entrance = new PrefabGUID(728150320);
public static readonly PrefabGUID TM_Castle_Wall_Tier02_Stone_EntranceWide = new PrefabGUID(996421136);
}
}