From a558c15f268f4e13489eecdd53ad80db00053266 Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Thu, 22 Aug 2019 19:09:58 -0700 Subject: [PATCH] Added in remaining ore veins, added in tin ore to ingot recipe for smelting, added in ingots. --- .../Objects/Resources/Ore/Bauxite.png | Bin 0 -> 532 bytes .../Graphics/Objects/Resources/Ore/Lead.png | Bin 0 -> 533 bytes .../Graphics/Objects/Resources/Ore/Silver.png | Bin 0 -> 439 bytes .../Objects/Resources/Ore/Titanium.png | Bin 0 -> 559 bytes .../Framework/Crafting/VanillaRecipe.cs | 4 +- .../Framework/Crafting/VanillaRecipeBook.cs | 13 +- .../Framework/Hacks/ObjectInteractionHacks.cs | 4 +- .../Framework/Objects/CustomObject.cs | 9 +- .../Framework/Objects/Items/Resources/Ore.cs | 24 ++-- .../Framework/Objects/ObjectManager.cs | 48 +++++++ .../Framework/Objects/ResourceManager.cs | 136 ++++++++++++++++-- GeneralMods/Revitalize/ModCore.cs | 49 +++---- GeneralMods/Revitalize/Revitalize.csproj | 12 ++ 13 files changed, 238 insertions(+), 61 deletions(-) create mode 100644 GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Bauxite.png create mode 100644 GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Lead.png create mode 100644 GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Silver.png create mode 100644 GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Titanium.png diff --git a/GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Bauxite.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Bauxite.png new file mode 100644 index 0000000000000000000000000000000000000000..0a9586d13c51885bb12d6cf2a7b0d579f776a49e GIT binary patch literal 532 zcmV+v0_**WP)Px$&PhZ;R5*>blCf(OQ5?rVmrF?R#8|o9)kFwYL~KM#X%MuFi<^Tkc55eH{Ciw< z(#=k#bd-=qI@BOia5y1`vl8+y$MXznE)C`!l3ea$MHhe5-Fv^!hu{0Y2mhls*UI7M zS~>ie_4HXy01ql9fUuFWW}71st-ty3NjXyhaNWv8-z$|eh2mJ!+}*);T8Z9N{O8)$ z)o8r=#)4_G{O~ch7!sdKiNkmAZ%`;&GR0H3dM4htfz{ ztW?T$gqHxO6&Jfso5OldNy9iW+i8Iibi@*Q%SeDzcoHD{?~iaN$53FFeD?M|I>H0s zeDer^J5QbgaPaauFbmigL+XA8)i8`L$;C&3o<~WiaGf@npym<5Tqj0000Px$&q+iLlTS|*K^TXhX{WN(LDvmwHzlNr9<+%Th;TCT=GTy$AIf9DMsH0# zK|;f&5~C5Z%kI*YrQHroZCDR5>$V}i_@3tdH}iX+$qWB!Vp(!`XD>D9!=r--YqQ|{ z?GGtHr`r~<8*fs}vQSF#q^tn&LZ5PKXN{e1TL4JY+^9EAF4ZEMYj$i0$9DK};*qcG zblXBMN@~=b^iGd~86zEYJC?wZC`hPQT!z;nLFi}o1#=i)hXAa*PL{kKOB(eiQIPQb zWsM;82|^z&BD9F+8En)x(-)Oj0N7QFC`j^h>75>9SFMbN77>R>2f`@$2r#_4lQz;Z zg|*rJDF4)rbWAz5Y1EsPQ=8qLy;PXjpFOp4R@{t%0eQy&3Tv}$B*Q_A2x(r=OEnh9 zF$hpfF>Eyowf?Qv|lg$mvU;8Bne6>Y84k#a~}Bgy|aCwRRp#Gj0)%RI)kf#$t31`_?1=5 zLTgR2BK^zYTSOf0`3b1;`!EAKqCVaqOREe8Gq XOa0228j7$300000NkvXXu0mjfQ}^*< literal 0 HcmV?d00001 diff --git a/GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Silver.png b/GeneralMods/Revitalize/Content/Graphics/Objects/Resources/Ore/Silver.png new file mode 100644 index 0000000000000000000000000000000000000000..941062bd3523996c52d5f712fbc5c4fa8753c217 GIT binary patch literal 439 zcmV;o0Z9IdP)Px$aY;l$R5*>Lk}+$-Kp2J}Z9tb4;*vH)>pyU7z~Jr_5IWnfgJkGWaggqHE(n?2 zRofuy7XOg_vQPZyZ24tgj%iE?$mn#qu4x|OiFU!3j%aGBCyR@Lx<1v^Rr zm|8WaR!tl31p)nK6+eqLi)DGbbJ0-4p6B6t9--kV$b2?aYuEWykTTGfzFp@NJ4z5j zXqos~j1U4pi#4bg;$mw6Rb@pWa5rmK`LHse-^03WRh3RhA z2qCnfOVUEK!jmk@Jf!Mow!h)8Px$=}AOER5*>Llgn!pQ5431VkP> ze}vunfZ{67GISM+xX3OQN;}Z_Xr&LkNXay5gMAGlnILgt?sd{g5j>lF&pDj$`|fu+ z@SmYv)JzWDZ;QLNwyL~%{zm4rb2AEnDhl4Fxj0WC5J1y3`huDS%jPq@dik0{&XOdT zyo@8`Nr0YVLpQj4C&9$%6i=Q$?oz3GlS0lSo6j&YIt9S{I`fZ4ej zB^Hgh2X5W&QnU2=L)Wm^A8Tz@kpQu1yd4hda!7=s8*G$TActg+_Fu<7r~rR{Asvgx z--ScEd_N%N1Dw{Ko|=77!Pj9ghC@0>C&&0zm0&Q4<2bYxXtrFMEtj$36azOBl&U)z zxM~0x^7`U9zZLm_!Lzf|L;vL~_ZrOxk5bPV8BbE$v{~OR z0^qtX>$^p+wfX^A{<6e=wZi81w@G2*M_^hgDC8_QN-JoZMy*yO5{b|k)G!z40XRB2 zrfly`0;Ufb1Q05=N?-Z3W#Rs8vHg9AtAPOZdL5r%rMz#`Xg1_<*DrL=hp}jUT6j{n x_uih*J8Df)^Da}Ge+$!_{B0XA0y57RegVhtxxHkN>8=0(002ovPDHLkV1lL505bpp literal 0 HcmV?d00001 diff --git a/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipe.cs b/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipe.cs index 4e186050..85b893db 100644 --- a/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipe.cs +++ b/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipe.cs @@ -175,7 +175,7 @@ namespace Revitalize.Framework.Crafting /// Checks to see if the player can craft this object and if so go ahead and craft it. /// /// - public void craft(StardewValley.Object o) + public bool craft(StardewValley.Object o) { if (this.PlayerCanCraft()) { @@ -183,7 +183,9 @@ namespace Revitalize.Framework.Crafting List outPutItems = new List(); ModCore.log("Can craft recipe."); this.craft(ref playerItems, ref o); + return true; } + return false; } } } diff --git a/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipeBook.cs b/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipeBook.cs index 77f75b12..f21403ed 100644 --- a/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipeBook.cs +++ b/GeneralMods/Revitalize/Framework/Crafting/VanillaRecipeBook.cs @@ -33,8 +33,9 @@ namespace Revitalize.Framework.Crafting VanillaRecipe furnace_tinOre = new VanillaRecipe(new Dictionary() { - {ModCore.ObjectManager.resources.getOre("Tin"),1 } - }, new KeyValuePair(new StardewValley.Object(211,1), 3), 30, new StatCost(), false); + {ModCore.ObjectManager.resources.getOre("Tin"),5 }, + {new StardewValley.Object(382,1),1} + }, new KeyValuePair(ModCore.ObjectManager.GetItem("TinIngot"), 1), 50, new StatCost(), false); this.recipesByObjectName["Furnace"].Add("Tin Ore", furnace_tinOre); } @@ -95,18 +96,20 @@ namespace Revitalize.Framework.Crafting } } - public void TryToCraftRecipe(StardewValley.Object Machine) + public bool TryToCraftRecipe(StardewValley.Object Machine) { if (this.DoesARecipeExistForHeldObjectName(Machine)) { ModCore.log("Recipe exists!"); VanillaRecipe rec = this.GetVanillaRecipeFromHeldObjectName(Machine); - rec.craft(Machine); - this.playCraftingSound(Machine); + bool crafted=rec.craft(Machine); + if(crafted)this.playCraftingSound(Machine); + return crafted; } else { ModCore.log("No recipe!"); + return false; } } diff --git a/GeneralMods/Revitalize/Framework/Hacks/ObjectInteractionHacks.cs b/GeneralMods/Revitalize/Framework/Hacks/ObjectInteractionHacks.cs index 6a8c487c..4ff7d8d9 100644 --- a/GeneralMods/Revitalize/Framework/Hacks/ObjectInteractionHacks.cs +++ b/GeneralMods/Revitalize/Framework/Hacks/ObjectInteractionHacks.cs @@ -47,8 +47,8 @@ namespace Revitalize.Framework.Hacks if (ObjectUtilities.IsObjectFurnace(obj) && ObjectUtilities.IsObjectHoldingItem(obj)==false) { ModCore.log("Found a furnace!"); - VanillaRecipeBook.VanillaRecipes.TryToCraftRecipe(obj); - + bool crafted=VanillaRecipeBook.VanillaRecipes.TryToCraftRecipe(obj); + if (crafted == false) return; obj.initializeLightSource((Vector2)(obj.TileLocation), false); obj.showNextIndex.Value = true; /* diff --git a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs index 89a6f8c1..209400c1 100644 --- a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs @@ -86,23 +86,24 @@ namespace Revitalize.Framework.Objects } /// Construct an instance. - public CustomObject(CustomObjectData PyTKData, BasicItemInformation info) + public CustomObject(CustomObjectData PyTKData, BasicItemInformation info,int Stack=1) : base(PyTKData, Vector2.Zero) { this.info = info; this.initializeBasics(); this.guid = Guid.NewGuid(); + this.Stack = Stack; } /// Construct an instance. - public CustomObject(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation) + public CustomObject(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation,int Stack=1) : base(PyTKData, TileLocation) { this.info = info; this.initializeBasics(); this.guid = Guid.NewGuid(); - + this.Stack = Stack; } /// Sets some basic information up. @@ -400,7 +401,7 @@ namespace Revitalize.Framework.Objects float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); } - spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize * .75)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), 3f, SpriteEffects.None, layerDepth); + spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); } /// What happens when the object is drawn when held by a player. diff --git a/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs b/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs index 350b659b..ed28709a 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Items/Resources/Ore.cs @@ -98,17 +98,7 @@ namespace Revitalize.Framework.Objects.Items.Resources } - public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawShadow) - { - if (drawStackNumber && this.maximumStackSize() > 1 && ((double)scaleSize > 0.3 && this.Stack != int.MaxValue) && this.Stack > 1) - Utility.drawTinyDigits(this.Stack, spriteBatch, location + new Vector2((float)(Game1.tileSize - Utility.getWidthOfTinyDigitString(this.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)((double)Game1.tileSize - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, Color.White); - if (drawStackNumber && this.Quality > 0) - { - float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); - spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); - } - spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize*4f, SpriteEffects.None, layerDepth); - } + public override Item getOne() { @@ -231,5 +221,17 @@ namespace Revitalize.Framework.Objects.Items.Resources } + public override void drawInMenu(SpriteBatch spriteBatch, Vector2 location, float scaleSize, float transparency, float layerDepth, bool drawStackNumber, Color c, bool drawShadow) + { + if (drawStackNumber && this.maximumStackSize() > 1 && ((double)scaleSize > 0.3 && this.Stack != int.MaxValue) && this.Stack > 1) + Utility.drawTinyDigits(this.Stack, spriteBatch, location + new Vector2((float)(Game1.tileSize - Utility.getWidthOfTinyDigitString(this.Stack, 3f * scaleSize)) + 3f * scaleSize, (float)((double)Game1.tileSize - 18.0 * (double)scaleSize + 2.0)), 3f * scaleSize, 1f, Color.White); + if (drawStackNumber && this.Quality > 0) + { + float num = this.Quality < 4 ? 0.0f : (float)((Math.Cos((double)Game1.currentGameTime.TotalGameTime.Milliseconds * Math.PI / 512.0) + 1.0) * 0.0500000007450581); + spriteBatch.Draw(Game1.mouseCursors, location + new Vector2(12f, (float)(Game1.tileSize - 12) + num), new Microsoft.Xna.Framework.Rectangle?(this.Quality < 4 ? new Microsoft.Xna.Framework.Rectangle(338 + (this.Quality - 1) * 8, 400, 8, 8) : new Microsoft.Xna.Framework.Rectangle(346, 392, 8, 8)), Color.White * transparency, 0.0f, new Vector2(4f, 4f), (float)(3.0 * (double)scaleSize * (1.0 + (double)num)), SpriteEffects.None, layerDepth); + } + spriteBatch.Draw(this.displayTexture, location + new Vector2((float)(Game1.tileSize / 2), (float)(Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * transparency, 0f, new Vector2((float)(this.animationManager.currentAnimation.sourceRectangle.Width / 2), (float)(this.animationManager.currentAnimation.sourceRectangle.Height)), scaleSize * 4f, SpriteEffects.None, layerDepth); + } + } } diff --git a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs index 21d7fd24..f3e8afcd 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ObjectManager.cs @@ -51,6 +51,8 @@ namespace Revitalize.Framework.Objects public ResourceManager resources; + public Dictionary ItemsByName; + /// /// Constructor. /// @@ -84,6 +86,15 @@ namespace Revitalize.Framework.Objects this.miscellaneous = new Dictionary(); this.resources = new ResourceManager(); + this.ItemsByName = new Dictionary(); + } + + /// + /// Loads in the items for the object and resource managers. + /// + public void loadInItems() + { + this.resources.loadInItems(); } /// @@ -202,6 +213,43 @@ namespace Revitalize.Framework.Objects } } + /// + /// Adds in an item to be tracked by the mod's object manager. + /// + /// + /// + public void AddItem(string key, CustomObject I) + { + if (this.ItemsByName.ContainsKey(key)) + { + throw new Exception("Item with the same key has already been added into the mod!"); + } + else + { + this.ItemsByName.Add(key, I); + } + } + + /// + /// Gets an item from the list of modded items. + /// + /// + /// + /// + public CustomObject GetItem(string Key,int Stack=1) + { + if (this.ItemsByName.ContainsKey(Key)) + { + Item I= this.ItemsByName[Key].getOne(); + I.Stack = Stack; + return (CustomObject)I; + } + else + { + return null; + } + } + /// /// Adds a new object manager to the master pool of managers. /// diff --git a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs index 06fd86ac..700d8822 100644 --- a/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs +++ b/GeneralMods/Revitalize/Framework/Objects/ResourceManager.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Microsoft.Xna.Framework; using Revitalize.Framework.Factories.Objects.Resources; using Revitalize.Framework.Objects.InformationFiles; @@ -49,10 +47,15 @@ namespace Revitalize.Framework.Objects this.ores = new Dictionary(); this.visitedFloors = new List(); + } + + + //Loads in the items for the resource manager. + public void loadInItems() + { this.loadInOreItems(); this.serializeOreVeins(); this.loadOreVeins(); - } /// @@ -131,30 +134,139 @@ namespace Revitalize.Framework.Objects OreVeinTile tinOre_0_0= new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Tin", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Tin"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Tin Ore Vein", "Omegasis.Revitalize.Resources.Ore.Tin", "A ore vein that is full of tin.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Tin"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Tin"), new Animation(0, 0, 16, 16)), Color.White, false, null, null), new InformationFiles.OreResourceInformation(this.getOre("Tin"), true, true, true, false, new List() { - new IntRange(1,9) - }, new List(), (i => i == 1), (i => i % 10 == 0), 1, 5, 1, 10, new IntRange(1, 3), new IntRange(1, 3), new IntRange(0, 0), new List() + new IntRange(1,20) + }, new List(), (i => i == 1), (i => i % 10 == 0), 1, 3, 1, 10, new IntRange(1, 3), new IntRange(1, 3), new IntRange(0, 0), new List() { new IntRange(0,0) }, new List() { new IntRange(0,9999) - }, null,null, 1d, 1.0d, 0.10d, 1d, 1d, 0, 0, 0, 0), new List(), 4); + }, null,null, 0.80d, 0.20d, 0.25d, 1d, 1d, 1, 1, 1, 1), new List(), 4); - OreFactoryInfo testOre_0_0_file = new OreFactoryInfo(tinOre_0_0); - OreFactoryInfo testOre_file = new OreFactoryInfo(tinOre); + OreFactoryInfo tinOre_0_0_file = new OreFactoryInfo(tinOre_0_0); + OreFactoryInfo tinOre_file = new OreFactoryInfo(tinOre); - ModCore.Serializer.SerializeContentFile("TinOre_0_0", testOre_0_0_file,Path.Combine(this.oreResourceDataPath,"TinOre")); - ModCore.Serializer.SerializeContentFile("TinOre", testOre_file, Path.Combine(this.oreResourceDataPath, "TinOre")); + ModCore.Serializer.SerializeContentFile("TinOre_0_0", tinOre_0_0_file,Path.Combine(this.oreResourceDataPath,"TinOre")); + ModCore.Serializer.SerializeContentFile("TinOre", tinOre_file, Path.Combine(this.oreResourceDataPath, "TinOre")); - } + + OreVeinObj bauxiteOre = new OreVeinObj(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Bauxite", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Bauxite"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Bauxite Ore Vein", "Omegasis.Revitalize.Resources.Ore.Bauxite", "A ore vein that is full of bauxite ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Bauxite"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Bauxite"), new Animation(0, 0, 16, 16)), Color.White, false, null, null)); + OreVeinTile bauxiteOre_0_0 = new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Bauxite", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Bauxite"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Bauxite Ore Vein", "Omegasis.Revitalize.Resources.Ore.Bauxite", "A ore vein that is full of bauxite ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Bauxite"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Bauxite"), new Animation(0, 0, 16, 16)), Color.White, false, null, null), + new InformationFiles.OreResourceInformation(this.getOre("Bauxite"), true, true, true, false, new List() + { + new IntRange(20,50) + }, new List(), null, (i => i % 10 == 0), 1, 3, 1, 10, new IntRange(1, 3), new IntRange(1, 3), new IntRange(0, 0), new List() + { + new IntRange(0,0) + }, new List() + { + new IntRange(0,9999) + }, null, null, .70d, 0.16d, 0.20d, 1d, 1d, 0, 0, 0, 0), new List(), 4); + + OreFactoryInfo bauxiteOre_0_0_file = new OreFactoryInfo(bauxiteOre_0_0); + OreFactoryInfo bauxiteOre_file = new OreFactoryInfo(bauxiteOre); + + ModCore.Serializer.SerializeContentFile("BauxiteOre_0_0", bauxiteOre_0_0_file, Path.Combine(this.oreResourceDataPath, "BauxiteOre")); + ModCore.Serializer.SerializeContentFile("BauxiteOre", bauxiteOre_file, Path.Combine(this.oreResourceDataPath, "BauxiteOre")); + + + OreVeinObj silverOre = new OreVeinObj(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Silver", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Silver"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Silver Ore Vein", "Omegasis.Revitalize.Resources.Ore.Silver", "A ore vein that is full of silver ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Silver"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Silver"), new Animation(0, 0, 16, 16)), Color.White, false, null, null)); + OreVeinTile silverOre_0_0 = new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Silver", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Silver"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Silver Ore Vein", "Omegasis.Revitalize.Resources.Ore.Silver", "A ore vein that is full of silver ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Silver"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Silver"), new Animation(0, 0, 16, 16)), Color.White, false, null, null), + new InformationFiles.OreResourceInformation(this.getOre("Silver"), true, true, true, false, new List() + { + new IntRange(60,100) + }, new List(), null, (i => i % 10 == 0), 1, 3, 1, 10, new IntRange(1, 3), new IntRange(1, 3), new IntRange(0, 0), new List() + { + new IntRange(0,0) + }, new List() + { + new IntRange(0,9999) + }, null, null, .50d, 0.10d, 0.14d, 1d, 1d, 0, 0, 0, 0), new List(), 4); + + OreFactoryInfo silverOre_0_0_file = new OreFactoryInfo(silverOre_0_0); + OreFactoryInfo silverOre_file = new OreFactoryInfo(silverOre); + + ModCore.Serializer.SerializeContentFile("SilverOre_0_0", silverOre_0_0_file, Path.Combine(this.oreResourceDataPath, "SilverOre")); + ModCore.Serializer.SerializeContentFile("SilverOre", silverOre_file, Path.Combine(this.oreResourceDataPath, "SilverOre")); + + OreVeinObj leadOre = new OreVeinObj(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Lead", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Lead"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Lead Ore Vein", "Omegasis.Revitalize.Resources.Ore.Lead", "A ore vein that is full of lead ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Lead"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Lead"), new Animation(0, 0, 16, 16)), Color.White, false, null, null)); + OreVeinTile leadOre_0_0 = new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Lead", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Lead"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Lead Ore Vein", "Omegasis.Revitalize.Resources.Ore.Lead", "A ore vein that is full of lead ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Lead"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Lead"), new Animation(0, 0, 16, 16)), Color.White, false, null, null), + new InformationFiles.OreResourceInformation(this.getOre("Lead"), true, true, true, false, new List() + { + new IntRange(60,70), + new IntRange(90,120) + }, new List(), null, (i => i % 10 == 0), 1, 3, 1, 10, new IntRange(1, 3), new IntRange(1, 3), new IntRange(0, 0), new List() + { + new IntRange(0,0) + }, new List() + { + new IntRange(0,9999) + }, null, null, .60d, 0.13d, 0.17d, 1d, 1d, 0, 0, 0, 0), new List(), 4); + + OreFactoryInfo leadOre_0_0_file = new OreFactoryInfo(leadOre_0_0); + OreFactoryInfo leadOre_file = new OreFactoryInfo(leadOre); + + ModCore.Serializer.SerializeContentFile("LeadOre_0_0", leadOre_0_0_file, Path.Combine(this.oreResourceDataPath, "LeadOre")); + ModCore.Serializer.SerializeContentFile("LeadOre", leadOre_file, Path.Combine(this.oreResourceDataPath, "LeadOre")); + + + OreVeinObj titaniumOre = new OreVeinObj(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Titanium", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Titanium"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Titanium Ore Vein", "Omegasis.Revitalize.Resources.Ore.Titanium", "A ore vein that is full of lead ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Titanium"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Titanium"), new Animation(0, 0, 16, 16)), Color.White, false, null, null)); + OreVeinTile titaniumOre_0_0 = new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Titanium", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Titanium"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Titanium Ore Vein", "Omegasis.Revitalize.Resources.Ore.Titanium", "A ore vein that is full of lead ore.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Titanium"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Titanium"), new Animation(0, 0, 16, 16)), Color.White, false, null, null), + new InformationFiles.OreResourceInformation(this.getOre("Titanium"), true, true, true, false, new List() + { + new IntRange(60,70), + new IntRange(90,120) + }, new List(), null, (i => i % 10 == 0), 1, 3, 1, 10, new IntRange(1, 3), new IntRange(1, 3), new IntRange(0, 0), new List() + { + new IntRange(0,0) + }, new List() + { + new IntRange(0,9999) + }, null, null, .40d, 0.05d, 0.10d, 1d, 1d, 0, 0, 0, 0), new List(), 4); + + OreFactoryInfo titaniumOre_0_0_file = new OreFactoryInfo(titaniumOre_0_0); + OreFactoryInfo titaniumOre_file = new OreFactoryInfo(titaniumOre); + + ModCore.Serializer.SerializeContentFile("TitaniumOre_0_0", titaniumOre_0_0_file, Path.Combine(this.oreResourceDataPath, "TitaniumOre")); + ModCore.Serializer.SerializeContentFile("TitaniumOre", titaniumOre_file, Path.Combine(this.oreResourceDataPath, "TitaniumOre")); + + } /// /// Loads in all of the ore items into the game. /// private void loadInOreItems() { - Ore tinOre = new Ore(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TinOre", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinOre"), typeof(Ore), Color.White, true), new BasicItemInformation("Tin Ore", "Omegasis.Revitalize.Items.Resources.Ore.TinOre", "Tin ore that can be smelted into tin ingots for further use.", "Ore", Color.Silver, -300, 0, false, 85, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinOre"), new AnimationManager(), Color.White, true, null, null), 1); + Ore tinOre = new Ore(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TinOre", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinOre"), typeof(Ore), Color.White, true), new BasicItemInformation("Tin Ore", "Omegasis.Revitalize.Items.Resources.Ore.TinOre", "Tin ore that can be smelted into tin ingots for further use.", "Ore", Color.Silver, -300, 0, false, 7, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinOre"), new AnimationManager(), Color.White, true, null, null), 1); this.ores.Add("Tin", tinOre); + + Ore bauxiteOre = new Ore(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.Bauxite", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "BauxiteOre"), typeof(Ore), Color.White, true), new BasicItemInformation("Bauxite Ore", "Omegasis.Revitalize.Items.Resources.Ore.BauxiteOre", "Bauxite ore that can be smelted into aluminum ingots for further use.", "Ore", Color.Silver, -300, 0, false, 11, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "BauxiteOre"), new AnimationManager(), Color.White, true, null, null), 1); + this.ores.Add("Bauxite", bauxiteOre); + this.ores.Add("Aluminum", bauxiteOre); + + Ore leadOre = new Ore(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.LeadOre", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "LeadOre"), typeof(Ore), Color.White, true), new BasicItemInformation("Lead Ore", "Omegasis.Revitalize.Items.Resources.Ore.LeadOre", "Lead ore that can be smelted into lead ingots for further use.", "Ore", Color.Silver, -300, 0, false, 15, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "LeadOre"), new AnimationManager(), Color.White, true, null, null), 1); + this.ores.Add("Lead", leadOre); + + Ore silverOre = new Ore(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.SilverOre", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "SilverOre"), typeof(Ore), Color.White, true), new BasicItemInformation("Silver Ore", "Omegasis.Revitalize.Items.Resources.Ore.SilverOre", "Silver ore that can be smelted into silver ingots for further use.", "Ore", Color.Silver, -300, 0, false, 20, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "SilverOre"), new AnimationManager(), Color.White, true, null, null), 1); + this.ores.Add("Silver", silverOre); + + Ore titaniumOre = new Ore(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TitaniumOre", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitaniumOre"), typeof(Ore), Color.White, true), new BasicItemInformation("Titanium Ore", "Omegasis.Revitalize.Items.Resources.Ore.TitaniumOre", "Titanium ore that can be smelted into titanium ingots for further use.", "Ore", Color.Silver, -300, 0, false, 35, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitaniumOre"), new AnimationManager(), Color.White, true, null, null), 1); + this.ores.Add("Titanium", titaniumOre); + + CustomObject tinIngot = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TinIngot", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinIngot"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Tin Ingot", "Omegasis.Revitalize.Items.Resources.Ore.TinIngot", "A tin ingot that can be used for crafting purposes.", "Metal", Color.Silver, -300, 0, false,75, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TinIngot"), new AnimationManager(), Color.White, true, null, null), 1); + ModCore.ObjectManager.AddItem("TinIngot", tinIngot); + + CustomObject aluminumIngot = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.AluminumIngot", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "AluminumIngot"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Aluminum Ingot", "Omegasis.Revitalize.Items.Resources.Ore.AluminumIngot", "An aluminum ingot that can be used for crafting purposes.", "Ore", Color.Silver, -300, 0, false, 120, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "AluminumIngot"), new AnimationManager(), Color.White, true, null, null), 1); + ModCore.ObjectManager.AddItem("AluminumIngot", aluminumIngot); + + CustomObject leadIngot = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.LeadIngot", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "LeadIngot"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Lead Ingot", "Omegasis.Revitalize.Items.Resources.Ore.LeadIngot", "A lead ingot that can be used for crafting purposes.", "Ore", Color.Silver, -300, 0, false, 165, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "LeadIngot"), new AnimationManager(), Color.White, true, null, null), 1); + ModCore.ObjectManager.AddItem("LeadIngot", leadIngot); + + CustomObject silverIngot = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.SilverIngot", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "SilverIngot"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Silver Ingot", "Omegasis.Revitalize.Items.Resources.Ore.SilverIngot", "A silver ingot that can be used for crafting purposes.", "Ore", Color.Silver, -300, 0, false, 220, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "SilverIngot"), new AnimationManager(), Color.White, true, null, null), 1); + ModCore.ObjectManager.AddItem("SilverIngot", silverIngot); + + CustomObject titaniumIngot = new CustomObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Items.Resources.Ore.TitaniumIngot", TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitaniumIngot"), typeof(CustomObject), Color.White, true), new BasicItemInformation("Titanium Ingot", "Omegasis.Revitalize.Items.Resources.Ore.TitaniumIngot", "A titanium ingot that can be used for crafting purposes.", "Ore", Color.Silver, -300, 325, false, 35, false, false, TextureManager.GetTexture(ModCore.Manifest, "Items.Resources.Ore", "TitaniumIngot"), new AnimationManager(), Color.White, true, null, null), 1); + ModCore.ObjectManager.AddItem("TitaniumIngot", titaniumIngot); } /// diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index 7bbead70..8bd7c24e 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -180,9 +180,8 @@ namespace Revitalize public static IManifest Manifest; /// - /// Keeps track of custom objects. REPLACE THIS WITH RESOUCE MANAGER. + /// Keeps track of custom objects. /// - //public static Dictionary customObjects; public static ObjectManager ObjectManager; /// @@ -206,36 +205,18 @@ namespace Revitalize this.createDirectories(); this.initailizeComponents(); Serializer = new Serializer(); - - playerInfo = new PlayerInfo(); - TextureManager.AddTextureManager(Manifest, "Furniture"); - TextureManager.GetTextureManager(Manifest, "Furniture").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects", "Furniture")); - TextureManager.AddTextureManager(Manifest, "InventoryMenu"); - TextureManager.GetTextureManager(Manifest, "InventoryMenu").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Menus", "InventoryMenu")); - TextureManager.AddTextureManager(Manifest, "Resources.Ore"); - TextureManager.GetTextureManager(Manifest, "Resources.Ore").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects", "Resources", "Ore")); - TextureManager.AddTextureManager(Manifest, "Items.Resources.Ore"); - TextureManager.GetTextureManager(Manifest, "Items.Resources.Ore").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Items", "Resources", "Ore")); - //TextureManager.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "Oak Chair.png"))); - - //Framework.Graphics.TextureManager.TextureManagers.Add("Furniture", new TextureManager(this.Helper.DirectoryPath, Path.Combine("Content", "Graphics", "Furniture"))); - //Rename graphic files tohave spaces and comment out below lines - - //TextureManager.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "Oak Chair.png"))); - // - - //TextureManager.addTexture("Furniture", "Oak Table", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content", "Graphics", "Furniture", "Tables", "Oak Table.png"))); - //TextureManager.addTexture("Furniture", "Oak Lamp", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content", "Graphics", "Furniture", "Lamps", "Oak Lamp.png"))); - //customObjects = new Dictionary(); + //Loads in textures to be used by the mod. + this.loadInTextures(); + //Loads in objects to be use by the mod. ObjectGroups = new Dictionary(); ObjectManager = new ObjectManager(Manifest); - - + ObjectManager.loadInItems(); ObjectsToDraw = new Dictionary(); + //Adds in event handling for the mod. ModHelper.Events.GameLoop.SaveLoaded += this.GameLoop_SaveLoaded; ModHelper.Events.GameLoop.TimeChanged += this.GameLoop_TimeChanged; ModHelper.Events.GameLoop.UpdateTicked += this.GameLoop_UpdateTicked; @@ -244,13 +225,29 @@ namespace Revitalize ModHelper.Events.Player.Warped += ObjectManager.resources.OnPlayerLocationChanged; ModHelper.Events.GameLoop.DayStarted += ObjectManager.resources.DailyResourceSpawn; ModHelper.Events.Input.ButtonPressed += ObjectInteractionHacks.Input_CheckForObjectInteraction; - ModHelper.Events.GameLoop.DayEnding += Serializer.DayEnding_CleanUpFilesForDeletion; //ModHelper.Events.Display.Rendered += MenuHacks.EndOfDay_OnMenuChanged; //ModHelper.Events.GameLoop.Saved += MenuHacks.EndOfDay_CleanupForNewDay; + + //Adds in recipes to the mod. VanillaRecipeBook = new VanillaRecipeBook(); } + /// + /// Loads in textures to be used by the mod. + /// + private void loadInTextures() + { + TextureManager.AddTextureManager(Manifest, "Furniture"); + TextureManager.GetTextureManager(Manifest, "Furniture").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects", "Furniture")); + TextureManager.AddTextureManager(Manifest, "InventoryMenu"); + TextureManager.GetTextureManager(Manifest, "InventoryMenu").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Menus", "InventoryMenu")); + TextureManager.AddTextureManager(Manifest, "Resources.Ore"); + TextureManager.GetTextureManager(Manifest, "Resources.Ore").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Objects", "Resources", "Ore")); + TextureManager.AddTextureManager(Manifest, "Items.Resources.Ore"); + TextureManager.GetTextureManager(Manifest, "Items.Resources.Ore").searchForTextures(ModHelper, this.ModManifest, Path.Combine("Content", "Graphics", "Items", "Resources", "Ore")); + } + private void Input_ButtonPressed(object sender, StardewModdingAPI.Events.ButtonPressedEventArgs e) { /* diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index 85172b95..0c7ea374 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -250,9 +250,21 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest + + PreserveNewest + Always