Decompiled source of Frost and Gunfire v1.0.5007
plugins/FrostAndGunfireItems.dll
Decompiled a month 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.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using Alexandria.CharacterAPI; using BepInEx; using Brave.BulletScript; using Dungeonator; using FrostAndGunfireItems; using FullSerializer; using Gungeon; using GungeonAPI; using InControl; using Ionic.Zip; using ItemAPI; using MonoMod.RuntimeDetour; using Pathfinding; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MiscellaneousItems")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MiscellaneousItems")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c3b4bc0d-4cc2-4e20-abdc-d76def15072d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")] public class PlantCompanionItem : PlayerItem { [EnemyIdentifier] public string CompanionGuid; public string CompanionGuid1; public string CompanionGuid2; public IntVector2 CustomClearance; public Vector2 CustomOffset; public bool IsTimed; public float Lifespan; public string IntroDirectionalAnimation; public string OutroDirectionalAnimation; public GameObject DepartureVFXPrefab; private GameObject m_extantCompanion; private GameObject m_extantSecondCompanion; public static void Init() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) string name = "Germinate"; string resourcePath = "FrostAndGunfireItems/Resources/capsule"; GameObject val = new GameObject(); PlantCompanionItem plantCompanionItem = val.AddComponent<PlantCompanionItem>(); ItemBuilder.AddSpriteToObject(name, resourcePath, val, v: true); string shortDesc = "Go!"; string longDesc = "An ancient device to used capture creatures. Previously owned by the famed monster tamer, Brash Ketchup, this capsule contains some rare creatures from the Gungeon that will happily fight for you."; ((PickupObject)(object)plantCompanionItem).SetupItem(shortDesc, longDesc, "kp"); ((PickupObject)plantCompanionItem).quality = (ItemQuality)(-100); plantCompanionItem.CompanionGuid = Spike.guid; ((PlayerItem)(object)plantCompanionItem).SetCooldownType(ItemBuilder.CooldownType.Timed, 1f); } private void CreateCompanion(PlayerController owner) { //IL_000d: 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_0018: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0080: 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_008a: 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) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(CompanionGuid); IntVector2 value = IntVector2.Max(CustomClearance, orLoadByGuid.Clearance); ((BraveBehaviour)orLoadByGuid).aiShooter.equippedGunId = ((PickupObject)((GameActor)owner).CurrentGun).PickupObjectId; owner.inventory.DestroyCurrentGun(); IntVector2? nearestAvailableCell = owner.CurrentRoom.GetNearestAvailableCell(Vector3Extensions.XY(((BraveBehaviour)owner).transform.position), (IntVector2?)value, (CellTypes?)(CellTypes)2, false, (CellValidator)null); if (nearestAvailableCell.HasValue) { GameObject gameObject = ((Component)orLoadByGuid).gameObject; IntVector2 value2 = nearestAvailableCell.Value; GameObject extantCompanion = Object.Instantiate<GameObject>(gameObject, Vector2Extensions.ToVector3ZUp(((IntVector2)(ref value2)).ToVector2() + CustomOffset, 0f), Quaternion.identity); m_extantCompanion = extantCompanion; CompanionController orAddComponent = GameObjectExtensions.GetOrAddComponent<CompanionController>(m_extantCompanion); orAddComponent.Initialize(owner); } } protected override void DoEffect(PlayerController user) { CreateCompanion(user); } public override bool CanBeUsed(PlayerController user) { if ((Object)(object)((GameActor)user).CurrentGun != (Object)null && ((PickupObject)((GameActor)user).CurrentGun).CanActuallyBeDropped(user) && !((GameActor)user).CurrentGun.InfiniteAmmo) { return (Object)(object)((Component)user).GetComponent<BasicBeamController>() == (Object)null; } return false; } protected override void OnPreDrop(PlayerController user) { ((PlayerItem)this).OnPreDrop(user); } protected override void OnDestroy() { ((PlayerItem)this).OnDestroy(); } } public class EnemyGuidDatabase { public static Dictionary<string, string> Entries { get; set; } = new Dictionary<string, string> { { "bullet_kin", "01972dee89fc4404a5c408d50007dad5" }, { "ak47_bullet_kin", "db35531e66ce41cbb81d507a34366dfe" }, { "bandana_bullet_kin", "88b6b6a93d4b4234a67844ef4728382c" }, { "veteran_bullet_kin", "70216cae6c1346309d86d4a0b4603045" }, { "treadnaughts_bullet_kin", "df7fb62405dc4697b7721862c7b6b3cd" }, { "minelet", "3cadf10c489b461f9fb8814abc1a09c1" }, { "cardinal", "8bb5578fba374e8aae8e10b754e61d62" }, { "shroomer", "e5cffcfabfae489da61062ea20539887" }, { "ashen_bullet_kin", "1a78cfb776f54641b832e92c44021cf2" }, { "mutant_bullet_kin", "d4a9836f8ab14f3fadd0f597438b1f1f" }, { "fallen_bullet_kin", "5f3abc2d561b4b9c9e72b879c6f10c7e" }, { "hooded_bullet", "844657ad68894a4facb1b8e1aef1abf9" }, { "office_bullet_kin", "906d71ccc1934c02a6f4ff2e9c07c9ec" }, { "office_bullette_kin", "9eba44a0ea6c4ea386ff02286dd0e6bd" }, { "brollet", "05cb719e0178478685dc610f8b3e8bfc" }, { "western_bullet_kin", "5861e5a077244905a8c25c2b7b4d6ebb" }, { "pirate_bullet_kin", "6f818f482a5c47fd8f38cce101f6566c" }, { "armored_bullet_kin", "39e6f47a16ab4c86bec4b12984aece4c" }, { "key_bullet_kin", "699cd24270af4cd183d671090d8323a1" }, { "chance_bullet_kin", "a446c626b56d4166915a4e29869737fd" }, { "hollowpoint", "4db03291a12144d69fe940d5a01de376" }, { "spectre", "56f5a0f2c1fc4bc78875aea617ee31ac" }, { "skullet", "336190e29e8a4f75ab7486595b700d4a" }, { "skullmet", "95ec774b5a75467a9ab05fa230c0c143" }, { "gummy", "5288e86d20184fa69c91ceb642d31474" }, { "spent", "249db525a9464e5282d02162c88e0357" }, { "gummy_spent", "e21ac9492110493baef6df02a2682a0d" }, { "red_shotgun_kin", "128db2f0781141bcb505d8f00f9e4d47" }, { "blue_shotgun_kin", "b54d89f9e802455cbb2b8a96a31e8259" }, { "veteran_shotgun_kin", "2752019b770f473193b08b4005dc781f" }, { "mutant_shotgun_kin", "7f665bd7151347e298e4d366f8818284" }, { "executioner", "b1770e0f1c744d9d887cc16122882b4f" }, { "ashen_shotgun_kin", "1bd8e49f93614e76b140077ff2e33f2b" }, { "shotgrub", "044a9f39712f456597b9762893fbc19c" }, { "creech", "37340393f97f41b2822bc02d14654172" }, { "western_shotgun_kin", "ddf12a4881eb43cfba04f36dd6377abb" }, { "pirate_shotgun_kin", "86dfc13486ee4f559189de53cfb84107" }, { "blobulon", "0239c0680f9f467dbe5c4aab7dd1eca6" }, { "blobuloid", "042edb1dfb614dc385d5ad1b010f2ee3" }, { "blobulin", "42be66373a3d4d89b91a35c9ff8adfec" }, { "poisbulon", "e61cab252cfb435db9172adc96ded75f" }, { "poisbuloid", "fe3fe59d867347839824d5d9ae87f244" }, { "poisbulin", "b8103805af174924b578c98e95313074" }, { "blizzbulon", "022d7c822bc146b58fe3b0287568aaa2" }, { "leadbulon", "ccf6d241dad64d989cbcaca2a8477f01" }, { "bloodbulon", "062b9b64371e46e195de17b6f10e47c8" }, { "poopulon", "116d09c26e624bca8cca09fc69c714b3" }, { "cubulon", "864ea5a6a9324efc95a0dd2407f42810" }, { "cubulead", "0b547ac6b6fc4d68876a241a88f5ca6a" }, { "chancebulon", "1bc2a07ef87741be90c37096910843ab" }, { "skusket", "af84951206324e349e1f13f9b7b60c1a" }, { "black_skusket", "1cec0cdf383e42b19920787798353e46" }, { "skusket_head", "c2f902b7cbe745efb3db4399927eab34" }, { "shelleton", "21dd14e5ca2a4a388adab5b11b69a1e1" }, { "revolvenant", "d5a7b95774cd41f080e517bea07bf495" }, { "gunreaper", "88f037c3f93b4362a040a87b30770407" }, { "bullat", "2feb50a6a40f4f50982e89fd276f6f15" }, { "shotgat", "2d4f8b5404614e7d8b235006acde427a" }, { "grenat", "b4666cb6ef4f4b038ba8924fd8adf38f" }, { "spirat", "7ec3e8146f634c559a7d58b19191cd43" }, { "king_bullat", "1a4872dafdb34fd29fe8ac90bd2cea67" }, { "gargoyle", "981d358ffc69419bac918ca1bdf0c7f7" }, { "apprentice_gunjurer", "206405acad4d4c33aac6717d184dc8d4" }, { "gunjurer", "c4fba8def15e47b297865b18e36cbef8" }, { "high_gunjurer", "9b2cf2949a894599917d4d391a0b7394" }, { "lore_gunjurer", "56fb939a434140308b8f257f0f447829" }, { "bookllet", "c0ff3744760c4a2eb0bb52ac162056e6" }, { "blue_bookllet", "6f22935656c54ccfb89fca30ad663a64" }, { "green_bookllet", "a400523e535f41ac80a43ff6b06dc0bf" }, { "necronomicon", "216fd3dfb9da439d9bd7ba53e1c76462" }, { "tablet_bookllett", "78e0951b097b46d89356f004dda27c42" }, { "mountain_cube", "f155fd2759764f4a9217db29dd21b7eb" }, { "lead_cube", "33b212b856b74ff09252bf4f2e8b8c57" }, { "flesh_cube", "3f2026dc3712490289c4658a2ba4a24b" }, { "brown_chest_mimic", "2ebf8ef6728648089babb507dec4edb7" }, { "blue_chest_mimic", "d8d651e3484f471ba8a2daa4bf535ce6" }, { "green_chest_mimic", "abfb454340294a0992f4173d6e5898a8" }, { "red_chest_mimic", "d8fd592b184b4ac9a3be217bc70912a2" }, { "black_chest_mimic", "6450d20137994881aff0ddd13e3d40c8" }, { "rat_chest_mimic", "ac9d345575444c9a8d11b799e8719be0" }, { "pedestal_mimic", "796a7ed4ad804984859088fc91672c7f" }, { "wall_mimic", "479556d05c7c44f3b6abb3b2067fc778" }, { "gun_nut", "ec8ea75b557d4e7b8ceeaacdf6f8238c" }, { "chain_gunner", "463d16121f884984abe759de38418e48" }, { "spectral_gun_nut", "383175a55879441d90933b5c4e60cf6f" }, { "det", "ac986dabc5a24adab11d48a4bccf4cb1" }, { "x_det", "48d74b9c65f44b888a94f9e093554977" }, { "diagonal_x_det", "c5a0fd2774b64287bf11127ca59dd8b4" }, { "vertical_det", "b67ffe82c66742d1985e5888fd8e6a03" }, { "diagonal_det", "d9632631a18849539333a92332895ebd" }, { "horizontal_det", "1898f6fe1ee0408e886aaf05c23cc216" }, { "vertical_x_det", "abd816b0bcbf4035b95837ca931169df" }, { "horizontal_x_det", "07d06d2b23cc48fe9f95454c839cb361" }, { "gunsinger", "cf2b7021eac44e3f95af07db9a7c442c" }, { "aged_gunsinger", "c50a862d19fc4d30baeba54795e8cb93" }, { "ammomancer", "b1540990a4f1480bbcb3bea70d67f60d" }, { "jammomancer", "8b4a938cdbc64e64822e841e482ba3d2" }, { "jamerlengo", "ba657723b2904aa79f9e51bce7d23872" }, { "gun_cultist", "57255ed50ee24794b7aac1ac3cfb8a95" }, { "gat", "9b4fb8a2a60a457f90dcf285d34143ac" }, { "grey_cylinder", "d4f4405e0ff34ab483966fd177f2ece3" }, { "red_cylinder", "534f1159e7cf4f6aa00aeea92459065e" }, { "bullet_mech", "2b6854c0849b4b8fb98eb15519d7db1c" }, { "grenade_kin", "4d37ce3d666b4ddda8039929225b7ede" }, { "dynamite_kin", "c0260c286c8d4538a697c5bf24976ccf" }, { "bombshee", "19b420dec96d4e9ea4aebc3398c0ba7a" }, { "m80_kin", "5f15093e6f684f4fb09d3e7e697216b4" }, { "rubber_kin", "6b7ef9e5d05b4f96b04f05ef4a0d1b18" }, { "tazie", "98fdf153a4dd4d51bf0bafe43f3c77ff" }, { "sniper_shell", "31a3ea0c54a745e182e22ea54844a82d" }, { "professional", "c5b11bfc065d417b9c4d03a5e385fe2c" }, { "muzzle_wisp", "ffdc8680bdaa487f8f31995539f74265" }, { "muzzle_flare", "d8a445ea4d944cc1b55a40f22821ae69" }, { "wizbang", "43426a2e39584871b287ac31df04b544" }, { "coaler", "9d50684ce2c044e880878e86dbada919" }, { "fungun", "f905765488874846b7ff257ff81d6d0c" }, { "bullet_shark", "72d2f44431da43b8a3bae7d8a114a46d" }, { "arrow_head", "05891b158cd542b1a5f3df30fb67a7ff" }, { "pot_fairy", "c182a5cb704d460d9d099a47af49c913" }, { "musketball", "226fd90be3a64958a5b13cb0a4f43e97" }, { "western_cactus", "3b0bd258b4c9432db3339665cc61c356" }, { "candle_kin", "37de0df92697431baa47894a075ba7e9" }, { "gigi", "ed37fa13e0fa4fcf8239643957c51293" }, { "misfire_beast", "45192ff6d6cb43ed8f1a874ab6bef316" }, { "phaser_spider", "98ca70157c364750a60f5e0084f9d3e2" }, { "gunzookie", "6e972cd3b11e4b429b888b488e308551" }, { "gunzockie", "8a9e9bedac014a829a48735da6daf3da" }, { "chameleon", "80ab6cd15bfc46668a8844b2975c6c26" }, { "bird_parrot", "4b21a913e8c54056bc05cafecf9da880" }, { "western_snake", "e861e59012954ab2b9b6977da85cb83c" }, { "kalibullet", "ff4f54ce606e4604bf8d467c1279be3e" }, { "kbullet", "f020570a42164e2699dcf57cac8a495c" }, { "blue_fish_bullet_kin", "06f5623a351c4f28bc8c6cda56004b80" }, { "green_fish_bullet_kin", "143be8c9bbb84e3fb3ab98bcd4cf5e5b" }, { "tarnisher", "475c20c1fd474dfbad54954e7cba29c1" }, { "agonizer", "3f6d6b0c4a7c4690807435c7b37c35a5" }, { "lead_maiden", "cd4a4b7f612a4ba9a720b9f97c52f38c" }, { "grip_master", "22fc2c2c45fb47cf9fb5f7b043a70122" }, { "shambling_round", "98ea2fe181ab4323ab6e9981955a9bca" }, { "great_bullet_shark", "b70cbd875fea498aa7fd14b970248920" }, { "killithid", "3e98ccecf7334ff2800188c417e67c15" }, { "spogre", "eed5addcc15148179f300cc0d9ee7f94" }, { "fridge_maiden", "9215d1a221904c7386b481a171e52859" }, { "titan_bullet_kin", "c4cf0620f71c4678bb8d77929fd4feff" }, { "titan_bullet_kin_boss", "1f290ea06a4c416cabc52d6b3cf47266" }, { "titaness_bullet_kin_boss", "df4e9fedb8764b5a876517431ca67b86" }, { "beadie", "7b0b1b6d9ce7405b86b75ce648025dd6" }, { "tombstoner", "cf27dd464a504a428d87a8b2560ad40a" }, { "ammoconda_ball", "f38686671d524feda75261e469f30e0b" }, { "summoned_treadnaughts_bullet_kin", "47bdfec22e8e4568a619130a267eab5b" }, { "mine_flayers_bell", "78a8ee40dff2477e9c2134f6990ef297" }, { "mine_flayers_claymore", "566ecca5f3b04945ac6ce1f26dedbf4f" }, { "candle_guy", "eeb33c3a5a8e4eaaaaf39a743e8767bc" }, { "bullet_kings_toadie", "b5e699a0abb94666bda567ab23bd91c4" }, { "bullet_kings_toadie_revenge", "d4dd2b2bbda64cc9bcec534b4e920518" }, { "old_kings_toadie", "02a14dec58ab45fb8aacde7aacd25b01" }, { "fusebot", "4538456236f64ea79f483784370bc62f" }, { "mouser", "be0683affb0e41bbb699cb7125fdded6" }, { "draguns_knife", "78eca975263d4482a4bfa4c07b32e252" }, { "dragun_knife_advanced", "2e6223e42e574775b56c6349921f42cb" }, { "marines_past_imp", "a9cc6a4e9b3d46ea871e70a03c9f77d4" }, { "convicts_past_soldier", "556e9f2a10f9411cb9dbfd61e0e0f1e1" }, { "robots_past_terminator", "12a054b8a6e549dcac58a82b89e319e5" }, { "blockner_rematch", "edc61b105ddd4ce18302b82efdc47178" }, { "fuselier", "39de9bd6a863451a97906d949c103538" }, { "shadow_agunim", "db97e486ef02425280129e1e27c33118" }, { "bullet_king", "ffca09398635467da3b1f4a54bcfda80" }, { "blobulord", "1b5810fafbec445d89921a4efb4e42b7" }, { "old_king", "5729c8b5ffa7415bb3d01205663a33ef" }, { "cannonbalrog", "5e0af7f7d9de4755a68d2fd3bbc15df4" }, { "door_lord", "9189f46c47564ed588b9108965f975c9" }, { "lich", "cd88c3ce60c442e9aa5b3904d31652bc" }, { "megalich", "68a238ed6a82467ea85474c595c49c6e" }, { "infinilich", "7c5d5f09911e49b78ae644d2b50ff3bf" }, { "chicken", "76bc43539fc24648bff4568c75c686d1" }, { "poopulons_corn", "0ff278534abb4fbaaa65d3f638003648" }, { "snake", "1386da0f42fb4bcabc5be8feb16a7c38" }, { "tiny_blobulord", "d1c9781fdac54d9e8498ed89210a0238" }, { "robots_past_critter_1", "95ea1a31fc9e4415a5f271b9aedf9b15" }, { "robots_past_critter_2", "42432592685e47c9941e339879379d3a" }, { "robots_past_critter_3", "4254a93fc3c84c0dbe0a8f0dddf48a5a" }, { "rat", "6ad1cafc268f4214a101dca7af61bc91" }, { "rat_candle", "14ea47ff46b54bb4a98f91ffcffb656d" }, { "dragun_egg_slimeguy", "8b43a5c59b854eb780f9ab669ec26b7a" } }; } public class CC : PlayerItem { [EnemyIdentifier] public string CompanionGuid; public string CompanionGuid1; public string CompanionGuid2; public IntVector2 CustomClearance; public Vector2 CustomOffset; public bool IsTimed; public float Lifespan; public string IntroDirectionalAnimation; public string OutroDirectionalAnimation; public GameObject DepartureVFXPrefab; private GameObject m_extantCompanion; private GameObject m_extantSecondCompanion; public CC() { Lifespan = 60f; } public static void Init() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) string name = "Creature Capsule"; string resourcePath = "FrostAndGunfireItems/Resources/capsule"; GameObject val = new GameObject(); CC cC = val.AddComponent<CC>(); ItemBuilder.AddSpriteToObject(name, resourcePath, val, v: true); string shortDesc = "Go!"; string longDesc = "An ancient device to used capture creatures. Previously owned by the famed monster tamer, Brash Ketchup, this capsule contains some rare creatures from the Gungeon that will happily fight for you."; ((PickupObject)(object)cC).SetupItem(shortDesc, longDesc, "kp"); ((PickupObject)cC).quality = (ItemQuality)(-100); cC.CompanionGuid = Frog.guid; cC.CompanionGuid1 = FChamber.guid; cC.CompanionGuid2 = Mushroom.guid; cC.IsTimed = true; cC.Lifespan = 60f; ((PlayerItem)(object)cC).SetCooldownType(ItemBuilder.CooldownType.Damage, 350f); } private void CreateCompanion(PlayerController owner) { //IL_0021: 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_0032: 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: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) int num = Random.Range(0, 3); IntVector2 value2; if (num == 0) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(CompanionGuid); IntVector2 value = IntVector2.Max(CustomClearance, orLoadByGuid.Clearance); IntVector2? nearestAvailableCell = owner.CurrentRoom.GetNearestAvailableCell(Vector3Extensions.XY(((BraveBehaviour)owner).transform.position), (IntVector2?)value, (CellTypes?)(CellTypes)2, false, (CellValidator)null); if (!nearestAvailableCell.HasValue) { return; } GameObject gameObject = ((Component)orLoadByGuid).gameObject; value2 = nearestAvailableCell.Value; GameObject targetCompanion = (m_extantCompanion = Object.Instantiate<GameObject>(gameObject, Vector2Extensions.ToVector3ZUp(((IntVector2)(ref value2)).ToVector2() + CustomOffset, 0f), Quaternion.identity)); CompanionController orAddComponent = GameObjectExtensions.GetOrAddComponent<CompanionController>(m_extantCompanion); orAddComponent.Initialize(owner); if (IsTimed) { ((MonoBehaviour)owner).StartCoroutine(HandleLifespan(targetCompanion, owner)); } } if (num == 1) { AIActor orLoadByGuid2 = EnemyDatabase.GetOrLoadByGuid(CompanionGuid1); IntVector2 value3 = IntVector2.Max(CustomClearance, orLoadByGuid2.Clearance); IntVector2? nearestAvailableCell2 = owner.CurrentRoom.GetNearestAvailableCell(Vector3Extensions.XY(((BraveBehaviour)owner).transform.position), (IntVector2?)value3, (CellTypes?)(CellTypes)2, false, (CellValidator)null); if (!nearestAvailableCell2.HasValue) { return; } GameObject gameObject2 = ((Component)orLoadByGuid2).gameObject; value2 = nearestAvailableCell2.Value; GameObject targetCompanion2 = (m_extantCompanion = Object.Instantiate<GameObject>(gameObject2, Vector2Extensions.ToVector3ZUp(((IntVector2)(ref value2)).ToVector2() + CustomOffset, 0f), Quaternion.identity)); CompanionController orAddComponent2 = GameObjectExtensions.GetOrAddComponent<CompanionController>(m_extantCompanion); orAddComponent2.Initialize(owner); if (IsTimed) { ((MonoBehaviour)owner).StartCoroutine(HandleLifespan(targetCompanion2, owner)); } } if (num != 2) { return; } AIActor orLoadByGuid3 = EnemyDatabase.GetOrLoadByGuid(CompanionGuid2); IntVector2 value4 = IntVector2.Max(CustomClearance, orLoadByGuid3.Clearance); IntVector2? nearestAvailableCell3 = owner.CurrentRoom.GetNearestAvailableCell(Vector3Extensions.XY(((BraveBehaviour)owner).transform.position), (IntVector2?)value4, (CellTypes?)(CellTypes)2, false, (CellValidator)null); if (nearestAvailableCell3.HasValue) { GameObject gameObject3 = ((Component)orLoadByGuid3).gameObject; value2 = nearestAvailableCell3.Value; GameObject targetCompanion3 = (m_extantCompanion = Object.Instantiate<GameObject>(gameObject3, Vector2Extensions.ToVector3ZUp(((IntVector2)(ref value2)).ToVector2() + CustomOffset, 0f), Quaternion.identity)); CompanionController orAddComponent3 = GameObjectExtensions.GetOrAddComponent<CompanionController>(m_extantCompanion); orAddComponent3.Initialize(owner); if (IsTimed) { ((MonoBehaviour)owner).StartCoroutine(HandleLifespan(targetCompanion3, owner)); } } } private void DestroyCompanion() { if (Object.op_Implicit((Object)(object)m_extantCompanion)) { if (!string.IsNullOrEmpty(OutroDirectionalAnimation)) { AIAnimator component = m_extantCompanion.GetComponent<AIAnimator>(); ((MonoBehaviour)GameManager.Instance.Dungeon).StartCoroutine(HandleDeparture(isPrimary: true, component)); } else { Object.Destroy((Object)(object)m_extantCompanion); m_extantCompanion = null; } } if (Object.op_Implicit((Object)(object)m_extantSecondCompanion)) { if (!string.IsNullOrEmpty(OutroDirectionalAnimation)) { AIAnimator component2 = m_extantSecondCompanion.GetComponent<AIAnimator>(); ((MonoBehaviour)GameManager.Instance.Dungeon).StartCoroutine(HandleDeparture(isPrimary: false, component2)); } else { Object.Destroy((Object)(object)m_extantSecondCompanion); m_extantSecondCompanion = null; } } } private IEnumerator HandleDeparture(bool isPrimary, AIAnimator anim) { ((Behaviour)((BraveBehaviour)anim).behaviorSpeculator).enabled = false; ((BraveBehaviour)anim).specRigidbody.Velocity = Vector2.zero; ((BraveBehaviour)anim).aiActor.ClearPath(); anim.PlayForDuration(OutroDirectionalAnimation, 3f, true, (string)null, -1f, false); float animLength = anim.GetDirectionalAnimationLength(OutroDirectionalAnimation); GameObject extantCompanion; if (isPrimary) { extantCompanion = m_extantCompanion; m_extantCompanion = null; } else { extantCompanion = m_extantSecondCompanion; m_extantSecondCompanion = null; } float elapsed2 = 0f; while (elapsed2 < animLength) { elapsed2 += BraveTime.DeltaTime; yield return null; } GameObject instanceVFXObject = null; if (Object.op_Implicit((Object)(object)anim)) { instanceVFXObject = Object.Instantiate<GameObject>(DepartureVFXPrefab); tk2dBaseSprite component = instanceVFXObject.GetComponent<tk2dBaseSprite>(); ((BraveBehaviour)component).transform.position = ((BraveBehaviour)((BraveBehaviour)anim).sprite).transform.position; } Object.Destroy((Object)(object)extantCompanion); if (Object.op_Implicit((Object)(object)instanceVFXObject)) { Vector3 startPosition = instanceVFXObject.transform.position; elapsed2 = 0f; while (elapsed2 < 1.5f) { elapsed2 += BraveTime.DeltaTime; instanceVFXObject.transform.position = Vector3.Lerp(startPosition, startPosition + new Vector3(0f, 75f, 0f), elapsed2 / 1.5f); yield return null; } Object.Destroy((Object)(object)instanceVFXObject); } } protected override void DoEffect(PlayerController user) { DestroyCompanion(); CreateCompanion(user); AkSoundEngine.PostEvent("Play_OBJ_teleport_arrive_01", ((Component)base.LastOwner).gameObject); DoWarpEffect(playSound: false); } private void DoWarpEffect(bool playSound = true) { //IL_0019: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0055: 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) //IL_006d: 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) if (Object.op_Implicit((Object)(object)m_extantCompanion)) { Vector2 worldBottomCenter = ((tk2dBaseSprite)m_extantCompanion.GetComponent<tk2dSprite>()).WorldBottomCenter; GameObject val = (GameObject)ResourceCache.Acquire("Global VFX/VFX_Teleport_Beam"); if (playSound) { AkSoundEngine.PostEvent("Play_OBJ_teleport_arrive_01", ((Component)base.LastOwner).gameObject); } GameObject val2 = Object.Instantiate<GameObject>(val); val2.GetComponent<tk2dBaseSprite>().PlaceAtLocalPositionByAnchor(Vector2.op_Implicit(worldBottomCenter), (Anchor)1); val2.transform.position = dfVectorExtensions.Quantize(val2.transform.position, 0.0625f); val2.GetComponent<tk2dBaseSprite>().UpdateZDepth(); } } protected override void OnPreDrop(PlayerController user) { ((PlayerItem)this).OnPreDrop(user); if (((PlayerItem)this).IsCurrentlyActive) { ((PlayerItem)this).IsCurrentlyActive = false; if (Object.op_Implicit((Object)(object)m_extantCompanion)) { DestroyCompanion(); } } } private IEnumerator HandleLifespan(GameObject targetCompanion, PlayerController owner) { ((PlayerItem)this).IsCurrentlyActive = true; float elapsed = 0f; base.m_activeDuration = Lifespan; base.m_activeElapsed = 0f; while (elapsed < Lifespan) { elapsed = (base.m_activeElapsed = elapsed + BraveTime.DeltaTime); yield return null; } ((PlayerItem)this).IsCurrentlyActive = false; if ((Object)(object)m_extantCompanion == (Object)(object)targetCompanion) { DestroyCompanion(); } } protected override void OnDestroy() { ((PlayerItem)this).OnDestroy(); } } namespace GungeonAPI { public static class ShrineTools { public static bool verbose = false; public static string modID = "CR"; private static Dictionary<string, float> timers = new Dictionary<string, float>(); public static void Init() { if (File.Exists(Tools.defaultLog)) { File.Delete(Tools.defaultLog); } } public static void Print<T>(T obj, string color = "FFFFFF", bool force = false) { if (verbose || force) { string[] array = obj.ToString().Split(new char[1] { '\n' }); string[] array2 = array; foreach (string text in array2) { LogToConsole("<color=#" + color + ">[" + modID + "] " + text + "</color>"); } } Log(obj.ToString()); } public static void PrintRaw<T>(T obj, bool force = false) { if (verbose || force) { LogToConsole(obj.ToString()); } Log(obj.ToString()); } public static void PrintError<T>(T obj, string color = "FF0000") { string[] array = obj.ToString().Split(new char[1] { '\n' }); string[] array2 = array; foreach (string text in array2) { LogToConsole("<color=#" + color + ">[" + modID + "] " + text + "</color>"); } Log(obj.ToString()); } public static void PrintException(Exception e, string color = "FF0000") { string text = e.Message + "\n" + e.StackTrace; string[] array = text.Split(new char[1] { '\n' }); string[] array2 = array; foreach (string text2 in array2) { LogToConsole("<color=#" + color + ">[" + modID + "] " + text2 + "</color>"); } Log(e.Message); Log("\t" + e.StackTrace); } public static void Log<T>(T obj) { using StreamWriter streamWriter = new StreamWriter(Path.Combine(ETGMod.ResourcesDirectory, Tools.defaultLog), append: true); streamWriter.WriteLine(obj.ToString()); } public static void Log<T>(T obj, string fileName) { if (!verbose) { return; } using StreamWriter streamWriter = new StreamWriter(Path.Combine(ETGMod.ResourcesDirectory, fileName), append: true); streamWriter.WriteLine(obj.ToString()); } public static void LogToConsole(string message) { message.Replace("\t", " "); ETGModConsole.Log((object)message, false); } private static void BreakdownComponentsInternal(this GameObject obj, int lvl = 0) { string text = ""; for (int i = 0; i < lvl; i++) { text += "\t"; } Log(text + ((Object)obj).name + "..."); Component[] components = obj.GetComponents<Component>(); foreach (Component val in components) { Log(text + " -" + ((object)val).GetType()); } Transform[] componentsInChildren = obj.GetComponentsInChildren<Transform>(); foreach (Transform val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)(object)obj.transform) { ((Component)val2).gameObject.BreakdownComponentsInternal(lvl + 1); } } } public static void BreakdownComponents(this GameObject obj) { obj.BreakdownComponentsInternal(); } public static void ExportTexture(Texture texture, string folder = "") { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown string text = Path.Combine(ETGMod.ResourcesDirectory, folder); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } File.WriteAllBytes(Path.Combine(text, ((Object)texture).name + ".png"), ImageConversion.EncodeToPNG((Texture2D)texture)); } public static T GetEnumValue<T>(string val) where T : Enum { return (T)Enum.Parse(typeof(T), val.ToUpper()); } public static void LogPropertiesAndFields<T>(this T obj, string header = "") { Log(header); Log("======================="); if (obj == null) { Log("LogPropertiesAndFields: Null object"); return; } Type type = obj.GetType(); Log($"Type: {type}"); PropertyInfo[] properties = type.GetProperties(); Log($"{typeof(T)} Properties: "); PropertyInfo[] array = properties; foreach (PropertyInfo propertyInfo in array) { try { object value = propertyInfo.GetValue(obj, null); string text = value.ToString(); if ((object)obj?.GetType().GetGenericTypeDefinition() == typeof(List<>)) { List<object> list = value as List<object>; text = $"List[{list.Count}]"; foreach (object item in list) { text = text + "\n\t\t" + item.ToString(); } } Log("\t" + propertyInfo.Name + ": " + text); } catch { } } Log($"{typeof(T)} Fields: "); FieldInfo[] fields = type.GetFields(); FieldInfo[] array2 = fields; foreach (FieldInfo fieldInfo in array2) { Log($"\t{fieldInfo.Name}: {fieldInfo.GetValue(obj)}"); } } } public static class NPCBuilder { public enum AnimationType { Move, Idle, Fidget, Flight, Hit, Talk, Other } public static tk2dSpriteAnimationClip AddAnimation(this GameObject obj, string name, string spriteDirectory, int fps, AnimationType type, DirectionType directionType = 0, FlipType flipType = 0) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected I4, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0061: 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) obj.AddComponent<tk2dSpriteAnimator>(); AIAnimator val = obj.GetComponent<AIAnimator>(); if (!Object.op_Implicit((Object)(object)val)) { val = CreateNewAIAnimator(obj); } DirectionalAnimation val2 = val.GetDirectionalAnimation(name, directionType, type); if (val2 == null) { DirectionalAnimation val3 = new DirectionalAnimation(); val3.AnimNames = new string[0]; val3.Flipped = (FlipType[])(object)new FlipType[0]; val3.Type = directionType; val3.Prefix = string.Empty; val2 = val3; } val2.AnimNames = val2.AnimNames.Concat(new string[1] { name }).ToArray(); val2.Flipped = val2.Flipped.Concat((IEnumerable<FlipType>)(object)new FlipType[1] { (FlipType)(int)flipType }).ToArray(); val.AssignDirectionalAnimation(name, val2, type); return BuildAnimation(val, name, spriteDirectory, fps); } private static AIAnimator CreateNewAIAnimator(GameObject obj) { AIAnimator val = obj.AddComponent<AIAnimator>(); val.FlightAnimation = CreateNewDirectionalAnimation(); val.HitAnimation = CreateNewDirectionalAnimation(); val.IdleAnimation = CreateNewDirectionalAnimation(); val.TalkAnimation = CreateNewDirectionalAnimation(); val.MoveAnimation = CreateNewDirectionalAnimation(); val.OtherAnimations = new List<NamedDirectionalAnimation>(); val.IdleFidgetAnimations = new List<DirectionalAnimation>(); val.OtherVFX = new List<NamedVFXPool>(); return val; } private static DirectionalAnimation CreateNewDirectionalAnimation() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) DirectionalAnimation val = new DirectionalAnimation(); val.AnimNames = new string[0]; val.Flipped = (FlipType[])(object)new FlipType[0]; val.Type = (DirectionType)0; return val; } public static tk2dSpriteAnimationClip BuildAnimation(AIAnimator aiAnimator, string name, string spriteDirectory, int fps) { tk2dSpriteCollectionData val = ((Component)aiAnimator).GetComponent<tk2dSpriteCollectionData>(); if (!Object.op_Implicit((Object)(object)val)) { val = SpriteBuilder.ConstructCollection(((Component)aiAnimator).gameObject, ((Object)aiAnimator).name + "_collection"); } string[] resourceNames = ResourceExtractor.GetResourceNames(); List<int> list = new List<int>(); for (int i = 0; i < resourceNames.Length; i++) { if (resourceNames[i].StartsWith(spriteDirectory.Replace('/', '.'), StringComparison.OrdinalIgnoreCase)) { list.Add(SpriteBuilder.AddSpriteToCollection(resourceNames[i], val)); } } if (list.Count == 0) { Tools.PrintError("No sprites found for animation " + name); } tk2dSpriteAnimationClip val2 = SpriteBuilder.AddAnimation(((BraveBehaviour)aiAnimator).spriteAnimator, val, list, name, (WrapMode)0); val2.fps = fps; return val2; } public static DirectionalAnimation GetDirectionalAnimation(this AIAnimator aiAnimator, string name, DirectionType directionType, AnimationType type) { DirectionalAnimation val = null; switch (type) { case AnimationType.Move: val = aiAnimator.MoveAnimation; break; case AnimationType.Idle: val = aiAnimator.IdleAnimation; break; case AnimationType.Flight: val = aiAnimator.FlightAnimation; break; case AnimationType.Hit: val = aiAnimator.HitAnimation; break; case AnimationType.Talk: val = aiAnimator.TalkAnimation; break; } if (val != null) { return val; } return null; } public static void AssignDirectionalAnimation(this AIAnimator aiAnimator, string name, DirectionalAnimation animation, AnimationType type) { //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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown switch (type) { case AnimationType.Move: aiAnimator.MoveAnimation = animation; return; case AnimationType.Idle: aiAnimator.IdleAnimation = animation; return; case AnimationType.Fidget: aiAnimator.IdleFidgetAnimations.Add(animation); return; case AnimationType.Flight: aiAnimator.FlightAnimation = animation; return; case AnimationType.Hit: aiAnimator.HitAnimation = animation; return; case AnimationType.Talk: aiAnimator.TalkAnimation = animation; return; } aiAnimator.OtherAnimations.Add(new NamedDirectionalAnimation { anim = animation, name = name }); } } public abstract class NPCInteractable : BraveBehaviour { public Action<PlayerController, GameObject> OnAccept; public Action<PlayerController, GameObject> OnDecline; public List<string> conversation; public List<string> conversation2; public Func<PlayerController, GameObject, bool> CanUse; public Transform talkPoint; public string text; public string acceptText; public string acceptText2; public string declineText; public string declineText2; public bool isToggle; protected bool m_isToggled; protected bool m_canUse = true; } public class OldShrineFactory { public class CustomShrineController : DungeonPlaceableBehaviour { public string ID; public bool isBreachShrine; public bool CantTalk = true; public Action<PlayerController, GameObject> OnInteracted; public Vector3 offset; public List<PixelCollider> pixelColliders; public Dictionary<string, int> roomStyles; public OldShrineFactory factory; public Action<PlayerController, GameObject> OnAccept; public Action<PlayerController, GameObject> OnDecline; public Func<PlayerController, GameObject, bool> CanUse; private RoomHandler m_parentRoom; private GameObject m_instanceMinimapIcon; public int numUses; private void Start() { string text = ((Object)this).name.Replace("(Clone)", ""); if (builtShrines.ContainsKey(text)) { Copy(builtShrines[text].GetComponent<CustomShrineController>()); } else { Tools.PrintError("Was this shrine registered correctly?: " + text); } ((Component)this).GetComponent<SimpleInteractable>().OnAccept = OnAccept; ((Component)this).GetComponent<SimpleInteractable>().OnDecline = OnDecline; ((Component)this).GetComponent<SimpleInteractable>().CanUse = CanUse; } public void Copy(CustomShrineController other) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) ID = other.ID; roomStyles = other.roomStyles; isBreachShrine = other.isBreachShrine; CantTalk = other.CantTalk; OnInteracted = other.OnInteracted; offset = other.offset; pixelColliders = other.pixelColliders; factory = other.factory; OnAccept = other.OnAccept; OnDecline = other.OnDecline; CanUse = other.CanUse; } public void ConfigureOnPlacement(RoomHandler room) { m_parentRoom = room; RegisterMinimapIcon(); } public void RegisterMinimapIcon() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown m_instanceMinimapIcon = Minimap.Instance.RegisterRoomIcon(m_parentRoom, (GameObject)BraveResources.Load("Global Prefabs/Minimap_Shrine_Icon", ".prefab"), false); } public void GetRidOfMinimapIcon() { if ((Object)(object)m_instanceMinimapIcon != (Object)null) { Minimap.Instance.DeregisterRoomIcon(m_parentRoom, m_instanceMinimapIcon); m_instanceMinimapIcon = null; } } } public float RoomWeight; public bool CantTalk = true; public Action<PlayerController, GameObject> OnInteracted; public string name; public string modID; public string spritePath; public string roomPath; public string text; public string acceptText; public string declineText; public Action<PlayerController, GameObject> OnAccept; public Action<PlayerController, GameObject> OnDecline; public Func<PlayerController, GameObject, bool> CanUse; public Vector3 talkPointOffset; public Vector3 offset = new Vector3(43.8f, 42.4f, 42.9f); public IntVector2 colliderOffset; public IntVector2 colliderSize; public bool isToggle; public bool usesCustomColliderOffsetAndSize; public Type interactableComponent; public bool isBreachShrine; public PrototypeDungeonRoom room; public Dictionary<string, int> roomStyles; public static Dictionary<string, GameObject> builtShrines = new Dictionary<string, GameObject>(); private static bool m_initialized; private static bool m_builtShrines; public static void Init() { if (m_initialized) { return; } DungeonHooks.OnFoyerAwake += PlaceBreachShrines; DungeonHooks.OnPreDungeonGeneration += delegate(LoopDungeonGenerator generator, Dungeon dungeon, DungeonFlow flow, int dungeonSeed) { if (((Object)flow).name != "Foyer Flow" && !GameManager.IsReturningToFoyerWithPlayer) { CustomShrineController[] array = Object.FindObjectsOfType<CustomShrineController>(); foreach (CustomShrineController customShrineController in array) { if (!ShrineFakePrefab.IsFakePrefab((Object)(object)customShrineController)) { Object.Destroy((Object)(object)((Component)customShrineController).gameObject); } } m_builtShrines = false; } }; m_initialized = true; } public GameObject Build() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008e: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) GameObject result; try { Texture2D textureFromResource = ResourceExtractor.GetTextureFromResource(spritePath); GameObject val = SpriteBuilder.SpriteFromResource(spritePath); string text2 = (((Object)val).name = (modID + ":" + name).ToLower().Replace(" ", "_")); tk2dSprite component = val.GetComponent<tk2dSprite>(); ((tk2dBaseSprite)component).IsPerpendicular = true; ((tk2dBaseSprite)component).PlaceAtPositionByAnchor(offset, (Anchor)1); Transform transform = new GameObject("talkpoint").transform; transform.position = val.transform.position + talkPointOffset; transform.SetParent(val.transform); if (!usesCustomColliderOffsetAndSize) { IntVector2 val2 = default(IntVector2); ((IntVector2)(ref val2))..ctor(((Texture)textureFromResource).width, ((Texture)textureFromResource).height); colliderOffset = new IntVector2(0, 0); colliderSize = new IntVector2(val2.x, val2.y / 2); } SpeculativeRigidbody val3 = component.SetUpSpeculativeRigidbody(colliderOffset, colliderSize); CustomShrineController customShrineController = val.AddComponent<CustomShrineController>(); customShrineController.ID = text2; customShrineController.roomStyles = roomStyles; customShrineController.isBreachShrine = true; customShrineController.offset = offset; customShrineController.pixelColliders = ((BraveBehaviour)val3).specRigidbody.PixelColliders; customShrineController.factory = this; customShrineController.OnAccept = OnAccept; customShrineController.OnInteracted = OnInteracted; customShrineController.OnDecline = OnDecline; customShrineController.CanUse = CanUse; IPlayerInteractable item; if ((object)interactableComponent != null) { Component obj = val.AddComponent(interactableComponent); item = (IPlayerInteractable)(object)((obj is IPlayerInteractable) ? obj : null); } else { SimpleShrine simpleShrine = val.AddComponent<SimpleShrine>(); simpleShrine.isToggle = isToggle; simpleShrine.CantTalk = CantTalk; simpleShrine.OnAccept = OnAccept; simpleShrine.OnInteracted = OnInteracted; simpleShrine.OnDecline = OnDecline; simpleShrine.CanUse = CanUse; simpleShrine.text = this.text; simpleShrine.acceptText = acceptText; simpleShrine.declineText = declineText; simpleShrine.talkPoint = transform; item = (IPlayerInteractable)(object)simpleShrine; } GameObject val4 = ShrineFakePrefab.Clone(val); val4.GetComponent<CustomShrineController>().Copy(customShrineController); ((Object)val4).name = text2; if (isBreachShrine) { if (!RoomHandler.unassignedInteractableObjects.Contains(item)) { RoomHandler.unassignedInteractableObjects.Add(item); } } else { if (!Object.op_Implicit((Object)(object)room)) { room = RoomFactory.CreateEmptyRoom(); } RegisterShrineRoom(val4, room, text2, Vector2.op_Implicit(offset), RoomWeight); } builtShrines.Add(text2, val4); result = val; } catch (Exception e) { Tools.PrintException(e); result = null; } if (!CantTalk) { ETGModConsole.Log((object)"sdfsfsdfsdfsdfsdfssfsfsfsfsefsef", false); } return result; } public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset, float roomweight) { //IL_0012: 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_0034: 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_0046: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown DungeonPrerequisite[] array = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)(protoroom.Width / 2) + offset.x, (float)(protoroom.Height / 2) + offset.y); protoroom.placedObjectPositions.Add(val); List<PrototypePlacedObjectData> placedObjects = protoroom.placedObjects; PrototypePlacedObjectData val2 = new PrototypePlacedObjectData(); val2.contentsBasePosition = val; val2.fieldData = new List<PrototypePlacedObjectFieldData>(); val2.instancePrerequisites = array; val2.linkedTriggerAreaIDs = new List<int>(); DungeonPlaceable val3 = new DungeonPlaceable(); val3.width = 2; val3.height = 2; val3.respectsEncounterableDifferentiator = true; List<DungeonPlaceableVariant> list = new List<DungeonPlaceableVariant>(); DungeonPlaceableVariant val4 = new DungeonPlaceableVariant(); val4.percentChance = 1f; val4.nonDatabasePlaceable = shrine; val4.prerequisites = array; val4.materialRequirements = (DungeonPlaceableRoomMaterialRequirement[])(object)new DungeonPlaceableRoomMaterialRequirement[0]; list.Add(val4); val3.variantTiers = list; val2.placeableContents = val3; placedObjects.Add(val2); RoomFactory.RoomData roomData = default(RoomFactory.RoomData); roomData.room = protoroom; roomData.category = ((object)(RoomCategory)(ref protoroom.category)).ToString(); roomData.weight = roomweight; RoomFactory.RoomData roomData2 = roomData; if (roomData2.floors != null) { string[] floors = roomData2.floors; foreach (string val5 in floors) { protoroom.prerequisites.Add(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)3, requiredTileset = ShrineTools.GetEnumValue<ValidTilesets>(val5) }); } } RoomFactory.rooms.Add(ID, roomData2); DungeonHandler.Register(roomData2); } private static void PlaceBreachShrines() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (m_builtShrines) { return; } foreach (GameObject value in builtShrines.Values) { try { CustomShrineController component = value.GetComponent<CustomShrineController>(); if (component.isBreachShrine) { CustomShrineController component2 = Object.Instantiate<GameObject>(value).GetComponent<CustomShrineController>(); component2.Copy(component); ((Component)component2).gameObject.SetActive(true); ((BraveBehaviour)component2).sprite.PlaceAtPositionByAnchor(component2.offset, (Anchor)1); IPlayerInteractable component3 = ((Component)component2).GetComponent<IPlayerInteractable>(); if (component3 is SimpleInteractable) { ((SimpleInteractable)(object)component3).OnAccept = component2.OnAccept; ((SimpleInteractable)(object)component3).OnDecline = component2.OnDecline; ((SimpleInteractable)(object)component3).CanUse = component2.CanUse; } if (!RoomHandler.unassignedInteractableObjects.Contains(component3)) { RoomHandler.unassignedInteractableObjects.Add(component3); } } } catch (Exception e) { Tools.PrintException(e); } } m_builtShrines = true; } } public class SimpleShrine : SimpleInteractable, IPlayerInteractable { private void Start() { talkPoint = ((BraveBehaviour)this).transform.Find("talkpoint"); m_isToggled = false; } public void Interact(PlayerController interactor) { if (!TextBoxManager.HasTextBox(talkPoint)) { m_canUse = ((CanUse != null) ? CanUse(interactor, ((Component)this).gameObject) : m_canUse); if (CantTalk) { ((MonoBehaviour)this).StartCoroutine(HandleConversation(interactor)); } else { OnInteracted(interactor, ((Component)this).gameObject); } } } private IEnumerator HandleConversation(PlayerController interactor) { TextBoxManager.ShowStoneTablet(talkPoint.position, talkPoint, -1f, text, true, false); interactor.SetInputOverride("shrineConversation"); yield return null; if (!m_canUse) { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, declineText, string.Empty); } else if (isToggle) { if (m_isToggled) { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, declineText, string.Empty); } else { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, acceptText, string.Empty); } } else { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, acceptText, declineText); } int num = default(int); while (!GameUIRoot.Instance.GetPlayerConversationResponse(ref num)) { yield return null; } interactor.ClearInputOverride("shrineConversation"); TextBoxManager.ClearTextBox(talkPoint); if (m_canUse) { if (num == 0 && isToggle) { (m_isToggled ? OnDecline : OnAccept)?.Invoke(interactor, ((Component)this).gameObject); m_isToggled = !m_isToggled; } else if (num == 0) { OnAccept?.Invoke(interactor, ((Component)this).gameObject); } else { OnDecline?.Invoke(interactor, ((Component)this).gameObject); } } } public void OnEnteredRange(PlayerController interactor) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.white, 1f, 0f, (OutlineType)0); ((BraveBehaviour)this).sprite.UpdateZDepth(); } public void OnExitRange(PlayerController interactor) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)this).sprite, false); } public string GetAnimationState(PlayerController interactor, out bool shouldBeFlipped) { shouldBeFlipped = false; return string.Empty; } public float GetDistanceToPoint(Vector2 point) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) if ((Object)(object)((BraveBehaviour)this).sprite == (Object)null) { return 100f; } Vector3 val = Vector2.op_Implicit(BraveMathCollege.ClosestPointOnRectangle(point, ((BraveBehaviour)this).specRigidbody.UnitBottomLeft, ((BraveBehaviour)this).specRigidbody.UnitDimensions)); return Vector2.Distance(point, Vector2.op_Implicit(val)) / 1.5f; } public float GetOverrideMaxDistance() { return -1f; } } public static class StaticReferences { public static Dictionary<string, AssetBundle> AssetBundles; public static Dictionary<string, GenericRoomTable> RoomTables; public static SharedInjectionData subShopTable; public static Dictionary<string, string> roomTableMap = new Dictionary<string, string> { { "castle", "Castle_RoomTable" }, { "gungeon", "Gungeon_RoomTable" }, { "mines", "Mines_RoomTable" }, { "catacombs", "Catacomb_RoomTable" }, { "forge", "Forge_RoomTable" }, { "sewer", "Sewer_RoomTable" }, { "cathedral", "Cathedral_RoomTable" }, { "bullethell", "BulletHell_RoomTable" } }; public static Dictionary<string, string> specialRoomTableMap = new Dictionary<string, string> { { "special", "basic special rooms (shrines, etc)" }, { "shop", "Shop Room Table" }, { "secret", "secret_room_table_01" } }; public static string[] assetBundleNames = new string[3] { "shared_auto_001", "shared_auto_002", "brave_resources_001" }; public static string[] dungeonPrefabNames = new string[8] { "base_gungeon", "base_castle", "base_mines", "base_catacombs", "base_forge", "base_sewer", "base_cathedral", "base_bullethell" }; public static void Init() { AssetBundles = new Dictionary<string, AssetBundle>(); string[] array = assetBundleNames; foreach (string text in array) { try { AssetBundle val = ResourceManager.LoadAssetBundle(text); if ((Object)(object)val == (Object)null) { Tools.PrintError("Failed to load asset bundle: " + text); } else { AssetBundles.Add(text, ResourceManager.LoadAssetBundle(text)); } } catch (Exception e) { Tools.PrintError("Failed to load asset bundle: " + text); Tools.PrintException(e); } } RoomTables = new Dictionary<string, GenericRoomTable>(); foreach (KeyValuePair<string, string> item in roomTableMap) { try { GenericRoomTable fallbackRoomTable = DungeonDatabase.GetOrLoadByName("base_" + item.Key).PatternSettings.flows[0].fallbackRoomTable; RoomTables.Add(item.Key, fallbackRoomTable); } catch (Exception e2) { Tools.PrintError("Failed to load room table: " + item.Key + ":" + item.Value); Tools.PrintException(e2); } } foreach (KeyValuePair<string, string> item2 in specialRoomTableMap) { try { GenericRoomTable asset = StaticReferences.GetAsset<GenericRoomTable>(item2.Value); RoomTables.Add(item2.Key, asset); } catch (Exception e3) { Tools.PrintError("Failed to load special room table: " + item2.Key + ":" + item2.Value); Tools.PrintException(e3); } } subShopTable = AssetBundles["shared_auto_001"].LoadAsset<SharedInjectionData>("_global injected subshop table"); Tools.Print("Static references initialized."); } public static GenericRoomTable GetRoomTable(ValidTilesets tileset) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0005: 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_001d: Expected I4, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if ((int)tileset <= 16) { switch (tileset - 1) { default: if ((int)tileset != 8) { if ((int)tileset != 16) { break; } return RoomTables["mines"]; } return RoomTables["cathedral"]; case 1: return RoomTables["castle"]; case 0: return RoomTables["gungeon"]; case 3: return RoomTables["sewer"]; case 2: break; } } else { if ((int)tileset == 32) { return RoomTables["catacombs"]; } if ((int)tileset == 64) { return RoomTables["forge"]; } if ((int)tileset == 128) { return RoomTables["bullethell"]; } } return RoomTables["gungeon"]; } public static T GetAsset<T>(string assetName) where T : Object { T val = default(T); foreach (AssetBundle value in AssetBundles.Values) { val = value.LoadAsset<T>(assetName); if ((Object)(object)val != (Object)null) { break; } } return val; } } public static class GungeonAP { public static void Init() { Tools.Init(); StaticReferences.Init(); ShrineFakePrefabHooks.Init(); ShrineFactory.Init(); OldShrineFactory.Init(); DungeonHandler.Init(); } } public static class DungeonHandler { private static bool initialized; public static bool debugFlow; public static bool LoadedFlow; public static void Init() { if (!initialized) { RoomFactory.LoadRoomsFromRoomDirectory(); DungeonHooks.OnPreDungeonGeneration += OnPreDungeonGen; initialized = true; } } public static void OnPreDungeonGen(LoopDungeonGenerator generator, Dungeon dungeon, DungeonFlow flow, int dungeonSeed) { if (((Object)flow).name != "Foyer Flow" && !GameManager.IsReturningToFoyerWithPlayer) { if (debugFlow) { flow = SampleFlow.CreateDebugFlow(dungeon); generator.AssignFlow(flow); } if (LoadedFlow) { PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; primaryPlayer.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Combine(primaryPlayer.OnNewFloorLoaded, new Action<PlayerController>(GiveKey)); PlayerController primaryPlayer2 = GameManager.Instance.PrimaryPlayer; primaryPlayer2.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Combine(primaryPlayer2.OnNewFloorLoaded, new Action<PlayerController>(RevealFloor)); flow = SampleFlow.CreateLoadedFlow(dungeon, GameManager.Instance.CurrentFloor); generator.AssignFlow(flow); } } dungeon = null; } private static void RevealFloor(PlayerController player) { Minimap.Instance.RevealAllRooms(true); } private static void GiveKey(PlayerController player) { if (GameManager.Instance.PrimaryPlayer.HasPickupID(Databases.Items["Sack"].PickupObjectId)) { PlayerConsumables carriedConsumables = player.carriedConsumables; carriedConsumables.Currency += 50; } else { PlayerConsumables carriedConsumables2 = player.carriedConsumables; carriedConsumables2.KeyBullets += 1; } player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action<PlayerController>(GiveKey)); } public static void Register(RoomFactory.RoomData roomData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0031: 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_0038: 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_0051: Expected I4, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0106: Unknown result type (might be due to invalid IL or missing references) PrototypeDungeonRoom room = roomData.room; WeightedRoom val = new WeightedRoom(); val.room = room; val.additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; val.weight = roomData.weight; WeightedRoom val2 = val; bool flag = false; RoomCategory category = room.category; switch (category - 3) { case 2: { RoomSpecialSubCategory subCategorySpecial = room.subCategorySpecial; if ((int)subCategorySpecial != 1) { if ((int)subCategorySpecial == 2) { StaticReferences.subShopTable.InjectionData.AddRange(GetFlowModifier(roomData)); flag = true; } else { StaticReferences.RoomTables["special"].includedRooms.Add(val2); flag = true; } } else { StaticReferences.RoomTables["shop"].includedRooms.Add(val2); flag = true; } break; } case 3: StaticReferences.RoomTables["secret"].includedRooms.Add(val2); flag = true; break; default: foreach (DungeonPrerequisite prerequisite in room.prerequisites) { if (prerequisite.requireTileset) { StaticReferences.GetRoomTable(prerequisite.requiredTileset).includedRooms.Add(val2); } } flag = true; break; case 0: break; } RemoveTilesetPrereqs(room); } public static List<ProceduralFlowModifierData> GetFlowModifier(RoomFactory.RoomData roomData) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown PrototypeDungeonRoom room = roomData.room; List<ProceduralFlowModifierData> list = new List<ProceduralFlowModifierData>(); List<DungeonPrerequisite> list2 = new List<DungeonPrerequisite>(); foreach (DungeonPrerequisite prerequisite in room.prerequisites) { if (prerequisite.requireTileset) { ProceduralFlowModifierData val = new ProceduralFlowModifierData(); val.annotation = ((Object)room).name; val.placementRules = new List<FlowModifierPlacementType> { (FlowModifierPlacementType)1, (FlowModifierPlacementType)3 }; val.exactRoom = room; val.selectionWeight = roomData.weight; val.chanceToSpawn = 1f; val.prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[1] { prerequisite }; val.CanBeForcedSecret = true; list.Add(val); } } RemoveTilesetPrereqs(room); if (list.Count == 0) { ProceduralFlowModifierData val = new ProceduralFlowModifierData(); val.annotation = ((Object)room).name; val.placementRules = new List<FlowModifierPlacementType> { (FlowModifierPlacementType)1, (FlowModifierPlacementType)3 }; val.exactRoom = room; val.selectionWeight = roomData.weight; val.chanceToSpawn = 1f; val.prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; val.CanBeForcedSecret = true; list.Add(val); } return list; } public static void RemoveTilesetPrereqs(PrototypeDungeonRoom room) { List<DungeonPrerequisite> list = new List<DungeonPrerequisite>(); foreach (DungeonPrerequisite prerequisite in room.prerequisites) { if (prerequisite.requireTileset) { list.Add(prerequisite); } } foreach (DungeonPrerequisite item in list) { room.prerequisites.Remove(item); } } public static bool BelongsOnThisFloor(RoomFactory.RoomData data, string dungeonName) { if (data.floors == null || data.floors.Length == 0) { return true; } bool result = false; string[] floors = data.floors; foreach (string text in floors) { if (text.ToLower().Equals(dungeonName.ToLower())) { result = true; break; } } return result; } public static GenericRoomTable GetSpecialRoomTable() { //IL_00dc: 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) foreach (MetaInjectionDataEntry entry in GameManager.Instance.GlobalInjectionData.entries) { if (entry.injectionData?.InjectionData == null) { continue; } foreach (ProceduralFlowModifierData injectionDatum in entry.injectionData.InjectionData) { if (!((Object)(object)injectionDatum.exactRoom != (Object)null)) { continue; } Tools.Log(((Object)injectionDatum.exactRoom).name); if (injectionDatum.prerequisites != null) { DungeonPrerequisite[] prerequisites = injectionDatum.prerequisites; foreach (DungeonPrerequisite val in prerequisites) { Tools.Log("\t" + ((object)(PrerequisiteType)(ref val.prerequisiteType)).ToString()); } } if (injectionDatum.placementRules == null) { continue; } foreach (FlowModifierPlacementType placementRule in injectionDatum.placementRules) { FlowModifierPlacementType current3 = placementRule; Tools.Log("\t" + ((object)(FlowModifierPlacementType)(ref current3)).ToString()); } } } return null; } public static void CollectDataForAnalysis(DungeonFlow flow, Dungeon dungeon) { try { foreach (WeightedRoom element in flow.fallbackRoomTable.includedRooms.elements) { } } catch (Exception e) { Tools.PrintException(e); } dungeon = null; } public static void LogProtoRoomData(PrototypeDungeonRoom room) { int num = 0; Tools.LogPropertiesAndFields<PrototypeDungeonRoom>(room, "ROOM"); foreach (PrototypePlacedObjectData placedObject in room.placedObjects) { Tools.Log($"\n----------------Object #{num++}----------------"); Tools.LogPropertiesAndFields<PrototypePlacedObjectData>(placedObject, "PLACED OBJECT"); Tools.LogPropertiesAndFields<DungeonPlaceable>(placedObject?.placeableContents, "PLACEABLE CONTENT"); Tools.LogPropertiesAndFields<DungeonPlaceableVariant>(placedObject?.placeableContents?.variantTiers[0], "VARIANT TIERS"); } Tools.Print("==LAYERS=="); foreach (PrototypeRoomObjectLayer additionalObjectLayer in room.additionalObjectLayers) { } } } public static class DungeonHooks { public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); private static GameManager targetInstance; public static FieldInfo m_assignedFlow = typeof(LoopDungeonGenerator).GetField("m_assignedFlow", BindingFlags.Instance | BindingFlags.NonPublic); private static Hook preDungeonGenHook = new Hook((MethodBase)typeof(LoopDungeonGenerator).GetConstructor(new Type[2] { typeof(Dungeon), typeof(int) }), typeof(DungeonHooks).GetMethod("LoopGenConstructor")); private static Hook foyerAwakeHook = new Hook((MethodBase)typeof(MainMenuFoyerController).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic), typeof(DungeonHooks).GetMethod("FoyerAwake")); public static List<WeightedRoomCollection> seenTables = new List<WeightedRoomCollection>(); public static event Action<LoopDungeonGenerator, Dungeon, DungeonFlow, int> OnPreDungeonGeneration; public static event Action OnPostDungeonGeneration; public static event Action OnFoyerAwake; public static void FoyerAwake(Action<MainMenuFoyerController> orig, MainMenuFoyerController self) { orig(self); DungeonHooks.OnFoyerAwake?.Invoke(); } public static void LoopGenConstructor(Action<LoopDungeonGenerator, Dungeon, int> orig, LoopDungeonGenerator self, Dungeon dungeon, int dungeonSeed) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown orig(self, dungeon, dungeonSeed); if ((Object)(object)GameManager.Instance != (Object)null && (Object)(object)GameManager.Instance != (Object)(object)targetInstance) { targetInstance = GameManager.Instance; targetInstance.OnNewLevelFullyLoaded += OnLevelLoad; } DungeonFlow arg = (DungeonFlow)m_assignedFlow.GetValue(self); DungeonHooks.OnPreDungeonGeneration?.Invoke(self, dungeon, arg, dungeonSeed); dungeon = null; } public static void OnLevelLoad() { DungeonHooks.OnPostDungeonGeneration?.Invoke(); } public static void ProcessRoomEvents(Action<RoomHandler, RoomEventTriggerCondition> orig, RoomHandler self, RoomEventTriggerCondition eventCondition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) orig(self, eventCondition); } public static WeightedRoom SelectByWeight(Func<WeightedRoomCollection, WeightedRoom> orig, WeightedRoomCollection self) { try { if (!seenTables.Contains(self)) { foreach (WeightedRoom element in self.elements) { Tools.Log(((Object)element.room).name, "RoomTables/" + seenTables.Count + ".txt"); } seenTables.Add(self); } } catch (Exception e) { Tools.PrintException(e); } return orig(self); } public static void AcquirePrototypeRoom(Action<LoopFlowBuilder, BuilderFlowNode> orig, LoopFlowBuilder self, BuilderFlowNode buildData) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 orig(self, buildData); if (Object.op_Implicit((Object)(object)buildData.assignedPrototypeRoom)) { if ((int)buildData.assignedPrototypeRoom.category != 2) { Tools.LogPropertiesAndFields<PrototypeDungeonRoom>(buildData.assignedPrototypeRoom, "\n" + ((Object)buildData.assignedPrototypeRoom).name); } else { Tools.Log("======================= NULL =======================\n"); } } } public static void SanityCheckRooms(Action<LoopFlowBuilder, SemioticLayoutManager> orig, LoopFlowBuilder self, SemioticLayoutManager layout) { orig(self, layout); FieldInfo field = typeof(LoopFlowBuilder).GetField("allBuilderNodes", BindingFlags.Instance | BindingFlags.NonPublic); List<BuilderFlowNode> list = (List<BuilderFlowNode>)field.GetValue(self); for (int i = 0; i < list.Count; i++) { BuilderFlowNode val = list[i]; if (val != null && Object.op_Implicit((Object)(object)val.assignedPrototypeRoom)) { string text = ((Object)val.assignedPrototypeRoom).name.ToLower(); if (text.Contains("shrine") || text.Contains("glass")) { Tools.LogPropertiesAndFields<BuilderFlowNode>(val, "Builder Flow Node"); Tools.LogPropertiesAndFields<PrototypeDungeonRoom>(val.assignedPrototypeRoom, "Proto Room"); Tools.LogPropertiesAndFields<SharedInjectionData>(val.assignedPrototypeRoom.requiredInjectionData, "InjectionData"); } } } } public static bool ProcessSingleNodeInjection(Func<LoopFlowBuilder, ProceduralFlowModifierData, BuilderFlowNode, RuntimeInjectionFlags, FlowCompositeMetastructure, RuntimeInjectionMetadata, bool> orig, LoopFlowBuilder self, ProceduralFlowModifierData pfmd, BuilderFlowNode root, RuntimeInjectionFlags flags, FlowCompositeMetastructure fcm, RuntimeInjectionMetadata rim = null) { return orig(self, pfmd, root, flags, fcm, rim); } public static List<BuilderFlowNode> NewGetNodeChildrenToBuild(Func<DungeonFlow, BuilderFlowNode, LoopFlowBuilder, List<BuilderFlowNode>> orig, DungeonFlow self, BuilderFlowNode parentBuilderNode, LoopFlowBuilder builder) { List<BuilderFlowNode> list = orig(self, parentBuilderNode, builder); try { foreach (BuilderFlowNode item in list) { } } catch (Exception e) { Tools.PrintException(e); } return list; } } internal class OfficialFlows { public enum FLOORS { KEEP, PROPER, MINES, HOLLOW, FORGE, HELL } public static string[] dungeonPrefabNames = new string[10] { "Base_Castle", "Base_Gungeon", "Base_Mines", "Base_Catacombs", "Base_Forge", "Base_Sewer", "Base_Cathedral ", "Base_ResourcefulRat", "Base_Nakatomi", "Base_BulletHell" }; public static string[] dungeonPrefabNamesInOrder = new string[9] { "Foyer", "Base_Castle", "Base_Sewer", "Base_Gungeon", "Base_Cathedral", "Base_Mines", "Base_Catacombs", "Base_Forge", "Base_BulletHell" }; public static string[] dungeonSceneNamesInOrder = new string[9] { "tt_foyer", "tt_castle", "tt_sewer", "tt5", "tt_cathedral", "tt_mines", "tt_catacombs", "tt_forge", "tt_bullethell" }; public static int GetLevelIndex(string dungeonName) { for (int i = 0; i < dungeonPrefabNames.Length; i++) { if (dungeonPrefabNames[i].ToLower().Contains(dungeonName.ToLower())) { return i; } } return -1; } public static Dungeon GetDungeonPrefab(string floor) { return DungeonDatabase.GetOrLoadByName(floor); } public static Dungeon GetDungeonPrefab(int floor) { return DungeonDatabase.GetOrLoadByName(dungeonPrefabNames[floor]); } public static List<PrototypeDungeonRoom> GetRoomsFromRoomTables(string floor) { Dungeon dungeonPrefab = GetDungeonPrefab(floor); List<PrototypeDungeonRoom> list = new List<PrototypeDungeonRoom>(); for (int i = 0; i < dungeonPrefab.PatternSettings.flows.Count; i++) { foreach (WeightedRoom element in dungeonPrefab.PatternSettings.flows[i].fallbackRoomTable.includedRooms.elements) { list.Add(element.room); } } dungeonPrefab = null; return list; } public static List<PrototypeDungeonRoom> GetRoomsFromRoomTables(int floor) { return GetRoomsFromRoomTables(dungeonPrefabNames[floor]); } public static PrototypeDungeonRoom GetRoomFromDungeon(string roomName, string floor) { roomName = roomName.ToLower(); List<PrototypeDungeonRoom> roomsFromRoomTables = GetRoomsFromRoomTables(floor); foreach (PrototypeDungeonRoom item in roomsFromRoomTables) { Tools.Log(((Object)item).name, "roomnames.txt"); if (((Object)item).name.ToLower().Equals(roomName)) { return item; } } List<DungeonFlowNode> allFlowNodes = GetAllFlowNodes(floor); if (allFlowNodes == null) { return null; } foreach (DungeonFlowNode item2 in allFlowNodes) { PrototypeDungeonRoom overrideExactRoom = item2.overrideExactRoom; if ((Object)(object)overrideExactRoom != (Object)null) { Tools.Log(((Object)overrideExactRoom).name, "roomnames.txt"); } if ((Object)(object)overrideExactRoom != (Object)null && ((Object)overrideExactRoom).name.ToLower().Equals(roomName)) { return overrideExactRoom; } } return null; } public static PrototypeDungeonRoom GetRoomFromDungeon(string roomName, int floor) { return GetRoomFromDungeon(roomName, dungeonPrefabNames[floor]); } public static DungeonFlowNode GetNodeFromDungeon(string roomName, string floor) { roomName = roomName.ToLower(); List<DungeonFlowNode> allFlowNodes = GetAllFlowNodes(floor); if (allFlowNodes == null) { return null; } foreach (DungeonFlowNode item in allFlowNodes) { PrototypeDungeonRoom overrideExactRoom = item.overrideExactRoom; if ((Object)(object)overrideExactRoom != (Object)null && ((Object)overrideExactRoom).name.ToLower().Equals(roomName)) { return item; } } return null; } public static List<DungeonFlowNode> GetAllFlowNodes(string floor) { Dungeon dungeonPrefab = GetDungeonPrefab(floor); List<DungeonFlowNode> allNodes = dungeonPrefab.PatternSettings.flows[0].AllNodes; for (int i = 1; i < dungeonPrefab.PatternSettings.flows.Count; i++) { allNodes.Concat(dungeonPrefab.PatternSettings.flows[i].AllNodes); } dungeonPrefab = null; return allNodes; } public static List<DungeonFlowNode> GetAllFlowNodes(int floor) { return GetAllFlowNodes(dungeonPrefabNames[floor]); } } public static class RoomFactory { public struct RoomData { public string category; public string normalSubCategory; public string specialSubCategory; public string bossSubCategory; public Vector2[] enemyPositions; public string[] enemyGUIDs; public Vector2[] placeablePositions; public string[] placeableGUIDs; public int[] enemyReinforcementLayers; public Vector2[] exitPositions; public string[] exitDirections; public string[] floors; public float weight; public bool isSpecialRoom; public bool randomizeEnemyPositions; public bool doFloorDecoration; public bool doWallDecoration; public bool doLighting; [NonSerialized] public PrototypeDungeonRoom room; } public static Dictionary<string, RoomData> rooms = new Dictionary<string, RoomData>(); public static Dictionary<string, RoomData> LoadedModeRooms = new Dictionary<string, RoomData>(); public static bool ImAddingThisBoolBecauseImLazy; private static readonly string dataHeader = "***DATA***"; private static FieldInfo m_cellData = typeof(PrototypeDungeonRoom).GetField("m_cellData", BindingFlags.Instance | BindingFlags.NonPublic); private static RoomEventDefinition sealOnEnterWithEnemies = new RoomEventDefinition((RoomEventTriggerCondition)3, (RoomEventTriggerAction)0); private static RoomEventDefinition unsealOnRoomClear = new RoomEventDefinition((RoomEventTriggerCondition)2, (RoomEventTriggerAction)1); public static void LoadRoomsFromRoomDirectory() { string zipFilePath = FrostandGunFireItems.ZipFilePath; string filePath = FrostandGunFireItems.FilePath; if (File.Exists(zipFilePath)) { ZipFile val = ZipFile.Read(zipFilePath); try { foreach (ZipEntry entry in val.Entries) { if (!entry.FileName.Contains("rooms") || ImAddingThisBoolBecauseImLazy) { continue; } ImAddingThisBoolBecauseImLazy = true; IEnumerable<RoomData> enumerable = BuildFromZipFile(zipFilePath); foreach (RoomData item in enumerable) { string name = ((Object)item.room).name; DungeonHandler.Register(item); rooms.Add(((Object)item.room).name, item); } } return; } finally { ((IDisposable)val)?.Dispose(); } } Directory.CreateDirectory(filePath); string[] files = Directory.GetFiles(filePath, "*", SearchOption.AllDirectories); foreach (string text in files) { if (text.EndsWith(".room", StringComparison.OrdinalIgnoreCase)) { string key = ETGMod.RemoveSuffix(ETGMod.RemovePrefix(Path.GetFullPath(text), filePath), ".room"); RoomData roomData = BuildFromRoomFile(text); DungeonHandler.Register(roomData); rooms.Add(key, roomData); } } } public static IEnumerable<RoomData> BuildFromZipFile(string zipFilePath) { if (!ZipFile.IsZipFile(zipFilePath)) { Tools.Log("Not a valid zip file!"); yield break; } ZipFile zipFile = ZipFile.Read(zipFilePath); try { foreach (ZipEntry entry in zipFile.Entries) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(entry.FileName); string extension = Path.GetExtension(entry.FileName); if (!string.Equals(extension, ".room", StringComparison.OrdinalIgnoreCase)) { continue; } int num = (int)entry.UncompressedSize; if (num >= 0) { byte[] array; using (MemoryStream memoryStream = new MemoryStream(num)) { entry.Extract((Stream)memoryStream); array = memoryStream.ToArray(); } Texture2D texture = ResourceExtractor.BytesToTexture(array, fileNameWithoutExtension); RoomData roomData = ExtractRoomDataFromBytes(array); roomData.room = Build(texture, roomData); yield return roomData; } } } finally { ((IDisposable)zipFile)?.Dispose(); } } public static RoomData BuildFromRoomFile(string roomPath) { Texture2D textureFromFile = ResourceExtractor.GetTextureFromFile(roomPath, ".room"); ((Object)textureFromFile).name = Path.GetFileName(roomPath); RoomData roomData = ExtractRoomDataFromFile(roomPath); roomData.room = Build(textureFromFile, roomData); return roomData; } public static RoomData BuildFromResource(string roomPath) { Texture2D textureFromResource = ResourceExtractor.GetTextureFromResource(roomPath); ((Object)textureFromResource).name = Path.GetFileName(roomPath); RoomData roomData = ExtractRoomDataFromResource(roomPath); roomData.room = Build(textureFromResource, roomData); return roomData; } public static PrototypeDungeonRoom Build(Texture2D texture, RoomData roomData) { try { PrototypeDungeonRoom val = CreateRoomFromTexture(texture); ApplyRoomData(val, roomData); val.UpdatePrecalculatedData(); return val; } catch (Exception e) { Tools.PrintException(e); } return CreateEmptyRoom(); } public static void ApplyRoomData(PrototypeDungeonRoom room, RoomData roomData) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00b3: 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_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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) if (roomData.exitPositions != null) { for (int i = 0; i < roomData.exitPositions.Length; i++) { Direction direction = (Direction)Enum.Parse(typeof(Direction), roomData.exitDirections[i].ToUpper()); AddExit(room, roomData.exitPositions[i], direction); } } else { AddExit(room, new Vector2((float)(room.Width / 2), (float)room.Height), (Direction)0); AddExit(room, new Vector2((float)(room.Width / 2), 0f), (Direction)4); AddExit(room, new Vector2((float)room.Width, (float)(room.Height / 2)), (Direction)2); AddExit(room, new Vector2(0f, (float)(room.Height / 2)), (Direction)6); } if (roomData.enemyPositions != null) { for (int j = 0; j < roomData.enemyPositions.Length; j++) { AddEnemyToRoom(room, roomData.enemyPositions[j], roomData.enemyGUIDs[j], roomData.enemyReinforcementLayers[j], roomData.randomizeEnemyPositions); } } if (roomData.placeablePositions != null) { for (int k = 0; k < roomData.placeablePositions.Length; k++) { AddPlaceableToRoom(room, roomData.placeablePositions[k], roomData.placeableGUIDs[k]); } } if (roomData.floors != null) { string[] floors = roomData.floors; foreach (string val in floors) { room.prerequisites.Add(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)3, requiredTileset = ShrineTools.GetEnumValue<ValidTilesets>(val) }); } } if (!string.IsNullOrEmpty(roomData.category)) { room.category = ShrineTools.GetEnumValue<RoomCategory>(roomData.category); } if (!string.IsNullOrEmpty(roomData.normalSubCategory)) { room.subCategoryNormal = ShrineTools.GetEnumValue<RoomNormalSubCategory>(roomData.normalSubCategory); } if (!string.IsNullOrEmpty(roomData.bossSubCategory)) { room.subCategoryBoss = ShrineTools.GetEnumValue<RoomBossSubCategory>(roomData.bossSubCategory); } if (!string.IsNullOrEmpty(roomData.specialSubCategory)) { room.subCategorySpecial = ShrineTools.GetEnumValue<RoomSpecialSubCategory>(roomData.specialSubCategory); } room.usesProceduralDecoration = true; room.allowFloorDecoration = roomData.doFloorDecoration; room.allowWallDecoration = roomData.doWallDecoration; room.usesProceduralLighting = roomData.doLighting; } public static RoomData ExtractRoomDataFromBytes(byte[] data) { string data2 = ResourceExtractor.BytesToString(data); return ExtractRoomData(data2); } public static RoomData ExtractRoomDataFromFile(string path) { byte[] data = File.ReadAllBytes(path); return ExtractRoomDataFromBytes(data); } public static RoomData ExtractRoomDataFromResource(string path) { byte[] data = ResourceExtractor.ExtractEmbeddedResource(path); return ExtractRoomDataFromBytes(data); } public static RoomData ExtractRoomData(string data) { int num = data.Length - dataHeader.Length - 1; for (int num2 = num; num2 > 0; num2--) { string text = data.Substring(num2, dataHeader.Length); if (text.Equals(dataHeader)) { return JsonUtility.FromJson<RoomData>(data.Substring(num2 + dataHeader.Length)); } } ShrineTools.Log("No room data found at " + data); return default(RoomData); } public static PrototypeDungeonRoom CreateRoomFromTexture(Texture2D texture) { //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) int width = ((Texture)texture).width; int height = ((Texture)texture).height; PrototypeDungeonRoom newPrototypeDungeonRoom = GetNewPrototypeDungeonRoom(width, height); PrototypeDungeonRoomCellData[] array = (PrototypeDungeonRoomCellData[])(object)new PrototypeDungeonRoomCellData[width * height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { array[i + j * width] = CellDataFromColor(Color32.op_Implicit(texture.GetPixel(i, j))); } } newPrototypeDungeonRoom.FullCellData = array; ((Object)newPrototypeDungeonRoom).name = ((Object)texture).name; return newPrototypeDungeonRoom; } public static PrototypeDungeonRoomCellData CellDataFromColor(Color32 color) { //IL_0002: 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_0021: Expected O, but got Unknown //IL_0022: 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_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_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_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) //IL_0055: Expected O, but got Unknown if (((object)(Color32)(ref color)).Equals((object?)Color.magenta)) { return null; } PrototypeDungeonRoomCellData val = new PrototypeDungeonRoomCellData(); val.state = TypeFromColor(Color32.op_Implicit(color)); val.diagonalWallType = DiagonalWallTypeFromColor(Color32.op_Implicit(color)); val.appearance = new PrototypeDungeonRoomCellAppearance { OverrideFloorType = (CellFloorType)0 }; return val; } public static CellType TypeFromColor(Color color) { //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_000f: 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) if (!(color == Color.black)) { if (!(color == Color.white)) { return (CellType)1; } return (CellType)2; } return (CellType)4; } public static DiagonalWallType DiagonalWallTypeFromColor(Color color) { //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_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) if (!(color == Color.red)) { if (!(color == Color.green)) { if (!(color == Color.blue)) { if (!(color == Color.yellow)) { return (DiagonalWallType)0; } return (DiagonalWallType)4; } return (DiagonalWallType)3; } return (DiagonalWallType)2; } return (DiagonalWallType)1; } public static RoomData CreateEmptyRoomData(int width = 12, int height = 12) { RoomData result = default(RoomData); result.room = CreateEmptyRoom(width, height); result.category = "NORMAL"; result.weight = 9999f; return result; } public static PrototypeDungeonRoom CreateEmptyRoom(int width = 12, int height = 12) { //IL_000f: 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_0036: 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) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_009d: Expected O, but got Unknown try { PrototypeDungeonRoom newPrototypeDungeonRoom = GetNewPrototypeDungeonRoom(width, height); AddExit(newPrototypeDungeonRoom, new Vector2((float)(width / 2), (float)height), (Direction)0); AddExit(newPrototypeDungeonRoom, new Vector2((float)(width / 2), 0f), (Direction)4); AddExit(newPrototypeDungeonRoom, new Vector2((float)width, (float)(height / 2)), (Direction)2); AddExit(newPrototypeDungeonRoom, new Vector2(0f, (float)(height / 2)), (Direction)6); PrototypeDungeonRoomCellData[] array = m_cellData.GetValue(newPrototypeDungeonRoom) as PrototypeDungeonRoomCellData[]; array = (PrototypeDungeonRoomCellData[])(object)new PrototypeDungeonRoomCellData[width * height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { array[i + j * width] = new PrototypeDungeonRoomCellData { state = (CellType)2, appearance = new PrototypeDungeonRoomCellAppearance { OverrideFloorType = (CellFloorType)0 } }; } } m_cellData.SetValue(newPrototypeDungeonRoom, array); newPrototypeDungeonRoom.UpdatePrecalculatedData(); return newPrototypeDungeonRoom; } catch (Exception e) { Tools.PrintException(e); return null; } } public static int GetStyleValue(string dungeonName, string shrineID) { if (OldShrineFactory.builtShrines != null && OldShrineFactory.builtShrines.ContainsKey(shrineID)) { GameObject obj = OldShrineFactory.builtShrines[shrineID]; ShrineFactory.CustomShrineController customShrineController = ((obj != null) ? obj.GetComponent<ShrineFactory.CustomShrineController>() : null); if ((Object)(object)customShrineController != (Object)null && customShrineController.roomStyles != null && customShrineController.roomStyles.ContainsKey(dungeonName)) { return customShrineController.roomStyles[dungeonName]; } } return -1; } public static void AddPlaceableToRoom(PrototypeDungeonRoom room, Vector2 location, string assetPath) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00e5: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing re