public static void OpenDesertCatalogue() { if (Config.LimitDesertCatalogToBusFixed && !Game1.player.mailReceived.Contains("ccVault")) { Game1.activeClickableMenu = new DialogueBox(Helper.Translation.Get("desert-merchant-cannot-ship")); return; } var dict = Desert.getDesertMerchantTradeStock(Game1.player); AdjustPrices(ref dict, Config.FreeDesertCatalogue); Monitor.Log("Opening desert catalogue"); DelayedOpen(new ShopMenu(dict, 0, "DesertTrade", new Func <ISalable, Farmer, int, bool>(boughtTraderItem), null, null)); }
/// <summary> /// Given the name of a shop property, return an instance of the vanilla menu that matches the property /// </summary> /// <param name="shopProperty">the name of the property, as outlined in the README.md</param> /// <param name="warpingShop">is true for animal shops and carpenter shops, which need special handling due to /// the fact it physically warps the players to hard-coded locations</param> /// <returns>An instance of the vanilla stores if the property matches, null otherwise</returns> public static IClickableMenu CheckVanillaShop(string shopProperty, out bool warpingShop) { warpingShop = false; switch (shopProperty) { case "Vanilla!PierreShop": { var seedShop = new SeedShop(); return(new ShopMenu(seedShop.shopStock(), 0, "Pierre")); } case "Vanilla!JojaShop": return(new ShopMenu(StardewValley.Utility.getJojaStock())); case "Vanilla!RobinShop": return(new ShopMenu(StardewValley.Utility.getCarpenterStock(), 0, "Robin")); case "Vanilla!RobinBuildingsShop": warpingShop = true; return(new CarpenterMenu()); case "Vanilla!ClintShop": return(new ShopMenu(StardewValley.Utility.getBlacksmithStock(), 0, "Clint")); case "Vanilla!ClintGeodes": return(new GeodeMenu()); case "Vanilla!ClintToolUpgrades": return(new ShopMenu(StardewValley.Utility.getBlacksmithUpgradeStock(Game1.player), 0, "ClintUpgrade")); case "Vanilla!MarlonShop": return(new ShopMenu(StardewValley.Utility.getAdventureShopStock(), 0, "Marlon")); case "Vanilla!MarnieShop": return(new ShopMenu(StardewValley.Utility.getAnimalShopStock(), 0, "Marnie")); case "Vanilla!MarnieAnimalShop": warpingShop = true; return(new PurchaseAnimalsMenu(StardewValley.Utility.getPurchaseAnimalStock())); case "Vanilla!TravellingMerchant": return(new ShopMenu(StardewValley.Utility.getTravelingMerchantStock((int)((long)Game1.uniqueIDForThisGame + Game1.stats.DaysPlayed)), 0, "Traveler", StardewValley.Utility.onTravelingMerchantShopPurchase)); case "Vanilla!HarveyShop": return(new ShopMenu(StardewValley.Utility.getHospitalStock())); case "Vanilla!SandyShop": { var SandyStock = ModEntry.helper.Reflection.GetMethod(Game1.currentLocation, "sandyShopStock").Invoke <Dictionary <ISalable, int[]> >(); return(new ShopMenu(SandyStock, 0, "Sandy", onSandyShopPurchase)); } case "Vanilla!DesertTrader": return(new ShopMenu(Desert.getDesertMerchantTradeStock(Game1.player), 0, "DesertTrade", boughtTraderItem)); case "Vanilla!KrobusShop": { var sewer = new Sewer(); return(new ShopMenu(sewer.getShadowShopStock(), 0, "Krobus", sewer.onShopPurchase)); } case "Vanilla!DwarfShop": return(new ShopMenu(StardewValley.Utility.getDwarfShopStock(), 0, "Dwarf")); case "Vanilla!AdventureRecovery": return(new ShopMenu(StardewValley.Utility.getAdventureRecoveryStock(), 0, "Marlon_Recovery")); case "Vanilla!GusShop": { return(new ShopMenu(StardewValley.Utility.getSaloonStock(), 0, "Gus", (item, farmer, amount) => { Game1.player.team.synchronizedShopStock.OnItemPurchased(SynchronizedShopStock.SynchedShop.Saloon, item, amount); return false; })); } case "Vanilla!WillyShop": return(new ShopMenu(StardewValley.Utility.getFishShopStock(Game1.player), 0, "Willy")); case "Vanilla!WizardBuildings": warpingShop = true; return(new CarpenterMenu(true)); case "Vanilla!QiShop": Game1.activeClickableMenu = new ShopMenu(StardewValley.Utility.getQiShopStock(), 2); break; case "Vanilla!IceCreamStand": return(new ShopMenu(new Dictionary <ISalable, int[]> { { new Object(233, 1), new[] { 250, int.MaxValue } } })); } return(null); }
/// <summary> /// When input is received, check for shop tiles to open them as necessary /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Input_ButtonPressed(object sender, StardewModdingAPI.Events.ButtonPressedEventArgs e) { //context and button check if (!Context.CanPlayerMove) { return; } //Resets the boolean I use to check if a menu used to move the player around came from my mod //and lets me return them to their original location SourceLocation = null; PlayerPos = Vector2.Zero; //checks if i've changed marnie's stock already after opening her menu ChangedMarnieStock = false; if (!e.Button.IsActionButton()) { return; } Vector2 clickedTile = Vector2.Zero; clickedTile = Helper.Input.GetCursorPosition().GrabTile; //check if there is a tile property on Buildings layer var tileProperty = GetTileProperty(Game1.currentLocation, "Buildings", clickedTile); if (tileProperty == null) { return; } //check if there is a Shop property on clicked tile tileProperty.TryGetValue("Shop", out PropertyValue shopProperty); if (shopProperty != null) { //everything in this block is for the shop property "Shop" if (shopProperty == "Vanilla!PierreShop") { helper.Input.Suppress(e.Button); var seedShop = new SeedShop(); Game1.activeClickableMenu = new ShopMenu(seedShop.shopStock(), 0, "Pierre", null, null, null); } else if (shopProperty == "Vanilla!JojaShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getJojaStock(), 0, (string)null, null, null, null); } else if (shopProperty == "Vanilla!RobinShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getCarpenterStock(), 0, "Robin", null, null, null); } else if (shopProperty == "Vanilla!RobinBuildingsShop") { helper.Input.Suppress(e.Button); SourceLocation = Game1.currentLocation; PlayerPos = Game1.player.position.Get(); Game1.activeClickableMenu = new CarpenterMenu(false); } else if (shopProperty == "Vanilla!ClintShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getBlacksmithStock(), 0, "Clint", null, null, null); } else if (shopProperty == "Vanilla!ClintGeodes") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new GeodeMenu(); } else if (shopProperty == "Vanilla!ClintToolUpgrades") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getBlacksmithUpgradeStock(Game1.player), 0, "ClintUpgrade", null, null, null); } else if (shopProperty == "Vanilla!MarlonShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getAdventureShopStock(), 0, "Marlon", null, null, null); } else if (shopProperty == "Vanilla!MarnieShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getAnimalShopStock(), 0, "Marnie", null, null, null); } else if (shopProperty == "Vanilla!MarnieAnimalShop") { helper.Input.Suppress(e.Button); PlayerPos = Game1.player.position.Get(); SourceLocation = Game1.currentLocation; Game1.activeClickableMenu = new PurchaseAnimalsMenu(Utility.getPurchaseAnimalStock()); } else if (shopProperty == "Vanilla!TravellingMerchant") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getTravelingMerchantStock((int)((long)Game1.uniqueIDForThisGame + (long)Game1.stats.DaysPlayed)), 0, "Traveler", new Func <ISalable, Farmer, int, bool>(Utility.onTravelingMerchantShopPurchase), null, null); } else if (shopProperty == "Vanilla!HarveyShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getHospitalStock(), 0, null, null, null, null); } else if (shopProperty == "Vanilla!SandyShop") { helper.Input.Suppress(e.Button); var SandyStock = helper.Reflection.GetMethod(Game1.currentLocation, "sandyShopStock").Invoke <Dictionary <ISalable, int[]> >(); Game1.activeClickableMenu = new ShopMenu(SandyStock, 0, "Sandy", new Func <ISalable, Farmer, int, bool>(onSandyShopPurchase), null, null); } else if (shopProperty == "Vanilla!DesertTrader") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Desert.getDesertMerchantTradeStock(Game1.player), 0, "DesertTrade", new Func <ISalable, Farmer, int, bool>(boughtTraderItem), null, null); } else if (shopProperty == "Vanilla!KrobusShop") { helper.Input.Suppress(e.Button); var sewer = new Sewer(); Game1.activeClickableMenu = new ShopMenu(sewer.getShadowShopStock(), 0, "Krobus", new Func <ISalable, Farmer, int, bool>(sewer.onShopPurchase), null, null); } else if (shopProperty == "Vanilla!DwarfShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getDwarfShopStock(), 0, "Dwarf", null, null, null); } else if (shopProperty == "Vanilla!AdventureRecovery") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getAdventureRecoveryStock(), 0, "Marlon_Recovery", null, null, null); } else if (shopProperty == "Vanilla!GusShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getSaloonStock(), 0, "Gus", (item, farmer, amount) => { Game1.player.team.synchronizedShopStock.OnItemPurchased(SynchronizedShopStock.SynchedShop.Saloon, item, amount); return(false); }, null, null); } else if (shopProperty == "Vanilla!WillyShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getFishShopStock(Game1.player), 0, "Willy", null, null, null); } else if (shopProperty == "Vanilla!WizardBuildings") { helper.Input.Suppress(e.Button); SourceLocation = Game1.currentLocation; PlayerPos = Game1.player.position.Get(); Game1.activeClickableMenu = new CarpenterMenu(true); } else if (shopProperty == "Vanilla!QiShop") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(Utility.getQiShopStock(), 2, null, null, null, null); } else if (shopProperty == "Vanilla!IceCreamStand") { helper.Input.Suppress(e.Button); Game1.activeClickableMenu = new ShopMenu(new Dictionary <ISalable, int[]>() { { new StardewValley.Object(233, 1, false, -1, 0), new int[2] { 250, int.MaxValue } } }, 0, null, null, null, null); } else { //Extract the tile property value string ShopName = shopProperty.ToString(); if (Shops.ContainsKey(ShopName)) { helper.Input.Suppress(e.Button); Shops[ShopName].DisplayShop(); } else { Monitor.Log($"A Shop tile was clicked, but a shop by the name \"{ShopName}\" " + $"was not found.", LogLevel.Debug); } } } else { tileProperty.TryGetValue("AnimalShop", out shopProperty); if (shopProperty == null) { return; } else { string ShopName = shopProperty.ToString(); if (AnimalShops.ContainsKey(ShopName)) { helper.Input.Suppress(e.Button); AnimalShops[ShopName].DisplayShop(); } else { Monitor.Log($"An Animal Shop tile was clicked, but a shop by the name \"{ShopName}\" " + $"was not found.", LogLevel.Debug); } } } //TODO: add another else check if no tile properties were found for bigcraftables }
public QuickShopScreen() { string buttonTitle = GetTranslation("quickShop.button"); string pierreShopTitle = $"{buttonTitle} {GetButtonTranslation("pierreShop")}"; AddElement(new Button(pierreShopTitle, pierreShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(new List <ISalable>(Utility.getShopStock(true)), who: "Pierre"); } }); string harveyShopTitle = $"{buttonTitle} {GetButtonTranslation("harveyShop")}"; AddElement(new Button(harveyShopTitle, harveyShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getHospitalStock()); } }); string gusShopTitle = $"{buttonTitle} {GetButtonTranslation("gusShop")}"; AddElement(new Button(gusShopTitle, gusShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getSaloonStock(), who: "Gus"); } }); string robinShopTitle = $"{buttonTitle} {GetButtonTranslation("robinShop")}"; AddElement(new Button(robinShopTitle, robinShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getCarpenterStock(), who: "Robin"); } }); string carpenterTitle = $"{buttonTitle} {GetButtonTranslation("carpenter")}"; AddElement(new Button(carpenterTitle, carpenterTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new CarpenterMenu(); } }); string willyShopTitle = $"{buttonTitle} {GetButtonTranslation("willyShop")}"; AddElement(new Button(willyShopTitle, willyShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getFishShopStock(Game1.player), who: "Willy"); } }); string krobusShopTitle = $"{buttonTitle} {GetButtonTranslation("krobusShop")}"; AddElement(new Button(krobusShopTitle, krobusShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(new Sewer().getShadowShopStock(), who: "Krobus"); } }); string marnieShopTitle = $"{buttonTitle} {GetButtonTranslation("marnieShop")}"; AddElement(new Button(marnieShopTitle, marnieShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getAnimalShopStock(), who: "Marnie"); } }); string animalShopTitle = $"{buttonTitle} {GetButtonTranslation("animalShop")}"; AddElement(new Button(animalShopTitle, animalShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new PurchaseAnimalsMenu(Utility.getPurchaseAnimalStock()); } }); string merchantShopTitle = $"{buttonTitle} {GetButtonTranslation("merchantShop")}"; AddElement(new Button(merchantShopTitle, merchantShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu( Utility.getTravelingMerchantStock((int)((long)Game1.uniqueIDForThisGame + Game1.stats.DaysPlayed)), who: "TravelerNightMarket", on_purchase: Utility.onTravelingMerchantShopPurchase); } }); string renovationTitle = $"{buttonTitle} {GetButtonTranslation("renovation")}"; AddElement(new Button(renovationTitle, renovationTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(HouseRenovation.GetAvailableRenovations(), on_purchase: HouseRenovation.OnPurchaseRenovation); } }); string clintShopTitle = $"{buttonTitle} {GetButtonTranslation("clintShop")}"; AddElement(new Button(clintShopTitle, clintShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getBlacksmithStock(), who: "Clint"); } }); if (Game1.player.toolBeingUpgraded.Value == null && Utility.getBlacksmithUpgradeStock(Game1.player).Values.Count != 0) { string upgradeTitle = $"{buttonTitle} {GetButtonTranslation("upgrade")}"; AddElement(new Button(upgradeTitle, upgradeTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getBlacksmithUpgradeStock(Game1.player)); } }); } string geodeTitle = $"{buttonTitle} {GetButtonTranslation("geode")}"; AddElement(new Button(geodeTitle, geodeTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new GeodeMenu(); } }); string specialOrdersBoardTitle = $"{buttonTitle} {GetButtonTranslation("specialOrdersBoard")}"; AddElement(new Button(specialOrdersBoardTitle, specialOrdersBoardTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new SpecialOrdersBoard(); } }); string morrisShopTitle = $"{buttonTitle} {GetButtonTranslation("morrisShop")}"; AddElement(new Button(morrisShopTitle, morrisShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getJojaStock()); } }); string dwarfShopTitle = $"{buttonTitle} {GetButtonTranslation("dwarfShop")}"; AddElement(new Button(dwarfShopTitle, dwarfShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getDwarfShopStock(), who: "Dwarf"); } }); string volcanoDungeonShopTitle = $"{buttonTitle} {GetButtonTranslation("volcanoDungeonShop")}"; Dictionary <ISalable, int[]> dictionary = new Dictionary <ISalable, int[]> { { new Boots(853), new[] { 0, int.MaxValue, 848, 100 } } }; AddElement(new Button(volcanoDungeonShopTitle, volcanoDungeonShopTitle) { OnLeftClicked = () => { Random random = new Random((int)(Game1.stats.DaysPlayed + 898U + (long)Game1.uniqueIDForThisGame)); Utility.AddStock(dictionary, new StardewValley.Object(Vector2.Zero, 286, int.MaxValue), 150); Utility.AddStock(dictionary, new StardewValley.Object(Vector2.Zero, 287, int.MaxValue), 300); Utility.AddStock(dictionary, new StardewValley.Object(Vector2.Zero, 288, int.MaxValue), 500); if (random.NextDouble() < 0.5) { Utility.AddStock(dictionary, new StardewValley.Object(Vector2.Zero, 244, int.MaxValue), 600); } else { Utility.AddStock(dictionary, new StardewValley.Object(Vector2.Zero, 237, int.MaxValue), 600); } if (random.NextDouble() < 0.25) { Utility.AddStock(dictionary, new Hat(77), 5000); } if (!Game1.player.craftingRecipes.ContainsKey("Warp Totem: Island")) { Utility.AddStock(dictionary, new StardewValley.Object(886, 1, true), 5000); } if (!Game1.player.cookingRecipes.ContainsKey("Ginger Ale")) { Utility.AddStock(dictionary, new StardewValley.Object(903, 1, true), 500); } Game1.activeClickableMenu = new ShopMenu(dictionary, who: "VolcanoShop", context: "VolcanoShop"); } }); string marlonShopTitle = $"{buttonTitle} {GetButtonTranslation("marlonShop")}"; AddElement(new Button(marlonShopTitle, marlonShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getAdventureShopStock(), who: "Marlon"); } }); string hatShopTitle = $"{buttonTitle} {GetButtonTranslation("hatShop")}"; AddElement(new Button(hatShopTitle, hatShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getHatStock()); } }); string casinoShopTitle = $"{buttonTitle} {GetButtonTranslation("casinoShop")}"; AddElement(new Button(casinoShopTitle, casinoShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Utility.getQiShopStock(), 2); } }); string qiSpecialOrdersBoardTitle = $"{buttonTitle} {GetButtonTranslation("qiSpecialOrdersBoard")}"; AddElement(new Button(qiSpecialOrdersBoardTitle, qiSpecialOrdersBoardTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new SpecialOrdersBoard("Qi"); } }); string sandyShopTitle = $"{buttonTitle} {GetButtonTranslation("sandyShop")}"; AddElement(new Button(sandyShopTitle, sandyShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(new List <ISalable>(Utility.getShopStock(false)), who: "Sandy"); } }); string desertShopTitle = $"{buttonTitle} {GetButtonTranslation("desertShop")}"; AddElement(new Button(desertShopTitle, desertShopTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(Desert.getDesertMerchantTradeStock(Game1.player)); } }); string islandTradeTitle = $"{buttonTitle} {GetButtonTranslation("islandTrade")}"; AddElement(new Button(islandTradeTitle, islandTradeTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(IslandNorth.getIslandMerchantTradeStock(Game1.player), who: "IslandTrade"); } }); string resortBarTitle = $"{buttonTitle} {GetButtonTranslation("resortBar")}"; AddElement(new Button(resortBarTitle, resortBarTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ShopMenu(dictionary, who: "Gus", context: "ResortBar"); } }); if (Game1.player.mailReceived.Contains("JojaMember")) { string joJaCdTitle = $"{buttonTitle} {GetButtonTranslation("joJaCD")}"; AddElement(new Button(joJaCdTitle, joJaCdTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new JojaCDMenu(Game1.temporaryContent.Load <Texture2D>("LooseSprites\\JojaCDForm")); } }); } string wizardTitle = $"{buttonTitle} {GetButtonTranslation("wizard")}"; AddElement(new Button(wizardTitle, wizardTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new CarpenterMenu(true); } }); if (!Game1.player.mailReceived.Contains("JojaMember")) { string bundlesTitle = $"{buttonTitle} {GetButtonTranslation("bundles")}"; AddElement(new Button(bundlesTitle, bundlesTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new JunimoNoteMenu(true, 1, true); } }); } string sewingTitle = $"{buttonTitle} {GetButtonTranslation("sewing")}"; AddElement(new Button(sewingTitle, sewingTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new TailoringMenu(); } }); string dyeTitle = $"{buttonTitle} {GetButtonTranslation("dye")}"; AddElement(new Button(dyeTitle, dyeTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new DyeMenu(); } }); string forgeTitle = $"{buttonTitle} {GetButtonTranslation("forge")}"; AddElement(new Button(forgeTitle, forgeTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new ForgeMenu(); } }); string minesTitle = $"{buttonTitle} {GetButtonTranslation("mines")}"; AddElement(new Button(minesTitle, minesTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = new MineElevatorMenu(); } }); string shipTitle = $"{buttonTitle} {GetButtonTranslation("ship")}"; AddElement(new Button(shipTitle, shipTitle) { OnLeftClicked = () => { Game1.activeClickableMenu = ShippingBin(); } }); if (Game1.player.toolBeingUpgraded.Value != null && Game1.player.daysLeftForToolUpgrade <= 0) { AddElement(new Button(GetTranslation("quickShop.button.getUpgradedTool"), GetTranslation("quickShop.button.getUpgradedTool")) { OnLeftClicked = () => { if (Game1.player.freeSpotsInInventory() > 0 || Game1.player.toolBeingUpgraded.Value is GenericTool) { Tool tool = Game1.player.toolBeingUpgraded.Value; Game1.player.toolBeingUpgraded.Value = null; Game1.player.hasReceivedToolUpgradeMessageYet = false; Game1.player.holdUpItemThenMessage(tool); if (tool is GenericTool) { tool.actionWhenClaimed(); } else { Game1.player.addItemToInventoryBool(tool); } Game1.exitActiveMenu(); } else { Game1.drawDialogue(Game1.getCharacterFromName("Clint"), Game1.content.LoadString("Data\\ExtraDialogue:Clint_NoInventorySpace", Game1.player.toolBeingUpgraded.Value.DisplayName)); } } }); } if (Game1.player.maxItems < 36) { AddElement(new Button(GetTranslation("quickShop.button.backpackUpgrade"), GetTranslation("quickShop.button.backpackUpgrade")) { OnLeftClicked = () => { if (Game1.player.maxItems == 12 && Game1.player.Money >= 2000) { Game1.player.Money -= 2000; Game1.player.maxItems.Value += 12; for (int index = 0; index < Game1.player.maxItems; ++index) { if (Game1.player.items.Count <= index) { Game1.player.items.Add(null); } } Game1.player.holdUpItemThenMessage(new SpecialItem(99, Game1.content.LoadString("Strings\\StringsFromCSFiles:GameLocation.cs.8708"))); Game1.exitActiveMenu(); } else if (Game1.player.maxItems < 36 && Game1.player.Money >= 10000) { Game1.player.Money -= 10000; Game1.player.maxItems.Value += 12; Game1.player.holdUpItemThenMessage(new SpecialItem(99, Game1.content.LoadString("Strings\\StringsFromCSFiles:GameLocation.cs.8709"))); for (int index = 0; index < Game1.player.maxItems; ++index) { if (Game1.player.items.Count <= index) { Game1.player.items.Add(null); } } Game1.exitActiveMenu(); } else if (Game1.player.maxItems != 36) { Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\UI:NotEnoughMoney2")); } } }); } if (Game1.player.daysUntilHouseUpgrade < 0 && !Game1.getFarm().isThereABuildingUnderConstruction()) { if (Game1.player.HouseUpgradeLevel < 3) { AddElement(new Button(GetTranslation("quickShop.button.houseUpgrade"), GetTranslation("quickShop.button.houseUpgrade")) { OnLeftClicked = () => { switch (Game1.player.houseUpgradeLevel) { case 0: if (Game1.player.Money >= 10000 && Game1.player.hasItemInInventory(388, 450)) { Game1.player.daysUntilHouseUpgrade.Value = 3; Game1.player.Money -= 10000; Game1.player.removeItemsFromInventory(388, 450); Game1.getCharacterFromName("Robin").setNewDialogue( Game1.content.LoadString( "Data\\ExtraDialogue:Robin_HouseUpgrade_Accepted")); Game1.drawDialogue(Game1.getCharacterFromName("Robin")); break; } if (Game1.player.Money < 10000) { Game1.drawObjectDialogue( Game1.content.LoadString("Strings\\UI:NotEnoughMoney3")); break; } Game1.drawObjectDialogue( Game1.content.LoadString( "Strings\\Locations:ScienceHouse_Carpenter_NotEnoughWood1")); break; case 1: if (Game1.player.Money >= 50000 && Game1.player.hasItemInInventory(709, 150)) { Game1.player.daysUntilHouseUpgrade.Value = 3; Game1.player.Money -= 50000; Game1.player.removeItemsFromInventory(709, 150); Game1.getCharacterFromName("Robin").setNewDialogue( Game1.content.LoadString( "Data\\ExtraDialogue:Robin_HouseUpgrade_Accepted")); Game1.drawDialogue(Game1.getCharacterFromName("Robin")); break; } if (Game1.player.Money < 50000) { Game1.drawObjectDialogue( Game1.content.LoadString("Strings\\UI:NotEnoughMoney3")); break; } Game1.drawObjectDialogue( Game1.content.LoadString( "Strings\\Locations:ScienceHouse_Carpenter_NotEnoughWood2")); break; case 2: if (Game1.player.Money >= 100000) { Game1.player.daysUntilHouseUpgrade.Value = 3; Game1.player.Money -= 100000; Game1.getCharacterFromName("Robin").setNewDialogue( Game1.content.LoadString( "Data\\ExtraDialogue:Robin_HouseUpgrade_Accepted")); Game1.drawDialogue(Game1.getCharacterFromName("Robin")); break; } if (Game1.player.Money >= 100000) { break; } Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\UI:NotEnoughMoney3")); break; } } }); } else if ((Game1.MasterPlayer.mailReceived.Contains("ccIsComplete") || Game1.MasterPlayer.mailReceived.Contains("JojaMember") || Game1.MasterPlayer.hasCompletedCommunityCenter()) && new Town().daysUntilCommunityUpgrade <= 0 && !Game1.MasterPlayer.mailReceived.Contains("pamHouseUpgrade")) { AddElement(new Button(GetTranslation("quickShop.button.houseUpgrade.communityUpgrade"), GetTranslation("quickShop.button.houseUpgrade.communityUpgrade.description")) { OnLeftClicked = () => { if (Game1.MasterPlayer.mailReceived.Contains("pamHouseUpgrade")) { return; } if (Game1.player.Money >= 500000 && Game1.player.hasItemInInventory(388, 950)) { Game1.player.Money -= 500000; Game1.player.removeItemsFromInventory(388, 950); Game1.getCharacterFromName("Robin").setNewDialogue( Game1.content.LoadString("Data\\ExtraDialogue:Robin_PamUpgrade_Accepted")); Game1.drawDialogue(Game1.getCharacterFromName("Robin")); new Town().daysUntilCommunityUpgrade.Value = 3; } else if (Game1.player.Money < 500000) { Game1.drawObjectDialogue(Game1.content.LoadString("Strings\\UI:NotEnoughMoney3")); } else { Game1.drawObjectDialogue( Game1.content.LoadString( "Strings\\Locations:ScienceHouse_Carpenter_NotEnoughWood3")); } } }); } } }