/*********
        ** Private methods
        *********/
        /// <summary>Get whether an object is a machine with 'fast processing' enabled.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="obj">The machine to check.</param>
        private bool IsFastMachine(CheatContext context, SObject obj)
        {
            // quick initial check
            bool mayBeMachine = obj != null && (obj.bigCraftable.Value || obj is CrabPot);

            if (!mayBeMachine)
            {
                return(false);
            }

            // specific check
            ModConfig config = context.Config;

            return(obj switch
            {
                Cask _ => config.FastCask,
                CrabPot _ => config.FastCrabPot,
                WoodChipper _ => config.FastWoodChipper,
                _ => obj.name switch
                {
                    "Bee House" => config.FastBeeHouse,
                    "Bone Mill" => config.FastBoneMill,
                    "Charcoal Kiln" => config.FastCharcoalKiln,
                    "Cheese Press" => config.FastCheesePress,
                    "Coffee Maker" => config.FastCoffeeMaker,
                    "Crystalarium" => config.FastCrystalarium,
                    "Deconstructor" => config.FastDeconstructor,
                    "Furnace" => config.FastFurnace,
                    "Geode Crusher" => config.FastGeodeCrusher,
                    "Heavy Tapper" => config.FastTapper,
                    "Incubator" => config.FastIncubator,
                    "Keg" => config.FastKeg,
                    "Lightning Rod" => config.FastLightningRod,
                    "Loom" => config.FastLoom,
                    "Mayonnaise Machine" => config.FastMayonnaiseMachine,
                    "Mushroom Box" => config.FastMushroomBox,
                    "Oil Maker" => config.FastOilMaker,
                    "Ostrich Incubator" => config.FastOstrichIncubator,
                    "Preserves Jar" => config.FastPreservesJar,
                    "Recycling Machine" => config.FastRecyclingMachine,
                    "Seed Maker" => config.FastSeedMaker,
                    "Slime Egg-Press" => config.FastSlimeEggPress,
                    "Slime Incubator" => config.FastSlimeIncubator,
                    "Soda Machine" => config.FastSodaMachine,
                    "Solar Panel" => config.FastSolarPanel,
                    "Statue Of Endless Fortune" => config.FastStatueOfEndlessFortune,
                    "Statue Of Perfection" => config.FastStatueOfPerfection,
                    "Statue Of True Perfection" => config.FastStatueOfTruePerfection,
                    "Tapper" => config.FastTapper,
                    "Worm Bin" => config.FastWormBin,
                    _ => false
                }
            });
Beispiel #2
0
 /*********
 ** Public methods
 *********/
 /// <summary>Get the config UI fields to show in the cheats menu.</summary>
 /// <param name="context">The cheat context.</param>
 public override IEnumerable <OptionsElement> GetFields(CheatContext context)
 {
     yield return(new CheatsOptionsSlider(
                      label: context.Text.Get("player.movement-speed"),
                      value: context.Config.MoveSpeed,
                      maxValue: 10,
                      setValue: value => context.Config.MoveSpeed = value,
                      format: val => val == 0
             ? context.Text.Get("player.movement-speed.default")
             : val.ToString()
                      ));
 }
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            if (this.ShouldFreezeTime(context.Config, Game1.currentLocation, out bool _))
            {
                Game1.gameTimeInterval = 0;
            }
        }
Beispiel #4
0
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            foreach (Friendship friendship in Game1.player.friendshipData.Values)
            {
                friendship.GiftsThisWeek = 0;
                friendship.GiftsToday    = 0;
            }
        }
Beispiel #5
0
        /// <summary>Handle the player loading a save file.</summary>
        /// <param name="context">The cheat context.</param>
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!e.IsOneSecond || !Context.IsWorldReady)
            {
                return;
            }
            IEnumerable <FarmAnimal> animals = Game1.getFarm().getAllFarmAnimals().Distinct();

            foreach (FarmAnimal animal in animals)
            {
                animal.wasPet.Set(true);
            }
        }
Beispiel #6
0
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!e.IsOneSecond || !Context.IsWorldReady)
            {
                return;
            }

            Farm farm = Game1.getFarm();

            if (farm == null || farm.piecesOfHay.Value <= 0)
            {
                return;
            }

            foreach (GameLocation location in context.GetAllLocations())
            {
                switch (location)
                {
                case AnimalHouse animalHouse:
                {
                    int animalCount = Math.Min(animalHouse.animalsThatLiveHere.Count, animalHouse.animalLimit.Value);
                    if (animalHouse.numberOfObjectsWithName("Hay") >= animalCount)
                    {
                        continue;
                    }

                    int tileX = animalHouse.Name.Contains("Barn")
                                ? 8
                                : 6;

                    for (int i = 0; i < animalCount && farm.piecesOfHay.Value > 0; i++)
                    {
                        Vector2 tile = new Vector2(tileX + i, 3);
                        if (!animalHouse.objects.ContainsKey(tile))
                        {
                            animalHouse.objects.Add(tile, new Object(178, 1));
                            farm.piecesOfHay.Value--;
                        }
                    }
                }
                break;

                case SlimeHutch slimeHutch:
                    for (int i = 0; i < slimeHutch.waterSpots.Length; i++)
                    {
                        slimeHutch.waterSpots[i] = true;
                    }
                    break;
                }
            }
        }
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!e.IsOneSecond || !Context.IsWorldReady)
            {
                return;
            }

            Farm farm = Game1.getFarm();

            if (farm != null)
            {
                farm.piecesOfHay.Value = Utility.numSilos() * 240;
            }
        }
Beispiel #8
0
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!e.IsOneSecond || !Context.IsWorldReady)
            {
                return;
            }

            foreach (GameLocation location in context.GetAllLocations())
            {
                foreach (Fence fence in location.objects.Values.OfType <Fence>())
                {
                    fence.repair();
                }
            }
        }
Beispiel #9
0
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!Context.IsPlayerFree || (!this.ShouldGrowCrops && !this.ShouldGrowTrees))
            {
                return;
            }

            Vector2 playerTile = Game1.player.getTileLocation();

            if (playerTile != this.LastGrowOrigin || e.IsMultipleOf(30))
            {
                this.Grow(playerTile, radius: context.Config.GrowRadius);
                this.LastGrowOrigin = playerTile;
            }
        }
        /// <summary>Handle the player loading a save file.</summary>
        /// <param name="context">The cheat context.</param>
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!e.IsOneSecond || !Context.IsWorldReady)
            {
                return;
            }

            foreach (Pet pet in this.GetAllPets())
            {
                if (!pet.lastPetDay.TryGetValue(Game1.player.UniqueMultiplayerID, out int lastPetDay) || lastPetDay < Game1.Date.TotalDays)
                {
                    pet.checkAction(Game1.player, pet.currentLocation);
                }
            }
        }
Beispiel #11
0
 /*********
 ** Public methods
 *********/
 /// <summary>Get the config UI fields to show in the cheats menu.</summary>
 /// <param name="context">The cheat context.</param>
 public override IEnumerable <OptionsElement> GetFields(CheatContext context)
 {
     return(this.SortFields(
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\StringsFromCSFiles:SkillsPage.cs.11587"), Game1.player.canUnderstandDwarves, value => Game1.player.canUnderstandDwarves = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\StringsFromCSFiles:SkillsPage.cs.11588"), Game1.player.hasRustyKey, value => Game1.player.hasRustyKey = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\StringsFromCSFiles:SkillsPage.cs.11589"), Game1.player.hasClubCard, value => Game1.player.hasClubCard = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\StringsFromCSFiles:SkillsPage.cs.11590"), Game1.player.hasSpecialCharm, value => Game1.player.hasSpecialCharm = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\StringsFromCSFiles:SkillsPage.cs.11591"), Game1.player.hasSkullKey, value => Game1.player.hasSkullKey = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\Objects:MagnifyingGlass"), Game1.player.hasMagnifyingGlass, value => Game1.player.hasMagnifyingGlass = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\Objects:DarkTalisman"), Game1.player.hasDarkTalisman, value => Game1.player.hasDarkTalisman = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\Objects:MagicInk"), Game1.player.hasMagicInk, value => Game1.player.hasMagicInk = value),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\Objects:BearPaw"), this.HasEvent(2120303), value => this.SetEvent(2120303, value)),
                new CheatsOptionsCheckbox(Game1.content.LoadString(@"Strings\Objects:SpringOnionBugs"), this.HasEvent(3910979), value => this.SetEvent(3910979, value))
                ));
 }
Beispiel #12
0
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            foreach (Monster monster in Game1.currentLocation.characters.OfType <Monster>())
            {
                if (monster.Health > 1)
                {
                    monster.Health = 1;
                }
            }
        }
Beispiel #13
0
        public override async ValueTask <bool> ReportCheatAsync(CheatContext context, string message)
        {
            if (!_antiCheatConfig.Enabled)
            {
                return(false);
            }

            if (_antiCheatConfig.BanIpFromGame)
            {
                Player?.Game.BanIp(Connection.EndPoint.Address);
            }

            await DisconnectAsync(DisconnectReason.Hacking, context.Name + ": " + message);

            return(true);
        }
Beispiel #14
0
 /*********
 ** Public methods
 *********/
 /// <summary>Get the config UI fields to show in the cheats menu.</summary>
 /// <param name="context">The cheat context.</param>
 public override IEnumerable <OptionsElement> GetFields(CheatContext context)
 {
     return(new[]
     {
         this.GetSkillButton(context, "farming", Farmer.farmingSkill, Game1.player.FarmingLevel),
         this.GetSkillButton(context, "mining", Farmer.miningSkill, Game1.player.MiningLevel),
         this.GetSkillButton(context, "foraging", Farmer.foragingSkill, Game1.player.ForagingLevel),
         this.GetSkillButton(context, "fishing", Farmer.fishingSkill, Game1.player.FishingLevel),
         this.GetSkillButton(context, "combat", Farmer.combatSkill, Game1.player.CombatLevel),
         new CheatsOptionsButton(
             label: context.Text.Get("skills.reset"),
             slotWidth: context.SlotWidth,
             toggle: this.ResetAllSkills
             )
     });
 }
Beispiel #15
0
        /*********
        ** Public methods
        *********/
        /// <summary>Get the config UI fields to show in the cheats menu.</summary>
        /// <param name="context">The cheat context.</param>
        public override IEnumerable <OptionsElement> GetFields(CheatContext context)
        {
            foreach (Quest quest in Game1.player.questLog)
            {
                if (quest.completed.Value)
                {
                    continue;
                }

                yield return(new CheatsOptionsButton(
                                 label: quest.questTitle,
                                 slotWidth: context.SlotWidth,
                                 toggle: () => this.CompleteQuest(quest)
                                 ));
            }
        }
Beispiel #16
0
        /// <summary>Handle the player loading a save file.</summary>
        /// <param name="context">The cheat context.</param>
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!e.IsOneSecond || !Context.IsWorldReady)
            {
                return;
            }

            FarmAnimal[] animalsToPet = Game1
                                        .getFarm()
                                        .getAllFarmAnimals()
                                        .Where(p => !p.wasPet.Value)
                                        .ToArray();

            if (animalsToPet.Any())
            {
                int  wasTime          = Game1.timeOfDay;
                Item wasTemporaryItem = Game1.player.TemporaryItem;

                try
                {
                    // avoid feeding hay
                    if (Utility.IsNormalObjectAtParentSheetIndex(Game1.player.ActiveObject, 178))
                    {
                        Game1.player.TemporaryItem = new Object(0, 1);
                    }

                    // avoid 'trying to sleep' dialogue popup
                    if (Game1.timeOfDay >= 1900)
                    {
                        Game1.timeOfDay = 1850;
                    }

                    // pet animals
                    foreach (FarmAnimal animal in animalsToPet)
                    {
                        animal.pet(Game1.player);
                    }
                }
                finally
                {
                    // restore previous values
                    Game1.player.TemporaryItem = wasTemporaryItem;
                    Game1.timeOfDay            = wasTime;
                }
            }
        }
Beispiel #17
0
        public override async ValueTask<bool> ReportCheatAsync(CheatContext context, string message)
        {
            _logger.LogWarning("Client {Name} ({Id}) was caught cheating: [{Context}] {Message}", Name, Id, context.Name, message);

            if (!_antiCheatConfig.Enabled)
            {
                return false;
            }

            if (_antiCheatConfig.BanIpFromGame)
            {
                Player?.Game.BanIp(Connection.EndPoint.Address);
            }

            await DisconnectAsync(DisconnectReason.Hacking, context.Name + ": " + message);

            return true;
        }
Beispiel #18
0
        /*********
        ** Public methods
        *********/
        /// <summary>Get the config UI fields to show in the cheats menu.</summary>
        /// <param name="context">The cheat context.</param>
        public override IEnumerable <OptionsElement> GetFields(CheatContext context)
        {
            // adventurer's guild
            yield return(new CheatsOptionsCheckbox(
                             label: context.Text.Get("flags.unlocked.guild"),
                             value: this.HasFlag("guildMember"),
                             setValue: value => this.SetFlag(value, "guildMember")
                             ));

            // NPC rooms
            foreach (NPC npc in this.GetSocialCharacters().OrderBy(p => p.displayName))
            {
                yield return(new CheatsOptionsCheckbox(
                                 label: context.Text.Get("flags.unlocked.room", new { name = npc.displayName }),
                                 value: this.HasFlag($"doorUnlock{npc.Name}"),
                                 setValue: value => this.SetFlag(value, $"doorUnlock{npc.Name}")
                                 ));
            }
        }
Beispiel #19
0
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            var monsters = Game1.currentLocation?.characters?.OfType <Monster>();

            if (monsters != null) // some custom locations can have null characters list
            {
                foreach (Monster monster in monsters)
                {
                    if (monster.Health > 1)
                    {
                        monster.Health = 1;
                    }
                }
            }
        }
        /// <summary>Handle the cheat options being loaded or changed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="needsUpdate">Whether the cheat should be notified of game updates.</param>
        /// <param name="needsInput">Whether the cheat should be notified of button presses.</param>
        /// <param name="needsRendering">Whether the cheat should be notified of render ticks.</param>
        public override void OnConfig(CheatContext context, out bool needsInput, out bool needsUpdate, out bool needsRendering)
        {
            bool enabled = context.Config.HarvestScythe;

            needsInput     = false;
            needsUpdate    = enabled;
            needsRendering = false;

            // disable harvest with scythe
            if (!enabled)
            {
                IDictionary <int, int> cropHarvestMethods = this.GetCropHarvestMethods();
                foreach (Crop crop in context.GetAllLocations().SelectMany(this.GetCropsIn))
                {
                    if (cropHarvestMethods.TryGetValue(crop.indexOfHarvest.Value, out int harvestMethod))
                    {
                        crop.harvestMethod.Value = harvestMethod;
                    }
                }
            }
        }
        /*********
        ** Public methods
        *********/
        /// <summary>Get the config UI fields to show in the cheats menu.</summary>
        /// <param name="context">The cheat context.</param>
        public override IEnumerable <OptionsElement> GetFields(CheatContext context)
        {
            return(new[]
            {
                this.GetField(I18n.Professions_Combat_Fighter(), Farmer.fighter),
                this.GetField(I18n.Professions_Combat_Scout(), Farmer.scout),
                this.GetField(I18n.Professions_Combat_Acrobat(), Farmer.acrobat),
                this.GetField(I18n.Professions_Combat_Brute(), Farmer.brute),
                this.GetField(I18n.Professions_Combat_Defender(), Farmer.defender),
                this.GetField(I18n.Professions_Combat_Desperado(), Farmer.desperado),

                this.GetField(I18n.Professions_Farming_Rancher(), Farmer.rancher),
                this.GetField(I18n.Professions_Farming_Tiller(), Farmer.tiller),
                this.GetField(I18n.Professions_Farming_Agriculturist(), Farmer.agriculturist),
                this.GetField(I18n.Professions_Farming_Artisan(), Farmer.artisan),
                this.GetField(I18n.Professions_Farming_Coopmaster(), Farmer.butcher), // butcher = coopmaster
                this.GetField(I18n.Professions_Farming_Shepherd(), Farmer.shepherd),

                this.GetField(I18n.Professions_Fishing_Fisher(), Farmer.fisher),
                this.GetField(I18n.Professions_Fishing_Trapper(), Farmer.trapper),
                this.GetField(I18n.Professions_Fishing_Angler(), Farmer.angler),
                this.GetField(I18n.Professions_Fishing_Luremaster(), Farmer.mariner), // mariner = luremaster (??)
                this.GetField(I18n.Professions_Fishing_Mariner(), Farmer.baitmaster), // baitmaster = mariner (??)
                this.GetField(I18n.Professions_Fishing_Pirate(), Farmer.pirate),

                this.GetField(I18n.Professions_Foraging_Forester(), Farmer.forester),
                this.GetField(I18n.Professions_Foraging_Gatherer(), Farmer.gatherer),
                this.GetField(I18n.Professions_Foraging_Botanist(), Farmer.botanist),
                this.GetField(I18n.Professions_Foraging_Lumberjack(), Farmer.lumberjack),
                this.GetField(I18n.Professions_Foraging_Tapper(), Farmer.tapper),
                this.GetField(I18n.Professions_Foraging_Tracker(), Farmer.tracker),

                this.GetField(I18n.Professions_Mining_Geologist(), Farmer.geologist),
                this.GetField(I18n.Professions_Mining_Miner(), Farmer.miner),
                this.GetField(I18n.Professions_Mining_Blacksmith(), Farmer.blacksmith),
                this.GetField(I18n.Professions_Mining_Excavator(), Farmer.excavator),
                this.GetField(I18n.Professions_Mining_Gemologist(), Farmer.gemologist),
                this.GetField(I18n.Professions_Mining_Prospector(), Farmer.burrower) // burrower = prospecter
            });
        }
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            if (!e.IsOneSecond || !Context.IsWorldReady)
            {
                return;
            }

            foreach (BuildableGameLocation location in context.GetAllLocations().OfType <BuildableGameLocation>())
            {
                foreach (Building building in location.buildings)
                {
                    if (building.daysOfConstructionLeft.Value > 0)
                    {
                        building.dayUpdate(0);
                    }
                    if (building.daysUntilUpgrade.Value > 0)
                    {
                        building.dayUpdate(0);
                    }
                }
            }
        }
        /// <summary>Handle a game update if <see cref="ICheat.OnSaveLoaded"/> indicated updates were needed.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="e">The update event arguments.</param>
        public override void OnUpdated(CheatContext context, UpdateTickedEventArgs e)
        {
            // skip if not using a tool
            if (!Context.IsPlayerFree || !Game1.player.UsingTool || !(Game1.player.CurrentTool is Axe || Game1.player.CurrentTool is Pickaxe))
            {
                return;
            }

            Farmer player   = Game1.player;
            var    tool     = player.CurrentTool;
            var    location = player.currentLocation;

            if (location == null)
            {
                return;
            }

            // get affected tile
            Vector2 tile = new Vector2((int)player.GetToolLocation().X / Game1.tileSize, (int)player.GetToolLocation().Y / Game1.tileSize);

            // break stones
            if (tool is Pickaxe && location.objects.TryGetValue(tile, out SObject obj) && obj?.name == "Stone")
            {
                obj.MinutesUntilReady = 0;
            }

            // break trees
            if (tool is Axe && location.terrainFeatures.TryGetValue(tile, out TerrainFeature feature))
            {
                if (feature is Tree tree && tree.health.Value > 1)
                {
                    tree.health.Value = 1;
                }
                else if (feature is FruitTree fruitTree && fruitTree.health.Value > 1)
                {
                    fruitTree.health.Value = 1;
                }
            }
        /// <summary>Get the display text for the current weather for tomorrow.</summary>
        /// <param name="context">The cheat context.</param>
        public string GetWeatherForNextDay(CheatContext context)
        {
            switch (Game1.weatherForTomorrow)
            {
            case Game1.weather_sunny:
            case Game1.weather_debris:
            case Game1.weather_festival:
            case Game1.weather_wedding:
                return(I18n.Weather_Sunny());

            case Game1.weather_rain:
                return(I18n.Weather_Raining());

            case Game1.weather_lightning:
                return(I18n.Weather_Lightning());

            case Game1.weather_snow:
                return(I18n.Weather_Snowing());

            default:
                return("");
            }
        }
Beispiel #25
0
        /// <summary>Render the 'time frozen' box in the top-left.</summary>
        /// <param name="context">The cheat context.</param>
        /// <param name="spriteBatch">The sprite batch being drawn.</param>
        /// <param name="isCave">Whether the given location is a cave.</param>
        private void RenderTimeFrozenBox(CheatContext context, SpriteBatch spriteBatch, bool isCave)
        {
            // get default draw settings
            int        x    = 5;
            int        y    = isCave ? 100 : 5;
            SpriteFont font = Game1.smallFont;
            string     text = I18n.Time_TimeFrozenMessage();

            // render
            if (Constants.TargetPlatform == GamePlatform.Android)
            {
                if (Game1.activeClickableMenu != null)
                {
                    return;
                }

                bool  hasVerticalToolbar = context.Reflection.GetField <bool>(Game1.options, "verticalToolbar").GetValue();
                float nativeZoomLevel    = context.Reflection.GetProperty <float>(typeof(Game1), "NativeZoomLevel").GetValue();

                // for Android, draw in a separate sprite batch whose scaling reverses the pinch zoom to keep the text box a stable size
                if (Constants.TargetPlatform == GamePlatform.Android)
                {
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, Matrix.CreateScale(nativeZoomLevel));
                }
                CommonHelper.DrawTab(x: 80 + (hasVerticalToolbar ? 160 : 80), y, font, text);
                if (Constants.TargetPlatform == GamePlatform.Android)
                {
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone);
                }
            }
            else
            {
                CommonHelper.DrawTab(x, y, font, text);
            }
        }
Beispiel #26
0
 /*********
 ** Public methods
 *********/
 /// <summary>Get the config UI fields to show in the cheats menu.</summary>
 /// <param name="context">The cheat context.</param>
 public override IEnumerable <OptionsElement> GetFields(CheatContext context)
 {
     return(new[]
     {
         this.GetField(context, "combat.fighter", Farmer.fighter),
         this.GetField(context, "combat.scout", Farmer.scout),
         this.GetField(context, "combat.acrobat", Farmer.acrobat),
         this.GetField(context, "combat.brute", Farmer.brute),
         this.GetField(context, "combat.defender", Farmer.defender),
         this.GetField(context, "combat.desperado", Farmer.desperado),
         this.GetField(context, "farming.rancher", Farmer.rancher),
         this.GetField(context, "farming.tiller", Farmer.tiller),
         this.GetField(context, "farming.agriculturist", Farmer.agriculturist),
         this.GetField(context, "farming.artisan", Farmer.artisan),
         this.GetField(context, "farming.coopmaster", Farmer.butcher), // butcher = coopmaster
         this.GetField(context, "farming.shepherd", Farmer.shepherd),
         this.GetField(context, "fishing.fisher", Farmer.fisher),
         this.GetField(context, "fishing.trapper", Farmer.trapper),
         this.GetField(context, "fishing.angler", Farmer.angler),
         this.GetField(context, "fishing.luremaster", Farmer.mariner), // mariner = luremaster (??)
         this.GetField(context, "fishing.mariner", Farmer.baitmaster), // baitmaster = mariner (??)
         this.GetField(context, "fishing.pirate", Farmer.pirate),
         this.GetField(context, "foraging.forester", Farmer.forester),
         this.GetField(context, "foraging.gatherer", Farmer.gatherer),
         this.GetField(context, "foraging.botanist", Farmer.botanist),
         this.GetField(context, "foraging.lumberjack", Farmer.lumberjack),
         this.GetField(context, "foraging.tapper", Farmer.tapper),
         this.GetField(context, "foraging.tracker", Farmer.tracker),
         this.GetField(context, "mining.geologist", Farmer.geologist),
         this.GetField(context, "mining.miner", Farmer.miner),
         this.GetField(context, "mining.blacksmith", Farmer.blacksmith),
         this.GetField(context, "mining.excavator", Farmer.excavator),
         this.GetField(context, "mining.gemologist", Farmer.gemologist),
         this.GetField(context, "mining.prospector", Farmer.burrower) // burrower = prospecter
     });
 }
Beispiel #27
0
        /// <summary>Get the config UI fields to show in the cheats menu.</summary>
        /// <param name="context">The cheat context.</param>
        public override IEnumerable <OptionsElement> GetFields(CheatContext context)
        {
            bool isJojaMember = this.HasFlag("JojaMember");

            ModData warpData = this.GetWarpData();
            IDictionary <string, int>           sectionOrder   = this.GetSectionOrder(warpData);
            IDictionary <string, ModDataWarp[]> warpsBySection = this.GetWarpsBySection(warpData);

            foreach ((string sectionKey, string sectionLabel) in this.GetSections(sectionOrder, warpsBySection))
            {
                // section title
                yield return(new OptionsElement($"{sectionLabel}:"));

                // warps
                foreach ((ModDataWarp warp, string warpLabel) in this.GetWarps(warpsBySection, sectionKey))
                {
                    // skip warps that don't apply
                    switch (warp.SpecialBehavior)
                    {
                    case WarpBehavior.Casino when !Game1.player.hasClubCard:
                    case WarpBehavior.CommunityCenter when isJojaMember:
                    case WarpBehavior.JojaMart when !isJojaMember && CommonHelper.GetIsCommunityCenterComplete():
                    case WarpBehavior.MovieTheaterCommunity when isJojaMember || !this.HasFlag("ccMovieTheater"):
                    case WarpBehavior.MovieTheaterJoja when !isJojaMember || !this.HasFlag("ccMovieTheater"):
                        continue;
                    }

                    // get warp button
                    yield return(new CheatsOptionsButton(
                                     label: warpLabel,
                                     slotWidth: context.SlotWidth,
                                     toggle: warp.SpecialBehavior switch
                    {
                        WarpBehavior.Farm => this.WarpToFarm,
                        _ => () => this.Warp(warp.Location ?? "Farm", (int)warp.Tile.X, (int)warp.Tile.Y)
                    }
 /// <summary>Handle the cheat options being loaded or changed.</summary>
 /// <param name="context">The cheat context.</param>
 /// <param name="needsUpdate">Whether the cheat should be notified of game updates.</param>
 /// <param name="needsInput">Whether the cheat should be notified of button presses.</param>
 /// <param name="needsRendering">Whether the cheat should be notified of render ticks.</param>
 public override void OnConfig(CheatContext context, out bool needsInput, out bool needsUpdate, out bool needsRendering)
 {
     needsInput     = false;
     needsUpdate    = context.Config.AutoWater;
     needsRendering = false;
 }
Beispiel #29
0
 /// <summary>Handle the cheat options being loaded or changed.</summary>
 /// <param name="context">The cheat context.</param>
 /// <param name="needsUpdate">Whether the cheat should be notified of game updates.</param>
 /// <param name="needsInput">Whether the cheat should be notified of button presses.</param>
 /// <param name="needsRendering">Whether the cheat should be notified of render ticks.</param>
 public override void OnConfig(CheatContext context, out bool needsInput, out bool needsUpdate, out bool needsRendering)
 {
     needsInput     = false;
     needsUpdate    = context.Config.ThrowBobberMax;
     needsRendering = false;
 }
Beispiel #30
0
 /// <summary>Handle the cheat options being loaded or changed.</summary>
 /// <param name="context">The cheat context.</param>
 /// <param name="needsUpdate">Whether the cheat should be notified of game updates.</param>
 /// <param name="needsInput">Whether the cheat should be notified of button presses.</param>
 /// <param name="needsRendering">Whether the cheat should be notified of render ticks.</param>
 public override void OnConfig(CheatContext context, out bool needsInput, out bool needsUpdate, out bool needsRendering)
 {
     needsInput     = context.Config.FreezeTimeKey.IsBound;
     needsUpdate    = needsInput || context.Config.FreezeTime || context.Config.FreezeTimeInside || context.Config.FreezeTimeCaves;
     needsRendering = needsUpdate;
 }