581 lines
23 KiB
C#
581 lines
23 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using StardustCore;
|
|
using StardewModdingAPI;
|
|
using StardewValley;
|
|
using StardewValley.Locations;
|
|
using StardewValley.Menus;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
using System.IO;
|
|
|
|
namespace AdditionalCropsFramework
|
|
{
|
|
///Make xtra crops data sheet
|
|
///edit crops png, crops xnb, and objectInformation.XNB and springObjects.png.
|
|
|
|
|
|
/// <summary>
|
|
/// Stardew ExtraSeeds Class. VERY Broken. Only extend from this class.
|
|
/// </summary>
|
|
///
|
|
public class ModularSeeds : CoreObject
|
|
{
|
|
|
|
public new Texture2D TextureSheet;
|
|
public string dataFilePath;
|
|
|
|
public string cropDataFilePath;
|
|
public string cropTextureFilePath;
|
|
|
|
public string cropObjectDataFilePath;
|
|
public string cropObjectTextureFilePath;
|
|
|
|
public override string Name
|
|
{
|
|
get
|
|
{
|
|
return this.name;
|
|
}
|
|
}
|
|
|
|
public ModularSeeds()
|
|
{
|
|
this.updateDrawPosition();
|
|
}
|
|
|
|
public ModularSeeds(int which, string ObjectSpriteSheet, string ObjectDataFile, string AssociatedCropTextureFile, string AssociatedCropDataFile, string AssociatedCropObjectTexture,string AssociatedCropObjectDataFile)
|
|
{
|
|
if (TextureSheet == null)
|
|
{
|
|
TextureSheet = ModCore.ModHelper.Content.Load<Texture2D>(Path.Combine(Utilities.EntensionsFolderName, ObjectSpriteSheet)); //Game1.content.Load<Texture2D>("Revitalize\\CropsNSeeds\\Graphics\\seeds");
|
|
texturePath = ObjectSpriteSheet;
|
|
}
|
|
Dictionary<int, string> dictionary = ModCore.ModHelper.Content.Load<Dictionary<int, string>>(Path.Combine(Utilities.EntensionsFolderName, ObjectDataFile));//Game1.content.Load<Dictionary<int, string>>("Revitalize\\CropsNSeeds\\Data\\seeds");
|
|
dataFilePath = ObjectDataFile;
|
|
cropDataFilePath = AssociatedCropDataFile;
|
|
cropTextureFilePath = AssociatedCropTextureFile;
|
|
|
|
cropObjectDataFilePath = AssociatedCropObjectDataFile;
|
|
cropObjectTextureFilePath = AssociatedCropObjectTexture;
|
|
|
|
Log.AsyncC(cropDataFilePath);
|
|
Log.AsyncG(cropTextureFilePath);
|
|
|
|
|
|
//Log.AsyncC(which);
|
|
string[] array = dictionary[which].Split(new char[]
|
|
{
|
|
'/'
|
|
});
|
|
this.name = array[0];
|
|
|
|
try
|
|
{
|
|
this.description = array[6];
|
|
this.description += "\nGrown in ";
|
|
ModularCrop c = parseCropInfo(which);
|
|
int trackCount = 0;
|
|
foreach (var v in c.seasonsToGrowIn)
|
|
{
|
|
if (c.seasonsToGrowIn.Count > 1)
|
|
{
|
|
trackCount++;
|
|
if (trackCount != c.seasonsToGrowIn.Count) description += v + ", ";
|
|
else description += "and " + v;
|
|
}
|
|
else description += v;
|
|
}
|
|
this.description += ".\n";
|
|
this.description += "Takes ";
|
|
int totalDaysToGrow = 0;
|
|
foreach (var v in c.phaseDays)
|
|
{
|
|
totalDaysToGrow += v;
|
|
}
|
|
totalDaysToGrow -= 99999;
|
|
this.description += Convert.ToString(totalDaysToGrow) + " days to mature.\n";
|
|
|
|
try
|
|
{
|
|
this.description += array[7];
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
this.description = "Some seeds! Maybe you should plant them.";
|
|
}
|
|
this.defaultSourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, 1, 1);
|
|
if (array[2].Equals("-1"))
|
|
{
|
|
}
|
|
else
|
|
{
|
|
this.defaultSourceRect.Width = Convert.ToInt32(array[2].Split(new char[]
|
|
{
|
|
' '
|
|
})[0]);
|
|
this.defaultSourceRect.Height = Convert.ToInt32(array[2].Split(new char[]
|
|
{
|
|
' '
|
|
})[1]);
|
|
this.sourceRect = new Rectangle(which * 16 % TextureSheet.Width, which * 16 / TextureSheet.Width * 16, this.defaultSourceRect.Width * 16, this.defaultSourceRect.Height * 16);
|
|
this.defaultSourceRect = this.sourceRect;
|
|
}
|
|
this.defaultBoundingBox = new Rectangle((int)this.tileLocation.X, (int)this.tileLocation.Y, 1, 1);
|
|
if (array[3].Equals("-1"))
|
|
{
|
|
}
|
|
else
|
|
{
|
|
this.defaultBoundingBox.Width = Convert.ToInt32(array[3].Split(new char[]
|
|
{
|
|
' '
|
|
})[0]);
|
|
this.defaultBoundingBox.Height = Convert.ToInt32(array[3].Split(new char[]
|
|
{
|
|
' '
|
|
})[1]);
|
|
this.boundingBox = new Rectangle((int)this.tileLocation.X * Game1.tileSize, (int)this.tileLocation.Y * Game1.tileSize, this.defaultBoundingBox.Width * Game1.tileSize, this.defaultBoundingBox.Height * Game1.tileSize);
|
|
this.defaultBoundingBox = this.boundingBox;
|
|
}
|
|
this.updateDrawPosition();
|
|
this.rotations = Convert.ToInt32(array[4]);
|
|
this.price = Convert.ToInt32(array[5]);
|
|
this.parentSheetIndex = which;
|
|
|
|
}
|
|
|
|
public override string getDescription()
|
|
{
|
|
return this.description;
|
|
}
|
|
|
|
public override bool performDropDownAction(StardewValley.Farmer who)
|
|
{
|
|
this.resetOnPlayerEntry((who == null) ? Game1.currentLocation : who.currentLocation);
|
|
return false;
|
|
}
|
|
|
|
public override void hoverAction()
|
|
{
|
|
base.hoverAction();
|
|
if (!Game1.player.isInventoryFull())
|
|
{
|
|
Game1.mouseCursor = 2;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public override bool checkForAction(StardewValley.Farmer who, bool justCheckingForActivity = false)
|
|
{
|
|
var mState = Microsoft.Xna.Framework.Input.Mouse.GetState();
|
|
if (mState.RightButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
|
|
{
|
|
return this.RightClicked(who);
|
|
|
|
// Game1.showRedMessage("YOOO");
|
|
//do some stuff when the right button is down
|
|
// rotate();
|
|
if (this.heldObject != null)
|
|
{
|
|
// Game1.player.addItemByMenuIfNecessary(this.heldObject);
|
|
// this.heldObject = null;
|
|
}
|
|
else
|
|
{
|
|
// this.heldObject = Game1.player.ActiveObject;
|
|
// Game1.player.removeItemFromInventory(heldObject);
|
|
}
|
|
//this.minutesUntilReady = 30;
|
|
}
|
|
else
|
|
{
|
|
//Game1.showRedMessage("CRY");
|
|
}
|
|
|
|
if (justCheckingForActivity)
|
|
{
|
|
return true;
|
|
}
|
|
return this.clicked(who);
|
|
}
|
|
|
|
//DONT USE THIS BASE IT IS TERRIBLE
|
|
public override bool clicked(StardewValley.Farmer who)
|
|
{
|
|
/*
|
|
// Game1.showRedMessage("THIS IS CLICKED!!!");
|
|
//var mState = Microsoft.Xna.Framework.Input.Mouse.GetState();
|
|
|
|
|
|
if (removable == false) return false;
|
|
|
|
|
|
Game1.haltAfterCheck = false;
|
|
if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject == null)
|
|
{
|
|
// Game1.showRedMessage("Why1?");
|
|
return false;
|
|
}
|
|
if (this.heldObject == null && (who.ActiveObject == null || !(who.ActiveObject is ExtraSeeds)))
|
|
{
|
|
if (Game1.player.currentLocation is FarmHouse)
|
|
{
|
|
//
|
|
Util.addItemToInventoryAndCleanTrackedList(this);
|
|
removeLights(this.thisLocation);
|
|
this.lightsOn = false;
|
|
Game1.playSound("coin");
|
|
// this.flaggedForPickUp = true;
|
|
thisLocation = null;
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
// return true;
|
|
// this.heldObject = new ExtraSeeds(parentSheetIndex, Vector2.Zero, this.lightColor, this.inventoryMaxSize);
|
|
Util.addItemToInventoryAndCleanTrackedList(this);
|
|
removeLights(this.thisLocation);
|
|
this.lightsOn = false;
|
|
Game1.playSound("coin");
|
|
thisLocation = null;
|
|
return true;
|
|
|
|
}
|
|
}
|
|
if (this.heldObject != null && who.addItemToInventoryBool(this.heldObject, false))
|
|
{
|
|
// Game1.showRedMessage("Why3?");
|
|
// if(this.heldObject!=null) Game1.player.addItemByMenuIfNecessary((Item)this.heldObject);
|
|
Util.addItemToInventoryAndCleanTrackedList(this);
|
|
this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
|
|
this.heldObject = null;
|
|
Game1.playSound("coin");
|
|
removeLights(this.thisLocation);
|
|
this.lightsOn = false;
|
|
thisLocation = null;
|
|
return true;
|
|
}
|
|
|
|
*/
|
|
|
|
return false;
|
|
}
|
|
|
|
public virtual bool RightClicked(StardewValley.Farmer who)
|
|
{
|
|
|
|
|
|
// Game1.showRedMessage("THIS IS CLICKED!!!");
|
|
//var mState = Microsoft.Xna.Framework.Input.Mouse.GetState();
|
|
/*
|
|
|
|
Game1.haltAfterCheck = false;
|
|
if (this.Decoration_type == 11 && who.ActiveObject != null && who.ActiveObject != null && this.heldObject == null)
|
|
{
|
|
// Game1.showRedMessage("Why1?");
|
|
return false;
|
|
}
|
|
if (this.heldObject == null && (who.ActiveObject == null || !(who.ActiveObject is ExtraSeeds)))
|
|
{
|
|
if (Game1.player.currentLocation is FarmHouse)
|
|
{
|
|
//
|
|
Game1.player.addItemByMenuIfNecessary(this);
|
|
removeLights(this.thisLocation);
|
|
this.lightsOn = false;
|
|
Game1.playSound("coin");
|
|
// this.flaggedForPickUp = true;
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
// return true;
|
|
// this.heldObject = new ExtraSeeds(parentSheetIndex, Vector2.Zero, this.lightColor, this.inventoryMaxSize);
|
|
Game1.player.addItemByMenuIfNecessary(this);
|
|
removeLights(this.thisLocation);
|
|
this.lightsOn = false;
|
|
Game1.playSound("coin");
|
|
return true;
|
|
|
|
}
|
|
}
|
|
if (this.heldObject != null && who.addItemToInventoryBool(this.heldObject, false))
|
|
{
|
|
// Game1.showRedMessage("Why3?");
|
|
// if(this.heldObject!=null) Game1.player.addItemByMenuIfNecessary((Item)this.heldObject);
|
|
Util.addItemToInventoryElseDrop(this);
|
|
this.heldObject.performRemoveAction(this.tileLocation, who.currentLocation);
|
|
this.heldObject = null;
|
|
Game1.playSound("coin");
|
|
removeLights(this.thisLocation);
|
|
this.lightsOn = false;
|
|
return true;
|
|
}
|
|
|
|
*/
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void DayUpdate(GameLocation location)
|
|
{
|
|
base.DayUpdate(location);
|
|
this.lightGlowAdded = false;
|
|
if (!Game1.isDarkOut() || (Game1.newDay && !Game1.isRaining))
|
|
{
|
|
this.removeLights(location);
|
|
return;
|
|
}
|
|
// this.addLights(thisLocation, lightColor);
|
|
this.addLights(thisLocation, lightColor);
|
|
}
|
|
|
|
public override bool performObjectDropInAction(StardewValley.Object dropIn, bool probe, StardewValley.Farmer who)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
|
|
public override bool minutesElapsed(int minutes, GameLocation environment)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override void performRemoveAction(Vector2 tileLocation, GameLocation environment)
|
|
{
|
|
|
|
}
|
|
|
|
public override bool canBeGivenAsGift()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override bool canBePlacedHere(GameLocation l, Vector2 tile)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual void updateDrawPosition()
|
|
{
|
|
this.drawPosition = new Vector2((float)this.boundingBox.X, (float)(this.boundingBox.Y - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)));
|
|
}
|
|
|
|
public override void drawPlacementBounds(SpriteBatch spriteBatch, GameLocation location)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public override bool placementAction(GameLocation location, int x, int y, StardewValley.Farmer who = null)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override bool isPlaceable()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override int salePrice()
|
|
{
|
|
return this.price;
|
|
}
|
|
|
|
public override int getStack()
|
|
{
|
|
return this.stack;
|
|
}
|
|
|
|
public override int addToStack(int amount)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
private float getScaleSize()
|
|
{
|
|
int num = this.sourceRect.Width / 16;
|
|
int num2 = this.sourceRect.Height / 16;
|
|
if (num >= 5)
|
|
{
|
|
return 0.75f;
|
|
}
|
|
if (num2 >= 3)
|
|
{
|
|
return 1f;
|
|
}
|
|
if (num <= 2)
|
|
{
|
|
return 2f;
|
|
}
|
|
if (num <= 4)
|
|
{
|
|
return 1f;
|
|
}
|
|
return 0.1f;
|
|
}
|
|
|
|
public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, StardewValley.Farmer f)
|
|
{
|
|
|
|
spriteBatch.Draw(this.TextureSheet, objectPosition, new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
|
if (f.ActiveObject != null && f.ActiveObject.Name.Contains("="))
|
|
{
|
|
spriteBatch.Draw(Game1.objectSpriteSheet, objectPosition + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Microsoft.Xna.Framework.Rectangle?(Game1.currentLocation.getSourceRectForObject(f.ActiveObject.ParentSheetIndex)), Color.White, 0f, new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), (float)Game1.pixelZoom + Math.Abs(Game1.starCropShimmerPause) / 8f, SpriteEffects.None, Math.Max(0f, (float)(f.getStandingY() + 2) / 10000f));
|
|
if (Math.Abs(Game1.starCropShimmerPause) <= 0.05f && Game1.random.NextDouble() < 0.97)
|
|
{
|
|
return;
|
|
}
|
|
Game1.starCropShimmerPause += 0.04f;
|
|
if (Game1.starCropShimmerPause >= 0.8f)
|
|
{
|
|
Game1.starCropShimmerPause = -0.8f;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber)
|
|
{
|
|
//spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize, SpriteEffects.None, layerDepth);
|
|
spriteBatch.Draw(TextureSheet, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize / 2)), new Rectangle?(this.defaultSourceRect), Color.White * transparency, 0f, new Vector2((float)(this.defaultSourceRect.Width / 2), (float)(this.defaultSourceRect.Height / 2)), 1f * this.getScaleSize() * scaleSize * 1.5f, SpriteEffects.None, layerDepth);
|
|
}
|
|
|
|
public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f)
|
|
{
|
|
if (x == -1)
|
|
{
|
|
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, this.drawPosition), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
|
|
}
|
|
else
|
|
{
|
|
spriteBatch.Draw(TextureSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), (float)(y * Game1.tileSize - (this.sourceRect.Height * Game1.pixelZoom - this.boundingBox.Height)))), new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, (this.Decoration_type == 12) ? 0f : ((float)(this.boundingBox.Bottom - 8) / 10000f));
|
|
}
|
|
if (this.heldObject != null)
|
|
{
|
|
if (this.heldObject is ModularSeeds)
|
|
{
|
|
(this.heldObject as ModularSeeds).drawAtNonTileSpot(spriteBatch, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - (this.heldObject as ModularSeeds).sourceRect.Height * Game1.pixelZoom - Game1.tileSize / 4))), (float)(this.boundingBox.Bottom - 7) / 10000f, alpha);
|
|
return;
|
|
}
|
|
spriteBatch.Draw(Game1.shadowTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))) + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * 5 / 6)), new Rectangle?(Game1.shadowTexture.Bounds), Color.White * alpha, 0f, new Vector2((float)Game1.shadowTexture.Bounds.Center.X, (float)Game1.shadowTexture.Bounds.Center.Y), 4f, SpriteEffects.None, (float)this.boundingBox.Bottom / 10000f);
|
|
spriteBatch.Draw(Game1.objectSpriteSheet, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(this.boundingBox.Center.X - Game1.tileSize / 2), (float)(this.boundingBox.Center.Y - Game1.tileSize * 4 / 3))), new Rectangle?(Game1.currentLocation.getSourceRectForObject(this.heldObject.ParentSheetIndex)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, (float)(this.boundingBox.Bottom + 1) / 10000f);
|
|
}
|
|
}
|
|
|
|
public override void drawAtNonTileSpot(SpriteBatch spriteBatch, Vector2 location, float layerDepth, float alpha = 1f)
|
|
{
|
|
spriteBatch.Draw(TextureSheet, location, new Rectangle?(this.sourceRect), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, layerDepth);
|
|
}
|
|
|
|
public override Item getOne()
|
|
{
|
|
ModularSeeds ExtraSeeds = new ModularSeeds(this.parentSheetIndex, this.texturePath, this.dataFilePath,this.cropTextureFilePath,this.cropDataFilePath,this.cropObjectTextureFilePath,this.cropObjectDataFilePath);
|
|
/*
|
|
drawPosition = this.drawPosition;
|
|
defaultBoundingBox = this.defaultBoundingBox;
|
|
boundingBox = this.boundingBox;
|
|
currentRotation = this.currentRotation - 1;
|
|
rotations = this.rotations;
|
|
rotate();
|
|
*/
|
|
return ExtraSeeds;
|
|
}
|
|
|
|
public override string getCategoryName()
|
|
{
|
|
return "Modular Seeds";
|
|
// return base.getCategoryName();
|
|
}
|
|
|
|
public override Color getCategoryColor()
|
|
{
|
|
return Color.Turquoise;
|
|
}
|
|
|
|
|
|
public override int maximumStackSize()
|
|
{
|
|
return base.maximumStackSize();
|
|
}
|
|
|
|
public ModularCrop parseCropInfo(int seedIndex)
|
|
{
|
|
ModularCrop c = new ModularCrop();
|
|
Log.AsyncC(this.cropDataFilePath);
|
|
Dictionary<int, string> dictionary = ModCore.ModHelper.Content.Load<Dictionary<int, string>>(Path.Combine(Utilities.EntensionsFolderName, this.cropDataFilePath)); //Game1.content.Load<Dictionary<int, string>>("Data\\Crops");
|
|
|
|
if (dictionary.ContainsKey(seedIndex))
|
|
{
|
|
string[] array = dictionary[seedIndex].Split(new char[]
|
|
{
|
|
'/'
|
|
});
|
|
string[] array2 = array[0].Split(new char[]
|
|
{
|
|
' '
|
|
});
|
|
for (int i = 0; i < array2.Length; i++)
|
|
{
|
|
c.phaseDays.Add(Convert.ToInt32(array2[i]));
|
|
}
|
|
c.phaseDays.Add(99999);
|
|
string[] array3 = array[1].Split(new char[]
|
|
{
|
|
' '
|
|
});
|
|
for (int j = 0; j < array3.Length; j++)
|
|
{
|
|
c.seasonsToGrowIn.Add(array3[j]);
|
|
}
|
|
c.rowInSpriteSheet = Convert.ToInt32(array[2]);
|
|
c.indexOfHarvest = Convert.ToInt32(array[3]);
|
|
c.regrowAfterHarvest = Convert.ToInt32(array[4]);
|
|
c.harvestMethod = Convert.ToInt32(array[5]);
|
|
string[] array4 = array[6].Split(new char[]
|
|
{
|
|
' '
|
|
});
|
|
if (array4.Length != 0 && array4[0].Equals("true"))
|
|
{
|
|
c.minHarvest = Convert.ToInt32(array4[1]);
|
|
c.maxHarvest = Convert.ToInt32(array4[2]);
|
|
c.maxHarvestIncreasePerFarmingLevel = Convert.ToInt32(array4[3]);
|
|
c.chanceForExtraCrops = Convert.ToDouble(array4[4]);
|
|
}
|
|
c.raisedSeeds = Convert.ToBoolean(array[7]);
|
|
string[] array5 = array[8].Split(new char[]
|
|
{
|
|
' '
|
|
});
|
|
if (array5.Length != 0 && array5[0].Equals("true"))
|
|
{
|
|
List<Color> list = new List<Color>();
|
|
for (int k = 1; k < array5.Length; k += 3)
|
|
{
|
|
list.Add(new Color((int)Convert.ToByte(array5[k]), (int)Convert.ToByte(array5[k + 1]), (int)Convert.ToByte(array5[k + 2])));
|
|
}
|
|
Random random = new Random(seedIndex * 1000 + Game1.timeOfDay + Game1.dayOfMonth);
|
|
c.tintColor = list[random.Next(list.Count)];
|
|
c.programColored = true;
|
|
}
|
|
c.flip = (Game1.random.NextDouble() < 0.5);
|
|
}
|
|
if (c.rowInSpriteSheet == 23)
|
|
{
|
|
c.whichForageCrop = seedIndex;
|
|
}
|
|
|
|
return c;
|
|
}
|
|
|
|
}
|
|
}
|