Esempio n. 1
0
        private static void ConvertCorruptionNormal()
        {
            for (int x = 0; x < Main.maxTilesX; x++)
            {
                for (int y = 0; y < Main.maxTilesY; y++)
                {
                    switch (Main.tile[x, y].type)
                    {
                    case 25:
                        Main.tile[x, y].type = 1;
                        break;

                    case 23:
                        Main.tile[x, y].type = 2;
                        break;

                    case 112:
                        Main.tile[x, y].type = 53;
                        break;

                    default:
                        continue;
                    }
                }
            }
            WorldGen.CountTiles(0);
            WorldGen.CountTiles(0);
            Main.NewText("Corruption converted to normal.");
        }
Esempio n. 2
0
        private static void ConvertHallowNormal()
        {
            for (int x = 0; x < Main.maxTilesX; x++)
            {
                for (int y = 0; y < Main.maxTilesY; y++)
                {
                    switch (Main.tile[x, y].type)
                    {
                    case 117:
                        Main.tile[x, y].type = 1;
                        break;

                    case 109:
                        Main.tile[x, y].type = 2;
                        break;

                    case 116:
                        Main.tile[x, y].type = 53;
                        break;

                    default:
                        continue;
                    }
                }
            }
            WorldGen.CountTiles(0);
            WorldGen.CountTiles(0);
            Main.NewText("Hallow converted to normal.");
        }
Esempio n. 3
0
        public override void Load()
        {
            ExplosiveBaseDamage = new Dictionary <int, int>();
            //Explosive item types
            NonFishItem.ResizeItemArrays += () => {
                ExplosiveItems = ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn.ToArray();
                ExplosiveItems[ItemID.BouncyBomb]       = true;
                ExplosiveItems[ItemID.HellfireArrow]    = true;
                ExplosiveItems[ItemID.BombFish]         = true;
                ExplosiveItems[ItemID.PartyGirlGrenade] = true;
                ExplosiveItems[ItemID.Beenade]          = true;
                ExplosiveItems[ItemID.MolotovCocktail]  = true;
            };
            //Explosive projectile & ammo types
            NonFishItem.ResizeOtherArrays += () => {
                ExplosiveProjectiles = new bool[ProjectileID.Sets.CanDistortWater.Length];
                ExplosiveProjectiles[ProjectileID.Grenade]          = true;
                ExplosiveProjectiles[ProjectileID.StickyGrenade]    = true;
                ExplosiveProjectiles[ProjectileID.BouncyGrenade]    = true;
                ExplosiveProjectiles[ProjectileID.Bomb]             = true;
                ExplosiveProjectiles[ProjectileID.StickyBomb]       = true;
                ExplosiveProjectiles[ProjectileID.BouncyBomb]       = true;
                ExplosiveProjectiles[ProjectileID.Dynamite]         = true;
                ExplosiveProjectiles[ProjectileID.StickyDynamite]   = true;
                ExplosiveProjectiles[ProjectileID.BouncyDynamite]   = true;
                ExplosiveProjectiles[ProjectileID.HellfireArrow]    = true;
                ExplosiveProjectiles[ProjectileID.BombFish]         = true;
                ExplosiveProjectiles[ProjectileID.PartyGirlGrenade] = true;
                ExplosiveProjectiles[ProjectileID.Beenade]          = true;
                ExplosiveProjectiles[ProjectileID.MolotovCocktail]  = true;
                ExplosiveProjectiles[ProjectileID.RocketI]          = true;
                ExplosiveProjectiles[ProjectileID.RocketII]         = true;
                ExplosiveProjectiles[ProjectileID.RocketIII]        = true;
                ExplosiveProjectiles[ProjectileID.RocketIV]         = true;
                ExplosiveProjectiles[ProjectileID.GrenadeI]         = true;
                ExplosiveProjectiles[ProjectileID.GrenadeII]        = true;
                ExplosiveProjectiles[ProjectileID.GrenadeIII]       = true;
                ExplosiveProjectiles[ProjectileID.GrenadeIV]        = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineI]   = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineII]  = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineIII] = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineIV]  = true;

                ExplosiveModOnHit = new bool[ProjectileID.Sets.CanDistortWater.Length];
                ExplosiveModOnHit[ProjectileID.Bomb]           = true;
                ExplosiveModOnHit[ProjectileID.StickyBomb]     = true;
                ExplosiveModOnHit[ProjectileID.BouncyBomb]     = true;
                ExplosiveModOnHit[ProjectileID.BombFish]       = true;
                ExplosiveModOnHit[ProjectileID.Dynamite]       = true;
                ExplosiveModOnHit[ProjectileID.StickyDynamite] = true;
                ExplosiveModOnHit[ProjectileID.BouncyDynamite] = true;

                ExplosiveAmmo = ExplosiveItems.ToArray();
                ExplosiveAmmo[AmmoID.Rocket]      = true;
                ExplosiveAmmo[AmmoID.StyngerBolt] = true;
            };
            #region vanilla weapon elements
            VanillaElements = ItemID.Sets.Factory.CreateUshortSet(0,
                                                                  #region fire
                                                                  (ushort)ItemID.FlamingArrow, Elements.Fire,
                                                                  (ushort)ItemID.FlareGun, Elements.Fire,
                                                                  (ushort)ItemID.WandofSparking, Elements.Fire,
                                                                  (ushort)ItemID.FieryGreatsword, Elements.Fire,
                                                                  (ushort)ItemID.MoltenPickaxe, Elements.Fire,
                                                                  (ushort)ItemID.MoltenHamaxe, Elements.Fire,
                                                                  (ushort)ItemID.ImpStaff, Elements.Fire,
                                                                  (ushort)ItemID.FlowerofFire, Elements.Fire,
                                                                  (ushort)ItemID.Flamelash, Elements.Fire,
                                                                  (ushort)ItemID.Sunfury, Elements.Fire,
                                                                  (ushort)ItemID.Flamethrower, Elements.Fire,
                                                                  (ushort)ItemID.EldMelter, Elements.Fire,
                                                                  (ushort)ItemID.InfernoFork, Elements.Fire,
                                                                  (ushort)ItemID.Cascade, Elements.Fire,
                                                                  (ushort)ItemID.HelFire, Elements.Fire,
                                                                  (ushort)ItemID.HellwingBow, Elements.Fire,
                                                                  (ushort)ItemID.PhoenixBlaster, Elements.Fire,
                                                                  (ushort)ItemID.MoltenFury, Elements.Fire,
                                                                  (ushort)ItemID.DD2FlameburstTowerT1Popper, Elements.Fire,
                                                                  (ushort)ItemID.DD2FlameburstTowerT2Popper, Elements.Fire,
                                                                  (ushort)ItemID.DD2FlameburstTowerT3Popper, Elements.Fire,
                                                                  (ushort)ItemID.DD2PhoenixBow, Elements.Fire,
                                                                  (ushort)ItemID.FrostburnArrow, Elements.Fire | Elements.Ice,
                                                                  (ushort)ItemID.FlowerofFrost, Elements.Fire | Elements.Ice,
                                                                  (ushort)ItemID.Amarok, Elements.Fire | Elements.Ice,
                                                                  (ushort)ItemID.CursedArrow, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.CursedBullet, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.CursedFlames, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.CursedDart, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.ClingerStaff, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.ShadowFlameBow, Elements.Fire,
                                                                  (ushort)ItemID.ShadowFlameHexDoll, Elements.Fire,
                                                                  (ushort)ItemID.ShadowFlameKnife, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareAxe, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareChainsaw, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareDrill, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareHammer, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlarePickaxe, Elements.Fire,
                                                                  (ushort)ItemID.DayBreak, Elements.Fire,
                                                                  (ushort)ItemID.SolarEruption, Elements.Fire,
                                                                  #endregion fire
                                                                  #region ice
                                                                  (ushort)ItemID.IceBlade, Elements.Ice,
                                                                  (ushort)ItemID.IceBoomerang, Elements.Ice,
                                                                  (ushort)ItemID.IceRod, Elements.Ice,
                                                                  (ushort)ItemID.IceBow, Elements.Ice,
                                                                  (ushort)ItemID.IceSickle, Elements.Ice,
                                                                  (ushort)ItemID.FrostDaggerfish, Elements.Ice,
                                                                  (ushort)ItemID.FrostStaff, Elements.Ice,
                                                                  (ushort)ItemID.Frostbrand, Elements.Ice,
                                                                  (ushort)ItemID.StaffoftheFrostHydra, Elements.Ice,
                                                                  (ushort)ItemID.NorthPole, Elements.Ice,
                                                                  (ushort)ItemID.BlizzardStaff, Elements.Ice,
                                                                  (ushort)ItemID.SnowballCannon, Elements.Ice,
                                                                  (ushort)ItemID.SnowmanCannon, Elements.Ice,
                                                                  #endregion ice
                                                                  #region earth
                                                                  (ushort)ItemID.CrystalBullet, Elements.Earth,
                                                                  (ushort)ItemID.CrystalDart, Elements.Earth,
                                                                  (ushort)ItemID.CrystalSerpent, Elements.Earth,
                                                                  (ushort)ItemID.CrystalStorm, Elements.Earth,
                                                                  (ushort)ItemID.CrystalVileShard, Elements.Earth,
                                                                  (ushort)ItemID.MeteorStaff, Elements.Earth,
                                                                  (ushort)ItemID.Seedler, Elements.Earth,
                                                                  (ushort)ItemID.MushroomSpear, Elements.Earth,
                                                                  (ushort)ItemID.Hammush, Elements.Earth,
                                                                  (ushort)ItemID.StaffofEarth, Elements.Earth,
                                                                  (ushort)ItemID.BladeofGrass, Elements.Earth,
                                                                  (ushort)ItemID.ThornChakram, Elements.Earth,
                                                                  (ushort)ItemID.PoisonStaff, Elements.Earth,
                                                                  (ushort)ItemID.Toxikarp, Elements.Earth,
                                                                  (ushort)ItemID.VenomArrow, Elements.Earth,
                                                                  (ushort)ItemID.VenomBullet, Elements.Earth,
                                                                  (ushort)ItemID.VenomStaff, Elements.Earth,
                                                                  (ushort)ItemID.SpiderStaff, Elements.Earth,
                                                                  (ushort)ItemID.QueenSpiderStaff, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteArrow, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteBullet, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteChainsaw, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteClaymore, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteDrill, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteGreataxe, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteJackhammer, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophytePartisan, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophytePickaxe, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteSaber, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteShotbow, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteWarhammer, Elements.Earth);
            #endregion earth
            #endregion vanilla weapon elements
            HelmetGlowMasks      = new Dictionary <int, Texture2D> {
            };
            BreastplateGlowMasks = new Dictionary <int, Texture2D> {
            };
            LeggingGlowMasks     = new Dictionary <int, Texture2D> {
            };
            if (!Main.dedServ)
            {
                OriginExtensions.drawPlayerItemPos = (Func <float, int, Vector2>) typeof(Main).GetMethod("DrawPlayerItemPos", BindingFlags.NonPublic | BindingFlags.Instance).CreateDelegate(typeof(Func <float, int, Vector2>), Main.instance);
                perlinFade0 = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/PerlinFade")), "RedFade");
                //perlinFade0.UseImage("Images/Misc/Perlin");
                perlinFade0.Shader.Parameters["uThreshold0"].SetValue(0.6f);
                perlinFade0.Shader.Parameters["uThreshold1"].SetValue(0.6f);
                blackHoleShade = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/BlackHole")), "BlackHole");

                Filters.Scene["Origins:ZoneDusk"]    = new Filter(new ScreenShaderData(new Ref <Effect>(GetEffect("Effects/BiomeShade")), "VoidShade"), EffectPriority.High);
                Filters.Scene["Origins:ZoneDefiled"] = new Filter(new ScreenShaderData(new Ref <Effect>(GetEffect("Effects/BiomeShade")), "DefiledShade"), EffectPriority.High);
                Filters.Scene["Origins:ZoneRiven"]   = new Filter(new ScreenShaderData(new Ref <Effect>(GetEffect("Effects/BiomeShade")), "RivenShade"), EffectPriority.High);

                solventShader = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Solvent")), "Dissolve");
                GameShaders.Misc["Origins:Solvent"] = solventShader;
                cellNoiseTexture = GetTexture("Textures/Cell_Noise_Pixel");

                rasterizeShader = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Rasterize")), "Rasterize");
                GameShaders.Misc["Origins:Rasterize"] = rasterizeShader;
                //Filters.Scene["Origins:ZoneDusk"].GetShader().UseOpacity(0.35f);
                //Ref<Effect> screenRef = new Ref<Effect>(GetEffect("Effects/ScreenDistort")); // The path to the compiled shader file.
                //Filters.Scene["BlackHole"] = new Filter(new ScreenShaderData(screenRef, "BlackHole"), EffectPriority.VeryHigh);
                //Filters.Scene["BlackHole"].Load();
                eyndumCoreUI        = new UserInterface();
                eyndumCoreUITexture = GetTexture("UI/CoreSlot");
                eyndumCoreTexture   = GetTexture("Items/Armor/Eyndum/Eyndum_Breastplate_Body_Core");
            }
            Sounds.Krunch       = AddSound("Sounds/Custom/BurstCannon", SoundType.Item);
            Sounds.HeavyCannon  = AddSound("Sounds/Custom/HeavyCannon", SoundType.Item);
            Sounds.EnergyRipple = AddSound("Sounds/Custom/EnergyRipple", SoundType.Item);
            //OriginExtensions.initClone();
            Music.Dusk                       = MusicID.Eerie;
            Music.Defiled                    = MusicID.Corruption;
            Music.UndergroundDefiled         = MusicID.UndergroundCorruption;
            On.Terraria.NPC.UpdateCollision += (orig, self) => {
                int realID = self.type;
                if (self.modNPC is ISandsharkNPC shark)
                {
                    self.type = NPCID.SandShark;
                    try {
                        shark.PreUpdateCollision();
                        orig(self);
                    } finally {
                        shark.PostUpdateCollision();
                    }
                    self.type = realID;
                    return;
                }
                ITileCollideNPC tcnpc = self.modNPC as ITileCollideNPC;
                self.type = tcnpc?.CollisionType ?? realID;
                orig(self);
                self.type = realID;
            };
            On.Terraria.NPC.GetMeleeCollisionData += NPC_GetMeleeCollisionData;
            On.Terraria.WorldGen.GERunner         += OriginWorld.GERunnerHook;
            On.Terraria.WorldGen.Convert          += OriginWorld.ConvertHook;
            On.Terraria.Item.NewItem_int_int_int_int_int_int_bool_int_bool_bool += OriginGlobalItem.NewItemHook;
            Mod blockSwap = ModLoader.GetMod("BlockSwap");
            if (!(blockSwap is null || blockSwap.Version > new Version(1, 0, 1)))
            {
                On.Terraria.TileObject.CanPlace += (On.Terraria.TileObject.orig_CanPlace orig, int x, int y, int type, int style, int dir, out TileObject objectData, bool onlyCheck, bool checkStay) => {
                    if (type == 20)
                    {
                        Tile soil = Main.tile[x, y + 1];
                        if (soil.active())
                        {
                            TileLoader.SaplingGrowthType(soil.type, ref type, ref style);
                        }
                    }
                    return(orig(x, y, type, style, dir, out objectData, onlyCheck, checkStay));
                }
            }
            ;
            Tiles.Defiled.Defiled_Tree.Load();
            OriginWorld worldInstance = ModContent.GetInstance <OriginWorld>();
            if (!(worldInstance is null))
            {
                worldInstance.defiledResurgenceTiles    = new List <(int, int)> {
                };
                worldInstance.defiledAltResurgenceTiles = new List <(int, int, ushort)> {
                };
            }
            //IL.Terraria.WorldGen.GERunner+=OriginWorld.GERunnerHook;
            On.Terraria.Main.DrawInterface_Resources_Breath += FixedDrawBreath;
            On.Terraria.WorldGen.CountTiles           += WorldGen_CountTiles;
            On.Terraria.WorldGen.AddUpAlignmentCounts += WorldGen_AddUpAlignmentCounts;
            Terraria.IO.WorldFile.OnWorldLoad         += () => {
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    for (int i = 0; i < Main.maxTilesX; i++)
                    {
                        WorldGen.CountTiles(i);
                    }
                }
            };
            On.Terraria.Lang.GetDryadWorldStatusDialog += Lang_GetDryadWorldStatusDialog;
            HookEndpointManager.Add(typeof(TileLoader).GetMethod("MineDamage", BindingFlags.Public | BindingFlags.Static), (hook_MinePower)MineDamage);
            On.Terraria.Main.DrawPlayer_DrawAllLayers += Main_DrawPlayer_DrawAllLayers;
        }