using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("WeaponReinforcement")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WeaponReinforcement")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3cd12e7c-3247-4e1b-a85c-7bed4c338b17")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace HardheimWeaponReinforcement; [BepInPlugin("h4nz0.hardheimweaponreinforcement", "Hardheim Weapon Reinforcement", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [SynchronizationMode(/*Could not decode attribute arguments.*/)] public class HardheimWeaponReinforcementPlugin : BaseUnityPlugin { public enum BonusStationType { None, Reinforcement, Forge, Blessing } [CompilerGenerated] private sealed class d__161 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private string 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__161(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (_customBlessingClipLoadAttempted) { return false; } _customBlessingClipLoadAttempted = true; if (!RuntimeUseCustomBlessingAudioFile) { return false; } 5__1 = GetCustomBlessingAudioPath(); if (string.IsNullOrEmpty(5__1) || !File.Exists(5__1)) { LogDebug("Custom blessing audio file not found: " + 5__1); return false; } <>2__current = LoadClipCoroutine(5__1, delegate(AudioClip clip) { _customBlessingClip = clip; if ((Object)(object)clip != (Object)null) { ((Object)clip).name = "HardheimWeaponReinforcementBlessingAudio"; } }); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__160 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private string 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__160(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (_customForgeClipLoadAttempted) { return false; } _customForgeClipLoadAttempted = true; if (!RuntimeUseCustomForgeAudioFile) { return false; } 5__1 = GetCustomForgeAudioPath(); if (string.IsNullOrEmpty(5__1) || !File.Exists(5__1)) { LogDebug("Custom forge audio file not found: " + 5__1); return false; } <>2__current = LoadClipCoroutine(5__1, delegate(AudioClip clip) { _customForgeClip = clip; if ((Object)(object)clip != (Object)null) { ((Object)clip).name = "HardheimWeaponReinforcementForgeAudio"; } }); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__159 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private string 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__159(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (_customReinforcementClipLoadAttempted) { return false; } _customReinforcementClipLoadAttempted = true; if (!RuntimeUseCustomReinforcementAudioFile) { return false; } 5__1 = GetCustomReinforcementAudioPath(); if (string.IsNullOrEmpty(5__1) || !File.Exists(5__1)) { LogDebug("Custom reinforcement audio file not found: " + 5__1); return false; } <>2__current = LoadClipCoroutine(5__1, delegate(AudioClip clip) { _customReinforcementClip = clip; if ((Object)(object)clip != (Object)null) { ((Object)clip).name = "HardheimWeaponReinforcementGrindingAudio"; } }); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__162 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string filePath; public Action onLoaded; private string 5__1; private AudioType 5__2; private UnityWebRequest 5__3; private AudioClip 5__4; private Exception 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__162(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__3 = null; 5__4 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; 5__1 = "file://" + filePath.Replace("\\", "/"); 5__2 = DetectAudioTypeFromPath(filePath); 5__3 = UnityWebRequestMultimedia.GetAudioClip(5__1, 5__2); <>1__state = -3; <>2__current = 5__3.SendWebRequest(); <>1__state = 1; result = true; break; case 1: <>1__state = -3; if ((int)5__3.result != 1) { LogDebug("Failed to load audio: " + 5__3.error); result = false; <>m__Finally1(); break; } 5__4 = null; try { 5__4 = DownloadHandlerAudioClip.GetContent(5__3); } catch (Exception ex) { 5__5 = ex; LogDebug("Exception while reading audio: " + 5__5.Message); } onLoaded?.Invoke(5__4); 5__4 = null; <>m__Finally1(); 5__3 = null; result = false; break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__191 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public string tag; public float seconds; private float 5__1; private Animator 5__2; private AnimatorStateInfo 5__3; private AnimatorStateInfo 5__4; private AnimatorClipInfo[] 5__5; private int 5__6; private Exception 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__191(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__5 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = Time.time + seconds; break; case 1: <>1__state = -1; 5__2 = null; break; } if (Time.time < 5__1) { if ((Object)(object)player == (Object)null) { return false; } 5__2 = ((Component)player).GetComponentInChildren(); if ((Object)(object)5__2 != (Object)null) { try { 5__3 = 5__2.GetCurrentAnimatorStateInfo(0); 5__4 = 5__2.GetNextAnimatorStateInfo(0); LogDebug($"[{tag}] current.fullPathHash={((AnimatorStateInfo)(ref 5__3)).fullPathHash} current.shortNameHash={((AnimatorStateInfo)(ref 5__3)).shortNameHash} current.normalizedTime={((AnimatorStateInfo)(ref 5__3)).normalizedTime:0.00}"); LogDebug($"[{tag}] next.fullPathHash={((AnimatorStateInfo)(ref 5__4)).fullPathHash} next.shortNameHash={((AnimatorStateInfo)(ref 5__4)).shortNameHash} next.normalizedTime={((AnimatorStateInfo)(ref 5__4)).normalizedTime:0.00}"); LogDebug(string.Format("[{0}] crafting={1} moving={2} forward_speed={3:0.00} sideway_speed={4:0.00}", tag, 5__2.GetInteger("crafting"), 5__2.GetBool("moving"), 5__2.GetFloat("forward_speed"), 5__2.GetFloat("sideway_speed"))); 5__5 = 5__2.GetCurrentAnimatorClipInfo(0); if (5__5 != null) { 5__6 = 0; while (5__6 < 5__5.Length) { if ((Object)(object)((AnimatorClipInfo)(ref 5__5[5__6])).clip != (Object)null) { LogDebug($"[{tag}] clip={((Object)((AnimatorClipInfo)(ref 5__5[5__6])).clip).name} weight={((AnimatorClipInfo)(ref 5__5[5__6])).weight:0.00}"); } int num = 5__6 + 1; 5__6 = num; } } 5__5 = null; } catch (Exception ex) { 5__7 = ex; LogDebug("[" + tag + "] logger failed: " + 5__7.Message); } } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__185 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public ItemData weapon; public Transform stationTransform; public BonusStationType type; private float 5__1; private float 5__2; private float 5__3; private string 5__4; private bool 5__5; private float 5__6; private float 5__7; private ItemData 5__8; private Vector3 5__9; private string 5__10; private Animator 5__11; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__185(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } 5__4 = null; 5__8 = null; 5__10 = null; 5__11 = null; <>1__state = -2; } private bool MoveNext() { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; 5__1 = RuntimeProcessAnimationSeconds; 5__2 = 0f; 5__3 = 0f; <>1__state = -3; if (CfgShowCenterMessages != null && CfgShowCenterMessages.Value) { ((Character)player).Message((MessageType)2, GetProgressTextForType(type), 0, (Sprite)null); } <>2__current = StartProcessSound(player, stationTransform, type); <>1__state = 1; result = true; goto end_IL_0000; case 1: <>1__state = -3; break; case 2: <>1__state = -3; 5__8 = null; break; } if (5__2 < 5__1) { if ((Object)(object)player == (Object)null || (Object)(object)stationTransform == (Object)null) { result = false; goto IL_046d; } 5__6 = 2.6f; 5__7 = Vector3.Distance(((Component)player).transform.position, stationTransform.position); if (5__7 > 5__6) { if (CfgShowCenterMessages != null && CfgShowCenterMessages.Value) { ((Character)player).Message((MessageType)2, GetInterruptedTextForType(type), 0, (Sprite)null); } result = false; goto IL_046d; } if (!CanProcessCurrentWeapon(player, type, out 5__8)) { if (CfgShowCenterMessages != null && CfgShowCenterMessages.Value) { ((Character)player).Message((MessageType)2, GetInterruptedTextForType(type), 0, (Sprite)null); } result = false; goto IL_046d; } if (5__8 != weapon) { if (CfgShowCenterMessages != null && CfgShowCenterMessages.Value) { ((Character)player).Message((MessageType)2, GetInterruptedTextForType(type), 0, (Sprite)null); } result = false; goto IL_046d; } FaceTarget(player, stationTransform.position); StopPlayerMovement(player); TryPlayStationAnimation(player, type); if (type == BonusStationType.Blessing) { SuppressBlessingCameraShakeFor(0.35f); TryLockBlessingPose(player); } UpdateCustomAudioLoopPosition(GetProcessEffectPosition(player, stationTransform)); if (5__2 >= 5__3 && RuntimeEnableProcessVfx) { 5__9 = GetProcessEffectPosition(player, stationTransform); if (type == BonusStationType.Forge) { SpawnForgeProcessEffects(5__9, stationTransform.rotation); 5__3 += 0.5f; } else if (type == BonusStationType.Blessing) { 5__10 = ResolveBlessingVfxPrefab(); LogDebug("[PROCESS] Spawning BLESSING VFX. Prefab=" + 5__10 + " (visual only)"); TrySpawnEffectVisualOnly(5__10, 5__9, stationTransform.rotation); 5__3 += 0.75f; 5__10 = null; } else { SpawnReinforcementProcessEffects(5__9, stationTransform.rotation); 5__3 += RuntimeReinforcementSparkInterval; } } 5__2 += Time.deltaTime; <>2__current = null; <>1__state = 2; result = true; } else { 5__5 = TryApplyBonusToWeapon(player, weapon, type, out 5__4); if (5__5 && CfgShowCenterMessages != null && CfgShowCenterMessages.Value) { ((Character)player).Message((MessageType)2, 5__4, 0, (Sprite)null); } 5__4 = null; <>m__Finally1(); result = false; } goto end_IL_0000; IL_046d: <>m__Finally1(); end_IL_0000:; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; try { if ((Object)(object)player != (Object)null) { TryStopPlayerEmote(player); 5__11 = ((Component)player).GetComponentInChildren(); if ((Object)(object)5__11 != (Object)null) { if (_blessingAnimatorDisabledThisProcess) { ((Behaviour)5__11).enabled = true; } 5__11.speed = 1f; 5__11.ResetTrigger("interact"); 5__11.ResetTrigger("attack"); 5__11.ResetTrigger("attack_abort"); 5__11.ResetTrigger("swing_hammer"); 5__11.ResetTrigger("emote_wave"); 5__11.ResetTrigger("emote_bow"); 5__11.ResetTrigger("emote_point"); 5__11.ResetTrigger("emote_cheer"); 5__11.ResetTrigger("emote_stop"); 5__11.ResetTrigger("emote_toast"); 5__11.ResetTrigger("emote_relax"); 5__11.ResetTrigger("emote_vibe"); 5__11.SetBool("moving", false); 5__11.SetBool("emote_sit", false); 5__11.SetBool("emote_sitchair", false); 5__11.SetBool("attach_chair", false); 5__11.SetBool("attach_throne", false); 5__11.SetBool("attach_divan", false); 5__11.SetBool("attach_sitship", false); 5__11.SetFloat("forward_speed", 0f); 5__11.SetFloat("sideway_speed", 0f); 5__11.SetInteger("crafting", 0); 5__11.Update(0f); } 5__11 = null; } } catch { } StopCustomAudioLoop(); BroadcastStationProcess(player, stationTransform, type, active: false); _isProcessInProgress = false; _activePlayerId = 0L; _activeRoutine = null; _activeProcessType = BonusStationType.None; _blessingPoseLockedThisProcess = false; _blessingAnimatorDisabledThisProcess = false; } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__207 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public long playerId; public Transform stationTransform; public BonusStationType type; private bool 5__1; private bool 5__2; private float 5__3; private float 5__4; private float 5__5; private Player 5__6; private Vector3 5__7; private string 5__8; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__207(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__6 = null; 5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = false; 5__2 = false; 5__3 = RuntimeProcessAnimationSeconds; 5__4 = 0f; 5__5 = 0f; 5__6 = FindPlayerById(playerId); if ((Object)(object)5__6 == (Object)null) { return false; } if ((Object)(object)Player.m_localPlayer != (Object)null && 5__6 == Player.m_localPlayer) { return false; } <>2__current = StartRemoteProcessSound(playerId, 5__6, stationTransform, type); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } if (5__4 < 5__3) { 5__6 = FindPlayerById(playerId); if (!((Object)(object)5__6 == (Object)null) && !((Object)(object)stationTransform == (Object)null)) { FaceTarget(5__6, stationTransform.position); TryPlayRemoteStationAnimation(5__6, type, ref 5__1, ref 5__2); if (type == BonusStationType.Blessing) { SuppressBlessingCameraShakeFor(0.35f); TryLockBlessingPose(5__6); } UpdateRemoteAudioLoopPosition(playerId, GetProcessEffectPosition(5__6, stationTransform)); if (5__4 >= 5__5 && RuntimeEnableProcessVfx) { 5__7 = GetProcessEffectPosition(5__6, stationTransform); if (type == BonusStationType.Forge) { SpawnForgeProcessEffects(5__7, stationTransform.rotation); 5__5 += 0.5f; } else if (type == BonusStationType.Blessing) { 5__8 = ResolveBlessingVfxPrefab(); LogDebug("[NET PROCESS] Remote BLESSING VFX. Prefab=" + 5__8 + " (stable visual only)"); TrySpawnEffectVisualOnly(5__8, 5__7, stationTransform.rotation); 5__5 += 0.75f; 5__8 = null; } else { SpawnReinforcementProcessEffects(5__7, stationTransform.rotation); 5__5 += RuntimeReinforcementSparkInterval; } } 5__4 += Time.deltaTime; <>2__current = null; <>1__state = 2; return true; } } StopRemoteStationProcess(playerId, resetAnimator: true); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__166 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public Transform stationTransform; public BonusStationType type; private Vector3 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__166(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!RuntimeEnableProcessSfx) { return false; } 5__1 = GetProcessEffectPosition(player, stationTransform); if (type == BonusStationType.Reinforcement) { if (RuntimeUseCustomReinforcementAudioFile) { if (!_customReinforcementClipLoadAttempted) { <>2__current = EnsureCustomReinforcementClipLoaded(); <>1__state = 1; return true; } goto IL_00a3; } goto IL_00d3; } if (type == BonusStationType.Forge) { if (RuntimeUseCustomForgeAudioFile) { if (!_customForgeClipLoadAttempted) { <>2__current = EnsureCustomForgeClipLoaded(); <>1__state = 2; return true; } goto IL_013b; } goto IL_016b; } if (type != BonusStationType.Blessing) { break; } if (RuntimeUseCustomBlessingAudioFile) { if (!_customBlessingClipLoadAttempted) { <>2__current = EnsureCustomBlessingClipLoaded(); <>1__state = 3; return true; } goto IL_01d0; } goto IL_0200; case 1: <>1__state = -1; goto IL_00a3; case 2: <>1__state = -1; goto IL_013b; case 3: { <>1__state = -1; goto IL_01d0; } IL_00d3: TrySpawnEffect(RuntimeReinforcementSfxPrefab, 5__1, stationTransform.rotation); return false; IL_016b: TrySpawnEffect(ResolveForgeSfxPrefab(), 5__1, stationTransform.rotation); return false; IL_0200: LogDebug("[BLESSING] Custom blessing audio missing; fallback SFX skipped to avoid vanilla boom/shake."); break; IL_01d0: if ((Object)(object)_customBlessingClip != (Object)null) { StartCustomAudioLoop(_customBlessingClip, 5__1, RuntimeCustomBlessingAudioVolume, "HardheimWeaponReinforcementBlessingAudio"); return false; } goto IL_0200; IL_013b: if ((Object)(object)_customForgeClip != (Object)null) { StartCustomAudioLoop(_customForgeClip, 5__1, RuntimeCustomForgeAudioVolume, "HardheimWeaponReinforcementForgeAudio"); return false; } goto IL_016b; IL_00a3: if ((Object)(object)_customReinforcementClip != (Object)null) { StartCustomAudioLoop(_customReinforcementClip, 5__1, RuntimeCustomReinforcementAudioVolume, "HardheimWeaponReinforcementGrindingAudio"); return false; } goto IL_00d3; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__211 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public long playerId; public Player player; public Transform stationTransform; public BonusStationType type; private Vector3 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__211(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!RuntimeEnableProcessSfx || (Object)(object)player == (Object)null || (Object)(object)stationTransform == (Object)null) { return false; } 5__1 = GetProcessEffectPosition(player, stationTransform); if (type == BonusStationType.Reinforcement) { if (RuntimeUseCustomReinforcementAudioFile) { if (!_customReinforcementClipLoadAttempted) { <>2__current = EnsureCustomReinforcementClipLoaded(); <>1__state = 1; return true; } goto IL_00c2; } goto IL_00f8; } if (type == BonusStationType.Forge) { if (RuntimeUseCustomForgeAudioFile) { if (!_customForgeClipLoadAttempted) { <>2__current = EnsureCustomForgeClipLoaded(); <>1__state = 2; return true; } goto IL_0160; } goto IL_0196; } if (type == BonusStationType.Blessing) { if (RuntimeUseCustomBlessingAudioFile) { if (!_customBlessingClipLoadAttempted) { <>2__current = EnsureCustomBlessingClipLoaded(); <>1__state = 3; return true; } goto IL_01fb; } goto IL_0231; } return false; case 1: <>1__state = -1; goto IL_00c2; case 2: <>1__state = -1; goto IL_0160; case 3: { <>1__state = -1; goto IL_01fb; } IL_00f8: TrySpawnEffect(RuntimeReinforcementSfxPrefab, 5__1, stationTransform.rotation); return false; IL_0196: TrySpawnEffect(ResolveForgeSfxPrefab(), 5__1, stationTransform.rotation); return false; IL_0231: LogDebug("[NET PROCESS] Remote blessing custom audio missing; fallback SFX skipped to avoid boom/shake."); return false; IL_0160: if ((Object)(object)_customForgeClip != (Object)null) { StartRemoteCustomAudioLoop(playerId, _customForgeClip, 5__1, RuntimeCustomForgeAudioVolume, "HH_WR_RemoteForgeAudio"); return false; } goto IL_0196; IL_01fb: if ((Object)(object)_customBlessingClip != (Object)null) { StartRemoteCustomAudioLoop(playerId, _customBlessingClip, 5__1, RuntimeCustomBlessingAudioVolume, "HH_WR_RemoteBlessingAudio"); return false; } goto IL_0231; IL_00c2: if ((Object)(object)_customReinforcementClip != (Object)null) { StartRemoteCustomAudioLoop(playerId, _customReinforcementClip, 5__1, RuntimeCustomReinforcementAudioVolume, "HH_WR_RemoteGrindingAudio"); return false; } goto IL_00f8; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__193 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player player; public CraftingStation station; private float 5__1; private Animator 5__2; private AnimatorStateInfo 5__3; private AnimatorStateInfo 5__4; private AnimatorClipInfo[] 5__5; private int 5__6; private Exception 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__193(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__5 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = Time.time + 2f; LogDebug("[VANILLA GALDR] ---- state logging started ---- station=" + (((Object)(object)station != (Object)null && (Object)(object)((Component)station).gameObject != (Object)null) ? ((Object)((Component)station).gameObject).name : "null")); break; case 1: <>1__state = -1; 5__2 = null; break; } if (Time.time < 5__1 && !((Object)(object)player == (Object)null)) { 5__2 = ((Component)player).GetComponentInChildren(); if ((Object)(object)5__2 != (Object)null) { try { 5__3 = 5__2.GetCurrentAnimatorStateInfo(0); 5__4 = 5__2.GetNextAnimatorStateInfo(0); LogDebug($"[VANILLA GALDR] current.fullPathHash={((AnimatorStateInfo)(ref 5__3)).fullPathHash} current.shortNameHash={((AnimatorStateInfo)(ref 5__3)).shortNameHash} current.normalizedTime={((AnimatorStateInfo)(ref 5__3)).normalizedTime:0.00}"); LogDebug($"[VANILLA GALDR] next.fullPathHash={((AnimatorStateInfo)(ref 5__4)).fullPathHash} next.shortNameHash={((AnimatorStateInfo)(ref 5__4)).shortNameHash} next.normalizedTime={((AnimatorStateInfo)(ref 5__4)).normalizedTime:0.00}"); LogDebug(string.Format("[VANILLA GALDR] crafting={0} moving={1} forward_speed={2:0.00} sideway_speed={3:0.00}", 5__2.GetInteger("crafting"), 5__2.GetBool("moving"), 5__2.GetFloat("forward_speed"), 5__2.GetFloat("sideway_speed"))); 5__5 = 5__2.GetCurrentAnimatorClipInfo(0); if (5__5 != null) { 5__6 = 0; while (5__6 < 5__5.Length) { if ((Object)(object)((AnimatorClipInfo)(ref 5__5[5__6])).clip != (Object)null) { LogDebug($"[VANILLA GALDR] clip={((Object)((AnimatorClipInfo)(ref 5__5[5__6])).clip).name} weight={((AnimatorClipInfo)(ref 5__5[5__6])).weight:0.00}"); } int num = 5__6 + 1; 5__6 = num; } } 5__5 = null; } catch (Exception ex) { 5__7 = ex; LogDebug("[VANILLA GALDR] logger failed: " + 5__7.Message); } } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } LogDebug("[VANILLA GALDR] ---- state logging finished ----"); _vanillaGaldrStateLoggerRoutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGuid = "h4nz0.hardheimweaponreinforcement"; public const string PluginName = "Hardheim Weapon Reinforcement"; public const string PluginVersion = "1.0.0"; internal const string GrindingWheelPrefabName = "forge_ext3"; internal const string AnvilPrefabName = "forge_ext4"; internal const string RuneTablePrefabName = "piece_magetable_ext"; internal const string GaldrTablePrefabName = "piece_magetable"; internal const string ReinforcementCustomDataKeyUntil = "hh_reinforcement_until_utc"; internal const string ForgeCustomDataKeyUntil = "hh_forge_until_utc"; internal const string BlessingCustomDataKeyUntil = "hh_blessing_until_utc"; internal const string ReinforcementStatusEffectName = "HardheimWeaponReinforcementReinforcedSE"; internal const string ForgeStatusEffectName = "HardheimWeaponReinforcementForgedSE"; internal const string BlessingStatusEffectName = "HardheimWeaponReinforcementBlessedSE"; internal const string StationProcessRpcName = "HH_WR_StationProcess"; internal static HardheimWeaponReinforcementPlugin Instance; internal static Harmony HarmonyInstance; internal static ConfigEntry CfgEnabled; internal static ConfigEntry CfgMaxBonusPercent; internal static ConfigEntry CfgDurationMinutes; internal static ConfigEntry CfgMinDurabilityPercent; internal static ConfigEntry CfgShowCenterMessages; internal static ConfigEntry CfgDebugLogging; internal static ConfigEntry CfgProcessAnimationSeconds; internal static ConfigEntry CfgEnableProcessVfx; internal static ConfigEntry CfgEnableProcessSfx; internal static ConfigEntry CfgReinforcementSparkInterval; internal static ConfigEntry CfgReinforcementVfxPrefab; internal static ConfigEntry CfgForgeVfxPrefab; internal static ConfigEntry CfgBlessingVfxPrefab; internal static ConfigEntry CfgReinforcementSfxPrefab; internal static ConfigEntry CfgForgeSfxPrefab; internal static ConfigEntry CfgBlessingSfxPrefab; internal static ConfigEntry CfgUseCustomReinforcementAudioFile; internal static ConfigEntry CfgCustomReinforcementAudioFolderName; internal static ConfigEntry CfgCustomReinforcementAudioFileName; internal static ConfigEntry CfgCustomReinforcementAudioVolume; internal static ConfigEntry CfgUseCustomForgeAudioFile; internal static ConfigEntry CfgCustomForgeAudioFolderName; internal static ConfigEntry CfgCustomForgeAudioFileName; internal static ConfigEntry CfgCustomForgeAudioVolume; internal static ConfigEntry CfgUseCustomBlessingAudioFile; internal static ConfigEntry CfgCustomBlessingAudioFolderName; internal static ConfigEntry CfgCustomBlessingAudioFileName; internal static ConfigEntry CfgCustomBlessingAudioVolume; internal static float RuntimeMaxBonusPercent; internal static int RuntimeDurationMinutes; internal static float RuntimeMinDurabilityPercent; internal static float RuntimeProcessAnimationSeconds; internal static bool RuntimeEnableProcessVfx; internal static bool RuntimeEnableProcessSfx; internal static float RuntimeReinforcementSparkInterval; internal static string RuntimeReinforcementVfxPrefab; internal static string RuntimeForgeVfxPrefab; internal static string RuntimeBlessingVfxPrefab; internal static string RuntimeReinforcementSfxPrefab; internal static string RuntimeForgeSfxPrefab; internal static string RuntimeBlessingSfxPrefab; internal static bool RuntimeUseCustomReinforcementAudioFile; internal static string RuntimeCustomReinforcementAudioFolderName; internal static string RuntimeCustomReinforcementAudioFileName; internal static float RuntimeCustomReinforcementAudioVolume; internal static bool RuntimeUseCustomForgeAudioFile; internal static string RuntimeCustomForgeAudioFolderName; internal static string RuntimeCustomForgeAudioFileName; internal static float RuntimeCustomForgeAudioVolume; internal static bool RuntimeUseCustomBlessingAudioFile; internal static string RuntimeCustomBlessingAudioFolderName; internal static string RuntimeCustomBlessingAudioFileName; internal static float RuntimeCustomBlessingAudioVolume; private static float _nextStatusRefreshTime; private static SE_HardheimTimedBonus _activeVisibleStatus; private static ItemData _activeVisibleWeapon; private static BonusStationType _activeVisibleStatusType = BonusStationType.None; private static Coroutine _activeRoutine; private static long _activePlayerId; private static bool _isProcessInProgress; private static BonusStationType _activeProcessType = BonusStationType.None; private static AudioClip _customReinforcementClip; private static bool _customReinforcementClipLoadAttempted; private static AudioClip _customForgeClip; private static bool _customForgeClipLoadAttempted; private static AudioClip _customBlessingClip; private static bool _customBlessingClipLoadAttempted; private static GameObject _activeAudioObject; private static AudioSource _activeAudioSource; private static readonly HashSet _registeredStationRpcObjects = new HashSet(); private static readonly Dictionary _remoteProcessRoutines = new Dictionary(); private static readonly Dictionary _remoteAudioObjects = new Dictionary(); private static bool _reinforcementAnimStartedThisProcess; private static bool _blessingAnimStartedThisProcess; private static bool _loggedForgeAnimatorParamsThisProcess; private static bool _loggedBlessingAnimatorParamsThisProcess; private static bool _emoteLoggingEnabled = false; private static string _resolvedForgeSfxPrefab; private static string _resolvedForgeVfxPrefab; private static string _resolvedBlessingSfxPrefab; private static string _resolvedBlessingVfxPrefab; internal static float _suppressBlessingCameraShakeUntil; private static Coroutine _vanillaGaldrStateLoggerRoutine; private static bool _blessingPoseLockedThisProcess; private static float _blessingPoseLockNormalizedTime = 0.35f; private static bool _blessingAnimatorDisabledThisProcess; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown Instance = this; CreateConfigs(); ApplySyncedConfigToRuntime(); EnsureCustomAudioFoldersExist(); HarmonyInstance = new Harmony("h4nz0.hardheimweaponreinforcement"); HarmonyInstance.PatchAll(); SynchronizationManager.OnConfigurationSynchronized += OnConfigurationSynchronized; LogAlways("Hardheim Weapon Reinforcement loaded."); } private void OnDestroy() { SynchronizationManager.OnConfigurationSynchronized -= OnConfigurationSynchronized; StopCustomAudioLoop(); if (HarmonyInstance != null) { HarmonyInstance.UnpatchSelf(); } } private void OnConfigurationSynchronized(object sender, ConfigurationSynchronizationEventArgs args) { ApplySyncedConfigToRuntime(); EnsureCustomAudioFoldersExist(); if (args != null && args.InitialSynchronization) { LogAlways(string.Format("{0}: config sync complete. MaxBonusPercent={1}, DurationMinutes={2}, AnimationSeconds={3}", "Hardheim Weapon Reinforcement", RuntimeMaxBonusPercent.ToString("0.##", CultureInfo.InvariantCulture), RuntimeDurationMinutes, RuntimeProcessAnimationSeconds.ToString("0.##", CultureInfo.InvariantCulture))); } if (IsDebugLoggingEnabled()) { LogDebug($"[CFGSYNC] InitialSynchronization={args != null && args.InitialSynchronization}"); LogDebug($"[CFGSYNC] Enabled={IsModEnabled()}"); LogDebug("[CFGSYNC] MaxBonusPercent=" + RuntimeMaxBonusPercent.ToString("0.##", CultureInfo.InvariantCulture)); LogDebug($"[CFGSYNC] DurationMinutes={RuntimeDurationMinutes}"); LogDebug("[CFGSYNC] MinDurabilityPercent=" + RuntimeMinDurabilityPercent.ToString("0.##", CultureInfo.InvariantCulture)); LogDebug("[CFGSYNC] ProcessAnimationSeconds=" + RuntimeProcessAnimationSeconds.ToString("0.##", CultureInfo.InvariantCulture)); LogDebug($"[CFGSYNC] EnableProcessVfx={RuntimeEnableProcessVfx}"); LogDebug($"[CFGSYNC] EnableProcessSfx={RuntimeEnableProcessSfx}"); LogDebug("[CFGSYNC] ReinforcementSparkInterval=" + RuntimeReinforcementSparkInterval.ToString("0.##", CultureInfo.InvariantCulture)); } } private ConfigEntry BindSyncedConfig(string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues = null) { return ConfigFileExtensions.BindConfig(((BaseUnityPlugin)this).Config, section, key, defaultValue, description, true, (int?)null, acceptableValues, (Action)null, (ConfigurationManagerAttributes)null); } private void CreateConfigs() { CfgEnabled = BindSyncedConfig("General", "Enabled", defaultValue: true, "A mod be- vagy kikapcsolása."); CfgMaxBonusPercent = BindSyncedConfig("Balance", "MaxBonusPercent", 5f, "Maximális sebzésbónusz százalékban teljesen ép fegyvernél.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); CfgDurationMinutes = BindSyncedConfig("Balance", "DurationMinutes", 60, "A folyamat időtartama percben.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 1440)); CfgMinDurabilityPercent = BindSyncedConfig("Balance", "MinDurabilityPercent", 1f, "Ez alatt már nem jár bónusz.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); CfgShowCenterMessages = BindSyncedConfig("UI", "ShowCenterMessages", defaultValue: true, "Mutasson-e középső üzenetet a folyamat elején és végén."); CfgDebugLogging = BindSyncedConfig("Debug", "DebugLogging", defaultValue: false, "Részletes debug logok."); CfgProcessAnimationSeconds = BindSyncedConfig("Animation", "ProcessAnimationSeconds", 10f, "A folyamat hossza másodpercben.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 30f)); CfgEnableProcessVfx = BindSyncedConfig("Animation", "EnableProcessVfx", defaultValue: true, "Jelenjenek-e meg effektek."); CfgEnableProcessSfx = BindSyncedConfig("Animation", "EnableProcessSfx", defaultValue: true, "Szóljon-e hang a folyamat közben."); CfgReinforcementSparkInterval = BindSyncedConfig("Animation", "ReinforcementSparkInterval", 0.45f, "Milyen gyakran jelenjen meg effekt.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 2f)); CfgReinforcementVfxPrefab = BindSyncedConfig("Animation", "ReinforcementVfxPrefab", "vfx_HitSparks", "A köszörűkőnél használandó VFX prefab neve."); CfgForgeVfxPrefab = BindSyncedConfig("Animation", "ForgeVfxPrefab", "vfx_HitSparks", "A kovácsoláskor használandó fő VFX prefab neve."); CfgBlessingVfxPrefab = BindSyncedConfig("Animation", "BlessingVfxPrefab", "fx_DvergerMage_Support_start", "Az áldáskor használandó VFX prefab neve."); CfgReinforcementSfxPrefab = BindSyncedConfig("Animation", "ReinforcementSfxPrefab", "sfx_gui_craftitem", "A köszörűkőnél használandó SFX prefab fallbackként."); CfgForgeSfxPrefab = BindSyncedConfig("Animation", "ForgeSfxPrefab", "sfx_gui_repairitem_forge", "A kovácsoláskor használandó SFX prefab fallbackként."); CfgBlessingSfxPrefab = BindSyncedConfig("Animation", "BlessingSfxPrefab", "sfx_gui_craftitem", "Az áldáskor használandó SFX prefab fallbackként."); CfgUseCustomReinforcementAudioFile = BindSyncedConfig("Animation", "UseCustomReinforcementAudioFile", defaultValue: true, "Egyedi hangfájl használata a WeaponReinforcement mappából a köszörűkőhöz."); CfgCustomReinforcementAudioFolderName = BindSyncedConfig("Animation", "CustomReinforcementAudioFolderName", "WeaponReinforcement", "A plugin melletti mappa neve a köszörűkő hangjához."); CfgCustomReinforcementAudioFileName = BindSyncedConfig("Animation", "CustomReinforcementAudioFileName", "grinding.ogg", "A köszörűkő egyedi hangfájlja."); CfgCustomReinforcementAudioVolume = BindSyncedConfig("Animation", "CustomReinforcementAudioVolume", 0.9f, "A köszörűkő egyedi hang hangereje.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f)); CfgUseCustomForgeAudioFile = BindSyncedConfig("Animation", "UseCustomForgeAudioFile", defaultValue: true, "Egyedi hangfájl használata a WeaponReinforcement mappából az üllőhöz."); CfgCustomForgeAudioFolderName = BindSyncedConfig("Animation", "CustomForgeAudioFolderName", "WeaponReinforcement", "A plugin melletti mappa neve az üllő hangjához."); CfgCustomForgeAudioFileName = BindSyncedConfig("Animation", "CustomForgeAudioFileName", "forge.ogg", "Az üllő egyedi hangfájlja."); CfgCustomForgeAudioVolume = BindSyncedConfig("Animation", "CustomForgeAudioVolume", 0.9f, "Az üllő egyedi hang hangereje.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f)); CfgUseCustomBlessingAudioFile = BindSyncedConfig("Animation", "UseCustomBlessingAudioFile", defaultValue: true, "Egyedi hangfájl használata a WeaponReinforcement mappából az áldáshoz."); CfgCustomBlessingAudioFolderName = BindSyncedConfig("Animation", "CustomBlessingAudioFolderName", "WeaponReinforcement", "A plugin melletti mappa neve az áldás hangjához."); CfgCustomBlessingAudioFileName = BindSyncedConfig("Animation", "CustomBlessingAudioFileName", "wand.ogg", "Az áldás egyedi hangfájlja."); CfgCustomBlessingAudioVolume = BindSyncedConfig("Animation", "CustomBlessingAudioVolume", 0.9f, "Az áldás egyedi hang hangereje.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f)); } internal static void ApplySyncedConfigToRuntime() { _emoteLoggingEnabled = IsDebugLoggingEnabled(); RuntimeMaxBonusPercent = ((CfgMaxBonusPercent != null) ? CfgMaxBonusPercent.Value : 5f); RuntimeDurationMinutes = ((CfgDurationMinutes != null) ? CfgDurationMinutes.Value : 60); RuntimeMinDurabilityPercent = ((CfgMinDurabilityPercent != null) ? CfgMinDurabilityPercent.Value : 1f); RuntimeProcessAnimationSeconds = ((CfgProcessAnimationSeconds != null) ? Mathf.Clamp(CfgProcessAnimationSeconds.Value, 0.5f, 30f) : 10f); RuntimeEnableProcessVfx = CfgEnableProcessVfx != null && CfgEnableProcessVfx.Value; RuntimeEnableProcessSfx = CfgEnableProcessSfx != null && CfgEnableProcessSfx.Value; RuntimeReinforcementSparkInterval = ((CfgReinforcementSparkInterval != null) ? Mathf.Clamp(CfgReinforcementSparkInterval.Value, 0.05f, 2f) : 0.45f); RuntimeReinforcementVfxPrefab = ((CfgReinforcementVfxPrefab != null) ? CfgReinforcementVfxPrefab.Value : "vfx_HitSparks"); RuntimeForgeVfxPrefab = ((CfgForgeVfxPrefab != null) ? CfgForgeVfxPrefab.Value : "vfx_HitSparks"); RuntimeBlessingVfxPrefab = ((CfgBlessingVfxPrefab != null) ? CfgBlessingVfxPrefab.Value : "fx_DvergerMage_Support_start"); RuntimeReinforcementSfxPrefab = ((CfgReinforcementSfxPrefab != null) ? CfgReinforcementSfxPrefab.Value : "sfx_gui_craftitem"); RuntimeForgeSfxPrefab = ((CfgForgeSfxPrefab != null) ? CfgForgeSfxPrefab.Value : "sfx_gui_repairitem_forge"); RuntimeBlessingSfxPrefab = ((CfgBlessingSfxPrefab != null) ? CfgBlessingSfxPrefab.Value : "sfx_gui_craftitem"); RuntimeUseCustomReinforcementAudioFile = CfgUseCustomReinforcementAudioFile != null && CfgUseCustomReinforcementAudioFile.Value; RuntimeCustomReinforcementAudioFolderName = ((CfgCustomReinforcementAudioFolderName != null) ? CfgCustomReinforcementAudioFolderName.Value : "WeaponReinforcement"); RuntimeCustomReinforcementAudioFileName = ((CfgCustomReinforcementAudioFileName != null) ? CfgCustomReinforcementAudioFileName.Value : "grinding.ogg"); RuntimeCustomReinforcementAudioVolume = ((CfgCustomReinforcementAudioVolume != null) ? Mathf.Clamp01(CfgCustomReinforcementAudioVolume.Value) : 0.9f); RuntimeUseCustomForgeAudioFile = CfgUseCustomForgeAudioFile != null && CfgUseCustomForgeAudioFile.Value; RuntimeCustomForgeAudioFolderName = ((CfgCustomForgeAudioFolderName != null) ? CfgCustomForgeAudioFolderName.Value : "WeaponReinforcement"); RuntimeCustomForgeAudioFileName = ((CfgCustomForgeAudioFileName != null) ? CfgCustomForgeAudioFileName.Value : "forge.ogg"); RuntimeCustomForgeAudioVolume = ((CfgCustomForgeAudioVolume != null) ? Mathf.Clamp01(CfgCustomForgeAudioVolume.Value) : 0.9f); RuntimeUseCustomBlessingAudioFile = CfgUseCustomBlessingAudioFile != null && CfgUseCustomBlessingAudioFile.Value; RuntimeCustomBlessingAudioFolderName = ((CfgCustomBlessingAudioFolderName != null) ? CfgCustomBlessingAudioFolderName.Value : "WeaponReinforcement"); RuntimeCustomBlessingAudioFileName = ((CfgCustomBlessingAudioFileName != null) ? CfgCustomBlessingAudioFileName.Value : "wand.ogg"); RuntimeCustomBlessingAudioVolume = ((CfgCustomBlessingAudioVolume != null) ? Mathf.Clamp01(CfgCustomBlessingAudioVolume.Value) : 0.9f); _customReinforcementClip = null; _customReinforcementClipLoadAttempted = false; _customForgeClip = null; _customForgeClipLoadAttempted = false; _customBlessingClip = null; _customBlessingClipLoadAttempted = false; _resolvedForgeSfxPrefab = null; _resolvedForgeVfxPrefab = null; _resolvedBlessingSfxPrefab = null; _resolvedBlessingVfxPrefab = null; _suppressBlessingCameraShakeUntil = 0f; } internal static bool IsModEnabled() { return CfgEnabled != null && CfgEnabled.Value; } internal static void LogAlways(string msg) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg); } } internal static bool IsDebugLoggingEnabled() { return CfgDebugLogging != null && CfgDebugLogging.Value; } internal static void LogDebug(string msg) { if ((Object)(object)Instance != (Object)null && IsDebugLoggingEnabled()) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[DEBUG] " + msg)); } } internal static bool IsUnarmedItem(ItemData item) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 if (item == null || item.m_shared == null) { return true; } try { if ((int)item.m_shared.m_skillType == 11) { return true; } } catch { } string text = string.Empty; try { if ((Object)(object)item.m_dropPrefab != (Object)null) { text = (((Object)item.m_dropPrefab).name ?? string.Empty).ToLowerInvariant(); } } catch { } if (text == "unarmed") { return true; } string a = string.Empty; try { if (!string.IsNullOrEmpty(item.m_shared.m_name)) { a = item.m_shared.m_name.Trim(); } } catch { } return string.Equals(a, "Unarmed", StringComparison.OrdinalIgnoreCase); } internal static bool IsStaffWeapon(ItemData item) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 if (item == null || item.m_shared == null) { return false; } try { SkillType skillType = item.m_shared.m_skillType; if ((int)skillType == 9 || (int)skillType == 10) { return true; } } catch { } string text = string.Empty; try { if ((Object)(object)item.m_dropPrefab != (Object)null) { text = (((Object)item.m_dropPrefab).name ?? string.Empty).ToLowerInvariant(); } } catch { } if (text.Contains("staff")) { return true; } string text2 = string.Empty; try { text2 = (item.m_shared.m_name ?? string.Empty).ToLowerInvariant(); } catch { } return text2.Contains("staff"); } internal static bool IsElementalStaffWeapon(ItemData item) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 if (item == null || item.m_shared == null || IsUnarmedItem(item)) { return false; } try { if ((int)item.m_shared.m_skillType == 9) { return true; } } catch { } return false; } internal static bool IsReinforcementWeapon(ItemData item) { //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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 if (item == null || item.m_shared == null || IsUnarmedItem(item) || IsStaffWeapon(item)) { return false; } SkillType skillType = item.m_shared.m_skillType; if ((int)skillType != 1 && (int)skillType != 2 && (int)skillType != 7) { return false; } string text = string.Empty; try { if ((Object)(object)item.m_dropPrefab != (Object)null) { text = (((Object)item.m_dropPrefab).name ?? string.Empty).ToLowerInvariant(); } } catch { } switch (text) { default: if (!(text == "knifeflint")) { return true; } goto case "swordwood"; case "swordwood": case "club": case "axestone": return false; } } internal static bool IsBluntWeapon(ItemData item) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if (item == null || item.m_shared == null || IsUnarmedItem(item) || IsStaffWeapon(item)) { return false; } try { if ((int)item.m_shared.m_skillType != 3) { return false; } } catch { return false; } string text = string.Empty; try { if ((Object)(object)item.m_dropPrefab != (Object)null) { text = (((Object)item.m_dropPrefab).name ?? string.Empty).ToLowerInvariant(); } } catch { } if (text == "club" || text == "macewood") { return false; } return true; } internal static bool IsAnySupportedWeapon(ItemData item) { return IsReinforcementWeapon(item) || IsBluntWeapon(item) || IsElementalStaffWeapon(item); } internal static bool PrefabExists(string prefabName) { if (string.IsNullOrEmpty(prefabName) || (Object)(object)ZNetScene.instance == (Object)null) { return false; } try { return (Object)(object)ZNetScene.instance.GetPrefab(prefabName) != (Object)null; } catch { return false; } } internal static string ResolveForgeSfxPrefab() { if (!string.IsNullOrEmpty(_resolvedForgeSfxPrefab) && PrefabExists(_resolvedForgeSfxPrefab)) { return _resolvedForgeSfxPrefab; } if (PrefabExists(RuntimeForgeSfxPrefab)) { _resolvedForgeSfxPrefab = RuntimeForgeSfxPrefab; return _resolvedForgeSfxPrefab; } string[] array = new string[8] { "sfx_gui_repairitem_forge", "sfx_fist_metal_blocked", "sfx_craft", "sfx_hammer", "sfx_build_hammer", "sfx_anvil", "sfx_forge", "sfx_smelter_add" }; for (int i = 0; i < array.Length; i++) { if (PrefabExists(array[i])) { _resolvedForgeSfxPrefab = array[i]; return _resolvedForgeSfxPrefab; } } _resolvedForgeSfxPrefab = RuntimeReinforcementSfxPrefab; return _resolvedForgeSfxPrefab; } internal static string ResolveForgeVfxPrefab() { if (!string.IsNullOrEmpty(_resolvedForgeVfxPrefab) && PrefabExists(_resolvedForgeVfxPrefab)) { return _resolvedForgeVfxPrefab; } if (PrefabExists(RuntimeForgeVfxPrefab)) { _resolvedForgeVfxPrefab = RuntimeForgeVfxPrefab; return _resolvedForgeVfxPrefab; } string[] array = new string[7] { "vfx_HitSparks", "vfx_FireAddFuel", "vfx_kiln_addore", "vfx_torch_hit", "fx_fire", "vfx_smelter", "vfx_smelter_add" }; for (int i = 0; i < array.Length; i++) { if (PrefabExists(array[i])) { _resolvedForgeVfxPrefab = array[i]; return _resolvedForgeVfxPrefab; } } _resolvedForgeVfxPrefab = "vfx_HitSparks"; return _resolvedForgeVfxPrefab; } internal static string ResolveBlessingSfxPrefab() { if (!string.IsNullOrEmpty(_resolvedBlessingSfxPrefab) && PrefabExists(_resolvedBlessingSfxPrefab)) { return _resolvedBlessingSfxPrefab; } if (PrefabExists(RuntimeBlessingSfxPrefab)) { _resolvedBlessingSfxPrefab = RuntimeBlessingSfxPrefab; return _resolvedBlessingSfxPrefab; } string[] array = new string[5] { "sfx_gui_craftitem", "sfx_magic_attack", "sfx_magic_staff_charge", "sfx_magic_staff_fireball_start", "sfx_magic_staff_charge_loop" }; for (int i = 0; i < array.Length; i++) { if (PrefabExists(array[i])) { _resolvedBlessingSfxPrefab = array[i]; return _resolvedBlessingSfxPrefab; } } _resolvedBlessingSfxPrefab = RuntimeForgeSfxPrefab; return _resolvedBlessingSfxPrefab; } internal static string ResolveBlessingVfxPrefab() { if (!string.IsNullOrEmpty(_resolvedBlessingVfxPrefab) && PrefabExists(_resolvedBlessingVfxPrefab)) { return _resolvedBlessingVfxPrefab; } if (PrefabExists(RuntimeBlessingVfxPrefab)) { _resolvedBlessingVfxPrefab = RuntimeBlessingVfxPrefab; return _resolvedBlessingVfxPrefab; } string[] array = new string[4] { "fx_DvergerMage_Support_start", "fx_DvergerMage_MistileSpawn", "fx_DvergerMage_Nova_ring", "fx_GP_Player" }; for (int i = 0; i < array.Length; i++) { if (PrefabExists(array[i])) { _resolvedBlessingVfxPrefab = array[i]; return _resolvedBlessingVfxPrefab; } } _resolvedBlessingVfxPrefab = "fx_GP_Player"; return _resolvedBlessingVfxPrefab; } internal static void DumpAnimatorParameters(Animator animator) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)animator == (Object)null) { return; } try { AnimatorControllerParameter[] parameters = animator.parameters; if (parameters == null || parameters.Length == 0) { LogDebug("[ANIM] Animator has no parameters"); return; } foreach (AnimatorControllerParameter val in parameters) { string name = val.name; AnimatorControllerParameterType type = val.type; LogDebug("[ANIM] Param: " + name + " | Type=" + ((object)(AnimatorControllerParameterType)(ref type)).ToString()); } } catch (Exception ex) { LogDebug("[ANIM] DumpAnimatorParameters failed: " + ex.Message); } } internal static void LogBlessingEmoteParameters(Animator animator) { //IL_0127: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Invalid comparison between Unknown and I4 if ((Object)(object)animator == (Object)null) { return; } string[] array = new string[28] { "emote_stop", "emote_wave", "emote_sit", "emote_sitchair", "emote_drink", "emote_challenge", "emote_cheer", "emote_nonono", "emote_thumbsup", "emote_point", "emote_blowkiss", "emote_bow", "emote_cower", "emote_cry", "emote_despair", "emote_flex", "emote_comehere", "emote_kneel", "emote_laugh", "emote_roar", "emote_shrug", "emote_headbang", "emote_dance", "emote_toast", "emote_rest", "emote_relax", "emote_vibe", "emote_loveyou" }; foreach (string text in array) { try { AnimatorControllerParameter[] parameters = animator.parameters; bool flag = false; AnimatorControllerParameterType val = (AnimatorControllerParameterType)9; for (int j = 0; j < parameters.Length; j++) { if (parameters[j].name == text) { flag = true; val = parameters[j].type; break; } } if (flag) { if ((int)val == 4) { LogDebug("[BLESSING EMOTE] BOOL param: " + text + " value=" + animator.GetBool(text)); } else { LogDebug("[BLESSING EMOTE] Trigger param: " + text); } } } catch (Exception ex) { LogDebug("[BLESSING EMOTE] Failed reading param " + text + ": " + ex.Message); } } } internal static string GetDataKeyForType(BonusStationType type) { return type switch { BonusStationType.Reinforcement => "hh_reinforcement_until_utc", BonusStationType.Forge => "hh_forge_until_utc", BonusStationType.Blessing => "hh_blessing_until_utc", _ => string.Empty, }; } internal static string GetStatusNameForType(BonusStationType type) { return type switch { BonusStationType.Reinforcement => "Megélezve", BonusStationType.Forge => "Megkovácsolva", BonusStationType.Blessing => "Megáldva", _ => string.Empty, }; } internal static string GetActionTextForType(BonusStationType type) { return type switch { BonusStationType.Reinforcement => "Élezés", BonusStationType.Forge => "Kovácsolás", BonusStationType.Blessing => "Áldás", _ => string.Empty, }; } internal static string GetProgressTextForType(BonusStationType type) { return type switch { BonusStationType.Reinforcement => "Fegyver élezése...", BonusStationType.Forge => "Fegyver kovácsolása...", BonusStationType.Blessing => "Fegyver megáldása...", _ => "Folyamat...", }; } internal static string GetInterruptedTextForType(BonusStationType type) { return type switch { BonusStationType.Reinforcement => "Az élezés megszakadt.", BonusStationType.Forge => "A kovácsolás megszakadt.", BonusStationType.Blessing => "Az áldás megszakadt.", _ => "A folyamat megszakadt.", }; } internal static string GetInvalidWeaponTextForType(BonusStationType type) { return type switch { BonusStationType.Reinforcement => "Ezt nem élezheted meg.", BonusStationType.Forge => "Ezt nem kovácsolhatod meg.", BonusStationType.Blessing => "Ezt itt nem áldhatod meg.", _ => "Ez a tárgy nem használható itt.", }; } internal static float GetCurrentBonusPercent(ItemData weapon, BonusStationType type) { if (!IsModEnabled() || weapon == null || type == BonusStationType.None) { return 0f; } if (type == BonusStationType.Reinforcement && !IsReinforcementWeapon(weapon)) { return 0f; } if (type == BonusStationType.Forge && !IsBluntWeapon(weapon)) { return 0f; } if (type == BonusStationType.Blessing && !IsElementalStaffWeapon(weapon)) { return 0f; } string dataKeyForType = GetDataKeyForType(type); if (string.IsNullOrEmpty(dataKeyForType)) { return 0f; } if (!TryGetUtcCustomData(weapon, dataKeyForType, out var utc)) { return 0f; } if (DateTime.UtcNow >= utc) { ClearBonusData(weapon, type); return 0f; } float maxDurabilitySafe = GetMaxDurabilitySafe(weapon); if (maxDurabilitySafe <= 0f) { return 0f; } float num = Mathf.Clamp01(weapon.m_durability / maxDurabilitySafe); float num2 = Mathf.Clamp01(RuntimeMinDurabilityPercent / 100f); if (num < num2) { return 0f; } return Mathf.Max(0f, RuntimeMaxBonusPercent * num); } internal static float GetCurrentBonusMultiplier(ItemData weapon, BonusStationType type) { return 1f + GetCurrentBonusPercent(weapon, type) / 100f; } internal static float GetMaxDurabilitySafe(ItemData weapon) { if (weapon == null) { return 0f; } try { return weapon.GetMaxDurability(); } catch { return (weapon.m_shared != null) ? weapon.m_shared.m_maxDurability : 0f; } } internal static void SetUtcCustomData(ItemData item, string key, DateTime utc) { if (item != null) { if (item.m_customData == null) { item.m_customData = new Dictionary(); } item.m_customData[key] = utc.Ticks.ToString(CultureInfo.InvariantCulture); } } internal static bool TryGetUtcCustomData(ItemData item, string key, out DateTime utc) { utc = DateTime.MinValue; if (item == null || item.m_customData == null) { return false; } if (!item.m_customData.TryGetValue(key, out var value)) { return false; } if (!long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return false; } try { utc = new DateTime(result, DateTimeKind.Utc); return true; } catch { return false; } } internal static void ClearBonusData(ItemData item, BonusStationType type) { if (item != null && item.m_customData != null) { string dataKeyForType = GetDataKeyForType(type); if (!string.IsNullOrEmpty(dataKeyForType)) { item.m_customData.Remove(dataKeyForType); } } } internal static void CleanupExpiredBonusData(Player player) { if ((Object)(object)player == (Object)null) { return; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return; } List allItems = inventory.GetAllItems(); if (allItems == null) { return; } DateTime utcNow = DateTime.UtcNow; for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (val != null) { CleanupExpiredBonusDataOnItem(val, BonusStationType.Reinforcement, utcNow); CleanupExpiredBonusDataOnItem(val, BonusStationType.Forge, utcNow); CleanupExpiredBonusDataOnItem(val, BonusStationType.Blessing, utcNow); } } } internal static void CleanupExpiredBonusDataOnItem(ItemData item, BonusStationType type, DateTime nowUtc) { string dataKeyForType = GetDataKeyForType(type); if (!string.IsNullOrEmpty(dataKeyForType) && TryGetUtcCustomData(item, dataKeyForType, out var utc) && nowUtc >= utc) { ClearBonusData(item, type); } } internal static bool TryApplyBonusToWeapon(Player player, ItemData weapon, BonusStationType type, out string message) { message = string.Empty; if (!IsModEnabled()) { message = "A funkció ki van kapcsolva."; return false; } if ((Object)(object)player == (Object)null || weapon == null) { message = "Nincs megfelelő fegyver a kezedben."; return false; } if (type == BonusStationType.Reinforcement && !IsReinforcementWeapon(weapon)) { message = GetInvalidWeaponTextForType(type); return false; } if (type == BonusStationType.Forge && !IsBluntWeapon(weapon)) { message = GetInvalidWeaponTextForType(type); return false; } if (type == BonusStationType.Blessing && !IsElementalStaffWeapon(weapon)) { message = GetInvalidWeaponTextForType(type); return false; } float maxDurabilitySafe = GetMaxDurabilitySafe(weapon); if (maxDurabilitySafe <= 0f) { message = "Ennél a tárgynál nincs használható tartósság."; return false; } if (weapon.m_durability <= 0f) { message = "A fegyvert előbb javítsd meg."; return false; } DateTime utc = DateTime.UtcNow.AddMinutes(Math.Max(1, RuntimeDurationMinutes)); SetUtcCustomData(weapon, GetDataKeyForType(type), utc); float currentBonusPercent = GetCurrentBonusPercent(weapon, type); message = string.Format(CultureInfo.InvariantCulture, "{0}. Jelenlegi bónusz: +{1:0.##}%", type switch { BonusStationType.Forge => "Fegyver megkovácsolva", BonusStationType.Reinforcement => "Fegyver megélezve", _ => "Fegyver megáldva", }, currentBonusPercent); RefreshVisibleBonusStatus(player, forceImmediate: true); return true; } internal static string FormatTimeRemainingHMS(TimeSpan remaining) { if (remaining.TotalSeconds <= 0.0) { return "0:00:00"; } int num = Mathf.Max(0, Mathf.FloorToInt((float)remaining.TotalHours)); return string.Format(CultureInfo.InvariantCulture, "{0}:{1:00}:{2:00}", num, remaining.Minutes, remaining.Seconds); } internal static string GetTimeRemainingText(ItemData item, BonusStationType type) { if (item == null) { return string.Empty; } string dataKeyForType = GetDataKeyForType(type); if (string.IsNullOrEmpty(dataKeyForType)) { return string.Empty; } if (!TryGetUtcCustomData(item, dataKeyForType, out var utc)) { return string.Empty; } TimeSpan remaining = utc - DateTime.UtcNow; if (remaining.TotalSeconds <= 0.0) { ClearBonusData(item, type); return "0:00:00"; } return FormatTimeRemainingHMS(remaining); } internal static string GetItemName(ItemData item) { if (item == null) { return "unknown"; } if (item.m_shared != null && !string.IsNullOrEmpty(item.m_shared.m_name)) { return item.m_shared.m_name; } return "unknown"; } internal static string FormatDamageValue(float value) { if (Math.Abs(value - Mathf.Round(value)) < 0.01f) { return Mathf.RoundToInt(value).ToString(CultureInfo.InvariantCulture); } return value.ToString("0.#", CultureInfo.InvariantCulture); } internal static string[] GetTooltipLabelCandidates(string labelToken) { return labelToken switch { "$inventory_blunt" => new string[3] { "$inventory_blunt", "Blunt", "Zúzó" }, "$inventory_slash" => new string[3] { "$inventory_slash", "Slash", "Vágó" }, "$inventory_pierce" => new string[3] { "$inventory_pierce", "Pierce", "Szúró" }, "$inventory_chop" => new string[3] { "$inventory_chop", "Chop", "Vágás" }, "$inventory_pickaxe" => new string[3] { "$inventory_pickaxe", "Pickaxe", "Csákány" }, "$inventory_fire" => new string[3] { "$inventory_fire", "Fire", "Tűz" }, "$inventory_frost" => new string[3] { "$inventory_frost", "Frost", "Fagy" }, "$inventory_lightning" => new string[3] { "$inventory_lightning", "Lightning", "Villám" }, "$inventory_spirit" => new string[3] { "$inventory_spirit", "Spirit", "Szellem" }, "$inventory_poison" => new string[3] { "$inventory_poison", "Poison", "Mérgezés" }, _ => new string[1] { labelToken }, }; } internal static bool TryReplaceTooltipDamageLine(ref string tooltip, string labelToken, float baseDamage, float multiplier) { if (string.IsNullOrEmpty(tooltip) || string.IsNullOrEmpty(labelToken) || baseDamage <= 0f || multiplier <= 1f) { return false; } string text = "" + FormatDamageValue(baseDamage * multiplier) + ""; string[] tooltipLabelCandidates = GetTooltipLabelCandidates(labelToken); foreach (string text2 in tooltipLabelCandidates) { if (!string.IsNullOrEmpty(text2)) { string pattern = "(?m)^(?\\s*" + Regex.Escape(text2) + ":\\s*)(?(?:]+>)?\\d+(?:[.,]\\d+)?(?:)?)"; Match match = Regex.Match(tooltip, pattern, RegexOptions.CultureInvariant); if (match.Success) { tooltip = Regex.Replace(tooltip, pattern, "${prefix}" + text, RegexOptions.CultureInvariant); return true; } } } return false; } internal static string ApplyBonusDamageTooltip(string tooltip, ItemData item) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(tooltip) || item == null) { return tooltip; } DamageTypes damage = item.GetDamage(); bool flag = false; float currentBonusMultiplier = GetCurrentBonusMultiplier(item, BonusStationType.Reinforcement); float currentBonusMultiplier2 = GetCurrentBonusMultiplier(item, BonusStationType.Forge); float currentBonusMultiplier3 = GetCurrentBonusMultiplier(item, BonusStationType.Blessing); if (currentBonusMultiplier > 1f) { TryReplaceTooltipDamageLine(ref tooltip, "$inventory_slash", damage.m_slash, currentBonusMultiplier); TryReplaceTooltipDamageLine(ref tooltip, "$inventory_pierce", damage.m_pierce, currentBonusMultiplier); TryReplaceTooltipDamageLine(ref tooltip, "$inventory_chop", damage.m_chop, currentBonusMultiplier); TryReplaceTooltipDamageLine(ref tooltip, "$inventory_pickaxe", damage.m_pickaxe, currentBonusMultiplier); } if (currentBonusMultiplier2 > 1f) { TryReplaceTooltipDamageLine(ref tooltip, "$inventory_blunt", damage.m_blunt, currentBonusMultiplier2); } if (currentBonusMultiplier3 > 1f) { TryReplaceTooltipDamageLine(ref tooltip, "$inventory_fire", damage.m_fire, currentBonusMultiplier3); TryReplaceTooltipDamageLine(ref tooltip, "$inventory_frost", damage.m_frost, currentBonusMultiplier3); TryReplaceTooltipDamageLine(ref tooltip, "$inventory_lightning", damage.m_lightning, currentBonusMultiplier3); TryReplaceTooltipDamageLine(ref tooltip, "$inventory_spirit", damage.m_spirit, currentBonusMultiplier3); TryReplaceTooltipDamageLine(ref tooltip, "$inventory_poison", damage.m_poison, currentBonusMultiplier3); } return tooltip; } internal static void AppendBonusTooltipInfo(ref string tooltip, ItemData item) { float currentBonusPercent = GetCurrentBonusPercent(item, BonusStationType.Reinforcement); float currentBonusPercent2 = GetCurrentBonusPercent(item, BonusStationType.Forge); float currentBonusPercent3 = GetCurrentBonusPercent(item, BonusStationType.Blessing); if (currentBonusPercent > 0f) { tooltip += string.Format(CultureInfo.InvariantCulture, "\nMegélezve\nSebzésbónusz: +{0:0.##}%\nHátralévő idő: {1}", currentBonusPercent, GetTimeRemainingText(item, BonusStationType.Reinforcement)); } if (currentBonusPercent2 > 0f) { tooltip += string.Format(CultureInfo.InvariantCulture, "\nMegkovácsolva\nSebzésbónusz: +{0:0.##}%\nHátralévő idő: {1}", currentBonusPercent2, GetTimeRemainingText(item, BonusStationType.Forge)); } if (currentBonusPercent3 > 0f) { tooltip += string.Format(CultureInfo.InvariantCulture, "\nMegáldva\nSebzésbónusz: +{0:0.##}%\nHátralévő idő: {1}", currentBonusPercent3, GetTimeRemainingText(item, BonusStationType.Blessing)); } } internal static void EnsureCustomAudioFoldersExist() { EnsureFolderExists(GetCustomReinforcementAudioFolderPath()); EnsureFolderExists(GetCustomForgeAudioFolderPath()); EnsureFolderExists(GetCustomBlessingAudioFolderPath()); } private static void EnsureFolderExists(string folder) { try { if (!string.IsNullOrEmpty(folder) && !Directory.Exists(folder)) { Directory.CreateDirectory(folder); } } catch (Exception ex) { LogDebug("EnsureFolderExists failed: " + ex.Message); } } internal static string GetPluginFolderPath() { try { return Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location); } catch { return string.Empty; } } internal static string GetCustomReinforcementAudioFolderPath() { string pluginFolderPath = GetPluginFolderPath(); if (string.IsNullOrEmpty(pluginFolderPath)) { return string.Empty; } string path = ((!string.IsNullOrEmpty(RuntimeCustomReinforcementAudioFolderName)) ? RuntimeCustomReinforcementAudioFolderName : "WeaponReinforcement"); return Path.Combine(pluginFolderPath, path); } internal static string GetCustomForgeAudioFolderPath() { string pluginFolderPath = GetPluginFolderPath(); if (string.IsNullOrEmpty(pluginFolderPath)) { return string.Empty; } string path = ((!string.IsNullOrEmpty(RuntimeCustomForgeAudioFolderName)) ? RuntimeCustomForgeAudioFolderName : "WeaponReinforcement"); return Path.Combine(pluginFolderPath, path); } internal static string GetCustomBlessingAudioFolderPath() { string pluginFolderPath = GetPluginFolderPath(); if (string.IsNullOrEmpty(pluginFolderPath)) { return string.Empty; } string path = ((!string.IsNullOrEmpty(RuntimeCustomBlessingAudioFolderName)) ? RuntimeCustomBlessingAudioFolderName : "WeaponReinforcement"); return Path.Combine(pluginFolderPath, path); } internal static string GetCustomReinforcementAudioPath() { string customReinforcementAudioFolderPath = GetCustomReinforcementAudioFolderPath(); if (string.IsNullOrEmpty(customReinforcementAudioFolderPath)) { return string.Empty; } string path = ((!string.IsNullOrEmpty(RuntimeCustomReinforcementAudioFileName)) ? RuntimeCustomReinforcementAudioFileName : "grinding.ogg"); return Path.Combine(customReinforcementAudioFolderPath, path); } internal static string GetCustomForgeAudioPath() { string customForgeAudioFolderPath = GetCustomForgeAudioFolderPath(); if (string.IsNullOrEmpty(customForgeAudioFolderPath)) { return string.Empty; } string path = ((!string.IsNullOrEmpty(RuntimeCustomForgeAudioFileName)) ? RuntimeCustomForgeAudioFileName : "forge.ogg"); return Path.Combine(customForgeAudioFolderPath, path); } internal static string GetCustomBlessingAudioPath() { string customBlessingAudioFolderPath = GetCustomBlessingAudioFolderPath(); if (string.IsNullOrEmpty(customBlessingAudioFolderPath)) { return string.Empty; } string path = ((!string.IsNullOrEmpty(RuntimeCustomBlessingAudioFileName)) ? RuntimeCustomBlessingAudioFileName : "wand.ogg"); return Path.Combine(customBlessingAudioFolderPath, path); } internal static AudioType DetectAudioTypeFromPath(string path) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) return (AudioType)(Path.GetExtension(path).ToLowerInvariant() switch { ".mp3" => 13, ".ogg" => 14, ".wav" => 20, _ => 0, }); } [IteratorStateMachine(typeof(d__159))] internal static IEnumerator EnsureCustomReinforcementClipLoaded() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__159(0); } [IteratorStateMachine(typeof(d__160))] internal static IEnumerator EnsureCustomForgeClipLoaded() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__160(0); } [IteratorStateMachine(typeof(d__161))] internal static IEnumerator EnsureCustomBlessingClipLoaded() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__161(0); } [IteratorStateMachine(typeof(d__162))] private static IEnumerator LoadClipCoroutine(string filePath, Action onLoaded) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__162(0) { filePath = filePath, onLoaded = onLoaded }; } internal static void StartCustomAudioLoop(AudioClip clip, Vector3 position, float volume, string objectName) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clip == (Object)null) { return; } try { StopCustomAudioLoop(); _activeAudioObject = new GameObject(objectName); _activeAudioObject.transform.position = position; _activeAudioSource = _activeAudioObject.AddComponent(); _activeAudioSource.clip = clip; _activeAudioSource.loop = true; _activeAudioSource.spatialBlend = 1f; _activeAudioSource.volume = volume; _activeAudioSource.minDistance = 2f; _activeAudioSource.maxDistance = 16f; _activeAudioSource.rolloffMode = (AudioRolloffMode)1; _activeAudioSource.Play(); } catch (Exception ex) { LogDebug("StartCustomAudioLoop failed: " + ex.Message); } } internal static void UpdateCustomAudioLoopPosition(Vector3 position) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_activeAudioObject != (Object)null) { _activeAudioObject.transform.position = position; } } catch { } } internal static void StopCustomAudioLoop() { try { if ((Object)(object)_activeAudioSource != (Object)null) { _activeAudioSource.Stop(); } } catch { } try { if ((Object)(object)_activeAudioObject != (Object)null) { Object.Destroy((Object)(object)_activeAudioObject); } } catch { } _activeAudioSource = null; _activeAudioObject = null; } [IteratorStateMachine(typeof(d__166))] internal static IEnumerator StartProcessSound(Player player, Transform stationTransform, BonusStationType type) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__166(0) { player = player, stationTransform = stationTransform, type = type }; } internal static GameObject TryGetPrefab(string prefabName) { if (string.IsNullOrEmpty(prefabName) || (Object)(object)ZNetScene.instance == (Object)null) { return null; } try { return ZNetScene.instance.GetPrefab(prefabName); } catch { return null; } } internal static void TrySpawnEffect(string prefabName, Vector3 position, Quaternion rotation) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(prefabName)) { return; } try { GameObject val = TryGetPrefab(prefabName); if ((Object)(object)val == (Object)null) { LogDebug("[EFFECT] Prefab NOT found: " + prefabName); } else { Object.Instantiate(val, position, rotation); } } catch (Exception ex) { LogAlways("[EFFECT] TrySpawnEffect failed for " + prefabName + ": " + ex.Message); } } internal static void TrySpawnEffectVisualOnly(string prefabName, Vector3 position, Quaternion rotation, bool disableShake = true) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(prefabName)) { return; } try { GameObject val = TryGetPrefab(prefabName); if ((Object)(object)val == (Object)null) { LogDebug("[EFFECT] VisualOnly prefab NOT found: " + prefabName); return; } bool activeSelf = val.activeSelf; GameObject val2 = null; try { if (activeSelf) { val.SetActive(false); } val2 = Object.Instantiate(val, position, rotation); } finally { if ((Object)(object)val != (Object)null && activeSelf) { val.SetActive(true); } } if ((Object)(object)val2 == (Object)null) { return; } AudioSource[] componentsInChildren = val2.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] == (Object)null)) { componentsInChildren[i].Stop(); componentsInChildren[i].playOnAwake = false; componentsInChildren[i].mute = true; componentsInChildren[i].volume = 0f; ((Behaviour)componentsInChildren[i]).enabled = false; } } MonoBehaviour[] componentsInChildren2 = val2.GetComponentsInChildren(true); foreach (MonoBehaviour val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)null)) { string name = ((object)val3).GetType().Name; bool flag = name.IndexOf("sfx", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("zsfx", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("audio", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("sound", StringComparison.OrdinalIgnoreCase) >= 0; bool flag2 = disableShake && (name.IndexOf("shake", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("camera", StringComparison.OrdinalIgnoreCase) >= 0); if (flag || flag2) { ((Behaviour)val3).enabled = false; } } } if (disableShake) { SuppressBlessingCameraShakeFor(1.25f); } val2.SetActive(true); if (disableShake) { SuppressBlessingCameraShakeFor(1.25f); } } catch (Exception ex) { LogAlways("[EFFECT] TrySpawnEffectVisualOnly failed for " + prefabName + ": " + ex.Message); } } internal static void SpawnForgeProcessEffects(Vector3 fxPos, Quaternion rotation) { //IL_0006: 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_0022: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) TrySpawnEffect("vfx_HitSparks", fxPos, rotation); if (PrefabExists("vfx_FireAddFuel")) { TrySpawnEffect("vfx_FireAddFuel", fxPos, rotation); } if (Time.frameCount % 30 == 0 && PrefabExists("vfx_kiln_addore")) { TrySpawnEffect("vfx_kiln_addore", fxPos, rotation); } } internal static void SpawnReinforcementProcessEffects(Vector3 fxPos, Quaternion rotation) { //IL_0006: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) TrySpawnEffect("vfx_HitSparks", fxPos, rotation); if (Time.frameCount % 25 == 0 && PrefabExists("vfx_arrowhit")) { TrySpawnEffect("vfx_arrowhit", fxPos, rotation); } } internal static Vector3 GetProcessEffectPosition(Player player, Transform stationTransform) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = stationTransform.position + Vector3.up * 1f; if ((Object)(object)player == (Object)null) { return val; } try { return Vector3.Lerp(val, ((Component)player).transform.position + ((Component)player).transform.forward * 0.6f + Vector3.up * 1.1f, 0.5f); } catch { } return val; } internal static bool IsGrindingWheelObject(GameObject go) { return (Object)(object)go != (Object)null && IsGrindingWheelObject((Component)(object)go.transform); } internal static bool IsGrindingWheelObject(Component component) { return IsNamedStationObject(component, "forge_ext3"); } internal static bool IsAnvilObject(GameObject go) { return (Object)(object)go != (Object)null && IsAnvilObject((Component)(object)go.transform); } internal static bool IsAnvilObject(Component component) { return IsNamedStationObject(component, "forge_ext4"); } internal static bool IsRuneTableObject(GameObject go) { return (Object)(object)go != (Object)null && IsRuneTableObject((Component)(object)go.transform); } internal static bool IsRuneTableObject(Component component) { return IsNamedStationObject(component, "piece_magetable_ext"); } internal static bool IsGaldrTableObject(GameObject go) { return (Object)(object)go != (Object)null && IsGaldrTableObject((Component)(object)go.transform); } internal static bool IsGaldrTableObject(Component component) { return IsNamedStationObject(component, "piece_magetable"); } internal static bool IsNamedStationObject(Component component, string prefabName) { if ((Object)(object)component == (Object)null || string.IsNullOrEmpty(prefabName)) { return false; } Transform val = component.transform; while ((Object)(object)val != (Object)null) { string name = ((Object)((Component)val).gameObject).name; if (!string.IsNullOrEmpty(name)) { name = name.Replace("(Clone)", string.Empty).Trim(); if (string.Equals(name, prefabName, StringComparison.OrdinalIgnoreCase)) { return true; } } CraftingStation component2 = ((Component)val).GetComponent(); if ((Object)(object)component2 != (Object)null) { string name2 = ((Object)((Component)component2).gameObject).name; if (!string.IsNullOrEmpty(name2)) { name2 = name2.Replace("(Clone)", string.Empty).Trim(); if (string.Equals(name2, prefabName, StringComparison.OrdinalIgnoreCase)) { return true; } } } val = val.parent; } return false; } internal static bool CanProcessCurrentWeapon(Player player, BonusStationType type, out ItemData weapon) { weapon = null; if (!IsModEnabled() || (Object)(object)player == (Object)null || type == BonusStationType.None) { return false; } weapon = ((Humanoid)player).GetCurrentWeapon(); if (weapon == null) { return false; } if (IsUnarmedItem(weapon)) { weapon = null; return false; } switch (type) { case BonusStationType.Reinforcement: if (IsStaffWeapon(weapon) || !IsReinforcementWeapon(weapon)) { weapon = null; return false; } break; case BonusStationType.Forge: if (IsStaffWeapon(weapon) || !IsBluntWeapon(weapon)) { weapon = null; return false; } break; case BonusStationType.Blessing: if (!IsElementalStaffWeapon(weapon)) { weapon = null; return false; } break; } float maxDurabilitySafe = GetMaxDurabilitySafe(weapon); if (maxDurabilitySafe <= 0f || weapon.m_durability <= 0f) { weapon = null; return false; } return true; } internal static string GetStationHoverText(Component component, BonusStationType type) { string text = type switch { BonusStationType.Forge => "Kovácsüllő", BonusStationType.Reinforcement => "Köszörűkő", _ => "Rúnaasztal", }; Piece val = (((Object)(object)component != (Object)null) ? component.GetComponent() : null); if ((Object)(object)val != (Object)null && !string.IsNullOrEmpty(val.m_name)) { text = val.m_name; } Player localPlayer = Player.m_localPlayer; if (!CanProcessCurrentWeapon(localPlayer, type, out var _)) { return text; } if (_isProcessInProgress && localPlayer.GetPlayerID() == _activePlayerId && _activeProcessType == type) { return text + "\n" + GetActionTextForType(type) + " folyamatban..."; } return text + "\n[E] " + GetActionTextForType(type); } internal static bool StartProcess(Player player, ItemData weapon, Transform stationTransform, BonusStationType type) { if ((Object)(object)Instance == (Object)null || (Object)(object)player == (Object)null || weapon == null || (Object)(object)stationTransform == (Object)null || type == BonusStationType.None) { return false; } if (_isProcessInProgress) { return false; } LogDebug("[PROCESS] StartProcess type=" + type.ToString() + " weapon=" + GetItemName(weapon)); _isProcessInProgress = true; _activePlayerId = player.GetPlayerID(); _activeProcessType = type; _reinforcementAnimStartedThisProcess = false; _blessingAnimStartedThisProcess = false; _loggedForgeAnimatorParamsThisProcess = false; _loggedBlessingAnimatorParamsThisProcess = false; _blessingAnimatorDisabledThisProcess = false; _blessingPoseLockedThisProcess = false; _resolvedForgeSfxPrefab = null; _resolvedForgeVfxPrefab = null; _resolvedBlessingSfxPrefab = null; _resolvedBlessingVfxPrefab = null; _activeRoutine = ((MonoBehaviour)Instance).StartCoroutine(ProcessRoutine(player, weapon, stationTransform, type)); BroadcastStationProcess(player, stationTransform, type, active: true); return true; } [IteratorStateMachine(typeof(d__185))] internal static IEnumerator ProcessRoutine(Player player, ItemData weapon, Transform stationTransform, BonusStationType type) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__185(0) { player = player, weapon = weapon, stationTransform = stationTransform, type = type }; } internal static void FaceTarget(Player player, Vector3 target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target - ((Component)player).transform.position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.001f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); ((Component)player).transform.rotation = Quaternion.Slerp(((Component)player).transform.rotation, val2, 12f * Time.deltaTime); } } internal static void StopPlayerMovement(Player player) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return; } try { Rigidbody value = Traverse.Create((object)player).Field("m_body").GetValue(); if (!((Object)(object)value == (Object)null)) { Vector3 linearVelocity = value.linearVelocity; linearVelocity.x = 0f; linearVelocity.z = 0f; value.linearVelocity = linearVelocity; } } catch { } } internal static void TryLockBlessingPose(Player player) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || _blessingPoseLockedThisProcess) { return; } try { Animator componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null || !((Behaviour)componentInChildren).enabled) { return; } AnimatorStateInfo currentAnimatorStateInfo = componentInChildren.GetCurrentAnimatorStateInfo(0); AnimatorClipInfo[] currentAnimatorClipInfo = componentInChildren.GetCurrentAnimatorClipInfo(0); bool flag = false; if (currentAnimatorClipInfo != null) { for (int i = 0; i < currentAnimatorClipInfo.Length; i++) { if ((Object)(object)((AnimatorClipInfo)(ref currentAnimatorClipInfo[i])).clip != (Object)null && string.Equals(((Object)((AnimatorClipInfo)(ref currentAnimatorClipInfo[i])).clip).name, "Cheer", StringComparison.OrdinalIgnoreCase)) { flag = true; break; } } } if (flag) { float normalizedTime = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime; if (normalizedTime >= _blessingPoseLockNormalizedTime) { componentInChildren.Play(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash, 0, _blessingPoseLockNormalizedTime); componentInChildren.Update(0f); ((Behaviour)componentInChildren).enabled = false; _blessingPoseLockedThisProcess = true; _blessingAnimatorDisabledThisProcess = true; LogDebug("[BLESSING] Pose hard-locked at Cheer normalizedTime=" + normalizedTime.ToString("0.00", CultureInfo.InvariantCulture)); } } } catch (Exception ex) { LogAlways("[BLESSING] TryLockBlessingPose failed: " + ex.Message); } } internal static void TryPlayStationAnimation(Player player, BonusStationType type) { if ((Object)(object)player == (Object)null) { return; } try { Animator componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return; } componentInChildren.SetBool("moving", false); componentInChildren.SetFloat("forward_speed", 0f); componentInChildren.SetFloat("sideway_speed", 0f); switch (type) { case BonusStationType.Forge: if (!_loggedForgeAnimatorParamsThisProcess) { _loggedForgeAnimatorParamsThisProcess = true; DumpAnimatorParameters(componentInChildren); } componentInChildren.SetInteger("crafting", 2); break; case BonusStationType.Blessing: if (!_loggedBlessingAnimatorParamsThisProcess) { _loggedBlessingAnimatorParamsThisProcess = true; LogDebug("[BLESSING DEBUG] Brutal debug started."); DumpAnimatorParameters(componentInChildren); LogBlessingEmoteParameters(componentInChildren); StartLocalAnimatorStateLogger(player, "BLESSING DEBUG", 2.5f); } componentInChildren.SetInteger("crafting", 0); componentInChildren.SetBool("moving", false); componentInChildren.SetFloat("forward_speed", 0f); componentInChildren.SetFloat("sideway_speed", 0f); if (!_blessingAnimStartedThisProcess) { _blessingAnimStartedThisProcess = true; try { TryStopPlayerEmote(player); } catch { } try { player.StartEmote("cheer", true); break; } catch (Exception ex) { LogAlways("[BLESSING] StartEmote failed: " + ex.Message); break; } } break; default: componentInChildren.SetInteger("crafting", 1); if (!_reinforcementAnimStartedThisProcess) { _reinforcementAnimStartedThisProcess = true; componentInChildren.ResetTrigger("interact"); componentInChildren.ResetTrigger("attack"); componentInChildren.ResetTrigger("attack_abort"); componentInChildren.ResetTrigger("swing_hammer"); componentInChildren.SetTrigger("interact"); } break; } } catch (Exception ex2) { LogAlways("[ANIM] TryPlayStationAnimation failed: " + ex2.Message); } } internal static void StartLocalAnimatorStateLogger(Player player, string tag, float seconds) { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)player == (Object)null)) { ((MonoBehaviour)Instance).StartCoroutine(LocalAnimatorStateLoggerCoroutine(player, tag, seconds)); } } [IteratorStateMachine(typeof(d__191))] private static IEnumerator LocalAnimatorStateLoggerCoroutine(Player player, string tag, float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__191(0) { player = player, tag = tag, seconds = seconds }; } internal static void StartVanillaGaldrStateLogger(Player player, CraftingStation station) { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)player == (Object)null) && !((Object)(object)station == (Object)null)) { if (_vanillaGaldrStateLoggerRoutine != null) { ((MonoBehaviour)Instance).StopCoroutine(_vanillaGaldrStateLoggerRoutine); _vanillaGaldrStateLoggerRoutine = null; } _vanillaGaldrStateLoggerRoutine = ((MonoBehaviour)Instance).StartCoroutine(VanillaGaldrStateLoggerCoroutine(player, station)); } } [IteratorStateMachine(typeof(d__193))] private static IEnumerator VanillaGaldrStateLoggerCoroutine(Player player, CraftingStation station) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__193(0) { player = player, station = station }; } internal static Sprite GetStatusIcon(ItemData weapon, BonusStationType type) { if (weapon != null && weapon.m_shared != null && weapon.m_shared.m_icons != null && weapon.m_shared.m_icons.Length != 0 && (Object)(object)weapon.m_shared.m_icons[0] != (Object)null) { return weapon.m_shared.m_icons[0]; } if ((Object)(object)ZNetScene.instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab(type switch { BonusStationType.Blessing => "piece_magetable_ext", BonusStationType.Forge => "forge_ext4", _ => "forge_ext3", }); if ((Object)(object)prefab != (Object)null) { Piece component = prefab.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.m_icon != (Object)null) { return component.m_icon; } } } return null; } internal static bool TryGetVisibleBonusWeapon(Player player, out ItemData weapon, out BonusStationType type) { weapon = null; type = BonusStationType.None; if ((Object)(object)player == (Object)null) { return false; } ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon == null) { return false; } float currentBonusPercent = GetCurrentBonusPercent(currentWeapon, BonusStationType.Reinforcement); float currentBonusPercent2 = GetCurrentBonusPercent(currentWeapon, BonusStationType.Forge); float currentBonusPercent3 = GetCurrentBonusPercent(currentWeapon, BonusStationType.Blessing); if (currentBonusPercent > 0f) { weapon = currentWeapon; type = BonusStationType.Reinforcement; return true; } if (currentBonusPercent2 > 0f) { weapon = currentWeapon; type = BonusStationType.Forge; return true; } if (currentBonusPercent3 > 0f) { weapon = currentWeapon; type = BonusStationType.Blessing; return true; } return false; } internal static void RemoveVisibleBonusStatus(SEMan seMan) { if (seMan != null && (Object)(object)_activeVisibleStatus != (Object)null) { seMan.RemoveStatusEffect(((StatusEffect)_activeVisibleStatus).NameHash(), true); } _activeVisibleStatus = null; _activeVisibleWeapon = null; _activeVisibleStatusType = BonusStationType.None; } internal static void UpdateVisibleBonusStatusVisuals(SE_HardheimTimedBonus effect, ItemData weapon, BonusStationType type) { if (!((Object)(object)effect == (Object)null) && weapon != null && type != 0) { float currentBonusPercent = GetCurrentBonusPercent(weapon, type); Sprite statusIcon = GetStatusIcon(weapon, type); if ((Object)(object)statusIcon != (Object)null) { ((StatusEffect)effect).m_icon = statusIcon; } ((StatusEffect)effect).m_name = GetStatusNameForType(type); effect.BonusType = type; ((StatusEffect)effect).m_tooltip = string.Format(CultureInfo.InvariantCulture, "{0}\nAktuális sebzésbónusz: +{1:0.##}%\nHátralévő idő: {2}", GetItemName(weapon), currentBonusPercent, GetTimeRemainingText(weapon, type)); if (TryGetUtcCustomData(weapon, GetDataKeyForType(type), out var utc)) { effect.ExpireUtcTicks = utc.Ticks; } } } internal static void RefreshVisibleBonusStatus(Player player) { RefreshVisibleBonusStatus(player, forceImmediate: false); } internal static void RefreshVisibleBonusStatus(Player player, bool forceImmediate) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) SEMan val = ((player != null) ? ((Character)player).GetSEMan() : null); if (val == null) { return; } CleanupExpiredBonusData(player); if (!TryGetVisibleBonusWeapon(player, out var weapon, out var type)) { RemoveVisibleBonusStatus(val); } else if ((Object)(object)_activeVisibleStatus == (Object)null || _activeVisibleWeapon == null || _activeVisibleWeapon != weapon || _activeVisibleStatusType != type) { RemoveVisibleBonusStatus(val); SE_HardheimTimedBonus sE_HardheimTimedBonus = ScriptableObject.CreateInstance(); ((Object)sE_HardheimTimedBonus).name = type switch { BonusStationType.Blessing => "HardheimWeaponReinforcementBlessedSE", BonusStationType.Forge => "HardheimWeaponReinforcementForgedSE", _ => "HardheimWeaponReinforcementReinforcedSE", }; ((StatusEffect)sE_HardheimTimedBonus).m_name = GetStatusNameForType(type); ((StatusEffect)sE_HardheimTimedBonus).m_tooltip = string.Empty; ((StatusEffect)sE_HardheimTimedBonus).m_icon = GetStatusIcon(weapon, type); ((StatusEffect)sE_HardheimTimedBonus).m_ttl = 31536000f; ((StatusEffect)sE_HardheimTimedBonus).m_startMessage = string.Empty; ((StatusEffect)sE_HardheimTimedBonus).m_stopMessage = string.Empty; ((StatusEffect)sE_HardheimTimedBonus).m_startMessageType = (MessageType)1; ((StatusEffect)sE_HardheimTimedBonus).m_stopMessageType = (MessageType)1; sE_HardheimTimedBonus.BonusType = type; StatusEffect val2 = val.AddStatusEffect((StatusEffect)(object)sE_HardheimTimedBonus, false, 0, 0f); _activeVisibleStatus = val2 as SE_HardheimTimedBonus; _activeVisibleWeapon = weapon; _activeVisibleStatusType = type; if ((Object)(object)_activeVisibleStatus != (Object)null) { UpdateVisibleBonusStatusVisuals(_activeVisibleStatus, weapon, type); } } else if ((Object)(object)_activeVisibleStatus != (Object)null) { UpdateVisibleBonusStatusVisuals(_activeVisibleStatus, weapon, type); if (forceImmediate) { LogDebug("Visible status force refreshed."); } } } internal static void PeriodicStatusRefresh() { if (IsModEnabled() && !((Object)(object)Player.m_localPlayer == (Object)null) && !(Time.time < _nextStatusRefreshTime)) { _nextStatusRefreshTime = Time.time + 0.2f; RefreshVisibleBonusStatus(Player.m_localPlayer); } } internal static bool ShouldLogEmoteParam(string value) { return _emoteLoggingEnabled && !string.IsNullOrEmpty(value) && value.StartsWith("emote_", StringComparison.Ordinal); } internal static void SuppressBlessingCameraShakeFor(float seconds) { if (!(seconds <= 0f)) { _suppressBlessingCameraShakeUntil = Mathf.Max(_suppressBlessingCameraShakeUntil, Time.time + seconds); } } internal static bool ShouldSuppressBlessingCameraShake() { return Time.time < _suppressBlessingCameraShakeUntil; } internal static void RegisterStationProcessRpc(Component stationComponent) { if ((Object)(object)stationComponent == (Object)null) { return; } ZNetView componentInParent = stationComponent.GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return; } int instanceID = ((Object)componentInParent).GetInstanceID(); if (_registeredStationRpcObjects.Contains(instanceID)) { return; } try { Transform stationTransform = stationComponent.transform; componentInParent.Register("HH_WR_StationProcess", (Action)delegate(long sender, long playerId, int typeInt, bool active) { RPC_StationProcess(stationTransform, sender, playerId, typeInt, active); }); _registeredStationRpcObjects.Add(instanceID); LogDebug("[NET PROCESS] Station RPC registered on " + ((Object)stationComponent.gameObject).name + " instanceId=" + instanceID); } catch (Exception ex) { LogDebug("[NET PROCESS] RegisterStationProcessRpc failed: " + ex.Message); } } internal static void BroadcastStationProcess(Player player, Transform stationTransform, BonusStationType type, bool active) { if ((Object)(object)player == (Object)null || (Object)(object)stationTransform == (Object)null || type == BonusStationType.None) { return; } ZNetView componentInParent = ((Component)stationTransform).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsValid()) { LogDebug("[NET PROCESS] Broadcast skipped: station has no valid ZNetView"); return; } try { componentInParent.InvokeRPC(ZNetView.Everybody, "HH_WR_StationProcess", new object[3] { player.GetPlayerID(), (int)type, active }); LogDebug("[NET PROCESS] Broadcast station process playerId=" + player.GetPlayerID() + " type=" + type.ToString() + " active=" + active); } catch (Exception ex) { LogDebug("[NET PROCESS] BroadcastStationProcess failed: " + ex.Message); } } private static void RPC_StationProcess(Transform stationTransform, long sender, long playerId, int typeInt, bool active) { if ((Object)(object)Instance == (Object)null || (Object)(object)stationTransform == (Object)null) { return; } BonusStationType bonusStationType = (BonusStationType)typeInt; if (playerId == 0L || bonusStationType == BonusStationType.None) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && localPlayer.GetPlayerID() == playerId) { return; } StopRemoteStationProcess(playerId, resetAnimator: false); if (!active) { StopRemoteStationProcess(playerId, resetAnimator: true); LogDebug("[NET PROCESS] Remote stop received playerId=" + playerId + " type=" + bonusStationType); return; } if (bonusStationType == BonusStationType.Blessing) { _blessingPoseLockedThisProcess = false; _blessingAnimatorDisabledThisProcess = false; } Coroutine value = ((MonoBehaviour)Instance).StartCoroutine(RemoteStationProcessCoroutine(playerId, stationTransform, bonusStationType)); _remoteProcessRoutines[playerId] = value; LogDebug("[NET PROCESS] Remote start received playerId=" + playerId + " type=" + bonusStationType); } [IteratorStateMachine(typeof(d__207))] private static IEnumerator RemoteStationProcessCoroutine(long playerId, Transform stationTransform, BonusStationType type) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__207(0) { playerId = playerId, stationTransform = stationTransform, type = type }; } private static Player FindPlayerById(long playerId) { if (playerId == 0) { return null; } try { Player[] array = Object.FindObjectsByType((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && array[i].GetPlayerID() == playerId) { return array[i]; } } } catch { } return null; } private static void TryPlayRemoteStationAnimation(Player player, BonusStationType type, ref bool reinforcementStarted, ref bool blessingStarted) { if ((Object)(object)player == (Object)null) { return; } try { Animator componentInChildren = ((Component)player).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return; } ((Behaviour)componentInChildren).enabled = true; componentInChildren.SetBool("moving", false); componentInChildren.SetFloat("forward_speed", 0f); componentInChildren.SetFloat("sideway_speed", 0f); switch (type) { case BonusStationType.Forge: componentInChildren.SetInteger("crafting", 2); break; case BonusStationType.Blessing: componentInChildren.SetInteger("crafting", 0); componentInChildren.SetBool("moving", false); if (!blessingStarted) { blessingStarted = true; try { TryStopPlayerEmote(player); } catch { } componentInChildren.ResetTrigger("emote_cheer"); LogDebug("[NET PROCESS] Remote blessing cheer/emote skipped to avoid vanilla boom/shake."); } break; default: componentInChildren.SetInteger("crafting", 1); if (!reinforcementStarted) { reinforcementStarted = true; componentInChildren.ResetTrigger("interact"); componentInChildren.ResetTrigger("attack"); componentInChildren.ResetTrigger("attack_abort"); componentInChildren.ResetTrigger("swing_hammer"); componentInChildren.SetTrigger("interact"); } break; } } catch (Exception ex) { LogDebug("[NET PROCESS] TryPlayRemoteStationAnimation failed: " + ex.Message); } } private static void StopRemoteStationProcess(long playerId, bool resetAnimator) { try { if (_remoteProcessRoutines.TryGetValue(playerId, out var value) && value != null && (Object)(object)Instance != (Object)null) { ((MonoBehaviour)Instance).StopCoroutine(value); } _remoteProcessRoutines.Remove(playerId); } catch { } StopRemoteAudioLoop(playerId); if (!resetAnimator) { return; } Player val = FindPlayerById(playerId); if ((Object)(object)val == (Object)null) { return; } try { TryStopPlayerEmote(val); Animator componentInChildren = ((Component)val).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { ((Behaviour)componentInChildren).enabled = true; componentInChildren.speed = 1f; componentInChildren.ResetTrigger("interact"); componentInChildren.ResetTrigger("attack"); componentInChildren.ResetTrigger("attack_abort"); componentInChildren.ResetTrigger("swing_hammer"); componentInChildren.ResetTrigger("emote_cheer"); componentInChildren.ResetTrigger("emote_stop"); componentInChildren.SetBool("moving", false); componentInChildren.SetFloat("forward_speed", 0f); componentInChildren.SetFloat("sideway_speed", 0f); componentInChildren.SetInteger("crafting", 0); componentInChildren.Update(0f); } } catch { } } [IteratorStateMachine(typeof(d__211))] private static IEnumerator StartRemoteProcessSound(long playerId, Player player, Transform stationTransform, BonusStationType type) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__211(0) { playerId = playerId, player = player, stationTransform = stationTransform, type = type }; } private static void StartRemoteCustomAudioLoop(long playerId, AudioClip clip, Vector3 position, float volume, string objectName) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clip == (Object)null) { return; } try { StopRemoteAudioLoop(playerId); GameObject val = new GameObject(objectName + "_" + playerId); val.transform.position = position; AudioSource val2 = val.AddComponent(); val2.clip = clip; val2.loop = true; val2.spatialBlend = 1f; val2.volume = volume; val2.minDistance = 2f; val2.maxDistance = 16f; val2.rolloffMode = (AudioRolloffMode)1; val2.Play(); _remoteAudioObjects[playerId] = val; } catch (Exception ex) { LogDebug("[NET PROCESS] StartRemoteCustomAudioLoop failed: " + ex.Message); } } private static void UpdateRemoteAudioLoopPosition(long playerId, Vector3 position) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) try { if (_remoteAudioObjects.TryGetValue(playerId, out var value) && (Object)(object)value != (Object)null) { value.transform.position = position; } } catch { } } private static void StopRemoteAudioLoop(long playerId) { try { if (_remoteAudioObjects.TryGetValue(playerId, out var value) && (Object)(object)value != (Object)null) { AudioSource component = value.GetComponent(); if ((Object)(object)component != (Object)null) { component.Stop(); } Object.Destroy((Object)(object)value); } } catch { } _remoteAudioObjects.Remove(playerId); } internal static void TryStopPlayerEmote(Player player) { if ((Object)(object)player == (Object)null) { return; } try { MethodInfo methodInfo = AccessTools.Method(typeof(Player), "StopEmote", (Type[])null, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(player, null); } } catch (Exception ex) { LogDebug("[BLESSING] StopEmote reflection failed: " + ex.Message); } } } public class SE_HardheimTimedBonus : StatusEffect { public long ExpireUtcTicks; public HardheimWeaponReinforcementPlugin.BonusStationType BonusType = HardheimWeaponReinforcementPlugin.BonusStationType.None; public override string GetIconText() { if (ExpireUtcTicks <= 0) { return string.Empty; } DateTime dateTime; try { dateTime = new DateTime(ExpireUtcTicks, DateTimeKind.Utc); } catch { return string.Empty; } TimeSpan remaining = dateTime - DateTime.UtcNow; if (remaining.TotalSeconds <= 0.0) { return "0:00:00"; } return HardheimWeaponReinforcementPlugin.FormatTimeRemainingHMS(remaining); } public override bool IsDone() { return false; } } public class GrindingWheelInteract : MonoBehaviour, Interactable { private void Awake() { HardheimWeaponReinforcementPlugin.RegisterStationProcessRpc((Component)(object)this); } private void Start() { HardheimWeaponReinforcementPlugin.RegisterStationProcessRpc((Component)(object)this); } public bool Interact(Humanoid user, bool hold, bool alt) { if (!HardheimWeaponReinforcementPlugin.IsModEnabled() || hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null) { return false; } if (!HardheimWeaponReinforcementPlugin.IsGrindingWheelObject((Component)(object)this)) { return false; } if (!HardheimWeaponReinforcementPlugin.CanProcessCurrentWeapon(val, HardheimWeaponReinforcementPlugin.BonusStationType.Reinforcement, out var weapon)) { return false; } return HardheimWeaponReinforcementPlugin.StartProcess(val, weapon, ((Component)this).transform, HardheimWeaponReinforcementPlugin.BonusStationType.Reinforcement); } public bool UseItem(Humanoid user, ItemData item) { return false; } } public class AnvilInteract : MonoBehaviour, Interactable { private void Awake() { HardheimWeaponReinforcementPlugin.RegisterStationProcessRpc((Component)(object)this); } private void Start() { HardheimWeaponReinforcementPlugin.RegisterStationProcessRpc((Component)(object)this); } public bool Interact(Humanoid user, bool hold, bool alt) { if (!HardheimWeaponReinforcementPlugin.IsModEnabled() || hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null) { return false; } if (!HardheimWeaponReinforcementPlugin.IsAnvilObject((Component)(object)this)) { return false; } if (!HardheimWeaponReinforcementPlugin.CanProcessCurrentWeapon(val, HardheimWeaponReinforcementPlugin.BonusStationType.Forge, out var weapon)) { return false; } return HardheimWeaponReinforcementPlugin.StartProcess(val, weapon, ((Component)this).transform, HardheimWeaponReinforcementPlugin.BonusStationType.Forge); } public bool UseItem(Humanoid user, ItemData item) { return false; } } public class RuneTableInteract : MonoBehaviour, Interactable { private void Awake() { HardheimWeaponReinforcementPlugin.RegisterStationProcessRpc((Component)(object)this); } private void Start() { HardheimWeaponReinforcementPlugin.RegisterStationProcessRpc((Component)(object)this); } public bool Interact(Humanoid user, bool hold, bool alt) { if (!HardheimWeaponReinforcementPlugin.IsModEnabled() || hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null) { return false; } HardheimWeaponReinforcementPlugin.LogDebug("[BLESSING] RuneTableInteract.Interact called"); if (!HardheimWeaponReinforcementPlugin.IsRuneTableObject((Component)(object)this)) { HardheimWeaponReinforcementPlugin.LogDebug("[BLESSING] IsRuneTableObject returned false"); return false; } if (!HardheimWeaponReinforcementPlugin.CanProcessCurrentWeapon(val, HardheimWeaponReinforcementPlugin.BonusStationType.Blessing, out var weapon)) { HardheimWeaponReinforcementPlugin.LogDebug("[BLESSING] CanProcessCurrentWeapon returned false"); return false; } HardheimWeaponReinforcementPlugin.LogDebug("[BLESSING] Starting blessing process with weapon: " + HardheimWeaponReinforcementPlugin.GetItemName(weapon)); return HardheimWeaponReinforcementPlugin.StartProcess(val, weapon, ((Component)this).transform, HardheimWeaponReinforcementPlugin.BonusStationType.Blessing); } public bool UseItem(Humanoid user, ItemData item) { return false; } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class ZNetScene_Awake_AddStationInteracts_Patch { private static void Postfix(ZNetScene __instance) { if (HardheimWeaponReinforcementPlugin.IsModEnabled() && !((Object)(object)__instance == (Object)null)) { GameObject prefab = __instance.GetPrefab("forge_ext3"); if ((Object)(object)prefab != (Object)null && (Object)(object)prefab.GetComponent() == (Object)null) { prefab.AddComponent(); HardheimWeaponReinforcementPlugin.LogDebug("[REINFORCEMENT] GrindingWheelInteract added"); } GameObject prefab2 = __instance.GetPrefab("forge_ext4"); if ((Object)(object)prefab2 != (Object)null && (Object)(object)prefab2.GetComponent() == (Object)null) { prefab2.AddComponent(); HardheimWeaponReinforcementPlugin.LogDebug("[FORGE] AnvilInteract added"); } GameObject prefab3 = __instance.GetPrefab("piece_magetable_ext"); if ((Object)(object)prefab3 != (Object)null && (Object)(object)prefab3.GetComponent() == (Object)null) { prefab3.AddComponent(); HardheimWeaponReinforcementPlugin.LogDebug("[BLESSING] RuneTableInteract added"); } } } } [HarmonyPatch(typeof(CraftingStation), "Interact")] public static class CraftingStation_Interact_VanillaGaldrLogger_Patch { private static void Prefix(CraftingStation __instance, Humanoid user, bool repeat, bool alt) { try { string text = (((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject != (Object)null) ? ((Object)((Component)__instance).gameObject).name : "null"); Piece val = (((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent() : null); string text2 = (((Object)(object)val != (Object)null) ? val.m_name : string.Empty); text = text.Replace("(Clone)", string.Empty).Trim(); if (string.Equals(text, "piece_magetable", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "$piece_magetable", StringComparison.OrdinalIgnoreCase)) { HardheimWeaponReinforcementPlugin.LogDebug("[VANILLA GALDR] Prefix hit. objectName=" + text + " pieceName=" + text2 + " repeat=" + repeat + " alt=" + alt); } } catch (Exception ex) { HardheimWeaponReinforcementPlugin.LogDebug("[VANILLA GALDR] Prefix failed: " + ex.Message); } } private static void Postfix(CraftingStation __instance, Humanoid user, bool repeat, bool alt, ref bool __result) { if (!__result || repeat) { return; } Player val = (Player)(object)((user is Player) ? user : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)__instance == (Object)null)) { string text = (((Object)(object)((Component)__instance).gameObject != (Object)null) ? ((Object)((Component)__instance).gameObject).name : string.Empty); Piece component = ((Component)__instance).GetComponent(); string text2 = (((Object)(object)component != (Object)null) ? component.m_name : string.Empty); text = text.Replace("(Clone)", string.Empty).Trim(); if (string.Equals(text, "piece_magetable", StringComparison.OrdinalIgnoreCase) || string.Equals(text2, "$piece_magetable", StringComparison.OrdinalIgnoreCase)) { HardheimWeaponReinforcementPlugin.LogDebug("[VANILLA GALDR] CraftingStation.Interact fired. objectName=" + text + " pieceName=" + text2); HardheimWeaponReinforcementPlugin.StartVanillaGaldrStateLogger(val, __instance); } } } } [HarmonyPatch(typeof(Animator), "SetTrigger", new Type[] { typeof(string) })] public static class Animator_SetTrigger_String_EmoteLogger_Patch { private static void Prefix(Animator __instance, string name) { if (HardheimWeaponReinforcementPlugin.ShouldLogEmoteParam(name)) { HardheimWeaponReinforcementPlugin.LogDebug("[VANILLA EMOTE] SetTrigger(string): " + name); } } } [HarmonyPatch(typeof(Animator), "SetBool", new Type[] { typeof(string), typeof(bool) })] public static class Animator_SetBool_String_EmoteLogger_Patch { private static void Prefix(Animator __instance, string name, bool value) { if (HardheimWeaponReinforcementPlugin.ShouldLogEmoteParam(name)) { HardheimWeaponReinforcementPlugin.LogDebug("[VANILLA EMOTE] SetBool(string): " + name + " = " + value); } } } [HarmonyPatch(typeof(Hud), "Update")] public static class Hud_Update_BonusStatusRefresh_Patch { private static void Postfix() { HardheimWeaponReinforcementPlugin.PeriodicStatusRefresh(); } } [HarmonyPatch(typeof(SEMan), "ModifyAttack")] public static class SEMan_ModifyAttack_BonusPatch { private static void Prefix(SEMan __instance, ref HitData hitData) { //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) //IL_00ce: 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_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) if (!HardheimWeaponReinforcementPlugin.IsModEnabled() || __instance == null) { return; } Character value = Traverse.Create((object)__instance).Field("m_character").GetValue(); Player val = (Player)(object)((value is Player) ? value : null); if ((Object)(object)val == (Object)null) { return; } ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon(); if (currentWeapon != null) { float currentBonusMultiplier = HardheimWeaponReinforcementPlugin.GetCurrentBonusMultiplier(currentWeapon, HardheimWeaponReinforcementPlugin.BonusStationType.Reinforcement); if (currentBonusMultiplier > 1f) { DamageTypes damage = hitData.m_damage; damage.m_slash *= currentBonusMultiplier; damage.m_pierce *= currentBonusMultiplier; damage.m_chop *= currentBonusMultiplier; damage.m_pickaxe *= currentBonusMultiplier; } float currentBonusMultiplier2 = HardheimWeaponReinforcementPlugin.GetCurrentBonusMultiplier(currentWeapon, HardheimWeaponReinforcementPlugin.BonusStationType.Forge); if (currentBonusMultiplier2 > 1f) { DamageTypes damage2 = hitData.m_damage; damage2.m_blunt *= currentBonusMultiplier2; } float currentBonusMultiplier3 = HardheimWeaponReinforcementPlugin.GetCurrentBonusMultiplier(currentWeapon, HardheimWeaponReinforcementPlugin.BonusStationType.Blessing); if (currentBonusMultiplier3 > 1f && HardheimWeaponReinforcementPlugin.IsElementalStaffWeapon(currentWeapon)) { DamageTypes damage3 = hitData.m_damage; damage3.m_fire *= currentBonusMultiplier3; damage3.m_frost *= currentBonusMultiplier3; damage3.m_lightning *= currentBonusMultiplier3; damage3.m_spirit *= currentBonusMultiplier3; damage3.m_poison *= currentBonusMultiplier3; } } } } [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(ItemData), typeof(int), typeof(bool), typeof(float), typeof(int) })] public static class ItemDrop_ItemData_GetTooltip_BonusPatch { private static void Postfix(ItemData item, ref string __result) { if (HardheimWeaponReinforcementPlugin.IsModEnabled() && item != null && HardheimWeaponReinforcementPlugin.IsAnySupportedWeapon(item)) { __result = HardheimWeaponReinforcementPlugin.ApplyBonusDamageTooltip(__result, item); HardheimWeaponReinforcementPlugin.AppendBonusTooltipInfo(ref __result, item); } } } [HarmonyPatch(typeof(Hud), "UpdateCrosshair")] public static class Hud_UpdateCrosshair_BonusPatch { private static void Postfix(Hud __instance, Player player) { if (!HardheimWeaponReinforcementPlugin.IsModEnabled() || (Object)(object)player == (Object)null) { return; } GameObject hoverObject = ((Humanoid)player).GetHoverObject(); if ((Object)(object)hoverObject == (Object)null) { return; } string text = null; if (HardheimWeaponReinforcementPlugin.IsGrindingWheelObject(hoverObject)) { text = HardheimWeaponReinforcementPlugin.GetStationHoverText((Component)(object)hoverObject.transform, HardheimWeaponReinforcementPlugin.BonusStationType.Reinforcement); } else if (HardheimWeaponReinforcementPlugin.IsAnvilObject(hoverObject)) { text = HardheimWeaponReinforcementPlugin.GetStationHoverText((Component)(object)hoverObject.transform, HardheimWeaponReinforcementPlugin.BonusStationType.Forge); } else if (HardheimWeaponReinforcementPlugin.IsRuneTableObject(hoverObject)) { text = HardheimWeaponReinforcementPlugin.GetStationHoverText((Component)(object)hoverObject.transform, HardheimWeaponReinforcementPlugin.BonusStationType.Blessing); } if (string.IsNullOrEmpty(text)) { return; } bool flag = false; try { TMP_Text value = Traverse.Create((object)__instance).Field("m_hoverName").GetValue(); if ((Object)(object)value != (Object)null) { value.text = text; flag = true; } } catch { } try { Text value2 = Traverse.Create((object)__instance).Field("m_hoverName").GetValue(); if ((Object)(object)value2 != (Object)null) { value2.text = text; flag = true; } } catch { } try { TMP_Text value3 = Traverse.Create((object)__instance).Field("m_hoverText").GetValue(); if ((Object)(object)value3 != (Object)null) { value3.text = string.Empty; } } catch { } try { Text value4 = Traverse.Create((object)__instance).Field("m_hoverText").GetValue(); if ((Object)(object)value4 != (Object)null) { value4.text = string.Empty; } } catch { } if (!flag) { HardheimWeaponReinforcementPlugin.LogDebug("Hover text field not found."); } } } [HarmonyPatch] public static class HardheimWeaponReinforcement_SuppressBlessingCameraShakePatch { [CompilerGenerated] private sealed class d__0 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private MethodBase <>2__current; private int <>l__initialThreadId; private string[] 5__1; private int 5__2; private Type 5__3; private MethodInfo[] 5__4; private int 5__5; private MethodInfo 5__6; MethodBase IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__3 = null; 5__4 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00fb; } <>1__state = -1; 5__1 = new string[2] { "GameCamera", "CameraShaker" }; 5__2 = 0; goto IL_014f; IL_00fb: 5__6 = null; goto IL_0103; IL_0103: int num2 = 5__5 + 1; 5__5 = num2; goto IL_0115; IL_0115: if (5__5 < 5__4.Length) { 5__6 = 5__4[5__5]; if (5__6 == null) { goto IL_0103; } if (5__6.Name.IndexOf("Shake", StringComparison.OrdinalIgnoreCase) >= 0) { <>2__current = 5__6; <>1__state = 1; return true; } goto IL_00fb; } 5__3 = null; 5__4 = null; goto IL_013d; IL_013d: num2 = 5__2 + 1; 5__2 = num2; goto IL_014f; IL_014f: if (5__2 < 5__1.Length) { 5__3 = AccessTools.TypeByName(5__1[5__2]); if (5__3 == null) { goto IL_013d; } 5__4 = 5__3.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); 5__5 = 0; goto IL_0115; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__0(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [IteratorStateMachine(typeof(d__0))] private static IEnumerable TargetMethods() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(-2); } private static bool Prefix() { return !HardheimWeaponReinforcementPlugin.ShouldSuppressBlessingCameraShake(); } }