Exemple #1
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The mod settings.</param>
 public Cheats(ModConfig config)
 {
     this.Config = config;
 }
Exemple #2
0
        /// <summary>Set the options to display.</summary>
        private void SetOptions()
        {
            CheatManager cheats  = this.Cheats;
            CheatContext context = cheats.Context;
            ModConfig    config  = context.Config;

            cheats.Context.SlotWidth = this.OptionSlots[0].bounds.Width;

            this.Options.Clear();
            switch (this.CurrentTab)
            {
            case MenuTab.PlayerAndTools:
                // player
                this.AddOptions(
                    $"{I18n.Player_Title()}:",
                    cheats.InfiniteHealth,
                    cheats.InfiniteStamina,
                    cheats.InstantCooldowns,
                    cheats.OneHitKill,
                    cheats.MaxDailyLuck,
                    cheats.MoveSpeed,
                    cheats.InventorySize
                    );

                // tools
                this.AddOptions(
                    $"{I18n.Tools_Title()}:",
                    cheats.InfiniteWater,
                    cheats.OneHitBreak,
                    cheats.HarvestWithScythe
                    );

                // money
                this.AddOptions(
                    $"{I18n.Money_Title()}:",
                    cheats.AddMoney
                    );

                // casino coins
                this.AddOptions(
                    $"{I18n.CasinoCoins_Title()}:",
                    cheats.AddCasinoCoins
                    );
                break;

            case MenuTab.FarmAndFishing:
                // farming
                this.AddOptions(
                    $"{I18n.Farm_Title()}:",
                    cheats.AutoWater,
                    cheats.DurableFences,
                    cheats.InstantBuild,
                    cheats.AlwaysAutoFeed,
                    cheats.InfiniteHay
                    );

                // fishing
                this.AddOptions(
                    $"{I18n.Fishing_Title()}:",
                    cheats.InstantFishCatch,
                    cheats.InstantFishBite,
                    cheats.AlwaysCastMaxDistance,
                    cheats.AlwaysFishTreasure,
                    cheats.DurableFishTackles
                    );

                // fast machines
                this.AddOptions(
                    $"{I18n.FastMachines_Title()}:",
                    cheats.FastMachines
                    );
                break;

            case MenuTab.Skills:
                // skills
                this.AddOptions(
                    $"{I18n.Skills_Title()}:",
                    cheats.Skills
                    );

                // professions
                this.AddOptions(
                    $"{I18n.Professions_Title()}:",
                    cheats.Professions
                    );
                break;

            case MenuTab.Weather:
                this.AddOptions(
                    $"{I18n.Weather_Title()}:",
                    cheats.SetWeatherForTomorrow
                    );
                break;

            case MenuTab.Relationships:
                // relationship options
                this.AddOptions(
                    $"{I18n.Relationships_Title()}:",
                    cheats.AlwaysGiveGifts,
                    cheats.NoFriendshipDecay
                    );

                // heart levels
                this.AddOptions(
                    $"{I18n.Relationships_Friends()}:",
                    cheats.Hearts
                    );
                break;

            case MenuTab.WarpLocations:
                this.AddOptions(
                    cheats.Warps     // grouped into sections, no need for a tab title
                    );
                break;

            case MenuTab.Time:
                this.AddOptions(
                    $"{I18n.Time_Title()}:",
                    cheats.FreezeTime,
                    cheats.SetTime
                    );
                break;

            case MenuTab.Advanced:
            {
                this.AddDescription(I18n.Flags_Warning());

                // quests
                this.AddOptions(
                    $"{I18n.Flags_Quests()}:",
                    cheats.Quests
                    );

                // wallet items
                this.AddOptions(
                    $"{I18n.Flags_Wallet()}:",
                    cheats.WalletItems
                    );

                // locked doors
                this.AddOptions(
                    $"{I18n.Flags_Unlocked()}:",
                    cheats.UnlockDoor
                    );

                // locked content
                this.AddOptions(
                    $"{I18n.Flags_UnlockedContent()}:",
                    cheats.UnlockContent
                    );

                // community center
                this.AddOptions(
                    $"{I18n.Flags_CommunityCenter()}:",
                    cheats.Bundles
                    );
            }
            break;

            case MenuTab.Controls:
                this.AddTitle($"{I18n.Controls_Title()}:");

                if (this.IsAndroid)
                {
                    this.AddDescription(I18n.Controls_AndroidConfigNote());
                }

                this.AddOptions(
                    new CheatsOptionsKeyListener(
                        label: I18n.Controls_OpenMenu(),
                        value: config.OpenMenuKey,
                        setValue: key => config.OpenMenuKey = key,
                        slotWidth: context.SlotWidth,
                        clearToButton: ModConfig.Defaults.OpenMenuKey
                        ),
                    new CheatsOptionsKeyListener(
                        label: I18n.Controls_FreezeTime(),
                        value: config.FreezeTimeKey,
                        setValue: key => config.FreezeTimeKey = key,
                        slotWidth: context.SlotWidth
                        ),
                    new CheatsOptionsKeyListener(
                        label: I18n.Controls_GrowTree(),
                        value: config.GrowTreeKey,
                        setValue: key => config.GrowTreeKey = key,
                        slotWidth: context.SlotWidth
                        ),
                    new CheatsOptionsKeyListener(
                        label: I18n.Controls_GrowCrops(),
                        value: config.GrowCropsKey,
                        setValue: key => config.GrowCropsKey = key,
                        slotWidth: context.SlotWidth
                        ),
                    new CheatsOptionsSlider(
                        label: I18n.Controls_GrowRadius(),
                        value: config.GrowRadius,
                        minValue: 1,
                        maxValue: 10,
                        setValue: value => config.GrowRadius = value,
                        disabled: () => config.GrowTreeKey == SButton.None && config.GrowCropsKey == SButton.None
                        ),
                    new OptionsElement(string.Empty),     // blank line
                    new CheatsOptionsButton(
                        label: I18n.Controls_ResetControls(),
                        toggle: this.ResetControls,
                        slotWidth: context.SlotWidth
                        )
                    );
                break;
            }
            this.SetScrollBarToCurrentIndex();
        }
Exemple #3
0
        /*********
        ** Public methods
        *********/
        public CheatsMenu(MenuTab tabIndex, ModConfig config, Cheats cheats, ITranslationHelper i18n)
            : base(Game1.viewport.Width / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2)
        {
            this.Config            = config;
            this.Cheats            = cheats;
            this.TranslationHelper = i18n;

            this.Title      = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2, this.yPositionOnScreen, Game1.tileSize * 4, Game1.tileSize), i18n.Get("title"));
            this.CurrentTab = tabIndex;

            {
                int i           = 0;
                int labelX      = (int)(this.xPositionOnScreen - Game1.tileSize * 4.8f);
                int labelY      = (int)(this.yPositionOnScreen + Game1.tileSize * 1.5f);
                int labelHeight = (int)(Game1.tileSize * 0.9F);

                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.PlayerAndTools.ToString(), i18n.Get("tabs.player-and-tools")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.FarmAndFishing.ToString(), i18n.Get("tabs.farm-and-fishing")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Skills.ToString(), i18n.Get("tabs.skills")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Weather.ToString(), i18n.Get("tabs.weather")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Relationships.ToString(), i18n.Get("tabs.relationships")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.WarpLocations.ToString(), i18n.Get("tabs.warp")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Time.ToString(), i18n.Get("tabs.time")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Quests.ToString(), i18n.Get("tabs.quests")));
                this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i, Game1.tileSize * 5, Game1.tileSize), MenuTab.Controls.ToString(), i18n.Get("tabs.controls")));
            }

            this.UpArrow         = new ClickableTextureComponent("up-arrow", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), Game1.pixelZoom);
            this.DownArrow       = new ClickableTextureComponent("down-arrow", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + this.height - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), Game1.pixelZoom);
            this.Scrollbar       = new ClickableTextureComponent("scrollbar", new Rectangle(this.UpArrow.bounds.X + Game1.pixelZoom * 3, this.UpArrow.bounds.Y + this.UpArrow.bounds.Height + Game1.pixelZoom, 6 * Game1.pixelZoom, 10 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(435, 463, 6, 10), Game1.pixelZoom);
            this.ScrollbarRunner = new Rectangle(this.Scrollbar.bounds.X, this.UpArrow.bounds.Y + this.UpArrow.bounds.Height + Game1.pixelZoom, this.Scrollbar.bounds.Width, this.height - Game1.tileSize * 2 - this.UpArrow.bounds.Height - Game1.pixelZoom * 2);
            for (int i = 0; i < CheatsMenu.ItemsPerPage; i++)
            {
                this.OptionSlots.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + i * ((this.height - Game1.tileSize * 2) / CheatsMenu.ItemsPerPage), this.width - Game1.tileSize / 2, (this.height - Game1.tileSize * 2) / CheatsMenu.ItemsPerPage + Game1.pixelZoom), string.Concat(i)));
            }

            switch (this.CurrentTab)
            {
            case MenuTab.PlayerAndTools:
                this.Options.Add(new OptionsElement($"{i18n.Get("player.title")}:"));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.infinite-stamina"), config.InfiniteStamina, value => config.InfiniteStamina             = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.infinite-health"), config.InfiniteHealth, value => config.InfiniteHealth                = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.increased-movement-speed"), config.IncreasedMovement, value => config.IncreasedMovement = value));
                this.Options.Add(new CheatsOptionsSlider(i18n.Get("player.movement-speed"), this.Config.MoveSpeed, 10, value => this.Config.MoveSpeed               = value, disabled: () => !this.Config.IncreasedMovement));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.one-hit-kill"), config.OneHitKill, value => config.OneHitKill       = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.max-daily-luck"), config.MaxDailyLuck, value => config.MaxDailyLuck = value));

                this.Options.Add(new OptionsElement($"{i18n.Get("tools.title")}:"));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("tools.infinite-water"), config.InfiniteWateringCan, value => config.InfiniteWateringCan = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("tools.one-hit-break"), config.OneHitBreak, value => config.OneHitBreak           = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("tools.harvest-with-sickle"), config.HarvestSickle, value => config.HarvestSickle = value));

                this.Options.Add(new OptionsElement($"{i18n.Get("money.title")}:"));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 100 }), 2, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 1000 }), 3, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 10000 }), 4, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 100000 }), 5, this.OptionSlots[0].bounds.Width, config, cheats, i18n));

                this.Options.Add(new OptionsElement($"{i18n.Get("casino-coins.title")}:"));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("casino-coins.add-amount", new { amount = 100 }), 6, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("casino-coins.add-amount", new { amount = 1000 }), 7, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("casino-coins.add-amount", new { amount = 10000 }), 8, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                break;

            case MenuTab.FarmAndFishing:
                this.Options.Add(new OptionsElement($"{i18n.Get("farm.title")}:"));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("farm.water-all-fields"), 9, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.durable-fences"), config.DurableFences, value => config.DurableFences = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.instant-build"), config.InstantBuild, value => config.InstantBuild    = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.always-auto-feed"), config.AutoFeed, value => config.AutoFeed         = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.infinite-hay"), config.InfiniteHay, value => config.InfiniteHay       = value));

                this.Options.Add(new OptionsElement($"{i18n.Get("fishing.title")}:"));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.instant-catch"), config.InstantCatch, value => config.InstantCatch = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.instant-bite"), config.InstantBite, value => config.InstantBite    = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.always-throw-max-distance"), config.ThrowBobberMax, value => config.ThrowBobberMax = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.always-treasure"), config.AlwaysTreasure, value => config.AlwaysTreasure           = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.durable-tackles"), config.DurableTackles, value => config.DurableTackles           = value));

                this.Options.Add(new OptionsElement($"{i18n.Get("fast-machines.title")}:"));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.cask"), config.FastCask, value => config.FastCask          = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.furnace"), config.FastFurnace, value => config.FastFurnace = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.recycling-machine"), config.FastRecyclingMachine, value => config.FastRecyclingMachine = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.crystalarium"), config.FastCrystalarium, value => config.FastCrystalarium        = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.incubator"), config.FastIncubator, value => config.FastIncubator                 = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.slime-incubator"), config.FastSlimeIncubator, value => config.FastSlimeIncubator = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.keg"), config.FastKeg, value => config.FastKeg = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.preserves-jar"), config.FastPreservesJar, value => config.FastPreservesJar = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.cheese-press"), config.FastCheesePress, value => config.FastCheesePress    = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.mayonnaise-machine"), config.FastMayonnaiseMachine, value => config.FastMayonnaiseMachine = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.loom"), config.FastLoom, value => config.FastLoom = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.oil-maker"), config.FastOilMaker, value => config.FastOilMaker                 = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.seed-maker"), config.FastSeedMaker, value => config.FastSeedMaker              = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.charcoal-kiln"), config.FastCharcoalKiln, value => config.FastCharcoalKiln     = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.slime-egg-press"), config.FastSlimeEggPress, value => config.FastSlimeEggPress = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.tapper"), config.FastTapper, value => config.FastTapper = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.lightning-rod"), config.FastLightningRod, value => config.FastLightningRod = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.bee-house"), config.FastBeeHouse, value => config.FastBeeHouse             = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.mushroom-box"), config.FastMushroomBox, value => config.FastMushroomBox    = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.worm-bin"), config.FastWormBin, value => config.FastWormBin        = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fast-machines.fruit-trees"), config.FastFruitTree, value => config.FastFruitTree = value));
                break;

            case MenuTab.Skills:
                this.Options.Add(new OptionsElement($"{i18n.Get("skills.title")}:"));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-farming"), 200, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-mining"), 201, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-foraging"), 202, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-fishing"), 203, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-combat"), 204, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.reset"), 205, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new OptionsElement($"{i18n.Get("professions.title")}:"));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.fighter"), this.GetProfession(SFarmer.fighter), value => this.SetProfession(SFarmer.fighter, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.scout"), this.GetProfession(SFarmer.scout), value => this.SetProfession(SFarmer.scout, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.acrobat"), this.GetProfession(SFarmer.acrobat), value => this.SetProfession(SFarmer.acrobat, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.brute"), this.GetProfession(SFarmer.brute), value => this.SetProfession(SFarmer.brute, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.defender"), this.GetProfession(SFarmer.defender), value => this.SetProfession(SFarmer.defender, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.desperado"), this.GetProfession(SFarmer.desperado), value => this.SetProfession(SFarmer.desperado, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.rancher"), this.GetProfession(SFarmer.rancher), value => this.SetProfession(SFarmer.rancher, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.tiller"), this.GetProfession(SFarmer.tiller), value => this.SetProfession(SFarmer.tiller, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.agriculturist"), this.GetProfession(SFarmer.agriculturist), value => this.SetProfession(SFarmer.agriculturist, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.artisan"), this.GetProfession(SFarmer.artisan), value => this.SetProfession(SFarmer.artisan, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.coopmaster"), this.GetProfession(SFarmer.butcher), value => this.SetProfession(SFarmer.butcher, value)));     // butcher = coopmaster
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.shepherd"), this.GetProfession(SFarmer.shepherd), value => this.SetProfession(SFarmer.shepherd, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.fisher"), this.GetProfession(SFarmer.fisher), value => this.SetProfession(SFarmer.fisher, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.trapper"), this.GetProfession(SFarmer.trapper), value => this.SetProfession(SFarmer.trapper, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.angler"), this.GetProfession(SFarmer.angler), value => this.SetProfession(SFarmer.angler, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.luremaster"), this.GetProfession(SFarmer.mariner), value => this.SetProfession(SFarmer.mariner, value)));     // mariner = luremaster (???)
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.mariner"), this.GetProfession(SFarmer.baitmaster), value => this.SetProfession(SFarmer.baitmaster, value)));  // baitmaster = mariner (???)
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.pirate"), this.GetProfession(SFarmer.pirate), value => this.SetProfession(SFarmer.pirate, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.forester"), this.GetProfession(SFarmer.forester), value => this.SetProfession(SFarmer.forester, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.gatherer"), this.GetProfession(SFarmer.gatherer), value => this.SetProfession(SFarmer.gatherer, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.botanist"), this.GetProfession(SFarmer.botanist), value => this.SetProfession(SFarmer.botanist, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.lumberjack"), this.GetProfession(SFarmer.lumberjack), value => this.SetProfession(SFarmer.lumberjack, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.tapper"), this.GetProfession(SFarmer.tapper), value => this.SetProfession(SFarmer.tapper, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.tracker"), this.GetProfession(SFarmer.tracker), value => this.SetProfession(SFarmer.tracker, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.geologist"), this.GetProfession(SFarmer.geologist), value => this.SetProfession(SFarmer.geologist, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.miner"), this.GetProfession(SFarmer.miner), value => this.SetProfession(SFarmer.miner, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.blacksmith"), this.GetProfession(SFarmer.blacksmith), value => this.SetProfession(SFarmer.blacksmith, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.excavator"), this.GetProfession(SFarmer.excavator), value => this.SetProfession(SFarmer.excavator, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.gemologist"), this.GetProfession(SFarmer.gemologist), value => this.SetProfession(SFarmer.gemologist, value)));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.prospector"), this.GetProfession(SFarmer.burrower), value => this.SetProfession(SFarmer.burrower, value)));     // burrower = prospector
                break;

            case MenuTab.Weather:
                this.Options.Add(new OptionsElement($"{i18n.Get("weather.title")}:"));
                this.Options.Add(new CheatsOptionsWeatherElement($"{i18n.Get("weather.current")}", () => CJB.GetWeatherNexDay(i18n)));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.sunny"), 10, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.raining"), 11, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.lightning"), 12, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.snowing"), 13, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                break;

            case MenuTab.Relationships:
            {
                this.Options.Add(new OptionsElement($"{i18n.Get("relationships.title")}:"));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("relationships.give-gifts-anytime"), config.AlwaysGiveGift, value => config.AlwaysGiveGift = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("relationships.no-decay"), config.NoFriendshipDecay, value => config.NoFriendshipDecay     = value));
                this.Options.Add(new OptionsElement($"{i18n.Get("relationships.friends")}:"));

                foreach (NPC npc in this.GetSocialCharacters().Distinct().OrderBy(p => p.displayName))
                {
                    this.Options.Add(new CheatsOptionsNpcSlider(npc, onValueChanged: points => this.Cheats.UpdateFriendship(npc, points)));
                }
            }
            break;

            case MenuTab.WarpLocations:
                this.Options.Add(new OptionsElement($"{i18n.Get("warp.title")}:"));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.farm"), 100, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.pierre-shop"), 101, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.blacksmith"), 102, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.museum"), 103, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.saloon"), 104, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.community-center"), 105, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.carpenter"), 106, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.adventurers-guild"), 107, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.ranch"), 113, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.mines"), 109, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.willy-shop"), 110, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.wizard-tower"), 114, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.hats"), 115, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.desert"), 112, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.sandy-shop"), 119, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.casino"), 120, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.quarry"), 108, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.new-beach"), 111, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.secret-woods"), 116, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.sewer"), 117, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.bathhouse"), 118, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                break;

            case MenuTab.Time:
                this.Options.Add(new OptionsElement($"{i18n.Get("time.title")}:"));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("time.freeze-inside"), config.FreezeTimeInside, value => config.FreezeTimeInside = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("time.freeze-caves"), config.FreezeTimeCaves, value => config.FreezeTimeCaves    = value));
                this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("time.freeze-everywhere"), config.FreezeTime, value => config.FreezeTime         = value));
                this.Options.Add(new CheatsOptionsSlider(i18n.Get("time.time"), (Game1.timeOfDay - 600) / 100, 19, value => this.SafelySetTime((value * 100) + 600), width: 100, format: value => Game1.getTimeOfDayString((value * 100) + 600)));
                break;

            case MenuTab.Quests:
            {
                this.Options.Add(new OptionsElement($"{i18n.Get("activequests.title")}:"));
                {
                    int i = 0;
                    foreach (Quest quest in Game1.player.questLog)
                    {
                        if (!quest.completed.Value)
                        {
                            this.Options.Add(new CheatsOptionsInputListener(quest.questTitle, 300 + i++, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                        }
                    }
                }
                this.Options.Add(new OptionsElement($"{i18n.Get("completedquests.title")}:"));

                foreach (Quest quest in Game1.player.questLog)
                {
                    if (quest.completed.Value)
                    {
                        this.Options.Add(new OptionsElement(quest.questTitle)
                            {
                                whichOption = -999
                            });
                    }
                }
            }
            break;

            case MenuTab.Controls:
                this.Options.Add(new OptionsElement($"{i18n.Get("controls.title")}:"));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.open-menu"), 1000, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.freeze-time"), 1001, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.grow-tree"), 1002, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.grow-crops"), 1003, this.OptionSlots[0].bounds.Width, config, cheats, i18n));
                break;
            }
            this.SetScrollBarToCurrentIndex();
        }
Exemple #4
0
        /// <summary>Set the options to display.</summary>
        private void SetOptions()
        {
            CheatManager       cheats  = this.Cheats;
            CheatContext       context = cheats.Context;
            ITranslationHelper text    = context.Text;
            ModConfig          config  = context.Config;

            cheats.Context.SlotWidth = this.OptionSlots[0].bounds.Width;

            this.Options.Clear();
            switch (this.CurrentTab)
            {
            case MenuTab.PlayerAndTools:
                // player
                this.AddOptions(
                    $"{text.Get("player.title")}:",
                    cheats.InfiniteHealth,
                    cheats.InfiniteStamina,
                    cheats.InstantCooldowns,
                    cheats.OneHitKill,
                    cheats.MaxDailyLuck,
                    cheats.MoveSpeed,
                    cheats.InventorySize
                    );

                // tools
                this.AddOptions(
                    $"{text.Get("tools.title")}:",
                    cheats.InfiniteWater,
                    cheats.OneHitBreak,
                    cheats.HarvestWithScythe
                    );

                // money
                this.AddOptions(
                    $"{text.Get("money.title")}:",
                    cheats.AddMoney
                    );

                // casino coins
                this.AddOptions(
                    $"{text.Get("casino-coins.title")}:",
                    cheats.AddCasinoCoins
                    );
                break;

            case MenuTab.FarmAndFishing:
                // farming
                this.AddOptions(
                    $"{text.Get("farm.title")}:",
                    cheats.AutoWater,
                    cheats.DurableFences,
                    cheats.InstantBuild,
                    cheats.AlwaysAutoFeed,
                    cheats.InfiniteHay
                    );

                // fishing
                this.AddOptions(
                    $"{text.Get("fishing.title")}:",
                    cheats.InstantFishCatch,
                    cheats.InstantFishBite,
                    cheats.AlwaysCastMaxDistance,
                    cheats.AlwaysFishTreasure,
                    cheats.DurableFishTackles
                    );

                // fast machines
                this.AddOptions(
                    $"{text.Get("fast-machines.title")}:",
                    cheats.FastMachines
                    );
                break;

            case MenuTab.Skills:
                // skills
                this.AddOptions(
                    $"{text.Get("skills.title")}:",
                    cheats.Skills
                    );

                // professions
                this.AddOptions(
                    $"{text.Get("professions.title")}:",
                    cheats.Professions
                    );
                break;

            case MenuTab.Weather:
                this.AddOptions(
                    $"{text.Get("weather.title")}:",
                    cheats.SetWeatherForTomorrow
                    );
                break;

            case MenuTab.Relationships:
                // relationship options
                this.AddOptions(
                    $"{text.Get("relationships.title")}:",
                    cheats.AlwaysGiveGifts,
                    cheats.NoFriendshipDecay
                    );

                // heart levels
                this.AddOptions(
                    $"{text.Get("relationships.friends")}:",
                    cheats.Hearts
                    );
                break;

            case MenuTab.WarpLocations:
                this.AddOptions(
                    cheats.Warps     // grouped into sections, no need for a tab title
                    );
                break;

            case MenuTab.Time:
                this.AddOptions(
                    $"{text.Get("time.title")}:",
                    cheats.FreezeTime,
                    cheats.SetTime
                    );
                break;

            case MenuTab.Advanced:
            {
                this.AddDescription(text.Get("flags.warning"));

                // quests
                this.AddOptions(
                    $"{text.Get("flags.quests")}:",
                    cheats.Quests
                    );

                // wallet items
                this.AddOptions(
                    $"{text.Get("flags.wallet")}:",
                    cheats.WalletItems
                    );

                // locked doors
                this.AddOptions(
                    $"{text.Get("flags.unlocked")}:",
                    cheats.UnlockDoor
                    );

                // locked content
                this.AddOptions(
                    $"{text.Get("flags.unlocked-content")}:",
                    cheats.UnlockContent
                    );

                // community center
                this.AddOptions(
                    $"{text.Get("flags.community-center")}:",
                    cheats.Bundles
                    );
            }
            break;

            case MenuTab.Controls:
                this.AddTitle($"{text.Get("controls.title")}:");

                if (this.IsAndroid)
                {
                    this.AddDescription(text.Get("controls.android-config-note"));
                }

                this.AddOptions(
                    new CheatsOptionsKeyListener(
                        label: text.Get("controls.open-menu"),
                        value: config.OpenMenuKey,
                        setValue: key => config.OpenMenuKey = key,
                        slotWidth: context.SlotWidth,
                        i18n: text,
                        clearToButton: ModConfig.Defaults.OpenMenuKey
                        ),
                    new CheatsOptionsKeyListener(
                        label: text.Get("controls.freeze-time"),
                        value: config.FreezeTimeKey,
                        setValue: key => config.FreezeTimeKey = key,
                        slotWidth: context.SlotWidth,
                        i18n: text
                        ),
                    new CheatsOptionsKeyListener(
                        label: text.Get("controls.grow-tree"),
                        value: config.GrowTreeKey,
                        setValue: key => config.GrowTreeKey = key,
                        slotWidth: context.SlotWidth,
                        i18n: text
                        ),
                    new CheatsOptionsKeyListener(
                        label: text.Get("controls.grow-crops"),
                        value: config.GrowCropsKey,
                        setValue: key => config.GrowCropsKey = key,
                        slotWidth: context.SlotWidth,
                        i18n: text
                        ),
                    new CheatsOptionsSlider(
                        label: text.Get("controls.grow-radius"),
                        value: config.GrowRadius,
                        minValue: 1,
                        maxValue: 10,
                        setValue: value => config.GrowRadius = value,
                        disabled: () => config.GrowTreeKey == SButton.None && config.GrowCropsKey == SButton.None
                        ),
                    new OptionsElement(string.Empty),     // blank line
                    new CheatsOptionsButton(
                        label: text.Get("controls.reset-controls"),
                        toggle: this.ResetControls,
                        slotWidth: context.SlotWidth
                        )
                    );
                break;
            }
            this.SetScrollBarToCurrentIndex();
        }
Exemple #5
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The mod settings.</param>
 /// <param name="translations">Provides translations stored in the mod folder.</param>
 public Cheats(ModConfig config, ITranslationHelper translations)
 {
     this.Config       = config;
     this.Translations = translations;
 }
Exemple #6
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="label">The field label.</param>
        /// <param name="whichOption">The option ID.</param>
        /// <param name="slotWidth">The field width.</param>
        /// <param name="config">The mod settings.</param>
        /// <param name="cheats">The cheats helper.</param>
        /// <param name="i18n">Provides translations for the mod.</param>
        public CheatsOptionsInputListener(string label, int whichOption, int slotWidth, ModConfig config, Cheats cheats, ITranslationHelper i18n)
            : base(label, -1, -1, slotWidth + 1, 11 * Game1.pixelZoom, whichOption)
        {
            this.Config           = config;
            this.Cheats           = cheats;
            this.PressNewKeyLabel = i18n.Get("messages.press-new-key");

            this.SetButtonBounds = new Rectangle(slotWidth - 28 * Game1.pixelZoom, -1 + Game1.pixelZoom * 3, 21 * Game1.pixelZoom, 11 * Game1.pixelZoom);
            if (whichOption == -1)
            {
                return;
            }

            switch (whichOption)
            {
            case 1000:
                this.ButtonNames.Add(this.Config.OpenMenuKey.ToString());
                break;

            case 1001:
                this.ButtonNames.Add(this.Config.FreezeTimeKey.ToString());
                break;

            case 1002:
                this.ButtonNames.Add(this.Config.GrowTreeKey.ToString());
                break;

            case 1003:
                this.ButtonNames.Add(this.Config.GrowCropsKey.ToString());
                break;
            }
        }
Exemple #7
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="config">The mod configuration.</param>
 /// <param name="reflection">Simplifies access to private code.</param>
 /// <param name="getAllLocations">Get a cached list of all in-game locations.</param>
 public CheatContext(ModConfig config, IReflectionHelper reflection, Func <IEnumerable <GameLocation> > getAllLocations)
 {
     this.Config              = config;
     this.Reflection          = reflection;
     this.GetAllLocationsImpl = getAllLocations;
 }