using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json.Serialization;
using GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;
using Serilog;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("Kittenji.LetsGoGambling")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyProduct("Kittenji.LetsGoGambling")]
[assembly: AssemblyTitle("Kittenji.LetsGoGambling")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Kittenji.LetsGoGambling;
public class Config
{
[JsonInclude]
public float volume = 20f;
public static float LinearToDecibel(float linear)
{
if (linear != 0f)
{
return 20f * (float)Math.Log10((double)linear);
}
return -144f;
}
public int GetVolumeDB()
{
return (int)Math.Round((double)LinearToDecibel(Math.Clamp(volume, 0f, 100f) / 100f));
}
}
public class Mod : IMod, global::System.IDisposable
{
public static Config Config;
public static ILogger Logger;
public Mod(IModInterface modInterface)
{
Logger = modInterface.Logger;
Config = modInterface.ReadConfig<Config>();
Logger.Information("Converted volume: " + Config.GetVolumeDB());
modInterface.RegisterScriptMod((IScriptMod)(object)new ScratchTicketPatch());
}
public void Dispose()
{
}
}
public class ScratchTicketPatch : IScriptMod
{
[CompilerGenerated]
private sealed class <Modify>d__3 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
{
private int <>1__state;
private Token <>2__current;
private int <>l__initialThreadId;
private string path;
public string <>3__path;
private global::System.Collections.Generic.IEnumerable<Token> tokens;
public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;
public ScratchTicketPatch <>4__this;
private MultiTokenWaiter <waiterStart>5__1;
private MultiTokenWaiter <waiterLost>5__2;
private MultiTokenWaiter <waiterWon>5__3;
private bool <startDone>5__4;
private bool <lostDone>5__5;
private global::System.Collections.Generic.IEnumerator<Token> <>s__6;
private Token <token>5__7;
private global::System.Collections.Generic.IEnumerator<Token> <>s__8;
private Token <temp>5__9;
private global::System.Collections.Generic.IEnumerator<Token> <>s__10;
private Token <temp>5__11;
private global::System.Collections.Generic.IEnumerator<Token> <>s__12;
private Token <temp>5__13;
Token global::System.Collections.Generic.IEnumerator<Token>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object global::System.Collections.IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Modify>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void global::System.IDisposable.Dispose()
{
int num = <>1__state;
if ((uint)(num - -6) > 3u && (uint)(num - 1) > 6u)
{
return;
}
try
{
switch (num)
{
case -4:
case 2:
try
{
break;
}
finally
{
<>m__Finally2();
}
case -5:
case 3:
try
{
break;
}
finally
{
<>m__Finally3();
}
case -6:
case 5:
try
{
break;
}
finally
{
<>m__Finally4();
}
}
}
finally
{
<>m__Finally1();
}
}
private bool MoveNext()
{
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Expected O, but got Unknown
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<waiterStart>5__1 = new MultiTokenWaiter(new Func<Token, bool>[7]
{
delegate(Token t)
{
IdentifierToken val12 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val12 != null && val12.Name == "GlobalAudio";
},
(Token t) => (int)t.Type == 84,
delegate(Token t)
{
IdentifierToken val11 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val11 != null && val11.Name == "_play_sound";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val9 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
int result3;
if (val9 != null)
{
Variant value3 = val9.Value;
StringVariant val10 = (StringVariant)(object)((value3 is StringVariant) ? value3 : null);
if (val10 != null)
{
result3 = ((val10.Value == "ui_open") ? 1 : 0);
goto IL_002c;
}
}
result3 = 0;
goto IL_002c;
IL_002c:
return (byte)result3 != 0;
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, true);
<waiterLost>5__2 = new MultiTokenWaiter(new Func<Token, bool>[7]
{
delegate(Token t)
{
IdentifierToken val8 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val8 != null && val8.Name == "GlobalAudio";
},
(Token t) => (int)t.Type == 84,
delegate(Token t)
{
IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val7 != null && val7.Name == "_play_sound";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
int result2;
if (val5 != null)
{
Variant value2 = val5.Value;
StringVariant val6 = (StringVariant)(object)((value2 is StringVariant) ? value2 : null);
if (val6 != null)
{
result2 = ((val6.Value == "jingle_lose") ? 1 : 0);
goto IL_002c;
}
}
result2 = 0;
goto IL_002c;
IL_002c:
return (byte)result2 != 0;
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, true);
<waiterWon>5__3 = new MultiTokenWaiter(new Func<Token, bool>[7]
{
delegate(Token t)
{
IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val4 != null && val4.Name == "GlobalAudio";
},
(Token t) => (int)t.Type == 84,
delegate(Token t)
{
IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val3 != null && val3.Name == "_play_sound";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
int result;
if (val != null)
{
Variant value = val.Value;
StringVariant val2 = (StringVariant)(object)((value is StringVariant) ? value : null);
if (val2 != null)
{
result = ((val2.Value == "jingle_win") ? 1 : 0);
goto IL_002c;
}
}
result = 0;
goto IL_002c;
IL_002c:
return (byte)result != 0;
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, true);
<startDone>5__4 = false;
<lostDone>5__5 = false;
<>s__6 = tokens.GetEnumerator();
<>1__state = -3;
goto IL_0649;
case 1:
<>1__state = -3;
<>s__8 = <>4__this.SetPlay("res://kittenji.mods/lets_go_gambling/gamble_start.ogg").GetEnumerator();
<>1__state = -4;
goto IL_044d;
case 2:
<>1__state = -4;
<temp>5__9 = null;
goto IL_044d;
case 3:
<>1__state = -5;
<temp>5__11 = null;
goto IL_0506;
case 4:
<>1__state = -3;
<lostDone>5__5 = true;
goto IL_0641;
case 5:
<>1__state = -6;
<temp>5__13 = null;
goto IL_05e3;
case 6:
<>1__state = -3;
goto IL_0641;
case 7:
{
<>1__state = -3;
goto IL_0641;
}
IL_044d:
if (((global::System.Collections.IEnumerator)<>s__8).MoveNext())
{
<temp>5__9 = <>s__8.Current;
<>2__current = <temp>5__9;
<>1__state = 2;
return true;
}
<>m__Finally2();
<>s__8 = null;
<startDone>5__4 = true;
goto IL_0641;
IL_0649:
if (((global::System.Collections.IEnumerator)<>s__6).MoveNext())
{
<token>5__7 = <>s__6.Current;
if (<waiterStart>5__1.Check(<token>5__7))
{
<>2__current = <token>5__7;
<>1__state = 1;
return true;
}
if (<startDone>5__4 && <waiterLost>5__2.Check(<token>5__7))
{
<>s__10 = <>4__this.SetPlay("res://kittenji.mods/lets_go_gambling/gamble_lose.ogg", 3u, "k_gamble_audio_2", "k_gamble_file_2").GetEnumerator();
<>1__state = -5;
goto IL_0506;
}
if (<lostDone>5__5 && <waiterWon>5__3.Check(<token>5__7))
{
<>s__12 = <>4__this.SetPlay("res://kittenji.mods/lets_go_gambling/gamble_win.ogg", 3u, "k_gamble_audio_3", "k_gamble_file_3").GetEnumerator();
<>1__state = -6;
goto IL_05e3;
}
<>2__current = <token>5__7;
<>1__state = 7;
return true;
}
<>m__Finally1();
<>s__6 = null;
return false;
IL_0641:
<token>5__7 = null;
goto IL_0649;
IL_0506:
if (((global::System.Collections.IEnumerator)<>s__10).MoveNext())
{
<temp>5__11 = <>s__10.Current;
<>2__current = <temp>5__11;
<>1__state = 3;
return true;
}
<>m__Finally3();
<>s__10 = null;
<>2__current = <token>5__7;
<>1__state = 4;
return true;
IL_05e3:
if (((global::System.Collections.IEnumerator)<>s__12).MoveNext())
{
<temp>5__13 = <>s__12.Current;
<>2__current = <temp>5__13;
<>1__state = 5;
return true;
}
<>m__Finally4();
<>s__12 = null;
<>2__current = <token>5__7;
<>1__state = 6;
return true;
}
}
catch
{
//try-fault
((global::System.IDisposable)this).Dispose();
throw;
}
}
bool global::System.Collections.IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<>s__6 != null)
{
((global::System.IDisposable)<>s__6).Dispose();
}
}
private void <>m__Finally2()
{
<>1__state = -3;
if (<>s__8 != null)
{
((global::System.IDisposable)<>s__8).Dispose();
}
}
private void <>m__Finally3()
{
<>1__state = -3;
if (<>s__10 != null)
{
((global::System.IDisposable)<>s__10).Dispose();
}
}
private void <>m__Finally4()
{
<>1__state = -3;
if (<>s__12 != null)
{
((global::System.IDisposable)<>s__12).Dispose();
}
}
[DebuggerHidden]
void global::System.Collections.IEnumerator.Reset()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
throw new NotSupportedException();
}
[DebuggerHidden]
global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
{
<Modify>d__3 <Modify>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<Modify>d__ = this;
}
else
{
<Modify>d__ = new <Modify>d__3(0)
{
<>4__this = <>4__this
};
}
<Modify>d__.path = <>3__path;
<Modify>d__.tokens = <>3__tokens;
return <Modify>d__;
}
[DebuggerHidden]
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
{
return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
}
}
[CompilerGenerated]
private sealed class <SetPlay>d__4 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
{
private int <>1__state;
private Token <>2__current;
private int <>l__initialThreadId;
private string path;
public string <>3__path;
private uint indent;
public uint <>3__indent;
private string notifVar;
public string <>3__notifVar;
private string fileVar;
public string <>3__fileVar;
public ScratchTicketPatch <>4__this;
Token global::System.Collections.Generic.IEnumerator<Token>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object global::System.Collections.IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetPlay>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void global::System.IDisposable.Dispose()
{
}
private bool MoveNext()
{
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Expected O, but got Unknown
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Expected O, but got Unknown
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Expected O, but got Unknown
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Expected O, but got Unknown
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Expected O, but got Unknown
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Expected O, but got Unknown
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Expected O, but got Unknown
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Expected O, but got Unknown
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Expected O, but got Unknown
//IL_037c: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Expected O, but got Unknown
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ad: Expected O, but got Unknown
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03cf: Expected O, but got Unknown
//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Expected O, but got Unknown
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Expected O, but got Unknown
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Expected O, but got Unknown
//IL_0459: Unknown result type (might be due to invalid IL or missing references)
//IL_0463: Expected O, but got Unknown
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0468: Expected O, but got Unknown
//IL_0485: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Expected O, but got Unknown
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_04b8: Expected O, but got Unknown
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
//IL_04d9: Expected O, but got Unknown
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0500: Expected O, but got Unknown
//IL_0518: Unknown result type (might be due to invalid IL or missing references)
//IL_0522: Expected O, but got Unknown
//IL_053f: Unknown result type (might be due to invalid IL or missing references)
//IL_0549: Expected O, but got Unknown
//IL_0568: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Expected O, but got Unknown
//IL_058a: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Expected O, but got Unknown
//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
//IL_05bb: Expected O, but got Unknown
//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
//IL_05dc: Expected O, but got Unknown
//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0603: Expected O, but got Unknown
//IL_061b: Unknown result type (might be due to invalid IL or missing references)
//IL_0625: Expected O, but got Unknown
//IL_0642: Unknown result type (might be due to invalid IL or missing references)
//IL_064c: Expected O, but got Unknown
//IL_066b: Unknown result type (might be due to invalid IL or missing references)
//IL_0675: Expected O, but got Unknown
//IL_068d: Unknown result type (might be due to invalid IL or missing references)
//IL_0697: Expected O, but got Unknown
//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
//IL_06be: Expected O, but got Unknown
//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
//IL_06df: Expected O, but got Unknown
//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0706: Expected O, but got Unknown
//IL_0724: Unknown result type (might be due to invalid IL or missing references)
//IL_072e: Expected O, but got Unknown
//IL_0729: Unknown result type (might be due to invalid IL or missing references)
//IL_0733: Expected O, but got Unknown
//IL_0752: Unknown result type (might be due to invalid IL or missing references)
//IL_075c: Expected O, but got Unknown
//IL_0774: Unknown result type (might be due to invalid IL or missing references)
//IL_077e: Expected O, but got Unknown
//IL_079b: Unknown result type (might be due to invalid IL or missing references)
//IL_07a5: Expected O, but got Unknown
//IL_07bc: Unknown result type (might be due to invalid IL or missing references)
//IL_07c6: Expected O, but got Unknown
//IL_07e3: Unknown result type (might be due to invalid IL or missing references)
//IL_07ed: Expected O, but got Unknown
//IL_0802: Unknown result type (might be due to invalid IL or missing references)
//IL_080c: Expected O, but got Unknown
//IL_0807: Unknown result type (might be due to invalid IL or missing references)
//IL_0811: Expected O, but got Unknown
//IL_0830: Unknown result type (might be due to invalid IL or missing references)
//IL_083a: Expected O, but got Unknown
//IL_0852: Unknown result type (might be due to invalid IL or missing references)
//IL_085c: Expected O, but got Unknown
//IL_0879: Unknown result type (might be due to invalid IL or missing references)
//IL_0883: Expected O, but got Unknown
//IL_089a: Unknown result type (might be due to invalid IL or missing references)
//IL_08a4: Expected O, but got Unknown
//IL_08c1: Unknown result type (might be due to invalid IL or missing references)
//IL_08cb: Expected O, but got Unknown
//IL_08e2: Unknown result type (might be due to invalid IL or missing references)
//IL_08ec: Expected O, but got Unknown
//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
//IL_08f1: Expected O, but got Unknown
//IL_0910: Unknown result type (might be due to invalid IL or missing references)
//IL_091a: Expected O, but got Unknown
//IL_0932: Unknown result type (might be due to invalid IL or missing references)
//IL_093c: Expected O, but got Unknown
//IL_0959: Unknown result type (might be due to invalid IL or missing references)
//IL_0963: Expected O, but got Unknown
//IL_097a: Unknown result type (might be due to invalid IL or missing references)
//IL_0984: Expected O, but got Unknown
//IL_09a1: Unknown result type (might be due to invalid IL or missing references)
//IL_09ab: Expected O, but got Unknown
//IL_09c8: Unknown result type (might be due to invalid IL or missing references)
//IL_09d2: Expected O, but got Unknown
//IL_09f1: Unknown result type (might be due to invalid IL or missing references)
//IL_09fb: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Mod.Logger.Information("INJECTING AUDIO: " + path);
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = new Token((TokenType)59, (uint?)null);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(notifVar);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = new Token((TokenType)23, (uint?)null);
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("AudioStreamPlayer");
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("new");
<>1__state = 7;
return true;
case 7:
<>1__state = -1;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 8;
return true;
case 8:
<>1__state = -1;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 9;
return true;
case 9:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 10;
return true;
case 10:
<>1__state = -1;
<>2__current = new Token((TokenType)59, (uint?)null);
<>1__state = 11;
return true;
case 11:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(fileVar);
<>1__state = 12;
return true;
case 12:
<>1__state = -1;
<>2__current = new Token((TokenType)23, (uint?)null);
<>1__state = 13;
return true;
case 13:
<>1__state = -1;
<>2__current = new Token((TokenType)5, (uint?)76u);
<>1__state = 14;
return true;
case 14:
<>1__state = -1;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 15;
return true;
case 15:
<>1__state = -1;
<>2__current = (Token)new ConstantToken((Variant)new StringVariant(path));
<>1__state = 16;
return true;
case 16:
<>1__state = -1;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 17;
return true;
case 17:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 18;
return true;
case 18:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("add_child");
<>1__state = 19;
return true;
case 19:
<>1__state = -1;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 20;
return true;
case 20:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(notifVar);
<>1__state = 21;
return true;
case 21:
<>1__state = -1;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 22;
return true;
case 22:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 23;
return true;
case 23:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(notifVar);
<>1__state = 24;
return true;
case 24:
<>1__state = -1;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 25;
return true;
case 25:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("set_stream");
<>1__state = 26;
return true;
case 26:
<>1__state = -1;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 27;
return true;
case 27:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(fileVar);
<>1__state = 28;
return true;
case 28:
<>1__state = -1;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 29;
return true;
case 29:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 30;
return true;
case 30:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(notifVar);
<>1__state = 31;
return true;
case 31:
<>1__state = -1;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 32;
return true;
case 32:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("volume_db");
<>1__state = 33;
return true;
case 33:
<>1__state = -1;
<>2__current = new Token((TokenType)23, (uint?)null);
<>1__state = 34;
return true;
case 34:
<>1__state = -1;
<>2__current = (Token)new ConstantToken((Variant)new IntVariant((long)Mod.Config.GetVolumeDB(), false));
<>1__state = 35;
return true;
case 35:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 36;
return true;
case 36:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(notifVar);
<>1__state = 37;
return true;
case 37:
<>1__state = -1;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 38;
return true;
case 38:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("pitch_scale");
<>1__state = 39;
return true;
case 39:
<>1__state = -1;
<>2__current = new Token((TokenType)23, (uint?)null);
<>1__state = 40;
return true;
case 40:
<>1__state = -1;
<>2__current = (Token)new ConstantToken((Variant)new IntVariant(1L, false));
<>1__state = 41;
return true;
case 41:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 42;
return true;
case 42:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(notifVar);
<>1__state = 43;
return true;
case 43:
<>1__state = -1;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 44;
return true;
case 44:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("bus");
<>1__state = 45;
return true;
case 45:
<>1__state = -1;
<>2__current = new Token((TokenType)23, (uint?)null);
<>1__state = 46;
return true;
case 46:
<>1__state = -1;
<>2__current = (Token)new ConstantToken((Variant)new StringVariant("SFX"));
<>1__state = 47;
return true;
case 47:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 48;
return true;
case 48:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken(notifVar);
<>1__state = 49;
return true;
case 49:
<>1__state = -1;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 50;
return true;
case 50:
<>1__state = -1;
<>2__current = (Token)new IdentifierToken("play");
<>1__state = 51;
return true;
case 51:
<>1__state = -1;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 52;
return true;
case 52:
<>1__state = -1;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 53;
return true;
case 53:
<>1__state = -1;
<>2__current = new Token((TokenType)89, (uint?)indent);
<>1__state = 54;
return true;
case 54:
<>1__state = -1;
return false;
}
}
bool global::System.Collections.IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void global::System.Collections.IEnumerator.Reset()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
throw new NotSupportedException();
}
[DebuggerHidden]
global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
{
<SetPlay>d__4 <SetPlay>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<SetPlay>d__ = this;
}
else
{
<SetPlay>d__ = new <SetPlay>d__4(0)
{
<>4__this = <>4__this
};
}
<SetPlay>d__.path = <>3__path;
<SetPlay>d__.indent = <>3__indent;
<SetPlay>d__.notifVar = <>3__notifVar;
<SetPlay>d__.fileVar = <>3__fileVar;
return <SetPlay>d__;
}
[DebuggerHidden]
global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
{
return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
}
}
private const string Notif = "notif_audio";
private const string NotifSound = "notif_sound_fx";
public bool ShouldRun(string path)
{
return path == "res://Scenes/Minigames/ScratchTicket/scratch_ticket.gdc";
}
[IteratorStateMachine(typeof(<Modify>d__3))]
public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
{
MultiTokenWaiter waiterStart = new MultiTokenWaiter(new Func<Token, bool>[7]
{
delegate(Token t)
{
IdentifierToken val12 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val12 != null && val12.Name == "GlobalAudio";
},
(Token t) => (int)t.Type == 84,
delegate(Token t)
{
IdentifierToken val11 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val11 != null && val11.Name == "_play_sound";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val9 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
int result3;
if (val9 != null)
{
Variant value3 = val9.Value;
StringVariant val10 = (StringVariant)(object)((value3 is StringVariant) ? value3 : null);
if (val10 != null)
{
result3 = ((val10.Value == "ui_open") ? 1 : 0);
goto IL_002c;
}
}
result3 = 0;
goto IL_002c;
IL_002c:
return (byte)result3 != 0;
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, true);
MultiTokenWaiter waiterLost = new MultiTokenWaiter(new Func<Token, bool>[7]
{
delegate(Token t)
{
IdentifierToken val8 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val8 != null && val8.Name == "GlobalAudio";
},
(Token t) => (int)t.Type == 84,
delegate(Token t)
{
IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val7 != null && val7.Name == "_play_sound";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
int result2;
if (val5 != null)
{
Variant value2 = val5.Value;
StringVariant val6 = (StringVariant)(object)((value2 is StringVariant) ? value2 : null);
if (val6 != null)
{
result2 = ((val6.Value == "jingle_lose") ? 1 : 0);
goto IL_002c;
}
}
result2 = 0;
goto IL_002c;
IL_002c:
return (byte)result2 != 0;
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, true);
MultiTokenWaiter waiterWon = new MultiTokenWaiter(new Func<Token, bool>[7]
{
delegate(Token t)
{
IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val4 != null && val4.Name == "GlobalAudio";
},
(Token t) => (int)t.Type == 84,
delegate(Token t)
{
IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val3 != null && val3.Name == "_play_sound";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
int result;
if (val != null)
{
Variant value = val.Value;
StringVariant val2 = (StringVariant)(object)((value is StringVariant) ? value : null);
if (val2 != null)
{
result = ((val2.Value == "jingle_win") ? 1 : 0);
goto IL_002c;
}
}
result = 0;
goto IL_002c;
IL_002c:
return (byte)result != 0;
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, true);
bool startDone = false;
bool lostDone = false;
global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
{
Token token = enumerator.Current;
if (waiterStart.Check(token))
{
yield return token;
global::System.Collections.Generic.IEnumerator<Token> enumerator2 = SetPlay("res://kittenji.mods/lets_go_gambling/gamble_start.ogg").GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
{
yield return enumerator2.Current;
}
}
finally
{
((global::System.IDisposable)enumerator2)?.Dispose();
}
startDone = true;
}
else if (startDone && waiterLost.Check(token))
{
global::System.Collections.Generic.IEnumerator<Token> enumerator3 = SetPlay("res://kittenji.mods/lets_go_gambling/gamble_lose.ogg", 3u, "k_gamble_audio_2", "k_gamble_file_2").GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator3).MoveNext())
{
yield return enumerator3.Current;
}
}
finally
{
((global::System.IDisposable)enumerator3)?.Dispose();
}
yield return token;
lostDone = true;
}
else if (lostDone && waiterWon.Check(token))
{
global::System.Collections.Generic.IEnumerator<Token> enumerator4 = SetPlay("res://kittenji.mods/lets_go_gambling/gamble_win.ogg", 3u, "k_gamble_audio_3", "k_gamble_file_3").GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator4).MoveNext())
{
yield return enumerator4.Current;
}
}
finally
{
((global::System.IDisposable)enumerator4)?.Dispose();
}
yield return token;
}
else
{
yield return token;
}
}
}
finally
{
((global::System.IDisposable)enumerator)?.Dispose();
}
}
[IteratorStateMachine(typeof(<SetPlay>d__4))]
private global::System.Collections.Generic.IEnumerable<Token> SetPlay(string path, uint indent = 1u, string notifVar = "k_gamble_audio", string fileVar = "k_gamble_file")
{
Mod.Logger.Information("INJECTING AUDIO: " + path);
yield return new Token((TokenType)89, (uint?)indent);
yield return new Token((TokenType)59, (uint?)null);
yield return (Token)new IdentifierToken(notifVar);
yield return new Token((TokenType)23, (uint?)null);
yield return (Token)new IdentifierToken("AudioStreamPlayer");
yield return new Token((TokenType)84, (uint?)null);
yield return (Token)new IdentifierToken("new");
yield return new Token((TokenType)80, (uint?)null);
yield return new Token((TokenType)81, (uint?)null);
yield return new Token((TokenType)89, (uint?)indent);
yield return new Token((TokenType)59, (uint?)null);
yield return (Token)new IdentifierToken(fileVar);
yield return new Token((TokenType)23, (uint?)null);
yield return new Token((TokenType)5, (uint?)76u);
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new ConstantToken((Variant)new StringVariant(path));
yield return new Token((TokenType)81, (uint?)null);
yield return new Token((TokenType)89, (uint?)indent);
yield return (Token)new IdentifierToken("add_child");
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new IdentifierToken(notifVar);
yield return new Token((TokenType)81, (uint?)null);
yield return new Token((TokenType)89, (uint?)indent);
yield return (Token)new IdentifierToken(notifVar);
yield return new Token((TokenType)84, (uint?)null);
yield return (Token)new IdentifierToken("set_stream");
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new IdentifierToken(fileVar);
yield return new Token((TokenType)81, (uint?)null);
yield return new Token((TokenType)89, (uint?)indent);
yield return (Token)new IdentifierToken(notifVar);
yield return new Token((TokenType)84, (uint?)null);
yield return (Token)new IdentifierToken("volume_db");
yield return new Token((TokenType)23, (uint?)null);
yield return (Token)new ConstantToken((Variant)new IntVariant((long)Mod.Config.GetVolumeDB(), false));
yield return new Token((TokenType)89, (uint?)indent);
yield return (Token)new IdentifierToken(notifVar);
yield return new Token((TokenType)84, (uint?)null);
yield return (Token)new IdentifierToken("pitch_scale");
yield return new Token((TokenType)23, (uint?)null);
yield return (Token)new ConstantToken((Variant)new IntVariant(1L, false));
yield return new Token((TokenType)89, (uint?)indent);
yield return (Token)new IdentifierToken(notifVar);
yield return new Token((TokenType)84, (uint?)null);
yield return (Token)new IdentifierToken("bus");
yield return new Token((TokenType)23, (uint?)null);
yield return (Token)new ConstantToken((Variant)new StringVariant("SFX"));
yield return new Token((TokenType)89, (uint?)indent);
yield return (Token)new IdentifierToken(notifVar);
yield return new Token((TokenType)84, (uint?)null);
yield return (Token)new IdentifierToken("play");
yield return new Token((TokenType)80, (uint?)null);
yield return new Token((TokenType)81, (uint?)null);
yield return new Token((TokenType)89, (uint?)indent);
}
}