Skip to content

Assorted changes and a couple of fixes to the fancy sheets - #147

Closed
PJBrs wants to merge 46 commits into
canismarko:masterfrom
PJBrs:wishlist-pj
Closed

Assorted changes and a couple of fixes to the fancy sheets#147
PJBrs wants to merge 46 commits into
canismarko:masterfrom
PJBrs:wishlist-pj

Conversation

@PJBrs

@PJBrs PJBrs commented Jan 19, 2023

Copy link
Copy Markdown
Contributor

Hi, I just found dungeon-sheets and I like it very much! I had been writing my character sheets by hand in latex using MSavage's style, but that isn't very automated.

I hope to contribute a little bit with a couple of ideas that are focused on the features pages. I think basically the patches speak for themselves, and for now I'd mainly like to get some reactions as to whether these patches are actually wanted, and perhaps what other / further directions to take with this.

I can also supply an example of the type of layout that I'm trying to achieve. I'm keeping a small wishlist of my own, with items like:

  • Ranger: Add feature options for Favored Enemy and Natural Explorer.
  • XP: Add Milestone option.
  • Allow handwritten boxes for rations, torches, arrows, bullets.
  • Add versatile damage automatically
  • Darkvision is always listed as source: race, but it can also be given by a (sub)class

I should add that I can code only a little bit, but I tested the changes on all the example sheets.

Anyway, I really hope to hear whether this type of work is appreciated!

@PJBrs
PJBrs force-pushed the wishlist-pj branch 4 times, most recently from 66e38c8 to 93c173c Compare January 21, 2023 21:27
@bw-mutley

Copy link
Copy Markdown
Contributor

Hi, I just found dungeon-sheets and I like it very much! I had been writing my character sheets by hand in latex using MSavage's style, but that isn't very automated.

Hi there, @PJBrs !
About this part, did you try using MSavage from Dungeonsheets? I've contributed to this part, let me know of any issues I can help.

Regards,
Mauricio

@PJBrs

PJBrs commented Jan 29, 2023

Copy link
Copy Markdown
Contributor Author

Hi @bw-mutley!

Thanks! I think most of the more structural changes apply to the features pages, hardly any to MSavaga's style. I've tested both though.

If you have any suggestions though for continuing this PR, please let me know. In the meantime, I've added one more substantial change that renders the monster blocks more in keeping with the RPGTex D&D style. Problem is, my repo now is one long list of assorted changes, including spelling fixes, small additions, small enhancements and substantial formatting changes that affect how everything looks...

I'm force-updating the PR now, and then I'll see whether I can sort it better. In the meantime, any suggestion at all would be appreciated!

@PJBrs

PJBrs commented Jan 29, 2023

Copy link
Copy Markdown
Contributor Author

So, I sorted all my patches. The first five patches are trivial spelling and whitespace fixes.
The next four add some equipment and offer very small corrections:

  • Ice Knife: put the material components in the right place
  • Armor: Add shield weight
  • Equipment: Add plural of book
  • Add potion of greater healing to equipment catalogue

The "Fix" pdfbookmarks patch does not fully work, but as far as I can tell, it's less error-prone than the current behaviour.

The next five patches all represent small enhancements:

  • Start page number of feature pages at 4
  • Distinguish between racial and class darkvision
  • Proficiencies: Harmonize capitalization and punction in MSavage.tex
  • Add 3rd and 5th level spells for Drow Magic feat
  • Add spellcasting details to latex spellbook form

All the remaining patches offer rather substantial changes that I personally like, and I hope for some feedback on them.

These two patches sort spells by name and level and add headings for each spell level in the features pages:

  • Sort spells by name and level
  • Add subheaders for spell level in the pdf

These two patches sort feats by origin and level (character feats, class feats, background feats and racial feats) and add associated headers in the feature pages:

  • List feats in the order that they're added
  • Separate headers for Character, Class, Racial and Background Feats

I tried to write these trying not to be invasive and ended up doing quite a lot of pattern matching in latex. Could have done them simpler.

The final two patches all concern relatively minor aesthetic changes that I liked:

  • MSavagetemplate: set XP to milestone if -1 <-- This enables users to have Milestone XP on their character sheet by entering -1 XP in their character .py-file.
  • Use all RPGtex options for monster formatting <-- This is actually quite substantial and tries to make monster box formatting to be more true to RPG-tex.

Basically, I'm looking for comments on all of these, regarding:

  • Which of these changes, if any, are wanted at all?
  • For those changes that are wanted, how should they be implemented?
  • How should I go about these patches anyway?

@bw-mutley

Copy link
Copy Markdown
Contributor

Problem is, my repo now is one long list of assorted changes, including spelling fixes, small additions, small enhancements and substantial formatting changes that affect how everything looks...

exactly how my local files are at the moment. I've made several additions and corrections too, but can't keep track of everything in commits like you did - seens like I have a lot to learn on how to keep with people here. To properly contribute again, I will - at some point - have to dowload the master branch again. I've seen many issues in my local files which were probably fixed.

@canismarko

Copy link
Copy Markdown
Owner

Hi, @PJBrs.

Apologies for the slow response. My day job got unexpectedly chaotic. Thank you for all the hard work and for organizing these commit in a useful way. I will take a closer look when things calm down a little bit and I get my feet back underneath me.

@PJBrs

PJBrs commented Jan 31, 2023

Copy link
Copy Markdown
Contributor Author

Hi @canismarko , take your time! By now it should be clear that I couldn't help myself anyway :-)

I think, given all patches I now added, the majority should be sufficiently palatable, but others also represent design choices that you might disagree with, and then there's the matter of whether my implementations are agreeable, aside from their effects.

I hope things will calm down soon!

@PJBrs

PJBrs commented Feb 1, 2023

Copy link
Copy Markdown
Contributor Author

@canismarko I noticed you triggered some tests. The latex ones fail because of the changes I made. The below patch adapts the tests to my other patches (and makes them pass). I'll look into the other failing tests another time.

--- a/tests/test_make_sheets.py
+++ b/tests/test_make_sheets.py
@@ -235,7 +235,7 @@ class TexCreatorTestCase(unittest.TestCase):
     def test_create_features_tex(self):
         char = self.new_character()
         tex = make_sheets.create_features_content(character=char, content_suffix="tex")
-        self.assertIn(r"\section*{Features}", tex)
+        self.assertIn(r"\section*{Class Features}", tex)
         self.assertIn(r"\subsection*{Martial Arts}", tex)
 
     def test_create_magic_items_tex(self):
@@ -248,7 +248,8 @@ class TexCreatorTestCase(unittest.TestCase):
         char = self.new_character()
         tex = make_sheets.create_spellbook_content(character=char, content_suffix="tex")
         self.assertIn(r"\section*{Spells}", tex)
-        self.assertIn(r"\section*{Invisibility}", tex)
+        self.assertIn(r"\subsection*{2nd-Level Spells}", tex)
+        self.assertIn(r"\subsubsection*{Invisibility}", tex)
 
     def test_create_infusions_tex(self):
         char = self.new_character()

@PJBrs

PJBrs commented Feb 5, 2023

Copy link
Copy Markdown
Contributor Author

I added the test I posted previously in the comments. Also, I reordered the new patches a bit to leave the DND-monster formatting at the end. I tested all monsters I could, made many formatting fixes as well, only remaining thing is to add bulleted lists.

And I wrote one more patch to enable DND-tables throughout, after I conjured up a regex that translated docutil's supertabular table header to a dndtable header. Next step is probably to see if I can improve any table I find.

@PJBrs
PJBrs force-pushed the wishlist-pj branch 3 times, most recently from 697e974 to 0f3fedb Compare February 10, 2023 17:40
@PJBrs

PJBrs commented Feb 10, 2023

Copy link
Copy Markdown
Contributor Author

Rewrote the monster formatting patch. I think it now is on par with, or better than regular latex.

I don't think I really have anything else to add anymore.

I didn't test all tables, but, in any case, the dndtables are less wide than the regular ones, so any text overflow will have been present anyway, and might be prevented now.

If necessary, I can upload some example character sheets... Would that help?

I did notice some potential enhancements, such as putting lair actions of dragons in a separate heading, just like aboleth, as well as formatting the breath weapons a bit more (\emph{breath weapon}). All that would be rather easy.

And one bug, perhaps, I can't seem to add certain monsters as companions, e.g.:
UserWarning: Companion 'Will-o'-Wisp' not found. Please add it to monsters.py

EDIT

Let's let this sit here for a while, while I test more... Just force-updated because I clobbered one of my previous fixes. ;'-)

EDIT 2 - 13 feb

Fixed a small bug in the dndtable header regex.

@PJBrs
PJBrs force-pushed the wishlist-pj branch 3 times, most recently from 28359ec to 85c9506 Compare February 13, 2023 21:50
@PJBrs

PJBrs commented Feb 19, 2023

Copy link
Copy Markdown
Contributor Author

@canismarko @bw-mutley
I think I really have no other patches to add right now. I have put a character sheet online to demonstrate the effects of all the patches in this PR together, note the feat and spell headings, the dndtables with text wrapping in cells, and the monster box formatting (I've given this character, a druid, a sizeable amount of companions).

@canismarko How might I make this PR easier to review? I can, for instance, make separate PRs for different groups of patches, for instance as follows:

  1. Spelling fixes / bug fixes
  2. MSavage style sheet enhancements
  3. Other small enhancements
  4. Monster formatting
  5. DNDtables
  6. Spellbook headings per spell level
  7. Separated headings for character, class, racial, and background feats

@bw-mutley Perhaps you'd be interested to take a look at the various patches that deal specifically with the MSavage style sheet?

Finally, I tried to run the dungeonsheets tests, which complain about some missing html pages, but the latex tests complete fine:

$ pytest3 tests
============================================================================================== test session starts ==============================================================================================
platform linux -- Python 3.9.16, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/pj/Src/dungeon-sheets/dungeon-sheets
plugins: cov-3.0.0
collected 125 items                                                                                                                                                                                             

tests/test_character.py ........................                                                                                                                                                          [ 19%]
tests/test_content_registry.py .....                                                                                                                                                                      [ 23%]
tests/test_dice.py ......                                                                                                                                                                                 [ 28%]
tests/test_encounter.py ..                                                                                                                                                                                [ 29%]
tests/test_epub.py ...                                                                                                                                                                                    [ 32%]
tests/test_equipment_reader.py .                                                                                                                                                                          [ 32%]
tests/test_features.py .......                                                                                                                                                                            [ 38%]
tests/test_html.py .s.........                                                                                                                                                                            [ 47%]
tests/test_latex.py .s.........                                                                                                                                                                           [ 56%]
tests/test_magic_items.py ..                                                                                                                                                                              [ 57%]
tests/test_make_sheets.py ...FFF.FFF...........                                                                                                                                                           [ 74%]
tests/test_monsters.py ....                                                                                                                                                                               [ 77%]
tests/test_multiclass.py ....                                                                                                                                                                             [ 80%]
tests/test_random_tables.py ..                                                                                                                                                                            [ 82%]
tests/test_readers.py .........                                                                                                                                                                           [ 89%]
tests/test_spells.py ....                                                                                                                                                                                 [ 92%]
tests/test_stats.py ......                                                                                                                                                                                [ 97%]
tests/test_weapon.py ...                                                                                                                                                                                  [100%]

[snip!]
============================================================================================ short test summary info ============================================================================================
FAILED tests/test_make_sheets.py::EpubOutputTestCase::test_character_file_created - jinja2.exceptions.TemplateNotFound: preamble.html
FAILED tests/test_make_sheets.py::EpubOutputTestCase::test_character_html_content - jinja2.exceptions.TemplateNotFound: preamble.html
FAILED tests/test_make_sheets.py::EpubOutputTestCase::test_gm_file_created - jinja2.exceptions.TemplateNotFound: preamble.html
FAILED tests/test_make_sheets.py::HtmlCreatorTestCase::test_create_extra_gm_content - jinja2.exceptions.TemplateNotFound: extra_gm_content.html
FAILED tests/test_make_sheets.py::HtmlCreatorTestCase::test_create_monsters_html - jinja2.exceptions.TemplateNotFound: monsters_template.html
FAILED tests/test_make_sheets.py::HtmlCreatorTestCase::test_create_party_summary_html - jinja2.exceptions.TemplateNotFound: party_summary_template.html
============================================================================= 6 failed, 117 passed, 2 skipped, 5 warnings in 38.05s =============================================================================

@bw-mutley

Copy link
Copy Markdown
Contributor

Hi there, @PJBrs , sorry for the late reply.

Perhaps you'd be interested to take a look at the various patches that deal specifically with the MSavage style sheet?

Thanks for the contribution. I will fork your branch and try to do it this week.

@PJBrs

PJBrs commented Mar 3, 2023

Copy link
Copy Markdown
Contributor Author

@bw-mutley Great!

Let me know if you need the MSavage style sheet changes in a separate branch...

Comment thread dungeonsheets/classes/sorceror.py
@bw-mutley

Copy link
Copy Markdown
Contributor

@bw-mutley Great!

Let me know if you need the MSavage style sheet changes in a separate branch...

Hi there, PJ! Only now I could have some spare time to work on it. I've made a small comment about the sorcerer -> sorceror change, please take a look. About the MSavagesheet: I will need some more time since I've changed my PC and ended missing some tex files needed.

@PJBrs

PJBrs commented Apr 3, 2023

Copy link
Copy Markdown
Contributor Author

Hi @bw-mutley I thought sorceror was the correct spelling, but indeed, not only the PHB but also standard dictionaries prefer sorcer_er_. I wonder whether we should revert or reverse that spelling patch ;)

@bw-mutley

Copy link
Copy Markdown
Contributor

Hi @bw-mutley I thought sorceror was the correct spelling, but indeed, not only the PHB but also standard dictionaries prefer sorcer_er_. I wonder whether we should revert or reverse that spelling patch ;)

I suppose it is up to @canismarko to decide. But my suggestion is to push a PR fixing all 'sorceror' ocurrences into 'sorcerer'.

PJBrs and others added 26 commits October 11, 2025 09:14
Allow the player choices for Trick Shots of the Gunslinger
Fighter subclass to be sorted as instances of AdeptMarksman,
by aliasing AdeptMarksman as TrickShot and by making all
Trick Shot features an instance of TrickShot
Make all Arcane Shot options a subclass of ArcaneShot, so
that they all get sorted directly after the Arcane Shot
feature text.
Allow Invocations to be sorted under the Eldritch
Invocations feature by aliasing the EldritchInvocation
class as Invocation.
This patch aliases Rites to CrimsonRites and BloodCurses to
BloodMaledict, so that all rites can be sorted under the
Crimson Rites feat, and all the blood curses under the
Blood Maledict feat.

Furthermore, it integrates the two Formulas classes.
Document the makesheets commandline option
to sort features by type.
"do fungus" should be "to fungus"  in line with TCE
This patch includes fixes, spelling fixes and formatting
enhancements for spells. Fixes are limited to misplaced
material components. Formatting consists of definition
lists and tables and a few newlines here and there.

Most relevant spelling change is:
Green-flame blade --> Green flame blade , which will
mean that existing characters with that spell need
to change its name in their character file.
This patch includes fixes, spelling fixes and formatting
enhancements for features. Formatting consists of
definition lists and tables and a few newlines here and
there.
The weight calculation omitted the weight of magic items.

One would expect that this could be as simple as:
weight += sum([m.weight for m in self.magic_items]).
However, this doesn't work for magic items that are also
added to self.weapons, since these would be counted twice
in the weight calculation.
In recent changes, the calculation for carrying weight
now better takes into account magic items and weapons.
Add this to the tests, and also check the new
weight_and_capacity_text code.
This allows a feature selected by a player (that is, non-class,
non-race) to be a FeatureSelectore. This is necessary to
implement, for instance, Resilient, which would be a
FeatureSelector where the chosen Ability in which the character
becomes resilient is then set in feature_choices.
Implement Resilient as a feature selector, add the various options
for resilient as features.
This patch adds the MSavage latex template as a submodule
to dungeonsheets, adds it to the TEXINPUTS environment
and adds TTFONTS environment variable to find the kalam
font.

Furthermore, make the MSavage latex template part of the
tests in the github workflow.

Remove babel support from the MSavage latex template,
otherwise latex will complain about missing languages
(alternatively, we could add the languages directory from
the dnd class to pyproject.toml).

The latest version of the MSavage latex template adds
automatic text scaling so that text fields no longer overflow with
longer inputs.

This fixes canismarko#92
The MSavage latex template was compiled using xelatex. To make this
work, an additional setting had to be used for dvipdfmx.cfg
(-dNOSAFER), which represents a (slight) security risk. Furthermore,
xelatex is very slow.

This patch switches to lualatex instead. It has different dependencies,
the most important one being the presence of luapstrics.lua.  As far as
I can tell, by now luapstricks.lua should be present on your average
system with TexLive. It is on mine, at least, on Slackware-15.0, which
is moderately conservative in many respects.
Rename the MSavage latex template to the more generic
latex_character_sheet_template.tex. I also renamed
associated functions that still had the msavage name
in them to more neutral alternatives.

This on behalf of Mat Savage himself, who created
the Latex 5e Character Sheet Template that we
use in dungeonsheets.
This patch adds the makesheets commandline option to
build the latex character sheet to the README.
Dungeonsheets now packages the dnd latex template and the dnd
latex character sheet template packages as submodules. This
greatly eases using the latex code, but it also takes away
some opportunities for customisation.

This patch checks whether dnd.sty and dndtemplate.sty are
already installed in a local latex directory, and if so,
adds them to the texinputs path used in the latex subprocess
environment.
This is a squashed commit of various changes by
Mat Savage to improve upon the github tests.

First, this patch updates the Docker file so that it is
compatible with lualatex. Furthermore, it adds a test
building all dungeonsheets examples in the docker workflow
file. And it refactors the python_ci workflow by only
testing all examples in python-3.12, to prevent the
test runs from taking so long. Finally, it pushes
the resulting docker image to the registry after tagging
it "latest".
The Bloodhunter features had three duplicate feature
classes:
   - Blood Curse of Corrosion
   - Blood Curse of the Exorcist
   - Blood Curse of the Souleater

This patch integrates these duplicates.
@PJBrs

PJBrs commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

Decided to close this one.

@PJBrs PJBrs closed this Nov 5, 2025
@PJBrs

PJBrs commented Nov 5, 2025

Copy link
Copy Markdown
Contributor Author

P.S. Would be nice to discuss on Discord though...

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.

5 participants