Fixed bug when getting tools from object manager. Added in all of the crafting recipes for tools.

This commit is contained in:
JoshuaNavarro 2019-09-07 15:54:45 -07:00
parent f4828fae49
commit b6a817608f
4 changed files with 201 additions and 16 deletions

View File

@ -207,6 +207,10 @@ namespace Revitalize.Framework.Crafting
private static void InitializeRecipeBooks()
{
//~~~~~~~~~~~~~~~~~~~//
// Workbench Recipes //
//~~~~~~~~~~~~~~~~~~~//
#region
CraftingRecipeBook WorkbenchRecipes = new CraftingRecipeBook("Workbench");
WorkbenchRecipes.addInCraftingTab("Default", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Default Tab", new Vector2(100 + 48, 100 + (24 * 4)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTabHorizontal"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f),true);
WorkbenchRecipes.addCraftingRecipe("Anvil", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
@ -215,6 +219,27 @@ namespace Revitalize.Framework.Crafting
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("SteelIngot"),20)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("Anvil"), 1)), true));
WorkbenchRecipes.addCraftingRecipe("Pickaxe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Stone,20),20),
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Wood,10),10)
},new CraftingRecipeComponent(new StardewValley.Tools.Pickaxe() {UpgradeLevel=0},1)),true));
WorkbenchRecipes.addCraftingRecipe("Axe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Stone,20),20),
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Wood,10),10)
}, new CraftingRecipeComponent(new StardewValley.Tools.Axe() { UpgradeLevel = 0 }, 1)), true));
WorkbenchRecipes.addCraftingRecipe("Hoe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Stone,20),20),
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Wood,10),10)
}, new CraftingRecipeComponent(new StardewValley.Tools.Hoe() { UpgradeLevel = 0 }, 1)), true));
WorkbenchRecipes.addCraftingRecipe("Watering Can", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Stone,20),20),
}, new CraftingRecipeComponent(new StardewValley.Tools.WateringCan() { UpgradeLevel = 0 }, 1)), true));
if (CraftingRecipesByGroup.ContainsKey(WorkbenchRecipes.craftingGroup))
{
foreach(KeyValuePair<string, UnlockableCraftingRecipe> recipe in WorkbenchRecipes.craftingRecipes)
@ -233,17 +258,101 @@ namespace Revitalize.Framework.Crafting
{
CraftingRecipesByGroup.Add("Workbench", WorkbenchRecipes);
}
#endregion
//~~~~~~~~~~~~~~~~~~//
// Anvil Recipes //
//~~~~~~~~~~~~~~~~~~//
CraftingRecipeBook AnvilRecipes = new CraftingRecipeBook("Anvil");
AnvilRecipes.addInCraftingTab("Default", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Default Tab", new Vector2(100 + 48, 100 + (24 * 4)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTabHorizontal"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f), true);
/*
WorkbenchRecipes.addCraftingRecipe("Nothing", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
//Inputs here
new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.Coal,1),1),
}, new CraftingRecipeComponent(new StardewValley.Object((int)Enums.SDVObject.FairyRose, 1), 1)), true));
*/
//~~~~~~~~~~~~~~~~~~~~~~~//
//Alternate Vanilla Tools//
//~~~~~~~~~~~~~~~~~~~~~~~//
#region
//Watering Cans
AnvilRecipes.addCraftingRecipe("Bronze Watering Can", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("BronzeIngot",15),15),
new CraftingRecipeComponent(new StardewValley.Tools.WateringCan(){ UpgradeLevel=0},1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzeWateringCan"), 1)), true));
AnvilRecipes.addCraftingRecipe("Hardened Watering Can", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("SteelIngot",10),10),
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("LeadIngot",5),5),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzeWateringCan"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedWateringCan"), 1)), true));
AnvilRecipes.addCraftingRecipe("Titanium Watering Can", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("TitaniumIngot",15),15),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedWateringCan"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("TitaniumWateringCan"), 1)), true));
//Pickaxes
AnvilRecipes.addCraftingRecipe("Bronze Pickaxe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("BronzeIngot",15),15),
new CraftingRecipeComponent(new StardewValley.Tools.Pickaxe(){ UpgradeLevel=0},1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzePickaxe"), 1)), true));
AnvilRecipes.addCraftingRecipe("Hardened Pickaxe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("SteelIngot",10),10),
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("LeadIngot",5),5),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzePickaxe"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedPickaxe"), 1)), true));
AnvilRecipes.addCraftingRecipe("Titanium Pickaxe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("TitaniumIngot",15),15),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedPickaxe"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("TitaniumPickaxe"), 1)), true));
//Axes
AnvilRecipes.addCraftingRecipe("Bronze Axe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("BronzeIngot",15),15),
new CraftingRecipeComponent(new StardewValley.Tools.Axe(){ UpgradeLevel=0},1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzeAxe"), 1)), true));
AnvilRecipes.addCraftingRecipe("Hardened Axe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("SteelIngot",10),10),
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("LeadIngot",5),5),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzeAxe"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedAxe"), 1)), true));
AnvilRecipes.addCraftingRecipe("Titanium Axe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("TitaniumIngot",15),15),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedAxe"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("TitaniumAxe"), 1)), true));
///Plows
AnvilRecipes.addCraftingRecipe("Bronze Hoe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("BronzeIngot",15),15),
new CraftingRecipeComponent(new StardewValley.Tools.Hoe(){ UpgradeLevel=0},1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzeHoe"), 1)), true));
AnvilRecipes.addCraftingRecipe("Hardened Hoe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("SteelIngot",10),10),
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("LeadIngot",5),5),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("BronzeHoe"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedHoe"), 1)), true));
AnvilRecipes.addCraftingRecipe("Titanium Hoe", new UnlockableCraftingRecipe("Default", new Recipe(new List<CraftingRecipeComponent>()
{
new CraftingRecipeComponent(ModCore.ObjectManager.GetItem("TitaniumIngot",15),15),
new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("HardenedHoe"),1)
}, new CraftingRecipeComponent(ModCore.ObjectManager.GetTool("TitaniumHoe"), 1)), true));
#endregion
if (CraftingRecipesByGroup.ContainsKey(AnvilRecipes.craftingGroup))
{
foreach (KeyValuePair<string, UnlockableCraftingRecipe> recipe in AnvilRecipes.craftingRecipes)

View File

@ -303,7 +303,7 @@ namespace Revitalize.Framework.Objects
/// <returns></returns>
public Item GetTool(string Name)
{
if (this.Tools.ContainsKey("Name")) return this.Tools[Name].getOne();
if (this.Tools.ContainsKey(Name)) return this.Tools[Name].getOne();
else return null;
}

View File

@ -547,13 +547,11 @@ namespace Revitalize
Game1.player.addItemToInventoryBool(ObjectManager.GetItem("Workbench"));
Game1.player.addItemToInventory(new StardewValley.Object((int)Enums.SDVObject.Coal, 1));
Game1.player.addItemByMenuIfNecessary(ModCore.ObjectManager.GetItem("SteelIngot", 20));
PickaxeExtended pick = new PickaxeExtended(new BasicItemInformation("My First Pickaxe", "Omegasis.Revitalize.Items.Tools.MyFirstPickaxe", "A testing pickaxe. Does it work?", "Tool", Color.SlateGray, 0, 0, false, 500, false, false, TextureManager.GetTexture(Manifest, "Tools", "Pickaxe"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Tools", "Pickaxe"), new Animation(0, 0, 16, 16)), Color.White, true, null, null),2,TextureManager.GetExtendedTexture(Manifest,"Tools","TestingPickaxeWorking"));
//PickaxeExtended pick = new PickaxeExtended(new BasicItemInformation("My First Pickaxe", "Omegasis.Revitalize.Items.Tools.MyFirstPickaxe", "A testing pickaxe. Does it work?", "Tool", Color.SlateGray, 0, 0, false, 500, false, false, TextureManager.GetTexture(Manifest, "Tools", "Pickaxe"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Tools", "Pickaxe"), new Animation(0, 0, 16, 16)), Color.White, true, null, null),2,TextureManager.GetExtendedTexture(Manifest,"Tools","TestingPickaxeWorking"));
Game1.player.addItemsByMenuIfNecessary(new List<Item>()
{
pick,
new StardewValley.Object((int)Enums.SDVObject.Wood,100)
new StardewValley.Object((int)Enums.SDVObject.Wood,100),
ModCore.ObjectManager.GetItem("SteelIngot", 20)
});
}

View File

@ -242,18 +242,96 @@
<Content Include="Content\Graphics\Items\Resources\Ore\TitaniumOre.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\DefaultAxeWorking.png" />
<Content Include="Content\Graphics\Items\Tools\DefaultHoeWorking.png" />
<Content Include="Content\Graphics\Items\Tools\BronzeAxe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\BronzeAxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\BronzeHoe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\BronzeHoeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\BronzePickaxe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\BronzePickaxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\BronzeWateringCan.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\BronzeWateringCanWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\DefaultAxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\DefaultHoeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\DefaultPickaxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\DefaultWateringCanWorking.png" />
<Content Include="Content\Graphics\Items\Tools\DefaultWateringCanWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedAxe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedAxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedHoe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedHoeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedPickaxe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedPickaxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedWateringCan.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\HardenedWateringCanWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\Pickaxe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TestingPickaxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumAxe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumAxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumHoe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumHoeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumPickaxe.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumPickaxeWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumWateringCan.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Items\Tools\TitaniumWateringCanWorking.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Graphics\Menus\CraftingMenu\CraftButton.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>