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;
[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("EffectAlert")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EffectAlert")]
[assembly: AssemblyTitle("EffectAlert")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace EffectAlert;
public class Config
{
[JsonInclude]
public float volume = 10f;
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
{
[field: CompilerGenerated]
[field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
public static Config Config
{
[CompilerGenerated]
get;
[CompilerGenerated]
private set;
}
public Mod(IModInterface modInterface)
{
Config = modInterface.ReadConfig<Config>();
modInterface.RegisterScriptMod((IScriptMod)(object)new StatusFXPatch(modInterface));
}
public void Dispose()
{
}
}
public class StatusFXPatch : IScriptMod
{
[CompilerGenerated]
private sealed class <Modify>d__5 : 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 StatusFXPatch <>4__this;
private TokenConsumer <newLineConsumer>5__1;
private TokenConsumer <colonConsumer>5__2;
private FunctionWaiter <setupFuncMatch>5__3;
private global::System.Collections.Generic.IEnumerator<Token> <>s__4;
private Token <token>5__5;
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__5(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void global::System.IDisposable.Dispose()
{
int num = <>1__state;
if (num != -3 && (uint)(num - 1) > 22u)
{
return;
}
try
{
}
finally
{
<>m__Finally1();
}
}
private bool MoveNext()
{
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Expected O, but got Unknown
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Expected O, but got Unknown
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Expected O, but got Unknown
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Expected O, but got Unknown
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Expected O, but got Unknown
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Expected O, but got Unknown
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Expected O, but got Unknown
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Expected O, but got Unknown
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Expected O, but got Unknown
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Expected O, but got Unknown
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Expected O, but got Unknown
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_03db: Expected O, but got Unknown
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Expected O, but got Unknown
//IL_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Expected O, but got Unknown
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Expected O, but got Unknown
//IL_0479: Unknown result type (might be due to invalid IL or missing references)
//IL_0483: Expected O, but got Unknown
//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
//IL_04aa: Expected O, but got Unknown
//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
//IL_04af: Expected O, but got Unknown
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_04dc: Expected O, but got Unknown
//IL_0500: Unknown result type (might be due to invalid IL or missing references)
//IL_050a: Expected O, but got Unknown
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_050f: Expected O, but got Unknown
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
//IL_053c: Expected O, but got Unknown
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Expected O, but got Unknown
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Expected O, but got Unknown
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<newLineConsumer>5__1 = new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 89));
<colonConsumer>5__2 = new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 86));
<setupFuncMatch>5__3 = new FunctionWaiter("_setup", false);
<>s__4 = tokens.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
<>2__current = new Token((TokenType)38, (uint?)null);
<>1__state = 2;
return true;
case 2:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("tier");
<>1__state = 3;
return true;
case 3:
<>1__state = -3;
<>2__current = new Token((TokenType)7, (uint?)null);
<>1__state = 4;
return true;
case 4:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new IntVariant(0L, false));
<>1__state = 5;
return true;
case 5:
<>1__state = -3;
<>2__current = new Token((TokenType)13, (uint?)null);
<>1__state = 6;
return true;
case 6:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("get");
<>1__state = 7;
return true;
case 7:
<>1__state = -3;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 8;
return true;
case 8:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new StringVariant("visible"));
<>1__state = 9;
return true;
case 9:
<>1__state = -3;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 10;
return true;
case 10:
<>1__state = -3;
<>2__current = new Token((TokenType)86, (uint?)null);
<>1__state = 11;
return true;
case 11:
<>1__state = -3;
<>2__current = new Token((TokenType)89, <token>5__5.AssociatedData + 1);
<>1__state = 12;
return true;
case 12:
<>1__state = -3;
<>2__current = new Token((TokenType)87, (uint?)null);
<>1__state = 13;
return true;
case 13:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("/root/n0EffectAlert");
<>1__state = 14;
return true;
case 14:
<>1__state = -3;
<>2__current = new Token((TokenType)84, (uint?)null);
<>1__state = 15;
return true;
case 15:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("_play_sound");
<>1__state = 16;
return true;
case 16:
<>1__state = -3;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 17;
return true;
case 17:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new StringVariant("res://mods/n0.EffectAlert/Resources/Bass_TickTock.mp3"));
<>1__state = 18;
return true;
case 18:
<>1__state = -3;
<>2__current = new Token((TokenType)82, (uint?)null);
<>1__state = 19;
return true;
case 19:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new IntVariant((long)Mod.Config.GetVolumeDB(), false));
<>1__state = 20;
return true;
case 20:
<>1__state = -3;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 21;
return true;
case 21:
<>1__state = -3;
<>4__this.modInterface.Logger.Information("Done patching");
<>2__current = <token>5__5;
<>1__state = 22;
return true;
case 22:
<>1__state = -3;
goto IL_05b3;
case 23:
{
<>1__state = -3;
goto IL_05b3;
}
IL_05b3:
<token>5__5 = null;
break;
}
if (((global::System.Collections.IEnumerator)<>s__4).MoveNext())
{
<token>5__5 = <>s__4.Current;
if (<setupFuncMatch>5__3.Check(<token>5__5))
{
<>2__current = <token>5__5;
<>1__state = 1;
return true;
}
<>2__current = <token>5__5;
<>1__state = 23;
return true;
}
<>m__Finally1();
<>s__4 = null;
return false;
}
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__4 != null)
{
((global::System.IDisposable)<>s__4).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__5 <Modify>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<Modify>d__ = this;
}
else
{
<Modify>d__ = new <Modify>d__5(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();
}
}
private Config config = new Config();
private const string Path = "/root/n0EffectAlert";
private const string SoundPath = "res://mods/n0.EffectAlert/Resources/Bass_TickTock.mp3";
private const string NotifSound = "notifsound";
public IModInterface modInterface;
public bool ShouldRun(string path)
{
return path == "res://Scenes/HUD/StatusEffectbox/statusfxbox.gdc";
}
[IteratorStateMachine(typeof(<Modify>d__5))]
public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
{
new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 89));
new TokenConsumer((Func<Token, bool>)((Token t) => (int)t.Type == 86));
FunctionWaiter setupFuncMatch = new FunctionWaiter("_setup", false);
global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
{
Token token = enumerator.Current;
if (setupFuncMatch.Check(token))
{
yield return token;
yield return new Token((TokenType)38, (uint?)null);
yield return (Token)new IdentifierToken("tier");
yield return new Token((TokenType)7, (uint?)null);
yield return (Token)new ConstantToken((Variant)new IntVariant(0L, false));
yield return new Token((TokenType)13, (uint?)null);
yield return (Token)new IdentifierToken("get");
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new ConstantToken((Variant)new StringVariant("visible"));
yield return new Token((TokenType)81, (uint?)null);
yield return new Token((TokenType)86, (uint?)null);
yield return new Token((TokenType)89, token.AssociatedData + 1);
yield return new Token((TokenType)87, (uint?)null);
yield return (Token)new IdentifierToken("/root/n0EffectAlert");
yield return new Token((TokenType)84, (uint?)null);
yield return (Token)new IdentifierToken("_play_sound");
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new ConstantToken((Variant)new StringVariant("res://mods/n0.EffectAlert/Resources/Bass_TickTock.mp3"));
yield return new Token((TokenType)82, (uint?)null);
yield return (Token)new ConstantToken((Variant)new IntVariant((long)Mod.Config.GetVolumeDB(), false));
yield return new Token((TokenType)81, (uint?)null);
modInterface.Logger.Information("Done patching");
yield return token;
}
else
{
yield return token;
}
}
}
finally
{
((global::System.IDisposable)enumerator)?.Dispose();
}
}
public StatusFXPatch(IModInterface pmodInterface)
{
modInterface = pmodInterface;
}
}