Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BoneAppetit v3.3.16
BoneAppetit.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; 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.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BoneAppetit")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BoneAppetit")] [assembly: AssemblyCopyright("Copyright RockerKitten and sbtoon© 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("3.3.16")] [assembly: AssemblyMetadata("AWLStorePackage", "3.3.16")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.3.16.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [RequireComponent(typeof(ParticleSystem))] public class CFX_AutoDestructShuriken : MonoBehaviour { public bool OnlyDeactivate; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("CheckIfAlive"); } private IEnumerator CheckIfAlive() { ParticleSystem ps = ((Component)this).GetComponent<ParticleSystem>(); while ((Object)ps != (Object)null) { yield return (object)new WaitForSeconds(0.5f); if (!ps.IsAlive(true)) { if (OnlyDeactivate) { ((Component)this).gameObject.SetActive(false); } else { Object.Destroy((Object)((Component)this).gameObject); } break; } } } } public class CFX_AutoRotate : MonoBehaviour { public Vector3 rotation; public Space space; private void Update() { //IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.Rotate(rotation * Time.deltaTime, space); } public CFX_AutoRotate() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) space = (Space)1; } } [RequireComponent(typeof(ParticleSystem))] public class CFX_ElectricityBall : MonoBehaviour { public bool OnlyDeactivate; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("CheckIfAlive"); } private IEnumerator CheckIfAlive() { ParticleSystem ps = ((Component)this).GetComponent<ParticleSystem>(); while ((Object)ps != (Object)null) { yield return (object)new WaitForSeconds(0.5f); if (!ps.IsAlive(true)) { if (OnlyDeactivate) { ((Component)this).gameObject.SetActive(false); } else { Object.Destroy((Object)((Component)this).gameObject); } break; } } } } [RequireComponent(typeof(Light))] public class CFX_LightFlicker : MonoBehaviour { public bool loop; public float smoothFactor = 1f; public float addIntensity = 1f; private float minIntensity; private float maxIntensity; private float baseIntensity; private void Awake() { baseIntensity = ((Component)this).GetComponent<Light>().intensity; } private void OnEnable() { minIntensity = baseIntensity; maxIntensity = minIntensity + addIntensity; } private void Update() { ((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(minIntensity, maxIntensity, Mathf.PerlinNoise(Time.time * smoothFactor, 0f)); } } [RequireComponent(typeof(Light))] public class CFX_LightIntensityFade : MonoBehaviour { public float duration = 1f; public float delay; public float finalIntensity; private float baseIntensity; public bool autodestruct; private float p_lifetime; private float p_delay; private void Start() { baseIntensity = ((Component)this).GetComponent<Light>().intensity; } private void OnEnable() { p_lifetime = 0f; p_delay = delay; if (delay > 0f) { ((Behaviour)((Component)this).GetComponent<Light>()).enabled = false; } } private void Update() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown if (p_delay > 0f) { p_delay -= Time.deltaTime; if (p_delay <= 0f) { ((Behaviour)((Component)this).GetComponent<Light>()).enabled = true; } } else if (p_lifetime / duration < 1f) { ((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration); p_lifetime += Time.deltaTime; } else if (autodestruct) { Object.Destroy((Object)((Component)this).gameObject); } } } public class ShaderReplacerNew : MonoBehaviour { [Tooltip("Use this Field For Normal Renderers")] [SerializeField] internal Renderer[] _renderers; [SerializeField] internal ShaderType _shaderType = ShaderType.Creature; [SerializeField] internal bool DebugOutput; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (IsHeadlessMode() || _renderers.Length == 0 || !((Component)this).gameObject.activeInHierarchy) { return; } Renderer[] renderers = _renderers; foreach (Renderer val in renderers) { if ((Object)val == (Object)null) { continue; } Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)val2 == (Object)null) { ((Component)val).gameObject.SetActive(false); } else { val2.shader = Shader.Find(ReturnEnumString(_shaderType)); } } } } internal string ReturnEnumString(ShaderType shaderchoice) { string result = ""; switch (shaderchoice) { case ShaderType.Alpha: result = "Custom/AlphaParticle"; break; case ShaderType.Blob: result = "Custom/Blob"; break; case ShaderType.Bonemass: result = "Custom/Bonemass"; break; case ShaderType.Clouds: result = "Custom/Clouds"; break; case ShaderType.Creature: result = "Custom/Creature"; break; case ShaderType.Decal: result = "Custom/Decal"; break; case ShaderType.Distortion: result = "Custom/Distortion"; break; case ShaderType.Flow: result = "Custom/Flow"; break; case ShaderType.FlowOpaque: result = "Custom/FlowOpaque"; break; case ShaderType.Grass: result = "Custom/Grass"; break; case ShaderType.GuiScroll: result = "Custom/GuiScroll"; break; case ShaderType.HeightMap: result = "Custom/HeightMap"; break; case ShaderType.Icon: result = "Custom/Icon"; break; case ShaderType.InteriorSide: result = "Custom/InteriorSide"; break; case ShaderType.LitGui: result = "Custom/LitGui"; break; case ShaderType.LitParticles: result = "Lux Lit Particles/ Bumped"; break; case ShaderType.MapShader: result = "Custom/mapshader"; break; case ShaderType.ParticleDetail: result = "Custom/ParticleDecal"; break; case ShaderType.Piece: result = "Custom/Piece"; break; default: throw new ArgumentOutOfRangeException("shaderchoice", shaderchoice, null); case ShaderType.Player: case ShaderType.Rug: case ShaderType.ShadowBlob: case ShaderType.SkyboxProcedural: case ShaderType.SkyObject: case ShaderType.StaticRock: case ShaderType.Tar: case ShaderType.TrilinearMap: case ShaderType.BGBlur: case ShaderType.Water: case ShaderType.WaterBottom: case ShaderType.WaterMask: case ShaderType.Yggdrasil: case ShaderType.YggdrasilRoot: case ShaderType.ToonDeferredShading2017: break; } return result; } public static bool IsHeadlessMode() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 return (int)SystemInfo.graphicsDeviceType == 4; } } [Serializable] internal enum ShaderType { Alpha, Blob, Bonemass, Clouds, Creature, Decal, Distortion, Flow, FlowOpaque, Grass, GuiScroll, HeightMap, Icon, InteriorSide, LitGui, LitParticles, MapShader, ParticleDetail, Piece, Player, Rug, ShadowBlob, SkyboxProcedural, SkyObject, StaticRock, Tar, TrilinearMap, BGBlur, Water, WaterBottom, WaterMask, Yggdrasil, YggdrasilRoot, ToonDeferredShading2017 } namespace CartoonFX { [RequireComponent(typeof(ParticleSystem))] [DisallowMultipleComponent] public class CFXR_Effect : MonoBehaviour { [Serializable] public class CameraShake { public enum ShakeSpace { Screen, World } public static bool editorPreview = true; public bool enabled; [Space] public bool useMainCamera; public List<Camera> cameras; [Space] public float delay; public float duration; public ShakeSpace shakeSpace; public Vector3 shakeStrength; public AnimationCurve shakeCurve; [Space] [Range(0f, 0.1f)] public float shakesDelay; [NonSerialized] public bool isShaking; private Dictionary<Camera, Vector3> camerasPreRenderPosition; private Vector3 shakeVector; private float delaysTimer; private static bool s_CallbackRegistered; private static List<CameraShake> s_CameraShakes = new List<CameraShake>(); private static void OnPreRenderCamera_Static(Camera cam) { int count = s_CameraShakes.Count; for (int i = 0; i < count; i++) { s_CameraShakes[i].onPreRenderCamera(cam); } } private static void OnPostRenderCamera_Static(Camera cam) { for (int num = s_CameraShakes.Count - 1; num >= 0; num--) { s_CameraShakes[num].onPostRenderCamera(cam); } } private static void RegisterStaticCallback(CameraShake cameraShake) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown s_CameraShakes.Add(cameraShake); if (!s_CallbackRegistered) { Camera.onPreRender = (CameraCallback)Delegate.Combine((Delegate)(object)Camera.onPreRender, (Delegate?)new CameraCallback(OnPreRenderCamera_Static)); Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate)(object)Camera.onPostRender, (Delegate?)new CameraCallback(OnPostRenderCamera_Static)); s_CallbackRegistered = true; } } private static void UnregisterStaticCallback(CameraShake cameraShake) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown s_CameraShakes.Remove(cameraShake); if (s_CallbackRegistered && s_CameraShakes.Count == 0) { Camera.onPreRender = (CameraCallback)Delegate.Remove((Delegate)(object)Camera.onPreRender, (Delegate?)new CameraCallback(OnPreRenderCamera_Static)); Camera.onPostRender = (CameraCallback)Delegate.Remove((Delegate)(object)Camera.onPostRender, (Delegate?)new CameraCallback(OnPostRenderCamera_Static)); s_CallbackRegistered = false; } } private void onPreRenderCamera(Camera cam) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!isShaking || !camerasPreRenderPosition.ContainsKey(cam)) { return; } camerasPreRenderPosition[cam] = ((Component)cam).transform.localPosition; if (!(Time.timeScale <= 0f)) { switch (shakeSpace) { case ShakeSpace.Screen: { Transform transform2 = ((Component)cam).transform; transform2.localPosition += ((Component)cam).transform.rotation * shakeVector; break; } case ShakeSpace.World: { Transform transform = ((Component)cam).transform; transform.localPosition += shakeVector; break; } } } } private void onPostRenderCamera(Camera cam) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (camerasPreRenderPosition.ContainsKey(cam)) { ((Component)cam).transform.localPosition = camerasPreRenderPosition[cam]; } } public void fetchCameras() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) foreach (Camera camera in cameras) { if (!((Object)camera == (Object)null)) { camerasPreRenderPosition.Remove(camera); } } cameras.Clear(); if (useMainCamera && (Object)Camera.main != (Object)null) { cameras.Add(Camera.main); } foreach (Camera camera2 in cameras) { if (!((Object)camera2 == (Object)null) && !camerasPreRenderPosition.ContainsKey(camera2)) { camerasPreRenderPosition.Add(camera2, Vector3.zero); } } } public void StartShake() { if (isShaking) { StopShake(); } isShaking = true; RegisterStaticCallback(this); } public void StopShake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) isShaking = false; shakeVector = Vector3.zero; UnregisterStaticCallback(this); } public void animate(float time) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) float num = duration + delay; if (time < num) { if (time < delay) { return; } if (!isShaking) { StartShake(); } float num2 = Mathf.Clamp01(time / num); if (shakesDelay > 0f) { delaysTimer += Time.deltaTime; if (delaysTimer < shakesDelay) { return; } while (delaysTimer >= shakesDelay) { delaysTimer -= shakesDelay; } } Vector3 val = Vector3.Scale(new Vector3(Random.value, Random.value, Random.value), shakeStrength) * (float)((!(Random.value > 0.5f)) ? 1 : (-1)); shakeVector = val * shakeCurve.Evaluate(num2) * 1f; } else if (isShaking) { StopShake(); } } public CameraShake() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) enabled = false; useMainCamera = true; cameras = new List<Camera>(); delay = 0f; duration = 1f; shakeSpace = ShakeSpace.Screen; shakeStrength = new Vector3(0.1f, 0.1f, 0.1f); shakeCurve = AnimationCurve.Linear(0f, 1f, 1f, 0f); shakesDelay = 0f; camerasPreRenderPosition = new Dictionary<Camera, Vector3>(); } } public enum ClearBehavior { None, Disable, Destroy } [Serializable] public class AnimatedLight { public static bool editorPreview = true; public Light light; public bool loop; public bool animateIntensity; public float intensityStart = 8f; public float intensityEnd; public float intensityDuration = 0.5f; public AnimationCurve intensityCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); public bool perlinIntensity; public float perlinIntensitySpeed = 1f; public bool fadeIn; public float fadeInDuration = 0.5f; public bool fadeOut; public float fadeOutDuration = 0.5f; public bool animateRange; public float rangeStart = 8f; public float rangeEnd; public float rangeDuration = 0.5f; public AnimationCurve rangeCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); public bool perlinRange; public float perlinRangeSpeed = 1f; public bool animateColor; public Gradient colorGradient; public float colorDuration = 0.5f; public AnimationCurve colorCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); public bool perlinColor; public float perlinColorSpeed = 1f; public void animate(float time) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) if (!((Object)light != (Object)null)) { return; } if (animateIntensity) { float num = (loop ? Mathf.Clamp01(time % intensityDuration / intensityDuration) : Mathf.Clamp01(time / intensityDuration)); num = (perlinIntensity ? Mathf.PerlinNoise(Time.time * perlinIntensitySpeed, 0f) : intensityCurve.Evaluate(num)); light.intensity = Mathf.LerpUnclamped(intensityEnd, intensityStart, num); if (fadeIn && time < fadeInDuration) { Light obj = light; obj.intensity *= Mathf.Clamp01(time / fadeInDuration); } } if (animateRange) { float num2 = (loop ? Mathf.Clamp01(time % rangeDuration / rangeDuration) : Mathf.Clamp01(time / rangeDuration)); num2 = (perlinRange ? Mathf.PerlinNoise(Time.time * perlinRangeSpeed, 10f) : rangeCurve.Evaluate(num2)); light.range = Mathf.LerpUnclamped(rangeEnd, rangeStart, num2); } if (animateColor) { float num3 = (loop ? Mathf.Clamp01(time % colorDuration / colorDuration) : Mathf.Clamp01(time / colorDuration)); num3 = (perlinColor ? Mathf.PerlinNoise(Time.time * perlinColorSpeed, 0f) : colorCurve.Evaluate(num3)); light.color = colorGradient.Evaluate(num3); } } public void animateFadeOut(float time) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (fadeOut && (Object)light != (Object)null) { Light obj = light; obj.intensity *= 1f - Mathf.Clamp01(time / fadeOutDuration); } } public void reset() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)light != (Object)null) { if (animateIntensity) { light.intensity = ((fadeIn || fadeOut) ? 0f : intensityEnd); } if (animateRange) { light.range = rangeEnd; } if (animateColor) { light.color = colorGradient.Evaluate(1f); } } } } private const float GLOBAL_CAMERA_SHAKE_MULTIPLIER = 1f; public static bool GlobalDisableCameraShake; public static bool GlobalDisableLights; [Tooltip("Defines an action to execute when the Particle System has completely finished playing and emitting particles.")] [SerializeField] public ClearBehavior clearBehavior = ClearBehavior.Destroy; [Space] public CameraShake cameraShake; [Space] [SerializeField] public List<AnimatedLight> animatedLights = new List<AnimatedLight>(); [Tooltip("Defines which Particle System to track to trigger light fading out.\nLeave empty if not using fading out.")] [SerializeField] public ParticleSystem fadeOutReference; private float time; private ParticleSystem rootParticleSystem; [NonSerialized] private MaterialPropertyBlock materialPropertyBlock; [NonSerialized] private Renderer particleRenderer; private const int CHECK_EVERY_N_FRAME = 20; private static int GlobalStartFrameOffset; private int startFrameOffset; private bool isFadingOut; private float fadingOutStartTime; public void ResetState() { time = 0f; fadingOutStartTime = 0f; isFadingOut = false; if (animatedLights != null) { foreach (AnimatedLight animatedLight in animatedLights) { animatedLight.reset(); } } if (cameraShake != null && cameraShake.enabled) { cameraShake.StopShake(); } } private void Awake() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (animatedLights == null) { animatedLights = new List<AnimatedLight>(); } if (cameraShake != null && cameraShake.enabled) { cameraShake.fetchCameras(); } startFrameOffset = GlobalStartFrameOffset++; particleRenderer = (Renderer)((Component)this).GetComponent<ParticleSystemRenderer>(); if ((Object)particleRenderer.sharedMaterial != (Object)null && particleRenderer.sharedMaterial.IsKeywordEnabled("_CFXR_LIGHTING_WPOS_OFFSET")) { materialPropertyBlock = new MaterialPropertyBlock(); } } private void OnEnable() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown foreach (AnimatedLight animatedLight in animatedLights) { if ((Object)animatedLight.light != (Object)null) { ((Behaviour)animatedLight.light).enabled = !GlobalDisableLights; } } } private void OnDisable() { ResetState(); } private void Update() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown time += Time.deltaTime; Animate(time); if ((Object)fadeOutReference != (Object)null && !fadeOutReference.isEmitting && (fadeOutReference.isPlaying || isFadingOut)) { FadeOut(time); } if (clearBehavior != ClearBehavior.None) { if ((Object)rootParticleSystem == (Object)null) { rootParticleSystem = ((Component)this).GetComponent<ParticleSystem>(); } if ((Time.renderedFrameCount + startFrameOffset) % 20 == 0 && !rootParticleSystem.IsAlive(true)) { if (clearBehavior == ClearBehavior.Destroy) { Object.Destroy((Object)((Component)this).gameObject); } else { ((Component)this).gameObject.SetActive(false); } } } if (materialPropertyBlock != null) { particleRenderer.GetPropertyBlock(materialPropertyBlock); materialPropertyBlock.SetVector("_GameObjectWorldPosition", Vector4.op_Implicit(((Component)this).transform.position)); particleRenderer.SetPropertyBlock(materialPropertyBlock); } } public void Animate(float time) { if (animatedLights != null && !GlobalDisableLights) { foreach (AnimatedLight animatedLight in animatedLights) { animatedLight.animate(time); } } if (cameraShake != null && cameraShake.enabled && !GlobalDisableCameraShake) { cameraShake.animate(time); } } public void FadeOut(float time) { if (animatedLights == null) { return; } if (!isFadingOut) { isFadingOut = true; fadingOutStartTime = time; } foreach (AnimatedLight animatedLight in animatedLights) { animatedLight.animateFadeOut(time - fadingOutStartTime); } } } [RequireComponent(typeof(ParticleSystem))] public class CFXR_EmissionBySurface : MonoBehaviour { public bool active = true; public float particlesPerUnit = 10f; [Tooltip("This is to avoid slowdowns in the Editor if the value gets too high")] public float maxEmissionRate = 5000f; [HideInInspector] public float density; private bool attachedToEditor; private ParticleSystem ps; } [RequireComponent(typeof(ParticleSystem))] public class CFXR_ParticleText : MonoBehaviour { [Header("Dynamic")] [Tooltip("Allow changing the text at runtime with the 'UpdateText' method. If disabled, this script will be excluded from the build.")] public bool isDynamic; [Header("Text")] [SerializeField] private string text; [SerializeField] private float size; [SerializeField] private float letterSpacing; [Header("Colors")] [SerializeField] private Color backgroundColor; [SerializeField] private Color color1; [SerializeField] private Color color2; [Header("Delay")] [SerializeField] private float delay; [SerializeField] private bool cumulativeDelay; [Range(0f, 2f)] [SerializeField] private float compensateLifetime; [Header("Misc")] [SerializeField] private float lifetimeMultiplier; [Range(-90f, 90f)] [SerializeField] private float rotation; [SerializeField] private float sortingFudgeOffset; [SerializeField] private CFXR_ParticleTextFontAsset font; private float baseLifetime; private float baseScaleX; private float baseScaleY; private float baseScaleZ; private Vector3 basePivot; private void Awake() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (!isDynamic) { Object.Destroy((Object)this); } else { InitializeFirstParticle(); } } private void InitializeFirstParticle() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (isDynamic && ((Component)this).transform.childCount == 0) { throw new Exception("[CFXR_ParticleText] A disabled GameObject with a ParticleSystem component is required as the first child when 'isDyanmic' is enabled, so that its settings can be used as a base for the generated characters."); } ParticleSystem val = (isDynamic ? ((Component)((Component)this).transform.GetChild(0)).GetComponent<ParticleSystem>() : ((Component)this).GetComponent<ParticleSystem>()); MainModule main = val.main; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; baseLifetime = ((MinMaxCurve)(ref startLifetime)).constant; baseScaleX = ((MainModule)(ref main)).startSizeXMultiplier; baseScaleY = ((MainModule)(ref main)).startSizeYMultiplier; baseScaleZ = ((MainModule)(ref main)).startSizeZMultiplier; basePivot = ((Component)val).GetComponent<ParticleSystemRenderer>().pivot; if (isDynamic) { basePivot.x = 0f; ((Component)val).gameObject.SetActive(false); ((Object)((Component)val).gameObject).name = "MODEL"; } } public void UpdateText(string newText = null, float? newSize = null, Color? newColor1 = null, Color? newColor2 = null, Color? newBackgroundColor = null, float? newLifetimeMultiplier = null) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) if (Application.isPlaying && !isDynamic) { throw new Exception("[CFXR_ParticleText] You cannot update the text at runtime if it's not marked as dynamic."); } if (newText != null) { switch (font.letterCase) { case CFXR_ParticleTextFontAsset.LetterCase.Lower: newText = newText.ToLowerInvariant(); break; case CFXR_ParticleTextFontAsset.LetterCase.Upper: newText = newText.ToUpperInvariant(); break; } string text = newText; for (int i = 0; i < text.Length; i++) { char c = text[i]; if (!char.IsWhiteSpace(c) && font.CharSequence.IndexOf(c) < 0) { throw new Exception("[CFXR_ParticleText] Invalid character supplied for the dynamic text: '" + c + "'\nThe allowed characters from the selected font are: " + font.CharSequence); } } this.text = newText; } if (newSize.HasValue) { size = newSize.Value; } if (newColor1.HasValue) { color1 = newColor1.Value; } if (newColor2.HasValue) { color2 = newColor2.Value; } if (newBackgroundColor.HasValue) { backgroundColor = newBackgroundColor.Value; } if (newLifetimeMultiplier.HasValue) { lifetimeMultiplier = newLifetimeMultiplier.Value; } if (this.text == null || (Object)font == (Object)null || !font.IsValid()) { return; } if (((Component)this).transform.childCount == 0) { throw new Exception("[CFXR_ParticleText] A disabled GameObject with a ParticleSystem component is required as the first child when 'isDyanmic' is enabled, so that its settings can be used as a base for the generated characters."); } float num = 0f; int num2 = 0; Rect rect; for (int j = 0; j < this.text.Length; j++) { if (char.IsWhiteSpace(this.text[j])) { if (j > 0) { num += letterSpacing * size; } continue; } num2++; if (j > 0) { int num3 = font.CharSequence.IndexOf(this.text[j]); rect = font.CharSprites[num3].rect; float num4 = ((Rect)(ref rect)).width + font.CharKerningOffsets[num3].post + font.CharKerningOffsets[num3].pre; num += (num4 * 0.01f + letterSpacing) * size; } } if (num2 > 0) { int num5 = ((Component)this).transform.childCount - (isDynamic ? 1 : 0); if (num5 < num2) { GameObject val = (isDynamic ? ((Component)((Component)this).transform.GetChild(0)).gameObject : null); for (int k = num5; k < num2; k++) { GameObject val2 = (GameObject)(isDynamic ? ((object)Object.Instantiate<GameObject>(val, ((Component)this).transform)) : ((object)new GameObject())); if (!isDynamic) { val2.transform.SetParent(((Component)this).transform); val2.AddComponent<ParticleSystem>(); } val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; } } float num6 = num / 2f; num = 0f; int num7 = ((!isDynamic) ? (-1) : 0); if (!isDynamic) { ((Component)this).GetComponent<ParticleSystem>(); } ((Component)this).GetComponent<ParticleSystemRenderer>(); for (int l = 0; l < this.text.Length; l++) { char c2 = this.text[l]; if (char.IsWhiteSpace(c2)) { num += letterSpacing * size; continue; } num7++; int num8 = font.CharSequence.IndexOf(this.text[l]); Sprite val3 = font.CharSprites[num8]; float num9 = size; rect = val3.rect; float num10 = num9 * ((Rect)(ref rect)).width / 50f; num += font.CharKerningOffsets[num8].pre * 0.01f * size; float num11 = (num - num6) / num10; rect = val3.rect; float num12 = ((Rect)(ref rect)).width + font.CharKerningOffsets[num8].post; num += (num12 * 0.01f + letterSpacing) * size; GameObject gameObject = ((Component)((Component)this).transform.GetChild(num7)).gameObject; ((Object)gameObject).name = c2.ToString(); ParticleSystem component = gameObject.GetComponent<ParticleSystem>(); MainModule main = component.main; ((MainModule)(ref main)).startSizeXMultiplier = baseScaleX * num10; ((MainModule)(ref main)).startSizeYMultiplier = baseScaleY * num10; ((MainModule)(ref main)).startSizeZMultiplier = baseScaleZ * num10; TextureSheetAnimationModule textureSheetAnimation = component.textureSheetAnimation; ((TextureSheetAnimationModule)(ref textureSheetAnimation)).SetSprite(0, val3); ((MainModule)(ref main)).startRotation = MinMaxCurve.op_Implicit((float)Math.PI / 180f * rotation); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(backgroundColor); CustomDataModule customData = component.customData; ((CustomDataModule)(ref customData)).enabled = true; ((CustomDataModule)(ref customData)).SetColor((ParticleSystemCustomData)0, MinMaxGradient.op_Implicit(color1)); ((CustomDataModule)(ref customData)).SetColor((ParticleSystemCustomData)1, MinMaxGradient.op_Implicit(color2)); if (cumulativeDelay) { ((MainModule)(ref main)).startDelay = MinMaxCurve.op_Implicit(delay * (float)l); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(Mathf.LerpUnclamped(baseLifetime, baseLifetime + delay * (float)(this.text.Length - l), compensateLifetime / lifetimeMultiplier)); } else { ((MainModule)(ref main)).startDelay = MinMaxCurve.op_Implicit(delay); } MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(((MinMaxCurve)(ref startLifetime)).constant * lifetimeMultiplier); ParticleSystemRenderer component2 = ((Component)component).GetComponent<ParticleSystemRenderer>(); ((Renderer)component2).enabled = true; component2.pivot = new Vector3(basePivot.x + num11, basePivot.y, basePivot.z); component2.sortingFudge += (float)l * sortingFudgeOffset; } } int m = 1; for (int childCount = ((Component)this).transform.childCount; m < childCount; m++) { ((Component)((Component)this).transform.GetChild(m)).gameObject.SetActive(m <= num2); } } public CFXR_ParticleText() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) size = 1f; letterSpacing = 0.44f; backgroundColor = new Color(0f, 0f, 0f, 1f); color1 = new Color(1f, 1f, 1f, 1f); color2 = new Color(0f, 0f, 1f, 1f); delay = 0.05f; cumulativeDelay = false; compensateLifetime = 0f; lifetimeMultiplier = 1f; rotation = -5f; sortingFudgeOffset = 0.1f; } } public class CFXR_ParticleTextFontAsset : ScriptableObject { public enum LetterCase { Both, Upper, Lower } [Serializable] public class Kerning { public string name = "A"; public float pre; public float post; } public string CharSequence = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?-.#@$ "; public LetterCase letterCase = LetterCase.Upper; public Sprite[] CharSprites; public Kerning[] CharKerningOffsets; private void OnValidate() { ((Object)this).hideFlags = (HideFlags)0; if (CharKerningOffsets == null || CharKerningOffsets.Length != CharSequence.Length) { CharKerningOffsets = new Kerning[CharSequence.Length]; for (int i = 0; i < CharKerningOffsets.Length; i++) { CharKerningOffsets[i] = new Kerning { name = CharSequence[i].ToString() }; } } } public bool IsValid() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown int num; if (!string.IsNullOrEmpty(CharSequence) && CharSprites != null && CharSprites.Length == CharSequence.Length && CharKerningOffsets != null) { num = ((CharKerningOffsets.Length == CharSprites.Length) ? 1 : 0); if (num != 0) { goto IL_006a; } } else { num = 0; } Debug.LogError((object)("Invalid ParticleTextFontAsset: '" + ((Object)this).name + "'\n"), (Object)this); goto IL_006a; IL_006a: return (byte)num != 0; } } } namespace Boneappetit { [BepInPlugin("com.rockerkitten.boneappetit", "BoneAppetit", "3.3.16")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class BoneAppetit : BaseUnityPlugin { public const string PluginGUID = "com.rockerkitten.boneappetit"; public const string PluginName = "BoneAppetit"; public const string PluginVersion = "3.3.16"; private const string BundleResourceName = "BoneAppetit.assets"; private const string LegacyGrillResourceName = "BoneAppetit.grill"; private const string AssetRoot = "assets/boneappetit6000"; private const string HammerPieceTable = "_HammerPieceTable"; private readonly Dictionary<string, CustomItem> _items = new Dictionary<string, CustomItem>(StringComparer.Ordinal); private readonly Dictionary<string, CustomPiece> _pieces = new Dictionary<string, CustomPiece>(StringComparer.Ordinal); private readonly Dictionary<ConeEffect, SE_Stats> _coneEffects = new Dictionary<ConeEffect, SE_Stats>(); private Harmony _harmony; private AssetBundle _assets; private AssetBundle _legacyGrillAssets; private bool _dropsApplied; private bool _addingExtraItem; private bool? _appliedOriginalGrill; public SkillType rkCookingSkill; public static ConfigEntry<int> NexusId; private static readonly Dictionary<string, Shader> ResolvedShaders = new Dictionary<string, Shader>(StringComparer.Ordinal); public static BoneAppetit Instance { get; private set; } public Sprite CookingSprite { get; private set; } public ConfigEntry<bool> ConesEnable { get; private set; } public ConfigEntry<bool> PorkRindEnable { get; private set; } public ConfigEntry<bool> KabobEnable { get; private set; } public ConfigEntry<bool> FriedLoxEnable { get; private set; } public ConfigEntry<bool> GlazedCarrotEnable { get; private set; } public ConfigEntry<bool> BaconEnable { get; private set; } public ConfigEntry<bool> SmokedFishEnable { get; private set; } public ConfigEntry<bool> PancakesEnable { get; private set; } public ConfigEntry<bool> PizzaEnable { get; private set; } public ConfigEntry<bool> CoffeeEnable { get; private set; } public ConfigEntry<bool> LatteEnable { get; private set; } public ConfigEntry<bool> SmokelessEnable { get; private set; } public ConfigEntry<bool> HaggisEnable { get; private set; } public ConfigEntry<bool> CandiedTurnipEnable { get; private set; } public ConfigEntry<bool> MoochiEnable { get; private set; } public ConfigEntry<bool> Nut_EllaEnable { get; private set; } public ConfigEntry<bool> BrothEnable { get; private set; } public ConfigEntry<bool> FishStewEnable { get; private set; } public ConfigEntry<bool> ButterEnable { get; private set; } public ConfigEntry<bool> BloodSausageEnable { get; private set; } public ConfigEntry<bool> OmletteEnable { get; private set; } public ConfigEntry<bool> BurgerEnable { get; private set; } public ConfigEntry<bool> PorridgeEnable { get; private set; } public ConfigEntry<bool> PBJEnable { get; private set; } public ConfigEntry<bool> BoiledEggEnable { get; private set; } public ConfigEntry<bool> CakeEnable { get; private set; } public ConfigEntry<bool> GrillOriginal { get; private set; } public ConfigEntry<bool> CarrotSticksEnable { get; private set; } public ConfigEntry<bool> CheffHatEnable { get; private set; } public ConfigEntry<bool> MeadEnable { get; private set; } public ConfigEntry<bool> CookingSkillEnable { get; private set; } public ConfigEntry<bool> BonusWhenCookingEnabled { get; private set; } public ConfigEntry<bool> HatSEMessage { get; private set; } public ConfigEntry<float> HatXpGain { get; private set; } private void Awake() { Instance = this; RegisterBuiltInEnglishTranslations(); LoadTranslations(); CreateConfigValues(); _assets = LoadEmbeddedAssetBundle("BoneAppetit.assets"); _legacyGrillAssets = LoadEmbeddedAssetBundle("BoneAppetit.grill"); if ((Object)(object)_assets == (Object)null || (Object)(object)_legacyGrillAssets == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"BoneAppetit could not load its Unity 6000 asset bundle."); return; } CookingSprite = LoadSprite("icon_rk_chef"); AddCookingSkill(); PrefabManager.OnVanillaPrefabsAvailable += RegisterRuntimeContent; ItemManager.OnItemsRegistered += AddDrops; SynchronizationManager.OnConfigurationSynchronized += OnConfigurationSynchronized; PieceManager.OnPiecesRegistered += EnsureCookingStationsRegistered; _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.rockerkitten.boneappetit"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"BoneAppetit modern runtime initialized."); } private static string TokenKey(string prefab, string field) { return "boneappetit_" + prefab + "_" + field; } private static string Token(string prefab, string field) { return "$" + TokenKey(prefab, field); } private void RegisterBuiltInEnglishTranslations() { ItemDefinition[] items = BoneAppetitData.Items; foreach (ItemDefinition itemDefinition in items) { LocalizationManager.Instance.AddToken(TokenKey(itemDefinition.Prefab, "name"), itemDefinition.Name, true); LocalizationManager.Instance.AddToken(TokenKey(itemDefinition.Prefab, "description"), itemDefinition.Description ?? string.Empty, true); } RegisterPieceEnglish("rk_grill", "Grill"); RegisterPieceEnglish("rk_griddle", "Stone Griddle"); RegisterPieceEnglish("rk_prep", "Prep Table"); RegisterPieceEnglish("rk_oven", "Oven"); RegisterPieceEnglish("rk_campfire", "Smokeless Firepit"); RegisterPieceEnglish("rk_hearth", "Smokeless Hearth"); RegisterPieceEnglish("rk_brazier", "Smokeless Brazier"); } private static void RegisterPieceEnglish(string prefab, string name) { LocalizationManager.Instance.AddToken(TokenKey(prefab, "name"), name, true); LocalizationManager.Instance.AddToken(TokenKey(prefab, "description"), string.Empty, true); } private void LoadTranslations() { string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; string text2 = Path.Combine(text, "Translations"); List<string> list = new List<string>(); if (Directory.Exists(text2)) { list.AddRange(Directory.GetFiles(text2, "*.json", SearchOption.AllDirectories)); } list.AddRange(from file in Directory.GetFiles(text, "*.json", SearchOption.TopDirectoryOnly) where !string.Equals(Path.GetFileName(file), "manifest.json", StringComparison.OrdinalIgnoreCase) select file); foreach (string item in list.Distinct<string>(StringComparer.OrdinalIgnoreCase)) { try { string text3 = ResolveTranslationLanguage(item, text2); LocalizationManager.Instance.AddJson(text3, File.ReadAllText(item)); ((BaseUnityPlugin)this).Logger.LogInfo((object)("BoneAppetit loaded " + text3 + " translations from " + Path.GetFileName(item) + ".")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("BoneAppetit could not load translation file " + Path.GetFileName(item) + ": " + ex.Message)); } } } private static string ResolveTranslationLanguage(string file, string translationsDirectory) { string text = Path.GetDirectoryName(file) ?? string.Empty; if (Directory.Exists(translationsDirectory) && text.StartsWith(translationsDirectory, StringComparison.OrdinalIgnoreCase) && !string.Equals(text, translationsDirectory, StringComparison.OrdinalIgnoreCase)) { return new DirectoryInfo(text).Name; } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); if (!fileNameWithoutExtension.StartsWith("BoneAppetit.", StringComparison.OrdinalIgnoreCase)) { return fileNameWithoutExtension; } return fileNameWithoutExtension.Substring("BoneAppetit.".Length); } private void OnDestroy() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterRuntimeContent; ItemManager.OnItemsRegistered -= AddDrops; SynchronizationManager.OnConfigurationSynchronized -= OnConfigurationSynchronized; PieceManager.OnPiecesRegistered -= EnsureCookingStationsRegistered; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } if (Object.op_Implicit((Object)(object)_assets)) { _assets.Unload(false); } if (Object.op_Implicit((Object)(object)_legacyGrillAssets)) { _legacyGrillAssets.Unload(false); } _assets = null; _legacyGrillAssets = null; if (Instance == this) { Instance = null; } } private void CreateConfigValues() { //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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Expected O, but got Unknown //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Expected O, but got Unknown ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; NexusId = ((BaseUnityPlugin)this).Config.Bind<int>("Hidden", "NexusId", 1250, new ConfigDescription("NexusId", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = false, Browsable = false, ReadOnly = true } })); ConesEnable = BindToggle("Cones", "All Cones Enable"); PorkRindEnable = BindToggle("Pork Rind", "Pork Rind Enable"); KabobEnable = BindToggle("Kabob", "Kabob Enable"); FriedLoxEnable = BindToggle("Fried Lox", "Fried Lox Enable"); GlazedCarrotEnable = BindToggle("Glazed Carrots", "Glazed Carrots Enable"); BaconEnable = BindToggle("Bacon", "Bacon Enable"); SmokedFishEnable = BindToggle("Smoked Fish", "Smoked Fish Enable"); PancakesEnable = BindToggle("Pancakes", "Pancakes Enable"); PizzaEnable = BindToggle("Pizza", "Pizza Enable"); CoffeeEnable = BindToggle("Coffee", "Coffee Enable"); LatteEnable = BindToggle("Latte", "Latte Enable"); PorridgeEnable = BindToggle("Porridge", "Porridge Enable"); PBJEnable = BindToggle("PBJ", "PBJ Enable"); CakeEnable = BindToggle("Cake", "Birthday Cake Enable"); HaggisEnable = BindToggle("Haggis", "Haggis Enable"); CandiedTurnipEnable = BindToggle("Candied Turnip", "Candied Turnip Enable"); MoochiEnable = BindToggle("Moochi", "Moochi Enable"); Nut_EllaEnable = BindToggle("Nut_Ella", "Nut_Ella Enable"); BurgerEnable = BindToggle("Burger", "Burger Enable"); OmletteEnable = BindToggle("Omlette", "Omlette Enable"); BrothEnable = BindToggle("Broth", "Broth Enable"); FishStewEnable = BindToggle("Fish Stew", "Fish Stew Enable"); ButterEnable = BindToggle("Butter", "Butter Enable"); BloodSausageEnable = BindToggle("Blood Sausage", "Blood Sausage Enable"); BoiledEggEnable = BindToggle("Boiled Egg", "Boiled Egg Enable"); CarrotSticksEnable = BindToggle("Carrot Sticks", "Carrot Sticks Enable"); CheffHatEnable = BindToggle("Chef Hat", "Chef Hat Enable"); MeadEnable = BindToggle("Mead", "Mead Enable"); GrillOriginal = BindToggle("Original", "Use original grill"); SmokelessEnable = BindToggle("Smokeless", "Enable to allow building of smokeless fires"); CookingSkillEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Cooking Skill", "Enable Cooking Skill", true, AdminDescription("Enable Cooking Skill", 1)); BonusWhenCookingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Cooking Skill", "Enable Cooking Bonus", true, AdminDescription("Enable Cooking Bonus", 2)); HatXpGain = ((BaseUnityPlugin)this).Config.Bind<float>("Cooking Skill", "Chef Hat XP Gain", 5f, AdminDescription("XP Gain multiplier when cooking while wearing the Chef Hat", 3)); HatSEMessage = ((BaseUnityPlugin)this).Config.Bind<bool>("Cooking Skill", "Enable Chef Hat Message", true, new ConfigDescription("Enable Message when equipping the Chef Hat", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = false, Order = 4 } })); } private ConfigEntry<bool> BindToggle(string section, string description) { //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_0024: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown return ((BaseUnityPlugin)this).Config.Bind<bool>(section, "Enable", true, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } private static ConfigDescription AdminDescription(string text, int order) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown return new ConfigDescription(text, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true, Order = order } }); } private void AddCookingSkill() { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0056: Expected O, but got Unknown //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) if (CookingSkillEnable.Value) { rkCookingSkill = SkillManager.Instance.AddSkill(new SkillConfig { Identifier = "com.rockerkitten.boneappetit", Name = "Gore-mand", Description = "Learn to cook and eat like a Viking!", Icon = CookingSprite, IncreaseStep = 1f }); } } private void RegisterRuntimeContent() { try { RegisterPieces(); RegisterItems(); ApplyConfiguration(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"BoneAppetit registered {_items.Count} items and {_pieces.Count} pieces against current Valheim prefabs."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"BoneAppetit runtime registration failed: {arg}"); } finally { PrefabManager.OnVanillaPrefabsAvailable -= RegisterRuntimeContent; } } private void RegisterItems() { //IL_001e: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0111: Expected O, but got Unknown ItemDefinition[] items = BoneAppetitData.Items; foreach (ItemDefinition itemDefinition in items) { ItemConfig val = null; if (itemDefinition.Recipe != null) { val = new ItemConfig { Name = Token(itemDefinition.Prefab, "name"), Description = Token(itemDefinition.Prefab, "description"), Enabled = itemDefinition.Enabled(this), Amount = itemDefinition.Recipe.Amount, CraftingStation = itemDefinition.Recipe.Station, MinStationLevel = itemDefinition.Recipe.StationLevel, Icon = LoadSprite("icon_" + itemDefinition.Prefab), Requirements = itemDefinition.Recipe.Requirements.Select(ToRequirementConfig).ToArray() }; } CustomItem val2 = ((val == null) ? new CustomItem(itemDefinition.Prefab, itemDefinition.BasePrefab) : new CustomItem(itemDefinition.Prefab, itemDefinition.BasePrefab, val)); ApplyItemData(val2, itemDefinition); ReplaceItemVisual(val2.ItemPrefab, itemDefinition.Prefab); if (!ItemManager.Instance.AddItem(val2)) { throw new InvalidOperationException("Failed to register item " + itemDefinition.Prefab); } _items.Add(itemDefinition.Prefab, val2); } } private void ApplyItemData(CustomItem item, ItemDefinition definition) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) SharedData shared = item.ItemDrop.m_itemData.m_shared; Sprite val = LoadSprite("icon_" + definition.Prefab); shared.m_name = Token(definition.Prefab, "name"); shared.m_description = Token(definition.Prefab, "description"); shared.m_itemType = definition.ItemType; shared.m_icons = (Sprite[])(object)new Sprite[1] { val }; shared.m_maxStackSize = definition.StackSize; shared.m_maxQuality = 1; shared.m_weight = definition.Weight; shared.m_value = 0; shared.m_teleportable = true; shared.m_equipDuration = 1f; shared.m_movementModifier = 0f; shared.m_eitrRegenModifier = 0f; shared.m_food = definition.Food; shared.m_foodStamina = definition.Stamina; shared.m_foodEitr = definition.Eitr; shared.m_foodBurnTime = definition.BurnTime; shared.m_foodRegen = definition.Regen; shared.m_armor = definition.Armor; shared.m_armorPerLevel = definition.ArmorPerLevel; shared.m_consumeStatusEffect = null; shared.m_equipStatusEffect = null; shared.m_setName = string.Empty; shared.m_setSize = 0; shared.m_setStatusEffect = null; if (definition.ConeEffect != ConeEffect.None) { shared.m_consumeStatusEffect = (StatusEffect)(object)GetConeEffect(definition.ConeEffect, val); } if (definition.Prefab == "rk_chef") { shared.m_helmetHideHair = (HelmetHairType)0; shared.m_helmetHideBeard = (HelmetHairType)0; shared.m_helmetHairSettings?.Clear(); shared.m_helmetBeardSettings?.Clear(); shared.m_equipStatusEffect = (StatusEffect)(object)ScriptableObject.CreateInstance<SE_CheffHat>(); } } private SE_Stats GetConeEffect(ConeEffect effect, Sprite icon) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) if (_coneEffects.TryGetValue(effect, out var value)) { return value; } SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>(); ((StatusEffect)val).m_icon = icon; ((StatusEffect)val).m_ttl = 300f; ((StatusEffect)val).m_activationAnimation = "gpower"; ((StatusEffect)val).m_startMessageType = (MessageType)1; ((StatusEffect)val).m_stopMessageType = (MessageType)1; ((StatusEffect)val).m_repeatMessageType = (MessageType)1; val.m_healthRegenMultiplier = 1f; val.m_staminaRegenMultiplier = 1f; val.m_eitrRegenMultiplier = 1f; val.m_damageModifier = 1f; val.m_mods = new List<DamageModPair>(); switch (effect) { case ConeEffect.Frost: ((Object)val).name = "frost resist"; ((StatusEffect)val).m_name = "Fire Cone"; ((StatusEffect)val).m_tooltip = "What's that smell? Are you on fire!?!?"; ((StatusEffect)val).m_startMessage = "It burns!"; val.m_mods.Add(new DamageModPair { m_type = (DamageType)64, m_modifier = (DamageModifier)5 }); break; case ConeEffect.Fire: ((Object)val).name = "fire resist"; ((StatusEffect)val).m_name = "Ice Cone"; ((StatusEffect)val).m_tooltip = "You feel you are cold, walking through fire acutaly sound good."; ((StatusEffect)val).m_startMessage = "Your lips have turned blue."; val.m_mods.Add(new DamageModPair { m_type = (DamageType)32, m_modifier = (DamageModifier)5 }); break; case ConeEffect.Lightning: ((Object)val).name = "electric resist"; ((StatusEffect)val).m_name = "Shock Cone"; ((StatusEffect)val).m_tooltip = "You just ate Guck, you don't think much could Shock you now."; ((StatusEffect)val).m_startMessage = "You feel green"; val.m_mods.Add(new DamageModPair { m_type = (DamageType)128, m_modifier = (DamageModifier)5 }); break; default: throw new ArgumentOutOfRangeException("effect", effect, null); } _coneEffects.Add(effect, val); return val; } private void RegisterPieces() { RegisterCraftingStation("rk_grill", "Grill", "forge", true, GrillOriginal.Value ? "rk_grill_original" : "rk_grill_custom", Req("Stone", 10), Req("Iron", 2)); RegisterGriddle(); RegisterCraftingStation("rk_prep", "Prep Table", "forge", false, "rk_prep", Req("Wood", 4), Req("Tin", 5), Req("Stone", 3)); RegisterOven(); RegisterSmokelessFire("rk_campfire", "Smokeless Firepit", "fire_pit", string.Empty, "rk_campfire", Req("Stone", 5), Req("Wood", 2)); RegisterSmokelessFire("rk_hearth", "Smokeless Hearth", "hearth", "piece_stonecutter", "rk_hearth", Req("Stone", 15)); RegisterSmokelessFire("rk_brazier", "Smokeless Brazier", "piece_brazierceiling01", "forge", "rk_brazier", Req("Bronze", 5), Req("Coal", 2), Req("Chain", 1)); } private void RegisterGriddle() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown string name = Token("rk_griddle", "name"); string description = Token("rk_griddle", "description"); PieceConfig val = new PieceConfig(); val.Name = name; val.Description = description; val.CraftingStation = string.Empty; val.AllowedInDungeons = false; val.Enabled = true; val.PieceTable = "_HammerPieceTable"; val.Icon = LoadSprite("piece_icon_rk_griddle"); val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { Req("Stone", 10) }; PieceConfig val2 = val; GameObject obj = _legacyGrillAssets.LoadAsset<GameObject>("rk_griddle"); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Missing original BoneAppetit prefab rk_griddle"); } CustomPiece val3 = new CustomPiece(obj, true, val2); CraftingStation component = obj.GetComponent<CraftingStation>(); ZNetView component2 = obj.GetComponent<ZNetView>(); WearNTear component3 = obj.GetComponent<WearNTear>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || (Object)(object)component3 == (Object)null) { throw new InvalidOperationException("rk_griddle is missing required build or network components."); } component.m_name = name; component.m_icon = val2.Icon; component.m_craftRequireRoof = false; component.m_craftRequireFire = true; val3.Piece.m_name = name; val3.Piece.m_description = description; val3.Piece.m_icon = val2.Icon; val3.Piece.m_craftingStation = null; RestorePieceShaders(obj); ConfigureStationInteraction(obj); AddPiece(val3); } private void EnsureCookingStationsRegistered() { EnsurePieceRegistered("rk_grill", "Stone Grill"); EnsurePieceRegistered("rk_griddle", "Stone Griddle"); EnsurePieceRegistered("rk_prep", "Prep Table"); EnsurePieceRegistered("rk_oven", "Oven"); EnsurePieceRegistered("rk_campfire", "Smokeless Firepit"); EnsurePieceRegistered("rk_hearth", "Smokeless Hearth"); EnsurePieceRegistered("rk_brazier", "Smokeless Brazier"); EnsureBuildStationResolved("rk_grill", "forge", "Stone Grill"); EnsureBuildStationResolved("rk_prep", "forge", "Prep Table"); EnsureBuildStationResolved("rk_hearth", "piece_stonecutter", "Smokeless Hearth"); EnsureBuildStationResolved("rk_brazier", "forge", "Smokeless Brazier"); } private void EnsureBuildStationResolved(string prefabName, string stationPrefabName, string displayName) { if (!_pieces.TryGetValue(prefabName, out var value) || (Object)(object)((value != null) ? value.PiecePrefab : null) == (Object)null) { return; } Piece piece = value.Piece; GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(stationPrefabName) : null); if ((Object)(object)val == (Object)null) { val = PrefabManager.Instance.GetPrefab(stationPrefabName); } CraftingStation val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<CraftingStation>() : null); if ((Object)(object)piece == (Object)null || (Object)(object)val2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)(displayName + " could not resolve build station " + stationPrefabName + " during late registration.")); return; } bool flag = (Object)(object)piece.m_craftingStation != (Object)(object)val2; piece.m_craftingStation = val2; if (flag) { ((BaseUnityPlugin)this).Logger.LogInfo((object)(displayName + " repaired build station reference to " + stationPrefabName + ".")); } } private void EnsurePieceRegistered(string prefabName, string displayName) { if (!_pieces.TryGetValue(prefabName, out var value) || (Object)(object)((value != null) ? value.PiecePrefab : null) == (Object)null) { return; } GameObject piecePrefab = value.PiecePrefab; PieceTable pieceTable = PieceManager.Instance.GetPieceTable("_HammerPieceTable"); if ((Object)(object)pieceTable == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)(displayName + " could not find the Hammer piece table during late registration.")); return; } bool flag = false; bool flag2 = false; if (!pieceTable.m_pieces.Contains(piecePrefab)) { PieceManager.Instance.RegisterPieceInPieceTable(piecePrefab, "_HammerPieceTable", (string)null); flag = true; } if ((Object)(object)ZNetScene.instance != (Object)null && (Object)(object)ZNetScene.instance.GetPrefab(((Object)piecePrefab).name) == (Object)null) { PrefabManager.Instance.RegisterToZNetScene(piecePrefab); flag2 = true; } ((BaseUnityPlugin)this).Logger.LogInfo((object)(displayName + " late registration: hammer=" + pieceTable.m_pieces.Contains(piecePrefab) + ", znet=" + ((Object)(object)ZNetScene.instance != (Object)null && (Object)(object)ZNetScene.instance.GetPrefab(((Object)piecePrefab).name) != (Object)null) + ", repairedHammer=" + flag + ", repairedZNet=" + flag2 + ".")); } private void RegisterCraftingStation(string prefabName, string displayName, string buildStation, bool requiresFire, string visualName, params RequirementConfig[] requirements) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown string name = Token(prefabName, "name"); string description = Token(prefabName, "description"); PieceConfig val = new PieceConfig { Name = name, Description = description, CraftingStation = buildStation, AllowedInDungeons = false, Enabled = true, PieceTable = "_HammerPieceTable", Icon = LoadSprite("piece_icon_" + prefabName), Requirements = requirements }; CustomPiece val2 = new CustomPiece(prefabName, "piece_cauldron", val); GameObject piecePrefab = val2.PiecePrefab; CraftingStation component = piecePrefab.GetComponent<CraftingStation>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException(prefabName + " did not inherit a current CraftingStation."); } component.m_name = name; component.m_icon = val.Icon; component.m_craftRequireRoof = false; component.m_craftRequireFire = requiresFire; val2.Piece.m_name = name; val2.Piece.m_description = description; val2.Piece.m_icon = val.Icon; if (string.IsNullOrEmpty(buildStation)) { val2.Piece.m_craftingStation = null; } ReplacePieceVisual(piecePrefab, visualName); if (prefabName == "rk_grill") { ConfigureStationInteraction(piecePrefab); } AddPiece(val2); } private void RegisterOven() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown string name = Token("rk_oven", "name"); string description = Token("rk_oven", "description"); PieceConfig val = new PieceConfig(); val.Name = name; val.Description = description; val.CraftingStation = string.Empty; val.AllowedInDungeons = false; val.Enabled = true; val.PieceTable = "_HammerPieceTable"; val.ExtendStation = "rk_grill"; val.Icon = LoadSprite("piece_icon_rk_oven"); val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { Req("SurtlingCore", 2), Req("TrophySurtling", 1), Req("Stone", 10) }; PieceConfig val2 = val; GameObject obj = _legacyGrillAssets.LoadAsset<GameObject>("rk_oven"); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Missing original BoneAppetit prefab rk_oven"); } CustomPiece val3 = new CustomPiece(obj, true, val2); val3.Piece.m_name = name; val3.Piece.m_description = description; val3.Piece.m_icon = val2.Icon; val3.Piece.m_craftingStation = null; StationExtension component = obj.GetComponent<StationExtension>(); WearNTear component2 = obj.GetComponent<WearNTear>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("rk_oven is missing its StationExtension."); } if ((Object)(object)component2 == (Object)null) { throw new InvalidOperationException("rk_oven is missing its WearNTear."); } component.m_maxStationDistance = 8f; component2.m_wet = null; ConfigureOvenVisuals(obj); AddPiece(val3); } private static void ConfigureOvenVisuals(GameObject prefab) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "flames" || ((Object)val).name == "FireWarmth" || ((Object)val).name == "Point light" || ((Object)val).name == "steam") { ((Component)val).gameObject.SetActive(true); } } ParticleSystem[] componentsInChildren2 = prefab.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren2) { if (!(((Object)((Component)val2).gameObject).name != "flames") || !(((Object)((Component)val2).gameObject).name != "steam")) { MainModule main = val2.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).playOnAwake = true; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = true; } } } if ((Object)(object)prefab.GetComponent<OvenVisualState>() == (Object)null) { prefab.AddComponent<OvenVisualState>(); } } private void RegisterSmokelessFire(string prefabName, string displayName, string basePrefab, string buildStation, string visualName, params RequirementConfig[] requirements) { //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_003c: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab(basePrefab); Piece val = ((prefab != null) ? prefab.GetComponent<Piece>() : null); string name = Token(prefabName, "name"); string description = Token(prefabName, "description"); PieceConfig val2 = new PieceConfig { Name = name, Description = description, CraftingStation = buildStation, AllowedInDungeons = false, Enabled = SmokelessEnable.Value, PieceTable = "_HammerPieceTable", Icon = (((Object)(object)val != (Object)null) ? val.m_icon : null), Requirements = requirements }; CustomPiece val3 = new CustomPiece(prefabName, basePrefab, val2); val3.Piece.m_name = name; val3.Piece.m_description = description; if ((Object)(object)val2.Icon != (Object)null) { val3.Piece.m_icon = val2.Icon; } Fireplace component = val3.PiecePrefab.GetComponent<Fireplace>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException(prefabName + " did not inherit a current Fireplace."); } ReplacePieceVisual(val3.PiecePrefab, visualName); DisableSmokeEmission(val3.PiecePrefab, component); AddPiece(val3); } private static void DisableSmokeEmission(GameObject prefab, Fireplace fireplace) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) fireplace.m_smokeSpawner = null; SmokeSpawner[] componentsInChildren = prefab.GetComponentsInChildren<SmokeSpawner>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; } ParticleSystem[] componentsInChildren2 = prefab.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren2) { if (((Object)((Component)val).gameObject).name.IndexOf("smoke", StringComparison.OrdinalIgnoreCase) >= 0) { val.Stop(true, (ParticleSystemStopBehavior)0); EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = false; ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } } } } private void AddPiece(CustomPiece piece) { if (!PieceManager.Instance.AddPiece(piece)) { throw new InvalidOperationException("Failed to register piece " + ((Object)piece.PiecePrefab).name); } _pieces.Add(((Object)piece.PiecePrefab).name, piece); } private static void ConfigureStationInteraction(GameObject prefab) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) CraftingStation component = prefab.GetComponent<CraftingStation>(); if (!((Object)(object)component == (Object)null)) { component.m_useDistance = Mathf.Max(component.m_useDistance, 3f); Transform val = prefab.transform.Find("BoneAppetitInteraction"); if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } if (TryGetLocalVisualBounds(prefab, out var bounds)) { GameObject val2 = new GameObject("BoneAppetitInteraction"); val2.transform.SetParent(prefab.transform, false); int num = LayerMask.NameToLayer("piece_nonsolid"); val2.layer = ((num >= 0) ? num : prefab.layer); BoxCollider obj = val2.AddComponent<BoxCollider>(); ((Collider)obj).isTrigger = false; obj.center = ((Bounds)(ref bounds)).center; obj.size = new Vector3(Mathf.Max(((Bounds)(ref bounds)).size.x + 0.3f, 1.2f), Mathf.Max(((Bounds)(ref bounds)).size.y + 0.4f, 1.4f), Mathf.Max(((Bounds)(ref bounds)).size.z + 0.3f, 1.2f)); } } } private static bool TryGetLocalVisualBounds(GameObject root, out Bounds bounds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); bool found = false; MeshFilter[] componentsInChildren = root.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val in componentsInChildren) { MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>(); Mesh sharedMesh = val.sharedMesh; if (!((Object)(object)component == (Object)null) && ((Renderer)component).enabled && !((Object)(object)sharedMesh == (Object)null)) { EncapsulateLocalBounds(root.transform, ((Component)val).transform, sharedMesh.bounds, ref bounds, ref found); } } SkinnedMeshRenderer[] componentsInChildren2 = root.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (((Renderer)val2).enabled) { EncapsulateLocalBounds(root.transform, ((Component)val2).transform, ((Renderer)val2).localBounds, ref bounds, ref found); } } return found; } private static void EncapsulateLocalBounds(Transform root, Transform source, Bounds sourceBounds, ref Bounds result, ref bool found) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Vector3 min = ((Bounds)(ref sourceBounds)).min; Vector3 max = ((Bounds)(ref sourceBounds)).max; Vector3 val = default(Vector3); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { ((Vector3)(ref val))..ctor((i == 0) ? min.x : max.x, (j == 0) ? min.y : max.y, (k == 0) ? min.z : max.z); Vector3 val2 = root.InverseTransformPoint(source.TransformPoint(val)); if (!found) { result = new Bounds(val2, Vector3.zero); found = true; } else { ((Bounds)(ref result)).Encapsulate(val2); } } } } } private void ReplaceItemVisual(GameObject target, string visualName) { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) DisableRenderersAndEffects(target); GameObject val = LoadVisual(visualName); if (visualName == "rk_chef") { Transform val2 = val.transform.Find("attach"); Transform val3 = target.transform.Find("attach"); if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { throw new InvalidOperationException("Chef Hat attach hierarchy is missing."); } val3.localPosition = val2.localPosition; val3.localRotation = val2.localRotation; val3.localScale = val2.localScale; for (int i = 0; i < val2.childCount; i++) { Object.Instantiate<GameObject>(((Component)val2.GetChild(i)).gameObject, val3, false); } for (int j = 0; j < val.transform.childCount; j++) { Transform child = val.transform.GetChild(j); if ((Object)(object)child != (Object)(object)val2) { Object.Instantiate<GameObject>(((Component)child).gameObject, target.transform, false); } } ApplyVisualShader(((Component)val3).gameObject, "Custom/Creature"); } else { GameObject obj = Object.Instantiate<GameObject>(val, target.transform, false); ((Object)obj).name = "BoneAppetitVisual"; obj.transform.localPosition = val.transform.localPosition; obj.transform.localRotation = val.transform.localRotation; obj.transform.localScale = val.transform.localScale; ApplyVisualShader(obj, "Custom/Creature"); } } private void ReplacePieceVisual(GameObject target, string visualName) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) Transform val = target.transform.Find("BoneAppetitVisual"); if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } MeshRenderer[] componentsInChildren = target.GetComponentsInChildren<MeshRenderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).enabled = false; } SkinnedMeshRenderer[] componentsInChildren2 = target.GetComponentsInChildren<SkinnedMeshRenderer>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { ((Renderer)componentsInChildren2[i]).enabled = false; } GameObject val2 = LoadVisual(visualName); GameObject val3 = Object.Instantiate<GameObject>(val2, target.transform, false); ((Object)val3).name = "BoneAppetitVisual"; val3.transform.localPosition = val2.transform.localPosition; val3.transform.localRotation = val2.transform.localRotation; val3.transform.localScale = val2.transform.localScale * ((visualName == "rk_oven" || visualName == "rk_griddle") ? 0.6f : 1f); RestorePieceShaders(val3); val3.AddComponent<PieceVisualShaderState>(); ParticleSystem[] componentsInChildren3 = val3.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren3) { obj.Stop(true, (ParticleSystemStopBehavior)0); ParticleSystemRenderer component = ((Component)obj).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } } Light[] componentsInChildren4 = val3.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { ((Behaviour)componentsInChildren4[i]).enabled = false; } } private static Shader ResolveLoadedShader(string shaderName) { if (ResolvedShaders.TryGetValue(shaderName, out var value) && (Object)(object)value != (Object)null) { return value; } Shader val = Shader.Find(shaderName); if ((Object)(object)val == (Object)null) { Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val2 in array) { if ((Object)(object)val2 != (Object)null && string.Equals(((Object)val2).name, shaderName, StringComparison.Ordinal)) { val = val2; break; } } } if ((Object)(object)val == (Object)null) { Material[] array2 = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val3 in array2) { if ((Object)(object)val3 != (Object)null && (Object)(object)val3.shader != (Object)null && string.Equals(((Object)val3.shader).name, shaderName, StringComparison.Ordinal)) { val = val3.shader; break; } } } if ((Object)(object)val != (Object)null) { ResolvedShaders[shaderName] = val; } return val; } internal static void RestorePieceShaders(GameObject root) { Shader val = ResolveLoadedShader("Custom/Piece"); Shader val2 = ResolveLoadedShader("Custom/StaticRock"); Shader val3 = ResolveLoadedShader("Standard TwoSided"); Shader val4 = ResolveLoadedShader("Standard (Specular setup)"); Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] sharedMaterials = componentsInChildren[i].sharedMaterials; foreach (Material val5 in sharedMaterials) { if (!((Object)(object)val5 == (Object)null)) { string name = ((Object)val5).name; if ((name.StartsWith("HearthNew_mat", StringComparison.Ordinal) || name.StartsWith("HearthBroken_mat", StringComparison.Ordinal)) && (Object)(object)val != (Object)null) { val5.shader = val; } else if ((name.StartsWith("stone_", StringComparison.Ordinal) || name.StartsWith("stones_", StringComparison.Ordinal) || name.StartsWith("GriddleRock", StringComparison.Ordinal)) && (Object)(object)val2 != (Object)null) { val5.shader = val2; } else if (name.StartsWith("fireplace_ash_glowing_", StringComparison.Ordinal) && (Object)(object)val4 != (Object)null) { val5.shader = val4; } else if (name.StartsWith("fireplace_ash_", StringComparison.Ordinal) && (Object)(object)val3 != (Object)null) { val5.shader = val3; } } } } } private static void ApplyVisualShader(GameObject root, string shaderName) { Shader val = Shader.Find(shaderName); if ((Object)(object)val == (Object)null) { return; } Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] sharedMaterials = componentsInChildren[i].sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null) { val2.shader = val; } } } } private static void DisableRenderersAndEffects(GameObject target) { Renderer[] componentsInChildren = target.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } ParticleSystem[] componentsInChildren2 = target.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].Stop(true, (ParticleSystemStopBehavior)0); } Light[] componentsInChildren3 = target.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { ((Behaviour)componentsInChildren3[i]).enabled = false; } } private static AssetBundle LoadEmbeddedAssetBundle(string resourceName) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { throw new InvalidOperationException("Embedded BoneAppetit asset bundle was not found: " + resourceName); } byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { throw new EndOfStreamException("Embedded BoneAppetit asset bundle ended unexpectedly."); } } return AssetBundle.LoadFromMemory(array); } private GameObject LoadVisual(string name) { string text = "assets/boneappetit6000/prefabs/" + name + ".prefab"; GameObject obj = _assets.LoadAsset<GameObject>(text); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Missing BoneAppetit visual asset " + text); } return obj; } private Sprite LoadSprite(string name) { string text = "assets/boneappetit6000/icons/" + name + ".asset"; Sprite obj = _assets.LoadAsset<Sprite>(text); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Missing BoneAppetit icon asset " + text); } return obj; } private void AddDrops() { if (_dropsApplied) { return; } try { AddCharacterDrop("Boar", "rk_pork"); AddCharacterDrop("Hatchling", "rk_dragonegg"); AddBirdDrop("Seagal", "rk_egg"); AddBirdDrop("Crow", "rk_egg"); _dropsApplied = true; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("BoneAppetit drop registration failed: " + ex)); } finally { ItemManager.OnItemsRegistered -= AddDrops; } } private static void AddCharacterDrop(string creatureName, string itemName) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab(creatureName); GameObject prefab2 = PrefabManager.Instance.GetPrefab(itemName); CharacterDrop val = ((prefab != null) ? prefab.GetComponent<CharacterDrop>() : null); if ((Object)(object)val == (Object)null || (Object)(object)prefab2 == (Object)null) { throw new InvalidOperationException("Could not add " + itemName + " to " + creatureName + " drops."); } if (!val.m_drops.Any((Drop drop) => (Object)(object)drop.m_prefab != (Object)null && ((Object)drop.m_prefab).name == itemName)) { val.m_drops.Add(new Drop { m_prefab = prefab2, m_amountMin = 1, m_amountMax = 1, m_chance = 1f, m_levelMultiplier = true, m_onePerPlayer = false }); } } private static void AddBirdDrop(string creatureName, string itemName) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = PrefabManager.Instance.GetPrefab(creatureName); GameObject prefab2 = PrefabManager.Instance.GetPrefab(itemName); DropOnDestroyed val = ((prefab != null) ? prefab.GetComponent<DropOnDestroyed>() : null); if ((Object)(object)val == (Object)null || (Object)(object)prefab2 == (Object)null) { throw new InvalidOperationException("Could not add " + itemName + " to " + creatureName + " drops."); } DropTable dropWhenDestroyed = val.m_dropWhenDestroyed; if (!dropWhenDestroyed.m_drops.Any((DropData drop) => (Object)(object)drop.m_item != (Object)null && ((Object)drop.m_item).name == itemName)) { dropWhenDestroyed.m_drops.Add(new DropData { m_item = prefab2, m_stackMin = 1, m_stackMax = 1, m_weight = 1f }); } dropWhenDestroyed.m_oneOfEach = true; dropWhenDestroyed.m_dropMin = 2; dropWhenDestroyed.m_dropMax = 2; dropWhenDestroyed.m_dropChance = 1f; val.m_spawnYStep = 0.3f; val.m_spawnYOffset = 0.5f; } private void OnConfigurationSynchronized(object sender, ConfigurationSynchronizationEventArgs args) { ApplyConfiguration(); } private void ApplyConfiguration() { ItemDefinition[] items = BoneAppetitData.Items; foreach (ItemDefinition itemDefinition in items) { if (itemDefinition.Recipe != null && _items.TryGetValue(itemDefinition.Prefab, out var value) && value.Recipe != null) { value.Recipe.Recipe.m_enabled = itemDefinition.Enabled(this); } } SetPieceEnabled("rk_campfire", SmokelessEnable.Value); SetPieceEnabled("rk_hearth", SmokelessEnable.Value); SetPieceEnabled("rk_brazier", SmokelessEnable.Value); if (_pieces.TryGetValue("rk_grill", out var value2) && _appliedOriginalGrill != GrillOriginal.Value) { ReplacePieceVisual(value2.PiecePrefab, GrillOriginal.Value ? "rk_grill_original" : "rk_grill_custom"); ConfigureStationInteraction(value2.PiecePrefab); _appliedOriginalGrill = GrillOriginal.Value; } } private void SetPieceEnabled(string name, bool enabled) { if (_pieces.TryGetValue(name, out var value)) { value.Piece.m_enabled = enabled; } } internal void OnCookingStationCookItem(bool result) { if (result && CookingSkillEnable.Value) { RaiseCookingSkill(); } } internal void OnInventoryAddItem(string itemName, long crafterId, string crafterName) { if (_addingExtraItem || !CookingSkillEnable.Value || (Object)(object)Player.m_localPlayer == (Object)null || string.IsNullOrEmpty(crafterName) || crafterId < 1 || !IsConsumable(itemName) || !IsCookingCraftingStation(Player.m_localPlayer.GetCurrentCraftingStation())) { return; } float cookingSkillLevel = GetCookingSkillLevel(); if (BonusWhenCookingEnabled.Value) { if (IsCrafterLucky(cookingSkillLevel)) { AddExtraItem(itemName); } if (cookingSkillLevel > 25f && IsCrafterLucky(cookingSkillLevel / 4f)) { AddExtraItem(itemName); } } RaiseCookingSkill(); } private void RaiseCookingSkill() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (CookingSkillEnable.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && (int)rkCookingSkill != 0) { ((Character)Player.m_localPlayer).RaiseSkill(rkCookingSkill, 1f); } } private float GetCookingSkillLevel() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || (int)rkCookingSkill == 0) { return 0f; } return ((IEnumerable<Skill>)((Character)Player.m_localPlayer).GetSkills().GetSkillList()).FirstOrDefault((Func<Skill, bool>)((Skill entry) => entry.m_info.m_skill == rkCookingSkill))?.m_level ?? 0f; } private static bool IsCookingCraftingStation(CraftingStation station) { if ((Object)(object)station == (Object)null) { return false; } string text = ((Object)((Component)station).gameObject).name.Replace("(Clone)", string.Empty); switch (text) { default: return text == "piece_cauldron"; case "rk_griddle": case "rk_grill": case "rk_prep": return true; } } private static bool IsConsumable(string prefabName) { //IL_0033: Unknown result type (might be due to invalid IL or missing referen