public Crop(int seedIndex, int tileX, int tileY) : this() { Dictionary <int, string> cropData = Game1.content.Load <Dictionary <int, string> >("Data\\Crops"); if (seedIndex == 770) { seedIndex = getRandomLowGradeCropForThisSeason(Game1.currentSeason); if (seedIndex == 473) { seedIndex--; } } if (cropData.ContainsKey(seedIndex)) { string[] split = cropData[seedIndex].Split('/'); string[] phaseSplit = split[0].Split(' '); for (int k = 0; k < phaseSplit.Length; k++) { phaseDays.Add(Convert.ToInt32(phaseSplit[k])); } phaseDays.Add(99999); string[] seasonSplit = split[1].Split(' '); for (int j = 0; j < seasonSplit.Length; j++) { seasonsToGrowIn.Add(seasonSplit[j]); } rowInSpriteSheet.Value = Convert.ToInt32(split[2]); if ((int)rowInSpriteSheet == 23) { whichForageCrop.Value = seedIndex; } else { netSeedIndex.Value = seedIndex; } indexOfHarvest.Value = Convert.ToInt32(split[3]); regrowAfterHarvest.Value = Convert.ToInt32(split[4]); harvestMethod.Value = Convert.ToInt32(split[5]); ResetCropYield(); raisedSeeds.Value = Convert.ToBoolean(split[7]); string[] programColors = split[8].Split(' '); if (programColors.Length != 0 && programColors[0].Equals("true")) { List <Color> colors = new List <Color>(); for (int i = 1; i < programColors.Length; i += 3) { colors.Add(new Color(Convert.ToByte(programColors[i]), Convert.ToByte(programColors[i + 1]), Convert.ToByte(programColors[i + 2]))); } Random r = new Random(tileX * 1000 + tileY + Game1.dayOfMonth); tintColor.Value = colors[r.Next(colors.Count)]; programColored.Value = true; } flip.Value = (Game1.random.NextDouble() < 0.5); } updateDrawMath(new Vector2(tileX, tileY)); }
protected void parseMonsterInfo(string name) { string[] monsterInfo = Game1.content.Load <Dictionary <string, string> >("Data\\Monsters")[name].Split('/'); Health = Convert.ToInt32(monsterInfo[0]); MaxHealth = Health; DamageToFarmer = Convert.ToInt32(monsterInfo[1]); coinsToDrop.Value = Game1.random.Next(Convert.ToInt32(monsterInfo[2]), Convert.ToInt32(monsterInfo[3]) + 1); isGlider.Value = Convert.ToBoolean(monsterInfo[4]); durationOfRandomMovements.Value = Convert.ToInt32(monsterInfo[5]); string[] objectsSplit = monsterInfo[6].Split(' '); objectsToDrop.Clear(); for (int i = 0; i < objectsSplit.Length; i += 2) { if (Game1.random.NextDouble() < Convert.ToDouble(objectsSplit[i + 1])) { objectsToDrop.Add(Convert.ToInt32(objectsSplit[i])); } } resilience.Value = Convert.ToInt32(monsterInfo[7]); jitteriness.Value = Convert.ToDouble(monsterInfo[8]); base.willDestroyObjectsUnderfoot = false; moveTowardPlayer(Convert.ToInt32(monsterInfo[9])); base.speed = Convert.ToInt32(monsterInfo[10]); missChance.Value = Convert.ToDouble(monsterInfo[11]); mineMonster.Value = Convert.ToBoolean(monsterInfo[12]); if (maxTimesReachedMineBottom() >= 1 && (bool)mineMonster) { resilience.Value += resilience.Value / 2; missChance.Value *= 2.0; Health += Game1.random.Next(0, Health); DamageToFarmer += Game1.random.Next(0, DamageToFarmer / 2); coinsToDrop.Value += Game1.random.Next(0, (int)coinsToDrop + 1); if (Game1.random.NextDouble() < 0.001) { objectsToDrop.Add((Game1.random.NextDouble() < 0.5) ? 72 : 74); } } try { ExperienceGained = Convert.ToInt32(monsterInfo[13]); } catch (Exception) { ExperienceGained = 1; } if (LocalizedContentManager.CurrentLanguageCode != 0) { base.displayName = monsterInfo[monsterInfo.Length - 1]; } }
public override void Load(SpecialOrder order, Dictionary <string, string> data) { string[] array = order.Parse(data["ResetEvents"]).Split(' '); foreach (string s in array) { resetEvents.Add(Convert.ToInt32(s)); } }