$include $lib/alynna $include $lib/rp lvar param lvar cgstage lvar sections $def }yerf }cat "FFa2.Sheet" pretty tellme $def }oyerf }cat "FFa2.Sheet" pretty tellhere $def -j 0 $def /dev/sda1 pop $def corny? "npc" getstat if "NPC" else "Character" then : qmorph[ arr:input -- arr:output ] { input @ foreach swap pop "^YELLOW^" swap strcat "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst repeat }array ; : mke2fs ( Parameter 1, stat dir ) ( Parameter 2, one of: ) $def SECTION_BOOLEAN 1 $def SECTION_COMPACT 2 $def SECTION_NUMERIC 3 $def SECTION_SPECIAL 4 { 1 { "Merits" "mer/" SECTION_SPECIAL }array 2 { "Skills" "s/" SECTION_NUMERIC }array 3 { "Specialties" "s/" SECTION_SPECIAL }array 4 { "Talents" "ta/" SECTION_BOOLEAN }array 5 { "Powers" "p/" SECTION_BOOLEAN }array 6 { "Specifics" "p/" SECTION_SPECIAL }array 7 { "Sorcery" "mag/" SECTION_BOOLEAN }array 8 { "Schools" "sch/" SECTION_BOOLEAN }array 9 { "Effects" "eff/" SECTION_BOOLEAN }array 10 { "Psionics" "psi/" SECTION_SPECIAL }array 11 { "Gifts" "psi/Gifts/" SECTION_BOOLEAN }array 12 { "Savant" "psi/Savant/" SECTION_BOOLEAN }array 13 { "Orders" "or/" SECTION_SPECIAL }array 14 { "Abilities" "ab/" SECTION_BOOLEAN }array 15 { "Equipment" "eq/" SECTION_NUMERIC }array }dict sections ! ; : getstatdir[ d:target s:dir -- a:stats ] target @ "/@rp/" dir @ strcat array_get_propvals var! x target @ "/@rp/@/" dir @ strcat array_get_propvals var! y y @ foreach var! value var! item x @ item @ [] value @ + x @ item @ ->[] x ! repeat x @ ; : sheet.psionics var! target { { "^GREEN^Primary psionics: " target @ "psi/1" getstatstr dup not if pop "^RED^None" then }cat 39 lj { "^CYAN^Secondary psionics: " target @ "psi/2" getstatstr dup not if pop "^RED^None" then }cat 39 lj }tell ; SAFECALL sheet.psionics : sheet.specialties[ d:target -- x:random-bullshit ] var special { RPSYSTEM "/Skills/" array_get_propdirs foreach var! item pop { "Skills" item @ "Specialties" }rpinfo if item @ then repeat }array special ! special @ foreach item ! pop target @ "s/" item @ strcat getstat if { target @ { "/@rp/s/" item @ "/" }cat array_get_propvals array_explode pop target @ { "/@rp/@/s/" item @ "/" }cat array_get_propvals array_explode pop }dict var! tmp { "^CYAN^::: ^YELLOW^" item @ " ^WHITE^[^GREEN^" tmp @ array_count "/" target @ "s/" item @ strcat getstat "^WHITE^] ^CYAN^:::" }tell tmp @ array_keys array_make 4 wrap_items_fixed qmorph atellme then repeat ; SAFECALL sheet.specialties : sheet.specifics[ d:target -- nil:random-bullshit ] var special { RPSYSTEM "/Powers/" array_get_propdirs foreach var! dir1 pop RPSYSTEM "/Powers/" dir1 @ "/" strcat strcat array_get_propdirs foreach var! item pop { "Powers" dir1 @ item @ "Specific" }rpinfo if item @ then repeat repeat }array special ! special @ foreach item ! pop target @ "/@rp/p/" item @ strcat propdir? if { target @ { "/@rp/p/" item @ "/" }cat array_get_propvals array_explode pop target @ { "/@rp/@/p/" item @ "/" }cat array_get_propvals array_explode pop }dict var! tmp { "^CYAN^::: ^YELLOW^" item @ " ^WHITE^[^GREEN^" tmp @ array_count "/" target @ item @ gtype target @ { "/@rp/@/p/" item @ "/" }cat array_get_propvals array_count + "^WHITE^] ^CYAN^:::" }tell tmp @ array_keys array_make 4 wrap_items_fixed qmorph atellme then repeat ; SAFECALL sheet.specifics : getMastery[ d:target s:magictype -- i:mastery ] 1677216 var! curlow { "Magic" magictype @ "Mastery" }rpinfo mklist foreach swap pop var! cur target @ "m/" cur @ strcat getstat ( target @ "b/" cur @ strcat getstat + ) dup not if pop target @ "s/" cur @ strcat getstat then dup curlow @ < if curlow ! else pop then repeat curlow @ ; : sheet.magic var! target 0 array_make var! output target @ "/@rp/mag/" array_get_propvals foreach var! value var! item value @ if { item @ " [" target @ item @ getMastery "] " }cat 26 lj "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst output @ []<- output ! then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then ; SAFECALL sheet.magic : getXS[ d:target s:merit -- i:essence ] { RPSYSTEM "/Race/" array_get_propdirs foreach var! dir1 pop RPSYSTEM { "/Race/" dir1 @ }cat array_get_propdirs foreach var! dir2 pop RPSYSTEM { "/Race/" dir1 @ "/" dir2 @ }cat array_get_propdirs foreach var! dir3 pop dir3 @ { dir1 @ "/" dir2 @ }cat repeat repeat repeat }dict var! DAMN DAMN @ merit @ [] chopsub "{True|Outsider}" smatch if target @ growth case 0 3 .. when 4 end 4 6 .. when 2 end 7 inf .. when 0 end endcase else target @ growth case 0 3 .. when 5 end 4 6 .. when 3 end 7 inf .. when 1 end endcase then ; : sheet.merits var! target 0 array_make var! output target @ "/@rp/mer/" array_get_propvals foreach var! value var! item value @ if { item @ }cat 26 lj "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst output @ []<- output ! then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then ; SAFECALL sheet.merits : sheet.orders var! target 0 array_make var! output target @ "/@rp/or/" array_get_propvals foreach var! value var! item value @ if { "^YELLOW^" { item @ { "Orders" item @ "Order" }rpinfo if " (" { "Orders" item @ "Order" }rpinfo ")" then }cat 48 lj { "Orders" item @ "Status" }rpinfo 30 rj }cat "^CYAN^(^GREEN^" "(" subst "^CYAN^)^YELLOW^" ")" subst tellme then repeat ; SAFECALL sheet.orders : doSection[ d:target i:sectionnum -- ] $def lstat BASE @ swap strcat 0 array_make var! output sections @ sectionnum @ [] 0 [] var! section sections @ sectionnum @ [] 1 [] var! BASE sections @ sectionnum @ [] 2 [] var! TYPE target @ "/@rp/" BASE @ strcat propdir? target @ "/@rp/@/" BASE @ strcat propdir? or if ( Header ) section @ header tellme TYPE @ case SECTION_BOOLEAN = when target @ BASE @ getstatdir foreach var! value var! item value @ if item @ 26 lj output @ []<- output ! then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then end SECTION_COMPACT = when target @ BASE @ getstatdir foreach var! value var! item value @ if value @ 1 = if item @ 26 lj output @ []<- output ! else { item @ " [" value @ "] " }cat 26 lj "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst output @ []<- output ! then then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then end SECTION_NUMERIC = when target @ BASE @ getstatdir foreach var! value var! item value @ if { item @ " [" value @ "] " }cat 26 lj "^CYAN^[^GREEN^" "[" subst "^CYAN^]^YELLOW^" "]" subst output @ []<- output ! then output @ array_count 3 = if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then repeat output @ array_count 0 > if { "^YELLOW^" output @ array_interpret "^NORMAL^" }tell 0 array_make output ! then end SECTION_SPECIAL = when target @ prog { "sheet." section @ }cat call end endcase then ; : main var target mke2fs -j /dev/sda1 param ! param @ case "#public" smatch when me @ "_prefs/sheet/public?" 1 setprop { "You have opted to show your sheet to other players." }yerf exit end "#private" smatch when me @ "_prefs/sheet/public?" 0 setprop { "You have opted to keep your sheet hidden from other players. This excludes staff." }yerf exit end endcase ( Spend a little time letting wizzes look at other sheets. Default to looking at my own only. ) me @ mlevel 5 >= if param @ not if me @ target ! else param @ resolver target ! target @ int 0 < if { "Who the heck is " param @ "?" }yerf exit then then else param @ if param @ resolver target ! target @ int 0 < if { "Who the heck is " param @ "?" }yerf exit then target @ "_prefs/sheet/public?" getprop not if { target @ ansi_name " has opted to keep their sheet private." }yerf exit then else me @ target ! then then ( Start printing the sheet ... ) { target @ unparseobj }cat header tellme ( Nations and DP/XP use ) { "^YELLOW^" "Nation: " 11 rj target @ "Nationality" getstatstr 33 lj "^GREEN^DP: " target @ dp tofloat 0 round tostr 6 lj "^CYAN^Power: " target @ xp tofloat 0 round tostr 6 rj "/" target @ power tofloat 0 round tostr 6 lj }tell ( Races ) { "^CYAN^" "Faith: " 11 rj target @ "Faith" getstatstr 10 lj "^CYAN^Allegiances: " target @ "Allegiances" getstatstr ", " explode_array array_commas }tell { "Races: " 11 rj target @ "Races" getstatstr dup if ", " explode_array array_commas else pop "Plain old mundane furry ^^o.o^^" then }tell { "^RED^" ( Physical ) { "Physical: " 11 rj target @ physical tostr 3 rj "/" target @ mphysical tostr 3 lj " [" target @ physical target @ mphysical statbar "]" }cat 36 lj "^WHITE^ " { "Defence: " 14 rj target @ defence tostr 3 rj "/" target @ mdefence tostr 3 lj "Soak: " 14 rj target @ soak tostr 3 rj "/" target @ msoak tostr 3 lj }cat 42 lj }tell { "^GREEN^" ( Mental ) { "Mental: " 11 rj target @ mental tostr 3 rj "/" target @ mmental tostr 3 lj " [" target @ mental target @ mmental statbar "]" }cat 36 lj "^WHITE^ " { "Resistance: " 14 rj target @ resistance tostr 3 rj "/" target @ mresistance tostr 3 lj "Size: " 14 rj target @ size tostr 3 rj "/" target @ msize tostr 3 lj }cat 42 lj }tell { "^CYAN^" { "Spiritual: " 11 rj target @ spiritual tostr 3 rj "/" target @ mspiritual tostr 3 lj " [" target @ spiritual target @ mspiritual statbar "]" }cat 36 lj "^WHITE^ " { "Resolve: " 14 rj target @ resolve tostr 3 rj "/" target @ mresolve tostr 3 lj "Speed: " 14 rj target @ speed tostr 3 rj "/" target @ mspeed tostr 3 lj }cat 42 lj }tell { "^YELLOW^" { "Social: " 11 rj target @ social tostr 3 rj "/" target @ msocial tostr 3 lj " [" target @ social target @ msocial statbar "]" }cat 36 lj "^WHITE^ " { "Resources: " 14 rj target @ mresources tostr 3 rj " " 4 lj "Initiative: " 14 rj target @ init tostr 3 rj "/" target @ minit tostr 3 lj }cat 42 lj }tell { { { "AP: " 11 rj target @ "AP" getstat tostr 3 rj "/" target @ aplimit tostr 3 lj " (+" target @ apgen ")" }cat 40 lj "^WHITE^ " "Growth: " 10 rj { target @ growth " (" target @ exp ")" }cat 10 lj "^CYAN^" "Actions: " 11 rj target @ minit 10.0 / toint ++ tostr 3 rj }cat }tell target @ "p/Spirit" getstat not if target @ mhealth 40.0 / toint 1 10 limit var! scale { "^BROWN^" "Health: " 11 rj target @ health tostr 3 rj "/" target @ mhealth tostr 3 lj " [" target @ health scale @ / target @ mhealth scale @ / statbar "]" }tell { "^PURPLE^" "Essence: " 11 rj target @ essence tostr 3 rj "/" target @ messence tostr 3 lj " [" target @ essence scale @ / target @ messence scale @ / statbar "]" }tell else target @ mmana 40.0 / toint 1 10 limit var! scale { "^WHITE^" "Mana: " 11 rj target @ mana tostr 3 rj "/" target @ mmana tostr 3 lj " [" target @ mana scale @ / target @ mmana scale @ / statbar "]" }tell then target @ "divine" getstat if target @ mprimal 40.0 / toint 1 10 limit var! scale { "^WHITE^" "Primal: " 11 rj target @ primal tostr 3 rj "/" target @ mprimal tostr 3 lj " [" target @ primal scale @ / target @ mprimal scale @ / statbar "]" }tell then { target @ "character_mode" getstat case 0 = when { "^BLUE^ New and uninitialized " target @ corny? " ..." }cat 78 center end 1 15 .. when target @ "disapprovedby" getstat if "^RED^" { target @ corny? " last disapproved by " target @ "disapprovedby" getstat " at " "%X" target @ "disapprovedat" getstat timefmt " on " "%C" target @ "disapprovedat" getstat timefmt }cat 78 center else "^PURPLE^" { target @ corny? " in chargen since " "%X" target @ "start_chargen" getstat timefmt " on " "%C" target @ "start_chargen" getstat timefmt }cat 78 center then end 16 255 .. when "^YELLOW^" { target @ corny? " waiting for approval since " "%X" target @ "waiting_since" getstat timefmt " on " "%C" target @ "waiting_since" getstat timefmt }cat 78 center end 256 65535 .. when "^GREEN^" { target @ corny? " last approved by " target @ "approvedby" getstat " at " "%X" target @ "approvedat" getstat timefmt " on " "%C" target @ "approvedat" getstat timefmt }cat 78 center end endcase }tell ( Do Sections ) sections @ foreach pop target @ swap doSection repeat ( Do Footer ) { "FFa2RPS Sheet" }cat footer tellme ; PUBLIC main