Exemplo n.º 1
0
 public TrainerComponent(Game game)
     : base(game)
 {
     settings = new Settings();
     this.Enabled =
         settings.ManaBoots ||
         settings.RegenMana ||
         settings.RegenHealth;
 }
Exemplo n.º 2
0
        public WorldComponent(Game game)
            : base(game)
        {
            settings = new Settings();

            this.Enabled =
                GameSettings.Lava ||
                GameSettings.Rain ||
                GameSettings.WaterInHell ||
                GameSettings.InfiniteBloodMoon ||
                GameSettings.InfiniteGoblinInvasion ||
                GameSettings.SpawnEye ||
                GameSettings.LavaCleanup ||
                settings.ProfanityFilter;

            if (settings.ProfanityFilter)
            {
                using (var str = new StringReader(Resources.badwords))
                {
                    BadWords = new List<string>();

                    while (str.Peek() >= 0)
                    {
                        BadWords.Add(str.ReadLine().Trim('*', ' ').ToLowerInvariant());
                    }
                }

            }

            terrariaAssembly = Assembly.GetAssembly(typeof(Terraria.Main));
            main = terrariaAssembly.GetType("Terraria.Main");
            worldGen = terrariaAssembly.GetType("Terraria.WorldGen");

            foreach (var f in worldGen.GetFields())
            {
                if (f.Name == "shadowOrbSmashed")
                {
                    shadowOrbSmashed = f;
                }
                if (f.Name == "spawnEye")
                {
                    spawnEye = f;
                }
            }

            foreach (var f in main.GetMethods(BindingFlags.Static | BindingFlags.NonPublic))
            {
                if (f.Name == "StartInvasion")
                {
                    startInvasion = f;
                }
            }

            foreach (var f in main.GetFields())
            {
                if (f.Name == "bloodMoon")
                {
                    bloodMoon = f;
                }
                if (f.Name == "invasionSize")
                {
                    invasionSize = f;
                }
                if (f.Name == "time")
                {
                    time = f;
                }
            }
        }