

using 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 HarmonyLib;
using Il2CppScheduleOne.Tiles;
using ManorNoSink;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::ManorNoSink.ManorNoSink), "ManorNoSink", "1.0.2", "k073l", null)]
[assembly: MelonColor(1, 0, 0, 255)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonPlatformDomain(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ManorNoSink-IL2CPP")]
[assembly: AssemblyConfiguration("Release IL2CPP")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ManorNoSink-IL2CPP")]
[assembly: AssemblyTitle("ManorNoSink-IL2CPP")]
[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.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ManorNoSink
{
public static class BuildInfo
{
public const string Name = "ManorNoSink";
public const string Description = "Removes sinks from Manor";
public const string Author = "k073l";
public const string Version = "1.0.2";
}
public class GridTilesHelper
{
public string GridPath;
public List<Coordinate> TilesToModify;
}
public class ManorNoSink : MelonMod
{
[HarmonyPatch(typeof(Grid), "GetTile")]
internal class GridGetTilePatch
{
private static void Postfix(Grid __instance, Coordinate coord, ref Tile __result)
{
if ((Object)(object)__instance == (Object)null || (Object)(object)__result != (Object)null)
{
return;
}
string fullPath = GetFullPath(((Component)__instance).transform);
if (!GridTilesHelpers.Select((GridTilesHelper h) => h.GridPath).Contains(fullPath))
{
return;
}
List<Coordinate> source = GridTilesHelpers.Where((GridTilesHelper h) => h.GridPath == fullPath).SelectMany((GridTilesHelper h) => h.TilesToModify).ToList();
if (source.Any((Coordinate c) => c.x == coord.x && c.y == coord.y))
{
Tile component = ((Component)((Component)__instance).transform.GetChild(1)).GetComponent<Tile>();
if ((Object)(object)component == (Object)null)
{
_logger.Warning("Template tile not found in grid at path: " + fullPath);
}
else
{
__result = GetOrCreateTile(__instance, component, coord);
}
}
}
private static string GetFullPath(Transform transform)
{
if ((Object)(object)transform.parent == (Object)null)
{
return ((Object)transform).name;
}
return GetFullPath(transform.parent) + "/" + ((Object)transform).name;
}
}
[CompilerGenerated]
private sealed class <_modifyGrids>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ManorNoSink <>4__this;
private List<GridTilesHelper>.Enumerator <>s__1;
private GridTilesHelper <gridHelper>5__2;
private GameObject <parent>5__3;
private Grid <grid>5__4;
private Tile <templateTile>5__5;
private List<Coordinate>.Enumerator <>s__6;
private Coordinate <coord>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <_modifyGrids>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = default(List<GridTilesHelper>.Enumerator);
<gridHelper>5__2 = null;
<parent>5__3 = null;
<grid>5__4 = null;
<templateTile>5__5 = null;
<>s__6 = default(List<Coordinate>.Enumerator);
<coord>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>s__1 = GridTilesHelpers.GetEnumerator();
try
{
while (<>s__1.MoveNext())
{
<gridHelper>5__2 = <>s__1.Current;
<parent>5__3 = GameObject.Find(<gridHelper>5__2.GridPath);
<grid>5__4 = <parent>5__3.GetComponent<Grid>();
if ((Object)(object)<grid>5__4 == (Object)null)
{
_logger.Warning("Grid not found at path: " + <gridHelper>5__2.GridPath);
continue;
}
<templateTile>5__5 = ((Component)((Component)<grid>5__4).transform.GetChild(1)).GetComponent<Tile>();
if ((Object)(object)<templateTile>5__5 == (Object)null)
{
_logger.Warning("Template tile not found in grid at path: " + <gridHelper>5__2.GridPath);
continue;
}
<>s__6 = <gridHelper>5__2.TilesToModify.GetEnumerator();
try
{
while (<>s__6.MoveNext())
{
<coord>5__7 = <>s__6.Current;
GetOrCreateTile(<grid>5__4, <templateTile>5__5, <coord>5__7);
<coord>5__7 = null;
}
}
finally
{
((IDisposable)<>s__6).Dispose();
}
<>s__6 = default(List<Coordinate>.Enumerator);
_logger.Msg("Modified grid at path: " + <gridHelper>5__2.GridPath);
<parent>5__3 = null;
<grid>5__4 = null;
<templateTile>5__5 = null;
<gridHelper>5__2 = null;
}
}
finally
{
((IDisposable)<>s__1).Dispose();
}
<>s__1 = default(List<GridTilesHelper>.Enumerator);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static Instance _logger;
private const string ManorSinksRoot = "@Properties/Manor/Taps/";
private static readonly List<GridTilesHelper> GridTilesHelpers = new List<GridTilesHelper>
{
new GridTilesHelper
{
GridPath = "@Properties/Manor/Grids/Room1",
TilesToModify = new List<Coordinate>
{
new Coordinate(14, 2),
new Coordinate(14, 3),
new Coordinate(15, 2),
new Coordinate(15, 3)
}
},
new GridTilesHelper
{
GridPath = "@Properties/Manor/Grids/Room2",
TilesToModify = new List<Coordinate>
{
new Coordinate(0, 2),
new Coordinate(0, 3),
new Coordinate(1, 2),
new Coordinate(1, 3)
}
}
};
public override void OnInitializeMelon()
{
_logger = ((MelonBase)this).LoggerInstance;
_logger.Msg("ManorNoSink initialized");
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
if (sceneName != "Main")
{
return;
}
List<string> list = new List<string> { "Standalone Sink", "Standalone Sink (1)" };
GameObject val = GameObject.Find("@Properties/Manor/Taps/");
foreach (string item in list)
{
Transform obj = val.transform.Find(item);
GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
if ((Object)(object)val2 != (Object)null)
{
_logger.Msg("Disabling sink: " + item);
val2.SetActive(false);
}
else
{
_logger.Warning("Sink not found: " + item);
}
}
MelonCoroutines.Start(_modifyGrids());
}
[IteratorStateMachine(typeof(<_modifyGrids>d__5))]
private IEnumerator _modifyGrids()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <_modifyGrids>d__5(0)
{
<>4__this = this
};
}
private static Tile GetOrCreateTile(Grid grid, Tile templateTile, Coordinate coord)
{
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
Tile result = default(Tile);
if (grid._coordinateToTile.TryGetValue(coord, ref result))
{
return result;
}
string name = $"Grid [{coord.x}, {coord.y}]";
Tile val = Object.Instantiate<Tile>(templateTile, ((Component)grid).transform);
((Object)val).name = name;
((Component)val).transform.localPosition = new Vector3((float)coord.x * Grid.TileSize, 0f, (float)coord.y * Grid.TileSize);
Tile component = ((Component)val).GetComponent<Tile>();
component.InitializePropertyTile(coord.x, coord.y, templateTile.AvailableOffset, grid);
grid.RegisterTile(component);
grid._coordinateToTile[coord] = component;
return component;
}
}
}using 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 HarmonyLib;
using ManorNoSink;
using MelonLoader;
using Microsoft.CodeAnalysis;
using ScheduleOne.Tiles;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::ManorNoSink.ManorNoSink), "ManorNoSink", "1.0.2", "k073l", null)]
[assembly: MelonColor(1, 0, 0, 255)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonPlatformDomain(/*Could not decode attribute arguments.*/)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ManorNoSink-Mono")]
[assembly: AssemblyConfiguration("Release Mono")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ManorNoSink-Mono")]
[assembly: AssemblyTitle("ManorNoSink-Mono")]
[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 ManorNoSink
{
public static class BuildInfo
{
public const string Name = "ManorNoSink";
public const string Description = "Removes sinks from Manor";
public const string Author = "k073l";
public const string Version = "1.0.2";
}
public class GridTilesHelper
{
public string GridPath;
public List<Coordinate> TilesToModify;
}
public class ManorNoSink : MelonMod
{
[HarmonyPatch(typeof(Grid), "GetTile")]
internal class GridGetTilePatch
{
private static void Postfix(Grid __instance, Coordinate coord, ref Tile __result)
{
if ((Object)(object)__instance == (Object)null || (Object)(object)__result != (Object)null)
{
return;
}
string fullPath = GetFullPath(((Component)__instance).transform);
if (!GridTilesHelpers.Select((GridTilesHelper h) => h.GridPath).Contains(fullPath))
{
return;
}
List<Coordinate> source = GridTilesHelpers.Where((GridTilesHelper h) => h.GridPath == fullPath).SelectMany((GridTilesHelper h) => h.TilesToModify).ToList();
if (source.Any((Coordinate c) => c.x == coord.x && c.y == coord.y))
{
Tile component = ((Component)((Component)__instance).transform.GetChild(1)).GetComponent<Tile>();
if ((Object)(object)component == (Object)null)
{
_logger.Warning("Template tile not found in grid at path: " + fullPath);
}
else
{
__result = GetOrCreateTile(__instance, component, coord);
}
}
}
private static string GetFullPath(Transform transform)
{
if ((Object)(object)transform.parent == (Object)null)
{
return ((Object)transform).name;
}
return GetFullPath(transform.parent) + "/" + ((Object)transform).name;
}
}
[CompilerGenerated]
private sealed class <_modifyGrids>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ManorNoSink <>4__this;
private List<GridTilesHelper>.Enumerator <>s__1;
private GridTilesHelper <gridHelper>5__2;
private GameObject <parent>5__3;
private Grid <grid>5__4;
private Tile <templateTile>5__5;
private List<Coordinate>.Enumerator <>s__6;
private Coordinate <coord>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <_modifyGrids>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = default(List<GridTilesHelper>.Enumerator);
<gridHelper>5__2 = null;
<parent>5__3 = null;
<grid>5__4 = null;
<templateTile>5__5 = null;
<>s__6 = default(List<Coordinate>.Enumerator);
<coord>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>s__1 = GridTilesHelpers.GetEnumerator();
try
{
while (<>s__1.MoveNext())
{
<gridHelper>5__2 = <>s__1.Current;
<parent>5__3 = GameObject.Find(<gridHelper>5__2.GridPath);
<grid>5__4 = <parent>5__3.GetComponent<Grid>();
if ((Object)(object)<grid>5__4 == (Object)null)
{
_logger.Warning("Grid not found at path: " + <gridHelper>5__2.GridPath);
continue;
}
<templateTile>5__5 = ((Component)((Component)<grid>5__4).transform.GetChild(1)).GetComponent<Tile>();
if ((Object)(object)<templateTile>5__5 == (Object)null)
{
_logger.Warning("Template tile not found in grid at path: " + <gridHelper>5__2.GridPath);
continue;
}
<>s__6 = <gridHelper>5__2.TilesToModify.GetEnumerator();
try
{
while (<>s__6.MoveNext())
{
<coord>5__7 = <>s__6.Current;
GetOrCreateTile(<grid>5__4, <templateTile>5__5, <coord>5__7);
<coord>5__7 = null;
}
}
finally
{
((IDisposable)<>s__6).Dispose();
}
<>s__6 = default(List<Coordinate>.Enumerator);
_logger.Msg("Modified grid at path: " + <gridHelper>5__2.GridPath);
<parent>5__3 = null;
<grid>5__4 = null;
<templateTile>5__5 = null;
<gridHelper>5__2 = null;
}
}
finally
{
((IDisposable)<>s__1).Dispose();
}
<>s__1 = default(List<GridTilesHelper>.Enumerator);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static Instance _logger;
private const string ManorSinksRoot = "@Properties/Manor/Taps/";
private static readonly List<GridTilesHelper> GridTilesHelpers = new List<GridTilesHelper>
{
new GridTilesHelper
{
GridPath = "@Properties/Manor/Grids/Room1",
TilesToModify = new List<Coordinate>
{
new Coordinate(14, 2),
new Coordinate(14, 3),
new Coordinate(15, 2),
new Coordinate(15, 3)
}
},
new GridTilesHelper
{
GridPath = "@Properties/Manor/Grids/Room2",
TilesToModify = new List<Coordinate>
{
new Coordinate(0, 2),
new Coordinate(0, 3),
new Coordinate(1, 2),
new Coordinate(1, 3)
}
}
};
public override void OnInitializeMelon()
{
_logger = ((MelonBase)this).LoggerInstance;
_logger.Msg("ManorNoSink initialized");
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
if (sceneName != "Main")
{
return;
}
List<string> list = new List<string> { "Standalone Sink", "Standalone Sink (1)" };
GameObject val = GameObject.Find("@Properties/Manor/Taps/");
foreach (string item in list)
{
Transform obj = val.transform.Find(item);
GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
if ((Object)(object)val2 != (Object)null)
{
_logger.Msg("Disabling sink: " + item);
val2.SetActive(false);
}
else
{
_logger.Warning("Sink not found: " + item);
}
}
MelonCoroutines.Start(_modifyGrids());
}
[IteratorStateMachine(typeof(<_modifyGrids>d__5))]
private IEnumerator _modifyGrids()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <_modifyGrids>d__5(0)
{
<>4__this = this
};
}
private static Tile GetOrCreateTile(Grid grid, Tile templateTile, Coordinate coord)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (grid._coordinateToTile.TryGetValue(coord, out var value))
{
return value;
}
string name = $"Grid [{coord.x}, {coord.y}]";
Tile val = Object.Instantiate<Tile>(templateTile, ((Component)grid).transform);
((Object)val).name = name;
((Component)val).transform.localPosition = new Vector3((float)coord.x * 0.5f, 0f, (float)coord.y * 0.5f);
Tile component = ((Component)val).GetComponent<Tile>();
component.InitializePropertyTile(coord.x, coord.y, templateTile.AvailableOffset, grid);
grid.RegisterTile(component);
grid._coordinateToTile[coord] = component;
return component;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}