Decompiled source of ZN Custom Musicbox v1.0.7
com.adibtw.loadstone.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Adapters; using DunGen.Graph; using HarmonyLib; using HarmonyLib.Public.Patching; using LCSoundTool; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalExpansionCore.Patches; using Loadstone.Config; using Loadstone.Patches; using Loadstone.Patches.ExpansionCore; using Loadstone.Patches.LCSoundTool; using Microsoft.CodeAnalysis; using Unity.AI.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.adibtw.loadstone")] [assembly: AssemblyConfiguration("release")] [assembly: AssemblyDescription("Reduces stuttering during level loading")] [assembly: AssemblyFileVersion("0.1.15.0")] [assembly: AssemblyInformationalVersion("0.1.15+2e42cc0a2176d7f571a8cf1e858a2e67aefc7a26")] [assembly: AssemblyProduct("LoadstoneNightly")] [assembly: AssemblyTitle("com.adibtw.loadstone")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.15.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Loadstone { public static class ObjectPool { private static Dictionary<GameObject, Stack<GameObject>> availableObjects = new Dictionary<GameObject, Stack<GameObject>>(256); private static Dictionary<GameObject, GameObject> inUseObjects = new Dictionary<GameObject, GameObject>(1024); public static GameObject InstantiateTransparently(GameObject original, Vector3 position, Quaternion rotation, Transform parent) { //IL_0071: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!availableObjects.TryAdd(original, new Stack<GameObject>(4)) && availableObjects[original].TryPop(out var result) && (Object)(object)result != (Object)null) { inUseObjects[result] = original; result.SetActive(true); ((Object)result).hideFlags = (HideFlags)0; result.transform.parent = parent; result.transform.localPosition = position; result.transform.localRotation = rotation; return result; } result = Object.Instantiate<GameObject>(original, position, rotation, parent); inUseObjects[result] = original; return result; } public static GameObject InstantiateTransparently(GameObject original, Transform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return InstantiateTransparently(original, Vector3.zero, Quaternion.identity, parent); } public static GameObject InstantiateTransparently(GameObject original) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return InstantiateTransparently(original, Vector3.zero, Quaternion.identity, null); } public static void InstantiateInvisibly(GameObject original) { GameObject val = Object.Instantiate<GameObject>(original); Object.DontDestroyOnLoad((Object)(object)val); val.SetActive(false); ((Object)val).hideFlags = (HideFlags)52; availableObjects[original].Push(val); } public static void ReleaseObject(GameObject toRelease) { if ((Object)(object)toRelease == (Object)null) { return; } if (!inUseObjects.Remove(toRelease, out var value)) { NetworkObject val = default(NetworkObject); if (toRelease.TryGetComponent<NetworkObject>(ref val)) { val.Despawn(true); } else { Object.DestroyImmediate((Object)(object)toRelease, false); } } else { toRelease.transform.parent = null; Object.DontDestroyOnLoad((Object)(object)toRelease); toRelease.SetActive(false); ((Object)toRelease).hideFlags = (HideFlags)52; availableObjects[value].Push(toRelease); } } public static void ReleaseAllObjects() { foreach (GameObject key in inUseObjects.Keys) { if ((Object)(object)key == (Object)null) { Loadstone.LogDebug("A pooled object for " + ((Object)inUseObjects[key]).name + " being mass released was null!"); continue; } key.transform.parent = null; Object.DontDestroyOnLoad((Object)(object)key); key.SetActive(false); ((Object)key).hideFlags = (HideFlags)52; availableObjects[inUseObjects[key]].Push(key); } inUseObjects.Clear(); } } [BepInPlugin("com.adibtw.loadstone.Nightly", "LoadstoneNightly", "0.1.15")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Loadstone : BaseUnityPlugin { private static ManualLogSource CurrentLog; private static ManualLogSource HarmonyLog; private static ManualLogSource TranspilerLog; private void Awake() { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Loading Loadstone..."); HarmonyLog = Logger.CreateLogSource(" LoadstoneNightly(Harmony)"); TranspilerLog = Logger.CreateLogSource(" LoadstoneNightly(Transpiler)"); CurrentLog = TranspilerLog; ((BaseUnityPlugin)this).Logger.LogDebug((object)"Loading Configs..."); LoadstoneConfig.BindAllTo(((BaseUnityPlugin)this).Config); ((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching Methods..."); if (LoadstoneConfig.StatusChangeFix.Value) { ConflictResolver.TryPatch(typeof(StatusChangedFixer)); if (LoadstoneConfig.AsyncDungeon.Value) { ConflictResolver.TryPatch(typeof(AsyncDungeonPatches)); if (LoadstoneConfig.DungeonRealization.Value) { ConflictResolver.TryPatch(typeof(FromProxyPatches)); } } } if (LoadstoneConfig.AsyncNavmesh.Value) { ConflictResolver.TryPatch(typeof(NavmeshPatches)); } ConflictResolver.TryPatch(typeof(ScreenDarkenPatches)); ConflictResolver.TryPatch(typeof(ObjectFindPatches)); if (LoadstoneConfig.ObjectPooling.Value) { ConflictResolver.TryPatch(typeof(PoolingPatches)); } if (LoadstoneConfig.DunGenOptimizations.Value) { ConflictResolver.TryPatch(typeof(DungenOptimizationPatches)); } if (LoadstoneConfig.LocalPerformanceReports.Value) { ConflictResolver.TryPatch(typeof(PerformanceReportPatches)); } CheckModded(); CurrentLog = HarmonyLog; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Loadstone is loaded!"); } private void Start() { ConflictResolver.CheckUnknownPatches(); } private void CheckModded() { OptionalModPatcher(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loadstone modded compat is loaded!"); } private void OptionalModPatcher() { using Dictionary<string, PluginInfo>.KeyCollection.Enumerator enumerator = Chainloader.PluginInfos.Keys.GetEnumerator(); while (enumerator.MoveNext()) { switch (enumerator.Current) { case "com.github.lethalmods.lethalexpansioncore": PatchExpansionCore(); break; case "LCSoundTool": PatchLCSoundTool(); break; case "ainavt.lc.lethalconfig": LoadstoneDynamicConfig.RegisterDynamicConfig(); break; } } } private void PatchExpansionCore() { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching ExpansionCore"); ConflictResolver.TryPatch(typeof(DungeonGenerator_PatchPatches)); } private void PatchLCSoundTool() { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching with LCSoundTool"); ConflictResolver.TryPatch(typeof(RoundManagerMusicPatches)); } internal static void Log(LogLevel level, object data) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) CurrentLog.Log(level, data); } internal static void LogDebug(object data) { CurrentLog.LogDebug(data); } internal static void LogError(object data) { CurrentLog.LogError(data); } internal static void LogFatal(object data) { CurrentLog.LogFatal(data); } internal static void LogInfo(object data) { CurrentLog.LogInfo(data); } internal static void LogMessage(object data) { CurrentLog.LogMessage(data); } internal static void LogWarning(object data) { CurrentLog.LogWarning(data); } } public static class PluginInfo { public const string PLUGIN_GUID = "com.adibtw.loadstone.Nightly"; public const string PLUGIN_NAME = "LoadstoneNightly"; public const string PLUGIN_VERSION = "0.1.15"; } } namespace Loadstone.Patches { public class AsyncDungeonPatches { [HarmonyPatch(typeof(DungeonGenerator), "ShouldSkipFrame")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ShouldSkipFrameTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown Loadstone.LogDebug("Attempting to inject modified frame skip transpiler into DungeonGenerator::ShouldSkipFrame"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).Start().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.DeclaredField(typeof(DungeonGenerator), "yieldTimer")), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.DeclaredMethod(typeof(Stopwatch), "Start", (Type[])null, (Type[])null)) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.DeclaredMethod(typeof(Stopwatch), "Restart", (Type[])null, (Type[])null), (string)null) }) .Advance(2) .SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(Stopwatch), "Reset", (Type[])null, (Type[])null)) .InstructionEnumeration(); Loadstone.LogDebug("Validating injected frame skip transpiler into DungeonGenerator::ShouldSkipFrame"); return result; } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyPrefix] private static void GenerateNewFloorPatch(RoundManager __instance) { if ((Object)(object)__instance.dungeonGenerator == (Object)null) { Loadstone.LogWarning("Runtime dungeon was null, not forcing Async dungeon for this landing"); return; } __instance.dungeonGenerator.Generator.GenerateAsynchronously = LoadstoneConfig.AsyncDungeon.Value; __instance.dungeonGenerator.Generator.PauseBetweenRooms = 0f; __instance.dungeonGenerator.Generator.MaxAsyncFrameMilliseconds = LoadstoneConfig.DungeonAsyncMaxTime.Value; } } public static class ConflictResolver { private static Harmony HarmonyInstance; private static bool HasOurs; static ConflictResolver() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown HarmonyInstance = new Harmony("com.adibtw.loadstone.Nightly"); } public static void CheckUnknownPatches() { foreach (MethodBase method in PatchManager.GetPatchedMethods()) { PatchInfo patchInfo = PatchManager.GetPatchInfo(method); patchInfo.transpilers.Where((Patch patch) => !IsPatchOurs(patch, method)).ToList().ForEach(delegate(Patch patch) { WarnPatch(patch, method, "transpiler"); }); HasOurs = false; patchInfo.ilmanipulators.Where((Patch patch) => !IsPatchOurs(patch, method)).ToList().ForEach(delegate(Patch patch) { WarnPatch(patch, method, "IL manipulator"); }); HasOurs = false; patchInfo.prefixes.Where((Patch patch) => !IsPatchOurs(patch, method)).ToList().ForEach(delegate(Patch patch) { WarnPatch(patch, method, "prefix"); }); HasOurs = false; patchInfo.postfixes.Where((Patch patch) => !IsPatchOurs(patch, method)).ToList().ForEach(delegate(Patch patch) { WarnPatch(patch, method, "postfix"); }); HasOurs = false; patchInfo.finalizers.Where((Patch patch) => !IsPatchOurs(patch, method)).ToList().ForEach(delegate(Patch patch) { WarnPatch(patch, method, "finalizer"); }); HasOurs = false; } } public static bool IsPatchOurs(Patch patch, MethodBase method) { string name = patch.GetMethod(method).DeclaringType.Assembly.GetName().Name; HasOurs = HasOurs || name == "com.adibtw.loadstone"; return name == "com.adibtw.loadstone"; } public static void WarnPatch(Patch patch, MethodBase method, string patchType) { if (HasOurs) { Loadstone.LogWarning("The assembly \"" + patch.GetMethod(method).DeclaringType.Assembly.GetName().Name + "\" has patched the method \"" + method.ToString() + "\" with a " + patchType + " using \"" + patch.GetMethod(method).ToString() + "\", which we also modify. Unexpected behaviour may occur"); } } public static void TryPatch(Type type) { try { HarmonyInstance.CreateClassProcessor(type, true).Patch(); } catch (Exception ex) { Loadstone.LogFatal($"Loadstone failed to patch {type}. The following exception was received:\n{ex.ToString()}"); } } } public class DungenOptimizationPatches { internal static Dictionary<Tile, Dictionary<Tile, bool>> DungeonTagMatchTemp = null; internal static Dictionary<DungeonFlow, Dictionary<Tile, Dictionary<Tile, bool>>> TagMatchDictionary = new Dictionary<DungeonFlow, Dictionary<Tile, Dictionary<Tile, bool>>>(); [HarmonyPatch(typeof(DungeonFlow), "HasMatchingTagPair")] [HarmonyPrefix] private static bool HasMatchingTagPairEarlyOut(DungeonFlow __instance, Tile tileA, Tile tileB, ref bool __result) { if (tileA.Tags.Tags.Count == 0 || tileB.Tags.Tags.Count == 0) { __result = false; return false; } try { __result = DungeonTagMatchTemp[tileA][tileB]; } catch (KeyNotFoundException) { Loadstone.LogWarning("The tile pair of \"" + ((Object)tileA).name + "\" and \"" + ((Object)tileB).name + "\" was not found in the tag cache! This pair is now being cached, which will cause a small performance penalty"); if (!TagMatchDictionary.ContainsKey(__instance)) { TagMatchDictionary[__instance] = new Dictionary<Tile, Dictionary<Tile, bool>>(); DungeonTagMatchTemp = TagMatchDictionary[__instance]; } if (!DungeonTagMatchTemp.ContainsKey(tileA)) { DungeonTagMatchTemp[tileA] = new Dictionary<Tile, bool>(); } if (!DungeonTagMatchTemp.ContainsKey(tileB)) { DungeonTagMatchTemp[tileB] = new Dictionary<Tile, bool>(); } __result = HasMatchingTagPairOriginal(__instance, tileA, tileB); DungeonTagMatchTemp[tileA][tileB] = __result; DungeonTagMatchTemp[tileB][tileA] = HasMatchingTagPairOriginal(__instance, tileB, tileA); } return false; } [HarmonyPatch(typeof(DungeonFlow), "HasMatchingTagPair")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static bool HasMatchingTagPairOriginal(DungeonFlow flow, Tile tileA, Tile tileB) { throw new NotImplementedException("Reverse Patch Stub"); } private static void GenerateTileHashSet(ref HashSet<Tile> tiles, List<TileSet> tileSets) { foreach (TileSet tileSet in tileSets) { foreach (GameObjectChance weight in tileSet.TileWeights.Weights) { Tile component = weight.Value.GetComponent<Tile>(); if (!((Object)(object)component == (Object)null)) { tiles.Add(component); } } } } private static Dictionary<Tile, Dictionary<Tile, bool>> TileConnectionTagOptimization(HashSet<Tile> tiles, DungeonFlow flow) { Dictionary<Tile, Dictionary<Tile, bool>> dictionary = new Dictionary<Tile, Dictionary<Tile, bool>>(); foreach (Tile tile in tiles) { Dictionary<Tile, bool> dictionary2 = new Dictionary<Tile, bool>(); foreach (Tile tile2 in tiles) { dictionary2.Add(tile2, HasMatchingTagPairOriginal(flow, tile, tile2)); } dictionary.Add(tile, dictionary2); } return dictionary; } [HarmonyPatch(typeof(DungeonGenerator), "Generate")] [HarmonyPrefix] private static void TileTagPrecalcPatch(DungeonGenerator __instance) { DungeonFlow dungeonFlow = __instance.DungeonFlow; if (TagMatchDictionary.ContainsKey(dungeonFlow)) { if (!TagMatchDictionary[dungeonFlow].Values.Any((Dictionary<Tile, bool> tile) => tile == null)) { return; } Loadstone.LogWarning("At least one tile in " + ((Object)dungeonFlow).name + " has been deleted since the flow was last cached! The cache will be fully recalculated as a result"); } HashSet<Tile> tiles = new HashSet<Tile>(); foreach (GraphNode node in dungeonFlow.Nodes) { GenerateTileHashSet(ref tiles, node.TileSets); } foreach (GraphLine line in dungeonFlow.Lines) { foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes) { GenerateTileHashSet(ref tiles, dungeonArchetype.TileSets); GenerateTileHashSet(ref tiles, dungeonArchetype.BranchCapTileSets); } } TagMatchDictionary.Add(dungeonFlow, TileConnectionTagOptimization(tiles, dungeonFlow)); DungeonTagMatchTemp = TagMatchDictionary[dungeonFlow]; } } public class FromProxyPatches { public static bool ConversionComplete; [HarmonyPatch(typeof(Dungeon), "FromProxy")] [HarmonyPrefix] private static bool FromProxyPre(Dungeon __instance, DungeonProxy proxyDungeon, DungeonGenerator generator) { ConversionComplete = false; ((MonoBehaviour)__instance).StartCoroutine(FromProxyEnumerator(generator, proxyDungeon, __instance)); return false; } private static IEnumerator FromProxyEnumerator(DungeonGenerator generator, DungeonProxy proxyDungeon, Dungeon __instance) { __instance.Clear(); Dictionary<TileProxy, Tile> dictionary = new Dictionary<TileProxy, Tile>(); MethodInfo shouldSkip = typeof(DungeonGenerator).GetMethod("ShouldSkipFrame", BindingFlags.Instance | BindingFlags.NonPublic); foreach (TileProxy allTile in proxyDungeon.AllTiles) { FromProxyIteration(__instance, dictionary, generator, allTile); if ((bool)shouldSkip.Invoke(generator, new object[1] { false })) { yield return null; } } FromProxyEnd(__instance, proxyDungeon, generator, dictionary); ConversionComplete = true; } [HarmonyPatch(typeof(Dungeon), "FromProxy")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void FromProxyIteration(Dungeon __instance, Dictionary<TileProxy, Tile> dictionary, DungeonGenerator generator, TileProxy tile) { StartTranspiler(null, null); static IEnumerable<CodeInstruction> StartTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown Loadstone.LogDebug("Attempting to reverse-patch Dungeon::FromProxy's first inner for loop"); CodeMatcher val = new CodeMatcher(instructions, generator); int pos = val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Br, (object)null, (string)null) }).Advance(4).Pos; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_3, (object)null), new CodeInstruction(OpCodes.Stloc_2, (object)null), new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Stloc_0, (object)null) }); int pos2 = val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Endfinally, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloca_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)null, (string)null) }).Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ret, (object)null) }) .Pos; Label label = default(Label); val.CreateLabel(ref label); val.MatchBack(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Brtrue, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Leave, (object)null, (string)null) }).Advance(1).SetOperandAndAdvance((object)label); IEnumerable<CodeInstruction> enumerable = val.InstructionsInRange(pos, pos2).AsEnumerable(); if (LoadstoneConfig.ObjectPooling.Value) { enumerable = PoolingPatches.FromProxyPoolingPatch(enumerable); } Loadstone.LogDebug("Validating reverse-patched Dungeon::FromProxy's first inner for loop"); return enumerable; } } [HarmonyPatch(typeof(Dungeon), "FromProxy")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] private static void FromProxyEnd(Dungeon __instance, DungeonProxy proxyDungeon, DungeonGenerator generator, Dictionary<TileProxy, Tile> dictionary) { EndTranspiler(null); static IEnumerable<CodeInstruction> EndTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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 //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown Loadstone.LogDebug("Attempting to reverse-patch Dungeon::FromProxy's final code"); CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); int pos = val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Endfinally, (object)null, (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldarg_1, (object)null, (string)null) }).Pos; val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_3, (object)null), new CodeInstruction(OpCodes.Stloc_0, (object)null), new CodeInstruction(OpCodes.Ldtoken, (object)typeof(GameObject)), new CodeInstruction(OpCodes.Pop, (object)null) }); int pos2 = val.End().Pos; List<CodeInstruction> source = val.InstructionsInRange(pos, pos2); Loadstone.LogDebug("Validating reverse-patched Dungeon::FromProxy's final code"); return source.AsEnumerable(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> PostProcessPatch(IEnumerable<CodeInstruction> instructions) { //IL_0041: 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_0061: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown Loadstone.LogDebug("Attempting to inject async check into DungeonGenerator::PostProcess"); Type[] array = new Type[1] { typeof(Func<bool>) }; Type[] array2 = new Type[2] { typeof(object), typeof(IntPtr) }; IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldnull, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)null, (string)null) }).SetOpcodeAndAdvance(OpCodes.Nop).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldloc_2, (object)null), new CodeInstruction(OpCodes.Ldftn, (object)AccessTools.Method(typeof(FromProxyPatches), "PostProcessCheck", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Newobj, (object)AccessTools.Constructor(typeof(Func<bool>), array2, false)), new CodeInstruction(OpCodes.Newobj, (object)AccessTools.Constructor(typeof(WaitUntil), array, false)) }) .InstructionEnumeration(); Loadstone.LogDebug("Validating injected async check into DungeonGenerator::PostProcess"); return result; } private static bool PostProcessCheck() { return ConversionComplete; } } public class NavmeshPatches { [HarmonyPatch(typeof(RoundManager), "SpawnOutsideHazards")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SpawnOutsideHazardsPatch(IEnumerable<CodeInstruction> instructions) { //IL_000c: 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_0053: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown Loadstone.LogDebug("Writing SpawnOutsideHazards Transpiler"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameObject), "GetComponent", (Type[])null, new Type[1] { typeof(NavMeshSurface) }), (string)null) }).Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldarg_0, (object)null) }) .Set(OpCodes.Call, (object)AccessTools.Method(typeof(NavmeshPatches), "GenerateNavMeshAsync", new Type[2] { typeof(NavMeshSurface), typeof(RoundManager) }, (Type[])null)) .InstructionEnumeration(); Loadstone.LogDebug("Verifying SpawnOutsideHazards Transpiler"); return result; } [HarmonyPatch(typeof(UnityNavMeshAdapter), "BakeFullDungeon")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> BakeFullDungeonPatch(IEnumerable<CodeInstruction> instructions) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown Loadstone.LogDebug("Writing UnityNavMeshAdapter Transpiler"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.DeclaredMethod(typeof(NavMeshSurface), "BuildNavMesh", (Type[])null, (Type[])null), (string)null) }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher matcher) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldarg_0, (object)null) }).SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(NavmeshPatches), "GenerateNavMeshAsync", (Type[])null, (Type[])null)); }, (Action<string>)null).InstructionEnumeration(); Loadstone.LogDebug("Verifying UnityNavMeshAdapter Transpiler"); return result; } private static void GenerateNavMeshAsync(NavMeshSurface navMeshSurface, MonoBehaviour coroutineHijack) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_00ab: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) List<NavMeshBuildSource> list = (List<NavMeshBuildSource>)typeof(NavMeshSurface).GetMethod("CollectSources", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(navMeshSurface, new object[0]); Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(navMeshSurface.center, navMeshSurface.size); if ((int)navMeshSurface.collectObjects != 1) { val = (Bounds)typeof(NavMeshSurface).GetMethod("CalculateWorldBounds", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(navMeshSurface, new object[1] { list }); } Loadstone.LogDebug($"Updating navmesh with {list.Count} obstacles"); NavMeshBuildSettings buildSettings = navMeshSurface.GetBuildSettings(); if ((Object)(object)navMeshSurface.navMeshData != (Object)null) { navMeshSurface.navMeshData.position = ((Component)navMeshSurface).transform.position; navMeshSurface.navMeshData.rotation = ((Component)navMeshSurface).transform.rotation; } else { navMeshSurface.navMeshData = new NavMeshData(((NavMeshBuildSettings)(ref buildSettings)).agentTypeID) { position = ((Component)navMeshSurface).transform.position, rotation = ((Component)navMeshSurface).transform.rotation }; } coroutineHijack.StartCoroutine(NavMeshUpdateCheck(NavMeshBuilder.UpdateNavMeshDataAsync(navMeshSurface.navMeshData, buildSettings, list, val), navMeshSurface)); } private static IEnumerator NavMeshUpdateCheck(AsyncOperation asyncOperation, NavMeshSurface navMeshSurface) { while (!asyncOperation.isDone) { yield return null; } navMeshSurface.RemoveData(); navMeshSurface.AddData(); Loadstone.LogDebug("Updated navmesh"); } } public class ObjectFindPatches { [HarmonyPatch(typeof(InteractTrigger), "Start")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> InteractTriggerPatch(IEnumerable<CodeInstruction> instructions) { Loadstone.LogDebug("Attempting to replace InteractTrigger's StartOfRound finding function"); IEnumerable<CodeInstruction> result = StartOfRoundFixer(instructions); Loadstone.LogDebug("Verifying InteractTrigger's replaced StartOfRound finding function"); return result; } [HarmonyPatch(typeof(OutOfBoundsTrigger), "Start")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> OutOfBoundsTriggerPatch(IEnumerable<CodeInstruction> instructions) { Loadstone.LogDebug("Attempting to replace OutOfBoundsTrigger's StartOfRound finding function"); IEnumerable<CodeInstruction> result = StartOfRoundFixer(instructions); Loadstone.LogDebug("Verifying OutOfBoundsTrigger's replaced StartOfRound finding function"); return result; } [HarmonyPatch(typeof(FoliageDetailDistance), "Start")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> FoliageDetailDistancePatch(IEnumerable<CodeInstruction> instructions) { Loadstone.LogDebug("Attempting to replace FoliageDetailDistance's StartOfRound finding function"); IEnumerable<CodeInstruction> result = StartOfRoundFixer(instructions); Loadstone.LogDebug("Verifying FoliageDetailDistance's replaced StartOfRound finding function"); return result; } [HarmonyPatch(typeof(ItemDropship), "Start")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ItemDropshipPatch(IEnumerable<CodeInstruction> instructions) { Loadstone.LogDebug("Attempting to replace ItemDropship's StartOfRound finding function"); IEnumerable<CodeInstruction> result = StartOfRoundFixer(instructions); Loadstone.LogDebug("Verifying ItemDropship's replaced StartOfRound finding function"); return result; } [HarmonyPatch(typeof(animatedSun), "Start")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> animatedSunPatch(IEnumerable<CodeInstruction> instructions) { Loadstone.LogDebug("Attempting to replace animatedSun's TImeOfDay finding function"); IEnumerable<CodeInstruction> result = InstanceFixer(instructions, typeof(TimeOfDay)); Loadstone.LogDebug("Verifying animatedSun's replaced TImeOfDay finding function"); return result; } private static IEnumerable<CodeInstruction> StartOfRoundFixer(IEnumerable<CodeInstruction> instructions) { return InstanceFixer(instructions, typeof(StartOfRound)); } private static IEnumerable<CodeInstruction> InstanceFixer(IEnumerable<CodeInstruction> instructions, Type instanceType) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(Object), "FindObjectOfType", new Type[0], new Type[1] { instanceType }), (string)null) }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher matcher) { matcher.SetOperandAndAdvance((object)AccessTools.DeclaredMethod(instanceType, "get_Instance", (Type[])null, (Type[])null)); }, (Action<string>)null).InstructionEnumeration(); } } public class PerformanceReportPatches { private static Stopwatch timer = new Stopwatch(); private static double DungeonWaitStartedAt = 0.0; private static double DungeonWaitEndedAt = 0.0; private static double FinishGeneratingLevelCalledAt = 0.0; private static DungeonGenerator CurrentGenerator = null; [HarmonyPatch(typeof(StartOfRound), "StartGame")] [HarmonyPrefix] private static void StartGameCalled() { timer.Reset(); timer.Start(); } [HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")] [HarmonyPrefix] private static void FinishGeneratingLevel() { FinishGeneratingLevelCalledAt = timer.Elapsed.TotalMilliseconds; timer.Stop(); GenerationStats val = null; if (CurrentGenerator != null) { val = CurrentGenerator.GenerationStats; } Loadstone.LogInfo("Level Loading Stats:"); if (val != null) { Loadstone.LogInfo(" DunGen"); Loadstone.LogInfo($" MainPathRoomCount: {val.MainPathRoomCount}"); Loadstone.LogInfo($" BranchPathRoomCount: {val.BranchPathRoomCount}"); Loadstone.LogInfo($" MaxBranchDepth: {val.MaxBranchDepth}"); Loadstone.LogInfo($" TotalRetries: {val.TotalRetries}"); Loadstone.LogInfo($" PrunedBranchTileCount: {val.PrunedBranchTileCount}"); Loadstone.LogInfo($" PreProcessTime: {val.PreProcessTime / 1000f} seconds"); Loadstone.LogInfo($" MainPathGenerationTime: {val.MainPathGenerationTime / 1000f} seconds"); Loadstone.LogInfo($" BranchPathGenerationTime: {val.BranchPathGenerationTime / 1000f} seconds"); Loadstone.LogInfo($" PostProcessTime: {val.PostProcessTime / 1000f} seconds"); Loadstone.LogInfo($" TotalTime: {val.TotalTime / 1000f} seconds"); } else { Loadstone.LogInfo(" No DunGen timing stats present"); } Loadstone.LogInfo($" Started Waiting for Others' Dungeons to Finish after {DungeonWaitStartedAt / 1000.0} seconds"); Loadstone.LogInfo($" Finished Waiting for Others' Dungeons to Finish after {DungeonWaitEndedAt / 1000.0} seconds"); Loadstone.LogInfo($" Total generation time took {FinishGeneratingLevelCalledAt / 1000.0} seconds"); } private static void DungeonWaitStarted() { DungeonWaitStartedAt = timer.Elapsed.TotalMilliseconds; } private static void DungeonWaitEnded() { DungeonWaitEndedAt = timer.Elapsed.TotalMilliseconds; } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyPostfix] private static void GetDungeonReference(RoundManager __instance) { CurrentGenerator = __instance.dungeonGenerator.Generator; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> DungeonWaitDetection(IEnumerable<CodeInstruction> instructions) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown Loadstone.LogDebug("Attempting to patch Dungeon Wait Detection into RoundManager::LoadNewLevelWait"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldftn, (object)null, (string)null) }).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldftn, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(PerformanceReportPatches), "DungeonWaitStarted", (Type[])null, (Type[])null)) }) .Advance(10) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(PerformanceReportPatches), "DungeonWaitEnded", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); Loadstone.LogDebug("Validating Dungeon Wait Detection patch in RoundManager::LoadNewLevelWait"); return result; } } public class PoolingPatches { private static CodeMatch InstantiateMatcher = new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Call && ((MethodInfo)i.operand).Name == "Instantiate" && ((MethodInfo)i.operand).DeclaringType == typeof(Object)), (string)null); [HarmonyPatch(typeof(DungeonGenerator), "Generate")] [HarmonyPostfix] private static void GenerateHijack(DungeonGenerator __instance) { GenerationStats generationStats = __instance.GenerationStats; Loadstone.LogDebug($"DunGen Stats:\nPre-process Time: {generationStats.PreProcessTime}\nMain Path Generation Time: {generationStats.MainPathGenerationTime}\nBranch Path Generation Time: {generationStats.BranchPathGenerationTime}\nPost-process Time: {generationStats.PostProcessTime}\nTotal Time: {generationStats.TotalTime}"); } [HarmonyPatch(typeof(RoundManager), "UnloadSceneObjectsEarly")] [HarmonyPostfix] private static void RoundManagerStartHijack() { ObjectPool.ReleaseAllObjects(); } [HarmonyPatch(typeof(DungeonProxy), "AddTile")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AddTilePoolingPatch(IEnumerable<CodeInstruction> instructions) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Loadstone.LogDebug("Attempting to inject pooling patches into DungeonProxy::AddTile"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { InstantiateMatcher }).SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(ObjectPool), "InstantiateTransparently", new Type[2] { typeof(GameObject), typeof(Transform) }, (Type[])null)).InstructionEnumeration(); Loadstone.LogDebug("Validating injected pooling patches into DungeonProxy::AddTile"); return result; } [HarmonyPatch(typeof(DungeonProxy), "RemoveTile")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> RemoveTilePoolingPatch(IEnumerable<CodeInstruction> instructions) { //IL_000c: 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_0053: Expected O, but got Unknown Loadstone.LogDebug("Attempting to inject pooling patches into DungeonProxy::RemoveTile"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(Object), "DestroyImmediate", new Type[1] { typeof(Object) }, (Type[])null), (string)null) }).SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(ObjectPool), "ReleaseObject", (Type[])null, (Type[])null)).InstructionEnumeration(); Loadstone.LogDebug("Validating injected pooling patches into DungeonProxy::RemoveTile"); return result; } [HarmonyPatch(typeof(UnityUtil), "Destroy")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> DestroyPoolingPatch(IEnumerable<CodeInstruction> instructions) { //IL_000c: 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_0053: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown Loadstone.LogDebug("Attempting to inject pooling patches into UnityUtil::Destroy"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(Object), "Destroy", new Type[1] { typeof(Object) }, (Type[])null), (string)null) }).SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(ObjectPool), "ReleaseObject", (Type[])null, (Type[])null)).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(Object), "DestroyImmediate", new Type[1] { typeof(Object) }, (Type[])null), (string)null) }) .SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(ObjectPool), "ReleaseObject", (Type[])null, (Type[])null)) .InstructionEnumeration(); Loadstone.LogDebug("Validating injected pooling patches into UnityUtil::Destroy"); return result; } [HarmonyPatch(typeof(Dungeon), "FromProxy")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> FromProxyPoolingPatch(IEnumerable<CodeInstruction> instructions) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown Loadstone.LogDebug("Attempting to inject pooling patches into Dungeon::FromProxy"); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { InstantiateMatcher }).SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(ObjectPool), "InstantiateTransparently", new Type[2] { typeof(GameObject), typeof(Transform) }, (Type[])null)).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { InstantiateMatcher }) .SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(ObjectPool), "InstantiateTransparently", new Type[1] { typeof(GameObject) }, (Type[])null)) .Start() .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(Object), "DestroyImmediate", new Type[2] { typeof(Object), typeof(bool) }, (Type[])null), (string)null) }) .Repeat((Action<CodeMatcher>)delegate(CodeMatcher matcher) { matcher.SetOperandAndAdvance((object)AccessTools.DeclaredMethod(typeof(PoolingPatches), "DestroyImmediateTransparently", (Type[])null, (Type[])null)); }, (Action<string>)null) .InstructionEnumeration(); Loadstone.LogDebug("Validating injected pooling patches into Dungeon::FromProxy"); return result; } private static void DestroyImmediateTransparently(Object obj, bool allowDestroyingAssets) { if (!((object)obj).GetType().IsAssignableFrom(typeof(GameObject))) { Object.DestroyImmediate(obj, allowDestroyingAssets); } else { ObjectPool.ReleaseObject((GameObject)(object)((obj is GameObject) ? obj : null)); } } } public class ScreenDarkenPatches { [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> GenerateNewLevelPatch(IEnumerable<CodeInstruction> instructions) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (LoadstoneConfig.SeedDisplayConfig.Value == LoadstoneConfig.SeedDisplayType.Darken) { return instructions; } Loadstone.LogDebug("Attempting to disable screen overlay on scene load in \"RoundManager::GenerateNewLevelClientRpc\""); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }).SetOpcodeAndAdvance(OpCodes.Ldc_I4_0).InstructionEnumeration(); Loadstone.LogDebug("Validating disabled screen overlay on scene load in \"RoundManager::GenerateNewLevelClientRpc\""); return result; } [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] private static void GenerateNewLevelClientRpcPrefixPath(int randomSeed) { Loadstone.LogInfo($"Random seed: {randomSeed}"); if (LoadstoneConfig.SeedDisplayConfig.Value == LoadstoneConfig.SeedDisplayType.Popup) { HUDManager.Instance.DisplayTip("Random Seed", $"{randomSeed}", false, false, "LC_Tip1"); } } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> OnLoadCompletePatch(IEnumerable<CodeInstruction> instructions) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown if (LoadstoneConfig.SeedDisplayConfig.Value == LoadstoneConfig.SeedDisplayType.Darken) { return instructions; } Loadstone.LogDebug("Attempting to disable screen overlay on scene load in \"StartOfRound::SceneManager_OnLoadComplete1\""); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }).SetOpcodeAndAdvance(OpCodes.Ldc_I4_0).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }) .SetOpcodeAndAdvance(OpCodes.Ldc_I4_0) .InstructionEnumeration(); Loadstone.LogDebug("Validating disabled screen overlay on scene load in \"StartOfRound::SceneManager_OnLoadComplete1\""); return result; } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoad")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> OnLoadPatch(IEnumerable<CodeInstruction> instructions) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (LoadstoneConfig.SeedDisplayConfig.Value == LoadstoneConfig.SeedDisplayType.Darken) { return instructions; } Loadstone.LogDebug("Attempting to disable screen overlay on scene load in \"StartOfRound::SceneManager_OnLoad\""); IEnumerable<CodeInstruction> result = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null) }).SetOpcodeAndAdvance(OpCodes.Ldc_I4_0).InstructionEnumeration(); Loadstone.LogDebug("Validating disabled screen overlay on scene load in \"StartOfRound::SceneManager_OnLoad\""); return result; } } public class StatusChangedFixer { [HarmonyPatch(typeof(RoundManager), "Generator_OnGenerationStatusChanged")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> StatusChangedPatch(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown Loadstone.LogDebug("Attempting to fix Generator_OnGenerationStatusChanged"); Label label = default(Label); return new CodeMatcher(instructions, ilGenerator).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null) }).CreateLabel(ref label).Start() .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Bne_Un, (object)null, (string)null) }) .SetOperandAndAdvance((object)label) .InstructionEnumeration(); } } } namespace Loadstone.Patches.LCSoundTool { [HarmonyPatch(typeof(RoundManager))] public class RoundManagerMusicPatches { internal static AudioSource loadingAudioSource; internal static AudioClip loadingAudioClip = SoundTool.GetAudioClip("AdiBTW-LoadstoneNightly", "LoadstoneLoading.ogg"); [HarmonyPatch("Awake")] [HarmonyPrefix] private static void CreateAudioSource() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 if ((Object)(object)loadingAudioSource != (Object)null) { Object.Destroy((Object)(object)loadingAudioSource); } if (!((Object)(object)loadingAudioClip == (Object)null)) { if ((int)loadingAudioClip.loadState != 2) { loadingAudioClip.LoadAudioData(); } loadingAudioSource = Object.Instantiate<AudioSource>(StartOfRound.Instance.speakerAudioSource); ((Object)loadingAudioSource).name = "LoadstoneLoading"; loadingAudioSource.clip = loadingAudioClip; ((Component)loadingAudioSource).transform.parent = ((Component)StartOfRound.Instance.speakerAudioSource).transform; } } [HarmonyPatch("LoadNewLevel")] [HarmonyPrefix] private static void PlayWaitingMusicPatch() { if (LoadstoneConfig.ShouldLoadingMusicPlay.Value) { loadingAudioSource.volume = LoadstoneConfig.LoadingMusicVolume.Value; loadingAudioSource.Play(); } } [HarmonyPatch("ResetEnemySpawningVariables")] [HarmonyPrefix] private static void StopWaitingMusicPatch() { ((MonoBehaviour)RoundManager.Instance).StartCoroutine(FadeOutMusic(loadingAudioSource)); } private static IEnumerator FadeOutMusic(AudioSource source) { float originalVolume = source.volume; float timeElapsed = 0f; while ((double)source.volume > 0.01) { source.volume = Mathf.Lerp(originalVolume, 0f, timeElapsed); timeElapsed += Time.deltaTime / LoadstoneConfig.LoadingMusicFadeTime.Value; yield return null; } source.Stop(); source.volume = originalVolume; Loadstone.LogDebug("Music fully faded and stopped"); } } } namespace Loadstone.Patches.ExpansionCore { public class DungeonGenerator_PatchPatches { [HarmonyPatch(typeof(DungeonGenerator_Patch), "Generate_Postfix")] [HarmonyPrefix] private static bool Generate_PostfixPrefix() { return false; } } } namespace Loadstone.Config { public static class LoadstoneConfig { public enum SeedDisplayType { Popup, Darken, JustLog } public static ConfigFile LoadstoneFile; public static ConfigEntry<bool> AsyncDungeon; public static ConfigEntry<float> DungeonAsyncMaxTime; public static ConfigEntry<bool> AsyncNavmesh; public static ConfigEntry<bool> DungeonRealization; public static ConfigEntry<SeedDisplayType> SeedDisplayConfig; public static ConfigEntry<bool> StatusChangeFix; public static ConfigEntry<bool> ObjectPooling; public static ConfigEntry<bool> DunGenOptimizations; public static ConfigEntry<bool> LocalPerformanceReports; public static ConfigEntry<bool> ShouldLoadingMusicPlay; public static ConfigEntry<float> LoadingMusicFadeTime; public static ConfigEntry<float> LoadingMusicVolume; public static void BindAllTo(ConfigFile config) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown LoadstoneFile = config; AsyncDungeon = LoadstoneFile.Bind<bool>("AsyncDungeon", "Enabled", true, "Whether or not the dungeon should generate asynchronously. The vanilla value is false. This option requires StatusChangeFix to be enabled"); DungeonAsyncMaxTime = LoadstoneFile.Bind<float>("AsyncDungeon", "Dungeon Target Frametime", 20f, new ConfigDescription("How long to spend generating the dungeon each frame, in milliseconds. There is no vanilla value", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>())); AsyncNavmesh = LoadstoneFile.Bind<bool>("AsyncNavmesh", "Enabled", true, "Whether or not the navmesh should be generated asynchrounously. The vanilla value is false"); DungeonRealization = LoadstoneFile.Bind<bool>("DungeonRealization", "Spread Over Multiple Frames", true, "Whether or not to spread dungeon realization over multiple frames. The vanilla value is false"); SeedDisplayConfig = LoadstoneFile.Bind<SeedDisplayType>("ScreenDarkening", "Seed Display Type", SeedDisplayType.Popup, "Decides how the random seed should appear when loading into a level. The vanilla value is \"Darken\""); StatusChangeFix = LoadstoneFile.Bind<bool>("StatusChangeFix", "Enabled", true, "Enables a fix for the game's status change callback, which is non-functional in vanilla. The vanilla value is false"); DunGenOptimizations = LoadstoneFile.Bind<bool>("DunGenOptimizations", "Enabled", true, "Enables a number of optmizations for DunGen's dungeon generator"); ObjectPooling = LoadstoneFile.Bind<bool>("ObjectPooling", "Enabled", false, "!!! EXPERIMENTAL FEATURE !!!\nEnables object pooling for dungeon spawning and certain parts of initial level generation. This can greatly improve load times, but may increase ram usage in modpacks with many custom interiors. This feature is currently very experimental. The vanilla value is false"); LocalPerformanceReports = LoadstoneFile.Bind<bool>("LocalPerformanceReports", "Enabled", false, "Enables local performance reports, which will appear in the logs every time the ship lands"); ShouldLoadingMusicPlay = LoadstoneFile.Bind<bool>("LCSoundTool", "Should Loading Music Play", false, new ConfigDescription("Should we play loading music as the level loads in? Requires LCSoundTool to be installed", (AcceptableValueBase)null, Array.Empty<object>())); LoadingMusicFadeTime = LoadstoneFile.Bind<float>("LCSoundTool", "Loading Music Fade Time", 15f, new ConfigDescription("How long should it take for the loading music to fade out", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); LoadingMusicVolume = LoadstoneFile.Bind<float>("LCSoundTool", "Loading Music Volume", 0.75f, new ConfigDescription("The volume of the loading music", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1.5f), Array.Empty<object>())); } } internal static class LoadstoneDynamicConfig { internal static void RegisterDynamicConfig() { //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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0034: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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 //IL_0055: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007c: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00ab: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown BaseConfigItem[] array = new BaseConfigItem[4]; ConfigEntry<float> dungeonAsyncMaxTime = LoadstoneConfig.DungeonAsyncMaxTime; FloatSliderOptions val = new FloatSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val).Min = 0f; ((BaseRangeOptions<float>)val).Max = 1000f; array[0] = (BaseConfigItem)new FloatSliderConfigItem(dungeonAsyncMaxTime, val); array[1] = (BaseConfigItem)new BoolCheckBoxConfigItem(LoadstoneConfig.ShouldLoadingMusicPlay, new BoolCheckBoxOptions { RequiresRestart = false }); ConfigEntry<float> loadingMusicFadeTime = LoadstoneConfig.LoadingMusicFadeTime; FloatSliderOptions val2 = new FloatSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val2).Min = 0f; ((BaseRangeOptions<float>)val2).Max = 30f; array[2] = (BaseConfigItem)new FloatSliderConfigItem(loadingMusicFadeTime, val2); ConfigEntry<float> loadingMusicVolume = LoadstoneConfig.LoadingMusicVolume; FloatSliderOptions val3 = new FloatSliderOptions { RequiresRestart = false }; ((BaseRangeOptions<float>)val3).Min = 0f; ((BaseRangeOptions<float>)val3).Max = 1.5f; array[3] = (BaseConfigItem)new FloatSliderConfigItem(loadingMusicVolume, val3); AddConfigItems((IEnumerable<BaseConfigItem>)(object)array); } internal static void AddConfigItems(IEnumerable<BaseConfigItem> configItems) { foreach (BaseConfigItem configItem in configItems) { LethalConfigManager.AddConfigItem(configItem); } } } }
lethalminecraftvillage_script.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("lethalminecraftvillage_script")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("lethalminecraftvillage_script")] [assembly: AssemblyTitle("lethalminecraftvillage_script")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace lethalminecraftvillage_script { public static class PluginInformation { public const string PLUGIN_GUID = "minecraftVillage"; public const string PLUGIN_NAME = "Minecraft Village"; public const string PLUGIN_VERSION = "1.0.0"; } [BepInPlugin("minecraftVillage", "Minecraft Village", "1.0.0")] public class SolidLib : BaseUnityPlugin { } } namespace MinecraftVillageMap.Components { public class MinecraftVillageHandler : MonoBehaviour { public static MinecraftVillageHandler instance; private bool lampsStart; private bool lampsInitialized; private void Start() { Debug.Log((object)"Minecraft Map Initialized"); } private void Update() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) try { GameObject[] array = GameObject.FindGameObjectsWithTag("Gravel"); if (((int)RoundManager.Instance.timeScript.dayMode == 2 || (int)RoundManager.Instance.timeScript.dayMode == 3) && !lampsInitialized) { GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name.Contains("mclamp")) { Debug.Log((object)"Turn on lamps"); ((Renderer)val.GetComponent<MeshRenderer>()).enabled = true; ((Component)val.transform.GetChild(0)).gameObject.SetActive(true); lampsInitialized = true; } } } else { if ((int)RoundManager.Instance.timeScript.dayMode != 0 || lampsStart) { return; } GameObject[] array2 = array; foreach (GameObject val2 in array2) { if (((Object)val2).name.Contains("mclamp")) { Debug.Log((object)"Turn off lamps"); ((Renderer)val2.GetComponent<MeshRenderer>()).enabled = false; ((Component)val2.transform.GetChild(0)).gameObject.SetActive(false); lampsStart = true; } } } } catch (Exception ex) { Debug.Log((object)("Error in Update: " + ex.GetType().Name + " - " + ex.Message + "\nStack Trace: " + ex.StackTrace)); } } } }
SolidLib.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Extras; using LethalLib.Modules; using Microsoft.CodeAnalysis; using SolidLib.Components; using SolidLib.NetcodePatcher; using SolidLib.Registry; using SolidLib.Utils; using SolidLib.Utils.AssetLoading; using SolidLib.Utils.Extensions; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SolidLib")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6e683211441854aeebd064d70abfd4fd3e392c0e")] [assembly: AssemblyProduct("SolidLib")] [assembly: AssemblyTitle("SolidLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [AddComponentMenu("Dynamic Bone/Dynamic Bone")] public class DynamicBone : MonoBehaviour { public enum UpdateMode { Normal, AnimatePhysics, UnscaledTime, Default } public enum FreezeAxis { None, X, Y, Z } private class Particle { public Transform m_Transform; public int m_ParentIndex; public int m_ChildCount; public float m_Damping; public float m_Elasticity; public float m_Stiffness; public float m_Inert; public float m_Friction; public float m_Radius; public float m_BoneLength; public bool m_isCollide; public bool m_TransformNotNull; public Vector3 m_Position; public Vector3 m_PrevPosition; public Vector3 m_EndOffset; public Vector3 m_InitLocalPosition; public Quaternion m_InitLocalRotation; public Vector3 m_TransformPosition; public Vector3 m_TransformLocalPosition; public Matrix4x4 m_TransformLocalToWorldMatrix; } private class ParticleTree { public Transform m_Root; public Vector3 m_LocalGravity; public Matrix4x4 m_RootWorldToLocalMatrix; public float m_BoneTotalLength; public List<Particle> m_Particles = new List<Particle>(); public Vector3 m_RestGravity; } public Transform m_Root; public List<Transform> m_Roots; public float m_UpdateRate = 60f; public UpdateMode m_UpdateMode = UpdateMode.Default; [Range(0f, 1f)] public float m_Damping = 0.1f; public AnimationCurve m_DampingDistrib; [Range(0f, 1f)] public float m_Elasticity = 0.1f; public AnimationCurve m_ElasticityDistrib; [Range(0f, 1f)] public float m_Stiffness = 0.1f; public AnimationCurve m_StiffnessDistrib; [Range(0f, 1f)] public float m_Inert; public AnimationCurve m_InertDistrib; public float m_Friction; public AnimationCurve m_FrictionDistrib; public float m_Radius; public AnimationCurve m_RadiusDistrib; public float m_EndLength; public Vector3 m_EndOffset = Vector3.zero; public Vector3 m_Gravity = Vector3.zero; public Vector3 m_Force = Vector3.zero; [Range(0f, 1f)] public float m_BlendWeight = 1f; public List<DynamicBoneColliderBase> m_Colliders; public List<Transform> m_Exclusions; public FreezeAxis m_FreezeAxis; public bool m_DistantDisable; public Transform m_ReferenceObject; public float m_DistanceToObject = 20f; [HideInInspector] public bool m_Multithread = true; private Vector3 m_ObjectMove; private Vector3 m_ObjectPrevPosition; private float m_ObjectScale; private float m_Time; private float m_Weight = 1f; private bool m_DistantDisabled; private int m_PreUpdateCount; private List<ParticleTree> m_ParticleTrees = new List<ParticleTree>(); private float m_DeltaTime; private List<DynamicBoneColliderBase> m_EffectiveColliders; private bool m_WorkAdded; private static List<DynamicBone> s_PendingWorks = new List<DynamicBone>(); private static List<DynamicBone> s_EffectiveWorks = new List<DynamicBone>(); private static AutoResetEvent s_AllWorksDoneEvent; private static int s_RemainWorkCount; private static Semaphore s_WorkQueueSemaphore; private static int s_WorkQueueIndex; private static int s_UpdateCount; private static int s_PrepareFrame; private void Start() { SetupParticles(); } private void FixedUpdate() { if (m_UpdateMode == UpdateMode.AnimatePhysics) { PreUpdate(); } } private void Update() { if (m_UpdateMode != UpdateMode.AnimatePhysics) { PreUpdate(); } if (m_PreUpdateCount > 0 && m_Multithread) { AddPendingWork(this); m_WorkAdded = true; } s_UpdateCount++; } private void LateUpdate() { if (m_PreUpdateCount == 0) { return; } if (s_UpdateCount > 0) { s_UpdateCount = 0; s_PrepareFrame++; } SetWeight(m_BlendWeight); if (m_WorkAdded) { m_WorkAdded = false; ExecuteWorks(); } else { CheckDistance(); if (IsNeedUpdate()) { Prepare(); UpdateParticles(); ApplyParticlesToTransforms(); } } m_PreUpdateCount = 0; } private void Prepare() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) m_DeltaTime = Time.deltaTime; m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x); m_ObjectMove = ((Component)this).transform.position - m_ObjectPrevPosition; m_ObjectPrevPosition = ((Component)this).transform.position; for (int i = 0; i < m_ParticleTrees.Count; i++) { ParticleTree particleTree = m_ParticleTrees[i]; particleTree.m_RestGravity = particleTree.m_Root.TransformDirection(particleTree.m_LocalGravity); for (int j = 0; j < particleTree.m_Particles.Count; j++) { Particle particle = particleTree.m_Particles[j]; if (particle.m_TransformNotNull) { particle.m_TransformPosition = particle.m_Transform.position; particle.m_TransformLocalPosition = particle.m_Transform.localPosition; particle.m_TransformLocalToWorldMatrix = particle.m_Transform.localToWorldMatrix; } } } if (m_EffectiveColliders != null) { m_EffectiveColliders.Clear(); } if (m_Colliders == null) { return; } for (int k = 0; k < m_Colliders.Count; k++) { DynamicBoneColliderBase dynamicBoneColliderBase = m_Colliders[k]; if ((Object)(object)dynamicBoneColliderBase != (Object)null && ((Behaviour)dynamicBoneColliderBase).enabled) { if (m_EffectiveColliders == null) { m_EffectiveColliders = new List<DynamicBoneColliderBase>(); } m_EffectiveColliders.Add(dynamicBoneColliderBase); if (dynamicBoneColliderBase.PrepareFrame != s_PrepareFrame) { dynamicBoneColliderBase.Prepare(); dynamicBoneColliderBase.PrepareFrame = s_PrepareFrame; } } } } private bool IsNeedUpdate() { if (m_Weight > 0f) { if (m_DistantDisable) { return !m_DistantDisabled; } return true; } return false; } private void PreUpdate() { if (IsNeedUpdate()) { InitTransforms(); } m_PreUpdateCount++; } private void CheckDistance() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!m_DistantDisable) { return; } Transform val = m_ReferenceObject; if ((Object)(object)val == (Object)null && (Object)(object)Camera.main != (Object)null) { val = ((Component)Camera.main).transform; } if (!((Object)(object)val != (Object)null)) { return; } Vector3 val2 = val.position - ((Component)this).transform.position; bool flag = ((Vector3)(ref val2)).sqrMagnitude > m_DistanceToObject * m_DistanceToObject; if (flag != m_DistantDisabled) { if (!flag) { ResetParticlesPosition(); } m_DistantDisabled = flag; } } private void OnEnable() { ResetParticlesPosition(); } private void OnDisable() { InitTransforms(); } private void OnValidate() { m_UpdateRate = Mathf.Max(m_UpdateRate, 0f); m_Damping = Mathf.Clamp01(m_Damping); m_Elasticity = Mathf.Clamp01(m_Elasticity); m_Stiffness = Mathf.Clamp01(m_Stiffness); m_Inert = Mathf.Clamp01(m_Inert); m_Friction = Mathf.Clamp01(m_Friction); m_Radius = Mathf.Max(m_Radius, 0f); if (Application.isEditor && Application.isPlaying) { if (IsRootChanged()) { InitTransforms(); SetupParticles(); } else { UpdateParameters(); } } } private bool IsRootChanged() { List<Transform> list = new List<Transform>(); if ((Object)(object)m_Root != (Object)null) { list.Add(m_Root); } if (m_Roots != null) { foreach (Transform root in m_Roots) { if ((Object)(object)root != (Object)null && !list.Contains(root)) { list.Add(root); } } } if (list.Count != m_ParticleTrees.Count) { return true; } for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] != (Object)(object)m_ParticleTrees[i].m_Root) { return true; } } return false; } private void OnDidApplyAnimationProperties() { UpdateParameters(); } private void OnDrawGizmosSelected() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { if (Application.isEditor && !Application.isPlaying && ((Component)this).transform.hasChanged) { SetupParticles(); } Gizmos.color = Color.white; for (int i = 0; i < m_ParticleTrees.Count; i++) { DrawGizmos(m_ParticleTrees[i]); } } } private void DrawGizmos(ParticleTree pt) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_ParentIndex >= 0) { Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; Gizmos.DrawLine(particle.m_Position, particle2.m_Position); } if (particle.m_Radius > 0f) { Gizmos.DrawWireSphere(particle.m_Position, particle.m_Radius * m_ObjectScale); } } } public void SetWeight(float w) { if (m_Weight != w) { if (w == 0f) { InitTransforms(); } else if (m_Weight == 0f) { ResetParticlesPosition(); } m_Weight = (m_BlendWeight = w); } } public float GetWeight() { return m_Weight; } private void UpdateParticles() { if (m_ParticleTrees.Count <= 0) { return; } int num = 1; float timeVar = 1f; float deltaTime = m_DeltaTime; if (m_UpdateMode == UpdateMode.Default) { if (m_UpdateRate > 0f) { timeVar = deltaTime * m_UpdateRate; } } else if (m_UpdateRate > 0f) { float num2 = 1f / m_UpdateRate; m_Time += deltaTime; num = 0; while (m_Time >= num2) { m_Time -= num2; if (++num >= 3) { m_Time = 0f; break; } } } if (num > 0) { for (int i = 0; i < num; i++) { UpdateParticles1(timeVar, i); UpdateParticles2(timeVar); } } else { SkipUpdateParticles(); } } public void SetupParticles() { //IL_0095: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) m_ParticleTrees.Clear(); if ((Object)(object)m_Root != (Object)null) { AppendParticleTree(m_Root); } if (m_Roots != null) { for (int i = 0; i < m_Roots.Count; i++) { Transform root = m_Roots[i]; if (!((Object)(object)root == (Object)null) && !m_ParticleTrees.Exists((ParticleTree x) => (Object)(object)x.m_Root == (Object)(object)root)) { AppendParticleTree(root); } } } m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x); m_ObjectPrevPosition = ((Component)this).transform.position; m_ObjectMove = Vector3.zero; for (int j = 0; j < m_ParticleTrees.Count; j++) { ParticleTree particleTree = m_ParticleTrees[j]; AppendParticles(particleTree, particleTree.m_Root, -1, 0f); } UpdateParameters(); } private void AppendParticleTree(Transform root) { //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) if (!((Object)(object)root == (Object)null)) { ParticleTree particleTree = new ParticleTree(); particleTree.m_Root = root; particleTree.m_RootWorldToLocalMatrix = root.worldToLocalMatrix; m_ParticleTrees.Add(particleTree); } } private void AppendParticles(ParticleTree pt, Transform b, int parentIndex, float boneLength) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) Particle particle = new Particle(); particle.m_Transform = b; particle.m_TransformNotNull = (Object)(object)b != (Object)null; particle.m_ParentIndex = parentIndex; Vector3 val; if ((Object)(object)b != (Object)null) { val = (particle.m_Position = (particle.m_PrevPosition = b.position)); particle.m_InitLocalPosition = b.localPosition; particle.m_InitLocalRotation = b.localRotation; } else { Transform transform = pt.m_Particles[parentIndex].m_Transform; if (m_EndLength > 0f) { Transform parent = transform.parent; if ((Object)(object)parent != (Object)null) { particle.m_EndOffset = transform.InverseTransformPoint(transform.position * 2f - parent.position) * m_EndLength; } else { particle.m_EndOffset = new Vector3(m_EndLength, 0f, 0f); } } else { particle.m_EndOffset = transform.InverseTransformPoint(((Component)this).transform.TransformDirection(m_EndOffset) + transform.position); } val = (particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset))); particle.m_InitLocalPosition = Vector3.zero; particle.m_InitLocalRotation = Quaternion.identity; } if (parentIndex >= 0) { float num = boneLength; val = pt.m_Particles[parentIndex].m_Transform.position - particle.m_Position; boneLength = num + ((Vector3)(ref val)).magnitude; particle.m_BoneLength = boneLength; pt.m_BoneTotalLength = Mathf.Max(pt.m_BoneTotalLength, boneLength); pt.m_Particles[parentIndex].m_ChildCount++; } int count = pt.m_Particles.Count; pt.m_Particles.Add(particle); if (!((Object)(object)b != (Object)null)) { return; } for (int i = 0; i < b.childCount; i++) { Transform child = b.GetChild(i); bool flag = false; if (m_Exclusions != null) { flag = m_Exclusions.Contains(child); } if (!flag) { AppendParticles(pt, child, count, boneLength); } else if (m_EndLength > 0f || m_EndOffset != Vector3.zero) { AppendParticles(pt, null, count, boneLength); } } if (b.childCount == 0 && (m_EndLength > 0f || m_EndOffset != Vector3.zero)) { AppendParticles(pt, null, count, boneLength); } } public void UpdateParameters() { SetWeight(m_BlendWeight); for (int i = 0; i < m_ParticleTrees.Count; i++) { UpdateParameters(m_ParticleTrees[i]); } } private void UpdateParameters(ParticleTree pt) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Matrix4x4)(ref pt.m_RootWorldToLocalMatrix)).MultiplyVector(m_Gravity); pt.m_LocalGravity = ((Vector3)(ref val)).normalized * ((Vector3)(ref m_Gravity)).magnitude; for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; particle.m_Damping = m_Damping; particle.m_Elasticity = m_Elasticity; particle.m_Stiffness = m_Stiffness; particle.m_Inert = m_Inert; particle.m_Friction = m_Friction; particle.m_Radius = m_Radius; if (pt.m_BoneTotalLength > 0f) { float num = particle.m_BoneLength / pt.m_BoneTotalLength; if (m_DampingDistrib != null && m_DampingDistrib.keys.Length != 0) { particle.m_Damping *= m_DampingDistrib.Evaluate(num); } if (m_ElasticityDistrib != null && m_ElasticityDistrib.keys.Length != 0) { particle.m_Elasticity *= m_ElasticityDistrib.Evaluate(num); } if (m_StiffnessDistrib != null && m_StiffnessDistrib.keys.Length != 0) { particle.m_Stiffness *= m_StiffnessDistrib.Evaluate(num); } if (m_InertDistrib != null && m_InertDistrib.keys.Length != 0) { particle.m_Inert *= m_InertDistrib.Evaluate(num); } if (m_FrictionDistrib != null && m_FrictionDistrib.keys.Length != 0) { particle.m_Friction *= m_FrictionDistrib.Evaluate(num); } if (m_RadiusDistrib != null && m_RadiusDistrib.keys.Length != 0) { particle.m_Radius *= m_RadiusDistrib.Evaluate(num); } } particle.m_Damping = Mathf.Clamp01(particle.m_Damping); particle.m_Elasticity = Mathf.Clamp01(particle.m_Elasticity); particle.m_Stiffness = Mathf.Clamp01(particle.m_Stiffness); particle.m_Inert = Mathf.Clamp01(particle.m_Inert); particle.m_Friction = Mathf.Clamp01(particle.m_Friction); particle.m_Radius = Mathf.Max(particle.m_Radius, 0f); } } private void InitTransforms() { for (int i = 0; i < m_ParticleTrees.Count; i++) { InitTransforms(m_ParticleTrees[i]); } } private void InitTransforms(ParticleTree pt) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_TransformNotNull) { particle.m_Transform.localPosition = particle.m_InitLocalPosition; particle.m_Transform.localRotation = particle.m_InitLocalRotation; } } } private void ResetParticlesPosition() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < m_ParticleTrees.Count; i++) { ResetParticlesPosition(m_ParticleTrees[i]); } m_ObjectPrevPosition = ((Component)this).transform.position; } private void ResetParticlesPosition(ParticleTree pt) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_TransformNotNull) { particle.m_Position = (particle.m_PrevPosition = particle.m_Transform.position); } else { Transform transform = pt.m_Particles[particle.m_ParentIndex].m_Transform; particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset)); } particle.m_isCollide = false; } } private void UpdateParticles1(float timeVar, int loopIndex) { for (int i = 0; i < m_ParticleTrees.Count; i++) { UpdateParticles1(m_ParticleTrees[i], timeVar, loopIndex); } } private void UpdateParticles1(ParticleTree pt, float timeVar, int loopIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0090: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_011f: Unknown result type (might be due to invalid IL or missing references) Vector3 gravity = m_Gravity; Vector3 normalized = ((Vector3)(ref m_Gravity)).normalized; Vector3 val = normalized * Mathf.Max(Vector3.Dot(pt.m_RestGravity, normalized), 0f); gravity -= val; gravity = (gravity + m_Force) * (m_ObjectScale * timeVar); Vector3 val2 = ((loopIndex == 0) ? m_ObjectMove : Vector3.zero); for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_ParentIndex >= 0) { Vector3 val3 = particle.m_Position - particle.m_PrevPosition; Vector3 val4 = val2 * particle.m_Inert; particle.m_PrevPosition = particle.m_Position + val4; float num = particle.m_Damping; if (particle.m_isCollide) { num += particle.m_Friction; if (num > 1f) { num = 1f; } particle.m_isCollide = false; } particle.m_Position += val3 * (1f - num) + gravity + val4; } else { particle.m_PrevPosition = particle.m_Position; particle.m_Position = particle.m_TransformPosition; } } } private void UpdateParticles2(float timeVar) { for (int i = 0; i < m_ParticleTrees.Count; i++) { UpdateParticles2(m_ParticleTrees[i], timeVar); } } private void UpdateParticles2(ParticleTree pt, float timeVar) { //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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) Plane val = default(Plane); for (int i = 1; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; Vector3 val2; float magnitude; if (particle.m_TransformNotNull) { val2 = particle2.m_TransformPosition - particle.m_TransformPosition; magnitude = ((Vector3)(ref val2)).magnitude; } else { val2 = ((Matrix4x4)(ref particle2.m_TransformLocalToWorldMatrix)).MultiplyVector(particle.m_EndOffset); magnitude = ((Vector3)(ref val2)).magnitude; } float num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight); if (num > 0f || particle.m_Elasticity > 0f) { Matrix4x4 transformLocalToWorldMatrix = particle2.m_TransformLocalToWorldMatrix; ((Matrix4x4)(ref transformLocalToWorldMatrix)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 val3 = ((!particle.m_TransformNotNull) ? ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_TransformLocalPosition)); Vector3 val4 = val3 - particle.m_Position; particle.m_Position += val4 * (particle.m_Elasticity * timeVar); if (num > 0f) { val4 = val3 - particle.m_Position; float magnitude2 = ((Vector3)(ref val4)).magnitude; float num2 = magnitude * (1f - num) * 2f; if (magnitude2 > num2) { particle.m_Position += val4 * ((magnitude2 - num2) / magnitude2); } } } if (m_EffectiveColliders != null) { float particleRadius = particle.m_Radius * m_ObjectScale; for (int j = 0; j < m_EffectiveColliders.Count; j++) { DynamicBoneColliderBase dynamicBoneColliderBase = m_EffectiveColliders[j]; particle.m_isCollide |= dynamicBoneColliderBase.Collide(ref particle.m_Position, particleRadius); } } if (m_FreezeAxis != 0) { Vector4 column = ((Matrix4x4)(ref particle2.m_TransformLocalToWorldMatrix)).GetColumn((int)(m_FreezeAxis - 1)); Vector3 val5 = Vector4.op_Implicit(((Vector4)(ref column)).normalized); ((Plane)(ref val)).SetNormalAndPosition(val5, particle2.m_Position); particle.m_Position -= ((Plane)(ref val)).normal * ((Plane)(ref val)).GetDistanceToPoint(particle.m_Position); } Vector3 val6 = particle2.m_Position - particle.m_Position; float magnitude3 = ((Vector3)(ref val6)).magnitude; if (magnitude3 > 0f) { particle.m_Position += val6 * ((magnitude3 - magnitude) / magnitude3); } } } private void SkipUpdateParticles() { for (int i = 0; i < m_ParticleTrees.Count; i++) { SkipUpdateParticles(m_ParticleTrees[i]); } } private void SkipUpdateParticles(ParticleTree pt) { //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; if (particle.m_ParentIndex >= 0) { particle.m_PrevPosition += m_ObjectMove; particle.m_Position += m_ObjectMove; Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; Vector3 val; float magnitude; if (particle.m_TransformNotNull) { val = particle2.m_TransformPosition - particle.m_TransformPosition; magnitude = ((Vector3)(ref val)).magnitude; } else { val = ((Matrix4x4)(ref particle2.m_TransformLocalToWorldMatrix)).MultiplyVector(particle.m_EndOffset); magnitude = ((Vector3)(ref val)).magnitude; } float num = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight); if (num > 0f) { Matrix4x4 transformLocalToWorldMatrix = particle2.m_TransformLocalToWorldMatrix; ((Matrix4x4)(ref transformLocalToWorldMatrix)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position)); Vector3 val2 = ((!particle.m_TransformNotNull) ? ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref transformLocalToWorldMatrix)).MultiplyPoint3x4(particle.m_TransformLocalPosition)); Vector3 val3 = val2 - particle.m_Position; float magnitude2 = ((Vector3)(ref val3)).magnitude; float num2 = magnitude * (1f - num) * 2f; if (magnitude2 > num2) { particle.m_Position += val3 * ((magnitude2 - num2) / magnitude2); } } Vector3 val4 = particle2.m_Position - particle.m_Position; float magnitude3 = ((Vector3)(ref val4)).magnitude; if (magnitude3 > 0f) { particle.m_Position += val4 * ((magnitude3 - magnitude) / magnitude3); } } else { particle.m_PrevPosition = particle.m_Position; particle.m_Position = particle.m_TransformPosition; } } } private static Vector3 MirrorVector(Vector3 v, Vector3 axis) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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) return v - axis * (Vector3.Dot(v, axis) * 2f); } private void ApplyParticlesToTransforms() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00df: Unknown result type (might be due to invalid IL or missing references) Vector3 right = Vector3.right; Vector3 up = Vector3.up; Vector3 forward = Vector3.forward; bool flag = false; bool flag2 = false; bool flag3 = false; Vector3 lossyScale = ((Component)this).transform.lossyScale; if (lossyScale.x < 0f || lossyScale.y < 0f || lossyScale.z < 0f) { Transform val = ((Component)this).transform; do { Vector3 localScale = val.localScale; flag = localScale.x < 0f; if (flag) { right = val.right; } flag2 = localScale.y < 0f; if (flag2) { up = val.up; } flag3 = localScale.z < 0f; if (flag3) { forward = val.forward; } if (flag || flag2 || flag3) { break; } val = val.parent; } while ((Object)(object)val != (Object)null); } for (int i = 0; i < m_ParticleTrees.Count; i++) { ApplyParticlesToTransforms(m_ParticleTrees[i], right, up, forward, flag, flag2, flag3); } } private void ApplyParticlesToTransforms(ParticleTree pt, Vector3 ax, Vector3 ay, Vector3 az, bool nx, bool ny, bool nz) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0097: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i < pt.m_Particles.Count; i++) { Particle particle = pt.m_Particles[i]; Particle particle2 = pt.m_Particles[particle.m_ParentIndex]; if (particle2.m_ChildCount <= 1) { Vector3 val = ((!particle.m_TransformNotNull) ? particle.m_EndOffset : particle.m_Transform.localPosition); Vector3 val2 = particle2.m_Transform.TransformDirection(val); Vector3 val3 = particle.m_Position - particle2.m_Position; if (nx) { val3 = MirrorVector(val3, ax); } if (ny) { val3 = MirrorVector(val3, ay); } if (nz) { val3 = MirrorVector(val3, az); } Quaternion val4 = Quaternion.FromToRotation(val2, val3); particle2.m_Transform.rotation = val4 * particle2.m_Transform.rotation; } if (particle.m_TransformNotNull) { particle.m_Transform.position = particle.m_Position; } } } private static void AddPendingWork(DynamicBone db) { s_PendingWorks.Add(db); } private static void AddWorkToQueue(DynamicBone db) { s_WorkQueueSemaphore.Release(); } private static DynamicBone GetWorkFromQueue() { int index = Interlocked.Increment(ref s_WorkQueueIndex); return s_EffectiveWorks[index]; } private static void ThreadProc() { while (true) { s_WorkQueueSemaphore.WaitOne(); GetWorkFromQueue().UpdateParticles(); if (Interlocked.Decrement(ref s_RemainWorkCount) <= 0) { s_AllWorksDoneEvent.Set(); } } } private static void InitThreadPool() { s_AllWorksDoneEvent = new AutoResetEvent(initialState: false); s_WorkQueueSemaphore = new Semaphore(0, int.MaxValue); int processorCount = Environment.ProcessorCount; for (int i = 0; i < processorCount; i++) { Thread thread = new Thread(ThreadProc); thread.IsBackground = true; thread.Start(); } } private static void ExecuteWorks() { if (s_PendingWorks.Count <= 0) { return; } s_EffectiveWorks.Clear(); for (int i = 0; i < s_PendingWorks.Count; i++) { DynamicBone dynamicBone = s_PendingWorks[i]; if ((Object)(object)dynamicBone != (Object)null && ((Behaviour)dynamicBone).enabled) { dynamicBone.CheckDistance(); if (dynamicBone.IsNeedUpdate()) { s_EffectiveWorks.Add(dynamicBone); } } } s_PendingWorks.Clear(); if (s_EffectiveWorks.Count > 0) { if (s_AllWorksDoneEvent == null) { InitThreadPool(); } int num = (s_RemainWorkCount = s_EffectiveWorks.Count); s_WorkQueueIndex = -1; for (int j = 0; j < num; j++) { DynamicBone dynamicBone2 = s_EffectiveWorks[j]; dynamicBone2.Prepare(); AddWorkToQueue(dynamicBone2); } s_AllWorksDoneEvent.WaitOne(); for (int k = 0; k < num; k++) { s_EffectiveWorks[k].ApplyParticlesToTransforms(); } } } } [AddComponentMenu("Dynamic Bone/Dynamic Bone Collider")] public class DynamicBoneCollider : DynamicBoneColliderBase { public float m_Radius = 0.5f; public float m_Height; public float m_Radius2; private float m_ScaledRadius; private float m_ScaledRadius2; private Vector3 m_C0; private Vector3 m_C1; private float m_C01Distance; private int m_CollideType; private void OnValidate() { m_Radius = Mathf.Max(m_Radius, 0f); m_Height = Mathf.Max(m_Height, 0f); m_Radius2 = Mathf.Max(m_Radius2, 0f); } public override void Prepare() { //IL_0006: 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_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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Abs(((Component)this).transform.lossyScale.x); float num2 = m_Height * 0.5f; Vector3 val; if (m_Radius2 <= 0f || Mathf.Abs(m_Radius - m_Radius2) < 0.01f) { m_ScaledRadius = m_Radius * num; float num3 = num2 - m_Radius; if (num3 <= 0f) { m_C0 = ((Component)this).transform.TransformPoint(m_Center); if (m_Bound == Bound.Outside) { m_CollideType = 0; } else { m_CollideType = 1; } return; } Vector3 center = m_Center; Vector3 center2 = m_Center; switch (m_Direction) { case Direction.X: center.x += num3; center2.x -= num3; break; case Direction.Y: center.y += num3; center2.y -= num3; break; case Direction.Z: center.z += num3; center2.z -= num3; break; } m_C0 = ((Component)this).transform.TransformPoint(center); m_C1 = ((Component)this).transform.TransformPoint(center2); val = m_C1 - m_C0; m_C01Distance = ((Vector3)(ref val)).magnitude; if (m_Bound == Bound.Outside) { m_CollideType = 2; } else { m_CollideType = 3; } return; } float num4 = Mathf.Max(m_Radius, m_Radius2); if (num2 - num4 <= 0f) { m_ScaledRadius = num4 * num; m_C0 = ((Component)this).transform.TransformPoint(m_Center); if (m_Bound == Bound.Outside) { m_CollideType = 0; } else { m_CollideType = 1; } return; } m_ScaledRadius = m_Radius * num; m_ScaledRadius2 = m_Radius2 * num; float num5 = num2 - m_Radius; float num6 = num2 - m_Radius2; Vector3 center3 = m_Center; Vector3 center4 = m_Center; switch (m_Direction) { case Direction.X: center3.x += num5; center4.x -= num6; break; case Direction.Y: center3.y += num5; center4.y -= num6; break; case Direction.Z: center3.z += num5; center4.z -= num6; break; } m_C0 = ((Component)this).transform.TransformPoint(center3); m_C1 = ((Component)this).transform.TransformPoint(center4); val = m_C1 - m_C0; m_C01Distance = ((Vector3)(ref val)).magnitude; if (m_Bound == Bound.Outside) { m_CollideType = 4; } else { m_CollideType = 5; } } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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) return m_CollideType switch { 0 => OutsideSphere(ref particlePosition, particleRadius, m_C0, m_ScaledRadius), 1 => InsideSphere(ref particlePosition, particleRadius, m_C0, m_ScaledRadius), 2 => OutsideCapsule(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_C01Distance), 3 => InsideCapsule(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_C01Distance), 4 => OutsideCapsule2(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_ScaledRadius2, m_C01Distance), 5 => InsideCapsule2(ref particlePosition, particleRadius, m_C0, m_C1, m_ScaledRadius, m_ScaledRadius2, m_C01Distance), _ => false, }; } private static bool OutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) float num = sphereRadius + particleRadius; float num2 = num * num; Vector3 val = particlePosition - sphereCenter; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > 0f && sqrMagnitude < num2) { float num3 = Mathf.Sqrt(sqrMagnitude); particlePosition = sphereCenter + val * (num / num3); return true; } return false; } private static bool InsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) float num = sphereRadius - particleRadius; float num2 = num * num; Vector3 val = particlePosition - sphereCenter; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude > num2) { float num3 = Mathf.Sqrt(sqrMagnitude); particlePosition = sphereCenter + val * (num / num3); return true; } return false; } private static bool OutsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) float num = capsuleRadius + particleRadius; float num2 = num * num; Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num3 = Vector3.Dot(val2, val); if (num3 <= 0f) { float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > 0f && sqrMagnitude < num2) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num / num4); return true; } } else { float num5 = dirlen * dirlen; if (num3 >= num5) { val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > 0f && sqrMagnitude2 < num2) { float num6 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num / num6); return true; } } else { Vector3 val3 = val2 - val * (num3 / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude3 > 0f && sqrMagnitude3 < num2) { float num7 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num - num7) / num7); return true; } } } return false; } private static bool InsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius, float dirlen) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) float num = capsuleRadius - particleRadius; float num2 = num * num; Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num3 = Vector3.Dot(val2, val); if (num3 <= 0f) { float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > num2) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num / num4); return true; } } else { float num5 = dirlen * dirlen; if (num3 >= num5) { val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > num2) { float num6 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num / num6); return true; } } else { Vector3 val3 = val2 - val * (num3 / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude3 > num2) { float num7 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num - num7) / num7); return true; } } } return false; } private static bool OutsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00f3: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num = Vector3.Dot(val2, val); if (num <= 0f) { float num2 = capsuleRadius0 + particleRadius; float num3 = num2 * num2; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > 0f && sqrMagnitude < num3) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num2 / num4); return true; } } else { float num5 = dirlen * dirlen; if (num >= num5) { float num6 = capsuleRadius1 + particleRadius; float num7 = num6 * num6; val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > 0f && sqrMagnitude2 < num7) { float num8 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num6 / num8); return true; } } else { Vector3 val3 = val2 - val * (num / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; float num9 = Vector3.Dot(val2, val / dirlen); float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) + particleRadius; float num11 = num10 * num10; if (sqrMagnitude3 > 0f && sqrMagnitude3 < num11) { float num12 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num10 - num12) / num12); return true; } } } return false; } private static bool InsideCapsule2(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius0, float capsuleRadius1, float dirlen) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_00a5: 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_00b5: Unknown result type (might be due to invalid IL or missing references) Vector3 val = capsuleP1 - capsuleP0; Vector3 val2 = particlePosition - capsuleP0; float num = Vector3.Dot(val2, val); if (num <= 0f) { float num2 = capsuleRadius0 - particleRadius; float num3 = num2 * num2; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude > num3) { float num4 = Mathf.Sqrt(sqrMagnitude); particlePosition = capsuleP0 + val2 * (num2 / num4); return true; } } else { float num5 = dirlen * dirlen; if (num >= num5) { float num6 = capsuleRadius1 - particleRadius; float num7 = num6 * num6; val2 = particlePosition - capsuleP1; float sqrMagnitude2 = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude2 > num7) { float num8 = Mathf.Sqrt(sqrMagnitude2); particlePosition = capsuleP1 + val2 * (num6 / num8); return true; } } else { Vector3 val3 = val2 - val * (num / num5); float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude; float num9 = Vector3.Dot(val2, val / dirlen); float num10 = Mathf.Lerp(capsuleRadius0, capsuleRadius1, num9 / dirlen) - particleRadius; float num11 = num10 * num10; if (sqrMagnitude3 > num11) { float num12 = Mathf.Sqrt(sqrMagnitude3); particlePosition += val3 * ((num10 - num12) / num12); return true; } } } return false; } private void OnDrawGizmosSelected() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_008a: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { Prepare(); if (m_Bound == Bound.Outside) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.magenta; } switch (m_CollideType) { case 0: case 1: Gizmos.DrawWireSphere(m_C0, m_ScaledRadius); break; case 2: case 3: DrawCapsule(m_C0, m_C1, m_ScaledRadius, m_ScaledRadius); break; case 4: case 5: DrawCapsule(m_C0, m_C1, m_ScaledRadius, m_ScaledRadius2); break; } } } private static void DrawCapsule(Vector3 c0, Vector3 c1, float radius0, float radius1) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) Gizmos.DrawLine(c0, c1); Gizmos.DrawWireSphere(c0, radius0); Gizmos.DrawWireSphere(c1, radius1); } } public class DynamicBoneColliderBase : MonoBehaviour { public enum Direction { X, Y, Z } public enum Bound { Outside, Inside } public Direction m_Direction = Direction.Y; public Vector3 m_Center = Vector3.zero; public Bound m_Bound; public int PrepareFrame { get; set; } public virtual void Start() { } public virtual void Prepare() { } public virtual bool Collide(ref Vector3 particlePosition, float particleRadius) { return false; } } [AddComponentMenu("Dynamic Bone/Dynamic Bone Plane Collider")] public class DynamicBonePlaneCollider : DynamicBoneColliderBase { private Plane m_Plane; private void OnValidate() { } public override void Prepare() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) Vector3 val = Vector3.up; switch (m_Direction) { case Direction.X: val = ((Component)this).transform.right; break; case Direction.Y: val = ((Component)this).transform.up; break; case Direction.Z: val = ((Component)this).transform.forward; break; } Vector3 val2 = ((Component)this).transform.TransformPoint(m_Center); ((Plane)(ref m_Plane)).SetNormalAndPosition(val, val2); } public override bool Collide(ref Vector3 particlePosition, float particleRadius) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) float distanceToPoint = ((Plane)(ref m_Plane)).GetDistanceToPoint(particlePosition); if (m_Bound == Bound.Outside) { if (distanceToPoint < 0f) { particlePosition -= ((Plane)(ref m_Plane)).normal * distanceToPoint; return true; } } else if (distanceToPoint > 0f) { particlePosition -= ((Plane)(ref m_Plane)).normal * distanceToPoint; return true; } return false; } private void OnDrawGizmosSelected() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { Prepare(); if (m_Bound == Bound.Outside) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.magenta; } Vector3 val = ((Component)this).transform.TransformPoint(m_Center); Gizmos.DrawLine(val, val + ((Plane)(ref m_Plane)).normal); } } } namespace SolidLib { public static class WalkieTalkieExtensions { public static void TransmitOneShotAudio(Transform audioSource, AudioClip clip, float vol = 1f, float pitch = 1f) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clip == (Object)null || (Object)(object)audioSource == (Object)null) { return; } for (int i = 0; i < WalkieTalkie.allWalkieTalkies.Count; i++) { if ((Object)(object)((GrabbableObject)WalkieTalkie.allWalkieTalkies[i]).playerHeldBy == (Object)null || !WalkieTalkie.allWalkieTalkies[i].clientIsHoldingAndSpeakingIntoThis || !((GrabbableObject)WalkieTalkie.allWalkieTalkies[i]).isBeingUsed) { continue; } float num = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[i]).transform.position, ((Component)audioSource).transform.position); if (!(num < WalkieTalkie.allWalkieTalkies[i].recordingRange)) { continue; } for (int j = 0; j < WalkieTalkie.allWalkieTalkies.Count; j++) { if (j != i && ((GrabbableObject)WalkieTalkie.allWalkieTalkies[j]).isBeingUsed) { float num2 = Mathf.Lerp(WalkieTalkie.allWalkieTalkies[i].maxVolume, 0f, num / (WalkieTalkie.allWalkieTalkies[i].recordingRange + 3f)); WalkieTalkie.allWalkieTalkies[j].target.pitch = pitch; WalkieTalkie.allWalkieTalkies[j].target.PlayOneShot(clip, num2 * vol); } } } } } public class LibConfig { public ConfigEntry<bool> extendedLogging; public LibConfig(ConfigFile cfg) { extendedLogging = cfg.Bind<bool>("General", "ExtendedLogging", false, "Extra logging for debugging"); ClearUnusedEntries(cfg); } private void ClearUnusedEntries(ConfigFile cfg) { ((Dictionary<ConfigDefinition, string>)((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(cfg, null)).Clear(); cfg.Save(); } } public static class PluginInformation { public const string PLUGIN_GUID = "solidlib"; public const string PLUGIN_NAME = "Solid's Library"; public const string PLUGIN_VERSION = "1.2.1"; } [BepInPlugin("solidlib", "Solid's Library", "1.2.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SolidLib : BaseUnityPlugin { public static ManualLogSource Log; private readonly Harmony harmony = new Harmony("solidlib"); private AssetBundle solidLibBundle; public static GameObject UtilsPrefab; private int materialCount; internal static LibConfig BoundConfig { get; private set; } private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Initializing Library"); BoundConfig = new LibConfig(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); Registries.InitRegistries(); LoadAllIngameAssetsIntoRegistry(); solidLibBundle = BundleUtils.LoadBundleFromInternalAssembly("solidlibassets"); UtilsPrefab = solidLibBundle.LoadAsset<GameObject>("SolidLibUtils.prefab"); NetworkPrefabs.RegisterNetworkPrefab(UtilsPrefab); harmony.PatchAll(Assembly.GetExecutingAssembly()); } public static void LogExtended(object log) { if (BoundConfig.extendedLogging.Value) { Log.LogInfo(log); } } private void LoadAllIngameAssetsIntoRegistry() { } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } } namespace SolidLib.Utils { public class SolidLibUtils : NetworkBehaviour { private static Random random; private static Dictionary<ulong, Action<GameObject>> pendingSpawns = new Dictionary<ulong, Action<GameObject>>(); public static SolidLibUtils Instance { get; private set; } private void Awake() { Instance = this; } [ServerRpc(RequireOwnership = false)] public void SpawnItemServerRpc(ulong requestId, string itemName, Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_023b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(569755127u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, requestId); bool flag = itemName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(itemName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 569755127u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } if ((Object)(object)StartOfRound.Instance == (Object)null) { CompleteSpawn(requestId, null); return; } if (random == null) { random = new Random(StartOfRound.Instance.randomMapSeed + 85); } if (!Registries.ItemRegistry.TryGetValue(itemName, out Item item)) { SolidLib.Log.LogInfo((object)"[Spawner] Failed to get item from registry"); CompleteSpawn(requestId, null); return; } GameObject val3 = Object.Instantiate<GameObject>(item.spawnPrefab, position + Vector3.up, Quaternion.identity, StartOfRound.Instance.propsContainer); val3.GetComponent<NetworkObject>().TrySetParent(StartOfRound.Instance.propsContainer, true); val3.GetComponent<NetworkObject>().Spawn(false); val3.GetComponent<NetworkObject>().TrySetParent(StartOfRound.Instance.propsContainer, true); val3.GetComponent<NetworkObject>().TrySetParent(StartOfRound.Instance.propsContainer, true); int num = random.Next(item.minValue, item.maxValue); ScanNodeProperties componentInChildren = val3.GetComponentInChildren<ScanNodeProperties>(); componentInChildren.scrapValue = num; componentInChildren.subText = $"Value: ${num}"; val3.GetComponent<GrabbableObject>().scrapValue = num; SolidLib.Log.LogInfo((object)"[Spawner] Syncing Spawned Object"); UpdateScanNodeClientRpc(new NetworkObjectReference(val3), num); CompleteSpawn(requestId, val3); } private void CompleteSpawn(ulong requestId, GameObject go) { if (pendingSpawns.TryGetValue(requestId, out Action<GameObject> value)) { pendingSpawns.Remove(requestId); value?.Invoke(go); } } [ClientRpc] public void UpdateScanNodeClientRpc(NetworkObjectReference go, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(666025953u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref go, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, value); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 666025953u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref go)).TryGet(ref val3, (NetworkManager)null)) { ScanNodeProperties componentInChildren = ((Component)val3).GetComponentInChildren<ScanNodeProperties>(); componentInChildren.scrapValue = value; componentInChildren.subText = $"Value: ${value}"; } } } public void SpawnItem(string itemName, Vector3 position, Action<GameObject> callback) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) ulong localClientId = NetworkManager.Singleton.LocalClientId; pendingSpawns[localClientId] = callback; SpawnItemServerRpc(localClientId, itemName, position); } public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); foreach (string item in from s in configMoonRarity.Split(',') select s.Trim()) { string[] array = item.Split(':'); if (array.Length != 2) { continue; } string text = array[0]; if (int.TryParse(array[1], out var result)) { if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2)) { dictionary[result2] = result; } else { dictionary2[text] = result; } } } return (dictionary, dictionary2); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SolidLibUtils() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(569755127u, new RpcReceiveHandler(__rpc_handler_569755127)); NetworkManager.__rpc_func_table.Add(666025953u, new RpcReceiveHandler(__rpc_handler_666025953)); } private static void __rpc_handler_569755127(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong requestId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref requestId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string itemName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemName, false); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((SolidLibUtils)(object)target).SpawnItemServerRpc(requestId, itemName, position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_666025953(N
ReservedWeaponSlot.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using ReservedItemSlotCore; using ReservedItemSlotCore.Config; using ReservedItemSlotCore.Data; using ReservedWeaponSlot.Config; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ReservedWeaponSlot")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ReservedWeaponSlot")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5b723481-f5bd-43e5-9f47-26325095eea7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ReservedWeaponSlot { [BepInPlugin("FlipMods.ReservedWeaponSlot", "ReservedWeaponSlot", "1.1.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static Plugin instance; private static ManualLogSource logger; private Harmony _harmony; public static ReservedItemSlotData weaponSlotData; public static ReservedItemSlotData rangedWeaponSlotData; public static ReservedItemSlotData mainAmmoSlotData; public static List<ReservedItemSlotData> allAmmoSlotData = new List<ReservedItemSlotData>(); public static ReservedItemData shotgunData; public static ReservedItemData zapGunData; public static ReservedItemData shovelData; public static ReservedItemData stopSignData; public static ReservedItemData yieldSignData; public static ReservedItemData kitchenKnifeData; public static ReservedItemData rocketLauncherData; public static ReservedItemData flareGunData; public static ReservedItemData toyGunData; public static ReservedItemData toyHammerData; public static ReservedItemData goldenShovelData; public static ReservedItemData ammoData; public static ReservedItemData shotgunAmmoData; public static ReservedItemData flareGunAmmoData; public static List<ReservedItemData> additionalItemData = new List<ReservedItemData>(); private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown instance = this; CreateCustomLogger(); ConfigSettings.BindConfigSettings(); CreateReservedItemSlots(); CreateAdditionalReservedItemSlots(); _harmony = new Harmony("ReservedWeaponSlot"); PatchAll(); Log("ReservedWeaponSlot loaded"); } private void CreateReservedItemSlots() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_015f: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Expected O, but got Unknown weaponSlotData = ReservedItemSlotData.CreateReservedItemSlotData("weapons", ConfigSettings.overrideMeleeSlotPriority.Value, ConfigSettings.overrideMeleeSlotPrice.Value); if (ConfigSettings.combineMeleeAndRangedWeaponSlots.Value) { rangedWeaponSlotData = weaponSlotData; weaponSlotData.purchasePrice = ConfigSettings.overrideCombinedWeaponSlotPrice.Value; } else { weaponSlotData.slotName = "melee_weapons"; rangedWeaponSlotData = ReservedItemSlotData.CreateReservedItemSlotData("ranged_weapons", ConfigSettings.overrideRangedSlotPriority.Value, ConfigSettings.overrideRangedSlotPrice.Value); } shovelData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Shovel", (PlayerBone)0, default(Vector3), default(Vector3))); stopSignData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Stop sign", (PlayerBone)0, default(Vector3), default(Vector3))); yieldSignData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Yield sign", (PlayerBone)0, default(Vector3), default(Vector3))); kitchenKnifeData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Kitchen knife", (PlayerBone)0, default(Vector3), default(Vector3))); toyHammerData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Toy Hammer", (PlayerBone)0, default(Vector3), default(Vector3))); goldenShovelData = weaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Australium Shovel", (PlayerBone)0, default(Vector3), default(Vector3))); shotgunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Shotgun", (PlayerBone)0, default(Vector3), default(Vector3))); zapGunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Zap gun", (PlayerBone)0, default(Vector3), default(Vector3))); rocketLauncherData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Rocket Launcher", (PlayerBone)0, default(Vector3), default(Vector3))); flareGunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Flaregun", (PlayerBone)0, default(Vector3), default(Vector3))); toyGunData = rangedWeaponSlotData.AddItemToReservedItemSlot(new ReservedItemData("Revolver", (PlayerBone)0, default(Vector3), default(Vector3))); mainAmmoSlotData = null; if (ConfigSettings.disableReservedAmmoSlot.Value) { return; } for (int i = 0; i < ConfigSettings.numAmmoSlots.Value && ConfigSettings.overrideAmmoSlotPriority.Value - i < 0; i++) { string text = "ammo" + ((i > 0) ? (i + 1).ToString() : ""); ReservedItemSlotData val = ReservedItemSlotData.CreateReservedItemSlotData(text, ConfigSettings.overrideAmmoSlotPriority.Value - i, Mathf.Max(ConfigSettings.overrideAmmoSlotPrice.Value + ConfigSettings.overrideExtraAmmoSlotPriceIncrease.Value * i, 0)); if (mainAmmoSlotData == null) { mainAmmoSlotData = val; } if (ammoData == null) { ammoData = val.AddItemToReservedItemSlot(new ReservedItemData("Ammo", (PlayerBone)0, default(Vector3), default(Vector3))); shotgunAmmoData = val.AddItemToReservedItemSlot(new ReservedItemData("Shells", (PlayerBone)0, default(Vector3), default(Vector3))); flareGunAmmoData = val.AddItemToReservedItemSlot(new ReservedItemData("Emergency Flare (ammo)", (PlayerBone)0, default(Vector3), default(Vector3))); } else { val.AddItemToReservedItemSlot(ammoData); val.AddItemToReservedItemSlot(shotgunAmmoData); val.AddItemToReservedItemSlot(flareGunAmmoData); } allAmmoSlotData.Add(val); } } private void CreateAdditionalReservedItemSlots() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown string[] array = ConfigSettings.ParseAdditionalMeleeWeaponItems(); string[] array2 = array; foreach (string text in array2) { if (!weaponSlotData.ContainsItem(text)) { LogWarning("Adding additional item to reserved (melee weapons) item slot. Item: " + text); ReservedItemData val = new ReservedItemData(text, (PlayerBone)0, default(Vector3), default(Vector3)); additionalItemData.Add(val); weaponSlotData.AddItemToReservedItemSlot(val); } } array = ConfigSettings.ParseAdditionalRangedWeaponItems(); string[] array3 = array; foreach (string text2 in array3) { if (!rangedWeaponSlotData.ContainsItem(text2)) { LogWarning("Adding additional item to reserved (ranged weapons) item slot. Item: " + text2); ReservedItemData val2 = new ReservedItemData(text2, (PlayerBone)0, default(Vector3), default(Vector3)); additionalItemData.Add(val2); rangedWeaponSlotData.AddItemToReservedItemSlot(val2); } } if (!ConfigSettings.disableReservedAmmoSlot.Value) { array = ConfigSettings.ParseAdditionalAmmoItems(); string[] array4 = array; foreach (string text3 in array4) { if (mainAmmoSlotData.ContainsItem(text3)) { continue; } LogWarning("Adding additional item to reserved (ammo) item slot. Item: " + text3); ReservedItemData val3 = new ReservedItemData(text3, (PlayerBone)0, default(Vector3), default(Vector3)); additionalItemData.Add(val3); foreach (ReservedItemSlotData allAmmoSlotDatum in allAmmoSlotData) { if (!allAmmoSlotDatum.ContainsItem(text3)) { allAmmoSlotDatum.AddItemToReservedItemSlot(val3); } } } } string[] array5 = ConfigSettings.ParseRemoveMeleeWeaponItems(); string[] array6 = array5; foreach (string text4 in array6) { if (weaponSlotData.ContainsItem(text4)) { LogWarning("Removing item from reserved (melee weapons) item slot. Item: " + text4); weaponSlotData.RemoveItemFromReservedItemSlot(text4); } } array5 = ConfigSettings.ParseRemoveRangedWeaponItems(); string[] array7 = array5; foreach (string text5 in array7) { if (rangedWeaponSlotData.ContainsItem(text5)) { LogWarning("Removing item from reserved (ranged weapons) item slot. Item: " + text5); rangedWeaponSlotData.RemoveItemFromReservedItemSlot(text5); } } if (ammoData == null) { return; } array5 = ConfigSettings.ParseRemoveAmmoItems(); string[] array8 = array5; foreach (string text6 in array8) { LogWarning("Removing item from reserved (ammo) item slot. Item: " + text6); foreach (ReservedItemSlotData allAmmoSlotDatum2 in allAmmoSlotData) { if (allAmmoSlotDatum2.ContainsItem(text6)) { allAmmoSlotDatum2.RemoveItemFromReservedItemSlot(text6); } } } } private void PatchAll() { IEnumerable<Type> enumerable; try { enumerable = Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { enumerable = ex.Types.Where((Type t) => t != null); } foreach (Type item in enumerable) { _harmony.PatchAll(item); } } private void CreateCustomLogger() { try { logger = Logger.CreateLogSource($"{((BaseUnityPlugin)this).Info.Metadata.Name}-{((BaseUnityPlugin)this).Info.Metadata.Version}"); } catch { logger = ((BaseUnityPlugin)this).Logger; } } public static void Log(string message) { logger.LogInfo((object)message); } public static void LogError(string message) { logger.LogError((object)message); } public static void LogWarning(string message) { logger.LogWarning((object)message); } public static bool IsModLoaded(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } } public static class PluginInfo { public const string PLUGIN_GUID = "FlipMods.ReservedWeaponSlot"; public const string PLUGIN_NAME = "ReservedWeaponSlot"; public const string PLUGIN_VERSION = "1.1.5"; } } namespace ReservedWeaponSlot.Input { internal class IngameKeybinds : LcInputActions { internal static IngameKeybinds Instance = new IngameKeybinds(); [InputAction("<Keyboard>/t", Name = "[ReservedItemSlots]\nToggle Weapon Slot")] public InputAction ToggleWeaponSlotHotkey { get; set; } internal static InputActionAsset GetAsset() { return ((LcInputActions)Instance).Asset; } } internal class InputUtilsCompat { internal static InputActionAsset Asset => IngameKeybinds.GetAsset(); internal static bool Enabled => Plugin.IsModLoaded("com.rune580.LethalCompanyInputUtils"); public static InputAction ToggleWeaponHotkey => IngameKeybinds.Instance.ToggleWeaponSlotHotkey; } [HarmonyPatch] internal static class Keybinds { public static InputActionAsset Asset; public static InputActionMap ActionMap; private static InputAction ToggleWeaponSlotAction; public static bool holdingWeaponModifier; public static bool toggledWeaponSlot; public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; public static ReservedPlayerData localPlayerData => ReservedPlayerData.localPlayerData; [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] public static void AddToKeybindMenu() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Plugin.Log("Initializing hotkeys."); if (InputUtilsCompat.Enabled) { Asset = InputUtilsCompat.Asset; ActionMap = Asset.actionMaps[0]; ToggleWeaponSlotAction = InputUtilsCompat.ToggleWeaponHotkey; } else { Asset = ScriptableObject.CreateInstance<InputActionAsset>(); ActionMap = new InputActionMap("ReservedItemSlots"); InputActionSetupExtensions.AddActionMap(Asset, ActionMap); ToggleWeaponSlotAction = InputActionSetupExtensions.AddAction(ActionMap, "ReservedItemSlots.ToggleWeaponSlot", (InputActionType)0, "", (string)null, (string)null, (string)null, (string)null); } } [HarmonyPatch(typeof(StartOfRound), "OnEnable")] [HarmonyPostfix] public static void OnEnable() { Asset.Enable(); ToggleWeaponSlotAction.performed += OnSwapToWeaponSlot; ToggleWeaponSlotAction.canceled += OnSwapToWeaponSlot; } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPostfix] public static void OnDisable() { Asset.Disable(); ToggleWeaponSlotAction.performed -= OnSwapToWeaponSlot; ToggleWeaponSlotAction.canceled -= OnSwapToWeaponSlot; } private static void OnSwapToWeaponSlot(CallbackContext context) { if (!((Object)(object)localPlayerController == (Object)null) && localPlayerData != null && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && SessionManager.unlockedReservedItemSlotsDict.TryGetValue(Plugin.weaponSlotData.slotName, out var value)) { List<ReservedItemSlotData> list = new List<ReservedItemSlotData> { value }; if (SessionManager.unlockedReservedItemSlotsDict.TryGetValue(Plugin.rangedWeaponSlotData.slotName, out var value2) && !list.Contains(value2)) { list.Add(value2); } ReservedHotbarManager.ForceToggleReservedHotbar(list.ToArray()); } } } } namespace ReservedWeaponSlot.Config { public static class ConfigSettings { public static ConfigEntry<int> overrideMeleeSlotPriority; public static ConfigEntry<int> overrideMeleeSlotPrice; public static ConfigEntry<int> overrideRangedSlotPriority; public static ConfigEntry<int> overrideRangedSlotPrice; public static ConfigEntry<bool> combineMeleeAndRangedWeaponSlots; public static ConfigEntry<int> overrideCombinedWeaponSlotPrice; public static ConfigEntry<bool> disableReservedAmmoSlot; public static ConfigEntry<int> overrideAmmoSlotPriority; public static ConfigEntry<int> overrideAmmoSlotPrice; public static ConfigEntry<int> numAmmoSlots; public static ConfigEntry<int> overrideExtraAmmoSlotPriceIncrease; public static ConfigEntry<string> additionalMeleeWeaponsInSlot; public static ConfigEntry<string> additionalRangedWeaponsInSlot; public static ConfigEntry<string> additionalAmmoInSlot; public static ConfigEntry<string> removeItemsFromMeleeWeaponsSlot; public static ConfigEntry<string> removeItemsFromRangedWeaponsSlot; public static ConfigEntry<string> removeItemsFromAmmoSlot; public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>(); public static void BindConfigSettings() { Plugin.Log("BindingConfigs"); overrideMeleeSlotPriority = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "MeleeWeaponSlotPriorityOverride", 100, "[Host only] Manually set the priority for this item slot. Higher priority slots will come first in the reserved item slots, which will appear below the other slots. Negative priority items will appear on the left side of the screen, this is disabled in the core mod's config.")); overrideMeleeSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "MeleeWeaponSlotPriceOverride", 150, "[Host only] Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts.")); overrideRangedSlotPriority = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "RangedWeaponSlotPriorityOverride", 99, "[Host only] Manually set the priority for this item slot. Higher priority slots will come first in the reserved item slots, which will appear below the other slots. Negative priority items will appear on the left side of the screen, this is disabled in the core mod's config.")); overrideRangedSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "RangedWeaponSlotPriceOverride", 250, "[Host only] Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts.")); combineMeleeAndRangedWeaponSlots = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Server-side", "CombineMeleeAndRangedWeaponSlots", true, "[Host only] If set to false, melee and ranged weapons will be added to two different reserved item slots. If purchasing item slots is enabled, each slots will need to be purchased separately. (prices for each will be reduced)")); overrideCombinedWeaponSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "CombinedWeaponSlotPriceOverride", 400, "[Host only] Only applies if CombineMeleeAndRangedWeaponSlots is true. Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts.")); disableReservedAmmoSlot = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("Server-side", "DisableReservedAmmoSlot", false, "[Host only] Disables the reserved ammo slot. Will sync with clients.")); overrideAmmoSlotPriority = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "AmmoSlotPriorityOverride", -100, "[Host only] Manually set the priority for this item slot. Higher priority slots will come first in the reserved item slots, which will appear below the other slots. Negative priority items will appear on the left side of the screen, this is disabled in the core mod's config.")); overrideAmmoSlotPrice = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "AmmoSlotPriceOverride", 150, "[Host only] Manually set the price for this item in the store. Setting 0 will force this item to be unlocked immediately after the game starts.")); numAmmoSlots = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "NumAmmoSlots", 1, "[Host only] Sets the number of reserved ammo slots. Only applies if this slot is enabled.\nNOTE: Ammo does NOT currently stack into one slot at this time. This is on my TODO list.")); overrideExtraAmmoSlotPriceIncrease = AddConfigEntry<int>(((BaseUnityPlugin)Plugin.instance).Config.Bind<int>("Server-side", "ExtraAmmoSlotsPriceIncreaseOverride", 10, "[Host only] If multiple ammo slots are enabled, and purchasing slots is enabled, the price for each additional ammo slot will go up by this amount.")); additionalMeleeWeaponsInSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "AdditionalMeleeWeaponsInSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). When adding items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nNOTE: IF YOU ARE USING A TRANSLATION MOD, YOU MAY NEED TO ADD THE TRANSLATED NAME OF ANY ITEM YOU WANT IN THIS SLOT.")); additionalRangedWeaponsInSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "AdditionalRangedWeaponsInSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). When adding items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nNOTE: IF YOU ARE USING A TRANSLATION MOD, YOU MAY NEED TO ADD THE TRANSLATED NAME OF ANY ITEM YOU WANT IN THIS SLOT.")); additionalAmmoInSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "AdditionalAmmoInSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). When adding items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nNOTE: IF YOU ARE USING A TRANSLATION MOD, YOU MAY NEED TO ADD THE TRANSLATED NAME OF ANY ITEM YOU WANT IN THIS SLOT.")); removeItemsFromMeleeWeaponsSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "RemoveMeleeWeaponsFromSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). Removes the specified items from this reserved item slot. When removing items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nCURRENT MELEE WEAPONS IN SLOT: \"Shovel\", \"Stop sign\", \"Yield sign\", \"Kitchen knife\", \"Toy Hammer\", \"Australium Shovel\"")); removeItemsFromRangedWeaponsSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "RemoveRangedWeaponsFromSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). Removes the specified items from this reserved item slot. When removing items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nCURRENT RANGED WEAPONS IN SLOT: \"Shotgun\", \"Zap gun\", \"Rocket Launcher\", \"Flaregun\", \"Revolver\"")); removeItemsFromAmmoSlot = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("Server-side", "RemoveAmmoItemsFromSlot", "", "[Host only] Syntax: \"Item1,Item name2\" (without quotes). Removes the specified items from this reserved item slot.When removing items, use the item's name as it appears in game. Include spaces if there are spaces in the item name. Adding items that do not exist, or that are from a mod which is not enabled will not cause any problems.\nCURRENT AMMO ITEMS IN SLOT: \"Ammo\", \"Shells\", \"Emergency Flare (ammo)\"")); additionalMeleeWeaponsInSlot.Value = additionalMeleeWeaponsInSlot.Value.Replace(", ", ","); additionalRangedWeaponsInSlot.Value = additionalRangedWeaponsInSlot.Value.Replace(", ", ","); additionalAmmoInSlot.Value = additionalAmmoInSlot.Value.Replace(", ", ","); removeItemsFromMeleeWeaponsSlot.Value = removeItemsFromMeleeWeaponsSlot.Value.Replace(", ", ","); removeItemsFromRangedWeaponsSlot.Value = removeItemsFromRangedWeaponsSlot.Value.Replace(", ", ","); removeItemsFromAmmoSlot.Value = removeItemsFromAmmoSlot.Value.Replace(", ", ","); TryRemoveOldConfigSettings(); } public static ConfigEntry<T> AddConfigEntry<T>(ConfigEntry<T> configEntry) { currentConfigEntries.Add(((ConfigEntryBase)configEntry).Definition.Key, (ConfigEntryBase)(object)configEntry); return configEntry; } public static string[] ParseAdditionalMeleeWeaponItems() { return ConfigSettings.ParseItemNames(additionalMeleeWeaponsInSlot.Value); } public static string[] ParseAdditionalRangedWeaponItems() { return ConfigSettings.ParseItemNames(additionalRangedWeaponsInSlot.Value); } public static string[] ParseAdditionalAmmoItems() { return ConfigSettings.ParseItemNames(additionalAmmoInSlot.Value); } public static string[] ParseRemoveMeleeWeaponItems() { return ConfigSettings.ParseItemNames(removeItemsFromMeleeWeaponsSlot.Value); } public static string[] ParseRemoveRangedWeaponItems() { return ConfigSettings.ParseItemNames(removeItemsFromRangedWeaponsSlot.Value); } public static string[] ParseRemoveAmmoItems() { return ConfigSettings.ParseItemNames(removeItemsFromAmmoSlot.Value); } public static void TryRemoveOldConfigSettings() { HashSet<string> hashSet = new HashSet<string>(); HashSet<string> hashSet2 = new HashSet<string>(); foreach (ConfigEntryBase value in currentConfigEntries.Values) { hashSet.Add(value.Definition.Section); hashSet2.Add(value.Definition.Key); } try { ConfigFile config = ((BaseUnityPlugin)Plugin.instance).Config; string configFilePath = config.ConfigFilePath; if (!File.Exists(configFilePath)) { return; } string text = File.ReadAllText(configFilePath); string[] array = File.ReadAllLines(configFilePath); string text2 = ""; for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("\n", ""); if (array[i].Length <= 0) { continue; } if (array[i].StartsWith("[")) { if (text2 != "" && !hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num = text.IndexOf(text2); int num2 = text.IndexOf(array[i]); text = text.Remove(num, num2 - num); } text2 = array[i].Replace("[", "").Replace("]", "").Trim(); } else { if (!(text2 != "")) { continue; } if (i <= array.Length - 4 && array[i].StartsWith("##")) { int j; for (j = 1; i + j < array.Length && array[i + j].Length > 3; j++) { } if (hashSet.Contains(text2)) { int num3 = array[i + j - 1].IndexOf("="); string item = array[i + j - 1].Substring(0, num3 - 1); if (!hashSet2.Contains(item)) { int num4 = text.IndexOf(array[i]); int num5 = text.IndexOf(array[i + j - 1]) + array[i + j - 1].Length; text = text.Remove(num4, num5 - num4); } } i += j - 1; } else if (array[i].Length > 3) { text = text.Replace(array[i], ""); } } } if (!hashSet.Contains(text2)) { text2 = "[" + text2 + "]"; int num6 = text.IndexOf(text2); text = text.Remove(num6, text.Length - num6); } while (text.Contains("\n\n\n")) { text = text.Replace("\n\n\n", "\n\n"); } File.WriteAllText(configFilePath, text); config.Reload(); } catch { } } } }
PortalDunGen.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen.Graph; using GameNetcodeStuff; using LethalLevelLoader; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.Playables; [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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PortalDunGen")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds Portal DunGen to Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+75abbe3fcb5bd5ea0cc062092254e8b3aa415ff0")] [assembly: AssemblyProduct("PortalDunGen")] [assembly: AssemblyTitle("PortalDunGen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class EXT_ChallengeModeTurret : MonoBehaviour { public PlayableDirector pd; public GameObject spawnOn; public IEnumerator SpawnCoroutine(GameObject turretPrefab) { pd.Play(); yield return (object)new WaitForSeconds(1.5f); Transform t = spawnOn.transform; GameObject gameObject = Object.Instantiate<GameObject>(turretPrefab, t.position, t.rotation); gameObject.GetComponent<NetworkObject>().Spawn(true); } } [RequireComponent(typeof(AudioSource))] public class EXT_PlayRandomSound : MonoBehaviour { public List<AudioClip> Sounds; public void PlayRandomSound() { int index = Random.Range(0, Sounds.Count); AudioSource component = ((Component)this).GetComponent<AudioSource>(); component.clip = Sounds[index]; component.Play(); } } public class EXT_ChallengeModeIntro : NetworkBehaviour { public void DoChallengeModeIntro() { Debug.Log((object)"[EXT_ChallengeModeIntro] Firing..."); NetworkManager component = ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>(); GameObject val = null; foreach (NetworkPrefab prefab in component.NetworkConfig.Prefabs.Prefabs) { if (((Object)prefab.Prefab).name == "TurretContainer") { val = prefab.Prefab; break; } } if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[EXT_ChallengeModeIntro] Failed to find TurretContainer"); return; } EXT_ChallengeModeTurret[] array = Object.FindObjectsByType<EXT_ChallengeModeTurret>((FindObjectsSortMode)0); Debug.Log((object)$"[EXT_ChallengeModeIntro] Found {array.Length} turrets to spawn"); EXT_ChallengeModeTurret[] array2 = array; foreach (EXT_ChallengeModeTurret eXT_ChallengeModeTurret in array2) { ((MonoBehaviour)this).StartCoroutine(eXT_ChallengeModeTurret.SpawnCoroutine(val)); } } } public class EXT_TimelineTrampoline : MonoBehaviour { public InteractEvent OnSignal; public void DoSignalTrampoline() { ((UnityEvent<PlayerControllerB>)(object)OnSignal).Invoke(GameNetworkManager.Instance.localPlayerController); } } public class EXT_RandomFanSpeed : MonoBehaviour { private void Awake() { Animator component = ((Component)this).GetComponent<Animator>(); component.speed = Random.Range(0.2f, 0.9f); } } [Serializable] public class BoolEvent : UnityEvent<bool> { } public class EXT_FloorButtonTrigger : NetworkBehaviour { public bool Persistent = false; public List<GrabbableObject> contained = new List<GrabbableObject>(); private bool IsPressed = false; public InteractEvent OnDepressed; public InteractEvent OnReleased; public bool GetNewIsPressed() { return contained.Count > 0; } private void UpdateIsPressed() { if (Persistent && IsPressed) { return; } bool newIsPressed = GetNewIsPressed(); if (newIsPressed != IsPressed) { IsPressed = newIsPressed; if (IsPressed) { ((UnityEvent<PlayerControllerB>)(object)OnDepressed).Invoke(GameNetworkManager.Instance.localPlayerController); } else { ((UnityEvent<PlayerControllerB>)(object)OnReleased).Invoke(GameNetworkManager.Instance.localPlayerController); } } } private void OnTriggerEnter(Collider other) { if (((NetworkBehaviour)this).NetworkManager.IsServer) { GrabbableObject component = ((Component)other).GetComponent<GrabbableObject>(); if (!((Object)(object)component == (Object)null) && !contained.Contains(component)) { Debug.Log((object)("Portal DunGen New thing entered input trigger: " + ((Object)((Component)other).gameObject).name + ".")); contained.Add(component); UpdateIsPressed(); } } } private void OnTriggerStay(Collider other) { if (((NetworkBehaviour)this).NetworkManager.IsServer) { GrabbableObject component = ((Component)other).GetComponent<GrabbableObject>(); if (!((Object)(object)component == (Object)null) && !contained.Contains(component)) { Debug.Log((object)("Portal DunGen New thing entered input trigger: " + ((Object)((Component)other).gameObject).name + ".")); contained.Add(component); UpdateIsPressed(); } } } private void FixedUpdate() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Collider component = ((Component)this).GetComponent<Collider>(); List<GrabbableObject> list = contained.ToList(); foreach (GrabbableObject item in list) { Collider component2 = ((Component)item).GetComponent<Collider>(); if (!((Object)(object)component2 == (Object)null)) { Bounds bounds = component2.bounds; if (!((Bounds)(ref bounds)).Intersects(component.bounds)) { Debug.Log((object)("Portal DunGen Thing has left input trigger in FixedUpdate: " + ((Object)((Component)item).gameObject).name + ".")); contained.Remove(item); } } } UpdateIsPressed(); } private void OnTriggerExit(Collider other) { if (((NetworkBehaviour)this).NetworkManager.IsServer) { GrabbableObject component = ((Component)other).GetComponent<GrabbableObject>(); if (!((Object)(object)component == (Object)null)) { Debug.Log((object)("Portal DunGen Thing has left input trigger: " + ((Object)((Component)other).gameObject).name + ".")); contained.Remove(component); UpdateIsPressed(); } } } } public class EXT_CarryCubeItem : GrabbableObject { } namespace PortalDunGen { [BepInPlugin("PortalDunGen", "PortalDunGen", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PortalDunGenPlugin : BaseUnityPlugin { public ManualLogSource mls; public static AssetBundle assets; private ConfigEntry<bool> configHideAperatureLogos; private ConfigEntry<string> configLevelMatchingProperties; private ConfigEntry<int> configLengthOverride; private void Awake() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Expected O, but got Unknown //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Expected O, but got Unknown mls = Logger.CreateLogSource("PortalDunGen"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); assets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "portaldungen.compressed")); if ((Object)(object)assets == (Object)null) { mls.LogError((object)"Failed to load Portal DunGen assets."); return; } DungeonFlow val = assets.LoadAsset<DungeonFlow>("assets/portaldungenflow.asset"); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load Portal DunGen Dungeon Flow."); return; } AudioClip val2 = assets.LoadAsset<AudioClip>("assets/misc/sp_a1_intro1_b2b.ogg"); if ((Object)(object)val2 == (Object)null) { mls.LogWarning((object)"Failed to load Portal DunGen Audio... weird"); } configLevelMatchingProperties = ((BaseUnityPlugin)this).Config.Bind<string>("General", "LevelMatchingProperties", "portal:99999,all:25,titan:100", new ConfigDescription("Controls how the DunGen will spawn. A list of the form `[name]:[rarity],[name]:[rarity],...`. Defaults to `portal:99999` so it always spawns on moons related to portal. Rarity is an integer. Name can be one of:\n* portal - Spawns only on portal-related maps using ContentTags\n* all - Spawns on everything\n* [name] - Name of a specific moon.\n\nIf no rarity is specified, the rarity for that item defaults to 0 and it wont spawn.", (AcceptableValueBase)null, Array.Empty<object>())); configLengthOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "PortalDunGenLengthOverride", -1, new ConfigDescription(string.Format("If not -1, overrides the foundation length to whatever you'd like. Adjusts how long/large the dungeon generates.\nSetting it too high has the potential to generate too much and crash the game. Untested over 50.\nFor reference, the default value for the current version [{0}] is {1}.", "1.0.0", val.Length.Min), (AcceptableValueBase)null, Array.Empty<object>())); configHideAperatureLogos = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PortalDunGenHideAperatureLogos", false, "Hides Aperature logos inside"); if (configLengthOverride.Value != -1) { mls.LogInfo((object)$"Portal DunGen length override has been set to {configLengthOverride.Value}"); val.Length.Min = configLengthOverride.Value; val.Length.Max = configLengthOverride.Value; } if (configHideAperatureLogos.Value) { mls.LogInfo((object)"Portal DunGen Aperature logos will be hidden"); GlobalPropSettings val3 = val.GlobalProps.Find((GlobalPropSettings t) => t.ID == 101010); val3.Count.Min = 0; val3.Count.Max = 0; } mls.LogInfo((object)"Portal DunGen registering..."); ExtendedDungeonFlow val4 = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); val4.DungeonFlow = val; val4.DungeonName = "Portal DunGen"; val4.FirstTimeDungeonAudio = val2; val4.DynamicDungeonSizeMinMax = new Vector2(1f, 3f); val4.DynamicDungeonSizeLerpRate = 0f; val4.LevelMatchingProperties = ScriptableObject.CreateInstance<LevelMatchingProperties>(); List<StringWithRarity> list = ConfigHelper.ConvertToStringWithRarityList(configLevelMatchingProperties.Value, Vector2.zero); foreach (StringWithRarity item in list) { if (item.Name == "portal") { mls.LogInfo((object)$"Portal DunGen registering with 'portal' ContentTag at rarity {item.Rarity}"); val4.LevelMatchingProperties.levelTags.Add(new StringWithRarity("portal", item.Rarity)); val4.LevelMatchingProperties.planetNames.Add(new StringWithRarity("Portal Moon", item.Rarity)); } else if (item.Name == "all") { mls.LogInfo((object)$"Portal DunGen registering against all moons ('custom' and 'vanilla' ContentTags) at rarity {item.Rarity}"); val4.LevelMatchingProperties.levelTags.Add(new StringWithRarity("custom", item.Rarity)); val4.LevelMatchingProperties.levelTags.Add(new StringWithRarity("vanilla", item.Rarity)); } else { mls.LogInfo((object)$"Portal DunGen registering against moon name {item.Name} at rarity {item.Rarity}"); val4.LevelMatchingProperties.planetNames.Add(new StringWithRarity(item.Name, item.Rarity)); } } PatchedContent.RegisterExtendedDungeonFlow(val4); mls.LogInfo((object)"Portal DunGen for Lethal Company [Version 1.0.0] successfully loaded."); } } public static class PluginInfo { public const string PLUGIN_GUID = "PortalDunGen"; public const string PLUGIN_NAME = "PortalDunGen"; public const string PLUGIN_VERSION = "1.0.0"; } }
BuyableShotgunShells.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("BuyableShotgunShells")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d6d2c0f918043d4e4353ef5c47682e34337a1e68")] [assembly: AssemblyProduct("BuyableShotgunShells")] [assembly: AssemblyTitle("BuyableShotgunShells")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BuyableShotgunShells { [BepInDependency("evaisa.lethallib", "0.13.2")] [BepInPlugin("MegaPiggy.BuyableShotgunShells", "Buyable Shotgun Shells", "1.3.0")] public class BuyableShotgunShells : BaseUnityPlugin { public class ClonedItem : Item { public Item original; } internal class Unflagger : MonoBehaviour { public void Awake() { ((Object)((Component)this).gameObject).hideFlags = (HideFlags)0; } } [HarmonyPatch] internal static class Patches { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void ServerConnect() { //IL_00a9: 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_008f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (IsHost) { LoggerInstance.LogInfo((object)"Started hosting, using local settings"); CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("BuyableShotgunShells_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); UpdateShopItemPrice(); } else { LoggerInstance.LogInfo((object)"Connected to server, requesting settings"); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("BuyableShotgunShells_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BuyableShotgunShells_OnRequestConfigSync", 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)2); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Start() { LoggerInstance.LogWarning((object)"Game network manager start"); CloneShells(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void ServerDisconnect() { LoggerInstance.LogInfo((object)"Server disconnect"); ShellPriceRemote = -1; } } private const string modGUID = "MegaPiggy.BuyableShotgunShells"; private const string modName = "Buyable Shotgun Shells"; private const string modVersion = "1.3.0"; private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgunShells"); private static BuyableShotgunShells Instance; private static ConfigEntry<int> ShellPriceConfig; internal static int ShellPriceRemote = -1; private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>(); public static byte CurrentVersionByte = 1; private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; public static List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Reverse().ToList(); public static Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name.Equals("GunAmmo") && (Object)(object)item.spawnPrefab != (Object)null)); public static ClonedItem ShotgunShellClone { get; private set; } public static int ShellPriceLocal => ShellPriceConfig.Value; public static int ShellPrice => (ShellPriceRemote > -1) ? ShellPriceRemote : ShellPriceLocal; private static bool IsHost => NetworkManager.Singleton.IsHost; private static ulong LocalClientId => NetworkManager.Singleton.LocalClientId; private void Awake() { if ((Object)(object)Instance == (Object)null) { Object.DontDestroyOnLoad((Object)(object)this); Instance = this; } harmony.PatchAll(); ShellPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunShellPrice", 20, "Credits needed to buy shotgun shells"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun Shells is loaded with version 1.3.0!"); } private static ClonedItem CloneNonScrap(Item original, int price) { ClonedItem clonedItem = ScriptableObject.CreateInstance<ClonedItem>(); Object.DontDestroyOnLoad((Object)(object)clonedItem); clonedItem.original = original; GameObject val = NetworkPrefabs.CloneNetworkPrefab(original.spawnPrefab, "Buyable" + ((Object)original).name); val.AddComponent<Unflagger>(); Object.DontDestroyOnLoad((Object)(object)val); CopyFields(original, (Item)(object)clonedItem); val.GetComponent<GrabbableObject>().itemProperties = (Item)(object)clonedItem; ((Item)clonedItem).spawnPrefab = val; ((Object)clonedItem).name = "Buyable" + ((Object)original).name; ((Item)clonedItem).creditsWorth = price; ((Item)clonedItem).isScrap = false; return clonedItem; } public static void CopyFields(Item source, Item destination) { FieldInfo[] fields = typeof(Item).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(destination, fieldInfo.GetValue(source)); } } private static TerminalNode CreateInfoNode(string name, string description) { if (infoNodes.ContainsKey(name)) { return infoNodes[name]; } TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } private static void CloneShells() { if (!((Object)(object)ShotgunShell == (Object)null) && !((Object)(object)ShotgunShellClone != (Object)null)) { ShotgunShellClone = CloneNonScrap(ShotgunShell, ShellPrice); ((Item)ShotgunShellClone).itemName = "Shells"; AddToShop(); } } private static void AddToShop() { ClonedItem shotgunShellClone = ShotgunShellClone; int shellPrice = ShellPrice; Items.RegisterShopItem((Item)(object)shotgunShellClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("ShotgunShell", "Ammo for the Nutcracker's Shotgun."), shellPrice); LoggerInstance.LogInfo((object)$"Shotgun Shell added to Shop for {ShellPrice} credits"); } private static void UpdateShopItemPrice() { ((Item)ShotgunShellClone).creditsWorth = ShellPrice; Items.UpdateShopItemPrice((Item)(object)ShotgunShellClone, ShellPrice); LoggerInstance.LogInfo((object)$"Shotgun Shell price updated to {ShellPrice} credits"); } public static void WriteData(FastBufferWriter writer) { ((FastBufferWriter)(ref writer)).WriteByte(CurrentVersionByte); ((FastBufferWriter)(ref writer)).WriteBytes(BitConverter.GetBytes(ShellPriceLocal), -1, 0); } public static void ReadData(FastBufferReader reader) { byte b = default(byte); ((FastBufferReader)(ref reader)).ReadByte(ref b); if (b == CurrentVersionByte) { byte[] value = new byte[4]; ((FastBufferReader)(ref reader)).ReadBytes(ref value, 4, 0); ShellPriceRemote = BitConverter.ToInt32(value, 0); UpdateShopItemPrice(); LoggerInstance.LogInfo((object)"Host config set successfully"); return; } throw new Exception("Invalid version byte"); } public static void OnRequestSync(ulong clientID, FastBufferReader reader) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { return; } LoggerInstance.LogInfo((object)("Sending config to client " + clientID)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(5, (Allocator)2, 5); try { WriteData(val); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BuyableShotgunShells_OnReceiveConfigSync", clientID, val, (NetworkDelivery)2); } catch (Exception arg) { LoggerInstance.LogError((object)$"Failed to send config: {arg}"); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong clientID, FastBufferReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) LoggerInstance.LogInfo((object)"Received config from host"); try { ReadData(reader); } catch (Exception arg) { LoggerInstance.LogError((object)$"Failed to receive config: {arg}"); ShellPriceRemote = -1; } } } }
BuyableShotgun.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("BuyableShotgun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6ba547771daa1d82ce02c67222831d51d8608dcc")] [assembly: AssemblyProduct("BuyableShotgun")] [assembly: AssemblyTitle("BuyableShotgun")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BuyableShotgun { [BepInDependency("evaisa.lethallib", "0.13.2")] [BepInPlugin("MegaPiggy.BuyableShotgun", "Buyable Shotgun", "1.3.0")] public class BuyableShotgun : BaseUnityPlugin { public class ClonedItem : Item { public Item original; } internal class Unflagger : MonoBehaviour { public void Awake() { ((Object)((Component)this).gameObject).hideFlags = (HideFlags)0; } } [HarmonyPatch] internal static class Patches { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void ServerConnect() { //IL_00a9: 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_008f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (IsHost) { LoggerInstance.LogInfo((object)"Started hosting, using local settings"); CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("BuyableShotgun_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); UpdateShopItemPrice(); } else { LoggerInstance.LogInfo((object)"Connected to server, requesting settings"); CustomMessagingManager customMessagingManager2 = NetworkManager.Singleton.CustomMessagingManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("BuyableShotgun_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BuyableShotgun_OnRequestConfigSync", 0uL, new FastBufferWriter(0, (Allocator)2, -1), (NetworkDelivery)2); } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Start() { LoggerInstance.LogWarning((object)"Game network manager start"); CloneShotgun(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void ServerDisconnect() { LoggerInstance.LogInfo((object)"Server disconnect"); ShotgunPriceRemote = -1; } } private const string modGUID = "MegaPiggy.BuyableShotgun"; private const string modName = "Buyable Shotgun"; private const string modVersion = "1.3.0"; private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgun"); private static BuyableShotgun Instance; private static ConfigEntry<int> ShotgunPriceConfig; internal static int ShotgunPriceRemote = -1; private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>(); public static byte CurrentVersionByte = 1; private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; public static List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Reverse().ToList(); public static Item Shotgun => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name.Equals("Shotgun") && (Object)(object)item.spawnPrefab != (Object)null)); public static ClonedItem ShotgunClone { get; private set; } public static int ShotgunPriceLocal => ShotgunPriceConfig.Value; public static int ShotgunPrice => (ShotgunPriceRemote > -1) ? ShotgunPriceRemote : ShotgunPriceLocal; private static bool IsHost => NetworkManager.Singleton.IsHost; private static ulong LocalClientId => NetworkManager.Singleton.LocalClientId; private void Awake() { if ((Object)(object)Instance == (Object)null) { Object.DontDestroyOnLoad((Object)(object)this); Instance = this; } harmony.PatchAll(); ShotgunPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunPrice", 700, "Credits needed to buy shotgun"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun is loaded with version 1.3.0!"); } private static ClonedItem CloneNonScrap(Item original, int price) { ClonedItem clonedItem = ScriptableObject.CreateInstance<ClonedItem>(); Object.DontDestroyOnLoad((Object)(object)clonedItem); clonedItem.original = original; GameObject val = NetworkPrefabs.CloneNetworkPrefab(original.spawnPrefab, "Buyable" + ((Object)original).name); val.AddComponent<Unflagger>(); Object.DontDestroyOnLoad((Object)(object)val); CopyFields(original, (Item)(object)clonedItem); val.GetComponent<GrabbableObject>().itemProperties = (Item)(object)clonedItem; ((Item)clonedItem).spawnPrefab = val; ((Object)clonedItem).name = "Buyable" + ((Object)original).name; ((Item)clonedItem).creditsWorth = price; ((Item)clonedItem).isScrap = false; return clonedItem; } public static void CopyFields(Item source, Item destination) { FieldInfo[] fields = typeof(Item).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(destination, fieldInfo.GetValue(source)); } } private static TerminalNode CreateInfoNode(string name, string description) { if (infoNodes.ContainsKey(name)) { return infoNodes[name]; } TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); Object.DontDestroyOnLoad((Object)(object)val); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } private static void CloneShotgun() { if (!((Object)(object)Shotgun == (Object)null) && !((Object)(object)ShotgunClone != (Object)null)) { ShotgunClone = CloneNonScrap(Shotgun, ShotgunPrice); AddToShop(); } } private static void AddToShop() { ClonedItem shotgunClone = ShotgunClone; int shotgunPrice = ShotgunPrice; Items.RegisterShopItem((Item)(object)shotgunClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("Shotgun", "Nutcracker's Shotgun. Can hold 2 shells. Recommended to keep safety on while not using or it might shoot randomly."), shotgunPrice); LoggerInstance.LogInfo((object)$"Shotgun added to Shop for {ShotgunPrice} credits"); } private static void UpdateShopItemPrice() { ((Item)ShotgunClone).creditsWorth = ShotgunPrice; Items.UpdateShopItemPrice((Item)(object)ShotgunClone, ShotgunPrice); LoggerInstance.LogInfo((object)$"Shotgun price updated to {ShotgunPrice} credits"); } public static void WriteData(FastBufferWriter writer) { ((FastBufferWriter)(ref writer)).WriteByte(CurrentVersionByte); ((FastBufferWriter)(ref writer)).WriteBytes(BitConverter.GetBytes(ShotgunPriceLocal), -1, 0); } public static void ReadData(FastBufferReader reader) { byte b = default(byte); ((FastBufferReader)(ref reader)).ReadByte(ref b); if (b == CurrentVersionByte) { byte[] value = new byte[4]; ((FastBufferReader)(ref reader)).ReadBytes(ref value, 4, 0); ShotgunPriceRemote = BitConverter.ToInt32(value, 0); UpdateShopItemPrice(); LoggerInstance.LogInfo((object)"Host config set successfully"); return; } throw new Exception("Invalid version byte"); } public static void OnRequestSync(ulong clientID, FastBufferReader reader) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { return; } LoggerInstance.LogInfo((object)("Sending config to client " + clientID)); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(5, (Allocator)2, 5); try { WriteData(val); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("BuyableShotgun_OnReceiveConfigSync", clientID, val, (NetworkDelivery)2); } catch (Exception arg) { LoggerInstance.LogError((object)$"Failed to send config: {arg}"); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong clientID, FastBufferReader reader) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) LoggerInstance.LogInfo((object)"Received config from host"); try { ReadData(reader); } catch (Exception arg) { LoggerInstance.LogError((object)$"Failed to receive config: {arg}"); ShotgunPriceRemote = -1; } } } }
mrgrm7.LethalCasino.dll
Decompiled 2 weeks 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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCasino.Config; using LethalCasino.Custom; using LethalCasino.Patches; using LethalCasino.Types; using LethalCasino.patches; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using mrgrm7.LethalCasino.NetcodePatcher; [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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("mrgrm7.LethalCasino")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("The Company is investing in a new vertical")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2+dc48dae2810e2ae1a0bec0d4f68b9631bd4fc928")] [assembly: AssemblyProduct("LethalCasino")] [assembly: AssemblyTitle("mrgrm7.LethalCasino")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public struct NetworkStringIntDictionary : INetworkSerializable { public Dictionary<string, int> Dictionary; public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (Dictionary == null && !serializer.IsReader) { Dictionary = new Dictionary<string, int>(); } int num = ((!serializer.IsReader) ? Dictionary.Count : 0); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref num, default(ForPrimitives)); if (serializer.IsReader) { Dictionary = new Dictionary<string, int>(num); } for (int i = 0; i < num; i++) { string key = string.Empty; int value = 0; if (!serializer.IsReader) { key = Dictionary.Keys.ElementAt(i); value = Dictionary[key]; } serializer.SerializeValue(ref key, false); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref value, default(ForPrimitives)); if (serializer.IsReader) { Dictionary[key] = value; } } } } public struct NetworkStringBoolDictionary : INetworkSerializable { public Dictionary<string, bool> Dictionary; public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (Dictionary == null && !serializer.IsReader) { Dictionary = new Dictionary<string, bool>(); } int num = ((!serializer.IsReader) ? Dictionary.Count : 0); ((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref num, default(ForPrimitives)); if (serializer.IsReader) { Dictionary = new Dictionary<string, bool>(num); } for (int i = 0; i < num; i++) { string key = string.Empty; bool value = false; if (!serializer.IsReader) { key = Dictionary.Keys.ElementAt(i); value = Dictionary[key]; } serializer.SerializeValue(ref key, false); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref value, default(ForPrimitives)); if (serializer.IsReader) { Dictionary[key] = value; } } } } namespace LethalCasino { [BepInPlugin("mrgrm7.LethalCasino", "LethalCasino", "1.1.2")] public class Plugin : BaseUnityPlugin { private static Harmony harmony; public static ManualLogSource logger; public static Dictionary<string, GameObject> Prefabs; public static Dictionary<string, AudioClip> Sounds; public static Dictionary<string, Material> Materials; public static int numSongs = 10; public static LethalCasinoConfig configFile; public static Plugin Instance { get; private set; } private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Instance = this; harmony = new Harmony("mrgrm7.LethalCasino"); NetcodeWeaver(); logger = Logger.CreateLogSource("mrgrm7.LethalCasino"); configFile = new LethalCasinoConfig(((BaseUnityPlugin)this).Config); LoadAllAssets(); Patch(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"mrgrm7.LethalCasino v1.1.2 has loaded!"); } private void LoadAllAssets() { //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown Prefabs = new Dictionary<string, GameObject>(); Sounds = new Dictionary<string, AudioClip>(); Materials = new Dictionary<string, Material>(); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "lethalcasinoassets")); if (!Object.op_Implicit((Object)(object)val)) { logger.LogError((object)"Failed to load asset bundle"); return; } logger.LogInfo((object)"Asset bundle loaded successfully"); Prefabs.Add("CasinoBuilding", LoadAsset<GameObject>(val, "CasinoBuilding")); Prefabs["CasinoBuilding"].AddComponent<CasinoBuilding>(); Prefabs.Add("SlotMachine", LoadAsset<GameObject>(val, "SlotMachine")); Prefabs["SlotMachine"].AddComponent<SlotMachine>(); Prefabs["SlotMachine"].AddComponent<InteractableCasinoComponent>(); Prefabs.Add("Roulette", LoadAsset<GameObject>(val, "Roulette")); Prefabs["Roulette"].AddComponent<Roulette>(); ((Component)Prefabs["Roulette"].transform.Find("Wheel")).gameObject.AddComponent<InteractableCasinoComponent>(); foreach (Transform item in Prefabs["Roulette"].transform.Find("BetContainer")) { Transform val2 = item; ((Component)val2).gameObject.AddComponent<InteractableCasinoComponent>(); } Prefabs.Add("Coin1", LoadAsset<GameObject>(val, "Coin1")); Prefabs.Add("Coin10", LoadAsset<GameObject>(val, "Coin10")); Prefabs.Add("Coin50", LoadAsset<GameObject>(val, "Coin50")); Prefabs.Add("Coin100", LoadAsset<GameObject>(val, "Coin100")); Prefabs.Add("Blackjack", LoadAsset<GameObject>(val, "Blackjack")); Prefabs["Blackjack"].AddComponent<Blackjack>(); Prefabs.Add("BlackjackBetControls", LoadAsset<GameObject>(val, "BlackjackBetControls")); foreach (Transform item2 in Prefabs["Blackjack"].transform) { Transform val3 = item2; if (((Object)((Component)val3).gameObject).name.StartsWith("Player") || ((Object)((Component)val3).gameObject).name.StartsWith("DealerHand")) { ((Component)val3).gameObject.AddComponent<InteractableCasinoComponent>(); } } Prefabs.Add("Card", LoadAsset<GameObject>(val, "Card")); string[] pLAYING_CARD_SUITS = Constants.PLAYING_CARD_SUITS; foreach (string text in pLAYING_CARD_SUITS) { string[] pLAYING_CARD_VALUES = Constants.PLAYING_CARD_VALUES; foreach (string text2 in pLAYING_CARD_VALUES) { string text3 = text2.ToLower() + "_" + text.ToLower(); Materials.Add(text3, LoadAsset<Material>(val, text3)); } } Sounds.Add("ShuffleDeck", LoadAsset<AudioClip>(val, "ShuffleDeck")); for (int k = 0; k < Constants.ASSETS_NUM_CARD_DEAL_SOUNDS; k++) { string text4 = $"CardDeal{k + 1}"; Sounds.Add(text4, LoadAsset<AudioClip>(val, text4)); } for (int l = 0; l < Constants.ASSETS_NUM_CARD_FLIP_SOUNDS; l++) { string text5 = $"CardFlip{l + 1}"; Sounds.Add(text5, LoadAsset<AudioClip>(val, text5)); } for (int m = 0; m < Constants.ASSETS_NUM_BLACKJACK_WIN_SOUNDS; m++) { string text6 = $"BlackjackWin{m + 1}"; Sounds.Add(text6, LoadAsset<AudioClip>(val, text6)); } Sounds.Add("BlackjackDealerWins", LoadAsset<AudioClip>(val, "BlackjackDealerWins")); Sounds.Add("BlackjackButtonHard", LoadAsset<AudioClip>(val, "BlackjackButtonHard")); Sounds.Add("BlackjackButtonSoft", LoadAsset<AudioClip>(val, "BlackjackButtonSoft")); Prefabs.Add("Jukebox", LoadAsset<GameObject>(val, "Jukebox")); Prefabs.Add("ATM", LoadAsset<GameObject>(val, "ATM")); Prefabs["ATM"].AddComponent<AtmMachine>(); Prefabs["ATM"].AddComponent<InteractableCasinoComponent>(); ((Component)Prefabs["ATM"].transform.Find("Buy10")).gameObject.AddComponent<InteractableCasinoComponent>(); ((Component)Prefabs["ATM"].transform.Find("Buy50")).gameObject.AddComponent<InteractableCasinoComponent>(); ((Component)Prefabs["ATM"].transform.Find("Buy100")).gameObject.AddComponent<InteractableCasinoComponent>(); Prefabs.Add("TheWheel", LoadAsset<GameObject>(val, "TheWheel")); Prefabs["TheWheel"].AddComponent<TheWheel>(); ((Component)Prefabs["TheWheel"].transform.Find("WheelPivot/Wheel")).gameObject.AddComponent<InteractableCasinoComponent>(); Prefabs.Add("ChipBag", LoadAsset<GameObject>(val, "ChipBag")); Prefabs.Add("PoofParticle", LoadAsset<GameObject>(val, "PoofParticle")); Prefabs.Add("SmokingPipe", LoadAsset<GameObject>(val, "SmokingPipe")); Prefabs.Add("Beer", LoadAsset<GameObject>(val, "Beer")); string[] array = Constants.BEER_POUR_SOUNDS.Concat(Constants.BEER_DRINK_SOUNDS).Concat(Constants.BEER_GULP_SOUNDS).Concat(Constants.GLASS_CLINK_SOUNDS) .ToArray(); string[] array2 = array; foreach (string text7 in array2) { Sounds.Add(text7, LoadAsset<AudioClip>(val, text7)); } Sounds.Add("PullLever", LoadAsset<AudioClip>(val, "PullLever")); Sounds.Add("ReelClick", LoadAsset<AudioClip>(val, "ReelClick")); Sounds.Add("SlotsPlaying1", LoadAsset<AudioClip>(val, "SlotsPlaying1")); Sounds.Add("SlotsPlaying2", LoadAsset<AudioClip>(val, "SlotsPlaying2")); Sounds.Add("SlotsPlaying3", LoadAsset<AudioClip>(val, "SlotsPlaying3")); Sounds.Add("SlotsDing", LoadAsset<AudioClip>(val, "SlotsDing")); Sounds.Add("CoinDispense", LoadAsset<AudioClip>(val, "CoinDispense")); Sounds.Add("SlotsBigJackpot", LoadAsset<AudioClip>(val, "SlotsBigJackpot")); Sounds.Add("SlotsMediumJackpot", LoadAsset<AudioClip>(val, "SlotsMediumJackpot")); Sounds.Add("SlotsSmallJackpot", LoadAsset<AudioClip>(val, "SlotsSmallJackpot")); Sounds.Add("SlotsBuzzer1", LoadAsset<AudioClip>(val, "SlotsBuzzer1")); Sounds.Add("SlotsBuzzer2", LoadAsset<AudioClip>(val, "SlotsBuzzer2")); Sounds.Add("SlotsLose", LoadAsset<AudioClip>(val, "SlotsLose")); Sounds.Add("ButtonPush", LoadAsset<AudioClip>(val, "ButtonPush")); Sounds.Add("RouletteBallRoll", LoadAsset<AudioClip>(val, "RouletteBallRoll")); Sounds.Add("Chips1", LoadAsset<AudioClip>(val, "Chips1")); Sounds.Add("Chips2", LoadAsset<AudioClip>(val, "Chips2")); Sounds.Add("Chips3", LoadAsset<AudioClip>(val, "Chips3")); Sounds.Add("Chips4", LoadAsset<AudioClip>(val, "Chips4")); Sounds.Add("PlaceMultipleChips", LoadAsset<AudioClip>(val, "PlaceMultipleChips")); Sounds.Add("ChipBagDrop1", LoadAsset<AudioClip>(val, "ChipBagDrop1")); Sounds.Add("ChipBagDrop2", LoadAsset<AudioClip>(val, "ChipBagDrop2")); Sounds.Add("ATMClick", LoadAsset<AudioClip>(val, "ATMClick")); Sounds.Add("PopSound", LoadAsset<AudioClip>(val, "PopSound")); Sounds.Add("ChaChing", LoadAsset<AudioClip>(val, "ChaCHing")); Sounds.Add("WheelClick1", LoadAsset<AudioClip>(val, "WheelClick1")); Sounds.Add("WheelClick2", LoadAsset<AudioClip>(val, "WheelClick2")); Sounds.Add("WheelClick3", LoadAsset<AudioClip>(val, "WheelClick3")); Sounds.Add("WheelClick4", LoadAsset<AudioClip>(val, "WheelClick4")); Sounds.Add("WheelClick5", LoadAsset<AudioClip>(val, "WheelClick5")); Sounds.Add("WheelClick6", LoadAsset<AudioClip>(val, "WheelClick6")); Sounds.Add("WheelClick7", LoadAsset<AudioClip>(val, "WheelClick7")); Sounds.Add("WheelClick8", LoadAsset<AudioClip>(val, "WheelClick8")); Sounds.Add("WheelClick9", LoadAsset<AudioClip>(val, "WheelClick9")); Sounds.Add("WheelClick10", LoadAsset<AudioClip>(val, "WheelClick10")); Sounds.Add("WheelLoseBig", LoadAsset<AudioClip>(val, "WheelLoseBig")); Sounds.Add("WheelLoseSmall", LoadAsset<AudioClip>(val, "WheelLoseSmall")); Sounds.Add("WheelTokenDrop", LoadAsset<AudioClip>(val, "WheelTokenDrop")); Sounds.Add("WheelWinMedium", LoadAsset<AudioClip>(val, "WheelWinMedium")); Sounds.Add("WheelWinLarge", LoadAsset<AudioClip>(val, "WheelWinLarge")); Sounds.Add("PipeLighter", LoadAsset<AudioClip>(val, "PipeLighter")); Sounds.Add("PipeBurn1", LoadAsset<AudioClip>(val, "PipeBurn1")); Sounds.Add("PipeBurn2", LoadAsset<AudioClip>(val, "PipeBurn2")); Sounds.Add("PipeBurn3", LoadAsset<AudioClip>(val, "PipeBurn3")); string[] sONG_TYPES = Constants.SONG_TYPES; foreach (string text8 in sONG_TYPES) { for (int num2 = 1; num2 <= numSongs; num2++) { Sounds.Add($"{text8}Song{num2}", LoadAsset<AudioClip>(val, $"{text8}Song{num2}")); } Sounds.Add(text8 + "Song99", LoadAsset<AudioClip>(val, text8 + "Song99")); } } private T LoadAsset<T>(AssetBundle bundle, string asset) where T : Object { T val = bundle.LoadAsset<T>(asset); if (!Object.op_Implicit((Object)(object)val)) { logger.LogError((object)(asset + " asset failed to load")); } return val; } private void Patch() { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching..."); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogDebug((object)"Finished Patching!"); } private void Unpatch() { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Unpatching..."); harmony.UnpatchSelf(); ((BaseUnityPlugin)this).Logger.LogDebug((object)"Finished Unpatching!"); } private static void NetcodeWeaver() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } [ServerRpc(RequireOwnership = false)] public T GetHostConfigValueServerRpc<T>(string configField) { logger.LogInfo((object)"GetHostConfigValueServerRpc"); if (typeof(T) == typeof(string)) { return (T)(object)configFile.configStrings[configField]; } if (typeof(T) == typeof(float)) { return (T)(object)configFile.configValues[configField]; } if (typeof(T) == typeof(bool)) { return (T)(object)configFile.configFlags[configField]; } if (typeof(T) == typeof(int)) { return (T)(object)configFile.configInts[configField]; } return default(T); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "mrgrm7.LethalCasino"; public const string PLUGIN_NAME = "LethalCasino"; public const string PLUGIN_VERSION = "1.1.2"; } } namespace LethalCasino.Types { internal class RouletteResult { public List<GrabbableObject> winningScrap = new List<GrabbableObject>(); public int lostValue; public int wonValue; } } namespace LethalCasino.patches { [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch : NetworkBehaviour { public static CasinoManager CasinoManager; [HarmonyPatch("Awake")] [HarmonyPostfix] public static void AwakePatch(RoundManager __instance) { Plugin.logger.LogInfo((object)"RoundManagerPatch has awoken"); CasinoManager = ((Component)__instance).gameObject.AddComponent<CasinoManager>(); } [HarmonyPatch("LoadNewLevelWait")] [HarmonyPrefix] public static void LoadNewLevelWaitPatch(RoundManager __instance) { if (__instance.currentLevel.levelID == 3) { Plugin.logger.LogInfo((object)"Spawning casino objects"); CasinoManager.SpawnCasinoServerRpc(); } } [HarmonyPatch("DespawnPropsAtEndOfRound")] [HarmonyPostfix] public static void DespawnPropsAtEndOfRoundPatch(RoundManager __instance) { if (__instance.currentLevel.levelID == 3) { Plugin.logger.LogInfo((object)"Despawning casino objects"); if (((NetworkBehaviour)CasinoManager).IsServer) { CasinoManager.DespawnCasinoServerRpc(); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RoundManagerPatch"; } } } namespace LethalCasino.Patches { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(GameNetworkManager __instance) { Plugin.logger.LogInfo((object)"Adding slot machine to network prefab"); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["CasinoBuilding"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["SlotMachine"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Roulette"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Blackjack"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["TheWheel"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Jukebox"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["ATM"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["ChipBag"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["SmokingPipe"]); NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Beer"]); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void StartDisconnectPatch() { Plugin.logger.LogInfo((object)"Player disconnected."); RoundManagerPatch.CasinoManager.Destroy(); } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch : NetworkBehaviour { [HarmonyPatch("Start")] [HarmonyPrefix] public static void Start(GrabbableObject __instance) { CustomScrapController customScrapController = default(CustomScrapController); if (!((Component)__instance).gameObject.TryGetComponent<CustomScrapController>(ref customScrapController)) { ((Component)__instance).gameObject.AddComponent<CustomScrapController>(); } } [HarmonyPatch("SetScrapValue")] [HarmonyPostfix] public static void SetScrapValue(GrabbableObject __instance) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) CustomScrapController customScrapController = default(CustomScrapController); if (((Component)__instance).gameObject.TryGetComponent<CustomScrapController>(ref customScrapController) && __instance.scrapValue <= 0 && customScrapController.destroyOnZeroValue && !customScrapController.tempDisablePoofOnZero) { if (__instance.isHeld || __instance.isPocketed) { Plugin.logger.LogInfo((object)"Object is held or pocketed"); RoundManagerPatch.CasinoManager.DespawnCasinoItemServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), needsNetworkDespawn: false); } else { Plugin.logger.LogInfo((object)"Destroying object on ground"); CreatePoofParticle(((Component)__instance).transform, default(Vector3), 0.7f); RoundManagerPatch.CasinoManager.DespawnCasinoItemServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), needsNetworkDespawn: true); } } } public static void CreatePoofParticle(Transform transform, Vector3 offset, float volume) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(Plugin.Prefabs["PoofParticle"], transform.position + offset, transform.rotation); val.AddComponent<PoofParticle>(); val.GetComponent<AudioSource>().PlayOneShot(Plugin.Sounds["PopSound"], volume); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GrabbableObjectPatch"; } } [HarmonyPatch(typeof(MenuManager))] internal class MenuManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPatch(MenuManager __instance) { CheckModConflicts(__instance); } private static void CheckModConflicts(MenuManager menuManager) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { BepInPlugin metadata = pluginInfo.Value.Metadata; if (metadata.GUID.Equals("LC_API")) { menuManager.DisplayMenuNotification("LC_API IS BROKEN. UNINSTALL IT.", "Ignore"); } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { internal static Dictionary<PlayerControllerB, CustomPlayerController> customPlayers = new Dictionary<PlayerControllerB, CustomPlayerController>(); private const float minDrunknessToAffectVoice = 0.3f; private const float timeToLoseDrunkness = 300f; [HarmonyPatch("Awake")] [HarmonyPrefix] public static void Awake(PlayerControllerB __instance) { CustomPlayerController value = ((Component)__instance).gameObject.AddComponent<CustomPlayerController>(); customPlayers.Add(__instance, value); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void AfterUpdate(PlayerControllerB __instance) { ProcessDrunkness(__instance); } private static void ProcessDrunkness(PlayerControllerB player) { CustomPlayerController customPlayerController = customPlayers[player]; if (customPlayerController.beerDrunkness > 0.3f) { float num = 1f - (customPlayerController.beerDrunkness - 0.3f) * 0.4f; Plugin.logger.LogInfo((object)$"setting player pitchTarget from {SoundManager.Instance.playerVoicePitchTargets[player.playerClientId]} to {num}"); SoundManager.Instance.playerVoicePitchTargets[player.playerClientId] = num; } if (customPlayerController.beerDrunkness > 0f) { player.drunkness = Mathf.Pow(customPlayerController.beerDrunkness, 2f); customPlayerController.beerDrunkness -= Time.deltaTime / 300f; if (customPlayerController.beerDrunkness < 0f) { customPlayerController.beerDrunkness = 0f; } } } [HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")] [HarmonyPostfix] private static void ShowScrapValueHoverTip(PlayerControllerB __instance) { InteractableCasinoComponent interactableCasinoComponent = default(InteractableCasinoComponent); if (!Object.op_Implicit((Object)(object)__instance.hoveringOverTrigger) || !Object.op_Implicit((Object)(object)((Component)__instance.hoveringOverTrigger).gameObject) || !((Component)__instance.hoveringOverTrigger).gameObject.TryGetComponent<InteractableCasinoComponent>(ref interactableCasinoComponent)) { return; } GrabbableObject val = __instance.ItemSlots[__instance.currentItemSlot]; if (interactableCasinoComponent.hoverTipCurrentBlackjackHand) { string text = "Hand"; if (interactableCasinoComponent.hoverTipIsBlackjackDealer) { text = "Dealer hand"; } ((TMP_Text)__instance.cursorTip).text = text + ": " + interactableCasinoComponent.currentBlackjackHand; } else if (Object.op_Implicit((Object)(object)val) && interactableCasinoComponent.hoverTipCurrentScrapValue && !((TMP_Text)__instance.cursorTip).text.Contains("Holding ■") && !interactableCasinoComponent.hoverTipIsBlackjackDealer) { TextMeshProUGUI cursorTip = __instance.cursorTip; ((TMP_Text)cursorTip).text = ((TMP_Text)cursorTip).text + "\nHolding ■" + val.scrapValue; } else if (interactableCasinoComponent.requireScrap && !Object.op_Implicit((Object)(object)val) && !interactableCasinoComponent.gameInProgress) { ((TMP_Text)__instance.cursorTip).text = interactableCasinoComponent.requireScrapMessage; } } } } namespace LethalCasino.Custom { internal class BarMenu : NetworkBehaviour { public Material signWithoutPricesMat; private void OnEnable() { if (SomeBarPricesAreChanged()) { MeshRenderer component = ((Component)((Component)this).transform.Find("Sign")).GetComponent<MeshRenderer>(); ((Renderer)component).material = signWithoutPricesMat; } } private bool SomeBarPricesAreChanged() { return Plugin.configFile.hostConfigInts[Constants.PRICE_LIGHT_BEER] != Constants.DEFAULT_PRICE_LIGHT_BEER || Plugin.configFile.hostConfigInts[Constants.PRICE_SPECIALTY_BEER] != Constants.DEFAULT_PRICE_SPECIALTY_BEER || Plugin.configFile.hostConfigInts[Constants.PRICE_LUCKY_PIPE] != Constants.DEFAULT_PRICE_LUCKY_PIPE; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BarMenu"; } } internal class BeerMugSpawner : NetworkBehaviour { private const int maxPreppedGlasses = 4; private const float spawnNewMugDelay = 60f; private const float preppedGlassFrontOffset = 0.2f; private const float preppedGlassSideOffset = 0.3f; private Vector3 beerMugSpawnRotation = new Vector3(0f, 0f, 0f); private float timeSinceMissingMugs = 0f; private List<CasinoBeer> preppedGlasses = new List<CasinoBeer>(); private void Start() { SpawnPreppedGlasses(showPoofs: false); } private void LateUpdate() { if (((NetworkBehaviour)this).IsServer && GetNumPreppedGlasses() < 4 && ((NetworkBehaviour)this).IsServer) { timeSinceMissingMugs += Time.deltaTime; if (timeSinceMissingMugs > 60f) { SpawnPreppedGlasses(showPoofs: true); timeSinceMissingMugs = 0f; } } } public CasinoBeer GetNextCasinoBeer() { CasinoBeer result = preppedGlasses[preppedGlasses.Count - 1]; preppedGlasses.RemoveAt(preppedGlasses.Count - 1); if (GetNumPreppedGlasses() == 1) { timeSinceMissingMugs = 59f; } else if (GetNumPreppedGlasses() == 0) { SpawnPreppedGlasses(showPoofs: true); } return result; } private int GetNumPreppedGlasses() { return preppedGlasses.Count; } private void SpawnPreppedGlasses(bool showPoofs) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"spawnning new beer glasses"); if (!((NetworkBehaviour)this).IsServer) { return; } Vector3 val = default(Vector3); while (GetNumPreppedGlasses() < 4) { int num = 4 - GetNumPreppedGlasses() - 1; int num2 = num % 2; int num3 = num / 2; ((Vector3)(ref val))..ctor(0.3f * (float)num3 - 0.3f, 0f, 0.2f * (float)num2 - 0.2f); GameObject val2 = CasinoManager.Spawn("Beer", ((Component)this).transform.position + val, Quaternion.Euler(beerMugSpawnRotation)); preppedGlasses.Add(val2.GetComponent<CasinoBeer>()); if (showPoofs) { CreatePoofParticleClientRpc(val2.transform.position, new Vector3(0f, 0.4f, 0f), 0.1f); } } } [ClientRpc] public void CreatePoofParticleClientRpc(Vector3 position, Vector3 offset, float volume) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3909558591u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref offset); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3909558591u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GameObject val3 = Object.Instantiate<GameObject>(Plugin.Prefabs["PoofParticle"], position + offset, Quaternion.Euler(0f, 0f, 0f)); val3.AddComponent<PoofParticle>(); val3.GetComponent<AudioSource>().PlayOneShot(Plugin.Sounds["PopSound"], volume); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BeerMugSpawner() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3909558591u, new RpcReceiveHandler(__rpc_handler_3909558591)); } private static void __rpc_handler_3909558591(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Vector3 offset = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref offset); float volume = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((BeerMugSpawner)(object)target).CreatePoofParticleClientRpc(position, offset, volume); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BeerMugSpawner"; } } internal class BeerTap : NetworkBehaviour { public int beerCost = 20; public bool isHeavyBeer = false; public string beerName; public Material beerLiquidMaterial; private const float moveToTargetTime = 1.3f; private const float delayBeforeMoveToTarget = 0.4f; private bool isBeingUsed = false; private CasinoBeer currentPouringBeer; private Vector3 currentBeerTarget; private bool movingToBeerTarget = false; private bool playedPickupSound = false; private bool beerIsAtTarget = false; private bool playerHasGrabbedBeer = false; private bool isDonePouring = false; private float timeMovingToBeerTarget = 0f; private Transform parentTapContainer; private AudioSource beerAudioSource; private BeerMugSpawner beerMugSpawner; private InteractTrigger interactTrigger; private void Start() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown parentTapContainer = ((Component)this).transform.parent.parent; beerMugSpawner = ((Component)parentTapContainer.Find("BeerMugSpawner")).GetComponent<BeerMugSpawner>(); interactTrigger = ((Component)this).GetComponent<InteractTrigger>(); InteractEvent val = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)val).AddListener((UnityAction<PlayerControllerB>)BuyBeer); interactTrigger.onInteract = val; SyncHostConfigs(); } private void SyncHostConfigs() { if (isHeavyBeer) { beerCost = Plugin.configFile.hostConfigInts[Constants.PRICE_SPECIALTY_BEER]; } else { beerCost = Plugin.configFile.hostConfigInts[Constants.PRICE_LIGHT_BEER]; } interactTrigger.hoverTip = $"Buy {beerName} (■{beerCost}) : [E]"; } private void LateUpdate() { //IL_00c3: 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_00cf: Unknown result type (might be due to invalid IL or missing references) if ((!movingToBeerTarget && !beerIsAtTarget) || playerHasGrabbedBeer) { return; } timeMovingToBeerTarget += Time.deltaTime; if (timeMovingToBeerTarget >= 0.4f) { if (!playedPickupSound) { beerAudioSource.PlayOneShot(Plugin.Sounds[Constants.GLASS_CLINK_SOUNDS[0]], 0.9f); playedPickupSound = true; } float num = timeMovingToBeerTarget - 0.4f; float num2 = Mathf.Clamp(num / 1.3f, 0f, 1f); ((Component)currentPouringBeer).transform.position = Vector3.Lerp(((Component)currentPouringBeer).transform.position, currentBeerTarget, num2); if (num2 == 1f && !beerIsAtTarget) { beerAudioSource.PlayOneShot(Plugin.Sounds[Constants.GLASS_CLINK_SOUNDS[1]], 1f); TriggerTapFillAnimation(); movingToBeerTarget = false; beerIsAtTarget = true; } } } [ClientRpc] public void ShowWarningMessageClientRpc(NetworkBehaviourReference playerRef, string header, string body, bool isWarning) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2696953337u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); bool flag = header != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(header, false); } bool flag2 = body != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(body, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isWarning, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2696953337u, val, (RpcDelivery)0); } PlayerControllerB val3 = default(PlayerControllerB); if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null) && !((Object)(object)val3 != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { HUDManager.Instance.DisplayTip(header, body, isWarning, false, "LC_Tip1"); } } private void BuyBeer(PlayerControllerB playerController) { //IL_0035: 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_00cf: 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) if (isBeingUsed) { if (isDonePouring) { ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), "Cannot use tap", "Pick up the previous beer first", isWarning: false); } else { ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), "Cannot use tap", "Another beer is already being poured", isWarning: false); } return; } GrabbableObject val = playerController.ItemSlots[playerController.currentItemSlot]; if (!((Object)(object)val == (Object)null)) { if (val.scrapValue < beerCost) { ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), "Cannot afford", $"A pint of {beerName} costs ■{beerCost}. Your scrap is only worth ■{val.scrapValue}.", isWarning: true); return; } Plugin.logger.LogInfo((object)"triggered BuyBeer from this client"); BuyBeerServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController)); } } [ServerRpc(RequireOwnership = false)] private void BuyBeerServerRpc(NetworkBehaviourReference playerControllerRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(960726601u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerControllerRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 960726601u, val, (RpcDelivery)0); } PlayerControllerB val3 = default(PlayerControllerB); if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || isBeingUsed || !((NetworkBehaviourReference)(ref playerControllerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null)) { return; } GrabbableObject val4 = val3.ItemSlots[val3.currentItemSlot]; if (!((Object)(object)val4 == (Object)null)) { if (((Component)val4).GetComponent<CustomScrapController>().lockFromGambling) { ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val3), "Cannot buy beer", "Scrap is being gambled", isWarning: true); } else if (val4.scrapValue >= beerCost) { isBeingUsed = true; CasinoBeer nextCasinoBeer = beerMugSpawner.GetNextCasinoBeer(); BuyBeerClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)nextCasinoBeer), NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val4)); } } } [ClientRpc] private void BuyBeerClientRpc(NetworkBehaviourReference beerRef, NetworkBehaviourReference scrapRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1862352400u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref beerRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref scrapRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1862352400u, val, (RpcDelivery)0); } CasinoBeer casinoBeer = default(CasinoBeer); GrabbableObject val3 = default(GrabbableObject); if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviourReference)(ref beerRef)).TryGet<CasinoBeer>(ref casinoBeer, (NetworkManager)null) && ((NetworkBehaviourReference)(ref scrapRef)).TryGet<GrabbableObject>(ref val3, (NetworkManager)null)) { isBeingUsed = true; currentPouringBeer = casinoBeer; movingToBeerTarget = true; beerIsAtTarget = false; playerHasGrabbedBeer = false; timeMovingToBeerTarget = 0f; playedPickupSound = false; isDonePouring = false; val3.SetScrapValue(val3.scrapValue - beerCost); CasinoBeer component = ((Component)casinoBeer).GetComponent<CasinoBeer>(); beerAudioSource = ((Component)((Component)currentPouringBeer).transform.Find("BeerMug")).GetComponent<AudioSource>(); component.SetBeerType(beerLiquidMaterial, isHeavyBeer); component.TriggerBeerFill(OnDoneFillingBeer, OnGrabBeerServerRpc); currentBeerTarget = ((Component)((Component)this).transform.Find("MugTarget")).transform.position; } } } private void setStreamEmission(bool setActive) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) ParticleSystem component = ((Component)((Component)this).transform.Find("Particles")).GetComponent<ParticleSystem>(); EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).enabled = setActive; } private void TriggerTapFillAnimation() { currentPouringBeer.StartFill(); setStreamEmission(setActive: true); Random random = new Random(); string key = Constants.BEER_POUR_SOUNDS[random.Next(1, Constants.BEER_POUR_SOUNDS.Length)]; beerAudioSource.PlayOneShot(Plugin.Sounds[key], 0.5f); } private void OnDoneFillingBeer() { isDonePouring = true; setStreamEmission(setActive: false); } [ServerRpc(RequireOwnership = false)] private void OnGrabBeerServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(274521252u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 274521252u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { OnGrabBeerClientRpc(); } } } [ClientRpc] private void OnGrabBeerClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3946222049u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3946222049u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { beerIsAtTarget = false; isBeingUsed = false; playerHasGrabbedBeer = true; } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_BeerTap() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2696953337u, new RpcReceiveHandler(__rpc_handler_2696953337)); NetworkManager.__rpc_func_table.Add(960726601u, new RpcReceiveHandler(__rpc_handler_960726601)); NetworkManager.__rpc_func_table.Add(1862352400u, new RpcReceiveHandler(__rpc_handler_1862352400)); NetworkManager.__rpc_func_table.Add(274521252u, new RpcReceiveHandler(__rpc_handler_274521252)); NetworkManager.__rpc_func_table.Add(3946222049u, new RpcReceiveHandler(__rpc_handler_3946222049)); } private static void __rpc_handler_2696953337(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00f5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference playerRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string header = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref header, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string body = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref body, false); } bool isWarning = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isWarning, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((BeerTap)(object)target).ShowWarningMessageClientRpc(playerRef, header, body, isWarning); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_960726601(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference playerControllerRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerControllerRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((BeerTap)(object)target).BuyBeerServerRpc(playerControllerRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1862352400(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference beerRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref beerRef, default(ForNetworkSerializable)); NetworkBehaviourReference scrapRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref scrapRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((BeerTap)(object)target).BuyBeerClientRpc(beerRef, scrapRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_274521252(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((BeerTap)(object)target).OnGrabBeerServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3946222049(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((BeerTap)(object)target).OnGrabBeerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BeerTap"; } } internal class CasinoBeer : PhysicsProp { private const float drinkSoundInterval = 0.2f; private const float gulpSoundInterval = 5f; private const float gulpChance = 0.2f; private Vector3 groundPosition; private Quaternion groundRotation; private Vector3 restingPositionOffset = new Vector3(-0.05f, 0.12f, 0.2f); private Vector3 restingRotationOffset = new Vector3(330f, 90f, 340f); private Quaternion restingRotation; private Vector3 activePositionOffset = new Vector3(0.06f, 0.18f, -0.18f); private Vector3 activeRotationOffset = new Vector3(310f, 220f, 340f); private Quaternion activeRotation; private Vector3 positionVelocity; private const float rotationSpeed = 20f; private const float smoothTime = 0.03f; private const float maxDrinkTime = 12f; private float originalLiquidHeight = 0f; private List<int> liquidVerticesTopIndexes; private float[] originalVerticesOffsetH; private float originalBeerLiquidTopVerticeHeight; private float originalBeerLiquidBottomVerticeHeight; private const float liquidRotationWhenActive = -45f; private const float liquidRotationWhenActiveForOtherPlayers = -20f; private const float fizzRate = 10f; private const float verticeMultiplier = 1f; private const float fillDelay = 1f; private const float fillTime = 5f; private bool startMethodComplete = false; private bool isActive; private bool isFlipping; private bool isFilling; private Action? doneFillCallback; private Action? grabItemCallback; private float fillDelayTimer; private float percentFilled = 0f; private float timeUntilDrinkSound = 0f; private float timeUntilGulpSound = 0f; private float percentUsed = 0f; private bool isEquiped; private PlayerControllerB lastPlayerHeldBy; private bool isFlatteningVerticesHorizontal; private bool hasSetBeerType = false; private Material beerLiquidMaterial; private bool isHeavyBeer = false; private float beerSipVolume; private Random randGen; private AudioSource audioSource; private GameObject beerMug; private GameObject beerLiquidContainer; private MeshFilter beerLiquidMeshFilter; private Mesh beerLiquidMesh; private ParticleSystem particleSystem; private Animator mugAnimator; public override void Start() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); randGen = new Random(); audioSource = ((Component)this).GetComponent<AudioSource>(); beerMug = ((Component)((Component)this).transform.Find("BeerMug")).gameObject; beerLiquidContainer = ((Component)((Component)this).transform.Find("BeerMug/LiquidContainer")).gameObject; beerLiquidMeshFilter = ((Component)beerLiquidContainer.transform.Find("BeerLiquid")).GetComponent<MeshFilter>(); beerLiquidMesh = beerLiquidMeshFilter.mesh; originalLiquidHeight = beerLiquidContainer.transform.localScale.y; particleSystem = ((Component)((Component)this).transform.Find("BeerMug/LiquidContainer/BeerParticles")).GetComponent<ParticleSystem>(); mugAnimator = beerMug.GetComponent<Animator>(); groundPosition = beerMug.transform.localPosition; groundRotation = beerMug.transform.localRotation; restingRotation = Quaternion.Euler(restingRotationOffset); activeRotation = Quaternion.Euler(activeRotationOffset); liquidVerticesTopIndexes = new List<int>(); if ((Object)(object)beerLiquidMesh != (Object)null) { Vector3[] vertices = beerLiquidMesh.vertices; originalVerticesOffsetH = new float[vertices.Length]; for (int i = 0; i < vertices.Length; i++) { originalVerticesOffsetH[i] = vertices[i].y; float z = vertices[i].z; Bounds bounds = beerLiquidMesh.bounds; if (Mathf.Approximately(z, ((Bounds)(ref bounds)).max.z)) { originalBeerLiquidTopVerticeHeight = vertices[i].z; liquidVerticesTopIndexes.Add(i); continue; } float z2 = vertices[i].z; bounds = beerLiquidMesh.bounds; if (Mathf.Approximately(z2, ((Bounds)(ref bounds)).min.z)) { originalBeerLiquidBottomVerticeHeight = vertices[i].z; } } } beerLiquidContainer.active = false; ((GrabbableObject)this).grabbable = false; ((GrabbableObject)this).customGrabTooltip = "(Disabled) Use tap handles"; beerSipVolume = Plugin.configFile.configValues[Constants.MISC_BEER_SIPPING_VOLUME] / 100f; startMethodComplete = true; } public override void Update() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00b1: 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_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (((GrabbableObject)this).isPocketed) { return; } if (startMethodComplete && !hasSetBeerType) { UpdateBeerType(); hasSetBeerType = true; } if (isActive) { activeRotation = Quaternion.Euler(activeRotationOffset); beerMug.transform.localPosition = Vector3.SmoothDamp(beerMug.transform.localPosition, activePositionOffset, ref positionVelocity, 0.03f); beerMug.transform.localRotation = Quaternion.Lerp(beerMug.transform.localRotation, activeRotation, 20f * Time.deltaTime); timeUntilDrinkSound -= Time.deltaTime; timeUntilGulpSound -= Time.deltaTime; if (timeUntilDrinkSound <= 0f && !audioSource.isPlaying) { if (timeUntilGulpSound <= 0f && randGen.NextDouble() <= 0.20000000298023224) { int num = randGen.Next(0, Constants.BEER_GULP_SOUNDS.Length); audioSource.PlayOneShot(Plugin.Sounds[Constants.BEER_GULP_SOUNDS[num]], beerSipVolume); } else { int num2 = randGen.Next(0, Constants.BEER_DRINK_SOUNDS.Length); audioSource.PlayOneShot(Plugin.Sounds[Constants.BEER_DRINK_SOUNDS[num2]], beerSipVolume); } timeUntilDrinkSound = 0.2f; timeUntilGulpSound = 5f; } percentUsed += Time.deltaTime / 12f; Vector3 localScale = beerLiquidContainer.transform.localScale; localScale.y = originalLiquidHeight * (1f - percentUsed); beerLiquidContainer.transform.localScale = localScale; EmissionModule emission = particleSystem.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(10f * (1f - percentUsed)); if (isHeavyBeer) { IncreaseDrunknessHeavy(); } else { IncreaseDrunkessLight(); } if (((NetworkBehaviour)this).IsServer && percentUsed >= 1f) { FinishDrinkingClientRpc(); } } else if (isEquiped) { restingRotation = Quaternion.Euler(restingRotationOffset); beerMug.transform.localPosition = Vector3.SmoothDamp(beerMug.transform.localPosition, restingPositionOffset, ref positionVelocity, 0.03f); beerMug.transform.localRotation = Quaternion.Lerp(beerMug.transform.localRotation, restingRotation, 20f * Time.deltaTime); } else if (isFilling) { Vector3 localScale2 = beerLiquidContainer.transform.localScale; localScale2.y = originalLiquidHeight * percentFilled; beerLiquidContainer.transform.localScale = localScale2; if (fillDelayTimer >= 1f) { if (!beerLiquidContainer.active) { beerLiquidContainer.active = true; } percentFilled += Time.deltaTime / 5f; if (percentFilled >= 1f) { DoneFilling(); } } else { fillDelayTimer += Time.deltaTime; } } if (!((Object)(object)beerLiquidMesh != (Object)null)) { return; } Vector3 forward = beerLiquidContainer.transform.forward; Vector3[] vertices = beerLiquidMesh.vertices; foreach (int liquidVerticesTopIndex in liquidVerticesTopIndexes) { float num3 = (float)Math.Pow((double)percentUsed * 1.2, 2.0) * 2.5f; if (isActive) { num3 *= 10f; } float num4 = Vector3.Dot(Vector3.down, forward) * (float)Math.Sin(vertices[liquidVerticesTopIndex].y * (1f + num3)); float num5 = originalBeerLiquidTopVerticeHeight - num4; if (num5 < originalBeerLiquidBottomVerticeHeight) { num5 = originalBeerLiquidBottomVerticeHeight; } vertices[liquidVerticesTopIndex].z = num5; } if (isActive) { for (int i = 0; i < vertices.Length; i++) { float num6 = 0f - (1f - percentUsed); Bounds bounds = beerLiquidMesh.bounds; float num7 = num6 * ((Bounds)(ref bounds)).max.y; if (vertices[i].y < num7) { vertices[i].y = num7; } } if (!isFlatteningVerticesHorizontal) { float num8 = -45f; if ((Object)(object)lastPlayerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController) { num8 = -20f; } beerLiquidContainer.transform.localRotation = Quaternion.Euler(0f, num8, 0f); } isFlatteningVerticesHorizontal = true; } else if (isFlatteningVerticesHorizontal) { for (int j = 0; j < vertices.Length; j++) { vertices[j].y = originalVerticesOffsetH[j]; } beerLiquidContainer.transform.localRotation = Quaternion.Euler(0f, 0f, 0f); isFlatteningVerticesHorizontal = false; } beerLiquidMesh.vertices = vertices; beerLiquidMesh.RecalculateNormals(); beerLiquidMeshFilter.mesh = beerLiquidMesh; } private void IncreaseDrunknessHeavy() { lastPlayerHeldBy.drunknessInertia = Mathf.Clamp(lastPlayerHeldBy.drunknessInertia + Time.deltaTime / 40f * lastPlayerHeldBy.drunknessSpeed, 0.1f, 3f); lastPlayerHeldBy.increasingDrunknessThisFrame = true; CustomPlayerController component = ((Component)lastPlayerHeldBy).GetComponent<CustomPlayerController>(); component.beerDrunkness = Mathf.Clamp(component.beerDrunkness + Time.deltaTime / 50f, 0f, 1f); } private void IncreaseDrunkessLight() { lastPlayerHeldBy.drunknessInertia = Mathf.Clamp(lastPlayerHeldBy.drunknessInertia + Time.deltaTime / 80f * lastPlayerHeldBy.drunknessSpeed, 0.1f, 1f); lastPlayerHeldBy.increasingDrunknessThisFrame = true; CustomPlayerController component = ((Component)lastPlayerHeldBy).GetComponent<CustomPlayerController>(); component.beerDrunkness = Mathf.Clamp(component.beerDrunkness + Time.deltaTime / 120f, 0f, 1f); } public float GetPercentUsed() { return percentUsed; } public void SetBeerType(Material mat, bool isHeavy) { hasSetBeerType = false; beerLiquidMaterial = mat; isHeavyBeer = isHeavy; } private void UpdateBeerType() { MeshRenderer component = ((Component)beerLiquidContainer.transform.Find("BeerLiquid")).GetComponent<MeshRenderer>(); ((Renderer)component).material = beerLiquidMaterial; } public void TriggerBeerFill(Action onDoneFillCallback, Action onGrabItemCallback) { doneFillCallback = onDoneFillCallback; grabItemCallback = onGrabItemCallback; FlipBeer(); } public void FlipBeer() { isFlipping = true; ((GrabbableObject)this).customGrabTooltip = "Pouring..."; beerMug.GetComponent<Animator>().SetTrigger("beerFlip"); } public void StartFill() { isFlipping = false; isFilling = true; percentFilled = 0f; Object.Destroy((Object)(object)mugAnimator); } private void DoneFilling() { percentFilled = 1f; isFilling = false; ((GrabbableObject)this).grabbable = true; doneFillCallback(); doneFillCallback = null; ((GrabbableObject)this).customGrabTooltip = null; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if (isActive) { SetActiveStatus(active: false); } isEquiped = false; particleSystem.Stop(); particleSystem.Clear(); } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); isEquiped = true; particleSystem.Play(); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); if (grabItemCallback != null) { grabItemCallback(); grabItemCallback = null; } GrabItemServerRpc(); } [ServerRpc(RequireOwnership = false)] private void GrabItemServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1003776000u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1003776000u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GrabItemClientRpc(); } } } [ClientRpc] private void GrabItemClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1323330482u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1323330482u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { grabItemCallback = null; lastPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; } } } public override void OnHitGround() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).OnHitGround(); if (isActive) { SetActiveStatus(active: false); } isEquiped = false; particleSystem.Play(); beerMug.transform.SetLocalPositionAndRotation(groundPosition, groundRotation); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); SetActiveStatusServerRpc(buttonDown, NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)this)); } [ServerRpc(RequireOwnership = false)] private void SetActiveStatusServerRpc(bool active, NetworkBehaviourReference pipeRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1614102246u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1614102246u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer) { SetActiveStatusClientRpc(active, pipeRef); SetPlayerVoiceMuffledClientRpc(active); } } } [ClientRpc] private void SetActiveStatusClientRpc(bool active, NetworkBehaviourReference pipeRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3865379800u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3865379800u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { if (percentUsed >= 1f && active) { Plugin.logger.LogDebug((object)"player cannot drink beer, already used up"); } else { SetActiveStatus(active); } } } private void SetActiveStatus(bool active) { isActive = active; lastPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", isActive); if (isActive) { timeUntilDrinkSound = 0.2f; } } [ClientRpc] private void SetPlayerVoiceMuffledClientRpc(bool enableMuffle) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3341308629u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enableMuffle, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3341308629u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } if (enableMuffle) { lastPlayerHeldBy.voiceMuffledByEnemy = true; if ((Object)(object)lastPlayerHeldBy.currentVoiceChatIngameSettings != (Object)null) { OccludeAudio component = ((Component)lastPlayerHeldBy.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>(); component.overridingLowPass = true; component.lowPassOverride = 600f; } } else { lastPlayerHeldBy.voiceMuffledByEnemy = false; if ((Object)(object)lastPlayerHeldBy.currentVoiceChatIngameSettings != (Object)null) { OccludeAudio component2 = ((Component)lastPlayerHeldBy.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>(); component2.overridingLowPass = false; } } } [ClientRpc] private void FinishDrinkingClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4282623143u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4282623143u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetActiveStatus(active: false); beerLiquidContainer.active = false; } } } private void OnCollisionEnter(Collision collision) { CasinoBeer casinoBeer = default(CasinoBeer); if (((Component)collision.transform).TryGetComponent<CasinoBeer>(ref casinoBeer) && isEquiped) { audioSource.PlayOneShot(Plugin.Sounds[Constants.GLASS_CLINK_SOUNDS[2]]); } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_CasinoBeer() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1003776000u, new RpcReceiveHandler(__rpc_handler_1003776000)); NetworkManager.__rpc_func_table.Add(1323330482u, new RpcReceiveHandler(__rpc_handler_1323330482)); NetworkManager.__rpc_func_table.Add(1614102246u, new RpcReceiveHandler(__rpc_handler_1614102246)); NetworkManager.__rpc_func_table.Add(3865379800u, new RpcReceiveHandler(__rpc_handler_3865379800)); NetworkManager.__rpc_func_table.Add(3341308629u, new RpcReceiveHandler(__rpc_handler_3341308629)); NetworkManager.__rpc_func_table.Add(4282623143u, new RpcReceiveHandler(__rpc_handler_4282623143)); } private static void __rpc_handler_1003776000(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((CasinoBeer)(object)target).GrabItemServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1323330482(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((CasinoBeer)(object)target).GrabItemClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1614102246(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool active = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives)); NetworkBehaviourReference pipeRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CasinoBeer)(object)target).SetActiveStatusServerRpc(active, pipeRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3865379800(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool active = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives)); NetworkBehaviourReference pipeRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((CasinoBeer)(object)target).SetActiveStatusClientRpc(active, pipeRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3341308629(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool playerVoiceMuffledClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref playerVoiceMuffledClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((CasinoBeer)(object)target).SetPlayerVoiceMuffledClientRpc(playerVoiceMuffledClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4282623143(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((CasinoBeer)(object)target).FinishDrinkingClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "CasinoBeer"; } } internal class CigarBox : NetworkBehaviour { private int pipeCost = 75; private const float lidOpenRotation = -80f; private const float lidRotationSmoothTime = 0.2f; private Vector3 pipeSpawnOffset = new Vector3(-0.7f, -0.05f, 0f); private Vector3 pipeSpawnArea = new Vector3(0.3f, 0f, 0.2f); private Vector3 pipeSpawnRotation = new Vector3(0f, 20f, 0f); private Quaternion lidClosedRotation; private Quaternion lidOpenRotationQuaternion; private InteractTrigger buyPipeInteractTrigger; private GameObject boxLid; private Camera localPlayerCamera; private int layerMask = 512; private void Awake() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown boxLid = ((Component)((Component)this).transform.Find("Top")).gameObject; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null) { localPlayerCamera = localPlayerController.gameplayCamera; } lidClosedRotation = boxLid.transform.localRotation; lidOpenRotationQuaternion = Quaternion.Euler(-80f, 0f, 0f); buyPipeInteractTrigger = ((Component)this).GetComponent<InteractTrigger>(); InteractEvent val = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)val).AddListener((UnityAction<PlayerControllerB>)BuyPipe); buyPipeInteractTrigger.onInteract = val; } private void Start() { SyncHostConfigs(); } private void SyncHostConfigs() { pipeCost = Plugin.configFile.hostConfigInts[Constants.PRICE_LUCKY_PIPE]; buyPipeInteractTrigger.hoverTip = $"Buy Lucky Pipe (■{pipeCost}) : [E]"; } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)localPlayerCamera).transform.position, ((Component)localPlayerCamera).transform.forward, ref val, 3f, layerMask) && (Object)(object)((RaycastHit)(ref val)).collider != (Object)null && (Object)(object)((Component)((RaycastHit)(ref val)).collider).gameObject == (Object)(object)((Component)this).gameObject) { boxLid.transform.localRotation = Quaternion.Slerp(boxLid.transform.localRotation, lidOpenRota
BepInEx/patchers/BepInExFasterLoadAssetBundles/BepInExFasterLoadAssetBundles.dll
Decompiled 2 weeks agousing System; using System.Buffers.Binary; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using System.Threading.Tasks; using BepInEx.Bootstrap; using BepInEx.Logging; using BepInExFasterLoadAssetBundles.Helpers; using BepInExFasterLoadAssetBundles.Managers; using BepInExFasterLoadAssetBundles.Models; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil; using Newtonsoft.Json; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BepInExFasterLoadAssetBundles")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.6.4.0")] [assembly: AssemblyInformationalVersion("0.6.4+7b48a441d0dfccb001fcd003ab16b3a96d5b5a77")] [assembly: AssemblyProduct("BepInExFasterLoadAssetBundles")] [assembly: AssemblyTitle("BepInExFasterLoadAssetBundles")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.6.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInExFasterLoadAssetBundles { public class BepInExFasterLoadAssetBundlesPatcher { internal static Harmony Harmony { get; } = new Harmony("BepInExFasterLoadAssetBundlesPatcher"); public static IEnumerable<string> TargetDLLs { get; } = Array.Empty<string>(); public static void Finish() { Harmony.PatchAll(typeof(BepInExFasterLoadAssetBundlesPatcher).Assembly); } public static void Patch(AssemblyDefinition _) { } } [HarmonyPatch] internal static class Patcher { internal static ManualLogSource Logger { get; private set; } internal static AssetBundleManager AssetBundleManager { get; private set; } internal static MetadataManager MetadataManager { get; private set; } [HarmonyPatch(typeof(Chainloader), "Initialize")] [HarmonyPostfix] public static void ChainloaderInitialized() { AsyncHelper.InitUnitySynchronizationContext(); Logger = Logger.CreateLogSource("BepInExFasterLoadAssetBundlesPatcher"); string fullName = new DirectoryInfo(Application.dataPath).Parent.FullName; string text = Path.Combine(fullName, "Cache", "AssetBundles"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } AssetBundleManager = new AssetBundleManager(text); MetadataManager = new MetadataManager(Path.Combine(text, "metadata.json")); Patch(); } private static void Patch() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown Type typeFromHandle = typeof(Patcher); Harmony harmony = BepInExFasterLoadAssetBundlesPatcher.Harmony; BindingFlags all = AccessTools.all; HarmonyMethod val = new HarmonyMethod(typeFromHandle.GetMethod("LoadAssetBundleFromFileFast", all)); Type typeFromHandle2 = typeof(AssetBundle); string[] array = new string[2] { "LoadFromFile", "LoadFromFileAsync" }; string[] array2 = array; foreach (string text in array2) { harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle2, text, new Type[1] { typeof(string) }, (Type[])null), val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle2, text, new Type[2] { typeof(string), typeof(uint) }, (Type[])null), val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle2, text, new Type[3] { typeof(string), typeof(uint), typeof(ulong) }, (Type[])null), val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle2, "LoadFromStreamInternal", (Type[])null, (Type[])null), new HarmonyMethod(typeFromHandle.GetMethod("LoadAssetBundleFromStreamFast", all)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle2, "LoadFromStreamAsyncInternal", (Type[])null, (Type[])null), new HarmonyMethod(typeFromHandle.GetMethod("LoadAssetBundleFromStreamAsyncFast", all)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void LoadAssetBundleFromFileFast(ref string path) { if (string.IsNullOrEmpty(path)) { return; } try { using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None, 16777216, FileOptions.SequentialScan); if (HandleStreamBundle(stream, out string path2)) { path = path2; } } catch (Exception arg) { Logger.LogError((object)$"Failed to decompress assetbundle\n{arg}"); } } private static bool LoadAssetBundleFromStreamFast(Stream stream, ref AssetBundle? __result) { if (HandleStreamBundle(stream, out string path)) { __result = AssetBundle.LoadFromFile_Internal(path, 0u, 0uL); return false; } return true; } private static bool LoadAssetBundleFromStreamAsyncFast(Stream stream, ref AssetBundleCreateRequest? __result) { if (HandleStreamBundle(stream, out string path)) { __result = AssetBundle.LoadFromFileAsync_Internal(path, 0u, 0uL); return false; } return true; } private static bool HandleStreamBundle(Stream stream, [NotNullWhen(true)] out string? path) { long position = stream.Position; try { return AssetBundleManager.TryRecompressAssetBundle(stream, out path); } catch (Exception arg) { Logger.LogError((object)$"Failed to decompress assetbundle\n{arg}"); } stream.Position = position; path = null; return false; } } } namespace BepInExFasterLoadAssetBundles.Models { internal class Metadata { public string? UncompressedAssetBundleName { get; set; } public string OriginalAssetBundleHash { get; set; } public bool ShouldNotDecompress { get; set; } public DateTime LastAccessTime { get; set; } } } namespace BepInExFasterLoadAssetBundles.Managers { internal class AssetBundleManager { private readonly struct WorkAsset { public string Path { get; } public string Hash { get; } public bool DeleteBundleAfterOperation { get; } public CompressionType CompressionType { get; } public WorkAsset(string path, string hash, bool deleteBundleAfterOperation, CompressionType compressionType) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Path = path; Hash = hash; DeleteBundleAfterOperation = deleteBundleAfterOperation; CompressionType = compressionType; } } private readonly ConcurrentQueue<WorkAsset> m_WorkAssets = new ConcurrentQueue<WorkAsset>(); private readonly object m_Lock = new object(); private readonly string m_PathForTemp; private bool m_IsProcessingQueue; public string CachePath { get; } public AssetBundleManager(string cachePath) { CachePath = cachePath; if (!Directory.Exists(CachePath)) { Directory.CreateDirectory(CachePath); } m_PathForTemp = Path.Combine(CachePath, "temp"); if (!Directory.Exists(m_PathForTemp)) { Directory.CreateDirectory(m_PathForTemp); } DeleteTempFiles(); } private void DeleteTempFiles() { int count2 = 0; try { foreach (string item in Directory.EnumerateFiles(CachePath, "*.tmp").Concat(Directory.EnumerateFiles(m_PathForTemp, "*.assetbundle"))) { DeleteFileSafely(ref count2, item); } } catch (Exception arg) { Patcher.Logger.LogError((object)$"Failed to delete temp files\n{arg}"); } if (count2 > 0) { Patcher.Logger.LogWarning((object)$"Deleted {count2} temp files"); } static void DeleteFileSafely(ref int count, string tempFile) { if (!FileHelper.TryDeleteFile(tempFile, out Exception exception)) { Patcher.Logger.LogError((object)$"Failed to delete temp file\n{exception}"); } else { count++; } } } public unsafe bool TryRecompressAssetBundle(Stream stream, [NotNullWhen(true)] out string? path) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) if (BundleHelper.CheckBundleIsAlreadyDecompressed(stream)) { Patcher.Logger.LogInfo((object)"Original bundle is already uncompressed, using it instead"); path = null; return false; } Span<char> span = stackalloc char[32]; HashingHelper.WriteHash(span, stream); path = null; if (FindCachedBundleByHash(span, out string path2)) { if (path2 != null) { path = path2; return true; } Patcher.Logger.LogDebug((object)"Found assetbundle metadata, but path was null. Probably bundle is already uncompressed!"); return false; } CompressionType compressionType = (CompressionType)((stream.Length > 314572800) ? 2 : 0); if (stream is FileStream fileStream) { path = string.Copy(fileStream.Name); RecompressAssetBundleInternal(new WorkAsset(path, span.ToString(), deleteBundleAfterOperation: false, compressionType)); return false; } string path3 = Guid.NewGuid().ToString("N") + ".assetbundle"; string path4 = Path.Combine(m_PathForTemp, path3); using (FileStream fileStream2 = new FileStream(path4, FileMode.CreateNew, FileAccess.Write, FileShare.None, 8192, FileOptions.SequentialScan)) { stream.Seek(0L, SeekOrigin.Begin); if (stream is UnmanagedMemoryStream unmanagedMemoryStream && unmanagedMemoryStream.Length < int.MaxValue) { ReadOnlySpan<byte> buffer = new ReadOnlySpan<byte>(unmanagedMemoryStream.PositionPointer, (int)unmanagedMemoryStream.Length); fileStream2.Write(buffer); } else { stream.CopyTo(fileStream2); } } RecompressAssetBundleInternal(new WorkAsset(path4, span.ToString(), deleteBundleAfterOperation: true, compressionType)); return false; } public void DeleteCachedAssetBundle(string path) { FileHelper.TryDeleteFile(path, out Exception exception); if (exception != null) { Patcher.Logger.LogError((object)$"Failed to delete uncompressed assetbundle\n{exception}"); } } private bool FindCachedBundleByHash(ReadOnlySpan<char> hash, out string? path) { path = null; Metadata metadata2 = Patcher.MetadataManager.FindMetadataByHash(hash); if (metadata2 == null) { return false; } if (metadata2.ShouldNotDecompress) { ModifyAccessTimeAndSave(metadata2); return true; } if (metadata2.UncompressedAssetBundleName == null) { return false; } string text = Path.Combine(CachePath, metadata2.UncompressedAssetBundleName); if (!File.Exists(text)) { Patcher.Logger.LogWarning((object)("Failed to find decompressed assetbundle at \"" + text + "\". Probably it was deleted?")); Patcher.MetadataManager.DeleteMetadata(metadata2); return false; } Patcher.Logger.LogDebug((object)("Loading uncompressed bundle \"" + metadata2.UncompressedAssetBundleName + "\"")); path = text; ModifyAccessTimeAndSave(metadata2); return true; static void ModifyAccessTimeAndSave(Metadata metadata) { metadata.LastAccessTime = DateTime.Now; Patcher.MetadataManager.SaveMetadata(metadata); } } private void RecompressAssetBundleInternal(WorkAsset workAsset) { if (!DriveHelper.HasDriveSpaceOnPath(CachePath, 10L)) { Patcher.Logger.LogWarning((object)"Ignoring request of decompressing, because the free drive space is less than 10GB"); return; } Patcher.Logger.LogDebug((object)("Queued recompress of \"" + Path.GetFileName(workAsset.Path) + "\" assetbundle")); m_WorkAssets.Enqueue(workAsset); StartRunner(); } private void StartRunner() { if (m_IsProcessingQueue) { return; } lock (m_Lock) { if (m_IsProcessingQueue) { return; } m_IsProcessingQueue = true; } AsyncHelper.Schedule(ProcessQueue); } private async Task ProcessQueue() { try { WorkAsset result; while (m_WorkAssets.TryDequeue(out result)) { await DecompressAssetBundleAsync(result); } } finally { lock (m_Lock) { if (m_IsProcessingQueue) { m_IsProcessingQueue = false; } } } } private async Task DecompressAssetBundleAsync(WorkAsset workAsset) { Metadata metadata = new Metadata { OriginalAssetBundleHash = workAsset.Hash, LastAccessTime = DateTime.Now }; string originalFileName = Path.GetFileNameWithoutExtension(workAsset.Path); string outputName = originalFileName + "_" + metadata.GetHashCode() + ".assetbundle"; string outputPath = Path.Combine(CachePath, outputName); CompressionType compressionType = workAsset.CompressionType; BuildCompression val = (((int)compressionType != 0) ? BuildCompression.LZ4Runtime : BuildCompression.UncompressedRuntime); BuildCompression buildCompression = val; Patcher.Logger.LogDebug((object)$"Decompressing \"{originalFileName}\" with compression type {workAsset.CompressionType}"); await FileHelper.RetryUntilFileIsClosedAsync(workAsset.Path); await AsyncHelper.SwitchToMainThread(); AssetBundleRecompressOperation op = AssetBundle.RecompressAssetBundleAsync(workAsset.Path, outputPath, buildCompression, 0u, (ThreadPriority)2); await op.WaitCompletionAsync<AssetBundleRecompressOperation>(); AssetBundleLoadResult result = op.result; string humanReadableResult = op.humanReadableResult; bool success = op.success; string newHash = GetHashOfFile(outputPath); await AsyncHelper.SwitchToThreadPool(); if (workAsset.DeleteBundleAfterOperation) { FileHelper.TryDeleteFile(workAsset.Path, out Exception _); } Patcher.Logger.LogDebug((object)$"Result of decompression \"{originalFileName}\": {result} ({success}), {humanReadableResult}"); if ((int)result != 0 || !success) { Patcher.Logger.LogWarning((object)$"Failed to decompress a assetbundle at \"{workAsset.Path}\"\nResult: {result}, {humanReadableResult}"); } else if (newHash.Equals(workAsset.Hash, StringComparison.InvariantCultureIgnoreCase)) { Patcher.Logger.LogDebug((object)("Assetbundle \"" + originalFileName + "\" is already uncompressed, adding to ignore list")); metadata.ShouldNotDecompress = true; Patcher.MetadataManager.SaveMetadata(metadata); DeleteCachedAssetBundle(outputPath); } else { Patcher.Logger.LogDebug((object)("Assetbundle \"" + originalFileName + "\" is now uncompressed!")); metadata.UncompressedAssetBundleName = outputName; Patcher.MetadataManager.SaveMetadata(metadata); } static string GetHashOfFile(string filePath) { Span<char> destination = stackalloc char[32]; HashingHelper.HashFile(destination, filePath); return destination.ToString(); } } } internal class MetadataManager { private readonly string m_MetadataFile; private readonly object m_Lock = new object(); private List<Metadata> m_Metadata; public MetadataManager(string metadataFile) { m_MetadataFile = metadataFile; LoadFile(); } public Metadata? FindMetadataByHash(ReadOnlySpan<char> hash) { lock (m_Lock) { foreach (Metadata metadatum in m_Metadata) { if (hash.SequenceEqual(metadatum.OriginalAssetBundleHash)) { return metadatum; } } } return null; } public void SaveMetadata(Metadata metadata) { Metadata metadata2 = metadata; lock (m_Lock) { int num = m_Metadata.FindIndex((Metadata m) => m.OriginalAssetBundleHash.Equals(metadata2.OriginalAssetBundleHash, StringComparison.InvariantCulture)); if (num == -1) { m_Metadata.Add(metadata2); } else { m_Metadata[num] = metadata2; } } SaveFile(); } public void DeleteMetadata(Metadata metadata) { Metadata metadata2 = metadata; bool flag = false; lock (m_Lock) { int num = m_Metadata.FindIndex((Metadata m) => m.OriginalAssetBundleHash.Equals(metadata2.OriginalAssetBundleHash, StringComparison.InvariantCulture)); if (num >= 0) { flag = true; m_Metadata.RemoveAt(num); } } if (flag) { SaveFile(); } } private void LoadFile() { if (!File.Exists(m_MetadataFile)) { m_Metadata = new List<Metadata>(); return; } try { m_Metadata = JsonConvert.DeserializeObject<List<Metadata>>(File.ReadAllText(m_MetadataFile)) ?? new List<Metadata>(); } catch (Exception arg) { Patcher.Logger.LogError((object)$"Failed to deserialize metadata.json file\n{arg}"); m_Metadata = new List<Metadata>(); return; } if (!UpgradeMetadata()) { DeleteOldBundles(); } } private bool UpgradeMetadata() { bool flag = false; foreach (Metadata metadatum in m_Metadata) { bool flag2 = metadatum.LastAccessTime == default(DateTime); if (flag2) { metadatum.LastAccessTime = DateTime.Now; } flag = flag || flag2; } if (flag) { SaveFile(); } return flag; } private void SaveFile() { lock (m_Lock) { File.WriteAllText(m_MetadataFile, JsonConvert.SerializeObject((object)m_Metadata)); } } private void DeleteOldBundles() { for (int num = m_Metadata.Count - 1; num >= 0; num--) { Metadata metadata = m_Metadata[num]; if (!((DateTime.Now - metadata.LastAccessTime).TotalDays < 3.0)) { m_Metadata.RemoveAt(num); if (metadata.UncompressedAssetBundleName != null) { Patcher.Logger.LogInfo((object)("Deleting unused asset bundle cache " + metadata.UncompressedAssetBundleName)); Patcher.AssetBundleManager.DeleteCachedAssetBundle(Path.Combine(Patcher.AssetBundleManager.CachePath, metadata.UncompressedAssetBundleName)); } } } int counter2 = 0; string[] files = Directory.GetFiles(Patcher.AssetBundleManager.CachePath, "*.assetbundle", SearchOption.TopDirectoryOnly); foreach (string path2 in files) { string bundleName = Path.GetFileName(path2); Metadata metadata2 = m_Metadata.Find((Metadata m) => m.UncompressedAssetBundleName != null && m.UncompressedAssetBundleName.Equals(bundleName, StringComparison.InvariantCulture)); if (metadata2 == null) { DeleteFileSafely(ref counter2, path2); } } if (counter2 > 0) { Patcher.Logger.LogWarning((object)$"Deleted {counter2} unknown bundles. Metadata file got corrupted?"); } static void DeleteFileSafely(ref int counter, string path) { if (!FileHelper.TryDeleteFile(path, out Exception exception)) { Patcher.Logger.LogWarning((object)$"Failed to delete cache\n{exception}"); } else { counter++; } } } } } namespace BepInExFasterLoadAssetBundles.Helpers { internal static class AsyncHelper { [StructLayout(LayoutKind.Sequential, Size = 1)] public readonly struct SwitchToMainThreadAwaiter : ICriticalNotifyCompletion, INotifyCompletion { private static readonly SendOrPostCallback s_OnPostAction = OnPost; public bool IsCompleted => Thread.CurrentThread.ManagedThreadId == s_MainThreadId; public SwitchToMainThreadAwaiter GetAwaiter() { return this; } public void GetResult() { } public void OnCompleted(Action continuation) { UnsafeOnCompleted(continuation); } public void UnsafeOnCompleted(Action continuation) { ((SynchronizationContext)(object)s_SynchronizationContext).Post(s_OnPostAction, (object?)continuation); } private static void OnPost(object state) { if (state is Action action) { action(); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public readonly struct SwitchToThreadPoolAwaiter : ICriticalNotifyCompletion, INotifyCompletion { private static readonly WaitCallback s_OnPostAction = OnPost; public bool IsCompleted => false; public SwitchToThreadPoolAwaiter GetAwaiter() { return this; } public void GetResult() { } public void OnCompleted(Action continuation) { ThreadPool.QueueUserWorkItem(s_OnPostAction, continuation); } public void UnsafeOnCompleted(Action continuation) { ThreadPool.UnsafeQueueUserWorkItem(s_OnPostAction, continuation); } private static void OnPost(object state) { if (state is Action action) { action(); } } } private static UnitySynchronizationContext s_SynchronizationContext = null; private static int s_MainThreadId = -1; public static void InitUnitySynchronizationContext() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown s_SynchronizationContext = (UnitySynchronizationContext)SynchronizationContext.Current; s_MainThreadId = Thread.CurrentThread.ManagedThreadId; } public static void Schedule(Func<Task> func) { Func<Task> func2 = func; Task.Run(async delegate { try { await func2(); } catch (Exception ex) { Patcher.Logger.LogError((object)ex); } }); } public static SwitchToMainThreadAwaiter SwitchToMainThread() { return default(SwitchToMainThreadAwaiter); } public static SwitchToThreadPoolAwaiter SwitchToThreadPool() { return default(SwitchToThreadPoolAwaiter); } } internal static class AsyncOperationHelper { public struct AsyncOperationAwaiter : ICriticalNotifyCompletion, INotifyCompletion { private AsyncOperation? m_AsyncOperation; private Action? m_ContinuationAction; public readonly bool IsCompleted => m_AsyncOperation.isDone; public AsyncOperationAwaiter(AsyncOperation asyncOperation) { m_AsyncOperation = asyncOperation; m_ContinuationAction = null; } public readonly AsyncOperationAwaiter GetAwaiter() { return this; } public void GetResult() { if (m_AsyncOperation != null) { m_AsyncOperation.completed -= OnCompleted; } m_AsyncOperation = null; m_ContinuationAction = null; } public void OnCompleted(Action continuation) { UnsafeOnCompleted(continuation); } public void UnsafeOnCompleted(Action continuation) { m_ContinuationAction = continuation; m_AsyncOperation.completed += OnCompleted; } private readonly void OnCompleted(AsyncOperation _) { m_ContinuationAction?.Invoke(); } } public static AsyncOperationAwaiter WaitCompletionAsync<T>(this T op) where T : AsyncOperation { return new AsyncOperationAwaiter((AsyncOperation)(object)op); } } internal static class BundleHelper { public static bool CheckBundleIsAlreadyDecompressed(Stream stream) { stream.Seek(0L, SeekOrigin.Begin); SkipString(stream); stream.Position += 4L; SkipString(stream); SkipString(stream); stream.Position += 16L; Span<byte> span = stackalloc byte[4]; stream.Read(span); int num = BinaryPrimitives.ReadInt32BigEndian(span); int num2 = num & 0x3F; if (num2 == 0 || num2 == 2) { return true; } return false; } private static void SkipString(Stream stream) { while (stream.ReadByte() != 0) { } } } internal static class DriveHelper { public static bool HasDriveSpaceOnPath(string path, long expectedSpaceGB) { string pathRoot = Path.GetPathRoot(Path.GetFullPath(path)); DriveInfo driveInfo = new DriveInfo(pathRoot); return driveInfo.AvailableFreeSpace > expectedSpaceGB * 1073741824; } } internal static class FileHelper { public const long c_GBToBytes = 1073741824L; public const long c_MBToBytes = 1048576L; public static bool TryDeleteFile(string path, [NotNullWhen(false)] out Exception? exception) { try { File.Delete(path); exception = null; return true; } catch (Exception ex) { exception = ex; return false; } } public static async Task RetryUntilFileIsClosedAsync(string path, int maxTries = 5) { int tries = maxTries; while (true) { int num = tries - 1; tries = num; if (num <= 0) { break; } try { using (new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { } } catch (IOException) { await Task.Delay(1000); } } } } internal class HashingHelper { private const int c_BufferSize = 16777216; public static int HashFile(Span<char> destination, string path) { using FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None, 16777216, FileOptions.SequentialScan); return WriteHash(destination, stream); } public unsafe static int WriteHash(Span<char> destination, Stream stream) { //IL_0028: 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_0074: Unknown result type (might be due to invalid IL or missing references) stream.Seek(0L, SeekOrigin.Begin); void* ptr = UnsafeUtility.Malloc(4096L, 16, (Allocator)2); Span<byte> buffer = new Span<byte>(ptr, 4096); Hash128 val = default(Hash128); int num; while ((num = stream.Read(buffer)) > 0) { ((Hash128)(ref val)).Append(ptr, (ulong)num); } UnsafeUtility.Free(ptr, (Allocator)2); Span<byte> span = stackalloc byte[16]; BinaryPrimitives.WriteUInt64LittleEndian(span, val.u64_0); BinaryPrimitives.WriteUInt64LittleEndian(span.Slice(8), val.u64_1); return HashToString(destination, span); } private static int HashToString(Span<char> destination, ReadOnlySpan<byte> hash) { for (int i = 0; i < hash.Length; i++) { hash[i].TryFormat(destination.Slice(i * 2), out var _, "X2", CultureInfo.InvariantCulture); } return hash.Length * 2; } } }
plugins/ImmersiveScrap/ImmersiveScrap.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using ImmersiveScrap.Configs; using ImmersiveScrap.Keybinds; using ImmersiveScrap.Misc; using ImmersiveScrap.NetcodePatcher; using LethalCompanyInputUtils.Api; using LethalLevelLoader; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ImmersiveScrap")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Immersive Scrap mod with 40+ Vanilla style Scrap!")] [assembly: AssemblyFileVersion("1.3.1.0")] [assembly: AssemblyInformationalVersion("1.3.1+6714c2e037eef128f6dd8e1de29e78160ece1c7c")] [assembly: AssemblyProduct("ImmersiveScrap")] [assembly: AssemblyTitle("ImmersiveScrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ImmersiveScrap { [BepInPlugin("ImmersiveScrap", "ImmersiveScrap", "1.3.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static GameObject explosionPrefab; internal static IngameKeybinds InputActionsInstance; public static ImmersiveScrapConfig ModConfig { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; InputActionsInstance = new IngameKeybinds(); ModConfig = new ImmersiveScrapConfig(((BaseUnityPlugin)this).Config); AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)OnExtendedModRegistered, "XuXiaolan", "ImmersiveScraps"); AssetBundleLoader.AddOnLethalBundleLoadedListener((Action<AssetBundle>)OnLethalBundleLoaded, "immersivescrapassets.lethalbundle"); InitializeNetworkBehaviours(); Logger.LogInfo((object)"Plugin ImmersiveScrap is loaded!"); } internal static void OnExtendedModRegistered(ExtendedMod extendedMod) { if ((Object)(object)extendedMod == (Object)null) { return; } foreach (ExtendedItem extendedItem in extendedMod.ExtendedItems) { string configValueForItem = GetConfigValueForItem(extendedItem.Item.itemName); if (!string.IsNullOrEmpty(configValueForItem)) { List<StringWithRarity> collection = ConfigParsing(configValueForItem); extendedItem.LevelMatchingProperties.levelTags.AddRange(collection); extendedItem.LevelMatchingProperties.planetNames.AddRange(collection); Logger.LogInfo((object)$"Updated matching properties for {extendedItem.Item}."); } } } internal static void OnLethalBundleLoaded(AssetBundle assetBundle) { _ = (Object)(object)assetBundle == (Object)null; } private static string GetConfigValueForItem(string itemName) { switch (itemName) { case "Alcohol Flask": return ImmersiveScrapConfig.ConfigAlcoholSpawnWeight.Value; case "ImmersiveAnvil": return ImmersiveScrapConfig.ConfigAnvilSpawnWeight.Value; case "IBaseball bat": return ImmersiveScrapConfig.ConfigBaseballSpawnWeight.Value; case "Beer can": return ImmersiveScrapConfig.ConfigBeercanSpawnWeight.Value; case "IBrick": return ImmersiveScrapConfig.ConfigBrickSpawnWeight.Value; case "Broken engine": return ImmersiveScrapConfig.ConfigBrokenEngineSpawnWeight.Value; case "Bucket": return ImmersiveScrapConfig.ConfigBucketSpawnWeight.Value; case "Can paint": return ImmersiveScrapConfig.ConfigCanPaintSpawnWeight.Value; case "Canteen": return ImmersiveScrapConfig.ConfigCanteenSpawnWeight.Value; case "Car battery": return ImmersiveScrapConfig.ConfigCarBatterySpawnWeight.Value; case "Clamp": return ImmersiveScrapConfig.ConfigClampSpawnWeight.Value; case "IClock": return ImmersiveScrapConfig.ConfigClockSpawnWeight.Value; case "IFan": return ImmersiveScrapConfig.ConfigFanSpawnWeight.Value; case "Fancy Painting": return ImmersiveScrapConfig.ConfigFancyPaintingSpawnWeight.Value; case "IFireAxe": return ImmersiveScrapConfig.ConfigFireAxeSpawnWeight.Value; case "Fire extinguisher": return ImmersiveScrapConfig.ConfigFireExtingSpawnWeight.Value; case "Fire hydrant": return ImmersiveScrapConfig.ConfigFireHydrantSpawnWeight.Value; case "Food can": return ImmersiveScrapConfig.ConfigFoodCanSpawnWeight.Value; case "Gameboy": return ImmersiveScrapConfig.ConfigGameboySpawnWeight.Value; case "Garbage": return ImmersiveScrapConfig.ConfigGarbageSpawnWeight.Value; case "ImmersiveHammer": return ImmersiveScrapConfig.ConfigHammerSpawnWeight.Value; case "Jerrycan": return ImmersiveScrapConfig.ConfigJerryCanSpawnWeight.Value; case "IKeyboard": return ImmersiveScrapConfig.ConfigKeyboardSpawnWeight.Value; case "ILantern": return ImmersiveScrapConfig.ConfigLanternSpawnWeight.Value; case "Library lamp": return ImmersiveScrapConfig.ConfigLibraryLampSpawnWeight.Value; case "ImmersivePlant": return ImmersiveScrapConfig.ConfigPlantSpawnWeight.Value; case "Pliers": return ImmersiveScrapConfig.ConfigPliersSpawnWeight.Value; case "Plunger": return ImmersiveScrapConfig.ConfigPlungerSpawnWeight.Value; case "Retro Toy": return ImmersiveScrapConfig.ConfigRetroToySpawnWeight.Value; case "Screwdriver": return ImmersiveScrapConfig.ConfigScrewdriverSpawnWeight.Value; case "Sink": return ImmersiveScrapConfig.ConfigSinkSpawnWeight.Value; case "Socket Wrench": return ImmersiveScrapConfig.ConfigSocketSpawnWeight.Value; case "ISqueaky toy": return ImmersiveScrapConfig.ConfigSqueakyToySpawnWeight.Value; case "Suitcase": return ImmersiveScrapConfig.ConfigSuitcaseSpawnWeight.Value; case "Toaster": return ImmersiveScrapConfig.ConfigToasterSpawnWeight.Value; case "Toolbox": return ImmersiveScrapConfig.ConfigToolboxSpawnWeight.Value; case "Top hat": return ImmersiveScrapConfig.ConfigTophatSpawnWeight.Value; case "Traffic cone": return ImmersiveScrapConfig.ConfigTrafficConeSpawnWeight.Value; case "Vent": return ImmersiveScrapConfig.ConfigVentSpawnWeight.Value; case "Watering Can": return ImmersiveScrapConfig.ConfigWateringCanSpawnWeight.Value; case "Wheel": return ImmersiveScrapConfig.ConfigWheelSpawnWeight.Value; case "Wine bottle": return ImmersiveScrapConfig.ConfigWineBottleSpawnWeight.Value; case "Wrench": return ImmersiveScrapConfig.ConfigWrenchSpawnWeight.Value; default: Logger.LogInfo((object)("No configuration found for item type: " + itemName)); return null; } } private static List<StringWithRarity> ConfigParsing(string configMoonRarity) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown List<StringWithRarity> list = new List<StringWithRarity>(); foreach (string item in from s in configMoonRarity.Split(",") select s.Trim()) { string[] array = item.Split(":"); if (array.Length == 2) { string text = array[0]; if (int.TryParse(array[1], out var result)) { list.Add(new StringWithRarity(text, result)); Logger.LogInfo((object)$"Registered spawn rate for {text} to {result}"); } } } return list; } private void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "ImmersiveScrap"; public const string PLUGIN_NAME = "ImmersiveScrap"; public const string PLUGIN_VERSION = "1.3.1"; } } namespace ImmersiveScrap.Misc { public class ThrowableNoisemaker : NoisemakerProp { public bool throwWithRight; public bool beingThrown; public AnimationCurve itemFallCurve; public AnimationCurve itemVerticalFallCurve; public AnimationCurve itemVerticalFallCurveNoBounce; public RaycastHit itemHit; public Ray itemThrowRay; public override void FallWithCurve() { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) Vector3 val = ((GrabbableObject)this).startFallingPosition - ((GrabbableObject)this).targetFloorPosition; float magnitude = ((Vector3)(ref val)).magnitude; ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(((GrabbableObject)this).itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, ((GrabbableObject)this).itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude); ((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, itemFallCurve.Evaluate(((GrabbableObject)this).fallTime)); if (magnitude > 5f) { ((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), itemVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime)); } else { ((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), itemVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime)); } ((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude); } public override void ItemActivate(bool used, bool buttonDown = true) { } public Vector3 GetItemThrowDestination() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; itemThrowRay = new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward); float num = 30f; position = ((!Physics.Raycast(itemThrowRay, ref itemHit, num, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) ? ((Ray)(ref itemThrowRay)).GetPoint(num) : ((Ray)(ref itemThrowRay)).GetPoint(((RaycastHit)(ref itemHit)).distance - 0.05f)); itemThrowRay = new Ray(position, Vector3.down); if (Physics.Raycast(itemThrowRay, ref itemHit, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref itemHit)).point + Vector3.up * 0.05f; } return ((Ray)(ref itemThrowRay)).GetPoint(30f); } protected override void __initializeVariables() { ((NoisemakerProp)this).__initializeVariables(); } protected internal override string __getTypeName() { return "ThrowableNoisemaker"; } } public class Utilities { private static Dictionary<int, int> _masksByLayer; public static void Init() { GenerateLayerMap(); } public static void GenerateLayerMap() { _masksByLayer = new Dictionary<int, int>(); for (int i = 0; i < 32; i++) { int num = 0; for (int j = 0; j < 32; j++) { if (!Physics.GetIgnoreLayerCollision(i, j)) { num |= 1 << j; } } _masksByLayer.Add(i, num); } } public static Transform TryFindRoot(Transform child) { Transform val = child; while ((Object)(object)val != (Object)null) { if ((Object)(object)((Component)val).GetComponent<NetworkObject>() != (Object)null) { return val; } val = ((Component)val).transform.parent; } return null; } public static int MaskForLayer(int layer) { return _masksByLayer[layer]; } public static void TeleportPlayer(int playerObj, Vector3 teleportPos) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj]; if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>())) { Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val); } val.isInElevator = false; val.isInHangarShipRoom = false; val.isInsideFactory = true; val.averageVelocity = 0f; val.velocityLastFrame = Vector3.zero; StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true); StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play(); if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } public static IEnumerator TeleportPlayerBody(int playerObj, Vector3 teleportPosition) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float startTime = Time.realtimeSinceStartup; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)StartOfRound.Instance.allPlayerScripts[playerObj].deadBody != (Object)null || Time.realtimeSinceStartup - startTime > 2f)); if (StartOfRound.Instance.inShipPhase || SceneManager.sceneCount <= 1) { yield break; } DeadBodyInfo deadBody = StartOfRound.Instance.allPlayerScripts[playerObj].deadBody; if ((Object)(object)deadBody != (Object)null) { deadBody.attachedTo = null; deadBody.attachedLimb = null; deadBody.secondaryAttachedLimb = null; deadBody.secondaryAttachedTo = null; if ((Object)(object)deadBody.grabBodyObject != (Object)null && deadBody.grabBodyObject.isHeld && (Object)(object)deadBody.grabBodyObject.playerHeldBy != (Object)null) { deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false); } deadBody.isInShip = false; deadBody.parentedToShip = false; ((Component)deadBody).transform.SetParent((Transform)null, true); deadBody.SetRagdollPositionSafely(teleportPosition, true); } } public static void TeleportEnemy(EnemyAI enemy, Vector3 teleportPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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) enemy.serverPosition = teleportPos; ((Component)enemy).transform.position = teleportPos; enemy.agent.Warp(teleportPos); enemy.SyncPositionToClients(); } public static void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 1f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"Spawning explosion at pos: {explosionPosition}"); Transform val = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } if (spawnExplosionEffect) { Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true); } float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2); PlayerControllerB val2 = null; for (int i = 0; i < array.Length; i++) { float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position); if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } if (((Component)array[i]).gameObject.layer == 3) { val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner) { float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange)); val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, default(Vector3)); } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f) { Debug.Log((object)"Setting off other mine"); ((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren)); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f) { componentInChildren2.mainScript.HitEnemyOnLocalClient(enemyHitForce, default(Vector3), attacker, false, -1); } } } int num4 = ~LayerMask.GetMask(new string[1] { "Room" }); num4 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num4); for (int j = 0; j < array.Length; j++) { Rigidbody component = ((Component)array[j]).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddExplosionForce(70f, explosionPosition, 10f); } } } } } namespace ImmersiveScrap.Scrap { public class Brick : ThrowableNoisemaker { public AudioClip[] cookieSpecialAudio; public AudioSource brickPlayer; private float explodePercentage = 100f; public bool wasThrown; private Random noiseMakerRandom; public override void Start() { ((NoisemakerProp)this).Start(); noiseMakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85); } public void DetectThrowKeyPressed() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (Plugin.InputActionsInstance.ThrowKey.triggered && !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { wasThrown = true; Vector3 itemThrowDestination = GetItemThrowDestination(); ((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, itemThrowDestination, true); PlayCookieAudioServerRpc(0); } } public override void Update() { ((GrabbableObject)this).Update(); if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer != (Object)(object)this)) { DetectThrowKeyPressed(); } } [ServerRpc] public void PlayCookieAudioServerRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3742843923u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3742843923u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayCookieAudioClientRpc(index); } } [ClientRpc] public void PlayCookieAudioClientRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0108: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2929058189u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2929058189u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && cookieSpecialAudio.Length != 0) { brickPlayer.PlayOneShot(cookieSpecialAudio[index]); WalkieTalkie.TransmitOneShotAudio(brickPlayer, cookieSpecialAudio[index], 0.5f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.5f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } } [ServerRpc] public void StopPlayingCookieAudioServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4170301725u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4170301725u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StopPlayingCookieAudioClientRpc(); } } [ClientRpc] public void StopPlayingCookieAudioClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(366094878u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 366094878u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { brickPlayer.Stop(); } } } [ClientRpc] public void BoomClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2731884806u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2731884806u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Boom(); } } } [ServerRpc] public void BoomServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3369954093u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3369954093u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Boom(); BoomClientRpc(); } } public void CreateExplosion() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB attacker = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)this).OwnerClientId)); int num = 0; if (ImmersiveScrapConfig.ConfigBrickDealingDamage.Value) { num = ImmersiveScrapConfig.ConfigBrickDealingXDamage.Value; } Utilities.CreateExplosion(((Component)this).transform.position, ImmersiveScrapConfig.ConfigBrickExploding.Value, 20, 0f, num, 2, (CauseOfDeath)3, attacker); } public void Boom() { CreateExplosion(); } public override void OnHitGround() { if (wasThrown) { wasThrown = false; if (((NetworkBehaviour)this).IsOwner && (float)noiseMakerRandom.Next(0, 101) <= explodePercentage) { Boom(); BoomServerRpc(); } } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Brick() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3742843923u, new RpcReceiveHandler(__rpc_handler_3742843923)); NetworkManager.__rpc_func_table.Add(2929058189u, new RpcReceiveHandler(__rpc_handler_2929058189)); NetworkManager.__rpc_func_table.Add(4170301725u, new RpcReceiveHandler(__rpc_handler_4170301725)); NetworkManager.__rpc_func_table.Add(366094878u, new RpcReceiveHandler(__rpc_handler_366094878)); NetworkManager.__rpc_func_table.Add(2731884806u, new RpcReceiveHandler(__rpc_handler_2731884806)); NetworkManager.__rpc_func_table.Add(3369954093u, new RpcReceiveHandler(__rpc_handler_3369954093)); } private static void __rpc_handler_3742843923(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((Brick)(object)target).PlayCookieAudioServerRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2929058189(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)2; ((Brick)(object)target).PlayCookieAudioClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4170301725(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((Brick)(object)target).StopPlayingCookieAudioServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_366094878(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Brick)(object)target).StopPlayingCookieAudioClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2731884806(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Brick)(object)target).BoomClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3369954093(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((Brick)(object)target).BoomServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Brick"; } } internal class HittingStuff : GrabbableObject { public int hammerHitForce = 1; public float hammerHitPercentage = 1f; public bool reelingUp; public bool isHoldingButton; private RaycastHit rayHit; private Coroutine reelingUpCoroutine; private RaycastHit[] objectsHitByHammer; private List<RaycastHit> objectsHitByHammerList = new List<RaycastHit>(); public AudioClip reelUp; public AudioClip swing; public AudioClip[] hitSFX; public AudioSource hammerAudio; private PlayerControllerB previousPlayerHeldBy; private int hammerMask = 11012424; public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } isHoldingButton = buttonDown; if (!reelingUp && buttonDown) { reelingUp = true; previousPlayerHeldBy = base.playerHeldBy; if (reelingUpCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine); } reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpHammer()); } } private IEnumerator reelUpHammer() { base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; base.playerHeldBy.playerBodyAnimator.ResetTrigger("hammerHit"); base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true); hammerAudio.PlayOneShot(reelUp); ReelUpSFXServerRpc(); yield return (object)new WaitForSeconds(0.35f); yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld)); SwingHammer(!base.isHeld); yield return (object)new WaitForSeconds(0.13f); HitHammer(!base.isHeld); yield return (object)new WaitForSeconds(0.3f); reelingUp = false; reelingUpCoroutine = null; } [ServerRpc] public void ReelUpSFXServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2951614796u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2951614796u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ReelUpSFXClientRpc(); } } [ClientRpc] public void ReelUpSFXClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(989564174u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 989564174u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { hammerAudio.PlayOneShot(reelUp); } } } public override void DiscardItem() { base.playerHeldBy.activatingItem = false; ((GrabbableObject)this).DiscardItem(); } public void SwingHammer(bool cancel = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); if (!cancel) { hammerAudio.PlayOneShot(swing); previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public void HitHammer(bool cancel = false) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)previousPlayerHeldBy == (Object)null) { return; } previousPlayerHeldBy.activatingItem = false; bool flag = false; int num = -1; if (!cancel) { previousPlayerHeldBy.twoHanded = false; Debug.DrawRay(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward * 1.85f, Color.blue, 5f); objectsHitByHammer = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.75f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.85f, hammerMask, (QueryTriggerInteraction)2); objectsHitByHammerList = objectsHitByHammer.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); Vector3 val = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; IHittable val3 = default(IHittable); RaycastHit val5 = default(RaycastHit); for (int i = 0; i < objectsHitByHammerList.Count; i++) { RaycastHit val2 = objectsHitByHammerList[i]; if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 8) { val2 = objectsHitByHammerList[i]; if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 11) { val2 = objectsHitByHammerList[i]; if (!((Component)((RaycastHit)(ref val2)).transform).TryGetComponent<IHittable>(ref val3)) { continue; } val2 = objectsHitByHammerList[i]; if ((Object)(object)((RaycastHit)(ref val2)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform) { continue; } val2 = objectsHitByHammerList[i]; if (!(((RaycastHit)(ref val2)).point == Vector3.zero)) { Vector3 val4 = val; val2 = objectsHitByHammerList[i]; if (Physics.Linecast(val4, ((RaycastHit)(ref val2)).point, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { continue; } } flag = true; Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward; val3.Hit(hammerHitForce, forward, previousPlayerHeldBy, true, -1); continue; } } val2 = objectsHitByHammerList[i]; Vector3 point = ((RaycastHit)(ref val2)).point; val2 = objectsHitByHammerList[i]; val = point + ((RaycastHit)(ref val2)).normal * 0.01f; flag = true; val2 = objectsHitByHammerList[i]; string tag = ((Component)((RaycastHit)(ref val2)).collider).gameObject.tag; for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++) { if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag) { hammerAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(hammerAudio, StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX, 1f); num = j; break; } } } } if (flag) { int soundID = RoundManager.PlayRandomClip(hammerAudio, hitSFX, true, 1f, 0, 1000); Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); base.playerHeldBy.playerBodyAnimator.SetTrigger("hammerHit"); HitHammerServerRpc(soundID); } } [ServerRpc] public void HitHammerServerRpc(int soundID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2176195719u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, soundID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2176195719u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { HitHammerClientRpc(soundID); } } [ClientRpc] public void HitHammerClientRpc(int soundID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3269527847u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, soundID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3269527847u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HitSurfaceWithHammer(soundID); } } } private void HitSurfaceWithHammer(int soundID) { if (!((NetworkBehaviour)this).IsOwner) { hammerAudio.PlayOneShot(hitSFX[soundID]); } WalkieTalkie.TransmitOneShotAudio(hammerAudio, hitSFX[soundID], 1f); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_HittingStuff() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2951614796u, new RpcReceiveHandler(__rpc_handler_2951614796)); NetworkManager.__rpc_func_table.Add(989564174u, new RpcReceiveHandler(__rpc_handler_989564174)); NetworkManager.__rpc_func_table.Add(2176195719u, new RpcReceiveHandler(__rpc_handler_2176195719)); NetworkManager.__rpc_func_table.Add(3269527847u, new RpcReceiveHandler(__rpc_handler_3269527847)); } private static void __rpc_handler_2951614796(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((HittingStuff)(object)target).ReelUpSFXServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_989564174(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((HittingStuff)(object)target).ReelUpSFXClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2176195719(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { int soundID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref soundID); target.__rpc_exec_stage = (__RpcExecStage)1; ((HittingStuff)(object)target).HitHammerServerRpc(soundID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3269527847(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int soundID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref soundID); target.__rpc_exec_stage = (__RpcExecStage)2; ((HittingStuff)(object)target).HitHammerClientRpc(soundID); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HittingStuff"; } } } namespace ImmersiveScrap.Weapons { public class BaseballBat : Shovel { protected override void __initializeVariables() { ((Shovel)this).__initializeVariables(); } protected internal override string __getTypeName() { return "BaseballBat"; } } public class Plunger : Shovel { protected override void __initializeVariables() { ((Shovel)this).__initializeVariables(); } protected internal override string __getTypeName() { return "Plunger"; } } } namespace ImmersiveScrap.Keybinds { public class IngameKeybinds : LcInputActions { [InputAction("<Keyboard>/q", Name = "ThrowKeybind")] public InputAction ThrowKey { get; set; } } } namespace ImmersiveScrap.Configs { public class ImmersiveScrapConfig { public static ConfigEntry<int> ConfigVanillaSpawnWeight { get; private set; } public static ConfigEntry<int> ConfigCustomSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigAlcoholSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigAnvilSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigBaseballSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigBeercanSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigBrickSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigBrokenEngineSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigBucketSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigCanPaintSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigCanteenSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigCarBatterySpawnWeight { get; private set; } public static ConfigEntry<string> ConfigClampSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigClockSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigFanSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigFancyPaintingSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigFireAxeSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigFireExtingSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigFireHydrantSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigFoodCanSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigGameboySpawnWeight { get; private set; } public static ConfigEntry<string> ConfigGarbageSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigHammerSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigJerryCanSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigKeyboardSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigLanternSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigLibraryLampSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigPlantSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigPliersSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigPlungerSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigRetroToySpawnWeight { get; private set; } public static ConfigEntry<string> ConfigScrewdriverSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigSinkSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigSocketSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigSqueakyToySpawnWeight { get; private set; } public static ConfigEntry<string> ConfigSuitcaseSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigToasterSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigToolboxSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigTophatSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigTrafficConeSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigVentSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigWateringCanSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigWheelSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigWineBottleSpawnWeight { get; private set; } public static ConfigEntry<string> ConfigWrenchSpawnWeight { get; private set; } public static ConfigEntry<bool> ConfigBrickExploding { get; private set; } public static ConfigEntry<bool> ConfigBrickDealingDamage { get; private set; } public static ConfigEntry<int> ConfigBrickDealingXDamage { get; private set; } public ImmersiveScrapConfig(ConfigFile configFile) { ConfigBrickExploding = configFile.Bind<bool>("Scrap Options", "Brick Exploding", false, "Enable/Disable Brick Exploding"); ConfigBrickDealingDamage = configFile.Bind<bool>("Scrap Options", "Brick Dealing Damage", false, "Enable/Disable Brick Dealing Damage"); ConfigBrickDealingXDamage = configFile.Bind<int>("Scrap Options", "Brick Dealing X Damage", 1, "Set how much damage the Brick deals"); ConfigAlcoholSpawnWeight = configFile.Bind<string>("Scrap Options", "Alcohol | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for alcohol scrap on moons"); ConfigAnvilSpawnWeight = configFile.Bind<string>("Scrap Options", "Anvil | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for anvil scrap on moons"); ConfigBaseballSpawnWeight = configFile.Bind<string>("Scrap Options", "Baseball | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for baseball scrap on moons"); ConfigBeercanSpawnWeight = configFile.Bind<string>("Scrap Options", "Beercan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for beer can scrap on moons"); ConfigBrickSpawnWeight = configFile.Bind<string>("Scrap Options", "Brick | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for brick scrap on moons"); ConfigCanteenSpawnWeight = configFile.Bind<string>("Scrap Options", "Canteen | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for canteen scrap on moons"); ConfigCarBatterySpawnWeight = configFile.Bind<string>("Scrap Options", "CarBattery | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for car battery scrap on moons"); ConfigFireAxeSpawnWeight = configFile.Bind<string>("Scrap Options", "FireAxe | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fire axe scrap on moons"); ConfigFireExtingSpawnWeight = configFile.Bind<string>("Scrap Options", "FireExtinguisher | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fire extinguisher scrap on moons"); ConfigFireHydrantSpawnWeight = configFile.Bind<string>("Scrap Options", "FireHydrant | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fire hydrant scrap on moons"); ConfigFoodCanSpawnWeight = configFile.Bind<string>("Scrap Options", "FoodCan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for food can scrap on moons"); ConfigLibraryLampSpawnWeight = configFile.Bind<string>("Scrap Options", "LibraryLamp | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for library lamp scrap on moons"); ConfigPlantSpawnWeight = configFile.Bind<string>("Scrap Options", "Plant | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for plant scrap on moons"); ConfigPliersSpawnWeight = configFile.Bind<string>("Scrap Options", "Pliers | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for pliers scrap on moons"); ConfigPlungerSpawnWeight = configFile.Bind<string>("Scrap Options", "Plunger | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for plunger scrap on moons"); ConfigTrafficConeSpawnWeight = configFile.Bind<string>("Scrap Options", "TrafficCone | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for traffic cone scrap on moons"); ConfigWateringCanSpawnWeight = configFile.Bind<string>("Scrap Options", "WateringCan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for watering can scrap on moons"); ConfigWrenchSpawnWeight = configFile.Bind<string>("Scrap Options", "Wrench | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for wrench scrap on moons"); ConfigBrokenEngineSpawnWeight = configFile.Bind<string>("Scrap Options", "BrokenEngine | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for broken engine scrap on moons"); ConfigBucketSpawnWeight = configFile.Bind<string>("Scrap Options", "Bucket | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for bucket scrap on moons"); ConfigCanPaintSpawnWeight = configFile.Bind<string>("Scrap Options", "CanPaint | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for can of paint scrap on moons"); ConfigClampSpawnWeight = configFile.Bind<string>("Scrap Options", "Clamp | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for clamp scrap on moons"); ConfigClockSpawnWeight = configFile.Bind<string>("Scrap Options", "Clock | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for clock scrap on moons"); ConfigFanSpawnWeight = configFile.Bind<string>("Scrap Options", "Fan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fan scrap on moons"); ConfigFancyPaintingSpawnWeight = configFile.Bind<string>("Scrap Options", "FancyPainting | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fancy painting scrap on moons"); ConfigGarbageSpawnWeight = configFile.Bind<string>("Scrap Options", "Garbage | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for garbage scrap on moons"); ConfigGameboySpawnWeight = configFile.Bind<string>("Scrap Options", "Gameboy | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for Gameboy scrap on moons"); ConfigHammerSpawnWeight = configFile.Bind<string>("Scrap Options", "Hammer | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for hammer scrap on moons"); ConfigJerryCanSpawnWeight = configFile.Bind<string>("Scrap Options", "JerryCan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for jerry can scrap on moons"); ConfigKeyboardSpawnWeight = configFile.Bind<string>("Scrap Options", "Keyboard | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for keyboard scrap on moons"); ConfigLanternSpawnWeight = configFile.Bind<string>("Scrap Options", "Lantern | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for lantern scrap on moons"); ConfigRetroToySpawnWeight = configFile.Bind<string>("Scrap Options", "RetroToy | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for retro toy scrap on moons"); ConfigScrewdriverSpawnWeight = configFile.Bind<string>("Scrap Options", "Screwdriver | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for screwdriver scrap on moons"); ConfigSinkSpawnWeight = configFile.Bind<string>("Scrap Options", "Sink | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for sink scrap on moons"); ConfigSocketSpawnWeight = configFile.Bind<string>("Scrap Options", "Socket | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for socket scrap on moons"); ConfigSqueakyToySpawnWeight = configFile.Bind<string>("Scrap Options", "SqueakyToy | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for squeaky toy scrap on moons"); ConfigSuitcaseSpawnWeight = configFile.Bind<string>("Scrap Options", "Suitcase | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for suitcase scrap on moons"); ConfigToasterSpawnWeight = configFile.Bind<string>("Scrap Options", "Toaster | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for toaster scrap on moons"); ConfigToolboxSpawnWeight = configFile.Bind<string>("Scrap Options", "Toolbox | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for toolbox scrap on moons"); ConfigTophatSpawnWeight = configFile.Bind<string>("Scrap Options", "Tophat | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for top hat scrap on moons"); ConfigVentSpawnWeight = configFile.Bind<string>("Scrap Options", "Vent | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for vent scrap on moons"); ConfigWheelSpawnWeight = configFile.Bind<string>("Scrap Options", "Wheel | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for wheel scrap on moons"); ConfigWineBottleSpawnWeight = configFile.Bind<string>("Scrap Options", "WineBottle | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for wine bottle scrap on moons"); ClearUnusedEntries(configFile); Plugin.Logger.LogInfo((object)"Setting up config for ImmersiveScrap plugin..."); } private void ClearUnusedEntries(ConfigFile configFile) { PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(configFile, null); dictionary.Clear(); configFile.Save(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace ImmersiveScrap.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
plugins/kPlug.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using ActionGame; using ActionGame.Chara; using H; using Illusion.Game; using IllusionPlugin; using Manager; using RootMotion.FinalIK; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityStandardAssets.ImageEffects; using kPlug.CmpBase; using kPlug.CmpChara; using kPlug.CmpH; using kPlug.CmpH.ActBind; using kPlug.CmpH.ActLink; using kPlug.CmpMisc; using kPlug.DefAndParse; using kPlug.Futa; using kPlug.GirlBrain; using kPlug.Inputs; using kPlug.PoseDef; using kPlug.Tools; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("kPlug Party")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("kPlug")] [assembly: AssemblyCopyright("Katarsys")] [assembly: AssemblyTrademark("")] [assembly: AssemblyVersion("2.8.0.0")] namespace kPlug { public class kPlug : IPlugin { public static string version = "2.8"; public static bool debug = false; public static bool debugButton = true; public static bool Disabled = false; public int level; public static string lvTyp; public static string mapName; public static string savName; public static int mapId = -1; public static bool havLanguageFiles = false; public static bool havDarknessPack_1 = false; private string hCusRoot = "hRoot"; private string actCtrlName = "actionTweaker"; public static Dealer dealer; public static ScreenWriter screenWriter; public static StatManager statManager; public static ConfigCtrl config; public static Diary diary; public static ClothesCtrl clothCtrl; public static JukeboxCtrl jukeboxCtrl; public static HControl hCtrl; public static AI_Main mainAi; public static AI_Second secondAi; public static FxCtrl fxCtrl; public static HComboCtrl combo; public static InviteUI inviteUi; public static ToolTranslation.Reader transReader; public static StudioCtrl studioCtrl; public static ActionMap map; public static HFlag hFlag; public static HSceneProc hProc; public static HSprite hSprite; public static GameObject hSpace; public static GameObject hTweaker; public static Heroine heroine; public static Heroine heroine2; public static string hAnim; public static ChaFileControl futaChaFile = null; public static bool inOverlap; public static bool inLoad; public static bool inFade; public static bool inActLv = false; public static bool inH = false; public static bool inSpH = false; public static bool catchSceneEnd = false; public static Def.HStartCtx hStartCtx = Def.HStartCtx.Normal; public static Def.HStartCtx hLastCtx = Def.HStartCtx.Normal; public static bool inFreeH = false; public static bool atHome = false; public static bool leavingH = false; public static bool HendFromTrespass = false; public static bool trespassingH = false; public static bool inHresult = false; public static int addedGirlId = 1; public static bool dickIsHere = false; public static bool useCustomDick = false; public static Texture knobTxt; public static ChaControl maleInMaker; public static Material knobMatInMaker; public static ChaControl femaleInMaker; public static KokanBehavior kbInMaker; public static Material vaginMatInMaker; public static bool hvActionCmps = false; public static bool tourInFreeH = false; public static bool tourInEvent = false; public static bool onTitle = false; public static bool inCharMaker = false; public static bool inStudio = false; public static bool addConfigOnTitle = false; public static string meetOnSchoolWay = string.Empty; public static List<SnapShot.Daily> morningPartners = new List<SnapShot.Daily>(); public static bool inRebirth = false; public static int spentDays = 0; public string Name => "kPlug"; public string Version => "2.8"; public static ChaControl heroineCha { get; private set; } public static SnapShot.Stats girl_statAtInit { get; private set; } public static string girl_atInit { get; private set; } public static ChaControl heroine2Cha { get; private set; } public static string girl2_atInit { get; private set; } public void OnApplicationStart() { Application.runInBackground = true; if (debug) { DebugMethods.WriteInConsole(" Have load \"" + Name + " v" + Version + " !", 1); } havLanguageFiles = ToolTranslation.HavTranslation(); havDarknessPack_1 = kFileParser.HavDarknessPack_1(); } public void OnUpdate() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0bee: Unknown result type (might be due to invalid IL or missing references) //IL_0bf5: Invalid comparison between Unknown and I4 if (Disabled) { return; } inLoad = Singleton<Scene>.Instance.IsNowLoading; inOverlap = Singleton<Scene>.Instance.IsOverlap; inFade = ((SimpleFade)Singleton<Scene>.Instance.sceneFade).IsFadeNow; if (inLoad || inFade) { _ = 1; } else _ = inOverlap; inStudio = lvTyp == "Studio"; if (inStudio && (Object)(object)studioCtrl == (Object)null) { studioCtrl = new GameObject().AddComponent<StudioCtrl>(); if (debug) { Console.WriteLine(" kPlug : Add Studio Control"); } } onTitle = lvTyp == "Title" || lvTyp == "VRTitle"; if (onTitle) { if (lvTyp == "VRTitle") { Disabled = true; return; } if (Time.timeScale == 0f) { Time.timeScale = 1f; } if (inH) { inH = false; if (debug) { DebugMethods.WriteInConsole(" Forcing inH reset on Title !", 3); } } if (!addConfigOnTitle && !inLoad && !inFade) { config = new GameObject().AddComponent<ConfigCtrl>(); addConfigOnTitle = true; } if (addConfigOnTitle && havLanguageFiles && (Object)(object)transReader == (Object)null) { transReader = ((Component)config).gameObject.AddComponent<ToolTranslation.Reader>(); } if (!string.IsNullOrEmpty(savName)) { savName = string.Empty; } if (tourInFreeH) { tourInFreeH = false; } if (tourInEvent) { tourInEvent = false; } if (inFreeH) { inFreeH = false; } if (HendFromTrespass) { HendFromTrespass = false; } if (trespassingH) { trespassingH = false; } if (hLastCtx != 0) { hLastCtx = Def.HStartCtx.Normal; } if (!string.IsNullOrEmpty(meetOnSchoolWay) || morningPartners.Count != 0 || inRebirth) { ClearRebirth(); } } else if (addConfigOnTitle) { addConfigOnTitle = false; } inCharMaker = ToolUI.InCharaMaker(); if (inCharMaker) { if (inLoad) { return; } if ((Object)(object)maleInMaker != (Object)null) { if (useCustomDick) { knobMatInMaker.mainTextureOffset = DickBehavior.KnobTxtOffset(DickBehavior.KnobColFromSkin(((ChaFile)((ChaInfo)maleInMaker).chaFile).custom.body.skinMainColor)); } } else { if ((Object)(object)femaleInMaker == (Object)null) { ChaControl[] array = Object.FindObjectsOfType<ChaControl>(); foreach (ChaControl val in array) { if (((ChaInfo)val).sex == 1 && ((ChaInfo)val).visibleAll) { ToolKokan.FindFemaleInMaker(val); if (debug) { ((Component)val).gameObject.AddComponent<MakerDebugger>(); } break; } } } if ((Object)(object)femaleInMaker != (Object)null && (Object)(object)vaginMatInMaker != (Object)null && (Object)(object)kbInMaker == (Object)null) { kbInMaker = ((Component)femaleInMaker).gameObject.AddComponent<KokanBehavior>(); } } } else { if ((Object)(object)knobMatInMaker != (Object)null) { knobMatInMaker = null; } if ((Object)(object)maleInMaker != (Object)null) { maleInMaker = null; } if ((Object)(object)vaginMatInMaker != (Object)null) { vaginMatInMaker = null; } if ((Object)(object)femaleInMaker != (Object)null) { femaleInMaker = null; } if ((Object)(object)kbInMaker != (Object)null) { kbInMaker = null; } } if (inCharMaker && ((Object)(object)maleInMaker != (Object)null || (Object)(object)femaleInMaker != (Object)null)) { return; } if (lvTyp == "FreeH" && !tourInFreeH) { tourInFreeH = true; } if (lvTyp == "FixEventSceneEx" && !tourInEvent) { tourInEvent = true; } int num; if (!(lvTyp == "Action")) { num = ((lvTyp == "H") ? 1 : 0); if (num == 0 && inActLv) { map = null; inActLv = false; if (debug) { DebugMethods.WriteInConsole(" kPlug : Exiting Action level context, delete components...", 1); } DeleteActionComponents(); } } else { num = 1; } if (num != 0 && !inActLv && !inLoad && !inOverlap) { if (debug) { DebugMethods.WriteInConsole(" kPlug : Enter Action Context Adding components", 1); } inActLv = true; hvActionCmps = true; AddActionComponents(); } if (inActLv && (Object)(object)config == (Object)null && !inLoad) { inActLv = false; inRebirth = true; } if (((inActLv && hvActionCmps) || tourInEvent || inCharMaker) && ((!inLoad && inFade && !tourInFreeH && !inH) || (inH && !dickIsHere && !inLoad) || (tourInEvent && !dickIsHere && !inLoad && !inFade)) && DickBehavior.DickJustAppear()) { DickBehavior.SetPlayerDickColor(); } if (dickIsHere && tourInEvent && inFade) { dickIsHere = false; } if (inActLv && hvActionCmps && !inCharMaker) { if (ParserScene.InH() && (Object)(object)hCtrl == (Object)null && !inLoad) { if (!inH) { ResetHVariables(); if (HendFromTrespass) { HendFromTrespass = false; trespassingH = true; if (debug) { DebugMethods.WriteInConsole(" kPlug : Previous H leaved from Trespass, assume this scene as next scene", 2); } } inH = true; hFlag = Object.FindObjectOfType<HFlag>(); hProc = Object.FindObjectOfType<HSceneProc>(); hSprite = hProc.sprite; if (debug) { DebugMethods.WriteInConsole(" kPlug : ENTERING H, CATCH NATIVE COMPONENTS...", 3); } } if ((Object)(object)GameObject.Find(hCusRoot) == (Object)null) { CreateEcchiSpace(); if (!tourInFreeH) { statManager.ConformAllDailys(atDayEnd: false); } } Def.PoseMod hpTyp = Def.PoseMod.None; ParserAnim.GetHPosModFromAssetPath(ref hpTyp); if (hpTyp != 0 && hpTyp != Def.PoseMod.Unknown && (Object)(object)hFlag != (Object)null && hFlag.nowAnimationInfo != null) { if (tourInFreeH) { mapId = ((BaseMap)Object.FindObjectOfType<ActionMap>()).no; } hAnim = kTranslator.AnimName(hFlag.nowAnimationInfo.paramFemale.path.file, kTranslator.AnimNameMapper_H()); if (debug) { DebugMethods.WriteInConsole(" kPlug : CATCH START ANIM as " + hAnim, 3); } hStartCtx = ParserScene.HStartCtx(); List<Def.HStartCtx> list = new List<Def.HStartCtx> { Def.HStartCtx.Masturbation, Def.HStartCtx.Peep, Def.HStartCtx.Lesbian, Def.HStartCtx.Darkness }; dealer.mapChangeAfetrH = !tourInFreeH && (list.Contains(hStartCtx) || (list.Contains(hLastCtx) && trespassingH)); hLastCtx = Def.HStartCtx.Normal; if (debug) { DebugMethods.WriteInConsole(" kPlug : Starting H scene, context is " + hStartCtx, 1); if (dealer.mapChangeAfetrH) { DebugMethods.WriteInConsole(" kPlug : H Context will chnage map after scene END ", 1); } } Def.ChangePose doPosChange = Def.ChangePose.No; if (hStartCtx == Def.HStartCtx.Normal) { doPosChange = ToolDeal.PosChangeAtStart(); } AddEcchiComponents(doPosChange); if (config.inviteClosest && !tourInFreeH && hStartCtx == Def.HStartCtx.Normal && mapName != "Home") { dealer.InviteCloseGirls(); } if (mapName == "Home" && !tourInFreeH) { dealer.InviteMorningGirls(); } if (debug) { DebugHStart(); } } } if (inH && !tourInFreeH && !inLoad && !inOverlap) { if (hFlag.isHSceneEnd && !catchSceneEnd) { if (debug) { DebugMethods.WriteInConsole(" kPlug : Catch H SCENE END !", 3); } if (!((Behaviour)hFlag.ctrlCamera).enabled) { ((Behaviour)hFlag.ctrlCamera).enabled = true; } hLastCtx = hStartCtx; if (Singleton<Game>.Instance.actScene.isPenetration && !trespassingH) { HendFromTrespass = true; if (dealer.InProcess) { dealer.ForceStopFromTrespass(); } if (debug) { DebugMethods.WriteInConsole(" Leaving H with ACTSCENE PENETRATION TRUE !", 3); } } catchSceneEnd = true; dealer.ClearLoadList(); ToolDeal.HSeneEnd(); hCtrl.Clean(sceneEnd: true); mainAi.ResetAtHend(); diary.Reset(); if (!hCtrl.noResultH && !HendFromTrespass && !leavingH) { dealer.results = ((Component)dealer).gameObject.AddComponent<HResults>(); leavingH = true; } statManager.LeavingH(); if ((Object)(object)hCtrl.SpHctrl != (Object)null) { hCtrl.SpHctrl.leavingH = true; } if (hCtrl.noResultH || HendFromTrespass) { config.ResetHcustom(); dealer.ExitingH(); if (HendFromTrespass && dealer.haremAI.Count > 0) { dealer.ClearHarem(); } dealer.DestroySpotManager(); if (debug) { DebugMethods.WriteInConsole(" kPlug : H SCENE END IN A NO Result CONTEXT", 1); } } } inH = ParserScene.InH(); if (!inH && (Object)(object)hCtrl != (Object)null) { if (debug) { DebugMethods.WriteInConsole(" kPlug : not inH but hControl exist, Add Destroyer...", 2); } ((Component)hCtrl).gameObject.AddComponent<AutoDestroy>().autoDestruct = true; } } if (tourInFreeH && inH && !ParserScene.InH()) { inH = false; ResetHVariables(); } if (!tourInFreeH) { if ((Object)(object)Singleton<Game>.Instance.actScene.AdvScene.nowScene != (Object)null && leavingH && !ParserScene.InH()) { leavingH = false; inHresult = true; dealer.HResume(); config.ResetHcustom(); } bool flag = hLastCtx == Def.HStartCtx.ThreeP; bool miniMapAndCameraActive = Singleton<Game>.Instance.actScene.MiniMapAndCameraActive; if (inHresult && ((ToolUI.InResultGaugeScreen() && !flag) || (flag && miniMapAndCameraActive))) { if (dealer.haremAI.Count > 0) { dealer.ClearHarem(); } dealer.ExitingH(); dealer.DestroySpotManager(); inHresult = false; } } } if (!inActLv || !hvActionCmps) { return; } if (!tourInFreeH) { if (!inLoad && ((BaseMap)Singleton<Game>.Instance.actScene.Map).isMapLoading) { map = Object.FindObjectOfType<ActionMap>(); if ((Object)(object)map != (Object)null && mapId != map.Info.No) { mapId = map.Info.No; mapName = kTranslator.MapNoInterpreter(map.Info.No); atHome = mapName == "Home"; if (new List<int> { 14, 15, 16, 45, 46 }.Contains(mapId) && (Object)(object)dealer != (Object)null) { Singleton<Game>.Instance.actScene.Map.Info.isWarning = ((!((Object)(object)dealer.futaOnMap != (Object)null)) ? true : false); if (debug) { DebugMethods.WriteInConsole(" Turning Map isWarning to " + Singleton<Game>.Instance.actScene.Map.Info.isWarning, 1); } } if ((int)Singleton<Game>.Instance.actScene.Cycle.nowType == 11) { ClearRebirth(); } if ((Object)(object)dealer != (Object)null) { dealer.mapChange = true; } if (debug) { DebugMethods.WriteInConsole(" kPlug : Map have change to " + mapName, 1); } } } if (!inLoad && !inFade && savName != Game.SaveFileName) { if (!string.IsNullOrEmpty(savName)) { if (debug) { DebugMethods.WriteInConsole(" kPlug : Loaded save change to \"" + Game.SaveFileName + "\"", 1); } inActLv = false; DeleteActionComponents(); } savName = Game.SaveFileName; } } if (inH && (Object)(object)hCtrl != (Object)null && !inFade) { hAnim = kTranslator.AnimName(hFlag.nowAnimationInfo.paramFemale.path.file, hCtrl.AnimNmMapper); } } public void OnLevelWasLoaded(int level) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); lvTyp = ((Scene)(ref activeScene)).name; if (debug) { DebugMsg(); } } public void OnFixedUpdate() { } public void OnLevelWasInitialized(int level) { } public void OnApplicationQuit() { } public static void ResetHVariables() { inH = false; hCtrl = null; hSpace = null; inSpH = false; catchSceneEnd = false; trespassingH = false; heroine = null; girl_statAtInit = null; girl_atInit = string.Empty; heroine2 = null; heroine2Cha = null; girl2_atInit = string.Empty; if (debug) { Console.WriteLine(" kPlug ( ResetHVariables ) : Clear H variables"); } } private void ClearRebirth() { meetOnSchoolWay = string.Empty; morningPartners.Clear(); inRebirth = false; if (debug) { Console.WriteLine(" kPlug ( ClearRebirth ) : Clear variables"); } } public void AddActionComponents() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) GameObject val = new GameObject(actCtrlName); config = val.AddComponent<ConfigCtrl>(); transReader = val.AddComponent<ToolTranslation.Reader>(); dealer = val.AddComponent<Dealer>(); statManager = val.AddComponent<StatManager>(); screenWriter = val.AddComponent<ScreenWriter>(); diary = val.AddComponent<Diary>(); clothCtrl = val.AddComponent<ClothesCtrl>(); jukeboxCtrl = val.AddComponent<JukeboxCtrl>(); if (inRebirth) { statManager.initByDayChange = true; if (!string.IsNullOrEmpty(meetOnSchoolWay)) { statManager.meetBeforeVanish = meetOnSchoolWay; } if (morningPartners.Count > 0) { foreach (SnapShot.Daily morningPartner in morningPartners) { statManager.dailysBeforeVanish.Add(morningPartner); } } dealer.waitToInitGirlAtSchool = true; dealer.InSchoolAtNight = false; dealer.BackHomeAtNight = false; spentDays = 1; ClearRebirth(); } if (debug) { DebugMethods.WriteInConsole(" kPlug : adding actioncomponents", 1); } } public void DeleteActionComponents() { if ((Object)(object)GameObject.Find(actCtrlName) != (Object)null) { GameObject.Find(actCtrlName).AddComponent<AutoDestroy>().autoDestruct = true; if (debug) { DebugMethods.WriteInConsole(" kPlug : ...have remove action components", 1); } } } public void CreateEcchiSpace() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown hTweaker = new GameObject(hCusRoot); hSpace = GameObject.Find("HScene"); if ((Object)(object)hSpace != (Object)null) { hTweaker.transform.SetParent(hSpace.transform); } fxCtrl = hTweaker.AddComponent<FxCtrl>(); if (debug) { DebugMethods.WriteInConsole(" kPlug : create hTweaker space and fx control", 1); } } public void AddEcchiComponents(Def.ChangePose doPosChange) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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) heroine = hFlag.lstHeroine[0]; heroineCha = ((CharaData)heroine).chaCtrl; girl_atInit = kFileParser.GirlName(heroine); if (hStartCtx != Def.HStartCtx.Lesbian) { EMode mode = hFlag.mode; if (!(((object)(EMode)(ref mode)).ToString() == "houshi3P")) { mode = hFlag.mode; if (!(((object)(EMode)(ref mode)).ToString() == "sonyu3P")) { goto IL_00d2; } } } heroine2 = hFlag.lstHeroine[1]; heroine2Cha = ((CharaData)heroine2).chaCtrl; girl2_atInit = kFileParser.GirlName(heroine2); if (debug) { DebugMethods.WriteInConsole(" kPlug : H scene have a second girl, " + girl2_atInit, 1); } goto IL_00d2; IL_00d2: if (tourInFreeH) { dealer.heroineVoice = heroine.ChaVoice; if (heroine2 != null) { dealer.heroine2Voice = heroine2.ChaVoice; } } else if ((Object)(object)dealer.fixChaSpCtrl == (Object)null) { dealer.heroineVoice = heroine.ChaVoice; if (heroine2 != null) { dealer.heroine2Voice = heroine2.ChaVoice; } } else { dealer.heroineVoice = ((dealer.fixChaSpCtrl.fixSav != null) ? dealer.fixChaSpCtrl.fixSav.ChaVoice : heroine.ChaVoice); if (heroine2 != null) { dealer.heroine2Voice = heroine2.ChaVoice; } } if (!tourInFreeH) { girl_statAtInit = ToolStats.StatsFromSav(heroine); statManager.RefreshDailyJudge(girl_atInit); if (debug) { DebugMethods.WriteInConsole(" kPlug : Ghosting main girl, " + girl_atInit + ", stats at h start", 1); } } inFreeH = hFlag.isFreeH; hCtrl = hTweaker.AddComponent<HControl>(); hCtrl.changePosAtStart = doPosChange; mainAi = ((Component)heroineCha).gameObject.AddComponent<AI_Main>(); if ((Object)(object)heroine2Cha != (Object)null) { secondAi = ((Component)heroine2Cha).gameObject.AddComponent<AI_Second>(); } combo = hTweaker.AddComponent<HComboCtrl>(); inviteUi = hTweaker.AddComponent<InviteUI>(); bool autoFpv = config.autoFpv; bool autoSmartUi = config.autoSmartUi; hCtrl.Init(Time.deltaTime, autoFpv, autoSmartUi); if (debug) { DebugMethods.WriteInConsole(" kPlug : adding ecchi components", 1); } } private void DebugHStart() { string text = mapName; if (tourInFreeH) { text = ((BaseMap)Object.FindObjectOfType<ActionMap>()).no.ToString(); } Console.WriteLine("------------------------------------------------------------------"); Console.WriteLine(" Entering H with with \"" + girl_atInit + "\" at place :" + text); Console.WriteLine("\tEExp kind " + ((object)(EExperience)(ref hFlag.experience)).ToString() + ", expCheat " + hFlag.expCheat); Console.WriteLine("------------------------------------------------------------------"); } private void DebugMsg() { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) Console.WriteLine(""); Console.WriteLine("---------------------------------------------------------------"); Scene activeScene = SceneManager.GetActiveScene(); Console.WriteLine("Level : " + ((Scene)(ref activeScene)).buildIndex); activeScene = SceneManager.GetActiveScene(); Console.WriteLine("Scene Name : " + ((Scene)(ref activeScene)).name); activeScene = SceneManager.GetActiveScene(); Console.WriteLine("Scene Path : " + ((Scene)(ref activeScene)).path); Console.WriteLine("runInBackground : " + Application.runInBackground); Console.WriteLine("---------------------------------------------------------------"); Console.WriteLine(""); Console.WriteLine(""); } } public class DebugMethods { public static bool test1 = false; public static bool test2 = true; public static bool test3 = false; public static int action = 0; public static int face = 0; public static int soundId = 0; public static bool togle = false; private List<FaceInfo> avaibleExpr = new List<FaceInfo>(); private static List<int[]> avaiblesIndexs = new List<int[]>(); private static int listId = 0; public static int animId = 0; public static List<string> advBundles = new List<string> { "adv/motion/controller/adv/00.unity3d" }; public static List<string> advAssets = new List<string> { "cf_adv_00_00", "cf_adv_suwari_00" }; public static bool debugAnim = false; public static List<string> statesToPlay = new List<string> { "Idle", "A_Idle", "Drop", "InsertIdle", "IN_A", "OUT_A" }; public static int stateId = 0; public static bool lookDan = true; public static int layerId = 0; private static int shorts = 0; public static void WriteInConsole(string msg, int blank) { for (int i = 0; i < blank; i++) { Console.WriteLine(""); } Console.WriteLine(msg); for (int j = 0; j < blank; j++) { Console.WriteLine(""); } } public static void DrawDebugButtons() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown int num = 3; float num2 = 40f; float num3 = 45f; float num4 = 60f; float num5 = (float)Screen.height - (float)Screen.height * 0.025f; GUILayout.BeginArea(new Rect((float)Screen.width - num3 * (float)num - (float)Screen.width * 0.005f - num4 * 1.01f, num5, num3 * (float)num, num2)); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUIStyle val = new GUIStyle(GUI.skin.button); val.fontSize = 11; if (GUILayout.Button("Dbg 1", val, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Debug1(); } GUIStyle val2 = new GUIStyle(GUI.skin.button); val2.fontSize = 11; if (GUILayout.Button("Dbg 2", val2, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Debug2(); } GUIStyle val3 = new GUIStyle(GUI.skin.button); val3.fontSize = 11; if (GUILayout.Button("Dbg 3", val3, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Debug3(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); } public static void HSituationChange() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Object.FindObjectOfType<HSceneProc>(); HControl hCtrl = kPlug.hCtrl; HFlag hFlag = kPlug.hFlag; AnimationListInfo nowAnimationInfo = hFlag.nowAnimationInfo; string file = nowAnimationInfo.paramFemale.path.file; _ = nowAnimationInfo.paramFemale.path.assetpath; Console.WriteLine(""); Console.WriteLine("---------------------------------------------------------------------------"); Console.WriteLine("Change H posMode to " + ParserAnim.AssetPathToCategory(returnNameIfFailed: true)); Console.WriteLine("\tposition known as \"" + kTranslator.AnimName(file, hCtrl.AnimNmMapper) + "\""); Console.WriteLine("\t\tsource asset: " + ToolMisc.GetLastString(file, "/", rmvExt: true)); Console.WriteLine(""); EMode mode = hFlag.mode; Console.WriteLine("\tCurrent Emod : \"" + ((object)(EMode)(ref mode)).ToString() + "\""); Console.WriteLine("\t\tinterpretation as posMod : \"" + hCtrl.posMod.ToString() + "\""); if (hCtrl.posMod == Def.PoseMod.Service) { int kindHoushi = nowAnimationInfo.kindHoushi; string text = ""; switch (kindHoushi) { case 0: text = "Hand Service"; break; case 1: text = "Mouth Service"; break; case 2: text = "Breast Service"; break; } Console.WriteLine("\t\tservice typ : " + text); } Console.WriteLine("---------------------------------------------------------------------------"); } public static void DebugAnimList() { List<AnimationListInfo>[] allAnims = kFileParser.GetAllAnims(); Console.WriteLine("------------------------------------------------------------"); Console.WriteLine("\tListing ALL ANIMATION"); Console.WriteLine(""); for (int i = 0; i < allAnims.Length; i++) { for (int j = 0; j < allAnims[i].Count; j++) { string file = allAnims[i][j].paramFemale.path.file; Console.WriteLine("\tIn AssetPath" + allAnims[i][j].paramFemale.path.assetpath); Console.WriteLine("\t\tfileNm :" + kTranslator.AnimName(file, kPlug.hCtrl.AnimNmMapper)); } } Console.WriteLine("------------------------------------------------------------"); } public static void DebugCanvasChilds() { RectTransform[] componentsInChildren = ((Component)kPlug.hSprite).gameObject.GetComponentsInChildren<RectTransform>(); Console.WriteLine(""); Console.WriteLine("-----------------------"); Console.WriteLine("Debug UI VISIBLE CANVAS CHILDS"); Console.WriteLine("-----------------------"); RectTransform[] array = componentsInChildren; foreach (RectTransform val in array) { Console.WriteLine("\t" + ((Object)val).name); } Console.WriteLine(""); Console.WriteLine("-----------------------"); Console.WriteLine("Debug UI Parent Search"); Console.WriteLine("-----------------------"); string text = "NewHeroine"; array = componentsInChildren; foreach (RectTransform val2 in array) { if (((Object)val2).name == text) { Console.WriteLine("Search Button parents for" + ((Object)val2).name); RectTransform[] componentsInParent = ((Component)val2).GetComponentsInParent<RectTransform>(); foreach (RectTransform val3 in componentsInParent) { Console.WriteLine("\t" + ((Object)val3).name); } Console.WriteLine(""); } } } public static void DebugSiru(string name, byte[] flags) { Console.WriteLine("Debug Siru Flags on " + name); Console.WriteLine("-----------------------------------"); Console.WriteLine("\ton kao " + flags[0]); Console.WriteLine("\ton frontUp " + flags[1]); Console.WriteLine("\ton frontDown " + flags[2]); Console.WriteLine("\ton backUp " + flags[3]); Console.WriteLine("\ton backDown " + flags[4]); } public static void DebugPublicAvaibleAnimSates() { foreach (ChaControl item in kPlug.dealer.harem) { Console.WriteLine(" Avables animation states for " + kFileParser.GirlName(item)); Console.WriteLine("--------------------------------------------"); AnimationClip[] animationClips = ((ChaInfo)item).animBody.runtimeAnimatorController.animationClips; foreach (AnimationClip val in animationClips) { if (ToolMisc.GetStringAtIndex(((Object)val).name, "_", 1) == "M") { Console.WriteLine("\t" + ((Object)val).name); } } } } public static void TestMaterialProperties(Material mat, List<string> properties) { foreach (string property in properties) { if (mat.HasProperty(property)) { Console.WriteLine(((Object)mat).name + " has " + property + " properties"); } } } public static void DebugCLothesState(ChaControl c) { List<string> list = new List<string>(0) { "Top", "Bottom", "Bra", "Shorts", "Gloves", "Panst", "Socks", "InnerShoes", "OuterShoes" }; List<int> list2 = new List<int>(0); for (int i = 0; i < 9; i++) { Dictionary<byte, string> clothesStateKind = c.GetClothesStateKind(i); bool flag = false; try { foreach (KeyValuePair<byte, string> item in clothesStateKind) { WriteInConsole(item.Value, 0); } flag = true; } catch (Exception ex) { WriteInConsole(ex.Message, 0); flag = false; } if (flag) { list2.Add(i); } } Console.WriteLine("Clothes State Report for " + kFileParser.GirlName(c)); Console.WriteLine("------------------------------------------"); foreach (int item2 in list2) { Console.WriteLine(list[item2] + " byte State : " + ((ChaFile)((ChaInfo)c).chaFile).status.clothesState[item2]); } Console.WriteLine(""); } public static void ReportHcount(SnapShot.HCount count) { Console.WriteLine("\tAibu org count : " + count.aibuOrg); Console.WriteLine("\tKiss count : " + count.kiss); Console.WriteLine("\tvaginal cum count : " + count.sonyuOrg); Console.WriteLine("\tcondom in count : " + count.sonyuCondomInside); Console.WriteLine("\tcum in count : " + count.sonyuInside); Console.WriteLine("\tcum out count : " + count.sonyuOutside); Console.WriteLine("\tcum together count : " + count.sonyuSame); Console.WriteLine("\tcum together ( condom ) count : " + count.sonyuCondomSame); Console.WriteLine("\tcum inside anal ( condom ) count : " + count.sonyuAnalCondomInside); Console.WriteLine("\tanal cum count : " + count.sonyuAnalOrg); Console.WriteLine("\tcum inside anal count : " + count.sonyuAnalInside); Console.WriteLine("\tcum outside anal count : " + count.sonyuAnalOutside); Console.WriteLine("\tsame cum in anal :" + count.sonyuAnalSame); Console.WriteLine("\tanal cum together ( condom ) count : " + count.sonyuAnalCondomSame); Console.WriteLine(""); Console.WriteLine("\tselect massage"); for (int i = 0; i < count.selectMassages.Length; i++) { Console.WriteLine("\t\tat id" + i + " : " + count.selectMassages[i]); } Console.WriteLine(""); Console.WriteLine("\tarea play experience"); for (int j = 0; j < count.selectAreaGlb.Length; j++) { Console.WriteLine("\t\thave play with " + Def.areaNames[j] + " : " + count.selectAreaGlb[j] + " ( experience added on results )"); } Console.WriteLine(""); Console.WriteLine("\tselect hobby? ( float )" + count.selectHobby); Console.WriteLine(""); } public static void AllSavesStatsDebug() { foreach (Heroine heroine in Singleton<Game>.Instance.HeroineList) { DebugStats(kFileParser.GirlName(heroine)); } } public static void DebugStats(string girlName) { SnapShot.Stats value = new SnapShot.Stats(); if (kPlug.statManager.statsDic.TryGetValue(girlName, out value)) { Heroine val = kFileParser.FindSaveData(girlName); Console.WriteLine("----------------------------------------------"); Console.WriteLine("H Stat for " + girlName); Console.WriteLine("----------------------------------------------"); Console.WriteLine(""); Console.WriteLine("\tToday's dangerous ? " + value.riskyDay); Console.WriteLine("\tIs Virgin ? " + value.isVirgin); Console.WriteLine("\tAnal Never been use ? " + value.isAnalVirgin); Console.WriteLine("\tAllow Anal? " + GirlQA.AllowAnal(val)); Console.WriteLine("\tAllow Insert No Condom ? " + GirlQA.AllowNoCondom(val)); Console.WriteLine("\tIs Taked ? " + val.isTaked); Console.WriteLine(""); } } public static void FlagCount() { Count count = kPlug.hFlag.count; Console.WriteLine(""); Console.WriteLine("H Count in that session "); Console.WriteLine("____________________________________________"); Console.WriteLine("HProc EEexp " + ((object)(EExperience)(ref kPlug.hFlag.experience)).ToString()); Console.WriteLine("exp cheat " + kPlug.hFlag.expCheat); Console.WriteLine("HScene Proc Data State " + kPlug.hProc.dataH.state); Console.WriteLine(""); Console.WriteLine("\tAibu org count : " + count.aibuOrg); Console.WriteLine("\tKiss count : " + count.kiss); Console.WriteLine("\tNot Kiss count : " + count.notKiss); Console.WriteLine("\tNotPowerfull count : " + count.notPowerful); Console.WriteLine("\tDon't touch anal count : " + count.dontTouchAnal); Console.WriteLine("\tDon't touch massage count : " + count.dontTouchMassage); Console.WriteLine("\thoushi Outside count : " + count.houshiOutside); Console.WriteLine("\thoushi inside count : " + count.houshiInside); Console.WriteLine("\thoushi hand count : " + count.handFinish); Console.WriteLine("\tpaizuri finish count : " + count.paizuriFinish); Console.WriteLine("\tpaizuri name finish : " + count.paizurinameFinish); Console.WriteLine("\tpaizuri kuwae finish : " + count.paizurikuwaeFinish); Console.WriteLine("\tDrink count : " + count.houshiDrink); Console.WriteLine("\tVomit count : " + count.houshiVomit); Console.WriteLine("\tName finish count : " + count.nameFinish); Console.WriteLine("\tKuwae finish count : " + count.kuwaeFinish); Console.WriteLine("\tSplash count : " + count.splash); Console.WriteLine("\tvaginal cum count : " + count.sonyuOrg); Console.WriteLine("\tcondom in count : " + count.sonyuCondomInside); Console.WriteLine("\tcum in count : " + count.sonyuInside); Console.WriteLine("\tcum outside count : " + count.sonyuOutside); Console.WriteLine("\tcum together count : " + count.sonyuSame); Console.WriteLine("\tcum together ( condom ) count : " + count.sonyuCondomSame); Console.WriteLine("\tsonyu tare ( ? ) count : " + count.sonyuTare); Console.WriteLine("\tcum inside anal ( condom ) count : " + count.sonyuAnalCondomInside); Console.WriteLine("\tanal cum count : " + count.sonyuAnalOrg); Console.WriteLine("\tcum inside anal count : " + count.sonyuAnalInside); Console.WriteLine("\tcum outside anal count : " + count.sonyuAnalOutside); Console.WriteLine("\tsame cum in anal :" + count.sonyuAnalSame); Console.WriteLine("\tanal cum together ( condom ) count : " + count.sonyuAnalCondomSame); Console.WriteLine("\tAnal tare ? count : " + count.sonyuAnalTare); Console.WriteLine("\tnotCondom play count : " + count.notCondomPlay); Console.WriteLine("\tnot condom play count : " + count.notAnalPlay); Console.WriteLine("\tsonyu kokan play count : " + count.sonyuKokanPlay); Console.WriteLine("\tsonyu anal play count : " + count.sonyuAnalPlay); Console.WriteLine(""); Console.WriteLine("\tselect massage"); for (int i = 0; i < count.selectMassages.Length; i++) { Console.WriteLine("\t\tat id" + i + " : " + count.selectMassages[i]); } Console.WriteLine(""); Console.WriteLine("\tarea play experience"); for (int j = 0; j < count.selectAreas.Length; j++) { Console.WriteLine("\t\thave play with " + Def.areaNames[j] + " : " + count.selectAreas[j] + " ( experience added on results )"); } Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("\t select hobby? ( float )" + count.selectHobby); Console.WriteLine(""); } public static void GetAvaiblesFaceExpr() { for (int i = 0; i < 300; i++) { for (int j = 0; j < 20; j++) { for (int k = 0; k < 3; k++) { try { _ = kPlug.hProc.voice.faceLists[0].facelib[k][j][i]; avaiblesIndexs.Add(new int[3] { i, j, k }); Console.WriteLine("Confirm expr at faceId: " + i + " actionId: " + j + " voiceId: " + k); } catch (Exception) { } } } } } public static void TestFaceExpr() { if (avaiblesIndexs.Count > 0) { int key = avaiblesIndexs[listId][0]; int index = avaiblesIndexs[listId][1]; int index2 = avaiblesIndexs[listId][2]; FaceInfo val = kPlug.hProc.voice.faceLists[0].facelib[index2][index][key]; Console.WriteLine("\tList Id : " + listId + " faceId: " + key + " actionId: " + index + " voiceId: " + index2); Console.WriteLine("\tmouth infos :" + val.mouth); ChaControl obj = kPlug.dealer.harem[0]; obj.ChangeEyebrowPtn(val.eyebrow, true); obj.ChangeEyesPtn(val.eye, true); obj.ChangeMouthPtn(val.mouth, true); obj.tearsLv = (byte)val.tears; obj.ChangeHohoAkaRate(val.cheek); obj.HideEyeHighlight(!val.highlight); obj.ChangeEyesBlinkFlag(val.eyesblink); obj.ChangeEyesShaking(val.yure); obj.DisableShapeMouth(MathfEx.IsRange<int>(21, val.mouth, 22, true)); obj.ChangeTongueState((byte)1); ((ChaInfo)obj).animTongueEx.Play("WLoop"); listId++; } else { GetAvaiblesFaceExpr(); } } public static void DebugAnimationInfo(AnimationListInfo anim) { } public static void Debug1() { kPlug.hFlag.voice.playShorts[0] = shorts; kPlug.screenWriter.AddToRightMsg("Play Shorts " + shorts); shorts++; } public static void Debug2() { foreach (int category in kPlug.hProc.categorys) { WriteInConsole("Debug2: now pose contains category " + category, 0); } } public static void Debug3() { } public static void SpacePosInfos() { //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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)((CharaData)kPlug.hFlag.player).chaCtrl).gameObject.transform; _ = ((ChaInfo)((CharaData)kPlug.hFlag.player).chaCtrl).objBodyBone.transform; Transform transform2 = ((ChaInfo)((CharaData)kPlug.hFlag.player).chaCtrl).objRoot.transform; _ = ((Component)((CharaData)kPlug.heroine).chaCtrl).gameObject.transform; _ = ((ChaInfo)((CharaData)kPlug.heroine).chaCtrl).objRoot.transform; Console.WriteLine("--------------------------------"); Console.WriteLine(" Space Position Infos :"); Console.WriteLine("--------------------------------"); Console.WriteLine(" Player ChaControl"); Vector3 val = ((Component)transform).transform.localPosition; Console.WriteLine("\t position " + ((object)(Vector3)(ref val)).ToString()); val = ((Component)transform).transform.position; Console.WriteLine("\t world position " + ((object)(Vector3)(ref val)).ToString()); val = ((Component)transform).transform.localEulerAngles; Console.WriteLine("\t rotation " + ((object)(Vector3)(ref val)).ToString()); Console.WriteLine(" ...BodyBone"); val = ((Component)transform2).transform.localPosition; Console.WriteLine("\t position " + ((object)(Vector3)(ref val)).ToString()); } } } namespace kPlug.GirlBrain { public class Judge { public static Def.DailyLifeOpinion DailyLife(Heroine girl, SnapShot.Daily daily) { Def.DailyLifeOpinion result = Def.DailyLifeOpinion.WaitNothing; int favor = girl.favor; switch (daily.talkTime != 0 || daily.meetInH != 0 || (daily.confirmDate && daily.meetInH == 0)) { case false: if (girl.isGirlfriend) { if (favor != 0) { result = ((favor <= 50) ? Def.DailyLifeOpinion.WishToSeeYou : Def.DailyLifeOpinion.WantToSeeYou); } } else if (girl.relation >= 1 && favor != 0) { result = ((favor <= 75) ? Def.DailyLifeOpinion.WishToSeeYou : Def.DailyLifeOpinion.WantToSeeYou); } break; case true: { int talkTime = daily.talkTime; bool flag = daily.orgTogether != 0; if (!GirlQA.AllowAnal(girl)) { _ = daily.orgInTease; _ = daily.orgInPiston; } else { _ = daily.orgInTease; _ = daily.orgInPiston; _ = daily.orgInAnalPiston; } bool flag2 = daily.kissCount != 0; Def.DailySexOpinion opinionOnH = daily.opinionOnH; List<Def.DailySexOpinion> list = new List<Def.DailySexOpinion> { Def.DailySexOpinion.Ecstatic, Def.DailySexOpinion.Satisfied, Def.DailySexOpinion.FeedForToday, Def.DailySexOpinion.FeedForLife }; if (girl.isGirlfriend) { result = ((talkTime > 3 || flag2 || flag || list.Contains(opinionOnH)) ? Def.DailyLifeOpinion.HappyLover : Def.DailyLifeOpinion.HavSeenYou); } else if (girl.relation >= 1) { result = ((talkTime > 5 || list.Contains(opinionOnH)) ? Def.DailyLifeOpinion.HappyFriend : Def.DailyLifeOpinion.HavSeenYou); } if (daily.confirmDate) { result = (girl.isGirlfriend ? Def.DailyLifeOpinion.HappyLover : Def.DailyLifeOpinion.HappyFriend); } break; } } return result; } public static Def.DailySexOpinion DailySex(Heroine girl, SnapShot.Daily daily) { Def.DailySexOpinion opinion = Def.DailySexOpinion.DontWant; if (daily.reachExtase) { return Def.DailySexOpinion.Ecstatic; } int lewdness = girl.lewdness; _ = girl.favor; switch (daily.interactInH != 0 || daily.helpInOnanism) { case false: { int num = (girl.isGirlfriend ? 50 : 75); if (daily.cameToLook) { opinion = Def.DailySexOpinion.HavJustWatch; } else if (daily.meetInH > 0 && !GirlQA.IsVirgin(girl)) { opinion = Def.DailySexOpinion.Frustrate; } else { if (girl.relation < 1) { break; } if (GirlQA.IsVirgin(girl)) { if (girl.isGirlfriend || girl.favor > 50) { opinion = ((lewdness > num) ? ((lewdness != 100) ? Def.DailySexOpinion.WishToTry : Def.DailySexOpinion.WantToTry) : Def.DailySexOpinion.DontWant); } } else { opinion = ((lewdness <= num) ? Def.DailySexOpinion.NothingHappen : ((lewdness == 100) ? Def.DailySexOpinion.Want : Def.DailySexOpinion.Wish)); } } break; } case true: if (daily.havFirstTime) { ThoughtsAboutFirst(girl, daily, ref opinion); } else if (daily.raped) { opinion = Def.DailySexOpinion.Raped; } else { ThoughtsAboutSex(girl, daily, ref opinion); } ToolStats.SexTodayToTalkEvent(girl); break; } return opinion; } public static void ThoughtsAboutFirst(Heroine girl, SnapShot.Daily daily, ref Def.DailySexOpinion opinion) { _ = Def.personalityEnums[((CharaData)girl).personality]; GirlQA.IsRiskyDay(girl.MenstruationDay); _ = girl.isGirlfriend; bool bitch = ((CharaData)girl).parameter.attribute.bitch; _ = daily.kissCount; _ = daily.kissCount; _ = daily.inQuantity; _ = daily.inAnalQuantity; int forceNoCondom = daily.forceNoCondom; int forceAnal = daily.forceAnal; int num = (bitch ? 0 : 0); if (daily.opinionOnH == Def.DailySexOpinion.NiceFirst && (forceAnal + forceNoCondom > num || daily.raped)) { opinion = Def.DailySexOpinion.NiceFirstRuined; if (girl.isGirlfriend) { daily.breakMotive = Def.BreakMotive.FirstTimeTrauma; } } else if (forceAnal + forceNoCondom > num || daily.raped) { opinion = Def.DailySexOpinion.BadFirst; if (girl.isGirlfriend) { daily.breakMotive = Def.BreakMotive.FirstTimeTrauma; } } else { opinion = Def.DailySexOpinion.NiceFirst; } } public static float WeakSpotUsageTrigger() { if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { return 60f; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 99f; } return 10f; } public static int ToleranceToAbuse(Heroine girl) { bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool isGirlfriend = girl.isGirlfriend; if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { if (!isGirlfriend) { return 0; } return 1; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 0; } if (!bitch) { if (!isGirlfriend) { return 1; } return 2; } if (!isGirlfriend) { return 2; } return 3; } public static void DefineMinRequirement(Heroine girl, int kissCount, bool weakUsed, ref int[] satisfied, ref int[] ecstatic) { bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool isGirlfriend = girl.isGirlfriend; int num = (bitch ? 3 : 2); int num2 = ((!bitch) ? 1 : 2); int num3 = ((!bitch) ? 1 : 2); int num4 = (bitch ? 5 : 4); int num5 = (bitch ? 4 : 3); int num6 = ((!bitch) ? 1 : 2); int num7 = (bitch ? 5 : 4); if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { num = (bitch ? 6 : 5); num2 = (bitch ? 4 : 3); num3 = (bitch ? 4 : 3); num4 = (bitch ? 10 : 9); num5 = (bitch ? 6 : 5); num6 = (bitch ? 7 : 5); num7 = (bitch ? 12 : 10); } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { num = (bitch ? 9 : 8); num2 = (bitch ? 4 : 3); num3 = (bitch ? 6 : 5); num4 = (bitch ? 12 : 10); num5 = (bitch ? 9 : 8); num6 = (bitch ? 12 : 10); num7 = (bitch ? 16 : 15); } if (isGirlfriend && kissCount >= num6) { int num8 = 1; if (kPlug.config.girlRequirement != 0) { num8 = 1; } num = (int)Mathf.Clamp((float)(num - num8), 1f, float.PositiveInfinity); num2 = (int)Mathf.Clamp((float)(num2 - num8), 1f, float.PositiveInfinity); } if (isGirlfriend && kissCount >= num7) { int num9 = 1; if (kPlug.config.girlRequirement != 0) { num9 = 2; } num4 = (int)Mathf.Clamp((float)(num4 - num9), 1f, float.PositiveInfinity); num5 = (int)Mathf.Clamp((float)(num5 - num9), 1f, float.PositiveInfinity); } if (weakUsed) { int num10 = 1; if (kPlug.config.girlRequirement != 0) { num10 = 2; } num = (int)Mathf.Clamp((float)(num - num10), 1f, float.PositiveInfinity); num2 = (int)Mathf.Clamp((float)(num2 - num10), 1f, float.PositiveInfinity); num4 = (int)Mathf.Clamp((float)(num4 - num10), 1f, float.PositiveInfinity); num5 = (int)Mathf.Clamp((float)(num5 - num10), 1f, float.PositiveInfinity); } satisfied = new int[3] { num, num2, num3 }; ecstatic = new int[2] { num4, num5 }; } public static int DrinkRequiremenForEcsatse() { if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { return 8; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 10; } return 5; } public static int HelpForSatisfaction() { if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { return 1; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 2; } return 0; } public static void ThoughtsAboutSex(Heroine girl, SnapShot.Daily daily, ref Def.DailySexOpinion opinion) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 Def.Personality num = Def.personalityEnums[((CharaData)girl).personality]; bool flag = GirlQA.IsRiskyDay(girl.MenstruationDay); bool flag2 = (int)girl.HExperience == 3; if (girl.isVirgin) { _ = girl.isAnalVirgin; } else _ = 0; _ = girl.isGirlfriend; _ = ((CharaData)girl).parameter.attribute.likeGirls; int num2 = ToleranceToAbuse(girl); bool flag3 = num == Def.Personality.Yandere; bool num3 = GirlQA.AllowAnal(girl); bool flag4 = GirlQA.AllowNoCondom(girl); bool weakUsed = ((CharaData)girl).parameter.weakPoint != -1 && daily.touchs[((CharaData)girl).parameter.weakPoint] > WeakSpotUsageTrigger(); _ = daily.kissCount; _ = daily.kissCount; int orgInTease = daily.orgInTease; int orgInPiston = daily.orgInPiston; int orgInAnalPiston = daily.orgInAnalPiston; int orgTogether = daily.orgTogether; int num4 = (num3 ? (orgInTease + orgInPiston + orgInAnalPiston) : (orgInTease + orgInPiston)); int service = daily.service; int drinkQuantity = daily.drinkQuantity; int inQuantity = daily.inQuantity; _ = daily.inAnalQuantity; int helpCount = daily.helpCount; int forceAnal = daily.forceAnal; int forceNoCondom = daily.forceNoCondom; bool flag5 = forceAnal + forceNoCondom >= num2 && !flag3; int[] satisfied = new int[3]; int[] ecstatic = new int[2]; DefineMinRequirement(girl, daily.kissCount, weakUsed, ref satisfied, ref ecstatic); int num5 = satisfied[0]; int num6 = satisfied[1]; int num7 = satisfied[2]; int num8 = ecstatic[0]; int num9 = ecstatic[1]; bool flag6 = num4 < num5; bool flag7 = num4 >= num5 || orgTogether >= num6 || service >= num7 || helpCount > HelpForSatisfaction(); if (flag7 && flag6) { flag6 = false; } bool flag8 = (orgTogether >= num9 || num4 >= num8) && !flag5; if (flag8) { flag6 = false; flag7 = false; } if (!flag2 && flag && inQuantity > 0 && !flag8 && !flag4) { opinion = Def.DailySexOpinion.WorryOnPregnancy; } else if (flag6) { opinion = Def.DailySexOpinion.WantMore; } else if (flag7) { if (drinkQuantity > DrinkRequiremenForEcsatse() && ((CharaData)girl).parameter.attribute.harapeko) { opinion = Def.DailySexOpinion.Ecstatic; } else { opinion = Def.DailySexOpinion.Satisfied; } } else if (flag8) { opinion = Def.DailySexOpinion.Ecstatic; } } public static int WatchOpinion(Heroine girl, SnapShot.Daily daily) { int meanWatchLastH = daily.meanWatchLastH; if (daily.lookOnfirstTime) { if (meanWatchLastH > 0) { if (GirlQA.IsVirgin(girl)) { if (meanWatchLastH <= 2) { return -30; } return -31; } if (meanWatchLastH <= 3) { return -32; } return -33; } if (!GirlQA.IsVirgin(girl)) { return 31; } return 30; } if (!daily.lookOnfirstTime) { if (meanWatchLastH > ((!((CharaData)girl).parameter.attribute.bitch) ? 1 : 3)) { if (meanWatchLastH <= (((CharaData)girl).parameter.attribute.bitch ? 6 : 3)) { return -34; } return -35; } if (daily.goodWatchLastH != 0) { return 32; } } return 30; } public static int RelationQuality(Heroine girl, SnapShot.Daily daily) { if (daily.opinionOnH == Def.DailySexOpinion.HavJustWatch) { return WatchOpinion(girl, daily); } List<Def.DailySexOpinion> list = new List<Def.DailySexOpinion> { Def.DailySexOpinion.Frustrate, Def.DailySexOpinion.WorryOnPregnancy, Def.DailySexOpinion.BadFirst, Def.DailySexOpinion.NiceFirstRuined, Def.DailySexOpinion.Raped }; if (girl.isAnger || list.Contains(daily.opinionOnH)) { if (daily.opinionOnH == Def.DailySexOpinion.Frustrate) { return -1; } if (daily.opinionOnH == Def.DailySexOpinion.WorryOnPregnancy) { if (!GirlQA.AfraidToBePregnant(girl, daily)) { return -2; } return -3; } if (daily.opinionOnH == Def.DailySexOpinion.BadFirst) { if (daily.forceAnal + daily.forceNoCondom <= 2) { return -4; } return -5; } if (daily.opinionOnH == Def.DailySexOpinion.NiceFirstRuined) { if (daily.forceAnal + daily.forceNoCondom <= 2) { return -6; } return -7; } if (daily.opinionOnH == Def.DailySexOpinion.Raped) { return -8; } return -9; } if (daily.opinionOnH == Def.DailySexOpinion.NiceFirst) { int num = 2; if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { num = 4; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { num = 6; } if (daily.orgTogether < num) { return 21; } return 22; } if (daily.opinionOnLife == Def.DailyLifeOpinion.WaitNothing) { return 0; } if (daily.opinionOnLife == Def.DailyLifeOpinion.WantToSeeYou || daily.opinionOnLife == Def.DailyLifeOpinion.WishToSeeYou) { if (daily.opinionOnH == Def.DailySexOpinion.DontWant || daily.opinionOnH == Def.DailySexOpinion.NothingHappen) { if (daily.opinionOnLife != Def.DailyLifeOpinion.WishToSeeYou) { return 2; } return 1; } if (daily.opinionOnH == Def.DailySexOpinion.WishToTry || daily.opinionOnH == Def.DailySexOpinion.WantToTry) { if (daily.opinionOnH != Def.DailySexOpinion.WantToTry) { return 4; } return 3; } if (daily.opinionOnH == Def.DailySexOpinion.Wish || daily.opinionOnH == Def.DailySexOpinion.Want) { if (daily.opinionOnH != Def.DailySexOpinion.Wish) { return 6; } return 5; } } if (daily.opinionOnLife == Def.DailyLifeOpinion.HavSeenYou || daily.opinionOnLife == Def.DailyLifeOpinion.HappyFriend || daily.opinionOnLife == Def.DailyLifeOpinion.HappyLover) { if (daily.opinionOnH == Def.DailySexOpinion.DontWant) { if (daily.opinionOnLife != Def.DailyLifeOpinion.HavSeenYou) { return 8; } return 7; } if (daily.opinionOnH == Def.DailySexOpinion.WishToTry || daily.opinionOnH == Def.DailySexOpinion.WantToTry) { if (daily.opinionOnLife == Def.DailyLifeOpinion.HavSeenYou) { if (daily.opinionOnH != Def.DailySexOpinion.WishToTry) { return 10; } return 9; } if (daily.opinionOnH != Def.DailySexOpinion.WishToTry) { return 12; } return 11; } if (daily.opinionOnH == Def.DailySexOpinion.Want || daily.opinionOnH == Def.DailySexOpinion.Wish) { if (daily.opinionOnLife == Def.DailyLifeOpinion.HavSeenYou) { if (daily.opinionOnH != Def.DailySexOpinion.Wish) { return 14; } return 13; } if (daily.opinionOnH != Def.DailySexOpinion.Wish) { return 16; } return 15; } if (daily.opinionOnH == Def.DailySexOpinion.Frustrate) { return -2; } if (daily.opinionOnH == Def.DailySexOpinion.WantMore) { if (daily.opinionOnLife != Def.DailyLifeOpinion.HavSeenYou) { return 18; } return 17; } if (daily.opinionOnH == Def.DailySexOpinion.Satisfied) { return 19; } if (daily.opinionOnH == Def.DailySexOpinion.Ecstatic) { return 20; } } return 0; } public static int DayQuality(Heroine girl, SnapShot.Daily daily) { List<Def.DailyLifeOpinion> obj = new List<Def.DailyLifeOpinion> { Def.DailyLifeOpinion.WaitNothing, Def.DailyLifeOpinion.WantToSeeYou, Def.DailyLifeOpinion.WishToSeeYou }; Def.DailyLifeOpinion opinionOnLife = daily.opinionOnLife; Def.DailySexOpinion dailySexOpinion = daily.opinionOnH; if (obj.Contains(opinionOnLife)) { return 0; } bool isGirlfriend = girl.isGirlfriend; bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool flag = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere; int num = daily.orgInTease + daily.orgTogether; int forceNoCondom = daily.forceNoCondom; int forceAnal = daily.forceAnal; int num2 = (GirlQA.AllowAnal(girl) ? (daily.orgInTease + daily.orgInPiston + daily.orgInAnalPiston) : (daily.orgInTease + daily.orgInPiston)); switch (dailySexOpinion) { case Def.DailySexOpinion.BadFirst: if (forceNoCondom + forceAnal <= 2) { return -1; } return -2; case Def.DailySexOpinion.NiceFirstRuined: if (forceNoCondom + forceAnal <= 2) { return -3; } return -4; case Def.DailySexOpinion.WorryOnPregnancy: if (!GirlQA.AfraidToBePregnant(girl, daily)) { return -5; } return -6; case Def.DailySexOpinion.Frustrate: { if (daily.interactInH == 0) { return -7; } if (daily.frustrateTime >= num2) { int num3 = ((!isGirlfriend) ? ((bitch || flag) ? 2 : 3) : ((bitch || flag) ? 1 : 2)); if (daily.frustrateTime < num3) { return -8; } return -9; } int num4 = ((!isGirlfriend) ? ((bitch || flag) ? 7 : 5) : ((bitch || flag) ? 5 : 3)); if (num2 < num4) { int num5 = ((!isGirlfriend) ? ((bitch || flag) ? 4 : 3) : ((bitch || flag) ? 3 : 2)); if (num2 > num5) { return -10; } return -11; } dailySexOpinion = Def.DailySexOpinion.Satisfied; break; } } if (dailySexOpinion == Def.DailySexOpinion.Raped) { return -12; } if (daily.havFirstTime && forceNoCondom + forceAnal == 0) { switch (opinionOnLife) { case Def.DailyLifeOpinion.WaitNothing: case Def.DailyLifeOpinion.HavSeenYou: if (num < 3) { return 1; } return 2; case Def.DailyLifeOpinion.HappyFriend: case Def.DailyLifeOpinion.HappyLover: if (num < 3) { return 3; } return 4; } } if (opinionOnLife == Def.DailyLifeOpinion.HavSeenYou) { switch (dailySexOpinion) { case Def.DailySexOpinion.DontWant: case Def.DailySexOpinion.NothingHappen: return 5; case Def.DailySexOpinion.WishToTry: case Def.DailySexOpinion.WantToTry: return 6; case Def.DailySexOpinion.Wish: case Def.DailySexOpinion.Want: return 7; case Def.DailySexOpinion.WantMore: if (forceNoCondom + forceAnal == 0) { return 8; } if (forceAnal >= forceNoCondom) { return 9; } if (forceNoCondom > forceAnal) { return 10; } break; } if (dailySexOpinion == Def.DailySexOpinion.Satisfied) { if (forceNoCondom + forceAnal == 0) { return 11; } if (forceAnal >= forceNoCondom) { return 12; } if (forceNoCondom > forceAnal) { return 13; } } if (dailySexOpinion == Def.DailySexOpinion.Ecstatic) { if (forceNoCondom + forceAnal == 0) { return 14; } if (forceAnal >= forceNoCondom) { return 15; } if (forceNoCondom > forceAnal) { return 16; } } } if (opinionOnLife == Def.DailyLifeOpinion.HappyFriend || opinionOnLife == Def.DailyLifeOpinion.HappyLover) { switch (dailySexOpinion) { case Def.DailySexOpinion.DontWant: case Def.DailySexOpinion.NothingHappen: return 17; case Def.DailySexOpinion.WishToTry: case Def.DailySexOpinion.WantToTry: return 18; case Def.DailySexOpinion.Wish: case Def.DailySexOpinion.Want: return 19; case Def.DailySexOpinion.WantMore: if (forceNoCondom + forceAnal == 0) { return 20; } if (forceAnal >= forceNoCondom) { return 21; } if (forceNoCondom > forceAnal) { return 22; } break; } if (dailySexOpinion == Def.DailySexOpinion.Satisfied) { if (forceNoCondom + forceAnal == 0) { return 23; } if (forceAnal >= forceNoCondom) { return 24; } if (forceNoCondom > forceAnal) { return 25; } } if (dailySexOpinion == Def.DailySexOpinion.Ecstatic) { if (forceNoCondom + forceAnal == 0) { return 26; } if (forceAnal >= forceNoCondom) { return 27; } if (forceNoCondom > forceAnal) { return 28; } } } return 0; } public static void ApplySatisfactionMoods(Heroine girl, SnapShot.Daily daily, int rq, ref int lewdTweak, ref bool lewdOverride, ref int favorTweak, ref bool favorOverride) { bool isGirlfriend = girl.isGirlfriend; GirlQA.IsVirgin(girl); bool flag = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere || ((CharaData)girl).parameter.attribute.bitch; lewdTweak = 0; lewdOverride = false; favorTweak = 0; favorOverride = false; switch (daily.opinionOnH) { case Def.DailySexOpinion.HavJustWatch: if (daily.goodWatchLastH != 0) { lewdTweak = ((!isGirlfriend) ? ((rq != 32) ? (flag ? 30 : 20) : (flag ? 100 : 5)) : ((rq != 32) ? (flag ? 50 : 25) : (flag ? 100 : 75))); favorTweak = (isGirlfriend ? 10 : 5); } break; case Def.DailySexOpinion.WishToTry: lewdTweak = ((!isGirlfriend) ? (flag ? 50 : 25) : (flag ? 75 : 50)); favorTweak = (isGirlfriend ? 20 : 10); break; case Def.DailySexOpinion.WantToTry: lewdTweak = (isGirlfriend ? 100 : (flag ? 100 : 75)); favorTweak = (isGirlfriend ? 30 : 20); break; case Def.DailySexOpinion.NiceFirst: lewdTweak = ((rq == 22) ? 75 : 50); lewdOverride = true; favorTweak = ((rq == 22) ? 100 : ((!isGirlfriend) ? (flag ? 75 : 50) : (flag ? 100 : 75))); break; case Def.DailySexOpinion.WantMore: lewdTweak = 95; lewdOverride = true; favorTweak = ((!isGirlfriend) ? (flag ? (-10) : (-5)) : (flag ? (-20) : (-10))); break; case Def.DailySexOpinion.Satisfied: lewdTweak = ((!isGirlfriend) ? (flag ? 90 : 70) : (flag ? 95 : 85)); lewdOverride = true; if (daily.breakMotive != 0) { daily.breakMotive = Def.BreakMotive.Null; } break; case Def.DailySexOpinion.Ecstatic: lewdTweak = 999; lewdOverride = true; favorTweak = 100; favorOverride = true; if (daily.breakMotive != 0) { daily.breakMotive = Def.BreakMotive.Null; } break; } if (lewdTweak == 0 && favorTweak == 0) { return; } if (kPlug.debug) { Console.WriteLine(" ToolStats : Applying Good Relation to " + daily.girlName + " (" + daily.opinionOnH.ToString() + ")"); } if (lewdTweak != 0) { girl.lewdness = (lewdOverride ? lewdTweak : Mathf.Clamp(girl.lewdness + lewdTweak, 0, 100)); if (kPlug.debug) { Console.WriteLine("\tLewdness , new value " + girl.lewdness); } } if (favorTweak != 0) { girl.favor = (favorOverride ? favorTweak : Mathf.Clamp(girl.favor + favorTweak, 0, 100)); if (kPlug.debug) { Console.WriteLine("\tFavor, new value " + girl.favor); } } } public static void ApplyBadMoods(Heroine girl, SnapShot.Daily daily, int rq, ref int lewdTweak, ref int favorTweak, ref int angerIncr) { Def.Personality personality = Def.personalityEnums[((CharaData)girl).personality]; lewdTweak = 0; favorTweak = 0; angerIncr = 0; bool isGirlfriend = girl.isGirlfriend; bool flag = personality == Def.Personality.Yandere; bool flag2 = flag || personality == Def.Personality.Maternal; switch (rq) { case -1: lewdTweak = ((!isGirlfriend) ? (flag ? 30 : 20) : (flag ? 50 : 30)); favorTweak = (isGirlfriend ? (-25) : (-15)); if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { favorTweak = (isGirlfriend ? (-50) : (-30)); } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { favorTweak = (isGirlfriend ? (-100) : (-80)); } if (girl.favor == 0) { angerIncr = (isGirlfriend ? 75 : 50); if (kPlug.config.girlRequirement != 0) { angerIncr = (isGirlfriend ? 100 : 75); } } break; case -2: lewdTweak = ((!isGirlfriend) ? (flag2 ? 25 : (-75)) : (flag2 ? 50 : (-50))); favorTweak = ((!isGirlfriend) ? ((!flag2) ? (-75) : 0) : ((!flag2) ? (-50) : 0)); if (!flag2) { angerIncr = (girl.isGirlfriend ? 10 : 50); } break; case -3: lewdTweak = ((!isGirlfriend) ? (flag2 ? (-100) : (-100)) : (flag2 ? 100 : (-100))); favorTweak = ((!isGirlfriend) ? (flag2 ? (-50) : (-100)) : (flag2 ? (-25) : (-50))); if (kPlug.config.girlRequirement != 0) { favorTweak = -100; } if (!flag2) { angerIncr = (isGirlfriend ? 50 : 100); } break; case -8: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-90))); favorTweak = ((!isGirlfriend) ? (flag ? 75 : (-100)) : (flag ? 100 : (-90))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 75 : 0) : ((!flag) ? 50 : 0)); if (kPlug.config.girlRequirement != 0) { angerIncr = ((!isGirlfriend) ? ((!flag) ? 150 : 0) : ((!flag) ? 75 : 0)); } break; case -30: lewdTweak = ((!isGirlfriend) ? (flag ? 75 : (-90)) : (flag ? 75 : (-75))); favorTweak = ((!isGirlfriend) ? ((!flag) ? (-75) : 0) : ((!flag) ? (-50) : 0)); angerIncr = ((!isGirlfriend) ? ((!flag) ? 50 : 0) : ((!flag) ? 25 : 0)); break; case -31: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-90))); favorTweak = ((!isGirlfriend) ? (flag ? 75 : (-100)) : (flag ? 100 : (-90))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 75 : 0) : ((!flag) ? 50 : 0)); if (isGirlfriend && girl.favor < 99 && !flag) { daily.breakMotive = Def.BreakMotive.VisualTrauma; } break; case -32: lewdTweak = ((!isGirlfriend) ? (flag ? 50 : (-50)) : (flag ? 50 : (-25))); favorTweak = ((!isGirlfriend) ? (flag ? 50 : (-20)) : (flag ? 50 : (-40))); break; case -33: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-90)) : (flag ? 100 : (-75))); favorTweak = ((!isGirlfriend) ? (flag ? 100 : (-50)) : (flag ? 100 : (-75))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 100 : 0) : ((!flag) ? 50 : 0)); if (isGirlfriend && girl.favor < 99 && !flag) { daily.breakMotive = Def.BreakMotive.DiscoverWhoYouAre; } break; case -34: lewdTweak = ((!isGirlfriend) ? (flag ? 75 : (-75)) : (flag ? 75 : (-50))); favorTweak = ((!isGirlfriend) ? (flag ? 10 : (-10)) : (flag ? 20 : (-20))); break; case -35: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-100))); favorTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-75))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 75 : 0) : ((!flag) ? 50 : 0)); if (isGirlfriend && girl.favor < 90 && !flag) { daily.breakMotive = Def.BreakMotive.VisualTrauma; } break; } if (lewdTweak == 0 && favorTweak == 0 && angerIncr == 0) { return; } if (kPlug.debug) { Console.WriteLine(" ToolStats : Applying Bad Relation to " + daily.girlName + " (" + daily.opinionOnH.ToString() + ")"); } if (lewdTweak != 0) { girl.lewdness = Mathf.Clamp(girl.lewdness + lewdTweak, 0, 100); if (kPlug.debug) { Console.WriteLine("\tadd " + lewdTweak + " to lewdness , new value " + girl.lewdness); } } if (favorTweak != 0) { girl.favor = Mathf.Clamp(girl.favor + favorTweak, 0, 100); if (kPlug.debug) { Console.WriteLine("\tadd " + favorTweak + " to favor, new value " + girl.favor); } } if (angerIncr != 0) { girl.anger = Mathf.Clamp(girl.anger + angerIncr, 0, 100); girl.isAnger = true; if (kPlug.debug) { Console.WriteLine("\t\"IsAnger\" add " + angerIncr + " to anger, new value " + girl.anger); } } } public static void ApplyBadFirstMoods(Heroine girl, SnapShot.Daily daily, ref int lewdTweak, ref int favorTweak, ref int angerIncr) { if (Def.personalityEnums[((CharaData)girl).personality] != Def.Personality.Yandere) { bool flag = GirlQA.IsRiskyDay(girl.MenstruationDay); _ = girl.isGirlfriend; bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool num = daily.kissCount != 0; int inQuantity = daily.inQuantity; int forceNoCondom = daily.forceNoCondom; int forceAnal = daily.forceAnal; int num2 = 15; if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { num2 = 20; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { num2 = 30; } angerIncr = 100 + forceNoCondom * num2 + forceAnal * num2; if (forceNoCondom > 0) { angerIncr += inQuantity * (flag ? 20 : 10); } favorTweak = (int)((float)angerIncr * (bitch ? 0.75f : 1f)); if (num) { favorTweak = (int)((float)favorTweak * 0.75f); } favorTweak = Mathf.Clamp(favorTweak, 0, 100); if (daily.raped) { favorTweak = 100; angerIncr = 999; } favorTweak *= -1; girl.isAnger = true; girl.anger = Mathf.Clamp(girl.anger + angerIncr, 0, 999); girl.favor = Mathf.Clamp(girl.favor + favorTweak, 0, 100); lewdTweak = 0; girl.lewdness = lewdTweak; } } } public class GirlQA { public static List<string> ExpStates = new List<string> { "0:First Time", "1:Newbie", "2:Used To", "3:Skilled", "4:Expert" }; public static bool IsRiskyDay(int day) { byte[] array = new byte[15] { 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }; if (array.Length <= day) { return false; } if (array[day] == 0) { return false; } if (array[day] == 1) { return true; } return false; } public static bool IsVirgin(Heroine girl) { if (girl.isVirgin) { return girl.isAnalVirgin; } return false; } public static bool WantToBreakToday(SnapShot.Daily daily) { Heroine val = kFileParser.FindSaveData(daily.girlName); if (!val.isGirlfriend || daily.isFixChara) { return false; } if (FeelAbused(val, daily)) { daily.breakMotive = Def.BreakMotive.AnalTrauma; } if (FeelSpoiled(val, daily)) { daily.breakMotive = Def.BreakMotive.Spoiled; } Def.Personality personality = Def.personalityEnums[((CharaData)val).personality]; bool flag = personality == Def.Personality.Yandere || personality == Def.Personality.Maternal; if (daily.opinionOnH == Def.DailySexOpinion.WorryOnPregnancy && !flag && AfraidToBePregnant(val, daily) && val.favor < 49) { daily.breakMotive = Def.BreakMotive.PregnancyStress; } return daily.breakMotive != Def.BreakMotive.Null; } public static bool AfraidToBePregnant(Heroine girl, SnapShot.Daily daily) { bool bitch = ((CharaData)girl).parameter.attribute.bitch; int num = ((!girl.isGirlfriend) ? (bitch ? 10 : 5) : (bitch ? 15 : 10)); if (daily.inQuantity > num) { return true; } return false; } public static bool FeelAbused(Heroine girl, SnapShot.Daily daily) { bool flag = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere; bool havEveningSex = daily.havEveningSex; if (daily.opinionOnH == Def.DailySexOpinion.Ecstatic || flag || havEveningSex) { return false; } int num = (((CharaData)girl).parameter.attribute.bitch ? 4 : 2); if (daily.forceAnal >= num) { return true; } return false; } public static bool FeelSpoiled(Heroine girl, SnapShot.Daily daily) { bool num = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere; bool bitch = ((CharaData)girl).parameter.attribute.bitch; int num2 = (num ? 1 : (bitch ? 2 : 3)); if (daily.frustrateTime > num2 && daily.interactInH == 0 && girl.favor != 100) { return true; } return false; } public static Def.Relation Relation(Heroine girl) { if (girl.isTeacher) { if (!girl.isVirgin || !girl.isAnalVirgin) { return Def.Relation.PrivateTeacher; } return Def.Relation.Teacher; } if (IsStoryHeroine(girl)) { if (!girl.isTaked) { return Def.Relation.StoryGirl; } return Def.Relation.GirlFriend; } if (girl.isGirlfriend) { return Def.Relation.GirlFriend; } if (girl.relation == 0) { if (!IsVirgin(girl)) { return Def.Relation.SexFriend; } return Def.Relation.JustSpoke; } if (girl.relation > 0) { if (!IsVirgin(girl)) { return Def.Relation.SexFriend; } return Def.Relation.Friend; } return Def.Relation.NotMeet; } public static string RelationToStr(Def.Relation relation) { bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); switch (relation) { case Def.Relation.JustSpoke: if (flag) { return ToolTranslation.GetUItxt("TodayRelJustMeet"); } return "Just spoke a bit"; case Def.Relation.Friend: return Diary.StatName("StatNmFriend"); case Def.Relation.Teacher: return Diary.StatName("StatNmTeach"); case Def.Relation.SexFriend: return Diary.StatName("StatNmSexFriend"); case Def.Relation.GirlFriend: return Diary.StatName("StatNmGirlfriend"); case Def.Relation.Ex: return Diary.StatName("StatNmEx"); case Def.Relation.StoryGirl: return Diary.StatName("StatNmStoryHer"); case Def.Relation.PrivateTeacher: return Diary.StatName("StatNmPrvtTeach"); default: if (flag) { return ToolTranslation.GetUItxt("TodayRelNotMeet"); } return "Never met You"; } } public static string Experience(Heroine girl, ref bool atMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Invalid comparison between Unknown and I4 HExperienceKind hExperience = girl.HExperience; bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? ExpStates : ToolTranslation.GetIndexedListFromTxt("StatsExpStates", 1)); if ((int)hExperience == 0) { return ToolMisc.GetStringAtIndex(list[0], ":", 2); } if ((int)hExperience == 1) { if (girl.countKokanH + girl.countAnalH + girl.houshiExp < 150f) { return ToolMisc.GetStringAtIndex(list[1], ":", 2); } if (girl.countKokanH + girl.countAnalH + girl.houshiExp < 250f) { return ToolMisc.GetStringAtIndex(list[2], ":", 2); } return ToolMisc.GetStringAtIndex(list[3], ":", 2); } if ((int)hExperience == 2 || (int)hExperience == 3) { atMax = true; return ToolMisc.GetStringAtIndex(list[4], ":", 2); } return ""; } public static string Experience(SnapShot.Stats girl, ref bool atMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Invalid comparison between Unknown and I4 HExperienceKind exp = girl.exp; bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? ExpStates : ToolTranslation.GetIndexedListFromTxt("StatsExpStates", 1)); if ((int)exp == 0) { return ToolMisc.GetStringAtIndex(list[0], ":", 2); } if ((int)exp == 1) { if (girl.vaginalExp + girl.analExp + girl.houshiExp < 150f) { return ToolMisc.GetStringAtIndex(list[1], ":", 2); } if (girl.vaginalExp + girl.analExp + girl.houshiExp < 250f) { return ToolMisc.GetStringAtIndex(list[2], ":", 2); } return ToolMisc.GetStringAtIndex(list[3], ":", 2); } if ((int)exp == 2 || (int)exp == 3) { atMax = true; return ToolMisc.GetStringAtIndex(list[4], ":", 2); } return ""; } public static bool IsHExpert(Heroine sav) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if ((int)sav.HExperience == 2 || (int)sav.HExperience == 3) { return true; } return false; } public static string WeakSpot(Heroine girl, bool allowTranslation) { return WeakSpot(((CharaData)girl).weakPoint, allowTranslation); } public static string WeakSpot(SnapShot.Stats girl) { return WeakSpot(girl.weakSpot, allowTranslation: true); } public static string WeakSpot(int val, bool allowTranslation) { bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language) && allowTranslation; if (val == -1) { if (flag) { return ToolTranslation.GetUItxt("NoWeakSpot"); } return "None"; } List<string> list = new List<string>(); list = ((!flag) ? new List<string> { "0:Kiss", "1:Sensitive Breast", "2:Sensitive Pussy", "3:Ticklish Ass", "4:Butt Caress", "5:Sensitive Tits" } : ToolTranslation.GetIndexedListFromTxt("weakSpots", 1)); return ToolMisc.GetStringAtIndex(list[val], ":", 2); } public static bool IsWeakSpot(string girlName, int val) { if ((Object)(object)kPlug.statManager == (Object)null) { return false; } SnapShot.Stats stat = kPlug.statManager.GetStat(girlName); if (stat != null && stat.weakSpot == val) { return true; } return false; } public static bool AllowKiss(Heroine girl) { if (!girl.isGirlfriend && !((CharaData)girl).denial.kiss) { if (!((CharaData)girl).denial.kiss) { return girl.hAreaExps[0] != 0f; } return false; } return true; } public static bool AllowKiss(SnapShot.Stats girl) { if (!girl.isGirlFriend && !girl.kissOk) { if (!girl.kissOk) { return girl.areaExp[0] != 0f; } return false; } return true; } public static bool AllowAnal(Heroine girl) { if (!((CharaData)girl).denial.anal) { if (!((CharaData)girl).denial.anal) { return girl.hAreaExps[3] == 100f; } return false; } return true; } public static bool AllowAnal(SnapShot.Stats girl) { if (!girl.analOk) { if (!girl.analOk) { return girl.areaExp[3] == 100f; } return false; } return true; } public static bool AllowNoCondom(Heroine girl) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 if (((CharaData)girl).denial.notCondom) { return true; } bool flag = (int)HFlag.GetMenstruation(girl.MenstruationDay) == 0 || girl.countNamaInsert >= 5; if (girl.fixCharaID < 0 && (int)girl.HExperience == 2 && flag) { return true; } if ((int)girl.HExperience == 2 && ((girl.relation == 1 && girl.favor >= 80) || girl.relation == 2) && flag) { return true; } if ((int)girl.HExperience == 3) { if (flag) { return true; } if (girl.countNamaInsert >= 3) { return true; } } return false; } public static bool AllowNoCondom(SnapShot.Stats girl) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 if (girl.insertOk) { return true; } bool flag = !girl.riskyDay || girl.namaInsert >= 5; if ((int)girl.exp == 2 && flag) { return true; } if ((int)girl.exp == 2 && ((girl.relation == 1 && girl.favor >= 80) || girl.relation == 2) && flag) { return true; } if ((int)girl.exp == 3) { if (flag) { return true; } if (girl.namaInsert >= 3) { return true; } } return false; } public static bool AllowHardTease(Heroine girl) { if (!((CharaData)girl).denial.aibu) { return girl.hAreaExps[3] != 0f; } return true; } public static bool AllowHardTease(SnapShot.Stats girl) { if (!girl.touchOk) { return girl.areaExp[3] != 0f; } return true; } public static bool AllowToyOnTits(Heroine girl) { if (!((CharaData)girl).denial.massage) { return girl.massageExps[1] != 0f; } return true; } public static bool AllowToyOnTits(SnapShot.Stats girl) { if (!girl.massageOk) { return girl.massageExp[1] != 0f; } return true; } public static bool NeedGumWithBuddy(AI_Public ai, AI_Public buddyAi) { if (!kPlug.tourInFreeH && !ai.isCardGuest && !buddyAi.isFutaBoy) { SnapShot.Daily daily = kPlug.statManager.GetDaily(ai.charaName); SnapShot.Stats stat = kPlug.statManager.GetStat(ai.charaName); bool flag = daily.reachExtase && kPlug.config.extaseBreakDenials; if (daily != null && stat != null) { if (!AllowNoCondom(stat)) { return !flag; } return false; } } return false; } public static bool AnalWithBuddy(AI_Public ai, AI_Public buddyAi) { if (!kPlug.tourInFreeH && !ai.isCardGuest && !buddyAi.isFutaBoy) { SnapShot.Daily daily = kPlug.statManager.GetDaily(ai.charaName); SnapShot.Stats stat = kPlug.statManager.GetStat(ai.charaName); if (daily != null && stat != null) { if (!AllowAnal(stat)) { if (daily.reachExtase) { return kPlug.config.extaseBreakDenials; } return false; } return true; } } return true; } public static string GetAnswerToKiss(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:Lovers do kiss", "1:Yes...", "2:Yes!", "3:No...", "4:Yes Kiss me!", "5:Want First" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerKiss", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToKiss(Heroine girl, ref bool addict) { if (girl.hAreaExps[0] == 100f) { addict = true; } if (girl.isGirlfriend) { return GetAnswerToKiss(0); } if (girl.hAreaExps[0] != 0f) { if (((CharaData)girl).denial.kiss) { return GetAnswerToKiss(2); } return GetAnswerToKiss(1); } if (((CharaData)girl).denial.kiss) { if (!girl.isKiss) { return GetAnswerToKiss(5); } return GetAnswerToKiss(4); } return GetAnswerToKiss(3); } public static string AnswerToKiss(SnapShot.Stats girl, ref bool addict) { if (girl.areaExp[0] == 100f) { addict = true; } if (girl.isGirlFriend) { return GetAnswerToKiss(0); } if (girl.areaExp[0] != 0f) { if (girl.kissOk) { return GetAnswerToKiss(2); } return GetAnswerToKiss(1); } if (girl.kissOk) { if (!girl.isKiss) { return GetAnswerToKiss(5); } return GetAnswerToKiss(4); } return GetAnswerToKiss(3); } public static string GetAnswerToAibu(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:Yes...Be kind", "1:Foundle Me!", "2:Ticklish", "3:Do Anything", "4:Love Anal Tease" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerAibu", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToAibu(Heroine girl, ref bool addict) { if (girl.hAreaExps[3] == 100f) { addict = true; } if (!((CharaData)girl).denial.aibu) { if (girl.hAreaExps[3] != 0f) { if (girl.hAreaExps[3] != 100f) { return GetAnswerToAibu(2); } return GetAnswerToAibu(1); } return GetAnswerToAibu(0); } if (girl.hAreaExps[3] != 0f) { if (girl.hAreaExps[3] != 100f) { return GetAnswerToAibu(1); } return GetAnswerToAibu(4); } return GetAnswerToAibu(3); } public static string AnswerToAibu(SnapShot.Stats girl, ref bool addict) { if (girl.areaExp[3] == 100f) { addict = true; } if (!girl.touchOk) { if (girl.areaExp[3] != 0f) { if (girl.areaExp[3] != 100f) { return GetAnswerToAibu(2); } return GetAnswerToAibu(1); } return GetAnswerToAibu(0); } if (girl.areaExp[3] != 0f) { if (girl.areaExp[3] != 100f) { return GetAnswerToAibu(1); } return GetAnswerToAibu(4); } return GetAnswerToAibu(3); } public static string GetAnswerToAnal(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:No Way! That won't fit...", "1:Why Not? Curious about...", "2:You may have force me, but stop that!", "3:Slaved to your wish!", "4:Not a fan, but obedient!", "5:Totally Addicted!", "6:Yes, enjoy the feeling!" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerAnal", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToAnal(Heroine girl, ref bool addict) { if (girl.isAnalVirgin) { if (((CharaData)girl).denial.anal) { return GetAnswerToAnal(1); } return GetAnswerToAnal(0); } if (!((CharaData)girl).denial.anal && girl.hAreaExps[3] != 100f) { return GetAnswerToAnal(2); } if (!((CharaData)girl).denial.anal) { if (girl.countAnalH == 100f) { addict = true; } if (girl.countAnalH != 100f) { return GetAnswerToAnal(4); } return GetAnswerToAnal(3); } if (girl.countAnalH == 100f) { addict = true; } if (girl.countAnalH != 100f) { return GetAnswerToAnal(6); } return GetAnswerToAnal(5); } public static string AnswerToAnal(SnapShot.Stats girl, ref bool addict) { if (girl.isAnalVirgin) { if (girl.analOk) { return GetAnswerToAnal(1); } return GetAnswerToAnal(0); } if (!girl.analOk && girl.areaExp[3] != 100f) { return GetAnswerToAnal(2); } if (!girl.analOk) { if (girl.analExp == 100f) { addict = true; } if (girl.analExp != 100f) { return GetAnswerToAnal(4); } return GetAnswerToAnal(3); } if (girl.analExp == 100f) { addict = true; } if (girl.analExp != 100f) { return GetAnswerToAnal(6); } return GetAnswerToAnal(5); } public static string GetAnswerToCondom(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:I beg you, put a gum!", "1:Doesn't care at all...", "2:Make me a Baby!", "3:Forget About That!", "4:Today's dangerous...put one please", "5:That's feel better without!", "6:Danger day! No Way Without!", "7:Conforted when you wear it", "8:Baby! Baby! Baby!", "9:Prefers Genuine Sensation!", "10:Danger day, but don't care", "11:No need for that useless thing..." } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerGum", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToCondom(Heroine girl, ref bool addict) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if (girl.isVirgin) { if (((CharaData)girl).denial.notCondom) { return GetAnswerToCondom(1); } return GetAnswerToCondom(0); } bool flag = IsRiskyDay(girl.MenstruationDay); if ((int)girl.HExperience == 3) { addict = true; if (!flag) { return GetAnswerToCondom(3); } return GetAnswerToCondom(2); } int countNamaInsert = girl.countNamaInsert; bool flag2 = girl.countKokanH == 100f; if (!((CharaData)girl).denial.notCondom) { if (countNamaInsert >= 10 || flag2) { if (!flag) { return GetAnswerToCondom(5); } return GetAnswerToCondom(4); } if (!flag) { return GetAnswerToCondom(7); } return GetAnswerToCondom(6); } if (countNamaInsert >= 10 || flag2) { addict = true; if (!flag) { return GetAnswerToCondom(9); } return GetAnswerToCondom(8); } if (!flag) { return GetAnswerToCondom(11); } return GetAnswerToCondom(10); } public static string AnswerToCondom(SnapShot.Stats girl, ref bool addict) { if (girl.isVirgin) { if (girl.insertOk) { return GetAnswerToCondom(1); } return GetAnswerToCondom(0); } bool riskyDay = girl.riskyDay; int namaInsert = girl.namaInsert; bool flag = girl.vaginalExp == 100f; if (!girl.insertOk) { if (namaInsert >= 10 || flag) { if (!riskyDay) { return GetAnswerToCondom(5); } return GetAnswerToCondom(4); } if (!riskyDay) { return GetAnswerToCondom(7); } return GetAnswerToCondom(6); } if (namaInsert >= 10 || flag) { addict = true; if (!riskyDay) { return GetAnswerToCondom(9); } return GetAnswerToCondom(8); } if (!riskyDay) { return GetAnswerToCondom(11); } return GetAnswerToCondom(10); } public static string GetAnswerToTitsToy(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:Don't use that!", "1:Weird Sensation", "2:Sounds fun...", "3:So Good!", "4:Enjoy it" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerTitsToy", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToTitsToy(Heroine girl, ref bool addict) { float num = girl.massageExps[0] + girl.massageExps[1]; if (num == 200f) { addict = true; } if (!((CharaData)girl).denial.massage) { if (girl.massageExps[1] != 0f) { return GetAnswerToTitsToy(1); } return GetAnswerToTitsToy(0); } if (num != 0f) { if (num != 200f) { return GetAnswerToTitsToy(4); } return GetAnswerToTitsToy(3); } return GetAnswerToTitsToy(2); } public static string AnswerToTitsToy(SnapShot.Stats girl, ref bool addict) { float num = girl.massageExp[0] + girl.massageExp[1]; if (num == 200f) { addict = true; } if (!girl.massageOk) { if (girl.massageExp[1] != 0f) { return GetAnswerToTitsToy(1); } return GetAnswerToTitsToy(0); } if (num != 0f) { if (num != 200f) { return GetAnswerToTitsToy(4); } return GetAnswerToTitsToy(3); } return GetAnswerToTitsToy(2); } public static string ComeToYourRoom(Heroine sav) { int myRoomCount = sav.myRoomCount; bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); string text = ((myRoomCount == 0) ? ((!flag) ? "Never seen your room" : (ToolTranslation.GetUItxt("StatTxtNeverInRoom") + " ")) : ((!flag) ? "Came to your room " : (ToolTranslation.GetUItxt("StatTxtCameToRoom") + " "))); if (myRoomCount == 0) { return text; } return text + myRoomCount + " " + Diary.TimeCountWord(myRoomCount); } public static bool HaveHExp(Heroine girl) { float num = girl.houshiExp + girl.countKokanH + girl.countAnalH; for (int i = 0; i < girl.hAreaExps.Length; i++) { num += girl.hAreaExps[i]; } for (int j = 0; j < girl.massageExps.Length; j++) { num += girl.massageExps[j]; } return num != 0f; } public static string Club(Heroine sav, bool allowTranslation) { if (kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language) && allowTranslation) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("Clubs", 1)[((CharaData)sav).clubActivities], ":", 2); } return Def.clubs[((CharaData)sav).clubActivities]; } public static string BloodTyp(Heroine sav) { return Def.bloodtyps[((CharaData)sav).bloodType]; } public static string Personality(Heroine sav) { if (kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language)) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("personalities", 1)[((CharaData)sav).personality], ":", 2); } return Def.personalities[((CharaData)sav).personality]; } public static string Personality(int id) { if (kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language)) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("personalities", 1)[id], ":", 2); } return Def.personalities[id]; } public static bool IsStoryHeroine(Heroine sav) { return kTranslator.StoryHeroineNames().Contains(kFileParser.GirlName(sav)); } public static string GetClasses(Heroine girl) { return ((CharaData)girl).schoolClass switch { -1 => "Story", 0 => "1 - 1", 1 => "2 - 1", 2 => "2 - 2", 3 => "3 - 1", _ => string.Empty, }; } public static string TeacherDiscipline(Heroine sav) { string text = kFileParser.GirlName(sav); bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); switch (text) { case "Nonoka Sakurai": if (flag) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("TeachDiscipline", 1)[0], ":", 2); } return "Homeroom Teacher"; case "Lina Roberts": case "Rina Labelle": if (flag) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("TeachDiscipline", 1)[1], ":", 2); } return "Academy Nurse"; case "Reina Hashimoto": if (flag) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("TeachDiscipline", 1)[2], ":", 2); } return "Mathematics Teacher"; default: return string.Empty; } } public static List<string> Traits(Heroine sav, bool allowTranslation) { List<string> list = new List<string>(); bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language) && allowTranslation; List<string> list2 = new List<string>(); if (flag) { list2 = ToolTranslation.GetIndexedListFromTxt("AllTraits", 1); } Attribute attribute = ((CharaData)sav).parameter.attribute; if (attribute.hinnyo) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[0], ":", 2) : "Small Bladder"); } if (attribute.harapeko) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[1], ":", 2) : "Always Hungry"); } if (attribute.donkan) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[2], ":", 2) : "Insensitive"); } if (attribute.choroi) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[3], ":", 2) : "Easy Going"); } if (attribute.bitch) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[4], ":", 2) : "Horny"); } if (attribute.mutturi) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[5], ":", 2) : "Taciturn"); } if (attribute.dokusyo) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[6], ":", 2) : "Bookworm"); } if (attribute.ongaku) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[7], ":", 2) : "Like Music"); } if (attribute.kappatu) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[8], ":", 2) : "Lively"); } if (attribute.ukemi) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[9], ":", 2) : "Passive"); } if (attribute.friendly) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[10], ":", 2) : "Friendly"); } if (attribute.kireizuki) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[11], ":", 2) : "Tidy"); } if (attribute.taida) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[12], ":", 2) : "Lazy"); } if (attribute.sinsyutu) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[13], ":", 2) : "Elusive"); } if (attribute.hitori) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[14], ":", 2) : "Loner"); } if (attribute.undo) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[15], ":", 2) : "Like Sports"); } if (attribute.majime) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[16], ":", 2) : "Serious"); } if (attribute.likeGirls) {
plugins/kPlugVR.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using ActionGame; using ActionGame.Chara; using H; using Illusion.Game; using IllusionPlugin; using Manager; using RootMotion.FinalIK; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityStandardAssets.ImageEffects; using VRTK; using kPlugVR.CmpBase; using kPlugVR.CmpChara; using kPlugVR.CmpH; using kPlugVR.CmpH.ActBind; using kPlugVR.CmpH.ActLink; using kPlugVR.CmpMisc; using kPlugVR.DefAndParse; using kPlugVR.Futa; using kPlugVR.GirlBrain; using kPlugVR.Inputs; using kPlugVR.PoseDef; using kPlugVR.Tools; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("kPlugVR Party")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("kPlugVR")] [assembly: AssemblyCopyright("Katarsys")] [assembly: AssemblyTrademark("")] [assembly: AssemblyVersion("2.8.0.0")] namespace kPlugVR { public class kPlug : IPlugin { public static string version = "2.8"; public static bool debug = false; public static bool debugButton = false; public static bool RunInVR = false; public static bool Disabled = false; public int level; public static string lvTyp; public static string mapName; public static string savName; public static int mapId = -1; public static bool havLanguageFiles = false; public static bool havDarknessPack_1 = false; private string hCusRoot = "hRoot"; private string actCtrlName = "actionTweaker"; public static Dealer dealer; public static ScreenWriter screenWriter; public static StatManager statManager; public static ConfigCtrl config; public static Diary diary; public static ClothesCtrl clothCtrl; public static JukeboxCtrl jukeboxCtrl; public static HControl hCtrl; public static AI_Main mainAi; public static AI_Second secondAi; public static FxCtrl fxCtrl; public static HComboCtrl combo; public static InviteUI inviteUi; public static ToolTranslation.Reader transReader; public static StudioCtrl studioCtrl; public static ActionMap map; public static HFlag hFlag; public static VRHScene hProc; public static HSprite hSprite; public static GameObject hSpace; public static GameObject hTweaker; public static Heroine heroine; public static Heroine heroine2; public static string hAnim; public static ChaFileControl futaChaFile = null; public static bool inOverlap; public static bool inLoad; public static bool inFade; public static bool inActLv = false; public static bool inH = false; public static bool inSpH = false; public static bool catchSceneEnd = false; public static Def.HStartCtx hStartCtx = Def.HStartCtx.Normal; public static Def.HStartCtx hLastCtx = Def.HStartCtx.Normal; public static bool inFreeH = false; public static bool atHome = false; public static bool leavingH = false; public static bool HendFromTrespass = false; public static bool trespassingH = false; public static bool inHresult = false; public static int addedGirlId = 1; public static bool dickIsHere = false; public static bool useCustomDick = false; public static Texture knobTxt; public static ChaControl maleInMaker; public static Material knobMatInMaker; public static ChaControl femaleInMaker; public static KokanBehavior kbInMaker; public static Material vaginMatInMaker; public static bool hvActionCmps = false; public static bool tourInFreeH = false; public static bool tourInEvent = false; public static bool onTitle = false; public static bool inCharMaker = false; public static bool inStudio = false; public static bool addConfigOnTitle = false; public static string meetOnSchoolWay = string.Empty; public static List<SnapShot.Daily> morningPartners = new List<SnapShot.Daily>(); public static bool inRebirth = false; public static int spentDays = 0; public string Name => "kPlugVR"; public string Version => "2.8"; public static ChaControl heroineCha { get; private set; } public static SnapShot.Stats girl_statAtInit { get; private set; } public static string girl_atInit { get; private set; } public static ChaControl heroine2Cha { get; private set; } public static string girl2_atInit { get; private set; } public void OnApplicationStart() { Application.runInBackground = true; if (debug) { DebugMethods.WriteInConsole(" Have load \"" + Name + " v" + Version + " !", 1); } havLanguageFiles = ToolTranslation.HavTranslation(); havDarknessPack_1 = kFileParser.HavDarknessPack_1(); } public void OnUpdate() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0a61: Unknown result type (might be due to invalid IL or missing references) //IL_0a68: Invalid comparison between Unknown and I4 if (Disabled) { return; } inLoad = Singleton<Scene>.Instance.IsNowLoading; inOverlap = Singleton<Scene>.Instance.IsOverlap; inFade = ((SimpleFade)Singleton<Scene>.Instance.sceneFade).IsFadeNow; if (inLoad || inFade) { _ = 1; } else _ = inOverlap; inStudio = lvTyp == "Studio"; if (inStudio && (Object)(object)studioCtrl == (Object)null) { studioCtrl = new GameObject().AddComponent<StudioCtrl>(); if (debug) { Console.WriteLine(" kPlug : Add Studio Control"); } } onTitle = lvTyp == "Title" || lvTyp == "VRTitle"; if (onTitle) { if (lvTyp == "VRTitle") { RunInVR = true; } if (lvTyp == "Title") { Disabled = true; return; } if (Time.timeScale == 0f) { Time.timeScale = 1f; } if (inH) { inH = false; if (debug) { DebugMethods.WriteInConsole(" Forcing inH reset on Title !", 3); } } if (!addConfigOnTitle && !inLoad && !inFade) { config = new GameObject().AddComponent<ConfigCtrl>(); addConfigOnTitle = true; } if (addConfigOnTitle && havLanguageFiles && (Object)(object)transReader == (Object)null) { transReader = ((Component)config).gameObject.AddComponent<ToolTranslation.Reader>(); } if (!string.IsNullOrEmpty(savName)) { savName = string.Empty; } if (tourInFreeH) { tourInFreeH = false; } if (tourInEvent) { tourInEvent = false; } if (inFreeH) { inFreeH = false; } if (HendFromTrespass) { HendFromTrespass = false; } if (trespassingH) { trespassingH = false; } if (hLastCtx != 0) { hLastCtx = Def.HStartCtx.Normal; } if (!string.IsNullOrEmpty(meetOnSchoolWay) || morningPartners.Count != 0 || inRebirth) { ClearRebirth(); } } else if (addConfigOnTitle) { addConfigOnTitle = false; } inCharMaker = ToolUI.InCharaMaker(); if (!inCharMaker) { if ((Object)(object)knobMatInMaker != (Object)null) { knobMatInMaker = null; } if ((Object)(object)maleInMaker != (Object)null) { maleInMaker = null; } if ((Object)(object)vaginMatInMaker != (Object)null) { vaginMatInMaker = null; } if ((Object)(object)femaleInMaker != (Object)null) { femaleInMaker = null; } if ((Object)(object)kbInMaker != (Object)null) { kbInMaker = null; } } if (inCharMaker && ((Object)(object)maleInMaker != (Object)null || (Object)(object)femaleInMaker != (Object)null)) { return; } if ((lvTyp == "FreeH" || lvTyp == "VRCharaSelect") && !tourInFreeH) { tourInFreeH = true; } if (lvTyp == "FixEventSceneEx" && !tourInEvent) { tourInEvent = true; } int num; if (!(lvTyp == "Action") && !(lvTyp == "H")) { num = ((lvTyp == "VRHScene") ? 1 : 0); if (num == 0 && inActLv) { map = null; inActLv = false; DebugMethods.WriteInConsole(" kPlug : Exiting Action level context, delete components...", 1); ResetHVariables(); DeleteActionComponents(); } } else { num = 1; } if (num != 0 && !inActLv && !inLoad && !inOverlap) { if (debug) { DebugMethods.WriteInConsole(" kPlug : Enter Action Context Adding components", 1); } inActLv = true; hvActionCmps = true; AddActionComponents(); } if (inActLv && (Object)(object)config == (Object)null && !inLoad) { inActLv = false; inRebirth = true; } if (((inActLv && hvActionCmps) || tourInEvent || inCharMaker) && ((!inLoad && inFade && !tourInFreeH && !inH) || (inH && !dickIsHere && !inLoad) || (tourInEvent && !dickIsHere && !inLoad && !inFade)) && DickBehavior.DickJustAppear()) { DickBehavior.SetPlayerDickColor(); } if (dickIsHere && tourInEvent && inFade) { dickIsHere = false; } if (inActLv && hvActionCmps && !inCharMaker) { if (ParserScene.InH() && (Object)(object)hCtrl == (Object)null && !inLoad) { if (!inH) { ResetHVariables(); if (HendFromTrespass) { HendFromTrespass = false; trespassingH = true; if (debug) { DebugMethods.WriteInConsole(" kPlug : Previous H leaved from Trespass, assume this scene as next scene", 2); } } inH = true; hFlag = Object.FindObjectOfType<HFlag>(); hProc = Singleton<VRHScene>.Instance; hSprite = hProc.sprites[0]; DebugMethods.WriteInConsole(" kPlug : ENTERING H, CATCH NATIVE COMPONENTS...", 3); } if ((Object)(object)GameObject.Find(hCusRoot) == (Object)null) { CreateEcchiSpace(); if (!tourInFreeH) { statManager.ConformAllDailys(atDayEnd: false); } } Def.PoseMod hpTyp = Def.PoseMod.None; ParserAnim.GetHPosModFromAssetPath(ref hpTyp); if (hpTyp != 0 && hpTyp != Def.PoseMod.Unknown && (Object)(object)hFlag != (Object)null && hFlag.nowAnimationInfo != null) { if (tourInFreeH) { mapId = ((BaseMap)Object.FindObjectOfType<ActionMap>()).no; } hAnim = kTranslator.AnimName(hFlag.nowAnimationInfo.paramFemale.path.file, kTranslator.AnimNameMapper_H()); DebugMethods.WriteInConsole(" kPlug : CATCH START ANIM as " + hAnim, 3); hStartCtx = ParserScene.HStartCtx(); List<Def.HStartCtx> list = new List<Def.HStartCtx> { Def.HStartCtx.Masturbation, Def.HStartCtx.Peep, Def.HStartCtx.Lesbian, Def.HStartCtx.Darkness }; dealer.mapChangeAfetrH = !tourInFreeH && (list.Contains(hStartCtx) || (list.Contains(hLastCtx) && trespassingH)); hLastCtx = Def.HStartCtx.Normal; if (debug) { DebugMethods.WriteInConsole(" kPlug : Starting H scene, context is " + hStartCtx, 1); if (dealer.mapChangeAfetrH) { DebugMethods.WriteInConsole(" kPlug : H Context will chnage map after scene END ", 1); } } Def.ChangePose doPosChange = Def.ChangePose.No; if (hStartCtx == Def.HStartCtx.Normal) { doPosChange = ToolDeal.PosChangeAtStart(); } AddEcchiComponents(doPosChange); if (config.inviteClosest && !tourInFreeH && hStartCtx == Def.HStartCtx.Normal && mapName != "Home") { dealer.InviteCloseGirls(); } if (mapName == "Home" && !tourInFreeH) { dealer.InviteMorningGirls(); } if (debug) { DebugHStart(); } } } if (inH && !tourInFreeH && !inLoad && !inOverlap) { if (hFlag.isHSceneEnd && !catchSceneEnd) { if (debug) { DebugMethods.WriteInConsole(" kPlug : Catch H SCENE END !", 3); } hLastCtx = hStartCtx; if (Singleton<Game>.Instance.actScene.isPenetration && !trespassingH) { HendFromTrespass = true; if (dealer.InProcess) { dealer.ForceStopFromTrespass(); } if (debug) { DebugMethods.WriteInConsole(" Leaving H with ACTSCENE PENETRATION TRUE !", 3); } } catchSceneEnd = true; dealer.ClearLoadList(); ToolDeal.HSeneEnd(); hCtrl.Clean(sceneEnd: true); mainAi.ResetAtHend(); diary.Reset(); if (!hCtrl.noResultH && !HendFromTrespass && !leavingH) { dealer.results = ((Component)dealer).gameObject.AddComponent<HResults>(); leavingH = true; } statManager.LeavingH(); if ((Object)(object)hCtrl.SpHctrl != (Object)null) { hCtrl.SpHctrl.leavingH = true; } if (hCtrl.noResultH || HendFromTrespass) { config.ResetHcustom(); dealer.ExitingH(); if (HendFromTrespass && dealer.haremAI.Count > 0) { dealer.ClearHarem(); } dealer.DestroySpotManager(); if (debug) { DebugMethods.WriteInConsole(" kPlug : H SCENE END IN A NO Result CONTEXT", 1); } } } inH = ParserScene.InH(); if (!inH && (Object)(object)hCtrl != (Object)null) { if (debug) { DebugMethods.WriteInConsole(" kPlug : not inH but hControl exist, Add Destroyer...", 2); } ((Component)hCtrl).gameObject.AddComponent<AutoDestroy>().autoDestruct = true; } } if (tourInFreeH && inH && !ParserScene.InH()) { ResetHVariables(); Console.WriteLine("Report to Leaving H"); } if (!tourInFreeH) { if ((Object)(object)Singleton<Game>.Instance.actScene.AdvScene.nowScene != (Object)null && leavingH && !ParserScene.InH()) { leavingH = false; inHresult = true; dealer.HResume(); config.ResetHcustom(); } bool flag = hLastCtx == Def.HStartCtx.ThreeP; bool miniMapAndCameraActive = Singleton<Game>.Instance.actScene.MiniMapAndCameraActive; if (inHresult && ((ToolUI.InResultGaugeScreen() && !flag) || (flag && miniMapAndCameraActive))) { if (dealer.haremAI.Count > 0) { dealer.ClearHarem(); } dealer.ExitingH(); dealer.DestroySpotManager(); inHresult = false; } } } if (!inActLv || !hvActionCmps) { return; } if (!tourInFreeH) { if (!inLoad && ((BaseMap)Singleton<Game>.Instance.actScene.Map).isMapLoading) { map = Object.FindObjectOfType<ActionMap>(); if ((Object)(object)map != (Object)null && mapId != map.Info.No) { mapId = map.Info.No; mapName = kTranslator.MapNoInterpreter(map.Info.No); atHome = mapName == "Home"; if ((int)Singleton<Game>.Instance.actScene.Cycle.nowType == 11) { ClearRebirth(); } if ((Object)(object)dealer != (Object)null) { dealer.mapChange = true; } if (debug) { DebugMethods.WriteInConsole(" kPlug : Map have change to " + mapName, 1); } } } if (!inLoad && !inFade && savName != Game.SaveFileName) { if (!string.IsNullOrEmpty(savName)) { if (debug) { DebugMethods.WriteInConsole(" kPlug : Loaded save change to \"" + Game.SaveFileName + "\"", 1); } inActLv = false; DeleteActionComponents(); } savName = Game.SaveFileName; } } if (inH && (Object)(object)hCtrl != (Object)null && !inFade) { hAnim = kTranslator.AnimName(hFlag.nowAnimationInfo.paramFemale.path.file, hCtrl.AnimNmMapper); } } public void OnLevelWasLoaded(int level) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); lvTyp = ((Scene)(ref activeScene)).name; if (debug) { DebugMsg(); } } public void OnFixedUpdate() { } public void OnLevelWasInitialized(int level) { } public void OnApplicationQuit() { } public static void ResetHVariables() { inH = false; hCtrl = null; hSpace = null; inSpH = false; catchSceneEnd = false; trespassingH = false; heroine = null; girl_statAtInit = null; girl_atInit = string.Empty; heroine2 = null; heroine2Cha = null; girl2_atInit = string.Empty; if (debug) { Console.WriteLine(" kPlug ( ResetHVariables ) : Clear H variables"); } } private void ClearRebirth() { meetOnSchoolWay = string.Empty; morningPartners.Clear(); inRebirth = false; if (debug) { Console.WriteLine(" kPlug ( ClearRebirth ) : Clear variables"); } } public void AddActionComponents() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) GameObject val = new GameObject(actCtrlName); config = val.AddComponent<ConfigCtrl>(); transReader = val.AddComponent<ToolTranslation.Reader>(); dealer = val.AddComponent<Dealer>(); statManager = val.AddComponent<StatManager>(); screenWriter = val.AddComponent<ScreenWriter>(); diary = val.AddComponent<Diary>(); clothCtrl = val.AddComponent<ClothesCtrl>(); jukeboxCtrl = val.AddComponent<JukeboxCtrl>(); if (inRebirth) { statManager.initByDayChange = true; if (!string.IsNullOrEmpty(meetOnSchoolWay)) { statManager.meetBeforeVanish = meetOnSchoolWay; } if (morningPartners.Count > 0) { foreach (SnapShot.Daily morningPartner in morningPartners) { statManager.dailysBeforeVanish.Add(morningPartner); } } dealer.waitToInitGirlAtSchool = true; dealer.InSchoolAtNight = false; dealer.BackHomeAtNight = false; spentDays = 1; ClearRebirth(); } if (debug) { DebugMethods.WriteInConsole(" kPlug : adding actioncomponents", 1); } } public void DeleteActionComponents() { if ((Object)(object)GameObject.Find(actCtrlName) != (Object)null) { GameObject.Find(actCtrlName).AddComponent<AutoDestroy>().autoDestruct = true; if (debug) { DebugMethods.WriteInConsole(" kPlug : ...have remove action components", 1); } } } public void CreateEcchiSpace() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown hTweaker = new GameObject(hCusRoot); hSpace = GameObject.Find("VRHScene"); if ((Object)(object)hSpace != (Object)null) { hTweaker.transform.SetParent(hSpace.transform); } fxCtrl = hTweaker.AddComponent<FxCtrl>(); if (debug) { DebugMethods.WriteInConsole(" kPlug : create hTweaker space and fx control", 1); } } public void AddEcchiComponents(Def.ChangePose doPosChange) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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) heroine = hFlag.lstHeroine[0]; heroineCha = ((CharaData)heroine).chaCtrl; girl_atInit = kFileParser.GirlName(heroine); if (hStartCtx != Def.HStartCtx.Lesbian) { EMode mode = hFlag.mode; if (!(((object)(EMode)(ref mode)).ToString() == "houshi3P")) { mode = hFlag.mode; if (!(((object)(EMode)(ref mode)).ToString() == "sonyu3P")) { goto IL_00d2; } } } heroine2 = hFlag.lstHeroine[1]; heroine2Cha = ((CharaData)heroine2).chaCtrl; girl2_atInit = kFileParser.GirlName(heroine2); if (debug) { DebugMethods.WriteInConsole(" kPlug : H scene have a second girl, " + girl2_atInit, 1); } goto IL_00d2; IL_00d2: if (tourInFreeH) { dealer.heroineVoice = heroine.ChaVoice; if (heroine2 != null) { dealer.heroine2Voice = heroine2.ChaVoice; } } else if ((Object)(object)dealer.fixChaSpCtrl == (Object)null) { dealer.heroineVoice = heroine.ChaVoice; if (heroine2 != null) { dealer.heroine2Voice = heroine2.ChaVoice; } } else { dealer.heroineVoice = ((dealer.fixChaSpCtrl.fixSav != null) ? dealer.fixChaSpCtrl.fixSav.ChaVoice : heroine.ChaVoice); if (heroine2 != null) { dealer.heroine2Voice = heroine2.ChaVoice; } } if (!tourInFreeH) { girl_statAtInit = ToolStats.StatsFromSav(heroine); statManager.RefreshDailyJudge(girl_atInit); if (debug) { DebugMethods.WriteInConsole(" kPlug : Ghosting main girl, " + girl_atInit + ", stats at h start", 1); } } hCtrl = hTweaker.AddComponent<HControl>(); hCtrl.changePosAtStart = doPosChange; mainAi = ((Component)heroineCha).gameObject.AddComponent<AI_Main>(); if ((Object)(object)heroine2Cha != (Object)null) { secondAi = ((Component)heroine2Cha).gameObject.AddComponent<AI_Second>(); } combo = hTweaker.AddComponent<HComboCtrl>(); inviteUi = hTweaker.AddComponent<InviteUI>(); inFreeH = hFlag.isFreeH; bool autoFpv = config.autoFpv; bool autoSmartUi = config.autoSmartUi; hCtrl.Init(Time.deltaTime, autoFpv, autoSmartUi); if (debug) { DebugMethods.WriteInConsole(" kPlug : adding ecchi components", 1); } } private void DebugHStart() { string text = mapName; if (tourInFreeH) { text = ((BaseMap)Object.FindObjectOfType<ActionMap>()).no.ToString(); } Console.WriteLine("------------------------------------------------------------------"); Console.WriteLine(" Entering H with with \"" + girl_atInit + "\" at place :" + text); Console.WriteLine("\tEExp kind " + ((object)(EExperience)(ref hFlag.experience)).ToString() + ", expCheat " + hFlag.expCheat); Console.WriteLine("------------------------------------------------------------------"); } private void DebugMsg() { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) Console.WriteLine(""); Console.WriteLine("---------------------------------------------------------------"); Scene activeScene = SceneManager.GetActiveScene(); Console.WriteLine("Level : " + ((Scene)(ref activeScene)).buildIndex); activeScene = SceneManager.GetActiveScene(); Console.WriteLine("Scene Name : " + ((Scene)(ref activeScene)).name); activeScene = SceneManager.GetActiveScene(); Console.WriteLine("Scene Path : " + ((Scene)(ref activeScene)).path); Console.WriteLine("runInBackground : " + Application.runInBackground); Console.WriteLine("---------------------------------------------------------------"); Console.WriteLine(""); Console.WriteLine(""); } } public class DebugMethods { public static bool test1 = false; public static bool test2 = true; public static bool test3 = false; public static int action = 0; public static int face = 0; public static int soundId = 0; public static bool togle = false; private List<FaceInfo> avaibleExpr = new List<FaceInfo>(); private static List<int[]> avaiblesIndexs = new List<int[]>(); private static int listId = 0; public static List<string> advBundles = new List<string> { "adv/motion/controller/adv/00.unity3d" }; public static List<string> advAssets = new List<string> { "cf_adv_00_00", "cf_adv_suwari_00" }; public static void WriteInConsole(string msg, int blank) { for (int i = 0; i < blank; i++) { Console.WriteLine(""); } Console.WriteLine(msg); for (int j = 0; j < blank; j++) { Console.WriteLine(""); } } public static void DrawDebugButtons() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown int num = 3; float num2 = 40f; float num3 = 45f; float num4 = 60f; float num5 = (float)Screen.height - (float)Screen.height * 0.025f; GUILayout.BeginArea(new Rect((float)Screen.width - num3 * (float)num - (float)Screen.width * 0.005f - num4 * 1.01f, num5, num3 * (float)num, num2)); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUIStyle val = new GUIStyle(GUI.skin.button); val.fontSize = 11; if (GUILayout.Button("Dbg 1", val, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Debug1(); } GUIStyle val2 = new GUIStyle(GUI.skin.button); val2.fontSize = 11; if (GUILayout.Button("Dbg 2", val2, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Debug2(); } GUIStyle val3 = new GUIStyle(GUI.skin.button); val3.fontSize = 11; if (GUILayout.Button("Dbg 3", val3, (GUILayoutOption[])(object)new GUILayoutOption[0])) { Debug3(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); } public static void HSituationChange() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Object.FindObjectOfType<HSceneProc>(); HControl hCtrl = kPlug.hCtrl; HFlag hFlag = kPlug.hFlag; AnimationListInfo nowAnimationInfo = hFlag.nowAnimationInfo; string file = nowAnimationInfo.paramFemale.path.file; _ = nowAnimationInfo.paramFemale.path.assetpath; Console.WriteLine(""); Console.WriteLine("---------------------------------------------------------------------------"); Console.WriteLine("Change H posMode to " + ParserAnim.AssetPathToCategory(returnNameIfFailed: true)); Console.WriteLine("\tposition known as \"" + kTranslator.AnimName(file, hCtrl.AnimNmMapper) + "\""); Console.WriteLine("\t\tsource asset: " + ToolMisc.GetLastString(file, "/", rmvExt: true)); Console.WriteLine(""); EMode mode = hFlag.mode; Console.WriteLine("\tCurrent Emod : \"" + ((object)(EMode)(ref mode)).ToString() + "\""); Console.WriteLine("\t\tinterpretation as posMod : \"" + hCtrl.posMod.ToString() + "\""); if (hCtrl.posMod == Def.PoseMod.Service) { int kindHoushi = nowAnimationInfo.kindHoushi; string text = ""; switch (kindHoushi) { case 0: text = "Hand Service"; break; case 1: text = "Mouth Service"; break; case 2: text = "Breast Service"; break; } Console.WriteLine("\t\tservice typ : " + text); } Console.WriteLine("---------------------------------------------------------------------------"); } public static void DebugAnimList() { List<AnimationListInfo>[] allAnims = kFileParser.GetAllAnims(); Console.WriteLine("------------------------------------------------------------"); Console.WriteLine("\tListing ALL ANIMATION"); Console.WriteLine(""); for (int i = 0; i < allAnims.Length; i++) { for (int j = 0; j < allAnims[i].Count; j++) { string file = allAnims[i][j].paramFemale.path.file; Console.WriteLine("\tIn AssetPath" + allAnims[i][j].paramFemale.path.assetpath); Console.WriteLine("\t\tfileNm :" + kTranslator.AnimName(file, kPlug.hCtrl.AnimNmMapper)); } } Console.WriteLine("------------------------------------------------------------"); } public static void DebugCanvasChilds() { RectTransform[] componentsInChildren = ((Component)kPlug.hSprite).gameObject.GetComponentsInChildren<RectTransform>(); Console.WriteLine(""); Console.WriteLine("-----------------------"); Console.WriteLine("Debug UI VISIBLE CANVAS CHILDS"); Console.WriteLine("-----------------------"); RectTransform[] array = componentsInChildren; foreach (RectTransform val in array) { Console.WriteLine("\t" + ((Object)val).name); } Console.WriteLine(""); Console.WriteLine("-----------------------"); Console.WriteLine("Debug UI Parent Search"); Console.WriteLine("-----------------------"); string text = "NewHeroine"; array = componentsInChildren; foreach (RectTransform val2 in array) { if (((Object)val2).name == text) { Console.WriteLine("Search Button parents for" + ((Object)val2).name); RectTransform[] componentsInParent = ((Component)val2).GetComponentsInParent<RectTransform>(); foreach (RectTransform val3 in componentsInParent) { Console.WriteLine("\t" + ((Object)val3).name); } Console.WriteLine(""); } } } public static void DebugSiru(string name, byte[] flags) { Console.WriteLine("Debug Siru Flags on " + name); Console.WriteLine("-----------------------------------"); Console.WriteLine("\ton kao " + flags[0]); Console.WriteLine("\ton frontUp " + flags[1]); Console.WriteLine("\ton frontDown " + flags[2]); Console.WriteLine("\ton backUp " + flags[3]); Console.WriteLine("\ton backDown " + flags[4]); } public static void DebugPublicAvaibleAnimSates() { foreach (ChaControl item in kPlug.dealer.harem) { Console.WriteLine(" Avables animation states for " + kFileParser.GirlName(item)); Console.WriteLine("--------------------------------------------"); AnimationClip[] animationClips = ((ChaInfo)item).animBody.runtimeAnimatorController.animationClips; foreach (AnimationClip val in animationClips) { if (ToolMisc.GetStringAtIndex(((Object)val).name, "_", 1) == "M") { Console.WriteLine("\t" + ((Object)val).name); } } } } public static void TestMaterialProperties(Material mat, List<string> properties) { foreach (string property in properties) { if (mat.HasProperty(property)) { Console.WriteLine(((Object)mat).name + " has " + property + " properties"); } } } public static void DebugCLothesState(ChaControl c) { List<string> list = new List<string>(0) { "Top", "Bottom", "Bra", "Shorts", "Gloves", "Panst", "Socks", "InnerShoes", "OuterShoes" }; List<int> list2 = new List<int>(0); for (int i = 0; i < 9; i++) { Dictionary<byte, string> clothesStateKind = c.GetClothesStateKind(i); bool flag = false; try { foreach (KeyValuePair<byte, string> item in clothesStateKind) { _ = item; } flag = true; } catch (Exception) { flag = false; } if (flag) { list2.Add(i); } } Console.WriteLine("Clothes State Report for " + kFileParser.GirlName(c)); Console.WriteLine("------------------------------------------"); foreach (int item2 in list2) { Console.WriteLine(list[item2] + " byte State : " + ((ChaFile)((ChaInfo)c).chaFile).status.clothesState[item2]); } Console.WriteLine(""); } public static void ReportHcount(SnapShot.HCount count) { Console.WriteLine("\tAibu org count : " + count.aibuOrg); Console.WriteLine("\tKiss count : " + count.kiss); Console.WriteLine("\tvaginal cum count : " + count.sonyuOrg); Console.WriteLine("\tcondom in count : " + count.sonyuCondomInside); Console.WriteLine("\tcum in count : " + count.sonyuInside); Console.WriteLine("\tcum out count : " + count.sonyuOutside); Console.WriteLine("\tcum together count : " + count.sonyuSame); Console.WriteLine("\tcum together ( condom ) count : " + count.sonyuCondomSame); Console.WriteLine("\tcum inside anal ( condom ) count : " + count.sonyuAnalCondomInside); Console.WriteLine("\tanal cum count : " + count.sonyuAnalOrg); Console.WriteLine("\tcum inside anal count : " + count.sonyuAnalInside); Console.WriteLine("\tcum outside anal count : " + count.sonyuAnalOutside); Console.WriteLine("\tsame cum in anal :" + count.sonyuAnalSame); Console.WriteLine("\tanal cum together ( condom ) count : " + count.sonyuAnalCondomSame); Console.WriteLine(""); Console.WriteLine("\tselect massage"); for (int i = 0; i < count.selectMassages.Length; i++) { Console.WriteLine("\t\tat id" + i + " : " + count.selectMassages[i]); } Console.WriteLine(""); Console.WriteLine("\tarea play experience"); for (int j = 0; j < count.selectAreaGlb.Length; j++) { Console.WriteLine("\t\thave play with " + Def.areaNames[j] + " : " + count.selectAreaGlb[j] + " ( experience added on results )"); } Console.WriteLine(""); Console.WriteLine("\tselect hobby? ( float )" + count.selectHobby); Console.WriteLine(""); } public static void AllSavesStatsDebug() { foreach (Heroine heroine in Singleton<Game>.Instance.HeroineList) { DebugStats(kFileParser.GirlName(heroine)); } } public static void DebugStats(string girlName) { SnapShot.Stats value = new SnapShot.Stats(); if (kPlug.statManager.statsDic.TryGetValue(girlName, out value)) { Heroine val = kFileParser.FindSaveData(girlName); Console.WriteLine("----------------------------------------------"); Console.WriteLine("H Stat for " + girlName); Console.WriteLine("----------------------------------------------"); Console.WriteLine(""); Console.WriteLine("\tToday's dangerous ? " + value.riskyDay); Console.WriteLine("\tIs Virgin ? " + value.isVirgin); Console.WriteLine("\tAnal Never been use ? " + value.isAnalVirgin); Console.WriteLine("\tAllow Anal? " + GirlQA.AllowAnal(val)); Console.WriteLine("\tAllow Insert No Condom ? " + GirlQA.AllowNoCondom(val)); Console.WriteLine("\tIs Taked ? " + val.isTaked); Console.WriteLine(""); } } public static void FlagCount() { Count count = kPlug.hFlag.count; Console.WriteLine(""); Console.WriteLine("H Count in that session "); Console.WriteLine("____________________________________________"); Console.WriteLine("HProc EEexp " + ((object)(EExperience)(ref kPlug.hFlag.experience)).ToString()); Console.WriteLine("exp cheat " + kPlug.hFlag.expCheat); Console.WriteLine("HScene Proc Data State " + kPlug.hProc.dataH.state); Console.WriteLine(""); Console.WriteLine("\tAibu org count : " + count.aibuOrg); Console.WriteLine("\tKiss count : " + count.kiss); Console.WriteLine("\tNot Kiss count : " + count.notKiss); Console.WriteLine("\tNotPowerfull count : " + count.notPowerful); Console.WriteLine("\tDon't touch anal count : " + count.dontTouchAnal); Console.WriteLine("\tDon't touch massage count : " + count.dontTouchMassage); Console.WriteLine("\thoushi Outside count : " + count.houshiOutside); Console.WriteLine("\thoushi inside count : " + count.houshiInside); Console.WriteLine("\thoushi hand count : " + count.handFinish); Console.WriteLine("\tpaizuri finish count : " + count.paizuriFinish); Console.WriteLine("\tpaizuri name finish : " + count.paizurinameFinish); Console.WriteLine("\tpaizuri kuwae finish : " + count.paizurikuwaeFinish); Console.WriteLine("\tDrink count : " + count.houshiDrink); Console.WriteLine("\tVomit count : " + count.houshiVomit); Console.WriteLine("\tName finish count : " + count.nameFinish); Console.WriteLine("\tKuwae finish count : " + count.kuwaeFinish); Console.WriteLine("\tSplash count : " + count.splash); Console.WriteLine("\tvaginal cum count : " + count.sonyuOrg); Console.WriteLine("\tcondom in count : " + count.sonyuCondomInside); Console.WriteLine("\tcum in count : " + count.sonyuInside); Console.WriteLine("\tcum outside count : " + count.sonyuOutside); Console.WriteLine("\tcum together count : " + count.sonyuSame); Console.WriteLine("\tcum together ( condom ) count : " + count.sonyuCondomSame); Console.WriteLine("\tsonyu tare ( ? ) count : " + count.sonyuTare); Console.WriteLine("\tcum inside anal ( condom ) count : " + count.sonyuAnalCondomInside); Console.WriteLine("\tanal cum count : " + count.sonyuAnalOrg); Console.WriteLine("\tcum inside anal count : " + count.sonyuAnalInside); Console.WriteLine("\tcum outside anal count : " + count.sonyuAnalOutside); Console.WriteLine("\tsame cum in anal :" + count.sonyuAnalSame); Console.WriteLine("\tanal cum together ( condom ) count : " + count.sonyuAnalCondomSame); Console.WriteLine("\tAnal tare ? count : " + count.sonyuAnalTare); Console.WriteLine("\tnotCondom play count : " + count.notCondomPlay); Console.WriteLine("\tnot condom play count : " + count.notAnalPlay); Console.WriteLine("\tsonyu kokan play count : " + count.sonyuKokanPlay); Console.WriteLine("\tsonyu anal play count : " + count.sonyuAnalPlay); Console.WriteLine(""); Console.WriteLine("\tselect massage"); for (int i = 0; i < count.selectMassages.Length; i++) { Console.WriteLine("\t\tat id" + i + " : " + count.selectMassages[i]); } Console.WriteLine(""); Console.WriteLine("\tarea play experience"); for (int j = 0; j < count.selectAreas.Length; j++) { Console.WriteLine("\t\thave play with " + Def.areaNames[j] + " : " + count.selectAreas[j] + " ( experience added on results )"); } Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("\t select hobby? ( float )" + count.selectHobby); Console.WriteLine(""); } public static void GetAvaiblesFaceExpr() { } public static void TestFaceExpr() { if (avaiblesIndexs.Count > 0) { int key = avaiblesIndexs[listId][0]; int index = avaiblesIndexs[listId][1]; int index2 = avaiblesIndexs[listId][2]; FaceInfo val = kPlug.hProc.voice.faceLists[0].facelib[index2][index][key]; Console.WriteLine("\tList Id : " + listId + " faceId: " + key + " actionId: " + index + " voiceId: " + index2); Console.WriteLine("\tmouth infos :" + val.mouth); ChaControl obj = kPlug.dealer.harem[0]; obj.ChangeEyebrowPtn(val.eyebrow, true); obj.ChangeEyesPtn(val.eye, true); obj.ChangeMouthPtn(val.mouth, true); obj.tearsLv = (byte)val.tears; obj.ChangeHohoAkaRate(val.cheek); obj.HideEyeHighlight(!val.highlight); obj.ChangeEyesBlinkFlag(val.eyesblink); obj.ChangeEyesShaking(val.yure); obj.DisableShapeMouth(MathfEx.IsRange<int>(21, val.mouth, 22, true)); obj.ChangeTongueState((byte)1); ((ChaInfo)obj).animTongueEx.Play("WLoop"); listId++; } else { GetAvaiblesFaceExpr(); } } public static void DebugAnimationInfo(AnimationListInfo anim) { } public static void Debug1() { } public static void Debug2() { } public static void Debug3() { } public static void SpacePosInfos() { //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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)((CharaData)kPlug.hFlag.player).chaCtrl).gameObject.transform; _ = ((ChaInfo)((CharaData)kPlug.hFlag.player).chaCtrl).objBodyBone.transform; Transform transform2 = ((ChaInfo)((CharaData)kPlug.hFlag.player).chaCtrl).objRoot.transform; _ = ((Component)((CharaData)kPlug.heroine).chaCtrl).gameObject.transform; _ = ((ChaInfo)((CharaData)kPlug.heroine).chaCtrl).objRoot.transform; Console.WriteLine("--------------------------------"); Console.WriteLine(" Space Position Infos :"); Console.WriteLine("--------------------------------"); Console.WriteLine(" Player ChaControl"); Vector3 val = ((Component)transform).transform.localPosition; Console.WriteLine("\t position " + ((object)(Vector3)(ref val)).ToString()); val = ((Component)transform).transform.position; Console.WriteLine("\t world position " + ((object)(Vector3)(ref val)).ToString()); val = ((Component)transform).transform.localEulerAngles; Console.WriteLine("\t rotation " + ((object)(Vector3)(ref val)).ToString()); Console.WriteLine(" ...BodyBone"); val = ((Component)transform2).transform.localPosition; Console.WriteLine("\t position " + ((object)(Vector3)(ref val)).ToString()); } } } namespace kPlugVR.GirlBrain { public class Judge { public static Def.DailyLifeOpinion DailyLife(Heroine girl, SnapShot.Daily daily) { Def.DailyLifeOpinion result = Def.DailyLifeOpinion.WaitNothing; int favor = girl.favor; switch (daily.talkTime != 0 || daily.meetInH != 0 || (daily.confirmDate && daily.meetInH == 0)) { case false: if (girl.isGirlfriend) { if (favor != 0) { result = ((favor <= 50) ? Def.DailyLifeOpinion.WishToSeeYou : Def.DailyLifeOpinion.WantToSeeYou); } } else if (girl.relation >= 1 && favor != 0) { result = ((favor <= 75) ? Def.DailyLifeOpinion.WishToSeeYou : Def.DailyLifeOpinion.WantToSeeYou); } break; case true: { int talkTime = daily.talkTime; bool flag = daily.orgTogether != 0; if (!GirlQA.AllowAnal(girl)) { _ = daily.orgInTease; _ = daily.orgInPiston; } else { _ = daily.orgInTease; _ = daily.orgInPiston; _ = daily.orgInAnalPiston; } bool flag2 = daily.kissCount != 0; Def.DailySexOpinion opinionOnH = daily.opinionOnH; List<Def.DailySexOpinion> list = new List<Def.DailySexOpinion> { Def.DailySexOpinion.Ecstatic, Def.DailySexOpinion.Satisfied, Def.DailySexOpinion.FeedForToday, Def.DailySexOpinion.FeedForLife }; if (girl.isGirlfriend) { result = ((talkTime > 3 || flag2 || flag || list.Contains(opinionOnH)) ? Def.DailyLifeOpinion.HappyLover : Def.DailyLifeOpinion.HavSeenYou); } else if (girl.relation >= 1) { result = ((talkTime > 5 || list.Contains(opinionOnH)) ? Def.DailyLifeOpinion.HappyFriend : Def.DailyLifeOpinion.HavSeenYou); } if (daily.confirmDate) { result = (girl.isGirlfriend ? Def.DailyLifeOpinion.HappyLover : Def.DailyLifeOpinion.HappyFriend); } break; } } return result; } public static Def.DailySexOpinion DailySex(Heroine girl, SnapShot.Daily daily) { Def.DailySexOpinion opinion = Def.DailySexOpinion.DontWant; if (daily.reachExtase) { return Def.DailySexOpinion.Ecstatic; } int lewdness = girl.lewdness; _ = girl.favor; switch (daily.interactInH != 0 || daily.helpInOnanism) { case false: { int num = (girl.isGirlfriend ? 50 : 75); if (daily.cameToLook) { opinion = Def.DailySexOpinion.HavJustWatch; } else if (daily.meetInH > 0 && !GirlQA.IsVirgin(girl)) { opinion = Def.DailySexOpinion.Frustrate; } else { if (girl.relation < 1) { break; } if (GirlQA.IsVirgin(girl)) { if (girl.isGirlfriend || girl.favor > 50) { opinion = ((lewdness > num) ? ((lewdness != 100) ? Def.DailySexOpinion.WishToTry : Def.DailySexOpinion.WantToTry) : Def.DailySexOpinion.DontWant); } } else { opinion = ((lewdness <= num) ? Def.DailySexOpinion.NothingHappen : ((lewdness == 100) ? Def.DailySexOpinion.Want : Def.DailySexOpinion.Wish)); } } break; } case true: if (daily.havFirstTime) { ThoughtsAboutFirst(girl, daily, ref opinion); } else if (daily.raped) { opinion = Def.DailySexOpinion.Raped; } else { ThoughtsAboutSex(girl, daily, ref opinion); } ToolStats.SexTodayToTalkEvent(girl); break; } return opinion; } public static void ThoughtsAboutFirst(Heroine girl, SnapShot.Daily daily, ref Def.DailySexOpinion opinion) { _ = Def.personalityEnums[((CharaData)girl).personality]; GirlQA.IsRiskyDay(girl.MenstruationDay); _ = girl.isGirlfriend; bool bitch = ((CharaData)girl).parameter.attribute.bitch; _ = daily.kissCount; _ = daily.kissCount; _ = daily.inQuantity; _ = daily.inAnalQuantity; int forceNoCondom = daily.forceNoCondom; int forceAnal = daily.forceAnal; int num = (bitch ? 0 : 0); if (daily.opinionOnH == Def.DailySexOpinion.NiceFirst && (forceAnal + forceNoCondom > num || daily.raped)) { opinion = Def.DailySexOpinion.NiceFirstRuined; if (girl.isGirlfriend) { daily.breakMotive = Def.BreakMotive.FirstTimeTrauma; } } else if (forceAnal + forceNoCondom > num || daily.raped) { opinion = Def.DailySexOpinion.BadFirst; if (girl.isGirlfriend) { daily.breakMotive = Def.BreakMotive.FirstTimeTrauma; } } else { opinion = Def.DailySexOpinion.NiceFirst; } } public static float WeakSpotUsageTrigger() { if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { return 60f; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 99f; } return 10f; } public static int ToleranceToAbuse(Heroine girl) { bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool isGirlfriend = girl.isGirlfriend; if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { if (!isGirlfriend) { return 0; } return 1; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 0; } if (!bitch) { if (!isGirlfriend) { return 1; } return 2; } if (!isGirlfriend) { return 2; } return 3; } public static void DefineMinRequirement(Heroine girl, int kissCount, bool weakUsed, ref int[] satisfied, ref int[] ecstatic) { bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool isGirlfriend = girl.isGirlfriend; int num = (bitch ? 3 : 2); int num2 = ((!bitch) ? 1 : 2); int num3 = ((!bitch) ? 1 : 2); int num4 = (bitch ? 5 : 4); int num5 = (bitch ? 4 : 3); int num6 = ((!bitch) ? 1 : 2); int num7 = (bitch ? 5 : 4); if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { num = (bitch ? 6 : 5); num2 = (bitch ? 4 : 3); num3 = (bitch ? 4 : 3); num4 = (bitch ? 10 : 9); num5 = (bitch ? 6 : 5); num6 = (bitch ? 7 : 5); num7 = (bitch ? 12 : 10); } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { num = (bitch ? 9 : 8); num2 = (bitch ? 4 : 3); num3 = (bitch ? 6 : 5); num4 = (bitch ? 12 : 10); num5 = (bitch ? 9 : 8); num6 = (bitch ? 12 : 10); num7 = (bitch ? 16 : 15); } if (isGirlfriend && kissCount >= num6) { int num8 = 1; if (kPlug.config.girlRequirement != 0) { num8 = 1; } num = (int)Mathf.Clamp((float)(num - num8), 1f, float.PositiveInfinity); num2 = (int)Mathf.Clamp((float)(num2 - num8), 1f, float.PositiveInfinity); } if (isGirlfriend && kissCount >= num7) { int num9 = 1; if (kPlug.config.girlRequirement != 0) { num9 = 2; } num4 = (int)Mathf.Clamp((float)(num4 - num9), 1f, float.PositiveInfinity); num5 = (int)Mathf.Clamp((float)(num5 - num9), 1f, float.PositiveInfinity); } if (weakUsed) { int num10 = 1; if (kPlug.config.girlRequirement != 0) { num10 = 2; } num = (int)Mathf.Clamp((float)(num - num10), 1f, float.PositiveInfinity); num2 = (int)Mathf.Clamp((float)(num2 - num10), 1f, float.PositiveInfinity); num4 = (int)Mathf.Clamp((float)(num4 - num10), 1f, float.PositiveInfinity); num5 = (int)Mathf.Clamp((float)(num5 - num10), 1f, float.PositiveInfinity); } satisfied = new int[3] { num, num2, num3 }; ecstatic = new int[2] { num4, num5 }; } public static int DrinkRequiremenForEcsatse() { if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { return 8; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 10; } return 5; } public static int HelpForSatisfaction() { if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { return 1; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { return 2; } return 0; } public static void ThoughtsAboutSex(Heroine girl, SnapShot.Daily daily, ref Def.DailySexOpinion opinion) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 Def.Personality num = Def.personalityEnums[((CharaData)girl).personality]; bool flag = GirlQA.IsRiskyDay(girl.MenstruationDay); bool flag2 = (int)girl.HExperience == 3; if (girl.isVirgin) { _ = girl.isAnalVirgin; } else _ = 0; _ = girl.isGirlfriend; _ = ((CharaData)girl).parameter.attribute.likeGirls; int num2 = ToleranceToAbuse(girl); bool flag3 = num == Def.Personality.Yandere; bool num3 = GirlQA.AllowAnal(girl); bool flag4 = GirlQA.AllowNoCondom(girl); bool weakUsed = ((CharaData)girl).parameter.weakPoint != -1 && daily.touchs[((CharaData)girl).parameter.weakPoint] > WeakSpotUsageTrigger(); _ = daily.kissCount; _ = daily.kissCount; int orgInTease = daily.orgInTease; int orgInPiston = daily.orgInPiston; int orgInAnalPiston = daily.orgInAnalPiston; int orgTogether = daily.orgTogether; int num4 = (num3 ? (orgInTease + orgInPiston + orgInAnalPiston) : (orgInTease + orgInPiston)); int service = daily.service; int drinkQuantity = daily.drinkQuantity; int inQuantity = daily.inQuantity; _ = daily.inAnalQuantity; int helpCount = daily.helpCount; int forceAnal = daily.forceAnal; int forceNoCondom = daily.forceNoCondom; bool flag5 = forceAnal + forceNoCondom >= num2 && !flag3; int[] satisfied = new int[3]; int[] ecstatic = new int[2]; DefineMinRequirement(girl, daily.kissCount, weakUsed, ref satisfied, ref ecstatic); int num5 = satisfied[0]; int num6 = satisfied[1]; int num7 = satisfied[2]; int num8 = ecstatic[0]; int num9 = ecstatic[1]; bool flag6 = num4 < num5; bool flag7 = num4 >= num5 || orgTogether >= num6 || service >= num7 || helpCount > HelpForSatisfaction(); if (flag7 && flag6) { flag6 = false; } bool flag8 = (orgTogether >= num9 || num4 >= num8) && !flag5; if (flag8) { flag6 = false; flag7 = false; } if (!flag2 && flag && inQuantity > 0 && !flag8 && !flag4) { opinion = Def.DailySexOpinion.WorryOnPregnancy; } else if (flag6) { opinion = Def.DailySexOpinion.WantMore; } else if (flag7) { if (drinkQuantity > DrinkRequiremenForEcsatse() && ((CharaData)girl).parameter.attribute.harapeko) { opinion = Def.DailySexOpinion.Ecstatic; } else { opinion = Def.DailySexOpinion.Satisfied; } } else if (flag8) { opinion = Def.DailySexOpinion.Ecstatic; } } public static int WatchOpinion(Heroine girl, SnapShot.Daily daily) { int meanWatchLastH = daily.meanWatchLastH; if (daily.lookOnfirstTime) { if (meanWatchLastH > 0) { if (GirlQA.IsVirgin(girl)) { if (meanWatchLastH <= 2) { return -30; } return -31; } if (meanWatchLastH <= 3) { return -32; } return -33; } if (!GirlQA.IsVirgin(girl)) { return 31; } return 30; } if (!daily.lookOnfirstTime) { if (meanWatchLastH > ((!((CharaData)girl).parameter.attribute.bitch) ? 1 : 3)) { if (meanWatchLastH <= (((CharaData)girl).parameter.attribute.bitch ? 6 : 3)) { return -34; } return -35; } if (daily.goodWatchLastH != 0) { return 32; } } return 30; } public static int RelationQuality(Heroine girl, SnapShot.Daily daily) { if (daily.opinionOnH == Def.DailySexOpinion.HavJustWatch) { return WatchOpinion(girl, daily); } List<Def.DailySexOpinion> list = new List<Def.DailySexOpinion> { Def.DailySexOpinion.Frustrate, Def.DailySexOpinion.WorryOnPregnancy, Def.DailySexOpinion.BadFirst, Def.DailySexOpinion.NiceFirstRuined, Def.DailySexOpinion.Raped }; if (girl.isAnger || list.Contains(daily.opinionOnH)) { if (daily.opinionOnH == Def.DailySexOpinion.Frustrate) { return -1; } if (daily.opinionOnH == Def.DailySexOpinion.WorryOnPregnancy) { if (!GirlQA.AfraidToBePregnant(girl, daily)) { return -2; } return -3; } if (daily.opinionOnH == Def.DailySexOpinion.BadFirst) { if (daily.forceAnal + daily.forceNoCondom <= 2) { return -4; } return -5; } if (daily.opinionOnH == Def.DailySexOpinion.NiceFirstRuined) { if (daily.forceAnal + daily.forceNoCondom <= 2) { return -6; } return -7; } if (daily.opinionOnH == Def.DailySexOpinion.Raped) { return -8; } return -9; } if (daily.opinionOnH == Def.DailySexOpinion.NiceFirst) { int num = 2; if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { num = 4; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { num = 6; } if (daily.orgTogether < num) { return 21; } return 22; } if (daily.opinionOnLife == Def.DailyLifeOpinion.WaitNothing) { return 0; } if (daily.opinionOnLife == Def.DailyLifeOpinion.WantToSeeYou || daily.opinionOnLife == Def.DailyLifeOpinion.WishToSeeYou) { if (daily.opinionOnH == Def.DailySexOpinion.DontWant || daily.opinionOnH == Def.DailySexOpinion.NothingHappen) { if (daily.opinionOnLife != Def.DailyLifeOpinion.WishToSeeYou) { return 2; } return 1; } if (daily.opinionOnH == Def.DailySexOpinion.WishToTry || daily.opinionOnH == Def.DailySexOpinion.WantToTry) { if (daily.opinionOnH != Def.DailySexOpinion.WantToTry) { return 4; } return 3; } if (daily.opinionOnH == Def.DailySexOpinion.Wish || daily.opinionOnH == Def.DailySexOpinion.Want) { if (daily.opinionOnH != Def.DailySexOpinion.Wish) { return 6; } return 5; } } if (daily.opinionOnLife == Def.DailyLifeOpinion.HavSeenYou || daily.opinionOnLife == Def.DailyLifeOpinion.HappyFriend || daily.opinionOnLife == Def.DailyLifeOpinion.HappyLover) { if (daily.opinionOnH == Def.DailySexOpinion.DontWant) { if (daily.opinionOnLife != Def.DailyLifeOpinion.HavSeenYou) { return 8; } return 7; } if (daily.opinionOnH == Def.DailySexOpinion.WishToTry || daily.opinionOnH == Def.DailySexOpinion.WantToTry) { if (daily.opinionOnLife == Def.DailyLifeOpinion.HavSeenYou) { if (daily.opinionOnH != Def.DailySexOpinion.WishToTry) { return 10; } return 9; } if (daily.opinionOnH != Def.DailySexOpinion.WishToTry) { return 12; } return 11; } if (daily.opinionOnH == Def.DailySexOpinion.Want || daily.opinionOnH == Def.DailySexOpinion.Wish) { if (daily.opinionOnLife == Def.DailyLifeOpinion.HavSeenYou) { if (daily.opinionOnH != Def.DailySexOpinion.Wish) { return 14; } return 13; } if (daily.opinionOnH != Def.DailySexOpinion.Wish) { return 16; } return 15; } if (daily.opinionOnH == Def.DailySexOpinion.Frustrate) { return -2; } if (daily.opinionOnH == Def.DailySexOpinion.WantMore) { if (daily.opinionOnLife != Def.DailyLifeOpinion.HavSeenYou) { return 18; } return 17; } if (daily.opinionOnH == Def.DailySexOpinion.Satisfied) { return 19; } if (daily.opinionOnH == Def.DailySexOpinion.Ecstatic) { return 20; } } return 0; } public static int DayQuality(Heroine girl, SnapShot.Daily daily) { List<Def.DailyLifeOpinion> obj = new List<Def.DailyLifeOpinion> { Def.DailyLifeOpinion.WaitNothing, Def.DailyLifeOpinion.WantToSeeYou, Def.DailyLifeOpinion.WishToSeeYou }; Def.DailyLifeOpinion opinionOnLife = daily.opinionOnLife; Def.DailySexOpinion dailySexOpinion = daily.opinionOnH; if (obj.Contains(opinionOnLife)) { return 0; } bool isGirlfriend = girl.isGirlfriend; bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool flag = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere; int num = daily.orgInTease + daily.orgTogether; int forceNoCondom = daily.forceNoCondom; int forceAnal = daily.forceAnal; int num2 = (GirlQA.AllowAnal(girl) ? (daily.orgInTease + daily.orgInPiston + daily.orgInAnalPiston) : (daily.orgInTease + daily.orgInPiston)); switch (dailySexOpinion) { case Def.DailySexOpinion.BadFirst: if (forceNoCondom + forceAnal <= 2) { return -1; } return -2; case Def.DailySexOpinion.NiceFirstRuined: if (forceNoCondom + forceAnal <= 2) { return -3; } return -4; case Def.DailySexOpinion.WorryOnPregnancy: if (!GirlQA.AfraidToBePregnant(girl, daily)) { return -5; } return -6; case Def.DailySexOpinion.Frustrate: { if (daily.interactInH == 0) { return -7; } if (daily.frustrateTime >= num2) { int num3 = ((!isGirlfriend) ? ((bitch || flag) ? 2 : 3) : ((bitch || flag) ? 1 : 2)); if (daily.frustrateTime < num3) { return -8; } return -9; } int num4 = ((!isGirlfriend) ? ((bitch || flag) ? 7 : 5) : ((bitch || flag) ? 5 : 3)); if (num2 < num4) { int num5 = ((!isGirlfriend) ? ((bitch || flag) ? 4 : 3) : ((bitch || flag) ? 3 : 2)); if (num2 > num5) { return -10; } return -11; } dailySexOpinion = Def.DailySexOpinion.Satisfied; break; } } if (dailySexOpinion == Def.DailySexOpinion.Raped) { return -12; } if (daily.havFirstTime && forceNoCondom + forceAnal == 0) { switch (opinionOnLife) { case Def.DailyLifeOpinion.WaitNothing: case Def.DailyLifeOpinion.HavSeenYou: if (num < 3) { return 1; } return 2; case Def.DailyLifeOpinion.HappyFriend: case Def.DailyLifeOpinion.HappyLover: if (num < 3) { return 3; } return 4; } } if (opinionOnLife == Def.DailyLifeOpinion.HavSeenYou) { switch (dailySexOpinion) { case Def.DailySexOpinion.DontWant: case Def.DailySexOpinion.NothingHappen: return 5; case Def.DailySexOpinion.WishToTry: case Def.DailySexOpinion.WantToTry: return 6; case Def.DailySexOpinion.Wish: case Def.DailySexOpinion.Want: return 7; case Def.DailySexOpinion.WantMore: if (forceNoCondom + forceAnal == 0) { return 8; } if (forceAnal >= forceNoCondom) { return 9; } if (forceNoCondom > forceAnal) { return 10; } break; } if (dailySexOpinion == Def.DailySexOpinion.Satisfied) { if (forceNoCondom + forceAnal == 0) { return 11; } if (forceAnal >= forceNoCondom) { return 12; } if (forceNoCondom > forceAnal) { return 13; } } if (dailySexOpinion == Def.DailySexOpinion.Ecstatic) { if (forceNoCondom + forceAnal == 0) { return 14; } if (forceAnal >= forceNoCondom) { return 15; } if (forceNoCondom > forceAnal) { return 16; } } } if (opinionOnLife == Def.DailyLifeOpinion.HappyFriend || opinionOnLife == Def.DailyLifeOpinion.HappyLover) { switch (dailySexOpinion) { case Def.DailySexOpinion.DontWant: case Def.DailySexOpinion.NothingHappen: return 17; case Def.DailySexOpinion.WishToTry: case Def.DailySexOpinion.WantToTry: return 18; case Def.DailySexOpinion.Wish: case Def.DailySexOpinion.Want: return 19; case Def.DailySexOpinion.WantMore: if (forceNoCondom + forceAnal == 0) { return 20; } if (forceAnal >= forceNoCondom) { return 21; } if (forceNoCondom > forceAnal) { return 22; } break; } if (dailySexOpinion == Def.DailySexOpinion.Satisfied) { if (forceNoCondom + forceAnal == 0) { return 23; } if (forceAnal >= forceNoCondom) { return 24; } if (forceNoCondom > forceAnal) { return 25; } } if (dailySexOpinion == Def.DailySexOpinion.Ecstatic) { if (forceNoCondom + forceAnal == 0) { return 26; } if (forceAnal >= forceNoCondom) { return 27; } if (forceNoCondom > forceAnal) { return 28; } } } return 0; } public static void ApplySatisfactionMoods(Heroine girl, SnapShot.Daily daily, int rq, ref int lewdTweak, ref bool lewdOverride, ref int favorTweak, ref bool favorOverride) { bool isGirlfriend = girl.isGirlfriend; GirlQA.IsVirgin(girl); bool flag = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere || ((CharaData)girl).parameter.attribute.bitch; lewdTweak = 0; lewdOverride = false; favorTweak = 0; favorOverride = false; switch (daily.opinionOnH) { case Def.DailySexOpinion.HavJustWatch: if (daily.goodWatchLastH != 0) { lewdTweak = ((!isGirlfriend) ? ((rq != 32) ? (flag ? 30 : 20) : (flag ? 100 : 5)) : ((rq != 32) ? (flag ? 50 : 25) : (flag ? 100 : 75))); favorTweak = (isGirlfriend ? 10 : 5); } break; case Def.DailySexOpinion.WishToTry: lewdTweak = ((!isGirlfriend) ? (flag ? 50 : 25) : (flag ? 75 : 50)); favorTweak = (isGirlfriend ? 20 : 10); break; case Def.DailySexOpinion.WantToTry: lewdTweak = (isGirlfriend ? 100 : (flag ? 100 : 75)); favorTweak = (isGirlfriend ? 30 : 20); break; case Def.DailySexOpinion.NiceFirst: lewdTweak = ((rq == 22) ? 75 : 50); lewdOverride = true; favorTweak = ((rq == 22) ? 100 : ((!isGirlfriend) ? (flag ? 75 : 50) : (flag ? 100 : 75))); break; case Def.DailySexOpinion.WantMore: lewdTweak = 95; lewdOverride = true; favorTweak = ((!isGirlfriend) ? (flag ? (-10) : (-5)) : (flag ? (-20) : (-10))); break; case Def.DailySexOpinion.Satisfied: lewdTweak = ((!isGirlfriend) ? (flag ? 90 : 70) : (flag ? 95 : 85)); lewdOverride = true; if (daily.breakMotive != 0) { daily.breakMotive = Def.BreakMotive.Null; } break; case Def.DailySexOpinion.Ecstatic: lewdTweak = 999; lewdOverride = true; favorTweak = 100; favorOverride = true; if (daily.breakMotive != 0) { daily.breakMotive = Def.BreakMotive.Null; } break; } if (lewdTweak == 0 && favorTweak == 0) { return; } if (kPlug.debug) { Console.WriteLine(" ToolStats : Applying Good Relation to " + daily.girlName + " (" + daily.opinionOnH.ToString() + ")"); } if (lewdTweak != 0) { girl.lewdness = (lewdOverride ? lewdTweak : Mathf.Clamp(girl.lewdness + lewdTweak, 0, 100)); if (kPlug.debug) { Console.WriteLine("\tLewdness , new value " + girl.lewdness); } } if (favorTweak != 0) { girl.favor = (favorOverride ? favorTweak : Mathf.Clamp(girl.favor + favorTweak, 0, 100)); if (kPlug.debug) { Console.WriteLine("\tFavor, new value " + girl.favor); } } } public static void ApplyBadMoods(Heroine girl, SnapShot.Daily daily, int rq, ref int lewdTweak, ref int favorTweak, ref int angerIncr) { Def.Personality personality = Def.personalityEnums[((CharaData)girl).personality]; lewdTweak = 0; favorTweak = 0; angerIncr = 0; bool isGirlfriend = girl.isGirlfriend; bool flag = personality == Def.Personality.Yandere; bool flag2 = flag || personality == Def.Personality.Maternal; switch (rq) { case -1: lewdTweak = ((!isGirlfriend) ? (flag ? 30 : 20) : (flag ? 50 : 30)); favorTweak = (isGirlfriend ? (-25) : (-15)); if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { favorTweak = (isGirlfriend ? (-50) : (-30)); } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { favorTweak = (isGirlfriend ? (-100) : (-80)); } if (girl.favor == 0) { angerIncr = (isGirlfriend ? 75 : 50); if (kPlug.config.girlRequirement != 0) { angerIncr = (isGirlfriend ? 100 : 75); } } break; case -2: lewdTweak = ((!isGirlfriend) ? (flag2 ? 25 : (-75)) : (flag2 ? 50 : (-50))); favorTweak = ((!isGirlfriend) ? ((!flag2) ? (-75) : 0) : ((!flag2) ? (-50) : 0)); if (!flag2) { angerIncr = (girl.isGirlfriend ? 10 : 50); } break; case -3: lewdTweak = ((!isGirlfriend) ? (flag2 ? (-100) : (-100)) : (flag2 ? 100 : (-100))); favorTweak = ((!isGirlfriend) ? (flag2 ? (-50) : (-100)) : (flag2 ? (-25) : (-50))); if (kPlug.config.girlRequirement != 0) { favorTweak = -100; } if (!flag2) { angerIncr = (isGirlfriend ? 50 : 100); } break; case -8: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-90))); favorTweak = ((!isGirlfriend) ? (flag ? 75 : (-100)) : (flag ? 100 : (-90))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 75 : 0) : ((!flag) ? 50 : 0)); if (kPlug.config.girlRequirement != 0) { angerIncr = ((!isGirlfriend) ? ((!flag) ? 150 : 0) : ((!flag) ? 75 : 0)); } break; case -30: lewdTweak = ((!isGirlfriend) ? (flag ? 75 : (-90)) : (flag ? 75 : (-75))); favorTweak = ((!isGirlfriend) ? ((!flag) ? (-75) : 0) : ((!flag) ? (-50) : 0)); angerIncr = ((!isGirlfriend) ? ((!flag) ? 50 : 0) : ((!flag) ? 25 : 0)); break; case -31: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-90))); favorTweak = ((!isGirlfriend) ? (flag ? 75 : (-100)) : (flag ? 100 : (-90))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 75 : 0) : ((!flag) ? 50 : 0)); if (isGirlfriend && girl.favor < 99 && !flag) { daily.breakMotive = Def.BreakMotive.VisualTrauma; } break; case -32: lewdTweak = ((!isGirlfriend) ? (flag ? 50 : (-50)) : (flag ? 50 : (-25))); favorTweak = ((!isGirlfriend) ? (flag ? 50 : (-20)) : (flag ? 50 : (-40))); break; case -33: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-90)) : (flag ? 100 : (-75))); favorTweak = ((!isGirlfriend) ? (flag ? 100 : (-50)) : (flag ? 100 : (-75))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 100 : 0) : ((!flag) ? 50 : 0)); if (isGirlfriend && girl.favor < 99 && !flag) { daily.breakMotive = Def.BreakMotive.DiscoverWhoYouAre; } break; case -34: lewdTweak = ((!isGirlfriend) ? (flag ? 75 : (-75)) : (flag ? 75 : (-50))); favorTweak = ((!isGirlfriend) ? (flag ? 10 : (-10)) : (flag ? 20 : (-20))); break; case -35: lewdTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-100))); favorTweak = ((!isGirlfriend) ? (flag ? 100 : (-100)) : (flag ? 100 : (-75))); angerIncr = ((!isGirlfriend) ? ((!flag) ? 75 : 0) : ((!flag) ? 50 : 0)); if (isGirlfriend && girl.favor < 90 && !flag) { daily.breakMotive = Def.BreakMotive.VisualTrauma; } break; } if (lewdTweak == 0 && favorTweak == 0 && angerIncr == 0) { return; } if (kPlug.debug) { Console.WriteLine(" ToolStats : Applying Bad Relation to " + daily.girlName + " (" + daily.opinionOnH.ToString() + ")"); } if (lewdTweak != 0) { girl.lewdness = Mathf.Clamp(girl.lewdness + lewdTweak, 0, 100); if (kPlug.debug) { Console.WriteLine("\tadd " + lewdTweak + " to lewdness , new value " + girl.lewdness); } } if (favorTweak != 0) { girl.favor = Mathf.Clamp(girl.favor + favorTweak, 0, 100); if (kPlug.debug) { Console.WriteLine("\tadd " + favorTweak + " to favor, new value " + girl.favor); } } if (angerIncr != 0) { girl.anger = Mathf.Clamp(girl.anger + angerIncr, 0, 100); girl.isAnger = true; if (kPlug.debug) { Console.WriteLine("\t\"IsAnger\" add " + angerIncr + " to anger, new value " + girl.anger); } } } public static void ApplyBadFirstMoods(Heroine girl, SnapShot.Daily daily, ref int lewdTweak, ref int favorTweak, ref int angerIncr) { if (Def.personalityEnums[((CharaData)girl).personality] != Def.Personality.Yandere) { bool flag = GirlQA.IsRiskyDay(girl.MenstruationDay); _ = girl.isGirlfriend; bool bitch = ((CharaData)girl).parameter.attribute.bitch; bool num = daily.kissCount != 0; int inQuantity = daily.inQuantity; int forceNoCondom = daily.forceNoCondom; int forceAnal = daily.forceAnal; int num2 = 15; if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Demanding) { num2 = 20; } if (kPlug.config.girlRequirement == ConfigCtrl.GirlRequirement.Insatiable) { num2 = 30; } angerIncr = 100 + forceNoCondom * num2 + forceAnal * num2; if (forceNoCondom > 0) { angerIncr += inQuantity * (flag ? 20 : 10); } favorTweak = (int)((float)angerIncr * (bitch ? 0.75f : 1f)); if (num) { favorTweak = (int)((float)favorTweak * 0.75f); } favorTweak = Mathf.Clamp(favorTweak, 0, 100); if (daily.raped) { favorTweak = 100; angerIncr = 999; } favorTweak *= -1; girl.isAnger = true; girl.anger = Mathf.Clamp(girl.anger + angerIncr, 0, 999); girl.favor = Mathf.Clamp(girl.favor + favorTweak, 0, 100); lewdTweak = 0; girl.lewdness = lewdTweak; } } } public class GirlQA { public static List<string> ExpStates = new List<string> { "0:First Time", "1:Newbie", "2:Used To", "3:Skilled", "4:Expert" }; public static bool IsRiskyDay(int day) { byte[] array = new byte[15] { 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }; if (array.Length <= day) { return false; } if (array[day] == 0) { return false; } if (array[day] == 1) { return true; } return false; } public static bool IsVirgin(Heroine girl) { if (girl.isVirgin) { return girl.isAnalVirgin; } return false; } public static bool WantToBreakToday(SnapShot.Daily daily) { Heroine val = kFileParser.FindSaveData(daily.girlName); if (!val.isGirlfriend || daily.isFixChara) { return false; } if (FeelAbused(val, daily)) { daily.breakMotive = Def.BreakMotive.AnalTrauma; } if (FeelSpoiled(val, daily)) { daily.breakMotive = Def.BreakMotive.Spoiled; } Def.Personality personality = Def.personalityEnums[((CharaData)val).personality]; bool flag = personality == Def.Personality.Yandere || personality == Def.Personality.Maternal; if (daily.opinionOnH == Def.DailySexOpinion.WorryOnPregnancy && !flag && AfraidToBePregnant(val, daily) && val.favor < 49) { daily.breakMotive = Def.BreakMotive.PregnancyStress; } return daily.breakMotive != Def.BreakMotive.Null; } public static bool AfraidToBePregnant(Heroine girl, SnapShot.Daily daily) { bool bitch = ((CharaData)girl).parameter.attribute.bitch; int num = ((!girl.isGirlfriend) ? (bitch ? 10 : 5) : (bitch ? 15 : 10)); if (daily.inQuantity > num) { return true; } return false; } public static bool FeelAbused(Heroine girl, SnapShot.Daily daily) { bool flag = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere; bool havEveningSex = daily.havEveningSex; if (daily.opinionOnH == Def.DailySexOpinion.Ecstatic || flag || havEveningSex) { return false; } int num = (((CharaData)girl).parameter.attribute.bitch ? 4 : 2); if (daily.forceAnal >= num) { return true; } return false; } public static bool FeelSpoiled(Heroine girl, SnapShot.Daily daily) { bool num = Def.personalityEnums[((CharaData)girl).personality] == Def.Personality.Yandere; bool bitch = ((CharaData)girl).parameter.attribute.bitch; int num2 = (num ? 1 : (bitch ? 2 : 3)); if (daily.frustrateTime > num2 && daily.interactInH == 0 && girl.favor != 100) { return true; } return false; } public static Def.Relation Relation(Heroine girl) { if (girl.isTeacher) { if (!girl.isVirgin || !girl.isAnalVirgin) { return Def.Relation.PrivateTeacher; } return Def.Relation.Teacher; } if (IsStoryHeroine(girl)) { if (!girl.isTaked) { return Def.Relation.StoryGirl; } return Def.Relation.GirlFriend; } if (girl.isGirlfriend) { return Def.Relation.GirlFriend; } if (girl.relation == 0) { if (!IsVirgin(girl)) { return Def.Relation.SexFriend; } return Def.Relation.JustSpoke; } if (girl.relation > 0) { if (!IsVirgin(girl)) { return Def.Relation.SexFriend; } return Def.Relation.Friend; } return Def.Relation.NotMeet; } public static string RelationToStr(Def.Relation relation) { bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); switch (relation) { case Def.Relation.JustSpoke: if (flag) { return ToolTranslation.GetUItxt("TodayRelJustMeet"); } return "Just spoke a bit"; case Def.Relation.Friend: return Diary.StatName("StatNmFriend"); case Def.Relation.Teacher: return Diary.StatName("StatNmTeach"); case Def.Relation.SexFriend: return Diary.StatName("StatNmSexFriend"); case Def.Relation.GirlFriend: return Diary.StatName("StatNmGirlfriend"); case Def.Relation.Ex: return Diary.StatName("StatNmEx"); case Def.Relation.StoryGirl: return Diary.StatName("StatNmStoryHer"); case Def.Relation.PrivateTeacher: return Diary.StatName("StatNmPrvtTeach"); default: if (flag) { return ToolTranslation.GetUItxt("TodayRelNotMeet"); } return "Never met You"; } } public static string Experience(Heroine girl, ref bool atMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Invalid comparison between Unknown and I4 HExperienceKind hExperience = girl.HExperience; bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? ExpStates : ToolTranslation.GetIndexedListFromTxt("StatsExpStates", 1)); if ((int)hExperience == 0) { return ToolMisc.GetStringAtIndex(list[0], ":", 2); } if ((int)hExperience == 1) { if (girl.countKokanH + girl.countAnalH + girl.houshiExp < 150f) { return ToolMisc.GetStringAtIndex(list[1], ":", 2); } if (girl.countKokanH + girl.countAnalH + girl.houshiExp < 250f) { return ToolMisc.GetStringAtIndex(list[2], ":", 2); } return ToolMisc.GetStringAtIndex(list[3], ":", 2); } if ((int)hExperience == 2 || (int)hExperience == 3) { atMax = true; return ToolMisc.GetStringAtIndex(list[4], ":", 2); } return ""; } public static string Experience(SnapShot.Stats girl, ref bool atMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Invalid comparison between Unknown and I4 HExperienceKind exp = girl.exp; bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? ExpStates : ToolTranslation.GetIndexedListFromTxt("StatsExpStates", 1)); if ((int)exp == 0) { return ToolMisc.GetStringAtIndex(list[0], ":", 2); } if ((int)exp == 1) { if (girl.vaginalExp + girl.analExp + girl.houshiExp < 150f) { return ToolMisc.GetStringAtIndex(list[1], ":", 2); } if (girl.vaginalExp + girl.analExp + girl.houshiExp < 250f) { return ToolMisc.GetStringAtIndex(list[2], ":", 2); } return ToolMisc.GetStringAtIndex(list[3], ":", 2); } if ((int)exp == 2 || (int)exp == 3) { atMax = true; return ToolMisc.GetStringAtIndex(list[4], ":", 2); } return ""; } public static bool HavEnoughExpForAfterSchoolSp(Heroine sav) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if ((int)sav.HExperience == 2 || (int)sav.HExperience == 3) { return true; } return false; } public static string WeakSpot(Heroine girl, bool allowTranslation) { return WeakSpot(((CharaData)girl).weakPoint, allowTranslation); } public static string WeakSpot(SnapShot.Stats girl) { return WeakSpot(girl.weakSpot, allowTranslation: true); } public static string WeakSpot(int val, bool allowTranslation) { bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language) && allowTranslation; if (val == -1) { if (flag) { return ToolTranslation.GetUItxt("NoWeakSpot"); } return "None"; } List<string> list = new List<string>(); list = ((!flag) ? new List<string> { "0:Kiss", "1:Sensitive Breast", "2:Sensitive Pussy", "3:Ticklish Ass", "4:Butt Caress", "5:Sensitive Tits" } : ToolTranslation.GetIndexedListFromTxt("weakSpots", 1)); return ToolMisc.GetStringAtIndex(list[val], ":", 2); } public static bool AllowKiss(Heroine girl) { if (!girl.isGirlfriend && !((CharaData)girl).denial.kiss) { if (!((CharaData)girl).denial.kiss) { return girl.hAreaExps[0] != 0f; } return false; } return true; } public static bool AllowKiss(SnapShot.Stats girl) { if (!girl.isGirlFriend && !girl.kissOk) { if (!girl.kissOk) { return girl.areaExp[0] != 0f; } return false; } return true; } public static bool AllowAnal(Heroine girl) { if (!((CharaData)girl).denial.anal) { if (!((CharaData)girl).denial.anal) { return girl.hAreaExps[3] == 100f; } return false; } return true; } public static bool AllowAnal(SnapShot.Stats girl) { if (!girl.analOk) { if (!girl.analOk) { return girl.areaExp[3] == 100f; } return false; } return true; } public static bool AllowNoCondom(Heroine girl) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 if (((CharaData)girl).denial.notCondom) { return true; } bool flag = (int)HFlag.GetMenstruation(girl.MenstruationDay) == 0 || girl.countNamaInsert >= 5; if (girl.fixCharaID < 0 && (int)girl.HExperience == 2 && flag) { return true; } if ((int)girl.HExperience == 2 && ((girl.relation == 1 && girl.favor >= 80) || girl.relation == 2) && flag) { return true; } if ((int)girl.HExperience == 3) { if (flag) { return true; } if (girl.countNamaInsert >= 3) { return true; } } return false; } public static bool AllowNoCondom(SnapShot.Stats girl) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 if (girl.insertOk) { return true; } bool flag = !girl.riskyDay || girl.namaInsert >= 5; if ((int)girl.exp == 2 && flag) { return true; } if ((int)girl.exp == 2 && ((girl.relation == 1 && girl.favor >= 80) || girl.relation == 2) && flag) { return true; } if ((int)girl.exp == 3) { if (flag) { return true; } if (girl.namaInsert >= 3) { return true; } } return false; } public static bool AllowHardTease(Heroine girl) { if (!((CharaData)girl).denial.aibu) { return girl.hAreaExps[3] != 0f; } return true; } public static bool AllowHardTease(SnapShot.Stats girl) { if (!girl.touchOk) { return girl.areaExp[3] != 0f; } return true; } public static bool AllowToyOnTits(Heroine girl) { if (!((CharaData)girl).denial.massage) { return girl.massageExps[1] != 0f; } return true; } public static bool AllowToyOnTits(SnapShot.Stats girl) { if (!girl.massageOk) { return girl.massageExp[1] != 0f; } return true; } public static bool NeedGumWithBuddy(AI_Public ai, AI_Public buddyAi) { if (!kPlug.tourInFreeH && !ai.isCardGuest && !buddyAi.isFutaBoy) { SnapShot.Daily daily = kPlug.statManager.GetDaily(ai.charaName); SnapShot.Stats stat = kPlug.statManager.GetStat(ai.charaName); bool flag = daily.reachExtase && kPlug.config.extaseBreakDenials; if (daily != null && stat != null) { if (!AllowNoCondom(stat)) { return !flag; } return false; } } return false; } public static bool AnalWithBuddy(AI_Public ai, AI_Public buddyAi) { if (!kPlug.tourInFreeH && !ai.isCardGuest && !buddyAi.isFutaBoy) { SnapShot.Daily daily = kPlug.statManager.GetDaily(ai.charaName); SnapShot.Stats stat = kPlug.statManager.GetStat(ai.charaName); if (daily != null && stat != null) { if (!AllowAnal(stat)) { if (daily.reachExtase) { return kPlug.config.extaseBreakDenials; } return false; } return true; } } return true; } public static string GetAnswerToKiss(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:Lovers do kiss", "1:Yes...", "2:Yes!", "3:No...", "4:Yes Kiss me!", "5:Want First" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerKiss", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToKiss(Heroine girl, ref bool addict) { if (girl.hAreaExps[0] == 100f) { addict = true; } if (girl.isGirlfriend) { return GetAnswerToKiss(0); } if (girl.hAreaExps[0] != 0f) { if (((CharaData)girl).denial.kiss) { return GetAnswerToKiss(2); } return GetAnswerToKiss(1); } if (((CharaData)girl).denial.kiss) { if (!girl.isKiss) { return GetAnswerToKiss(5); } return GetAnswerToKiss(4); } return GetAnswerToKiss(3); } public static string AnswerToKiss(SnapShot.Stats girl, ref bool addict) { if (girl.areaExp[0] == 100f) { addict = true; } if (girl.isGirlFriend) { return GetAnswerToKiss(0); } if (girl.areaExp[0] != 0f) { if (girl.kissOk) { return GetAnswerToKiss(2); } return GetAnswerToKiss(1); } if (girl.kissOk) { if (!girl.isKiss) { return GetAnswerToKiss(5); } return GetAnswerToKiss(4); } return GetAnswerToKiss(3); } public static string GetAnswerToAibu(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:Yes...Be kind", "1:Foundle Me!", "2:Ticklish", "3:Do Anything", "4:Love Anal Tease" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerAibu", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToAibu(Heroine girl, ref bool addict) { if (girl.hAreaExps[3] == 100f) { addict = true; } if (!((CharaData)girl).denial.aibu) { if (girl.hAreaExps[3] != 0f) { if (girl.hAreaExps[3] != 100f) { return GetAnswerToAibu(2); } return GetAnswerToAibu(1); } return GetAnswerToAibu(0); } if (girl.hAreaExps[3] != 0f) { if (girl.hAreaExps[3] != 100f) { return GetAnswerToAibu(1); } return GetAnswerToAibu(4); } return GetAnswerToAibu(3); } public static string AnswerToAibu(SnapShot.Stats girl, ref bool addict) { if (girl.areaExp[3] == 100f) { addict = true; } if (!girl.touchOk) { if (girl.areaExp[3] != 0f) { if (girl.areaExp[3] != 100f) { return GetAnswerToAibu(2); } return GetAnswerToAibu(1); } return GetAnswerToAibu(0); } if (girl.areaExp[3] != 0f) { if (girl.areaExp[3] != 100f) { return GetAnswerToAibu(1); } return GetAnswerToAibu(4); } return GetAnswerToAibu(3); } public static string GetAnswerToAnal(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:No Way! That won't fit...", "1:Why Not? Curious about...", "2:You may have force me, but stop that!", "3:Slaved to your wish!", "4:Not a fan, but obedient!", "5:Totally Addicted!", "6:Yes, enjoy the feeling!" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerAnal", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToAnal(Heroine girl, ref bool addict) { if (girl.isAnalVirgin) { if (((CharaData)girl).denial.anal) { return GetAnswerToAnal(1); } return GetAnswerToAnal(0); } if (!((CharaData)girl).denial.anal && girl.hAreaExps[3] != 100f) { return GetAnswerToAnal(2); } if (!((CharaData)girl).denial.anal) { if (girl.countAnalH == 100f) { addict = true; } if (girl.countAnalH != 100f) { return GetAnswerToAnal(4); } return GetAnswerToAnal(3); } if (girl.countAnalH == 100f) { addict = true; } if (girl.countAnalH != 100f) { return GetAnswerToAnal(6); } return GetAnswerToAnal(5); } public static string AnswerToAnal(SnapShot.Stats girl, ref bool addict) { if (girl.isAnalVirgin) { if (girl.analOk) { return GetAnswerToAnal(1); } return GetAnswerToAnal(0); } if (!girl.analOk && girl.areaExp[3] != 100f) { return GetAnswerToAnal(2); } if (!girl.analOk) { if (girl.analExp == 100f) { addict = true; } if (girl.analExp != 100f) { return GetAnswerToAnal(4); } return GetAnswerToAnal(3); } if (girl.analExp == 100f) { addict = true; } if (girl.analExp != 100f) { return GetAnswerToAnal(6); } return GetAnswerToAnal(5); } public static string GetAnswerToCondom(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:I beg you, put a gum!", "1:Doesn't care at all...", "2:Make me a Baby!", "3:Forget About That!", "4:Today's dangerous...put one please", "5:That's feel better without!", "6:Danger day! No Way Without!", "7:Conforted when you wear it", "8:Baby! Baby! Baby!", "9:Prefers Genuine Sensation!", "10:Danger day, but don't care", "11:No need for that useless thing..." } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerGum", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToCondom(Heroine girl, ref bool addict) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if (girl.isVirgin) { if (((CharaData)girl).denial.notCondom) { return GetAnswerToCondom(1); } return GetAnswerToCondom(0); } bool flag = IsRiskyDay(girl.MenstruationDay); if ((int)girl.HExperience == 3) { addict = true; if (!flag) { return GetAnswerToCondom(3); } return GetAnswerToCondom(2); } int countNamaInsert = girl.countNamaInsert; bool flag2 = girl.countKokanH == 100f; if (!((CharaData)girl).denial.notCondom) { if (countNamaInsert >= 10 || flag2) { if (!flag) { return GetAnswerToCondom(5); } return GetAnswerToCondom(4); } if (!flag) { return GetAnswerToCondom(7); } return GetAnswerToCondom(6); } if (countNamaInsert >= 10 || flag2) { addict = true; if (!flag) { return GetAnswerToCondom(9); } return GetAnswerToCondom(8); } if (!flag) { return GetAnswerToCondom(11); } return GetAnswerToCondom(10); } public static string AnswerToCondom(SnapShot.Stats girl, ref bool addict) { if (girl.isVirgin) { if (girl.insertOk) { return GetAnswerToCondom(1); } return GetAnswerToCondom(0); } bool riskyDay = girl.riskyDay; int namaInsert = girl.namaInsert; bool flag = girl.vaginalExp == 100f; if (!girl.insertOk) { if (namaInsert >= 10 || flag) { if (!riskyDay) { return GetAnswerToCondom(5); } return GetAnswerToCondom(4); } if (!riskyDay) { return GetAnswerToCondom(7); } return GetAnswerToCondom(6); } if (namaInsert >= 10 || flag) { addict = true; if (!riskyDay) { return GetAnswerToCondom(9); } return GetAnswerToCondom(8); } if (!riskyDay) { return GetAnswerToCondom(11); } return GetAnswerToCondom(10); } public static string GetAnswerToTitsToy(int id) { bool num = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); List<string> list = new List<string>(); list = ((!num) ? new List<string> { "0:Don't use that!", "1:Weird Sensation", "2:Sounds fun...", "3:So Good!", "4:Enjoy it" } : ToolTranslation.GetIndexedListFromTxt("denialsAnswerTitsToy", 1)); return ToolMisc.GetStringAtIndex(list[id], ":", 2); } public static string AnswerToTitsToy(Heroine girl, ref bool addict) { float num = girl.massageExps[0] + girl.massageExps[1]; if (num == 200f) { addict = true; } if (!((CharaData)girl).denial.massage) { if (girl.massageExps[1] != 0f) { return GetAnswerToTitsToy(1); } return GetAnswerToTitsToy(0); } if (num != 0f) { if (num != 200f) { return GetAnswerToTitsToy(4); } return GetAnswerToTitsToy(3); } return GetAnswerToTitsToy(2); } public static string AnswerToTitsToy(SnapShot.Stats girl, ref bool addict) { float num = girl.massageExp[0] + girl.massageExp[1]; if (num == 200f) { addict = true; } if (!girl.massageOk) { if (girl.massageExp[1] != 0f) { return GetAnswerToTitsToy(1); } return GetAnswerToTitsToy(0); } if (num != 0f) { if (num != 200f) { return GetAnswerToTitsToy(4); } return GetAnswerToTitsToy(3); } return GetAnswerToTitsToy(2); } public static string ComeToYourRoom(Heroine sav) { int myRoomCount = sav.myRoomCount; bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); string text = ((myRoomCount == 0) ? ((!flag) ? "Never seen your room" : (ToolTranslation.GetUItxt("StatTxtNeverInRoom") + " ")) : ((!flag) ? "Came to your room " : (ToolTranslation.GetUItxt("StatTxtCameToRoom") + " "))); if (myRoomCount == 0) { return text; } return text + myRoomCount + " " + Diary.TimeCountWord(myRoomCount); } public static bool HaveHExp(Heroine girl) { float num = girl.houshiExp + girl.countKokanH + girl.countAnalH; for (int i = 0; i < girl.hAreaExps.Length; i++) { num += girl.hAreaExps[i]; } for (int j = 0; j < girl.massageExps.Length; j++) { num += girl.massageExps[j]; } return num != 0f; } public static string Club(Heroine sav, bool allowTranslation) { if (kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language) && allowTranslation) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("Clubs", 1)[((CharaData)sav).clubActivities], ":", 2); } return Def.clubs[((CharaData)sav).clubActivities]; } public static string BloodTyp(Heroine sav) { return Def.bloodtyps[((CharaData)sav).bloodType]; } public static string Personality(Heroine sav) { if (kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language)) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("personalities", 1)[((CharaData)sav).personality], ":", 2); } return Def.personalities[((CharaData)sav).personality]; } public static string Personality(int id) { if (kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language)) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("personalities", 1)[id], ":", 2); } return Def.personalities[id]; } public static bool IsStoryHeroine(Heroine sav) { return kTranslator.StoryHeroineNames().Contains(kFileParser.GirlName(sav)); } public static string GetClasses(Heroine girl) { return ((CharaData)girl).schoolClass switch { -1 => "Story", 0 => "1 - 1", 1 => "2 - 1", 2 => "2 - 2", 3 => "3 - 1", _ => string.Empty, }; } public static string TeacherDiscipline(Heroine sav) { string text = kFileParser.GirlName(sav); bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); switch (text) { case "Nonoka Sakurai": if (flag) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("TeachDiscipline", 1)[0], ":", 2); } return "Homeroom Teacher"; case "Lina Roberts": case "Rina Labelle": if (flag) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("TeachDiscipline", 1)[1], ":", 2); } return "Academy Nurse"; case "Reina Hashimoto": if (flag) { return ToolMisc.GetStringAtIndex(ToolTranslation.GetIndexedListFromTxt("TeachDiscipline", 1)[2], ":", 2); } return "Mathematics Teacher"; default: return string.Empty; } } public static List<string> Traits(Heroine sav, bool allowTranslation) { List<string> list = new List<string>(); bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language) && allowTranslation; List<string> list2 = new List<string>(); if (flag) { list2 = ToolTranslation.GetIndexedListFromTxt("AllTraits", 1); } Attribute attribute = ((CharaData)sav).parameter.attribute; if (attribute.hinnyo) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[0], ":", 2) : "Small Bladder"); } if (attribute.harapeko) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[1], ":", 2) : "Always Hungry"); } if (attribute.donkan) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[2], ":", 2) : "Insensitive"); } if (attribute.choroi) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[3], ":", 2) : "Easy Going"); } if (attribute.bitch) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[4], ":", 2) : "Horny"); } if (attribute.mutturi) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[5], ":", 2) : "Taciturn"); } if (attribute.dokusyo) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[6], ":", 2) : "Bookworm"); } if (attribute.ongaku) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[7], ":", 2) : "Like Music"); } if (attribute.kappatu) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[8], ":", 2) : "Lively"); } if (attribute.ukemi) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[9], ":", 2) : "Passive"); } if (attribute.friendly) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[10], ":", 2) : "Friendly"); } if (attribute.kireizuki) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[11], ":", 2) : "Tidy"); } if (attribute.taida) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[12], ":", 2) : "Lazy"); } if (attribute.sinsyutu) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[13], ":", 2) : "Elusive"); } if (attribute.hitori) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[14], ":", 2) : "Loner"); } if (attribute.undo) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[15], ":", 2) : "Like Sports"); } if (attribute.majime) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[16], ":", 2) : "Serious"); } if (attribute.likeGirls) { list.Add(flag ? ToolMisc.GetStringAtIndex(list2[17], ":", 2) : "Like Girls"); } return list; } public static string ZodiacSign(Heroine sav) { List<string> obj = new List<string> { "Capricorn/Aquarius", "Aquarius/Pisces", "Pisces/Aries", "Aries/Taurus", "Taurus/Gemini", "Gemini/Cancer", "Cancer/Leo", "Leo/Virgo", "Virgo/Libra", "Libra/Scorpio", "Scorpio/Sagittarus", "Sagittarus/Capricorn" }; int birthMonth = ((CharaData)sav).birthMonth; string toSplit = obj[birthMonth - 1]; int birthDay = ((CharaData)sav).birthDay; int num = 21; int index = ((birthDay <= num) ? 1 : 2); return ToolMisc.GetStringAtIndex(toSplit, "/", index); } } public class GirlMood { public static string Interpret(Heroine girl, SnapShot.Daily dailyStat, Def.Mood mood, ref Def.MoodColors moodColor) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) _ = Def.personalityEnums[((CharaData)girl).personality]; _ = girl.HExperience; if (dailyStat.skipSchool) { moodColor = Def.MoodColors.Grey; } bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); if (girl.relation < 1 && GirlQA.IsVirgin(girl)) { string text = (flag ? ToolTranslation.GetUItxt("NotCloseEnoughMsg") : "Not Close Enough to know her thoughts or activities..."); if (girl.isAnger) { text = text + "\n" + (flag ? ToolTranslation.GetUItxt("NotCloseEnoughAnger") : "But seems she have a grudge against you !"); } return text; } string result = "Not Commented"; if (!kPlug.atHome && dailyStat.skipSchool) { return AtSkipSchool(girl, dailyStat); } if (mood == Def.Mood.AtInit && ((CharaData)girl).parameter.kindness != 0) { mood = Def.Mood.AfterDay; } switch (mood) { case Def.Mood.AtInit: result = AtInit(girl); break; case Def.Mood.AtSchool: result = AtSchool(girl, dailyStat, ref moodColor); break; case Def.Mood.AfterDay: result = AfterDay(girl, dailyStat, ref moodColor); break; } return result; } public static string AfterDay(Heroine girl, SnapShot.Daily dailyStat, ref Def.MoodColors moodColor) { string toSplit = "Undefined"; Def.Personality personality = Def.personalityEnums[((CharaData)girl).personality]; bool isGirlfriend = girl.isGirlfriend; string mindName = string.Empty; string empty = string.Empty; bool flag = kPlug.havLanguageFiles && !string.IsNullOrEmpty(kPlug.config.language); int kindness = ((CharaData)girl).parameter.kindness; string text = "shared_missedDat"; if ((dailyStat.isDateToday && !dailyStat.confirmDate && dailyStat.meetInH == 0) || kindness == -100) { moodColor = Def.MoodColors.Red; toSplit = ((!flag) ? (isGirlfriend ? Mind.shared_missedDat[1] : Mind.shared_missedDat[0]) : (isGirlfriend ? To