From b1ee13ace954898b2e4d1eb9ee421d7e85db24ec Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 6 Apr 2020 12:03:17 +0300 Subject: Fixed crafting bug and made trees to require axes --- Mundus/Data/Crafting/RI.cs | 9 ++++++--- Mundus/Service/Crafting/CraftingRecipe.cs | 2 +- Mundus/Service/SuperLayers/LandPresets.cs | 2 +- Mundus/Views/Windows/CraftingWindow.cs | 8 +++++++- Mundus/Views/Windows/SmallGameWindow.cs | 8 +++++--- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Mundus/Data/Crafting/RI.cs b/Mundus/Data/Crafting/RI.cs index c0af046..3ffd72e 100644 --- a/Mundus/Data/Crafting/RI.cs +++ b/Mundus/Data/Crafting/RI.cs @@ -10,12 +10,15 @@ namespace Mundus.Data.Crafting { public static List AllRecipies { get; private set; } public static CraftingRecipe StonePickAxe { get; private set; } + public static CraftingRecipe Hand { get; private set; } public static void CreateInstances() { - AllRecipies = new List(); - StonePickAxe = new CraftingRecipe(ToolPresets.GetAStonePickaxe(), 2, MaterialPresets.GetALandRock(), 2, MaterialPresets.GetAStick()); - AllRecipies.Add(StonePickAxe); + Hand = new CraftingRecipe(new Tool("blank_hand", ToolTypes.Axe, 10), 5, MaterialPresets.GetALandRock()); + + AllRecipies = new List { + StonePickAxe, Hand + }; } } } diff --git a/Mundus/Service/Crafting/CraftingRecipe.cs b/Mundus/Service/Crafting/CraftingRecipe.cs index 198622a..34092ee 100644 --- a/Mundus/Service/Crafting/CraftingRecipe.cs +++ b/Mundus/Service/Crafting/CraftingRecipe.cs @@ -58,7 +58,7 @@ namespace Mundus.Service.Crafting { if (ReqItem1 != null && hasEnough) { if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem1.stock_id)) { - hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem1.stock_id).Value >= Count2; + hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem1.stock_id).Value >= Count1; } else hasEnough = false; } diff --git a/Mundus/Service/SuperLayers/LandPresets.cs b/Mundus/Service/SuperLayers/LandPresets.cs index 5181c45..2357711 100644 --- a/Mundus/Service/SuperLayers/LandPresets.cs +++ b/Mundus/Service/SuperLayers/LandPresets.cs @@ -9,7 +9,7 @@ namespace Mundus.Service.SuperLayers { } public static Structure GetATree() { - return new Structure("tree", 5, ToolTypes.Pickaxe, 1, false, MaterialPresets.GetAStick()); + return new Structure("tree", 5, ToolTypes.Axe, 1, false, MaterialPresets.GetAStick()); } } } diff --git a/Mundus/Views/Windows/CraftingWindow.cs b/Mundus/Views/Windows/CraftingWindow.cs index 5037226..f5c2c3d 100644 --- a/Mundus/Views/Windows/CraftingWindow.cs +++ b/Mundus/Views/Windows/CraftingWindow.cs @@ -31,6 +31,7 @@ namespace Mundus.Views.Windows { private void PrintRecipe() { if (Recipes.Length > 0) { + ClearScreen(); CraftingRecipe recipe = Recipes[recipeIndex]; btnCraft.Sensitive = true; @@ -80,7 +81,7 @@ namespace Mundus.Views.Windows { btnPrev.Sensitive = recipeIndex > 0; } - private void Reset() { + private void ClearScreen() { lblC1.Text = "0"; lblC2.Text = "0"; lblC3.Text = "0"; @@ -92,6 +93,10 @@ namespace Mundus.Views.Windows { imgI3.SetFromStock("empty", IconSize.Dnd); imgI4.SetFromStock("empty", IconSize.Dnd); imgI5.SetFromStock("empty", IconSize.Dnd); + } + + private void Reset() { + ClearScreen(); imgItem.SetFromStock("empty", IconSize.Dnd); lblInfo.Text = null; @@ -100,6 +105,7 @@ namespace Mundus.Views.Windows { btnCraft.Sensitive = false; } + protected void OnBtnCraftClicked(object sender, EventArgs e) { CraftingController.CraftItem(Recipes[recipeIndex]); this.Hide(); diff --git a/Mundus/Views/Windows/SmallGameWindow.cs b/Mundus/Views/Windows/SmallGameWindow.cs index 1e8ca3d..1956e31 100644 --- a/Mundus/Views/Windows/SmallGameWindow.cs +++ b/Mundus/Views/Windows/SmallGameWindow.cs @@ -904,14 +904,16 @@ namespace Mundus.Views.Windows { protected void OnBtnIG1Clicked(object sender, EventArgs e) { //Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[0] = LandPresets.Boulder(); - //MobStatsController.DamagePlayer(1); - Service.Crafting.CraftingController.FindAvalableItems(); + MobStatsController.DamagePlayer(1); + //Service.Crafting.CraftingController.FindAvalableItems(); PrintMainMenu(); } protected void OnBtnIG2Clicked(object sender, EventArgs e) { Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[1] = new Service.Tiles.Items.Tool("blank_hand", Mundus.Data.Tiles.ToolTypes.Pickaxe, 1); - //MobStatsController.TryHealPlayer(1); + Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[0] = new Service.Tiles.Items.Tool("blank_hand", Mundus.Data.Tiles.ToolTypes.Axe, 1); + + MobStatsController.TryHealPlayer(1); PrintMainMenu(); } -- cgit v1.2.3