using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using KinPonds.Commands.Converters;
using KinPonds.Services;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.CastleBuilding;
using ProjectM.Network;
using ProjectM.Physics;
using ProjectM.Shared;
using ProjectM.Terrain;
using ProjectM.Tiles;
using Stunlock.Core;
using Stunlock.Localization;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Physics;
using Unity.Scenes;
using Unity.Transforms;
using UnityEngine;
using VampireCommandFramework;
[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("KinPonds")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A pond to call your own.")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2.0+c59658db4662dc17b9a144b6de81658c13b3db88")]
[assembly: AssemblyProduct("KinPonds")]
[assembly: AssemblyTitle("KinPonds")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 KinPonds
{
public static class Color
{
public static string Red = "red";
public static string Primary = "#b0b";
public static string White = "#eee";
public static string LightGrey = "#ccc";
public static string Yellow = "#dd0";
public static string DarkGreen = "#0c0";
public static string Command = "#40E0D0";
public static string Orange = "orange";
public static string Cyan = "#0CD";
}
internal static class CommandContextExtensions
{
private const int MAX_MESSAGE_SIZE = 460;
internal static void PaginatedReply(this ICommandContext ctx, StringBuilder input)
{
ctx.PaginatedReply(input.ToString());
}
internal static void PaginatedReply(this ICommandContext ctx, string input)
{
if (input.Length <= 460)
{
ctx.Reply(input);
return;
}
string[] array = SplitIntoPages(input);
string[] array2 = array;
foreach (string text in array2)
{
string text2 = text.TrimEnd('\n', '\r', ' ');
text2 = Environment.NewLine + text2;
ctx.Reply(text2);
}
}
internal static string[] SplitIntoPages(string rawText, int pageSize = 460)
{
List<string> list = new List<string>();
StringBuilder stringBuilder = new StringBuilder();
string[] array = rawText.Split(Environment.NewLine);
List<string> list2 = new List<string>();
string[] array2 = array;
foreach (string text in array2)
{
if (text.Length > pageSize)
{
string text2 = text;
while (!string.IsNullOrWhiteSpace(text2) && text2.Length > pageSize)
{
int num = text2.LastIndexOf(' ', pageSize - (int)((double)pageSize * 0.05));
if (num < 0)
{
num = Math.Min(pageSize - 1, text2.Length);
}
list2.Add(text2.Substring(0, num));
text2 = text2.Substring(num);
}
list2.Add(text2);
}
else
{
list2.Add(text);
}
}
foreach (string item in list2)
{
if (stringBuilder.Length + item.Length > pageSize)
{
list.Add(stringBuilder.ToString());
stringBuilder.Clear();
}
stringBuilder.AppendLine(item);
}
if (stringBuilder.Length > 0)
{
list.Add(stringBuilder.ToString());
}
return list.ToArray();
}
}
internal static class Core
{
private static World server;
private static GenerateCastleSystem generateCastleSystem;
private static MonoBehaviour monoBehaviour;
private static bool _hasInitialized = false;
public static World Server => GetServer();
public static bool IsServer => Application.productName == "VRisingServer";
public static GenerateCastleSystem GenerateCastle => generateCastleSystem ?? (generateCastleSystem = Server.GetOrCreateSystemManaged<GenerateCastleSystem>());
public static PrefabCollectionSystem PrefabCollectionSystem { get; } = Server.GetExistingSystemManaged<PrefabCollectionSystem>();
public static LocalizationService Localization { get; } = new LocalizationService();
public static PondService Ponds { get; internal set; }
public static RegionService Region { get; internal set; }
public static EntityManager EntityManager { get; } = Server.EntityManager;
public static ManualLogSource Log { get; } = Plugin.LogInstance;
private static World GetServer()
{
if (server == null)
{
server = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");
}
return server;
}
internal static void InitializeAfterLoaded()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
if (!_hasInitialized)
{
Ponds = new PondService();
Region = new RegionService();
_hasInitialized = true;
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("KinPonds initialized");
}
log.LogInfo(val);
}
}
private static World GetWorld(string name)
{
Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
while (enumerator.MoveNext())
{
World current = enumerator.Current;
if (current.Name == name)
{
return current;
}
}
return null;
}
public static Coroutine StartCoroutine(IEnumerator routine)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if ((Object)(object)monoBehaviour == (Object)null)
{
GameObject val = new GameObject("KinPonds");
monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>();
Object.DontDestroyOnLoad((Object)(object)val);
}
return monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
}
public static void StopCoroutine(Coroutine coroutine)
{
if (!((Object)(object)monoBehaviour == (Object)null))
{
monoBehaviour.StopCoroutine(coroutine);
}
}
}
public static class ECSExtensions
{
public delegate void ActionRef<T>(ref T item);
public unsafe static Entity Write<T>(this Entity entity, T componentData) where T : struct
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_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)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
byte[] array = StructureToByteArray(componentData);
int num = Marshal.SizeOf<T>();
fixed (byte* ptr = array)
{
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, val.TypeIndex, (void*)ptr, num);
}
return entity;
}
public static void With<T>(this Entity entity, ActionRef<T> action) where T : struct
{
//IL_0001: 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_0016: 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)
T item = entity.ReadRW<T>();
action(ref item);
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item);
}
public unsafe static T ReadRW<T>(this Entity entity) where T : struct
{
//IL_000e: 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_0016: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
void* componentDataRawRW = ((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, val.TypeIndex);
return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRW));
}
public static byte[] StructureToByteArray<T>(T structure) where T : struct
{
int num = Marshal.SizeOf(structure);
byte[] array = new byte[num];
IntPtr intPtr = Marshal.AllocHGlobal(num);
Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true);
Marshal.Copy(intPtr, array, 0, num);
Marshal.FreeHGlobal(intPtr);
return array;
}
public unsafe static T Read<T>(this Entity entity) where T : struct
{
//IL_000e: 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_0016: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex);
return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRO));
}
public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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_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)
EntityManager entityManager = Core.Server.EntityManager;
return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false);
}
public static bool Has<T>(this Entity entity)
{
//IL_000e: 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_0016: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
return ((EntityManager)(ref entityManager)).HasComponent(entity, val);
}
public static string LookupName(this PrefabGUID prefabGuid)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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_0025: 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)
PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap;
string text = default(string);
object obj;
if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetName(prefabGuid, ref text))
{
obj = "GUID Not Found";
}
else
{
string text2 = text;
PrefabGUID val = prefabGuid;
obj = text2 + " " + ((object)(PrefabGUID)(ref val)).ToString();
}
return obj.ToString();
}
public static string PrefabName(this PrefabGUID prefabGuid)
{
//IL_0006: 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)
string prefabName = Core.Localization.GetPrefabName(prefabGuid);
return string.IsNullOrEmpty(prefabName) ? prefabGuid.LookupName() : prefabName;
}
public static Entity Add<T>(this Entity entity)
{
//IL_000e: 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_0016: 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_001e: 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_0022: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).AddComponent(entity, val);
return entity;
}
public static void Remove<T>(this Entity entity)
{
//IL_000e: 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_0016: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent(entity, val);
}
}
public static class Format
{
public enum FormatMode
{
GameChat,
None
}
public static FormatMode Mode { get; set; }
public static string B(string input)
{
return input.Bold();
}
public static string Bold(this string input)
{
return (Mode == FormatMode.GameChat) ? ("<b>" + input + "</b>") : input;
}
public static string I(string input)
{
return input.Italic();
}
public static string Italic(this string input)
{
return (Mode == FormatMode.GameChat) ? ("<i>" + input + "</i>") : input;
}
public static string Underline(this string input)
{
return (Mode == FormatMode.GameChat) ? ("<u>" + input + "</u>") : input;
}
public static string Color(this string input, string color)
{
return (Mode == FormatMode.GameChat) ? $"<color={color}>{input}</color>" : input;
}
public static string Size(this string input, int size)
{
return (Mode == FormatMode.GameChat) ? $"<size={size}>{input}</size>" : input;
}
public static string Small(this string input)
{
return input.Size(10);
}
public static string Normal(this string input)
{
return input.Size(16);
}
public static string Medium(this string input)
{
return input.Size(20);
}
public static string Large(this string input)
{
return input.Size(24);
}
public static string Command(this string input)
{
return input.Bold().Color(KinPonds.Color.Command);
}
public static string Role(this string input)
{
return input.Bold().Color(KinPonds.Color.DarkGreen);
}
public static string User(this string input)
{
return input.Bold().Color(KinPonds.Color.Orange);
}
}
internal class Helper
{
internal static PrefabGUID TM_Castle_ObjectDecor_Pool_StrongbladeDLC01 = new PrefabGUID(558668025);
internal static PrefabGUID TM_Castle_ObjectDecor_Pool_StrongbladeDLC02 = new PrefabGUID(-1963794511);
internal static PrefabGUID Char_Fish_General = new PrefabGUID(1559481073);
internal static PrefabGUID TM_LiquidStation_Water_Well01 = new PrefabGUID(986517450);
internal static PrefabGUID TM_LiquidStation_Water_Well03 = new PrefabGUID(1742891933);
public static Entity FindClosestPool(Vector3 pos)
{
//IL_0008: 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_0011: 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_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_0022: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: 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_0176: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
GenerateCastleSystem generateCastle = Core.GenerateCastle;
TileModelSpatialLookupSystemData tileModelLookupSystemData = generateCastle._TileModelLookupSystemData;
TileModelSpatialLookupRO spatialLookupReadOnlyAndComplete = ((TileModelSpatialLookupSystemData)(ref tileModelLookupSystemData)).GetSpatialLookupReadOnlyAndComplete((SystemBase)(object)generateCastle);
float3 val = ConvertPosToTileGrid(float3.op_Implicit(pos));
BoundsMinMax val2 = default(BoundsMinMax);
((BoundsMinMax)(ref val2))..ctor((int)((double)val.x - 2.5), (int)((double)val.z - 2.5), (int)((double)val.x + 2.5), (int)((double)val.z + 2.5));
Entity result = Entity.Null;
float num = float.MaxValue;
NativeList<Entity> entities = ((TileModelSpatialLookupRO)(ref spatialLookupReadOnlyAndComplete)).GetEntities(ref val2, (TileType)255, 16, 16);
for (int i = 0; i < entities.Length; i++)
{
Entity val3 = entities[i];
if (!val3.Has<TilePosition>() || !val3.Has<Translation>())
{
continue;
}
PrefabGUID val4 = val3.Read<PrefabGUID>();
if (!(val4 != TM_Castle_ObjectDecor_Pool_StrongbladeDLC01) || !(val4 != TM_Castle_ObjectDecor_Pool_StrongbladeDLC02) || !(val4 != TM_LiquidStation_Water_Well01) || !(val4 != TM_LiquidStation_Water_Well03))
{
float3 value = val3.Read<Translation>().Value;
float num2 = math.distancesq(float3.op_Implicit(pos), value);
if (num2 < num)
{
num = num2;
result = val3;
}
}
}
entities.Dispose();
return result;
}
public static float3 ConvertPosToTileGrid(float3 pos)
{
//IL_0001: 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_001f: 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)
//IL_003c: 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)
return new float3((float)(Mathf.FloorToInt(pos.x * 2f) + 6400), pos.y, (float)(Mathf.FloorToInt(pos.z * 2f) + 6400));
}
public static Entity SpawnEntity(Entity userEntity, Vector3 translation, Vector3 pos, Quaternion rot, Entity prefab)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_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_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_0018: 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_002f: 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)
//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)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_005e: 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_0067: 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_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_0079: 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_0098: 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_00a1: 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_00ad: 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_00b4: 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_008f: 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)
EntityManager entityManager = Core.EntityManager;
Entity val = ((EntityManager)(ref entityManager)).Instantiate(prefab);
val.Add<PhysicsCustomTags>();
if (!val.Has<Translation>())
{
val.Add<Translation>();
}
val.Write<Translation>(new Translation
{
Value = float3.op_Implicit(pos + translation)
});
if (val.Has<LastTranslation>())
{
val.Write<LastTranslation>(new LastTranslation
{
Value = float3.op_Implicit(pos + translation)
});
}
if (!val.Has<Rotation>())
{
val.Add<Rotation>();
}
val.Write<Rotation>(new Rotation
{
Value = quaternion.op_Implicit(rot)
});
return val;
}
}
[BepInPlugin("KinPonds", "KinPonds", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
private Harmony _harmony;
public static Harmony Harmony { get; private set; }
public static ManualLogSource LogInstance { get; private set; }
public override void Load()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
if (!(Application.productName != "VRisingServer"))
{
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("KinPonds");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.2");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
LogInstance = ((BasePlugin)this).Log;
PondService.InitializeConfiguration(((BasePlugin)this).Config, ((BasePlugin)this).Log);
_harmony = new Harmony("KinPonds");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
Harmony = _harmony;
CommandRegistry.RegisterAll();
}
}
public override bool Unload()
{
CommandRegistry.UnregisterAssembly();
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
return true;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "KinPonds";
public const string PLUGIN_NAME = "KinPonds";
public const string PLUGIN_VERSION = "1.0.2";
}
}
namespace KinPonds.Services
{
internal class LocalizationService
{
private Dictionary<string, string> localization = new Dictionary<string, string>();
private Dictionary<int, string> prefabNames = new Dictionary<int, string>();
public LocalizationService()
{
LoadLocalization();
LoadPrefabNames();
}
private void LoadLocalization()
{
string name = "KinPonds.Localization.English.json";
Assembly executingAssembly = Assembly.GetExecutingAssembly();
Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(name);
if (manifestResourceStream != null)
{
using (StreamReader streamReader = new StreamReader(manifestResourceStream))
{
string json = streamReader.ReadToEnd();
localization = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
return;
}
}
Console.WriteLine("Resource not found!");
}
private void LoadPrefabNames()
{
string name = "KinPonds.Localization.PrefabNames.json";
Assembly executingAssembly = Assembly.GetExecutingAssembly();
Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(name);
if (manifestResourceStream != null)
{
using (StreamReader streamReader = new StreamReader(manifestResourceStream))
{
string json = streamReader.ReadToEnd();
prefabNames = JsonSerializer.Deserialize<Dictionary<int, string>>(json);
return;
}
}
Console.WriteLine("Resource not found!");
}
public string GetLocalization(string guid)
{
if (localization.TryGetValue(guid, out var value))
{
return value;
}
return "<Localization not found for " + guid + ">";
}
public string GetLocalization(LocalizationKey key)
{
//IL_0008: 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)
Guid val = ((AssetGuid)(ref key.Key)).ToGuid();
string guid = ((object)(Guid)(ref val)).ToString();
return GetLocalization(guid);
}
public string GetPrefabName(PrefabGUID itemPrefabGUID)
{
//IL_0007: 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_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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: 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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Invalid comparison between Unknown and I4
//IL_00f5: 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_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_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
if (!prefabNames.TryGetValue(itemPrefabGUID._Value, out var value))
{
return null;
}
string text = GetLocalization(value);
if (itemPrefabGUID._Value == -1265586439)
{
text = "Darkmatter Pistols";
}
PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap;
Entity entity = default(Entity);
if (((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(itemPrefabGUID, ref entity))
{
if (entity.Has<ItemData>())
{
ItemData val = entity.Read<ItemData>();
if ((int)val.ItemType == 5)
{
text = "Book " + text;
}
}
if (entity.Has<JewelInstance>())
{
JewelInstance val2 = entity.Read<JewelInstance>();
if (val2.TierIndex != 0)
{
text += $" Jewel Tier {val2.TierIndex + 1}";
}
}
if (entity.Has<LegendaryItemInstance>())
{
LegendaryItemInstance val3 = entity.Read<LegendaryItemInstance>();
text += $" Tier {val3.TierIndex + 1}";
}
if (entity.Has<ShatteredItem>())
{
text += " Shattered";
}
}
if (itemPrefabGUID._Value == 1455590675 || itemPrefabGUID._Value == -651642571)
{
text += " Tier 1";
}
else if (itemPrefabGUID._Value == 1150376281 || itemPrefabGUID._Value == 686122001)
{
text += " Tier 2";
}
return text;
}
}
internal class PondService
{
[CompilerGenerated]
private sealed class <>c__DisplayClass39_0
{
public Entity pondEntity;
internal bool <SpawnFishIn>b__0(KeyValuePair<NetworkId, (Entity pond, int territoryId)> p)
{
//IL_0007: 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)
return p.Value.pond == pondEntity;
}
}
[CompilerGenerated]
private sealed class <DelayCheckForSpawning>d__24 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public PondService <>4__this;
private Dictionary<NetworkId, (Entity pond, int territoryId)>.ValueCollection.Enumerator <>s__1;
private (Entity pond, int territoryId) <pondEntry>5__2;
private bool <hasFish>5__3;
private DynamicBuffer<AttachedBuffer> <attachedBuffer>5__4;
private Enumerator<AttachedBuffer> <>s__5;
private AttachedBuffer <attached>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayCheckForSpawning>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = default(Dictionary<NetworkId, (Entity, int)>.ValueCollection.Enumerator);
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0079: 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_00ad: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>s__1 = <>4__this.ponds.Values.GetEnumerator();
try
{
while (<>s__1.MoveNext())
{
<pondEntry>5__2 = <>s__1.Current;
if (!<pondEntry>5__2.pond.Has<AttachedBuffer>())
{
Core.Log.LogInfo((object)"Missing AttachedBuffer?");
continue;
}
<hasFish>5__3 = false;
EntityManager entityManager = Core.EntityManager;
<attachedBuffer>5__4 = ((EntityManager)(ref entityManager)).GetBuffer<AttachedBuffer>(<pondEntry>5__2.pond, false);
<>s__5 = <attachedBuffer>5__4.GetEnumerator();
while (<>s__5.MoveNext())
{
<attached>5__6 = <>s__5.Current;
if (<attached>5__6.PrefabGuid == Helper.Char_Fish_General)
{
<hasFish>5__3 = true;
break;
}
}
if (!<hasFish>5__3)
{
<>4__this.SpawnFish(<pondEntry>5__2.pond);
}
}
}
finally
{
((IDisposable)<>s__1).Dispose();
}
<>s__1 = default(Dictionary<NetworkId, (Entity, int)>.ValueCollection.Enumerator);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SpawnFishIn>d__39 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Entity pondEntity;
public float timeToWait;
public PondService <>4__this;
private <>c__DisplayClass39_0 <>8__1;
private NetworkId <networkId>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnFishIn>d__39(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_006e: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: 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)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass39_0();
<>8__1.pondEntity = pondEntity;
<>2__current = (object)new WaitForSeconds(timeToWait);
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
if (!<>4__this.pondsAdded.Contains(<>8__1.pondEntity))
{
return false;
}
EntityManager entityManager = Core.EntityManager;
if (!((EntityManager)(ref entityManager)).Exists(<>8__1.pondEntity))
{
<networkId>5__2 = (from p in <>4__this.ponds
where p.Value.pond == <>8__1.pondEntity
select p.Key).FirstOrDefault();
<>4__this.RemovePond(<networkId>5__2);
return false;
}
<>4__this.SpawnFish(<>8__1.pondEntity);
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static readonly PrefabGUID DT_Fish_Cursed_Standard_01 = new PrefabGUID(1553238108);
private static readonly PrefabGUID DT_Fish_Dunley_Standard_01 = new PrefabGUID(1612482091);
private static readonly PrefabGUID DT_Fish_Farbane_Standard_01 = new PrefabGUID(-47980789);
private static readonly PrefabGUID DT_Fish_General_Standard_01 = new PrefabGUID(-2110497587);
private static readonly PrefabGUID DT_Fish_Gloomrot_Standard_01 = new PrefabGUID(-1478565794);
private static readonly PrefabGUID DT_Fish_Silverlight_Standard_01 = new PrefabGUID(711437197);
private static readonly PrefabGUID DT_Fish_StrongBlade_Standard_01 = new PrefabGUID(1670470961);
private Dictionary<NetworkId, (Entity pond, int territoryId)> ponds = new Dictionary<NetworkId, (Entity, int)>();
private HashSet<Entity> pondsAdded = new HashSet<Entity>();
private Dictionary<int, List<(Entity pond, NetworkId networkId)>> pondsPerTerritory = new Dictionary<int, List<(Entity, NetworkId)>>();
private Dictionary<WorldRegionType, PrefabGUID> regionDropTables = new Dictionary<WorldRegionType, PrefabGUID>
{
{
(WorldRegionType)3,
DT_Fish_Farbane_Standard_01
},
{
(WorldRegionType)4,
DT_Fish_Dunley_Standard_01
},
{
(WorldRegionType)7,
DT_Fish_Silverlight_Standard_01
},
{
(WorldRegionType)8,
DT_Fish_Gloomrot_Standard_01
},
{
(WorldRegionType)9,
DT_Fish_Gloomrot_Standard_01
},
{
(WorldRegionType)5,
DT_Fish_Cursed_Standard_01
},
{
(WorldRegionType)11,
DT_Fish_StrongBlade_Standard_01
},
{
(WorldRegionType)0,
DT_Fish_Farbane_Standard_01
},
{
(WorldRegionType)2,
DT_Fish_Farbane_Standard_01
},
{
(WorldRegionType)6,
DT_Fish_Dunley_Standard_01
},
{
(WorldRegionType)10,
DT_Fish_Cursed_Standard_01
},
{
(WorldRegionType)1,
DT_Fish_Farbane_Standard_01
}
};
private Entity fishPrefab;
internal static ConfigEntry<int> PondCostItemGuid;
internal static ConfigEntry<int> PondCostAmount;
internal static ConfigEntry<float> RespawnTimeMin;
internal static ConfigEntry<float> RespawnTimeMax;
internal static ConfigEntry<int> DropTable;
internal static ConfigEntry<int> TerritoryLimit;
private PrefabGUID pondCostItem => new PrefabGUID(PondCostItemGuid.Value);
private PrefabGUID dropTable => new PrefabGUID(DropTable.Value);
internal static void InitializeConfiguration(ConfigFile config, ManualLogSource log)
{
//IL_00c4: 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_015a: Expected O, but got Unknown
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
PondCostItemGuid = config.Bind<int>("Pond Creation", "PondCostItemGuid", 0, "PrefabGUID of the item required to create a pondEntry. Set to 0 to disable cost.");
PondCostAmount = config.Bind<int>("Pond Creation", "PondCostAmount", 0, "Amount of the item required to create a pondEntry. Set to 0 to disable cost.");
RespawnTimeMin = config.Bind<float>("Fish Respawn", "RespawnTimeMin", 180f, "Minimum time in seconds before a fish respawns after being caught");
RespawnTimeMax = config.Bind<float>("Fish Respawn", "RespawnTimeMax", 600f, "Maximum time in seconds before a fish respawns after being caught");
DropTable = config.Bind<int>("Fish DropTable", "DropTable", 0, (ConfigDescription)null);
TerritoryLimit = config.Bind<int>("Pond Limits", "TerritoryLimit", 3, "Maximum number of ponds allowed per territory. Set to -1 for unlimited.");
bool flag = default(bool);
if (RespawnTimeMin.Value < 0f)
{
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(48, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("RespawnTimeMin cannot be negative. Setting to 0.");
}
log.LogWarning(val);
RespawnTimeMin.Value = 0f;
}
if (RespawnTimeMax.Value < RespawnTimeMin.Value)
{
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(83, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("RespawnTimeMax cannot be less than RespawnTimeMin. Setting to RespawnTimeMin value.");
}
log.LogWarning(val);
RespawnTimeMax.Value = RespawnTimeMin.Value;
}
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(71, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("PondService configuration loaded - RespawnTimeMin: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(RespawnTimeMin.Value);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("s, RespawnTimeMax: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(RespawnTimeMax.Value);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("s");
}
log.LogInfo(val2);
}
public PondService()
{
//IL_0029: 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_0043: 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_005e: 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_0079: 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_0093: 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_00ae: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: 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_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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: 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_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2));
val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<NameableInteractable>());
val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<PrefabGUID>());
EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)2);
EntityManager entityManager = Core.Server.EntityManager;
EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2);
((EntityQueryBuilder)(ref val2)).Dispose();
NativeArray<Entity> val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
Enumerator<Entity> enumerator = val4.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
PrefabGUID val5 = current.Read<PrefabGUID>();
if (!(val5 != Helper.TM_Castle_ObjectDecor_Pool_StrongbladeDLC01) || !(val5 != Helper.TM_Castle_ObjectDecor_Pool_StrongbladeDLC02) || !(val5 != Helper.TM_LiquidStation_Water_Well01) || !(val5 != Helper.TM_LiquidStation_Water_Well03))
{
NameableInteractable val6 = current.Read<NameableInteractable>();
if (!(((FixedString64Bytes)(ref val6.Name)).Value != "KinPonds"))
{
AddPond(current);
}
}
}
val4.Dispose();
PrefabLookupMap prefabLookupMap = Core.PrefabCollectionSystem._PrefabLookupMap;
if (!((PrefabLookupMap)(ref prefabLookupMap)).TryGetValue(Helper.Char_Fish_General, ref fishPrefab))
{
Core.Log.LogError((object)("PondService: Fish prefab missing! " + Helper.Char_Fish_General.PrefabName()));
}
Core.StartCoroutine(DelayCheckForSpawning());
Core.Log.LogInfo((object)("PondService initialized with " + ponds.Count + " ponds."));
}
[IteratorStateMachine(typeof(<DelayCheckForSpawning>d__24))]
private IEnumerator DelayCheckForSpawning()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayCheckForSpawning>d__24(0)
{
<>4__this = this
};
}
public int GetPondCountForTerritory(Entity pondEntity)
{
//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_001a: 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_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_002f: 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)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0054: 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_006d: 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_00ad: 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_00b8: 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)
if (pondEntity == Entity.Null)
{
return 0;
}
CastleHeartConnection val = pondEntity.Read<CastleHeartConnection>();
Entity entityOnServer = ((NetworkedEntity)(ref val.CastleHeartEntity)).GetEntityOnServer();
if (entityOnServer == Entity.Null)
{
return 0;
}
Entity castleTerritoryEntity = entityOnServer.Read<CastleHeart>().CastleTerritoryEntity;
if (castleTerritoryEntity == Entity.Null)
{
return 0;
}
int castleTerritoryIndex = castleTerritoryEntity.Read<CastleTerritory>().CastleTerritoryIndex;
if (!pondsPerTerritory.TryGetValue(castleTerritoryIndex, out List<(Entity, NetworkId)> value))
{
return 0;
}
int num = 0;
foreach (var item in value)
{
EntityManager entityManager = Core.EntityManager;
if (!((EntityManager)(ref entityManager)).Exists(item.Item1))
{
RemovePond(item.Item2);
}
else
{
num++;
}
}
return num;
}
public void AddPond(Entity pondEntity)
{
//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_0007: 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_0009: 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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_001e: 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_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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0064: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
NetworkId val = pondEntity.Read<NetworkId>();
CastleHeartConnection val2 = pondEntity.Read<CastleHeartConnection>();
Entity entityOnServer = ((NetworkedEntity)(ref val2.CastleHeartEntity)).GetEntityOnServer();
if (entityOnServer == Entity.Null)
{
return;
}
Entity castleTerritoryEntity = entityOnServer.Read<CastleHeart>().CastleTerritoryEntity;
if (!(castleTerritoryEntity == Entity.Null))
{
int castleTerritoryIndex = castleTerritoryEntity.Read<CastleTerritory>().CastleTerritoryIndex;
ponds[val] = (pondEntity, castleTerritoryIndex);
pondsAdded.Add(pondEntity);
if (!pondsPerTerritory.TryGetValue(castleTerritoryIndex, out List<(Entity, NetworkId)> value))
{
value = new List<(Entity, NetworkId)>();
pondsPerTerritory[castleTerritoryIndex] = value;
}
value.Add((pondEntity, val));
}
}
public void RemovePond(NetworkId networkId)
{
//IL_0007: 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_0015: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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_008b: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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)
if (!ponds.TryGetValue(networkId, out (Entity, int) value))
{
return;
}
pondsAdded.Remove(value.Item1);
ponds.Remove(networkId);
CastleHeartConnection val = value.Item1.Read<CastleHeartConnection>();
Entity entityOnServer = ((NetworkedEntity)(ref val.CastleHeartEntity)).GetEntityOnServer();
if (entityOnServer == Entity.Null)
{
return;
}
Entity castleTerritoryEntity = entityOnServer.Read<CastleHeart>().CastleTerritoryEntity;
if (castleTerritoryEntity == Entity.Null)
{
return;
}
int castleTerritoryIndex = castleTerritoryEntity.Read<CastleTerritory>().CastleTerritoryIndex;
if (pondsPerTerritory.TryGetValue(castleTerritoryIndex, out List<(Entity, NetworkId)> value2))
{
value2.RemoveAll(((Entity pond, NetworkId networkId) p) => p.networkId == networkId);
}
}
public Entity GetPond(NetworkId networkId)
{
//IL_0007: 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_0015: 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_0025: Unknown result type (might be due to invalid IL or missing references)
if (ponds.TryGetValue(networkId, out (Entity, int) value))
{
return value.Item1;
}
return Entity.Null;
}
public string CreatePond(Entity charEntity, Entity userEntity, Entity pondEntity, bool isAdmin)
{
//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_001b: 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_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_0042: 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_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_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_006d: 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_007a: 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_00a7: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: 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)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: 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_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: 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_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
if (pondEntity == Entity.Null)
{
return "Invalid pool";
}
if (!pondEntity.Has<NetworkId>())
{
return "Pool has no NetworkId";
}
NetworkId key = pondEntity.Read<NetworkId>();
if (ponds.ContainsKey(key))
{
return "Pond already exists in the pool.";
}
PrefabGUID val = pondEntity.Read<PrefabGUID>();
if (val != Helper.TM_Castle_ObjectDecor_Pool_StrongbladeDLC01 && val != Helper.TM_Castle_ObjectDecor_Pool_StrongbladeDLC02 && val != Helper.TM_LiquidStation_Water_Well01 && val != Helper.TM_LiquidStation_Water_Well03)
{
return "Not a pool";
}
NameableInteractable componentData;
if (pondEntity.Has<NameableInteractable>())
{
componentData = pondEntity.Read<NameableInteractable>();
return "Pool is already being used by " + ((FixedString64Bytes)(ref componentData.Name)).Value;
}
if (!isAdmin)
{
CastleHeartConnection val2 = pondEntity.Read<CastleHeartConnection>();
Entity entityOnServer = ((NetworkedEntity)(ref val2.CastleHeartEntity)).GetEntityOnServer();
UserOwner val3 = entityOnServer.Read<UserOwner>();
Entity entityOnServer2 = ((NetworkedEntity)(ref val3.Owner)).GetEntityOnServer();
if (entityOnServer2 != userEntity)
{
return "You are not the owner of this pool";
}
int pondCountForTerritory = GetPondCountForTerritory(pondEntity);
if (TerritoryLimit.Value >= 0 && pondCountForTerritory >= TerritoryLimit.Value)
{
return $"You have reached the limit of {TerritoryLimit.Value} ponds for this territory.";
}
}
if (pondCostItem != PrefabGUID.Empty && PondCostAmount.Value > 0)
{
EntityManager entityManager = Core.EntityManager;
DynamicBuffer<InventoryInstanceElement> buffer = ((EntityManager)(ref entityManager)).GetBuffer<InventoryInstanceElement>(charEntity, false);
Entity val4 = Entity.Null;
Enumerator<InventoryInstanceElement> enumerator = buffer.GetEnumerator();
if (enumerator.MoveNext())
{
InventoryInstanceElement current = enumerator.Current;
NetworkedEntity externalInventoryEntity = current.ExternalInventoryEntity;
val4 = ((NetworkedEntity)(ref externalInventoryEntity)).GetEntityOnServer();
}
if (val4 == Entity.Null || !InventoryUtilitiesServer.TryRemoveItem(Core.EntityManager, val4, pondCostItem, PondCostAmount.Value))
{
return $"You must have {PondCostAmount.Value.ToString().Color(Color.White)}x {pondCostItem.PrefabName().Color(Color.Yellow)} in your inventory to create a pond.";
}
}
pondEntity.Add<NameableInteractable>();
componentData = new NameableInteractable
{
Name = new FixedString64Bytes("KinPonds")
};
pondEntity.Write<NameableInteractable>(componentData);
AddPond(pondEntity);
SpawnFish(pondEntity);
return null;
}
private void SpawnFish(Entity pondEntity)
{
//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_0007: 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_0016: 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_002c: 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_0032: 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_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_007c: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: 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_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: 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_015f: Unknown result type (might be due to invalid IL or missing references)
CastleHeartConnection val = pondEntity.Read<CastleHeartConnection>();
Entity entityOnServer = ((NetworkedEntity)(ref val.CastleHeartEntity)).GetEntityOnServer();
if (entityOnServer == Entity.Null)
{
return;
}
UserOwner val2 = entityOnServer.Read<UserOwner>();
Entity entityOnServer2 = ((NetworkedEntity)(ref val2.Owner)).GetEntityOnServer();
if (fishPrefab == Entity.Null)
{
Core.Log.LogError((object)("PondService: Fish prefab missing! " + Helper.Char_Fish_General.PrefabName()));
return;
}
float3 value = pondEntity.Read<Translation>().Value;
value.y += 0.5f;
Entity val3 = Helper.SpawnEntity(entityOnServer2, float3.op_Implicit(value), Vector3.zero, Quaternion.identity, fishPrefab);
Attach componentData = default(Attach);
((Attach)(ref componentData))..ctor(pondEntity);
val3.Add<Attach>().Write<Attach>(componentData);
DestroyAfterDuration componentData2 = val3.Read<DestroyAfterDuration>();
componentData2.Duration = float.MaxValue;
val3.Write<DestroyAfterDuration>(componentData2);
EntityManager entityManager;
PrefabGUID val4;
if (pondEntity.Has<DropTableBuffer>())
{
entityManager = Core.EntityManager;
val4 = ((EntityManager)(ref entityManager)).GetBuffer<DropTableBuffer>(pondEntity, false)[0].DropTableGuid;
}
else
{
val4 = GetDropTableToUse(value);
}
if (val4 != DT_Fish_General_Standard_01)
{
entityManager = Core.EntityManager;
DynamicBuffer<DropTableBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<DropTableBuffer>(val3, false);
DropTableBuffer val5 = buffer[0];
val5.DropTableGuid = val4;
buffer[0] = val5;
}
}
internal void SetDropTable(PrefabGUID newDropTable)
{
//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_002b: 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)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
DropTable.Value = ((PrefabGUID)(ref newDropTable)).GuidHash;
foreach (Entity item in pondsAdded)
{
if (!item.Has<DropTableBuffer>())
{
SetPondDropTable(newDropTable, item);
}
}
}
internal PrefabGUID GetOverrideDropTable(Entity pondEntity)
{
//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_0018: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_0028: 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_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_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
if (pondEntity == Entity.Null)
{
return PrefabGUID.Empty;
}
if (pondEntity.Has<DropTableBuffer>())
{
EntityManager entityManager = Core.EntityManager;
DynamicBuffer<DropTableBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<DropTableBuffer>(pondEntity, false);
if (buffer.Length > 0)
{
return buffer[0].DropTableGuid;
}
}
return GetDropTableToUse(pondEntity.Read<Translation>().Value);
}
internal PrefabGUID GetGlobalDropTable()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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)
if (dropTable != PrefabGUID.Empty)
{
return dropTable;
}
return PrefabGUID.Empty;
}
internal bool HasPondOverrideDropTable(Entity pondEntity)
{
//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_0014: 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_0028: 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_003d: 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)
if (pondEntity == Entity.Null)
{
return false;
}
if (pondEntity.Has<DropTableBuffer>())
{
EntityManager entityManager = Core.EntityManager;
DynamicBuffer<DropTableBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<DropTableBuffer>(pondEntity, false);
return buffer.Length > 0 && buffer[0].DropTableGuid != PrefabGUID.Empty;
}
return false;
}
internal void SetPondOverrideDropTable(Entity pondEntity, PrefabGUID newDropTable)
{
//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_003e: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_005d: 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_006f: 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_0078: 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_0085: 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_004b: 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_001c: 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_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)
if (newDropTable == PrefabGUID.Empty)
{
if (pondEntity.Has<DropTableBuffer>())
{
pondEntity.Remove<DropTableBuffer>();
SetPondDropTable(GetDropTableToUse(pondEntity.Read<Translation>().Value), pondEntity);
}
return;
}
if (!pondEntity.Has<DropTableBuffer>())
{
pondEntity.Add<DropTableBuffer>();
}
EntityManager entityManager = Core.EntityManager;
DynamicBuffer<DropTableBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<DropTableBuffer>(pondEntity, false);
buffer.Clear();
buffer.Add(new DropTableBuffer
{
DropTableGuid = newDropTable
});
SetPondDropTable(newDropTable, pondEntity);
}
private static void SetPondDropTable(PrefabGUID newDropTable, Entity pondEntity)
{
//IL_0001: 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_0018: 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_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_0026: 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_0030: 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_0038: 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_003f: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_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_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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: 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)
if (!pondEntity.Has<AttachedBuffer>())
{
return;
}
EntityManager entityManager = Core.EntityManager;
Enumerator<AttachedBuffer> enumerator = ((EntityManager)(ref entityManager)).GetBuffer<AttachedBuffer>(pondEntity, false).GetEnumerator();
while (enumerator.MoveNext())
{
AttachedBuffer current = enumerator.Current;
if (!(current.PrefabGuid != Helper.Char_Fish_General))
{
Entity entity = current.Entity;
if (entity.Has<DropTableBuffer>())
{
entityManager = Core.EntityManager;
DynamicBuffer<DropTableBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<DropTableBuffer>(entity, false);
DropTableBuffer val = buffer[0];
val.DropTableGuid = newDropTable;
buffer[0] = val;
}
}
}
}
private PrefabGUID GetDropTableToUse(float3 pondPos)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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_000d: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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_0035: Invalid comparison between Unknown and I4
//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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: 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_0050: Unknown result type (might be due to invalid IL or missing references)
PrefabGUID value = DT_Fish_General_Standard_01;
if (dropTable != PrefabGUID.Empty)
{
value = dropTable;
}
else
{
WorldRegionType region = Core.Region.GetRegion(pondPos);
if ((int)region > 0)
{
regionDropTables.TryGetValue(region, out value);
}
}
return value;
}
internal void CheckForRespawn(Entity fishEntity)
{
//IL_0001: 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_0011: 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_001b: 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_004c: Unknown result type (might be due to invalid IL or missing references)
if (fishEntity.Has<Attached>())
{
Entity parent = fishEntity.Read<Attached>().Parent;
if (pondsAdded.Contains(parent))
{
float timeToWait = Random.RandomRange(RespawnTimeMin.Value, RespawnTimeMax.Value);
Core.StartCoroutine(SpawnFishIn(parent, timeToWait));
}
}
}
[IteratorStateMachine(typeof(<SpawnFishIn>d__39))]
private IEnumerator SpawnFishIn(Entity pondEntity, float timeToWait)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnFishIn>d__39(0)
{
<>4__this = this,
pondEntity = pondEntity,
timeToWait = timeToWait
};
}
}
internal class RegionService
{
private struct RegionPolygon
{
public WorldRegionType Region;
public Aabb Aabb;
public float2[] Vertices;
}
internal class RegionConverter : JsonConverter<WorldRegionType>
{
public override WorldRegionType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
//IL_002d: 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_004e: 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_0063: Unknown result type (might be due to invalid IL or missing references)
if (reader.TokenType != JsonTokenType.String)
{
throw new JsonException();
}
reader.GetString();
WorldRegionType[] values = Enum.GetValues<WorldRegionType>();
for (int i = 0; i < values.Length; i++)
{
WorldRegionType result = values[i];
if (((object)(WorldRegionType)(ref result)).ToString() == reader.GetString())
{
return result;
}
}
return (WorldRegionType)0;
}
public override void Write(Utf8JsonWriter writer, WorldRegionType value, JsonSerializerOptions options)
{
writer.WriteStringValue(((object)(WorldRegionType)(ref value)).ToString());
}
}
private List<RegionPolygon> regionPolygons = new List<RegionPolygon>();
public RegionService()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_002b: 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_0035: 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_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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_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_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_0075: 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_007e: 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)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00b0: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
EntityQueryBuilder val = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2));
val = ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<WorldRegionPolygon>());
EntityQueryBuilder val2 = ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)2);
EntityManager entityManager = Core.EntityManager;
EntityQuery val3 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val2);
((EntityQueryBuilder)(ref val2)).Dispose();
NativeArray<Entity> val4 = ((EntityQuery)(ref val3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
Enumerator<Entity> enumerator = val4.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
WorldRegionPolygon val5 = current.Read<WorldRegionPolygon>();
entityManager = Core.EntityManager;
NativeArray<WorldRegionPolygonVertex> val6 = ((EntityManager)(ref entityManager)).GetBuffer<WorldRegionPolygonVertex>(current, false).ToNativeArray(AllocatorHandle.op_Implicit((Allocator)2));
regionPolygons.Add(new RegionPolygon
{
Region = val5.WorldRegion,
Aabb = val5.PolygonBounds,
Vertices = ((IEnumerable<WorldRegionPolygonVertex>)val6.ToArray()).Select((WorldRegionPolygonVertex x) => x.VertexPos).ToArray()
});
val6.Dispose();
}
val4.Dispose();
((EntityQuery)(ref val3)).Dispose();
}
public WorldRegionType GetRegion(float3 pos)
{
//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_0022: 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_003a: 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_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_0076: Unknown result type (might be due to invalid IL or missing references)
foreach (RegionPolygon regionPolygon in regionPolygons)
{
Aabb aabb = regionPolygon.Aabb;
if (((Aabb)(ref aabb)).Contains(pos) && IsPointInPolygon(regionPolygon.Vertices, float2.op_Implicit(((float3)(ref pos)).xz)))
{
return regionPolygon.Region;
}
}
return (WorldRegionType)0;
}
private static bool IsPointInPolygon(float2[] polygon, Vector2 point)
{
//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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
int num2 = polygon.Length;
int num3 = 0;
int num4 = num2