GrimmSpector
March 9th, 2016, 06:02
Looking at the 3.5e implementation for Feats, from what I can gather, it looks like when you drag a feat over, it just creates a link, and a string with the value of the name field from the link; I'm not sure where the "value" tag in the database comes from that is storing that name in the list.
I'm looking at implementing Traits for Battletech through a similar method. Like everything else in Battletech the numerical value of a trait depends on the XP a player puts in it, so the intended layout/implementation is something like this:
Drag & Drop a Trait from the Library
Item appears just like in the feats list, but the windowlist has extra controls; one indicates the current Level of the trait, and the other is editable, and indicates the XP spent on the trait
Traits have maximums and minimums, that can have a significant range, anywhere from -15 to +15 in some cases, others can only have specific values like "3 or 7", or just "1", and some have prerequisites.
The trait needs to only increase the score when sufficient XP is spent to reach a valid level, this is easy coding, however I'm not sure what values I can add to the library module for feats, or more importantly how to access them.
The traits cannot be added manually, only dragged, so only edit not add functionality will be included in the list
Some traits impact how XP is calculated on other things, so some traits need to modify a global value in the DB for that character, I'm thinking of setting this up with a comparison of the "name" field for the trait, and if the name fits certain values having a boolean type setup in the characters database entry, i.e. if the trait was called "Green" and it was one I was tracking for, it would put a database "number" with the value "1" called "green". Again this should be fairly easy to implement, but I'm unsure the best approach for building an xml structure to extend feat entries to make this work well
I think that's it for now; I've included the XML from the library module for a feat entry below, and would love to hear some suggestions. I'm aware that the "class" entry in the "windowreference" items is used when the link is dragged to allow the Drag event handlers to identify the data structure being dragged and dropped, and to tell fg what sort of window class to construct when opened.
This puts the "feats" listing into the library module itself:
<feats>
<librarylink type="windowreference">
<class>referenceindex</class>
<recordname>lists.feats@PFRPG Basic Rules</recordname>
</librarylink>
<name type="string">Feats</name>
</feats>
[CODE]
The xml above allows this type of entry in a list with links:
[CODE]
<feats>
<name type="string">Feats</name>
<index>
<acrobatic>
<listlink type="windowreference">
<class>referencefeat</class>
<recordname>reference.feats.acrobatic@PFRPG Basic Rules</recordname>
</listlink>
<name type="string">Acrobatic</name>
</acrobatic>
And this link, links to this entry:
<feats>
<acrobatic>
<name type="string">Acrobatic</name>
<type type="string">General</type>
<mult type="number">0</mult>
<stack type="number">0</stack>
<benefit type="formattedtext">
<p>You get a +2 bonus on all Acrobatics and Fly skill checks. If you have 10 or more ranks in one of these skills, the bonus increases to +4 for that skill.</p>
</benefit>
</acrobatic>
Some of the feats have entries of other types, such as "prerequisites", or "special", etc., either as strings or as formattedtext elements; but I've been unsuccesful in finding in the xml how these are being structured into the feats reference windows. I imagine knowing this might help me significantly on pursuing a data structure, and deciding how much information to store in the character DB, and what to leave purely in the library, per item.
I'm looking at implementing Traits for Battletech through a similar method. Like everything else in Battletech the numerical value of a trait depends on the XP a player puts in it, so the intended layout/implementation is something like this:
Drag & Drop a Trait from the Library
Item appears just like in the feats list, but the windowlist has extra controls; one indicates the current Level of the trait, and the other is editable, and indicates the XP spent on the trait
Traits have maximums and minimums, that can have a significant range, anywhere from -15 to +15 in some cases, others can only have specific values like "3 or 7", or just "1", and some have prerequisites.
The trait needs to only increase the score when sufficient XP is spent to reach a valid level, this is easy coding, however I'm not sure what values I can add to the library module for feats, or more importantly how to access them.
The traits cannot be added manually, only dragged, so only edit not add functionality will be included in the list
Some traits impact how XP is calculated on other things, so some traits need to modify a global value in the DB for that character, I'm thinking of setting this up with a comparison of the "name" field for the trait, and if the name fits certain values having a boolean type setup in the characters database entry, i.e. if the trait was called "Green" and it was one I was tracking for, it would put a database "number" with the value "1" called "green". Again this should be fairly easy to implement, but I'm unsure the best approach for building an xml structure to extend feat entries to make this work well
I think that's it for now; I've included the XML from the library module for a feat entry below, and would love to hear some suggestions. I'm aware that the "class" entry in the "windowreference" items is used when the link is dragged to allow the Drag event handlers to identify the data structure being dragged and dropped, and to tell fg what sort of window class to construct when opened.
This puts the "feats" listing into the library module itself:
<feats>
<librarylink type="windowreference">
<class>referenceindex</class>
<recordname>lists.feats@PFRPG Basic Rules</recordname>
</librarylink>
<name type="string">Feats</name>
</feats>
[CODE]
The xml above allows this type of entry in a list with links:
[CODE]
<feats>
<name type="string">Feats</name>
<index>
<acrobatic>
<listlink type="windowreference">
<class>referencefeat</class>
<recordname>reference.feats.acrobatic@PFRPG Basic Rules</recordname>
</listlink>
<name type="string">Acrobatic</name>
</acrobatic>
And this link, links to this entry:
<feats>
<acrobatic>
<name type="string">Acrobatic</name>
<type type="string">General</type>
<mult type="number">0</mult>
<stack type="number">0</stack>
<benefit type="formattedtext">
<p>You get a +2 bonus on all Acrobatics and Fly skill checks. If you have 10 or more ranks in one of these skills, the bonus increases to +4 for that skill.</p>
</benefit>
</acrobatic>
Some of the feats have entries of other types, such as "prerequisites", or "special", etc., either as strings or as formattedtext elements; but I've been unsuccesful in finding in the xml how these are being structured into the feats reference windows. I imagine knowing this might help me significantly on pursuing a data structure, and deciding how much information to store in the character DB, and what to leave purely in the library, per item.