Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show seal hours for barrel recipes in handbook #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,7 @@ protected List<RichTextComponentBase> BuildBarrelRecipesText(ICoreClientAPI capi
int ingredientsLen = recipes[0].Ingredients.Length;
ItemStack[][] ingstacks = new ItemStack[ingredientsLen][];
ItemStack[] outstacks = new ItemStack[recipes.Count];
double sealHours = 0;

for (int i = 0; i < recipes.Count; i++)
{
Expand All @@ -1261,6 +1262,7 @@ protected List<RichTextComponentBase> BuildBarrelRecipesText(ICoreClientAPI capi
ingstacks[j][i] = recipes[i].Ingredients[j].ResolvedItemstack;
}

sealHours = recipes[i].SealHours;
outstacks[i] = recipes[i].Output.ResolvedItemstack;
}

Expand Down Expand Up @@ -1289,6 +1291,11 @@ protected List<RichTextComponentBase> BuildBarrelRecipesText(ICoreClientAPI capi
ocmp.ShowStackSize = true;
barrelRecipesTexts.Add(ocmp);

string sealHoursText = (sealHours > 24.0) ? " " + Lang.Get("{0} days", Math.Round(sealHours / (double)capi.World.Calendar.HoursPerDay, 1)) : Lang.Get("{0} hours", Math.Round(sealHours));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

24.0 should be capi.World.Calendar.HoursPerDay as well so it properly adjusts if the setting is changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capi.World.Calendar.HoursPerDay

Done

var hoursCmp = new RichTextComponent(capi, sealHoursText, CairoFont.WhiteSmallText());
hoursCmp.VerticalAlign = EnumVerticalAlign.Middle;
barrelRecipesTexts.Add(hoursCmp);

barrelRecipesTexts.Add(new ClearFloatTextComponent(capi, 10));
}

Expand Down