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

[Bug]: Export button not displayed in Cypher System #83

Closed
1 task done
trevorschadt opened this issue Jul 23, 2023 · 3 comments
Closed
1 task done

[Bug]: Export button not displayed in Cypher System #83

trevorschadt opened this issue Jul 23, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@trevorschadt
Copy link
Contributor

trevorschadt commented Jul 23, 2023

Expected Behavior

Given:

  • A world is created using the Cypher System;
  • The "Export Sheet to PDF" module has been activated;
  • The "Cypher System" mapping included in the settings for the module has been set;

When:

  • A GM or an owning player opens a character's sheet;

Then:

  • A link should appear on the title bar of the character sheet that allows the user to export the character's data to PDF.

Current Behavior

Given: as above
When: as above
Then:

  • No such button, link, or other access method is displayed on the title bar.

Steps to Reproduce

  1. Launch a world that uses the Cypher System game system.
  2. Activate the "Export Sheet to PDF" module, click the "Save Module Settings" button and select "Yes" on the "Reload Application?" dialog that appears.
  3. In the "Export Sheet to PDF" section of the "Configure Game Settings" dialog and select "cyphersystem" from the "Mapping" drop down. Click "Save Changes."
  4. In the "Actors" tab of the sidebar, create a new Actor.
  5. Observe that no link, button or other methodology to access the Export functionality appears on the title bar.

Context

No response

Version

0.22.4

Foundry VTT Version

11.306

Operating System

Windows

Browser / App

Native Electron App

Game System

cyphersystem

Modules Disabled

  • I can confirm that disabling all of my other modules doesn't fix this issue.
@trevorschadt trevorschadt added the bug Something isn't working label Jul 23, 2023
@mrkwnzl
Copy link

mrkwnzl commented Sep 18, 2023

I found the error. There’s a check for the right actor types, and it looks for PC, but in the Cypher System, all actor types are lower case, i. e. pc.

Adding "pc" here (or transforming everything to lower case) will solve this issue:

if (!["character", "PC", "Player", "npc"].includes(sheet.actor.type ?? sheet.actor.data.type)) return;

As a system agnostic and future-proof way, let the systems define what actor types should be able to export the sheet. For example, having NPCs have that sheet doesn’t really make sense for the Cypher System (NPCs don’t have character sheets), but the Companion actor type might work with different mappings.

@gioppoluca
Copy link
Collaborator

In 5e I have recently added the option to have sheets also for NPC.
I need to check if there is an API for getting the actor sheet.
Will check.
For the moment could be a solution for you if I add also lower case "pc" in the next build?

@mrkwnzl
Copy link

mrkwnzl commented Sep 24, 2023

Yeah, lower case pc will work.

gioppoluca added a commit to gioppoluca/pdf-sheet that referenced this issue Sep 24, 2023
gioppoluca added a commit that referenced this issue Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants