Add an "Arcane" Tab (Savage)
With the basics of arcane powers now in place, we need to add a suitable tab where they can be managed by the user. We'll also need this new tab to adequately test the additional handling we must still implement for arcane powers.
Something Simple to Start With
We'll use the same technique that we used previously for obtaining a simple new tab. We'll clone the "tab_skills.dat" file and convert it over for handling arcane background details. Since the primary thing we'll be showing in this tab is a table of arcane powers, we'll convert the table over for that purpose. We'll also make use of the "SimpleItem" template within the table for expedience. Arcane powers will require that we provide our own custom template to show the various fields, but this will serve as a useful placeholder for the moment.
When the conversion is done, we'll have a single portal, layout, and panel. All of them will be tailored for their new purpose, ultimately looking something like the following.
<portal id="apPowers" style="tblNormal"> <table_dynamic component="Power" showtemplate="SimpleItem" choosetemplate="SimpleItem" addpick="resPowers"> <titlebar><![CDATA[ @text = "Add an Arcane Power - " & hero.child[resPowers].field[resSummary].text ]]></titlebar> <headertitle><![CDATA[ @text = "Arcane Powers - " & hero.child[resPowers].field[resSummary].text ]]></headertitle> <additem><![CDATA[ ~get the color-highlighted "add" text @text = field[resAddItem].text ]]></additem> </table_dynamic> </portal> <layout id="arcane"> <portalref portal="apPowers" taborder="10"/> <position><![CDATA[ ~freeze our table in advancement mode to disable adding new choices ~Note: All freezing must be done *before* any positioning is performed. if (state.iscreate = 0) then portal[apPowers].freeze = 1 endif ~position and size the table to span the full layout; it will only use the ~vertical space that it actually needs perform portal[apPowers].autoplace ]]></position> </layout> <panel id="arcane" name="Arcane" marginhorz="5" marginvert="5" order="140"> <layoutref layout="arcane"/> <position><![CDATA[ ]]></position> </panel>
We need to address when the "Arcane" tab appears to the user. Since the panel only applies for a character that has selected an arcane background, the panel should only be shown when a character possesses such a background. The visibility of the panel can be controlled via the Live tag expression, and that tag expression can key on whether the character possesses any "Arcane" tag. This can be implemented by adding the following line to the panel definition.
Arcane powers are exclusively selected via the "Arcane" tab. As such, any errors that may arise with arcane powers should highlight the "Arcane" tab in red so the user knows where to correct them. We can automatically associate every arcane power with the "Arcane" tab by specifying the "panellink" attribute within the "Arcane" component. Set the "panellink" attribute to "arcane" to establish the linkage for all powers.