@program $lib/rps 1 10000 d i $pubdef : $include $lib/rp $include $lib/alynna $include $muf/cron lvar param lvar itype lvar iname ( std-defines ) $def RPSYS "$rpsystem" match $def DEBUGMODE RPSYS "MOBILE" flag? $def TRUE 1 $def YES 1 $def FALSE 0 $def NO 0 ( MUCK defines ) $ifdef __muckname=FF:DA $def FORCEWIZ #390 $def GP_INTEGER 1 $def CURRENCY "Gil" $def gil gp $pubdef gil gp $def adjustgil adjustgp $pubdef adjustgil adjustgp $endif $ifdef __muckname=Metamorphosis $def FORCEWIZ #21 $def CANTRIPS 1 $def CURRENCY "GP" $def ALWAYS_EMPLOYED 1 $def INSERVER_WIZCHAT 1 $endif $libdef nd10 : nd10[ int:n -- int:result ] n @ 10 ndx ; : ADDITEM[ str:string -- str:result ] string @ ", " swap strcat strcat ; : rpinfo-chopper[ str:string -- str:result ] string @ dup "/" instr 1 = if 1 strcut swap pop then dup "/" rinstr over strlen = if dup "/" rinstr 1 - strcut pop then ; : l[ str:string int:chars -- str:result ] string @ chars @ swap dup not if pop "" then tostr swap lj ; : r[ str:string int:chars -- str:result ] string @ chars @ swap dup not if pop "" then tostr swap rj ; : l0[ str:string int:chars -- str:result ] string @ chars @ swap dup not if pop "0" then tostr swap lj ; : r0[ str:string int:chars -- str:result ] string @ chars @ swap dup not if pop "0" then tostr swap rj ; : neg[ num:value -- num:result ] value @ 0 swap - ; : votes2cp[ num:value -- num:result ] value @ toint dup 5 / 5 * swap 5 % 2.0 / + ; : stou[ str:string -- str:result ] string @ "_" " " subst ; : utos[ str:string -- str:result ] string @ " " "_" subst ; : ayb RPSYS { "/" itype @ "/" iname @ "/" } array_make "" array_join ; : smatch_array[ str:string -- str:result ] string @ ", " explode_array "|" array_join "{" swap "}" strcat strcat ; : eTYPE me @ "_prefs/fmlrps/entry-type" getprop dup string? not if pop "" then ; : eNAME me @ "_prefs/fmlrps/entry-name" getprop dup string? not if pop "" then ; : eTARGET "/" etype "/" ename "/" strcat strcat strcat strcat ; : tm[ str:string ] string @ dup "FMLRPS" pretty tellme DEBUGMODE not if pop else FORCEWIZ { "wi : " }cat rot strcat force then ; : th[ str:string ] string @ dup "FMLRPS" pretty tellhere DEBUGMODE not if pop else FORCEWIZ { "wi : " }cat rot strcat force then ; : maxstrlen[ arr:strings -- int:result ] var item var value 0 var! result strings @ foreach value ! item ! value @ strlen result @ > if value @ strlen result ! then repeat result @ ; : dbg[ int:items -- ] var itemarr DEBUGMODE if { } array_make itemarr ! 1 items @ 1 for pick itemarr @ array_vals ++ array_make itemarr ! repeat FORCEWIZ { "wi Items found on stack: " itemarr @ "; " array_join }cat force then ; $libdef find-prop-in $pubdef find-prop "" find-prop-in $pubdef find-nameprop "/name" strcat "" find-prop-in pop "" "/name" subst $pubdef find-nameprop-in swap "/name" strcat swap find-prop-in pop "" "/name" subst $def find-prop "" find-prop-in $def find-nameprop "/name" strcat "" find-prop-in pop "" "/name" subst $def find-nameprop-in swap "/name" strcat swap find-prop-in pop "" "/name" subst : find-prop-in[ str:search str:section -- s x ] var item var value var value2 RPSYS { section @ "/" search @ }cat getprop if { section @ "/" search @ }cat RPSYS over getprop exit then RPSYS section @ "/" strcat array_get_propdirs foreach value ! pop RPSYS { section @ "/" value @ "/" search @ }cat getprop if { section @ "/" value @ "/" search @ }cat RPSYS over getprop exit then RPSYS { section @ "/" value @ "/" }cat array_get_propdirs foreach value2 ! pop RPSYS { section @ "/" value @ "/" value2 @ "/" search @ }cat getprop if { section @ "/" value @ "/" value2 @ "/" search @ }cat RPSYS over getprop exit then repeat repeat "" 0 ; PUBLIC find-prop-in $libdef find-propdir-in $pubdef find-propdir "" find-propdir-in $def find-propdir "" find-propdir-in : find-propdir-in[ str:search str:section -- s ] var item var value var value2 RPSYS { section @ "/" search @ "/" }cat propdir? if { section @ "/" search @ capitalize }cat exit then RPSYS { section @ "/" }cat array_get_propdirs foreach value ! pop RPSYS { section @ "/" value @ "/" search @ "/" }cat propdir? if { section @ "/" value @ capitalize "/" search @ capitalize }cat exit then RPSYS { section @ "/" value @ "/" }cat array_get_propdirs foreach value2 ! pop RPSYS { section @ "/" value @ "/" value2 @ "/" search @ "/" }cat propdir? if { section @ "/" value @ capitalize "/" value2 @ capitalize "/" search @ capitalize }cat exit then repeat repeat "" ; PUBLIC find-propdir-in $libdef find-stat : find-stat[ dbref:target dbref:search -- s ? ] var item var value var value2 target @ search @ getstat if search @ target @ search @ getstat exit then target @ "/@rp/" array_get_propdirs foreach value ! pop target @ { value @ "/" search @ }cat getstat if { value @ "/" search @ }cat target @ over getstat exit then RPSYS { "/@rp/" value @ "/" }cat array_get_propdirs foreach value2 ! pop target @ { value @ "/" value2 @ "/" search @ }cat getstat if { value @ "/" value2 @ "/" search @ }cat target @ over getstat exit then repeat repeat "" 0 ; PUBLIC find-stat : showindex var count var linestore var item var function var idxperline var itemsize param @ function ! ( dump an index ) { "RPinfo item type: " function @ }cat header tellme -1 count ! "" linestore ! RPSYS function @ array_get_propdirs maxstrlen case 10 <= when 7 11 end 12 <= when 6 13 end 14 <= when 5 15 end 18 <= when 4 19 end 25 <= when 3 26 end default 2 39 end endcase itemsize ! idxperline ! RPSYS function @ array_get_propdirs foreach item ! item @ "_*" smatch not if count @ 1 + count ! linestore @ { RPSYS function @ "/" item @ strcat strcat array_get_propdirs array_count if "^CYAN^" else "^YELLOW^" then item @ tostr capitalize itemsize @ lj "^NORMAL^" }cat strcat linestore ! count @ idxperline @ % idxperline @ -- = if linestore @ tellme "" linestore ! then then repeat count @ idxperline @ % idxperline @ -- < if linestore @ tellme "" linestore ! then { "FMLRPS RPinfo v1.0 by Alynna" }cat footer tellme ; : rpinfo var item var value var value2 var count var linestore var function var propdirmatch var section var idxperline var itemsize param ! command @ "+rpinfo" smatch if "" section ! else { command @ "" "+" subst }cat section ! then param @ not if section @ not if "/" param ! showindex exit else section @ param ! showindex exit then then "" itype ! "" iname ! param @ section @ find-nameprop-in dup if rpinfo-chopper "/" split iname ! itype ! else pop param @ section @ find-propdir-in dup if rpinfo-chopper param ! showindex exit else "Couldn't find that item." "RPinfo" pretty tellme exit then then { iname @ capitalize " (" itype @ capitalize ")" }cat header tellme ayb "desc" strcat getpropstr wrap74 atellme { "Other information" }cat header tellme ayb array_get_propvals foreach value ! item ! item @ "_*" smatch not item @ "{desc|name}" smatch not and if { "^YELLOW^" item @ capitalize 16 lj "^GREEN^" value @ }cat tellme then repeat ayb array_get_propdirs array_count 0 > if "Subitems" header tellme param @ function ! -1 count ! "" linestore ! ayb array_get_propdirs maxstrlen case 10 <= when 7 11 end 12 <= when 6 13 end 14 <= when 5 15 end 18 <= when 4 19 end 25 <= when 3 26 end default 2 39 end endcase itemsize ! idxperline ! ayb array_get_propdirs foreach item ! item @ "_*" smatch not if count @ 1 + count ! linestore @ { "^GREEN^" item @ tostr capitalize itemsize @ lj "^NORMAL^" }cat strcat linestore ! count @ idxperline @ % idxperline @ -- = if linestore @ tellme "" linestore ! then then repeat count @ idxperline @ % idxperline @ -- < if linestore @ tellme "" linestore ! then then { "FMLRPS RPinfo v1.0 by Alynna" }cat footer tellme ; : entry var item var value param ! command @ tolower case ".type" smatch when me @ "_prefs/fmlrps/entry-type" param @ setprop { "Target:^YELLOW^ " eTARGET "^NORMAL^" }cat "Data" pretty tellhere end ".name" smatch when me @ "_prefs/fmlrps/entry-name" param @ setprop RPSYS eTARGET "name" strcat param @ dup "/" instr if "/" rsplit swap pop then setprop { "Target:^YELLOW^ " eTARGET "^NORMAL^, name prop set" }cat "Data" pretty tellhere end ".desc" smatch when param @ value ! RPSYS eTARGET "desc" strcat value @ setprop { "^GREEN^Property set, ^YELLOW^" eTARGET "desc:^CYAN^" value @ }cat "Data" pretty tellhere end ".set" smatch when param @ " " split value ! item ! RPSYS eTARGET item @ strcat value @ setprop { "^GREEN^Property set, ^YELLOW^" eTARGET item @ ":^CYAN^" value @ }cat "Data" pretty tellhere end endcase ; ( "Current Class, Previous Classes, Essence, CP, CP Spent, Body (C/T), Mind (C/T), Spirit (C/T), Body HP (C/T), Mind HP (C/T), Spirit HP (C/T), Skills (and Rank), Abilities (and Rank), Gil, Expenses, Gear (and Rank)" ) $libdef rpstat : rpstat ( s -- x ) var dir var item dir ! RPSYS "/" array_get_propdirs foreach item ! pop RPSYS { "/" item @ "/" dir @ }cat getprop dup if exit else pop then repeat 0 ; PUBLIC rpstat : fc[ str:string str:color -- s ] string @ { "[^" color @ "^" }cat "[" subst "^NORMAL^]" "]" subst ; $libdef valid? : valid?[ dbref:target ] target @ "valid" getstatstr "yes" smatch ; PUBLIC valid? $libdef employed? : employed?[ dbref:target ] $ifdef ALWAYS_EMPLOYED TRUE $else target @ "employed" getstatstr "y*" smatch $endif ; PUBLIC employed? $libdef body : body[ dbref:target ] target @ "body" getstat toint ; PUBLIC body $libdef mind : mind[ dbref:target ] target @ "mind" getstat toint ; PUBLIC mind $libdef spirit : spirit[ dbref:target ] target @ "spirit" getstat toint ; PUBLIC spirit $libdef btop : btop[ dbref:target ] target @ "bmax" getstat toint ; PUBLIC btop $libdef mtop : mtop[ dbref:target ] target @ "mmax" getstat toint ; PUBLIC mtop $libdef stop : stop[ dbref:target ] target @ "smax" getstat toint ; PUBLIC stop $libdef bmax : bmax[ dbref:target ] target @ btop target @ "ability/defence" getstat toint 3 + * ; PUBLIC bmax $libdef mmax : mmax[ dbref:target ] target @ mtop target @ "ability/defence" getstat toint 3 + * ; PUBLIC mmax $libdef smax : smax[ dbref:target ] target @ stop target @ "ability/defence" getstat toint 3 + * ; PUBLIC smax $libdef bhp : bhp[ dbref:target ] target @ "bhp" getstat toint target @ "bhp" getstat toint target @ "ability/defence" getstat toint 3 + / target @ "body" rot 1 + target @ "bhp" getstat toint not if pop 0 then 0 target @ btop limit toint setstat ; PUBLIC bhp $libdef mhp : mhp[ dbref:target ] target @ "mhp" getstat toint target @ "mhp" getstat toint target @ "ability/defence" getstat toint 3 + / target @ "mind" rot 1 + target @ "mhp" getstat toint not if pop 0 then 0 target @ mtop limit toint setstat ; PUBLIC mhp $libdef shp : shp[ dbref:target ] target @ "shp" getstat toint target @ "shp" getstat toint target @ "ability/defence" getstat toint 3 + / target @ "spirit" rot 1 + target @ "shp" getstat toint not if pop 0 then 0 target @ stop limit toint setstat ; PUBLIC shp $libdef essence : essence[ dbref:target ] target @ "essence" getstat toint ; PUBLIC essence $libdef cp : cp[ dbref:target ] target @ "cp" getstat tofloat ; PUBLIC cp $libdef cpspent : cpspent[ dbref:target ] target @ "cpspent" getstat tofloat ; PUBLIC cpspent $libdef cpavail : cpavail[ dbref:target ] target @ cp target @ cpspent - ; PUBLIC cpavail $libdef adjustcp : adjustcp[ dbref:target value ] target @ "cpspent" over over getstat tofloat value @ tofloat + setstat ; PUBLIC adjustcp $libdef gp $libdef adjustgp $libdef expenses $ifdef GP_INTEGER : gp[ dbref:target ] target @ "gp" getstat tofloat 0 round ; PUBLIC gp : adjustgp[ dbref:target value ] target @ "gp" over over getstat toint value @ + setstat ; PUBLIC adjustgp : expenses[ dbref:target ] target @ "expenses" getstat tofloat 0 round ; PUBLIC expenses $else : gp[ dbref:target ] target @ "gp" getstat tofloat ; PUBLIC gp : adjustgp[ dbref:target value ] target @ "gp" over over getstat tofloat value @ + setstat ; PUBLIC adjustgp : expenses[ dbref:target ] target @ "expenses" getstat tofloat ; PUBLIC expenses $endif $libdef class : class[ dbref:target ] target @ "class" getstat tostr ; PUBLIC class $libdef prevclasses : prevclasses[ dbref:target ] target @ "prevclasses" getstat tostr ; PUBLIC prevclasses $libdef income : income[ dbref:target -- i ] var item var value 0.0 var! total target @ "/@rp/resource/" array_get_propvals foreach value ! item ! target @ employed? if target @ { "resource/" item @ "/type" }cat getstat tostr "income" smatch if total @ value @ tofloat + total ! then then target @ { "resource/" item @ "/type" }cat getstat tostr "income" smatch not if total @ value @ tofloat + total ! then repeat total @ ; PUBLIC income $libdef essmax : essmax[ dbref:target -- i ] target @ "bmax" getstat toint target @ "mmax" getstat toint + target @ "smax" getstat toint + ; PUBLIC essmax : nstatbar[ int:cur int:max -- s ] { "[" cur @ if 1 cur @ toint 1 for pop "*" repeat then max @ if 1 max @ toint cur @ toint - 1 for pop " " repeat then "]" }cat ; : abilityhandler[ dbref:target str:item str:item2 value2 ] item @ case "break" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/" item2 @ "/focus" }cat getstat 30 l "|" }cat tellme end "sorcery" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/" item2 @ "/focus" }cat getstat 30 l "|" }cat tellme end $ifdef cantrips "cantrip" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/" item2 @ "/focus" }cat getstat 30 l "|" }cat tellme end "monsterous" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/" item2 @ "/focus" }cat getstat 30 l "|" }cat tellme end $endif "equip" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/" item2 @ "/focus" }cat getstat 30 l "|" }cat tellme end "dark sword" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Difficulty:" { item @ "/" item2 @ "/difficulty" }cat rpstat }cat 31 l "|" }cat tellme end "sing" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Difficulty:" { item @ "/" item2 @ "/difficulty" }cat rpstat " Actions:" { item @ "/" item2 @ "/actions" }cat rpstat }cat 31 l "|" }cat tellme end "alchemy" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Difficulty:" { item @ "/" item2 @ "/difficulty" }cat rpstat " Required:" { item @ "/" item2 @ "/required" }cat rpstat }cat 31 l "|" }cat tellme end "craft" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/" item2 @ "/focus" }cat getstat 31 l "|" }cat tellme end "draw out" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Area:" { item @ "/" item2 @ "/area" }cat rpstat " Rating:" { item @ "/" item2 @ "/actions" }cat rpstat }cat 31 l "|" }cat tellme end "magic sword" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Area:" { item @ "/" item2 @ "/essence" }cat rpstat " Rating:" { item @ "/" item2 @ "/rating" }cat rpstat }cat 31 l "|" }cat tellme end "guts" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Essence:" { item @ "/" item2 @ "/essence" }cat rpstat }cat 31 l "|" }cat tellme end "holy sword" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Area:" { item @ "/" item2 @ "/essence" }cat rpstat " Rating:" { item @ "/" item2 @ "/rating" }cat rpstat }cat 31 l "|" }cat tellme end "talk" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/" item2 @ "/focus" }cat getstat 31 l "|" }cat tellme end "punch art" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Difficulty:" { item @ "/" item2 @ "/difficulty" }cat rpstat }cat 31 l "|" }cat tellme end "blitz" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Difficulty:" { item @ "/" item2 @ "/difficulty" }cat rpstat }cat 31 l "|" }cat tellme end "sword technique" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Difficulty:" { item @ "/" item2 @ "/difficulty" }cat rpstat }cat 31 l "|" }cat tellme end "dance" smatch when { "|`-" item2 @ capitalize 28 l "|" value2 @ 1 l "|" { item @ "/" item2 @ "/type" }cat rpstat 12 l { "| Actions:" { item @ "/" item2 @ "/actions" }cat rpstat " Cost:" { item @ "/" item2 @ "/cost" }cat rpstat " Difficulty:" { item @ "/" item2 @ "/difficulty" }cat rpstat }cat 31 l "|" }cat tellme end endcase ; : sh-header[ dbref:target -- ] { "| Class: [" target @ class 27 l "] Attr RK HP" "YELLOW" fc }cat 66 lj { "Valid: " target @ valid? if "^GREEN^Yes^NORMAL^" else "^RED^No ^NORMAL^" then }cat " |" strcat strcat tellme { { "| Essence: " target @ essence 2 r0 "/" target @ essmax 2 l0 " " target @ essence target @ essmax nstatbar }cat 38 l "GRAY" fc " " "^RED^Body " target @ body 1 r0 "/" target @ btop 1 l0 " " target @ bhp 2 r0 "/" target @ bmax 2 l0 target @ bhp 1 17 limit target @ bmax 1 17 limit nstatbar "^NORMAL^" }cat 77 l "|" strcat tellme { { "| CP: [" target @ cpavail ftostrc "/" target @ cp "] " }cat 20 l "CYAN" fc { CURRENCY ": [" target @ gp 3 round ftostrc "] " }cat 18 l "YELLOW" fc " " "^GREEN^Mind " target @ mind 1 r0 "/" target @ mtop 1 l0 " " target @ mhp 2 r0 "/" target @ mmax 2 l0 target @ mhp 1 17 limit target @ mmax 1 17 limit nstatbar "^NORMAL^" }cat 77 l "|" strcat tellme { { "| Income: [" target @ income 3 round ftostrc "]" }cat 25 lj "GREEN" fc " " { "Job? [" target @ employed? if "^GREEN^Yes^NORMAL^] " else "^RED^No ^NORMAL^] " then }cat "^BLUE^Spirit " target @ spirit 1 r0 "/" target @ stop 1 l0 " " target @ shp 2 r0 "/" target @ smax 2 l0 target @ shp 1 17 limit target @ smax 1 17 limit nstatbar "^NORMAL^" }cat 77 l "|" strcat tellme { "| Previous Classes: [^YELLOW^" target @ prevclasses "^NORMAL^]" }cat 77 l "|" strcat tellme ; : sheet var target var item var value var item2 var value2 var focus param @ not if me @ target ! else param @ resolve target ! then target @ int 0 < if { "Unresolvable or ambiguous reference." }cat "FMLRPS" pretty tellme exit then ( Sheet header ) { target @ me @ "W" flag? if unparseobj else name then }cat header tellme target @ sh-header me @ "W" flag? me @ target @ controls me @ target @ dbcmp or or if target @ "@rp/skill" propdir? if "Skills" header tellme "|^UNDERLINE^Skill |R|Dice|Focii ^NORMAL^|" tellme target @ "@rp/skill" array_get_propvals foreach value ! item ! { "|" item @ capitalize 20 l "|" value @ 1 l "|" value @ 1 l "d10" "|" target @ { "skill/" item @ "/focus" }cat getstat 48 l "|" }cat tellme repeat then target @ "@rp/ability" propdir? if "Abilities" header tellme "|^UNDERLINE^Ability |R|Type | ^NORMAL^|" tellme target @ "@rp/ability" array_get_propvals foreach value ! item ! { "|" item @ capitalize 30 l "|" value @ 1 l "|" { item @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/focus" }cat getstat 30 l "|" }cat tellme target @ { "@rp/ability/" item @ "/" }cat array_get_propvals "focus" array_delitem focus ! focus @ array_count if focus @ foreach value2 ! item2 ! target @ item @ item2 @ value2 @ abilityhandler repeat then repeat target @ "@rp/ability" array_get_propdirs foreach dup value ! item ! pop target @ "@rp/ability/" value @ strcat getprop not if { "|" value @ capitalize 30 l "|+" "|" { item @ "/type" }cat rpstat 12 l "|" target @ { "ability/" item @ "/focus" }cat getstat 30 l "|" }cat tellme target @ { "@rp/ability/" item @ "/" }cat array_get_propvals "focus" array_delitem focus ! focus @ array_count if focus @ foreach value2 ! item2 ! target @ item @ item2 @ value2 @ abilityhandler repeat then then repeat then target @ "@rp/spell" propdir? if "Spell" header tellme "|^UNDERLINE^Spell |R|T|A|Type |Area |Target ^NORMAL^|" tellme target @ "@rp/spell" array_get_propvals foreach value ! item ! { "|" item @ capitalize 20 l "|" value @ 1 l "|" { item @ "/casting time" }cat rpstat 1 l "|" { item @ "/rating" }cat rpstat 1 l "|" { item @ "/type" }cat rpstat 12 l "|" { item @ "/area" }cat rpstat 12 l "|" { item @ "/target" }cat rpstat 23 l "|" }cat tellme repeat then target @ "@rp/item" propdir? if "Items" header tellme "|^UNDERLINE^Item |Q|Qty|Desc ^NORMAL^|" tellme target @ "@rp/item/" array_get_propdirs foreach item ! pop target @ { "@rp/item/" item @ "/" }cat array_get_propvals foreach value ! item2 ! { "|" item @ capitalize 20 l "|" item2 @ 1 l "|" value @ 3 l "|" { item @ "/desc" }cat "items" find-prop-in swap pop 49 l "|" }cat tellme repeat repeat then target @ "@rp/gear" propdir? if "Equipment" header tellme "|^UNDERLINE^Equipment |Qty|DV|Type |Stats ^NORMAL^|" tellme target @ "@rp/gear" array_get_propvals foreach value ! item ! { "|" item @ capitalize 20 l "|" value @ 3 l "|" { item @ "/DV" }cat "equipment" find-prop-in swap pop 2 l "|" { item @ "/type" }cat "equipment" find-prop-in swap pop 10 l "|" { { RPSYS item @ find-propdir array_get_propvals foreach value2 ! item2 ! item2 @ "{DV|type|name|cost}" smatch not if item2 @ ":" value2 @ strcat strcat then repeat } array_make " " array_join }cat 37 l "|" }cat tellme repeat then target @ "@rp/resource" propdir? if "Resources" header tellme "|^UNDERLINE^Resources |Value |Type |Debt |To | ^NORMAL^|" tellme target @ "@rp/resource" array_get_propvals foreach value ! item ! { "|" item @ capitalize 20 l "|" value @ $ifdef GP_INTEGER tofloat 0 round $else 2 fchop $endif 10 r "|" target @ { "resource/" item @ "/type" }cat getstat 12 l "|" target @ { "resource/" item @ "/debt" }cat getstat 10 l "|" target @ { "resource/" item @ "/to" }cat getstat dup dbref? if name else pop "" then 12 l "| |" }cat tellme repeat then then "FMLRPS 2.0 sheet by Alynna" footer tellme ; : ssheet var target var item var value var item2 var value2 var focus var flip param @ not if me @ target ! else param @ resolve target ! then target @ int 0 < if { "Unresolvable or ambiguous reference." }cat "FMLRPS" pretty tellme exit then ( Sheet header ) { target @ me @ "W" flag? if unparseobj else name then }cat header tellme target @ sh-header me @ "W" flag? me @ target @ controls me @ target @ dbcmp or or if ( -- Skills -- ) 0 flip ! target @ "@rp/skill" propdir? if "Skills" header tellme target @ "@rp/skill" array_get_propvals foreach value ! item ! { "^GREEN^" item @ capitalize 34 l "^CYAN^[^YELLOW^" value @ tostr 1 l "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then repeat flip @ 2 % if "|" swap 76 l "|" strcat strcat tellme then then ( -- Abilities -- ) 0 flip ! target @ "@rp/ability" propdir? if "Abilities" header tellme target @ "@rp/ability" array_get_propvals foreach value ! item ! { "^GREEN^" item @ capitalize 34 l "^CYAN^[^YELLOW^" value @ tostr 1 l "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then target @ { "@rp/ability/" item @ "/" }cat array_get_propvals "focus" array_delitem focus ! focus @ array_count if focus @ foreach value2 ! item2 ! { "^GREEN^" item @ capitalize "/" item2 @ capitalize strcat strcat 34 l "^CYAN^[^YELLOW^" value2 @ tostr 1 l "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then repeat then repeat target @ "@rp/ability" array_get_propdirs foreach dup value ! item ! pop target @ "@rp/ability/" value @ strcat getprop not if dup string? if { swap else { then { "^GREEN^" item @ capitalize 34 l "^CYAN^[^YELLOW^" value @ tostr 1 l "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then target @ { "@rp/ability/" item @ "/" }cat array_get_propvals "focus" array_delitem focus ! focus @ array_count if focus @ foreach value2 ! item2 ! { "^GREEN^" item @ capitalize "/" item2 @ capitalize strcat strcat 34 l "^CYAN^[^YELLOW^" value2 @ tostr 1 l "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then repeat then then repeat flip @ 2 % if "|" swap 76 l "^NORMAL^|" strcat strcat tellme then then ( -- Spells -- ) 0 flip ! target @ "@rp/spell" propdir? if "Spells" header tellme target @ "@rp/spell" array_get_propvals foreach value ! item ! { "^GREEN^" item @ capitalize 30 l "^PURPLE^" { item @ "/casting time" }cat rpstat 1 r " " "^PURPLE^" { item @ "/rating" }cat rpstat 1 r " " "^CYAN^[^YELLOW^" value @ tostr 1 l "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then repeat flip @ 2 % if "|" swap 76 l "^NORMAL^|" strcat strcat tellme then then ( -- Item -- ) 0 flip ! target @ "@rp/item" propdir? if "Items" header tellme target @ "@rp/item/" array_get_propdirs foreach item ! pop target @ { "@rp/item/" item @ "/" }cat array_get_propvals foreach value ! item2 ! { "^GREEN^" item @ capitalize 30 l "^PURPLE^" item2 @ tostr 1 r " " "^CYAN^[^YELLOW^" value @ tostr 3 r "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then repeat repeat flip @ 2 % if "|" swap 76 l "^NORMAL^|" strcat strcat tellme then then ( -- Equipment -- ) 0 flip ! target @ "@rp/gear" propdir? if "Equipment" header tellme target @ "@rp/gear" array_get_propvals foreach value ! item ! { "^GREEN^" item @ capitalize 30 l "^PURPLE^" { item @ "/DV" }cat "equipment" find-prop-in swap pop 2 r " " "^CYAN^[^YELLOW^" value @ tostr 2 r "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then repeat flip @ 2 % if "|" swap 76 l "^NORMAL^|" strcat strcat tellme then then ( -- Resources -- ) 0 flip ! target @ "@rp/resource" propdir? if "Resources" header tellme target @ "@rp/resource" array_get_propvals foreach value ! item ! { "^GREEN^" item @ capitalize 30 l "^CYAN^[^YELLOW^" value @ tostr 5 r "^CYAN^]^NORMAL^ " }cat flip ++ flip @ 2 % not if strcat 76 l "|" swap "^NORMAL^|" strcat strcat tellme then repeat flip @ 2 % if "|" swap 76 l "^NORMAL^|" strcat strcat tellme then then then "'lsheet' to see long, detailed sheet" footer tellme ; : init param @ "{body|mind|spirit}" smatch not if "use +init {body|mind|spirit}" "FMLRPS" pretty tellme exit then FORCEWIZ { "@set #" me @ int "=/@rp:" }cat force FORCEWIZ { "wi " me @ " just cleared their sheet using " command @ " " param @ "." }cat force me @ "cp" 100.0 setstat "Sheet cleared, 100cp given." "FMLRPS" pretty tellme me @ "bmax" 2 setstat me @ "mmax" 2 setstat me @ "smax" 2 setstat me @ param @ 1 strcut pop "max" strcat over over getstat ++ setstat me @ "bhp" me @ bmax setstat me @ "mhp" me @ mmax setstat me @ "shp" me @ smax setstat me @ "body" me @ btop setstat me @ "mind" me @ mtop setstat me @ "spirit" me @ stop setstat "First time init of body, mind and spirit set to MAX." tm me @ "essence" me @ essmax setstat "First time init essence set to MAX." tm me @ "gp" 500 setstat "" param ! sheet "Giving you 500GP and sending you on your way. Choose a class next." tm ; : buyattr var value var cost param @ "{body|mind|spirit}" smatch not if { command @ " " }cat tm exit then me @ param @ 1 strcut pop "max" strcat getstat ++ value ! value @ 6 > if { param @ capitalize " is at max." }cat tm exit then me @ { "rank/" value @ "/attr-cost" }cat rpstat tofloat cost ! cost @ me @ cpavail > if { "Insufficient CP, you have " me @ cpavail ", you need " cost @ "." }cat tm exit then me @ param @ 1 strcut pop "max" strcat over over getstat ++ setstat me @ cost @ adjustcp param @ case "body" smatch when me @ "bhp" me @ bmax setstat end "mind" smatch when me @ "mhp" me @ mmax setstat end "spirit" smatch when me @ "shp" me @ smax setstat end endcase { param @ capitalize " raised to " me @ param @ getstat " for " cost @ "cp, " me @ cpavail "cp remaining." }cat tm ; : buyclass ( -- ) var item var value var tmp var cost var bonus var got-tshirt var mad-skillz RPSYS { "class/" param @ "/name" }cat getprop not if { "'" param @ capitalize "' is not a valid class." }cat tm exit then { param @ "/cost" }cat rpstat tofloat cost ! { param @ "/preferred" }cat rpstat tmp ! tmp @ not if "None" tmp ! then { param @ "/type" }cat rpstat dup not if pop "Standard" then case "standard" smatch when ( not preffered class gets cost * 2 ) 2 mad-skillz ! tmp @ "None" smatch if 1 mad-skillz ! then tmp @ not if 1 mad-skillz ! then me @ prevclasses ", " explode_array foreach swap pop stou tmp @ smatch_array stou smatch if 1 mad-skillz ! then repeat me @ class stou tmp @ smatch_array stou smatch if 1 mad-skillz ! then cost @ mad-skillz @ * cost ! end ( Reduced cost per preferred class ) "Mixed" smatch when { param @ "/bonus" }cat rpstat tofloat bonus ! me @ prevclasses ", " explode_array foreach swap pop stou tmp @ smatch_array stou smatch if cost @ bonus @ + cost ! then repeat me @ class stou tmp @ smatch_array stou smatch if cost @ bonus @ + cost ! then end ( Requires preferred class ) "Special" smatch when inf cost ! me @ prevclasses ", " explode_array foreach swap pop stou tmp @ smatch_array stou smatch if { param @ "/cost" }cat rpstat tofloat cost ! then repeat me @ class stou tmp @ smatch_array stou smatch if { param @ "/cost" }cat rpstat tofloat cost ! then cost @ inf = if "You do not have one of the required classes." tm exit then end endcase cost @ me @ cpavail > if { "Insufficient CP, you have " me @ cpavail ", you need " cost @ "." }cat tm exit then me @ param @ over over getstat ++ setstat me @ cost @ adjustcp { param @ capitalize " class bought, for " cost @ "cp, " me @ cpavail "cp remaining." }cat tm ( preffered class doesnt get skills again ) 0 got-tshirt ! param @ me @ prevclasses smatch_array smatch if 1 got-tshirt ! then ( Hand out abilities ) got-tshirt @ not if { param @ "/abilities" }cat rpstat ", " explode_array foreach item ! pop me @ { "ability/" item @ }cat over over getstat ++ 1 6 limit setstat { "Ability (" item @ ") was increased to " me @ { "ability/" item @ }cat getstat }cat tm repeat then me @ "resource/" param @ strcat over over getstat { param @ "/income" }cat rpstat tofloat + setstat me @ { "resource/" param @ "/type" }cat "Income" setstat { "Your resources rose by " { param @ "/income" }cat rpstat "." }cat tm me @ "class" getstat if me @ "prevclasses" getstat dup if ", " strcat else pop "" then me @ "class" getstat strcat me @ "prevclasses" rot setstat then me @ "class" param @ capitalize setstat ; : ability-exceptions[ str:ability -- str:ability ] ability @ "alchemy/*" smatch if "Alchemy" ability ! then ability @ "cantrip/*" smatch if "Cantrip" ability ! then ability @ "blitz/*" smatch if "Blitz" ability ! then ability @ "break/*" smatch if "Break" ability ! then ability @ "dance/*" smatch if "Dance" ability ! then ability @ "dark sword/*" smatch if "Dark Sword" ability ! then ability @ "draw out/*" smatch if "Draw Out" ability ! then ability @ "holy sword/*" smatch if "Holy Sword" ability ! then ability @ "magic sword/*" smatch if "Magic Sword" ability ! then ability @ "punch art/*" smatch if "Punch Art" ability ! then ability @ "sing/*" smatch if "Sing" ability ! then ability @ "talk/*" smatch if "Talk" ability ! then ability @ "sword technique/*" smatch if "Sword Technique" ability ! then ability @ ; $libdef abilitycost : abilitycost[ dbref:target str:ability -- float:cost ] var cost var tshirt var tmp RPSYS { "ability/" ability @ "/name" }cat getprop not if 0.0 exit then 5 cost ! { ability @ "/cost" }cat rpstat tofloat dup if cost ! else pop then ability @ ability-exceptions ability ! "trained" tshirt ! target @ prevclasses ", " explode_array foreach tmp ! pop ability @ stou { tmp @ "/abilities" }cat rpstat tostr smatch_array stou smatch if "outclass" tshirt ! then repeat ability @ stou { target @ class "/abilities" }cat rpstat tostr smatch_array stou smatch if "inclass" tshirt ! then tshirt @ case "inclass" smatch when cost @ 1 * cost ! end "outclass" smatch when cost @ 2 * cost ! end "trained" smatch when cost @ 3 * cost ! end endcase cost @ ; PUBLIC abilitycost $libdef abilityaccost : abilityaccost[ dbref:target str:ability -- str:accost ] var cost var tshirt var tmp RPSYS { "ability/" ability @ "/name" }cat getprop not if "Not an ability" exit then ability @ ability-exceptions ability ! "trained" tshirt ! target @ prevclasses ", " explode_array foreach tmp ! pop ability @ stou { tmp @ "/abilities" }cat rpstat tostr smatch_array stou smatch if "outclass" tshirt ! then repeat ability @ stou { target @ class "/abilities" }cat rpstat tostr smatch_array stou smatch if "inclass" tshirt ! then tshirt @ case "inclass" smatch when "in your class (x1)" end "outclass" smatch when "out of your class (x2)" end "trained" smatch when "trained (x3)" end endcase ; PUBLIC abilityaccost : buyability var item var value var tmp var cost var got-tshirt RPSYS { "ability/" param @ "/name" }cat getprop not if { "'" param @ capitalize "' is not a valid ability." }cat tm exit then me @ param @ abilitycost cost ! cost @ me @ cpavail > if { "Insufficient CP, you have " me @ cpavail ", you need " cost @ "." }cat tm exit then me @ { "ability/" param @ }cat getstat toint 6 >= if { "Your ability (" param @ capitalize ") is already at MAX." }cat tm exit then me @ { "ability/" param @ }cat over over getstat ++ 1 6 limit setstat me @ cost @ adjustcp { param @ capitalize " raised to " me @ "ability/" param @ strcat getstat " for " cost @ "cp, " me @ cpavail "cp remaining." " Ability was " me @ param @ abilityaccost "." }cat tm ; $libdef spellcost : spellcost[ dbref:target str:ability -- float:cost ] var cost var tshirt var tmp RPSYS { "spell/" ability @ "/name" }cat getprop not if 0.0 exit then 5 cost ! { ability @ "/cost" }cat rpstat tofloat dup if cost ! else pop then "trained" tshirt ! target @ prevclasses ", " explode_array foreach tmp ! pop { "sorcery/" { ability @ "/type" }cat rpstat }cat stou { tmp @ "/abilities" }cat rpstat tostr smatch_array stou smatch if "outclass" tshirt ! then repeat { "sorcery/" { ability @ "/type" }cat rpstat }cat stou { target @ class "/abilities" }cat rpstat tostr smatch_array stou smatch if "inclass" tshirt ! then tshirt @ case "inclass" smatch when cost @ 1 * cost ! end "outclass" smatch when cost @ 2 * cost ! end "trained" smatch when cost @ 3 * cost ! end endcase cost @ ; PUBLIC spellcost $libdef spellaccost : spellaccost[ dbref:target str:ability -- str:accost ] var cost var tshirt var tmp RPSYS { "spell/" ability @ "/name" }cat getprop not if "Not an ability" exit then "trained" tshirt ! target @ prevclasses ", " explode_array foreach tmp ! pop { "sorcery/" { ability @ "/type" }cat rpstat }cat stou { tmp @ "/abilities" }cat rpstat tostr smatch_array stou smatch if "outclass" tshirt ! then repeat { "sorcery/" { ability @ "/type" }cat rpstat }cat stou { target @ class "/abilities" }cat rpstat tostr smatch_array stou smatch if "inclass" tshirt ! then tshirt @ case "inclass" smatch when "in your class (x1)" end "outclass" smatch when "out of your class (x2)" end "trained" smatch when "trained (x3)" end endcase ; PUBLIC spellaccost : buyspell var item var value var tmp var cost var got-tshirt var srcrating var dstrating var type RPSYS { "spell/" param @ "/name" }cat getprop not if { "'" param @ capitalize "' is not a valid spell." }cat tm exit then me @ param @ spellcost cost ! cost @ me @ cpavail > if { "Insufficient CP, you have " me @ cpavail ", you need " cost @ "." }cat tm exit then me @ { "spell/" param @ }cat getstat toint 6 >= if { "Your spell (" param @ capitalize ") is already at MAX." }cat tm exit then { param @ "/type" }cat rpstat 1 dbg type ! { param @ "/rating" }cat rpstat toint 1 dbg srcrating ! me @ { "ability/sorcery/" type @ }cat getstat toint 1 dbg dstrating ! srcrating @ dstrating @ > if { "Insufficient ranks in sorcery type " type @ ", you have " dstrating @ ", you need " srcrating @ "." }cat tm exit then me @ { "spell/" param @ }cat over over getstat ++ 1 6 limit setstat me @ cost @ adjustcp { param @ capitalize " raised to " me @ "spell/" param @ strcat getstat " for " cost @ "cp, " me @ cpavail "cp remaining." " Spell was " me @ param @ spellaccost "." }cat tm ; : freeskill me @ valid? if "No freebie adjusting while validated." tm exit then param @ "=" split toint var! amount var! skill 0 var! cnt1 0 var! cnt2 var tgt RPSYS { "skill/" skill @ "/name" }cat getprop not if { "'" skill @ capitalize "' is not a valid skill." }cat tm exit then me @ "/@rp/skill/" array_get_propdirs foreach tgt ! pop me @ { "skill/" tgt @ "/freebie" }cat getstat toint case 1 = when cnt1 ++ end 2 = when cnt2 ++ end endcase repeat amount @ 0 2 limit amount ! amount @ 1 = cnt1 @ 3 = and amount @ 2 = cnt2 @ 3 = and or if { "You already have 3 skills amounting to " amount @ "." }cat tm exit then me @ { "skill/" skill @ }cat getstat toint me @ { "skill/" skill @ "/freebie" }cat getstat toint = not if { "You cant alter this stat after you spend CP into it." }cat tm exit then me @ { "skill/" skill @ }cat amount @ setstat me @ { "skill/" skill @ "/freebie" }cat amount @ setstat { "You added " amount @ " to " skill @ " with your freebies." }cat tm 0 cnt1 ! 0 cnt2 ! me @ "/@rp/skill/" array_get_propdirs foreach tgt ! pop me @ { "skill/" tgt @ "/freebie" }cat getstat toint case 1 = when cnt1 ++ end 2 = when cnt2 ++ end endcase repeat { 3 cnt1 @ - " 1pt skills and " 3 cnt2 @ - " 2pt skills are left." }cat tm ; : buyskill param @ var! skill var subskill var cost var focii var cur RPSYS { "skill/" skill @ "/" rsplit pop "/name" }cat getprop not if { "'" skill @ capitalize "' is not a valid skill." }cat tm exit then me @ { "skill/" skill @ }cat getstat toint cur ! cur @ 6 >= if { "Your skill (" param @ capitalize ") is already at MAX." }cat tm exit then me @ { "rank/" cur @ ++ "/skill-cost" }cat rpstat tofloat cost ! skill @ "/" instr if skill @ "/" split subskill ! skill ! me @ { "skill/" skill @ "/focus" }cat getstat tostr dup "0" smatch if pop "" then focii ! focii @ if subskill @ stou focii @ smatch_array stou smatch if { "You already have (" subskill @ ") as a subskill of (" skill @ ")." }cat tm exit then 10 cost ! cost @ me @ cpavail > if { "Insufficient CP, you have " me @ cpavail ", you need " cost @ "." }cat tm exit then me @ { "skill/" skill @ "/focus" }cat over over getstat ", " subskill @ capitalize strcat strcat setstat me @ cost @ adjustcp { "'" param @ capitalize "' subskill added for " cost @ "cp, " me @ cpavail "cp remaining." }cat tm else 0 cost ! me @ { "skill/" skill @ "/focus" }cat subskill @ capitalize setstat me @ cost @ adjustcp { "'" param @ capitalize "' subskill added for " cost @ "cp, " me @ cpavail "cp remaining." }cat tm then else cost @ me @ cpavail > if { "Insufficient CP, you have " me @ cpavail ", you need " cost @ "." }cat tm exit then me @ { "skill/" skill @ }cat over over getstat ++ setstat me @ cost @ adjustcp { "'" param @ capitalize "' skill raised to " me @ { "skill/" skill @ }cat getstat " for " cost @ "cp, " me @ cpavail "cp remaining." }cat tm then ; : buyequip me @ valid? if "You're validated. Go find an IC store." tm exit then param @ not if "+buyequip " tm exit then param @ var! equip var cost var fullequip var realname { equip @ "/cost" }cat "equipment" find-prop-in tofloat cost ! "" "/cost" subst fullequip ! fullequip @ not if { "I dont have any '" equip @ capitalize "' in stock." }cat tm exit then cost @ me @ gp > if { "Put that down! You don't have enough GP! (Required: " cost @ ")" }cat tm exit then RPSYS { fullequip @ "/name" }cat getprop realname ! me @ { "gear/" realname @ }cat over over getstat ++ setstat me @ cost @ neg adjustgp { "The store owner takes your " cost @ "gp and gives you your " realname @ "." }cat tm ; : buyitem me @ valid? if "You're validated. Go find an IC store." tm exit then param @ not if "+buyitem =" tm exit then param @ "=" split toint 1 6 limit var! quality var! equip var cost var fullequip var realname { equip @ "/name" }cat "items" find-prop-in tofloat cost ! "" "/name" subst fullequip ! fullequip @ not if { "I dont have any '" equip @ capitalize "' in stock." }cat tm exit then ( ((10-Difficulty)+Required)*5*Rank of Item) 10 RPSYS { fullequip @ "/difficulty" }cat getprop toint - RPSYS { fullequip @ "/required" }cat getprop toint + 5 * quality @ * cost ! cost @ me @ gp > if { "Put that down! You don't have enough GP! (Required: " cost @ ")" }cat tm exit then RPSYS { fullequip @ "/name" }cat getprop realname ! me @ { "item/" realname @ "/" quality @ }cat over over getstat ++ setstat me @ cost @ neg adjustgp { "The store owner takes your " cost @ "gp and gives you your " realname @ " " quality @ "." }cat tm ; : store-buy var item var price RPSYS "primary/taxes/sales/percentage" getprop var! taxes me @ valid? not if "You're not validated. Use the OOC store." tm exit then param @ item ! me @ location item @ "/price" strcat getstat price ! price @ not if "There's none of that item left, or its not for sale." tm exit then price @ me @ gp > if { "Put that down! You don't have enough GP! (Required: " price @ ")" }cat tm exit then me @ price @ neg adjustgp me @ location owner price @ 1.0 taxes @ 100.0 / - * adjustgp rpsys { "primary/coffers/" rpsys "primary/taxes/sales/coffer" getpropstr "/value" }cat over over getprop price @ taxes @ 100.0 / * + setprop me @ location item @ over over getstat -- setstat me @ item @ over over getstat ++ setstat { "The store owner (" me @ location owner ") takes " me @ "'s " price @ "gp and gives them their new " item @ "." }cat th ; : store-list var search var item var qty var price param @ not if "*" param ! then "The following items for sale are on the board" header tellme here "@rp/item" array_get_propvals foreach qty ! "item/" swap strcat item ! here item @ "/price" strcat getstat price ! price @ item @ param @ smatch and if { "^CYAN^" qty @ tostr 3 rj "x " "^YELLOW^ " item @ 40 lj "^GREEN^" price @ 2 round ftostrc 12 rj "^NORMAL^" }cat tellme then repeat here "@rp/gear" array_get_propvals foreach qty ! "gear/" swap strcat item ! here item @ "/price" strcat getstat price ! price @ item @ param @ smatch and if { "^CYAN^" qty @ tostr 3 rj "x " "^YELLOW^ " item @ 40 lj "^GREEN^" price @ 2 round ftostrc 12 rj "^NORMAL^" }cat tellme then repeat here "@rp/goods" array_get_propvals foreach qty ! "goods/" swap strcat item ! here item @ "/price" strcat getstat price ! price @ item @ param @ smatch and if { "^CYAN^" qty @ tostr 3 rj "x " "^YELLOW^ " item @ 40 lj "^GREEN^" price @ 2 round ftostrc 12 rj "^NORMAL^" }cat tellme then repeat "FMLRPS Store" footer tellme ; : store-price var iclass var item var price me @ "W" flag? not me @ me @ location controls not or if { "^RED^Permission denied.^NORMAL^" }cat tellme exit then param @ not if { "Format: " command @ " /=" }cat tm exit then param @ "/" instr not if { "Format: " command @ " /=" }cat tm exit then param @ "=" instr not if { "Format: " command @ " /=" }cat tm exit then param @ "=" explode pop "/" explode pop iclass ! item ! tofloat price ! me @ location { iclass @ "/" item @ }cat getstat not if { "There is no " { iclass @ "/" item @ }cat " in " here name "'s inventory." }cat tm exit then me @ location { iclass @ "/" item @ "/price" }cat price @ setstat price @ if { "Price for " { iclass @ "/" item @ }cat " set to " price @ 2 fchop "." }cat tm else { { iclass @ "/" item @ }cat capitalize " taken off the shelves " price @ 2 fchop "." }cat tm then ; : prove var result var result-prop me @ param @ find-stat result ! result-prop ! result @ if { me @ " has a stat ^YELLOW^" result-prop @ "^NORMAL^ with a value of ^GREEN^" result @ "^NORMAL^." }cat th else { me @ " does ^RED^not^NORMAL^ have a stat called " param @ }cat th then ; : roll var value var item var ndie var stats var curstat var fullstat var statval var curnum var curdie var curtot var grandt var modifier var foreigns 0 ndie ! 0 modifier ! 0 foreigns ! param @ not if { command @ " ++..." }cat tm exit then ( Seperate stats ) param @ "+" explode_array stats ! ( Anything not ndx ) stats @ foreach curstat ! curstat @ "*[0-9]d[0-9]*" smatch not if ( Add nd10 stats together ) pop me @ curstat @ find-stat swap pop toint ndie @ + ndie ! ( Pure integers get added to modifier ) curstat @ toint if curstat @ toint modifier @ + modifier ! then ( Until done ) then repeat ( Limit to 0-12 die ) ndie @ 0 12 limit ndie ! ( Begin rolling string ) { me @ " rolls " ( List the stats we'll be using ) { stats @ foreach curstat ! pop me @ curstat @ find-stat swap pop statval ! { "^YELLOW^" curstat @ "^NORMAL^(^GREEN^" statval @ "^NORMAL^)" }cat repeat }array "+" array_join ndie @ if ( How many 1d10's we get to roll ) " = ^YELLOW^" ndie @ "d10^NORMAL^" ( Roll the 1d10's ) ndie @ nd10 curtot ! curdie ! "(^CYAN^" curdie @ " " array_join "^NORMAL^ = ^GREEN^" curtot @ "^NORMAL^)" ( add it to the grand total ) curtot @ grandt ! then ( roll the foreigns ) stats @ foreach curstat ! pop curstat @ "*[0-9]d[0-9]*" smatch if { "^NORMAL^ + ^YELLOW^" curstat @ "^NORMAL^(^CYAN^" curstat @ "d" split toint curdie ! toint curnum ! curnum @ 0 32 limit curdie @ 0 65536 limit ndx curtot ! curdie ! curdie @ " " array_join "^NORMAL^ = ^GREEN^" curtot @ "^NORMAL^)" }cat ( add the foreigns to the grand totals ) curtot @ grandt @ + grandt ! ( Until done ) then repeat ( add the modifier ) modifier @ if " + ^GREEN^" modifier @ "^NORMAL^" modifier @ grandt @ + grandt ! then ( display result ) " = ^YELLOW^" grandt @ "^NORMAL^" ( Make a string then write it. ) }cat th ; : gp-give param @ "=" split tofloat var! amount resolve var! target param @ not if "+gp/give =" tm exit then target @ toint 0 < if "Invalid or insoulable reference." tm exit then amount @ 0.0 <= if { "You must specify a positive amount of " CURRENCY "." }cat tm exit then amount @ 0.0 me @ gp limit amount ! target @ amount @ adjustgp me @ 0 amount @ - adjustgp { me @ " just gave ^GREEN^" amount @ "^YELLOW^gp^NORMAL^ to " target @ }cat th ; : gp-spend param @ tofloat var! amount param @ not if "+gp/spend " tm exit then amount @ 0.0 <= if { "You must specify a positive amount of " currency "." } tm exit then rpsys "primary/taxes/NPC/percentage" getprop var! taxes rpsys { "primary/coffers/" rpsys "primary/taxes/NPC/coffer" getpropstr "/value" }cat over over getprop amount @ taxes @ 100.0 / * + setprop amount @ 0.0 me @ gp limit amount ! me @ 0.0 amount @ - adjustgp { me @ " just spent ^RED^" amount @ "^YELLOW^gp^NORMAL^ (Expended)" }cat th ; : gear-give param @ not if "+gear/give =" tm exit then param @ "=" split var! gear resolve var! target target @ toint 0 < if "Invalid or insoulable reference." tm exit then me @ { "gear/" gear @ }cat getstat not if "You dont have any of that to give." tm exit then me @ { "gear/" gear @ }cat over over getstat -- setstat target @ { "gear/" gear @ }cat over over getstat ++ setstat { me @ " just gave ^GREEN^" gear @ capitalize "^NORMAL^ to ^YELLOW^" target @ "^NORMAL^." }cat th ; : gear-spend param @ not if "+gear/spend " tm exit then param @ var! gear me @ { "gear/" gear @ }cat getstat not if "You dont have any of that to spend." tm exit then me @ { "gear/" gear @ }cat over over getstat -- setstat { me @ " just used one of their ^GREEN^" gear @ capitalize "^NORMAL^." }cat th ; : item-give param @ not if "+give =" tm exit then param @ "=" split var! gear resolve var! target target @ toint 0 < if "Invalid or insoulable reference." tm exit then me @ { "item/" gear @ }cat getstat not if "You dont have any of that to give." tm exit then me @ { "item/" gear @ }cat over over getstat -- setstat target @ { "item/" gear @ }cat over over getstat ++ setstat { me @ " just gave ^GREEN^" gear @ capitalize "^NORMAL^ to ^YELLOW^" target @ "^NORMAL^." }cat th ; : item-spend param @ not if "+use " tm exit then param @ var! gear me @ { "item/" gear @ }cat getstat not if "You dont have any of that to spend." tm exit then me @ { "item/" gear @ }cat over over getstat -- setstat { me @ " just used one of their ^GREEN^" gear @ capitalize "^NORMAL^." }cat th ; : vote var target me @ valid? not if "You're invalid. No vote you." tm exit then param @ not if "+vote " tm exit then param @ resolve target ! target @ int 0 < if "You already voted for them since their last refresh." tm exit then target @ me @ dbcmp if "*SLAP* Don't vote for yourself!" tm exit then target @ "@rp/vote/by" me @ reflist_find if "You already voted for them since their last refresh." tm exit then me @ "@rp/vote/for" target @ reflist_add target @ "@rp/vote/by" me @ reflist_add target @ { "^YELLOW^" me @ "^NORMAL^ just voted for you." }cat "FMLRPS" pretty ansi_notify me @ { "You just voted for ^YELLOW^" target @ "^NORMAL^." }cat "FMLRPS" pretty ansi_notify ; : vote-all me @ valid? not if "You're invalid. No vote you." tm exit then var target me @ location contents_array foreach target ! pop target @ player? if target @ "~status" getpropstr "OOC" smatch not if target @ me @ dbcmp not if target @ awake? if target @ "@rp/vote/by" me @ reflist_find not if target @ name param ! vote then then then then then repeat ; : status param @ not if "me" param ! then param @ resolve var! target target @ toint 0 < if "Invalid or insoulable reference." tm exit then { "Status of " target @ }cat header tellme target @ sh-header { "Last validated on [" target @ "valid/at" getstat "%X %x" swap timefmt "] by " target @ "valid/by" getstat }cat wrap74 atellme { "Last invalidated on [" target @ "valid/!at" getstat "%X %x" swap timefmt "] by " target @ "valid/!by" getstat }cat wrap74 atellme { "People who voted for you: (" target @ "@rp/vote/by" array_get_reflist dup array_count ") " rot foreach swap pop "; " repeat }cat wrap74 atellme { "People who you voted for: (" target @ "@rp/vote/for" array_get_reflist dup array_count ") " rot foreach swap pop "; " repeat }cat wrap74 atellme { "Age: Character has existed for " target @ "@rp/heart/dotbeats" getprop toint " online hours." }cat wrap74 atellme { "Refresh: Approximate time to next refresh: " target @ "@rp/heart/refreshes" getprop toint 24 * target @ "@rp/heart/dotbeats" getprop toint - " online hours." }cat wrap74 atellme "FMLRPS Status by Alynna" footer tellme ; : validation me @ mlevel 7 < if { "^RED^" "noperm_mesg" sysparm "^NORMAL^" }cat tellme exit then param @ resolve var! target target @ toint 0 < if "Invalid or insoulable reference." tm exit then command @ "+validate" smatch if target @ "valid" "Yes" setstat target @ "valid/at" systime setstat target @ "valid/by" me @ setstat target @ { me @ " has ^GREEN^validated^NORMAL^ your sheet. You may now go IC." }cat "FMLRPS" pretty ansi_notify me @ { "You have ^GREEN^validated^NORMAL^ " target @ "'s sheet." }cat "FMLRPS" pretty ansi_notify FORCEWIZ { "wc ^NORMAL^" me @ " has ^GREEN^validated^NORMAL^ " target @ "'s sheet." }cat $ifdef INSERVER_WIZCHAT 1 parse_ansi $endif force then command @ "+invalidate" smatch if target @ "valid" "No" setstat target @ "valid/!at" systime setstat target @ "valid/!by" me @ setstat target @ { me @ " has ^RED^invalidated^NORMAL^ your sheet. You may NOT go IC." }cat "FMLRPS" pretty ansi_notify me @ { "You have ^RED^invalidated^NORMAL^ " target @ "'s sheet." }cat "FMLRPS" pretty ansi_notify FORCEWIZ { "wc ^NORMAL^" me @ " has ^RED^invalidated^NORMAL^ " target @ "'s sheet." }cat $ifdef INSERVER_WIZCHAT 1 parse_ansi $endif force then ; : sysheart-reset var target me @ #7 dbcmp not if { "^RED^Permission DAMN DENIED!!!^NORMAL^" }cat tellme exit then #-1 "*" "P" find_array foreach target ! pop target @ "@rp/heart/dotbeats" 0 setprop target @ "@rp/heart/refreshes" 0 setprop target @ "@rp/heart/weekly" 0 setprop target @ "@rp/heart/monthly" 0 setprop target @ "@rp/heart/yearly" 0 setprop repeat FORCEWIZ { "@wall ![!] Danger Will Robinson! " me @ " has issued the +sysheart/reset command with proper permissions and TIME is being reset. Aging data for all characters has been deleted. I hope there was a good reason for this. --Alynna" }cat force ; : sysheart var target var dotbeats var votes var resource command @ "*sysheart*" smatch if me @ mlevel 8 >= not if { "^RED^" "noperm_mesg" sysparm "^NORMAL^" }cat tellme exit then then ( vote processing ) ( A person gets 5 CP per Month. At the beginning of the month. ) ( A person gets 2 CP per week. At the beginning of the week. ) ( A person gets 1 CP per 24 hours logged in. If they were voted for. For every 5 votes they have, they get +5 CP ) ( A person can only vote for someone once per 24 hour 'refresh' ) online_array foreach target ! pop DEBUGMODE if FORCEWIZ { "wc Refreshing ... " target @ }cat force then target @ valid? if target @ idletime 3600 < if me @ player? not if target @ "heart/dotbeats" over over getstat ++ dup dotbeats ! setstat then ( Essence regen ) target @ essence target @ essmax < if target @ "essence" over over getstat toint target @ spirit + 1 target @ essmax limit setstat target @ { "You've got essence! (" target @ spirit " regained)" }cat "FMLRPS" pretty ansi_notify then target @ essence target @ essmax > if target @ "essence" over over getstat toint 1 target @ essmax limit setstat then ( BHP, MHP, SHP regen ) systime target @ "heart/daily" getstat 86400 + >= if target @ bhp target @ bmax < if target @ "bhp" target @ bhp target @ body + 1 target @ bmax limit setstat target @ bhp pop target @ { "You've got body! (" target @ body " regained)" }cat "FMLRPS" pretty ansi_notify then target @ mhp target @ mmax < if target @ "mhp" target @ mhp target @ mind + 1 target @ mmax limit setstat target @ mhp pop target @ { "You've got mind! (" target @ mind " regained)" }cat "FMLRPS" pretty ansi_notify then target @ shp target @ smax < if target @ "shp" target @ shp target @ spirit + 1 target @ smax limit setstat target @ shp pop target @ { "You've got spirit! (" target @ spirit " regained)" }cat "FMLRPS" pretty ansi_notify then target @ "heart/daily" systime setstat then dotbeats @ target @ "heart/refreshes" getstat 24 * >= me @ player? or if me @ player? if target @ { "FMLRPS ... Begin 24 hour refresh cycle, forced by " me @ }cat header ansi_notify else target @ "FMLRPS ... Begin 24 hour refresh cycle" header ansi_notify then ( Detect cheaters ) target @ "cp" getstat string? if FORCEWIZ { "wc DANGER WILL ROBINSON, Possible cheater detected! " target @ " has a string in their CP property, possible manual edit." }cat force then ( Votes ) target @ "@rp/vote/by" array_get_reflist array_count votes ! votes @ if target @ "cp" over over getstat toint votes @ votes2cp + 1 + setstat target @ { "You get " votes @ votes2cp 1 + "cp from refresh and votes." }cat ansi_notify target @ "vote/for" 0 setstat target @ "vote/by" 0 setstat else target @ "vote/for" 0 setstat target @ "vote/by" 0 setstat target @ { "No votes since last refresh, 0cp earned." }cat ansi_notify then ( Other time CP ) systime target @ "heart/weekly" getstat 86400 7 * + >= if target @ { "You get 2 cp from weekly refresh." }cat ansi_notify target @ "cp" over over getstat toint 2 + setstat target @ "heart/weekly" systime setstat ( Resources ) target @ income tofloat resource ! resource @ if resource @ 0.0 > if rpsys "primary/taxes/income/percentage" getprop var! taxes rpsys { "primary/coffers/" rpsys "primary/taxes/income/coffer" getpropstr "/value" }cat over over getprop resource @ taxes @ 100.0 / * + setprop resource @ 100.0 taxes @ - 100 / * resource ! target @ { "You earn " resource @ 2 fchop "gp from your resources." }cat ansi_notify target @ resource @ adjustgp else target @ { "You lose " resource @ fabs 2 fchop "gp from your resources." }cat ansi_notify target @ resource @ adjustgp then then then systime target @ "heart/monthly" getstat 86400 30 * + >= if target @ { "You get 5 cp from monthly refresh." }cat ansi_notify target @ "cp" over over getstat toint 5 + setstat target @ "heart/monthly" systime setstat then systime target @ "heart/yearly" getstat 86400 365 * + >= if target @ { "Happy birthday!" }cat ansi_notify target @ "cp" over over getstat toint 10 + setstat target @ "heart/yearly" systime setstat then ( Detect cheaters ) target @ "gp" getstat string? if FORCEWIZ { "wc DANGER WILL ROBINSON, Possible cheater detected! " target @ " has a string in their GP property, possible manual edit." }cat force then ( Increment refreshes ) me @ player? not if target @ "heart/refreshes" over over getstat ++ setstat then target @ "End FMLRPS refresh cycle" footer ansi_notify then then else target @ "valid/at" getstat not if target @ cp 100.0 = not if target @ "cp" 100.0 setstat then then then repeat ; : adjuster var stat var max var tmp param @ "=" split var! amount var! target amount @ not if target @ amount ! "me" target ! then target @ resolve target ! amount @ toint amount ! target @ toint 0 < if "Invalid or insoulable reference." tm exit then me @ "W" flag? not if me @ target ! then param @ not if { command @ " - positive values reduce amounts, negative values increase them." }cat tm exit then command @ case "+bhp" smatch when "bhp" stat ! target @ bmax max ! end "+mhp" smatch when "mhp" stat ! target @ mmax max ! end "+shp" smatch when "shp" stat ! target @ smax max ! end "+ess" smatch when "essence" stat ! target @ essmax max ! end endcase command @ "+hp" smatch if target @ "bhp" over over getstat 0 amount @ - + 0 target @ bmax limit setstat target @ "mhp" over over getstat 0 amount @ - + 0 target @ mmax limit setstat target @ "shp" over over getstat 0 amount @ - + 0 target @ smax limit setstat "bhp, mhp, shp" stat ! else target @ stat @ over over getstat 0 amount @ - + 0 max @ limit setstat then me @ target @ dbcmp if { me @ " expends " amount @ " " stat @ "." }cat th else { me @ " adjusts " target @ "'s " stat @ " by " amount @ "." }cat th then target @ bhp target @ "ability/defence" getstat toint 3 + / target @ "body" rot 1 + target @ bhp not if pop 0 then 0 target @ btop limit toint setstat target @ mhp target @ "ability/defence" getstat toint 3 + / target @ "mind" rot 1 + target @ mhp not if pop 0 then 0 target @ mtop limit toint setstat target @ shp target @ "ability/defence" getstat toint 3 + / target @ "spirit" rot 1 + target @ shp not if pop 0 then 0 target @ stop limit toint setstat ; : restore param @ not if "me" param ! then param @ resolve var! target target @ toint 0 < if "Invalid or insoulable reference." tm exit then me @ "W" flag? not if me @ target ! then target @ "bhp" target @ bmax setstat target @ "mhp" target @ mmax setstat target @ "shp" target @ smax setstat target @ "essence" target @ essmax setstat target @ bhp target @ "ability/defence" getstat toint 3 + / target @ "body" rot 1 + target @ bhp not if pop 0 then 0 target @ btop limit toint setstat target @ mhp target @ "ability/defence" getstat toint 3 + / target @ "mind" rot 1 + target @ mhp not if pop 0 then 0 target @ mtop limit toint setstat target @ shp target @ "ability/defence" getstat toint 3 + / target @ "spirit" rot 1 + target @ shp not if pop 0 then 0 target @ stop limit toint setstat { me @ " restored " target @ "'s body, mind, spirit, essence to MAX." }cat th ; : main param ! param @ mufcron? if sysheart exit then command @ tolower case "{.type|.name|.desc|.set}" smatch when entry end "+rpinfo" smatch when rpinfo exit end "{+ability|+equipment|+items|+class|+skill|+spell}" smatch when rpinfo end "*lsheet" smatch when sheet exit end "*sheet" smatch when ssheet exit end "+init" smatch when init exit end "+buyattr" smatch when buyattr exit end "+buyclass" smatch when buyclass exit end "+buyability" smatch when buyability exit end "+buyspell" smatch when buyspell exit end "+buyequip" smatch when buyequip exit end "+buyitem" smatch when buyitem exit end "+freeskill" smatch when freeskill exit end "+buyskill" smatch when buyskill exit end "+prove" smatch when prove exit end "+gp/give" smatch when gp-give exit end "+gp/spend" smatch when gp-spend exit end "+gear/give" smatch when gear-give exit end "+gear/spend" smatch when gear-spend exit end "+give" smatch when item-give exit end "+use" smatch when item-spend exit end "+vote/all" smatch when vote-all exit end "+vote" smatch when vote exit end "+status" smatch when status exit end "+roll" smatch when roll exit end "+store" smatch when store-list exit end "+store/price" smatch when store-price exit end "+store/buy" smatch when store-buy exit end "{+bhp|+mhp|+shp|+ess|+hp}" smatch when adjuster exit end "+restore" smatch when restore exit end "{+validate|+invalidate}" smatch when validation exit end "{+sysheart}" smatch when sysheart exit end "{+sysheart/reset}" smatch when sysheart-reset exit end endcase ; . c q