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.Security;
using System.Security.Permissions;
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("FailPunch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FailPunch")]
[assembly: AssemblyTitle("FailPunch")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace FailPunch;
public class Config
{
}
public class Mod : IScriptMod, IMod, global::System.IDisposable
{
[CompilerGenerated]
private sealed class <Modify>d__9 : 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 global::System.Collections.Generic.IEnumerable<Token> tokens;
public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;
public Mod <>4__this;
private MultiTokenWaiter <fail>5__2;
private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap2;
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__9(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) <= 11u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
}
private bool MoveNext()
{
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Expected O, but got Unknown
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Expected O, but got Unknown
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Expected O, but got Unknown
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Expected O, but got Unknown
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Expected O, but got Unknown
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Expected O, but got Unknown
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Expected O, but got Unknown
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Expected O, but got Unknown
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Expected O, but got Unknown
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Expected O, but got Unknown
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: 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_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Expected O, but got Unknown
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Expected O, but got Unknown
try
{
int num = <>1__state;
Mod mod = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<fail>5__2 = new MultiTokenWaiter(new Func<Token, bool>[10]
{
(Token t) => (int)t.Type == 40,
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
(Token t) => enumIdent(t, "_enter_state"),
(Token t) => (int)t.Type == 80,
(Token t) => enumIdent(t, "STATES"),
(Token t) => (int)t.Type == 84,
(Token t) => enumIdent(t, "FISHING_CANCEL"),
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, false);
<>7__wrap2 = tokens.GetEnumerator();
<>1__state = -3;
break;
case 1:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("_punched");
<>1__state = 2;
return true;
case 2:
<>1__state = -3;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 3;
return true;
case 3:
<>1__state = -3;
<>2__current = (Token)new IdentifierToken("animation_data");
<>1__state = 4;
return true;
case 4:
<>1__state = -3;
<>2__current = new Token((TokenType)76, (uint?)null);
<>1__state = 5;
return true;
case 5:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new StringVariant("bobber_position"));
<>1__state = 6;
return true;
case 6:
<>1__state = -3;
<>2__current = new Token((TokenType)77, (uint?)null);
<>1__state = 7;
return true;
case 7:
<>1__state = -3;
<>2__current = new Token((TokenType)82, (uint?)null);
<>1__state = 8;
return true;
case 8:
<>1__state = -3;
<>2__current = (Token)new ConstantToken((Variant)new IntVariant(1L, false));
<>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)89, (uint?)null);
<>1__state = 11;
return true;
case 11:
<>1__state = -3;
break;
case 12:
<>1__state = -3;
break;
}
if (((global::System.Collections.IEnumerator)<>7__wrap2).MoveNext())
{
Token current = <>7__wrap2.Current;
if (<fail>5__2.Check(current))
{
mod.Logger.Information(((object)current).ToString());
mod.Logger.Information("Injecting _punched");
<>2__current = new Token((TokenType)89, (uint?)2u);
<>1__state = 1;
return true;
}
<>2__current = current;
<>1__state = 12;
return true;
}
<>m__Finally1();
<>7__wrap2 = 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 (<>7__wrap2 != null)
{
((global::System.IDisposable)<>7__wrap2).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__9 <Modify>d__;
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
<Modify>d__ = this;
}
else
{
<Modify>d__ = new <Modify>d__9(0)
{
<>4__this = <>4__this
};
}
<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();
}
}
public Config Config;
public ILogger Logger;
public Mod(IModInterface modInterface)
{
Config = modInterface.ReadConfig<Config>();
modInterface.Logger.Information("Initializing FailPunch!");
Logger = modInterface.Logger;
modInterface.RegisterScriptMod((IScriptMod)(object)this);
}
public void Dispose()
{
}
public bool ShouldRun(string path)
{
return path == "res://Scenes/Entities/Player/player.gdc";
}
private static bool enumInt(Token t, int i)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (!(t is ConstantToken))
{
return false;
}
ConstantToken val = (ConstantToken)t;
if (!(val.Value is IntVariant))
{
return false;
}
return ((IntVariant)val.Value).Value == i;
}
private static bool enumString(Token t, string s)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (!(t is ConstantToken))
{
return false;
}
ConstantToken val = (ConstantToken)t;
if (!(val.Value is StringVariant))
{
return false;
}
return ((StringVariant)val.Value).Value == s;
}
private static bool enumDouble(Token t, double num)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
if (!(t is ConstantToken))
{
return false;
}
ConstantToken val = (ConstantToken)t;
if (!(val.Value is RealVariant))
{
return false;
}
return ((RealVariant)val.Value).Value == num;
}
private static bool enumIdent(Token t, string ident)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
if (!(t is IdentifierToken))
{
return false;
}
return ((IdentifierToken)t).Name == ident;
}
[IteratorStateMachine(typeof(<Modify>d__9))]
public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
{
MultiTokenWaiter fail = new MultiTokenWaiter(new Func<Token, bool>[10]
{
(Token t) => (int)t.Type == 40,
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
(Token t) => enumIdent(t, "_enter_state"),
(Token t) => (int)t.Type == 80,
(Token t) => enumIdent(t, "STATES"),
(Token t) => (int)t.Type == 84,
(Token t) => enumIdent(t, "FISHING_CANCEL"),
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 89
}, false, false);
global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
{
Token current = enumerator.Current;
if (fail.Check(current))
{
Logger.Information(((object)current).ToString());
Logger.Information("Injecting _punched");
yield return new Token((TokenType)89, (uint?)2u);
yield return (Token)new IdentifierToken("_punched");
yield return new Token((TokenType)80, (uint?)null);
yield return (Token)new IdentifierToken("animation_data");
yield return new Token((TokenType)76, (uint?)null);
yield return (Token)new ConstantToken((Variant)new StringVariant("bobber_position"));
yield return new Token((TokenType)77, (uint?)null);
yield return new Token((TokenType)82, (uint?)null);
yield return (Token)new ConstantToken((Variant)new IntVariant(1L, false));
yield return new Token((TokenType)81, (uint?)null);
yield return new Token((TokenType)89, (uint?)null);
}
else
{
yield return current;
}
}
}
finally
{
((global::System.IDisposable)enumerator)?.Dispose();
}
}
}