Decompiled source of BubbetsItems v1.8.15
plugins/BubbetsItems/NCalc.dll
Decompiled 2 months 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.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using Antlr.Runtime; using Antlr.Runtime.Debug; using Antlr.Runtime.Misc; using Antlr.Runtime.Tree; using Antlr3.Runtime.PCL.Output; using NCalc.Domain; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Antlr3.Runtime.PCL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("")] [assembly: AssemblyFileVersion("3.5.0.2")] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")] [assembly: AssemblyInformationalVersion("2.2.0")] [assembly: AssemblyVersion("3.5.0.2")] [CLSCompliant(false)] public class NCalcLexer : Lexer { private class DFA7 : DFA { private const string DFA7_eotS = "\u0004\uffff"; private const string DFA7_eofS = "\u0004\uffff"; private const string DFA7_minS = "\u0002.\u0002\uffff"; private const string DFA7_maxS = "\u00019\u0001e\u0002\uffff"; private const string DFA7_acceptS = "\u0002\uffff\u0001\u0001\u0001\u0002"; private const string DFA7_specialS = "\u0004\uffff}>"; private static readonly string[] DFA7_transitionS; private static readonly short[] DFA7_eot; private static readonly short[] DFA7_eof; private static readonly char[] DFA7_min; private static readonly char[] DFA7_max; private static readonly short[] DFA7_accept; private static readonly short[] DFA7_special; private static readonly short[][] DFA7_transition; public override string Description => "252:1: FLOAT : ( ( DIGIT )* '.' ( DIGIT )+ ( E )? | ( DIGIT )+ E );"; static DFA7() { DFA7_transitionS = new string[4] { "\u0001\u0002\u0001\uffff\n\u0001", "\u0001\u0002\u0001\uffff\n\u0001\v\uffff\u0001\u0003\u001f\uffff\u0001\u0003", "", "" }; DFA7_eot = DFA.UnpackEncodedString("\u0004\uffff"); DFA7_eof = DFA.UnpackEncodedString("\u0004\uffff"); DFA7_min = DFA.UnpackEncodedStringToUnsignedChars("\u0002.\u0002\uffff"); DFA7_max = DFA.UnpackEncodedStringToUnsignedChars("\u00019\u0001e\u0002\uffff"); DFA7_accept = DFA.UnpackEncodedString("\u0002\uffff\u0001\u0001\u0001\u0002"); DFA7_special = DFA.UnpackEncodedString("\u0004\uffff}>"); int num = DFA7_transitionS.Length; DFA7_transition = new short[num][]; for (int i = 0; i < num; i++) { DFA7_transition[i] = DFA.UnpackEncodedString(DFA7_transitionS[i]); } } public DFA7(BaseRecognizer recognizer) { base.recognizer = recognizer; decisionNumber = 7; eot = DFA7_eot; eof = DFA7_eof; min = DFA7_min; max = DFA7_max; accept = DFA7_accept; special = DFA7_special; transition = DFA7_transition; } public override void Error(NoViableAltException nvae) { } } private class DFA14 : DFA { private const string DFA14_eotS = "\u0001\uffff\u0001!\u0001\uffff\u0001#\b\uffff\u0001'\u0001)\u0001,\u0002\uffff\u0003\u001e\u00011\u0001\uffff\u0003\u001e\u00016\u0013\uffff\u0002\u001e\u00019\u0002\uffff\u0003\u001e\u0002\uffff\u0001<\u0001=\u0001\uffff\u0002\u001e\u0002\uffff\u0001@\u0001\u001e\u0001\uffff\u0001B\u0001\uffff"; private const string DFA14_eofS = "C\uffff"; private const string DFA14_minS = "\u0001\t\u0001=\u0001\uffff\u0001&\b\uffff\u0001<\u0002=\u0002\uffff\u0001n\u0001o\u0001r\u0001|\u0001\uffff\u0001r\u0001a\u0001+\u0001.\u0013\uffff\u0001d\u0001t\u00010\u0002\uffff\u0001u\u0001l\u00010\u0002\uffff\u00020\u0001\uffff\u0001e\u0001s\u0002\uffff\u00010\u0001e\u0001\uffff\u00010\u0001\uffff"; private const string DFA14_maxS = "\u0001~\u0001=\u0001\uffff\u0001&\b\uffff\u0001>\u0001=\u0001>\u0002\uffff\u0001n\u0001o\u0001r\u0001|\u0001\uffff\u0001r\u0001a\u00019\u0001e\u0013\uffff\u0001d\u0001t\u0001z\u0002\uffff\u0001u\u0001l\u00019\u0002\uffff\u0002z\u0001\uffff\u0001e\u0001s\u0002\uffff\u0001z\u0001e\u0001\uffff\u0001z\u0001\uffff"; private const string DFA14_acceptS = "\u0002\uffff\u0001\u0003\u0001\uffff\u0001\u0006\u0001\a\u0001\b\u0001\t\u0001\n\u0001\v\u0001\f\u0001\r\u0003\uffff\u0001\u0017\u0001\u0018\u0004\uffff\u0001\u001e\u0004\uffff\u0001#\u0001$\u0001%\u0001&\u0001!\u0001(\u0001\u0002\u0001\u0001\u0001\u0004\u0001\u0005\u0001\u000f\u0001\u0010\u0001\u0011\u0001\u000e\u0001\u0013\u0001\u0012\u0001\u0015\u0001\u0016\u0001\u0014\u0003\uffff\u0001\u001d\u0001\u001c\u0003\uffff\u0001'\u0001\"\u0002\uffff\u0001\u001b\u0002\uffff\u0001\u0019\u0001\u001a\u0002\uffff\u0001\u001f\u0001\uffff\u0001 "; private const string DFA14_specialS = "C\uffff}>"; private static readonly string[] DFA14_transitionS; private static readonly short[] DFA14_eot; private static readonly short[] DFA14_eof; private static readonly char[] DFA14_min; private static readonly char[] DFA14_max; private static readonly short[] DFA14_accept; private static readonly short[] DFA14_special; private static readonly short[][] DFA14_transition; public override string Description => "1:1: Tokens : ( T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | TRUE | FALSE | ID | INTEGER | FLOAT | STRING | DATETIME | NAME | E | WS );"; static DFA14() { DFA14_transitionS = new string[67] { "\u0002\u001f\u0001\uffff\u0002\u001f\u0012\uffff\u0001\u001f\u0001\u0001\u0001\uffff\u0001\u001c\u0001\uffff\u0001\u0002\u0001\u0003\u0001\u001b\u0001\u0004\u0001\u0005\u0001\u0006\u0001\a\u0001\b\u0001\t\u0001\u001a\u0001\n\n\u0019\u0001\v\u0001\uffff\u0001\f\u0001\r\u0001\u000e\u0001\u000f\u0001\uffff\u0004\u001e\u0001\u0018\u0015\u001e\u0001\u001d\u0002\uffff\u0001\u0010\u0001\u001e\u0001\uffff\u0001\u0011\u0003\u001e\u0001\u0018\u0001\u0017\a\u001e\u0001\u0012\u0001\u0013\u0004\u001e\u0001\u0016\u0006\u001e\u0001\uffff\u0001\u0014\u0001\uffff\u0001\u0015", "\u0001 ", "", "\u0001\"", "", "", "", "", "", "", "", "", "\u0001$\u0001%\u0001&", "\u0001(", "\u0001*\u0001+", "", "", "\u0001-", "\u0001.", "\u0001/", "\u00010", "", "\u00012", "\u00013", "\u00015\u0001\uffff\u00015\u0002\uffff\n4", "\u0001\u001a\u0001\uffff\n\u0019\v\uffff\u0001\u001a\u001f\uffff\u0001\u001a", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\u00017", "\u00018", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "", "", "\u0001:", "\u0001;", "\n4", "", "", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "", "\u0001>", "\u0001?", "", "", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "\u0001A", "", "\n\u001e\a\uffff\u001a\u001e\u0004\uffff\u0001\u001e\u0001\uffff\u001a\u001e", "" }; DFA14_eot = DFA.UnpackEncodedString("\u0001\uffff\u0001!\u0001\uffff\u0001#\b\uffff\u0001'\u0001)\u0001,\u0002\uffff\u0003\u001e\u00011\u0001\uffff\u0003\u001e\u00016\u0013\uffff\u0002\u001e\u00019\u0002\uffff\u0003\u001e\u0002\uffff\u0001<\u0001=\u0001\uffff\u0002\u001e\u0002\uffff\u0001@\u0001\u001e\u0001\uffff\u0001B\u0001\uffff"); DFA14_eof = DFA.UnpackEncodedString("C\uffff"); DFA14_min = DFA.UnpackEncodedStringToUnsignedChars("\u0001\t\u0001=\u0001\uffff\u0001&\b\uffff\u0001<\u0002=\u0002\uffff\u0001n\u0001o\u0001r\u0001|\u0001\uffff\u0001r\u0001a\u0001+\u0001.\u0013\uffff\u0001d\u0001t\u00010\u0002\uffff\u0001u\u0001l\u00010\u0002\uffff\u00020\u0001\uffff\u0001e\u0001s\u0002\uffff\u00010\u0001e\u0001\uffff\u00010\u0001\uffff"); DFA14_max = DFA.UnpackEncodedStringToUnsignedChars("\u0001~\u0001=\u0001\uffff\u0001&\b\uffff\u0001>\u0001=\u0001>\u0002\uffff\u0001n\u0001o\u0001r\u0001|\u0001\uffff\u0001r\u0001a\u00019\u0001e\u0013\uffff\u0001d\u0001t\u0001z\u0002\uffff\u0001u\u0001l\u00019\u0002\uffff\u0002z\u0001\uffff\u0001e\u0001s\u0002\uffff\u0001z\u0001e\u0001\uffff\u0001z\u0001\uffff"); DFA14_accept = DFA.UnpackEncodedString("\u0002\uffff\u0001\u0003\u0001\uffff\u0001\u0006\u0001\a\u0001\b\u0001\t\u0001\n\u0001\v\u0001\f\u0001\r\u0003\uffff\u0001\u0017\u0001\u0018\u0004\uffff\u0001\u001e\u0004\uffff\u0001#\u0001$\u0001%\u0001&\u0001!\u0001(\u0001\u0002\u0001\u0001\u0001\u0004\u0001\u0005\u0001\u000f\u0001\u0010\u0001\u0011\u0001\u000e\u0001\u0013\u0001\u0012\u0001\u0015\u0001\u0016\u0001\u0014\u0003\uffff\u0001\u001d\u0001\u001c\u0003\uffff\u0001'\u0001\"\u0002\uffff\u0001\u001b\u0002\uffff\u0001\u0019\u0001\u001a\u0002\uffff\u0001\u001f\u0001\uffff\u0001 "); DFA14_special = DFA.UnpackEncodedString("C\uffff}>"); int num = DFA14_transitionS.Length; DFA14_transition = new short[num][]; for (int i = 0; i < num; i++) { DFA14_transition[i] = DFA.UnpackEncodedString(DFA14_transitionS[i]); } } public DFA14(BaseRecognizer recognizer) { base.recognizer = recognizer; decisionNumber = 14; eot = DFA14_eot; eof = DFA14_eof; min = DFA14_min; max = DFA14_max; accept = DFA14_accept; special = DFA14_special; transition = DFA14_transition; } public override void Error(NoViableAltException nvae) { } } public const int EOF = -1; public const int DATETIME = 4; public const int DIGIT = 5; public const int E = 6; public const int EscapeSequence = 7; public const int FALSE = 8; public const int FLOAT = 9; public const int HexDigit = 10; public const int ID = 11; public const int INTEGER = 12; public const int LETTER = 13; public const int NAME = 14; public const int STRING = 15; public const int TRUE = 16; public const int UnicodeEscape = 17; public const int WS = 18; public const int T__19 = 19; public const int T__20 = 20; public const int T__21 = 21; public const int T__22 = 22; public const int T__23 = 23; public const int T__24 = 24; public const int T__25 = 25; public const int T__26 = 26; public const int T__27 = 27; public const int T__28 = 28; public const int T__29 = 29; public const int T__30 = 30; public const int T__31 = 31; public const int T__32 = 32; public const int T__33 = 33; public const int T__34 = 34; public const int T__35 = 35; public const int T__36 = 36; public const int T__37 = 37; public const int T__38 = 38; public const int T__39 = 39; public const int T__40 = 40; public const int T__41 = 41; public const int T__42 = 42; public const int T__43 = 43; public const int T__44 = 44; public const int T__45 = 45; public const int T__46 = 46; public const int T__47 = 47; public const int T__48 = 48; private static readonly bool[] decisionCanBacktrack = new bool[0]; private DFA7 dfa7; private DFA14 dfa14; public override string GrammarFileName => "C:\\Users\\sebros\\My Projects\\NCalc\\Grammar\\NCalc.g"; public NCalcLexer() { } public NCalcLexer(ICharStream input) : this(input, new RecognizerSharedState()) { } public NCalcLexer(ICharStream input, RecognizerSharedState state) : base(input, state) { } [GrammarRule("T__19")] private void mT__19() { try { int type = 19; int channel = 0; Match(33); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__20")] private void mT__20() { try { int type = 20; int channel = 0; Match("!="); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__21")] private void mT__21() { try { int type = 21; int channel = 0; Match(37); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__22")] private void mT__22() { try { int type = 22; int channel = 0; Match("&&"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__23")] private void mT__23() { try { int type = 23; int channel = 0; Match(38); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__24")] private void mT__24() { try { int type = 24; int channel = 0; Match(40); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__25")] private void mT__25() { try { int type = 25; int channel = 0; Match(41); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__26")] private void mT__26() { try { int type = 26; int channel = 0; Match(42); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__27")] private void mT__27() { try { int type = 27; int channel = 0; Match(43); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__28")] private void mT__28() { try { int type = 28; int channel = 0; Match(44); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__29")] private void mT__29() { try { int type = 29; int channel = 0; Match(45); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__30")] private void mT__30() { try { int type = 30; int channel = 0; Match(47); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__31")] private void mT__31() { try { int type = 31; int channel = 0; Match(58); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__32")] private void mT__32() { try { int type = 32; int channel = 0; Match(60); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__33")] private void mT__33() { try { int type = 33; int channel = 0; Match("<<"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__34")] private void mT__34() { try { int type = 34; int channel = 0; Match("<="); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__35")] private void mT__35() { try { int type = 35; int channel = 0; Match("<>"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__36")] private void mT__36() { try { int type = 36; int channel = 0; Match(61); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__37")] private void mT__37() { try { int type = 37; int channel = 0; Match("=="); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__38")] private void mT__38() { try { int type = 38; int channel = 0; Match(62); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__39")] private void mT__39() { try { int type = 39; int channel = 0; Match(">="); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__40")] private void mT__40() { try { int type = 40; int channel = 0; Match(">>"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__41")] private void mT__41() { try { int type = 41; int channel = 0; Match(63); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__42")] private void mT__42() { try { int type = 42; int channel = 0; Match(94); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__43")] private void mT__43() { try { int type = 43; int channel = 0; Match("and"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__44")] private void mT__44() { try { int type = 44; int channel = 0; Match("not"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__45")] private void mT__45() { try { int type = 45; int channel = 0; Match("or"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__46")] private void mT__46() { try { int type = 46; int channel = 0; Match(124); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__47")] private void mT__47() { try { int type = 47; int channel = 0; Match("||"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("T__48")] private void mT__48() { try { int type = 48; int channel = 0; Match(126); state.type = type; state.channel = channel; } finally { } } [GrammarRule("TRUE")] private void mTRUE() { try { int type = 16; int channel = 0; Match("true"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("FALSE")] private void mFALSE() { try { int type = 8; int channel = 0; Match("false"); state.type = type; state.channel = channel; } finally { } } [GrammarRule("ID")] private void mID() { try { int type = 11; int channel = 0; mLETTER(); try { while (true) { int num = 2; try { int num2 = input.LA(1); if ((num2 < 48 || num2 > 57) && (num2 < 65 || num2 > 90)) { switch (num2) { case 95: case 97: case 98: case 99: case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: case 120: case 121: case 122: break; default: goto end_IL_000d; } } num = 1; end_IL_000d:; } finally { } if (num != 1) { break; } input.Consume(); } } finally { } state.type = type; state.channel = channel; } finally { } } [GrammarRule("INTEGER")] private void mINTEGER() { try { int type = 12; int channel = 0; int num = 0; try { while (true) { int num2 = 2; try { int num3 = input.LA(1); if (num3 >= 48 && num3 <= 57) { num2 = 1; } } finally { } if (num2 != 1) { break; } input.Consume(); num++; } if (num < 1) { throw new EarlyExitException(2, input); } } finally { } state.type = type; state.channel = channel; } finally { } } [GrammarRule("FLOAT")] private void mFLOAT() { try { int type = 9; int channel = 0; int num = 2; try { num = dfa7.Predict(input); } catch (NoViableAltException) { throw; } finally { } switch (num) { case 1: { try { while (true) { int num5 = 2; try { int num6 = input.LA(1); if (num6 >= 48 && num6 <= 57) { num5 = 1; } } finally { } if (num5 != 1) { break; } input.Consume(); } } finally { } Match(46); int num7 = 0; try { while (true) { int num8 = 2; try { int num9 = input.LA(1); if (num9 >= 48 && num9 <= 57) { num8 = 1; } } finally { } if (num8 != 1) { break; } input.Consume(); num7++; } if (num7 < 1) { throw new EarlyExitException(4, input); } } finally { } int num10 = 2; try { try { int num11 = input.LA(1); if (num11 == 69 || num11 == 101) { num10 = 1; } } finally { } if (num10 == 1) { mE(); } } finally { } break; } case 2: { int num2 = 0; try { while (true) { int num3 = 2; try { int num4 = input.LA(1); if (num4 >= 48 && num4 <= 57) { num3 = 1; } } finally { } if (num3 != 1) { break; } input.Consume(); num2++; } if (num2 < 1) { throw new EarlyExitException(6, input); } } finally { } mE(); break; } } state.type = type; state.channel = channel; } finally { } } [GrammarRule("STRING")] private void mSTRING() { try { int type = 15; int channel = 0; Match(39); try { while (true) { int num = 3; try { int num2 = input.LA(1); switch (num2) { case 92: num = 1; goto end_IL_000f; default: if ((num2 >= 40 && num2 <= 91) || (num2 >= 93 && num2 <= 65535)) { break; } goto end_IL_000f; case 32: case 33: case 34: case 35: case 36: case 37: case 38: break; } num = 2; end_IL_000f:; } finally { } switch (num) { case 1: mEscapeSequence(); continue; case 2: input.Consume(); continue; } break; } } finally { } Match(39); state.type = type; state.channel = channel; } finally { } } [GrammarRule("DATETIME")] private void mDATETIME() { try { int type = 4; int channel = 0; Match(35); try { while (true) { int num = 2; try { int num2 = input.LA(1); if ((num2 >= 0 && num2 <= 34) || (num2 >= 36 && num2 <= 65535)) { num = 1; } } finally { } if (num != 1) { break; } input.Consume(); } } finally { } Match(35); state.type = type; state.channel = channel; } finally { } } [GrammarRule("NAME")] private void mNAME() { try { int type = 14; int channel = 0; Match(91); try { while (true) { int num = 2; try { int num2 = input.LA(1); if ((num2 >= 0 && num2 <= 92) || (num2 >= 94 && num2 <= 65535)) { num = 1; } } finally { } if (num != 1) { break; } input.Consume(); } } finally { } Match(93); state.type = type; state.channel = channel; } finally { } } [GrammarRule("E")] private void mE() { try { int type = 6; int channel = 0; if (input.LA(1) == 69 || input.LA(1) == 101) { input.Consume(); int num = 2; try { try { int num2 = input.LA(1); if (num2 == 43 || num2 == 45) { num = 1; } } finally { } if (num == 1) { input.Consume(); } } finally { } int num3 = 0; try { while (true) { int num4 = 2; try { int num5 = input.LA(1); if (num5 >= 48 && num5 <= 57) { num4 = 1; } } finally { } if (num4 != 1) { break; } input.Consume(); num3++; } if (num3 < 1) { throw new EarlyExitException(12, input); } } finally { } state.type = type; state.channel = channel; return; } MismatchedSetException ex = new MismatchedSetException(null, input); Recover(ex); throw ex; } finally { } } [GrammarRule("LETTER")] private void mLETTER() { try { if ((input.LA(1) >= 65 && input.LA(1) <= 90) || input.LA(1) == 95 || (input.LA(1) >= 97 && input.LA(1) <= 122)) { input.Consume(); return; } MismatchedSetException ex = new MismatchedSetException(null, input); Recover(ex); throw ex; } finally { } } [GrammarRule("DIGIT")] private void mDIGIT() { try { if (input.LA(1) >= 48 && input.LA(1) <= 57) { input.Consume(); return; } MismatchedSetException ex = new MismatchedSetException(null, input); Recover(ex); throw ex; } finally { } } [GrammarRule("EscapeSequence")] private void mEscapeSequence() { try { Match(92); int num = 6; try { try { num = input.LA(1) switch { 110 => 1, 114 => 2, 116 => 3, 39 => 4, 92 => 5, 117 => 6, _ => throw new NoViableAltException("", 13, 0, input), }; } finally { } switch (num) { case 1: Match(110); break; case 2: Match(114); break; case 3: Match(116); break; case 4: Match(39); break; case 5: Match(92); break; case 6: mUnicodeEscape(); break; } } finally { } } finally { } } [GrammarRule("HexDigit")] private void mHexDigit() { try { if ((input.LA(1) >= 48 && input.LA(1) <= 57) || (input.LA(1) >= 65 && input.LA(1) <= 70) || (input.LA(1) >= 97 && input.LA(1) <= 102)) { input.Consume(); return; } MismatchedSetException ex = new MismatchedSetException(null, input); Recover(ex); throw ex; } finally { } } [GrammarRule("UnicodeEscape")] private void mUnicodeEscape() { try { Match(117); mHexDigit(); mHexDigit(); mHexDigit(); mHexDigit(); } finally { } } [GrammarRule("WS")] private void mWS() { try { int type = 18; int num = 0; if ((input.LA(1) >= 9 && input.LA(1) <= 10) || (input.LA(1) >= 12 && input.LA(1) <= 13) || input.LA(1) == 32) { input.Consume(); num = 99; state.type = type; state.channel = num; return; } MismatchedSetException ex = new MismatchedSetException(null, input); Recover(ex); throw ex; } finally { } } public override void mTokens() { int num = 40; try { num = dfa14.Predict(input); } catch (NoViableAltException) { throw; } finally { } switch (num) { case 1: mT__19(); break; case 2: mT__20(); break; case 3: mT__21(); break; case 4: mT__22(); break; case 5: mT__23(); break; case 6: mT__24(); break; case 7: mT__25(); break; case 8: mT__26(); break; case 9: mT__27(); break; case 10: mT__28(); break; case 11: mT__29(); break; case 12: mT__30(); break; case 13: mT__31(); break; case 14: mT__32(); break; case 15: mT__33(); break; case 16: mT__34(); break; case 17: mT__35(); break; case 18: mT__36(); break; case 19: mT__37(); break; case 20: mT__38(); break; case 21: mT__39(); break; case 22: mT__40(); break; case 23: mT__41(); break; case 24: mT__42(); break; case 25: mT__43(); break; case 26: mT__44(); break; case 27: mT__45(); break; case 28: mT__46(); break; case 29: mT__47(); break; case 30: mT__48(); break; case 31: mTRUE(); break; case 32: mFALSE(); break; case 33: mID(); break; case 34: mINTEGER(); break; case 35: mFLOAT(); break; case 36: mSTRING(); break; case 37: mDATETIME(); break; case 38: mNAME(); break; case 39: mE(); break; case 40: mWS(); break; } } protected override void InitDFAs() { base.InitDFAs(); dfa7 = new DFA7(this); dfa14 = new DFA14(this); } } [CLSCompliant(false)] public class NCalcParser : Parser { public class ncalcExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class logicalExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class conditionalExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class booleanAndExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class bitwiseOrExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class bitwiseXOrExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class bitwiseAndExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class equalityExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class relationalExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class shiftExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class additiveExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class multiplicativeExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class unaryExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class primaryExpression_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public LogicalExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class value_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public ValueExpression value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class identifier_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public Identifier value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class expressionList_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public List<LogicalExpression> value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } public class arguments_return : ParserRuleReturnScope<IToken>, IAstRuleReturnScope<CommonTree>, IAstRuleReturnScope, IRuleReturnScope { public List<LogicalExpression> value; private CommonTree _tree; public CommonTree Tree { get { return _tree; } set { _tree = value; } } object IAstRuleReturnScope.Tree => _tree; } private static class Follow { public static readonly BitSet _logicalExpression_in_ncalcExpression56 = new BitSet(new ulong[1]); public static readonly BitSet _EOF_in_ncalcExpression58 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _conditionalExpression_in_logicalExpression78 = new BitSet(new ulong[1] { 2199023255554uL }); public static readonly BitSet _41_in_logicalExpression84 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _conditionalExpression_in_logicalExpression88 = new BitSet(new ulong[1] { 2147483648uL }); public static readonly BitSet _31_in_logicalExpression90 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _conditionalExpression_in_logicalExpression94 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _booleanAndExpression_in_conditionalExpression121 = new BitSet(new ulong[1] { 175921860444162uL }); public static readonly BitSet _set_in_conditionalExpression130 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _conditionalExpression_in_conditionalExpression146 = new BitSet(new ulong[1] { 175921860444162uL }); public static readonly BitSet _bitwiseOrExpression_in_booleanAndExpression180 = new BitSet(new ulong[1] { 8796097216514uL }); public static readonly BitSet _set_in_booleanAndExpression189 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _bitwiseOrExpression_in_booleanAndExpression205 = new BitSet(new ulong[1] { 8796097216514uL }); public static readonly BitSet _bitwiseXOrExpression_in_bitwiseOrExpression237 = new BitSet(new ulong[1] { 70368744177666uL }); public static readonly BitSet _46_in_bitwiseOrExpression246 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _bitwiseOrExpression_in_bitwiseOrExpression256 = new BitSet(new ulong[1] { 70368744177666uL }); public static readonly BitSet _bitwiseAndExpression_in_bitwiseXOrExpression290 = new BitSet(new ulong[1] { 4398046511106uL }); public static readonly BitSet _42_in_bitwiseXOrExpression299 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _bitwiseAndExpression_in_bitwiseXOrExpression309 = new BitSet(new ulong[1] { 4398046511106uL }); public static readonly BitSet _equalityExpression_in_bitwiseAndExpression341 = new BitSet(new ulong[1] { 8388610uL }); public static readonly BitSet _23_in_bitwiseAndExpression350 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _equalityExpression_in_bitwiseAndExpression360 = new BitSet(new ulong[1] { 8388610uL }); public static readonly BitSet _relationalExpression_in_equalityExpression394 = new BitSet(new ulong[1] { 240519217154uL }); public static readonly BitSet _set_in_equalityExpression405 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _set_in_equalityExpression422 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _relationalExpression_in_equalityExpression441 = new BitSet(new ulong[1] { 240519217154uL }); public static readonly BitSet _shiftExpression_in_relationalExpression474 = new BitSet(new ulong[1] { 846108557314uL }); public static readonly BitSet _32_in_relationalExpression485 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _34_in_relationalExpression495 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _38_in_relationalExpression506 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _39_in_relationalExpression516 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _shiftExpression_in_relationalExpression528 = new BitSet(new ulong[1] { 846108557314uL }); public static readonly BitSet _additiveExpression_in_shiftExpression560 = new BitSet(new ulong[1] { 1108101562370uL }); public static readonly BitSet _33_in_shiftExpression571 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _40_in_shiftExpression581 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _additiveExpression_in_shiftExpression593 = new BitSet(new ulong[1] { 1108101562370uL }); public static readonly BitSet _multiplicativeExpression_in_additiveExpression625 = new BitSet(new ulong[1] { 671088642uL }); public static readonly BitSet _27_in_additiveExpression636 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _29_in_additiveExpression646 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _multiplicativeExpression_in_additiveExpression658 = new BitSet(new ulong[1] { 671088642uL }); public static readonly BitSet _unaryExpression_in_multiplicativeExpression690 = new BitSet(new ulong[1] { 1142947842uL }); public static readonly BitSet _26_in_multiplicativeExpression701 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _30_in_multiplicativeExpression711 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _21_in_multiplicativeExpression721 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _unaryExpression_in_multiplicativeExpression733 = new BitSet(new ulong[1] { 1142947842uL }); public static readonly BitSet _primaryExpression_in_unaryExpression760 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _set_in_unaryExpression771 = new BitSet(new ulong[1] { 16898832uL }); public static readonly BitSet _primaryExpression_in_unaryExpression779 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _48_in_unaryExpression791 = new BitSet(new ulong[1] { 16898832uL }); public static readonly BitSet _primaryExpression_in_unaryExpression794 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _29_in_unaryExpression805 = new BitSet(new ulong[1] { 16898832uL }); public static readonly BitSet _primaryExpression_in_unaryExpression807 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _24_in_primaryExpression829 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _logicalExpression_in_primaryExpression831 = new BitSet(new ulong[1] { 33554432uL }); public static readonly BitSet _25_in_primaryExpression833 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _value_in_primaryExpression843 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _identifier_in_primaryExpression851 = new BitSet(new ulong[1] { 16777218uL }); public static readonly BitSet _arguments_in_primaryExpression856 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _INTEGER_in_value876 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _FLOAT_in_value884 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _STRING_in_value892 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _DATETIME_in_value901 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _TRUE_in_value908 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _FALSE_in_value916 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _ID_in_identifier934 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _NAME_in_identifier942 = new BitSet(new ulong[1] { 2uL }); public static readonly BitSet _logicalExpression_in_expressionList966 = new BitSet(new ulong[1] { 268435458uL }); public static readonly BitSet _28_in_expressionList973 = new BitSet(new ulong[1] { 299067717049104uL }); public static readonly BitSet _logicalExpression_in_expressionList977 = new BitSet(new ulong[1] { 268435458uL }); public static readonly BitSet _24_in_arguments1006 = new BitSet(new ulong[1] { 299067750603536uL }); public static readonly BitSet _expressionList_in_arguments1010 = new BitSet(new ulong[1] { 33554432uL }); public static readonly BitSet _25_in_arguments1017 = new BitSet(new ulong[1] { 2uL }); } internal static readonly string[] tokenNames = new string[49] { "<invalid>", "<EOR>", "<DOWN>", "<UP>", "DATETIME", "DIGIT", "E", "EscapeSequence", "FALSE", "FLOAT", "HexDigit", "ID", "INTEGER", "LETTER", "NAME", "STRING", "TRUE", "UnicodeEscape", "WS", "'!'", "'!='", "'%'", "'&&'", "'&'", "'('", "')'", "'*'", "'+'", "','", "'-'", "'/'", "':'", "'<'", "'<<'", "'<='", "'<>'", "'='", "'=='", "'>'", "'>='", "'>>'", "'?'", "'^'", "'and'", "'not'", "'or'", "'|'", "'||'", "'~'" }; public const int EOF = -1; public const int DATETIME = 4; public const int DIGIT = 5; public const int E = 6; public const int EscapeSequence = 7; public const int FALSE = 8; public const int FLOAT = 9; public const int HexDigit = 10; public const int ID = 11; public const int INTEGER = 12; public const int LETTER = 13; public const int NAME = 14; public const int STRING = 15; public const int TRUE = 16; public const int UnicodeEscape = 17; public const int WS = 18; public const int T__19 = 19; public const int T__20 = 20; public const int T__21 = 21; public const int T__22 = 22; public const int T__23 = 23; public const int T__24 = 24; public const int T__25 = 25; public const int T__26 = 26; public const int T__27 = 27; public const int T__28 = 28; public const int T__29 = 29; public const int T__30 = 30; public const int T__31 = 31; public const int T__32 = 32; public const int T__33 = 33; public const int T__34 = 34; public const int T__35 = 35; public const int T__36 = 36; public const int T__37 = 37; public const int T__38 = 38; public const int T__39 = 39; public const int T__40 = 40; public const int T__41 = 41; public const int T__42 = 42; public const int T__43 = 43; public const int T__44 = 44; public const int T__45 = 45; public const int T__46 = 46; public const int T__47 = 47; public const int T__48 = 48; private static readonly bool[] decisionCanBacktrack = new bool[0]; private ITreeAdaptor adaptor; private const char BS = '\\'; private static NumberFormatInfo numberFormatInfo = new NumberFormatInfo(); public ITreeAdaptor TreeAdaptor { get { return adaptor; } set { adaptor = value; } } public override string[] TokenNames => tokenNames; public override string GrammarFileName => "C:\\Users\\sebros\\My Projects\\NCalc\\Grammar\\NCalc.g"; public List<string> Errors { get; private set; } public NCalcParser(ITokenStream input) : this(input, new RecognizerSharedState()) { } public NCalcParser(ITokenStream input, RecognizerSharedState state) : base(input, state) { ITreeAdaptor treeAdaptor = null; TreeAdaptor = treeAdaptor ?? new CommonTreeAdaptor(); } private string extractString(string text) { StringBuilder stringBuilder = new StringBuilder(text); int startIndex = 1; int num = -1; while ((num = stringBuilder.ToString().IndexOf('\\', startIndex)) != -1) { char c = stringBuilder[num + 1]; switch (c) { case 'u': { string text2 = string.Concat(stringBuilder[num + 4], stringBuilder[num + 5]); string text3 = string.Concat(stringBuilder[num + 2], stringBuilder[num + 3]); char c2 = Encoding.Unicode.GetChars(new byte[2] { Convert.ToByte(text2, 16), Convert.ToByte(text3, 16) })[0]; stringBuilder.Remove(num, 6).Insert(num, c2); break; } case 'n': stringBuilder.Remove(num, 2).Insert(num, '\n'); break; case 'r': stringBuilder.Remove(num, 2).Insert(num, '\r'); break; case 't': stringBuilder.Remove(num, 2).Insert(num, '\t'); break; case '\'': stringBuilder.Remove(num, 2).Insert(num, '\''); break; case '\\': stringBuilder.Remove(num, 2).Insert(num, '\\'); break; default: throw new RecognitionException("Unvalid escape sequence: \\" + c); } startIndex = num + 1; } stringBuilder.Remove(0, 1); stringBuilder.Remove(stringBuilder.Length - 1, 1); return stringBuilder.ToString(); } public override void DisplayRecognitionError(string[] tokenNames, RecognitionException e) { base.DisplayRecognitionError(tokenNames, e); if (Errors == null) { Errors = new List<string>(); } string errorHeader = GetErrorHeader(e); string errorMessage = GetErrorMessage(e, tokenNames); Errors.Add(errorMessage + " at " + errorHeader); } [GrammarRule("ncalcExpression")] public ncalcExpression_return ncalcExpression() { ncalcExpression_return ncalcExpression_return = new ncalcExpression_return(); ncalcExpression_return.Start = input.LT(1); CommonTree commonTree = null; logicalExpression_return logicalExpression_return = null; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._logicalExpression_in_ncalcExpression56); logicalExpression_return = logicalExpression(); PopFollow(); adaptor.AddChild(commonTree, logicalExpression_return.Tree); _ = (IToken)Match(input, -1, Follow._EOF_in_ncalcExpression58); ncalcExpression_return.value = logicalExpression_return?.value; ncalcExpression_return.Stop = input.LT(-1); ncalcExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(ncalcExpression_return.Tree, ncalcExpression_return.Start, ncalcExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); ncalcExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, ncalcExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return ncalcExpression_return; } [GrammarRule("logicalExpression")] private logicalExpression_return logicalExpression() { logicalExpression_return logicalExpression_return = new logicalExpression_return(); logicalExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; conditionalExpression_return conditionalExpression_return = null; conditionalExpression_return conditionalExpression_return2 = null; conditionalExpression_return conditionalExpression_return3 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._conditionalExpression_in_logicalExpression78); conditionalExpression_return = conditionalExpression(); PopFollow(); adaptor.AddChild(commonTree, conditionalExpression_return.Tree); logicalExpression_return.value = conditionalExpression_return?.value; int num = 2; try { try { if (input.LA(1) == 41) { num = 1; } } finally { } if (num == 1) { token = (IToken)Match(input, 41, Follow._41_in_logicalExpression84); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); PushFollow(Follow._conditionalExpression_in_logicalExpression88); conditionalExpression_return2 = conditionalExpression(); PopFollow(); adaptor.AddChild(commonTree, conditionalExpression_return2.Tree); token2 = (IToken)Match(input, 31, Follow._31_in_logicalExpression90); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); PushFollow(Follow._conditionalExpression_in_logicalExpression94); conditionalExpression_return3 = conditionalExpression(); PopFollow(); adaptor.AddChild(commonTree, conditionalExpression_return3.Tree); logicalExpression_return.value = new TernaryExpression(conditionalExpression_return?.value, conditionalExpression_return2?.value, conditionalExpression_return3?.value); } } finally { } logicalExpression_return.Stop = input.LT(-1); logicalExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(logicalExpression_return.Tree, logicalExpression_return.Start, logicalExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); logicalExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, logicalExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return logicalExpression_return; } [GrammarRule("conditionalExpression")] private conditionalExpression_return conditionalExpression() { conditionalExpression_return conditionalExpression_return = new conditionalExpression_return(); conditionalExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; booleanAndExpression_return booleanAndExpression_return = null; conditionalExpression_return conditionalExpression_return2 = null; BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._booleanAndExpression_in_conditionalExpression121); booleanAndExpression_return = booleanAndExpression(); PopFollow(); adaptor.AddChild(commonTree, booleanAndExpression_return.Tree); conditionalExpression_return.value = booleanAndExpression_return?.value; try { while (true) { int num = 2; try { int num2 = input.LA(1); if (num2 == 45 || num2 == 47) { num = 1; } } finally { } if (num == 1) { token = input.LT(1); if (input.LA(1) == 45 || input.LA(1) == 47) { input.Consume(); adaptor.AddChild(commonTree, (CommonTree)adaptor.Create(token)); state.errorRecovery = false; binaryExpressionType = BinaryExpressionType.Or; PushFollow(Follow._conditionalExpression_in_conditionalExpression146); conditionalExpression_return2 = conditionalExpression(); PopFollow(); adaptor.AddChild(commonTree, conditionalExpression_return2.Tree); conditionalExpression_return.value = new NCalc.Domain.BinaryExpression(binaryExpressionType, conditionalExpression_return.value, conditionalExpression_return2?.value); continue; } throw new MismatchedSetException(null, input); } break; } } finally { } conditionalExpression_return.Stop = input.LT(-1); conditionalExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(conditionalExpression_return.Tree, conditionalExpression_return.Start, conditionalExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); conditionalExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, conditionalExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return conditionalExpression_return; } [GrammarRule("booleanAndExpression")] private booleanAndExpression_return booleanAndExpression() { booleanAndExpression_return booleanAndExpression_return = new booleanAndExpression_return(); booleanAndExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; bitwiseOrExpression_return bitwiseOrExpression_return = null; bitwiseOrExpression_return bitwiseOrExpression_return2 = null; BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._bitwiseOrExpression_in_booleanAndExpression180); bitwiseOrExpression_return = bitwiseOrExpression(); PopFollow(); adaptor.AddChild(commonTree, bitwiseOrExpression_return.Tree); booleanAndExpression_return.value = bitwiseOrExpression_return?.value; try { while (true) { int num = 2; try { int num2 = input.LA(1); if (num2 == 22 || num2 == 43) { num = 1; } } finally { } if (num == 1) { token = input.LT(1); if (input.LA(1) == 22 || input.LA(1) == 43) { input.Consume(); adaptor.AddChild(commonTree, (CommonTree)adaptor.Create(token)); state.errorRecovery = false; binaryExpressionType = BinaryExpressionType.And; PushFollow(Follow._bitwiseOrExpression_in_booleanAndExpression205); bitwiseOrExpression_return2 = bitwiseOrExpression(); PopFollow(); adaptor.AddChild(commonTree, bitwiseOrExpression_return2.Tree); booleanAndExpression_return.value = new NCalc.Domain.BinaryExpression(binaryExpressionType, booleanAndExpression_return.value, bitwiseOrExpression_return2?.value); continue; } throw new MismatchedSetException(null, input); } break; } } finally { } booleanAndExpression_return.Stop = input.LT(-1); booleanAndExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(booleanAndExpression_return.Tree, booleanAndExpression_return.Start, booleanAndExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); booleanAndExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, booleanAndExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return booleanAndExpression_return; } [GrammarRule("bitwiseOrExpression")] private bitwiseOrExpression_return bitwiseOrExpression() { bitwiseOrExpression_return bitwiseOrExpression_return = new bitwiseOrExpression_return(); bitwiseOrExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; bitwiseXOrExpression_return bitwiseXOrExpression_return = null; bitwiseOrExpression_return bitwiseOrExpression_return2 = null; CommonTree commonTree2 = null; BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._bitwiseXOrExpression_in_bitwiseOrExpression237); bitwiseXOrExpression_return = bitwiseXOrExpression(); PopFollow(); adaptor.AddChild(commonTree, bitwiseXOrExpression_return.Tree); bitwiseOrExpression_return.value = bitwiseXOrExpression_return?.value; try { while (true) { int num = 2; try { if (input.LA(1) == 46) { num = 1; } } finally { } if (num == 1) { token = (IToken)Match(input, 46, Follow._46_in_bitwiseOrExpression246); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); binaryExpressionType = BinaryExpressionType.BitwiseOr; PushFollow(Follow._bitwiseOrExpression_in_bitwiseOrExpression256); bitwiseOrExpression_return2 = bitwiseOrExpression(); PopFollow(); adaptor.AddChild(commonTree, bitwiseOrExpression_return2.Tree); bitwiseOrExpression_return.value = new NCalc.Domain.BinaryExpression(binaryExpressionType, bitwiseOrExpression_return.value, bitwiseOrExpression_return2?.value); continue; } break; } } finally { } bitwiseOrExpression_return.Stop = input.LT(-1); bitwiseOrExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(bitwiseOrExpression_return.Tree, bitwiseOrExpression_return.Start, bitwiseOrExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); bitwiseOrExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, bitwiseOrExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return bitwiseOrExpression_return; } [GrammarRule("bitwiseXOrExpression")] private bitwiseXOrExpression_return bitwiseXOrExpression() { bitwiseXOrExpression_return bitwiseXOrExpression_return = new bitwiseXOrExpression_return(); bitwiseXOrExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; bitwiseAndExpression_return bitwiseAndExpression_return = null; bitwiseAndExpression_return bitwiseAndExpression_return2 = null; CommonTree commonTree2 = null; BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._bitwiseAndExpression_in_bitwiseXOrExpression290); bitwiseAndExpression_return = bitwiseAndExpression(); PopFollow(); adaptor.AddChild(commonTree, bitwiseAndExpression_return.Tree); bitwiseXOrExpression_return.value = bitwiseAndExpression_return?.value; try { while (true) { int num = 2; try { if (input.LA(1) == 42) { num = 1; } } finally { } if (num == 1) { token = (IToken)Match(input, 42, Follow._42_in_bitwiseXOrExpression299); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); binaryExpressionType = BinaryExpressionType.BitwiseXOr; PushFollow(Follow._bitwiseAndExpression_in_bitwiseXOrExpression309); bitwiseAndExpression_return2 = bitwiseAndExpression(); PopFollow(); adaptor.AddChild(commonTree, bitwiseAndExpression_return2.Tree); bitwiseXOrExpression_return.value = new NCalc.Domain.BinaryExpression(binaryExpressionType, bitwiseXOrExpression_return.value, bitwiseAndExpression_return2?.value); continue; } break; } } finally { } bitwiseXOrExpression_return.Stop = input.LT(-1); bitwiseXOrExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(bitwiseXOrExpression_return.Tree, bitwiseXOrExpression_return.Start, bitwiseXOrExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); bitwiseXOrExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, bitwiseXOrExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return bitwiseXOrExpression_return; } [GrammarRule("bitwiseAndExpression")] private bitwiseAndExpression_return bitwiseAndExpression() { bitwiseAndExpression_return bitwiseAndExpression_return = new bitwiseAndExpression_return(); bitwiseAndExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; equalityExpression_return equalityExpression_return = null; equalityExpression_return equalityExpression_return2 = null; CommonTree commonTree2 = null; BinaryExpressionType binaryExpressionType = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._equalityExpression_in_bitwiseAndExpression341); equalityExpression_return = equalityExpression(); PopFollow(); adaptor.AddChild(commonTree, equalityExpression_return.Tree); bitwiseAndExpression_return.value = equalityExpression_return?.value; try { while (true) { int num = 2; try { if (input.LA(1) == 23) { num = 1; } } finally { } if (num == 1) { token = (IToken)Match(input, 23, Follow._23_in_bitwiseAndExpression350); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); binaryExpressionType = BinaryExpressionType.BitwiseAnd; PushFollow(Follow._equalityExpression_in_bitwiseAndExpression360); equalityExpression_return2 = equalityExpression(); PopFollow(); adaptor.AddChild(commonTree, equalityExpression_return2.Tree); bitwiseAndExpression_return.value = new NCalc.Domain.BinaryExpression(binaryExpressionType, bitwiseAndExpression_return.value, equalityExpression_return2?.value); continue; } break; } } finally { } bitwiseAndExpression_return.Stop = input.LT(-1); bitwiseAndExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(bitwiseAndExpression_return.Tree, bitwiseAndExpression_return.Start, bitwiseAndExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); bitwiseAndExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, bitwiseAndExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return bitwiseAndExpression_return; } [GrammarRule("equalityExpression")] private equalityExpression_return equalityExpression() { equalityExpression_return equalityExpression_return = new equalityExpression_return(); equalityExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; relationalExpression_return relationalExpression_return = null; relationalExpression_return relationalExpression_return2 = null; BinaryExpressionType type = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._relationalExpression_in_equalityExpression394); relationalExpression_return = relationalExpression(); PopFollow(); adaptor.AddChild(commonTree, relationalExpression_return.Tree); equalityExpression_return.value = relationalExpression_return?.value; try { while (true) { int num = 2; try { switch (input.LA(1)) { case 20: case 35: case 36: case 37: num = 1; break; } } finally { } if (num != 1) { break; } int num2 = 2; try { try { int num3 = input.LA(1); if (num3 >= 36 && num3 <= 37) { num2 = 1; } else { if (num3 != 20 && num3 != 35) { throw new NoViableAltException("", 7, 0, input); } num2 = 2; } } finally { } switch (num2) { case 1: token = input.LT(1); if (input.LA(1) >= 36 && input.LA(1) <= 37) { input.Consume(); adaptor.AddChild(commonTree, (CommonTree)adaptor.Create(token)); state.errorRecovery = false; type = BinaryExpressionType.Equal; break; } throw new MismatchedSetException(null, input); case 2: token2 = input.LT(1); if (input.LA(1) == 20 || input.LA(1) == 35) { input.Consume(); adaptor.AddChild(commonTree, (CommonTree)adaptor.Create(token2)); state.errorRecovery = false; type = BinaryExpressionType.NotEqual; break; } throw new MismatchedSetException(null, input); } } finally { } PushFollow(Follow._relationalExpression_in_equalityExpression441); relationalExpression_return2 = relationalExpression(); PopFollow(); adaptor.AddChild(commonTree, relationalExpression_return2.Tree); equalityExpression_return.value = new NCalc.Domain.BinaryExpression(type, equalityExpression_return.value, relationalExpression_return2?.value); } } finally { } equalityExpression_return.Stop = input.LT(-1); equalityExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(equalityExpression_return.Tree, equalityExpression_return.Start, equalityExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); equalityExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, equalityExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return equalityExpression_return; } [GrammarRule("relationalExpression")] private relationalExpression_return relationalExpression() { relationalExpression_return relationalExpression_return = new relationalExpression_return(); relationalExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; IToken token3 = null; IToken token4 = null; shiftExpression_return shiftExpression_return = null; shiftExpression_return shiftExpression_return2 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; CommonTree commonTree4 = null; CommonTree commonTree5 = null; BinaryExpressionType type = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._shiftExpression_in_relationalExpression474); shiftExpression_return = shiftExpression(); PopFollow(); adaptor.AddChild(commonTree, shiftExpression_return.Tree); relationalExpression_return.value = shiftExpression_return?.value; try { while (true) { int num = 2; try { switch (input.LA(1)) { case 32: case 34: case 38: case 39: num = 1; break; } } finally { } if (num != 1) { break; } int num2 = 4; try { try { num2 = input.LA(1) switch { 32 => 1, 34 => 2, 38 => 3, 39 => 4, _ => throw new NoViableAltException("", 9, 0, input), }; } finally { } switch (num2) { case 1: token = (IToken)Match(input, 32, Follow._32_in_relationalExpression485); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); type = BinaryExpressionType.Lesser; break; case 2: token2 = (IToken)Match(input, 34, Follow._34_in_relationalExpression495); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); type = BinaryExpressionType.LesserOrEqual; break; case 3: token3 = (IToken)Match(input, 38, Follow._38_in_relationalExpression506); commonTree4 = (CommonTree)adaptor.Create(token3); adaptor.AddChild(commonTree, commonTree4); type = BinaryExpressionType.Greater; break; case 4: token4 = (IToken)Match(input, 39, Follow._39_in_relationalExpression516); commonTree5 = (CommonTree)adaptor.Create(token4); adaptor.AddChild(commonTree, commonTree5); type = BinaryExpressionType.GreaterOrEqual; break; } } finally { } PushFollow(Follow._shiftExpression_in_relationalExpression528); shiftExpression_return2 = shiftExpression(); PopFollow(); adaptor.AddChild(commonTree, shiftExpression_return2.Tree); relationalExpression_return.value = new NCalc.Domain.BinaryExpression(type, relationalExpression_return.value, shiftExpression_return2?.value); } } finally { } relationalExpression_return.Stop = input.LT(-1); relationalExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(relationalExpression_return.Tree, relationalExpression_return.Start, relationalExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); relationalExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, relationalExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return relationalExpression_return; } [GrammarRule("shiftExpression")] private shiftExpression_return shiftExpression() { shiftExpression_return shiftExpression_return = new shiftExpression_return(); shiftExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; additiveExpression_return additiveExpression_return = null; additiveExpression_return additiveExpression_return2 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; BinaryExpressionType type = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._additiveExpression_in_shiftExpression560); additiveExpression_return = additiveExpression(); PopFollow(); adaptor.AddChild(commonTree, additiveExpression_return.Tree); shiftExpression_return.value = additiveExpression_return?.value; try { while (true) { int num = 2; try { int num2 = input.LA(1); if (num2 == 33 || num2 == 40) { num = 1; } } finally { } if (num != 1) { break; } int num3 = 2; try { try { num3 = input.LA(1) switch { 33 => 1, 40 => 2, _ => throw new NoViableAltException("", 11, 0, input), }; } finally { } switch (num3) { case 1: token = (IToken)Match(input, 33, Follow._33_in_shiftExpression571); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); type = BinaryExpressionType.LeftShift; break; case 2: token2 = (IToken)Match(input, 40, Follow._40_in_shiftExpression581); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); type = BinaryExpressionType.RightShift; break; } } finally { } PushFollow(Follow._additiveExpression_in_shiftExpression593); additiveExpression_return2 = additiveExpression(); PopFollow(); adaptor.AddChild(commonTree, additiveExpression_return2.Tree); shiftExpression_return.value = new NCalc.Domain.BinaryExpression(type, shiftExpression_return.value, additiveExpression_return2?.value); } } finally { } shiftExpression_return.Stop = input.LT(-1); shiftExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(shiftExpression_return.Tree, shiftExpression_return.Start, shiftExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); shiftExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, shiftExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return shiftExpression_return; } [GrammarRule("additiveExpression")] private additiveExpression_return additiveExpression() { additiveExpression_return additiveExpression_return = new additiveExpression_return(); additiveExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; multiplicativeExpression_return multiplicativeExpression_return = null; multiplicativeExpression_return multiplicativeExpression_return2 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; BinaryExpressionType type = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._multiplicativeExpression_in_additiveExpression625); multiplicativeExpression_return = multiplicativeExpression(); PopFollow(); adaptor.AddChild(commonTree, multiplicativeExpression_return.Tree); additiveExpression_return.value = multiplicativeExpression_return?.value; try { while (true) { int num = 2; try { int num2 = input.LA(1); if (num2 == 27 || num2 == 29) { num = 1; } } finally { } if (num != 1) { break; } int num3 = 2; try { try { num3 = input.LA(1) switch { 27 => 1, 29 => 2, _ => throw new NoViableAltException("", 13, 0, input), }; } finally { } switch (num3) { case 1: token = (IToken)Match(input, 27, Follow._27_in_additiveExpression636); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); type = BinaryExpressionType.Plus; break; case 2: token2 = (IToken)Match(input, 29, Follow._29_in_additiveExpression646); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); type = BinaryExpressionType.Minus; break; } } finally { } PushFollow(Follow._multiplicativeExpression_in_additiveExpression658); multiplicativeExpression_return2 = multiplicativeExpression(); PopFollow(); adaptor.AddChild(commonTree, multiplicativeExpression_return2.Tree); additiveExpression_return.value = new NCalc.Domain.BinaryExpression(type, additiveExpression_return.value, multiplicativeExpression_return2?.value); } } finally { } additiveExpression_return.Stop = input.LT(-1); additiveExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(additiveExpression_return.Tree, additiveExpression_return.Start, additiveExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); additiveExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, additiveExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return additiveExpression_return; } [GrammarRule("multiplicativeExpression")] private multiplicativeExpression_return multiplicativeExpression() { multiplicativeExpression_return multiplicativeExpression_return = new multiplicativeExpression_return(); multiplicativeExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; IToken token3 = null; unaryExpression_return unaryExpression_return = null; unaryExpression_return unaryExpression_return2 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; CommonTree commonTree4 = null; BinaryExpressionType type = BinaryExpressionType.Unknown; try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._unaryExpression_in_multiplicativeExpression690); unaryExpression_return = unaryExpression(); PopFollow(); adaptor.AddChild(commonTree, unaryExpression_return.Tree); multiplicativeExpression_return.value = unaryExpression_return?.value; try { while (true) { int num = 2; try { int num2 = input.LA(1); if (num2 == 21 || num2 == 26 || num2 == 30) { num = 1; } } finally { } if (num != 1) { break; } int num3 = 3; try { try { num3 = input.LA(1) switch { 26 => 1, 30 => 2, 21 => 3, _ => throw new NoViableAltException("", 15, 0, input), }; } finally { } switch (num3) { case 1: token = (IToken)Match(input, 26, Follow._26_in_multiplicativeExpression701); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); type = BinaryExpressionType.Times; break; case 2: token2 = (IToken)Match(input, 30, Follow._30_in_multiplicativeExpression711); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); type = BinaryExpressionType.Div; break; case 3: token3 = (IToken)Match(input, 21, Follow._21_in_multiplicativeExpression721); commonTree4 = (CommonTree)adaptor.Create(token3); adaptor.AddChild(commonTree, commonTree4); type = BinaryExpressionType.Modulo; break; } } finally { } PushFollow(Follow._unaryExpression_in_multiplicativeExpression733); unaryExpression_return2 = unaryExpression(); PopFollow(); adaptor.AddChild(commonTree, unaryExpression_return2.Tree); multiplicativeExpression_return.value = new NCalc.Domain.BinaryExpression(type, multiplicativeExpression_return.value, unaryExpression_return2?.value); } } finally { } multiplicativeExpression_return.Stop = input.LT(-1); multiplicativeExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(multiplicativeExpression_return.Tree, multiplicativeExpression_return.Start, multiplicativeExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); multiplicativeExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, multiplicativeExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return multiplicativeExpression_return; } [GrammarRule("unaryExpression")] private unaryExpression_return unaryExpression() { unaryExpression_return unaryExpression_return = new unaryExpression_return(); unaryExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; IToken token3 = null; primaryExpression_return primaryExpression_return = null; primaryExpression_return primaryExpression_return2 = null; primaryExpression_return primaryExpression_return3 = null; primaryExpression_return primaryExpression_return4 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; try { try { int num = 4; try { switch (input.LA(1)) { case 4: case 8: case 9: case 11: case 12: case 14: case 15: case 16: case 24: num = 1; break; case 19: case 44: num = 2; break; case 48: num = 3; break; case 29: num = 4; break; default: throw new NoViableAltException("", 17, 0, input); } } finally { } switch (num) { case 1: commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._primaryExpression_in_unaryExpression760); primaryExpression_return = primaryExpression(); PopFollow(); adaptor.AddChild(commonTree, primaryExpression_return.Tree); unaryExpression_return.value = primaryExpression_return?.value; break; case 2: commonTree = (CommonTree)adaptor.Nil(); token = input.LT(1); if (input.LA(1) == 19 || input.LA(1) == 44) { input.Consume(); adaptor.AddChild(commonTree, (CommonTree)adaptor.Create(token)); state.errorRecovery = false; PushFollow(Follow._primaryExpression_in_unaryExpression779); primaryExpression_return2 = primaryExpression(); PopFollow(); adaptor.AddChild(commonTree, primaryExpression_return2.Tree); unaryExpression_return.value = new NCalc.Domain.UnaryExpression(UnaryExpressionType.Not, primaryExpression_return2?.value); break; } throw new MismatchedSetException(null, input); case 3: commonTree = (CommonTree)adaptor.Nil(); token2 = (IToken)Match(input, 48, Follow._48_in_unaryExpression791); commonTree2 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree2); PushFollow(Follow._primaryExpression_in_unaryExpression794); primaryExpression_return3 = primaryExpression(); PopFollow(); adaptor.AddChild(commonTree, primaryExpression_return3.Tree); unaryExpression_return.value = new NCalc.Domain.UnaryExpression(UnaryExpressionType.BitwiseNot, primaryExpression_return3?.value); break; case 4: commonTree = (CommonTree)adaptor.Nil(); token3 = (IToken)Match(input, 29, Follow._29_in_unaryExpression805); commonTree3 = (CommonTree)adaptor.Create(token3); adaptor.AddChild(commonTree, commonTree3); PushFollow(Follow._primaryExpression_in_unaryExpression807); primaryExpression_return4 = primaryExpression(); PopFollow(); adaptor.AddChild(commonTree, primaryExpression_return4.Tree); unaryExpression_return.value = new NCalc.Domain.UnaryExpression(UnaryExpressionType.Negate, primaryExpression_return4?.value); break; } unaryExpression_return.Stop = input.LT(-1); unaryExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(unaryExpression_return.Tree, unaryExpression_return.Start, unaryExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); unaryExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, unaryExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return unaryExpression_return; } [GrammarRule("primaryExpression")] private primaryExpression_return primaryExpression() { primaryExpression_return primaryExpression_return = new primaryExpression_return(); primaryExpression_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; value_return value_return = null; logicalExpression_return logicalExpression_return = null; identifier_return identifier_return = null; arguments_return arguments_return = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; try { try { int num = 3; try { switch (input.LA(1)) { case 24: num = 1; break; case 4: case 8: case 9: case 12: case 15: case 16: num = 2; break; case 11: case 14: num = 3; break; default: throw new NoViableAltException("", 19, 0, input); } } finally { } switch (num) { case 1: commonTree = (CommonTree)adaptor.Nil(); token = (IToken)Match(input, 24, Follow._24_in_primaryExpression829); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); PushFollow(Follow._logicalExpression_in_primaryExpression831); logicalExpression_return = logicalExpression(); PopFollow(); adaptor.AddChild(commonTree, logicalExpression_return.Tree); token2 = (IToken)Match(input, 25, Follow._25_in_primaryExpression833); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); primaryExpression_return.value = logicalExpression_return?.value; break; case 2: commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._value_in_primaryExpression843); value_return = value(); PopFollow(); adaptor.AddChild(commonTree, value_return.Tree); primaryExpression_return.value = value_return?.value; break; case 3: { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._identifier_in_primaryExpression851); identifier_return = identifier(); PopFollow(); adaptor.AddChild(commonTree, identifier_return.Tree); primaryExpression_return.value = identifier_return?.value; int num2 = 2; try { try { if (input.LA(1) == 24) { num2 = 1; } } finally { } if (num2 == 1) { PushFollow(Follow._arguments_in_primaryExpression856); arguments_return = arguments(); PopFollow(); adaptor.AddChild(commonTree, arguments_return.Tree); primaryExpression_return.value = new Function(identifier_return?.value, (arguments_return?.value).ToArray()); } } finally { } break; } } primaryExpression_return.Stop = input.LT(-1); primaryExpression_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(primaryExpression_return.Tree, primaryExpression_return.Start, primaryExpression_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); primaryExpression_return.Tree = (CommonTree)adaptor.ErrorNode(input, primaryExpression_return.Start, input.LT(-1), ex); } finally { } } finally { } return primaryExpression_return; } [GrammarRule("value")] private value_return value() { value_return value_return = new value_return(); value_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; IToken token3 = null; IToken token4 = null; IToken token5 = null; IToken token6 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; CommonTree commonTree4 = null; CommonTree commonTree5 = null; CommonTree commonTree6 = null; CommonTree commonTree7 = null; try { try { int num = 6; try { num = input.LA(1) switch { 12 => 1, 9 => 2, 15 => 3, 4 => 4, 16 => 5, 8 => 6, _ => throw new NoViableAltException("", 20, 0, input), }; } finally { } switch (num) { case 1: commonTree = (CommonTree)adaptor.Nil(); token = (IToken)Match(input, 12, Follow._INTEGER_in_value876); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); try { value_return.value = new ValueExpression(int.Parse(token?.Text)); } catch (OverflowException) { value_return.value = new ValueExpression((object)long.Parse(token?.Text)); } break; case 2: commonTree = (CommonTree)adaptor.Nil(); token2 = (IToken)Match(input, 9, Follow._FLOAT_in_value884); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); value_return.value = new ValueExpression(double.Parse(token2?.Text, NumberStyles.Float, numberFormatInfo)); break; case 3: commonTree = (CommonTree)adaptor.Nil(); token3 = (IToken)Match(input, 15, Follow._STRING_in_value892); commonTree4 = (CommonTree)adaptor.Create(token3); adaptor.AddChild(commonTree, commonTree4); value_return.value = new ValueExpression(extractString(token3?.Text)); break; case 4: commonTree = (CommonTree)adaptor.Nil(); token4 = (IToken)Match(input, 4, Follow._DATETIME_in_value901); commonTree5 = (CommonTree)adaptor.Create(token4); adaptor.AddChild(commonTree, commonTree5); value_return.value = new ValueExpression(DateTime.Parse((token4?.Text).Substring(1, (token4?.Text).Length - 2))); break; case 5: commonTree = (CommonTree)adaptor.Nil(); token5 = (IToken)Match(input, 16, Follow._TRUE_in_value908); commonTree6 = (CommonTree)adaptor.Create(token5); adaptor.AddChild(commonTree, commonTree6); value_return.value = new ValueExpression(value: true); break; case 6: commonTree = (CommonTree)adaptor.Nil(); token6 = (IToken)Match(input, 8, Follow._FALSE_in_value916); commonTree7 = (CommonTree)adaptor.Create(token6); adaptor.AddChild(commonTree, commonTree7); value_return.value = new ValueExpression(value: false); break; } value_return.Stop = input.LT(-1); value_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(value_return.Tree, value_return.Start, value_return.Stop); } catch (RecognitionException ex2) { ReportError(ex2); Recover(input, ex2); value_return.Tree = (CommonTree)adaptor.ErrorNode(input, value_return.Start, input.LT(-1), ex2); } finally { } } finally { } return value_return; } [GrammarRule("identifier")] private identifier_return identifier() { identifier_return identifier_return = new identifier_return(); identifier_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; try { try { int num = 2; try { num = input.LA(1) switch { 11 => 1, 14 => 2, _ => throw new NoViableAltException("", 21, 0, input), }; } finally { } switch (num) { case 1: commonTree = (CommonTree)adaptor.Nil(); token = (IToken)Match(input, 11, Follow._ID_in_identifier934); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); identifier_return.value = new Identifier(token?.Text); break; case 2: commonTree = (CommonTree)adaptor.Nil(); token2 = (IToken)Match(input, 14, Follow._NAME_in_identifier942); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); identifier_return.value = new Identifier((token2?.Text).Substring(1, (token2?.Text).Length - 2)); break; } identifier_return.Stop = input.LT(-1); identifier_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(identifier_return.Tree, identifier_return.Start, identifier_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); identifier_return.Tree = (CommonTree)adaptor.ErrorNode(input, identifier_return.Start, input.LT(-1), ex); } finally { } } finally { } return identifier_return; } [GrammarRule("expressionList")] private expressionList_return expressionList() { expressionList_return expressionList_return = new expressionList_return(); expressionList_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; logicalExpression_return logicalExpression_return = null; logicalExpression_return logicalExpression_return2 = null; CommonTree commonTree2 = null; List<LogicalExpression> list = new List<LogicalExpression>(); try { try { commonTree = (CommonTree)adaptor.Nil(); PushFollow(Follow._logicalExpression_in_expressionList966); logicalExpression_return = logicalExpression(); PopFollow(); adaptor.AddChild(commonTree, logicalExpression_return.Tree); list.Add(logicalExpression_return?.value); try { while (true) { int num = 2; try { if (input.LA(1) == 28) { num = 1; } } finally { } if (num == 1) { token = (IToken)Match(input, 28, Follow._28_in_expressionList973); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); PushFollow(Follow._logicalExpression_in_expressionList977); logicalExpression_return2 = logicalExpression(); PopFollow(); adaptor.AddChild(commonTree, logicalExpression_return2.Tree); list.Add(logicalExpression_return2?.value); continue; } break; } } finally { } expressionList_return.value = list; expressionList_return.Stop = input.LT(-1); expressionList_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(expressionList_return.Tree, expressionList_return.Start, expressionList_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); expressionList_return.Tree = (CommonTree)adaptor.ErrorNode(input, expressionList_return.Start, input.LT(-1), ex); } finally { } } finally { } return expressionList_return; } [GrammarRule("arguments")] private arguments_return arguments() { arguments_return arguments_return = new arguments_return(); arguments_return.Start = input.LT(1); CommonTree commonTree = null; IToken token = null; IToken token2 = null; expressionList_return expressionList_return = null; CommonTree commonTree2 = null; CommonTree commonTree3 = null; arguments_return.value = new List<LogicalExpression>(); try { try { commonTree = (CommonTree)adaptor.Nil(); token = (IToken)Match(input, 24, Follow._24_in_arguments1006); commonTree2 = (CommonTree)adaptor.Create(token); adaptor.AddChild(commonTree, commonTree2); int num = 2; try { try { int num2 = input.LA(1); switch (num2) { default: if ((num2 >= 11 && num2 <= 12) || (num2 >= 14 && num2 <= 16) || num2 == 19 || num2 == 24 || num2 == 29 || num2 == 44 || num2 == 48) { break; } goto end_IL_0080; case 4: case 8: case 9: break; } num = 1; end_IL_0080:; } finally { } if (num == 1) { PushFollow(Follow._expressionList_in_arguments1010); expressionList_return = expressionList(); PopFollow(); adaptor.AddChild(commonTree, expressionList_return.Tree); arguments_return.value = expressionList_return?.value; } } finally { } token2 = (IToken)Match(input, 25, Follow._25_in_arguments1017); commonTree3 = (CommonTree)adaptor.Create(token2); adaptor.AddChild(commonTree, commonTree3); arguments_return.Stop = input.LT(-1); arguments_return.Tree = (CommonTree)adaptor.RulePostProcessing(commonTree); adaptor.SetTokenBoundaries(arguments_return.Tree, arguments_return.Start, arguments_return.Stop); } catch (RecognitionException ex) { ReportError(ex); Recover(input, ex); arguments_return.Tree = (CommonTree)adaptor.ErrorNode(input, arguments_return.Start, input.LT(-1), ex); } finally { } } finally { } return arguments_return; } } namespace System { public static class TypeExtensions { private static readonly Dictionary<Type, TypeCode> TypeCodeMap = new Dictionary<Type, TypeCode> { { typeof(bool), TypeCode.Boolean }, { typeof(byte), TypeCode.Byte }, { typeof(sbyte), TypeCode.SByte }, { typeof(char), TypeCode.Char }, { typeof(DateTime), TypeCode.DateTime }, { typeof(decimal), TypeCode.Decimal }, { typeof(double), TypeCode.Double }, { typeof(float), TypeCode.Single }, { typeof(short), TypeCode.Int16 }, { typeof(int), TypeCode.Int32 }, { typeof(long), TypeCode.Int64 }, { typeof(ushort), TypeCode.UInt16 }, { typeof(uint), TypeCode.UInt32 }, { typeof(ulong), TypeCode.UInt64 }, { typeof(string), TypeCode.String } }; public static TypeCode GetTypeCode(this object obj) { return obj?.GetType().ToTypeCode() ?? TypeCode.Empty; } public static TypeCode ToTypeCode(this Type type) { if (type == null) { return TypeCode.Empty; } if (!TypeCodeMap.TryGetValue(type, out var value)) { return TypeCode.Object; } return value; } } } namespace NCalc { public delegate void EvaluateFunctionHandler(string name, FunctionArgs args); public delegate void EvaluateParameterHandler(string name, ParameterArgs args); public class EvaluationException : Exception { public EvaluationException(string message) : base(message) { } public EvaluationException(string message, Exception innerException) : base(message, innerException) { } } [Flags] public enum EvaluateOptions { None = 1, IgnoreCase = 2, NoCache = 4, IterateParameters = 8, RoundAwayFromZero = 0x10, MatchStringsWithIgnoreCase = 0x20, MatchStringsOrdinal = 0x40, OverflowProtection = 0x80, BooleanCalculation = 0x100, UseDoubleForAbsFunction = 0x200, AllowNullParameter = 0x400 } public class Expression { protected string OriginalExpression; private static bool _cacheEnabled = true; private static ConcurrentDictionary<string, WeakReference> _compiledExpressions = new ConcurrentDictionary<string, WeakReference>(); protected Dictionary<string, IEnumerator> ParameterEnumerators; protected Dictionary<string, object> ParametersBackup; private Dictionary<string, object> _parameters; public EvaluateOptions Options { get; set; } public static bool CacheEnabled { get { return _cacheEnabled; } set { _cacheEnabled = value; if (!CacheEnabled) { _compiledExpressions = new ConcurrentDictionary<string, WeakReference>(); } } } public string Error { get; private set; } public Exception ErrorException { get; private set; } public LogicalExpression ParsedExpression { get; private set; } public Dictionary<string, object> Parameters { get { return _parameters ?? (_parameters = new Dictionary<string, object>()); } set { _parameters = value; } } public event EvaluateFunctionHandler EvaluateFunction; public event EvaluateParameterHandler EvaluateParameter; public Expression(string expression) : this(expression, EvaluateOptions.None) { } public Expression(string expression, EvaluateOptions options) { if (string.IsNullOrEmpty(expression)) { throw new ArgumentException("Expression can't be empty", "expression"); } OriginalExpression = expression; Options = options; } public Expression(LogicalExpression expression) : this(expression, EvaluateOptions.None) { } public Expression(LogicalExpression expression, EvaluateOptions options) { if (expression == null) { throw new ArgumentException("Expression can't be null", "expression"); } ParsedExpression = expression; Options = options; } private static void CleanCache() { List<string> list = new List<string>(); foreach (KeyValuePair<string, WeakReference> compiledExpression in _compiledExpressions) { if (!compiledExpression.Value.IsAlive) { list.Add(compiledExpression.Key); } } foreach (string item in list) { _compiledExpressions.TryRemove(item, out var _); } } public static LogicalExpression Compile(string expression, bool nocache) { LogicalExpression logicalExpression = null; if (_cacheEnabled && !nocache && _compiledExpressions.ContainsKey(expression) && _compiledExpressions.TryGetValue(expression, out var value)) { logicalExpression = value.Target as LogicalExpression; if (value.IsAlive && logicalExpression != null) { return logicalExpression; } } if (logicalExpression == null) { NCalcParser nCalcParser = new NCalcParser(new CommonTokenStream(new NCalcLexer(new ANTLRStringStream(expression)))); logicalExpression = nCalcParser.ncalcExpression().value; if (nCalcParser.Errors != null && nCalcParser.Errors.Count > 0) { throw new EvaluationException(string.Join(Environment.NewLine, nCalcParser.Errors.ToArray())); } if (_cacheEnabled && !nocache) { try { if (_compiledExpressions.TryGetValue(expression, out var value2)) { _compiledExpressions.TryUpdate(expression, new WeakReference(logicalExpression), value2); } else { _compiledExpressions.TryAdd(expression, new WeakReference(logicalExpression)); } } finally { CleanCache(); } } } return logicalExpression
plugins/BubbetsItems/BubbetsItems.dll
Decompiled 2 months 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.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using Aetherium; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BubbetsItems.Behaviours; using BubbetsItems.Components; using BubbetsItems.Helpers; using BubbetsItems.ItemBehaviors; using BubbetsItems.Items; using BubbetsItems.Items.BarrierItems; using BubbetsItems.Items.VoidLunar; using EntityStates; using EntityStates.Interactables.MSObelisk; using EntityStates.Merc; using HG; using HG.Reflection; using HarmonyLib; using InLobbyConfig; using InLobbyConfig.Fields; using ItemStats; using JetBrains.Annotations; using KinematicCharacterController; using MaterialHud; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using NCalc; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.EntityLogic; using RoR2.ExpansionManagement; using RoR2.Items; using RoR2.Networking; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using RoR2.UI.LogBook; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.Serialization; using UnityEngine.UI; using ZedMod; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BubbetsItems")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+014bfd1340c40c30c1c953402cef9ff65bf54ac3")] [assembly: AssemblyProduct("BubbetsItems")] [assembly: AssemblyTitle("BubbetsItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ZedMod { [ExecuteAlways] public class PrefabLoader : MonoBehaviour { public string prefabAddress; private string _loadedPrefab; private bool _loading; private GameObject _instance; private void Start() { LoadPrefab(); } private void OnValidate() { LoadPrefab(); } private void LoadPrefab() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(prefabAddress) && !_loading) { _loading = true; AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)prefabAddress); val.Completed += PrefabLoaded; } } private void PrefabLoaded(AsyncOperationHandle<GameObject> obj) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown AsyncOperationStatus status = obj.Status; switch ((int)status) { case 1: if (!(_loadedPrefab == prefabAddress)) { if ((Object)(object)_instance != (Object)null) { Object.DestroyImmediate((Object)(object)_instance); } GameObject result = obj.Result; _instance = Object.Instantiate<GameObject>(result, ((Component)this).gameObject.transform, false); SetRecursiveFlags(_instance.transform); _loadedPrefab = prefabAddress; _loading = false; } break; case 2: if ((Object)(object)_instance != (Object)null) { Object.DestroyImmediate((Object)(object)_instance); } Debug.LogError((object)"Prefab load failed."); _loading = false; break; case 0: break; } } private static void SetRecursiveFlags(Transform transform) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown GameObject gameObject = ((Component)transform).gameObject; ((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x34); foreach (Transform item in transform) { SetRecursiveFlags(item); } } } } namespace MaterialHud { [ExecuteAlways] public class FieldLoader : MonoBehaviour { public string addressablePath = ""; public string targetFieldName = ""; public Component target; private static readonly MethodInfo? LoadAssetAsyncInfo = typeof(Addressables).GetMethod("LoadAssetAsync", new Type[1] { typeof(string) }); private const BindingFlags Flags = BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private void LoadAsset(bool dontSave = false) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) Type type = ((object)target).GetType(); FieldInfo field = type.GetField(targetFieldName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); PropertyInfo propertyInfo = null; if (field == null) { propertyInfo = type.GetProperty(targetFieldName, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (propertyInfo == null) { return; } } object obj = (LoadAssetAsyncInfo?.MakeGenericMethod(field?.FieldType ?? propertyInfo.PropertyType))?.Invoke(null, new object[1] { addressablePath }); object obj2 = (obj?.GetType().GetMethod("WaitForCompletion", BindingFlags.Instance | BindingFlags.Public))?.Invoke(obj, null); Object val = (Object)((obj2 is Object) ? obj2 : null); if (!(val == (Object)null)) { if (dontSave) { val.hideFlags = (HideFlags)(val.hideFlags | 0x34); } field?.SetValue(target, obj2); propertyInfo?.SetValue(target, obj2); } } private IEnumerator WaitAndLoadAsset() { yield return (object)new WaitUntil((Func<bool>)(() => Addressables.InternalIdTransformFunc != null)); LoadAsset(dontSave: true); } private void Start() { LoadAsset(); } private void OnValidate() { if (((Component)this).gameObject.activeInHierarchy) { ((MonoBehaviour)this).StartCoroutine(WaitAndLoadAsset()); } } } [ExecuteAlways] public class ParticleSystemMaterialLoader : MonoBehaviour { public string addressablePath; public ParticleSystem target; [FormerlySerializedAs("Tint")] public Color tint; private void LoadAsset(bool dontSave = false) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) ParticleSystemRenderer component = ((Component)target).GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material = Addressables.LoadAssetAsync<Material>((object)addressablePath).WaitForCompletion(); if (tint != default(Color)) { ((Renderer)component).material.SetColor("_TintColor", tint); } } private IEnumerator WaitAndLoadAsset() { yield return (object)new WaitUntil((Func<bool>)(() => Addressables.InternalIdTransformFunc != null)); LoadAsset(dontSave: true); } private void Start() { LoadAsset(); } private void OnValidate() { if (((Component)this).gameObject.activeInHierarchy) { ((MonoBehaviour)this).StartCoroutine(WaitAndLoadAsset()); } } } [ExecuteAlways] public class PrefabChildLoader : MonoBehaviour { public string prefabAddress = ""; public int childIndex; private bool _loading; private GameObject? _instance; private int _loadedIndex = -1; public UnityEvent finished = new UnityEvent(); private void Start() { LoadPrefab(); } private void OnValidate() { LoadPrefab(); } private void LoadPrefab() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (_loadedIndex != childIndex) { _loadedIndex = -1; if ((Object)(object)_instance != (Object)null) { Object.DestroyImmediate((Object)(object)_instance); } } if (!string.IsNullOrEmpty(prefabAddress) && !_loading) { _loading = true; AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)prefabAddress); val.Completed += PrefabLoaded; } } private void PrefabLoaded(AsyncOperationHandle<GameObject> obj) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) AsyncOperationStatus status = obj.Status; switch ((int)status) { case 1: if (_loadedIndex != childIndex) { if ((Object)(object)_instance != (Object)null) { Object.DestroyImmediate((Object)(object)_instance); } GameObject val = Object.Instantiate<GameObject>(obj.Result); _instance = ((val.transform.childCount > 0) ? ((Component)val.transform.GetChild(Math.Min(childIndex, val.transform.childCount - 1))).gameObject : val); Transform transform = _instance.transform; SetRecursiveFlags(transform); transform.eulerAngles = Vector3.zero; transform.position = Vector3.zero; transform.localScale = Vector3.one; transform.SetParent(((Component)this).gameObject.transform, false); if (val.transform.childCount > 0) { Object.DestroyImmediate((Object)(object)val); } _loadedIndex = childIndex; _loading = false; finished.Invoke(); } break; case 2: if ((Object)(object)_instance != (Object)null) { Object.DestroyImmediate((Object)(object)_instance); } Debug.LogError((object)"Prefab load failed."); _loading = false; break; case 0: break; } } private static void SetRecursiveFlags(Transform transform) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown GameObject gameObject = ((Component)transform).gameObject; ((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x34); foreach (Transform item in transform) { SetRecursiveFlags(item); } } } [ExecuteAlways] public class ShaderLoader : MonoBehaviour { public string addressablePath = ""; public Renderer target; [ContextMenu("Fill In Editor")] [ExecuteAlways] public void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) Shader shader = Addressables.LoadAssetAsync<Shader>((object)addressablePath).WaitForCompletion(); target.material.shader = shader; target.sharedMaterial.shader = shader; for (int i = 0; i < target.sharedMaterial.shader.GetPropertyCount(); i++) { Debug.Log((object)target.sharedMaterial.shader.GetPropertyFlags(i)); } } } } namespace BubbetsItems { [HarmonyPatch] public abstract class EquipmentBase : SharedBase { public enum EquipmentActivationState { ConsumeStock, DontConsume, DidNothing } public EquipmentDef EquipmentDef; private static IEnumerable<EquipmentBase>? _equipments; internal ConfigEntry<float> Cooldown; public static IEnumerable<EquipmentBase> Equipments => _equipments ?? (_equipments = SharedBase.Instances.OfType<EquipmentBase>()); protected override void MakeConfigs() { string name = GetType().Name; Enabled = sharedInfo.ConfigFile.Bind<bool>("Disable Equipments", name, true, "Should this equipment be enabled."); Cooldown = sharedInfo.ConfigFile.Bind(ConfigCategoriesEnum.EquipmentCooldowns, name, Object.op_Implicit((Object)(object)EquipmentDef) ? EquipmentDef.cooldown : 15f, "Cooldown for this equipment.", 0f); Cooldown.SettingChanged += CooldownChanged; } public static void ApplyPostEquipments() { foreach (EquipmentBase equipment in Equipments) { equipment.PostEquipmentDef(); } } private void CooldownChanged(object sender, EventArgs e) { EquipmentDef.cooldown = Cooldown.Value; } public override void MakeRiskOfOptions() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown base.MakeRiskOfOptions(); SliderConfig val = new SliderConfig { min = 0f, max = 80f }; ModSettingsManager.AddOption((BaseOption)new SliderOption(Cooldown, val)); } public virtual void AuthorityEquipmentPress(EquipmentSlot equipmentSlot) { } public virtual void PerformClientAction(EquipmentSlot equipmentSlot, EquipmentActivationState state) { } public virtual EquipmentActivationState PerformEquipment(EquipmentSlot equipmentSlot) { return EquipmentActivationState.DidNothing; } public virtual void OnUnEquip(Inventory inventory, EquipmentState newEquipmentState) { } public virtual void OnEquip(Inventory inventory, EquipmentState? oldEquipmentState) { } public virtual bool UpdateTargets(EquipmentSlot equipmentSlot) { return false; } protected virtual void PostEquipmentDef() { EquipmentDef.cooldown = Cooldown.Value; } [HarmonyPrefix] [HarmonyPatch(typeof(EquipmentSlot), "InvokeRpcRpcOnClientEquipmentActivationRecieved")] public static bool NetReceive(NetworkBehaviour obj, NetworkReader reader) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) EquipmentActivationState state = EquipmentActivationState.ConsumeStock; try { state = (EquipmentActivationState)reader.ReadByte(); } catch (IndexOutOfRangeException) { } EquipmentSlot val = (EquipmentSlot)obj; EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val.equipmentIndex); EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)equipmentDef); if (equipmentBase != null) { equipmentBase.PerformClientAction(val, state); return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(EquipmentSlot), "CallCmdExecuteIfReady")] public static void PerformEquipmentActionClient(EquipmentSlot __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (__instance.characterBody.hasEffectiveAuthority && !NetworkServer.active && (int)__instance.equipmentIndex != -1 && __instance.stock > 0) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(__instance.equipmentIndex); Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)equipmentDef)?.AuthorityEquipmentPress(__instance); } } [HarmonyPrefix] [HarmonyPatch(typeof(EquipmentSlot), "PerformEquipmentAction")] public static bool PerformEquipmentAction(EquipmentSlot __instance, EquipmentDef equipmentDef, ref bool __result) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) EquipmentDef equipmentDef2 = equipmentDef; EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)equipmentDef2); if (equipmentBase == null) { return true; } try { EquipmentActivationState equipmentActivationState = equipmentBase.PerformEquipment(__instance); __result = equipmentActivationState == EquipmentActivationState.ConsumeStock; if (equipmentActivationState != 0 && NetworkServer.active) { NetworkWriter val = new NetworkWriter(); val.StartMessage((short)2); val.WritePackedUInt32((uint)EquipmentSlot.kRpcRpcOnClientEquipmentActivationRecieved); val.Write(((Component)__instance).GetComponent<NetworkIdentity>().netId); val.Write((byte)equipmentActivationState); ((NetworkBehaviour)__instance).SendRPCInternal(val, 0, "RpcOnClientEquipmentActivationRecieved"); } } catch (Exception ex) { ManualLogSource logger = equipmentBase.sharedInfo.Logger; if (logger != null) { logger.LogError((object)ex); } } return false; } [HarmonyILManipulator] [HarmonyPatch(typeof(EquipmentSlot), "UpdateTargets")] public static void UpdateTargetsIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int activeFlag = -1; val.GotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<EquipmentSlot>(x, "targetIndicator"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref activeFlag) }); int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<EquipmentSlot, bool>>((Func<EquipmentSlot, bool>)UpdateTargetsHook); val.Emit(OpCodes.Ldloc, activeFlag); val.Emit(OpCodes.Or); val.Emit(OpCodes.Stloc, activeFlag); } public static bool UpdateTargetsHook(EquipmentSlot __instance) { EquipmentSlot __instance2 = __instance; EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => x.EquipmentDef.equipmentIndex == __instance2.equipmentIndex); if (equipmentBase == null) { return false; } try { return equipmentBase.UpdateTargets(__instance2); } catch (Exception ex) { ManualLogSource logger = equipmentBase.sharedInfo.Logger; if (logger != null) { logger.LogError((object)ex); } } return false; } public override string GetFormattedDescription(Inventory? inventory = null, string? token = null, bool forceHideExtended = false) { return Language.GetString(token ?? EquipmentDef.descriptionToken); } [HarmonyPrefix] [HarmonyPatch(typeof(Inventory), "SetEquipmentInternal")] public static void OnEquipmentSwap(Inventory __instance, EquipmentState equipmentState, uint slot) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) EquipmentState? val = null; if (__instance.equipmentStateSlots.Length > slot) { val = __instance.equipmentStateSlots[slot]; } if (val.Equals(equipmentState) || val?.equipmentIndex == (EquipmentIndex?)equipmentState.equipmentIndex) { return; } EquipmentDef oldDef = val?.equipmentDef; EquipmentDef newDef = equipmentState.equipmentDef; EquipmentBase equipmentBase = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)oldDef); EquipmentBase equipmentBase2 = Equipments.FirstOrDefault((EquipmentBase x) => (Object)(object)x.EquipmentDef == (Object)(object)newDef); try { equipmentBase?.OnUnEquip(__instance, equipmentState); } catch (Exception ex) { equipmentBase.sharedInfo.Logger.LogError((object)ex); } try { equipmentBase2?.OnEquip(__instance, val); } catch (Exception ex2) { if (equipmentBase2 != null) { equipmentBase2.sharedInfo.Logger.LogError((object)ex2); } } } public override void AddDisplayRules(VanillaIDRS which, ItemDisplayRule[] displayRules) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which); if (ruleSet != null) { ruleSet.keyAssetRuleGroups = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)ruleSet.keyAssetRuleGroups, new KeyAssetRuleGroup { displayRuleGroup = new DisplayRuleGroup { rules = displayRules }, keyAsset = (Object)(object)EquipmentDef }).ToArray(); } } public override void AddDisplayRules(ModdedIDRS which, ItemDisplayRule[] displayRules) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which); if (ruleSet != null) { ruleSet.keyAssetRuleGroups = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)ruleSet.keyAssetRuleGroups, new KeyAssetRuleGroup { displayRuleGroup = new DisplayRuleGroup { rules = displayRules }, keyAsset = (Object)(object)EquipmentDef }).ToArray(); } } protected override void FillDefsFromSerializableCP(SerializableContentPack serializableContentPack) { base.FillDefsFromSerializableCP(serializableContentPack); string name = GetType().Name; EquipmentDef[] equipmentDefs = serializableContentPack.equipmentDefs; foreach (EquipmentDef val in equipmentDefs) { if (val != null && SharedBase.MatchName(((Object)val).name, name)) { EquipmentDef = val; } } if ((Object)(object)EquipmentDef == (Object)null) { ManualLogSource logger = sharedInfo.Logger; if (logger != null) { logger.LogWarning((object)$"Could not find EquipmentDef for item {this} in serializableContentPack, class/equipmentdef name are probably mismatched. This will throw an exception later."); } } } protected override void FillDefsFromContentPack() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) foreach (ContentPack contentPack in SharedBase.ContentPacks) { if ((Object)(object)EquipmentDef != (Object)null) { continue; } string name = GetType().Name; AssetEnumerator<EquipmentDef> enumerator2 = contentPack.equipmentDefs.GetEnumerator(); try { while (enumerator2.MoveNext()) { EquipmentDef current2 = enumerator2.Current; if (SharedBase.MatchName(((Object)current2).name, name)) { EquipmentDef = current2; } } } finally { ((IDisposable)enumerator2).Dispose(); } } if ((Object)(object)EquipmentDef == (Object)null) { ManualLogSource logger = sharedInfo.Logger; if (logger != null) { logger.LogWarning((object)$"Could not find EquipmentDef for item {this}, class/equipmentdef name are probably mismatched. This will throw an exception later."); } } } protected override void FillPickupIndex() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) try { PickupIndex key = (PickupIndex = PickupCatalog.FindPickupIndex(EquipmentDef.equipmentIndex)); SharedBase.PickupIndexes.Add(key, this); } catch (NullReferenceException ex) { ManualLogSource logger = sharedInfo.Logger; if (logger != null) { logger.LogError((object)("Equipment " + GetType().Name + " threw a NRE when filling pickup indexes, this could mean its not defined in your content pack:\n" + ex)); } } } protected override void FillRequiredExpansions() { if (RequiresSotv) { EquipmentDef.requiredExpansion = (Object.op_Implicit((Object)(object)sharedInfo.SotVExpansion) ? sharedInfo.SotVExpansion : SharedBase.SotvExpansion); } else { EquipmentDef.requiredExpansion = sharedInfo.Expansion; } } } [HarmonyPatch] public abstract class ItemBase : SharedBase { public class ScalingInfo { private readonly string _description; private readonly ConfigEntry<string> _configEntry; private Func<ExpressionContext, float> _function; private string _oldValue; public readonly string _name; private readonly ExpressionContext _defaultContext; public readonly ExpressionContext WorkingContext; private string _defaultValue; private bool _madeRiskOfOptions; public string Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public bool IsDefault => _configEntry.Value.Trim() == _defaultValue.Trim(); public ScalingInfo(ConfigFile configFile, string defaultValue, string name, Type callingType, string? desc = null, string? oldDefault = null) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) _description = desc ?? "[a] = item count"; _name = name; WorkingContext = new ExpressionContext(); _configEntry = configFile.Bind(ConfigCategoriesEnum.BalancingFunctions, callingType.Name + "_" + name, defaultValue, callingType.Name + "; " + _name + "; Scaling function for item. ;" + _description, oldDefault); _defaultValue = defaultValue; _oldValue = _configEntry.Value; try { _function = new Expression(_oldValue).ToLambda<ExpressionContext, float>(); } catch (EvaluationException) { _function = new Expression(_defaultValue).ToLambda<ExpressionContext, float>(); } _configEntry.SettingChanged += EntryChanged; } public float ScalingFunction(ExpressionContext? context = null) { return _function(context ?? _defaultContext); } public float ScalingFunction(int? itemCount) { WorkingContext.a = itemCount.GetValueOrDefault(1); return ScalingFunction(WorkingContext); } public override string ToString() { return _oldValue + "\n(" + _name + ": " + _description + ")"; } public void MakeInLobbyConfig(List<object> modConfigEntryObj) { modConfigEntryObj.Add(ConfigFieldUtilities.CreateFromBepInExConfigEntry<string>(_configEntry)); } public void MakeRiskOfOptions() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!_madeRiskOfOptions) { ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_configEntry)); _madeRiskOfOptions = true; } } private void EntryChanged(object sender, EventArgs e) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (_configEntry.Value == _oldValue) { return; } try { _function = new Expression(_configEntry.Value).ToLambda<ExpressionContext, float>(); _oldValue = _configEntry.Value; } catch (EvaluationException) { } } } public class VoidPairing { public static string ValidEntries = string.Join(" ", ItemCatalog.itemNames); private ConfigEntry<string> _configEntry; private ItemBase _parent; public ItemDef[] ItemDefs; private string _default; private string? _oldDefault; private bool _setup; private bool _madeRiskOfOptions; public bool IsDefault => _default.Trim() == _configEntry.Value.Trim(); public VoidPairing(string defaultValue, ItemBase parent, string? oldDefault = null) { _parent = parent; _default = defaultValue; _oldDefault = oldDefault; } public void SettingChangedOld() { IEnumerable<Pair> first = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem].Where((Pair x) => (Object)(object)x.itemDef2 != (Object)(object)_parent.ItemDef); ItemDefs = (from str in _configEntry.Value.Split(' ') select ItemCatalog.FindItemIndex(str) into index where (int)index != -1 select ItemCatalog.GetItemDef(index)).ToArray(); IEnumerable<Pair> second = ItemDefs.Select(delegate(ItemDef def) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Pair result = default(Pair); result.itemDef1 = def; result.itemDef2 = _parent.ItemDef; return result; }); ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = first.Union(second).ToArray(); } public void PostItemCatalog() { if (string.IsNullOrWhiteSpace(ValidEntries)) { ValidEntries = string.Join(" ", ItemCatalog.itemNames); } _configEntry = _parent.sharedInfo.ConfigFile.Bind(ConfigCategoriesEnum.VoidConversions, _parent.GetType().Name, _default, "Valid values: " + ValidEntries, _oldDefault); _configEntry.SettingChanged += delegate { SettingChanged(); }; SettingChanged(); } public void SettingChanged() { ItemDef[] itemDefs = ItemDefs; SettingChangedOld(); if (_setup && !itemDefs.SequenceEqual(ItemDefs)) { ContagiousItemManager.InitTransformationTable(); } _setup = true; } public void MakeRiskOfOptions() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!_madeRiskOfOptions) { ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(_configEntry)); _madeRiskOfOptions = true; } } } public class ExpressionContext { public float a; public float b; public float c; public float d; public float e; public float f; public float g; public float h; public float i; public float j; public float k; public float l; public float m; public float n; public float o; public float p; public float q; public float r; public float s; public float t; public float u; public float v; public float w; public float x; public float y; public float z; public float Epsilon = Mathf.Epsilon; public float Infinity = float.PositiveInfinity; public float Deg2Rad = MathF.PI / 180f; public float NegativeInfinity = float.NegativeInfinity; public float PI = MathF.PI; public float Rad2Deg = 57.29578f; public float Abs(float x) { return Mathf.Abs(x); } public float Acos(float x) { return Mathf.Acos(x); } public float Asin(float x) { return Mathf.Asin(x); } public float Atan(float x) { return Mathf.Atan(x); } public float Atan2(float x, float y) { return Mathf.Atan2(x, y); } public float Ceil(float x) { return Mathf.Ceil(x); } public float Clamp(float a, float x, float y) { return Mathf.Clamp(a, x, y); } public float Clamp01(float x) { return Mathf.Clamp01(x); } public float Cos(float x) { return Mathf.Cos(x); } public float Exp(float x) { return Mathf.Exp(x); } public float Floor(float x) { return Mathf.Floor(x); } public float Gamma(float x, float y, float z) { return Mathf.Gamma(x, y, z); } public float Lerp(float x, float y, float z) { return Mathf.Lerp(x, y, z); } public double Log(double x, double y) { return Mathf.Log((float)x, (float)y); } public float Max(float x, float y) { return Mathf.Max(x, y); } public float Min(float x, float y) { return Mathf.Min(x, y); } public float Pow(float x, float y) { return Mathf.Pow(x, y); } public float Repeat(float x, float y) { return Mathf.Repeat(x, y); } public float Round(float x) { return Mathf.Round(x); } public float Sign(float x) { return Mathf.Sign(x); } public float Sin(float x) { return Mathf.Sin(x); } public float Sqrt(float x) { return Mathf.Sqrt(x); } public float Tan(float x) { return Mathf.Tan(x); } public float DeltaAngle(float x, float y) { return Mathf.DeltaAngle(x, y); } public float InverseLerp(float x, float y, float z) { return Mathf.InverseLerp(x, y, z); } public float LerpAngle(float x, float y, float z) { return Mathf.LerpAngle(x, y, z); } public float LerpUnclamped(float x, float y, float z) { return Mathf.LerpUnclamped(x, y, z); } public float MoveTowards(float x, float y, float z) { return Mathf.MoveTowards(x, y, z); } public float PerlinNoise(float x, float y) { return Mathf.PerlinNoise(x, y); } public float PingPong(float x, float y) { return Mathf.PingPong(x, y); } public float SmoothStep(float x, float y, float z) { return Mathf.SmoothStep(x, y, z); } public float MoveTowardsAngle(float x, float y, float z) { return Mathf.MoveTowardsAngle(x, y, z); } public float GammaToLinearSpace(float x) { return Mathf.GammaToLinearSpace(x); } public float LinearToGammaSpace(float x) { return Mathf.LinearToGammaSpace(x); } } public ItemDef ItemDef; private static IEnumerable<ItemBase>? _items; public ScalingInfoIndexer ScalingInfos = new ScalingInfoIndexer(); public VoidPairing? voidPairing; protected string SimpleDescriptionToken; private static List<string> _alreadyPlural = new List<string> { "400 Tickets", "Balls", "Gummy Vitamins", "Booster Boots", "Life Savings", "Predatory Instincts", "Fueling Bellows", "Sharpened Chopsticks", "Hardlight Shields", "Steroids", "Charging Nanobots", "Experimental Jets", "Prototype Jet Boots", "Low Quality Speakers", "Stargazer's Records", "Baby's Toys", "Defensive Microbots", "Death's Regards", "Spare Drone Parts", "Brainstalks", "Sorcerer's Pills", "Shifted Quartz", "Clasping Claws", "Enhancement Vials", "<style=cIsVoid>Corrupts all Shatterspleens.</style>", "Orbs of Falsity", "Visions of Heresy", "Hooks of Heresy", "Strides of Heresy", "Essence of Heresy", "Beads of Fealty", "Prescriptions" }; private static Dictionary<string, string> rules = new Dictionary<string, string> { { "rounds$", "rounds" }, { "tooth$", "teeth" }, { "fungus$", "fungi" }, { "(a|e|i|o|u)o$", "$1os" }, { "o$", "oes" }, { "(a|e|i|o|u)y$", "$1ys" }, { "y$", "ies" }, { "ff$", "s" }, { "fe?$", "ves" }, { "es$", "es" }, { "(ch|sh|x|z|s)$", "$1es" }, { "s?$", "s" } }; private static Regex formatArgParams = new Regex("({\\d:?.*?})+", RegexOptions.Compiled); public static IEnumerable<ItemBase> Items => _items ?? (_items = SharedBase.Instances.OfType<ItemBase>()); public override bool RequiresSotv => voidPairing != null; protected override void MakeConfigs() { string name = GetType().Name; Enabled = sharedInfo.ConfigFile.Bind<bool>("Disable Items", name, true, "Should this item be enabled."); List<Pair> pairs = new List<Pair>(); FillVoidConversions(pairs); } protected void AddScalingFunction(string defaultValue, string name, string? desc = null, string? oldDefault = null) { ScalingInfos.Add(new ScalingInfo(sharedInfo.ConfigFile, defaultValue, name, new StackFrame(1).GetMethod().DeclaringType, desc, oldDefault)); } public static string GetPlural(string str) { if (_alreadyPlural.Contains(str)) { return str; } if (str == "Silence Between Two Strikes") { return "Silences Between Two Strikes"; } Match match = Regex.Match(str, "(.+) of (.+)", RegexOptions.IgnoreCase); if (match.Success) { return GetPlural(match.Groups[1].Value) + " of " + match.Groups[2].Value; } match = Regex.Match(str, "^the (.+)", RegexOptions.IgnoreCase); if (match.Success) { return GetPlural(match.Groups[1].Value); } foreach (string key in rules.Keys) { if (Regex.Match(str, key, RegexOptions.IgnoreCase).Success) { return Regex.Replace(str, key, rules[key], RegexOptions.IgnoreCase); } } return str; } public override string GetFormattedDescription(Inventory? inventory, string? token = null, bool forceHideExtended = false) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) Inventory inventory2 = inventory; if (ScalingInfos.Count <= 0) { return Language.GetString(ItemDef.descriptionToken); } object[] array = ScalingInfos.Select(delegate(ScalingInfo info) { Inventory obj = inventory2; return info.ScalingFunction((obj != null) ? new int?(obj.GetItemCount(ItemDef)) : null); }).Cast<object>().ToArray(); string text = ""; if (voidPairing != null) { if (!voidPairing.IsDefault) { text = Language.GetStringFormatted("BUB_DEFAULT_CONVERT", new object[1] { string.Join(", ", voidPairing.ItemDefs.Select(delegate(ItemDef x) { string text3 = Language.GetString(x.nameToken); if (Language.currentLanguage == Language.english) { text3 = GetPlural(text3); } return text3; })) }); text = text.Style((ItemDef.tier == BubbetsItemsPlugin.VoidLunarTier.tier) ? StyleEnum.VoidLunar : StyleEnum.Void); } else { text = Language.GetString(ItemDef.nameToken.Sub(0, -"_NAME".Length) + "_CONVERT"); } } if (sharedInfo.UseSimpleDescIfApplicable.Value && ScalingInfos.All((ScalingInfo x) => x.IsDefault) && !string.IsNullOrEmpty(SimpleDescriptionToken)) { string @string = Language.GetString(sharedInfo.TokenPrefix + SimpleDescriptionToken); if (sharedInfo.ItemStatsInSimpleDesc.Value && !forceHideExtended) { List<string> list = new List<string>(); @string += text; @string += "\n"; foreach (Match item in formatArgParams.Matches(Language.GetString(token ?? ItemDef.descriptionToken))) { string value = item.Value; if (!string.IsNullOrEmpty(value)) { list.Add(value); } } list = list.OrderBy((string x) => x[1]).ToList(); foreach (string item2 in list) { if (int.TryParse(item2[1].ToString(), out var result)) { @string = @string + "\n" + ScalingInfos[result]._name + ": " + item2; } } return string.Format(@string, array); } return @string + text; } string text2 = Language.GetStringFormatted(token ?? ItemDef.descriptionToken, array) + text; if (sharedInfo.ExpandedTooltips.Value && !forceHideExtended) { text2 = text2 + "\n\nTooltip updates automatically with these fully configurable Scaling Functions:\n" + string.Join("\n", ScalingInfos.Select((ScalingInfo info) => info.ToString())); } return text2; } public override void MakeInLobbyConfig(Dictionary<ConfigCategoriesEnum, List<object>> scalingFunctions) { base.MakeInLobbyConfig(scalingFunctions); foreach (ScalingInfo scalingInfo in ScalingInfos) { scalingInfo.MakeInLobbyConfig(scalingFunctions[ConfigCategoriesEnum.BalancingFunctions]); } } public override void MakeRiskOfOptions() { base.MakeRiskOfOptions(); foreach (ScalingInfo scalingInfo in ScalingInfos) { scalingInfo.MakeRiskOfOptions(); } } protected override void FillDefsFromSerializableCP(SerializableContentPack serializableContentPack) { base.FillDefsFromSerializableCP(serializableContentPack); string name = GetType().Name; ItemDef[] itemDefs = serializableContentPack.itemDefs; foreach (ItemDef val in itemDefs) { if (SharedBase.MatchName(((Object)val).name, name)) { ItemDef = val; } } if ((Object)(object)ItemDef == (Object)null) { ManualLogSource logger = sharedInfo.Logger; if (logger != null) { logger.LogWarning((object)$"Could not find ItemDef for item {this} in serializableContentPack, class/itemdef name are probably mismatched. This will throw an exception later."); } } } public override void AddDisplayRules(VanillaIDRS which, ItemDisplayRule[] displayRules) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which); KeyAssetRuleGroup[] array = ruleSet?.keyAssetRuleGroups; if (array != null) { array = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)array, new KeyAssetRuleGroup { displayRuleGroup = new DisplayRuleGroup { rules = displayRules }, keyAsset = (Object)(object)ItemDef }).ToArray(); ruleSet.keyAssetRuleGroups = array; } } public override void AddDisplayRules(ModdedIDRS which, ItemDisplayRule[] displayRules) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) ItemDisplayRuleSet ruleSet = IDRHelper.GetRuleSet(which); KeyAssetRuleGroup[] array = ruleSet?.keyAssetRuleGroups; if (array != null) { array = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)array, new KeyAssetRuleGroup { displayRuleGroup = new DisplayRuleGroup { rules = displayRules }, keyAsset = (Object)(object)ItemDef }).ToArray(); ruleSet.keyAssetRuleGroups = array; } } protected override void FillDefsFromContentPack() { //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) foreach (ContentPack contentPack in SharedBase.ContentPacks) { if ((Object)(object)ItemDef != (Object)null) { break; } string name = GetType().Name; AssetEnumerator<ItemDef> enumerator2 = contentPack.itemDefs.GetEnumerator(); try { while (enumerator2.MoveNext()) { ItemDef current2 = enumerator2.Current; if (SharedBase.MatchName(((Object)current2).name, name)) { ItemDef = current2; } } } finally { ((IDisposable)enumerator2).Dispose(); } } if ((Object)(object)ItemDef == (Object)null) { ManualLogSource logger = sharedInfo.Logger; if (logger != null) { logger.LogWarning((object)$"Could not find ItemDef for item {this}, class/itemdef name are probably mismatched. This will throw an exception later."); } } } protected override void FillPickupIndex() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) try { PickupIndex key = (PickupIndex = PickupCatalog.FindPickupIndex(ItemDef.itemIndex)); SharedBase.PickupIndexes.Add(key, this); } catch (NullReferenceException ex) { ManualLogSource logger = sharedInfo.Logger; if (logger != null) { logger.LogError((object)("Equipment " + GetType().Name + " threw a NRE when filling pickup indexes, this could mean its not defined in your content pack:\n" + ex)); } } } protected override void FillRequiredExpansions() { if (RequiresSotv) { ItemDef.requiredExpansion = (Object.op_Implicit((Object)(object)sharedInfo.SotVExpansion) ? sharedInfo.SotVExpansion : SharedBase.SotvExpansion); } else { ItemDef.requiredExpansion = sharedInfo.Expansion; } } [HarmonyPrefix] [HarmonyPatch(typeof(ContagiousItemManager), "Init")] public static void FillVoidItems() { List<Pair> list = new List<Pair>(); bool flag = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); foreach (ItemBase item in Items) { item.voidPairing?.PostItemCatalog(); if (flag) { item.voidPairing?.MakeRiskOfOptions(); } } ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = CollectionExtensions.AddRangeToArray<Pair>(ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem], list.ToArray()); } protected virtual void FillVoidConversions(List<Pair> pairs) { } public static void CheatForAllItems() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) foreach (ItemBase item in Items) { item.CheatForItem(Random.onUnitSphere); } } public void AddVoidPairing(string defaultValue, string? oldDefault = null) { voidPairing = new VoidPairing(defaultValue, this, oldDefault); } } public abstract class SharedBase { public class SharedInfo { public ConfigEntry<bool> ExpandedTooltips; public ConfigEntry<bool> DescInPickup; public ConfigEntry<bool> ForceHideScalingInfoInPickup; public ConfigEntry<bool> UseSimpleDescIfApplicable; public ConfigEntry<bool> ItemStatsInSimpleDesc; public ConfigFile ConfigFile; public Harmony? Harmony; public readonly ManualLogSource Logger; public readonly string TokenPrefix; private bool _riskOfOptionsMade; public ExpansionDef? Expansion; public ExpansionDef? SotVExpansion; public List<SharedBase> Instances = new List<SharedBase>(); private bool _zioRiskOfOptionsMade; public SharedInfo(ManualLogSource manualLogSource, ConfigFile configFile, Harmony? harmony, string tokenPrefix) { Logger = manualLogSource; ConfigFile = configFile; Harmony = harmony; TokenPrefix = tokenPrefix; } public void MakeRiskOfOptions() { if (!_riskOfOptionsMade) { _riskOfOptionsMade = true; } } public void MakeZioOptions(ConfigFile configFile) { ExpandedTooltips = configFile.Bind(ConfigCategoriesEnum.General, "Expanded Tooltips", defaultValue: true, "Enables the scaling function in the tooltip.", oldDefault: false, networked: false); DescInPickup = configFile.Bind(ConfigCategoriesEnum.General, "Description In Pickup", defaultValue: true, "Used the description in the pickup for my items.", oldDefault: false, networked: false); ForceHideScalingInfoInPickup = configFile.Bind(ConfigCategoriesEnum.General, "Disable Scaling Info In Pickup", defaultValue: true, "Should the scaling infos be hidden from pickups.", oldDefault: false, networked: false); UseSimpleDescIfApplicable = configFile.Bind(ConfigCategoriesEnum.General, "Use Simple Descriptions If Applicable", defaultValue: true, "Should the description be closer to vanilla if you haven't changed the scaling function.", oldDefault: false, networked: false); ItemStatsInSimpleDesc = configFile.Bind(ConfigCategoriesEnum.General, "Show Item Stats For Simple Desc", defaultValue: true, "Display the solved value under the simple description.", oldDefault: false, networked: false); foreach (SharedBase instance in Instances) { instance.MakeZioOptions(); } if (Chainloader.PluginInfos.ContainsKey("bubbet.zioriskofoptions")) { MakeZioRiskOfOptions(); } } public void MakeZioRiskOfOptions() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if (_zioRiskOfOptionsMade) { return; } _zioRiskOfOptionsMade = true; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ExpandedTooltips)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DescInPickup)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ForceHideScalingInfoInPickup)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UseSimpleDescIfApplicable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ItemStatsInSimpleDesc)); foreach (SharedBase instance in Instances) { instance.MakeZioRiskOfOptions(); } } } public static readonly MethodInfo? MemberwiseCloneRef = typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic); public ConfigEntry<bool>? Enabled; public static readonly List<SharedBase> Instances = new List<SharedBase>(); public static readonly Dictionary<PickupIndex, SharedBase> PickupIndexes = new Dictionary<PickupIndex, SharedBase>(); private static readonly Dictionary<Type, SharedBase> InstanceDict = new Dictionary<Type, SharedBase>(); private static List<SharedInfo> SharedInfos = new List<SharedInfo>(); public PickupIndex PickupIndex; protected PatchClassProcessor? PatchProcessor; protected static readonly List<ContentPack> ContentPacks = new List<ContentPack>(); public SharedInfo sharedInfo; private static ExpansionDef? _sotvExpansion; public static ExpansionDef? SotvExpansion => _sotvExpansion ?? (_sotvExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion()); public virtual bool RequiresSotv => false; protected virtual void MakeConfigs() { } protected virtual void MakeTokens() { } protected virtual void MakeBehaviours() { } protected virtual void DestroyBehaviours() { } public virtual void MakeInLobbyConfig(Dictionary<ConfigCategoriesEnum, List<object>> dict) { } public virtual void MakeRiskOfOptions() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown sharedInfo.MakeRiskOfOptions(); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(Enabled, true)); } public virtual string GetFormattedDescription(Inventory? inventory = null, string? token = null, bool forceHideExtended = false) { return "Not Implemented"; } public static void Initialize(ManualLogSource manualLogSource, ConfigFile configFile, out SharedInfo info, SerializableContentPack? serializableContentPack = null, Harmony? harmony = null, string tokenPrefix = "") { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown SharedInfo sharedInfo = (info = new SharedInfo(manualLogSource, configFile, harmony, tokenPrefix)); SharedInfos.Add(sharedInfo); Type[] types = Assembly.GetCallingAssembly().GetTypes(); foreach (Type type in types) { if (!typeof(SharedBase).IsAssignableFrom(type) || type.IsAbstract) { continue; } if (!(Activator.CreateInstance(type) is SharedBase sharedBase)) { manualLogSource.LogError((object)$"Failed to make instance of {type}"); continue; } sharedBase.sharedInfo = sharedInfo; sharedBase.MakeConfigs(); ConfigEntry<bool>? enabled = sharedBase.Enabled; if (enabled != null && !enabled.Value) { continue; } sharedBase.MakeBehaviours(); if (harmony != null) { sharedBase.PatchProcessor = new PatchClassProcessor(harmony, sharedBase.GetType()); try { sharedBase.PatchProcessor.Patch(); } catch (Exception ex) { sharedInfo.Logger.LogError((object)ex); } } sharedInfo.Instances.Add(sharedBase); Instances.Add(sharedBase); InstanceDict[type] = sharedBase; if (Object.op_Implicit((Object)(object)serializableContentPack)) { sharedBase.FillDefsFromSerializableCP(serializableContentPack); } } if (!Object.op_Implicit((Object)(object)serializableContentPack)) { return; } serializableContentPack.itemDefs = serializableContentPack.itemDefs.Where((ItemDef x) => ItemBase.Items.Any((ItemBase y) => MatchName(((Object)x).name, y.GetType().Name))).ToArray(); IEnumerable<EquipmentDef> second = serializableContentPack.eliteDefs.Select((EliteDef x) => x.eliteEquipmentDef); serializableContentPack.equipmentDefs = serializableContentPack.equipmentDefs.Where((EquipmentDef x) => EquipmentBase.Equipments.Any((EquipmentBase y) => x != null && MatchName(((Object)x).name, y.GetType().Name))).Union(second).ToArray(); } public static T? GetInstance<T>() where T : SharedBase { InstanceDict.TryGetValue(typeof(T), out SharedBase value); return value as T; } public static bool TryGetInstance<T>(out T instance) where T : SharedBase { SharedBase value; bool num = InstanceDict.TryGetValue(typeof(T), out value); instance = null; if (num) { instance = (T)value; } return num; } public static void ResetConfigs() { foreach (SharedInfo sharedInfo in SharedInfos) { sharedInfo.ConfigFile.Clear(); sharedInfo.ConfigFile.Save(); } foreach (SharedBase instance in Instances) { instance.MakeConfigs(); } } public static void InitializePickups() { foreach (SharedBase instance in Instances) { instance.FillDefsFromContentPack(); } foreach (SharedBase instance2 in Instances) { instance2.FillPickupIndex(); } } protected static bool MatchName(string scriptableObject, string sharedBase) { if (!scriptableObject.StartsWith(sharedBase) && !scriptableObject.StartsWith("ItemDef" + sharedBase)) { return scriptableObject.StartsWith("EquipmentDef" + sharedBase); } return true; } public static void AddContentPack(ContentPack contentPack) { if (!ContentPacks.Contains(contentPack)) { ContentPacks.Add(contentPack); } } ~SharedBase() { DestroyBehaviours(); } public void CheatForItem(Vector3? rotationUniform = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) CharacterMaster master = PlayerCharacterMasterController.instances[0].master; PickupDropletController.CreatePickupDroplet(PickupIndex, master.GetBody().corePosition + Vector3.up * 1.5f, (Vector3)(((??)rotationUniform) ?? (Vector3.one * 25f))); } public static void FillAllExpansionDefs() { foreach (SharedBase instance in Instances) { try { instance.FillRequiredExpansions(); } catch (Exception ex) { instance.sharedInfo.Logger.LogError((object)ex); } } } public static void FillIDRS() { } protected virtual void FillItemDisplayRules() { } public static void MakeAllTokens() { foreach (SharedBase instance in Instances) { try { ManualLogSource logger = instance.sharedInfo.Logger; if (logger != null) { logger.LogMessage((object)$"Making tokens for {instance}."); } instance.MakeTokens(); } catch (Exception ex) { ManualLogSource logger2 = instance.sharedInfo.Logger; if (logger2 != null) { logger2.LogError((object)ex); } } } } protected void AddToken(string key, string value) { Language.english.SetStringByToken(sharedInfo.TokenPrefix + key, value); } protected virtual void FillDefsFromSerializableCP(SerializableContentPack serializableContentPack) { } protected abstract void FillDefsFromContentPack(); protected abstract void FillPickupIndex(); protected abstract void FillRequiredExpansions(); public virtual void MakeZioOptions() { } public virtual void MakeZioRiskOfOptions() { } public abstract void AddDisplayRules(ModdedIDRS which, ItemDisplayRule[] displayRules); public abstract void AddDisplayRules(VanillaIDRS which, ItemDisplayRule[] displayRules); public virtual void AddDisplayRules(ModdedIDRS which, ItemDisplayRule displayRule) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((!Object.op_Implicit((Object)(object)((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab)) ? ((this as EquipmentBase)?.EquipmentDef as BubEquipmentDef)?.displayModelPrefab : ((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab); if (Object.op_Implicit((Object)(object)val)) { displayRule.followerPrefab = val; AddDisplayRules(which, (ItemDisplayRule[])(object)new ItemDisplayRule[1] { displayRule }); } } public virtual void AddDisplayRules(VanillaIDRS which, ItemDisplayRule displayRule) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((!Object.op_Implicit((Object)(object)((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab)) ? ((this as EquipmentBase)?.EquipmentDef as BubEquipmentDef)?.displayModelPrefab : ((this as ItemBase)?.ItemDef as BubItemDef)?.displayModelPrefab); if (Object.op_Implicit((Object)(object)val)) { displayRule.followerPrefab = val; AddDisplayRules(which, (ItemDisplayRule[])(object)new ItemDisplayRule[1] { displayRule }); } } } public class AmmoPickupOrb : GenericDamageOrb { public override void OnArrival() { ((Component)((Orb)this).target.healthComponent).GetComponent<SkillLocator>().ApplyAmmoPack(); } public override GameObject GetOrbEffect() { return BubbetsItemsPlugin.AssetBundle.LoadAsset<GameObject>("AmmoPickupOrb"); } } public class AmmoPickupOrbBehavior : MonoBehaviour { private TrailRenderer _trail; private float _localTime; private Vector3 _startPos; private Vector3 _initialVelocity; public Transform? TargetTransform { get; set; } public float TravelTime { get; set; } = 1f; private void Awake() { _trail = ((Component)this).GetComponent<TrailRenderer>(); } private void Start() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) _localTime = 0f; _startPos = ((Component)this).transform.position; _initialVelocity = Vector3.up * 4f + Random.insideUnitSphere * 1f; _trail.startWidth = 0.05f; } private void Update() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) _localTime += Time.deltaTime; if ((Object)(object)TargetTransform == (Object)null || !Object.op_Implicit((Object)(object)TargetTransform)) { EffectData effectData = ((Component)this).GetComponent<EffectComponent>().effectData; object targetTransform; if (effectData == null) { targetTransform = null; } else { GameObject obj = effectData.ResolveHurtBoxReference(); targetTransform = ((obj != null) ? obj.transform : null); } TargetTransform = (Transform?)targetTransform; if (effectData != null) { TravelTime = effectData.genericFloat; } if ((Object)(object)TargetTransform == (Object)null || !Object.op_Implicit((Object)(object)TargetTransform)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } } float num = Mathf.Clamp01(_localTime / TravelTime); ((Component)this).transform.position = CalculatePosition(_startPos, _initialVelocity, TargetTransform.position, num); if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private static Vector3 CalculatePosition(Vector3 startPos, Vector3 initialVelocity, Vector3 targetPos, float t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Vector3 val = startPos + initialVelocity * t; float num = t * t * t; return Vector3.LerpUnclamped(val, targetPos, num); } } public class BrokenClockHandBehaviour : MonoBehaviour { public Transform hourHand; public Transform minuteHand; private float _ratio = 2f; private float _nextMinuteY; private float _nextHourY; public void Update() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) _ratio += Time.deltaTime; if (_ratio > 1f) { _ratio = 0f; _nextHourY = Random.value * 2f - 1f; _nextMinuteY = Random.value * 2f - 1f; } Quaternion rotation = hourHand.rotation; _ = ((Quaternion)(ref rotation)).eulerAngles; rotation = minuteHand.rotation; _ = ((Quaternion)(ref rotation)).eulerAngles; hourHand.Rotate(0f, 0f, _nextHourY); minuteHand.Rotate(0f, 0f, _nextMinuteY); } } public class HourGlassWobble : MonoBehaviour { private Renderer _rend; private Vector3 _lastPos; private Vector3 _velocity; private Vector3 _lastRot; private Vector3 _angularVelocity; [FormerlySerializedAs("MaxWobble")] public float maxWobble = 0.03f; [FormerlySerializedAs("WobbleSpeed")] public float wobbleSpeed = 1f; [FormerlySerializedAs("Recovery")] public float recovery = 1f; private float _wobbleAmountX; private float _wobbleAmountZ; private float _wobbleAmountToAddX; private float _wobbleAmountToAddZ; private float _pulse; private float _time = 0.5f; private Material _material; private static readonly int WobbleX = Shader.PropertyToID("_WobbleX"); private static readonly int WobbleZ = Shader.PropertyToID("_WobbleZ"); private void Start() { _rend = ((Component)this).GetComponent<Renderer>(); _material = _rend.materials.First((Material x) => ((Object)x.shader).name.Contains("Pain")); _wobbleAmountX = 10f; } private void Update() { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) _time += Time.deltaTime; _wobbleAmountToAddX = Mathf.Lerp(_wobbleAmountToAddX, 0f, Time.deltaTime * recovery); _wobbleAmountToAddZ = Mathf.Lerp(_wobbleAmountToAddZ, 0f, Time.deltaTime * recovery); _pulse = MathF.PI * 2f * wobbleSpeed; _wobbleAmountX = _wobbleAmountToAddX * Mathf.Sin(_pulse * _time); _wobbleAmountZ = _wobbleAmountToAddZ * Mathf.Sin(_pulse * _time); _material.SetFloat(WobbleX, _wobbleAmountX); _material.SetFloat(WobbleZ, _wobbleAmountZ); Transform transform = ((Component)this).transform; Vector3 position = transform.position; _velocity = (_lastPos - position) / Time.deltaTime; Quaternion rotation = transform.rotation; _angularVelocity = ((Quaternion)(ref rotation)).eulerAngles - _lastRot; _wobbleAmountToAddX += Mathf.Clamp((_velocity.x + _angularVelocity.z * 0.2f) * maxWobble, 0f - maxWobble, maxWobble); _wobbleAmountToAddZ += Mathf.Clamp((_velocity.z + _angularVelocity.x * 0.2f) * maxWobble, 0f - maxWobble, maxWobble); _lastPos = position; _lastRot = ((Quaternion)(ref rotation)).eulerAngles; } } public class VoidSlugController : MonoBehaviour { private Animator _animator; private CharacterModel _characterModel; private bool _lastInDanger; private static readonly int InCombat = Animator.StringToHash("inCombat"); private void Start() { _animator = ((Component)this).GetComponent<Animator>(); _characterModel = ((Component)this).GetComponentInParent<CharacterModel>(); } private void FixedUpdate() { if (Object.op_Implicit((Object)(object)_characterModel) && Object.op_Implicit((Object)(object)_characterModel.body) && Object.op_Implicit((Object)(object)_animator)) { bool flag = !_characterModel.body.outOfDanger; if (flag && _lastInDanger) { _animator.SetBool(InCombat, true); } else if (!flag && _lastInDanger) { _animator.SetBool(InCombat, false); } _lastInDanger = flag; } } } [BepInPlugin("bubbet.bubbetsitems", "Bubbets Items", "1.8.15.24")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BubbetsItemsPlugin : BaseUnityPlugin { public static class Conf { public static ConfigEntry<bool> AmmoPickupAsOrbEnabled; public static ConfigEntry<bool> VoidCoinShareOnPickup; public static ConfigEntry<float> VoidCoinDropChanceStart; public static ConfigEntry<float> VoidCoinDropChanceMult; public static ConfigEntry<bool> VoidCoinBarrelDrop; public static ConfigEntry<bool> VoidCoinVoidFields; public static ConfigEntry<float> EffectVolume; internal static void Init(ConfigFile configFile) { AmmoPickupAsOrbEnabled = configFile.Bind(ConfigCategoriesEnum.DisableModParts, "Ammo Pickup As Orb", defaultValue: true, "Should the Ammo Pickup as an orb be enabled.", oldDefault: false); VoidCoinShareOnPickup = configFile.Bind(ConfigCategoriesEnum.General, "Share Void Coin On Pickup", defaultValue: false, "Should void coins share on pickup.", oldDefault: false); VoidCoinDropChanceStart = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop Chance", 10f, "Not used if using Released from the void. Starting drop chance of void coins from void guys.", 0f); VoidCoinDropChanceMult = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop Chance Mult", 0.5f, "Not used if using Released from the void. Drop chance multiplier to chance upon getting coin.", 0f); VoidCoinBarrelDrop = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop From Void Barrel", defaultValue: true, "Not used if using Released from the void. Should the void coin drop from barrels.", oldDefault: false); VoidCoinVoidFields = configFile.Bind(ConfigCategoriesEnum.General, "Void Coin Drop From Void Fields", defaultValue: true, "Should the void coin drop from void fields.", oldDefault: false); } internal static void InitZio(ConfigFile configFile) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) EffectVolume = configFile.Bind(ConfigCategoriesEnum.General, "Effect Volume", 50f, "Volume of the sound effects in my mod.", 0f, networked: false); EffectVolume.SettingChanged += delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) AkSoundEngine.SetRTPCValue("Volume_Effects", EffectVolume.Value); }; AkSoundEngine.SetRTPCValue("Volume_Effects", EffectVolume.Value); Instance._sharedInfo.MakeZioOptions(configFile); } internal static void MakeRiskOfOptions() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(VoidCoinShareOnPickup)); ModSettingsManager.AddOption((BaseOption)new SliderOption(VoidCoinDropChanceStart)); ModSettingsManager.AddOption((BaseOption)new SliderOption(VoidCoinDropChanceMult, new SliderConfig { min = 0f, max = 1f, formatString = "{0:0.##%}" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(VoidCoinBarrelDrop, true)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(VoidCoinVoidFields)); } internal static void MakeRiskOfOptionsZio() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(EffectVolume)); } } private class ContentPackProvider : IContentPackProvider { [CompilerGenerated] private static class <>O { public static CollectContentPackProvidersDelegate <0>__AddCustomContent; } private static ContentPack _contentPack; private static string _identifier; private static SharedBase.SharedInfo _info; public string identifier => _identifier; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(_contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); Log.LogInfo((object)"Contentpack finished"); _info.Expansion = BubExpansion; _info.SotVExpansion = BubSotvExpansion; yield break; } internal static void Initialize(string identifier, ContentPack pack, SharedBase.SharedInfo sharedInfo) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown _identifier = identifier; _contentPack = pack; _info = sharedInfo; object obj = <>O.<0>__AddCustomContent; if (obj == null) { CollectContentPackProvidersDelegate val = AddCustomContent; <>O.<0>__AddCustomContent = val; obj = (object)val; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; } private static void AddCustomContent(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentPackProvider()); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<ItemDef, bool> <>9__8_0; public static Func<ItemDef, PickupIndex> <>9__8_1; public static Func<ExpansionDef, bool> <>9__14_0; public static Func<ExpansionDef, bool> <>9__16_0; public static Action<List<string>> <>9__17_0; public static UnityAction <>9__20_0; public static UnityAction <>9__20_1; public static UnityAction <>9__20_2; internal bool <get_VoidLunarItems>b__8_0(ItemDef x) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return x.tier == VoidLunarTier.tier; } internal PickupIndex <get_VoidLunarItems>b__8_1(ItemDef x) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return PickupCatalog.FindPickupIndex(x.itemIndex); } internal bool <get_BubExpansion>b__14_0(ExpansionDef x) { return x.nameToken == "BUB_EXPANSION"; } internal bool <get_BubSotvExpansion>b__16_0(ExpansionDef x) { return x.nameToken == "BUB_EXPANSION_VOID"; } internal void <Awake>b__17_0(List<string> list) { string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Language"; if (File.Exists(text)) { list.Add(text); } } internal void <MakeRiskOfOptions>b__20_0() { Application.OpenURL("https://github.com/Bubbet/Risk-Of-Rain-Mods/issues/new"); } internal void <MakeRiskOfOptions>b__20_1() { Application.OpenURL("https://ko-fi.com/bubbet"); } internal void <MakeRiskOfOptions>b__20_2() { Application.OpenURL("https://ko-fi.com/snakeygemo/gallery"); } } private const string AssetBundleName = "MainAssetBundle"; public const string RecalcStatsGuid = "com.bepis.r2api.recalculatestats"; public static ContentPack ContentPack; public static AssetBundle AssetBundle; public const string Version = "1.8.15.24"; public static BubbetsItemsPlugin Instance; public static ManualLogSource Log; private static ExpansionDef? _bubExpansion; private static ExpansionDef? _bubSotvExpansion; private static uint _bankID; public static ItemTierDef VoidLunarTier; private static PickupIndex[]? _voidLunarItems; private SharedBase.SharedInfo _sharedInfo; public static bool RiskOfOptionsEnabled; public List<SharedBase> ForwardTest => SharedBase.Instances; public static PickupIndex[] VoidLunarItems => _voidLunarItems ?? (_voidLunarItems = (from x in (IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs where x.tier == VoidLunarTier.tier select PickupCatalog.FindPickupIndex(x.itemIndex)).ToArray()); public static ExpansionDef BubExpansion { get { if (_bubExpansion == null) { _bubExpansion = ((IEnumerable<ExpansionDef>)ContentPack.expansionDefs).First((ExpansionDef x) => x.nameToken == "BUB_EXPANSION"); _bubExpansion.disabledIconSprite = BubSotvExpansion.disabledIconSprite; } return _bubExpansion; } } public static ExpansionDef BubSotvExpansion { get { if (_bubSotvExpansion == null) { _bubSotvExpansion = ((IEnumerable<ExpansionDef>)ContentPack.expansionDefs).First((ExpansionDef x) => x.nameToken == "BUB_EXPANSION_VOID"); ExpansionDef val = LegacyResourcesAPI.Load<ExpansionDef>("ExpansionDefs/DLC1"); _bubSotvExpansion.requiredEntitlement = val.requiredEntitlement; _bubSotvExpansion.disabledIconSprite = val.disabledIconSprite; } return _bubSotvExpansion; } } public void Awake() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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) //IL_012a: Unknown result type (might be due to invalid IL or missing references) Conf.Init(((BaseUnityPlugin)this).Config); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { MakeRiskOfOptions(); } Instance = this; Log = ((BaseUnityPlugin)this).Logger; RoR2Application.isModded = true; Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); LoadContentPack(val); VoidLunarShopController.Init(); InLobbyConfigCompat.Init(); RiskOfOptionsCompat.Init(); new PatchClassProcessor(val, typeof(CommonBodyPatches)).Patch(); new PatchClassProcessor(val, typeof(HarmonyPatches)).Patch(); new PatchClassProcessor(val, typeof(PickupTooltipFormat)).Patch(); new PatchClassProcessor(val, typeof(LogBookPageScalingGraph)).Patch(); new PatchClassProcessor(val, typeof(ModdedDamageColors)).Patch(); new PatchClassProcessor(val, typeof(CustomItemTierDefs)).Patch(); new PatchClassProcessor(val, typeof(ColorCatalogPatches)).Patch(); if (!Chainloader.PluginInfos.ContainsKey("com.bepis.r2api.recalculatestats")) { Log.LogInfo((object)"R2Api RecalcStats not present, patching myself."); new PatchClassProcessor(val, typeof(RecalculateStatsAPI)).Patch(); } ColorCatalogPatches.AddNewColors(); new PatchClassProcessor(val, typeof(EquipmentBase)).Patch(); new PatchClassProcessor(val, typeof(ItemBase)).Patch(); new PatchClassProcessor(val, typeof(VoidLunarShopController)).Patch(); new PatchClassProcessor(val, typeof(ExtraHealthBarSegments)).Patch(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(onLoad)); Language.collectLanguageRootFolders += delegate(List<string> list) { string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Language"; if (File.Exists(text)) { list.Add(text); } }; ItemStatsCompat.Init(); } private void onLoad() { if (Chainloader.PluginInfos.ContainsKey("bubbet.zioconfigfile")) { ZioConfigSetup(); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { Conf.MakeRiskOfOptionsZio(); } } ConfigCategories.Init(); BubEventFunctions.Init(); } private void ZioConfigSetup() { Conf.InitZio(((BaseUnityPlugin)this).Config); } private void MakeRiskOfOptions() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown RiskOfOptionsEnabled = true; object obj = <>c.<>9__20_0; if (obj == null) { UnityAction val = delegate { Application.OpenURL("https://github.com/Bubbet/Risk-Of-Rain-Mods/issues/new"); }; <>c.<>9__20_0 = val; obj = (object)val; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Report An Issue", "General", "If you find a bug in the mod, reporting an issue is the best way to ensure it gets fixed.", "Open Link", (UnityAction)obj)); object obj2 = <>c.<>9__20_1; if (obj2 == null) { UnityAction val2 = delegate { Application.OpenURL("https://ko-fi.com/bubbet"); }; <>c.<>9__20_1 = val2; obj2 = (object)val2; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Donate to Bubbet", "General", "Donate to the programmer of bubbet's items.", "Open Link", (UnityAction)obj2)); object obj3 = <>c.<>9__20_2; if (obj3 == null) { UnityAction val3 = delegate { Application.OpenURL("https://ko-fi.com/snakeygemo/gallery"); }; <>c.<>9__20_2 = val3; obj3 = (object)val3; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Donate to GEMO", "General", "Donate to the modeller of bubbet's items.", "Open Link", (UnityAction)obj3)); Conf.MakeRiskOfOptions(); } public static void LoadSoundBank() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 if (Application.isBatchMode) { return; } try { AkSoundEngine.AddBasePath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); AKRESULT val = AkSoundEngine.LoadBank("BubbetsItems.bnk", ref _bankID); if ((int)val != 1) { Debug.LogError((object)("[Bubbets Items] SoundBank Load Failed: " + ((object)(AKRESULT)(ref val)).ToString())); } } catch (Exception ex) { Log.LogError((object)ex); } } public static void ExtraTokens() { Language.english.SetStringByToken("BUB_HOLD_TOOLTIP", "Hold Capslock for more."); Language.english.SetStringByToken("BUB_EXPANSION", "Bubbet's Content"); Language.english.SetStringByToken("BUB_EXPANSION_DESC", "Adds content from 'Bubbets Items' to the game."); Language.english.SetStringByToken("BUB_EXPANSION_VOID", "Bubbet's Void Content"); Language.english.SetStringByToken("BUB_EXPANSION_VOID_DESC", "Adds the void content from 'Bubbets Items' and requires 'Survivors of the Void'."); Language.english.SetStringByToken("BUB_DEFAULT_CONVERT", "Corrupts all {0}."); } private void LoadContentPack(Harmony harmony) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown AssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "MainAssetBundle")); BubsItemsContentPackProvider bubsItemsContentPackProvider = AssetBundle.LoadAsset<BubsItemsContentPackProvider>("MainContentPack"); CustomItemTierDefs.Init(bubsItemsContentPackProvider); List<SerializableEntityStateType> list = new List<SerializableEntityStateType>(); Type[] types = Assembly.GetCallingAssembly().GetTypes(); foreach (Type type in types) { if (typeof(EntityState).IsAssignableFrom(type)) { list.Add(new SerializableEntityStateType(type)); } } ((SerializableContentPack)bubsItemsContentPackProvider).entityStateTypes = list.ToArray(); SharedBase.Initialize(((BaseUnityPlugin)this).Logger, ((BaseUnityPlugin)this).Config, out _sharedInfo, (SerializableContentPack?)(object)bubsItemsContentPackProvider, harmony, "BUB_"); ContentPack = ((SerializableContentPack)bubsItemsContentPackProvider).CreateContentPack(); SharedBase.AddContentPack(ContentPack); ContentPackProvider.Initialize(((BaseUnityPlugin)this).Info.Metadata.GUID, ContentPack, _sharedInfo); if (Conf.AmmoPickupAsOrbEnabled.Value) { GameObject val = AssetBundle.LoadAsset<GameObject>("AmmoPickupOrb"); ContentPack.effectDefs.Add((EffectDef[])(object)new EffectDef[1] { new EffectDef(val) }); } } } public class BubPickupDisplayCustom : MonoBehaviour { private static GameObject _voidLunarSystem; private static GameObject _pickup; private PickupDisplay _display; private bool _set; public static void ModifyGenericPickup() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) _pickup = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/GenericPickup.prefab").WaitForCompletion(); ((Component)_pickup.transform.Find("PickupDisplay")).gameObject.AddComponent<BubPickupDisplayCustom>(); Transform obj = _pickup.transform.Find("VoidSystem"); Transform obj2 = obj.Find("Loops"); Transform val = _pickup.transform.Find("LunarSystem"); Transform obj3 = val.Find("Loops"); _voidLunarSystem = new GameObject("VoidLunarSystem"); _voidLunarSystem.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_voidLunarSystem); GameObject val2 = new GameObject("Loops"); val2.transform.SetParent(_voidLunarSystem.transform); MainModule main = Object.Instantiate<GameObject>(((Component)obj3.Find("Swirls")).gameObject, val2.transform).GetComponent<ParticleSystem>().main; ((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(ColorCatalogPatches.VoidLunarColor)); Object.Instantiate<GameObject>(((Component)obj2.Find("DistantSoftGlow")).gameObject, val2.transform); Object.Instantiate<GameObject>(((Component)obj2.Find("Glowies")).gameObject, val2.transform); Object.Instantiate<GameObject>(((Component)obj2.Find("Point Light")).gameObject, val2.transform).GetComponent<Light>().color = Color32.op_Implicit(ColorCatalogPatches.VoidLunarColor); ((Object)Object.Instantiate<GameObject>(((Component)val.Find("Burst")).gameObject, _voidLunarSystem.transform)).name = "LunarBurst"; ((Object)Object.Instantiate<GameObject>(((Component)obj.Find("Burst")).gameObject, _voidLunarSystem.transform)).name = "VoidBurst"; } private void Awake() { _display = ((Component)this).GetComponent<PickupDisplay>(); } public void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between I4 and Unknown PickupDef pickupDef = PickupCatalog.GetPickupDef(_display.pickupIndex); if (pickupDef != null && !_set) { _set = true; ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (((itemDef == null) ? 5 : ((int)itemDef.tier)) == (int)BubbetsItemsPlugin.VoidLunarTier.tier) { Object.Instantiate<GameObject>(_voidLunarSystem, ((Component)this).transform.parent).SetActive(true); } } } } [HarmonyPatch] public static class ColorCatalogPatches { public static FieldInfo? indexToColor32 = typeof(ColorCatalog).GetField("indexToColor32", BindingFlags.Static | BindingFlags.NonPublic); public static FieldInfo? indexToHexString = typeof(ColorCatalog).GetField("indexToHexString", BindingFlags.Static | BindingFlags.NonPublic); public static Color32 VoidLunarColor = new Color32((byte)134, (byte)0, (byte)203, byte.MaxValue); public static void AddNewColors() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) int num = ColorCatalog.indexToColor32.Length; BubbetsItemsPlugin.VoidLunarTier.colorIndex = (ColorIndex)num; BubbetsItemsPlugin.VoidLunarTier.darkColorIndex = (ColorIndex)(num + 1); Color32 val = default(Color32); ((Color32)(ref val))..ctor((byte)83, (byte)0, (byte)126, byte.MaxValue); indexToColor32?.SetValue(null, CollectionExtensions.AddItem<Color32>(CollectionExtensions.AddItem<Color32>((IEnumerable<Color32>)ColorCatalog.indexToColor32, VoidLunarColor), val).ToArray()); indexToHexString?.SetValue(null, CollectionExtensions.AddItem<string>(CollectionExtensions.AddItem<string>((IEnumerable<string>)ColorCatalog.indexToHexString, Util.RGBToHex(VoidLunarColor)), Util.RGBToHex(val)).ToArray()); } [HarmonyPrefix] [HarmonyPatch(typeof(ColorCatalog), "GetColor")] public static bool PatchGetColor(ColorIndex colorIndex, ref Color32 __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) int num = (int)colorIndex; if (num >= ColorCatalog.indexToColor32.Length) { return true; } __result = ColorCatalog.indexToColor32[num]; return false; } [HarmonyPrefix] [HarmonyPatch(typeof(ColorCatalog), "GetColorHexString")] public static bool GetColorHexString(ColorIndex colorIndex, ref string __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown int num = (int)colorIndex; if (num >= ColorCatalog.indexToHexString.Length) { return true; } __result = ColorCatalog.indexToHexString[num]; return false; } } [HarmonyPatch] public static class CustomItemTierDefs { public delegate void RefAction(ref object obj); public static List<ItemTierDef> recyclerTiers = new List<ItemTierDef>(); public static List<ItemTierDef> voidTiers = new List<ItemTierDef>(); [HarmonyILManipulator] [HarmonyPatch(typeof(PickupTransmutationManager), "RebuildPickupGroups")] public static void RebuildCustomTierRecycler(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodReference val2 = default(MethodReference); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchStsfld(x, typeof(PickupTransmutationManager), "pickupGroups") }); val.Emit(OpCodes.Dup); val.EmitDelegate<Action<List<PickupIndex[]>>>((Action<List<PickupIndex[]>>)delegate(List<PickupIndex[]> groups) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) foreach (ItemTierDef recyclerTier in recyclerTiers) { AddItemTierGroup(recyclerTier.tier, ref groups); } }); } [HarmonyPostfix] [HarmonyPatch(typeof(VoidSurvivorController), "OnInventoryChanged")] public static void AddExtraTiersToVoidSurvivor(VoidSurvivorController __instance) { Inventory inv = __instance.characterBody.inventory; if (Object.op_Implicit((Object)(object)inv)) { __instance.voidItemCount += voidTiers.Sum((ItemTierDef x) => inv.GetTotalItemCountOfTier(x.tier)); } } public static PickupIndex[] AddItemTierGroup(ItemTier tier, ref List<PickupIndex[]> groups) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: