using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Dinghies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Dinghies")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4861a431-f590-441d-b316-7e369b90c25b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
public class HingeJointFix : MonoBehaviour
{
private Quaternion initialLocalRotation;
private Vector3 initialLocalPosition;
private Quaternion localRotationOnDisable;
private Vector3 localPositionOnDisable;
private bool hasDisabled;
private void Awake()
{
//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_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)
initialLocalRotation = ((Component)this).transform.localRotation;
initialLocalPosition = ((Component)this).transform.localPosition;
}
private void OnDisable()
{
//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_0019: 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_003c: Unknown result type (might be due to invalid IL or missing references)
localRotationOnDisable = ((Component)this).transform.localRotation;
((Component)this).transform.localRotation = initialLocalRotation;
localPositionOnDisable = ((Component)this).transform.localPosition;
((Component)this).transform.localPosition = initialLocalPosition;
hasDisabled = true;
}
private void Update()
{
//IL_001a: 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)
if (hasDisabled)
{
hasDisabled = false;
((Component)this).transform.localRotation = localRotationOnDisable;
((Component)this).transform.localPosition = localPositionOnDisable;
}
}
}
namespace Dinghies;
internal class IndexManager
{
private static bool updateSave;
private static bool updateLegacySave;
private static bool xebec;
public static Dictionary<string, int> loadedIndexMap = new Dictionary<string, int>();
public static Dictionary<string, int> indexMap = new Dictionary<string, int>();
public static string loadedVersion;
[HarmonyPriority(400)]
[HarmonyPrefix]
private static void Manager(int backupIndex)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
Debug.LogWarning((object)"Dinghies: Manager running");
string path = ((backupIndex != 0) ? SaveSlots.GetBackupPath(SaveSlots.currentSlot, backupIndex) : SaveSlots.GetCurrentSavePath());
BinaryFormatter binaryFormatter = new BinaryFormatter();
SaveContainer val;
using (FileStream serializationStream = File.Open(path, FileMode.Open))
{
val = (SaveContainer)binaryFormatter.Deserialize(serializationStream);
}
LoadSavedIndexes(val);
DetectXebec(val);
ValidateIndexes();
if (updateSave || updateLegacySave)
{
if (updateLegacySave)
{
val = UpdateFromLegacy(val);
}
if (updateSave)
{
val = UpdateSave(val);
}
}
using FileStream serializationStream2 = File.Open(path, FileMode.Create);
binaryFormatter.Serialize(serializationStream2, val);
}
[HarmonyPostfix]
public static void SaveIndex()
{
if (GameState.currentlyLoading)
{
GameState.modData["pr0skynesis.dinghies"] = "";
SaveModData();
}
}
[HarmonyPostfix]
public static void StartNewGamePatch()
{
SaveModData();
}
public static void AssignAvailableIndex(GameObject boat)
{
SaveableObject[] currentObjects = SaveLoadManager.instance.GetCurrentObjects();
int holeSize = GetHoleSize(boat);
int num = FindHole(currentObjects, holeSize);
boat.GetComponent<SaveableObject>().sceneIndex = num;
indexMap[((Object)boat).name] = num;
}
public static void LoadSavedIndexes(SaveContainer saveContainer)
{
if (saveContainer.modData.ContainsKey("pr0skynesis.dinghies"))
{
string text = saveContainer.modData["pr0skynesis.dinghies"];
string[] array = text.Split(new char[1] { ';' });
for (int i = 0; i < array.Length - 1; i++)
{
string key = array[i].Split(new char[1] { ':' })[0];
int value = int.Parse(array[i].Split(new char[1] { ':' })[1]);
loadedIndexMap[key] = value;
}
}
if (saveContainer.modData.ContainsKey("pr0.dinghies.version"))
{
loadedVersion = saveContainer.modData["pr0.dinghies.version"];
}
else
{
updateLegacySave = true;
}
}
private static void DetectXebec(SaveContainer saveContainer)
{
if (saveContainer.savedObjects.Any((SaveObjectData x) => x.sceneIndex == 133) && updateLegacySave)
{
xebec = true;
}
}
private static SaveContainer UpdateSave(SaveContainer saveContainer)
{
Debug.LogWarning((object)("Dinghies: updating save " + SaveSlots.currentSlot));
foreach (string boat in loadedIndexMap.Keys)
{
foreach (SavePrefabData item in saveContainer.savedPrefabs.Where((SavePrefabData x) => x != null && x.itemParentObject == loadedIndexMap[boat]))
{
item.itemParentObject = indexMap[boat];
}
foreach (SaveObjectData item2 in saveContainer.savedObjects.Where((SaveObjectData x) => x != null && x.sceneIndex == loadedIndexMap[boat]))
{
item2.sceneIndex = indexMap[boat];
}
if (saveContainer.modData.ContainsKey($"SEboatSails.{loadedIndexMap[boat]}"))
{
string value = saveContainer.modData[$"SEboatSails.{loadedIndexMap[boat]}"];
saveContainer.modData.Remove($"SEboatSails.{loadedIndexMap[boat]}");
saveContainer.modData[$"SEboatSails.{indexMap[boat]}"] = value;
}
}
Debug.LogWarning((object)"Dinghies: save updated...");
return saveContainer;
}
public static SaveContainer UpdateFromLegacy(SaveContainer saveContainer)
{
Debug.LogWarning((object)("Dinghies: updating save " + SaveSlots.currentSlot + " from legacy version"));
foreach (string key in indexMap.Keys)
{
if (!xebec)
{
foreach (SavePrefabData item in saveContainer.savedPrefabs.Where((SavePrefabData x) => x.itemParentObject == 130 || x.itemParentObject == 131 || x.itemParentObject == 132))
{
item.itemParentObject = indexMap[key];
}
continue;
}
foreach (SavePrefabData item2 in saveContainer.savedPrefabs.Where((SavePrefabData x) => x.itemParentObject == 130))
{
item2.itemParentObject = indexMap[key];
}
}
foreach (string key2 in indexMap.Keys)
{
if (!xebec)
{
foreach (SaveObjectData item3 in saveContainer.savedObjects.Where((SaveObjectData x) => x.sceneIndex == 130 || x.sceneIndex == 131 || x.sceneIndex == 132))
{
if (item3.sceneIndex == 130)
{
item3.sceneIndex = indexMap[key2];
}
else if (item3.sceneIndex == 131)
{
item3.sceneIndex = indexMap[key2] + 1;
}
else if (item3.sceneIndex == 132)
{
item3.sceneIndex = indexMap[key2] + 2;
}
}
continue;
}
foreach (SaveObjectData item4 in saveContainer.savedObjects.Where((SaveObjectData x) => x.sceneIndex == 130))
{
if (item4.sceneIndex == 130)
{
item4.sceneIndex = indexMap[key2];
}
}
}
if (saveContainer.modData.ContainsKey("SEboatSails.130"))
{
string value = saveContainer.modData["SEboatSails.130"];
saveContainer.modData.Remove("SEboatSails.130");
saveContainer.modData[$"SEboatSails.{indexMap[indexMap.Keys.First()]}"] = value;
}
Debug.LogWarning((object)"Dinghies: save updated from legacy version...");
return saveContainer;
}
private static void SaveModData()
{
GameState.modData["pr0skynesis.dinghies"] = "";
foreach (string key in indexMap.Keys)
{
string text = key.ToString() + ":" + indexMap[key] + ";";
if (GameState.modData.ContainsKey("pr0skynesis.dinghies"))
{
GameState.modData["pr0skynesis.dinghies"] += text;
}
else
{
GameState.modData["pr0skynesis.dinghies"] = text;
}
}
GameState.modData["pr0.dinghies.version"] = "1.0.5";
}
private static int GetHoleSize(GameObject boat)
{
return boat.GetComponent<BoatMooringRopes>().ropes.Length + 1;
}
public static int FindHole(SaveableObject[] array, int holeSize)
{
for (int i = 1; i < array.Length - holeSize; i++)
{
if (!((Object)(object)array[i] == (Object)null))
{
continue;
}
for (int j = 0; j < holeSize && !((Object)(object)array[i + j] != (Object)null); j++)
{
if (j == holeSize - 1)
{
return i;
}
}
}
return -1;
}
private static void ValidateIndexes()
{
foreach (string key in indexMap.Keys)
{
if (loadedIndexMap.ContainsKey(key) && loadedIndexMap[key] != indexMap[key])
{
updateSave = true;
}
}
}
}
public class Nameplate : GoPointerButton
{
private string plateName;
private const string key = "pr0.dinghies.plateName";
private int letterCount;
private float unpausedTimescale;
private float textAnchorX;
private float textAnchorY;
private float textAnchorZ;
private float currentOffset;
private readonly float[] spacing = new float[27]
{
0.045f, 0.065f, 0.06f, 0.07f, 0.06f, 0.06f, 0.06f, 0.07f, 0.035f, 0.045f,
0.065f, 0.055f, 0.095f, 0.075f, 0.065f, 0.055f, 0.065f, 0.06f, 0.05f, 0.06f,
0.07f, 0.065f, 0.09f, 0.06f, 0.06f, 0.05f, 0.06f
};
private bool typing;
private bool initialised;
private Nameplate otherPlate;
private Transform boat;
private Transform textAnchor;
private Vector3 direction = new Vector3(-1f, 0f, 0f);
private void Awake()
{
//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_00a4: Unknown result type (might be due to invalid IL or missing references)
Transform parent = ((Component)this).transform.parent;
boat = parent.parent;
if (((Object)this).name == "nameplate_left")
{
otherPlate = ((Component)parent.Find("nameplate_right")).GetComponent<Nameplate>();
}
else
{
otherPlate = ((Component)parent.Find("nameplate_left")).GetComponent<Nameplate>();
}
textAnchor = ((Component)this).transform.GetChild(0);
textAnchorX = textAnchor.localPosition.x;
textAnchorY = textAnchor.localPosition.y;
textAnchorZ = textAnchor.localPosition.z;
plateName = "";
}
public override void OnActivate()
{
if (!typing)
{
unpausedTimescale = Time.timeScale;
Time.timeScale = 0f;
typing = true;
MouseLook.ToggleMouseLook(false);
Refs.SetPlayerControl(false);
}
}
public override void ExtraLateUpdate()
{
if (!initialised && GameState.playing)
{
LoadName();
initialised = true;
}
if (typing)
{
if (Input.GetKeyDown((KeyCode)97))
{
AddLetter('A', 0);
otherPlate.AddLetter('A', 0);
}
else if (Input.GetKeyDown((KeyCode)98))
{
AddLetter('B', 1);
otherPlate.AddLetter('B', 1);
}
else if (Input.GetKeyDown((KeyCode)99))
{
AddLetter('C', 2);
otherPlate.AddLetter('C', 2);
}
else if (Input.GetKeyDown((KeyCode)100))
{
AddLetter('D', 3);
otherPlate.AddLetter('D', 3);
}
else if (Input.GetKeyDown((KeyCode)101))
{
AddLetter('E', 4);
otherPlate.AddLetter('E', 4);
}
else if (Input.GetKeyDown((KeyCode)102))
{
AddLetter('F', 5);
otherPlate.AddLetter('F', 5);
}
else if (Input.GetKeyDown((KeyCode)103))
{
AddLetter('G', 6);
otherPlate.AddLetter('G', 6);
}
else if (Input.GetKeyDown((KeyCode)104))
{
AddLetter('H', 7);
otherPlate.AddLetter('H', 7);
}
else if (Input.GetKeyDown((KeyCode)105))
{
AddLetter('I', 8);
otherPlate.AddLetter('I', 8);
}
else if (Input.GetKeyDown((KeyCode)106))
{
AddLetter('J', 9);
otherPlate.AddLetter('J', 9);
}
else if (Input.GetKeyDown((KeyCode)107))
{
AddLetter('K', 10);
otherPlate.AddLetter('K', 10);
}
else if (Input.GetKeyDown((KeyCode)108))
{
AddLetter('L', 11);
otherPlate.AddLetter('L', 11);
}
else if (Input.GetKeyDown((KeyCode)109))
{
AddLetter('M', 12);
otherPlate.AddLetter('M', 12);
}
else if (Input.GetKeyDown((KeyCode)110))
{
AddLetter('N', 13);
otherPlate.AddLetter('N', 13);
}
else if (Input.GetKeyDown((KeyCode)111))
{
AddLetter('O', 14);
otherPlate.AddLetter('O', 14);
}
else if (Input.GetKeyDown((KeyCode)112))
{
AddLetter('P', 15);
otherPlate.AddLetter('P', 15);
}
else if (Input.GetKeyDown((KeyCode)113))
{
AddLetter('Q', 16);
otherPlate.AddLetter('Q', 16);
}
else if (Input.GetKeyDown((KeyCode)114))
{
AddLetter('R', 17);
otherPlate.AddLetter('R', 17);
}
else if (Input.GetKeyDown((KeyCode)115))
{
AddLetter('S', 18);
otherPlate.AddLetter('S', 18);
}
else if (Input.GetKeyDown((KeyCode)116))
{
AddLetter('T', 19);
otherPlate.AddLetter('T', 19);
}
else if (Input.GetKeyDown((KeyCode)117))
{
AddLetter('U', 20);
otherPlate.AddLetter('U', 20);
}
else if (Input.GetKeyDown((KeyCode)118))
{
AddLetter('V', 21);
otherPlate.AddLetter('V', 21);
}
else if (Input.GetKeyDown((KeyCode)119))
{
AddLetter('W', 22);
otherPlate.AddLetter('W', 22);
}
else if (Input.GetKeyDown((KeyCode)120))
{
AddLetter('X', 23);
otherPlate.AddLetter('X', 23);
}
else if (Input.GetKeyDown((KeyCode)121))
{
AddLetter('Y', 24);
otherPlate.AddLetter('Y', 24);
}
else if (Input.GetKeyDown((KeyCode)122))
{
AddLetter('Z', 25);
otherPlate.AddLetter('Z', 25);
}
else if (Input.GetKeyDown((KeyCode)32))
{
AddLetter(' ', 26);
otherPlate.AddLetter(' ', 26);
}
else if (Input.GetKeyDown((KeyCode)8))
{
RemoveLetter();
otherPlate.RemoveLetter();
}
else if (Input.GetKeyDown((KeyCode)13))
{
Time.timeScale = unpausedTimescale;
SaveName();
otherPlate.SaveName();
typing = false;
Refs.SetPlayerControl(true);
MouseLook.ToggleMouseLook(true);
}
}
}
private void AddLetter(char letter, int index)
{
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_006a: 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_007b: 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)
if (!(currentOffset > 1.25f))
{
plateName += letter;
if (index < 26)
{
GameObject val = Object.Instantiate<GameObject>(DinghiesPatches.letters[index], textAnchor);
Transform transform = val.transform;
currentOffset += spacing[index];
transform.localPosition += direction * currentOffset;
}
else
{
Object.Instantiate<GameObject>(new GameObject(), textAnchor);
currentOffset += spacing[index];
}
if (currentOffset > 0.95f)
{
ScaleAnchor(0.4f);
}
else if (currentOffset > 0.72f)
{
ScaleAnchor(0.6f);
}
else if (currentOffset > 0.55f)
{
ScaleAnchor(0.8f);
}
letterCount++;
}
}
private void RemoveLetter()
{
if (letterCount != 0)
{
letterCount--;
char l = plateName[letterCount];
plateName = plateName.Remove(letterCount);
currentOffset -= spacing[IndexFromLetter(l)];
Object.Destroy((Object)(object)((Component)textAnchor.GetChild(letterCount)).gameObject);
if (currentOffset < 0.55f)
{
ScaleAnchor(1f);
}
else if (currentOffset < 0.72f)
{
ScaleAnchor(0.8f);
}
else if (currentOffset < 0.95f)
{
ScaleAnchor(0.6f);
}
}
}
private void ScaleAnchor(float scale)
{
//IL_000b: 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)
textAnchor.localScale = new Vector3(0f - scale, scale, scale);
textAnchor.localPosition = new Vector3(textAnchorX, textAnchorY * scale, textAnchorZ);
}
private int IndexFromLetter(char l)
{
return l switch
{
'A' => 0,
'B' => 1,
'C' => 2,
'D' => 3,
'E' => 4,
'F' => 5,
'G' => 6,
'H' => 7,
'I' => 8,
'J' => 9,
'K' => 10,
'L' => 11,
'M' => 12,
'N' => 13,
'O' => 14,
'P' => 15,
'Q' => 16,
'R' => 17,
'S' => 18,
'T' => 19,
'U' => 20,
'V' => 21,
'W' => 22,
'X' => 23,
'Y' => 24,
'Z' => 25,
_ => 26,
};
}
private void WriteLoadedName(string str)
{
foreach (char c in str)
{
AddLetter(c, IndexFromLetter(c));
}
}
private void SaveName()
{
GameState.modData["pr0.dinghies.plateName"] = ((Object)boat).name + ":" + plateName + ";";
}
private void LoadName()
{
if (!GameState.modData.ContainsKey("pr0.dinghies.plateName"))
{
return;
}
string text = GameState.modData["pr0.dinghies.plateName"];
string[] array = text.Split(new char[1] { ';' });
string[] array2 = array;
foreach (string text2 in array2)
{
string[] array3 = text2.Split(new char[1] { ':' });
if (array3[0] == ((Object)boat).name)
{
WriteLoadedName(array3[1]);
}
}
}
}
public class OarLocks : GoPointerButton
{
public bool oarUp;
private Oar leftOar;
private Oar rightOar;
private float min1 = -3f;
private float max1 = -2.9f;
private float min2 = 94.5f;
private float max2 = 95f;
private void Awake()
{
leftOar = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).GetComponent<Oar>();
rightOar = ((Component)((Component)this).transform.GetChild(1).GetChild(0)).GetComponent<Oar>();
leftOar.locks = this;
rightOar.locks = this;
}
public override void OnActivate()
{
//IL_0075: 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)
if (!oarUp)
{
oarUp = true;
SetPosition(oarUp);
Juicebox.juice.PlaySoundAt("lock unlock", ((Component)this).transform.position, 0f, 0.66f, 0.88f);
}
else
{
oarUp = false;
SetPosition(oarUp);
Juicebox.juice.PlaySoundAt("lock unlock", ((Component)this).transform.position, 0f, 0.66f, 0.88f);
}
}
public void SetPosition(bool up)
{
//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_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_007a: 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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
Debug.LogWarning((object)"OarLocks: SetPosition called...");
if (up)
{
JointLimits limits = leftOar.joint.limits;
JointLimits limits2 = leftOar.parentJoint.limits;
((JointLimits)(ref limits)).min = min1;
((JointLimits)(ref limits)).max = max1;
((JointLimits)(ref limits2)).min = min2;
((JointLimits)(ref limits2)).max = max2;
leftOar.joint.limits = limits;
rightOar.joint.limits = limits;
leftOar.parentJoint.limits = limits2;
rightOar.parentJoint.limits = limits2;
leftOar.joint.useLimits = true;
rightOar.joint.useLimits = true;
leftOar.parentJoint.useLimits = true;
rightOar.parentJoint.useLimits = true;
leftOar.joint.useSpring = false;
rightOar.joint.useSpring = false;
leftOar.parentJoint.useSpring = false;
rightOar.parentJoint.useSpring = false;
}
else
{
leftOar.joint.useLimits = false;
rightOar.joint.useLimits = false;
leftOar.parentJoint.useLimits = false;
rightOar.parentJoint.useLimits = false;
leftOar.joint.useSpring = true;
rightOar.joint.useSpring = true;
leftOar.parentJoint.useSpring = true;
rightOar.parentJoint.useSpring = true;
}
}
}
public class Oar : GoPointerButton
{
private Oar leftOar;
private Oar rightOar;
public HingeJoint joint;
public HingeJoint parentJoint;
public static bool grabbed;
public static bool used;
public static bool firstTime;
public bool rowing;
private int isLeft;
private Rigidbody rb;
private Transform forcePoint;
public Rudder rudder;
public TillerRudder tiller;
public OarLocks locks;
private void Awake()
{
joint = ((Component)this).GetComponent<HingeJoint>();
parentJoint = ((Component)((Component)this).transform.parent).GetComponent<HingeJoint>();
if (((Object)this).name == "oar_left")
{
leftOar = this;
isLeft = 1;
rightOar = ((Component)((Component)this).transform.parent.parent.GetChild(1)).GetComponentInChildren<Oar>();
forcePoint = ((Component)this).transform.parent.parent.GetChild(2);
}
else
{
rightOar = this;
isLeft = -1;
leftOar = ((Component)((Component)this).transform.parent.parent.GetChild(0)).GetComponentInChildren<Oar>();
forcePoint = ((Component)this).transform.parent.parent.GetChild(3);
}
((Component)this).gameObject.AddComponent<HingeJointFix>();
((Component)parentJoint).gameObject.AddComponent<HingeJointFix>();
rb = ((Component)((Component)this).transform.parent.parent.parent.parent).GetComponent<Rigidbody>();
rudder = ((Component)((Component)rb).transform.Find("cutterModel").Find("rudder")).GetComponent<Rudder>();
tiller = ((Component)((Component)rudder).transform.GetChild(0)).GetComponent<TillerRudder>();
}
public override void OnActivate(GoPointer activatingPointer)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
if (Settings.steeringWithMouse && (int)activatingPointer.type == 2)
{
MouseLook.ToggleMouseLook(false);
}
if (!Settings.steeringWithMouse && (int)activatingPointer.type == 2)
{
((GoPointerButton)this).StickyClick(activatingPointer);
}
}
public override void OnUnactivate(GoPointer activatingPointer)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
if (Settings.steeringWithMouse && (int)activatingPointer.type == 2)
{
MouseLook.ToggleMouseLook(true);
}
}
public override void ExtraLateUpdate()
{
//IL_0105: 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_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
if (!firstTime)
{
locks.oarUp = true;
locks.SetPosition(locks.oarUp);
firstTime = true;
}
else
{
if (locks.oarUp)
{
return;
}
if (Object.op_Implicit((Object)(object)base.stickyClickedBy) || base.isClicked)
{
leftOar.joint.useLimits = false;
leftOar.joint.useSpring = true;
rightOar.joint.useLimits = false;
rightOar.joint.useSpring = true;
used = true;
if ((Object)(object)tiller == (Object)null)
{
Debug.LogWarning((object)"Dinghies: tiller is null");
}
if (!tiller.locked)
{
rudder.rudderPower = 0f;
}
if (Input.GetKey(DinghiesMain.leftFConfig.Value) && !leftOar.rowing)
{
((MonoBehaviour)this).StartCoroutine(leftOar.Row(1f));
}
if (Input.GetKey(DinghiesMain.rightFConfig.Value) && !rightOar.rowing)
{
((MonoBehaviour)this).StartCoroutine(rightOar.Row(1f));
}
if (Input.GetKey(DinghiesMain.leftBConfig.Value) && !leftOar.rowing)
{
((MonoBehaviour)this).StartCoroutine(leftOar.Row(-1f));
}
if (Input.GetKey(DinghiesMain.rightBConfig.Value) && !rightOar.rowing)
{
((MonoBehaviour)this).StartCoroutine(rightOar.Row(-1f));
}
}
else if (used && !Object.op_Implicit((Object)(object)((GoPointerButton)leftOar).stickyClickedBy) && !Object.op_Implicit((Object)(object)((GoPointerButton)rightOar).stickyClickedBy) && !((GoPointerButton)leftOar).isClicked && !((GoPointerButton)rightOar).isClicked)
{
rudder.rudderPower = 10f;
leftOar.ResetPos();
rightOar.ResetPos();
}
}
}
public IEnumerator Row(float dir)
{
rowing = true;
JointSpring spring1 = joint.spring;
JointSpring spring2 = parentJoint.spring;
for (float t = 0f; t <= 1f; t += Time.deltaTime * 0.5f)
{
float heel = GetBoatHeeling() * (float)isLeft;
float angle = t * 2f * (float)Math.PI;
spring1.targetPosition = Mathf.Lerp(-10f + heel, 25f + heel, 0.5f + 0.5f * Mathf.Sin(angle));
joint.spring = spring1;
spring2.targetPosition = Mathf.Lerp(35f * dir, -35f * dir, 0.5f + 0.5f * Mathf.Cos(angle));
parentJoint.spring = spring2;
yield return (object)new WaitForEndOfFrame();
}
AddOarForce(dir);
rowing = false;
}
public void ResetPos()
{
//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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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)
JointSpring spring = joint.spring;
JointSpring spring2 = parentJoint.spring;
JointLimits limits = joint.limits;
spring.targetPosition = 0f;
spring2.targetPosition = 0f;
((JointLimits)(ref limits)).max = 45f;
rightOar.joint.spring = spring;
leftOar.joint.spring = spring;
rightOar.parentJoint.spring = spring2;
leftOar.parentJoint.spring = spring2;
rightOar.joint.limits = limits;
leftOar.joint.limits = limits;
joint.useLimits = true;
joint.useSpring = false;
used = false;
}
private void AddOarForce(float dir)
{
//IL_0011: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
Juicebox.juice.PlaySoundAt("ug tank splash", ((Component)this).transform.position, 2f, 1f);
float z = ((Component)rb).transform.InverseTransformDirection(rb.velocity).z;
Vector3 val = ((dir > 0f) ? ((Component)rb).transform.forward : (-((Component)rb).transform.forward));
Vector3 velocity = rb.velocity;
float magnitude = ((Vector3)(ref velocity)).magnitude;
float num = Mathf.Lerp(250f, 0f, Mathf.Clamp(magnitude, 0f, 2f) / 2f);
if (z * dir < 0f)
{
num = 200f;
}
rb.AddForceAtPosition(val * num, forcePoint.position, (ForceMode)1);
}
private static float GetBoatHeeling()
{
//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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Transform currentBoat = GameState.currentBoat;
Vector3 up = ((Component)currentBoat).transform.up;
return Vector3.SignedAngle(up, Vector3.up, -Vector3.forward);
}
}
internal class SaveCleaner
{
[HarmonyPriority(300)]
[HarmonyPrefix]
private static void CleanSave(int backupIndex)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
Debug.LogWarning((object)"Dinghies: CleanSave running");
Debug.LogWarning((object)("Dinghies: cleaning save " + SaveSlots.currentSlot));
string path = ((backupIndex != 0) ? SaveSlots.GetBackupPath(SaveSlots.currentSlot, backupIndex) : SaveSlots.GetCurrentSavePath());
BinaryFormatter binaryFormatter = new BinaryFormatter();
SaveContainer val;
using (FileStream serializationStream = File.Open(path, FileMode.Open))
{
val = (SaveContainer)binaryFormatter.Deserialize(serializationStream);
}
if (IndexManager.loadedIndexMap.Count == 0)
{
val.savedPrefabs.RemoveAll((SavePrefabData x) => x.itemParentObject == 130 || x.itemParentObject == 131 || x.itemParentObject == 132);
val.savedObjects.RemoveAll((SaveObjectData x) => x.sceneIndex == 130 || x.sceneIndex == 131 || x.sceneIndex == 132);
}
else
{
foreach (string boat in IndexManager.loadedIndexMap.Keys)
{
if (boat == "BOAT Cutter (130)")
{
val.savedPrefabs.RemoveAll((SavePrefabData x) => x.itemParentObject == IndexManager.loadedIndexMap[boat] || x.itemParentObject == IndexManager.loadedIndexMap[boat] + 1 || x.itemParentObject == IndexManager.loadedIndexMap[boat] + 2);
val.savedObjects.RemoveAll((SaveObjectData x) => x.sceneIndex == IndexManager.loadedIndexMap[boat] || x.sceneIndex == IndexManager.loadedIndexMap[boat] + 1 || x.sceneIndex == IndexManager.loadedIndexMap[boat] + 2);
}
}
}
using (FileStream serializationStream2 = File.Open(path, FileMode.Create))
{
binaryFormatter.Serialize(serializationStream2, val);
}
Debug.LogWarning((object)"Dinghies: save cleaned...");
}
}
public class TillerRudder : GoPointerButton
{
private Rudder rudder;
private HingeJoint hingeJoint;
private AudioSource audio;
public bool locked;
private bool held;
public float input;
private float lastInput;
private float rotationAngleLimit;
private const float volumeMult = 0.05f;
private const float mult = 0.025f;
private void Awake()
{
//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)
rudder = ((Component)((Component)this).transform.parent).GetComponent<Rudder>();
hingeJoint = ((Component)rudder).GetComponent<HingeJoint>();
input = 0f;
lastInput = 0f;
JointLimits limits = hingeJoint.limits;
rotationAngleLimit = ((JointLimits)(ref limits)).max;
audio = ((Component)this).GetComponentInChildren<AudioSource>();
}
public override void OnActivate(GoPointer activatingPointer)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
if (Settings.steeringWithMouse && (int)activatingPointer.type == 2)
{
MouseLook.ToggleMouseLook(false);
}
if (!Settings.steeringWithMouse && (int)activatingPointer.type == 2)
{
((GoPointerButton)this).StickyClick(activatingPointer);
}
if (locked)
{
Unlock();
}
}
public override void OnUnactivate(GoPointer activatingPointer)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
if (Settings.steeringWithMouse && (int)activatingPointer.type == 2)
{
MouseLook.ToggleMouseLook(true);
}
}
private void ToggleLock()
{
if (!locked)
{
Lock();
}
else
{
Unlock();
}
}
private void Lock()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)base.stickyClickedBy))
{
((GoPointerButton)this).UnStickyClick();
}
locked = true;
Juicebox.juice.PlaySoundAt("lock unlock", ((Component)this).transform.position, 0f, 0.66f, 0.88f);
}
private void Unlock()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
locked = false;
Juicebox.juice.PlaySoundAt("lock unlock", ((Component)this).transform.position, 0f, 0.66f, 1f);
}
public override void ExtraLateUpdate()
{
//IL_0090: 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)
if (Object.op_Implicit((Object)(object)base.stickyClickedBy) || base.isClicked)
{
if (base.stickyClickedBy.AltButtonDown())
{
ToggleLock();
}
if (!locked)
{
if (!held)
{
held = true;
ChangeDamper(held);
}
int num = ((!DinghiesMain.invertedTillerConfig.Value) ? 1 : (-1));
input += base.stickyClickedBy.movement.GetKeyboardDelta().x * 0.025f * (float)num;
if (base.stickyClickedBy.movement.GetKeyboardDelta().y != 0f)
{
input = 0f;
}
}
ApplyRotationLimit();
RotateRudder();
}
else if (locked)
{
ApplyRotationLimit();
RotateRudder();
}
else
{
if (held)
{
held = false;
ChangeDamper(held);
}
input = rudder.currentAngle;
}
if (Object.op_Implicit((Object)(object)audio))
{
float num2 = Mathf.Abs(input - lastInput) / Time.deltaTime;
audio.volume = Mathf.Lerp(audio.volume, num2 * 0.05f, Time.deltaTime * 3f);
}
lastInput = input;
}
private void RotateRudder()
{
//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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
float num = input / rotationAngleLimit;
JointSpring spring = hingeJoint.spring;
JointLimits limits = hingeJoint.limits;
spring.targetPosition = ((JointLimits)(ref limits)).max * num;
hingeJoint.spring = spring;
}
private void ApplyRotationLimit()
{
if (input > rotationAngleLimit)
{
input = rotationAngleLimit;
}
if (input < 0f - rotationAngleLimit)
{
input = 0f - rotationAngleLimit;
}
}
private void ChangeDamper(bool held)
{
//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_0066: 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_0031: Unknown result type (might be due to invalid IL or missing references)
if (held)
{
JointSpring spring = hingeJoint.spring;
spring.spring = 250f;
spring.damper = 50f;
hingeJoint.spring = spring;
}
else
{
JointSpring spring2 = hingeJoint.spring;
spring2.spring = 50f;
spring2.damper = 10f;
hingeJoint.spring = spring2;
}
}
}
[BepInPlugin("pr0skynesis.dinghies", "Dinghies", "1.0.5")]
public class DinghiesMain : BaseUnityPlugin
{
public const string pluginGuid = "pr0skynesis.dinghies";
public const string pluginName = "Dinghies";
public const string pluginVersion = "1.0.5";
public const string shortName = "pr0.dinghies";
public static ConfigEntry<bool> nothingConfig;
public static ConfigEntry<bool> invertedTillerConfig;
public static ConfigEntry<KeyCode> leftFConfig;
public static ConfigEntry<KeyCode> rightFConfig;
public static ConfigEntry<KeyCode> leftBConfig;
public static ConfigEntry<KeyCode> rightBConfig;
public static ConfigEntry<bool> saveCleanerConfig;
public void Awake()
{
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Expected O, but got Unknown
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Expected O, but got Unknown
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Expected O, but got Unknown
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Expected O, but got Unknown
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Expected O, but got Unknown
nothingConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("A) General Settings", "nothing", true, "This setting does nothing. Default is true, set to false to disable.");
invertedTillerConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("B) Rudder Settings", "Inverted Tiller", false, "Inverts the tiller control, e.g. press left to move right. Default is false, set to true to enable.");
leftFConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("C) Rowing Settings", "Forward Left Button", (KeyCode)97, "Controls the rowing forward of the left oar. Default is A. Use the Bepniex Configuration Manager for this!;");
rightFConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("C) Rowing Settings", "Forward Right Button", (KeyCode)100, "Controls the rowing forward of the right oar. Default is D. Use the Bepniex Configuration Manager for this!;");
leftBConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("C) Rowing Settings", "Bakcward Left Button", (KeyCode)113, "Controls the rowing backward of the left oar. Default is Q. Use the Bepniex Configuration Manager for this!;");
rightBConfig = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("C) Rowing Settings", "Backward Right Button", (KeyCode)101, "Controls the rowing backward of the right oar. Default is E. Use the Bepniex Configuration Manager for this!;");
saveCleanerConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("D) Other Settings", "Save Cleaner", false, "Removes the saves dependency on this mod. Only use if you want to remove the mod from an ongoing save! Change to true (with the game closed), open the game → load the save → save → close the game → remove the mod → done. A save backup is recommended.");
Harmony val = new Harmony("pr0skynesis.dinghies");
MethodInfo methodInfo = AccessTools.Method(typeof(SaveLoadManager), "LoadGame", (Type[])null, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(typeof(IndexManager), "Manager", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo methodInfo3 = AccessTools.Method(typeof(SaveLoadManager), "LoadModData", (Type[])null, (Type[])null);
MethodInfo methodInfo4 = AccessTools.Method(typeof(IndexManager), "SaveIndex", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo methodInfo5 = AccessTools.Method(typeof(StartMenu), "StartNewGame", (Type[])null, (Type[])null);
MethodInfo methodInfo6 = AccessTools.Method(typeof(IndexManager), "StartNewGamePatch", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo5, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
if (!saveCleanerConfig.Value)
{
MethodInfo methodInfo7 = AccessTools.Method(typeof(FloatingOriginManager), "Start", (Type[])null, (Type[])null);
MethodInfo methodInfo8 = AccessTools.Method(typeof(DinghiesPatches), "StartPatch", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo7, new HarmonyMethod(methodInfo8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo methodInfo9 = AccessTools.Method(typeof(Mast), "Start", (Type[])null, (Type[])null);
MethodInfo methodInfo10 = AccessTools.Method(typeof(DinghiesPatches), "SailSetupPatch", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo9, new HarmonyMethod(methodInfo10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
else
{
MethodInfo methodInfo11 = AccessTools.Method(typeof(SaveLoadManager), "LoadGame", (Type[])null, (Type[])null);
MethodInfo methodInfo12 = AccessTools.Method(typeof(SaveCleaner), "CleanSave", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo11, new HarmonyMethod(methodInfo12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
}
}
public class DinghiesPatches
{
public static string bundlePath;
public static AssetBundle bundle;
public static Material harlequinMat;
public static GameObject cutter;
public static GameObject cutterEmbark;
public static GameObject[] letters = (GameObject[])(object)new GameObject[26];
[HarmonyPrefix]
public static void StartPatch(FloatingOriginManager __instance)
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
SetupThings();
IndexManager.AssignAvailableIndex(cutter);
Transform transform = ((Component)__instance).transform;
SetMooring(transform);
GameObject val = Object.Instantiate<GameObject>(cutter, transform);
cutterEmbark = ((Component)val.transform.Find("WALK cutter")).gameObject;
cutterEmbark.transform.parent = GameObject.Find("walk cols").transform;
Vector3 position = default(Vector3);
((Vector3)(ref position))..ctor(5691.12f, 0.3087376f, 38987.02f);
SetRotationAndPosition(val, -89.8f, position);
}
[HarmonyPrefix]
public static void SailSetupPatch(Mast __instance)
{
if (((Object)((Component)__instance).transform.parent.parent).name == "cutterModel")
{
GameObject[] sails = PrefabsDirectory.instance.sails;
GameObject startSailPrefab = sails[45];
GameObject startSailPrefab2 = sails[3];
if (((Object)__instance).name == "mizzen_mast")
{
__instance.startSailPrefab = startSailPrefab2;
}
if (((Object)__instance).name == "main_mast")
{
__instance.startSailPrefab = startSailPrefab;
}
}
}
public static void SetupThings()
{
bundlePath = Paths.PluginPath + "\\Dinghies\\dinghies";
bundle = AssetBundle.LoadFromFile(bundlePath);
if ((Object)(object)bundle == (Object)null)
{
bundlePath = Paths.PluginPath + "\\Pr0SkyNesis-Dinghies-1.0.5\\dinghies";
bundle = AssetBundle.LoadFromFile(bundlePath);
if ((Object)(object)bundle == (Object)null)
{
bundlePath = Paths.PluginPath + "\\Pr0SkyNesis-Dinghies\\dinghies";
bundle = AssetBundle.LoadFromFile(bundlePath);
if ((Object)(object)bundle == (Object)null)
{
Debug.LogError((object)"Dinghies: Bundle not loaded! Did you place it in the correct folder?");
}
}
}
string text = "Assets/Dinghies/BOAT Cutter (130).prefab";
cutter = bundle.LoadAsset<GameObject>(text);
string text2 = "Assets/Dinghies/nameplate/letter";
for (int i = 0; i < 26; i++)
{
letters[i] = bundle.LoadAsset<GameObject>(text2 + i + ".prefab");
}
string text3 = "Assets/Dinghies/Materials/cutterHarlequin.mat";
harlequinMat = bundle.LoadAsset<Material>(text3);
Transform transform = cutter.transform;
Transform val = cutter.transform.Find("cutterModel");
cutter.GetComponent<PurchasableBoat>().region = GameObject.Find("Region Medi").GetComponent<Region>();
((Component)transform.Find("cutterModel").Find("rudder").Find("rudder_tiller_cutter")).gameObject.AddComponent<TillerRudder>();
Transform val2 = transform.Find("cutterModel").Find("oars_locks");
((Component)val2.GetChild(0).GetChild(0)).gameObject.AddComponent<Oar>();
((Component)val2.GetChild(1).GetChild(0)).gameObject.AddComponent<Oar>();
((Component)val2).gameObject.AddComponent<OarLocks>();
Transform val3 = val.Find("nameplates");
((Component)val3.Find("nameplate_left")).gameObject.AddComponent<Nameplate>();
((Component)val3.Find("nameplate_right")).gameObject.AddComponent<Nameplate>();
MatLib.RegisterMaterials();
((Renderer)((Component)transform.Find("WaterFoam")).GetComponent<MeshRenderer>()).sharedMaterial = MatLib.foam;
((Renderer)((Component)transform.Find("WaterObjectInteractionSphereBack")).GetComponent<MeshRenderer>()).sharedMaterial = MatLib.objectInteraction;
((Renderer)((Component)transform.Find("WaterObjectInteractionSphereFront")).GetComponent<MeshRenderer>()).sharedMaterial = MatLib.objectInteraction;
((Component)transform.Find("overflow particles")).GetComponent<Renderer>().sharedMaterial = MatLib.overflow;
((Component)transform.Find("overflow particles (1)")).GetComponent<Renderer>().sharedMaterial = MatLib.overflow;
((Renderer)((Component)val.Find("mask")).GetComponent<MeshRenderer>()).sharedMaterial = MatLib.convexHull;
((Renderer)((Component)val.Find("damage_water")).GetComponent<MeshRenderer>()).sharedMaterial = MatLib.water4;
((Renderer)((Component)val.Find("mask_splash")).GetComponent<MeshRenderer>()).sharedMaterial = MatLib.mask;
((Component)val.Find("easter_egg")).gameObject.SetActive(false);
if (DinghiesMain.nothingConfig.Value)
{
EasterEgg(val);
}
}
public static void SetRotationAndPosition(GameObject boat, float yRot, Vector3 position)
{
//IL_0014: 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)
Transform transform = boat.transform;
transform.eulerAngles = new Vector3(0f, yRot, 0f);
transform.position = position;
}
public static void SetMooring(Transform shiftingWorld)
{
Transform val = shiftingWorld.Find("island 15 M (Fort)");
BoatMooringRopes component = cutter.GetComponent<BoatMooringRopes>();
component.mooringFront = ((Component)val.Find("dock_mooring M")).transform;
component.mooringBack = ((Component)val.Find("dock_mooring M (8)")).transform;
}
public static void EasterEgg(Transform cutterModel)
{
DateTime now = DateTime.Now;
int month = now.Month;
int day = now.Day;
if ((month == 12 && day >= 8) || (month == 1 && day <= 6))
{
GameObject gameObject = ((Component)cutterModel.Find("easter_egg")).gameObject;
gameObject.SetActive(true);
}
if ((month == 2 && day >= 27) || (month == 3 && day <= 4))
{
Debug.LogWarning((object)"Dinghies: harlequin time!");
GameObject gameObject2 = ((Component)cutterModel.Find("hull")).gameObject;
Material[] sharedMaterials = ((Renderer)gameObject2.GetComponent<MeshRenderer>()).sharedMaterials;
sharedMaterials[1] = harlequinMat;
((Renderer)gameObject2.GetComponent<MeshRenderer>()).sharedMaterials = sharedMaterials;
Debug.LogWarning((object)"Dinghies: harlequin time enabled");
}
}
}
public class MatLib
{
public static Material convexHull;
public static Material foam;
public static Material objectInteraction;
public static Material water4;
public static Material mask;
public static Material overflow;
public static void RegisterMaterials()
{
GameObject val = GameObject.Find("BOAT medi small (40)");
Transform val2 = val.transform.Find("medi small");
convexHull = ((Renderer)((Component)val2.Find("mask")).GetComponent<MeshRenderer>()).sharedMaterial;
foam = ((Renderer)((Component)val.transform.Find("WaterFoam")).GetComponent<MeshRenderer>()).sharedMaterial;
objectInteraction = ((Renderer)((Component)val.transform.Find("WaterObjectInteractionSphereBack")).GetComponent<MeshRenderer>()).sharedMaterial;
water4 = ((Renderer)((Component)val2.Find("damage_water")).GetComponent<MeshRenderer>()).sharedMaterial;
mask = ((Renderer)((Component)val2.Find("mask_splash")).GetComponent<MeshRenderer>()).sharedMaterial;
overflow = ((Component)val.transform.Find("overflow particles")).GetComponent<Renderer>().sharedMaterial;
}
}