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

[#79] Hide name/desc for items not identified #1696

Closed

Conversation

ccjmk
Copy link
Contributor

@ccjmk ccjmk commented Aug 11, 2022

Resolves #79

Used system.identified to toggle between description.value and description.unidentified and between showing true name or a masked 'Unidentified XYZ' faked name in item sheet (weapon/equipment/consumable) and actor inventory.

Possible further steps:

  • Leveraging baseItem on weapons and equipments to improve masked name, for example turning "Unidentified Martial Meele" into "Unidentified Rapier" or "Unidentified Medium Armor" to "Unidentified Breastplate".
  • Showing a fake icon if not identified; either mystery-man or saving a different icon akin of the description treatment.
  • Hiding possible spoiler data, ranging from values on the Description tab like Price and Properties, to hiding the Effects tab and everythin on the details tab save for the basic equipment details. Maybe even just showing the Identified flag on the Details tab at all.
  • Following a suggestion by Arcanist in the League's discord, a context menu could be added for the GM to identify/unidentify items on the sidebar (similar to Forien's mystify mechanics)
  • Some way of showing on the sidebar if an item is identified or not, like a little FA icon next to the name or showing the masked name with some style, and revealing the true name on hover for the GM, or the likes.

@arbron arbron self-requested a review August 11, 2022 16:24
@arbron arbron added ui User interface related features or bugs feature request labels Aug 11, 2022
module/utils.mjs Outdated Show resolved Hide resolved
@aaclayton
Copy link
Contributor

I presume gamemasters need to edit both the identified and unidentified item descriptions. Can we provide a better UX for that than needing to toggle the identified state in order to have access to the relevant text field?

@ccjmk
Copy link
Contributor Author

ccjmk commented Sep 1, 2022

@Fyorl question, I was still working on aaclayton latest comment (maybe I should have replied to that before?) but I imagine you closed this 'cause the v10-dev branch is closed, can't I just rebase this on whatever the new branch is ? Is the intention to move away from what I've been working on onto a different solution (in system or in core, as requested on the issue linked by andrew -- though my understanding of his reply was that this was The solution for now--to have systems implement their own solutions)

@Fyorl
Copy link
Contributor

Fyorl commented Sep 1, 2022

The v10-dev branch has become 2.0.x. I was not expecting GitHub to close all the PRs associated with v10-dev, sorry. I will go through and re-open those now. Thanks for pointing it out.

@Fyorl
Copy link
Contributor

Fyorl commented Sep 1, 2022

I seem to be lacking some permissions to change the target of these PRs and reopen them. Are you able to edit it and change the target to 2.0.x?

@ccjmk
Copy link
Contributor Author

ccjmk commented Sep 1, 2022

I don't seem to be able to change it here, but on a repo I have full ownership I can change the target branch from the Edit button that lets you change the PR title. Have you tried that one ? It should turn the target label into a selectable. Questionable UX xD (EDIT: for me, it just lets me change the title here, not the target branch)

@Fyorl Fyorl reopened this Sep 1, 2022
@Fyorl Fyorl changed the base branch from v10-dev to 2.0.x September 1, 2022 13:08
@ccjmk ccjmk force-pushed the feature/79-hide-unidentified-item-details branch from f9ce0c9 to 1b01c79 Compare September 1, 2022 15:59
@ccjmk ccjmk marked this pull request as draft September 1, 2022 17:28
@ccjmk ccjmk force-pushed the feature/79-hide-unidentified-item-details branch 4 times, most recently from f209aaa to 087575b Compare September 24, 2022 17:33
@ccjmk
Copy link
Contributor Author

ccjmk commented Sep 24, 2022

image

Following @aaclayton's advice, this is my current iteration, but I'm not sold on the UI with both descriptions together. Also, I see a divide between how only the "Unidentified {type}" is shown as name and showing both descriptions.

that is for GMs; regular users just see one description:
image
image

Alternatively, something like this could be done for the name:
image

There's also the fact that the title of the item sheet still shows the full name, but I am unable to change it somehow. I tried changing the title inside item-sheet.mjs::defaultOptions() but it didn't work. Where would be the appropriate place for that ?

@ccjmk ccjmk marked this pull request as ready for review September 24, 2022 18:00
@kaelad02
Copy link
Contributor

I get what you mean about the appearance of having both descriptions showing at the same time. I wonder if changing the styling of the <h3> dividers to look like those on the details tab would help. At least it would look consistent and maybe that'll be enough to make it look better.

And just to make sure, these kind of dividers are what I'm referring to:

image

@kaelad02
Copy link
Contributor

As for the title problem, the DocumentSheet class does have a title property that seems to pull the document's name. Perhaps that's overriding whatever you're trying to change with defaultOptions. I'd try overriding title in ItemSheet5e.

@krbz999
Copy link
Contributor

krbz999 commented Sep 25, 2022

Having two text editors in the same place seems like the way to go for ease of use.

However, the front page of the item sheet is notoriously annoying to work with, what with its height always resetting to less than the minimum with every change (or when dragging the sheet). If the inputs are stacked on each other vertically, the minimum height of the sheet needs an adjustment more than ever (or at minimum needs to stop resetting its height when dragged or when changing tabs).

Bit of a tangent, but I agree with Kaelad's idea.

@ccjmk ccjmk force-pushed the feature/79-hide-unidentified-item-details branch from 087575b to b2785ae Compare September 27, 2022 17:24
@ccjmk
Copy link
Contributor Author

ccjmk commented Sep 27, 2022

Updated as per suggestions, plus I found a couple extra places where the name and/or description are shown that were not initially mentioned; PR should be reviewable now!

Description of changes so far:

Inventory list now shows the correct description when expanded (screenshot is from a GM, player does not see true name)
image

Image had the item name as hover text, used the masked name now.
image
image

Also, GM sees both descriptions, with the unidentified one boxed and labeled for better visibility:

image


player view:

image
image

@ccjmk ccjmk changed the base branch from 2.0.x to 2.1.x September 27, 2022 17:34
@ccjmk ccjmk requested a review from arbron October 12, 2022 17:26
Copy link
Collaborator

@arbron arbron left a comment

Choose a reason for hiding this comment

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

The item descriptions are currently unusable (seen on Firefox):

Screen Shot 2022-10-13 at 11 35 09

Screen Shot 2022-10-13 at 11 35 21

* @returns {string} The localized name to show for the unidentified item.
* @private
*/
export function unidentifiedName(item) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

None of these are properly localized:

Screen Shot 2022-10-13 at 11 37 07

Screen Shot 2022-10-13 at 11 40 02

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, I thought they were in the system! Thanks for the review, I will look into it asap (I am moving this weekend though so it might take some time to catch up)

<input name="name" type="text" value="{{item.name}}" placeholder="{{ localize 'DND5E.ItemName' }}"/>
{{else}}
<input disabled name="ignored" type="text" value="{{ localize (dnd5e-unidentifiedName item) }}"/>
Copy link
Collaborator

@arbron arbron Oct 13, 2022

Choose a reason for hiding this comment

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

Disabled inputs are automatically ignored by form processing, so you don't need to worry about the name here.

Suggested change
<input disabled name="ignored" type="text" value="{{ localize (dnd5e-unidentifiedName item) }}"/>
<input type="text" value="{{ localize (dnd5e-unidentifiedName item) }}" disabled>

<input name="name" type="text" value="{{item.name}}" placeholder="{{ localize 'DND5E.ItemName' }}"/>
{{else}}
<input disabled name="ignored" type="text" value="{{ localize (dnd5e-unidentifiedName item) }}"/>
Copy link
Collaborator

@arbron arbron Oct 13, 2022

Choose a reason for hiding this comment

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

Suggested change
<input disabled name="ignored" type="text" value="{{ localize (dnd5e-unidentifiedName item) }}"/>
<input type="text" value="{{ localize (dnd5e-unidentifiedName item) }}" disabled>

Comment on lines 55 to 87
{{#unless isIdentifiable}}
{{editor descriptionHTML target="system.description.value"
button=true editable=editable engine="prosemirror" collaborate=false}}
{{/unless}}
{{#if showIdentifiedDesc}}
{{editor descriptionHTML target="system.description.value"
button=true editable=editable engine="prosemirror" collaborate=false}}
{{/if}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

These can just be merged into a single editor instance:

Suggested change
{{#unless isIdentifiable}}
{{editor descriptionHTML target="system.description.value"
button=true editable=editable engine="prosemirror" collaborate=false}}
{{/unless}}
{{#if showIdentifiedDesc}}
{{editor descriptionHTML target="system.description.value"
button=true editable=editable engine="prosemirror" collaborate=false}}
{{/if}}
{{#if (or showIdentifiedDesc (not isIdentifiable)}}
{{editor descriptionHTML target="system.description.value"
button=true editable=editable engine="prosemirror" collaborate=false}}
{{/if}}

@arbron
Copy link
Collaborator

arbron commented Oct 13, 2022

Adding align-content: stretch; to .dnd5e.sheet.item .sheet-body .tab seems to help with the descriptions being too small, but it will need to be tested to make sure it doesn't break stuff elsewhere.

{{/if}}
{{#if showUnidentifiedDesc}}
{{#if isGM}}
<hr class="flex0">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this <hr> just for spacing? It doesn't seem to show up visually. If so, it would probably be better to do with with CSS on the unidentified description box.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this <hr> was a remnent from showing a line that I removed, it will be gone.

{{#if isGM}}
<hr class="flex0">
<div class="unidentified-description">
<h3 class="flex0" >{{localize "DND5E.UnidentifiedDesc"}}</h3>
Copy link
Collaborator

Choose a reason for hiding this comment

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

.flex0 doesn't seem to be a class in the CSS, is this doing anything?

<input name="name" type="text" value="{{item.name}}" placeholder="{{ localize 'DND5E.ItemName' }}"/>
{{else}}
<input disabled name="ignored" type="text" value="{{ localize (dnd5e-unidentifiedName item) }}"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<input disabled name="ignored" type="text" value="{{ localize (dnd5e-unidentifiedName item) }}"/>
<input type="text" value="{{ localize (dnd5e-unidentifiedName item) }}" disabled>

etiquettestartshere and others added 4 commits October 30, 2023 12:55
Open delete dialogue to confirm deletion of active effects on the effects page.
…fect.mjs

Require confirmation to delete effects.
…-effect.mjs

Revert "Require confirmation to delete effects."
@arbron
Copy link
Collaborator

arbron commented Oct 31, 2023

@ccjmk Support for editing multiple items has been merged into the 2.4 branch. If you wanted to update this using those updates then we can take a look at this for either 2.4 or the next version :)

@ccjmk
Copy link
Contributor Author

ccjmk commented Nov 2, 2023

@arbron I sure would love to! I need to get my dev env up to speed probably because it's been like a year since I touched anything foundry-related, but I'll definitely want to move this forward. I'll hit you on discord if that's ok once I have my local branch updated and conflicts fixed.

@ccjmk ccjmk force-pushed the feature/79-hide-unidentified-item-details branch from 263f3be to fe7afa4 Compare November 5, 2023 18:09
@ccjmk ccjmk marked this pull request as draft November 5, 2023 18:12
@arbron arbron changed the base branch from 2.1.x to 2.4.x November 5, 2023 22:27
@arbron arbron added this to the D&D5E 2.5.0 milestone Dec 6, 2023
@arbron arbron removed this from the D&D5E 2.5.0 milestone Dec 19, 2023
@arbron arbron closed this Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request ui User interface related features or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants