Skip to content

Commit

Permalink
Fix Collectable handling
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Jul 27, 2024
1 parent 1587cbb commit 4a00589
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Craftimizer/Utils/RecipeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public sealed record RecipeData

public ClassJob ClassJob { get; }
public RecipeInfo RecipeInfo { get; }
public bool IsCollectable => Recipe.ItemResult.Value?.AlwaysCollectable ?? false;
public IReadOnlyList<int?>? CollectableThresholds { get; }
public IReadOnlyList<(Item Item, int Amount)> Ingredients { get; }
public int MaxStartingQuality { get; }
Expand Down
2 changes: 1 addition & 1 deletion Craftimizer/Utils/SimulatedMacro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void FinalizeData()
public Reliablity(in SimulationState startState, IEnumerable<ActionType> actions, int iterCount, RecipeData recipeData)
{
Func<SimulationState, int> getParam;
if (recipeData.Recipe.ItemResult.Value!.IsCollectable)
if (recipeData.IsCollectable)
getParam = s => s.Collectability;
else if (recipeData.Recipe.RequiredQuality > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions Craftimizer/Windows/MacroEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ private bool DrawRecipeParams()
textStarsSize = AxisFont.CalcTextSize(textStars);
var textLevel = SqText.LevelPrefix.ToIconChar() + SqText.ToLevelString(RecipeData.RecipeInfo.ClassJobLevel);
var isExpert = RecipeData.RecipeInfo.IsExpert;
var isCollectable = RecipeData.Recipe.ItemResult.Value!.IsCollectable;
var isCollectable = RecipeData.IsCollectable;
var imageSize = ImGui.GetFrameHeight();
var textSize = ImGui.GetFontSize();
var badgeSize = new Vector2(textSize * (ExpertBadge.AspectRatio ?? 1), textSize);
Expand Down Expand Up @@ -1080,7 +1080,7 @@ void DrawCondition(DynamicBars.DrawerParams drawerParams)
new("Durability", Colors.Durability, State.Durability, RecipeData.RecipeInfo.MaxDurability),
new("Condition", DrawCondition)
};
if (RecipeData.Recipe.ItemResult.Value!.IsCollectable)
if (RecipeData.IsCollectable)
datas.Add(new("Collectability", Colors.Collectability, Reliability.ParamScore, State.Collectability, State.MaxCollectability, RecipeData.CollectableThresholds, $"{State.Collectability}", $"{State.MaxCollectability:0}"));
else if (RecipeData.Recipe.RequiredQuality > 0)
{
Expand Down
2 changes: 1 addition & 1 deletion Craftimizer/Windows/RecipeNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ private void DrawRecipeStats()
}
var textLevel = SqText.LevelPrefix.ToIconChar() + SqText.ToLevelString(RecipeData.RecipeInfo.ClassJobLevel);
var isExpert = RecipeData.RecipeInfo.IsExpert;
var isCollectable = RecipeData.Recipe.ItemResult.Value!.IsCollectable;
var isCollectable = RecipeData.IsCollectable;
var imageSize = ImGui.GetFrameHeight();
var textSize = ImGui.GetFontSize();
var badgeSize = new Vector2(textSize * (ExpertBadge.AspectRatio ?? 1), textSize);
Expand Down
2 changes: 1 addition & 1 deletion Craftimizer/Windows/SynthHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ private void DrawMacroInfo()
{
new("Durability", Colors.Durability, state.Durability, RecipeData.RecipeInfo.MaxDurability),
};
if (RecipeData.Recipe.ItemResult.Value!.IsCollectable)
if (RecipeData.IsCollectable)
halfBars.Add(new("Collectability", Colors.Collectability, reliability.ParamScore, state.Collectability, state.MaxCollectability, RecipeData.CollectableThresholds, $"{state.Collectability}", $"{state.MaxCollectability:0}"));
else if (RecipeData.Recipe.RequiredQuality > 0)
{
Expand Down

0 comments on commit 4a00589

Please sign in to comment.