using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using CoreWoodExtras;
using CoreWoodExtras.Containers;
using CoreWoodExtras.TextureUtils;
using CoreWoodExtras.Updates;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Extensions;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("CoreWoodExtras")]
[assembly: AssemblyDescription("https://discord.gg/zRucjV8rqc")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MagicMike")]
[assembly: AssemblyProduct("CoreWoodExtras")]
[assembly: AssemblyCopyright("Copyright © MagicMike 2025CoreWoodExtras")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("2.1.8")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.8.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 Elevator : MonoBehaviour
{
public bool m_canMove = true;
public float m_speed = 2f;
public int m_startPoint;
public Transform[] m_points;
private int i;
private bool m_reverse;
public static readonly int m_elevatorPosition = StringExtensionMethods.GetStableHashCode("elevatorPosition");
private string m_name;
private ZNetView m_nview;
public void Start()
{
//IL_008f: 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)
m_name = ((Object)((Component)this).gameObject.GetComponentInParent<Piece>()).name;
m_nview = ((Component)this).gameObject.GetComponentInParent<ZNetView>();
if ((Object)(object)m_nview != (Object)null && m_nview.GetZDO() != null)
{
i = m_nview.GetZDO().GetInt(m_elevatorPosition, 0);
((Component)this).transform.position = m_points[i].position;
}
else
{
((Component)this).transform.position = m_points[m_startPoint].position;
i = m_startPoint;
}
}
public void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
if (Vector3.Distance(((Component)this).transform.position, m_points[i].position) < 0.01f)
{
m_canMove = false;
if (i == m_points.Length - 1)
{
m_reverse = true;
i--;
return;
}
if (i == 0)
{
m_reverse = false;
i++;
return;
}
if (m_reverse)
{
i--;
}
else
{
i++;
}
}
if (m_canMove)
{
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, m_points[i].position, m_speed * Time.deltaTime);
m_nview.GetZDO().Set(m_elevatorPosition, i, false);
}
}
}
public class ElevatorSwitch : MonoBehaviour, Hoverable, Interactable
{
public Elevator m_elevator;
public EffectList m_elevatorSFX;
private string m_name;
private Piece m_piece;
private void Start()
{
m_piece = ((Component)this).gameObject.GetComponentInParent<Piece>();
m_name = m_piece.m_name;
}
public string GetHoverText()
{
return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $text_use_elevator");
}
public string GetHoverName()
{
return m_name;
}
public bool Interact(Humanoid human, bool hold, bool alt)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if (hold)
{
return false;
}
if (m_elevator.m_canMove)
{
return true;
}
m_elevator.m_speed = 2f;
m_elevator.m_canMove = true;
m_elevatorSFX.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
return true;
}
public bool UseItem(Humanoid user, ItemData item)
{
return false;
}
}
public class ParentPlatform : MonoBehaviour
{
private Piece m_piece;
private void Start()
{
m_piece = ((Component)this).gameObject.GetComponentInParent<Piece>();
}
private void OnCollisionEnter(Collision other)
{
other.transform.SetParent(((Component)this).transform);
other.gameObject.GetComponent<Rigidbody>().interpolation = (RigidbodyInterpolation)0;
m_piece.m_canBeRemoved = false;
}
private void OnCollisionExit(Collision other)
{
other.transform.SetParent((Transform)null);
other.gameObject.GetComponent<Rigidbody>().interpolation = (RigidbodyInterpolation)1;
m_piece.m_canBeRemoved = true;
}
}
public class SchoolBubbles : MonoBehaviour
{
public ParticleSystem _bubbleParticles;
public float _emitEverySecond = 0.01f;
public float _speedEmitMultiplier = 0.25f;
public int _minBubbles;
public int _maxBubbles = 5;
public void Start()
{
if ((Object)(object)_bubbleParticles == (Object)null)
{
((Component)((Component)this).transform).GetComponent<ParticleSystem>();
}
}
public void EmitBubbles(Vector3 pos, float amount)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (!(amount * _speedEmitMultiplier < 1f))
{
((Component)_bubbleParticles).transform.position = pos;
_bubbleParticles.Emit(Mathf.Clamp((int)(amount * _speedEmitMultiplier), _minBubbles, _maxBubbles));
}
}
}
public class SchoolChild : MonoBehaviour
{
public SchoolController _spawner;
private Vector3 _wayPoint;
[HideInInspector]
public float _speed = 10f;
private float _stuckCounter;
private float _damping;
private Transform _model;
private float _targetSpeed;
private float tParam;
private float _rotateCounterR;
private float _rotateCounterL;
public Transform _scanner;
private bool _scan = true;
private bool _instantiated;
private static int _updateNextSeed;
private int _updateSeed = -1;
public Transform _cacheTransform;
private Animation _legacyAnim;
private Animator anim;
public void Start()
{
_cacheTransform = ((Component)this).transform;
LocateRequiredChildren();
if (_spawner._useLegacyAnimations)
{
_legacyAnim = ((Component)_model).GetComponent<Animation>();
}
else
{
anim = ((Component)_model).GetComponent<Animator>();
}
SetRandomScale();
RandomizeStartAnimationFrame();
_speed = Random.Range(_spawner._minSpeed, _spawner._maxSpeed);
Wander(0f);
SetRandomWaypoint();
CheckForBubblesThenInvoke();
_instantiated = true;
GetStartPos();
FrameSkipSeedInit();
_spawner._activeChildren++;
}
public void childUpdate()
{
CheckForDistanceToWaypoint();
RotationBasedOnWaypointOrAvoidance();
ForwardMovement();
RayCastToPushAwayFromObstacles();
SetAnimationSpeed();
}
public void FrameSkipSeedInit()
{
if (_spawner._updateDivisor > 1)
{
int num = _spawner._updateDivisor - 1;
_updateNextSeed++;
_updateSeed = _updateNextSeed;
_updateNextSeed %= num;
}
}
public void CheckForBubblesThenInvoke()
{
if ((Object)(object)_spawner._bubbles != (Object)null)
{
((MonoBehaviour)this).InvokeRepeating("EmitBubbles", _spawner._bubbles._emitEverySecond * Random.value + 1f, _spawner._bubbles._emitEverySecond);
}
}
public void EmitBubbles()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
_spawner._bubbles.EmitBubbles(_cacheTransform.position, _speed);
}
public void OnDisable()
{
((MonoBehaviour)this).CancelInvoke();
_spawner._activeChildren--;
}
public void OnEnable()
{
if (_instantiated)
{
CheckForBubblesThenInvoke();
_spawner._activeChildren++;
}
}
public void LocateRequiredChildren()
{
//IL_0033: 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_0069: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_model == (Object)null)
{
_model = _cacheTransform.Find("Model");
}
if ((Object)(object)_scanner == (Object)null)
{
_scanner = new GameObject().transform;
_scanner.parent = ((Component)this).transform;
_scanner.localRotation = Quaternion.identity;
_scanner.localPosition = Vector3.zero;
}
}
public void SkewModelForLessUniformedMovement()
{
//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_001c: 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)
Quaternion identity = Quaternion.identity;
((Quaternion)(ref identity)).eulerAngles = new Vector3(0f, 0f, (float)Random.Range(-25, 25));
_model.rotation = identity;
}
public void SetRandomScale()
{
//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)
float num = Random.Range(_spawner._minScale, _spawner._maxScale);
_cacheTransform.localScale = Vector3.one * num;
}
public void RandomizeStartAnimationFrame()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if (!_spawner._useLegacyAnimations)
{
return;
}
foreach (AnimationState item in _legacyAnim)
{
AnimationState val = item;
val.time = Random.value * val.length;
}
}
public void SetAnimationSpeed()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
if (_spawner._useLegacyAnimations)
{
foreach (AnimationState item in _legacyAnim)
{
item.speed = Random.Range(_spawner._minAnimationSpeed, _spawner._maxAnimationSpeed) * _spawner._schoolSpeed * _speed + 0.1f;
}
return;
}
anim.speed = Random.Range(_spawner._minAnimationSpeed, _spawner._maxAnimationSpeed) * _spawner._schoolSpeed * _speed + 0.1f;
}
public void GetStartPos()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
_cacheTransform.position = _wayPoint - new Vector3(0.1f, 0.1f, 0.1f);
}
public Vector3 findWaypoint()
{
//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_00a2: Unknown result type (might be due to invalid IL or missing references)
Vector3 zero = Vector3.zero;
zero.x = Random.Range(0f - _spawner._spawnSphere, _spawner._spawnSphere) + _spawner._posBuffer.x;
zero.z = Random.Range(0f - _spawner._spawnSphereDepth, _spawner._spawnSphereDepth) + _spawner._posBuffer.z;
zero.y = Random.Range(0f - _spawner._spawnSphereHeight, _spawner._spawnSphereHeight) + _spawner._posBuffer.y;
return zero;
}
public void RayCastToPushAwayFromObstacles()
{
if (_spawner._push)
{
RotateScanner();
RayCastToPushAwayFromObstaclesCheckForCollision();
}
}
public void RayCastToPushAwayFromObstaclesCheckForCollision()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0039: 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_0099: 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_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_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_0123: 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)
RaycastHit val = default(RaycastHit);
float num = 0f;
Vector3 forward = _scanner.forward;
if (Physics.Raycast(_cacheTransform.position, forward, ref val, _spawner._pushDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
{
SchoolChild component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<SchoolChild>();
num = (_spawner._pushDistance - ((RaycastHit)(ref val)).distance) / _spawner._pushDistance;
if ((Object)(object)component != (Object)null)
{
Transform cacheTransform = _cacheTransform;
cacheTransform.position -= forward * _spawner._newDelta * num * _spawner._pushForce;
return;
}
_speed -= 0.01f * _spawner._newDelta;
if (_speed < 0.1f)
{
_speed = 0.1f;
}
Transform cacheTransform2 = _cacheTransform;
cacheTransform2.position -= forward * _spawner._newDelta * num * _spawner._pushForce * 2f;
_scan = false;
}
else
{
_scan = true;
}
}
public void RotateScanner()
{
//IL_003a: 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)
if (_scan)
{
_scanner.rotation = Random.rotation;
}
else
{
_scanner.Rotate(new Vector3(150f * _spawner._newDelta, 0f, 0f));
}
}
public bool Avoidance()
{
//IL_0011: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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_013b: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: 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_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: 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_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: 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_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
if (!_spawner._avoidance)
{
return false;
}
RaycastHit val = default(RaycastHit);
float num = 0f;
Quaternion rotation = _cacheTransform.rotation;
Quaternion rotation2 = _cacheTransform.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation2)).eulerAngles;
Vector3 forward = _cacheTransform.forward;
Vector3 right = _cacheTransform.right;
if (Physics.Raycast(_cacheTransform.position, -Vector3.up + forward * 0.1f, ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
{
num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
eulerAngles.x -= _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
_cacheTransform.rotation = rotation;
}
if (Physics.Raycast(_cacheTransform.position, Vector3.up + forward * 0.1f, ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
{
num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
eulerAngles.x += _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
_cacheTransform.rotation = rotation;
}
if (Physics.Raycast(_cacheTransform.position, forward + right * Random.Range(-0.1f, 0.1f), ref val, _spawner._stopDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
{
num = (_spawner._stopDistance - ((RaycastHit)(ref val)).distance) / _spawner._stopDistance;
eulerAngles.y -= _spawner._avoidSpeed * num * _spawner._newDelta * (_targetSpeed + 3f);
((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
_cacheTransform.rotation = rotation;
_speed -= num * _spawner._newDelta * _spawner._stopSpeedMultiplier * _speed;
if (_speed < 0.01f)
{
_speed = 0.01f;
}
return true;
}
if (Physics.Raycast(_cacheTransform.position, forward + right * (_spawner._avoidAngle + _rotateCounterL), ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
{
num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
_rotateCounterL += 0.1f;
eulerAngles.y -= _spawner._avoidSpeed * num * _spawner._newDelta * _rotateCounterL * (_speed + 1f);
((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
_cacheTransform.rotation = rotation;
if (_rotateCounterL > 1.5f)
{
_rotateCounterL = 1.5f;
}
_rotateCounterR = 0f;
return true;
}
if (Physics.Raycast(_cacheTransform.position, forward + right * (0f - (_spawner._avoidAngle + _rotateCounterR)), ref val, _spawner._avoidDistance, LayerMask.op_Implicit(_spawner._avoidanceMask)))
{
num = (_spawner._avoidDistance - ((RaycastHit)(ref val)).distance) / _spawner._avoidDistance;
if (((RaycastHit)(ref val)).point.y < _cacheTransform.position.y)
{
eulerAngles.y -= _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
}
else
{
eulerAngles.x += _spawner._avoidSpeed * num * _spawner._newDelta * (_speed + 1f);
}
_rotateCounterR += 0.1f;
eulerAngles.y += _spawner._avoidSpeed * num * _spawner._newDelta * _rotateCounterR * (_speed + 1f);
((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
_cacheTransform.rotation = rotation;
if (_rotateCounterR > 1.5f)
{
_rotateCounterR = 1.5f;
}
_rotateCounterL = 0f;
return true;
}
_rotateCounterL = 0f;
_rotateCounterR = 0f;
return false;
}
public void ForwardMovement()
{
//IL_0007: 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_0022: 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)
Transform cacheTransform = _cacheTransform;
cacheTransform.position += _cacheTransform.TransformDirection(Vector3.forward) * _speed * _spawner._newDelta;
if (tParam < 1f)
{
if (_speed > _targetSpeed)
{
tParam += _spawner._newDelta * _spawner._acceleration;
}
else
{
tParam += _spawner._newDelta * _spawner._brake;
}
_speed = Mathf.Lerp(_speed, _targetSpeed, tParam);
}
}
public void RotationBasedOnWaypointOrAvoidance()
{
//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_0007: 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_001c: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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)
Quaternion identity = Quaternion.identity;
identity = Quaternion.LookRotation(_wayPoint - _cacheTransform.position);
if (!Avoidance())
{
_cacheTransform.rotation = Quaternion.Slerp(_cacheTransform.rotation, identity, _spawner._newDelta * _damping);
}
float x = _cacheTransform.localEulerAngles.x;
x = ((x > 180f) ? (x - 360f) : x);
Quaternion rotation = _cacheTransform.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
eulerAngles.x = ClampAngle(x, -50f, 50f);
((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
_cacheTransform.rotation = rotation;
}
public void CheckForDistanceToWaypoint()
{
//IL_0006: 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_0016: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = _cacheTransform.position - _wayPoint;
if (((Vector3)(ref val)).magnitude < _spawner._waypointDistance + _stuckCounter)
{
Wander(0f);
_stuckCounter = 0f;
CheckIfThisShouldTriggerNewFlockWaypoint();
}
else
{
_stuckCounter += _spawner._newDelta * (_spawner._waypointDistance * 0.25f);
}
}
public void CheckIfThisShouldTriggerNewFlockWaypoint()
{
if (_spawner._childTriggerPos)
{
_spawner.SetRandomWaypointPosition();
}
}
public static float ClampAngle(float angle, float min, float max)
{
if (angle < -360f)
{
angle += 360f;
}
if (angle > 360f)
{
angle -= 360f;
}
return Mathf.Clamp(angle, min, max);
}
public void Wander(float delay)
{
_damping = Random.Range(_spawner._minDamping, _spawner._maxDamping);
_targetSpeed = Random.Range(_spawner._minSpeed, _spawner._maxSpeed) * _spawner._speedCurveMultiplier.Evaluate(Random.value) * _spawner._schoolSpeed;
((MonoBehaviour)this).Invoke("SetRandomWaypoint", delay);
}
public void SetRandomWaypoint()
{
//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)
tParam = 0f;
_wayPoint = findWaypoint();
}
}
public class SchoolController : MonoBehaviour
{
public SchoolChild[] _childPrefab;
public bool _groupChildToNewTransform;
public Transform _groupTransform;
public string _groupName = "";
public bool _groupChildToSchool;
public int _childAmount = 250;
public float _spawnSphere = 3f;
public float _spawnSphereDepth = 3f;
public float _spawnSphereHeight = 1.5f;
public float _childSpeedMultipler = 2f;
public float _minSpeed = 6f;
public float _maxSpeed = 10f;
public AnimationCurve _speedCurveMultiplier = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 1f),
new Keyframe(1f, 1f)
});
public float _minScale = 0.7f;
public float _maxScale = 1f;
public float _minDamping = 1f;
public float _maxDamping = 2f;
public float _waypointDistance = 1f;
public float _minAnimationSpeed = 2f;
public float _maxAnimationSpeed = 4f;
public float _randomPositionTimerMax = 10f;
public float _randomPositionTimerMin = 4f;
public float _acceleration = 0.025f;
public float _brake = 0.01f;
public float _positionSphere = 25f;
public float _positionSphereDepth = 5f;
public float _positionSphereHeight = 5f;
public bool _childTriggerPos;
public bool _forceChildWaypoints;
public bool _autoRandomPosition;
public float _forcedRandomDelay = 1.5f;
public float _schoolSpeed;
public List<SchoolChild> _roamers;
public Vector3 _posBuffer;
public Vector3 _posOffset;
public bool _avoidance;
public float _avoidAngle = 0.35f;
public float _avoidDistance = 1f;
public float _avoidSpeed = 75f;
public float _stopDistance = 0.5f;
public float _stopSpeedMultiplier = 2f;
public LayerMask _avoidanceMask = LayerMask.op_Implicit(-1);
public bool _push;
public float _pushDistance;
public float _pushForce = 5f;
public SchoolBubbles _bubbles;
public int _updateDivisor = 1;
public float _newDelta;
public int _updateCounter;
public int _activeChildren;
public bool _useLegacyAnimations = true;
public void Start()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//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)
_posBuffer = ((Component)this).transform.position + _posOffset;
_schoolSpeed = Random.Range(1f, _childSpeedMultipler);
AddFish(_childAmount);
((MonoBehaviour)this).Invoke("AutoRandomWaypointPosition", RandomWaypointTime());
}
public void Update()
{
if (_activeChildren > 0)
{
if (_updateDivisor > 1)
{
_updateCounter++;
_updateCounter %= _updateDivisor;
_newDelta = Time.deltaTime * (float)_updateDivisor;
}
else
{
_newDelta = Time.deltaTime;
}
UpdateFishAmount();
for (int i = 0; i < _roamers.Count; i++)
{
_roamers[i].childUpdate();
}
}
}
public void InstantiateGroup()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_groupTransform != (Object)null))
{
GameObject val = new GameObject();
_groupTransform = val.transform;
_groupTransform.position = ((Component)this).transform.position;
if (_groupName != "")
{
((Object)val).name = _groupName;
}
else
{
((Object)val).name = ((Object)((Component)this).transform).name + " Fish Container";
}
}
}
public void AddFish(int amount)
{
if (_groupChildToNewTransform)
{
InstantiateGroup();
}
for (int i = 0; i < amount; i++)
{
int num = Random.Range(0, _childPrefab.Length);
SchoolChild schoolChild = Object.Instantiate<SchoolChild>(_childPrefab[num]);
schoolChild._spawner = this;
_roamers.Add(schoolChild);
AddChildToParent(((Component)schoolChild).transform);
}
}
public void AddChildToParent(Transform obj)
{
if (_groupChildToSchool)
{
obj.parent = ((Component)this).transform;
}
else if (_groupChildToNewTransform)
{
obj.parent = _groupTransform;
}
}
public void RemoveFish(int amount)
{
SchoolChild schoolChild = _roamers[_roamers.Count - 1];
_roamers.RemoveAt(_roamers.Count - 1);
Object.Destroy((Object)(object)((Component)schoolChild).gameObject);
}
public void UpdateFishAmount()
{
if (_childAmount >= 0 && _childAmount < _roamers.Count)
{
RemoveFish(1);
}
else if (_childAmount > _roamers.Count)
{
AddFish(1);
}
}
public void SetRandomWaypointPosition()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_008a: 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_009c: Unknown result type (might be due to invalid IL or missing references)
_schoolSpeed = Random.Range(1f, _childSpeedMultipler);
Vector3 zero = Vector3.zero;
zero.x = Random.Range(0f - _positionSphere, _positionSphere) + ((Component)this).transform.position.x;
zero.z = Random.Range(0f - _positionSphereDepth, _positionSphereDepth) + ((Component)this).transform.position.z;
zero.y = Random.Range(0f - _positionSphereHeight, _positionSphereHeight) + ((Component)this).transform.position.y;
_posBuffer = zero;
if (_forceChildWaypoints)
{
for (int i = 0; i < _roamers.Count; i++)
{
_roamers[i].Wander(Random.value * _forcedRandomDelay);
}
}
}
public void AutoRandomWaypointPosition()
{
if (_autoRandomPosition && _activeChildren > 0)
{
SetRandomWaypointPosition();
}
((MonoBehaviour)this).CancelInvoke("AutoRandomWaypointPosition");
((MonoBehaviour)this).Invoke("AutoRandomWaypointPosition", RandomWaypointTime());
}
public float RandomWaypointTime()
{
return Random.Range(_randomPositionTimerMin, _randomPositionTimerMax);
}
public void OnDrawGizmos()
{
//IL_0046: 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_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_0094: 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_0008: 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_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_0031: 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_0041: Unknown result type (might be due to invalid IL or missing references)
if (!Application.isPlaying && _posBuffer != ((Component)this).transform.position + _posOffset)
{
_posBuffer = ((Component)this).transform.position + _posOffset;
}
Gizmos.color = Color.blue;
Gizmos.DrawWireCube(_posBuffer, new Vector3(_spawnSphere * 2f, _spawnSphereHeight * 2f, _spawnSphereDepth * 2f));
Gizmos.color = Color.cyan;
Gizmos.DrawWireCube(((Component)this).transform.position, new Vector3(_positionSphere * 2f + _spawnSphere * 2f, _positionSphereHeight * 2f + _spawnSphereHeight * 2f, _positionSphereDepth * 2f + _spawnSphereDepth * 2f));
}
}
public class TriggerPlatform : MonoBehaviour
{
public Elevator m_platform;
private void OnTriggerEnter(Collider other)
{
if (MainConfig.autoTriggers.Value)
{
m_platform.m_speed = 2f;
m_platform.m_canMove = true;
}
}
}
public class KeyUtils
{
public static bool IgnoreKeyPresses(bool extra = false)
{
if (!extra)
{
if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
{
Chat instance = Chat.instance;
if (instance == null)
{
return false;
}
return instance.HasFocus();
}
return true;
}
if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
{
Chat instance2 = Chat.instance;
if ((instance2 == null || !instance2.HasFocus()) && !StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible())
{
TextViewer instance3 = TextViewer.instance;
if (instance3 == null)
{
return false;
}
return instance3.IsVisible();
}
}
return true;
}
public static bool CheckKeyDown(string value)
{
try
{
string[] array = value.Split(new char[1] { ',' });
for (int i = 0; i < array.Length; i++)
{
if (Input.GetKeyDown(array[i].ToLower()))
{
return true;
}
}
}
catch
{
}
return false;
}
public static bool CheckKeyUp(string value)
{
try
{
string[] array = value.Split(new char[1] { ',' });
for (int i = 0; i < array.Length; i++)
{
if (Input.GetKeyUp(array[i].ToLower()))
{
return true;
}
}
}
catch
{
}
return false;
}
public static bool CheckKeyHeld(string value, bool req = true)
{
try
{
string[] array = value.Split(new char[1] { ',' });
for (int i = 0; i < array.Length; i++)
{
if (Input.GetKey(array[i].ToLower()))
{
return true;
}
}
}
catch
{
}
return !req;
}
}
public class WaypointMover : MonoBehaviour
{
[SerializeField]
private Waypoints waypoints;
[Range(0f, 10f)]
[SerializeField]
private float moveSpeed = 5f;
[Range(0f, 20f)]
[SerializeField]
private float rotateSpeed = 0.5f;
[SerializeField]
private float distanceThreshold = 0.1f;
private Transform currentWaypoint;
private Quaternion rotationGoal;
private Vector3 directionToWaypoint;
private void Start()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
currentWaypoint = waypoints.GetNextWaypoint(currentWaypoint);
((Component)this).transform.position = currentWaypoint.position;
currentWaypoint = waypoints.GetNextWaypoint(currentWaypoint);
((Component)this).transform.LookAt(currentWaypoint);
}
private void Update()
{
//IL_000c: 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_0028: 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_0043: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, currentWaypoint.position, moveSpeed * Time.deltaTime);
if (Vector3.Distance(((Component)this).transform.position, currentWaypoint.position) < distanceThreshold)
{
currentWaypoint = waypoints.GetNextWaypoint(currentWaypoint);
}
RotateTowardsWaypoint();
}
private void RotateTowardsWaypoint()
{
//IL_0007: 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_001c: 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_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_0046: 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_005d: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = currentWaypoint.position - ((Component)this).transform.position;
directionToWaypoint = ((Vector3)(ref val)).normalized;
rotationGoal = Quaternion.LookRotation(directionToWaypoint);
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, rotationGoal, rotateSpeed * Time.deltaTime);
}
}
public class Waypoints : MonoBehaviour
{
[Range(0f, 2f)]
[SerializeField]
private float gizmoSize = 1f;
[SerializeField]
private bool canLoop = true;
private void OnDrawGizmos()
{
//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_0023: 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_0068: 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_00b9: 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)
foreach (Transform item in ((Component)this).transform)
{
Gizmos.color = Color.blue;
Gizmos.DrawWireSphere(item.position, gizmoSize);
}
Gizmos.color = Color.red;
for (int i = 0; i < ((Component)this).transform.childCount - 1; i++)
{
Gizmos.DrawLine(((Component)this).transform.GetChild(i).position, ((Component)this).transform.GetChild(i + 1).position);
}
if (canLoop)
{
Gizmos.DrawLine(((Component)this).transform.GetChild(((Component)this).transform.childCount - 1).position, ((Component)this).transform.GetChild(0).position);
}
}
public Transform GetNextWaypoint(Transform currentWaypoint)
{
if ((Object)(object)currentWaypoint == (Object)null)
{
return ((Component)this).transform.GetChild(0);
}
if (currentWaypoint.GetSiblingIndex() < ((Component)this).transform.childCount - 1)
{
return ((Component)this).transform.GetChild(currentWaypoint.GetSiblingIndex() + 1);
}
if (canLoop)
{
return ((Component)this).transform.GetChild(0);
}
return ((Component)this).transform.GetChild(currentWaypoint.GetSiblingIndex());
}
}
namespace CoreWoodExtras
{
internal class FishPond : MonoBehaviour, Hoverable, Interactable
{
public string m_name = "Fish Pond";
public float m_useDistance = 4f;
public Transform m_attachPoint;
public GameObject m_fxobject;
private ZNetView m_nview;
private static readonly int _isFishEnabled = StringExtensionMethods.GetStableHashCode("IsFishEnabled");
private void Awake()
{
m_nview = ((Component)this).gameObject.GetComponentInParent<ZNetView>();
if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid())
{
return;
}
if (m_nview.GetZDO().GetBool(_isFishEnabled, false))
{
if (!m_fxobject.activeSelf)
{
m_fxobject.SetActive(true);
}
}
else if (m_fxobject.activeSelf)
{
m_fxobject.SetActive(false);
}
}
public string GetHoverText()
{
if (!InUseDistance((Humanoid)(object)Player.m_localPlayer))
{
return Localization.instance.Localize("<color=#888888>$piece_toofar</color>");
}
if (!m_fxobject.activeSelf)
{
return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $text_enable_fish");
}
return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $text_disable_fish");
}
public string GetHoverName()
{
return m_name;
}
public bool Interact(Humanoid human, bool hold, bool alt)
{
//IL_00bb: 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)
if (hold)
{
return false;
}
Player human2 = (Player)(object)((human is Player) ? human : null);
if (!InUseDistance((Humanoid)(object)human2))
{
return false;
}
if ((Object)(object)m_nview == (Object)null || !m_nview.IsValid())
{
return false;
}
if (!m_fxobject.activeSelf)
{
m_nview.GetZDO().Set(_isFishEnabled, true);
m_fxobject.SetActive(true);
ZDOMan.instance.ForceSendZDO(ZNetView.Everybody, m_nview.GetZDO().m_uid);
return false;
}
m_nview.GetZDO().Set(_isFishEnabled, false);
m_fxobject.SetActive(false);
ZDOMan.instance.ForceSendZDO(ZNetView.Everybody, m_nview.GetZDO().m_uid);
return false;
}
public bool UseItem(Humanoid user, ItemData item)
{
return false;
}
private bool InUseDistance(Humanoid human)
{
//IL_0006: 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)
return Vector3.Distance(((Component)human).transform.position, m_attachPoint.position) < m_useDistance;
}
}
internal class Inflatable : MonoBehaviour, Hoverable, Interactable
{
public string m_name = "Inflatable";
public float m_useDistance = 1.5f;
public Transform m_attachPoint;
public Vector3 m_detachOffset = new Vector3(0f, 0f, 0f);
private static string m_attachAnimation = "attach_bed";
private static float m_lastAttachTime;
public string GetHoverText()
{
if (Time.time - m_lastAttachTime < 2f)
{
return "";
}
if (!InUseDistance((Humanoid)(object)Player.m_localPlayer))
{
return Localization.instance.Localize("<color=#888888>$piece_toofar</color>");
}
return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use");
}
public string GetHoverName()
{
return m_name;
}
public bool Interact(Humanoid human, bool hold, bool alt)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (hold)
{
return false;
}
if (Time.time - m_lastAttachTime < 2f)
{
return false;
}
Player val = (Player)(object)((human is Player) ? human : null);
if (!InUseDistance((Humanoid)(object)val))
{
return false;
}
if (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Wet")))
{
((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), true);
}
((Character)val).AttachStart(m_attachPoint, ((Component)this).gameObject, true, false, false, m_attachAnimation, m_detachOffset, (Transform)null);
m_lastAttachTime = Time.time;
return false;
}
public bool UseItem(Humanoid user, ItemData item)
{
return false;
}
private bool InUseDistance(Humanoid human)
{
//IL_0006: 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)
return Vector3.Distance(((Component)human).transform.position, m_attachPoint.position) < m_useDistance;
}
}
internal class ContainerPatches
{
[HarmonyPatch(typeof(ZNetScene), "Awake")]
private static class ZNetSceneAwakeContainerPatch
{
private static void Postfix(ZNetScene __instance)
{
GameObject prefab = __instance.GetPrefab("mm_corewood_chest_public");
GameObject prefab2 = __instance.GetPrefab("mm_corewood_chest_private");
GameObject prefab3 = __instance.GetPrefab("mm_corewood_stackable_chest");
try
{
if ((Object)(object)prefab != (Object)null)
{
Container component = prefab.GetComponent<Container>();
component.m_width = MainConfig.chestColumns.Value;
component.m_height = MainConfig.chestRows.Value;
}
if ((Object)(object)prefab2 != (Object)null)
{
Container component2 = prefab2.GetComponent<Container>();
component2.m_width = MainConfig.chestPrivateColumns.Value;
component2.m_height = MainConfig.chestPrivateRows.Value;
}
if ((Object)(object)prefab3 != (Object)null)
{
Container component3 = prefab3.GetComponent<Container>();
component3.m_width = MainConfig.chestStackedColumns.Value;
component3.m_height = MainConfig.chestStackedRows.Value;
}
}
catch
{
Logger.LogError((object)"Error with ZNetSceneAwakeContainerPatch!");
}
}
}
[HarmonyPatch(typeof(Container), "Interact")]
public static class ContainerInteractPatch
{
private static bool Prefix(Container __instance, Humanoid character, bool hold, bool alt)
{
Piece component = ((Component)__instance).GetComponent<Piece>();
if ((Object)(object)component == (Object)null || component.m_name != "$piece_mm_corewood_chest_stackable")
{
return true;
}
Sign component2 = ((Component)__instance).GetComponent<Sign>();
if ((Object)(object)component2 == (Object)null)
{
return true;
}
if (!alt)
{
return true;
}
return !component2.Interact(character, hold, true);
}
}
[HarmonyPatch(typeof(Container), "GetHoverText")]
public static class ContainerGetHoverTextPatch
{
private static bool Prefix(Container __instance, ref string __result)
{
Piece component = ((Component)__instance).GetComponent<Piece>();
if ((Object)(object)component == (Object)null || component.m_name != "$piece_mm_corewood_chest_stackable")
{
return true;
}
if ((Object)(object)((Component)__instance).GetComponent<Sign>() == (Object)null)
{
return true;
}
if (!MainConfig.chestStackedHotbar.Value)
{
__result = Localization.instance.Localize("$piece_mm_corewood_chest_stackable\n[<color=yellow><b>$KEY_Use</b></color>] $text_chest_open\n[<color=yellow><b>Shift + $KEY_Use</b></color>] $text_chest_edit\n[<color=yellow><b>1-8</b></color>] $text_chest_set\n");
}
else
{
__result = Localization.instance.Localize("$piece_mm_corewood_chest_stackable\n[<color=yellow><b>$KEY_Use</b></color>] $text_chest_open\n[<color=yellow><b>Shift + $KEY_Use</b></color>] $text_chest_edit\n");
}
return false;
}
}
[HarmonyPatch(typeof(Player), "UseHotbarItem")]
public static class InterceptUseHotbarItemOnNamedChest
{
private static bool Prefix(Player __instance, int index)
{
GameObject hoverObject = ((Humanoid)__instance).GetHoverObject();
if ((Object)(object)hoverObject == (Object)null)
{
return true;
}
Piece componentInParent = hoverObject.GetComponentInParent<Piece>();
if ((Object)(object)componentInParent == (Object)null || componentInParent.m_name != "$piece_mm_corewood_chest_stackable" || MainConfig.chestStackedHotbar.Value)
{
return true;
}
Sign component = ((Component)componentInParent).GetComponent<Sign>();
if ((Object)(object)component == (Object)null)
{
return true;
}
Inventory inventory = ((Humanoid)__instance).GetInventory();
ItemData val = ((inventory != null) ? inventory.GetItemAt(index - 1, 0) : null);
if (val == null)
{
return true;
}
string text = (Object.op_Implicit((Object)(object)val.m_dropPrefab) ? ((Object)val.m_dropPrefab).name : val.m_shared.m_name);
component.SetText(text);
return false;
}
}
[HarmonyPatch(typeof(InventoryGui), "Show")]
public static class InventoryGui_Show_Patch
{
public static void Postfix(Container ___m_currentContainer)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)___m_currentContainer) && ((Object)___m_currentContainer).name.Contains("mm_corewood_stackable_chest"))
{
Sign componentInParent = ((Component)___m_currentContainer).gameObject.GetComponentInParent<Sign>();
if (!((Object)(object)componentInParent == (Object)null))
{
((Component)Utils.FindChild(((Component)componentInParent).transform, "CanvasFront", (IterativeSearchType)0)).transform.localPosition = new Vector3(0f, 0.666f, 1.795f);
}
}
}
}
[HarmonyPatch(typeof(InventoryGui), "Hide")]
public static class InventoryGui_Hide_Patch
{
public static void Prefix(InventoryGui __instance, Container ___m_currentContainer)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.m_animator.GetBool("visible") || !Object.op_Implicit((Object)(object)___m_currentContainer) || !((Object)___m_currentContainer).name.Contains("mm_corewood_stackable_chest"))
{
return;
}
Sign componentInParent = ((Component)___m_currentContainer).gameObject.GetComponentInParent<Sign>();
if (!((Object)(object)componentInParent == (Object)null))
{
Transform val = Utils.FindChild(((Component)componentInParent).transform, "CanvasFront", (IterativeSearchType)0);
if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
((Component)val).transform.localPosition = new Vector3(0f, 0.666f, 1.003f);
}
}
}
}
}
public static class SignHelper
{
public static GameObject CreateSignCanvas(string name, Transform parent, Vector3 pos, Quaternion rot, Vector2 size)
{
//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_0025: 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_0031: 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_0043: 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: 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_0071: 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_0080: Expected O, but got Unknown
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent);
val.transform.localPosition = pos;
val.transform.localRotation = rot;
val.transform.localScale = Vector3.one;
val.GetComponent<RectTransform>().sizeDelta = size;
Canvas obj = val.AddComponent<Canvas>();
obj.renderMode = (RenderMode)2;
obj.scaleFactor = 10f;
val.AddComponent<CanvasRenderer>();
val.AddComponent<GraphicRaycaster>();
return val;
}
public static TextMeshProUGUI CreateText(Transform parent, string name)
{
//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_0025: 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_0035: 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_0045: 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_0057: 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_006c: 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_0130: 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_0106: Expected O, but got Unknown
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent);
val.transform.localPosition = Vector3.zero;
val.transform.localScale = Vector3.one;
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val2).text = "";
((TMP_Text)val2).fontSize = 1f;
((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
((TMP_Text)val2).textWrappingMode = (TextWrappingModes)1;
((Graphic)val2).color = Color32.op_Implicit(new Color32((byte)20, (byte)20, (byte)20, byte.MaxValue));
GameObject prefab = PrefabManager.Instance.GetPrefab("sign");
if ((Object)(object)prefab != (Object)null)
{
TextMeshProUGUI componentInChildren = prefab.GetComponentInChildren<TextMeshProUGUI>(true);
if ((Object)(object)componentInChildren != (Object)null)
{
((TMP_Text)val2).font = ((TMP_Text)componentInChildren).font;
((TMP_Text)val2).fontMaterial = new Material(((TMP_Text)componentInChildren).fontMaterial);
((TMP_Text)val2).fontMaterial.SetFloat(ShaderUtilities.ID_FaceDilate, 0.3f);
}
}
((TMP_Text)val2).outlineColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
((TMP_Text)val2).outlineWidth = 0.02f;
return val2;
}
}
public class NamedChest : MonoBehaviour
{
public Sign sign;
public TextMeshProUGUI textFront;
private string _lastText;
private void Update()
{
if (Object.op_Implicit((Object)(object)sign) && Object.op_Implicit((Object)(object)sign.m_textWidget))
{
string text = sign.GetText();
if (!(text == _lastText))
{
_lastText = text;
UpdateDisplay(text);
}
}
}
private void UpdateDisplay(string text)
{
if (text != null)
{
ObjectDB instance = ObjectDB.instance;
GameObject val = ((instance != null) ? instance.GetItemPrefab(text) : null);
if ((Object)(object)val != (Object)null)
{
ItemDrop component = val.GetComponent<ItemDrop>();
if ((Object)(object)component != (Object)null)
{
((TMP_Text)textFront).text = null;
((TMP_Text)textFront).text = Localization.instance.Localize(component.m_itemData.m_shared.m_name);
return;
}
}
}
((TMP_Text)textFront).text = text;
}
}
internal class Shower : MonoBehaviour, Hoverable, Interactable
{
public string m_name = "Shower";
public float m_useDistance = 2f;
public Transform m_attachPoint;
public Vector3 m_detachOffset = new Vector3(0f, 0f, 0f);
public GameObject m_fxobject;
public EffectList m_showerSFX;
private static string m_attachAnimation = "";
private static float m_lastShowerTime;
public string GetHoverText()
{
if (Time.time - m_lastShowerTime < 32f)
{
return "";
}
if (!InUseDistance((Humanoid)(object)Player.m_localPlayer))
{
return Localization.instance.Localize("<color=#888888>$piece_toofar</color>");
}
return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use");
}
public string GetHoverName()
{
return m_name;
}
public bool Interact(Humanoid human, bool hold, bool alt)
{
//IL_0031: 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_00c7: 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)
if (hold)
{
return false;
}
Player val = (Player)(object)((human is Player) ? human : null);
if (!InUseDistance((Humanoid)(object)val))
{
return false;
}
if (Time.time - m_lastShowerTime < 32f)
{
return false;
}
Player closestPlayer = Player.GetClosestPlayer(m_attachPoint.position, 0.1f);
if ((Object)(object)closestPlayer != (Object)null && (Object)(object)closestPlayer != (Object)(object)Player.m_localPlayer)
{
((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_blocked", 0, (Sprite)null);
return false;
}
m_fxobject.SetActive(false);
if (Object.op_Implicit((Object)(object)val))
{
if (((Character)val).IsEncumbered())
{
return false;
}
((Character)val).AttachStart(m_attachPoint, (GameObject)null, true, false, false, m_attachAnimation, m_detachOffset, (Transform)null);
m_lastShowerTime = Time.time;
m_fxobject.SetActive(true);
m_showerSFX.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
}
return false;
}
public bool UseItem(Humanoid user, ItemData item)
{
return false;
}
private bool InUseDistance(Humanoid human)
{
//IL_0006: 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)
return Vector3.Distance(((Component)human).transform.position, m_attachPoint.position) < m_useDistance;
}
}
public class LightPatches
{
[HarmonyPatch(typeof(ZNetScene), "Awake")]
[HarmonyAfter(new string[] { "com.jotunn.jotunn" })]
public static class CustomLightPatch
{
[HarmonyPostfix]
public static void Postfix(ZNetScene __instance)
{
ModifySkullCandles(__instance, "mm_corewood_skull_candles", MainConfig.skullLightIntensity.Value, MainConfig.skullLightRange.Value);
ModifyDeerChandelier(__instance, "mm_deerchandelier", MainConfig.chandelierLightIntensity.Value, MainConfig.chandelierLightRange.Value);
ModifySurtlingLantern(__instance, "mm_corewood_surtling_lantern", MainConfig.surtlingLanternLightIntensity.Value, MainConfig.surtlingLanternLightRange.Value);
ModifySurtlingSingle(__instance, "mm_corewood_surtling_lamppost_single", MainConfig.surtlingSingleLightIntensity.Value, MainConfig.surtlingSingleLightRange.Value);
ModifySurtlingDouble(__instance, "mm_corewood_surtling_lamppost_double", MainConfig.surtlingDoubleLightIntensity.Value, MainConfig.surtlingDoubleLightRange.Value);
ModifyWallLights(__instance, "mm_horn_walltorch", MainConfig.wallLightIntensity.Value, MainConfig.wallLightRange.Value);
ModifyLavaLights(__instance, "mm_corewood_lavalantern", MainConfig.lavaLightIntensity.Value, MainConfig.lavaLightRange.Value);
ModifyCrystalLights(__instance, "mm_corewood_crystal_light", MainConfig.crystalLightIntensity.Value, MainConfig.crystalLightRange.Value);
ModifyRopeLights(__instance, "mm_corewood_rope_lights", MainConfig.ropeLightIntensity.Value, MainConfig.ropeLightRange.Value);
ModifyBrazierLights(__instance, "mm_corewood_brazier", MainConfig.brazierLightIntensity.Value, MainConfig.brazierLightRange.Value);
ModifyBeaconLights(__instance, "mm_corewood_palisade_beacon", MainConfig.beaconLightIntensity.Value, MainConfig.beaconLightRange.Value);
}
}
public static void ModifySkullCandles(ZNetScene instance, string prefab, float intensity, float range)
{
GameObject prefab2 = instance.GetPrefab(prefab);
if (!Object.op_Implicit((Object)(object)prefab2))
{
return;
}
Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
foreach (Light val in componentsInChildren)
{
val.intensity = intensity;
val.range = range;
if (MainConfig.skullLightShadows.Value == MainConfig.ShadowsType.None)
{
val.shadows = (LightShadows)0;
}
else if (MainConfig.skullLightShadows.Value == MainConfig.ShadowsType.Hard)
{
val.shadows = (LightShadows)1;
}
else if (MainConfig.skullLightShadows.Value == MainConfig.ShadowsType.Soft)
{
val.shadows = (LightShadows)2;
}
}
}
public static void ModifyDeerChandelier(ZNetScene instance, string prefab, float intensity, float range)
{
GameObject prefab2 = instance.GetPrefab(prefab);
if (!Object.op_Implicit((Object)(object)prefab2))
{
return;
}
Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
foreach (Light val in componentsInChildren)
{
val.intensity = intensity;
val.range = range;
if (MainConfig.chandelierLightShadows.Value == MainConfig.ShadowsType.None)
{
val.shadows = (LightShadows)0;
}
else if (MainConfig.chandelierLightShadows.Value == MainConfig.ShadowsType.Hard)
{
val.shadows = (LightShadows)1;
}
else if (MainConfig.chandelierLightShadows.Value == MainConfig.ShadowsType.Soft)
{
val.shadows = (LightShadows)2;
}
}
}
public static void ModifySurtlingDouble(ZNetScene instance, string prefab, float intensity, float range)
{
GameObject prefab2 = instance.GetPrefab(prefab);
if (!Object.op_Implicit((Object)(object)prefab2))
{
return;
}
Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
foreach (Light val in componentsInChildren)
{
val.intensity = intensity;
val.range = range;
if (MainConfig.surtlingDoubleLightShadows.Value == MainConfig.ShadowsType.None)
{
val.shadows = (LightShadows)0;
}
else if (MainConfig.surtlingDoubleLightShadows.Value == MainConfig.ShadowsType.Hard)
{
val.shadows = (LightShadows)1;
}
else if (MainConfig.surtlingDoubleLightShadows.Value == MainConfig.ShadowsType.Soft)
{
val.shadows = (LightShadows)2;
}
}
}
public static void ModifyRopeLights(ZNetScene instance, string prefab, float intensity, float range)
{
GameObject prefab2 = instance.GetPrefab(prefab);
if (!Object.op_Implicit((Object)(object)prefab2))
{
return;
}
Light[] componentsInChildren = prefab2.GetComponentsInChildren<Light>(true);
foreach (Light val in componentsInChildren)
{
val.intensity = intensity;
val.range = range;
if (MainConfig.ropeLightShadows.Value == MainConfig.ShadowsType.None)
{
val.shadows = (LightShadows)0;
}
else if (MainConfig.ropeLightShadows.Value == MainConfig.ShadowsType.Hard)
{
val.shadows = (LightShadows)1;
}
else if (MainConfig.ropeLightShadows.Value == MainConfig.ShadowsType.Soft)
{
val.shadows = (LightShadows)2;
}
}
}
public static void ModifySurtlingLantern(ZNetScene instance, string slprefab, float slintensity, float slrange)
{
GameObject prefab = instance.GetPrefab(slprefab);
if (Object.op_Implicit((Object)(object)prefab))
{
Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
componentInChildren.intensity = slintensity;
componentInChildren.range = slrange;
if (MainConfig.surtlingLanternLightShadows.Value == MainConfig.ShadowsType.None)
{
componentInChildren.shadows = (LightShadows)0;
}
else if (MainConfig.surtlingLanternLightShadows.Value == MainConfig.ShadowsType.Hard)
{
componentInChildren.shadows = (LightShadows)1;
}
else if (MainConfig.surtlingLanternLightShadows.Value == MainConfig.ShadowsType.Soft)
{
componentInChildren.shadows = (LightShadows)2;
}
}
}
public static void ModifySurtlingSingle(ZNetScene instance, string ssprefab, float ssintensity, float ssrange)
{
GameObject prefab = instance.GetPrefab(ssprefab);
if (Object.op_Implicit((Object)(object)prefab))
{
Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
componentInChildren.intensity = ssintensity;
componentInChildren.range = ssrange;
if (MainConfig.surtlingSingleLightShadows.Value == MainConfig.ShadowsType.None)
{
componentInChildren.shadows = (LightShadows)0;
}
else if (MainConfig.surtlingSingleLightShadows.Value == MainConfig.ShadowsType.Hard)
{
componentInChildren.shadows = (LightShadows)1;
}
else if (MainConfig.surtlingSingleLightShadows.Value == MainConfig.ShadowsType.Soft)
{
componentInChildren.shadows = (LightShadows)2;
}
}
}
public static void ModifyWallLights(ZNetScene instance, string wlprefab, float wlintensity, float wlrange)
{
GameObject prefab = instance.GetPrefab(wlprefab);
if (Object.op_Implicit((Object)(object)prefab))
{
Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
componentInChildren.intensity = wlintensity;
componentInChildren.range = wlrange;
if (MainConfig.wallLightShadows.Value == MainConfig.ShadowsType.None)
{
componentInChildren.shadows = (LightShadows)0;
}
else if (MainConfig.wallLightShadows.Value == MainConfig.ShadowsType.Hard)
{
componentInChildren.shadows = (LightShadows)1;
}
else if (MainConfig.wallLightShadows.Value == MainConfig.ShadowsType.Soft)
{
componentInChildren.shadows = (LightShadows)2;
}
}
}
public static void ModifyLavaLights(ZNetScene instance, string llprefab, float llintensity, float llrange)
{
GameObject prefab = instance.GetPrefab(llprefab);
if (Object.op_Implicit((Object)(object)prefab))
{
Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
componentInChildren.intensity = llintensity;
componentInChildren.range = llrange;
if (MainConfig.lavaLightShadows.Value == MainConfig.ShadowsType.None)
{
componentInChildren.shadows = (LightShadows)0;
}
else if (MainConfig.lavaLightShadows.Value == MainConfig.ShadowsType.Hard)
{
componentInChildren.shadows = (LightShadows)1;
}
else if (MainConfig.lavaLightShadows.Value == MainConfig.ShadowsType.Soft)
{
componentInChildren.shadows = (LightShadows)2;
}
}
}
public static void ModifyCrystalLights(ZNetScene instance, string clprefab, float clintensity, float clrange)
{
GameObject prefab = instance.GetPrefab(clprefab);
if (Object.op_Implicit((Object)(object)prefab))
{
Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
componentInChildren.intensity = clintensity;
componentInChildren.range = clrange;
if (MainConfig.crystalLightShadows.Value == MainConfig.ShadowsType.None)
{
componentInChildren.shadows = (LightShadows)0;
}
else if (MainConfig.crystalLightShadows.Value == MainConfig.ShadowsType.Hard)
{
componentInChildren.shadows = (LightShadows)1;
}
else if (MainConfig.crystalLightShadows.Value == MainConfig.ShadowsType.Soft)
{
componentInChildren.shadows = (LightShadows)2;
}
}
}
public static void ModifyBrazierLights(ZNetScene instance, string bprefab, float bintensity, float brange)
{
GameObject prefab = instance.GetPrefab(bprefab);
if (Object.op_Implicit((Object)(object)prefab))
{
Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
componentInChildren.intensity = bintensity;
componentInChildren.range = brange;
if (MainConfig.brazierLightShadows.Value == MainConfig.ShadowsType.None)
{
componentInChildren.shadows = (LightShadows)0;
}
else if (MainConfig.brazierLightShadows.Value == MainConfig.ShadowsType.Hard)
{
componentInChildren.shadows = (LightShadows)1;
}
else if (MainConfig.brazierLightShadows.Value == MainConfig.ShadowsType.Soft)
{
componentInChildren.shadows = (LightShadows)2;
}
}
}
public static void ModifyBeaconLights(ZNetScene instance, string bcprefab, float bcintensity, float bcrange)
{
GameObject prefab = instance.GetPrefab(bcprefab);
if (Object.op_Implicit((Object)(object)prefab))
{
Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
componentInChildren.intensity = bcintensity;
componentInChildren.range = bcrange;
if (MainConfig.beaconLightShadows.Value == MainConfig.ShadowsType.None)
{
componentInChildren.shadows = (LightShadows)0;
}
else if (MainConfig.beaconLightShadows.Value == MainConfig.ShadowsType.Hard)
{
componentInChildren.shadows = (LightShadows)1;
}
else if (MainConfig.beaconLightShadows.Value == MainConfig.ShadowsType.Soft)
{
componentInChildren.shadows = (LightShadows)2;
}
}
}
}
public class TexturePatches
{
[HarmonyPatch(typeof(ZNetScene), "Awake")]
private class ZNetSceneAwakeTexturePatch
{
[HarmonyPriority(200)]
private static void Postfix(ZNetScene __instance)
{
zNetScene = __instance;
if (MainConfig.disableHDTextures.Value)
{
ChangeTextureFilter();
}
}
}
public static ZNetScene zNetScene;
public static void ChangeTextureFilter()
{
foreach (GameObject prefab in zNetScene.m_prefabs)
{
if (!((Object)prefab).name.ToLower().Contains("mm_corewood"))
{
continue;
}
MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>(true);
if (componentsInChildren == null)
{
continue;
}
MeshRenderer[] array = componentsInChildren;
foreach (MeshRenderer val in array)
{
if ((Object)(object)((Renderer)val).material.mainTexture != (Object)null)
{
((Renderer)val).material.mainTexture.anisoLevel = 0;
((Renderer)val).material.mainTexture.filterMode = (FilterMode)0;
}
}
}
}
}
public class SoundPatches
{
[HarmonyPatch(typeof(ZNetScene), "Awake")]
private static class ZNetSceneAwakePatch
{
private static void Postfix(ZNetScene __instance)
{
GameObject prefab = __instance.GetPrefab("sfx_open_gate_mm");
GameObject prefab2 = __instance.GetPrefab("sfx_close_gate_mm");
GameObject prefab3 = __instance.GetPrefab("sfx_open_bridge_mm");
GameObject prefab4 = __instance.GetPrefab("sfx_break_glass_mm");
GameObject prefab5 = __instance.GetPrefab("sfx_tower_bridge_mm");
GameObject prefab6 = __instance.GetPrefab("sfx_elevator_mm");
GameObject prefab7 = __instance.GetPrefab("sfx_elevator_long_mm");
GameObject prefab8 = __instance.GetPrefab("sfx_water_fountain");
GameObject prefab9 = __instance.GetPrefab("sfx_frog_croaking");
GameObject prefab10 = __instance.GetPrefab("sfx_water_bucket");
GameObject prefab11 = __instance.GetPrefab("sfx_bartender_bye");
GameObject prefab12 = __instance.GetPrefab("sfx_bartender_greet");
GameObject prefab13 = __instance.GetPrefab("sfx_bartender_random");
GameObject prefab14 = __instance.GetPrefab("sfx_bartender_trade");
GameObject prefab15 = __instance.GetPrefab("sfx_shower_cwe");
GameObject prefab16 = __instance.GetPrefab("sfx_elevator_cwe_01");
GameObject prefab17 = __instance.GetPrefab("sfx_elevator_cwe_01");
GameObject prefab18 = __instance.GetPrefab("sfx_elevator_cwe_01");
GameObject prefab19 = __instance.GetPrefab("sfx_elevator_cwe_01");
try
{
prefab.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab2.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab3.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab4.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab5.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab6.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab7.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab8.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab9.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab10.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab11.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab12.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab13.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab14.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab15.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab16.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab17.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab18.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
prefab19.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = AudioMan.instance.m_ambientMixer;
}
catch
{
Logger.LogError((object)"Error with ZNetSceneAwakePatch!");
}
}
}
}
internal class FileWatcher
{
public static void WatchFileChanges(string path, Action onChanged)
{
FileSystemWatcher fileSystemWatcher = new FileSystemWatcher();
string directoryName = Path.GetDirectoryName(path);
string fileName = Path.GetFileName(path);
fileSystemWatcher.Path = directoryName;
fileSystemWatcher.Filter = fileName;
fileSystemWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
fileSystemWatcher.Changed += delegate
{
onChanged?.Invoke();
};
fileSystemWatcher.Deleted += delegate
{
onChanged?.Invoke();
};
fileSystemWatcher.Created += delegate
{
onChanged?.Invoke();
};
fileSystemWatcher.Renamed += delegate
{
onChanged?.Invoke();
};
fileSystemWatcher.EnableRaisingEvents = true;
}
public static void WatchTranslationChanges(string path, Action onChanged)
{
if (!Directory.Exists(CoreWoodPlugin.TranslationFilePath))
{
return;
}
try
{
WatchFileChanges(Path.Combine(path, "*.*"), onChanged);
}
catch
{
Logger.LogError((object)"There was an issue loading Translation files!");
}
}
}
internal class LocalisedText
{
public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();
public static void AddLocalisations()
{
CustomLocalization localization = Localization;
string text = "English";
localization.AddTranslation(ref text, new Dictionary<string, string>
{
{ "piece_mm_corewood_market_stall_fish", "Fish Market Stall" },
{ "piece_mm_perch_fish_container", "Perch Fish Crate" },
{ "piece_mm_tuna_fish_container", "Tuna Fish Crate" },
{ "piece_mm_troll_fish_container", "Trollfish Crate" },
{ "piece_mm_herring_fish_container", "Herring Fish Crate" },
{ "piece_mm_angler_fish_container", "Angler Fish Crate" },
{ "piece_mm_serpent_flesh_container", "Serpent Flesh Crate" },
{ "piece_mm_corewood_market_stall_veg", "Fruit & Veg Market Stall" },
{ "piece_mm_bluberries_container", "Bluberry Crate" },
{ "piece_mm_raspberry_container", "Raspberry Crate" },
{ "piece_mm_cloudberry_container", "Cloudberry Crate" },
{ "piece_mm_onion_container", "Onion Crate" },
{ "piece_mm_turnip_container", "Turnip Crate" },
{ "piece_mm_carrot_container", "Carrot Crate" },
{ "piece_mm_corewood_market_stall_meat", "Meat Market Stall" },
{ "piece_mm_boar_meat_container", "Boar Meat Crate" },
{ "piece_mm_lox_meat_container", "Lox Meat Crate" },
{ "piece_mm_volture_meat_container", "Volture Meat Crate" },
{ "piece_mm_chicken_meat_container", "Chicken Meat Crate" },
{ "piece_mm_deer_meat_container", "Deer Meat Crate" },
{ "piece_mm_wolf_meat_container", "Wolf Meat Crate" },
{ "piece_mm_hare_meat_container", "Hare Meat Crate" },
{ "piece_mm_asksvin_meat_container", "Asksvin Meat Crate" },
{ "piece_mm_corewood_market_stall_seeds", "Seed Market Stall" },
{ "piece_mm_oak_seeds_container", "Oak Seeds Sack" },
{ "piece_mm_birch_seeds_container", "Birch Seeds Sack" },
{ "piece_mm_beech_seeds_container", "Beech Seeds Sack" },
{ "piece_mm_pine_seeds_container", "Pine Seeds Sack" },
{ "piece_mm_mystical_seeds_container", "Mystical Seeds Sack" },
{ "piece_mm_ancient_seeds_container", "Ancient Seeds Sack" },
{ "piece_mm_carrot_seeds_container", "Carrot Seeds Sack" },
{ "piece_mm_turnip_seeds_container", "Turnip Seeds Sack" },
{ "piece_mm_onion_seeds_container", "Onion Seeds Sack" },
{ "piece_mm_corewood_market_stall_hot_food", "Hot Food Market Stall" },
{ "piece_mm_hot_asksvin_tail_container", "Cooked Asksvin Tail" },
{ "piece_mm_hot_serpent_meat_container", "Cooked Serpent Meat" },
{ "piece_mm_hot_volture_meat_container", "Cooked Volture Meat" },
{ "piece_mm_hot_boar_meat_container", "Cooked Boar Meat" },
{ "piece_mm_hot_lox_meat_container", "Cooked Lox Meat" },
{ "piece_mm_hot_wolf_meat_container", "Cooked Wolf Meat" },
{ "piece_mm_hot_chicken_meat_container", "Cooked Chicken Meat" },
{ "piece_mm_hot_deer_meat_container", "Cooked Deer Meat" },
{ "piece_mm_chair", "Chair" },
{ "piece_mm_bench", "Log Bench" },
{ "piece_mmgate", "Door" },
{ "piece_mmfencegate", "Gate" },
{ "piece_mmwindow", "Window" },
{ "piece_mmshutter", "Shutter" },
{ "piece_mmcabinet", "Cabinet" },
{ "piece_mmtoilet", "Toilet" },
{ "piece_mmwatchtower_enter", "Enter Watch Tower" },
{ "piece_mmwatchtower_exit", "Exit Watch Tower" },
{ "piece_mmexit", "Exit" },
{ "piece_mmelevator", "Elevator" },
{ "piece_mm_chest_open", "Open" },
{ "piece_mm_chest_edit", "Edit" },
{ "piece_mm_drawbridge", "Drawbridge" },
{ "piece_mm_corewood_stakewall", "Core Wood Stake Wall" },
{ "piece_mm_corewood_stakes_01", "Core Wood Sharp Stakes" },
{ "piece_mm_corewood_stakes_02", "Core Wood Sharp Stakes" },
{ "piece_mm_corewood_stakes_03", "Core Wood Sharp Stakes" },
{ "piece_mm_corewood_stakes_04", "Core Wood Sharp Stakes" },
{ "piece_mm_corewood_palisadefence", "Core Wood Palisade" },
{ "piece_mm_corewood_palisadefencetall", "Core Wood Palisade Tall" },
{ "piece_mm_corewood_palisade_tower", "Core Wood Palisade Tower" },
{ "piece_mm_corewood_palisade_beacon", "Core Wood Palisade Beacon" },
{ "piece_mm_corewood_palisade_gates", "Core Wood Palisade Gates" },
{ "piece_mm_corewood_palisade_entrance", "Core Wood Fortified Entrance" },
{ "piece_mm_corewood_palisade_wall", "Core Wood Fortified Wall" },
{ "piece_mm_corewood_palisade_corner", "Core Wood Fortified Corner" },
{ "piece_mm_corewood_woodlog26", "Core Wood Log 26" },
{ "piece_mm_corewood_woodlog45", "Core Wood Log 45" },
{ "piece_mm_corewood_woodlog26_thin", "Thin Core Wood Log 26" },
{ "piece_mm_corewood_woodlog45_thin", "Thin Core Wood Log 45" },
{ "piece_mm_corewood_logpole1", "Core Wood Log Pole 1m" },
{ "piece_mm_corewood_logpole2", "Core Wood Log Pole 2m" },
{ "piece_mm_corewood_logpole3", "Core Wood Log Pole 3m" },
{ "piece_mm_corewood_logpole4", "Core Wood Log Pole 4m" },
{ "piece_mm_corewood_logpole1_thin", "Thin Core Wood Log Pole 1m" },
{ "piece_mm_corewood_logpole2_thin", "Thin Core Wood Log Pole 2m" },
{ "piece_mm_corewood_logpole3_thin", "Thin Core Wood Log Pole 3m" },
{ "piece_mm_corewood_logpole4_thin", "Thin Core Wood Log Pole 4m" },
{ "piece_mm_corewood_logbeam1", "Core Wood Log Beam 1m" },
{ "piece_mm_corewood_logbeam2", "Core Wood Log Beam 2m" },
{ "piece_mm_corewood_logbeam3", "Core Wood Log Beam 3m" },
{ "piece_mm_corewood_logbeam4", "Core Wood Log Beam 4m" },
{ "piece_mm_corewood_logbeam1_thin", "Thin Core Wood Log Beam 1m" },
{ "piece_mm_corewood_logbeam2_thin", "Thin Core Wood Log Beam 2m" },
{ "piece_mm_corewood_logbeam3_thin", "Thin Core Wood Log Beam 3m" },
{ "piece_mm_corewood_logbeam4_thin", "Thin Core Wood Log Beam 4m" },
{ "piece_mm_corewood_roof26", "Core Wood Roof 26" },
{ "piece_mm_corewood_roof45", "Core Wood Roof 45" },
{ "piece_mm_corewood_rooficorner26", "Core Wood Icorner 26" },
{ "piece_mm_corewood_rooficorner45", "Core Wood Icorner 45" },
{ "piece_mm_corewood_roofocorner26", "Core Wood Ocorner 26" },
{ "piece_mm_corewood_roofocorner45", "Core Wood Ocorner 45" },
{ "piece_mm_corewood_rooftop26", "Core Wood Roof Top 26" },
{ "piece_mm_corewood_rooftop45", "Core Wood Roof Top 45" },
{ "piece_mm_corewood_wallroof26", "Core Wood Wall Roof 26" },
{ "piece_mm_corewood_wallroof45", "Core Wood Wall Roof 45" },
{ "piece_mm_corewood_wallroof_upsidedown26", "Core Wood Wall Roof 26" },
{ "piece_mm_corewood_wallroof_upsidedown45", "Core Wood Wall Roof 45" },
{ "piece_mm_corewood_cross26", "Core Wood Cross 26" },
{ "piece_mm_corewood_cross45", "Core Wood Cross 45" },
{ "piece_mm_corewood_decking_2x2", "Core Wood Decking 2x2" },
{ "piece_mm_corewood_decking_4x4", "Core Wood Decking 4x4" },
{ "piece_mm_corewood_floor_half", "Core Wood Floor Half" },
{ "piece_mm_corewood_floor", "Core Wood Floor 2m" },
{ "piece_mm_corewood_floor_4m", "Core Wood Floor 4m" },
{ "piece_mm_corewood_quarterwall", "Core Wood Wall Quarter" },
{ "piece_mm_corewood_halfwall", "Core Wood Wall Half" },
{ "piece_mm_corewoodwall_v", "Core Wood Wall 2m" },
{ "piece_mm_corewoodwall_4m", "Core Wood Wall 4m" },
{ "piece_mm_corewood_gate_left", "Core Wood Gate Left (L)" },
{ "piece_mm_corewood_gate_right", "Core Wood Gate Right (L)" },
{ "piece_mm_corewood_gate_small_left", "Core Wood Gate Left (S)" },
{ "piece_mm_corewood_gate_small_right", "Core Wood Gate Right (S)" },
{ "piece_mm_corewood_trapdoor", "Core Wood Trapdoor" },
{ "piece_mm_corewwood_window_single", "Core Wood Window Single" },
{ "piece_mm_corewwood_window_double", "Core Wood Window Double" },
{ "piece_mm_corewwood_window_tall", "Core Wood Window Tall" },
{ "piece_mm_corewwood_window_small", "Core Wood Window Animated (S)" },
{ "piece_mm_corewwood_window_medium", "Core Wood Window Animated (M)" },
{ "piece_mm_corewwood_window_large", "Core Wood Shutter Animated (L)" },
{ "piece_mm_corewwood_shutter_small", "Core Wood Shutter Animated (S)" },
{ "piece_mm_corewwood_shutter_medium", "Core Wood Shutter Animated (M)" },
{ "piece_mm_corewwood_shutter_large", "Core Wood Shutter Animated (L)" },
{ "piece_mm_window_large_01", "Stained Glass Window (L)" },
{ "piece_mm_window_large_02", "Stained Glass Window (L)" },
{ "piece_mm_window_large_03", "Stained Glass Window (L)" },
{ "piece_mm_window_medium_01", "Stained Glass Window (M)" },
{ "piece_mm_window_medium_02", "Stained Glass Window (M)" },
{ "piece_mm_window_medium_03", "Stained Glass Window (M)" },
{ "piece_mm_window_small_01", "Stained Glass Window (S)" },
{ "piece_mm_window_small_02", "Stained Glass Window (S)" },
{ "piece_mm_window_small_03", "Stained Glass Window (S)" },
{ "piece_mm_corewood_fencepost", "Core Wood Fence Post" },
{ "piece_mm_corewood_wattle_fence", "Core Wood Wattle Fence" },
{ "piece_mm_corewood_fence_small", "Core Wood Fence (S)" },
{ "piece_mm_corewood_fence_small_alt", "Core Wood Fence (M)" },
{ "piece_mm_corewood_fence_large", "Core Wood Fence (L)" },
{ "piece_mm_corewood_fence_small_gate", "Core Wood Fence Gate" },
{ "piece_mm_corewood_stair", "Core Wood Stair" },
{ "piece_mm_corewood_stepladder", "Core Wood Stepladder" },
{ "piece_mm_corewood_drawbridge", "Drawbridge 01" },
{ "piece_mm_corewood_drawbridge2", "Drawbridge 02" },
{ "piece_mm_corewood_elevator_small", "Small Elevator 4.5m" },
{ "piece_mm_corewood_elevator_large", "Large Elevator 4.5m" },
{ "piece_mm_corewood_elevator_small_9", "Small Elevator 9m" },
{ "piece_mm_corewood_elevator_large_9", "Large Elevator 9m" },
{ "piece_mm_corewood_liftgate", "Liftgate" },
{ "piece_mm_corewood_bridge_part", "Bridge Part" },
{ "piece_mm_corewood_bridge_part_02", "Bridge Part 02" },
{ "piece_mm_corewood_bridge_tjunction", "Bridge T-Junction" },
{ "piece_mm_corewood_bridge_cross_junction", "Bridge Cross-Junction" },
{ "piece_mm_corewood_bridge_foundation", "Bridge Foundation" },
{ "piece_mm_corewood_bridge_foundation_02", "Bridge Foundation 02" },
{ "piece_mm_corewood_bridge_ramp", "Bridge Ramp" },
{ "piece_mm_corewood_bridge_drawbridge", "Bridge Drawbridge" },
{ "piece_mm_corewood_tower_drawbridge", "Tower Drawbridge" },
{ "piece_mm_corewood_greenhouse_door", "Greenhouse Door" },
{ "piece_mm_corewood_greenhouse_panel", "Greenhouse Panel" },
{ "piece_mm_corewood_greenhouse_roof", "Greenhouse Roof" },
{ "piece_mm_corewood_greenhouse_roof_top", "Greenhouse Roof Top" },
{ "piece_mm_corewood_greenhouse_roof_wall_corner", "Greenhouse Roof Wall Corner" },
{ "piece_mm_corewood_greenhouse_roof_wall_half", "Greenhouse Roof Wall Half" },
{ "piece_mm_corewood_greenhouse_workbench", "Greenhouse Workbench" },
{ "piece_mm_corewood_greenhouse_table", "Greenhouse Table" },
{ "piece_mm_greenhouse_plantpot", "plant Pot" },
{ "piece_mm_greenhouse_plantpots", "plant Pots" },
{ "piece_mm_greenhouse_soilbags", "Soil Bags" },
{ "piece_mm_greenhouse_shovel", "Garden Shovel" },
{ "piece_mm_greenhouse_rake", "Garden Rake" },
{ "piece_mm_corewood_stack", "Core Wood Stack" },
{ "piece_mm_corewood_dynamic_stack", "Dynamic Core Wood Stack" },
{ "piece_mm_corewood_dynamic_stack_desc", "A dynamic stack of Core Wood logs." },
{ "piece_mm_corewood_logbench", "Core Wood Log Bench" },
{ "piece_mm_corewood_large_bench", "Core Wood Log Bench" },
{ "piece_mm_corewood_stump_chair", "Core Wood Stump Chair" },
{ "piece_mm_corewood_throne", "Core Wood Throne" },
{ "piece_mm_corewood_chair", "Core Wood Chair" },
{ "piece_mm_corewood_table", "Core Wood Table" },
{ "piece_mm_corewood_log_chair", "Core Wood Stump Chair" },
{ "piece_mm_corewood_log_table", "Core Wood Stump Table" },
{ "piece_mm_corewood_bed", "Core Wood Bed" },
{ "piece_mm_corewood_bed_4poster", "Core Wood 4 Poster" },
{ "piece_mm_corewood_chest_public", "public Chest" },
{ "piece_mm_corewood_chest_private", "private Chest" },
{ "piece_mm_corewood_bookshelf_small", "Bookshelf (S)" },
{ "piece_mm_corewood_bookshelf_medium", "Bookshelf (M)" },
{ "piece_mm_corewood_bookshelf_large", "Bookshelf (L)" },
{ "piece_mm_corewood_wall_cabinet", "Wall Cabinet" },
{ "piece_mm_corewood_tall_cabinet", "Tall Cabinet" },
{ "piece_mm_corewood_tall_cabinet_double", "Double Tall Cabinet" },
{ "piece_mm_corewood_cabinet_armor", "Armor Stand Cabinet" },
{ "piece_mm_corewood_displaycase", "Boss Trophy Display" },
{ "piece_mm_corewood_displaycase_large", "Large Display Case" },
{ "piece_mm_corewood_outhouse", "Outhouse" },
{ "piece_mm_corewood_arch", "Garden Arch" },
{ "piece_mm_corewood_arch_ivy", "Garden Arch Ivy" },
{ "piece_mm_horn_walltorch", "Horn Walltorch" },
{ "piece_mm_deer_chandelier", "Deer Chandelier" },
{ "piece_mm_skull_candles", "Skull Candles" },
{ "piece_mm_lavalantern", "Lava Lantern" },
{ "piece_mm_corewood_surtling_lantern", "Surtling Lantern" },
{ "piece_mm_surtling_lamppost_single", "Surtling Lamppost Single" },
{ "piece_mm_surtling_lamppost_double", "Surtling Lamppost Double" },
{ "piece_corewood_crystal_light", "Crystal Light" },
{ "piece_mm_corewood_rope_lights", "Crystal Rope Lights" },
{ "piece_mm_corewood_brazier", "Iron Brazier" },
{ "piece_mm_private_sign", "private Property Sign" },
{ "piece_mm_repair_sign", "Repair Area Sign" },
{ "piece_mm_rest_sign", "Rest Area Sign" },
{ "piece_mm_docks_sign", "Docks Sign" },
{ "piece_mm_tavern_sign", "Tavern Sign" },
{ "piece_mm_haldor_sign", "Haldor Sign" },
{ "piece_mm_hildir_sign", "Hildir Sign" },
{ "piece_mm_bonemass_banner", "Bonemass Banner" },
{ "piece_mm_eikthyr_banner", "Eikthyr Banner" },
{ "piece_mm_elder_banner", "The Elder Banner" },
{ "piece_mm_fader_banner", "Fader Banner" },
{ "piece_mm_moder_banner", "Moder Banner" },
{ "piece_mm_queen_banner", "The Queen Banner" },
{ "piece_mm_yagluth_banner", "Yagluth Banner" },
{ "piece_mm_haldor_banner", "Haldor Banner" },
{ "piece_mm_hildir_banner", "Hildir Banner" },
{ "piece_mm_wall_banner_01", "Wall Banner 01" },
{ "piece_mm_wall_banner_02", "Wall Banner 02" },
{ "piece_mm_wall_banner_03", "Wall Banner 03" },
{ "piece_mm_first_pictureframe", "picture Frame" },
{ "piece_mm_first_pictureframe_vertical", "picture Frame(vertical)" },
{ "piece_mm_first_pictureframe_square", "picture Frame(square)" },
{ "piece_mm_bookstack_01", "Book Stack 01" },
{ "piece_mm_bookstack_02", "Book Stack 02" },
{ "piece_mm_bookstack_03", "Book Stack 03" },
{ "piece_mm_bookstack_04", "Book Stack 04" },
{ "piece_mm_bookstack_05", "Book Stack 05" },
{ "piece_mm_bookstack_06", "Book Stack 06" },
{ "piece_mm_bowlstack_01", "Bowl Stack 01" },
{ "piece_mm_bowlstack_02", "Bowl Stack 02" },
{ "piece_mm_platestack_01", "plate Stack 01" },
{ "piece_mm_platestack_02", "plate Stack 02" },
{ "piece_mm_saucepan_01", "Saucepan 01" },
{ "piece_mm_saucepan_02", "Saucepan 02" },
{ "piece_mm_potted_plant_01", "potted Plant 01" },
{ "piece_mm_potted_plant_02", "potted Plant 02" },
{ "piece_mm_potted_plant_03", "potted Plant 03" },
{ "piece_mm_potted_plant_04", "potted Plant 04" },
{ "piece_mm_potted_plant_05", "potted Plant 05" },
{ "piece_mm_potted_plant_06", "potted Plant 06" },
{ "piece_mm_corewood_planter_01", "planter 01" },
{ "piece_mm_corewood_planter_02", "planter 02" },
{ "piece_mm_corewood_planter_03", "planter 03" },
{ "piece_mm_corewood_planter_04", "planter 04" },
{ "piece_mm_corewood_planter_05", "planter 05" },
{ "piece_mm_corewood_planter_06", "planter 06" },
{ "piece_mm_corewood_planter_glowing", "planter Glowing" },
{ "piece_mm_corewood_planter_roses_red", "planter Roses Red" },
{ "piece_mm_corewood_planter_roses_white", "planter Roses White" },
{ "piece_mm_corewood_planter_roses_yellow", "planter Roses Yellow" },
{ "piece_mm_seeds_desc", "Mystical seeds can be bought from the traders." },
{ "piece_mm_decorative_goblet", "Decorative Goblet" },
{ "piece_mm_decorative_pitcher", "Decorative Pitcher" },
{ "piece_mm_decorative_bowl", "Decorative Bowl" },
{ "piece_mm_decorative_plate", "Decorative Plate" },
{ "piece_mm_decorative_bowl_large", "Large Decorative Bowl" },
{ "piece_mm_decorative_plate_large", "Large Decorative Plate" },
{ "piece_mm_cutlery_set", "Cutlery Set" },
{ "piece_mm_rug_01", "Rug 01" },
{ "piece_mm_rug_02", "Rug 02" },
{ "piece_mm_rug_03", "Rug 03" },
{ "piece_mm_scarecrow", "Scarecrow" },
{ "piece_mm_wood_carving_01", "Viking Wood Carving" },
{ "piece_mm_wood_carving_02", "Owl Wood Carving" },
{ "piece_mm_corewood_stuffed_boar", "Stuffed Boar" },
{ "piece_mm_corewood_stuffed_deer", "Stuffed Deer" },
{ "piece_mm_corewood_stuffed_wolf", "Stuffed Wolf" },
{ "piece_mm_corewood_stuffed_vulture", "Stuffed Vulture" },
{ "piece_mm_corewood_stuffed_werewolf", "Stuffed Werewolf" },
{ "piece_mm_corewood_stuffed_crow", "Stuffed Crow" },
{ "piece_mm_corewood_stuffed_seagul", "Stuffed Seagul" },
{ "piece_mm_corewood_creature_stand_small", "Small Creature Stand" },
{ "piece_mm_corewood_creature_stand_medium", "Medium Creature Stand" },
{ "piece_mm_corewood_creature_stand_large", "Large Creature Stand" },
{ "piece_mm_corewood_chest_stackable", "Stackable Chest" },
{ "piece_mm_water_fountain", "Water Fountain" },
{ "piece_mm_haybale", "Straw Bale" },
{ "piece_mm_shower_block", "Shower" },
{ "piece_mm_parasol", "Parasol" },
{ "piece_mm_corewood_plank_floor", "Core Wood Planks 2x2" },
{ "piece_mm_corewood_plank_floor_4", "Core Wood Planks 4x4" },
{ "piece_mm_corewood_well", "Old Well" },
{ "piece_mm_corewood_bar", "Burts Bar" },
{ "piece_mm_corewood_gazebo", "Garden Gazebo" },
{ "piece_mm_corewood_pergola", "Garden Pergola" },
{ "piece_mm_corewood_footbridge_small", "Small Footbridge" },
{ "piece_mm_corewood_footbridge_large", "Large Footbridge" },
{ "piece_mm_corewood_arch_corner", "Arch Corner" },
{ "piece_mm_corewood_paving_straight", "Paving Straight" },
{ "piece_mm_corewood_paving_corner", "Paving Corner" },
{ "piece_mm_corewood_paving_cross", "Paving Cross" },
{ "piece_mm_corewood_aquarium", "Aquarium" },
{ "piece_mm_corewood_large_aquarium", "Large Aquarium" },
{ "piece_mm_gnome_welcome", "Gnome Welcome" },
{ "piece_mm_gnome_female", "Gnome Female" },
{ "piece_mm_gnome_flowerpots", "Gnome Flowerpots" },
{ "piece_mm_gnome_palm_tree", "Gnome Palm Tree" },
{ "piece_mm_barrel_01", "Barrel" },
{ "piece_mm_keg_01", "Large Keg" },
{ "piece_mm_keg_02", "Small Keg" },
{ "piece_mm_placeable_ivy", "Ivy Patch" },
{ "piece_mm_corewood_elevator_01", "Elevator 01" },
{ "piece_mm_corewood_elevator_02", "Elevator 02" },
{ "piece_mm_corewood_elevator_03", "Elevator 03" },
{ "piece_mm_corewood_elevator_04", "Elevator 04" },
{ "piece_mm_hedge", "Hedge" },
{ "piece_mm_hedge_curved", "Hedge Curved" },
{ "piece_mm_hedge_corner", "Hedge Corner" },
{ "piece_mm_hedge_arch", "Hedge Arch" },
{ "piece_mm_corewood_noticeboard", "Large Noticeboard" },
{ "piece_mm_corewood_rope_fence", "Rope Fence" },
{ "piece_mm_corewood_rope_fence_angled", "Rope Fence Angled" }
});
CustomLocalization localization2 = Localization;
text = "English";
localization2.AddTranslation(ref text, new Dictionary<string, string>
{
{ "item_mm_planter_small", "Small Planter" },
{ "item_mm_planter_large", "Large Planter" },
{ "item_mm_vase_01", "Vase 01" },
{ "item_mm_vase_02", "Vase 02" },
{ "item_mm_vase_03", "Vase 03" },
{ "item_mm_mystical_seed", "Mystical Seed" },
{ "item_mm_mystical_seed_desc", "A Mystical seed to create plants at the Greenhouse Workbench." }
});
CustomLocalization localization3 = Localization;
text = "English";
localization3.AddTranslation(ref text, new Dictionary<string, string>
{
{ "message_restricted", "Item Resticted!" },
{ "text_chest_open", "Open (Hold to quick stack)" },
{ "text_chest_edit", "Edit text" },
{ "text_chest_set", "Set item name" },
{ "text_enable_fountain", "Enable Fountain" },
{ "text_disable_fountain", "Disable Fountain" },
{ "text_enable_fish", "Enable Fish" },
{ "text_disable_fish", "Disable Fish" },
{ "text_use_elevator", "Use Elevator" },
{ "text_written_by", "Written by" },
{ "npc_bartender_talk", "????" }
});
}
}
public class GamePatches
{
[HarmonyPatch(typeof(ZNetScene), "Awake")]
private class ZNetSceneAwakeMeshPatch
{
[HarmonyPriority(200)]
private static void Postfix(ZNetScene __instance)
{
zNetScene = __instance;
FixGameObjects();
}
}
public static ZNetScene zNetScene;
public static void FixGameObjects()
{
foreach (GameObject prefab in zNetScene.m_prefabs)
{
if (!((Object)prefab).name.ToLower().StartsWith("mm_corewood"))
{
continue;
}
MeshRenderer[] componentsInChildren = prefab.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val in componentsInChildren)
{
if (((Renderer)val).material.HasProperty("_RippleDistance"))
{
((Renderer)val).sharedMaterial.SetFloat("_RippleDistance", 0.01f);
((Renderer)val).sharedMaterial.SetFloat("_RippleFreq", 0f);
((Renderer)val).sharedMaterial.SetFloat("_ValueNoise", 0f);
}
}
}
}
}
internal class TraderPatches
{
[HarmonyPatch(typeof(Trader), "GetAvailableItems")]
public static class GetAvailableItemsPatch
{
[HarmonyPriority(200)]
private static void Postfix(Trader __instance, ref List<TradeItem> __result)
{
if (!((Object)__instance).name.Contains("Burt"))
{
string name = ((Object)Cache.GetPrefab<GameObject>("mm_mystical_seed")).name;
__result.Add(CreateTraderItem(name, 10, 10, "none"));
}
if (!MainConfig.traderEnabled.Value || !((Object)__instance).name.Contains("Burt"))
{
return;
}
if (MainConfig.barleyWineEnabled.Value)
{
int value = MainConfig.barleyWineStack.Value;
int value2 = MainConfig.barleyWinePrice.Value;
if (MainConfig.barleyWineKey.Value != "")
{
key = MainConfig.barleyWineKey.Value;
}
string name2 = ((Object)Cache.GetPrefab<GameObject>("BarleyWine")).name;
__result.Add(CreateTraderItem(name2, value, value2, key));
}
if (MainConfig.frostResistEnabled.Value)
{
int value3 = MainConfig.frostResistStack.Value;
int value4 = MainConfig.frostResistPrice.Value;
if (MainConfig.frostResistKey.Value != "")
{
key = MainConfig.frostResistKey.Value;
}
string name3 = ((Object)Cache.GetPrefab<GameObj