- Output is sorted, shows the token state images in the tooltips.
- The "conditions" have been reformatted an include a tool tip.
- Everything is on it's own line and in a table.
- Items or mods with states, if active, are set in case they get turned off manually or through some other method.
- All mods appears in a thin border box with header.
||| ConditionReport |||
Code: Select all
@@ @ConditionReport
[H: output = "" ]
[H: gTok = "Lib:GlobalsSRDPF" ]
[H: jTM = getLibProperty( "TempModToggleSets", gTok ) ]
[H: atms = json.get( PrivateJSON, "ActiveTempModSets" ) ]
[H, IF( json.isEmpty( atms ) ): activeMSList = ""; activeMSList = json.toList( json.unique( atms ) ) ]
[H: jPTM= json.get( PrivateJSON, "CustomModSetValues") ]
[H, FOREACH( m, activeMSList ), CODE: {
[IF( json.isEmpty( jPTM ) ): jPM = ""; jPM = json.get( jPTM, m ) ]
[IF( json.isEmpty( jPM ) ): tTip = json.get( json.get( jTM, m ), "tip" );tTip = json.get( jPM, "tip" ) ]
[ tCat = json.get( json.get( jTM, m ), "cat" )]
[ tState = json.get( json.get( jTM, m), "state")]
[H, if(tState != "NA"), code: {
[H: setState(tState,1)]
[H: stateImage = strformat("<img src='%s' width=50 height=50>",getStateImage(tState))]
};{
[H: stateImage = " "]
}]
[IF(tCat == ""): tCat = "Mod"]
[H: tTip = strformat('<span title="<html><table><tr valign=top><td>%{stateImage}</td><td>%{tTip}</td></tr></table></html>">%{m}</span>')]
[H: output = json.append(output,strformat('<tr id="%s"><td style="padding: 0px 2px 0px 5px;text-align:right" NOWRAP><b>%{tCat}:</b></td><td style="padding-right: 5px">%{tTip}</td></tr>',replace(lower(tCat+m),"[^a-z0-9._]","")))]
}]
[H: aitems = json.get( PrivateJSON, "ActiveItems" ) ]
[H, IF( json.isEmpty( aitems ) ): activeMSList = ""; activeMSList = json.toList( json.unique( aitems ) ) ]
[H, FOREACH( m, activeMSList ), CODE: {
[IF( json.isEmpty( jPTM ) ): jPM = ""; jPM = json.get( jPTM, m ) ]
[IF( json.isEmpty( jPM ) ): tTip = json.get( json.get( BonusTypedItems, m ), "tip" );tTip = json.get( jPM, "tip" ) ]
[ tCat = json.get( json.get( BonusTypedItems, m ), "cat" )]
[ tState = json.get( json.get( BonusTypedItems, m), "state")]
[H, if(tState != "NA"), code: {
[H: setState(tState,1)]
[H: stateImage = strformat("<img src='%s' width=50 height=50>",getStateImage(tState))]
};{
[H: stateImage = " "]
}]
[IF(tCat == "" || tCat == "Misc"): tCat = "Item"]
[H: tTip = strformat('<span title="<html><table><tr valign=top><td>%{stateImage}</td><td>%{tTip}</td></tr></table></html>">%{m}</span>')]
[H: output = json.append(output,strformat('<tr id="%s"><td style="padding: 0px 2px 0px 5px;text-align:right" NOWRAP><b>%{tCat}:</b></td><td style="padding-right: 5px">%{tTip}</td></tr>',replace(lower(tCat+m),"[^a-z0-9._]","")))]
}]
[H: numConditions = tbl("Conditions",0)]
[H, for(i,0,numConditions), code: {
[H: conditionStr = tbl("Conditions",i + 1)]
[H: curState = listGet(conditionStr,0,";")]
[H, if(getState(curState)), code: {
[H: conditionText = replace(listGet(conditionStr,1,";"),"%","%%")]
[H: stateImage = "'"+getStateImage(curState)+"'"]
[H: tTip = strformat('<span title="<html><table><tr valign=top><td><img src=%{stateImage} width=50 height=50></td><td>%{conditionText}</td></tr></table></html>">%{curState}</span>')]
[H: output = json.append(output,strformat('<tr id="state%s"><td style="padding: 0px 2px 0px 5px;text-align:right" NOWRAP><b>State:</b></td><td style="padding-right: 5px">%{tTip}</td></tr>',lower(curState)))]
};{}]
}]
[H: output = json.sort(output,"a")]
[R,S: '<table style="background-color:black"><tr><td style="padding:1pt"><table style="background-color:white"><tr><th colspan=2 style="color:blue;text-align:center">Mod Report</th></tr>' + json.toList(output,"") + "</table></td></tr></table>"]
!!