using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net.Security; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using Characters; using Characters.Abilities; using Characters.Gear; using Characters.Gear.Items; using Characters.Gear.Synergy; using Characters.Gear.Synergy.Inscriptions; using Characters.Gear.Upgrades; using Characters.Gear.Weapons; using Characters.Player; using ChzzkSkul; using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks.CompilerServices; using GameResources; using HarmonyLib; using Level; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Services; using Singletons; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using WebSocketSharp; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class BypassCertificate : CertificateHandler { public override bool ValidateCertificate(byte[] certificateData) { return true; } } public class ChzzkUnity : MonoBehaviour { private enum SslProtocolsHack { Tls = 192, Tls11 = 768, Tls12 = 3072 } [Serializable] public class LiveStatus { [Serializable] public class Content { public string liveTitle; public string status; public int concurrentUserCount; public int accumulateCount; public bool paidPromotion; public bool adult; public string chatChannelId; public string categoryType; public string liveCategory; public string liveCategoryValue; public string livePollingStatusJson; public string faultStatus; public string userAdultStatus; public bool chatActive; public string chatAvailableGroup; public string chatAvailableCondition; public int minFollowerMinute; } public int code; public string message; public Content content; } [Serializable] public class AccessTokenResult { [Serializable] public class Content { [Serializable] public class TemporaryRestrict { public bool temporaryRestrict; public int times; public int duration; public int createdTime; } public string accessToken; public bool realNameAuth; public string extraToken; } public int code; public string message; public Content content; } [Serializable] public class Profile { [Serializable] public class StreamingProperty { } public string userIdHash; public string nickname; public string profileImageUrl; public string userRoleCode; public string badge; public string title; public string verifiedMark; public List activityBadges; public StreamingProperty streamingProperty; } [Serializable] public class SubscriptionExtras { public int month; public string tierName; public string nickname; public int tierNo; } [Serializable] public class DonationExtras { [Serializable] public class WeeklyRank { public string userIdHash; public string nickName; public bool verifiedMark; public int donationAmount; public int ranking; } private object emojis; public bool isAnonymous; public string payType; public int payAmount; public string streamingChannelId; public string nickname; public string osType; public string donationType; public List weeklyRankList; public WeeklyRank donationUserWeeklyRank; } [Serializable] public class ChannelInfo { [Serializable] public class Content { public string channelId; public string channelName; public string channelImageUrl; public bool verifiedMark; public string channelType; public string channelDescription; public int followerCount; public bool openLive; } public int code; public string message; public Content content; } [CompilerGenerated] private sealed class d__31 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public ChzzkUnity <>4__this; private LiveStatus 5__1; private AccessTokenResult 5__2; private SslProtocols 5__3; private LiveStatus <>s__4; private AccessTokenResult <>s__5; private Exception 5__6; private Awaiter <>u__1; private Awaiter <>u__2; private Awaiter <>u__3; private void MoveNext() { //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { Awaiter awaiter; if ((uint)num > 1u && num == 2) { awaiter = <>u__3; <>u__3 = default(Awaiter); num = (<>1__state = -1); goto IL_04f9; } try { Awaiter awaiter2; Awaiter awaiter3; if (num != 0) { if (num == 1) { awaiter2 = <>u__2; <>u__2 = default(Awaiter); num = (<>1__state = -1); goto IL_0233; } if (<>4__this.socket != null && <>4__this.socket.IsAlive) { <>4__this.socket.Close(); <>4__this.socket = null; } Debug.Log((object)("[ChzzkUnity] Connecting to channel: " + <>4__this.channel)); awaiter3 = <>4__this.GetLiveStatus(<>4__this.channel).GetAwaiter(); if (!awaiter3.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter3; d__31 d__ = this; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted, d__31>(ref awaiter3, ref d__); return; } } else { awaiter3 = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); } <>s__4 = awaiter3.GetResult(); 5__1 = <>s__4; <>s__4 = null; if (5__1 == null) { Debug.LogError((object)"[ChzzkUnity] 라이브 상태 데이터를 가져오지 못했습니다. 연결을 중단합니다."); } else if (5__1.content == null) { Debug.LogError((object)$"[ChzzkUnity] 라이브 상태 content가 null입니다. (코드: {5__1.code}, 메시지: {5__1.message}). 연결을 중단합니다."); } else { <>4__this.cid = 5__1.content.chatChannelId; if (!string.IsNullOrEmpty(<>4__this.cid)) { awaiter2 = <>4__this.GetAccessToken(<>4__this.cid).GetAwaiter(); if (!awaiter2.IsCompleted) { num = (<>1__state = 1); <>u__2 = awaiter2; d__31 d__ = this; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted, d__31>(ref awaiter2, ref d__); return; } goto IL_0233; } Debug.LogError((object)"[ChzzkUnity] chatChannelId가 비어있습니다. 방송이 켜져있지 않거나 채널 ID가 틀렸습니다. 연결을 중단합니다."); } goto end_IL_001c; IL_0233: <>s__5 = awaiter2.GetResult(); 5__2 = <>s__5; <>s__5 = null; if (5__2 == null) { Debug.LogError((object)"[ChzzkUnity] 액세스 토큰 데이터를 가져오지 못했습니다. 연결을 중단합니다."); } else if (5__2.content == null) { Debug.LogError((object)$"[ChzzkUnity] 액세스 토큰 content가 null입니다. (코드: {5__2.code}, 메시지: {5__2.message}). 연결을 중단합니다."); } else { <>4__this.token = 5__2.content.accessToken; if (!string.IsNullOrEmpty(<>4__this.token)) { <>4__this.socket = new WebSocket("wss://kr-ss3.chat.naver.com/chat", Array.Empty()); <>4__this.socket.Log.Output = delegate { }; 5__3 = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12; <>4__this.socket.SslConfiguration.EnabledSslProtocols = 5__3; <>4__this.socket.SslConfiguration.ServerCertificateValidationCallback = (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) => true; <>4__this.socket.OnMessage += <>4__this.ParseMessage; <>4__this.socket.OnClose += <>4__this.CloseConnect; <>4__this.socket.OnOpen += <>4__this.StartChat; <>4__this.socket.OnError += delegate(object sender, ErrorEventArgs e) { Debug.LogError((object)("[ChzzkUnity] WebSocket 오류: " + e.Message)); }; <>4__this.socket.ConnectAsync(); Debug.Log((object)("[ChzzkUnity] WebSocket 연결 요청 완료 (채널 ID: " + <>4__this.cid + ")")); 5__1 = null; 5__2 = null; goto IL_04a1; } Debug.LogError((object)"[ChzzkUnity] 액세스 토큰 값이 비어있습니다. 연결을 중단합니다."); } end_IL_001c:; } catch (Exception ex) { 5__6 = ex; Debug.LogError((object)$"[ChzzkUnity] Connect 중 치명적 예외 발생: {5__6}"); goto IL_04a1; } goto end_IL_0007; IL_04a1: awaiter = ((UniTask)(ref UniTask.CompletedTask)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 2); <>u__3 = awaiter; d__31 d__ = this; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompletedd__31>(ref awaiter, ref d__); return; } goto IL_04f9; IL_04f9: ((Awaiter)(ref awaiter)).GetResult(); end_IL_0007:; } catch (Exception ex) { <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(ex); return; } <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class d__30 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public string cid; public ChzzkUnity <>4__this; private string 5__1; private UnityWebRequest 5__2; private AccessTokenResult 5__3; private Exception 5__4; private Awaiter <>u__1; private void MoveNext() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; AccessTokenResult result; try { if (num != 0) { 5__1 = "https://comm-api.game.naver.com/nng_main/v1/chats/access-token?channelId=" + cid + "&chatType=STREAMING"; 5__2 = UnityWebRequest.Get(5__1); } try { if (num != 0) { 5__2.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); 5__2.SendWebRequest(); 5__3 = null; goto IL_00cf; } Awaiter awaiter = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_00c6; IL_00c6: ((Awaiter)(ref awaiter)).GetResult(); goto IL_00cf; IL_00cf: if (!5__2.isDone) { YieldAwaitable val = UniTask.Yield(); awaiter = ((YieldAwaitable)(ref val)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; d__30 d__ = this; <>t__builder.AwaitUnsafeOnCompletedd__30>(ref awaiter, ref d__); return; } goto IL_00c6; } if ((int)5__2.result == 1) { try { 5__3 = JsonConvert.DeserializeObject(5__2.downloadHandler.text); Debug.Log((object)("[ChzzkUnity] GetAccessToken 성공: " + 5__2.downloadHandler.text)); } catch (Exception ex) { 5__4 = ex; Debug.LogError((object)("[ChzzkUnity] GetAccessToken JSON 파싱 실패: " + 5__4.Message)); } } else { Debug.LogError((object)("[ChzzkUnity] GetAccessToken HTTP 요청 실패: " + 5__2.error + " (URL: " + 5__1 + ")")); } result = 5__3; } finally { if (num < 0 && 5__2 != null) { ((IDisposable)5__2).Dispose(); } } } catch (Exception ex) { <>1__state = -2; 5__1 = null; <>t__builder.SetException(ex); return; } <>1__state = -2; 5__1 = null; <>t__builder.SetResult(result); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class d__28 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public string channelId; public ChzzkUnity <>4__this; private string 5__1; private UnityWebRequest 5__2; private ChannelInfo 5__3; private Awaiter <>u__1; private void MoveNext() { //IL_00a6: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00ea: Invalid comparison between Unknown and I4 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; ChannelInfo result; try { if (num != 0) { 5__1 = "https://api.chzzk.naver.com/service/v1/channels/" + channelId; 5__2 = UnityWebRequest.Get(5__1); } try { if (num != 0) { 5__2.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); 5__2.SendWebRequest(); 5__3 = null; goto IL_00ca; } Awaiter awaiter = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_00c1; IL_00c1: ((Awaiter)(ref awaiter)).GetResult(); goto IL_00ca; IL_00ca: if (!5__2.isDone) { YieldAwaitable val = UniTask.Yield(); awaiter = ((YieldAwaitable)(ref val)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; d__28 d__ = this; <>t__builder.AwaitUnsafeOnCompletedd__28>(ref awaiter, ref d__); return; } goto IL_00c1; } if ((int)5__2.result == 1) { 5__3 = JsonConvert.DeserializeObject(5__2.downloadHandler.text); } result = 5__3; } finally { if (num < 0 && 5__2 != null) { ((IDisposable)5__2).Dispose(); } } } catch (Exception exception) { <>1__state = -2; 5__1 = null; <>t__builder.SetException(exception); return; } <>1__state = -2; 5__1 = null; <>t__builder.SetResult(result); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class d__29 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public string channelId; public ChzzkUnity <>4__this; private string 5__1; private UnityWebRequest 5__2; private LiveStatus 5__3; private Exception 5__4; private Awaiter <>u__1; private void MoveNext() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; LiveStatus result; try { if (num != 0) { 5__1 = "https://api.chzzk.naver.com/polling/v2/channels/" + channelId + "/live-status"; 5__2 = UnityWebRequest.Get(5__1); } try { if (num != 0) { 5__2.certificateHandler = (CertificateHandler)(object)new BypassCertificate(); 5__2.SendWebRequest(); 5__3 = null; goto IL_00cf; } Awaiter awaiter = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_00c6; IL_00c6: ((Awaiter)(ref awaiter)).GetResult(); goto IL_00cf; IL_00cf: if (!5__2.isDone) { YieldAwaitable val = UniTask.Yield(); awaiter = ((YieldAwaitable)(ref val)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; d__29 d__ = this; <>t__builder.AwaitUnsafeOnCompletedd__29>(ref awaiter, ref d__); return; } goto IL_00c6; } if ((int)5__2.result == 1) { try { 5__3 = JsonConvert.DeserializeObject(5__2.downloadHandler.text); Debug.Log((object)("[ChzzkUnity] GetLiveStatus 성공: " + 5__2.downloadHandler.text)); } catch (Exception ex) { 5__4 = ex; Debug.LogError((object)("[ChzzkUnity] GetLiveStatus JSON 파싱 실패: " + 5__4.Message)); } } else { Debug.LogError((object)("[ChzzkUnity] GetLiveStatus HTTP 요청 실패: " + 5__2.error + " (URL: " + 5__1 + ")")); } result = 5__3; } finally { if (num < 0 && 5__2 != null) { ((IDisposable)5__2).Dispose(); } } } catch (Exception ex) { <>1__state = -2; 5__1 = null; <>t__builder.SetException(ex); return; } <>1__state = -2; 5__1 = null; <>t__builder.SetResult(result); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class d__19 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ChzzkUnity <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.reOpenTrying = true; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; UniTaskExtensions.Forget(<>4__this.Connect()); <>4__this.reOpenTrying = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string WS_URL = "wss://kr-ss3.chat.naver.com/chat"; private const string HEARTBEAT_REQUEST = "{\"ver\":\"2\",\"cmd\":0}"; private const string HEARTBEAT_RESPONSE = "{\"ver\":\"2\",\"cmd\":10000}"; private string cid; private string token; public string channel; private WebSocket socket = null; private float timer = 0f; private bool running = false; public UnityEvent onMessage = new UnityEvent(); public UnityEvent onDonation = new UnityEvent(); public UnityEvent onSubscription = new UnityEvent(); public UnityEvent onClose = new UnityEvent(); public UnityEvent onOpen = new UnityEvent(); private int closedCount = 0; private bool reOpenTrying = false; private void Start() { onMessage.AddListener((UnityAction)DebugMessage); onDonation.AddListener((UnityAction)DebugDonation); onSubscription.AddListener((UnityAction)DebugSubscription); } private void Update() { if (closedCount > 0) { UnityEvent obj = onClose; if (obj != null) { obj.Invoke(); } if (!reOpenTrying) { ((MonoBehaviour)this).StartCoroutine(TryReOpen()); } closedCount--; } } [IteratorStateMachine(typeof(d__19))] public IEnumerator TryReOpen() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__19(0) { <>4__this = this }; } private void FixedUpdate() { if (running) { timer += Time.unscaledDeltaTime; if (timer > 15f) { socket.Send("{\"ver\":\"2\",\"cmd\":0}"); timer = 0f; } } } private void OnDestroy() { StopListening(); } private void DebugMessage(Profile profile, string str) { Debug.Log((object)("| [Message] " + profile.nickname + " - " + str)); } private void DebugDonation(Profile profile, string str, DonationExtras donation) { Debug.Log((object)(donation.isAnonymous ? $"| [Donation] 익명 - {str} - {donation.payAmount}/{donation.payType}" : $"| [Donation] {profile.nickname} - {str} - {donation.payAmount}/{donation.payType}")); } private void DebugSubscription(Profile profile, SubscriptionExtras subscription) { Debug.Log((object)$"| [Subscription] {profile.nickname} - {subscription.month}"); } public void RemoveAllOnMessageListener() { ((UnityEventBase)onMessage).RemoveAllListeners(); } public void RemoveAllOnDonationListener() { ((UnityEventBase)onDonation).RemoveAllListeners(); } public void RemoveAllOnSubscriptionListener() { ((UnityEventBase)onSubscription).RemoveAllListeners(); } [AsyncStateMachine(typeof(d__28))] [DebuggerStepThrough] public UniTask GetChannelInfo(string channelId) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) d__28 d__ = new d__28(); d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); d__.<>4__this = this; d__.channelId = channelId; d__.<>1__state = -1; d__.<>t__builder.Start<d__28>(ref d__); return d__.<>t__builder.Task; } [AsyncStateMachine(typeof(d__29))] [DebuggerStepThrough] public UniTask GetLiveStatus(string channelId) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) d__29 d__ = new d__29(); d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); d__.<>4__this = this; d__.channelId = channelId; d__.<>1__state = -1; d__.<>t__builder.Start<d__29>(ref d__); return d__.<>t__builder.Task; } [AsyncStateMachine(typeof(d__30))] [DebuggerStepThrough] public UniTask GetAccessToken(string cid) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) d__30 d__ = new d__30(); d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); d__.<>4__this = this; d__.cid = cid; d__.<>1__state = -1; d__.<>t__builder.Start<d__30>(ref d__); return d__.<>t__builder.Task; } [AsyncStateMachine(typeof(d__31))] [DebuggerStepThrough] public UniTask Connect() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) d__31 d__ = new d__31(); d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); d__.<>4__this = this; d__.<>1__state = -1; ((AsyncUniTaskMethodBuilder)(ref d__.<>t__builder)).Start<d__31>(ref d__); return ((AsyncUniTaskMethodBuilder)(ref d__.<>t__builder)).Task; } public void Connect(string channelId) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) channel = channelId; UniTaskExtensions.Forget(Connect()); } public void StopListening() { if (socket != null) { socket.Close(); socket = null; } } private void ParseMessage(object sender, MessageEventArgs e) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown try { IDictionary dictionary = JsonConvert.DeserializeObject>(e.Data); Debug.Log((object)e.Data); switch ((long)dictionary["cmd"]) { case 0L: socket.Send("{\"ver\":\"2\",\"cmd\":10000}"); timer = 0f; break; case 93101L: { JArray val = (JArray)dictionary["bdy"]; { foreach (JToken item in val) { try { JObject val2 = (JObject)item; string text = ((object)val2["profile"])?.ToString(); Profile profile = new Profile(); profile.nickname = "익명"; if (!string.IsNullOrEmpty(text) && text != "null") { try { JObject val6 = JObject.Parse(text); if (val6["nickname"] != null) { profile.nickname = ((object)val6["nickname"]).ToString(); } if (val6["userIdHash"] != null) { profile.userIdHash = ((object)val6["userIdHash"]).ToString(); } } catch (Exception ex5) { Debug.LogWarning((object)("[ChzzkUnity] 프로필 JObject 파싱 오류: " + ex5.Message + ". 원본: " + text)); } } string text3 = ((object)val2["msg"])?.ToString()?.Trim() ?? ""; onMessage?.Invoke(profile, text3); } catch (Exception ex6) { Debug.LogError((object)("[ChzzkUnity] 개별 채팅 메시지 처리 중 오류: " + ex6.Message)); } } break; } } case 93102L: { JArray val = (JArray)dictionary["bdy"]; { JToken val4 = default(JToken); JToken val5 = default(JToken); foreach (JToken item2 in val) { try { JObject val2 = (JObject)item2; string text = ((object)val2["profile"])?.ToString(); Profile profile = new Profile(); profile.nickname = "익명"; if (!string.IsNullOrEmpty(text) && text != "null") { try { JObject val3 = JObject.Parse(text); if (val3["nickname"] != null) { profile.nickname = ((object)val3["nickname"]).ToString(); } if (val3["userIdHash"] != null) { profile.userIdHash = ((object)val3["userIdHash"]).ToString(); } } catch (Exception ex) { Debug.LogWarning((object)("[ChzzkUnity] 후원자 프로필 JObject 파싱 오류: " + ex.Message + ". 원본: " + text)); } } int num = int.Parse(((object)val2["msgTypeCode"]).ToString()); string text2 = null; if (val2.TryGetValue("extra", ref val4)) { text2 = ((object)val4).ToString(); } else if (val2.TryGetValue("extras", ref val5)) { text2 = ((object)val5).ToString(); } switch (num) { case 10: { DonationExtras donationExtras = null; if (!string.IsNullOrEmpty(text2)) { try { donationExtras = JsonConvert.DeserializeObject(text2); } catch (Exception ex3) { Debug.LogError((object)("[ChzzkUnity] DonationExtras 파싱 오류: " + ex3.Message + ". 원본: " + text2)); } } onDonation?.Invoke(profile, ((object)val2["msg"])?.ToString() ?? "", donationExtras); break; } case 11: { SubscriptionExtras subscriptionExtras = null; if (!string.IsNullOrEmpty(text2)) { try { subscriptionExtras = JsonConvert.DeserializeObject(text2); } catch (Exception ex2) { Debug.LogError((object)("[ChzzkUnity] SubscriptionExtras 파싱 오류: " + ex2.Message + ". 원본: " + text2)); } } onSubscription?.Invoke(profile, subscriptionExtras); break; } default: Debug.LogError((object)$"MessageTypeCode-{num} is not supported"); Debug.LogError((object)((object)val2).ToString()); break; } } catch (Exception ex4) { Debug.LogError((object)("[ChzzkUnity] 후원/구독 메시지 처리 중 오류: " + ex4.Message)); } } break; } } case 10100L: { UnityEvent obj = onOpen; if (obj != null) { obj.Invoke(); } break; } } } catch (Exception ex7) { Debug.LogError((object)ex7.ToString()); } } private void CloseConnect(object sender, CloseEventArgs e) { Debug.LogError((object)"연결이 해제되었습니다"); Debug.Log((object)e.Reason); Debug.Log((object)e.Code); Debug.Log((object)e); closedCount++; } private void StartChat(object sender, EventArgs e) { Debug.Log((object)("OPENED : " + cid + " + " + token)); string text = "{\"ver\":\"2\",\"cmd\":100,\"svcid\":\"game\",\"cid\":\"" + cid + "\",\"bdy\":{\"uid\":null,\"devType\":2001,\"accTkn\":\"" + token + "\",\"auth\":\"READ\"},\"tid\":1}"; timer = 0f; running = true; socket.Send(text); } } public class ChzzkVideoDonationUnity : MonoBehaviour { private enum SslProtocolsHack { Tls = 192, Tls11 = 768, Tls12 = 3072 } [Serializable] public class SessionUrl { [Serializable] public class Content { public string sessionUrl; } public string code; public object message; public Content content; } public class DonationControl { private int startSecond; private int endSecond; private bool stopVideo; private bool titleExpose; private string donationId; private int payAmount; private bool isAnonymous; private bool useSpeech; } [Serializable] public class VideoDonationList { public List videoDonation; } [Serializable] public class VideoDonation { public int startSecond; public int endSecond; public string videoType; public string videoId; public string playMode; public bool stopVideo; public bool titleExpose; public string donationId; public string profile; public int payAmount; public string donationText; public bool isAnonymous; public int tierNo; public bool useSpeech; public override string ToString() { return JsonConvert.SerializeObject((object)this); } } [Serializable] public class Profile { [Serializable] public class ActivityBadge { public int badgeNo; public string badgeId; public string imageUrl; public bool activated; } [Serializable] public class StreamingProperty { [Serializable] public class Subscription { public class Badge { public string imageUrl; } public int accumulativeMonth; public int tier; public Badge badge; } [Serializable] public class NicknameColor { public string colorCode; } public Subscription subscription; public NicknameColor nicknameColor; } public string userIdHash; public string nickname; public string profileImageUrl; public string userRoleCode; public string badge; public string title; public bool verifiedMark; public List activityBadges; public StreamingProperty streamingProperty; } [CompilerGenerated] private sealed class d__21 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public ChzzkVideoDonationUnity <>4__this; private SslProtocols 5__1; private Awaiter <>u__1; private void MoveNext() { //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { Awaiter awaiter; if (num != 0) { if (<>4__this.socket != null && <>4__this.socket.IsAlive) { <>4__this.socket.Close(); <>4__this.socket = null; } <>4__this.socket = new WebSocket(<>4__this.wssUrl, Array.Empty()); 5__1 = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12; <>4__this.socket.SslConfiguration.EnabledSslProtocols = 5__1; <>4__this.socket.OnMessage += <>4__this.ParseMessage; <>4__this.socket.OnClose += <>4__this.CloseConnect; <>4__this.socket.OnOpen += <>4__this.onSocketOpen; <>4__this.socket.Connect(); awaiter = ((UniTask)(ref UniTask.CompletedTask)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; d__21 d__ = this; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompletedd__21>(ref awaiter, ref d__); return; } } else { awaiter = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); } ((Awaiter)(ref awaiter)).GetResult(); } catch (Exception exception) { <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetException(exception); return; } <>1__state = -2; ((AsyncUniTaskMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class d__16 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public string missionWSSId; public ChzzkVideoDonationUnity <>4__this; private string 5__1; private UnityWebRequest 5__2; private SessionUrl 5__3; private void MoveNext() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 int num = <>1__state; string sessionUrl; try { 5__1 = "https://api.chzzk.naver.com/manage/v1/alerts/video@" + missionWSSId + "/session-url"; 5__2 = UnityWebRequest.Get(5__1); 5__2.SendWebRequest(); 5__3 = null; if ((int)5__2.result == 1) { 5__3 = JsonUtility.FromJson(5__2.downloadHandler.text); } sessionUrl = 5__3.content.sessionUrl; } catch (Exception exception) { <>1__state = -2; 5__1 = null; 5__2 = null; 5__3 = null; <>t__builder.SetException(exception); return; } <>1__state = -2; 5__1 = null; 5__2 = null; 5__3 = null; <>t__builder.SetResult(sessionUrl); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class d__19 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskMethodBuilder <>t__builder; public string missionUrl; public ChzzkVideoDonationUnity <>4__this; private string 5__1; private string 5__2; private string <>s__3; private Awaiter <>u__1; private void MoveNext() { //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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; string result; try { Awaiter awaiter; if (num != 0) { 5__1 = <>4__this.GetMissionWSSId(missionUrl); awaiter = <>4__this.GetSessionURL(5__1).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; d__19 d__ = this; <>t__builder.AwaitUnsafeOnCompleted, d__19>(ref awaiter, ref d__); return; } } else { awaiter = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); } <>s__3 = awaiter.GetResult(); 5__2 = <>s__3; <>s__3 = null; result = <>4__this.MakeWssURL(5__2); } catch (Exception exception) { <>1__state = -2; 5__1 = null; 5__2 = null; <>t__builder.SetException(exception); return; } <>1__state = -2; 5__1 = null; 5__2 = null; <>t__builder.SetResult(result); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [CompilerGenerated] private sealed class d__27 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ChzzkVideoDonationUnity <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.reOpenTrying = true; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!<>4__this.socket.IsAlive) { <>4__this.socket.Connect(); } <>4__this.reOpenTrying = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private WebSocket socket = null; private float timer = 0f; private bool running = false; private const string HEARTBEAT_REQUEST = "2"; private const string HEARTBEAT_RESPONSE = "3"; public UnityEvent onVideoDonationArrive = new UnityEvent(); public UnityEvent onVideoDonationControl = new UnityEvent(); public UnityEvent onClose = new UnityEvent(); public UnityEvent onOpen = new UnityEvent(); private int closedCount = 0; private bool reOpenTrying = false; private string wssUrl; private Dictionary> activeVideo; private void Start() { } private void Update() { if (closedCount > 0) { UnityEvent obj = onClose; if (obj != null) { obj.Invoke(); } if (!reOpenTrying) { ((MonoBehaviour)this).StartCoroutine(TryReOpen()); } closedCount--; } if (running) { timer += Time.unscaledDeltaTime; if (timer > 15f) { socket.Send("2"); timer = 0f; } } } private void OnDestroy() { StopListening(); } public string GetMissionWSSId(string url) { return url.Split(new char[1] { '@' })[1]; } [AsyncStateMachine(typeof(d__16))] [DebuggerStepThrough] public UniTask GetSessionURL(string missionWSSId) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) d__16 d__ = new d__16(); d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); d__.<>4__this = this; d__.missionWSSId = missionWSSId; d__.<>1__state = -1; d__.<>t__builder.Start<d__16>(ref d__); return d__.<>t__builder.Task; } public string MakeWssURL(string sessionUrl) { string text = sessionUrl.Split(new string[1] { "auth=" }, StringSplitOptions.None)[1]; string text2 = sessionUrl.Split(new string[1] { ".nchat" }, StringSplitOptions.None)[0].Substring(12); return "wss://ssio" + text2 + ".nchat.naver.com/socket.io/?auth=" + text + "&EIO=3&transport=websocket"; } [AsyncStateMachine(typeof(d__19))] [DebuggerStepThrough] public UniTask GetWssUrlFromMissionUrl(string missionUrl) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) d__19 d__ = new d__19(); d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); d__.<>4__this = this; d__.missionUrl = missionUrl; d__.<>1__state = -1; d__.<>t__builder.Start<d__19>(ref d__); return d__.<>t__builder.Task; } public async void Connect(string url) { wssUrl = await GetWssUrlFromMissionUrl(url); UniTaskExtensions.Forget(Connect()); } [AsyncStateMachine(typeof(d__21))] [DebuggerStepThrough] public UniTask Connect() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) d__21 d__ = new d__21(); d__.<>t__builder = AsyncUniTaskMethodBuilder.Create(); d__.<>4__this = this; d__.<>1__state = -1; ((AsyncUniTaskMethodBuilder)(ref d__.<>t__builder)).Start<d__21>(ref d__); return ((AsyncUniTaskMethodBuilder)(ref d__.<>t__builder)).Task; } private void onSocketOpen(object sender, EventArgs e) { timer = 0f; running = true; socket.Send("2"); } public void StopListening() { if (socket != null) { socket.Close(); socket = null; } } private void ParseMessage(object sender, MessageEventArgs e) { Debug.Log((object)e.Data); if (e.Data == "2") { timer = 0f; socket.Send("3"); } else { if (e.Data == "3" || e.Data == "40") { return; } VideoDonationList videoDonationList = JsonUtility.FromJson(e.Data); string text = videoDonationList.videoDonation[0]; string text2 = text; if (!(text2 == "donation")) { if (text2 == "donationControl") { List list = new List(); for (int i = 1; i < videoDonationList.videoDonation.Count; i++) { DonationControl donationControl = JsonUtility.FromJson(videoDonationList.videoDonation[i]); Debug.Log((object)donationControl); list.Add(donationControl); onVideoDonationControl.Invoke(donationControl); } } } else { for (int j = 1; j < videoDonationList.videoDonation.Count; j++) { VideoDonation videoDonation = JsonUtility.FromJson(videoDonationList.videoDonation[j]); Debug.Log((object)videoDonation); Profile profile = JsonUtility.FromJson(videoDonation.profile); onVideoDonationArrive.Invoke(profile, videoDonation); } } } } private void CloseConnect(object sender, CloseEventArgs e) { Debug.LogError((object)"연결이 해제되었습니다"); Debug.Log((object)e.Reason); Debug.Log((object)e.Code); Debug.Log((object)e); closedCount++; } [IteratorStateMachine(typeof(d__27))] private IEnumerator TryReOpen() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__27(0) { <>4__this = this }; } } [BepInPlugin("ChzzkSkul", "ChzzkSkul", "1.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry ChannelID; public static ConfigEntry EnableYoutube; public static ConfigEntry YoutubeApiKey; public static ConfigEntry YoutubeVideoId; public static ConfigEntry AllowHeal; public static ConfigEntry AllowBuffCurse; public static ConfigEntry AllowItem; public static ConfigEntry AllowSkull; public static ConfigEntry AllowSynergy; public static ConfigEntry AllowOmen; public static ConfigEntry AllowBoss; public static ConfigEntry AllowDarkAbility; public static ConfigEntry AllowRandomStat; public static ConfigEntry AllowStreamerCommand; public static ConfigEntry StreamerNickname; public static ConfigEntry CommandCooldown; public static ConfigEntry CmdHealString; public static ConfigEntry CmdBuffCurseString; public static ConfigEntry CmdItemString; public static ConfigEntry CmdSkullString; public static ConfigEntry CmdSynergyString; public static ConfigEntry CmdOmenString; public static ConfigEntry CmdBossString; public static ConfigEntry CmdDarkAbilityString; public static ConfigEntry CmdRandomString; public static ConfigEntry CmdRandomStatString; private void Awake() { //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Expected O, but got Unknown ChannelID = ((BaseUnityPlugin)this).Config.Bind("General", "치지직 채널 ID", "", "연결할 치지직 스트리머의 채널 ID입니다."); EnableYoutube = ((BaseUnityPlugin)this).Config.Bind("YouTube", "유튜브 연동 켜기", false, "유튜브 실시간 채팅 연동 기능을 활성화합니다."); YoutubeApiKey = ((BaseUnityPlugin)this).Config.Bind("YouTube", "유튜브 API 키", "", "구글 클라우드에서 발급받은 YouTube Data API v3 키를 입력하세요."); YoutubeVideoId = ((BaseUnityPlugin)this).Config.Bind("YouTube", "유튜브 방송 Video ID", "", "현재 방송 중인 유튜브 스트리밍의 Video ID를 입력하세요."); AllowHeal = ((BaseUnityPlugin)this).Config.Bind("Commands", "힐 활성화", true, "!heal / !힐 명령어 활성화 여부"); AllowBuffCurse = ((BaseUnityPlugin)this).Config.Bind("Commands", "버프저주 활성화", true, "!buff / !curse 명령어 활성화 여부"); AllowItem = ((BaseUnityPlugin)this).Config.Bind("Commands", "아이템 활성화", true, "!item / !아이템 명령어 활성화 여부"); AllowSkull = ((BaseUnityPlugin)this).Config.Bind("Commands", "스컬 활성화", true, "!skull / !해골 명령어 활성화 여부"); AllowSynergy = ((BaseUnityPlugin)this).Config.Bind("Commands", "각인 활성화", true, "!synergy / !각인 명령어 활성화 여부"); AllowOmen = ((BaseUnityPlugin)this).Config.Bind("Commands", "흉조 활성화", true, "!omen / !흉조 명령어 활성화 여부"); AllowBoss = ((BaseUnityPlugin)this).Config.Bind("Commands", "보스 활성화", true, "!boss / !보스 명령어 활성화 여부"); AllowDarkAbility = ((BaseUnityPlugin)this).Config.Bind("Commands", "검은능력 활성화", true, "!dark / !검은능력 명령어 활성화 여부"); AllowRandomStat = ((BaseUnityPlugin)this).Config.Bind("Commands", "랜덤스탯 활성화", true, "!랜덤스탯 명령어 활성화 여부"); AllowStreamerCommand = ((BaseUnityPlugin)this).Config.Bind("General", "스트리머 명령어 허용", true, "스트리머 본인의 명령어 사용을 허용할지 여부"); StreamerNickname = ((BaseUnityPlugin)this).Config.Bind("General", "스트리머 닉네임", "스트리머", "스트리머의 치지직 닉네임을 입력하세요."); CommandCooldown = ((BaseUnityPlugin)this).Config.Bind("General", "명령어 쿨타임", 5f, "일반 유저의 명령어 쿨타임 (초)"); CmdHealString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "힐 명령어", "!heal,!힐", "쉼표(,)로 구분하세요."); CmdBuffCurseString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "버프저주 명령어", "!buff,!버프,!curse,!저주", "쉼표(,)로 구분하세요."); CmdItemString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "아이템 명령어", "!item,!아이템", "쉼표(,)로 구분하세요."); CmdSkullString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "스컬 명령어", "!skull,!해골,!머리,!대머리,!skul", "쉼표(,)로 구분하세요."); CmdSynergyString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "각인 명령어", "!synergy,!각인", "쉼표(,)로 구분하세요."); CmdOmenString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "흉조 명령어", "!omen,!흉조", "쉼표(,)로 구분하세요."); CmdBossString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "보스 명령어", "!boss,!보스", "쉼표(,)로 구분하세요."); CmdDarkAbilityString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "검은능력 명령어", "!dark,!검은능력", "쉼표(,)로 구분하세요."); CmdRandomString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "랜덤 명령어", "!random,!랜덤", "쉼표(,)로 구분하세요."); CmdRandomStatString = ((BaseUnityPlugin)this).Config.Bind("CommandStrings", "랜덤스탯 명령어", "!randomstat,!랜덤스탯", "쉼표(,)로 구분하세요."); Harmony.CreateAndPatchAll(typeof(OmenChestPath), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod ChzzkSkul is loaded!"); GameObject val = new GameObject("ChzzkGameModeHost"); Object.DontDestroyOnLoad((Object)(object)val); ChzzkGameMode gameModeHandler = val.AddComponent(); Task task = OmenChestPath.StartChzzk(gameModeHandler, ChannelID.Value); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[Plugin] Chzzk 채팅 게임 모드가 활성화되었습니다."); } private void Update() { if (Input.GetKeyDown((KeyCode)286)) { ((BaseUnityPlugin)this).Config.Reload(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[Plugin] Config 파일이 재로드 되었습니다!"); } } } namespace ChzzkSkul { public class ChzzkGameMode : MonoBehaviour { private struct CommandInfo { public string nickname; public string command; public bool isStreamer; } private struct ChatMessageInfo { public string msg; public float expireTime; } [CompilerGenerated] private sealed class d__57 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ChzzkGameMode <>4__this; private Map 5__1; private HashSet 5__2; private List 5__3; private List.Enumerator <>s__4; private Character 5__5; private string 5__6; private SpriteRenderer 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__57(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; <>s__4 = default(List.Enumerator); 5__5 = null; 5__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = Map.Instance; 5__2 = new HashSet(); break; case 1: <>1__state = -1; break; } if ((Object)(object)Map.Instance == (Object)(object)5__1) { if ((Object)(object)5__1.waveContainer != (Object)null) { 5__3 = 5__1.waveContainer.GetAllEnemies(); if (5__3 != null) { <>s__4 = 5__3.GetEnumerator(); try { while (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; if ((Object)(object)5__5 != (Object)null && !5__2.Contains(5__5)) { 5__2.Add(5__5); Key key = 5__5.key; 5__6 = ((object)(Key)(ref key)).ToString(); if ((int)5__5.type == 0 && 5__6 != "Hound" && 5__6 != "SpiritInFlask" && 5__6 != "UnstableFlask" && 5__6 != "UnstableFlasksSpirit" && 5__6 != "Ent" && 5__6 != "CannonSpecialist" && 5__6 != "GiantMushroomEnt" && 5__6 != "CarleonRecruitInCannon" && 5__6 != "CarleonRecruit" && 5__6 != "Unspecified") { Transform transform = ((Component)5__5).transform; transform.localScale *= 1.3f; try { 5__5.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.Health, 2.0) })); 5__5.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.AttackDamage, 1.2000000476837158) })); } catch { } 5__7 = ((Component)5__5).GetComponentInChildren(); if ((Object)(object)5__7 != (Object)null) { 5__7.color = new Color(0.3f, 0f, 0.3f); } 5__7 = null; } 5__6 = null; } 5__5 = null; } } finally { ((IDisposable)<>s__4).Dispose(); } <>s__4 = default(List.Enumerator); } 5__3 = null; } <>2__current = (object)new WaitForSeconds(0.5f); <>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__47 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string nickname; public ChzzkGameMode <>4__this; private Character 5__1; private int 5__2; private int 5__3; private Service 5__4; private Rarity 5__5; private ItemReference 5__6; private int 5__7; private ItemRequest 5__8; private int 5__9; private Item 5__10; private Inventory 5__11; private int 5__12; private Inventory 5__13; private int 5__14; private Item 5__15; private FieldInfo 5__16; private IEnumerable 5__17; private List 5__18; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__47(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__4 = null; 5__6 = null; 5__8 = null; 5__10 = null; 5__11 = null; 5__13 = null; 5__15 = null; 5__16 = null; 5__17 = null; 5__18 = null; <>1__state = -2; } private bool MoveNext() { //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_0405: 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 = <>4__this.GetPlayer(); if ((Object)(object)5__1 == (Object)null) { return false; } 5__2 = <>4__this._random.Next(1, 10001); if (5__2 == 1) { 5__11 = 5__1.playerComponents.inventory; if (5__11 != null && 5__11.item.items.Count > 0) { 5__12 = 5__11.item.items.Count - 1; while (5__12 >= 0) { 5__11.item.Remove(5__11.item.items[5__12]); 5__12--; } <>4__this.ShowFloatingText(nickname + "이(가) 인벤토리를 텅 비웠어요! (0.01% 기적)"); } return false; } 5__3 = <>4__this._random.Next(1, 101); if (5__3 <= 40) { 5__13 = 5__1.playerComponents.inventory; if (5__13 != null && 5__13.item.items.Count > 0) { 5__14 = <>4__this._random.Next(5__13.item.items.Count); 5__15 = 5__13.item.items[5__14]; 5__13.item.Remove(5__15); <>4__this.ShowFloatingText(nickname + "이(가) 인벤토리에서 아이템을 파괴했어요!"); 5__15 = null; } else { <>4__this.ShowFloatingText(nickname + "이(가) 아이템 파괴를 시도했으나 텅 비었네요!"); } return false; } 5__4 = <>4__this.GetService(); if ((Object)(object)5__4 == (Object)null) { return false; } 5__5 = <>4__this.PickWeightedRarity(); 5__6 = null; 5__7 = <>4__this._random.Next(1, 101); if (5__7 <= 30) { 5__16 = ((object)5__4.gearManager).GetType().GetField("_items", BindingFlags.Instance | BindingFlags.NonPublic) ?? ((object)5__4.gearManager).GetType().GetField("items", BindingFlags.Instance | BindingFlags.Public); if (5__16 != null) { 5__17 = 5__16.GetValue(5__4.gearManager) as IEnumerable; if (5__17 != null) { 5__18 = 5__17.Where((ItemReference i) => (int)i.prefabKeyword1 == 34 || (int)i.prefabKeyword2 == 34).ToList(); if (5__18.Count > 0) { 5__6 = 5__18[<>4__this._random.Next(5__18.Count)]; } 5__18 = null; } 5__17 = null; } 5__16 = null; } if (5__6 == null) { 5__6 = 5__4.gearManager.GetItemToTake(5__5); } if (5__6 == null) { 5__6 = 5__4.gearManager.GetItemToTake((Rarity)0); } if (5__6 == null) { return false; } 5__8 = 5__6.LoadAsync(); break; case 1: <>1__state = -1; break; } if (!((Request)(object)5__8).isDone) { <>2__current = null; <>1__state = 1; return true; } 5__9 = <>4__this._random.Next(1, 101); 5__10 = Singleton.Instance.levelManager.DropItem(5__6.LoadAsync(), ((Component)5__1).transform.position); if (5__9 <= 70 && 5__1.playerComponents.inventory.item.items.Count((Item i) => (Object)(object)i != (Object)null) < 9) { 5__1.playerComponents.inventory.item.TryEquip(5__10); <>4__this.ShowFloatingText(nickname + "이(가) 인벤토리에 아이템을 꽂아줬어요!"); } else if (5__9 <= 70) { <>4__this.ShowFloatingText(nickname + "이(가) 인벤토리가 꽉차서 아이템을 바닥에 떨궜어요!"); } else { <>4__this.ShowFloatingText(nickname + "이(가) 아이템을 선물했어요!"); } 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__48 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string nickname; public ChzzkGameMode <>4__this; private Service 5__1; private Character 5__2; private int 5__3; private WeaponReference 5__4; private WeaponRequest 5__5; private FieldInfo 5__6; private IEnumerable 5__7; private IEnumerator <>s__8; private WeaponReference 5__9; private Weapon 5__10; private Rarity 5__11; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; <>s__8 = null; 5__9 = null; 5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Invalid comparison between Unknown and I4 switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = <>4__this.GetService(); if ((Object)(object)5__1 == (Object)null) { return false; } 5__2 = <>4__this.GetPlayer(); if ((Object)(object)5__2 == (Object)null) { return false; } 5__3 = <>4__this._random.Next(1, 1001); 5__4 = null; if (5__3 <= 5) { 5__6 = ((object)5__1.gearManager).GetType().GetField("_weapons", BindingFlags.Instance | BindingFlags.NonPublic) ?? ((object)5__1.gearManager).GetType().GetField("weapons", BindingFlags.Instance | BindingFlags.Public); if (5__6 != null) { 5__7 = 5__6.GetValue(5__1.gearManager) as IEnumerable; if (5__7 != null) { <>s__8 = 5__7.GetEnumerator(); try { while (<>s__8.MoveNext()) { 5__9 = <>s__8.Current; if (((GearReference)5__9).name.Equals("super_skul", StringComparison.OrdinalIgnoreCase)) { 5__4 = 5__9; break; } 5__9 = null; } } finally { if (<>s__8 != null) { <>s__8.Dispose(); } } <>s__8 = null; } 5__7 = null; } 5__6 = null; } else if (5__3 <= 305) { 5__10 = 5__2.playerComponents.inventory.weapon.polymorphOrCurrent; if ((Object)(object)5__10 != (Object)null && (int)((Gear)5__10).rarity != 3 && 5__10.nextLevelReference != null && !string.IsNullOrEmpty(((GearReference)5__10.nextLevelReference).name)) { 5__4 = 5__10.nextLevelReference; } 5__10 = null; } if (5__4 == null) { 5__11 = <>4__this.PickWeightedRarity(); 5__4 = 5__1.gearManager.GetWeaponToTake(5__11); if (5__4 == null) { 5__4 = 5__1.gearManager.GetWeaponToTake((Rarity)0); } } if (5__4 == null) { return false; } 5__5 = 5__4.LoadAsync(); break; case 1: <>1__state = -1; break; } if (!((Request)(object)5__5).isDone) { <>2__current = null; <>1__state = 1; return true; } 5__1.levelManager.DropWeapon(5__5, ((Component)5__2).transform.position + Vector3.up); <>4__this.ShowFloatingText(nickname + "이(가) 스컬을 선물했어요!"); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float BUFF_DURATION = 30f; private const float HEAL_PERCENT = 0.3f; private readonly ConcurrentQueue _commandQueue = new ConcurrentQueue(); private readonly ConcurrentQueue _pendingChats = new ConcurrentQueue(); private readonly Queue _chatMessages = new Queue(); private float _cooldownTimer = 0f; private bool _onCooldown = false; private Random _random = new Random(); public static bool ForceNextDarkEnemy = false; private Map _lastMap; private static ChzzkGameMode _instance; public static HashSet CustomSuperInscriptions = new HashSet(); private Map _currentMap; private bool _streamerUsedCommandInThisMap = false; private float GLOBAL_COOLDOWN => Plugin.CommandCooldown.Value; private HashSet HealCommands => GetCommands(Plugin.CmdHealString.Value); private HashSet BuffCommands => GetCommands(Plugin.CmdBuffCurseString.Value); private HashSet ItemCommands => GetCommands(Plugin.CmdItemString.Value); private HashSet SkullCommands => GetCommands(Plugin.CmdSkullString.Value); private HashSet SynergyCommands => GetCommands(Plugin.CmdSynergyString.Value); private HashSet OmenCommands => GetCommands(Plugin.CmdOmenString.Value); private HashSet BossCommands => GetCommands(Plugin.CmdBossString.Value); private HashSet DarkCommands => GetCommands(Plugin.CmdDarkAbilityString.Value); private HashSet RandomCommands => GetCommands(Plugin.CmdRandomString.Value); private HashSet RandomStatCommands => GetCommands(Plugin.CmdRandomStatString.Value); private HashSet GetCommands(string config) { HashSet hashSet = new HashSet(); if (config == null) { return hashSet; } string[] array = config.Split(new char[1] { ',' }); foreach (string text in array) { string text2 = text.Trim().ToLower(); if (!string.IsNullOrEmpty(text2)) { hashSet.Add(text2); } } return hashSet; } private void Awake() { if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void Update() { Map instance = Map.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance != (Object)(object)_currentMap) { _currentMap = instance; _streamerUsedCommandInThisMap = false; } string result; while (_pendingChats.TryDequeue(out result)) { _chatMessages.Enqueue(new ChatMessageInfo { msg = result, expireTime = Time.unscaledTime + 5f }); if (_chatMessages.Count > 6) { _chatMessages.Dequeue(); } } while (_chatMessages.Count > 0 && Time.unscaledTime > _chatMessages.Peek().expireTime) { _chatMessages.Dequeue(); } if ((Object)(object)Map.Instance != (Object)null && (Object)(object)_lastMap != (Object)(object)Map.Instance) { _lastMap = Map.Instance; if (ForceNextDarkEnemy) { ForceNextDarkEnemy = false; Debug.Log((object)"[ChzzkGameMode] 다음 맵 커스텀 몬스터 강화 적용 완료"); ShowFloatingText("강화된 몬스터들이 등장합니다!"); ((MonoBehaviour)this).StartCoroutine(ApplyCustomDarkEnemyRoutine()); } } if (_onCooldown) { _cooldownTimer -= Time.unscaledDeltaTime; if (_cooldownTimer <= 0f) { _onCooldown = false; _cooldownTimer = 0f; } } CommandInfo result2; while (_commandQueue.TryDequeue(out result2)) { string nickname = result2.nickname; string command = result2.command; if (!result2.isStreamer && _onCooldown) { ShowFloatingText($"명령어 쿨타임.. ({_cooldownTimer:F1}초 남음)"); continue; } if (!result2.isStreamer) { _onCooldown = true; _cooldownTimer = GLOBAL_COOLDOWN; } try { if (RandomCommands.Contains(command)) { DoRandom(nickname); } else if (HealCommands.Contains(command) && Plugin.AllowHeal.Value) { DoHeal(nickname); } else if (BuffCommands.Contains(command) && Plugin.AllowBuffCurse.Value) { DoBuffOrCurse(nickname); } else if (ItemCommands.Contains(command) && Plugin.AllowItem.Value) { ((MonoBehaviour)this).StartCoroutine(DoItemCoroutine(nickname)); } else if (SkullCommands.Contains(command) && Plugin.AllowSkull.Value) { ((MonoBehaviour)this).StartCoroutine(DoSkullCoroutine(nickname)); } else if (SynergyCommands.Contains(command) && Plugin.AllowSynergy.Value) { DoSynergy(nickname); } else if (OmenCommands.Contains(command) && Plugin.AllowOmen.Value) { DoOmen(nickname); } else if (BossCommands.Contains(command) && Plugin.AllowBoss.Value) { DoBoss(nickname); } else if (DarkCommands.Contains(command) && Plugin.AllowDarkAbility.Value) { DoDarkAbility(nickname); } else if (RandomStatCommands.Contains(command) && Plugin.AllowRandomStat.Value) { DoRandomStat(nickname); } } catch (Exception arg) { Debug.LogError((object)$"[ChzzkGameMode] 커맨드 실행 오류: {arg}"); } } } private void OnGUI() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) if (_chatMessages.Count == 0 && (!_onCooldown || !(_cooldownTimer > 0f))) { return; } GUIStyle val = new GUIStyle(); if ((Object)(object)GUI.skin != (Object)null && GUI.skin.label != null) { val = new GUIStyle(GUI.skin.label); } val.fontSize = 24; val.wordWrap = true; val.richText = true; val.normal.textColor = Color.white; GUIStyle val2 = new GUIStyle(val); val2.normal.textColor = Color.black; float num = (float)Screen.height - 350f; Rect val3 = default(Rect); foreach (ChatMessageInfo chatMessage in _chatMessages) { ((Rect)(ref val3))..ctor(20f, num, 800f, 50f); Rect val4 = val3; ((Rect)(ref val4)).x = ((Rect)(ref val4)).x + 1f; ((Rect)(ref val4)).y = ((Rect)(ref val4)).y + 1f; GUI.Label(val4, chatMessage.msg, val2); ((Rect)(ref val4)).x = ((Rect)(ref val4)).x - 2f; ((Rect)(ref val4)).y = ((Rect)(ref val4)).y - 2f; GUI.Label(val4, chatMessage.msg, val2); GUI.Label(val3, chatMessage.msg, val); num += 40f; } GUIStyle val5 = new GUIStyle(val); val5.alignment = (TextAnchor)2; Rect val6 = default(Rect); ((Rect)(ref val6))..ctor((float)(Screen.width - 320), 20f, 300f, 50f); string text = ((_onCooldown && _cooldownTimer > 0f) ? $"커맨드 쿨타임: {_cooldownTimer:F1}초" : "커맨드 사용 가능 \ud83d\udfe2"); Rect val7 = val6; ((Rect)(ref val7)).x = ((Rect)(ref val7)).x + 1f; ((Rect)(ref val7)).y = ((Rect)(ref val7)).y + 1f; GUI.Label(val7, text.Replace("", "").Replace("", "").Replace("", ""), val2); ((Rect)(ref val7)).x = ((Rect)(ref val7)).x - 2f; ((Rect)(ref val7)).y = ((Rect)(ref val7)).y - 2f; GUI.Label(val7, text.Replace("", "").Replace("", "").Replace("", ""), val2); GUI.Label(val6, text, val5); } public void OnChatMessage(string nickname, string message) { if (string.IsNullOrWhiteSpace(message)) { return; } string text = message.Trim().ToLower(); nickname = (string.IsNullOrEmpty(nickname) ? "익명" : nickname); if (nickname == Plugin.StreamerNickname.Value) { if (Plugin.AllowStreamerCommand.Value) { if (_streamerUsedCommandInThisMap) { ShowFloatingText("스트리머는 이번 맵에서 이미 명령어를 사용했습니다!"); return; } _streamerUsedCommandInThisMap = true; _commandQueue.Enqueue(new CommandInfo { nickname = nickname, command = text, isStreamer = true }); } } else if (HealCommands.Contains(text) || BuffCommands.Contains(text) || ItemCommands.Contains(text) || SkullCommands.Contains(text) || SynergyCommands.Contains(text) || OmenCommands.Contains(text) || BossCommands.Contains(text) || DarkCommands.Contains(text) || RandomCommands.Contains(text) || RandomStatCommands.Contains(text)) { _commandQueue.Enqueue(new CommandInfo { nickname = nickname, command = text, isStreamer = false }); } else { string text2 = nickname.Replace("<", "").Replace(">", ""); _pendingChats.Enqueue("[" + text2 + "] " + message); } } private void DoRandom(string nickname) { int num = _random.Next(1, 4); ShowFloatingText($"{nickname}이(가) 랜덤 효과 {num}개를 발동시켰어요!"); Action[] source = new Action[9] { delegate(string n) { DoHeal(n); }, delegate(string n) { DoBuffOrCurse(n); }, delegate(string n) { ((MonoBehaviour)this).StartCoroutine(DoItemCoroutine(n)); }, delegate(string n) { ((MonoBehaviour)this).StartCoroutine(DoSkullCoroutine(n)); }, delegate(string n) { DoSynergy(n); }, delegate(string n) { DoOmen(n); }, delegate(string n) { DoBoss(n); }, delegate(string n) { DoDarkAbility(n); }, delegate(string n) { DoRandomStat(n); } }; List> list = source.OrderBy((Action x) => _random.Next()).Take(num).ToList(); foreach (Action item in list) { item(nickname); } } private void DoRandomStat(string nickname) { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown Character player = GetPlayer(); if ((Object)(object)player == (Object)null) { return; } Kind[] array = (Kind[])(object)new Kind[7] { Kind.AttackDamage, Kind.PhysicalAttackDamage, Kind.MagicAttackDamage, Kind.AttackSpeed, Kind.MovementSpeed, Kind.CriticalChance, Kind.CriticalDamage }; string[] array2 = new string[7] { "모든 공격력", "물리 공격력", "마법 공격력", "공격 속도", "이동 속도", "치명타 확률", "치명타 데미지" }; int num = _random.Next(array.Length); Kind val = array[num]; string text = array2[num]; bool flag = _random.Next(2) == 0; float num2 = (flag ? 0.1f : (-0.1f)); string text2 = (flag ? "증가" : "감소"); string text3 = (flag ? "축복" : "저주"); try { player.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, val, (double)num2) })); ShowFloatingText(nickname + "이(가) " + text3 + "을 내렸어요! " + text + " 10% " + text2 + "!"); } catch { ShowFloatingText(nickname + "의 스탯 조작이 빗나갔어요!"); } } private void DoHeal(string nickname) { Character player = GetPlayer(); if ((Object)(object)player == (Object)null) { return; } int num = _random.Next(1, 101); if (num <= 30) { double currentHealth = ((Health)player.health).currentHealth; double maximumHealth = ((Health)player.health).maximumHealth; double num2 = maximumHealth * 0.30000001192092896; if (currentHealth - num2 < 1.0) { num2 = currentHealth - 1.0; } if (num2 > 0.0) { Type type = ((object)player.health).GetType(); FieldInfo fieldInfo = type.GetField("_currentHealth", BindingFlags.Instance | BindingFlags.NonPublic) ?? type.GetField("k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic); if (fieldInfo != null) { fieldInfo.SetValue(player.health, currentHealth - num2); ShowFloatingText($"{nickname}이(가) 독약을 선물했어요! -{num2:F0}"); } else { ShowFloatingText(nickname + "이(가) 독약을 선물했지만 간신히 버텼어요!"); } } else { ShowFloatingText(nickname + "이(가) 독약을 선물했지만 간신히 버텼어요!"); } } else { double num3 = ((Health)player.health).PercentHeal(0.3f); ShowFloatingText($"{nickname}이(가) 힐을 선물했어요! +{num3:F0}"); } } private void DoBuffOrCurse(string nickname) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected I4, but got Unknown Character player = GetPlayer(); if ((Object)(object)player == (Object)null) { return; } SavableAbilityManager component = ((Component)player).GetComponent(); if (!((Object)(object)component == (Object)null)) { int num = _random.Next(1, 101); if (num <= 60) { Name[] array = new Name[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Name[] array2 = (Name[])(object)array; Name val = array2[_random.Next(array2.Length)]; component.Apply(val, 1f, 30f); ShowFloatingText(nickname + "이(가) " + (val - 8) switch { 0 => "잔혹함(공격력↑)", 1 => "분노(공격속도↑)", 2 => "불굴(방어력↑)", _ => ((object)(Name)(ref val)).ToString(), } + " 버프를 선물했어요!"); } else { component.Apply((Name)0, 1f); ShowFloatingText(nickname + "이(가) 신의 은총을 선물해주셨습니다!"); } } } [IteratorStateMachine(typeof(d__47))] private IEnumerator DoItemCoroutine(string nickname) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__47(0) { <>4__this = this, nickname = nickname }; } [IteratorStateMachine(typeof(d__48))] private IEnumerator DoSkullCoroutine(string nickname) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__48(0) { <>4__this = this, nickname = nickname }; } private void DoSynergy(string nickname) { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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) //IL_0097: Invalid comparison between Unknown and I4 //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Character player = GetPlayer(); if ((Object)(object)player == (Object)null) { return; } Inventory inventory = player.playerComponents.inventory; if (inventory == null || (Object)(object)inventory.synergy == (Object)null || inventory.synergy.inscriptions == null) { return; } Synergy synergy = inventory.synergy; List list = new List(); List list2 = new List(); if (Inscription.keys != null) { foreach (Key key in Inscription.keys) { if ((int)key != 0 && (int)key != 35) { if (synergy.inscriptions[key].count > 0) { list.Add(key); } else { list2.Add(key); } } } } int num = _random.Next(1, 101); string text = ""; Key val; if (num <= 50 && list.Count > 0) { val = list[_random.Next(list.Count)]; text = "강화"; } else { if (list2.Count <= 0) { ShowFloatingText(nickname + "의 각인 조작 시도! 하지만 실패했어요."); return; } val = list2[_random.Next(list2.Count)]; text = "추가"; } Inscription obj = synergy.inscriptions[val]; obj.bonusCount++; if (text == "강화") { CustomSuperInscriptions.Add(val); } inventory.UpdateSynergy(); ShowFloatingText($"{nickname}이(가) [{val}] 각인을 {text}했어요!"); } private void DoOmen(string nickname) { OmenChestPath.ForceNextOmen = true; ShowFloatingText(nickname + "이(가) 다음 상자를 흉조 상자로 바꿨어요!"); } private void DoDarkAbility(string nickname) { //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Invalid comparison between Unknown and I4 Character player = GetPlayer(); if ((Object)(object)player == (Object)null) { return; } UpgradeInventory upgrade = player.playerComponents.inventory.upgrade; if ((Object)(object)upgrade == (Object)null) { return; } int num = _random.Next(1, 101); if (num <= 50) { List upgrades = upgrade.upgrades; List list = new List(); for (int i = 0; i < upgrades.Count; i++) { if ((Object)(object)upgrades[i] != (Object)null) { list.Add(i); } } if (list.Count > 0) { int num2 = list[_random.Next(list.Count)]; upgrade.Remove(num2); upgrade.Trim(); ShowFloatingText(nickname + "이(가) 검은 능력을 삭제했어요!"); } else { ShowFloatingText(nickname + "의 파괴 시도! 하지만 능력이 없어요."); } return; } UpgradeManager instance = Singleton.Instance; if (!((Object)(object)instance != (Object)null)) { return; } List collection = instance.GetUnlockList((Type)0) ?? new List(); List collection2 = instance.GetUnlockList((Type)1) ?? new List(); List list2 = new List(); list2.AddRange(collection); list2.AddRange(collection2); if (list2.Count > 0) { Reference val = list2[_random.Next(list2.Count)]; if (upgrade.TryEquip(val)) { string text = (((int)val.type == 1) ? "저주" : "검은 능력"); ShowFloatingText(nickname + "이(가) " + text + "을(를) 추가했어요!"); } else { ShowFloatingText(nickname + "의 부여 시도! 칸이 가득 찼어요."); } } else { ShowFloatingText(nickname + "의 부여 시도! 획득 가능한 능력이 없어요."); } } private void DoBoss(string nickname) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown bool flag = false; if ((Object)(object)Map.Instance != (Object)null && (Object)(object)Map.Instance.waveContainer != (Object)null) { List list = Map.Instance.waveContainer.GetAllEnemies().ToList(); if (list.Count > 0) { Character val = list[_random.Next(list.Count)]; Transform transform = ((Component)val).transform; transform.localScale *= 1.5f; try { val.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.Health, 5.0) })); val.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.AttackDamage, 1.5) })); } catch { } ((Health)val.health).Heal(999999.0, true); flag = true; } } ForceNextDarkEnemy = true; if (flag) { ShowFloatingText(nickname + "이(가) 몬스터 하나를 미니보스로 둔갑시키고 다음 맵을 저주했어요!"); } else { ShowFloatingText(nickname + "이(가) 보스를 소환했어요! 다음 맵에서 적들이 강해집니다!"); } } private Character GetPlayer() { try { Service instance = Singleton.Instance; object result; if (instance == null) { result = null; } else { LevelManager levelManager = instance.levelManager; result = ((levelManager != null) ? levelManager.player : null); } return (Character)result; } catch { return null; } } private Service GetService() { try { return Singleton.Instance; } catch { return null; } } private Rarity PickWeightedRarity() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) int num = _random.Next(100); if (num < 60) { return (Rarity)0; } if (num < 90) { return (Rarity)1; } if (num < 99) { return (Rarity)2; } return (Rarity)3; } private void ShowFloatingText(string message) { //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_0059: 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) try { Service instance = Singleton.Instance; object obj; if (instance == null) { obj = null; } else { LevelManager levelManager = instance.levelManager; obj = ((levelManager != null) ? levelManager.player : null); } Character val = (Character)obj; if ((Object)(object)val == (Object)null) { return; } Service instance2 = Singleton.Instance; if (instance2 != null) { FloatingTextSpawner floatingTextSpawner = instance2.floatingTextSpawner; if (floatingTextSpawner != null) { floatingTextSpawner.SpawnBuff(message, ((Component)val).transform.position + Vector3.up * 2f, "#FFD700"); } } } catch { } } [IteratorStateMachine(typeof(d__57))] private IEnumerator ApplyCustomDarkEnemyRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__57(0) { <>4__this = this }; } } public class OmenChestPath { private static ChzzkUnity streamingConnection; public static bool ForceNextOmen { get; set; } [HarmonyPostfix] [HarmonyPatch(typeof(HardmodeChest), "TryToChangeOmenChest")] private static void OmenChest(ref HardmodeChest __instance, ref bool ____isOmenChest) { if (ForceNextOmen) { ____isOmenChest = true; ForceNextOmen = false; Debug.Log((object)"[OmenChestPath] !omen 커맨드로 흉조 상자가 강제 활성화되었습니다."); } else { ____isOmenChest = true; } } [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static void Inscription_isSuper_Postfix(Inscription __instance, ref bool __result) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (ChzzkGameMode.CustomSuperInscriptions.Contains(__instance.key)) { __result = true; } } public static async Task StartChzzk(ChzzkGameMode gameModeHandler, string channelId) { GameObject go = new GameObject("ChatIntegrationHost"); Object.DontDestroyOnLoad((Object)(object)go); if (!string.IsNullOrEmpty(channelId)) { streamingConnection = go.AddComponent(); streamingConnection.onMessage.AddListener((UnityAction)delegate(ChzzkUnity.Profile profile, string msg) { gameModeHandler.OnChatMessage(profile?.nickname, msg); }); streamingConnection.Connect(channelId); } if (Plugin.EnableYoutube.Value && !string.IsNullOrEmpty(Plugin.YoutubeApiKey.Value) && !string.IsNullOrEmpty(Plugin.YoutubeVideoId.Value)) { YouTubeUnity ytConnection = go.AddComponent(); ytConnection.onMessage.AddListener((UnityAction)delegate(string nickname, string msg) { gameModeHandler.OnChatMessage(nickname, msg); }); ytConnection.Connect(Plugin.YoutubeApiKey.Value, Plugin.YoutubeVideoId.Value); Debug.Log((object)"[OmenChestPath] YouTube Live Chat integration started."); } await Task.CompletedTask; } } public class YouTubeUnity : MonoBehaviour { [CompilerGenerated] private sealed class d__8 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public YouTubeUnity <>4__this; private string 5__1; private UnityWebRequest 5__2; private JObject 5__3; private JArray 5__4; private JToken 5__5; private Exception 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__8(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__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; 5__1 = "https://www.googleapis.com/youtube/v3/videos?id=" + <>4__this._videoId + "&part=liveStreamingDetails&key=" + <>4__this._apiKey; 5__2 = UnityWebRequest.Get(5__1); <>1__state = -3; <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result = true; break; case 1: { <>1__state = -3; if (5__2.isNetworkError || 5__2.isHttpError) { Debug.LogError((object)("[YouTubeUnity] Failed to get liveChatId: " + 5__2.error + "\n" + 5__2.downloadHandler.text)); <>4__this._isRunning = false; result = false; } else { try { 5__3 = JObject.Parse(5__2.downloadHandler.text); 5__4 = (JArray)5__3["items"]; if (5__4 != null && ((JContainer)5__4).Count > 0) { 5__5 = 5__4[0][(object)"liveStreamingDetails"]; if (5__5 != null) { <>4__this._liveChatId = (string)5__5[(object)"activeLiveChatId"]; } 5__5 = null; } if (!string.IsNullOrEmpty(<>4__this._liveChatId)) { Debug.Log((object)("[YouTubeUnity] Successfully connected to YouTube Live Chat! (Chat ID: " + <>4__this._liveChatId + ")")); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.PollMessagesRoutine()); 5__3 = null; 5__4 = null; goto IL_0266; } Debug.LogError((object)("[YouTubeUnity] Could not find activeLiveChatId for Video ID: " + <>4__this._videoId + ". Is it a live stream?")); <>4__this._isRunning = false; result = false; } catch (Exception ex) { 5__6 = ex; Debug.LogError((object)("[YouTubeUnity] Error parsing liveChatId: " + 5__6.Message)); <>4__this._isRunning = false; goto IL_0266; } } <>m__Finally1(); break; } IL_0266: <>m__Finally1(); 5__2 = 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__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__9 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public YouTubeUnity <>4__this; private string 5__1; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(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__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -3; if (5__2.isNetworkError || 5__2.isHttpError) { Debug.LogError((object)("[YouTubeUnity] Fetch error: " + 5__2.error + "\n" + 5__2.downloadHandler.text)); } else { <>4__this.ParseMessages(5__2.downloadHandler.text); } <>m__Finally1(); 5__2 = null; <>2__current = (object)new WaitForSeconds(<>4__this._pollingIntervalMillis / 1000f); <>1__state = 2; return true; case 2: <>1__state = -1; 5__1 = null; break; } if (<>4__this._isRunning) { 5__1 = "https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=" + <>4__this._liveChatId + "&part=snippet,authorDetails&key=" + <>4__this._apiKey; if (!string.IsNullOrEmpty(<>4__this._nextPageToken)) { 5__1 = 5__1 + "&pageToken=" + <>4__this._nextPageToken; } 5__2 = UnityWebRequest.Get(5__1); <>1__state = -3; <>2__current = 5__2.SendWebRequest(); <>1__state = 1; return true; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } 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__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public UnityEvent onMessage = new UnityEvent(); private string _apiKey; private string _videoId; private string _liveChatId; private string _nextPageToken = ""; private float _pollingIntervalMillis = 3000f; private bool _isRunning = false; public void Connect(string apiKey, string videoId) { _apiKey = apiKey; _videoId = videoId; _isRunning = true; ((MonoBehaviour)this).StartCoroutine(FetchLiveChatIdRoutine()); } [IteratorStateMachine(typeof(d__8))] private IEnumerator FetchLiveChatIdRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__8(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__9))] private IEnumerator PollMessagesRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this }; } private void ParseMessages(string jsonResponse) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown try { JObject val = JObject.Parse(jsonResponse); if (val["pollingIntervalMillis"] != null) { _pollingIntervalMillis = (float)val["pollingIntervalMillis"]; } bool flag = string.IsNullOrEmpty(_nextPageToken); if (val["nextPageToken"] != null) { _nextPageToken = (string)val["nextPageToken"]; } JArray val2 = (JArray)val["items"]; if (val2 == null || flag) { return; } foreach (JToken item in val2) { JToken val3 = item[(object)"snippet"]; JToken val4 = item[(object)"authorDetails"]; if (val3 != null && val4 != null) { string text = (string)val3[(object)"type"]; if (text == "textMessageEvent") { string text2 = (string)val4[(object)"displayName"]; string text3 = (string)val3[(object)"displayMessage"]; onMessage?.Invoke(text2, text3); } } } } catch (Exception ex) { Debug.LogError((object)("[YouTubeUnity] Parse error: " + ex.Message)); } } private void OnDestroy() { _isRunning = false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ChzzkSkul"; public const string PLUGIN_NAME = "ChzzkSkul"; public const string PLUGIN_VERSION = "1.0"; } } namespace System { internal readonly struct Index : IEquatable { private readonly int _value; public static Index Start => new Index(0); public static Index End => new Index(-1); public bool IsFromEnd => _value < 0; public int Value => IsFromEnd ? (~_value) : _value; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Index(int value, bool fromEnd = false) { if (value < 0) { throw new ArgumentOutOfRangeException("value"); } _value = (fromEnd ? (~value) : value); } private Index(int value) { _value = value; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator Index(int value) { return new Index(value); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetOffset(int length) { int num = _value; if (IsFromEnd) { num += length + 1; } return num; } public bool Equals(Index other) { return _value == other._value; } public override bool Equals(object value) { return value is Index index && _value == index._value; } public override int GetHashCode() { return _value; } public override string ToString() { return IsFromEnd ? $"^{Value}" : Value.ToString(); } } internal readonly struct Range : IEquatable { public Index Start { get; } public Index End { get; } public static Range All => Index.Start..Index.End; public Range(Index start, Index end) { Start = start; End = end; } public static Range StartAt(Index start) { return start..Index.End; } public static Range EndAt(Index end) { return Index.Start..end; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public (int Offset, int Length) GetOffsetAndLength(int length) { int offset = Start.GetOffset(length); int offset2 = End.GetOffset(length); if ((uint)offset2 > (uint)length || (uint)offset > (uint)offset2) { throw new ArgumentOutOfRangeException("length"); } return (offset, offset2 - offset); } public bool Equals(Range other) { return Start.Equals(other.Start) && End.Equals(other.End); } public override bool Equals(object value) { return value is Range range && range.Equals(this); } public override int GetHashCode() { return Start.GetHashCode() ^ (End.GetHashCode() << 16); } public override string ToString() { return $"{Start}..{End}"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } internal static class IsExternalInit { } }