Decompiled source of Redeem v1.0.5
plugins/Redeem.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; [assembly: AssemblyFileVersion("1.0.5")] [assembly: Guid("E74EB49A-461D-48EA-85BC-F462D60C98C4")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyProduct("Redeem")] [assembly: AssemblyCompany("Radamanto")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("Redeem")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.5.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<3a0db56f-1367-47b1-82bd-1a4a86c9de3a>Embedded] internal sealed class <3a0db56f-1367-47b1-82bd-1a4a86c9de3a>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<3a0db56f-1367-47b1-82bd-1a4a86c9de3a>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <be8d265a-b5f3-4442-90f8-fb1a7f94c948>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <be8d265a-b5f3-4442-90f8-fb1a7f94c948>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <be8d265a-b5f3-4442-90f8-fb1a7f94c948>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<3a0db56f-1367-47b1-82bd-1a4a86c9de3a>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <43815e13-402f-407e-9e25-db2b91c6fb17>NullableContextAttribute : Attribute { public readonly byte Flag; public <43815e13-402f-407e-9e25-db2b91c6fb17>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Redeem { [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(1)] [BepInPlugin("radamanto.Redeem", "Redeem", "1.0.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RedeemPlugin : BaseUnityPlugin { [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] private class PackagesData { [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(1)] public Dictionary<string, PackageDef> Packages = new Dictionary<string, PackageDef>(StringComparer.OrdinalIgnoreCase); } [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private class PackageDef { public string Id = ""; public List<ItemDef> Items = new List<ItemDef>(); } [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] private class ItemDef { [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(1)] public string Prefab = ""; public int Amount = 1; public int Quality = 1; public int Variant = 0; } [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] private class CodesData { [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(1)] public Dictionary<string, CodeInfo> Codes = new Dictionary<string, CodeInfo>(StringComparer.OrdinalIgnoreCase); } [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private class CodeInfo { public string Code = ""; public string Package = ""; public bool Claimed = false; public DateTime? ClaimedAt = null; public string ClaimedName = ""; } [CompilerGenerated] private sealed class <Core_RpcRebindWatcher>d__80 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public RedeemPlugin <>4__this; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private WaitForSeconds <wait>5__1; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private ZRoutedRpc <cur>5__2; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <Core_RpcRebindWatcher>d__80(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <wait>5__1 = null; <cur>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <wait>5__1 = new WaitForSeconds(1f); break; case 1: <>1__state = -1; break; } try { <cur>5__2 = ZRoutedRpc.instance; if (<cur>5__2 != _coreLastRpcRef) { _coreLastRpcRef = <cur>5__2; ResetCoreRpcFlags(); TryRegisterRpcHandlers(); TryRegisterClientHandlers(); Raffle_ResetRpcFlags(); Raffle_TryRegisterRpcs(); } <cur>5__2 = null; } catch (Exception) { } <>2__current = <wait>5__1; <>1__state = 1; return true; } 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 <FilePoller>d__94 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public RedeemPlugin <>4__this; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private WaitForSeconds <wait>5__1; private DateTime <mtimePackages>5__2; private DateTime <mtimeCodes>5__3; private DateTime <mtimeInsert>5__4; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>s__5; private bool <>s__6; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <FilePoller>d__94(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <wait>5__1 = null; <>s__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <wait>5__1 = new WaitForSeconds(2f); break; case 1: <>1__state = -1; break; } try { if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { <mtimePackages>5__2 = GetLastWriteUtcSafe(PackagesPath); if (<mtimePackages>5__2 > _pollPackagesLastWriteUtc) { _pollPackagesLastWriteUtc = <mtimePackages>5__2; <>s__5 = _packagesFileLock; <>s__6 = false; try { Monitor.Enter(<>s__5, ref <>s__6); _packages = LoadPackagesYml(PackagesPath); } finally { if (<>s__6) { Monitor.Exit(<>s__5); } } <>s__5 = null; } <mtimeCodes>5__3 = GetLastWriteUtcSafe(CodesActivePath); if (<mtimeCodes>5__3 > _pollCodesLastWriteUtc) { _pollCodesLastWriteUtc = <mtimeCodes>5__3; TryReloadCodesSafe(); } <mtimeInsert>5__4 = GetLastWriteUtcSafe(CodeInsertPath); if (<mtimeInsert>5__4 > _pollInsertLastWriteUtc) { _pollInsertLastWriteUtc = <mtimeInsert>5__4; TryProcessSingleInsert(); } } } catch (Exception) { } <>2__current = <wait>5__1; <>1__state = 1; return true; } 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 <InFlightAndAntiFloodSweeper>d__107 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public RedeemPlugin <>4__this; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private WaitForSeconds <wait>5__1; private DateTime <now>5__2; private DateTime <cutoffRecent>5__3; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 0, 1 })] private KeyValuePair<string, DateTime>[] <>s__4; private int <>s__5; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] private KeyValuePair<string, DateTime> <kv>5__6; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 0, 1 })] private KeyValuePair<string, DateTime>[] <>s__7; private int <>s__8; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] private KeyValuePair<string, DateTime> <kv>5__9; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 0, 1 })] private KeyValuePair<string, DateTime>[] <>s__10; private int <>s__11; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] private KeyValuePair<string, DateTime> <kv>5__12; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <InFlightAndAntiFloodSweeper>d__107(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <wait>5__1 = null; <>s__4 = null; <kv>5__6 = default(KeyValuePair<string, DateTime>); <>s__7 = null; <kv>5__9 = default(KeyValuePair<string, DateTime>); <>s__10 = null; <kv>5__12 = default(KeyValuePair<string, DateTime>); <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <wait>5__1 = new WaitForSeconds(1f); break; case 1: <>1__state = -1; break; } try { <now>5__2 = DateTime.UtcNow; <>s__4 = _inFlightExpires.ToArray(); DateTime value; for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++) { <kv>5__6 = <>s__4[<>s__5]; if (<kv>5__6.Value <= <now>5__2) { _inFlightExpires.TryRemove(<kv>5__6.Key, out value); _inFlightCodes.TryRemove(<kv>5__6.Key, out var _); } <kv>5__6 = default(KeyValuePair<string, DateTime>); } <>s__4 = null; <>s__7 = _codeLockTouched.ToArray(); for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { <kv>5__9 = <>s__7[<>s__8]; if (<now>5__2 - <kv>5__9.Value > CodeLockOrphanTtl) { _codeLockTouched.TryRemove(<kv>5__9.Key, out value); _codeLocks.TryRemove(<kv>5__9.Key, out var _); } <kv>5__9 = default(KeyValuePair<string, DateTime>); } <>s__7 = null; <cutoffRecent>5__3 = <now>5__2.AddDays(-7.0); <>s__10 = _recentClaimed.ToArray(); for (<>s__11 = 0; <>s__11 < <>s__10.Length; <>s__11++) { <kv>5__12 = <>s__10[<>s__11]; if (<kv>5__12.Value < <cutoffRecent>5__3) { _recentClaimed.TryRemove(<kv>5__12.Key, out value); } <kv>5__12 = default(KeyValuePair<string, DateTime>); } <>s__10 = null; } catch (Exception) { } <>2__current = <wait>5__1; <>1__state = 1; return true; } 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 <Raffle_PendingTimeoutTick>d__150 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public RedeemPlugin <>4__this; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private WaitForSeconds <wait>5__1; private int <timeoutMin>5__2; private DateTime <now>5__3; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] private List<string> <expired>5__4; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>s__5; private bool <>s__6; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] private Dictionary<string, DateTime>.Enumerator <>s__7; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] private KeyValuePair<string, DateTime> <kvp>5__8; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] private List<string>.Enumerator <>s__9; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private string <key>5__10; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <Raffle_PendingTimeoutTick>d__150(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <wait>5__1 = null; <expired>5__4 = null; <>s__5 = null; <>s__7 = default(Dictionary<string, DateTime>.Enumerator); <kvp>5__8 = default(KeyValuePair<string, DateTime>); <>s__9 = default(List<string>.Enumerator); <key>5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <wait>5__1 = new WaitForSeconds(60f); break; case 1: <>1__state = -1; break; } try { if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { <timeoutMin>5__2 = PendingCodeTimeoutMinutes.Value; if (<timeoutMin>5__2 > 0) { <now>5__3 = DateTime.UtcNow; <expired>5__4 = new List<string>(); <>s__5 = _codesFileLock; <>s__6 = false; try { Monitor.Enter(<>s__5, ref <>s__6); <>s__7 = _rafflePendingCodes.GetEnumerator(); try { while (<>s__7.MoveNext()) { <kvp>5__8 = <>s__7.Current; if (<kvp>5__8.Value.AddMinutes(<timeoutMin>5__2) < <now>5__3) { <expired>5__4.Add(<kvp>5__8.Key); } <kvp>5__8 = default(KeyValuePair<string, DateTime>); } } finally { ((IDisposable)<>s__7).Dispose(); } <>s__7 = default(Dictionary<string, DateTime>.Enumerator); <>s__9 = <expired>5__4.GetEnumerator(); try { while (<>s__9.MoveNext()) { <key>5__10 = <>s__9.Current; _rafflePendingCodes.Remove(<key>5__10); <key>5__10 = null; } } finally { ((IDisposable)<>s__9).Dispose(); } <>s__9 = default(List<string>.Enumerator); } finally { if (<>s__6) { Monitor.Exit(<>s__5); } } <>s__5 = null; <expired>5__4 = null; } } } catch { } <>2__current = <wait>5__1; <>1__state = 1; return true; } 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 <Raffle_RegisterRpcs_WhenReady>d__149 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public RedeemPlugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <Raffle_RegisterRpcs_WhenReady>d__149(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (ZRoutedRpc.instance == null) { <>2__current = null; <>1__state = 1; return true; } Raffle_TryRegisterRpcs(); 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 <Raffle_Sequence>d__144 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public string code; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(new byte[] { 0, 1 })] public List<ZNetPeer> eligibleSnapshot; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private Random <rnd>5__1; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private ZNetPeer <winner>5__2; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private string <winnerName>5__3; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private string <title>5__4; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private StringBuilder <sb>5__5; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <Raffle_Sequence>d__144(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rnd>5__1 = null; <winner>5__2 = null; <winnerName>5__3 = null; <title>5__4 = null; <sb>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Raffle_SendStep("<color=green>SORTEIO DE GIFT KEY!</color>"); <>2__current = (object)new WaitForSeconds(4f); <>1__state = 1; return true; case 1: <>1__state = -1; Raffle_SendStep("<color=green>Iniciando sistema</color>"); <>2__current = (object)new WaitForSeconds(4f); <>1__state = 2; return true; case 2: <>1__state = -1; Raffle_SendStep("<color=green>Embaralhando os jogadores</color>"); <>2__current = (object)new WaitForSeconds(4f); <>1__state = 3; return true; case 3: <>1__state = -1; Raffle_SendStep("<color=green>Misturando as chances</color>"); <>2__current = (object)new WaitForSeconds(4f); <>1__state = 4; return true; case 4: <>1__state = -1; Raffle_SendStep("<color=green>3</color>"); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 5; return true; case 5: <>1__state = -1; Raffle_SendStep("<color=green>2</color>"); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 6; return true; case 6: <>1__state = -1; Raffle_SendStep("<color=green>1</color>"); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 7; return true; case 7: <>1__state = -1; <rnd>5__1 = new Random(Environment.TickCount ^ DateTime.UtcNow.Millisecond); <winner>5__2 = eligibleSnapshot[<rnd>5__1.Next(eligibleSnapshot.Count)]; <winnerName>5__3 = <winner>5__2.m_playerName; Raffle_SendStep("<color=green>O vencedor(a) foi:</color> <b>" + <winnerName>5__3 + "</b>!"); <>2__current = (object)new WaitForSeconds(4f); <>1__state = 8; return true; case 8: <>1__state = -1; Raffle_SendStep("<color=green>Uma mensagem privada foi enviada ao ganhador com as instruções.</color>"); <title>5__4 = "Parabéns! Você venceu o sorteio!"; <sb>5__5 = new StringBuilder(); <sb>5__5.AppendLine("Você recebeu um código do sistema Redeem."); <sb>5__5.AppendLine("Para resgatar, use: /redeem <CÓDIGO>"); <sb>5__5.AppendLine("O código foi salvo no seu personagem; consulte com redeem.mycode."); Raffle_SendPrivate(<winner>5__2.m_uid, <title>5__4, <sb>5__5.ToString(), code); _raffleBusy = 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(); } } [CompilerGenerated] private sealed class <RegisterRpcWhenReady>d__70 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public RedeemPlugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <RegisterRpcWhenReady>d__70(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (ZRoutedRpc.instance == null) { <>2__current = null; <>1__state = 1; return true; } TryRegisterRpcHandlers(); TryRegisterClientHandlers(); 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 <Rpc_RebindWatcher>d__151 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private object <>2__current; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] public RedeemPlugin <>4__this; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private WaitForSeconds <wait>5__1; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] private ZRoutedRpc <cur>5__2; object IEnumerator<object>.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] [return: <be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(0)] get { return <>2__current; } } [DebuggerHidden] public <Rpc_RebindWatcher>d__151(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <wait>5__1 = null; <cur>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <wait>5__1 = new WaitForSeconds(1f); break; case 1: <>1__state = -1; break; } try { <cur>5__2 = ZRoutedRpc.instance; if (<cur>5__2 != _lastRpcRef) { _lastRpcRef = <cur>5__2; if (<cur>5__2 != null) { ResetCoreRpcFlags(); TryRegisterRpcHandlers(); TryRegisterClientHandlers(); Raffle_ResetRpcFlags(); Raffle_TryRegisterRpcs(); } else { ResetCoreRpcFlags(); Raffle_ResetRpcFlags(); } } <cur>5__2 = null; } catch { } <>2__current = <wait>5__1; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal const string ModName = "Redeem"; internal const string ModVersion = "1.0.5"; internal const string Author = "radamanto"; private const string ModGUID = "radamanto.Redeem"; internal static ManualLogSource Log = null; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(2)] private static ConfigSync _configSync; private static ConfigEntry<bool> ServerConfigLocked = null; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(2)] private static SyncedConfigEntry<bool> SYNC_ServerConfigLocked; private static ConfigEntry<bool> AllowAdminsInRaffle = null; private static ConfigEntry<int> PendingCodeTimeoutMinutes = null; private const float DebounceSeconds = 2.5f; private const float SpawnYOffset = 0.5f; private const string PackagesFile = "packages.yml"; private const string CodesActiveFile = "code.active.yml"; private const string CodesClaimedFile = "code.claimed.yml"; private const string CodeInsertFile = "code.insert.yml"; private const int AttemptWindowSeconds = 300; private const int MaxAttemptsPerWindow = 5; private const int BlockSeconds = 900; private const int InFlightTimeoutSeconds = 60; private const int MaxCodeLength = 128; private const int RecentClaimedTtlDays = 7; private static readonly TimeSpan CodeLockOrphanTtl = TimeSpan.FromMinutes(10.0); private const string RPC_RedeemRequest = "VD_RedeemRequest"; private const string RPC_RedeemResult = "VD_RedeemResult"; private const string RPC_GiveItems = "VD_GiveItems"; private const string RPC_AckDelivery = "VD_AckDelivery"; private static readonly ConcurrentDictionary<long, DateTime> _lastRequestByPeer = new ConcurrentDictionary<long, DateTime>(); private static readonly ConcurrentDictionary<string, DateTime> _lastRequestByCode = new ConcurrentDictionary<string, DateTime>(); private static readonly ConcurrentDictionary<string, object> _codeLocks = new ConcurrentDictionary<string, object>(); private static readonly ConcurrentDictionary<string, DateTime> _codeLockTouched = new ConcurrentDictionary<string, DateTime>(); private static readonly ConcurrentDictionary<string, DateTime> _recentClaimed = new ConcurrentDictionary<string, DateTime>(); private static readonly ConcurrentDictionary<long, List<DateTime>> _attemptsByPeer = new ConcurrentDictionary<long, List<DateTime>>(); private static readonly ConcurrentDictionary<long, DateTime> _peerBlockedUntil = new ConcurrentDictionary<long, DateTime>(); internal static readonly object _codesFileLock = new object(); private static readonly object _packagesFileLock = new object(); private static readonly object _claimedFileLock = new object(); private static readonly ConcurrentDictionary<string, long> _inFlightCodes = new ConcurrentDictionary<string, long>(); private static readonly ConcurrentDictionary<string, DateTime> _inFlightExpires = new ConcurrentDictionary<string, DateTime>(); private static PackagesData _packages = new PackagesData(); private static CodesData _codes = new CodesData(); [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(2)] private FileSystemWatcher _watchPackages; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(2)] private FileSystemWatcher _watchCodesActive; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(2)] private FileSystemWatcher _watchCodeInsert; private static DateTime _codesLastWriteUtc = DateTime.MinValue; private static DateTime _insertLastHandledUtc = DateTime.MinValue; private const double InsertDebounceMs = 200.0; private static DateTime _packagesLastHandledUtc = DateTime.MinValue; private static DateTime _activeLastHandledUtc = DateTime.MinValue; private const double WatcherDebounceMs = 200.0; private static DateTime _pollPackagesLastWriteUtc = DateTime.MinValue; private static DateTime _pollCodesLastWriteUtc = DateTime.MinValue; private static DateTime _pollInsertLastWriteUtc = DateTime.MinValue; private static bool _rpcRequestRegistered = false; private static bool _rpcResultRegistered = false; private static bool _rpcGiveItemsRegistered = false; private static bool _rpcAckRegistered = false; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(2)] private static ZRoutedRpc _coreLastRpcRef = null; internal const string RPC_RaffleStep = "VD_RaffleStep"; internal const string RPC_RafflePrivateNote = "VD_RafflePrivateNote"; internal const string RPC_RaffleRequest = "VD_RaffleRequest"; internal const string RPC_RaffleRequestResult = "VD_RaffleRequestResult"; internal const string RPC_RaffleClaimedNotify = "VD_RaffleClaimedNotify"; internal const string RPC_RaffleSyncRequest = "VD_RaffleSyncRequest"; internal const string RPC_RaffleSyncResponse = "VD_RaffleSyncResponse"; private static bool _raffleStepRegistered = false; private static bool _rafflePrivateRegistered = false; private static bool _raffleRequestRegistered = false; private static bool _raffleResultRegistered = false; private static bool _raffleClaimedRegistered = false; private static bool _raffleSyncReqRegistered = false; private static bool _raffleSyncRespRegistered = false; private static volatile bool _raffleBusy = false; internal static readonly Dictionary<string, DateTime> _rafflePendingCodes = new Dictionary<string, DateTime>(StringComparer.OrdinalIgnoreCase); internal const string RD_RAFFLE_LAST_TITLE = "Redeem.Raffle.LastTitle"; internal const string RD_RAFFLE_LAST_BODY = "Redeem.Raffle.LastBody"; internal const string RD_RAFFLE_LAST_CODE = "Redeem.Raffle.LastCode"; internal const string RD_RAFFLE_LAST_UTC = "Redeem.Raffle.LastUtc"; internal const string RD_RAFFLE_PENDING = "Redeem.Raffle.PendingList"; [<be8d265a-b5f3-4442-90f8-fb1a7f94c948>Nullable(2)] private static ZRoutedRpc _lastRpcRef = null; private static string DataFolder => Path.Combine(Paths.ConfigPath, "Redeem_data"); private static string PackagesPath => Path.Combine(DataFolder, "packages.yml"); private static string CodesActivePath => Path.Combine(DataFolder, "code.active.yml"); private static string CodesClaimedPath => Path.Combine(DataFolder, "code.claimed.yml"); private static string CodeInsertPath => Path.Combine(DataFolder, "code.insert.yml"); private void Awake() { //IL_012a: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; ServerConfigLocked = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ServerConfigLocked", true, "When true, synced configs can only be changed by the server admins."); _configSync = new ConfigSync("radamanto.Redeem") { DisplayName = "Redeem", CurrentVersion = "1.0.5", MinimumRequiredVersion = "1.0.5", ModRequired = true }; SYNC_ServerConfigLocked = _configSync.AddLockingConfigEntry<bool>(ServerConfigLocked); AllowAdminsInRaffle = ((BaseUnityPlugin)this).Config.Bind<bool>("Raffle", "AllowAdmins", false, "Allow server admins to participate in raffles."); _configSync.AddConfigEntry<bool>(AllowAdminsInRaffle).SynchronizedConfig = true; PendingCodeTimeoutMinutes = ((BaseUnityPlugin)this).Config.Bind<int>("Raffle", "PendingCodeTimeoutMinutes", 30, "Minutes to auto-release pending raffle codes (0=disabled)."); _configSync.AddConfigEntry<int>(PendingCodeTimeoutMinutes).SynchronizedConfig = true; if (IsDedicatedEnvironment()) { Directory.CreateDirectory(DataFolder); EnsureSampleFiles(); LoadAll(); TryAttachWatchers(); ((MonoBehaviour)this).StartCoroutine(FilePoller()); ((MonoBehaviour)this).StartCoroutine(InFlightAndAntiFloodSweeper()); } new Harmony("radamanto.Redeem").PatchAll(); TryRegisterRpcHandlers(); ((MonoBehaviour)this).StartCoroutine(RegisterRpcWhenReady()); TryRegisterClientHandlers(); ((MonoBehaviour)this).StartCoroutine(Core_RpcRebindWatcher()); } private static bool IsDedicatedEnvironment() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4) { return true; } if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated()) { return true; } return false; } [IteratorStateMachine(typeof(<RegisterRpcWhenReady>d__70))] private IEnumerator RegisterRpcWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RegisterRpcWhenReady>d__70(0) { <>4__this = this }; } private void OnDestroy() { try { _watchPackages?.Dispose(); _watchCodesActive?.Dispose(); _watchCodeInsert?.Dispose(); } catch (Exception) { } } private static void ResetCoreRpcFlags() { _rpcRequestRegistered = false; _rpcResultRegistered = false; _rpcGiveItemsRegistered = false; _rpcAckRegistered = false; } private static void TryRegisterRpcHandlers() { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance == null) { return; } if (!_rpcRequestRegistered) { try { instance.Register<string>("VD_RedeemRequest", (Action<long, string>)OnRpcRedeemRequest_String); _rpcRequestRegistered = true; } catch (ArgumentException) { _rpcRequestRegistered = true; } catch (Exception) { } } if (_rpcAckRegistered) { return; } try { instance.Register<string>("VD_AckDelivery", (Action<long, string>)OnRpcAckDelivery_Server); _rpcAckRegistered = true; } catch (ArgumentException) { _rpcAckRegistered = true; } catch (Exception) { } } private static void TryRegisterClientHandlers() { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance == null) { return; } if (!_rpcResultRegistered) { try { instance.Register<ZPackage>("VD_RedeemResult", (Action<long, ZPackage>)OnRpcRedeemResult_Client); _rpcResultRegistered = true; } catch (ArgumentException) { _rpcResultRegistered = true; } catch (Exception) { } } if (_rpcGiveItemsRegistered) { return; } try { instance.Register<ZPackage>("VD_GiveItems", (Action<long, ZPackage>)OnRpcGiveItems_Client); _rpcGiveItemsRegistered = true; } catch (ArgumentException) { _rpcGiveItemsRegistered = true; } catch (Exception) { } } [IteratorStateMachine(typeof(<Core_RpcRebindWatcher>d__80))] private IEnumerator Core_RpcRebindWatcher() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Core_RpcRebindWatcher>d__80(0) { <>4__this = this }; } public static void ClientRequestRedeem(string code) { ZRoutedRpc instance = ZRoutedRpc.instance; ZNet instance2 = ZNet.instance; if (instance != null && !((Object)(object)instance2 == (Object)null) && !string.IsNullOrWhiteSpace(code)) { code = code.Trim(); ZNetPeer serverPeer = instance2.GetServerPeer(); if (serverPeer != null) { instance.InvokeRoutedRPC(serverPeer.m_uid, "VD_RedeemRequest", new object[1] { code }); } } } private static void OnRpcRedeemRequest_String(long senderId, string code) { if (!((Object)(object)ZNet.instance == (Object)null) && ZNet.instance.IsServer() && !string.IsNullOrWhiteSpace(code)) { HandleRedeemServer(senderId, code.Trim()); } } private static void HandleRedeemServer(long senderId, string codeRaw) { //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Expected O, but got Unknown DateTime utcNow = DateTime.UtcNow; if (_peerBlockedUntil.TryGetValue(senderId, out var value) && utcNow < value) { SendResultTo(senderId, success: false, $"Muitas tentativas. Aguarde {(int)Math.Max(1.0, (value - utcNow).TotalSeconds)}s."); return; } List<DateTime> orAdd = _attemptsByPeer.GetOrAdd(senderId, (long _) => new List<DateTime>(8)); lock (orAdd) { DateTime dateTime = utcNow.AddSeconds(-300.0); for (int num = orAdd.Count - 1; num >= 0; num--) { if (orAdd[num] < dateTime) { orAdd.RemoveAt(num); } } if (orAdd.Count >= 5) { _peerBlockedUntil[senderId] = utcNow.AddSeconds(900.0); SendResultTo(senderId, success: false, "Muitas tentativas. Aguarde alguns minutos."); return; } orAdd.Add(utcNow); } if (_lastRequestByPeer.TryGetValue(senderId, out var value2) && (utcNow - value2).TotalSeconds < Math.Max(0.1, 2.5)) { SendResultTo(senderId, success: false, "Aguarde um instante e tente novamente."); return; } _lastRequestByPeer[senderId] = utcNow; string text = codeRaw.Trim(); if (text.Length == 0 || text.Length > 128) { SendResultTo(senderId, success: false, "Código inválido."); return; } if (_lastRequestByCode.TryGetValue(text, out var value3) && (utcNow - value3).TotalSeconds < Math.Max(0.1, 2.5)) { SendResultTo(senderId, success: false, "Código em processamento, aguarde."); return; } _lastRequestByCode[text] = utcNow; DateTime value8; try { object orAdd2 = _codeLocks.GetOrAdd(text, (string _) => new object()); _codeLockTouched[text] = utcNow; lock (orAdd2) { TryReloadCodesSafe(); string package; lock (_codesFileLock) { if (!_codes.Codes.TryGetValue(text, out var value4)) { if (_recentClaimed.ContainsKey(text)) { SendResultTo(senderId, success: false, "Código já resgatado."); } else { SendResultTo(senderId, success: false, "Código não encontrado."); } return; } if (value4.Claimed) { SendResultTo(senderId, success: false, "Código já resgatado."); return; } package = value4.Package; } PackageDef value5; lock (_packagesFileLock) { if (!_packages.Packages.TryGetValue(package, out value5)) { SendResultTo(senderId, success: false, "Pacote inexistente."); return; } } ZNetPeer peer = ZNet.instance.GetPeer(senderId); if (peer == null) { SendResultTo(senderId, success: false, "Jogador desconectado."); return; } if (_inFlightCodes.TryGetValue(text, out var value6)) { if (!_inFlightExpires.TryGetValue(text, out var value7) || !(utcNow > value7)) { SendResultTo(senderId, success: false, "Código em processamento, aguarde."); return; } _inFlightCodes.TryRemove(text, out value6); _inFlightExpires.TryRemove(text, out value8); } if (!_inFlightCodes.TryAdd(text, senderId)) { SendResultTo(senderId, success: false, "Código em processamento, aguarde."); return; } try { _inFlightExpires[text] = utcNow.AddSeconds(60.0); ZPackage val = new ZPackage(); val.Write(text); val.Write(value5.Items.Count); foreach (ItemDef item in value5.Items) { val.Write(item.Prefab ?? ""); val.Write(item.Amount); val.Write(item.Quality); val.Write(item.Variant); } ZRoutedRpc instance = ZRoutedRpc.instance; if (instance != null) { instance.InvokeRoutedRPC(senderId, "VD_GiveItems", new object[1] { val }); } } catch (Exception) { _inFlightCodes.TryRemove(text, out value6); _inFlightExpires.TryRemove(text, out value8); throw; } } } finally { _lastRequestByCode.TryRemove(text, out value8); } } private static void OnRpcAckDelivery_Server(long senderId, string code) { if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer() || string.IsNullOrWhiteSpace(code)) { return; } if (!_inFlightCodes.TryGetValue(code, out var value) || value != senderId) { SendResultTo(senderId, success: false, "ACK inválido ou expirado."); return; } object orAdd = _codeLocks.GetOrAdd(code, (string _) => new object()); _codeLockTouched[code] = DateTime.UtcNow; bool flag = false; bool flag2 = false; DateTime value4; try { lock (orAdd) { CodeInfo value2; long value3; string package; lock (_codesFileLock) { if (!_codes.Codes.TryGetValue(code, out value2)) { _inFlightCodes.TryRemove(code, out value3); _inFlightExpires.TryRemove(code, out value4); SendResultTo(senderId, success: false, "Código inválido."); flag2 = true; return; } package = value2.Package; } CodeInfo codeInfo = new CodeInfo { Code = value2.Code, Package = value2.Package, Claimed = value2.Claimed, ClaimedAt = value2.ClaimedAt, ClaimedName = value2.ClaimedName }; try { lock (_codesFileLock) { flag = _codes.Codes.Remove(code); } SaveCodesAtomic(); try { string value5 = ZNet.instance.GetPeer(senderId)?.m_playerName ?? ""; string playerName = SanitizeField(value5, 64); AppendClaimedAtomic(code, package ?? "", playerName); } catch (Exception) { } _recentClaimed[code] = DateTime.UtcNow; _attemptsByPeer.TryRemove(senderId, out var _); _peerBlockedUntil.TryRemove(senderId, out value4); _inFlightCodes.TryRemove(code, out value3); _inFlightExpires.TryRemove(code, out value4); SendResultTo(senderId, success: true, "Pacote \"" + package + "\" entregue!"); Raffle_SendClaimedNotify(senderId, code); flag2 = true; } catch (Exception) { if (flag) { lock (_codesFileLock) { _codes.Codes[codeInfo.Code] = codeInfo; } } _inFlightCodes.TryRemove(code, out value3); _inFlightExpires.TryRemove(code, out value4); SendResultTo(senderId, success: false, "Falha ao persistir entrega. Tente novamente."); flag2 = true; } } } finally { if (flag2) { _codeLocks.TryRemove(code, out var _); _codeLockTouched.TryRemove(code, out value4); } } } private static void SendResultTo(long peerId, bool success, string message) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown try { ZPackage val = new ZPackage(); val.Write(success); val.Write(message ?? ""); ZRoutedRpc instance = ZRoutedRpc.instance; if (instance != null) { instance.InvokeRoutedRPC(peerId, "VD_RedeemResult", new object[1] { val }); } } catch (Exception) { } } private static void OnRpcRedeemResult_Client(long _sender, ZPackage pkg) { try { bool flag = pkg.ReadBool(); string text = pkg.ReadString(); MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)(flag ? 1 : 2), (flag ? "<color=green>" : "<color=red>") + text + "</color>", 0, (Sprite)null, false); } } catch (Exception) { } } private static void OnRpcGiveItems_Client(long sender, ZPackage pkg) { //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) try { ZNet instance = ZNet.instance; ZNetPeer val = ((instance != null) ? instance.GetServerPeer() : null); if (val == null || sender != val.m_uid) { return; } string text = pkg.ReadString(); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Humanoid)localPlayer).GetInventory() == null) { return; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); ObjectDB instance2 = ObjectDB.instance; if ((Object)(object)instance2 == (Object)null) { return; } int num = pkg.ReadInt(); for (int i = 0; i < num; i++) { string text2 = pkg.ReadString(); int num2 = pkg.ReadInt(); int num3 = pkg.ReadInt(); int num4 = pkg.ReadInt(); if (string.IsNullOrWhiteSpace(text2) || num2 <= 0) { continue; } GameObject itemPrefab = instance2.GetItemPrefab(text2); if ((Object)(object)itemPrefab == (Object)null) { continue; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { continue; } int val2 = Mathf.Max(1, component.m_itemData.m_shared.m_maxStackSize); int num5 = Mathf.Max(1, component.m_itemData.m_shared.m_maxQuality); int num6 = Mathf.Clamp((num3 <= 0) ? 1 : num3, 1, num5); int num7 = num2; while (num7 > 0) { int num8 = Math.Min(num7, val2); num7 -= num8; ItemData val3 = inventory.AddItem(text2, num8, num6, Mathf.Max(0, num4), 0L, "", false); if (val3 == null) { Vector3 val4 = ((Component)localPlayer).transform.position + new Vector3(0f, 0.5f, 0f); GameObject val5 = Object.Instantiate<GameObject>(itemPrefab, val4, Quaternion.identity); ItemDrop component2 = val5.GetComponent<ItemDrop>(); if ((Object)(object)component2 != (Object)null) { component2.m_itemData.m_stack = num8; component2.m_itemData.m_quality = num6; component2.m_itemData.m_variant = Mathf.Max(0, num4); component2.m_itemData.m_durability = component2.m_itemData.GetMaxDurability(); component2.m_autoPickup = true; } } } } ((Humanoid)localPlayer).m_pickupEffects.Create(((Component)localPlayer).transform.position, Quaternion.identity, (Transform)null, 1f, -1); ZRoutedRpc instance3 = ZRoutedRpc.instance; if (instance3 != null) { instance3.InvokeRoutedRPC(val.m_uid, "VD_AckDelivery", new object[1] { text }); } } catch (Exception) { } } private static string SamplePackagesYml() { return "# Redeem - packages.yml (example)\r\nPackages:\r\n - Id: starter\r\n Items:\r\n - Prefab: Coins, Amount: 500\r\n - Prefab: Wood, Amount: 100\r\n - Prefab: Stone, Amount: 100\r\n - Id: vip_bundle\r\n Items:\r\n - Prefab: Coins, Amount: 5000\r\n - Prefab: Bronze, Amount: 20\r\n - Prefab: Sausages, Amount: 20, Quality: 1\r\n"; } private static string SampleCodesYml() { return "# Redeem - code.active (example)\r\nCodes:\r\n - Code: ABCD-1234-START\r\n Package: starter\r\n Claimed: false\r\n - Code: VIP-ONLY-9999\r\n Package: vip_bundle\r\n Claimed: false\r\n"; } private static void EnsureSampleFiles() { Directory.CreateDirectory(DataFolder); if (!File.Exists(PackagesPath)) { File.WriteAllText(PackagesPath, SamplePackagesYml(), Encoding.UTF8); } if (!File.Exists(CodesActivePath)) { File.WriteAllText(CodesActivePath, SampleCodesYml(), Encoding.UTF8); } if (!File.Exists(CodesClaimedPath)) { File.WriteAllText(CodesClaimedPath, "", Encoding.UTF8); } if (!File.Exists(CodeInsertPath)) { string contents = "# Redeem - code.insert.yml\r\n# Edite a seção Codes e SALVE o arquivo para aplicar.\r\n# Se houver QUALQUER erro (duplicata em active, pacote inexistente, formato inválido),\r\n# nada é aplicado e este arquivo permanece intacto.\r\n\r\nCodes:\r\n - Code: NEW-EXAMPLE-0001\r\n Package: starter\r\n"; File.WriteAllText(CodeInsertPath, contents, Encoding.UTF8); } } private static void LoadAll() { lock (_packagesFileLock) { _packages = LoadPackagesYml(PackagesPath); } lock (_codesFileLock) { _codes = LoadCodesYml(CodesActivePath); try { _codesLastWriteUtc = GetLastWriteUtcSafe(CodesActivePath); } catch (Exception) { } } ReindexClaimedFromFile(); TryProcessSingleInsert(); } private static void TryReloadCodesSafe() { try { lock (_codesFileLock) { DateTime lastWriteUtcSafe = GetLastWriteUtcSafe(CodesActivePath); if (!(lastWriteUtcSafe <= _codesLastWriteUtc)) { _codes = LoadCodesYml(CodesActivePath); _codesLastWriteUtc = lastWriteUtcSafe; } } } catch (Exception) { } } private void TryAttachWatchers() { try { _watchPackages = new FileSystemWatcher(Path.GetDirectoryName(PackagesPath), Path.GetFileName(PackagesPath)) { IncludeSubdirectories = false, EnableRaisingEvents = true, NotifyFilter = (NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite) }; _watchPackages.Changed += [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] (object _, FileSystemEventArgs __) => { try { DateTime utcNow3 = DateTime.UtcNow; if ((utcNow3 - _packagesLastHandledUtc).TotalMilliseconds < 200.0) { return; } _packagesLastHandledUtc = utcNow3; lock (_packagesFileLock) { _packages = LoadPackagesYml(PackagesPath); } } catch (Exception) { } }; } catch (Exception) { } try { _watchCodesActive = new FileSystemWatcher(Path.GetDirectoryName(CodesActivePath), Path.GetFileName(CodesActivePath)) { IncludeSubdirectories = false, EnableRaisingEvents = true, NotifyFilter = (NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite) }; _watchCodesActive.Changed += [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] (object _, FileSystemEventArgs __) => { try { DateTime utcNow2 = DateTime.UtcNow; if (!((utcNow2 - _activeLastHandledUtc).TotalMilliseconds < 200.0)) { _activeLastHandledUtc = utcNow2; TryReloadCodesSafe(); } } catch (Exception) { } }; } catch (Exception) { } try { _watchCodeInsert = new FileSystemWatcher(Path.GetDirectoryName(CodeInsertPath), Path.GetFileName(CodeInsertPath)) { IncludeSubdirectories = false, EnableRaisingEvents = true, NotifyFilter = (NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.LastWrite) }; _watchCodeInsert.Changed += [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] (object _, FileSystemEventArgs __) => { DateTime utcNow = DateTime.UtcNow; if (!((utcNow - _insertLastHandledUtc).TotalMilliseconds < 200.0)) { _insertLastHandledUtc = utcNow; TryProcessSingleInsert(); } }; } catch (Exception) { } } [IteratorStateMachine(typeof(<FilePoller>d__94))] private IEnumerator FilePoller() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FilePoller>d__94(0) { <>4__this = this }; } private static void TryProcessSingleInsert() { if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer()) { return; } try { if (!File.Exists(CodeInsertPath)) { return; } List<string> list = DetectInternalInsertDuplicates(CodeInsertPath); if (list.Count > 0) { return; } CodesData codesData; try { codesData = LoadCodesYml(CodeInsertPath); } catch (Exception) { return; } if (codesData.Codes.Count == 0) { return; } lock (_codesFileLock) { foreach (KeyValuePair<string, CodeInfo> code in codesData.Codes) { string key = code.Key; if (string.IsNullOrWhiteSpace(key) || key.Length > 128 || _codes.Codes.ContainsKey(key)) { return; } } } if (ClaimedFileContainsAny(codesData.Codes.Keys, out var _)) { return; } lock (_packagesFileLock) { foreach (CodeInfo value in codesData.Codes.Values) { if (string.IsNullOrWhiteSpace(value.Package) || !_packages.Packages.ContainsKey(value.Package)) { return; } } } lock (_codesFileLock) { foreach (CodeInfo value2 in codesData.Codes.Values) { _codes.Codes[value2.Code] = new CodeInfo { Code = value2.Code, Package = value2.Package, Claimed = false, ClaimedAt = null, ClaimedName = "" }; } SaveCodesAtomic(); } try { string contents = "# Redeem - code.insert.yml\r\n# Edite a seção Codes e SALVE o arquivo para aplicar.\r\nCodes:\r\n"; File.WriteAllText(CodeInsertPath, contents, Encoding.UTF8); } catch (Exception) { } } catch (Exception) { } } private static void SaveCodesAtomic() { lock (_codesFileLock) { string codesActivePath = CodesActivePath; string text = codesActivePath + ".tmp"; string text2 = codesActivePath + ".bak"; string contents = DumpCodesYml(_codes); int num = 0; while (true) { try { File.WriteAllText(text, contents, Encoding.UTF8); if (File.Exists(text2)) { File.Delete(text2); } if (File.Exists(codesActivePath)) { File.Move(codesActivePath, text2); } File.Move(text, codesActivePath); _codesLastWriteUtc = GetLastWriteUtcSafe(codesActivePath); try { File.Delete(text2); break; } catch (Exception) { break; } } catch (IOException) { if (++num >= 3) { throw; } Thread.Sleep(num switch { 2 => 100, 1 => 50, _ => 200, }); } catch (UnauthorizedAccessException) { if (++num >= 3) { throw; } Thread.Sleep(num switch { 2 => 100, 1 => 50, _ => 200, }); } } } } private static bool ClaimedFileContainsAny(IEnumerable<string> codes, out string foundCode) { foundCode = ""; try { if (!File.Exists(CodesClaimedPath)) { return false; } HashSet<string> hashSet = new HashSet<string>(codes.Where([<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] (string c) => !string.IsNullOrWhiteSpace(c)), StringComparer.OrdinalIgnoreCase); if (hashSet.Count == 0) { return false; } using FileStream stream = new FileStream(CodesClaimedPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, 8192); string text; while ((text = streamReader.ReadLine()) != null) { if (string.IsNullOrWhiteSpace(text)) { continue; } string[] array = text.Split(new char[1] { '\t' }); if (array.Length >= 2) { string text2 = array[1].Trim(); if (text2.Length != 0 && hashSet.Contains(text2)) { foundCode = text2; return true; } } } } catch (Exception) { } return false; } private static DateTime GetLastWriteUtcSafe(string path) { try { return File.Exists(path) ? File.GetLastWriteTimeUtc(path) : DateTime.MinValue; } catch { return DateTime.MinValue; } } private static void AppendClaimedAtomic(string code, string package, string playerName) { lock (_claimedFileLock) { code = SanitizeField(code, 128); package = SanitizeField(package, 128); playerName = SanitizeField(playerName, 64); string contents = string.Format(CultureInfo.InvariantCulture, "{0:u}\t{1}\t{2}\t{3}\n", DateTime.UtcNow, code, package, playerName); int num = 0; while (true) { try { File.AppendAllText(CodesClaimedPath, contents, Encoding.UTF8); break; } catch (IOException) { if (++num >= 3) { throw; } Thread.Sleep(num switch { 2 => 100, 1 => 50, _ => 200, }); } catch (UnauthorizedAccessException) { if (++num >= 3) { throw; } Thread.Sleep(num switch { 2 => 100, 1 => 50, _ => 200, }); } } } } private static void ReindexClaimedFromFile() { try { if (!File.Exists(CodesClaimedPath)) { return; } _recentClaimed.Clear(); using FileStream stream = new FileStream(CodesClaimedPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true, 8192); string text; while ((text = streamReader.ReadLine()) != null) { if (string.IsNullOrWhiteSpace(text)) { continue; } string[] array = text.Split(new char[1] { '\t' }); if (array.Length >= 2) { string text2 = array[1].Trim(); if (text2.Length != 0) { DateTime result; DateTime value = ((array.Length < 1 || !DateTime.TryParse(array[0].Trim(), CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out result)) ? DateTime.UtcNow : result); _recentClaimed[text2] = value; } } } } catch (Exception) { } } private static PackagesData LoadPackagesYml(string path) { PackagesData packagesData = new PackagesData(); if (!File.Exists(path)) { return packagesData; } string[] array; try { array = File.ReadAllLines(path); } catch (Exception) { return packagesData; } PackageDef packageDef = null; bool flag = false; bool flag2 = false; string[] array2 = array; foreach (string text in array2) { string text2 = text.Replace("\t", " ").Trim(); if (text2.StartsWith("#") || text2.Length == 0) { continue; } if (text2.StartsWith("Packages:", StringComparison.OrdinalIgnoreCase)) { flag = true; } else { if (!flag) { continue; } Match match = Regex.Match(text2, "^-+\\s*Id\\s*:\\s*(.+)$", RegexOptions.IgnoreCase); if (match.Success) { packageDef = new PackageDef { Id = match.Groups[1].Value.Trim() }; packagesData.Packages[packageDef.Id] = packageDef; } else { if (packageDef == null) { continue; } if (text2.StartsWith("Items:", StringComparison.OrdinalIgnoreCase)) { flag2 = true; } else if (flag2) { Match match2 = Regex.Match(text2, "^-\\s*Prefab\\s*:\\s*([^,]+)(?:,|$)", RegexOptions.IgnoreCase); if (match2.Success) { ItemDef itemDef = new ItemDef { Prefab = match2.Groups[1].Value.Trim() }; itemDef.Amount = GetIntField(text2, "Amount", 1); itemDef.Quality = GetIntField(text2, "Quality", 1); itemDef.Variant = GetIntField(text2, "Variant", 0); packageDef.Items.Add(itemDef); } } } } } return packagesData; } private static int GetIntField(string line, string key, int def) { Match match = Regex.Match(line, key + "\\s*:\\s*([-]?\\d+)", RegexOptions.IgnoreCase); if (match.Success && int.TryParse(match.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } return def; } private static CodesData LoadCodesYml(string path) { CodesData codesData = new CodesData(); if (!File.Exists(path)) { return codesData; } string[] array; try { array = File.ReadAllLines(path); } catch (Exception) { return codesData; } bool flag = false; CodeInfo codeInfo = null; string[] array2 = array; foreach (string text in array2) { string text2 = text.Replace("\t", " ").Trim(); if (text2.StartsWith("#") || text2.Length == 0) { continue; } if (text2.StartsWith("Codes:", StringComparison.OrdinalIgnoreCase)) { flag = true; } else { if (!flag) { continue; } Match match = Regex.Match(text2, "^-+\\s*Code\\s*:\\s*(.+)$", RegexOptions.IgnoreCase); if (match.Success) { codeInfo = new CodeInfo { Code = match.Groups[1].Value.Trim() }; codesData.Codes[codeInfo.Code] = codeInfo; } else { if (codeInfo == null) { continue; } Match match2 = Regex.Match(text2, "^Package\\s*:\\s*(.+)$", RegexOptions.IgnoreCase); if (match2.Success) { codeInfo.Package = match2.Groups[1].Value.Trim(); continue; } Match match3 = Regex.Match(text2, "^Claimed\\s*:\\s*(.+)$", RegexOptions.IgnoreCase); if (match3.Success) { string text3 = match3.Groups[1].Value.Trim(); codeInfo.Claimed = text3.Equals("true", StringComparison.OrdinalIgnoreCase); } } } } return codesData; } private static string DumpCodesYml(CodesData data) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("# Redeem - code.active"); stringBuilder.AppendLine("Codes:"); foreach (KeyValuePair<string, CodeInfo> item in data.Codes.OrderBy<KeyValuePair<string, CodeInfo>, string>([<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] (KeyValuePair<string, CodeInfo> k) => k.Key, StringComparer.OrdinalIgnoreCase)) { CodeInfo value = item.Value; stringBuilder.AppendLine(" - Code: " + value.Code); stringBuilder.AppendLine(" Package: " + value.Package); stringBuilder.AppendLine(" Claimed: " + (value.Claimed ? "true" : "false")); } return stringBuilder.ToString(); } private static string SanitizeField(string value, int maxLength) { if (string.IsNullOrEmpty(value)) { return ""; } StringBuilder stringBuilder = new StringBuilder(value.Length); foreach (char c in value) { if (c >= ' ' && c != '\t' && c != '\n' && c != '\r') { stringBuilder.Append(c); if (stringBuilder.Length >= maxLength) { break; } } } return stringBuilder.ToString(); } private static List<string> DetectInternalInsertDuplicates(string path) { List<string> list = new List<string>(); try { if (!File.Exists(path)) { return list; } string[] array = File.ReadAllLines(path); bool flag = false; HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); string[] array2 = array; foreach (string text in array2) { string text2 = text.Replace("\t", " ").Trim(); if (text2.StartsWith("#") || text2.Length == 0) { continue; } if (text2.StartsWith("Codes:", StringComparison.OrdinalIgnoreCase)) { flag = true; } else { if (!flag) { continue; } Match match = Regex.Match(text2, "^-+\\s*Code\\s*:\\s*(.+)$", RegexOptions.IgnoreCase); if (match.Success) { string text3 = match.Groups[1].Value.Trim(); if (text3.Length != 0 && !hashSet.Add(text3) && !list.Contains<string>(text3, StringComparer.OrdinalIgnoreCase)) { list.Add(text3); } } } } } catch (Exception) { } return list; } [IteratorStateMachine(typeof(<InFlightAndAntiFloodSweeper>d__107))] private IEnumerator InFlightAndAntiFloodSweeper() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InFlightAndAntiFloodSweeper>d__107(0) { <>4__this = this }; } internal static string RemoveRichText(string s) { return Regex.Replace(s ?? "", "<.*?>", ""); } internal static List<string> RD_LoadPending(Player p) { if ((Object)(object)p == (Object)null) { return new List<string>(); } if (!p.m_customData.TryGetValue("Redeem.Raffle.PendingList", out var value) || string.IsNullOrWhiteSpace(value)) { return new List<string>(); } List<string> list = new List<string>(); string[] array = value.Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (string s in array) { string text = RemoveRichText(s).Trim(); if (!string.IsNullOrWhiteSpace(text)) { list.Add(text); } } return list; } internal static void RD_SavePending(Player p, List<string> list) { if (!((Object)(object)p == (Object)null)) { p.m_customData["Redeem.Raffle.PendingList"] = string.Join("\n", list.Distinct<string>(StringComparer.OrdinalIgnoreCase)); } } internal static void Raffle_TryRegisterRpcs() { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance == null) { return; } if (!_raffleStepRegistered) { try { instance.Register<ZPackage>("VD_RaffleStep", (Action<long, ZPackage>)Raffle_OnStep_Client); _raffleStepRegistered = true; } catch (ArgumentException) { _raffleStepRegistered = true; } catch (Exception arg) { Log.LogWarning((object)string.Format("[Redeem] Raffle: falha ao registrar {0}: {1}", "VD_RaffleStep", arg)); } } if (!_rafflePrivateRegistered) { try { instance.Register<ZPackage>("VD_RafflePrivateNote", (Action<long, ZPackage>)Raffle_OnPrivateNote_Client); _rafflePrivateRegistered = true; } catch (ArgumentException) { _rafflePrivateRegistered = true; } catch (Exception arg2) { Log.LogWarning((object)string.Format("[Redeem] Raffle: falha ao registrar {0}: {1}", "VD_RafflePrivateNote", arg2)); } } if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer() && !_raffleRequestRegistered) { try { instance.Register<ZPackage>("VD_RaffleRequest", (Action<long, ZPackage>)Raffle_OnRequest_Server); _raffleRequestRegistered = true; } catch (ArgumentException) { _raffleRequestRegistered = true; } catch (Exception arg3) { Log.LogWarning((object)string.Format("[Redeem] Raffle: falha ao registrar {0}: {1}", "VD_RaffleRequest", arg3)); } } if (!_raffleResultRegistered) { try { instance.Register<ZPackage>("VD_RaffleRequestResult", (Action<long, ZPackage>)Raffle_OnRequestResult_Client); _raffleResultRegistered = true; } catch (ArgumentException) { _raffleResultRegistered = true; } catch (Exception arg4) { Log.LogWarning((object)string.Format("[Redeem] Raffle: falha ao registrar {0}: {1}", "VD_RaffleRequestResult", arg4)); } } if (!_raffleClaimedRegistered) { try { instance.Register<ZPackage>("VD_RaffleClaimedNotify", (Action<long, ZPackage>)Raffle_OnClaimedNotify_Client); _raffleClaimedRegistered = true; } catch (ArgumentException) { _raffleClaimedRegistered = true; } catch (Exception arg5) { Log.LogWarning((object)string.Format("[Redeem] Raffle: falha ao registrar {0}: {1}", "VD_RaffleClaimedNotify", arg5)); } } if (!_raffleSyncRespRegistered) { try { instance.Register<ZPackage>("VD_RaffleSyncResponse", (Action<long, ZPackage>)Raffle_OnSyncResponse_Client); _raffleSyncRespRegistered = true; } catch (ArgumentException) { _raffleSyncRespRegistered = true; } catch (Exception arg6) { Log.LogWarning((object)string.Format("[Redeem] Raffle: falha ao registrar {0}: {1}", "VD_RaffleSyncResponse", arg6)); } } if (!((Object)(object)ZNet.instance != (Object)null) || !ZNet.instance.IsServer() || _raffleSyncReqRegistered) { return; } try { instance.Register<ZPackage>("VD_RaffleSyncRequest", (Action<long, ZPackage>)Raffle_OnSyncRequest_Server); _raffleSyncReqRegistered = true; } catch (ArgumentException) { _raffleSyncReqRegistered = true; } catch (Exception arg7) { Log.LogWarning((object)string.Format("[Redeem] Raffle: falha ao registrar {0}: {1}", "VD_RaffleSyncRequest", arg7)); } } internal static void Raffle_ResetRpcFlags() { _raffleStepRegistered = false; _rafflePrivateRegistered = false; _raffleRequestRegistered = false; _raffleResultRegistered = false; _raffleClaimedRegistered = false; _raffleSyncReqRegistered = false; _raffleSyncRespRegistered = false; } private static void Raffle_OnStep_Client(long _sender, ZPackage pkg) { try { string text = pkg.ReadString(); if (!string.IsNullOrEmpty(text)) { MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)2, text, 0, (Sprite)null, false); } } } catch { } } private static void Raffle_OnPrivateNote_Client(long sender, ZPackage pkg) { ZNet instance = ZNet.instance; ZNetPeer val = ((instance != null) ? instance.GetServerPeer() : null); if (val == null || sender != val.m_uid) { return; } string text; string text2; string text3; try { text = pkg.ReadString(); text2 = pkg.ReadString(); text3 = pkg.ReadString() ?? ""; } catch { return; } string value = DateTime.UtcNow.ToString("u"); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } string codeClean = RemoveRichText(text3 ?? "").Trim(); try { Dictionary<string, string> customData = localPlayer.m_customData; customData["Redeem.Raffle.LastTitle"] = text ?? ""; customData["Redeem.Raffle.LastBody"] = text2 ?? ""; customData["Redeem.Raffle.LastCode"] = text3; customData["Redeem.Raffle.LastUtc"] = value; if (!string.IsNullOrEmpty(codeClean)) { List<string> list = RD_LoadPending(localPlayer); if (!list.Any([<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(0)] (string s) => string.Equals(s, codeClean, StringComparison.OrdinalIgnoreCase))) { list.Add(codeClean); RD_SavePending(localPlayer, list); } } } catch { } try { if ((Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString("Parabéns! Você venceu o sorteio!"); if (!string.IsNullOrEmpty(codeClean)) { ((Terminal)Chat.instance).AddString("Código: " + codeClean); } ((Terminal)Chat.instance).AddString("Use /redeem <CÓDIGO> (ou 'redeem.mycode')."); } } catch { } try { if ((Object)(object)MessageHud.instance != (Object)null) { string text4 = (string.IsNullOrEmpty(codeClean) ? "Você venceu o sorteio! Código salvo." : ("Você venceu o sorteio! Código: " + codeClean)); MessageHud.instance.ShowMessage((MessageType)1, text4, 0, (Sprite)null, false); } } catch { } } private static void Raffle_OnRequestResult_Client(long sender, ZPackage pkg) { try { ZNet instance = ZNet.instance; ZNetPeer val = ((instance != null) ? instance.GetServerPeer() : null); if (val == null || sender != val.m_uid) { return; } bool flag = pkg.ReadBool(); string text = pkg.ReadString(); if (flag) { Console instance2 = Console.instance; if (instance2 != null) { ((Terminal)instance2).AddString("[Redeem] " + text); } } else { Console instance3 = Console.instance; if (instance3 != null) { ((Terminal)instance3).AddString("[Redeem] ERRO: " + text); } } } catch { } } private static void Raffle_OnSyncResponse_Client(long sender, ZPackage pkg) { try { ZNet instance = ZNet.instance; ZNetPeer val = ((instance != null) ? instance.GetServerPeer() : null); if (val == null || sender != val.m_uid) { return; } int num = pkg.ReadInt(); List<string> list = new List<string>(Mathf.Max(0, num)); for (int i = 0; i < num; i++) { string text = RemoveRichText(pkg.ReadString() ?? "").Trim(); if (!string.IsNullOrWhiteSpace(text)) { list.Add(text); } } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } RD_SavePending(localPlayer, list); if (list.Count == 0) { Dictionary<string, string> customData = localPlayer.m_customData; customData.Remove("Redeem.Raffle.LastTitle"); customData.Remove("Redeem.Raffle.LastBody"); customData.Remove("Redeem.Raffle.LastCode"); customData.Remove("Redeem.Raffle.LastUtc"); Console instance2 = Console.instance; if (instance2 != null) { ((Terminal)instance2).AddString("Nenhum código pendente."); } MessageHud instance3 = MessageHud.instance; if (instance3 != null) { instance3.ShowMessage((MessageType)1, "Nenhum código pendente.", 0, (Sprite)null, false); } return; } Console instance4 = Console.instance; if (instance4 != null) { ((Terminal)instance4).AddString($"Códigos pendentes ({list.Count}) [sincronizado]:"); } foreach (string item in list) { Console instance5 = Console.instance; if (instance5 != null) { ((Terminal)instance5).AddString(" - " + item); } } if ((Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString($"[Redeem] Você possui {list.Count} código(s) pendente(s)."); { foreach (string item2 in list) { ((Terminal)Chat.instance).AddString("Código: " + item2); } return; } } MessageHud instance6 = MessageHud.instance; if (instance6 != null) { instance6.ShowMessage((MessageType)1, $"Você possui {list.Count} código(s) pendente(s).", 0, (Sprite)null, false); } } catch { } } private static void Raffle_OnClaimedNotify_Client(long sender, ZPackage pkg) { try { ZNet instance = ZNet.instance; ZNetPeer val = ((instance != null) ? instance.GetServerPeer() : null); if (val == null || sender != val.m_uid) { return; } string s = pkg.ReadString() ?? ""; string codeClean = RemoveRichText(s).Trim(); Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !string.IsNullOrWhiteSpace(codeClean)) { List<string> list = RD_LoadPending(localPlayer); int num = list.RemoveAll((string c) => string.Equals(c, codeClean, StringComparison.OrdinalIgnoreCase)); Dictionary<string, string> customData = localPlayer.m_customData; if (num > 0) { RD_SavePending(localPlayer, list); } if (list.Count == 0) { customData.Remove("Redeem.Raffle.LastTitle"); customData.Remove("Redeem.Raffle.LastBody"); customData.Remove("Redeem.Raffle.LastCode"); customData.Remove("Redeem.Raffle.LastUtc"); } if (num > 0 && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString("[Redeem] Código \"" + codeClean + "\" removido da sua lista (resgatado)."); } } } catch { } } private static void Raffle_OnRequest_Server(long senderPeerId, ZPackage pkg) { try { if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer()) { return; } string text = pkg.ReadString()?.Trim() ?? ""; ZNetPeer peer = ZNet.instance.GetPeer(senderPeerId); if (peer == null) { Raffle_SendRequestResult(senderPeerId, ok: false, "Solicitante inválido."); return; } ISocket socket = peer.m_rpc.GetSocket(); string text2 = ((socket != null) ? socket.GetHostName() : null) ?? string.Empty; if (!ZNet.instance.IsAdmin(text2) && !ZNet.instance.IsAdmin(peer.m_playerName ?? string.Empty) && !ZNet.instance.IsAdmin(peer.m_uid.ToString())) { Raffle_SendRequestResult(senderPeerId, ok: false, "Apenas administradores."); return; } lock (_codesFileLock) { if (string.IsNullOrEmpty(text) || !_codes.Codes.TryGetValue(text, out var value)) { Raffle_SendRequestResult(senderPeerId, ok: false, "Código inválido ou não encontrado."); return; } if (value.Claimed) { Raffle_SendRequestResult(senderPeerId, ok: false, "Código já utilizado."); return; } if (_rafflePendingCodes.ContainsKey(text)) { Raffle_SendRequestResult(senderPeerId, ok: false, "Já sorteado e ainda pendente."); return; } } if (_raffleBusy) { Raffle_SendRequestResult(senderPeerId, ok: false, "Já existe um sorteio em andamento."); return; } Raffle_SendRequestResult(senderPeerId, ok: true, "Sorteio autorizado. Executando..."); Raffle_Execute(text); } catch { Raffle_SendRequestResult(senderPeerId, ok: false, "Falha interna."); } } private static void Raffle_OnSyncRequest_Server(long senderPeerId, ZPackage pkg) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown try { if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer()) { return; } int num = pkg.ReadInt(); List<string> list = new List<string>(Mathf.Max(0, num)); for (int i = 0; i < num; i++) { string text = RemoveRichText(pkg.ReadString() ?? "").Trim(); if (!string.IsNullOrWhiteSpace(text)) { list.Add(text); } } List<string> list2 = new List<string>(); lock (_codesFileLock) { foreach (string item in list) { if (_codes.Codes.TryGetValue(item, out var value) && !value.Claimed && _rafflePendingCodes.ContainsKey(item)) { list2.Add(item); } } } ZRoutedRpc instance = ZRoutedRpc.instance; if (instance == null) { return; } ZPackage val = new ZPackage(); val.Write(list2.Count); foreach (string item2 in list2) { val.Write(item2); } instance.InvokeRoutedRPC(senderPeerId, "VD_RaffleSyncResponse", new object[1] { val }); } catch { } } private static void Raffle_SendRequestResult(long peerId, bool ok, string message) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown try { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance != null) { ZPackage val = new ZPackage(); val.Write(ok); val.Write(message ?? ""); instance.InvokeRoutedRPC(peerId, "VD_RaffleRequestResult", new object[1] { val }); } } catch { } } private static void Raffle_SendStep(string messageRich) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown try { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance != null) { ZPackage val = new ZPackage(); val.Write(messageRich ?? ""); instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "VD_RaffleStep", new object[1] { val }); } } catch { } } internal static void Raffle_Execute(string code) { //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer()) { return; } Raffle_TryRegisterRpcs(); if (_raffleBusy) { Raffle_SendStep("<color=red>Já existe um sorteio em andamento.</color>"); return; } string text = (code ?? "").Trim(); if (string.IsNullOrEmpty(text)) { Raffle_SendStep("<color=red>Código vazio.</color>"); return; } lock (_codesFileLock) { if (!_codes.Codes.TryGetValue(text, out var value)) { Raffle_SendStep("<color=red>Código não encontrado.</color>"); return; } if (value.Claimed) { Raffle_SendStep("<color=red>Código já utilizado.</color>"); return; } if (_rafflePendingCodes.ContainsKey(text)) { Raffle_SendStep("<color=red>Já sorteado e pendente.</color>"); return; } _rafflePendingCodes[text] = DateTime.UtcNow; } List<ZNetPeer> connectedPeers = ZNet.instance.GetConnectedPeers(); List<ZNetPeer> list = new List<ZNetPeer>(); bool value2 = AllowAdminsInRaffle.Value; foreach (ZNetPeer item in connectedPeers) { if (item == null || item.m_server || string.IsNullOrWhiteSpace(item.m_playerName) || item.m_characterID == ZDOID.None) { continue; } if (!value2) { ISocket socket = item.m_rpc.GetSocket(); string text2 = ((socket != null) ? socket.GetHostName() : null) ?? string.Empty; if (ZNet.instance.IsAdmin(text2) || ZNet.instance.IsAdmin(item.m_playerName ?? string.Empty) || ZNet.instance.IsAdmin(item.m_uid.ToString())) { continue; } } list.Add(item); } if (list.Count == 0) { lock (_codesFileLock) { _rafflePendingCodes.Remove(text); } Raffle_SendStep("<color=red>Nenhum jogador elegível.</color>"); } else { _raffleBusy = true; ((MonoBehaviour)ZNet.instance).StartCoroutine(Raffle_Sequence(text, list)); } } [IteratorStateMachine(typeof(<Raffle_Sequence>d__144))] private static IEnumerator Raffle_Sequence(string code, List<ZNetPeer> eligibleSnapshot) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Raffle_Sequence>d__144(0) { code = code, eligibleSnapshot = eligibleSnapshot }; } internal static void Raffle_SendPrivate(long peerId, string title, string body, string code) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown try { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance != null) { ZPackage val = new ZPackage(); val.Write(title ?? ""); val.Write(body ?? ""); val.Write(code ?? ""); instance.InvokeRoutedRPC(peerId, "VD_RafflePrivateNote", new object[1] { val }); } } catch { } } internal static void Raffle_SendClaimedNotify(long peerId, string code) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown try { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance != null) { ZPackage val = new ZPackage(); val.Write(code ?? ""); instance.InvokeRoutedRPC(peerId, "VD_RaffleClaimedNotify", new object[1] { val }); } } catch { } } private void Start() { ((MonoBehaviour)this).StartCoroutine(Raffle_RegisterRpcs_WhenReady()); ((MonoBehaviour)this).StartCoroutine(Rpc_RebindWatcher()); if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { ((MonoBehaviour)this).StartCoroutine(Raffle_PendingTimeoutTick()); } } [IteratorStateMachine(typeof(<Raffle_RegisterRpcs_WhenReady>d__149))] private IEnumerator Raffle_RegisterRpcs_WhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Raffle_RegisterRpcs_WhenReady>d__149(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<Raffle_PendingTimeoutTick>d__150))] private IEnumerator Raffle_PendingTimeoutTick() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Raffle_PendingTimeoutTick>d__150(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<Rpc_RebindWatcher>d__151))] private IEnumerator Rpc_RebindWatcher() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Rpc_RebindWatcher>d__151(0) { <>4__this = this }; } } [HarmonyPatch(typeof(Terminal), "Awake")] internal static class Redeem_Terminal_Awake_Patch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__1_0; internal void <Postfix>b__1_0(ConsoleEventArgs args) { if (args.Args != null && args.Args.Length >= 2) { string code = string.Join(" ", args.Args.Skip(1)); RedeemPlugin.ClientRequestRedeem(code); } } } private static bool _registered; private static void Postfix() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown try { if (_registered) { return; } _registered = true; if (Terminal.commands.ContainsKey("redeem")) { return; } object obj = <>c.<>9__1_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (args.Args != null && args.Args.Length >= 2) { string code = string.Join(" ", args.Args.Skip(1)); RedeemPlugin.ClientRequestRedeem(code); } }; <>c.<>9__1_0 = val; obj = (object)val; } new ConsoleCommand("redeem", "redeem <CODE> - Resgata um pacote Redeem", (ConsoleEvent)obj, false, true, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } catch (Exception) { } } } [HarmonyPatch(typeof(Chat), "SendText")] internal static class Redeem_ChatSendText_Patch { [<43815e13-402f-407e-9e25-db2b91c6fb17>NullableContext(1)] private static bool Prefix(Type type, string text) { if (string.IsNullOrWhiteSpace(text)) { return true; } if (text.StartsWith("/redeem ", StringComparison.OrdinalIgnoreCase)) { int num = text.IndexOf(' '); if (num > 0 && num + 1 < text.Length) { string text2 = text.Substring(num + 1).Trim(); if (!string.IsNullOrEmpty(text2)) { RedeemPlugin.ClientRequestRedeem(text2); return false; } } } return true; } } [HarmonyPatch(typeof(Terminal), "Awake")] internal static class Redeem_Raffle_Terminal_Awake_Patch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; public static ConsoleEvent <>9__0_1; internal void <Postfix>b__0_0(ConsoleEventArgs args) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown try { RedeemPlugin.Raffle_TryRegisterRpcs(); if (args?.Args == null || args.Args.Length < 2) { Console instance = Console.instance; if (instance != null) { ((Terminal)instance).AddString("Uso: redeem.raffle <CODE>"); } return; } string text = string.Join(" ", args.Args.Skip(1)); if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { RedeemPlugin.Raffle_Execute(text); return; } ZRoutedRpc instance2 = ZRoutedRpc.instance; if (instance2 == null) { Console instance3 = Console.instance; if (instance3 != null) { ((Terminal)instance3).AddString("Redeem: RPC indisponível."); } return; } ZPackage val = new ZPackage(); val.Write(text); instance2.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "VD_RaffleRequest", new object[1] { val }); Console instance4 = Console.instance; if (instance4 != null) { ((Terminal)instance4).AddString("[Redeem] Pedido enviado ao servidor..."); } } catch { } } internal void <Postfix>b__0_1(ConsoleEventArgs args) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown <>c__DisplayClass0_0 CS$<>8__locals0 = new <>c__DisplayClass0_0(); RedeemPlugin.Raffle_TryRegisterRpcs(); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console instance = Console.instance; if (instance != null) { ((Terminal)instance).AddString("Personagem não carregado."); } return; } List<string> list = RedeemPlugin.RD_LoadPending(localPlayer); localPlayer.m_customData.TryGetValue("Redeem.Raffle.LastCode", out var value); CS$<>8__locals0.legacyClean = RedeemPlugin.RemoveRichText(value ?? "").Trim(); if (!string.IsNullOrWhiteSpace(CS$<>8__locals0.legacyClean) && !list.Any((string s) => string.Equals(s, CS$<>8__locals0.legacyClean, StringComparison.OrdinalIgnoreCase))) { list.Add(CS$<>8__locals0.legacyClean); RedeemPlugin.RD_SavePending(localPlayer, list); } ZRoutedRpc instance2 = ZRoutedRpc.instance; ZNet instance3 = ZNet.instance; if (instance2 == null || (Object)(object)instance3 == (Object)null) { Console instance4 = Console.instance; if (instance4 != null) { ((Terminal)instance4).AddString("Redeem: RPC/Servidor indisponível."); } return; } ZNetPeer serverPeer = instance3.GetServerPeer(); if (serverPeer == null) { Console instance5 = Console.instance; if (instance5 != null) { ((Terminal)instance5).AddString("Redeem: servidor indisponível."); } return; } ZPackage val = new ZPackage(); val.Write(list.Count); foreach (string item in list) { val.Write(item); } instance2.InvokeRoutedRPC(serverPeer.m_uid, "VD_RaffleSyncRequest", new object[1] { val }); Console instance6 = Console.instance; if (instance6 != null) { ((Terminal)instance6).AddString("[Redeem] Sincronizando códigos pendentes..."); } } } [CompilerGenerated] private sealed class <>c__DisplayClass0_0 { public string legacyClean; internal bool <Postfix>b__2(string s) { return string.Equals(s, legacyClean, StringComparison.OrdinalIgnoreCase); } } private static void Postfix() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_009b: 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_0092: Expected O, but got Unknown try { if (!Terminal.commands.ContainsKey("redeem.raffle")) { object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown try { RedeemPlugin.Raffle_TryRegisterRpcs(); if (args?.Args == null || args.Args.Length < 2) { Console instance7 = Console.instance; if (instance7 != null) { ((Terminal)instance7).AddString("Uso: redeem.raffle <CODE>"); } } else { string text = string.Join(" ", args.Args.Skip(1)); if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { RedeemPlugin.Raffle_Execute(text); } else { ZRoutedRpc instance8 = ZRoutedRpc.instance; if (instance8 == null) { Console instance9 = Console.instance; if (instance9 != null) { ((Terminal)instance9).AddString("Redeem: RPC indisponível."); } } else { ZPackage val4 = new ZPackage(); val4.Write(text); instance8.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "VD_RaffleRequest", new object[1] { val4 }); Console instance10 = Console.instance; if (instance10 != null) { ((Terminal)instance10).AddString("[Redeem] Pedido enviado ao servidor..."); } } } } } catch { } }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("redeem.raffle", "redeem.raffle <CODE> - Solicita sorteio ao servidor", (ConsoleEvent)obj, false, true, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } if (Terminal.commands.ContainsKey("redeem.mycode")) { return; } object obj2 = <>c.<>9__0_1; if (obj2 == null) { ConsoleEvent val2 = delegate { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown RedeemPlugin.Raffle_TryRegisterRpcs(); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Console instance = Console.instance; if (instance != null) { ((Terminal)instance).AddString("Personagem não carregado."); } } else { List<string> list = RedeemPlugin.RD_LoadPending(localPlayer); localPlayer.m_customData.TryGetValue("Redeem.Raffle.LastCode", out var value); string legacyClean = RedeemPlugin.RemoveRichText(value ?? "").Trim(); if (!string.IsNullOrWhiteSpace(legacyClean) && !list.Any((string s) => string.Equals(s, legacyClean, StringComparison.OrdinalIgnoreCase))) { list.Add(legacyClean); RedeemPlugin.RD_SavePending(localPlayer, list); } ZRoutedRpc instance2 = ZRoutedRpc.instance; ZNet instance3 = ZNet.instance; if (instance2 == null || (Object)(object)instance3 == (Object)null) { Console instance4 = Console.instance; if (instance4 != null) { ((Terminal)instance4).AddString("Redeem: RPC/Servidor indisponível."); } } else { ZNetPeer serverPeer = instance3.GetServerPeer(); if (serverPeer == null) { Console instance5 = Console.instance; if (instance5 != null) { ((Terminal)instance5).AddString("Redeem: servidor indisponível."); } } else { ZPackage val3 = new ZPackage(); val3.Write(list.Count); foreach (string item in list) { val3.Write(item); } instance2.InvokeRoutedRPC(serverPeer.m_uid, "VD_RaffleSyncRequest", new object[1] { val3 }); Console instance6 = Console.instance; if (instance6 != null) { ((Terminal)instance6).AddString("[Redeem] Sincronizando códigos pendentes..."); } } } } }; <>c.<>9__0_1 = val2; obj2 = (object)val2; } new ConsoleCommand("redeem.mycode", "Sincroniza e lista todos os códigos de sorteio pendentes salvos neste personagem.", (ConsoleEvent)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } catch { } } } } namespace Microsoft.CodeAnalysis { [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [Microsoft.CodeAnalysis.Embedded] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ServerSync { [PublicAPI] internal abstract class OwnConfigEntryBase { public object? LocalBaseValue; public