Code:
@@ @Modify Spec Abil Click
@PROPS@ fontColor=lime ; autoExecute=true ; fontSize=11pt ; sortBy=3 ; color=blue ; playerEditable=false ; applyToSelected=false ; group=11 Special Abilities ; tooltip= ; minWidth=147 ;
[h: passed = macro.args]
[h: classviewed = json.get(passed, "Classviewed")]
[h: classdata = json.get(CasterInfo, classviewed)]
[h: SAdata = json.get(classdata, "SpecAbil Data")]
[h: powdata = json.get(passed, "Abildata")]
[h: oldpowname = json.get(powdata, "Name")]
[h: powcategory = json.get(powdata, "Category")]
[h: catdata = json.get(SAdata, powcategory)]
[h: powatlevel = json.get(powdata, "At Level")]
[h: powatlevelprop = json.get(powdata, "At Level Property")]
[h: powusage = json.get(powdata, "Usage")]
[h: powuses = json.get(powdata, "Uses")]
[h: powusesleft = json.get(powdata, "Uses Left")]
[h: pownote = json.get(powdata, "Note")]
[h: powflavor = json.get(powdata, "Flavor Text")]
[h: powflavoronly = json.get(powdata, "Flavor Only")]
[h, if(string(powflavor)=="(None)" || string(powflavor)==""), code:{
[inptext = "addflavor|0|Add flavortext?|check"]
[quote3 = 0]
[quote4 = 0]
}; {
[inptext = "powflavor|"+powflavor+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=90##quote3|1|Put quote at head of flavor text?|check##quote4|1|Put quote at end of flavor text?|check##powflavoronly|Supplement,Override|Flavor text interacts with default output how?|radio|select="+powflavoronly+" orient=h"]
[addflavor = 0]
}]
[h: usagelist="As an AT-WILL power,As a Number of BOLTS that can be called in large numbers,As an ITEM with permanently expeded CHARGES used 1 at a time,As an ITEM with permanently expended CHARGES used in varying amounts,As a number of FEET that can be called in large numbers,As a number of LEVELS normally added to apply metamagic,As a constantly active PASSIVE power,As a number of POINTS that can be used in large numbers (e.g. for absorbtion),As a number of ROUNDS used one at a time,As a number of USES used one at a time (like casting a spell)"]
[h: shortusagelist="At-Will,Bolts,Charges,Multi Charges,Feet,Levels,Passive,Points,Rounds,Uses"]
[h: usagestart = listFind(shortusagelist, powusage)]
[h:screen3=input(
"powname|"+oldpowname+"|Name|text|width=50",
"powatlevel|"+powatlevel+"|Reveal number|text|width=3",
"powatlevelprop|"+powatlevelprop+"|Reveal property ('(None)' to always display)|text|width=50",
"powusage|"+usagelist+"|How should the manager treat the way it is used?|list|select="+usagestart+" value=number",
"powuses|"+powuses+"|Code for uses per day ('Automated' for pre-coded options)|text|width=50",
"powusesleft|"+powusesleft+"|Number of uses left now|text|width=5",
"pownote|"+pownote+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=75",
"quote1|1|Put quote at head of note?|check",
"quote2|1|Put quote at end of note?|check",
inptext
)]
[h:abort(screen3)]
[h, if(addflavor == 1), code:{
[screen = input(
"powflavor|"+powflavor+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=90",
"quote3|1|Put quote at head of flavor text?|check",
"quote4|1|Put quote at end of flavor text?|check",
"powflavoronly|Supplement,Override|Flavor text interacts with default output how?|radio|select="+powflavoronly+" orient=h"
)][abort(screen)]
}; {}]
[h, if(powusage == 0 || powusage == 6): powuses = "Infinite"]
[h: powusage = listGet(shortusagelist, powusage)]
[h, if(!isNumber(powatlevel)): powatlevel = 0]
[h, if(!isNumber(powusesleft)): powusesleft = 0]
[h, if(isNumber(powuses)): powuses = powuses+"*1"]
[h, if(powusage == 0 || powusage == 6): powusesleft = "Infinite"]
[h, if(string(powuses) == "Automated"), code:{
[screen = input(
"codepick|Number,Infinite,Ability Modifier (D&D rules),Number+Ability Modifier,Straight Up Token Property,Token Property/2 (Round Down),(Manual Entry)|How should the manager calculate uses per day|radio|select=2 value=string orient=h"
)][abort(screen)]
[h,if(codepick=="Number"),code:{
[screen4=input(
"powuses|50|Enter how many uses this ability should have"
)]
[h:abort(screen4)]
[powuses=powuses+"*1"]
}; {}]
[h,if(codepick=="Infinite"),code:{
[powuses="Infinite"]
}; {}]
[if(codepick=="(Manual Entry)"),code:{
[screen6=input(
"powuses|3+floor((Charisma-10)/2)|Enter your code"
)][abort(screen6)]
}; {}]
[if(codepick=="Ability Modifier (D&D rules)"),code:{
[screen7=input(
"propertypick|Intelligence|Enter the name of the token property holding your ability score"
)][abort(screen7)]
[powuses="floor(("+propertypick+"-10)/2)"]
}; {}]
[if(codepick=="Number+Ability Modifier"),code:{
[screen7=input(
"propertypick|Intelligence|Enter the name of the token property holding your ability score",
"numberpick|3|Enter the number to add"
)][abort(screen7)]
[powuses=numberpick+"+floor(("+propertypick+"-10)/2)"]
}; {}]
[if(codepick=="Straight Up Token Property"),code:{
[screen7=input(
"propertypick|Level|Enter the name of the token property to use"
)][abort(screen7)]
[powuses=propertypick]
}; {}]
[if(codepick=="Token Property/2 (Round Down)"),code:{
[screen7=input(
"propertypick|Level|Enter the name of the token property to use"
)]
[abort(screen7)]
[powuses="floor("+propertypick+"/2)"]
}; {}]
}; {}]
[h,if(quote1==1):quote1=" ' "; quote1=""]
[h,if(quote2==1):quote2=" ' "; quote2=""]
[h:pownote=quote1+trim(pownote)+quote2]
[h,if(quote3==1):quote3=" ' "; quote3=""]
[h,if(quote4==1):quote4=" ' "; quote4=""]
[h:powflavor=quote3+trim(powflavor)+quote4]
[h: newpower=json.set("{}","Name",powname,"Category",powcategory,"Uses",powuses,"Uses Left",powusesleft,"Usage",powusage,"At Level",powatlevel,"At Level Property",powatlevelprop,"Note",pownote,"Flavor Text",powflavor,"Flavor Only",powflavoronly)]
[h: catdata = json.remove(catdata, oldpowname)]
[h: catdata = json.set(catdata, powname, newpower)]
[macro("Alphabetize Object@this"): catdata]
[h: catdata = macro.return]
[h: SAdata = json.set(SAdata, powcategory, catdata)]
[h: classdata = json.set(classdata, "SpecAbil Data", SAdata)]
[h: CasterInfo = json.set(CasterInfo, classviewed, classdata)]
[macro("Manage SA Main@Lib:spells"): classviewed]
!!
@@ @Modify Group Abil Click
@PROPS@ fontColor=lime ; autoExecute=true ; fontSize=11pt ; sortBy=3 ; color=blue ; playerEditable=false ; applyToSelected=false ; group=11 Special Abilities ; tooltip= ; minWidth=147 ;
[h: passed = macro.args]
[h: classviewed = json.get(passed, "Classviewed")]
[h: classdata = json.get(CasterInfo, classviewed)]
[h: SAdata = json.get(classdata, "SpecAbil Data")]
[h: powdata = json.get(passed, "Abildata")]
[h: oldpowname = json.get(powdata, "Name")]
[h: powcategory = json.get(powdata, "Category")]
[h: catdata = json.get(SAdata, powcategory)]
[h: powatlevel = json.get(powdata, "At Level")]
[h: powatlevelprop = json.get(powdata, "At Level Property")]
[h: powusage = json.get(powdata, "Usage")]
[h: powuses = json.get(powdata, "Uses")]
[h: pownote = json.get(powdata, "Note")]
[h: powflavor = json.get(powdata, "Flavor Text")]
[h: powflavoronly = json.get(powdata, "Flavor Only")]
[h, if(string(powflavor)=="(None)" || string(powflavor)==""), code:{
[inptext = "addflavor|0|Add flavortext?|check"]
[quote3 = 0]
[quote4 = 0]
}; {
[inptext = "powflavor|"+powflavor+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=90##quote3|1|Put quote at head of flavor text?|check##quote4|1|Put quote at end of flavor text?|check##powflavoronly|Supplement,Override|Flavor text interacts with default output how?|radio|select="+powflavoronly+" orient=h"]
[addflavor = 0]
}]
[h: usagelist="Set Number (0 for At-Will),Varies (Use Calls An Input),Code (Enter)"]
[h: shortusagelist="Fixed, Varies, Code"]
[h: usagestart = listFind(shortusagelist, powusage)]
[h:screen3=input(
"powname|"+oldpowname+"|Name|text|width=50",
"powatlevel|"+powatlevel+"|Reveal number|text|width=3",
"powatlevelprop|"+powatlevelprop+"|Reveal property ('(None)' to always display)|text|width=50",
"usagepick|"+usagelist+"|How should the manager treat the way it is used?|list|select="+usagestart+" value=number",
"pownote|"+pownote+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=75",
"quote1|1|Put quote at head of note?|check",
"quote2|1|Put quote at end of note?|check",
inptext
)]
[h:abort(screen3)]
[h, if(addflavor == 1), code:{
[screen = input(
"powflavor|"+powflavor+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=90",
"quote3|1|Put quote at head of flavor text?|check",
"quote4|1|Put quote at end of flavor text?|check",
"powflavoronly|Supplement,Override|Flavor text interacts with default output how?|radio|select="+powflavoronly+" orient=h"
)][abort(screen)]
}; {}]
[h: powusage = listGet(shortusagelist, usagepick)]
[h, if(!isNumber(powatlevel)): powatlevel = 0]
[h, if(usagepick == 0), code:{
[screen=input(
"groupdata|0|Enter the number of group points this ability will use up with each use (0 for At-Will)|text|width=5"
)]
[abort(screen)]
}; {
[if(usagepick == 1): groupdata = 0]
}]
[h,if(usagepick==2),code:{
[screen=input(
"groupdata|max(0,14-Intelligence)|Enter code to determine group point usage|text|width=50"
)]
[abort(screen)]
}; {}]
[h,if(quote1==1):quote1=" ' "; quote1=""]
[h,if(quote2==1):quote2=" ' "; quote2=""]
[h:pownote=quote1+trim(pownote)+quote2]
[h,if(quote3==1):quote3=" ' "; quote3=""]
[h,if(quote4==1):quote4=" ' "; quote4=""]
[h:powflavor=quote3+trim(powflavor)+quote4]
[h:powertoadd=json.set("{}","Name",powname,"Category",powcategory,"Usage",powusage,"Uses",groupdata,"At Level",powatlevel,"At Level Property",powatlevelprop,"Note",pownote,"Flavor Text",powflavor,"Flavor Only",powflavoronly)]
[h: catdata = json.remove(catdata, oldpowname)]
[h: catdata = json.set(catdata, powname, powertoadd)]
[macro("Alphabetize Object@this"): catdata]
[h: catdata = macro.return]
[h: SAdata = json.set(SAdata, powcategory, catdata)]
[h: classdata = json.set(classdata, "SpecAbil Data", SAdata)]
[h: CasterInfo = json.set(CasterInfo, classviewed, classdata)]
[macro("Manage SA Main@Lib:spells"): classviewed]
!!
@@ @Modify CI Spec Abil Click
@PROPS@ fontColor=yellow ; autoExecute=true ; fontSize=11pt ; sortBy=3 ; color=blue ; playerEditable=false ; applyToSelected=false ; group=11 Special Abilities ; tooltip= ; minWidth=147 ;
[h: powdata = macro.args]
[h: oldpowname = json.get(powdata, "Name")]
[h: powcategory = json.get(powdata, "Category")]
[h: powatlevel = json.get(powdata, "At Level")]
[h: powatlevelprop = json.get(powdata, "At Level Property")]
[h: powusage = json.get(powdata, "Usage")]
[h: powuses = json.get(powdata, "Uses")]
[h: powusesleft = json.get(powdata, "Uses Left")]
[h: pownote = json.get(powdata, "Note")]
[h: powflavor = json.get(powdata, "Flavor Text")]
[h: powflavoronly = json.get(powdata, "Flavor Only")]
[h, if(string(powflavor)=="(None)" || string(powflavor)==""), code:{
[inptext = "addflavor|0|Add flavortext?|check"]
[quote3 = 0]
[quote4 = 0]
}; {
[inptext = "powflavor|"+powflavor+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=90##quote3|1|Put quote at head of flavor text?|check##quote4|1|Put quote at end of flavor text?|check##powflavoronly|Supplement,Override|Flavor text interacts with default output how?|radio|select="+powflavoronly+" orient=h"]
[addflavor = 0]
}]
[h: usagelist="As an AT-WILL power,As a Number of BOLTS that can be called in large numbers,As an ITEM with permanently expeded CHARGES used 1 at a time,As an ITEM with permanently expended CHARGES used in varying amounts,As a number of FEET that can be called in large numbers,As a number of LEVELS normally added to apply metamagic,As a constantly active PASSIVE power,As a number of POINTS that can be used in large numbers (e.g. for absorbtion),As a number of ROUNDS used one at a time,As a number of USES used one at a time (like casting a spell)"]
[h: shortusagelist="At-Will,Bolts,Charges,Multi Charges,Feet,Levels,Passive,Points,Rounds,Uses"]
[h: usagestart = listFind(shortusagelist, powusage)]
[h:screen3=input(
"powname|"+oldpowname+"|Name|text|width=50",
"powatlevel|"+powatlevel+"|Reveal number|text|width=3",
"powatlevelprop|"+powatlevelprop+"|Reveal property ('(None)' to always display)|text|width=50",
"powusage|"+usagelist+"|How should the manager treat the way it is used?|list|select="+usagestart+" value=number",
"powuses|"+powuses+"|Code for uses per day ('Automated' for pre-coded options)|text|width=50",
"powusesleft|"+powusesleft+"|Number of uses left now|text|width=5",
"pownote|"+pownote+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=75",
"quote1|1|Put quote at head of note?|check",
"quote2|1|Put quote at end of note?|check",
inptext
)]
[h:abort(screen3)]
[h, if(addflavor == 1), code:{
[screen = input(
"powflavor|"+powflavor+"|Provide descriptive text surrounded by single quotes (accepts code; see help menu)|text|width=90",
"quote3|1|Put quote at head of flavor text?|check",
"quote4|1|Put quote at end of flavor text?|check",
"powflavoronly|Supplement,Override|Flavor text interacts with default output how?|radio|select="+powflavoronly+" orient=h"
)][abort(screen)]
}; {}]
[h, if(powusage == 0 || powusage == 6): powuses = "Infinite"]
[h: powusage = listGet(shortusagelist, powusage)]
[h, if(!isNumber(powatlevel)): powatlevel = 0]
[h, if(!isNumber(powusesleft)): powusesleft = 0]
[h, if(isNumber(powuses)): powuses = powuses+"*1"]
[h, if(powusage == 0 || powusage == 6): powusesleft = "Infinite"]
[h, if(string(powuses) == "Automated"), code:{
[screen = input(
"codepick|Number,Infinite,Ability Modifier (D&D rules),Number+Ability Modifier,Straight Up Token Property,Token Property/2 (Round Down),(Manual Entry)|How should the manager calculate uses per day|radio|select=2 value=string orient=h"
)][abort(screen)]
[h,if(codepick=="Number"),code:{
[screen4=input(
"powuses|50|Enter how many uses this ability should have"
)]
[h:abort(screen4)]
[powuses=powuses+"*1"]
}; {}]
[h,if(codepick=="Infinite"),code:{
[powuses="Infinite"]
}; {}]
[if(codepick=="(Manual Entry)"),code:{
[screen6=input(
"powuses|3+floor((Charisma-10)/2)|Enter your code"
)][abort(screen6)]
}; {}]
[if(codepick=="Ability Modifier (D&D rules)"),code:{
[screen7=input(
"propertypick|Intelligence|Enter the name of the token property holding your ability score"
)][abort(screen7)]
[powuses="floor(("+propertypick+"-10)/2)"]
}; {}]
[if(codepick=="Number+Ability Modifier"),code:{
[screen7=input(
"propertypick|Intelligence|Enter the name of the token property holding your ability score",
"numberpick|3|Enter the number to add"
)][abort(screen7)]
[powuses=numberpick+"+floor(("+propertypick+"-10)/2)"]
}; {}]
[if(codepick=="Straight Up Token Property"),code:{
[screen7=input(
"propertypick|Level|Enter the name of the token property to use"
)][abort(screen7)]
[powuses=propertypick]
}; {}]
[if(codepick=="Token Property/2 (Round Down)"),code:{
[screen7=input(
"propertypick|Level|Enter the name of the token property to use"
)]
[abort(screen7)]
[powuses="floor("+propertypick+"/2)"]
}; {}]
}; {}]
[h,if(quote1==1):quote1=" ' "; quote1=""]
[h,if(quote2==1):quote2=" ' "; quote2=""]
[h:pownote=quote1+trim(pownote)+quote2]
[h,if(quote3==1):quote3=" ' "; quote3=""]
[h,if(quote4==1):quote4=" ' "; quote4=""]
[h:powflavor=quote3+trim(powflavor)+quote4]
[h: newpower=json.set("{}","Name",powname,"Category",powcategory,"Uses",powuses,"Uses Left",powusesleft,"Usage",powusage,"At Level",powatlevel,"At Level Property",powatlevelprop,"Note",pownote,"Flavor Text",powflavor,"Flavor Only",powflavoronly)]
[h: catdata = json.get(CI_SpecAbils, powcategory)]
[h: catdata = json.remove(catdata, oldpowname)]
[h: catdata = json.set(catdata, powname, newpower)]
[macro("Alphabetize Object@this"): catdata]
[h: catdata = macro.return]
[h: CI_SpecAbils = json.set(CI_SpecAbils, powcategory, catdata)]
[macro("Manage CISA Main@Lib:spells"): "Class-Independent, 0"]
!!