Thanks for the compliment. No one has ever said anything like that about my code before and I do this for a living.
Now onto some help for you and your framework:
I don't know your framework really, but I'd suggest either starting with monsters or players and concentrating on that first off. Personally I'd pick monsters as their base data is a lot smaller to deal with and they are created a lot more regularly than players.Monsters
class stores the data from a monster. It's usually generated by a bit of a backdoor approach. When you ask it for it's HTML (getHtml() method) it goes off to the Compendium and grabs the HTML and whilst there it parses it, populating all the fields at that time. I think I get pretty much everything you need from the monster HTML onto the 'NPC' object when I parse it. I don't parse out the Equipment at this stage but I think I get everything else. You probably don't need to change this code I don't think.
Once your NPC is populated, you create a Token for it using the Token
class. This class is subclassed into NPCToken
for any special extra stuff that needs doing for those specialist cases. To output a token for your framework (whether it be PC or NPC) you'll probably best off extending NPCToken and PCToken, creating something like RumblesNPCToken and RumblesPCToken classes. This done you need to override the following methods:
- writePropertyMap() - this is what builds the properties for your token. Should be quite self explanatory.
- writePowerMacros() - this writes out the macros on the "Selected" frame. I loop through each power on the N/PC and create a macro for each one. Currently what those macros do for me is to display the HTML of the power. You would override these to do whatever your macros do. I also create my "Character Sheet" macro at this stage but I guess you have no need for that.
- optionally writePowerMacro(). If you use the same approach as me of looping over each power to make a macro this method actually writes out the XML for each macro.
That's it. I think that the issue for you will be how to get the data that you want to write out. Incidentally, the important part of the macro code in XML is the <command> node. This is where you need to stick your actual macro code. Players
Firstly, in order to get more granular information out of the save file, look at the PCDataAccessor.java file. This class basically deals with taking in a Character Builder save file and generating a PC class object. It builds a DOM and then uses lots of separate routines to parse the DOM to get all the nitty gritty data out. It could easily be expanded to pick out smaller granularity stuff like a PCs strength bonus etc. So far all I have done is to make it retrieve the stuff I am interested in. If you do expand it to read in more data you'll need to expand either the Character or PC class to hold this extra data.
Once you have got all the data you need out of the character sheet, you can use the same approach as for monsters to make your PC tokens. Again there really isn't much to do other than override those same three methods.
This may well not cover everyrhing and more issues will probably come up from this but I think this should be a start for you.
Also, if you want to utilize my character sheet dockable frame, as well as your existing framework, feel free. Just add code to make the "Character Sheet" macro when you're building the others and add it on as a 'on mouseover' field. You could override the buildHtml() method if you want it to look different - for example by copying the code but removing all the links which are for my framework.
I hope this helps and if you have any questions at all, shout.
The guy in the green hat.