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

Support for unidentified and corrupted items #1063

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

nqrcqn
Copy link
Contributor

@nqrcqn nqrcqn commented Sep 6, 2019

Added "Unidentified" text for unidentified items, added filters for unidentified and corrupted items and ensured "unidentified corrupted" maps look same as in-game. closes #995

screenshot:
unid

Added identified and uncorrupted item filters which only return maps and gear that can be identified or corrupted

@@ -26,6 +26,8 @@ public class ItemHoverViewModel
public string DescriptionText { get; private set; }
public string SecondaryDescriptionText { get; private set; }
public bool IsCorrupted { get; private set; }
public bool IsUnidentified { get; private set; }
public bool IsCorruptedOrUnidentified { get; private set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the setter, and have the getter look directly at this.IsCorrupted and this.IsUnidentified, so we don't have to duplicate the logic (and remember to keep multiple things in sync when changing any of them).


public bool Applicable(Item item)
{
if (item.TypeLine.Contains(" Flask") || item.TypeLine.Contains("Sacrifice at ") || item.TypeLine.Contains("Mortal ") || item.TypeLine.Contains(" Key") || item.TypeLine.Contains("Fragment of the ") || item.TypeLine.Contains(" Breachstone"))
Copy link
Contributor

Choose a reason for hiding this comment

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

We should prioritize quicker checks first. The first thing is to check if item.Corrupted is true. (And we shouldn't have to make that check multiple times in the function.)

These type line checks are for various kinds of fragments, right? We should limit this, then, to when the item is not a Gear object. There's no reason to run these [relatively] expensive string comparisons when the object is a Gear. Also we can use StartsWith or EndsWith for some of these, instead of the more expensive Contains.

Also, MaxStackSize is a property of Item, so we can check that before casting to a Gear object.

Copy link
Contributor Author

@nqrcqn nqrcqn Sep 6, 2019

Choose a reason for hiding this comment

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

MaxStackSize is just to exclude divination cards from gears, others are map fragments and flasks, there may be better ways to exclude those

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flasks, map fragments and breachstones come up as part of Gear, that's why I excluded them first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please check the new commit


public bool Applicable(Item item)
{
if (item.TypeLine.Contains(" Flask") || item.TypeLine.Contains("Sacrifice at ") || item.TypeLine.Contains("Mortal ") || item.TypeLine.Contains(" Key") || item.TypeLine.Contains("Fragment of the ") || item.TypeLine.Contains(" Breachstone"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Split this line across multiple lines.


public bool Applicable(Item item)
{
return !item.Identified;
Copy link
Contributor

Choose a reason for hiding this comment

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

For items that can't be unidentified, is item.Identified always true? If so, add a comment explaining this, and thus why we don't need a more complicated check (like we do for the IdentifiedItemFilter).

Copy link
Contributor Author

@nqrcqn nqrcqn Sep 6, 2019

Choose a reason for hiding this comment

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

yes that appears to be the case, haven't seen any issues with the way these filters work

@nqrcqn
Copy link
Contributor Author

nqrcqn commented Sep 10, 2019

Reverted itemhover changes since other pull request now contains bigger changes including these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better support unidentified and corrupted items
2 participants