public override void receiveLeftClick(int x, int y, bool playSound = true) { if (this.transitioning) { return; } if (this.characterIndexInDialogue < this.getCurrentString().Length - 1) { this.characterIndexInDialogue = this.getCurrentString().Length - 1; } else { if (this.safetyTimer > 0) { return; } if (this.isQuestion) { if (this.selectedResponse == -1) { return; } this.questionFinishPauseTimer = Game1.eventUp ? 600 : 200; this.transitioning = true; this.transitionInitialized = false; this.transitioningBigger = true; Game1.dialogueUp = false; UpgradeCabins.houseUpgradeAccept(ModUtility.GetCabin(this.responses[this.selectedResponse].responseKey)); this.selectedResponse = -1; this.tryOutro(); return; } this.characterIndexInDialogue = 0; if (!this.transitioning) { Game1.playSound("smallSelect"); } this.setUpIcons(); this.safetyTimer = 750; if (this.getCurrentString() == null || this.getCurrentString().Length > 20) { return; } this.safetyTimer -= 200; } }
private void GameLoop_DayEnding(object sender, DayEndingEventArgs e) { //so this doesn't end up happening for every single player online.... if (!Context.IsMainPlayer) { return; } foreach (var cabin in ModUtility.GetCabins()) { if (cabin.daysUntilUpgrade.Value == 1) { FinalUpgrade(cabin); } } }
internal static void AskForUpgrade() { if (Game1.getFarm().isThereABuildingUnderConstruction()) { Game1.drawObjectDialogue(helper.Translation.Get("robin.busy")); return; } List <Response> cabinNames = new List <Response>(); foreach (var cabin in ModUtility.GetCabins()) { string displayInfo = null; var cabinIndoors = ((Cabin)cabin.indoors.Value); //if the cabin is occupied, we ignore it if (cabinIndoors.owner.Name != "") { continue; } switch (cabinIndoors.upgradeLevel) { case 0: displayInfo = $"{cabin.buildingType.Value} {helper.Translation.Get("robin.hu1_materials") }"; break; case 1: displayInfo = $"{cabin.buildingType.Value} {helper.Translation.Get("robin.hu2_materials") }"; break; case 2: displayInfo = $"{cabin.buildingType.Value} {helper.Translation.Get("robin.hu3_materials") }"; break; } if (displayInfo != null) { cabinNames.Add(new Response(cabin.nameOfIndoors, displayInfo)); } } if (cabinNames.Count > 0) { cabinNames.Add(new Response("Cancel", helper.Translation.Get("menu.cancel_option"))); Game1.activeClickableMenu = new CabinQuestionsBox("Which Cabin would you like to upgrade?", cabinNames); } }
private void GameLoop_DayEnding(object sender, StardewModdingAPI.Events.DayEndingEventArgs e) { //so this doesn't end up happening for every single player online.... if (!Context.IsMainPlayer) { return; } foreach (var cabin in ModUtility.GetCabins()) { if (cabin.daysUntilUpgrade.Value == 1) { var cabinIndoors = ((Cabin)cabin.indoors.Value); cabin.daysUntilUpgrade.Value = -1; cabinIndoors.upgradeLevel++; cabinIndoors.moveObjectsForHouseUpgrade(cabinIndoors.upgradeLevel); cabinIndoors.setMapForUpgradeLevel(cabinIndoors.upgradeLevel); } } }
private void RemoveSeedBoxesCommand(string arg1, string[] arg2) { foreach (var cab in ModUtility.GetCabins()) { if (((Cabin)cab.indoors.Value).owner.Name != "") { continue; } foreach (var obj in ((Cabin)cab.indoors.Value).Objects.SelectMany(objs => objs.Where(obj => obj.Value is Chest).Select(obj => obj))) { Chest chest = (Chest)obj.Value; if (!chest.giftbox.Value || chest.bigCraftable.Value) { continue; } ((Cabin)cab.indoors.Value).Objects.Remove(obj.Key); } } }