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

Add text icons for HQ items and collectables #77

Merged
merged 11 commits into from
Aug 23, 2024

Conversation

augenfrosch
Copy link
Contributor

Adds text icons for HQ items and collectables using the same Unicode characters Final Fantasy XIV uses.
Additionally, improves the handling of pasted text copied from the game and changes game_data::Item to use AlwaysCollectable instead of IsCollectable from Item.csv.

Overview of the changes:

  • Add text icons for HQ items and collectables
    • Add a font that recreates the icons
    • Use the HQ character '\u{e03c}' instead of "(HQ)" when displaying the name of HQ items
    • Add the collectable character '\u{e03d}' to the end of the name of collectables
    • User input copied from the game that includes these characters now displays correctly
  • Improve handling of pasted text copied from the game
    • Filter out any null bytes that are included in the search text
    • Remove the HQ character from the search
  • Change game_data::Item to use AlwaysCollectable instead of IsCollectable from Item.csv.

Caveats / Limitations caused by the current implementation:

  • The font has a relatively "large" file size even though it just adds two characters. I couldn't get it any smaller than ~2kB with my limited knowledge
  • The code that checks if the collectable character should be added is used across all items, as such, it is also run for food items and potions.
    • It would be possible to bake the character into the item name but that would make the field differ from the entry in Item.csv which is potentially undesirable. Alternatively, you could pass an additional argument (can_be_collectable) to game_data::get_item_name
  • Null bytes are filtered from the search text regardless of the target. Although I only observed the issue on a native Windows build, I assume it happens when no code that affects the clipboard uses null-terminated strings. As such, I kept the code target independent
  • Removing the HQ character from the food and potion search makes the search less specific but I personally found it useful to always show both the NQ and HQ version.
    • The current version of Raphael allows for the specification by searching for "[Food/Potion] (HQ)" which only matches the HQ version of the item. If this behaviour is desired, I could change it to not remove the HQ character for the search to restore the old behaviour
  • Related to the last point, there is currently no easy way to include the HQ and collectable characters in the search text without having them in the clipboard
    • It would be possible to replace "(HQ)" and something like "(C)" with the respective character

Screenshot:
image

src/widgets/food_select.rs Outdated Show resolved Hide resolved
src/widgets/potion_select.rs Outdated Show resolved Hide resolved
src/widgets/recipe_select.rs Outdated Show resolved Hide resolved
This makes the search more "correct" and consistent to the recipe search. Additionally the search for all HQ items of a category is now possible.
…cively in the search text

This allows for easy input of those special characters without pasting them directly.
@augenfrosch
Copy link
Contributor Author

augenfrosch commented Aug 23, 2024

I made the requested change and (hopefully) fixed the failing tests. One of the tests (test_item_name_44232_hq) had to be rewritten since with the current implementation an item that is always a collectable will only include the collectable character at the end of it's name. To test the HQ functionality, I added a new test (test_item_name_44104_hq) that replaces the role of the aforementioned test

Additionally, I implemented two of my proposed alterations that I would now consider a usability improvement:

  • The search for food items and potions now behaves the same as the current version of Raphael, by not excluding the HQ character.
  • I added the easy input method for the special characters

Without these changes a user can not easily search for the same things possible in the current version of Raphael. Specifically, searches that included "(HQ)" at the end were not possible.

@KonaeAkira KonaeAkira merged commit 2c48381 into KonaeAkira:preview Aug 23, 2024
1 check passed
@KonaeAkira
Copy link
Owner

Nice work! Thank you for your contribution :)

@augenfrosch augenfrosch deleted the text-icons branch September 14, 2024 21:44
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.

2 participants