private void GameEvents_OneSecondTick(object sender, EventArgs e) { if (Game1.hasLoadedGame) { Cheats.OneSecondUpdate(); } }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { // load config/data this.Config = helper.ReadConfig <ModConfig>(); this.Warps = helper.Data.ReadJsonFile <ModDataWarp[]>("data/warps.json"); if (this.Warps == null) { this.Monitor.Log("Some of the mod files are missing (data/warps.json); try reinstalling this mod.", LogLevel.Error); return; } this.Monitor.Log($"Started with menu key {this.Config.OpenMenuKey}.", LogLevel.Trace); // load cheats this.Cheats = new Cheats(this.Config, this.Helper.Translation); // hook events helper.Events.Display.Rendered += this.OnRendered; helper.Events.Display.MenuChanged += this.OnMenuChanged; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.Input.ButtonReleased += this.OnButtonReleased; helper.Events.World.LocationListChanged += this.OnLocationListChanged; }
private void Events_UpdateTick(object sender, EventArgs e) { if (!Game1.hasLoadedGame) { return; } Cheats.onUpdate(); }
private void TimeEvents_TimeOfDayChanged(object sender, EventArgsIntChanged e) { if (!Game1.hasLoadedGame) { return; } Cheats.onTimeOfDayChanged(); }
private void GraphicsEvents_DrawTick(object sender, EventArgs e) { if (!Game1.hasLoadedGame) { return; } Cheats.onDrawTick(); }
private void GraphicsEvents_DrawTick(object sender, EventArgs e) { if (!CJBCheatsMenu.IsLoaded) { return; } Cheats.OnDrawTick(); }
private void GameEvents_OneSecondTick(object sender, EventArgs e) { if (!CJBCheatsMenu.IsLoaded) { return; } Cheats.OneSecondUpdate(CJBCheatsMenu.Locations); }
private void Events_UpdateTick(object sender, EventArgs e) { if (!CJBCheatsMenu.IsLoaded) { return; } Cheats.OnUpdate(CJBCheatsMenu.Helper); }
private void TimeEvents_TimeOfDayChanged(object sender, EventArgsIntChanged e) { if (!CJBCheatsMenu.IsLoaded) { return; } Cheats.OnTimeOfDayChanged(); }
private void Events_KeyPressed(object sender, EventArgsKeyPressed e) { if (!CJBCheatsMenu.IsLoaded) { return; } Cheats.OnKeyPress(e.KeyPressed); }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { this.Config = helper.ReadConfig <ModConfig>(); this.Monitor.Log($"Started with menu key {this.Config.OpenMenuKey}.", LogLevel.Trace); this.Cheats = new Cheats(this.Config); helper.Events.Display.Rendered += this.OnRendered; helper.Events.Display.MenuChanged += this.OnMenuChanged; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.World.LocationListChanged += this.OnLocationListChanged; }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { this.Config = helper.ReadConfig <ModConfig>(); this.Cheats = new Cheats(this.Config); SaveEvents.AfterLoad += this.SaveEvents_AfterLoad; LocationEvents.LocationsChanged += this.LocationEvents_LocationsChanged; GameEvents.UpdateTick += this.Events_UpdateTick; GameEvents.OneSecondTick += this.GameEvents_OneSecondTick; TimeEvents.TimeOfDayChanged += this.TimeEvents_TimeOfDayChanged; ControlEvents.KeyPressed += this.Events_KeyPressed; ControlEvents.ControllerButtonPressed += this.ControlEvents_ControllerButtonPressed; GraphicsEvents.OnPostRenderEvent += this.GraphicsEvents_DrawTick; MenuEvents.MenuClosed += this.MenuEvents_MenuChanged; }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { this.Config = helper.ReadConfig <ModConfig>(); this.Monitor.Log($"Started with menu key {this.Config.OpenMenuKey}.", LogLevel.Trace); this.Cheats = new Cheats(this.Config); SaveEvents.AfterLoad += this.SaveEvents_AfterLoad; LocationEvents.LocationsChanged += this.LocationEvents_LocationsChanged; GameEvents.UpdateTick += this.Events_UpdateTick; GameEvents.OneSecondTick += this.GameEvents_OneSecondTick; InputEvents.ButtonPressed += this.Events_ButtonPressed; GraphicsEvents.OnPostRenderEvent += this.GraphicsEvents_DrawTick; MenuEvents.MenuClosed += this.MenuEvents_MenuClosed; }
/// <summary>Perform any action needed after the cheat options change.</summary> public static void OnOptionsChanged() { // disable harvest with sickle if (!CJBCheatsMenu.Config.HarvestSickle) { IDictionary <int, int> cropHarvestMethods = Cheats.GetCropHarvestMethods(); foreach (GameLocation location in Game1.locations) { if (!location.isFarm && !location.name.Contains("Greenhouse")) { continue; } foreach (KeyValuePair <Vector2, TerrainFeature> pair in location.terrainFeatures) { if (pair.Value is HoeDirt dirt && dirt.crop != null && cropHarvestMethods.TryGetValue(dirt.crop.indexOfHarvest, out int harvestMethod)) { dirt.crop.harvestMethod = harvestMethod; } } } } }
private void Events_KeyPressed(object sender, EventArgsKeyPressed e) { Cheats.onKeyPress(e.KeyPressed); }
/// <summary>Update the mod's config.json file from the current <see cref="Config"/>.</summary> internal static void SaveConfig() { CJBCheatsMenu.Helper.WriteConfig(CJBCheatsMenu.Config); Cheats.OnOptionsChanged(); }
public override void receiveLeftClick(int x, int y) { if (this.greyedOut || this.Listening || !this.SetButtonBounds.Contains(x, y)) { return; } if (!this.ButtonNames.Any()) { switch (whichOption) { case 2: Game1.player.money += 100; Game1.soundBank.PlayCue("coin"); break; case 3: Game1.player.money += 1000; Game1.soundBank.PlayCue("coin"); break; case 4: Game1.player.money += 10000; Game1.soundBank.PlayCue("coin"); break; case 5: Game1.player.money += 100000; Game1.soundBank.PlayCue("coin"); break; case 6: Game1.player.clubCoins += 100; Game1.soundBank.PlayCue("coin"); break; case 7: Game1.player.clubCoins += 1000; Game1.soundBank.PlayCue("coin"); break; case 8: Game1.player.clubCoins += 10000; Game1.soundBank.PlayCue("coin"); break; case 9: Game1.soundBank.PlayCue("glug"); Cheats.WaterAllFields(CJBCheatsMenu.GetAllLocations().ToArray()); break; case 10: Cheats.SetWeatherForNextDay(Game1.weather_sunny); break; case 11: Cheats.SetWeatherForNextDay(Game1.weather_rain); break; case 12: Cheats.SetWeatherForNextDay(Game1.weather_lightning); break; case 13: Cheats.SetWeatherForNextDay(Game1.weather_snow); break; case 14: Game1.warpFarmer("FarmHouse", 9, 11, false); Game1.exitActiveMenu(); break; case 100: Game1.warpFarmer("Farm", 64, 15, false); Game1.exitActiveMenu(); break; case 101: Game1.warpFarmer("Town", 43, 57, false); Game1.exitActiveMenu(); break; case 102: Game1.warpFarmer("Town", 94, 82, false); Game1.exitActiveMenu(); break; case 103: Game1.warpFarmer("Town", 102, 90, false); Game1.exitActiveMenu(); break; case 104: Game1.warpFarmer("Town", 45, 71, false); Game1.exitActiveMenu(); break; case 105: Game1.warpFarmer("Town", 52, 20, false); Game1.exitActiveMenu(); break; case 106: Game1.warpFarmer("Mountain", 12, 26, false); Game1.exitActiveMenu(); break; case 107: Game1.warpFarmer("Mountain", 76, 9, false); Game1.exitActiveMenu(); break; case 108: Game1.warpFarmer("Mountain", 127, 12, false); Game1.exitActiveMenu(); break; case 109: Game1.warpFarmer("Mine", 13, 10, false); Game1.exitActiveMenu(); break; case 110: Game1.warpFarmer("Beach", 30, 34, false); Game1.exitActiveMenu(); break; case 111: Game1.warpFarmer("Beach", 87, 26, false); Game1.exitActiveMenu(); break; case 112: Game1.warpFarmer("Desert", 18, 28, false); Game1.exitActiveMenu(); break; case 113: Game1.warpFarmer("Forest", 90, 16, false); Game1.exitActiveMenu(); break; case 114: Game1.warpFarmer("Forest", 5, 27, false); Game1.exitActiveMenu(); break; case 115: Game1.warpFarmer("Forest", 34, 96, false); Game1.exitActiveMenu(); break; case 116: Game1.warpFarmer("Woods", 58, 15, false); Game1.exitActiveMenu(); break; case 117: Game1.warpFarmer("Sewer", 3, 48, false); Game1.exitActiveMenu(); break; case 118: Game1.warpFarmer("Railroad", 10, 57, false); Game1.exitActiveMenu(); break; case 119: Game1.warpFarmer("SandyHouse", 4, 8, false); Game1.exitActiveMenu(); break; case 120: Game1.warpFarmer("Club", 8, 11, false); Game1.exitActiveMenu(); break; case 200: int lvl1 = Game1.player.newLevels.Count; Game1.player.gainExperience(0, CJB.GetExperiencePoints(Game1.player.farmingLevel)); if (lvl1 < Game1.player.newLevels.Count) { Game1.player.newLevels.RemoveAt(Game1.player.newLevels.Count - 1); } Game1.exitActiveMenu(); Game1.activeClickableMenu = new LevelUpMenu(0, Game1.player.farmingLevel); break; case 201: int lvl2 = Game1.player.newLevels.Count; Game1.player.gainExperience(3, CJB.GetExperiencePoints(Game1.player.miningLevel)); if (lvl2 < Game1.player.newLevels.Count) { Game1.player.newLevels.RemoveAt(Game1.player.newLevels.Count - 1); } Game1.exitActiveMenu(); Game1.activeClickableMenu = new LevelUpMenu(3, Game1.player.miningLevel); break; case 202: int lvl3 = Game1.player.newLevels.Count; Game1.player.gainExperience(2, CJB.GetExperiencePoints(Game1.player.foragingLevel)); if (lvl3 < Game1.player.newLevels.Count) { Game1.player.newLevels.RemoveAt(Game1.player.newLevels.Count - 1); } Game1.exitActiveMenu(); Game1.activeClickableMenu = new LevelUpMenu(2, Game1.player.foragingLevel); break; case 203: int lvl4 = Game1.player.newLevels.Count; Game1.player.gainExperience(1, CJB.GetExperiencePoints(Game1.player.fishingLevel)); if (lvl4 < Game1.player.newLevels.Count) { Game1.player.newLevels.RemoveAt(Game1.player.newLevels.Count - 1); } Game1.exitActiveMenu(); Game1.activeClickableMenu = new LevelUpMenu(1, Game1.player.fishingLevel); break; case 204: int lvl5 = Game1.player.newLevels.Count; Game1.player.gainExperience(4, CJB.GetExperiencePoints(Game1.player.combatLevel)); if (lvl5 < Game1.player.newLevels.Count) { Game1.player.newLevels.RemoveAt(Game1.player.newLevels.Count - 1); } Game1.exitActiveMenu(); Game1.activeClickableMenu = new LevelUpMenu(4, Game1.player.combatLevel); break; case 205: Game1.player.maxHealth -= 5 * Game1.player.combatLevel; Game1.player.experiencePoints[0] = 0; Game1.player.experiencePoints[1] = 0; Game1.player.experiencePoints[2] = 0; Game1.player.experiencePoints[3] = 0; Game1.player.experiencePoints[4] = 0; Game1.player.farmingLevel = 0; Game1.player.miningLevel = 0; Game1.player.foragingLevel = 0; Game1.player.fishingLevel = 0; Game1.player.combatLevel = 0; if (Game1.player.professions.Contains(24)) { Game1.player.maxHealth -= 15; } if (Game1.player.professions.Contains(27)) { Game1.player.maxHealth -= 25; } Game1.player.health = Game1.player.maxHealth; Game1.player.professions.Clear(); break; } } else { this.Listening = true; Game1.soundBank.PlayCue("breathin"); GameMenu.forcePreventClose = true; this.ListenerMessage = "Press new key..."; } }