public static void OnHealthHaverDie(Action <HealthHaver, Vector2> orig, HealthHaver self, Vector2 finalDamageDir) { if (self.aiActor && self.specRigidbody) { string enemyGuid = self.aiActor.EnemyGuid; bool isJammed = self.aiActor.IsBlackPhantom; bool isCharmed = self.aiActor.CanTargetEnemies && !self.aiActor.CanTargetPlayers; bool isFloorBossOutsideTutorial = self.IsBoss && !self.IsSubboss && !GameManager.Instance.InTutorial; bool isValidForMutagen = false; bool usingDog = false; bool usingShade = false; Vector2 deathPosition = self.specRigidbody.UnitCenter; float deceasedEnemyMaxHealth = self.healthHaver.GetMaxHealth(); List <PlayableCharacters> activeCharacters = new List <PlayableCharacters>(); foreach (var item in GameManager.Instance.AllPlayers) { if (!item) { continue; } isValidForMutagen |= item.healthHaver && ((item.healthHaver.GetCurrentHealth() <= 0f && item.healthHaver.Armor == 1) || (item.healthHaver.GetCurrentHealth() <= 0.5f && item.healthHaver.Armor == 0)); activeCharacters.Add(item.characterIdentity); usingDog |= item.HasPickupID(300); // dog usingShade |= item.ModdedCharacterIdentity() == ModdedCharacterID.Shade; // this also asks player2 but that doesn't hurt } ETGMod.StartGlobalCoroutine(SaveDeathsForUnlocks(enemyGuid, isJammed, isCharmed, isFloorBossOutsideTutorial, isValidForMutagen, usingDog, usingShade, activeCharacters)); if (!isCharmed) { ETGMod.StartGlobalCoroutine(HandleCurseDeathEffects(deathPosition, enemyGuid, deceasedEnemyMaxHealth, isJammed)); } } orig(self, finalDamageDir); }
// Example commands void Echo(string[] args) { if (string.Join(" ", args) == "the magic word") { ETGMod.SayTheMagicWord(); return; } if (string.Join(" ", args) == "Keep singing, woah, I keep singing") { ETGMod.KeepSinging(); Log("Keep singing, woah, I keep singing\nPraising to the heavens with my voice ringing\nKeep singing, woah, I keep singing\nClap to the beat till my hands are stinging\nAnd I'd be saved some sunny day\nFrom throwing my life, throwing my life away"); ETGModLoaderMenu.Instance.KeepSinging(); return; } StringBuilder combined = new StringBuilder(); for (int i = 0; i < args.Length; i++) { combined.Append(args[i]); if (i < args.Length - 1) { combined.Append(' '); } } string str = combined.ToString(); Debug.Log(str); Log(str); }
void Update() { if (projectile) { Vector2 position = projectile.specRigidbody.UnitCenter; Vector2 direction = projectile.LastVelocity.normalized; int thePointOfTheMaskIs = CollisionMask.LayerToMask(CollisionLayer.HighObstacle, CollisionLayer.BulletBlocker, CollisionLayer.EnemyHitBox, CollisionLayer.BulletBreakable); PhysicsEngine.Instance.Raycast(position, direction, 100f, out RaycastResult result, true, true, thePointOfTheMaskIs); if (result != null && result.Contact != null) { tk2dTiledSprite component = SpawnManager.SpawnVFX(linkVFXPrefab, false).GetComponent <tk2dTiledSprite>(); PostBeamRender(component); Vector2 unitCenter = position; Vector2 unitCenter2 = result.Contact; component.transform.position = unitCenter; Vector2 vector = unitCenter2 - unitCenter; float num = BraveMathCollege.Atan2Degrees(vector.normalized); int num2 = Mathf.RoundToInt(vector.magnitude / 0.0625f); component.dimensions = new Vector2((float)num2, component.dimensions.y); component.transform.rotation = Quaternion.Euler(0f, 0f, num); component.UpdateZDepth(); ETGMod.StartGlobalCoroutine(doTimerMagic(component.gameObject, wait)); OnBeamHit(result.Contact, projectile); } projectile.DieInAir(); } }
public override void Start() { ItemBuilder.Init(); CrossChamber.Init(); LichsBookItem.Init(); LichsGun.Init(); CustomSynergies.Add("Master of Gungeon", new List <string> { "spapi:lichs_gun", "spapi:lichs_book", "lichs_eye_bullets" }); CustomSynergies.Add("Baby Peacemaker", new List <string> { "spapi:cross_chamber", "magnum" }); Hook getNicknamehook = new Hook( typeof(StringTableManager).GetMethod("GetTalkingPlayerNick", BindingFlags.NonPublic | BindingFlags.Static), typeof(LichModule).GetMethod("GetTalkingPlayerNickHook") ); Hook getNamehook = new Hook( typeof(StringTableManager).GetMethod("GetTalkingPlayerName", BindingFlags.NonPublic | BindingFlags.Static), typeof(LichModule).GetMethod("GetTalkingPlayerNameHook") ); Hook getValueHook = new Hook( typeof(dfLanguageManager).GetMethod("GetValue", BindingFlags.Public | BindingFlags.Instance), typeof(LichModule).GetMethod("GetValueHook") ); ETGMod.StartGlobalCoroutine(this.DelayedStartCR()); }
public override void Pickup(PlayerController player) { base.Pickup(player); player.ownerlessStatModifiers.Add(modifier); player.stats.RecalculateStats(player); ETGMod.StartGlobalCoroutine(Enumerator(player)); }
protected override void DoEffect(PlayerController user) { AkSoundEngine.PostEvent("Play_WPN_Gun_Musical_01", gameObject); Exploder.DoRadialKnockback(user.CenterPosition, 100f, 15f); this.Collide1(15f); ETGMod.SayTheMagicWord(); ETGMod.KeepSinging(); }
public static void Init(string prefix) { CharApi.prefix = prefix; CharApiHiveMind.Init(prefix); Hooks.Init(); ToolsCharApi.Init(); ETGMod.StartGlobalCoroutine(DelayedStartCR()); //SaveFileBullShit.Load(); }
private static IEnumerator DelayedLoadMods() { Debug.Log("Mods.txt is bad - starting to load mods."); List <string> mods = new List <string>(); string[] array = Directory.GetFiles(ETGMod.ModsDirectory); for (int i = 0; i < array.Length; i++) { string fileName = Path.GetFileName(array[i]); if (fileName.EndsWithInvariant(".zip")) { mods.Add(fileName); } } array = Directory.GetDirectories(ETGMod.ModsDirectory); for (int j = 0; j < array.Length; j++) { string fileName2 = Path.GetFileName(array[j]); if (!(fileName2 == "RelinkCache")) { mods.Add(fileName2); } } if (File.Exists(ETGMod.ModsListFile)) { foreach (string text in File.ReadAllLines(ETGMod.ModsListFile)) { if (!string.IsNullOrEmpty(text) && text[0] != '#') { if (mods.Contains(text)) { mods.Remove(text); } } } } foreach (string text2 in mods) { if (!string.IsNullOrEmpty(text2) && text2[0] != '#') { try { InitMod(text2.Trim()); } catch (Exception e) { Debug.LogError("Mods.txt is bad could not load mod " + text2 + "! Check your output log / player log."); ETGMod.LogDetailed(e, null); } } } Debug.Log("Mods.txt is bad - calling Init() in loaded mods."); CallInNewModules("Init", null); Debug.Log("Mods.txt is bad - finished."); yield break; }
public void Awake() { DontDestroyOnLoad(gameObject); #pragma warning disable CS0618 ETGMod.StartCoroutine = StartCoroutine; #pragma warning restore CS0618 ETGMod.StartGlobalCoroutine = StartCoroutine; ETGMod.StopGlobalCoroutine = StopCoroutine; ETGMod.Init(); }
private void Update() { if (!generationRunning) { if (timer >= 0) { timer -= BraveTime.DeltaTime; } else { ETGMod.StartGlobalCoroutine(HandleGeneration()); } } }
// Token: 0x06000097 RID: 151 RVA: 0x00007E60 File Offset: 0x00006060 public static void SetProjectileSpriteRight(this Projectile proj, string name, int pixelWidth, int pixelHeight, bool lightened = true, tk2dBaseSprite.Anchor anchor = tk2dBaseSprite.Anchor.LowerLeft, int?overrideColliderPixelWidth = null, int?overrideColliderPixelHeight = null, int?overrideColliderOffsetX = null, int?overrideColliderOffsetY = null, Projectile overrideProjectileToCopyFrom = null) { try { ETGMod.GetAnySprite(proj).spriteId = ETGMod.Databases.Items.ProjectileCollection.inst.GetSpriteIdByName(name); tk2dSpriteDefinition tk2dSpriteDefinition = GunTools.SetupDefinitionForProjectileSprite(name, ETGMod.GetAnySprite(proj).spriteId, pixelWidth, pixelHeight, lightened, overrideColliderPixelWidth, overrideColliderPixelHeight, overrideColliderOffsetX, overrideColliderOffsetY, overrideProjectileToCopyFrom); tk2dSpriteDefinition.ConstructOffsetsFromAnchor(anchor, tk2dSpriteDefinition.position3); } catch (Exception ex) { ETGModConsole.Log("Ooops! Seems like something got very, Very, VERY wrong. Here's the exception:", false); ETGModConsole.Log(ex.ToString(), false); } }
public override void Init() { ETGMod.StartGlobalCoroutine(DelayedLoadMods()); }
public override void Start() { try { ETGModConsole.Log("Once More Into The Breach started initialising..."); //Rooms ZipFilePath = this.Metadata.Archive; FilePath = this.Metadata.Directory + "/rooms"; ModName = this.Metadata.Name; //Tools and Toolboxes StaticReferences.Init(); ExoticPlaceables.Init(); DungeonHandler.Init(); Tools.Init(); ShrineFakePrefabHooks.Init(); ShrineFactory.Init(); OldShrineFactory.Init(); FakePrefabHooks.Init(); ItemBuilder.Init(); CharApi.Init("nn"); CustomClipAmmoTypeToolbox.Init(); EnemyTools.Init(); NpcApi.Hooks.Init(); EnemyAPI.Hooks.Init(); SaveAPIManager.Setup("nn"); AudioResourceLoader.InitAudio(); CurseManager.Init(); ETGModMainBehaviour.Instance.gameObject.AddComponent <GlobalUpdate>(); ETGModMainBehaviour.Instance.gameObject.AddComponent <CustomDarknessHandler>(); GameOfLifeHandler.Init(); //ETGModMainBehaviour.Instance.gameObject.AddComponent<GameOfLifeHandler>(); //ETGModConsole.Log(Assembly.GetExecutingAssembly().FullName); //Challenges Challenges.Init(); //Hooks n Shit PlayerToolsSetup.Init(); EnemyHooks.InitEnemyHooks(); CompanionisedEnemyUtility.InitHooks(); MiscUnlockHooks.InitHooks(); FloorAndGenerationToolbox.Init(); PedestalHooks.Init(); ExplosionHooks.Init(); ChestToolbox.Inithooks(); UIHooks.Init(); ComplexProjModBeamCompatibility.Init(); ReloadBreachShrineHooks.Init(); metadata = this.Metadata; //VFX Setup VFXToolbox.InitVFX(); EasyVFXDatabase.Init(); //Needs to occur before goop definition ShadeFlightHookFix.Init(); //Status Effect Setup StaticStatusEffects.InitCustomEffects(); PlagueStatusEffectSetup.Init(); Confusion.Init(); //Goop Setup EasyGoopDefinitions.DefineDefaultGoops(); DoGoopEffectHook.Init(); //Commands and Other Console Utilities Commands.Init(); //Hats HatUtility.NecessarySetup(); HatDefinitions.Init(); //Gamemodes AllJammedState.Init(); JammedChests.Init(); //Exotic Object Shit //VFX LockdownStatusEffect.Initialise(); //Testing / Debug Items ActiveTestingItem.Init(); PassiveTestingItem.Init(); BulletComponentLister.Init(); ObjectComponentLister.Init(); //-----------------------------------------------------ITEMS GET INITIALISED #region ItemInitialisation //Character Starters ShadeHand.Init(); ShadeHeart.Init(); //Egg Salad and Prima Bean can go here, because they were the first EggSalad.Init(); PrimaBean.Init(); //Bullet modifiers BashingBullets.Init(); TitanBullets.Init(); MistakeBullets.Init(); FiftyCalRounds.Init(); UnengravedBullets.Init(); EngravedBullets.Init(); HardReloadBullets.Init(); NitroBullets.Init(); SupersonicShots.Init(); GlassRounds.Init(); Junkllets.Init(); BloodthirstyBullets.Init(); CleansingRounds.Init(); HallowedBullets.Init(); PromethianBullets.Init(); EpimethianBullets.Init(); RandoRounds.Init(); IngressBullets.Init(); //Unfinished HematicRounds.Init(); FullArmourJacket.Init(); MirrorBullets.Init(); CrowdedClip.Init(); BashfulShot.Init(); OneShot.Init(); BulletBullets.Init(); AntimatterBullets.Init(); SpectreBullets.Init(); Tabullets.Init(); TierBullets.Init(); //Unfinished BombardierShells.Init(); GildedLead.Init(); DemoterBullets.Init(); Voodoollets.Init(); TracerRound.Init(); EndlessBullets.Init(); HellfireRounds.Init(); Birdshot.Init(); Unpredictabullets.Init(); WarpBullets.Init(); BulletsWithGuns.Init(); LaserBullets.Init(); BalancedBullets.Init(); //Unfinished WoodenBullets.Init(); ComicallyGiganticBullets.Init(); //Excluded KnightlyBullets.Init(); EmptyRounds.Init(); LongswordShot.Init(); DrillBullets.Init(); FoamDarts.Init(); BatterBullets.Init(); ElectrumRounds.Init(); BreachingRounds.Init(); MagnetItem.Init(); EargesplittenLoudenboomerRounds.Init(); TheShell.Init(); //Status Effect Bullet Mods SnailBullets.Init(); LockdownBullets.Init(); PestiferousLead.Init(); Shrinkshot.Init(); //Volley Modifying Bullet Mods Splattershot.Init(); BackwardsBullets.Init(); CrossBullets.Init(); ShadeShot.Init(); //Insta-Kill Bullet Modifiers MinersBullets.Init(); AntimagicRounds.Init(); AlkaliBullets.Init(); ShutdownShells.Init(); ERRORShells.Init(); OsteoporosisBullets.Init(); //NonBullet Stat Changers MicroAIContact.Init(); LuckyCoin.Init(); IronSights.Init(); Lewis.Init(); MysticOil.Init(); VenusianBars.Init(); NumberOneBossMug.Init(); LibramOfTheChambers.Init(); OrganDonorCard.Init(); GlassGod.Init(); ChaosRuby.Init(); BlobulonRage.Init(); OverpricedHeadband.Init(); GunslingerEmblem.Init(); MobiusClip.Init(); ClipOnAmmoPouch.Init(); JawsOfDefeat.Init(); //Armour ArmourBandage.Init(); GoldenArmour.Init(); ExoskeletalArmour.Init(); PowerArmour.Init(); ArmouredArmour.Init(); //Consumable Givers LooseChange.Init(); SpaceMetal.Init(); //Blank Themed Items TrueBlank.Init(); FalseBlank.Init(); SpareBlank.Init(); OpulentBlank.Init(); GrimBlanks.Init(); NNBlankPersonality.Init(); Blombk.Init(); Blankh.Init(); //Key Themed Items BlankKey.Init(); SharpKey.Init(); SpareKey.Init(); KeyChain.Init(); KeyBullwark.Init(); KeyBulletEffigy.Init(); FrostKey.Init(); ShadowKey.Init(); Keygen.Init(); CursedTumbler.Init(); //Ammo Box Themed Items TheShellactery.Init(); BloodyAmmo.Init(); MengerAmmoBox.Init(); AmmoTrap.Init(); //Boxes and Stuff BloodyBox.Init(); MaidenShapedBox.Init(); Toolbox.Init(); PocketChest.Init(); DeliveryBox.Init(); Wonderchest.Init(); //Heart themed items HeartPadlock.Init(); Mutagen.Init(); ForsakenHeart.Init(); HeartOfGold.Init(); GooeyHeart.Init(); ExaltedHeart.Init(); CheeseHeart.Init(); TinHeart.Init(); //Chambers BarrelChamber.Init(); GlassChamber.Init(); FlameChamber.Init(); Recyclinder.Init(); Nitroglycylinder.Init(); SpringloadedChamber.Init(); WitheringChamber.Init(); HeavyChamber.Init(); CyclopeanChamber.Init(); //Table Techs TableTechTable.Init(); TableTechSpeed.Init(); TableTechInvulnerability.Init(); TableTechAmmo.Init(); TableTechGuon.Init(); TableTechNology.Init(); UnsTableTech.Init(); //Guon Stones WoodGuonStone.Init(); YellowGuonStone.Init(); GreyGuonStone.Init(); GoldGuonStone.Init(); BrownGuonStone.Init(); CyanGuonStone.Init(); IndigoGuonStone.Init(); SilverGuonStone.Init(); MaroonGuonStone.Init(); UltraVioletGuonStone.Init(); InfraredGuonStone.Init(); RainbowGuonStone.Init(); KaleidoscopicGuonStone.Init(); GuonBoulder.Init(); BloodglassGuonStone.Init(); //Ammolets GlassAmmolet.Init(); WickerAmmolet.Init(); FuriousAmmolet.Init(); SilverAmmolet.Init(); IvoryAmmolet.Init(); KinAmmolet.Init(); Autollet.Init(); Keymmolet.Init(); Ammolock.Init(); HepatizonAmmolet.Init(); BronzeAmmolet.Init(); PearlAmmolet.Init(); NeutroniumAmmolet.Init(); Shatterblank.Init(); // Boots CycloneCylinder.Init(); BootLeg.Init(); BlankBoots.Init(); BulletBoots.Init(); //Bracelets and Jewelry DiamondBracelet.Init(); PearlBracelet.Init(); PanicPendant.Init(); GunknightAmulet.Init(); AmuletOfShelltan.Init(); //Rings RingOfOddlySpecificBenefits.Init(); FowlRing.Init(); RingOfAmmoRedemption.Init(); RiskyRing.Init(); WidowsRing.Init(); ShadowRing.Init(); RingOfInvisibility.Init(); //Holsters BlackHolster.Init(); TheBeholster.Init(); HiveHolster.Init(); ShoulderHolster.Init(); ArtilleryBelt.Init(); BulletShuffle.Init(); //Companions MolotovBuddy.Init(); BabyGoodChanceKin.Init(); Potty.Init(); Peanut.Init(); DarkPrince.Init(); Diode.Init(); DroneCompanion.Init(); GregTheEgg.Init(); FunGuy.Init(); BabyGoodDet.Init(); AngrySpirit.Init(); Gusty.Init(); ScrollOfExactKnowledge.Init(); LilMunchy.Init(); //Potions / Jars SpeedPotion.Init(); LovePotion.Init(); HoneyPot.Init(); ChemicalBurn.Init(); WitchsBrew.Init(); Nigredo.Init(); Albedo.Init(); Citrinitas.Init(); Rubedo.Init(); HoleyWater.Init(); //Remotes ReinforcementRadio.Init(); //Medicine BloodThinner.Init(); BoosterShot.Init(); ShotInTheArm.Init(); //Knives and Blades DaggerOfTheAimgel.Init(); CombatKnife.Init(); Bayonet.Init(); //Books BookOfMimicAnatomy.Init(); KalibersPrayer.Init(); GunidaeSolvitHaatelis.Init(); //Maps MapFragment.Init(); TatteredMap.Init(); //Clothing CloakOfDarkness.Init(); TimeFuddlersRobe.Init(); //Eyes CartographersEye.Init(); BloodshotEye.Init(); ShadesEye.Init(); KalibersEye.Init(); //Hands Lefthandedness.Init(); NecromancersRightHand.Init(); //Bombs InfantryGrenade.Init(); DiceGrenade.Init(); //True Misc Lvl2Molotov.Init(); GoldenAppleCore.Init(); AppleCore.Init(); AppleActive.Init(); LibationtoIcosahedrax.Init(); //Unfinished BagOfHolding.Init(); ItemCoupon.Init(); IdentityCrisis.Init(); LiquidMetalBody.Init(); GunGrease.Init(); BomberJacket.Init(); DragunsScale.Init(); GTCWTVRP.Init(); BlightShell.Init(); BulletKinPlushie.Init(); Kevin.Init(); PurpleProse.Init(); RustyCasing.Init(); HikingPack.Init(); GunpowderPheromones.Init(); GunsmokePerfume.Init(); Pestilence.Init(); ElevatorButton.Init(); Bullut.Init(); GSwitch.Init(); FaultyHoverboots.Init(); //Unfinished AcidAura.Init(); HornedHelmet.Init(); RocketMan.Init(); Roulette.Init(); //Unfinished FinishedBullet.Init(); ChanceKinEffigy.Init(); MagickeCauldron.Init(); Bombinomicon.Init(); ClaySculpture.Init(); GracefulGoop.Init(); MrFahrenheit.Init(); MagicQuiver.Init(); FocalLenses.Init(); MagicMissile.Init(); AmberDie.Init(); ObsidianPistol.Init(); Showdown.Init(); LootEngineItem.Init(); Ammolite.Init(); PortableHole.Init(); CardinalsMitre.Init(); GunjurersBelt.Init(); GoomperorsCrown.Init(); ChemGrenade.Init(); EightButton.Init(); TitaniumClip.Init(); PaperBadge.Init(); Permafrost.Init(); GlassShard.Init(); EqualityItem.Init(); BitBucket.Init(); Eraser.Init(); TackShooter.Init(); Moonrock.Init(); Telekinesis.Init(); TabletOfOrder.Init(); LeadSoul.Init(); LeadOfLife.Init(); AWholeBulletKin.Init(); #endregion //-----------------------------------------------------GUNS GET INITIALISED #region GunInitialisation //UNFINISHED / TEST GUNS WailingMagnum.Add(); Defender.Add(); TestGun.Add(); Gunycomb.Add(); GlobbitSMALL.Add(); GlobbitMED.Add(); GlobbitMEGA.Add(); //GUNS //CHARACTERSTARTERS ElderMagnum.Add(); //REVOLVERS FlayedRevolver.Add(); G20.Add(); MamaGun.Add(); LovePistol.Add(); DiscGun.Add(); Repeatovolver.Add(); Pista.Add(); NNGundertale.Add(); DiamondGun.Add(); NNMinigun.Add(); ShroomedGun.Add(); GoldenRevolver.Add(); Nocturne.Add(); BackWarder.Add(); Redhawk.Add(); ToolGun.Add(); //GENERAL HANDGUNS StickGun.Add(); Glock42.Add(); StarterPistol.Add(); PopGun.Add(); UnusCentum.Add(); StunGun.Add(); CopperSidearm.Add(); Rekeyter.Add(); HotGlueGun.Add(); UpNUp.Add(); RedRobin.Add(); VariableGun.Add(); CrescendoBlaster.Add(); Glasster.Add(); HandGun.Add(); Viper.Add(); DiamondCutter.Add(); MarchGun.Add(); RebarGun.Add(); MinuteGun.Add(); Ulfberht.Add(); HeadOfTheOrder.Add(); GunOfAThousandSins.Add(); DoubleGun.Add(); //SHOTGUNS JusticeGun.Add(); Orgun.Add(); Octagun.Add(); ClownShotgun.Add(); Ranger.Add(); RustyShotgun.Add(); TheBride.Add(); TheGroom.Add(); IrregularShotgun.Add(); GrenadeShotgun.Add(); Jackhammer.Add(); SaltGun.Add(); SoapGun.Add(); //CANNONS Felissile.Add(); HandCannon.Add(); Lantaka.Add(); GreekFire.Add(); EmberCannon.Add(); ElysiumCannon.Add(); DisplacerCannon.Add(); //SCI-FI GUNS Blasmaster.Add(); St4ke.Add(); RedBlaster.Add(); BeamBlade.Add(); Neutrino.Add(); Rico.Add(); TheThinLine.Add(); RocketPistol.Add(); Repetitron.Add(); Dimensionaliser.Add(); Purpler.Add(); VacuumGun.Add(); Oxygun.Add(); TriBeam.Add(); KineticBlaster.Add(); LaserWelder.Add(); QBeam.Add(); HighVelocityRifle.Add(); Demolitionist.Add(); PumpChargeShotgun.Add(); TheOutbreak.Add(); Multiplicator.Add(); PunishmentRay.Add(); YBeam.Add(); WallRay.Add(); BolaGun.Add(); AlphaBeam.Add(); Glazerbeam.Add(); StasisRifle.Add(); Gravitron.Add(); Ferrobolt.Add(); TauCannon.Add(); GravityGun.Add(); GalaxyCrusher.Add(); //ARC Weapons ARCPistol.Add(); ARCShotgun.Add(); ARCRifle.Add(); ARCTactical.Add(); ARCCannon.Add(); //BOWS AND CROSSBOWS IceBow.Add(); Boltcaster.Add(); Clicker.Add(); //ANTIQUES WheelLock.Add(); Welrod.Add(); Welgun.Add(); TheLodger.Add(); Gonne.Add(); Hwacha.Add(); FireLance.Add(); HandMortar.Add(); GrandfatherGlock.Add(); GatlingGun.Add(); Blowgun.Add(); Gaxe.Add(); WoodenHorse.Add(); AgarGun.Add(); //KNIVES AND BLADES Carnwennan.Add(); MantidAugment.Add(); //REALISTIC GUNS HeatRay.Add(); BarcodeScanner.Add(); AntimaterielRifle.Add(); Primos1.Add(); DartRifle.Add(); AM0.Add(); RiskRifle.Add(); RiotGun.Add(); Kalashnirang.Add(); MaidenRifle.Add(); Blizzkrieg.Add(); Copygat.Add(); Skorpion.Add(); HeavyAssaultRifle.Add(); DynamiteLauncher.Add(); MarbledUzi.Add(); BurstRifle.Add(); OlReliable.Add(); //MISSILE LAUNCHERS BottleRocket.Add(); NNBazooka.Add(); BoomBeam.Add(); Pillarocket.Add(); //ANIMAL / ORGANIC GUNS SporeLauncher.Add(); PoisonDartFrog.Add(); Corgun.Add(); FungoCannon.Add(); PhaserSpiderling.Add(); Guneonate.Add(); KillithidTendril.Add(); Gunger.Add(); SickWorm.Add(); MiniMonger.Add(); CarrionFormeTwo.Add(); CarrionFormeThree.Add(); Carrion.Add(); UterinePolyp.Add(); Wrinkler.Add(); //BLADES ButchersKnife.Add(); RapidRiposte.Add(); //FUN GUNS Gumgun.Add(); Glooper.Add(); Accelerator.Add(); PaintballGun.Add(); Converter.Add(); Spiral.Add(); Gunshark.Add(); FingerGuns.Add(); OBrienFist.Add(); GolfRifle.Add(); Pandephonium.Add(); Sweeper.Add(); DeskFan.Add(); Pencil.Add(); SquarePeg.Add(); Ringer.Add(); Snaker.Add(); GayK47.Add(); DecretionCarbine.Add(); RC360.Add(); UziSpineMM.Add(); Autogun.Add(); Rebondir.Add(); BigShot.Add(); W3irdstar.Add(); Seismograph.Add(); BioTranstater2100.Add(); //MAGICAL GUNS Icicle.Add(); GunjurersStaff.Add(); InitiateWand.Add(); LightningRod.Add(); OrbOfTheGun.Add(); SpearOfJustice.Add(); Protean.Add(); BulletBlade.Add(); Bookllet.Add(); Lorebook.Add(); Beastclaw.Add(); Bullatterer.Add(); Entropew.Add(); Missinguno.Add(); Paraglocks.Add(); //CONSUMABLE FIRING GUNS Creditor.Add(); Blankannon.Add(); Viscerifle.Add(); //ENDPAGE GUNS MastersGun.Add(); Wrench.Add(); Pumhart.Add(); //SYNERGY FORME GUNS GunsharkMegasharkSynergyForme.Add(); DiscGunSuperDiscForme.Add(); OrgunHeadacheSynergyForme.Add(); Wolfgun.Add(); MinigunMiniShotgunSynergyForme.Add(); PenPencilSynergy.Add(); ReShelletonKeyter.Add(); AM0SpreadForme.Add(); BulletBladeGhostForme.Add(); GlueGunGlueGunnerSynergy.Add(); KingBullatterer.Add(); WrenchNullRefException.Add(); GatlingGunGatterUp.Add(); GravityGunNegativeMatterForm.Add(); GonneElder.Add(); UterinePolypWombular.Add(); DiamondGaxe.Add(); RedRebondir.Add(); DiamondCutterRangerClass.Add(); StickGunQuickDraw.Add(); StormRod.Add(); UnrustyShotgun.Add(); #endregion //-----------------------------------------------------SHRINES GET INITIALISED #region ShrineInitialisation InvestmentShrine.Add(); RelodinShrine.Add(); DagunShrine.Add(); ArtemissileShrine.Add(); ExecutionerShrine.Add(); TurtleShrine.Add(); KliklokShrine.Add(); #endregion //-----------------------------------------------------NPCS GET INITIALISED #region NPCInitialisation Rusty.Init(); Ironside.Init(); Boomhildr.Init(); #endregion ChromaGun.Add(); //GOOD MIMIC (NEEDS TO BE INITIALISED LATER) GoodMimic.Add(); //Characters var data = Loader.BuildCharacter("NevernamedsItems/Characters/Shade", CustomPlayableCharacters.Shade, new Vector3(12.3f, 21.3f), false, new Vector3(13.1f, 19.1f), false, false, true, true, //Sprites used by paradox false, //Glows null, //Glow Mat null, //Alt Skin Glow Mat 0, //Hegemony Cost false, //HasPast ""); //Past ID String //Other Features MasteryReplacementOub.InitDungeonHook(); CadenceAndOxShopPoolAdditions.Init(); CustomHuntingQuest.Init(); //NPCS TheJammomaster.Add(); //Carto.Add(); ShrineFactory.PlaceBreachShrines(); //Synergy Setup, Synergy Formes, Dual Wielding, and any changes to Basegame Guns InitialiseSynergies.DoInitialisation(); SynergyFormInitialiser.AddSynergyForms(); ExistantGunModifiers.Init(); ChamberGunAPI.Init("OnceMoreIntoTheBreach"); //Late Hooks AmmoPickupHooks.Init(); HealthPickupHooks.Init(); ETGModConsole.Commands.AddUnit("nndebugflow", (args) => { DungeonHandler.debugFlow = !DungeonHandler.debugFlow; string status = DungeonHandler.debugFlow ? "enabled" : "disabled"; string color = DungeonHandler.debugFlow ? "00FF00" : "FF0000"; ETGModConsole.Log($"OMITB flow {status}", false); }); //PoopySchloopy /* Dungeon keepDungeon = DungeonDatabase.GetOrLoadByName("base_jungle"); * if (keepDungeon == null) ETGModConsole.Log("Jungle null!"); * if (keepDungeon && keepDungeon.PatternSettings != null) * { * if (keepDungeon.PatternSettings.flows != null && keepDungeon.PatternSettings.flows.Count > 0) * { * if (keepDungeon.PatternSettings.flows[0].fallbackRoomTable) * { * if (keepDungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms != null) * { * if (keepDungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements != null) * { * foreach (WeightedRoom wRoom in keepDungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements) * { * * if (wRoom.room != null && !string.IsNullOrEmpty(wRoom.room.name)) * { * ETGModConsole.Log(wRoom.room.name); * } * } * } * else ETGModConsole.Log("No elements"); * } * else ETGModConsole.Log("No included rooms"); * } * else ETGModConsole.Log("No fallback room table"); * } * else ETGModConsole.Log("Flow was null or empty"); * } * else ETGModConsole.Log("Pattern settings null"); * keepDungeon = null;*/ ETGMod.StartGlobalCoroutine(this.delayedstarthandler()); ETGModConsole.Log("'If you're reading this, I must have done something right' - NN"); } catch (Exception e) { ETGModConsole.Log(e.Message); ETGModConsole.Log(e.StackTrace); } }
public override void Start() { try { FakePrefabHooks.Init(); ItemBuilder.Init(); PlayerEventAdder.Init(); UnlockHookInators.AddHooks(); MagmaticBlood.Init(); MimicSkin.Init(); //Added to the doc SaplingBullets.Init(); //Added to the doc SlightlyLargerBullets.Init(); //Added to the doc WarriorsSyringe.Init(); //Added to the doc VultureFeather.Init(); //Added to the doc StraponRPG.Init(); //Added to the doc Jeremy.Init(); //Added to the doc Gasoline.Init(); //Added to the doc CatSnack.Init(); //Added to the doc ClassicCatSnack.Init(); JunkSynthesizer.Init(); WyrmBlood.Init(); //Added to the doc //GreenCandy.Init(); //KeyCandy.Init(); //GoldenCandy.Init(); //BlueCandy.Init(); //RedCandy.Init(); //HeartCandy.Init(); //MonsterCandy.Init(); ImprovedCandies.CandiesInit(); ImprovedCandies.PositiveEffectsInit(); //TrickOTreater.Init(); //Added to the doc BlackSkull.Init(); StoneSword.Init(); StoneAmmolet.Init(); Randy.Init(); BeeGun.Add(); //BloodyCannon.Add(); //WindStaff.Add(); RedAndWhite.Add(); RoyalShotgun.Add(); //Shotstool.Add(); RescueRanger.Add(); NuclearShotgun.Add(); NuclearAmmoPickup.Init(); SweeperGun.Add(); MaliciousRailcannon.Add(); Superbug.Add(); PetrifyingMirror.Init(); EnchantedTome.Init(); BronzeKey.Init(); StackOfCash.Init(); ExecutionShells.Init(); BloodBullets.Init(); HoodedShells.Init(); ClockworkCog.Init(); HighPriestCloak.Init(); LuckyCoin.Init(); LuckyHorseshoe.Init(); ToxicFungus.Init(); PurpleGuonStone.Init(); GarbageBin.Init(); ColdAmmo.Init(); MaidenPlating.Init(); PlagueBullets.Init(); CrownOfBlood.Init(); GalacticChest.Init(); Bravery.Init(); RaidersAxe.Init(); BulletSynthesizer.Init(); ElectricRounds.Init(); ThunderRounds.Init(); ToxicHoneycomb.Init(); BoomerangBullets.Init(); OilyGreaves.Init(); ShadyChest.Init(); //CandyBag.Init(); MinerHelmet.Init(); Depthmeter.Init(); Smore.Init(); KeyDoubler.Init(); BlankDoubler.Init(); CursedCandle.Init(); MyNameIsYoshikageKira.Init(); MythrilBullets.Init(); Charcoal.Init(); CodexUmbra.Init(); BloodyDice.Init(); StarFruit.Init(); HeartyKey.Init(); DeadlyKnife.Init(); Overloader.Init(); Sushi.Init(); AmmoEnhancer.Init(); BanditHat.Init(); Ushanka.Init(); BigBoom.Init(); Seashell.Init(); //GoldenBox.Init(); CobaltCoin.Init(); RingOfWealth.Init(); QuartzCrystal.Init(); DeadRinger.Init(); RoyalCapacitator.Init(); Cookbook.Init(); ParrotsFeather.Init(); Soulbauble.Init(); FlameWisp.Init(); CatsEye.Init(); GunPermit.Init(); DormantStabiliser.Init(); CaveCarrot.Init(); BlueAlbum.Init(); DoubleABattery.Init(); ScarecrowsHead.Init(); OnyxBracelet.Init(); LemonPig.Init(); IfritsHorn.Init(); EnderHelmet.Init(); BabyGoodRobot.Init(); CaptainsBrooch.Init(); SoulInator.Init(); TwoOfHearts.Init(); ParasiticFungus.Init(); ExperimentalRocketLauncher.Init(); AbyssalShield.Init(); //Coil.Init(); //Restock.Init(); //ChainOfBeing.Init(); //RangeCrystal.Init(); //BloodyLockpick.Init(); //Bitey.Init(); //JestersHat.Init(); //PrismaticLexicon.Init(); //GhoulBullets.Init(); IncubusStartingPassive.Init(); IncubusStartingActive.Init(); /*BlueExplosive.Init(); * RedExplosive.Init(); * WhiteExplosive.Init(); * SwarmSneak.Init(); * YVSwarmPickup.Init(); * WhiteDamageUp.Init(); * Drone.Init();*/ ETGModConsole.Commands.AddGroup("psmdebug", delegate(string[] args) { Log("Please specify a command.", TEXT_COLOR); }); ETGModConsole.Commands.GetGroup("psmdebug").AddUnit("guaranteeproc", delegate(string[] args) { DebugChance = !DebugChance; Log($"Guarantee Proc is now: {DebugChance}", TEXT_COLOR); }); ETGModConsole.Commands.GetGroup("psmdebug").AddUnit("unlocks", delegate(string[] args) { int totalItems = 0; int unlockedItems = 0; List <PickupObject> list = new List <PickupObject>(); List <PickupObject> list2 = new List <PickupObject>(); foreach (PickupObject item in ItemBuilder.AddedItems) { EncounterTrackable trolling = item.GetComponent <EncounterTrackable>(); if (trolling && trolling.prerequisites != null && trolling.prerequisites.Length > 0) { totalItems++; if (trolling.PrerequisitesMet()) { unlockedItems++; list2.Add(item); } else { list.Add(item); } } } Log($"Unlocked: {unlockedItems}/{totalItems}", TEXT_COLOR); if (list2.Count > 0) { Log("Items Unlocked:", TEXT_COLOR); foreach (PickupObject item in list2) { Log(item.name, TEXT_COLOR); } } if (list.Count > 0) { Log("Items Left:", TEXT_COLOR); foreach (PickupObject item in list) { Log($"{item.name}: {Unlocks[item.PickupObjectId]}", TEXT_COLOR); } } }); ETGModConsole.Commands.GetGroup("psmdebug").AddUnit("getcustommaximums", delegate(string[] args) { Log($"Most Damage Had: {DaveAPIManager.GetPlayerMaximum(CustomTrackedMaximums.MAXIMUM_DAMAGE)}", TEXT_COLOR); Log($"Most Health Had: {DaveAPIManager.GetPlayerMaximum(CustomTrackedMaximums.MAXIMUM_HEALTH)}", TEXT_COLOR); Log($"Most Money Had: {DaveAPIManager.GetPlayerMaximum(CustomTrackedMaximums.MOST_MONEY)}", TEXT_COLOR); }); } catch (Exception ex) { itemsLoad = $"{ex}"; } ETGMod.StartGlobalCoroutine(IfOtherModsExist()); }
public static tk2dSpriteCollectionData ReplaceDungeonCollection(tk2dSpriteCollectionData sourceCollection, Texture2D spriteSheet = null, List <string> spriteList = null) { if (sourceCollection == null) { return(null); } tk2dSpriteCollectionData collectionData = UnityEngine.Object.Instantiate(sourceCollection); tk2dSpriteDefinition[] spriteDefinietions = new tk2dSpriteDefinition[collectionData.spriteDefinitions.Length]; for (int i = 0; i < collectionData.spriteDefinitions.Length; i++) { spriteDefinietions[i] = collectionData.spriteDefinitions[i].Copy(); } collectionData.spriteDefinitions = spriteDefinietions; if (spriteSheet != null) { Material[] materials = sourceCollection.materials; Material[] newMaterials = new Material[materials.Length]; if (materials != null) { for (int i = 0; i < materials.Length; i++) { newMaterials[i] = materials[i].Copy(spriteSheet); } collectionData.materials = newMaterials; foreach (Material material2 in collectionData.materials) { foreach (tk2dSpriteDefinition spriteDefinition in collectionData.spriteDefinitions) { bool flag3 = material2 != null && spriteDefinition.material.name.Equals(material2.name); if (flag3) { spriteDefinition.material = material2; spriteDefinition.materialInst = new Material(material2); } } } } } else if (spriteList != null) { RuntimeAtlasPage runtimeAtlasPage = new RuntimeAtlasPage(0, 0, TextureFormat.RGBA32, 2); for (int i = 0; i < spriteList.Count; i++) { Texture2D texture2D = ResourceExtractor.GetTextureFromResource(spriteList[i]); if (!texture2D) { Debug.Log("[BuildDungeonCollection] Null Texture found at index: " + i); goto IL_EXIT; } float X = (texture2D.width / 16f); float Y = (texture2D.height / 16f); // tk2dSpriteDefinition spriteData = collectionData.GetSpriteDefinition(i.ToString()); tk2dSpriteDefinition spriteData = collectionData.spriteDefinitions[i]; if (spriteData != null) { if (spriteData.boundsDataCenter != Vector3.zero) { try { // Debug.Log("[BuildDungeonCollection] Pack Existing Atlas Element at index: " + i); RuntimeAtlasSegment runtimeAtlasSegment = runtimeAtlasPage.Pack(texture2D, false); spriteData.materialInst.mainTexture = runtimeAtlasSegment.texture; spriteData.uvs = runtimeAtlasSegment.uvs; spriteData.extractRegion = true; spriteData.position0 = Vector3.zero; spriteData.position1 = new Vector3(X, 0, 0); spriteData.position2 = new Vector3(0, Y, 0); spriteData.position3 = new Vector3(X, Y, 0); spriteData.boundsDataCenter = new Vector2((X / 2), (Y / 2)); spriteData.untrimmedBoundsDataCenter = spriteData.boundsDataCenter; spriteData.boundsDataExtents = new Vector2(X, Y); spriteData.untrimmedBoundsDataExtents = spriteData.boundsDataExtents; } catch (Exception) { Debug.Log("[BuildDungeonCollection] Exception caught at index: " + i); } } else { // Debug.Log("Test 3. Replace Existing Atlas Element at index: " + i); try { ETGMod.ReplaceTexture(spriteData, texture2D, true); } catch (Exception) { Debug.Log("[BuildDungeonCollection] Exception caught at index: " + i); } } } else { Debug.Log("[BuildDungeonCollection] SpriteData is null at index: " + i); } IL_EXIT :; } runtimeAtlasPage.Apply(); } else { Debug.Log("[BuildDungeonCollection] SpriteList is null!"); } return(collectionData); }
public void Update() { ETGMod.Update(); }
internal void KeepSinging() { ETGMod.StartGlobalCoroutine(_KeepSinging()); }
public static void InitModZIP(string archive) { Debug.Log("Initializing mod ZIP " + archive + " with Mods.txt is bad."); if (!File.Exists(archive)) { archive = Path.Combine(ETGMod.ModsDirectory, archive); } ETGModuleMetadata etgmoduleMetadata = new ETGModuleMetadata { Name = Path.GetFileNameWithoutExtension(archive), Version = new Version(0, 0), DLL = "mod.dll" }; Assembly assembly = null; using (ZipFile zipFile = ZipFile.Read(archive)) { Texture2D texture2D = null; foreach (ZipEntry zipEntry in zipFile.Entries) { if (zipEntry.FileName == "metadata.txt") { using (MemoryStream memoryStream = new MemoryStream()) { zipEntry.Extract(memoryStream); memoryStream.Seek(0L, SeekOrigin.Begin); etgmoduleMetadata = (ETGModuleMetadata)parseMethod.Invoke(null, new object[] { archive, "", memoryStream }); continue; } } if (zipEntry.FileName == "icon.png") { texture2D = new Texture2D(2, 2); texture2D.name = "icon"; using (MemoryStream memoryStream2 = new MemoryStream()) { zipEntry.Extract(memoryStream2); memoryStream2.Seek(0L, SeekOrigin.Begin); texture2D.LoadImage(memoryStream2.GetBuffer()); } texture2D.filterMode = FilterMode.Point; } } if (texture2D != null) { etgmoduleMetadata.Icon = texture2D; } if (!etgmoduleMetadata.Profile.RunsOn(ETGMod.BaseProfile)) { return; } foreach (ETGModuleMetadata etgmoduleMetadata2 in etgmoduleMetadata.Dependencies) { if (!ETGMod.DependencyLoaded(etgmoduleMetadata2)) { Debug.LogWarning(string.Concat(new object[] { "DEPENDENCY ", etgmoduleMetadata2, " OF ", etgmoduleMetadata, " NOT LOADED with Mods.txt is bad!" })); return; } } AppDomain.CurrentDomain.AssemblyResolve += (ResolveEventHandler)generateModAssemblyMethod.Invoke(null, new object[] { etgmoduleMetadata }); foreach (ZipEntry zipEntry2 in zipFile.Entries) { string text = zipEntry2.FileName.Replace("\\", "/"); if (text == etgmoduleMetadata.DLL) { using (MemoryStream memoryStream3 = new MemoryStream()) { zipEntry2.Extract(memoryStream3); memoryStream3.Seek(0L, SeekOrigin.Begin); if (etgmoduleMetadata.Prelinked) { assembly = Assembly.Load(memoryStream3.GetBuffer()); continue; } assembly = etgmoduleMetadata.GetRelinkedAssembly(memoryStream3); continue; } } ETGMod.Assets.AddMapping(text, new AssetMetadata(archive, text) { AssetType = (zipEntry2.IsDirectory ? ETGMod.Assets.t_AssetDirectory : null) }); } } if (assembly == null) { return; } assembly.MapAssets(); foreach (Type type in assembly.GetTypes()) { if (typeof(ETGModule).IsAssignableFrom(type) && !type.IsAbstract) { ETGModule etgmodule = (ETGModule)type.GetConstructor((Type[])emptyTypeArrayInfo.GetValue(null)).Invoke((object[])emptyObjectArrayInfo.GetValue(null)); if (!ETGMod.AllMods.Contains(etgmodule)) { etgmodule.Metadata = etgmoduleMetadata; ETGMod.GameMods.Add(etgmodule); ETGMod.AllMods.Add(etgmodule); loadedMods.Add(etgmodule); addedModuleTypes.Add(type); addedModuleMethods.Add(new Dictionary <string, MethodInfo>()); } } } Debug.Log("Mod " + etgmoduleMetadata.Name + " initialized with Mods.txt is bad."); }
// Token: 0x0600009A RID: 154 RVA: 0x000080AC File Offset: 0x000062AC public static tk2dSpriteDefinition SetupDefinitionForProjectileSprite(string name, int id, int pixelWidth, int pixelHeight, bool lightened = true, int?overrideColliderPixelWidth = null, int?overrideColliderPixelHeight = null, int?overrideColliderOffsetX = null, int?overrideColliderOffsetY = null, Projectile overrideProjectileToCopyFrom = null) { bool flag = overrideColliderPixelWidth == null; if (flag) { overrideColliderPixelWidth = new int?(pixelWidth); } bool flag2 = overrideColliderPixelHeight == null; if (flag2) { overrideColliderPixelHeight = new int?(pixelHeight); } bool flag3 = overrideColliderOffsetX == null; if (flag3) { overrideColliderOffsetX = new int?(0); } bool flag4 = overrideColliderOffsetY == null; if (flag4) { overrideColliderOffsetY = new int?(0); } float num = 14f; float num2 = 16f; float num3 = (float)pixelWidth / num; float num4 = (float)pixelHeight / num; float x = (float)overrideColliderPixelWidth.Value / num2; float y = (float)overrideColliderPixelHeight.Value / num2; float x2 = (float)overrideColliderOffsetX.Value / num2; float y2 = (float)overrideColliderOffsetY.Value / num2; tk2dSpriteDefinition tk2dSpriteDefinition = ETGMod.Databases.Items.ProjectileCollection.inst.spriteDefinitions[ETGMod.GetAnySprite(overrideProjectileToCopyFrom ?? (PickupObjectDatabase.GetById(lightened ? 47 : 12) as Gun).DefaultModule.projectiles[0]).spriteId].CopyDefinitionFrom(); tk2dSpriteDefinition.boundsDataCenter = new Vector3(num3 / 2f, num4 / 2f, 0f); tk2dSpriteDefinition.boundsDataExtents = new Vector3(num3, num4, 0f); tk2dSpriteDefinition.untrimmedBoundsDataCenter = new Vector3(num3 / 2f, num4 / 2f, 0f); tk2dSpriteDefinition.untrimmedBoundsDataExtents = new Vector3(num3, num4, 0f); tk2dSpriteDefinition.texelSize = new Vector2(0.0625f, 0.0625f); tk2dSpriteDefinition.position0 = new Vector3(0f, 0f, 0f); tk2dSpriteDefinition.position1 = new Vector3(0f + num3, 0f, 0f); tk2dSpriteDefinition.position2 = new Vector3(0f, 0f + num4, 0f); tk2dSpriteDefinition.position3 = new Vector3(0f + num3, 0f + num4, 0f); tk2dSpriteDefinition.colliderVertices[0].x = x2; tk2dSpriteDefinition.colliderVertices[0].y = y2; tk2dSpriteDefinition.colliderVertices[1].x = x; tk2dSpriteDefinition.colliderVertices[1].y = y; tk2dSpriteDefinition.name = name; ETGMod.Databases.Items.ProjectileCollection.inst.spriteDefinitions[id] = tk2dSpriteDefinition; return(tk2dSpriteDefinition); }
public static void InitModDir(string dir) { Debug.Log("Initializing mod directory " + dir + " with Mods.txt is bad"); if (!Directory.Exists(dir)) { dir = Path.Combine(ETGMod.ModsDirectory, dir); } ETGModuleMetadata etgmoduleMetadata = new ETGModuleMetadata { Name = Path.GetFileName(dir), Version = new Version(0, 0), DLL = "mod.dll" }; Assembly assembly = null; string path = Path.Combine(dir, "metadata.txt"); if (File.Exists(path)) { using (FileStream fileStream = File.OpenRead(path)) { etgmoduleMetadata = (ETGModuleMetadata)parseMethod.Invoke(null, new object[] { "", dir, fileStream }); } } foreach (ETGModuleMetadata etgmoduleMetadata2 in etgmoduleMetadata.Dependencies) { if (!ETGMod.DependencyLoaded(etgmoduleMetadata2)) { Debug.LogWarning(string.Concat(new object[] { "DEPENDENCY ", etgmoduleMetadata2, " OF ", etgmoduleMetadata, " NOT LOADED with Mods.txt is bad!" })); return; } } AppDomain.CurrentDomain.AssemblyResolve += (ResolveEventHandler)generateModAssemblyMethod.Invoke(null, new object[] { etgmoduleMetadata }); if (!File.Exists(etgmoduleMetadata.DLL)) { return; } if (etgmoduleMetadata.Prelinked) { assembly = Assembly.LoadFrom(etgmoduleMetadata.DLL); } else { using (FileStream fileStream2 = File.OpenRead(etgmoduleMetadata.DLL)) { assembly = etgmoduleMetadata.GetRelinkedAssembly(fileStream2); } } assembly.MapAssets(); ETGMod.Assets.Crawl(dir, null); foreach (Type type in assembly.GetTypes()) { if (typeof(ETGModule).IsAssignableFrom(type) && !type.IsAbstract) { ETGModule etgmodule = (ETGModule)type.GetConstructor((Type[])emptyTypeArrayInfo.GetValue(null)).Invoke((object[])emptyObjectArrayInfo.GetValue(null)); if (!ETGMod.AllMods.Contains(etgmodule)) { etgmodule.Metadata = etgmoduleMetadata; ETGMod.GameMods.Add(etgmodule); ETGMod.AllMods.Add(etgmodule); loadedMods.Add(etgmodule); addedModuleTypes.Add(type); addedModuleMethods.Add(new Dictionary <string, MethodInfo>()); } } } Debug.Log("Mod " + etgmoduleMetadata.Name + " initialized with Mods.txt is bad."); }
public void Start() { ETGMod.Start(); }
public override void Start() { ETGMod.StartGlobalCoroutine(DelayedStart()); }
// public static T GetEnumValue<T>(string val) where T : Enum { return (T)Enum.Parse(typeof(T), val.ToUpper()); } // This came from KyleTheScientest's SpriteWork mod. public static void DumpSpecificSpriteCollection(tk2dSpriteCollectionData sprites, bool debugMode = false, bool overrideFlag = false) { string collectionName = sprites.spriteCollectionName; // if (string.IsNullOrEmpty(collectionName)) { collectionName = Guid.NewGuid().ToString(); } string text = "DUMPsprites/" + collectionName; string path = Path.Combine(ETGMod.ResourcesDirectory, text.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar) + ".png"); if (debugMode) { ETGModConsole.Log("[ExpandTheGungeon] Debug: Current Sprite Collection Length: " + sprites.spriteDefinitions.Length.ToString()); } if (!File.Exists(path)) { Texture2D texture2D = null; Texture2D texture2D2 = null; Color[] array = null; for (int i = 0; i < sprites.spriteDefinitions.Length; i++) { tk2dSpriteDefinition tk2dSpriteDefinition = sprites.spriteDefinitions[i]; Texture2D texture2D3 = tk2dSpriteDefinition.material.mainTexture as Texture2D; if (texture2D3 != null || !tk2dSpriteDefinition.Valid || (tk2dSpriteDefinition.materialInst != null && overrideFlag)) { try { string spriteName = tk2dSpriteDefinition.name; // if (string.IsNullOrEmpty(tk2dSpriteDefinition.name)) { spriteName = Guid.NewGuid().ToString(); } string text2 = text + "/" + tk2dSpriteDefinition.name; if (texture2D != texture2D3) { if (debugMode) { ETGModConsole.Log("[ExpandTheGungeon] Debug: Dumping Sprite Atlas to file."); } texture2D = texture2D3; texture2D2 = ETGMod.GetRW(texture2D3); array = texture2D2.GetPixels(); path = Path.Combine(ETGMod.ResourcesDirectory, text.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar) + ".png"); Directory.GetParent(path).Create(); File.WriteAllBytes(path, ImageConversion.EncodeToPNG(texture2D2)); } double num = 1.0; double num2 = 1.0; double num3 = 0.0; double num4 = 0.0; for (int j = 0; j < tk2dSpriteDefinition.uvs.Length; j++) { bool flag4 = tk2dSpriteDefinition.uvs[j].x < num; if (flag4) { num = tk2dSpriteDefinition.uvs[j].x; } bool flag5 = tk2dSpriteDefinition.uvs[j].y < num2; if (flag5) { num2 = tk2dSpriteDefinition.uvs[j].y; } bool flag6 = num3 < tk2dSpriteDefinition.uvs[j].x; if (flag6) { num3 = tk2dSpriteDefinition.uvs[j].x; } bool flag7 = num4 < tk2dSpriteDefinition.uvs[j].y; if (flag7) { num4 = tk2dSpriteDefinition.uvs[j].y; } } int num5 = (int)Math.Floor(num * texture2D3.width); int num6 = (int)Math.Floor(num2 * texture2D3.height); int num7 = (int)Math.Ceiling(num3 * texture2D3.width); int num8 = (int)Math.Ceiling(num4 * texture2D3.height); int num9 = num7 - num5; int num10 = num8 - num6; bool flag8 = tk2dSpriteDefinition.uvs[0].x == num && tk2dSpriteDefinition.uvs[0].y == num2 && tk2dSpriteDefinition.uvs[1].x == num3 && tk2dSpriteDefinition.uvs[1].y == num2 && tk2dSpriteDefinition.uvs[2].x == num && tk2dSpriteDefinition.uvs[2].y == num4 && tk2dSpriteDefinition.uvs[3].x == num3 && tk2dSpriteDefinition.uvs[3].y == num4; Texture2D texture2D4; if (flag8) { if (debugMode) { ETGModConsole.Log("[ExpandTheGungeon] Debug: flag8 at SpriteID " + i.ToString()); } texture2D4 = new Texture2D(num9, num10); texture2D4.SetPixels(texture2D2.GetPixels(num5, num6, num9, num10)); } else { bool flag9 = tk2dSpriteDefinition.uvs[0].x == tk2dSpriteDefinition.uvs[1].x; if (flag9) { int num11 = num10; num10 = num9; num9 = num11; if (debugMode) { ETGModConsole.Log("[ExpandTheGungeon] Debug: flag9 at SpriteID " + i.ToString()); } } if (debugMode) { ETGModConsole.Log("[ExpandTheGungeon] Debug: Prepering to dump sprite texture at SpriteID " + i.ToString()); } texture2D4 = new Texture2D(num9, num10); double num12 = tk2dSpriteDefinition.uvs[1].x - tk2dSpriteDefinition.uvs[0].x; double num13 = tk2dSpriteDefinition.uvs[2].x - tk2dSpriteDefinition.uvs[0].x; double num14 = tk2dSpriteDefinition.uvs[1].y - tk2dSpriteDefinition.uvs[0].y; double num15 = tk2dSpriteDefinition.uvs[2].y - tk2dSpriteDefinition.uvs[0].y; double num16 = texture2D3.width * (tk2dSpriteDefinition.uvs[3].x - tk2dSpriteDefinition.uvs[0].x); double num17 = texture2D3.height * (tk2dSpriteDefinition.uvs[3].y - tk2dSpriteDefinition.uvs[0].y); double num18 = 0.001; double num19 = (num12 < num18) ? 0.0 : num16; double num20 = (num13 < num18) ? 0.0 : num16; double num21 = (num14 < num18) ? 0.0 : num17; double num22 = (num15 < num18) ? 0.0 : num17; if (debugMode) { ETGModConsole.Log("[ExpandTheGungeon] Debug: Prepering to set pixels for texture2D4..."); } for (int k = 0; k < num10; k++) { double num23 = k / (double)num10; for (int l = 0; l < num9; l++) { double num24 = l / (double)num9; double num25 = num24 * num19 + num23 * num20; double num26 = num24 * num21 + num23 * num22; double num27 = Math.Round(tk2dSpriteDefinition.uvs[0].y * texture2D3.height + num26) * texture2D3.width + Math.Round(tk2dSpriteDefinition.uvs[0].x * texture2D3.width + num25); texture2D4.SetPixel(l, k, array[(int)num27]); } } } if (debugMode) { ETGModConsole.Log("[ExpandTheGungeon] Debug: Writing sprite texture to file..."); } path = Path.Combine(ETGMod.ResourcesDirectory, text2.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar) + ".png"); bool flag10 = !File.Exists(path); if (flag10) { Directory.GetParent(path).Create(); File.WriteAllBytes(path, ImageConversion.EncodeToPNG(texture2D4)); } } catch (Exception ex) { if (debugMode) { ETGModConsole.Log("Exception occured while processing sprite id '" + i.ToString() + "'!"); Debug.LogException(ex); } } } } } }
public static void DumpSpriteCollection(tk2dSpriteCollectionData sprites) { string text = "DUMPsprites/" + sprites.spriteCollectionName; string path = Path.Combine(ETGMod.ResourcesDirectory, text.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar) + ".png"); bool flag = File.Exists(path); bool staticFlag = false; if (!flag) { Texture2D texture2D = null; Texture2D texture2D2 = null; Color[] array = null; for (int i = 0; i < sprites.spriteDefinitions.Length; i++) { tk2dSpriteDefinition tk2dSpriteDefinition = sprites.spriteDefinitions[i]; Texture2D texture2D3 = tk2dSpriteDefinition.material.mainTexture as Texture2D; bool flag2 = texture2D3 == null || !tk2dSpriteDefinition.Valid || (tk2dSpriteDefinition.materialInst != null && staticFlag); if (!flag2) { string text2 = text + "/" + tk2dSpriteDefinition.name; bool flag3 = texture2D != texture2D3; if (flag3) { texture2D = texture2D3; texture2D2 = ETGMod.GetRW(texture2D3); array = texture2D2.GetPixels(); path = Path.Combine(ETGMod.ResourcesDirectory, text.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar) + ".png"); Directory.GetParent(path).Create(); File.WriteAllBytes(path, ImageConversion.EncodeToPNG(texture2D2)); } double num = 1.0; double num2 = 1.0; double num3 = 0.0; double num4 = 0.0; for (int j = 0; j < tk2dSpriteDefinition.uvs.Length; j++) { bool flag4 = tk2dSpriteDefinition.uvs[j].x < num; if (flag4) { num = tk2dSpriteDefinition.uvs[j].x; } bool flag5 = tk2dSpriteDefinition.uvs[j].y < num2; if (flag5) { num2 = tk2dSpriteDefinition.uvs[j].y; } bool flag6 = num3 < tk2dSpriteDefinition.uvs[j].x; if (flag6) { num3 = tk2dSpriteDefinition.uvs[j].x; } bool flag7 = num4 < tk2dSpriteDefinition.uvs[j].y; if (flag7) { num4 = tk2dSpriteDefinition.uvs[j].y; } } int num5 = (int)Math.Floor(num * texture2D3.width); int num6 = (int)Math.Floor(num2 * texture2D3.height); int num7 = (int)Math.Ceiling(num3 * texture2D3.width); int num8 = (int)Math.Ceiling(num4 * texture2D3.height); int num9 = num7 - num5; int num10 = num8 - num6; bool flag8 = tk2dSpriteDefinition.uvs[0].x == num && tk2dSpriteDefinition.uvs[0].y == num2 && tk2dSpriteDefinition.uvs[1].x == num3 && tk2dSpriteDefinition.uvs[1].y == num2 && tk2dSpriteDefinition.uvs[2].x == num && tk2dSpriteDefinition.uvs[2].y == num4 && tk2dSpriteDefinition.uvs[3].x == num3 && tk2dSpriteDefinition.uvs[3].y == num4; Texture2D texture2D4; if (flag8) { texture2D4 = new Texture2D(num9, num10); texture2D4.SetPixels(texture2D2.GetPixels(num5, num6, num9, num10)); } else { bool flag9 = tk2dSpriteDefinition.uvs[0].x == tk2dSpriteDefinition.uvs[1].x; if (flag9) { int num11 = num10; num10 = num9; num9 = num11; } texture2D4 = new Texture2D(num9, num10); double num12 = tk2dSpriteDefinition.uvs[1].x - tk2dSpriteDefinition.uvs[0].x; double num13 = tk2dSpriteDefinition.uvs[2].x - tk2dSpriteDefinition.uvs[0].x; double num14 = tk2dSpriteDefinition.uvs[1].y - tk2dSpriteDefinition.uvs[0].y; double num15 = tk2dSpriteDefinition.uvs[2].y - tk2dSpriteDefinition.uvs[0].y; double num16 = texture2D3.width * (tk2dSpriteDefinition.uvs[3].x - tk2dSpriteDefinition.uvs[0].x); double num17 = texture2D3.height * (tk2dSpriteDefinition.uvs[3].y - tk2dSpriteDefinition.uvs[0].y); double num18 = 0.001; double num19 = (num12 < num18) ? 0.0 : num16; double num20 = (num13 < num18) ? 0.0 : num16; double num21 = (num14 < num18) ? 0.0 : num17; double num22 = (num15 < num18) ? 0.0 : num17; for (int k = 0; k < num10; k++) { double num23 = k / (double)num10; for (int l = 0; l < num9; l++) { double num24 = l / (double)num9; double num25 = num24 * num19 + num23 * num20; double num26 = num24 * num21 + num23 * num22; double num27 = Math.Round(tk2dSpriteDefinition.uvs[0].y * (float)texture2D3.height + num26) * texture2D3.width + Math.Round(tk2dSpriteDefinition.uvs[0].x * (float)texture2D3.width + num25); texture2D4.SetPixel(l, k, array[(int)num27]); } } } path = Path.Combine(ETGMod.ResourcesDirectory, text2.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar) + ".png"); bool flag10 = !File.Exists(path); if (flag10) { Directory.GetParent(path).Create(); File.WriteAllBytes(path, ImageConversion.EncodeToPNG(texture2D4)); } } } } }
public static void Init(string modName) { Gun ChamberGun = PickupObjectDatabase.GetById(647) as Gun; ChamberGunProcessor extantProcessor = ChamberGun.GetComponent <ChamberGunProcessor>(); if (extantProcessor) { AdvancedChamberGunController newProcessor = ChamberGun.gameObject.AddComponent <AdvancedChamberGunController>(); newProcessor.RefillsOnFloorChange = true; newProcessor.primeHandlerModName = modName; //newProcessor.hyperDebugMode = true; if (AdvancedChamberGunController.floorFormeDatas == null) { AdvancedChamberGunController.floorFormeDatas = new List <AdvancedChamberGunController.ChamberGunData>(); } #region SetupVanillaFloors //KEEP AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 2, indexValue = 1, correspondingFormeID = 647, viableMasterRounds = new List <int>() { 469, } }); //OUBLIETTE AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 4, indexValue = 1.5f, correspondingFormeID = 657, viableMasterRounds = new List <int>() { } }); //GUNGEON PROPER AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 1, indexValue = 2, correspondingFormeID = 660, viableMasterRounds = new List <int>() { 471, } }); //ABBEY AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 8, indexValue = 2.5f, correspondingFormeID = 806, viableMasterRounds = new List <int>() { } }); //MINES AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 16, indexValue = 3, correspondingFormeID = 807, viableMasterRounds = new List <int>() { 468, } }); //RAT FLOOR AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 32768, indexValue = 3.5f, correspondingFormeID = 808, viableMasterRounds = new List <int>() { } }); //HOLLOW AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 32, indexValue = 4, correspondingFormeID = 659, viableMasterRounds = new List <int>() { 470, } }); //R&G DEPT AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 2048, indexValue = 4.5f, correspondingFormeID = 823, viableMasterRounds = new List <int>() { } }); //FORGE AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 64, indexValue = 5, correspondingFormeID = 658, viableMasterRounds = new List <int>() { 467, } }); //BULLET HELL AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData() { modName = "Vanilla Gungeon", floorTilesetID = 128, indexValue = 6, correspondingFormeID = 763, viableMasterRounds = new List <int>() { } }); #endregion ETGMod.StartGlobalCoroutine(postStart(newProcessor, modName)); UnityEngine.Object.Destroy(extantProcessor); Debug.Log($"Mod '{modName}' correctly initialised the ChamberGunAPI and is the prime handler."); } else { Debug.Log($"Mod '{modName}' did not alter the Chamber Gun, as the Chamber Gun was already altered."); } }
public override void Start() { try { //audio ZipFilePath = this.Metadata.Archive; FilePath = this.Metadata.Directory; AudioResourceLoader.InitAudio(); //basic inits ItemBuilder.Init(); TreasureChest.Add(); //synergies List <string> mandatoryConsoleIDs = new List <string> { "ans:treasure_chest" }; List <string> optionalConsoleIDs = new List <string> { "shelleton_key", "akey47", "master_of_unlocking" }; CustomSynergies.Add("oh you can open that!", mandatoryConsoleIDs, optionalConsoleIDs); List <string> mandatoryConsoleIDs2 = new List <string> { "ans:treasure_chest" }; List <string> optionalConsoleIDs2 = new List <string> { "gold_junk", "briefcase_of_cash", }; CustomSynergies.Add("who even needs money.", mandatoryConsoleIDs2, optionalConsoleIDs2); List <string> mandatoryConsoleIDs3 = new List <string> { "ans:treasure_chest" }; List <string> optionalConsoleIDs3 = new List <string> { "black_hole_gun", }; CustomSynergies.Add("what could be in here?", mandatoryConsoleIDs3, optionalConsoleIDs3, false); //gets a list of all items that are in the game. for the who even needs money synergy. foreach (string text in Game.Items.AllIDs) { bool flag = text.Contains("dupe") || text.Contains("|"); if (!flag) { PickupObject pickupObject = Game.Items[text]; bool flag2 = pickupObject == null; if (!flag2) { items.Add(ETGMod.RemovePrefix(text, "gungeon:")); } } } } catch (Exception e) { Toolbox.Log(e); } Toolbox.Log(MOD_NAME + "v" + VERSION + "started successfully.", TEXT_COLOR); }