Skip to content

Commit

Permalink
Crafting Description (#1434)
Browse files Browse the repository at this point in the history
* Crafting Description

* Panda review I
  • Loading branch information
WeylonSantana committed Sep 3, 2022
1 parent 22175f5 commit e5742cc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
39 changes: 25 additions & 14 deletions Intersect.Client/Interface/Game/Crafting/CraftingWindow.cs
Expand Up @@ -18,11 +18,6 @@ namespace Intersect.Client.Interface.Game.Crafting

public partial class CraftingWindow
{

private static int sItemXPadding = 4;

private static int sItemYPadding = 4;

public bool Crafting;

private ImagePanel mBar;
Expand All @@ -43,8 +38,6 @@ public partial class CraftingWindow

private int mAutoCraftAmount = 0;

private ImagePanel mCraftedItemTemplate;

private Guid mCraftId;

//Controls
Expand All @@ -56,19 +49,28 @@ public partial class CraftingWindow

private List<RecipeItem> mItems = new List<RecipeItem>();

private ImagePanel mItemTemplate;

private Label mLblIngredients;

private Label mLblProduct;

private Label mLblRecipes;

private Label mLblCraftingChance;

private Label mLblDestroyMaterialsChance;

private Label mLblCraftingTime;

//Objects
private ListBox mRecipes;

private List<Label> mValues = new List<Label>();

//Location
public int X => mCraftWindow.X;

public int Y => mCraftWindow.Y;

public CraftingWindow(Canvas gameCanvas)
{
mCraftWindow = new WindowControl(gameCanvas, Globals.ActiveCraftingTable.Name, false, "CraftingWindow");
Expand All @@ -86,6 +88,15 @@ public CraftingWindow(Canvas gameCanvas)
mLblProduct = new Label(mCraftWindow, "ProductLabel");
mLblProduct.Text = Strings.Crafting.product;

mLblCraftingChance = new Label(mCraftWindow, "ProductChanceLabel");
mLblCraftingChance.Text = Strings.Crafting.CraftChance.ToString(0);

mLblDestroyMaterialsChance = new Label(mCraftWindow, "DestroyMaterialsChanceLabel");
mLblDestroyMaterialsChance.Text = Strings.Crafting.DestroyMaterialsChance.ToString(0);

mLblCraftingTime = new Label(mCraftWindow, "CraftingTimeLabel");
mLblCraftingTime.Text = Strings.Crafting.CraftingTime.ToString(0);

//Recepie list
mRecipes = new ListBox(mCraftWindow, "RecipesList");

Expand Down Expand Up @@ -114,11 +125,6 @@ public CraftingWindow(Canvas gameCanvas)
};
}

//Location
public int X => mCraftWindow.X;

public int Y => mCraftWindow.Y;

private void LoadCraftItems(Guid id)
{
//Combined item
Expand Down Expand Up @@ -246,6 +252,11 @@ private void LoadCraftItems(Guid id)
);
}

//Show crafting time and chances
mLblCraftingTime.Text = Strings.Crafting.CraftingTime.ToString(craft.Time / 1000.0);
mLblCraftingChance.Text = Strings.Crafting.CraftChance.ToString(craft.FailureChance);
mLblDestroyMaterialsChance.Text = Strings.Crafting.DestroyMaterialsChance.ToString(craft.ItemLossChance);

//If crafting & we no longer have the items for the craft then stop!
if (Crafting)
{
Expand Down
9 changes: 9 additions & 0 deletions Intersect.Client/Localization/Strings.cs
Expand Up @@ -610,9 +610,18 @@ public partial struct Crafting
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public static LocalizedString craftall = @"Craft {00}";

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public static LocalizedString CraftChance = @"Chance to fail: {00}%";

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public static LocalizedString CraftingTime = "Time to craft: {00}s";

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public static LocalizedString craftstop = "Stop";

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public static LocalizedString DestroyMaterialsChance = @"Chance to destroy materials: {00}%";

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public static LocalizedString incorrectresources =
@"You do not have the correct resources to craft this item.";
Expand Down

0 comments on commit e5742cc

Please sign in to comment.