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 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("SelfPunchMultiplier")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SelfPunchMultiplier")]
[assembly: AssemblyTitle("SelfPunchMultiplier")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace SelfPunchModifier;
public class Config
{
[JsonInclude]
public double multiplier = 3.0;
[JsonInclude]
public bool meow_on_punch;
}
public class Mod : IScriptMod, IMod, global::System.IDisposable
{
[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 global::System.Collections.Generic.IEnumerable<Token> tokens;
public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;
public Mod <>4__this;
private int <skip_for>5__2;
private int <part>5__3;
private MultiTokenWaiter <meow>5__4;
private MultiTokenWaiter <normal_horz>5__5;
private MultiTokenWaiter <normal_vert>5__6;
private MultiTokenWaiter <super_horz>5__7;
private MultiTokenWaiter <super_vert>5__8;
private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap8;
private Token <token>5__10;
private bool <overridden>5__11;
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) <= 7u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
}
private bool MoveNext()
{
//IL_0828: Unknown result type (might be due to invalid IL or missing references)
//IL_0832: Expected O, but got Unknown
//IL_0855: Unknown result type (might be due to invalid IL or missing references)
//IL_085f: 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_0647: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Expected O, but got Unknown
//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
//IL_06e2: Expected O, but got Unknown
//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
//IL_06e4: Expected O, but got Unknown
//IL_076e: Unknown result type (might be due to invalid IL or missing references)
//IL_0778: Expected O, but got Unknown
//IL_0773: Unknown result type (might be due to invalid IL or missing references)
//IL_077a: Expected O, but got Unknown
//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0805: Expected O, but got Unknown
//IL_05af: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Expected O, but got Unknown
//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
//IL_05ba: Expected O, but got Unknown
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Expected O, but got Unknown
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: 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_0474: Unknown result type (might be due to invalid IL or missing references)
//IL_047e: Expected O, but got Unknown
//IL_050f: Unknown result type (might be due to invalid IL or missing references)
//IL_0519: Expected O, but got Unknown
try
{
int num = <>1__state;
Mod mod = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<skip_for>5__2 = 0;
<part>5__3 = 0;
<meow>5__4 = new MultiTokenWaiter(new Func<Token, bool>[12]
{
(Token t) => (int)t.Type == 48,
delegate(Token t)
{
IdentifierToken val26 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val26 != null && val26.Name == "_punched";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
IdentifierToken val25 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val25 != null && val25.Name == "from";
},
(Token t) => (int)t.Type == 82,
delegate(Token t)
{
IdentifierToken val24 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val24 != null && val24.Name == "type";
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val23 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val23 != null && val23.Name == "bounce_horz";
},
delegate(Token t)
{
IdentifierToken val22 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val22 != null && val22.Name == "bounce_vert";
},
delegate(Token t)
{
IdentifierToken val21 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val21 != null && val21.Name == "_sync_face_emote";
}
}, false, true);
<normal_horz>5__5 = new MultiTokenWaiter(new Func<Token, bool>[6]
{
delegate(Token t)
{
ConstantToken val19 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val19 != null)
{
Variant value6 = val19.Value;
IntVariant val20 = (IntVariant)(object)((value6 is IntVariant) ? value6 : null);
if (val20 != null)
{
return val20.Value == 0;
}
}
return false;
},
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val18 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val18 != null && val18.Name == "bounce_horz";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val16 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val16 != null)
{
Variant value5 = val16.Value;
RealVariant val17 = (RealVariant)(object)((value5 is RealVariant) ? value5 : null);
if (val17 != null)
{
return val17.Value == 4.0;
}
}
return false;
}
}, false, false);
<normal_vert>5__6 = new MultiTokenWaiter(new Func<Token, bool>[4]
{
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val15 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val15 != null && val15.Name == "bounce_vert";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val13 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val13 != null)
{
Variant value4 = val13.Value;
RealVariant val14 = (RealVariant)(object)((value4 is RealVariant) ? value4 : null);
if (val14 != null)
{
return val14.Value == 8.0;
}
}
return false;
}
}, false, false);
<super_horz>5__7 = new MultiTokenWaiter(new Func<Token, bool>[7]
{
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
ConstantToken val11 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val11 != null)
{
Variant value3 = val11.Value;
IntVariant val12 = (IntVariant)(object)((value3 is IntVariant) ? value3 : null);
if (val12 != null)
{
return val12.Value == 1;
}
}
return false;
},
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val10 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val10 != null && val10.Name == "bounce_horz";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val8 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val8 != null)
{
Variant value2 = val8.Value;
RealVariant val9 = (RealVariant)(object)((value2 is RealVariant) ? value2 : null);
if (val9 != null)
{
return val9.Value == 12.0;
}
}
return false;
}
}, false, false);
<super_vert>5__8 = new MultiTokenWaiter(new Func<Token, bool>[4]
{
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val7 != null && val7.Name == "bounce_vert";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val5 != null)
{
Variant value = val5.Value;
RealVariant val6 = (RealVariant)(object)((value is RealVariant) ? value : null);
if (val6 != null)
{
return val6.Value == 24.0;
}
}
return false;
}
}, false, false);
<>7__wrap8 = tokens.GetEnumerator();
<>1__state = -3;
goto IL_08ae;
case 1:
<>1__state = -3;
goto IL_05fd;
case 2:
<>1__state = -3;
goto IL_0693;
case 3:
<>1__state = -3;
goto IL_0729;
case 4:
<>1__state = -3;
goto IL_07bf;
case 5:
<>1__state = -3;
<>2__current = new Token((TokenType)80, (uint?)null);
<>1__state = 6;
return true;
case 6:
<>1__state = -3;
<>2__current = new Token((TokenType)81, (uint?)null);
<>1__state = 7;
return true;
case 7:
<>1__state = -3;
<overridden>5__11 = true;
<skip_for>5__2 = 3;
goto IL_0880;
case 8:
{
<>1__state = -3;
goto IL_08a7;
}
IL_0693:
if (<part>5__3 == 2 && <super_horz>5__7.Check(<token>5__10))
{
mod.Logger.Information("Injecting bounce_horz super");
ConstantToken val = new ConstantToken((Variant)new RealVariant(12.0 * mod.Config.multiplier, false));
mod.Logger.Information(((object)val).ToString());
<overridden>5__11 = true;
<part>5__3++;
<>2__current = (Token)(object)val;
<>1__state = 3;
return true;
}
goto IL_0729;
IL_0880:
if (!<overridden>5__11)
{
<>2__current = <token>5__10;
<>1__state = 8;
return true;
}
goto IL_08a7;
IL_08ae:
while (true)
{
if (((global::System.Collections.IEnumerator)<>7__wrap8).MoveNext())
{
<token>5__10 = <>7__wrap8.Current;
if (<skip_for>5__2 <= 0)
{
break;
}
<skip_for>5__2--;
continue;
}
<>m__Finally1();
<>7__wrap8 = null;
return false;
}
<overridden>5__11 = false;
if (<part>5__3 == 0 && <normal_horz>5__5.Check(<token>5__10))
{
mod.Logger.Information("Injecting bounce_horz normal");
ConstantToken val2 = new ConstantToken((Variant)new RealVariant(4.0 * mod.Config.multiplier, false));
mod.Logger.Information(((object)val2).ToString());
<overridden>5__11 = true;
<part>5__3++;
<>2__current = (Token)(object)val2;
<>1__state = 1;
return true;
}
goto IL_05fd;
IL_07bf:
if (mod.Config.meow_on_punch && <meow>5__4.Check(<token>5__10))
{
mod.Logger.Information("Injecting meow");
<>2__current = (Token)new IdentifierToken("_bark");
<>1__state = 5;
return true;
}
goto IL_0880;
IL_0729:
if (<part>5__3 == 3 && <super_vert>5__8.Check(<token>5__10))
{
mod.Logger.Information("Injecting bounce_vert super");
ConstantToken val3 = new ConstantToken((Variant)new RealVariant(24.0 * mod.Config.multiplier, false));
mod.Logger.Information(((object)val3).ToString());
<overridden>5__11 = true;
<part>5__3++;
<>2__current = (Token)(object)val3;
<>1__state = 4;
return true;
}
goto IL_07bf;
IL_05fd:
if (<part>5__3 == 1 && <normal_vert>5__6.Check(<token>5__10))
{
mod.Logger.Information("Injecting bounce_vert normal");
ConstantToken val4 = new ConstantToken((Variant)new RealVariant(8.0 * mod.Config.multiplier, false));
mod.Logger.Information(((object)val4).ToString());
<overridden>5__11 = true;
<part>5__3++;
<>2__current = (Token)(object)val4;
<>1__state = 2;
return true;
}
goto IL_0693;
IL_08a7:
<token>5__10 = null;
goto IL_08ae;
}
}
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__wrap8 != null)
{
((global::System.IDisposable)<>7__wrap8).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__.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 SelfPunchMultiplier!");
Logger = modInterface.Logger;
modInterface.RegisterScriptMod((IScriptMod)(object)this);
}
public void Dispose()
{
}
public bool ShouldRun(string path)
{
return path == "res://Scenes/Entities/Player/player.gdc";
}
[IteratorStateMachine(typeof(<Modify>d__5))]
public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
{
int skip_for = 0;
int part = 0;
MultiTokenWaiter meow = new MultiTokenWaiter(new Func<Token, bool>[12]
{
(Token t) => (int)t.Type == 48,
delegate(Token t)
{
IdentifierToken val26 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val26 != null && val26.Name == "_punched";
},
(Token t) => (int)t.Type == 80,
delegate(Token t)
{
IdentifierToken val25 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val25 != null && val25.Name == "from";
},
(Token t) => (int)t.Type == 82,
delegate(Token t)
{
IdentifierToken val24 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val24 != null && val24.Name == "type";
},
(Token t) => (int)t.Type == 81,
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val23 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val23 != null && val23.Name == "bounce_horz";
},
delegate(Token t)
{
IdentifierToken val22 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val22 != null && val22.Name == "bounce_vert";
},
delegate(Token t)
{
IdentifierToken val21 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val21 != null && val21.Name == "_sync_face_emote";
}
}, false, true);
MultiTokenWaiter normal_horz = new MultiTokenWaiter(new Func<Token, bool>[6]
{
delegate(Token t)
{
ConstantToken val19 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val19 != null)
{
Variant value6 = val19.Value;
IntVariant val20 = (IntVariant)(object)((value6 is IntVariant) ? value6 : null);
if (val20 != null)
{
return val20.Value == 0;
}
}
return false;
},
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val18 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val18 != null && val18.Name == "bounce_horz";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val16 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val16 != null)
{
Variant value5 = val16.Value;
RealVariant val17 = (RealVariant)(object)((value5 is RealVariant) ? value5 : null);
if (val17 != null)
{
return val17.Value == 4.0;
}
}
return false;
}
}, false, false);
MultiTokenWaiter normal_vert = new MultiTokenWaiter(new Func<Token, bool>[4]
{
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val15 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val15 != null && val15.Name == "bounce_vert";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val13 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val13 != null)
{
Variant value4 = val13.Value;
RealVariant val14 = (RealVariant)(object)((value4 is RealVariant) ? value4 : null);
if (val14 != null)
{
return val14.Value == 8.0;
}
}
return false;
}
}, false, false);
MultiTokenWaiter super_horz = new MultiTokenWaiter(new Func<Token, bool>[7]
{
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
ConstantToken val11 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val11 != null)
{
Variant value3 = val11.Value;
IntVariant val12 = (IntVariant)(object)((value3 is IntVariant) ? value3 : null);
if (val12 != null)
{
return val12.Value == 1;
}
}
return false;
},
(Token t) => (int)t.Type == 86,
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val10 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val10 != null && val10.Name == "bounce_horz";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val8 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val8 != null)
{
Variant value2 = val8.Value;
RealVariant val9 = (RealVariant)(object)((value2 is RealVariant) ? value2 : null);
if (val9 != null)
{
return val9.Value == 12.0;
}
}
return false;
}
}, false, false);
MultiTokenWaiter super_vert = new MultiTokenWaiter(new Func<Token, bool>[4]
{
(Token t) => (int)t.Type == 89,
delegate(Token t)
{
IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
return val7 != null && val7.Name == "bounce_vert";
},
(Token t) => (int)t.Type == 23,
delegate(Token t)
{
ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
if (val5 != null)
{
Variant value = val5.Value;
RealVariant val6 = (RealVariant)(object)((value is RealVariant) ? value : null);
if (val6 != null)
{
return val6.Value == 24.0;
}
}
return false;
}
}, false, false);
global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
try
{
while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
{
Token token = enumerator.Current;
if (skip_for > 0)
{
skip_for--;
continue;
}
bool overridden = false;
if (part == 0 && normal_horz.Check(token))
{
Logger.Information("Injecting bounce_horz normal");
ConstantToken val = new ConstantToken((Variant)new RealVariant(4.0 * Config.multiplier, false));
Logger.Information(((object)val).ToString());
overridden = true;
part++;
yield return (Token)(object)val;
}
if (part == 1 && normal_vert.Check(token))
{
Logger.Information("Injecting bounce_vert normal");
ConstantToken val2 = new ConstantToken((Variant)new RealVariant(8.0 * Config.multiplier, false));
Logger.Information(((object)val2).ToString());
overridden = true;
part++;
yield return (Token)(object)val2;
}
if (part == 2 && super_horz.Check(token))
{
Logger.Information("Injecting bounce_horz super");
ConstantToken val3 = new ConstantToken((Variant)new RealVariant(12.0 * Config.multiplier, false));
Logger.Information(((object)val3).ToString());
overridden = true;
part++;
yield return (Token)(object)val3;
}
if (part == 3 && super_vert.Check(token))
{
Logger.Information("Injecting bounce_vert super");
ConstantToken val4 = new ConstantToken((Variant)new RealVariant(24.0 * Config.multiplier, false));
Logger.Information(((object)val4).ToString());
overridden = true;
part++;
yield return (Token)(object)val4;
}
if (Config.meow_on_punch && meow.Check(token))
{
Logger.Information("Injecting meow");
yield return (Token)new IdentifierToken("_bark");
yield return new Token((TokenType)80, (uint?)null);
yield return new Token((TokenType)81, (uint?)null);
overridden = true;
skip_for = 3;
}
if (!overridden)
{
yield return token;
}
}
}
finally
{
((global::System.IDisposable)enumerator)?.Dispose();
}
}
}