morepurplemorebetter / MPMBs-Character-Record-Sheet

MorePurpleMoreBetter's D&D 5e Character Record Sheet
https://www.flapkan.com
GNU General Public License v3.0
372 stars 352 forks source link

Removing the "witch" string from the regExpSearch for the "sorcerer" … #49

Closed foleyj2 closed 6 years ago

foleyj2 commented 6 years ago

…class.

This line causes problems for anyone implementing a homebrew class with "witch" in its name.

foleyj2 commented 6 years ago

I posted related comments and opened discussion on https://www.reddit.com/r/mpmb/comments/7x0tc5/witch_triggers_sorcerer_creation/

morepurplemorebetter commented 6 years ago

The Witch being included as an alternative for the sorcerer is intentional and not a bug. Until WotC brings forward a class named 'witch', I'm keeping it like this.

If you want your imported code to work, you have two options:

  1. Re-define the regExpSearch of the sorcerer class by including the following line in your import: ClassList.sorcerer.regExpSearch = /sorcerer/i;
  2. Make your object name longer than 'sorcerer', e.g. 'witch-class'. The sheet looks through all the classes to see which one's regExpSearch matches the text in the class field and looks at the length of the object name to see which one is the 'newer'. I did the same for the Witch class that is in the additional content folder on this GitHub.
foleyj2 commented 6 years ago

Ah! I am new to javascript/JSON and didn't get the syntax right for adjusting the regExpSearch in sorcerer. Thank you for showing me how to implement the workaround.