public override void dayUpdate(int dayOfMonth) { base.dayUpdate(dayOfMonth); if (this.daysOfConstructionLeft <= 0) { if ((this.indoors as AnimalHouse).incubatingEgg.Y > 0) { --(this.indoors as AnimalHouse).incubatingEgg.X; if ((this.indoors as AnimalHouse).incubatingEgg.X <= 0) { long newId = MultiplayerUtility.getNewID(); FarmAnimal farmAnimal = new FarmAnimal((this.indoors as AnimalHouse).incubatingEgg.Y == 442 ? "Duck" : ((this.indoors as AnimalHouse).incubatingEgg.Y == 180 || (this.indoors as AnimalHouse).incubatingEgg.Y == 182 ? "BrownChicken" : ((this.indoors as AnimalHouse).incubatingEgg.Y == 107 ? "Dinosaur" : "Chicken")), newId, this.owner); (this.indoors as AnimalHouse).incubatingEgg.X = 0; (this.indoors as AnimalHouse).incubatingEgg.Y = -1; this.indoors.map.GetLayer("Front").Tiles[1, 2].TileIndex = 45; ((AnimalHouse)this.indoors).animals.Add(newId, farmAnimal); } } if ((this.indoors as AnimalHouse).animalLimit == 16) { int num = Math.Min((this.indoors as AnimalHouse).animals.Count - this.indoors.numberOfObjectsWithName("Hay"), (Game1.getLocationFromName("Farm") as Farm).piecesOfHay); (Game1.getLocationFromName("Farm") as Farm).piecesOfHay -= num; for (int index = 0; index < 16 && num > 0; ++index) { Vector2 key = new Vector2((float)(6 + index), 3f); if (!this.indoors.objects.ContainsKey(key)) { this.indoors.objects.Add(key, new StardewValley.Object(178, 1, false, -1, 0)); } --num; } } } this.currentOccupants = ((AnimalHouse)this.indoors).animals.Count; }
// Token: 0x0600117C RID: 4476 RVA: 0x0016684C File Offset: 0x00164A4C public Forest(Map map, string name) : base(map, name) { this.marniesLivestock = new List <FarmAnimal>(); this.marniesLivestock.Add(new FarmAnimal("Dairy Cow", MultiplayerUtility.getNewID(), -1L)); this.marniesLivestock.Add(new FarmAnimal("Dairy Cow", MultiplayerUtility.getNewID(), -1L)); this.marniesLivestock[0].position = new Vector2((float)(98 * Game1.tileSize), (float)(20 * Game1.tileSize)); this.marniesLivestock[1].position = new Vector2((float)(101 * Game1.tileSize), (float)(20 * Game1.tileSize)); this.log = new ResourceClump(602, 2, 2, new Vector2(1f, 6f)); }
public override void dayUpdate(int dayOfMonth) { base.dayUpdate(dayOfMonth); if (this.daysOfConstructionLeft <= 0) { if ((this.indoors as AnimalHouse).incubatingEgg.Y > 0) { AnimalHouse expr_43_cp_0_cp_0 = this.indoors as AnimalHouse; expr_43_cp_0_cp_0.incubatingEgg.X = expr_43_cp_0_cp_0.incubatingEgg.X - 1; if ((this.indoors as AnimalHouse).incubatingEgg.X <= 0) { long newID = MultiplayerUtility.getNewID(); FarmAnimal value = new FarmAnimal(((this.indoors as AnimalHouse).incubatingEgg.Y == 442) ? "Duck" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 180 || (this.indoors as AnimalHouse).incubatingEgg.Y == 182) ? "BrownChicken" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 107) ? "Dinosaur" : "Chicken")), newID, this.owner); (this.indoors as AnimalHouse).incubatingEgg.X = 0; (this.indoors as AnimalHouse).incubatingEgg.Y = -1; this.indoors.map.GetLayer("Front").Tiles[1, 2].TileIndex = 45; ((AnimalHouse)this.indoors).animals.Add(newID, value); } } if ((this.indoors as AnimalHouse).animalLimit == 16) { int arg_1A6_0 = (this.indoors as AnimalHouse).animals.Count; int num = this.indoors.numberOfObjectsWithName("Hay"); int num2 = Math.Min(arg_1A6_0 - num, (Game1.getLocationFromName("Farm") as Farm).piecesOfHay); (Game1.getLocationFromName("Farm") as Farm).piecesOfHay -= num2; int num3 = 0; while (num3 < 16 && num2 > 0) { Vector2 key = new Vector2((float)(6 + num3), 3f); if (!this.indoors.objects.ContainsKey(key)) { this.indoors.objects.Add(key, new StardewValley.Object(178, 1, false, -1, 0)); } num2--; num3++; } } } this.currentOccupants = ((AnimalHouse)this.indoors).animals.Count; }
// Token: 0x060012C2 RID: 4802 RVA: 0x0017C604 File Offset: 0x0017A804 public override void dayUpdate(int dayOfMonth) { base.dayUpdate(dayOfMonth); if (this.daysOfConstructionLeft <= 0) { if ((this.indoors as AnimalHouse).incubatingEgg.Y > 0) { AnimalHouse expr_43_cp_0_cp_0 = this.indoors as AnimalHouse; expr_43_cp_0_cp_0.incubatingEgg.X = expr_43_cp_0_cp_0.incubatingEgg.X - 1; if ((this.indoors as AnimalHouse).incubatingEgg.X <= 0) { long id = MultiplayerUtility.getNewID(); FarmAnimal layed = new FarmAnimal(((this.indoors as AnimalHouse).incubatingEgg.Y == 442) ? "Duck" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 180 || (this.indoors as AnimalHouse).incubatingEgg.Y == 182) ? "BrownChicken" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 107) ? "Dinosaur" : "Chicken")), id, this.owner); (this.indoors as AnimalHouse).incubatingEgg.X = 0; (this.indoors as AnimalHouse).incubatingEgg.Y = -1; this.indoors.map.GetLayer("Front").Tiles[1, 2].TileIndex = 45; ((AnimalHouse)this.indoors).animals.Add(id, layed); } } if ((this.indoors as AnimalHouse).animalLimit == 16) { int arg_1A6_0 = (this.indoors as AnimalHouse).animals.Count; int numExistingHay = this.indoors.numberOfObjectsWithName("Hay"); int piecesHay = Math.Min(arg_1A6_0 - numExistingHay, (Game1.getLocationFromName("Farm") as Farm).piecesOfHay); (Game1.getLocationFromName("Farm") as Farm).piecesOfHay -= piecesHay; int i = 0; while (i < 16 && piecesHay > 0) { Vector2 tile = new Vector2((float)(6 + i), 3f); if (!this.indoors.objects.ContainsKey(tile)) { this.indoors.objects.Add(tile, new Object(178, 1, false, -1, 0)); } piecesHay--; i++; } } } this.currentOccupants = ((AnimalHouse)this.indoors).animals.Count; }
// Token: 0x06000F96 RID: 3990 RVA: 0x0013F5B0 File Offset: 0x0013D7B0 public override void receiveLeftClick(int x, int y, bool playSound = true) { if (Game1.globalFade || this.freeze) { return; } if (this.okButton != null && this.okButton.containsPoint(x, y) && this.readyToClose()) { if (this.onFarm) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForReturnToShopMenu), 0.02f); Game1.playSound("smallSelect"); } else { Game1.exitActiveMenu(); Game1.playSound("bigDeSelect"); } } if (this.onFarm) { Vector2 clickTile = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize)); Building selection = (Game1.getLocationFromName("Farm") as Farm).getBuildingAt(clickTile); if (selection != null && !this.namingAnimal) { if (selection.buildingType.Contains(this.animalBeingPurchased.buildingTypeILiveIn)) { if ((selection.indoors as AnimalHouse).isFull()) { Game1.showRedMessage("That Building Is Full"); } else if (this.animalBeingPurchased.harvestType != 2) { this.namingAnimal = true; this.newAnimalHome = selection; if (this.animalBeingPurchased.sound != null && Game1.soundBank != null) { Cue expr_14B = Game1.soundBank.GetCue(this.animalBeingPurchased.sound); expr_14B.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201))); expr_14B.Play(); } this.textBox.OnEnterPressed += this.e; Game1.keyboardDispatcher.Subscriber = this.textBox; this.textBox.Text = this.animalBeingPurchased.name; this.textBox.Selected = true; } else if (Game1.player.money >= this.priceOfAnimal) { this.newAnimalHome = selection; this.animalBeingPurchased.home = this.newAnimalHome; this.animalBeingPurchased.homeLocation = new Vector2((float)this.newAnimalHome.tileX, (float)this.newAnimalHome.tileY); this.animalBeingPurchased.setRandomPosition(this.animalBeingPurchased.home.indoors); (this.newAnimalHome.indoors as AnimalHouse).animals.Add(this.animalBeingPurchased.myID, this.animalBeingPurchased); (this.newAnimalHome.indoors as AnimalHouse).animalsThatLiveHere.Add(this.animalBeingPurchased.myID); this.newAnimalHome = null; this.namingAnimal = false; if (this.animalBeingPurchased.sound != null && Game1.soundBank != null) { Cue expr_2B5 = Game1.soundBank.GetCue(this.animalBeingPurchased.sound); expr_2B5.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201))); expr_2B5.Play(); } Game1.player.money -= this.priceOfAnimal; Game1.addHUDMessage(new HUDMessage("Purchased " + this.animalBeingPurchased.type, Color.LimeGreen, 3500f)); this.animalBeingPurchased = new FarmAnimal(this.animalBeingPurchased.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); } else if (Game1.player.money < this.priceOfAnimal) { Game1.dayTimeMoneyBox.moneyShakeTimer = 1000; } } else { Game1.showRedMessage(this.animalBeingPurchased.type.Split(new char[] { ' ' }).Last <string>() + "s Can't Live There."); } } if (this.namingAnimal && this.doneNamingButton.containsPoint(x, y)) { this.textBoxEnter(this.textBox); Game1.playSound("smallSelect"); return; } if (this.namingAnimal && this.randomButton.containsPoint(x, y)) { this.animalBeingPurchased.name = Dialogue.randomName(); this.textBox.Text = this.animalBeingPurchased.name; this.randomButton.scale = this.randomButton.baseScale; Game1.playSound("drumkit6"); return; } } else { foreach (ClickableTextureComponent c in this.animalsToPurchase) { if (c.containsPoint(x, y) && (c.item as Object).type == null) { int price = Convert.ToInt32(c.name); if (Game1.player.money >= price) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForAnimalPlacement), 0.02f); Game1.playSound("smallSelect"); this.onFarm = true; this.animalBeingPurchased = new FarmAnimal(c.hoverText, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); this.priceOfAnimal = price; } else { Game1.addHUDMessage(new HUDMessage("Not Enough Money", Color.Red, 3500f)); } } } } }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (Game1.globalFade || freeze) { return; } if (okButton != null && okButton.containsPoint(x, y) && readyToClose()) { if (onFarm) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(setUpForReturnToShopMenu), 0.02f); Game1.playSound("smallSelect"); } else { Game1.exitActiveMenu(); Game1.playSound("bigDeSelect"); } } if (onFarm) { Vector2 tile = new Vector2((x + Game1.viewport.X) / Game1.tileSize, (y + Game1.viewport.Y) / Game1.tileSize); Building buildingAt = currentFarm.getBuildingAt(tile); if (buildingAt != null && !namingAnimal) { if (buildingAt.buildingType.Contains(animalBeingPurchased.buildingTypeILiveIn)) { if ((buildingAt.indoors as AnimalHouse).isFull()) { Game1.showRedMessage("That Building Is Full"); } else if (animalBeingPurchased.harvestType != 2) { namingAnimal = true; newAnimalHome = buildingAt; if (animalBeingPurchased.sound != null && Game1.soundBank != null) { Cue cue = Game1.soundBank.GetCue(animalBeingPurchased.sound); cue.SetVariable("Pitch", 1200 + Game1.random.Next(-200, 201)); cue.Play(); } textBox.OnEnterPressed += e; Game1.keyboardDispatcher.Subscriber = textBox; textBox.Text = animalBeingPurchased.name; textBox.Selected = true; } else if (Game1.player.money >= priceOfAnimal) { newAnimalHome = buildingAt; animalBeingPurchased.home = newAnimalHome; animalBeingPurchased.homeLocation = new Vector2(newAnimalHome.tileX, newAnimalHome.tileY); animalBeingPurchased.setRandomPosition(animalBeingPurchased.home.indoors); (newAnimalHome.indoors as AnimalHouse).animals.Add(animalBeingPurchased.myID, animalBeingPurchased); (newAnimalHome.indoors as AnimalHouse).animalsThatLiveHere.Add(animalBeingPurchased.myID); newAnimalHome = null; namingAnimal = false; if (animalBeingPurchased.sound != null && Game1.soundBank != null) { Cue cue2 = Game1.soundBank.GetCue(animalBeingPurchased.sound); cue2.SetVariable("Pitch", 1200 + Game1.random.Next(-200, 201)); cue2.Play(); } Game1.player.money -= priceOfAnimal; Game1.addHUDMessage(new HUDMessage("Purchased " + animalBeingPurchased.type, Color.LimeGreen, 3500f)); animalBeingPurchased = new FarmAnimal(animalBeingPurchased.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); } else if (Game1.player.money < priceOfAnimal) { Game1.dayTimeMoneyBox.moneyShakeTimer = 1000; } } else { Game1.showRedMessage(animalBeingPurchased.type.Split(new char[] { ' ' }).Last() + "s Can't Live There."); } } if (namingAnimal && doneNamingButton.containsPoint(x, y)) { textBoxEnter(textBox); Game1.playSound("smallSelect"); return; } if (namingAnimal && randomButton.containsPoint(x, y)) { animalBeingPurchased.name = Dialogue.randomName(); textBox.Text = animalBeingPurchased.name; randomButton.scale = randomButton.baseScale; Game1.playSound("drumkit6"); return; } } else { if (backButton.containsPoint(x, y)) { currentFarmIndex = (currentFarmIndex == 0) ? 1 : 0; populateAnimalStock(); backButton.scale = backButton.baseScale; } if (forwardButton.containsPoint(x, y)) { currentFarmIndex = (currentFarmIndex == 0) ? 1 : 0; populateAnimalStock(); forwardButton.scale = forwardButton.baseScale; } foreach (ClickableTextureComponent current in animalsToPurchase) { if (current.containsPoint(x, y) && (current.item as StardewValley.Object).type == null) { int num = Convert.ToInt32(current.name); if (Game1.player.money >= num) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(setUpForAnimalPlacement), 0.02f); Game1.playSound("smallSelect"); onFarm = true; animalBeingPurchased = new FarmAnimal(current.hoverText, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); priceOfAnimal = num; } else { Game1.addHUDMessage(new HUDMessage("Not Enough Money", Color.Red, 3500f)); } } } } }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (Game1.globalFade || this.freeze) { return; } if (this.okButton != null && this.okButton.containsPoint(x, y) && this.readyToClose()) { if (this.onFarm) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForReturnToShopMenu), 0.02f); Game1.playSound("smallSelect"); } else { Game1.exitActiveMenu(); Game1.playSound("bigDeSelect"); } } if (this.onFarm) { Vector2 tile = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize)); Building buildingAt = (Game1.getLocationFromName("Farm") as Farm).getBuildingAt(tile); if (buildingAt != null && !this.namingAnimal) { if (buildingAt.buildingType.Contains(this.animalBeingPurchased.buildingTypeILiveIn)) { if ((buildingAt.indoors as AnimalHouse).isFull()) { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11321", new object[0])); } else if (this.animalBeingPurchased.harvestType != 2) { this.namingAnimal = true; this.newAnimalHome = buildingAt; if (this.animalBeingPurchased.sound != null && Game1.soundBank != null) { Cue expr_15B = Game1.soundBank.GetCue(this.animalBeingPurchased.sound); expr_15B.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201))); expr_15B.Play(); } this.textBox.OnEnterPressed += this.e; this.textBox.Text = this.animalBeingPurchased.displayName; Game1.keyboardDispatcher.Subscriber = this.textBox; if (Game1.options.SnappyMenus) { this.currentlySnappedComponent = base.getComponentWithID(104); this.snapCursorToCurrentSnappedComponent(); } } else if (Game1.player.money >= this.priceOfAnimal) { this.newAnimalHome = buildingAt; this.animalBeingPurchased.home = this.newAnimalHome; this.animalBeingPurchased.homeLocation = new Vector2((float)this.newAnimalHome.tileX, (float)this.newAnimalHome.tileY); this.animalBeingPurchased.setRandomPosition(this.animalBeingPurchased.home.indoors); (this.newAnimalHome.indoors as AnimalHouse).animals.Add(this.animalBeingPurchased.myID, this.animalBeingPurchased); (this.newAnimalHome.indoors as AnimalHouse).animalsThatLiveHere.Add(this.animalBeingPurchased.myID); this.newAnimalHome = null; this.namingAnimal = false; if (this.animalBeingPurchased.sound != null && Game1.soundBank != null) { Cue expr_2DC = Game1.soundBank.GetCue(this.animalBeingPurchased.sound); expr_2DC.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201))); expr_2DC.Play(); } Game1.player.money -= this.priceOfAnimal; Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11324", new object[] { this.animalBeingPurchased.displayType }), Color.LimeGreen, 3500f)); this.animalBeingPurchased = new FarmAnimal(this.animalBeingPurchased.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); } else if (Game1.player.money < this.priceOfAnimal) { Game1.dayTimeMoneyBox.moneyShakeTimer = 1000; } } else { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11326", new object[] { this.animalBeingPurchased.displayType })); } } if (this.namingAnimal) { if (this.doneNamingButton.containsPoint(x, y)) { this.textBoxEnter(this.textBox); Game1.playSound("smallSelect"); } else if (this.namingAnimal && this.randomButton.containsPoint(x, y)) { this.animalBeingPurchased.name = Dialogue.randomName(); this.animalBeingPurchased.displayName = this.animalBeingPurchased.name; this.textBox.Text = this.animalBeingPurchased.displayName; this.randomButton.scale = this.randomButton.baseScale; Game1.playSound("drumkit6"); } this.textBox.Update(); return; } } else { foreach (ClickableTextureComponent current in this.animalsToPurchase) { if (current.containsPoint(x, y) && (current.item as StardewValley.Object).type == null) { int num = current.item.salePrice(); if (Game1.player.money >= num) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForAnimalPlacement), 0.02f); Game1.playSound("smallSelect"); this.onFarm = true; this.animalBeingPurchased = new FarmAnimal(current.hoverText, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); this.priceOfAnimal = num; } else { Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11325", new object[0]), Color.Red, 3500f)); } } } } }