Decompiled source of CrowdControl Dredge v1.0.1
BepInEx/plugins/Crowdcontrol/ConnectorLib.JSON.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("Warp World, Inc.")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("© 2024 Warp World, Inc.")] [assembly: AssemblyFileVersion("5.0.8924.25521")] [assembly: AssemblyInformationalVersion("5.0.8924.25521+1ef6cca7b48ffec6f735086f83465220347f78d1")] [assembly: AssemblyProduct("ConnectorLib.JSON")] [assembly: AssemblyTitle("ConnectorLib.JSON")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("5.0.8924.25521")] [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] internal sealed class IsReadOnlyAttribute : Attribute { } [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 ConnectorLib.JSON { internal class AnnotatedEnumConverter<T> : JsonConverter<T> where T : struct, Enum { [AttributeUsage(AttributeTargets.Field)] public class JsonValueAttribute : Attribute { public readonly string Value; public JsonValueAttribute(string value) { Value = value; base..ctor(); } } private static readonly Dictionary<T, JsonValueAttribute?> _attributes; static AnnotatedEnumConverter() { T[] source = (T[])Enum.GetValues(typeof(T)); _attributes = source.Select((T m) => new KeyValuePair<T, JsonValueAttribute>(m, GetAttributeOfType<JsonValueAttribute>(m))).ToDictionary(); } private static T? GetAttributeOfType<T>(Enum enumVal) where T : Attribute { Enum enumVal2 = enumVal; Type type = enumVal2.GetType(); MemberInfo memberInfo = type.GetTypeInfo().DeclaredMembers.First((MemberInfo m) => string.Equals(m.Name, enumVal2.ToString(), StringComparison.Ordinal)); object[] array = memberInfo.GetCustomAttributes(typeof(T), inherit: false).ToArray(); return (array.Length != 0) ? ((T)array[0]) : null; } public override void WriteJson(JsonWriter writer, T value, JsonSerializer serializer) { JsonValueAttribute jsonValueAttribute = _attributes[value]; if (jsonValueAttribute != null) { serializer.Serialize(writer, (object)jsonValueAttribute.Value); } else { serializer.Serialize(writer, (object)Enum.GetName(typeof(T), value)); } } public override T ReadJson(JsonReader reader, Type objectType, T existingValue, bool hasExistingValue, JsonSerializer serializer) { string value = serializer.Deserialize<string>(reader); if (value == null) { return default(T); } KeyValuePair<T, JsonValueAttribute>? keyValuePair = _attributes.Cast<KeyValuePair<T, JsonValueAttribute>?>().FirstOrDefault((KeyValuePair<T, JsonValueAttribute>? a) => (a?.Value?.Value?.Equals(value, StringComparison.OrdinalIgnoreCase)).GetValueOrDefault()); if (keyValuePair.HasValue) { return keyValuePair.Value.Key; } if (Enum.TryParse<T>(value, ignoreCase: true, out var result)) { return result; } return default(T); } } public class CamelCaseStringEnumConverter : JsonConverter<Enum> { public override void WriteJson(JsonWriter writer, Enum? value, JsonSerializer serializer) { if (value == null) { serializer.Serialize(writer, (object)null); } else { serializer.Serialize(writer, (object)value.ToCamelCase()); } } public override Enum ReadJson(JsonReader reader, Type objectType, Enum? existingValue, bool hasExistingValue, JsonSerializer serializer) { return ReadJToken(JToken.ReadFrom(reader), objectType); } public static Enum ReadJToken(JToken reader, Type objectType) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 JTokenType type = reader.Type; JTokenType val = type; if ((int)val != 6) { if ((int)val == 8) { string text = Extensions.Value<string>((IEnumerable<JToken>)reader); if (text == null) { throw new SerializationException("The value was null."); } try { object obj = Enum.Parse(objectType, text, ignoreCase: true); return (Enum)obj; } catch (Exception) { throw new SerializationException("The value was not recognized."); } } throw new SerializationException("The value was not a string or number."); } int? num = Extensions.Value<int>((IEnumerable<JToken>)reader); if (!num.HasValue) { throw new SerializationException("The value was null."); } return (Enum)Enum.ToObject(objectType, num.Value); } } [Serializable] public class EffectRequest : SimpleJSONRequest { [Serializable] public class Target { public string? service; public string? id; public string? name; public string? avatar; } public string? code; public string? message; public JToken? parameters; public uint? quantity; public JArray? targets; public long? duration; public string? viewer; public JArray? viewers; public int? cost; public EffectRequest() { type = RequestType.Start; } } [Serializable] public class EffectResponse : SimpleJSONResponse { private class MetadataConverter : JsonConverter<Dictionary<string, EffectResponseMetadata>?> { public override void WriteJson(JsonWriter writer, Dictionary<string, EffectResponseMetadata>? value, JsonSerializer serializer) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (value == null) { serializer.Serialize(writer, (object)null); return; } JObject val = new JObject(); foreach (KeyValuePair<string, EffectResponseMetadata> item in value) { JObject val2 = JObject.FromObject((object)item.Value); val2.Remove("key"); val[item.Key] = (JToken)(object)val2; } serializer.Serialize(writer, (object)val); } public override Dictionary<string, EffectResponseMetadata>? ReadJson(JsonReader reader, Type objectType, Dictionary<string, EffectResponseMetadata>? existingValue, bool hasExistingValue, JsonSerializer serializer) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown JObject val = (JObject)serializer.Deserialize(reader); if (val == null) { return null; } Dictionary<string, EffectResponseMetadata> dictionary = new Dictionary<string, EffectResponseMetadata>(); foreach (JProperty item in val.Properties()) { JObject val2 = (JObject)item.Value; val2["key"] = JToken.op_Implicit(item.Name); dictionary.Add(item.Name, ((JToken)val2).ToObject<EffectResponseMetadata>()); } return dictionary; } } public EffectStatus status; public string? message; public long timeRemaining; [JsonConverter(typeof(MetadataConverter))] public Dictionary<string, EffectResponseMetadata>? metadata; public EffectResponse() { } public EffectResponse(uint id, EffectStatus status, string? message = null) : this(id, status, 0L, message) { } [JsonConstructor] public EffectResponse(uint id, EffectStatus status, long timeRemaining, string? message = null) { base.id = id; this.status = status; this.timeRemaining = timeRemaining; this.message = message; type = ResponseType.EffectRequest; } } public class EffectResponseMetadata { public string key; public JToken? value; public EffectStatus status; public long? timeRemaining; public string? message; [JsonConstructor] public EffectResponseMetadata(string key, EffectStatus status, object? value = null, long timeRemaining = 0L, string? message = null) { this.key = key; this.value = value.IfNotNull((Func<object, JToken?>)JToken.FromObject); this.status = status; this.timeRemaining = timeRemaining; this.message = message; base..ctor(); } public static EffectResponseMetadata Success(string key, object? value, string? message = null) { return new EffectResponseMetadata(key, EffectStatus.Success, value, 0L, message); } public static EffectResponseMetadata Failure(string key) { return new EffectResponseMetadata(key, EffectStatus.Failure, null, 0L); } public static EffectResponseMetadata Failure(string key, string? message) { return new EffectResponseMetadata(key, EffectStatus.Failure, null, 0L, message); } public static EffectResponseMetadata Failure(string key, object? value, string? message = null) { return new EffectResponseMetadata(key, EffectStatus.Failure, null, 0L, message); } public static EffectResponseMetadata Retry(string key, long delay = 0L, string? message = null) { return new EffectResponseMetadata(key, EffectStatus.Retry, null, delay, message); } } [JsonConverter(typeof(CamelCaseStringEnumConverter))] public enum EffectStatus { Success = 0, Failure = 1, Unavailable = 2, Retry = 3, Queue = 4, Running = 5, Paused = 6, Resumed = 7, Finished = 8, Visible = 128, NotVisible = 129, Selectable = 130, NotSelectable = 131, NotReady = 255 } [Serializable] public class EffectUpdate : SimpleJSONResponse { [JsonConverter(typeof(CamelCaseStringEnumConverter))] public enum IdentifierType { Effect, Group, Category } [Obsolete] [JsonProperty(/*Could not decode attribute arguments.*/)] public string? code; [JsonProperty(/*Could not decode attribute arguments.*/)] public string[]? ids; public IdentifierType idType; public EffectStatus status; public string? message; public EffectUpdate() { } public EffectUpdate(string code, EffectStatus status, string? message = null) { ids = new string[1] { code }; idType = IdentifierType.Effect; this.status = status; this.message = message; type = ResponseType.EffectStatus; } } [Serializable] public class EmptyRequest : SimpleJSONRequest { } [Serializable] public class EmptyResponse : SimpleJSONResponse { } internal static class EnumEx { public static string ToCamelCase(this Enum value) { return value.ToString("G").ToCamelCase(); } } [JsonConverter(typeof(CamelCaseStringEnumConverter))] public enum GameState { Unknown = 0, Ready = 1, Error = -1, Unmodded = -2, NotFocused = -3, Loading = -4, Paused = -5, WrongMode = -6, SafeArea = -7, Cutscene = -8, BadPlayerState = -9, Menu = -10, Map = -11 } [Serializable] public class GameUpdate : SimpleJSONResponse { public GameState state; public string? message; public GameUpdate(GameState state, string? message = null) { this.state = state; this.message = message; type = ResponseType.GameUpdate; } } [Serializable] public class GenericEvent : SimpleJSONResponse { [JsonProperty(PropertyName = "internal")] public bool @internal; public string eventType; public Dictionary<string, string> data; public GenericEvent() { type = ResponseType.GenericEvent; } } internal class HexColorConverter : JsonConverter<ParameterColorValue> { private static readonly Dictionary<char, byte> CHAR_LOOKUP = new Dictionary<char, byte> { { '0', 0 }, { '1', 1 }, { '2', 2 }, { '3', 3 }, { '4', 4 }, { '5', 5 }, { '6', 6 }, { '7', 7 }, { '8', 8 }, { '9', 9 }, { 'A', 10 }, { 'B', 11 }, { 'C', 12 }, { 'D', 13 }, { 'E', 14 }, { 'F', 15 } }; public override void WriteJson(JsonWriter writer, ParameterColorValue value, JsonSerializer serializer) { serializer.Serialize(writer, (object)string.Format("#{0}{1:X2}{2:X2}{3:X2}", (value.A != byte.MaxValue) ? value.A.ToString("X2") : string.Empty, value.R, value.G, value.B)); } public override ParameterColorValue ReadJson(JsonReader reader, Type objectType, ParameterColorValue existingValue, bool hasExistingValue, JsonSerializer serializer) { string value = serializer.Deserialize<string>(reader); if (TryParse(value, out var color)) { return color; } throw new SerializationException("Unrecognized color code."); } public static bool TryParse(string value, out ParameterColorValue color) { if (value == null) { color = default(ParameterColorValue); return false; } value = value.TrimStart(new char[1] { '#' }); switch (value.Length) { case 6: { string[] array2 = Chop(value, 2); byte result2; byte red3 = (byte)(byte.TryParse(array2[0], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out result2) ? result2 : 0); byte green3 = (byte)(byte.TryParse(array2[1], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out result2) ? result2 : 0); byte blue3 = (byte)(byte.TryParse(array2[2], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out result2) ? result2 : 0); color = ParameterColorValue.FromArgb(red3, green3, blue3); return true; } case 8: { string[] array = Chop(value, 2); byte result; byte alpha2 = (byte)(byte.TryParse(array[0], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out result) ? result : 0); byte red2 = (byte)(byte.TryParse(array[1], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out result) ? result : 0); byte green2 = (byte)(byte.TryParse(array[2], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out result) ? result : 0); byte blue2 = (byte)(byte.TryParse(array[3], NumberStyles.AllowHexSpecifier, NumberFormatInfo.InvariantInfo, out result) ? result : 0); color = ParameterColorValue.FromArgb(alpha2, red2, green2, blue2); return true; } case 3: { byte value3; byte red4 = (byte)(CHAR_LOOKUP.TryGetValue(value[0], out value3) ? checked((byte)(value3 * 16)) : 0); byte green4 = (byte)(CHAR_LOOKUP.TryGetValue(value[1], out value3) ? checked((byte)(value3 * 16)) : 0); byte blue4 = (byte)(CHAR_LOOKUP.TryGetValue(value[2], out value3) ? checked((byte)(value3 * 16)) : 0); color = ParameterColorValue.FromArgb(red4, green4, blue4); return true; } case 4: { byte value2; byte alpha = (byte)(CHAR_LOOKUP.TryGetValue(value[0], out value2) ? checked((byte)(value2 * 16)) : 0); byte red = (byte)(CHAR_LOOKUP.TryGetValue(value[1], out value2) ? checked((byte)(value2 * 16)) : 0); byte green = (byte)(CHAR_LOOKUP.TryGetValue(value[2], out value2) ? checked((byte)(value2 * 16)) : 0); byte blue = (byte)(CHAR_LOOKUP.TryGetValue(value[3], out value2) ? checked((byte)(value2 * 16)) : 0); color = ParameterColorValue.FromArgb(alpha, red, green, blue); return true; } default: color = default(ParameterColorValue); return false; } } private unsafe static string[] Chop(string value, int chopLength) { int length = value.Length; char* ptr = stackalloc char[chopLength]; string[] array = new string[length]; for (int i = 0; i < length; i = checked(i + chopLength)) { int j; for (j = 0; j < chopLength; j = checked(j + 1)) { int num = checked(i + j); if (num >= length) { break; } *(char*)((byte*)ptr + checked(unchecked((nint)j) * (nint)2)) = value[num]; } array[i / chopLength] = new string(ptr, 0, j); } return array; } } internal static class IEnumerableEx { public static Dictionary<K, V> ToDictionary<K, V>(this IEnumerable<KeyValuePair<K, V>> values) where K : notnull { Dictionary<K, V> dictionary = new Dictionary<K, V>(); foreach (KeyValuePair<K, V> value in values) { dictionary.Add(value.Key, value.Value); } return dictionary; } } [Serializable] public class LoginRequest : SimpleJSONRequest { public string? login; public string? password; } [Serializable] public class MessageRequest : SimpleJSONRequest { public string? message; } [Serializable] public class MessageResponse : SimpleJSONResponse { public string? message; } internal static class ObjectEx { public static T2? IfNotNull<T1, T2>(this T1? value, Func<T1, T2?> selector) where T2 : class { return (value != null) ? selector(value) : null; } } public class ParameterColor : ParameterBase, IParameterValue { [JsonProperty(PropertyName = "value")] [JsonConverter(typeof(HexColorConverter))] public ParameterColorValue Value; [JsonIgnore] string IParameterValue.ID => ID; [JsonIgnore] string IParameterValue.Name => Name; [JsonIgnore] ParameterType IParameterValue.Type => Type; [JsonIgnore] object? IParameterValue.Value => Value; [JsonConstructor] public ParameterColor(string name, string id, ParameterColorValue value) : base(name, id, ParameterType.HexColor) { Value = value; } [JsonConstructor] public ParameterColor(string name, string id, string value) : base(name, id, ParameterType.HexColor) { if (!HexColorConverter.TryParse(value, out Value)) { throw new ArgumentException("Unknown color code.", "value"); } } } [Serializable] [DebuggerDisplay("{NameAndARGBValue}")] [TypeForwardedFrom("System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public readonly struct ParameterColorValue : IEquatable<ParameterColorValue> { public static readonly ParameterColorValue Empty = default(ParameterColorValue); private const short StateARGBValueValid = 2; private const short StateValueMask = 2; private const short StateNameValid = 8; private const long NotDefinedValue = 0L; internal const int ARGBAlphaShift = 24; internal const int ARGBRedShift = 16; internal const int ARGBGreenShift = 8; internal const int ARGBBlueShift = 0; internal const uint ARGBAlphaMask = 4278190080u; internal const uint ARGBRedMask = 16711680u; internal const uint ARGBGreenMask = 65280u; internal const uint ARGBBlueMask = 255u; private readonly long value; private readonly short state; public byte R => (byte)(Value >> 16); public byte G => (byte)(Value >> 8); public byte B => (byte)Value; public byte A => (byte)(Value >> 24); public bool IsEmpty => state == 0; private long Value { get { if (((uint)state & 2u) != 0) { return value; } return 0L; } } private ParameterColorValue(long value, short state) { this.value = value; this.state = state; } private static ParameterColorValue FromArgb(uint argb) { return new ParameterColorValue(argb, 2); } public static ParameterColorValue FromArgb(int argb) { return FromArgb((uint)argb); } public static ParameterColorValue FromArgb(byte alpha, byte red, byte green, byte blue) { return FromArgb((uint)((alpha << 24) | (red << 16) | (green << 8) | blue)); } public static ParameterColorValue FromArgb(int alpha, ParameterColorValue baseColor) { return FromArgb(checked(((uint)alpha << 24) | ((uint)baseColor.Value & 0xFFFFFFu))); } public static ParameterColorValue FromArgb(byte red, byte green, byte blue) { return FromArgb(byte.MaxValue, red, green, blue); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void GetRgbValues(out byte r, out byte g, out byte b) { checked { uint num = (uint)Value; r = (byte)((num & 0xFF0000) >> 16); g = (byte)((num & 0xFF00) >> 8); b = (byte)(num & 0xFFu); } } public float GetBrightness() { GetRgbValues(out var r, out var g, out var b); int num = Math.Min(Math.Min(r, g), b); int num2 = Math.Max(Math.Max(r, g), b); return (float)checked(num2 + num) / 510f; } public float GetHue() { GetRgbValues(out var r, out var g, out var b); if (r == g && g == b) { return 0f; } int num = Math.Min(Math.Min(r, g), b); int num2 = Math.Max(Math.Max(r, g), b); checked { float num3 = num2 - num; float num4 = ((r == num2) ? ((float)(g - b) / num3) : ((g != num2) ? ((float)(r - g) / num3 + 4f) : ((float)(b - r) / num3 + 2f))); num4 *= 60f; if (num4 < 0f) { num4 += 360f; } return num4; } } public float GetSaturation() { GetRgbValues(out var r, out var g, out var b); if (r == g && g == b) { return 0f; } int num = Math.Min(Math.Min(r, g), b); int num2 = Math.Max(Math.Max(r, g), b); checked { int num3 = num2 + num; if (num3 > 255) { num3 = 510 - num2 - num; } return (float)(num2 - num) / (float)num3; } } public int ToArgb() { return (int)Value; } public override string ToString() { if (((uint)state & 2u) != 0) { return "ParameterColorValue [A=" + A + ", R=" + R + ", G=" + G + ", B=" + B + "]"; } return "ParameterColorValue [Empty]"; } public static bool operator ==(ParameterColorValue left, ParameterColorValue right) { return left.value == right.value && left.state == right.state; } public static bool operator !=(ParameterColorValue left, ParameterColorValue right) { return !(left == right); } public override bool Equals(object? obj) { return obj is ParameterColorValue other && Equals(other); } public bool Equals(ParameterColorValue other) { return this == other; } public override int GetHashCode() { long num = value; int num2 = num.GetHashCode() * 397; short num3 = state; return num2 ^ num3.GetHashCode(); } } public class ParameterValue<T> : ParameterBase, IParameterValue { [JsonProperty(PropertyName = "value")] public T? Value; [JsonIgnore] string IParameterValue.ID => ID; [JsonIgnore] string IParameterValue.Name => Name; [JsonIgnore] ParameterType IParameterValue.Type => Type; [JsonIgnore] object? IParameterValue.Value => Value; [JsonConstructor] public ParameterValue(string name, string id, T? value) : base(name, id, ParameterType.Options) { Value = value; } public override string ToString() { return Name; } } [Serializable] public class PlayerInfo : SimpleJSONRequest { public JObject? player; public PlayerInfo() { type = RequestType.Start; } } [Serializable] [JsonConverter(typeof(Converter))] public class RequestParameters : IReadOnlyList<string>, IEnumerable<string>, IEnumerable, IReadOnlyCollection<string>, IReadOnlyDictionary<string, IParameterValue>, IEnumerable<KeyValuePair<string, IParameterValue>>, IReadOnlyCollection<KeyValuePair<string, IParameterValue>> { private class Converter : JsonConverter<RequestParameters> { public override void WriteJson(JsonWriter writer, RequestParameters? value, JsonSerializer serializer) { serializer.Serialize(writer, (object)value?._parameters); } public override RequestParameters? ReadJson(JsonReader reader, Type objectType, RequestParameters? existingValue, bool hasExistingValue, JsonSerializer serializer) { JObject val = JObject.Load(reader); List<IParameterValue> list = new List<IParameterValue>(); foreach (KeyValuePair<string, JToken> item in val) { string key = item.Key; string name = Extensions.Value<string>((IEnumerable<JToken>)item.Value[(object)"name"]); switch (Extensions.Value<ParameterBase.ParameterType>((IEnumerable<JToken>)item.Value[(object)"type"])) { case ParameterBase.ParameterType.Options: { string value2 = Extensions.Value<string>((IEnumerable<JToken>)item.Value[(object)"value"]); list.Add(new ParameterValue<string>(name, key, value2)); break; } case ParameterBase.ParameterType.HexColor: { string value = Extensions.Value<string>((IEnumerable<JToken>)item.Value[(object)"value"]); if (HexColorConverter.TryParse(value, out var color)) { list.Add(new ParameterColor(name, key, color)); } break; } default: throw new SerializationException(); } } return new RequestParameters(list); } } private readonly Dictionary<string, IParameterValue> _parameters; private readonly List<string> _parameter_list; int IReadOnlyCollection<string>.Count => _parameters.Count; int IReadOnlyCollection<KeyValuePair<string, IParameterValue>>.Count => _parameters.Count; public string this[int index] => _parameter_list[index]; public IParameterValue this[string key] => _parameters[key]; public IEnumerable<string> Keys => _parameters.Keys; public IEnumerable<IParameterValue> Values => _parameters.Values; public int Count => _parameters.Count; private RequestParameters() { _parameters = new Dictionary<string, IParameterValue>(); _parameter_list = new List<string>(); } public RequestParameters(IEnumerable<IParameterValue> list) { list = list.ToArray(); _parameters = list.ToDictionary((IParameterValue d) => d.ID); _parameter_list = list.Select((IParameterValue v) => v.Value.ToString()).ToList(); } public RequestParameters(IEnumerable<KeyValuePair<string, IParameterValue>> parameters) { _parameters = parameters.ToDictionary(); _parameter_list = _parameters.Values.Select((IParameterValue p) => p.Value.ToString()).ToList(); } IEnumerator<KeyValuePair<string, IParameterValue>> IEnumerable<KeyValuePair<string, IParameterValue>>.GetEnumerator() { return _parameters.GetEnumerator(); } IEnumerator<string> IEnumerable<string>.GetEnumerator() { return _parameters.Values.Select((IParameterValue v) => v.Value?.ToString()).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } public bool ContainsKey(string key) { return _parameters.ContainsKey(key); } public bool TryGetValue(string key, out IParameterValue value) { return _parameters.TryGetValue(key, out value); } public IEnumerable<string> Where(Func<string, bool> predicate) { return Enumerable.Where(this, predicate); } public IEnumerable<TResult> Select<TResult>(Func<string, TResult> selector) { return Enumerable.Select(this, selector); } public IEnumerable<TResult> SelectMany<TResult>(Func<string, IEnumerable<TResult>> selector) { return Enumerable.SelectMany(this, selector); } public IEnumerable<TResult> SelectMany<TResult>(Func<string, int, IEnumerable<TResult>> selector) { return Enumerable.SelectMany(this, selector); } public string First() { return this.First<string>(); } public string First(Func<string, bool> predicate) { return Enumerable.First(this, predicate); } public string? FirstOrDefault() { return this.FirstOrDefault<string>(); } public string FirstOrDefault(string defaultValue) { return this.FirstOrDefault<string>() ?? defaultValue; } public string? FirstOrDefault(Func<string, bool> predicate) { return Enumerable.FirstOrDefault(this, predicate); } public string FirstOrDefault(Func<string, bool> predicate, string defaultValue) { return Enumerable.FirstOrDefault(this, predicate) ?? defaultValue; } public bool Any() { return this.Any<string>(); } public bool Any(Func<string, bool> predicate) { return Enumerable.Any(this, predicate); } } public interface IParameterValue { string ID { get; } string Name { get; } ParameterBase.ParameterType Type { get; } object? Value { get; } } public abstract class ParameterBase { [JsonConverter(typeof(AnnotatedEnumConverter<ParameterType>))] public enum ParameterType { [AnnotatedEnumConverter<ParameterType>.JsonValue("options")] Options, [AnnotatedEnumConverter<ParameterType>.JsonValue("hex-color")] HexColor } [JsonIgnore] public readonly string ID; [JsonProperty(PropertyName = "title")] public readonly string Name; [JsonProperty(PropertyName = "type")] public readonly ParameterType Type; protected ParameterBase(string name, string id, ParameterType type) { ID = id; Name = name; Type = type; } } [JsonConverter(typeof(CamelCaseStringEnumConverter))] public enum RequestType : byte { Test = 0, Start = 1, Stop = 2, GenericEvent = 16, RpcResponse = 208, PlayerInfo = 224, Login = 240, GameUpdate = 253, KeepAlive = byte.MaxValue } [JsonConverter(typeof(CamelCaseStringEnumConverter))] public enum ResponseType : byte { EffectRequest = 0, EffectStatus = 1, GenericEvent = 16, LoadEvent = 24, SaveEvent = 25, RpcRequest = 208, Login = 240, LoginSuccess = 241, GameUpdate = 253, Disconnect = 254, KeepAlive = byte.MaxValue } [Serializable] public class RpcRequest : SimpleJSONResponse { public string? method; public object?[]? args; } [Serializable] public class RpcResponse : SimpleJSONRequest { public object? value; public RpcResponse() { type = RequestType.RpcResponse; } } public abstract class SimpleJSONMessage { public static readonly JsonSerializerSettings JSON_SERIALIZER_SETTINGS = new JsonSerializerSettings { NullValueHandling = (NullValueHandling)1, MissingMemberHandling = (MissingMemberHandling)0, Formatting = (Formatting)0 }; public static readonly JsonSerializer JSON_SERIALIZER = new JsonSerializer { NullValueHandling = JSON_SERIALIZER_SETTINGS.NullValueHandling, MissingMemberHandling = JSON_SERIALIZER_SETTINGS.MissingMemberHandling, Formatting = JSON_SERIALIZER_SETTINGS.Formatting }; private static int _next_id = 0; public static uint NextID { get { uint result; while ((result = (uint)Interlocked.Increment(ref _next_id)) == 0) { } return result; } } public abstract uint ID { get; } public abstract bool IsKeepAlive { get; } } [Serializable] public class SimpleJSONRequest : SimpleJSONMessage { public uint id = SimpleJSONMessage.NextID; public RequestType type; [JsonIgnore] public override uint ID => id; [JsonIgnore] public override bool IsKeepAlive => type == RequestType.KeepAlive; public static SimpleJSONRequest Parse(string json) { return Parse(JObject.Parse(json)); } public static SimpleJSONRequest Parse(JObject j) { switch ((RequestType)(object)CamelCaseStringEnumConverter.ReadJToken(j.GetValue("type"), typeof(RequestType))) { case RequestType.Test: case RequestType.Start: return ((JToken)j).ToObject<EffectRequest>(SimpleJSONMessage.JSON_SERIALIZER); case RequestType.Stop: return ((JToken)j).ToObject<EffectRequest>(SimpleJSONMessage.JSON_SERIALIZER); case RequestType.RpcResponse: return ((JToken)j).ToObject<RpcResponse>(SimpleJSONMessage.JSON_SERIALIZER); case RequestType.PlayerInfo: return ((JToken)j).ToObject<PlayerInfo>(SimpleJSONMessage.JSON_SERIALIZER); case RequestType.Login: return ((JToken)j).ToObject<MessageRequest>(SimpleJSONMessage.JSON_SERIALIZER); case RequestType.GameUpdate: return ((JToken)j).ToObject<EmptyRequest>(SimpleJSONMessage.JSON_SERIALIZER); case RequestType.KeepAlive: return ((JToken)j).ToObject<EmptyRequest>(SimpleJSONMessage.JSON_SERIALIZER); default: throw new SerializationException("Message type was missing or unknown."); } } } [Serializable] public class SimpleJSONResponse : SimpleJSONMessage { public uint id; public ResponseType type; [JsonIgnore] public override uint ID => id; [JsonIgnore] public override bool IsKeepAlive => type == ResponseType.KeepAlive; [JsonIgnore] public static SimpleJSONResponse KeepAlive { get; } = new EmptyResponse { type = ResponseType.KeepAlive }; public static SimpleJSONResponse Parse(string json) { return Parse(JObject.Parse(json)); } public static SimpleJSONResponse Parse(JObject j) { return (ResponseType)(object)CamelCaseStringEnumConverter.ReadJToken(j.GetValue("type"), typeof(ResponseType)) switch { ResponseType.EffectRequest => ((JToken)j).ToObject<EffectResponse>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.EffectStatus => ((JToken)j).ToObject<EffectUpdate>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.RpcRequest => ((JToken)j).ToObject<RpcRequest>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.GenericEvent => ((JToken)j).ToObject<GenericEvent>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.Login => ((JToken)j).ToObject<EmptyResponse>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.LoginSuccess => ((JToken)j).ToObject<EmptyResponse>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.GameUpdate => ((JToken)j).ToObject<GameUpdate>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.Disconnect => ((JToken)j).ToObject<MessageResponse>(SimpleJSONMessage.JSON_SERIALIZER), ResponseType.KeepAlive => ((JToken)j).ToObject<EmptyResponse>(SimpleJSONMessage.JSON_SERIALIZER), _ => throw new SerializationException("Message type was missing or unknown."), }; } } internal static class StringEx { public static string ToCamelCase(this string input) { bool flag = false; string text = ""; checked { for (int i = 0; i < input.Length; i++) { if (char.IsUpper(input[i])) { if (flag) { text += input.Substring(i); break; } text += char.ToLower(input[i]); } else { flag = true; text = ((i <= 1 || !char.IsUpper(input[i - 1]) || !char.IsUpper(input[i - 2])) ? (text + input[i]) : (text.Substring(0, text.Length - 1) + char.ToUpper(input[i - 1]) + input[i])); } } return text; } } } }
BepInEx/plugins/Crowdcontrol/CrowdControl.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using BepInEx; using BepInEx.Logging; using Cinemachine; using ConnectorLib.JSON; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LethalCompanyTestMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalCompanyTestMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d4f6b961-e8ae-4e4b-950c-37644e42d4ca")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 BepinControl { public class ControlClient { public static readonly string CV_HOST = "127.0.0.1"; public static readonly int CV_PORT = 51337; private static readonly string[] CommonMetadata = new string[0]; private static readonly Dictionary<string, MetadataDelegate> Metadata = new Dictionary<string, MetadataDelegate>(); private static readonly Dictionary<string, EffectDelegate> Delegate = new Dictionary<string, EffectDelegate> { { "money100", EffectDelegates.Money100 }, { "damage", EffectDelegates.Damage }, { "damageto1", EffectDelegates.DamageTo1 }, { "heal", EffectDelegates.Heal }, { "healall", EffectDelegates.HealAll }, { "kill", EffectDelegates.Kill }, { "give10", EffectDelegates.Give10 }, { "give100", EffectDelegates.Give100 }, { "give1000", EffectDelegates.Give1000 }, { "take10", EffectDelegates.Take10 }, { "take100", EffectDelegates.Take100 }, { "take1000", EffectDelegates.Take1000 }, { "debt", EffectDelegates.RepayDebt }, { "debthalf", EffectDelegates.RepayDebtHalf }, { "debtup", EffectDelegates.IncreaseDebt }, { "debtuphalf", EffectDelegates.IncreaseDebtHalf }, { "passhour", EffectDelegates.PassHour }, { "passhours", EffectDelegates.PassHours }, { "backhour", EffectDelegates.BackHour }, { "backhours", EffectDelegates.BackHours }, { "timedawn", EffectDelegates.TimeDawn }, { "timedusk", EffectDelegates.TimeDusk }, { "timeslow", EffectDelegates.TimeSlow }, { "timefast", EffectDelegates.TimeFast }, { "timestop", EffectDelegates.TimeStop }, { "weather_Aurora", EffectDelegates.Weather }, { "weather_AuroraSnow", EffectDelegates.Weather }, { "weather_Clear", EffectDelegates.Weather }, { "weather_Cloudy", EffectDelegates.Weather }, { "weather_FinaleAurora", EffectDelegates.Weather }, { "weather_FinaleStorm", EffectDelegates.Weather }, { "weather_HeavyRain", EffectDelegates.Weather }, { "weather_HeavySnow", EffectDelegates.Weather }, { "weather_HeavyStorm", EffectDelegates.Weather }, { "weather_LightRain", EffectDelegates.Weather }, { "weather_LightSnow", EffectDelegates.Weather }, { "weather_MediumRain", EffectDelegates.Weather }, { "weather_MediumSnow", EffectDelegates.Weather }, { "weather_MediumStorm", EffectDelegates.Weather }, { "fishinstant", EffectDelegates.FishInstant }, { "fishfast", EffectDelegates.FishFast }, { "fishslow", EffectDelegates.FishSlow }, { "fishmanual", EffectDelegates.FishManual }, { "monster_0", EffectDelegates.SpawnMonster }, { "monster_1", EffectDelegates.SpawnMonster }, { "monster_2", EffectDelegates.SpawnMonster }, { "monster_3", EffectDelegates.SpawnMonster }, { "monster_4", EffectDelegates.SpawnMonster }, { "color_0_0", EffectDelegates.Color }, { "color_0_1", EffectDelegates.Color }, { "color_0_2", EffectDelegates.Color }, { "color_0_3", EffectDelegates.Color }, { "color_0_4", EffectDelegates.Color }, { "color_0_5", EffectDelegates.Color }, { "color_0_6", EffectDelegates.Color }, { "color_0_7", EffectDelegates.Color }, { "color_1_0", EffectDelegates.Color }, { "color_1_1", EffectDelegates.Color }, { "color_1_2", EffectDelegates.Color }, { "color_1_3", EffectDelegates.Color }, { "color_1_4", EffectDelegates.Color }, { "color_1_5", EffectDelegates.Color }, { "color_1_6", EffectDelegates.Color }, { "color_1_7", EffectDelegates.Color }, { "boatfreeze", EffectDelegates.BoatFreeze }, { "boatfast", EffectDelegates.BoatFast }, { "boatxfast", EffectDelegates.BoatXFast }, { "boatslow", EffectDelegates.BoatSlow }, { "boatxslow", EffectDelegates.BoatXSlow }, { "tele_0", EffectDelegates.Teleport }, { "tele_1", EffectDelegates.Teleport }, { "tele_2", EffectDelegates.Teleport }, { "tele_3", EffectDelegates.Teleport }, { "tele_4", EffectDelegates.Teleport }, { "tele_5", EffectDelegates.Teleport }, { "tele_6", EffectDelegates.Teleport }, { "tele_7", EffectDelegates.Teleport }, { "tele_8", EffectDelegates.Teleport }, { "tele_9", EffectDelegates.Teleport }, { "tele_10", EffectDelegates.Teleport }, { "tele_11", EffectDelegates.Teleport }, { "tele_12", EffectDelegates.Teleport }, { "tele_13", EffectDelegates.Teleport }, { "tele_14", EffectDelegates.Teleport }, { "wavesbig", EffectDelegates.WavesBig }, { "waveshuge", EffectDelegates.WavesHuge }, { "wavesgiant", EffectDelegates.WavesGiant }, { "invul", EffectDelegates.Invul }, { "bigboat", EffectDelegates.BigBoat }, { "smallboat", EffectDelegates.SmallBoat }, { "item_bait", EffectDelegates.GiveItem }, { "item_bait-ab", EffectDelegates.GiveItem }, { "item_bait-crab", EffectDelegates.GiveItem }, { "item_bait-exotic", EffectDelegates.GiveItem }, { "item_explosives", EffectDelegates.GiveItem }, { "item_ice-block-1", EffectDelegates.GiveItem }, { "item_cloth", EffectDelegates.GiveItem }, { "item_lumber", EffectDelegates.GiveItem }, { "item_metal", EffectDelegates.GiveItem }, { "item_research-item", EffectDelegates.GiveItem }, { "item_scrap", EffectDelegates.GiveItem }, { "item_rot", EffectDelegates.GiveItem }, { "item_doubloon", EffectDelegates.GiveItem }, { "item_catfish", EffectDelegates.GiveItem }, { "rotall", EffectDelegates.FillRot }, { "rotnone", EffectDelegates.CkearRot }, { "fishnone", EffectDelegates.CkearFish }, { "widecamera", EffectDelegates.WideCamera }, { "narrowcamera", EffectDelegates.NarrowCamera }, { "flipcamera", EffectDelegates.FlipCamera }, { "sane", EffectDelegates.Sane }, { "insane", EffectDelegates.Insane }, { "sanityevent", EffectDelegates.SanityEvent }, { "ability_haste", EffectDelegates.Ability }, { "ability_manifest", EffectDelegates.Ability }, { "ability_banish", EffectDelegates.Ability }, { "ability_atrophy", EffectDelegates.Ability }, { "ability_foghorn", EffectDelegates.Ability }, { "infectfish", EffectDelegates.InfectFish }, { "rotfish", EffectDelegates.RotFish }, { "freshfish", EffectDelegates.FreshFish }, { "nodock", EffectDelegates.NoDock } }; private bool paused; public bool inGame = true; public static readonly ControlClient Instance = new ControlClient(); public static readonly int RECV_BUF = 4096; public static readonly int RECV_TIME = 5000000; private static readonly EmptyResponse KEEPALIVE = new EmptyResponse { type = (ResponseType)255 }; private GameState? _last_game_state; private const float GAME_STATUS_UPDATE_INTERVAL = 1f; private float _game_status_update_timer = 0f; private IPEndPoint Endpoint { get; } private Queue<SimpleJSONRequest> Requests { get; } private bool Running { get; set; } public static Socket? Socket { get; set; } private ControlClient() { Endpoint = new IPEndPoint(IPAddress.Parse(CV_HOST), CV_PORT); Requests = new Queue<SimpleJSONRequest>(); Running = true; Socket = null; } public bool isReady() { try { if (!GameManager.Instance.Player.IsAlive) { return false; } if (GameManager.Instance.Player.IsDocked) { return false; } if (!GameManager.Instance.Player.Controller.IsMovementAllowed) { return false; } } catch { return false; } return true; } public bool HideEffect(string code) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return Send((SimpleJSONResponse)new EffectUpdate(code, (EffectStatus)129, (string)null)); } public bool ShowEffect(string code) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return Send((SimpleJSONResponse)new EffectUpdate(code, (EffectStatus)128, (string)null)); } public bool DisableEffect(string code) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return Send((SimpleJSONResponse)new EffectUpdate(code, (EffectStatus)131, (string)null)); } public bool EnableEffect(string code) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return Send((SimpleJSONResponse)new EffectUpdate(code, (EffectStatus)130, (string)null)); } private void ClientLoop() { Mod.mls.LogInfo((object)"Connected to Crowd Control"); Timer timer = new Timer(timeUpdate, null, 0, 200); try { while (Running) { SimpleJSONRequest val = Recieve(this, Socket); if (val == null || ((SimpleJSONMessage)val).IsKeepAlive) { Thread.Sleep(0); continue; } lock (Requests) { Requests.Enqueue(val); } } } catch (Exception) { Mod.mls.LogInfo((object)"Disconnected from Crowd Control"); Socket?.Close(); } } public SimpleJSONRequest? Recieve(ControlClient client, Socket socket) { byte[] array = new byte[RECV_BUF]; string text = ""; int num = 0; do { if (!client.IsRunning()) { return null; } if (socket.Poll(RECV_TIME, SelectMode.SelectRead)) { num = socket.Receive(array); if (num < 0) { return null; } text += Encoding.ASCII.GetString(array); } else { KeepAlive(); } } while (num == 0 || (num == RECV_BUF && array[RECV_BUF - 1] != 0)); return SimpleJSONRequest.Parse(text); } public bool KeepAlive() { return Send((SimpleJSONResponse)(object)KEEPALIVE); } public static bool Send(SimpleJSONResponse message) { byte[] bytes = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject((object)message)); byte[] array = new byte[bytes.Length + 1]; Buffer.BlockCopy(bytes, 0, array, 0, bytes.Length); array[bytes.Length] = 0; int num = Socket?.Send(array) ?? (-1); return num == array.Length; } public void timeUpdate(object state) { inGame = true; if (!isReady()) { inGame = false; } if (!inGame) { TimedThread.addTime(200); paused = true; } else if (paused) { paused = false; TimedThread.unPause(); TimedThread.tickTime(200); } else { TimedThread.tickTime(200); } } public bool IsRunning() { return Running; } public void NetworkLoop() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; while (Running) { Mod.mls.LogInfo((object)"Attempting to connect to Crowd Control"); try { Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, optionValue: true); if (Socket.BeginConnect(Endpoint, null, null).AsyncWaitHandle.WaitOne(10000, exitContext: true) && Socket.Connected) { ClientLoop(); } else { Mod.mls.LogInfo((object)"Failed to connect to Crowd Control"); } Socket.Close(); } catch (Exception ex) { Mod.mls.LogInfo((object)ex.GetType().Name); Mod.mls.LogInfo((object)"Failed to connect to Crowd Control"); } Thread.Sleep(10000); } } public void FixedUpdate() { _game_status_update_timer += Time.fixedDeltaTime; if (_game_status_update_timer >= 1f) { UpdateGameState(); _game_status_update_timer = 0f; } } public void RequestLoop() { //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Invalid comparison between Unknown and I4 //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; while (Running) { try { SimpleJSONRequest val; lock (Requests) { if (Requests.Count == 0) { continue; } val = Requests.Dequeue(); goto IL_005e; } IL_005e: EffectRequest val2 = (EffectRequest)(object)((val is EffectRequest) ? val : null); if (val2 != null) { string code = val2.code; try { EffectResponse val3 = null; if (code == null) { val3 = new EffectResponse(((SimpleJSONMessage)val2).ID, (EffectStatus)2, "No effect code was sent."); } else if (isReady()) { if (Delegate.TryGetValue(code, out EffectDelegate value)) { val3 = value(this, val2); if (val3 != null) { val3.metadata = new Dictionary<string, EffectResponseMetadata>(); string[] commonMetadata = CommonMetadata; foreach (string key in commonMetadata) { val3.metadata.Add(key, Metadata[key](this)); } } } else { val3 = new EffectResponse(((SimpleJSONMessage)val2).ID, (EffectStatus)2, "Unknown effect code: " + code); } } else { val3 = new EffectResponse(((SimpleJSONMessage)val2).ID, (EffectStatus)3, (string)null); } if (val3 != null) { Send((SimpleJSONResponse)(object)val3); } } catch (KeyNotFoundException) { Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)val2).ID, (EffectStatus)2, "Request error for '" + code + "'")); } } else if ((int)val.type == 253) { UpdateGameState(force: true); } } catch (Exception) { Mod.mls.LogInfo((object)"Disconnected from Crowd Control"); Socket?.Close(); } } } public void Stop() { Running = false; } private bool UpdateGameState(bool force = false) { return UpdateGameState((GameState)1, force); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool UpdateGameState(GameState newState, bool force) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return UpdateGameState(newState, null, force); } private bool UpdateGameState(GameState newState, string? message = null, bool force = false) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (force || _last_game_state != (GameState?)newState) { _last_game_state = newState; return Send((SimpleJSONResponse)new GameUpdate(newState, message)); } return true; } } public delegate EffectResponse EffectDelegate(ControlClient client, EffectRequest req); public static class EffectDelegates { public static Random rng = new Random(); public static EffectResponse Money100(ControlClient client, EffectRequest req) { //IL_0002: 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_0029: 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_003f: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { Vector3 position = ((Component)GameManager.Instance.Player).transform.position; Mod.mls.LogInfo((object)$"x: {position.x} y: {position.y} z: {position.z}"); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } List<AbilityData> list = (List<AbilityData>)getProperty(GameManager.Instance.PlayerAbilities, "abilityDatas"); foreach (AbilityData item in list) { Mod.mls.LogInfo((object)("ability: " + ((Object)item).name)); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Damage(ControlClient client, EffectRequest req) { //IL_000f: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.Player.RemainingHealth <= 1) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not allowed to sink ship."); } if (GameManager.Instance.Player.IsImmuneModeEnabled) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Can't damage while invincible."); } Mod.ActionQueue.Enqueue(delegate { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (GameManager.Instance.GridManager.AddDamageToInventory(1, -1, -1)) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, "")); } else { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "")); } }); return null; } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse DamageTo1(ControlClient client, EffectRequest req) { //IL_000f: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.Player.RemainingHealth <= 1) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not allowed to sink ship."); } if (GameManager.Instance.Player.IsImmuneModeEnabled) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Can't damage while invincible."); } Mod.ActionQueue.Enqueue(delegate { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown if (GameManager.Instance.GridManager.AddDamageToInventory(GameManager.Instance.Player.RemainingHealth - 1, -1, -1)) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, "")); } else { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "")); } }); return null; } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Heal(ControlClient client, EffectRequest req) { //IL_000f: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.SaveData.GetNumberOfDamagedSlots() <= 0) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No damage to repair."); } Mod.ActionQueue.Enqueue(delegate { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown SpatialItemInstance val2 = GameManager.Instance.SaveData.Inventory.spatialUnderlayItems.Find((SpatialItemInstance i) => (int)((ItemData)((ItemInstance)i).GetItemData<SpatialItemData>()).itemType == 4); if (val2 != (SpatialItemInstance)null) { GameManager.Instance.SaveData.Inventory.GetRootCellForObject(val2); GameManager.Instance.SaveData.Inventory.RemoveObjectFromGridData(val2, true); GameEvents.Instance.TriggerFocusedGridCellChanged(GameManager.Instance.GridManager.LastSelectedCell); GameEvents.Instance.TriggerOnPlayerDamageChanged(); GameEvents.Instance.TriggerItemInventoryChanged((SpatialItemData)null); ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, "")); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)2), ">Hull Repaired</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)23, text2); } else { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "")); } }); return null; } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse HealAll(ControlClient client, EffectRequest req) { //IL_0002: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.SaveData.GetNumberOfDamagedSlots() <= 0) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No damage to repair."); } Mod.ActionQueue.Enqueue(delegate { string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)2), ">Hull Repaired</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)23, text2); GameManager.Instance.ItemManager.RepairHullDamage(true); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Kill(ControlClient client, EffectRequest req) { //IL_0002: 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_002f: Expected O, but got Unknown //IL_0083: 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_008b: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; if (GameManager.Instance.Player.IsImmuneModeEnabled) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Can't kill while invincible."); } try { Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.Player.Die(); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Weather(ControlClient client, EffectRequest req) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { string weather = req.code.Split(new char[1] { '_' })[1]; Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.WeatherController.ChangeWeather(weather); setProperty(GameManager.Instance.WeatherController, "weatherChangeTransitionStartTime", -99999f); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Ability(ControlClient client, EffectRequest req) { //IL_0002: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { string text2 = req.code.Split(new char[1] { '_' })[1]; AbilityData abilityDataByName = GameManager.Instance.PlayerAbilities.GetAbilityDataByName(text2); Ability ability = GameManager.Instance.PlayerAbilities.GetAbilityForData(abilityDataByName); if (ability.IsActive) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Ability already active."); } Mod.ActionQueue.Enqueue(delegate { ability.Activate(); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse InfectFish(ControlClient client, EffectRequest req) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00d2: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { SerializableGrid inventory = GameManager.Instance.SaveData.Inventory; FishItemInstance fishItemInstance = ((IEnumerable<FishItemInstance>)CollectionUtil.Shuffle<FishItemInstance>((IEnumerable<FishItemInstance>)inventory.GetAllItemsOfType<FishItemInstance>((ItemType)1, (ItemSubtype)1)).ToList()).FirstOrDefault((Func<FishItemInstance, bool>)((FishItemInstance f) => !f.isInfected && ((ItemInstance)f).GetItemData<FishItemData>().CanBeInfected)); if ((SpatialItemInstance)(object)fishItemInstance == (SpatialItemInstance)null) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No target to infect."); } Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.GridManager.InfectItem(fishItemInstance, inventory, false); GameManager.Instance.UI.ShowNotificationWithColor((NotificationType)8, "notification.infection-start", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)4)); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse RotFish(ControlClient client, EffectRequest req) { //IL_0002: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { SerializableGrid inventory = GameManager.Instance.SaveData.Inventory; FishItemInstance fishItemInstance = ((IEnumerable<FishItemInstance>)CollectionUtil.Shuffle<FishItemInstance>((IEnumerable<FishItemInstance>)inventory.GetAllItemsOfType<FishItemInstance>((ItemType)1, (ItemSubtype)1)).ToList()).FirstOrDefault((Func<FishItemInstance, bool>)((FishItemInstance f) => f.freshness > 0f)); if ((SpatialItemInstance)(object)fishItemInstance == (SpatialItemInstance)null) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No target to rot."); } Mod.ActionQueue.Enqueue(delegate { fishItemInstance.freshness = 0f; }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse FreshFish(ControlClient client, EffectRequest req) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { SerializableGrid inventory = GameManager.Instance.SaveData.Inventory; List<FishItemInstance> fish = inventory.GetAllItemsOfType<FishItemInstance>((ItemType)1, (ItemSubtype)1).ToList(); if (fish == null || fish.Count == 0) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No target to freshen."); } Mod.ActionQueue.Enqueue(delegate { foreach (FishItemInstance item in fish) { item.freshness = GameManager.Instance.GameConfigData.MaxFreshness; item.isInfected = false; } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse GiveItem(ControlClient client, EffectRequest req) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) EffectStatus val = (EffectStatus)0; string text = ""; try { string itemId = req.code.Split(new char[1] { '_' })[1]; Mod.ActionQueue.Enqueue(delegate { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_0142: 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_010e: Expected O, but got Unknown //IL_009e: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) SerializableGrid inventory = GameManager.Instance.SaveData.Inventory; ItemData itemDataById = GameManager.Instance.ItemManager.GetItemDataById<ItemData>(itemId); ItemInstance val2 = GameManager.Instance.ItemManager.CreateItem<ItemInstance>(itemDataById); if (val2 == null) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)1, "Item ID does not exist.")); } else { if (itemDataById is SpatialItemData && inventory != null) { Vector3Int val3 = default(Vector3Int); if (!inventory.FindPositionForObject((SpatialItemData)(object)((itemDataById is SpatialItemData) ? itemDataById : null), ref val3, 0, false)) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No space for item.")); return; } inventory.AddObjectToGridData((SpatialItemInstance)(object)((val2 is SpatialItemInstance) ? val2 : null), val3, true, (Action<GridObject>)null); GameManager.Instance.ItemManager.SetItemSeen((SpatialItemInstance)(object)((val2 is SpatialItemInstance) ? val2 : null)); GameManager.Instance.UI.ShowNotificationWithItemName((NotificationType)5, "notification.item-added", itemDataById.itemNameKey, GameManager.Instance.LanguageManager.GetColor((DredgeColorTypeEnum)2)); } else if (itemDataById is NonSpatialItemData) { bool flag = GameManager.Instance.SaveData.AddNonSpatialItemInstance((NonSpatialItemInstance)(object)((val2 is NonSpatialItemInstance) ? val2 : null)); NotificationType val4 = (NotificationType)5; if (val2 is ResearchableItemInstance) { val4 = (NotificationType)3; } if (flag && Object.op_Implicit((Object)(object)GameManager.Instance.UI)) { GameManager.Instance.UI.ShowNotificationWithItemName(val4, "notification.cabin-item-added", itemDataById.itemNameKey, GameManager.Instance.LanguageManager.GetColor((DredgeColorTypeEnum)2)); } } ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, "")); } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return null; } public static EffectResponse FillRot(ControlClient client, EffectRequest req) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) EffectStatus val = (EffectStatus)0; string text = ""; try { string itemId = "rot"; Mod.ActionQueue.Enqueue(delegate { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown bool flag = false; SerializableGrid inventory = GameManager.Instance.SaveData.Inventory; ItemData itemDataById = GameManager.Instance.ItemManager.GetItemDataById<ItemData>(itemId); Vector3Int val3 = default(Vector3Int); while (true) { ItemInstance val2 = GameManager.Instance.ItemManager.CreateItem<ItemInstance>(itemDataById); if (val2 == null) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)1, "Item ID does not exist.")); return; } if (itemDataById is SpatialItemData && inventory != null) { if (!inventory.FindPositionForObject((SpatialItemData)(object)((itemDataById is SpatialItemData) ? itemDataById : null), ref val3, 0, false)) { break; } inventory.AddObjectToGridData((SpatialItemInstance)(object)((val2 is SpatialItemInstance) ? val2 : null), val3, true, (Action<GridObject>)null); GameManager.Instance.ItemManager.SetItemSeen((SpatialItemInstance)(object)((val2 is SpatialItemInstance) ? val2 : null)); flag = true; } } if (!flag) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No space for item.")); } else { GameManager.Instance.UI.ShowNotificationWithItemName((NotificationType)5, "notification.item-added", itemDataById.itemNameKey, GameManager.Instance.LanguageManager.GetColor((DredgeColorTypeEnum)2)); ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, "")); } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return null; } public static EffectResponse CkearRot(ControlClient client, EffectRequest req) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) EffectStatus val = (EffectStatus)0; string text = ""; try { string itemId = "rot"; ItemData itemDataById = GameManager.Instance.ItemManager.GetItemDataById<ItemData>("rot"); Mod.ActionQueue.Enqueue(delegate { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown try { bool flag = false; bool flag2 = false; SerializableGrid inventory = GameManager.Instance.SaveData.Inventory; do { flag2 = false; foreach (SpatialItemInstance spatialItem in inventory.spatialItems) { if (Object.op_Implicit((Object)(object)itemDataById) && ((ItemInstance)spatialItem).id == itemId) { flag = true; flag2 = true; GameManager.Instance.SaveData.Inventory.RemoveObjectFromGridData(spatialItem, true); break; } } } while (flag2); if (!flag) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)1, "No rot in inventory.")); } else { GameManager.Instance.UI.ShowNotificationWithItemName((NotificationType)6, "notification.item-removed", itemDataById.itemNameKey, GameManager.Instance.LanguageManager.GetColor((DredgeColorTypeEnum)2)); ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, "")); } } catch (Exception arg2) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg2}"); } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return null; } public static EffectResponse CkearFish(ControlClient client, EffectRequest req) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) EffectStatus val = (EffectStatus)0; string text = ""; try { Mod.ActionQueue.Enqueue(delegate { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_00ad: 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_012e: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown try { bool flag = false; bool flag2 = false; SerializableGrid inventory = GameManager.Instance.SaveData.Inventory; do { flag2 = false; foreach (SpatialItemInstance spatialItem in inventory.spatialItems) { ItemData itemDataById = GameManager.Instance.ItemManager.GetItemDataById<ItemData>(((ItemInstance)spatialItem).id); if (Object.op_Implicit((Object)(object)itemDataById) && (int)itemDataById.itemSubtype == 1) { flag = true; flag2 = true; GameManager.Instance.SaveData.Inventory.RemoveObjectFromGridData(spatialItem, true); GameManager.Instance.UI.ShowNotificationWithItemName((NotificationType)6, "notification.item-removed", itemDataById.itemNameKey, GameManager.Instance.LanguageManager.GetColor((DredgeColorTypeEnum)3)); break; } } } while (flag2); if (!flag) { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)1, "No fish in inventory.")); } else { ControlClient.Send((SimpleJSONResponse)new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, "")); } } catch (Exception arg2) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg2}"); } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return null; } public static EffectResponse Color(ControlClient client, EffectRequest req) { //IL_0002: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { string s = req.code.Split(new char[1] { '_' })[1]; string s2 = req.code.Split(new char[1] { '_' })[2]; int id = int.Parse(s); int id2 = int.Parse(s2); Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.DialogueRunner.ChangeBoatColor(id, id2); setProperty(GameManager.Instance.WeatherController, "weatherChangeTransitionStartTime", -99999f); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse SpawnMonster(ControlClient client, EffectRequest req) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { string s = req.code.Split(new char[1] { '_' })[1]; int id = int.Parse(s); Mod.ActionQueue.Enqueue(delegate { //IL_0047: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0079: Unknown result type (might be due to invalid IL or missing references) MonsterConfig[] array = (MonsterConfig[])getProperty(GameManager.Instance.MonsterManager, "monsterConfigs"); MonsterConfig val2 = array[id]; MonsterData monsterData = val2.monsterData; Vector3 val3 = ((Component)GameManager.Instance.Player).transform.position + ((Component)GameManager.Instance.Player).transform.forward * 5f; GameObject val4 = Object.Instantiate<GameObject>(monsterData.prefab, val3, Quaternion.identity); MarrowMonster monster = val4.GetComponent<MarrowMonster>(); monster.Init(monsterData, GameManager.Instance.Player, val2.path); List<MarrowMonster> list = (List<MarrowMonster>)getProperty(GameManager.Instance.MonsterManager, "marrowMonsters"); list.Add(monster); MarrowMonster val5 = monster; val5.OnDespawned = (Action)Delegate.Combine(val5.OnDespawned, (Action)delegate { callFunc(GameManager.Instance.MonsterManager, "OnMonsterDespawned", new object[2] { id, monster }); }); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Teleport(ControlClient client, EffectRequest req) { //IL_0002: 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_0069: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_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_00d5: 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_00f0: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0223: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { string s = req.code.Split(new char[1] { '_' })[1]; int id = int.Parse(s); Vector3[] dests = (Vector3[])(object)new Vector3[15] { new Vector3(6.993686f, -0.3209705f, 3.805297f), new Vector3(136.5563f, -0.32097f, 5.364019f), new Vector3(80.37583f, -0.3209714f, -111.4164f), new Vector3(92.1106f, -0.3209923f, 195.3986f), new Vector3(-306.3754f, -0.3209918f, 459.7136f), new Vector3(-460.3278f, -0.3209712f, 527.504f), new Vector3(430.7815f, -0.3209701f, 460.0402f), new Vector3(462.1723f, -0.3209606f, 673.5444f), new Vector3(623.5914f, -0.3209707f, 412.8581f), new Vector3(400.9278f, -0.3209701f, -349.392f), new Vector3(411.0558f, -0.2474921f, -443.3668f), new Vector3(342.1147f, -0.3209687f, -388.4335f), new Vector3(-334.566f, -0.3209673f, -419.5938f), new Vector3(-526.0281f, -0.3209687f, -573.6337f), new Vector3(-581.5466f, -0.32097f, -283.0213f) }; Mod.ActionQueue.Enqueue(delegate { //IL_000d: 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_001f: 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) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00b0: 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_00f4: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = dests[id]; val2.y = 0f; Vector3 waveDisplacement = WaveDisplacement.GetWaveDisplacement(val2, GameManager.Instance.WaveController.Steepness, GameManager.Instance.WaveController.Wavelength, GameManager.Instance.WaveController.Speed, GameManager.Instance.WaveController.Directions); val2 += waveDisplacement; BuoyantObject componentInChildren = ((Component)GameManager.Instance.Player).GetComponentInChildren<BuoyantObject>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { val2.y = 0f - componentInChildren.objectDepth; } Vector3 val3 = val2 - ((Component)GameManager.Instance.Player).transform.position; ((CinemachineVirtualCameraBase)GameManager.Instance.PlayerCamera.CinemachineCamera).OnTargetObjectWarped(((Component)GameManager.Instance.PlayerCamera.CinemachineCamera.m_Follow).gameObject.transform, val3); ((Component)GameManager.Instance.Player).transform.position = val2; GameManager.Instance.Input.SetActiveActionLayer((ActionLayer)3); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Despawn(ControlClient client, EffectRequest req) { //IL_0008: 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_0054: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; List<MarrowMonster> marrowMonsters = (List<MarrowMonster>)getProperty(GameManager.Instance.MonsterManager, "marrowMonsters"); if (marrowMonsters.Count == 0) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "No monsters to despawn."); } try { Mod.ActionQueue.Enqueue(delegate { marrowMonsters.ForEach(delegate(MarrowMonster m) { m.Despawn(); }); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse PassHour(ControlClient client, EffectRequest req) { //IL_0002: 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_003c: Expected O, but got Unknown //IL_0090: 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_0099: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; if ((bool)getProperty(GameManager.Instance.Time, "_freezeTime")) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } try { Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.Time.ForcefullyPassTime(1f, "feedback.pass-time-generic", (TimePassageMode)4); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse PassHours(ControlClient client, EffectRequest req) { //IL_0002: 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_003c: Expected O, but got Unknown //IL_0090: 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_0099: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; if ((bool)getProperty(GameManager.Instance.Time, "_freezeTime")) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } try { Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.Time.ForcefullyPassTime(4f, "feedback.pass-time-generic", (TimePassageMode)4); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse BackHour(ControlClient client, EffectRequest req) { //IL_0008: 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_0048: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_00ea: 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_00f3: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; bool flag = (bool)getProperty(GameManager.Instance.Time, "_freezeTime"); TimeProxy proxy = (TimeProxy)getProperty(GameManager.Instance.Time, "timeProxy"); if (flag) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } if (proxy.GetTimeAndDay() <= 1.0416666666666666666666666667m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Can't go back any further."); } try { Mod.ActionQueue.Enqueue(delegate { if (proxy.GetTimeAndDay() > 1.0416666666666666666666666667m) { proxy.SetTimeAndDay(proxy.GetTimeAndDay() - 0.0416666666666666666666666667m); } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse BackHours(ControlClient client, EffectRequest req) { //IL_0008: 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_0048: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_00ea: 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_00f3: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; bool flag = (bool)getProperty(GameManager.Instance.Time, "_freezeTime"); TimeProxy proxy = (TimeProxy)getProperty(GameManager.Instance.Time, "timeProxy"); if (flag) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } if (proxy.GetTimeAndDay() <= 1.2083333333333333333333333333m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Can't go back any further."); } try { Mod.ActionQueue.Enqueue(delegate { if (proxy.GetTimeAndDay() > 1.2083333333333333333333333333m) { proxy.SetTimeAndDay(proxy.GetTimeAndDay() - 0.1666666666666666666666666667m); } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse TimeDawn(ControlClient client, EffectRequest req) { //IL_0008: 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_0048: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0118: 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_0121: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; bool flag = (bool)getProperty(GameManager.Instance.Time, "_freezeTime"); TimeProxy proxy = (TimeProxy)getProperty(GameManager.Instance.Time, "timeProxy"); if (flag) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } decimal timeAndDay = proxy.GetTimeAndDay(); decimal day = Math.Floor(timeAndDay); timeAndDay -= Math.Floor(timeAndDay); float num = Math.Abs(GameManager.Instance.Time.DawnTime - (float)timeAndDay); if (num <= 1f / 24f) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Already dawn."); } try { Mod.ActionQueue.Enqueue(delegate { proxy.SetTimeAndDay(day + (decimal)GameManager.Instance.Time.DawnTime); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse TimeDusk(ControlClient client, EffectRequest req) { //IL_0008: 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_0048: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0118: 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_0121: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; bool flag = (bool)getProperty(GameManager.Instance.Time, "_freezeTime"); TimeProxy proxy = (TimeProxy)getProperty(GameManager.Instance.Time, "timeProxy"); if (flag) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } decimal timeAndDay = proxy.GetTimeAndDay(); decimal day = Math.Floor(timeAndDay); timeAndDay -= Math.Floor(timeAndDay); float num = Math.Abs(GameManager.Instance.Time.DuskTime - (float)timeAndDay); if (num <= 1f / 24f) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Already dusk."); } try { Mod.ActionQueue.Enqueue(delegate { proxy.SetTimeAndDay(day + (decimal)GameManager.Instance.Time.DuskTime); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Give10(ControlClient client, EffectRequest req) { //IL_0002: 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_0060: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.AddFunds(10.0m); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)2), ">Received $10</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)1, text2); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Give100(ControlClient client, EffectRequest req) { //IL_0002: 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_0060: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.AddFunds(100.0m); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)2), ">Received $100</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)1, text2); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Give1000(ControlClient client, EffectRequest req) { //IL_0002: 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_0060: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.AddFunds(1000.0m); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)2), ">Received $1000</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)1, text2); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Take10(ControlClient client, EffectRequest req) { //IL_0002: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.SaveData.Funds < 10.0m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not enough money."); } Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.AddFunds(-10.0m); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)3), ">Lost $10</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)2, text2); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Take100(ControlClient client, EffectRequest req) { //IL_0002: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.SaveData.Funds < 100.0m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not enough money."); } Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.AddFunds(-100.0m); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)3), ">Lost $100</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)2, text2); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Take1000(ControlClient client, EffectRequest req) { //IL_0002: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.SaveData.Funds < 1000.0m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not enough money."); } Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.AddFunds(-1000.0m); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)3), ">Lost $1000</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)2, text2); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse RepayDebt(ControlClient client, EffectRequest req) { //IL_0002: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.GameConfigData.GreaterMarrowDebt - GameManager.Instance.SaveData.GreaterMarrowRepayments <= 0m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not in debt."); } Mod.ActionQueue.Enqueue(delegate { //IL_003c: Unknown result type (might be due to invalid IL or missing references) decimal num = GameManager.Instance.GameConfigData.GreaterMarrowDebt - GameManager.Instance.SaveData.GreaterMarrowRepayments; GameManager.Instance.AddFunds(num); GameManager.Instance.DialogueRunner.RepayDebt(((object)(DockProgressType)1/*cast due to .constrained prefix*/).ToString(), num); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse RepayDebtHalf(ControlClient client, EffectRequest req) { //IL_0002: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.GameConfigData.GreaterMarrowDebt - GameManager.Instance.SaveData.GreaterMarrowRepayments <= 0m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not in debt."); } Mod.ActionQueue.Enqueue(delegate { //IL_004e: Unknown result type (might be due to invalid IL or missing references) decimal num = GameManager.Instance.GameConfigData.GreaterMarrowDebt - GameManager.Instance.SaveData.GreaterMarrowRepayments; num /= 2.0m; GameManager.Instance.AddFunds(num); GameManager.Instance.DialogueRunner.RepayDebt(((object)(DockProgressType)1/*cast due to .constrained prefix*/).ToString(), num); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse IncreaseDebt(ControlClient client, EffectRequest req) { //IL_0002: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.GameConfigData.GreaterMarrowDebt - GameManager.Instance.SaveData.GreaterMarrowRepayments <= 0m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not in debt."); } Mod.ActionQueue.Enqueue(delegate { setProperty(GameManager.Instance.GameConfigData, "greaterMarrowDebt", GameManager.Instance.GameConfigData.GreaterMarrowDebt * 2.0m); string text2 = string.Concat(new string[3] { "<color=#", GameManager.Instance.LanguageManager.GetColorCode((DredgeColorTypeEnum)3), ">Debt Repaid</color>" }); GameEvents.Instance.TriggerNotification((NotificationType)2, "Debt Increased"); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse IncreaseDebtHalf(ControlClient client, EffectRequest req) { //IL_0002: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.GameConfigData.GreaterMarrowDebt - GameManager.Instance.SaveData.GreaterMarrowRepayments <= 0m) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Not in debt."); } Mod.ActionQueue.Enqueue(delegate { setProperty(GameManager.Instance.GameConfigData, "greaterMarrowDebt", GameManager.Instance.GameConfigData.GreaterMarrowDebt * 1.5m); GameEvents.Instance.TriggerNotification((NotificationType)2, "Debt Increased"); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Insane(ControlClient client, EffectRequest req) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.Player.Sanity.CurrentSanity <= 0.1f) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Sanity already low."); } Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.Player.Sanity.ChangeSanity(0f - GameManager.Instance.Player.Sanity.CurrentSanity); GameEvents.Instance.TriggerNotification((NotificationType)2, "Sanity Drained"); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse Sane(ControlClient client, EffectRequest req) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { if (GameManager.Instance.Player.Sanity.CurrentSanity >= 0.9f) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Sanity already high."); } Mod.ActionQueue.Enqueue(delegate { GameManager.Instance.Player.Sanity.ChangeSanity(0.95f - GameManager.Instance.Player.Sanity.CurrentSanity); GameEvents.Instance.TriggerNotification((NotificationType)1, "Sanity Restored"); }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse SanityEvent(ControlClient client, EffectRequest req) { //IL_0002: 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_0029: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; try { Vector3 position = ((Component)GameManager.Instance.Player).transform.position; if (GameManager.Instance.WorldEventManager.DoesHitSafeZone(position)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "In safe zone."); } Mod.ActionQueue.Enqueue(delegate { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown try { WorldEventData val2 = null; List<WorldEventData> list = new List<WorldEventData>(); for (int i = 0; i < GameManager.Instance.DataLoader.allWorldEvents.Count; i++) { WorldEventData item = GameManager.Instance.DataLoader.allWorldEvents[i]; list.Add(item); } if (list.Count > 0) { int index = rng.Next(0, list.Count); val2 = list[index]; } if ((Object)(object)val2 != (Object)null) { float num = (val2.minSanity + val2.maxSanity) / 2f; GameManager.Instance.Player.Sanity.ChangeSanity(num - GameManager.Instance.Player.Sanity.CurrentSanity); TimeProxy val3 = (TimeProxy)getProperty(GameManager.Instance.Time, "timeProxy"); decimal timeAndDay = val3.GetTimeAndDay(); timeAndDay -= Math.Floor(timeAndDay); float num2 = Math.Abs(GameManager.Instance.Time.DawnTime - (float)timeAndDay); decimal num3 = Math.Floor(timeAndDay); val3.SetTimeAndDay(num3 + (decimal)val2.spawnStartTime); GameManager.Instance.WorldEventManager.DoEvent(val2); } else { Mod.mls.LogInfo((object)"No Event"); } } catch (Exception arg2) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg2}"); } }); } catch (Exception arg) { Mod.mls.LogInfo((object)$"Crowd Control Error: {arg}"); } return new EffectResponse(((SimpleJSONMessage)req).ID, val, text); } public static EffectResponse TimeSlow(ControlClient client, EffectRequest req) { //IL_0002: 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_007a: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if ((bool)getProperty(GameManager.Instance.Time, "_freezeTime")) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } if (TimedThread.isRunning(TimedType.TIME_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.TIME_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.TIME_STOP)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.TIME_SLOW, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse TimeFast(ControlClient client, EffectRequest req) { //IL_0002: 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_007a: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if ((bool)getProperty(GameManager.Instance.Time, "_freezeTime")) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } if (TimedThread.isRunning(TimedType.TIME_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.TIME_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.TIME_STOP)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.TIME_FAST, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse TimeStop(ControlClient client, EffectRequest req) { //IL_0002: 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_007a: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if ((bool)getProperty(GameManager.Instance.Time, "_freezeTime")) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time is frozen."); } if (TimedThread.isRunning(TimedType.TIME_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.TIME_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.TIME_STOP)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.TIME_STOP, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse FishInstant(ControlClient client, EffectRequest req) { //IL_0002: 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_0062: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if (TimedThread.isRunning(TimedType.FISH_INSTANT)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_MANUAL)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.FISH_INSTANT, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse FishFast(ControlClient client, EffectRequest req) { //IL_0002: 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_0062: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if (TimedThread.isRunning(TimedType.FISH_INSTANT)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_MANUAL)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.FISH_FAST, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse FishSlow(ControlClient client, EffectRequest req) { //IL_0002: 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_0062: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if (TimedThread.isRunning(TimedType.FISH_INSTANT)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.FISH_MANUAL)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.FISH_SLOW, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse FishManual(ControlClient client, EffectRequest req) { //IL_0002: 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_0062: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if (TimedThread.isRunning(TimedType.FISH_INSTANT)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.FISH_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.FISH_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } if (TimedThread.isRunning(TimedType.FISH_MANUAL)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Time effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.FISH_MANUAL, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse BoatXSlow(ControlClient client, EffectRequest req) { //IL_0002: 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_0062: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if (TimedThread.isRunning(TimedType.BOAT_FREEZE)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_XSLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_XFAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.BOAT_XSLOW, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse BoatSlow(ControlClient client, EffectRequest req) { //IL_0002: 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_0062: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown EffectStatus val = (EffectStatus)0; string text = ""; long num = 30L; if (req.duration > 0) { num = req.duration.Value / 1000; } if (TimedThread.isRunning(TimedType.BOAT_FREEZE)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_XSLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_SLOW)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_FAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } if (TimedThread.isRunning(TimedType.BOAT_XFAST)) { return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)3, "Timed effect already active"); } new Thread(new TimedThread(((SimpleJSONMessage)req).ID, TimedType.BOAT_SLOW, num * 1000).Run).Start(); return new EffectResponse(((SimpleJSONMessage)req).ID, (EffectStatus)0, num * 1000, (string)null); } public static EffectResponse BoatXFast(ControlClient client, EffectRequest req) { //IL_0002: 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_0062: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but