Data Cleanup Projects

From PCGen Wiki
Jump to: navigation, search

Wield Category

Special Value: WeaponProf LST HANDS Token

Currently, the HANDS: token in WeaponProf LST files takes a special value: 1IFLARGERTHANWEAPON

This special value is no longer required and we should find ways to remove it from other game systems (other than SRD and RSRD where it is no longer present)

This will require defining the appropriate replacement, as well as doing a conversion

Replacement

Conversion

Starting Values

Currently, there are some default values of Wield Category that exist if no other values are defined in the Game Mode. These defaults should always be built on data load, rather than waiting for them to be accessed. These values are currently in WieldCategory.findByName() as of SVN 12324

These should be created when LstSystemLoader.finishLoad is called

Separate Game Mode file

Currently, the Wield Category is located in the Misc Info file of the Game Mode. Wield Categories are unique enough to deserve their own file in the Game Mode. Therefore, the should be moved to a separate file. This will require conversion when it takes place.

Conversion

Loading References

Currently, the Wield Category can load another Wield Category in a SWITCH token (WieldCategoryToken). There are two issues with the current construct:

  • The current construct does not parse the SWITCH token to create a WieldCategory reference. It is input as a string, and any misspellings would be caught at runtime. Therefore, we need to put WieldCategory under the control of the LoadContext, so that references to other WieldCategory objects can be made (and subsequently resolved)
  • The current use of PREVAR* and SWITCH is not a safe load. The two tokens are currently codependent, and only one can appear on each line (and no error checking is done if one is missing). This is a problem for doing editing type functions and makes it harder to properly write independent (and thus testable) tokens. In fact, the PREVAR and SWITCH items are parsed in the loader rather than as separate tokens. Therefore, we need to deprecate the current form of SWITCH (which is just a WieldCategory) and replace it with a version that takes the WieldCategory and a Prerequisite. This will combine the two, and allow a WieldCategory to appear on a single line (if desired), as well as a SWITCH token rather than being directly in the Loader

Tokens

The current WieldCategory tokens are "old style" tokens that do not have a LoadContext or unparse present. We should update these to "new style" tokens

Unreachable Data

It would seem on first inspection that the contents of the ZERO token in Wield Category objects is impossible to reach. This sets the replacement at Equipment Size = PC Size, but that is specifically shortcut in the code to return the same WC as the incoming WC. Therefore the ZERO value never seems to be fetched (not that I would understand the rules construct where we would WANT it to be fetched)

Complete Rebuild of Wield Category model

The Wield Category model today involves a significant amount of redundant information. Both the UP and DOWN tokens are redundant across the different WieldCategory items, and that would seem to allow mistakes. Should think about a method of having a single list of items (or only one way to define PREVIOUS/NEXT in the Wield Category family of objects)