Here is the field I added to the category helper component
Code:
<field
id="cpriority"
name="Priority"
type="derived"
persistence="full">
</field>
Here is one of the two buttons that swaps the primary/secondary attributes or skills. All it does is increase the priority index of the one being lowered, then it lowers both indexes based on which one is currently in the lower position. It doesn't rely on the dot values at all, just the priority field. It's nothing elaborate, just a brute force mathematical method that does the job.
Code:
<portal
id="swapPS"
style="actSwap"
tiptext="Click here to Swap Prioritization categories.">
<action
action="trigger">
<trigger><![CDATA[
~We need to swap our Primary and Secondary category dots
if (hero.child[cTalent].field[cpriority].value = 1) then
hero.child[cTalent].field[cpriority].value += 3
if (hero.child[cSkill].field[cpriority].value = 2) then
hero.child[cSkill].field[cpriority].value -= 1
hero.child[cTalent].field[cpriority].value -= 2
elseif (hero.child[cKnowledge].field[cpriority].value = 2) then
hero.child[cKnowledge].field[cpriority].value -= 1
hero.child[cTalent].field[cpriority].value -= 2
endif
elseif (hero.child[cSkill].field[cpriority].value = 1) then
hero.child[cSkill].field[cpriority].value += 3
if (hero.child[cTalent].field[cpriority].value = 2) then
hero.child[cTalent].field[cpriority].value -= 1
hero.child[cSkill].field[cpriority].value -= 2
elseif (hero.child[cKnowledge].field[cpriority].value = 2) then
hero.child[cKnowledge].field[cpriority].value -= 1
hero.child[cSkill].field[cpriority].value -= 2
endif
elseif (hero.child[cKnowledge].field[cpriority].value = 1) then
hero.child[cKnowledge].field[cpriority].value += 3
if (hero.child[cTalent].field[cpriority].value = 2) then
hero.child[cTalent].field[cpriority].value -= 1
hero.child[cKnowledge].field[cpriority].value -= 2
elseif (hero.child[cSkill].field[cpriority].value = 2) then
hero.child[cSkill].field[cpriority].value -= 1
hero.child[cKnowledge].field[cpriority].value -= 2
endif
endif
]]></trigger>
</action>
</portal>