$include $lib/RP $include $lib/Alynna $def PARANOIA prog "?" flag? $def DIRS { "m" } array_make $def MODE_PROVE 0 $def MODE_ADJUST 1 $def MODE_SET 2 $def MODE_RESET 3 $def MODE_GIVEstuff 4 $def MODE_ADJUSTstuff 6 $def rpsystem.log logstatus lvar mode lvar param : translate[ s:input -- s:output ] input @ "defence" "defense" subst "initiative" "init" subst ; : searchProver[ s:stat -- s:out ] ; : authorize[ s:stat -- b:granted ] stat @ { "{" { "System" "Stats" "Adjustable" }rpinfo mklist "|" array_join "}" }join smatch ; : resetter[ s:stat ] stat @ translate me @ stat @ me @ "$lib/rp" match "m" stat @ strcat call setstat ; : main param ! var mode command @ case "*adjust" smatch when MODE_ADJUST mode ! end "*reset" smatch when MODE_RESET mode ! end "*set" smatch when MODE_SET mode ! end "*prove" smatch when MODE_PROVE mode ! end "@givestuff" smatch when MODE_GIVEstuff mode ! end "@adjuststuff" smatch when MODE_ADJUSTstuff mode ! end default pop end endcase param @ "=" split tofloat var! value translate var! item mode @ MODE_PROVE = if var targetdir var tmp item @ not if "Invalid syntax, +prove " "Prove" pretty tellme exit then 0 targetdir ! me @ "/@rp/" item @ strcat getprop value ! value @ not if me @ "/@rp/" array_get_propdirs DIRS array_union foreach tmp ! me @ "/@rp/" tmp @ "/" item @ strcat strcat strcat getprop dup if value ! tmp @ targetdir ! else pop then repeat then value @ if { "<^YELLOW^*^GREEN^Official^YELLOW^*^NORMAL^> " me @ " proves that they posess a stat named ^CYAN^" item @ "^NORMAL^" " with a value of ^GREEN^" value @ "^NORMAL^" value @ int? if value @ 16777215 > if " (^YELLOW^Date value: " "%X %x" value @ timefmt ", " systime value @ - timex " ago^NORMAL^)" then then "." targetdir @ if " [Found in: " targetdir @ "]" then }cat tellhere else { "<^YELLOW^*^GREEN^Official^YELLOW^*^NORMAL^> " me @ " proves that they do ^RED^NOT^NORMAL^ possess any stats named ^CYAN^" item @ "^NORMAL^." }cat tellhere then exit then mode @ MODE_GIVEstuff = if me @ mlevel 5 >= me @ "staff" power? or if else { "^RED^Permission denied." }tell exit then param @ not if "@givestuff =" "Give" pretty tellme exit then item @ " " explode_array foreach resolve var! target pop target @ int 0 < if { "I dont know who to give XP to! (" item @ ")" }cat "Give" pretty tellme continue then target @ "stuff" over over getstat value @ + setstat value @ 0 < if #55 { "!wc #" me @ " takes " value @ fabs " stuff from " target @ }cat dup 5 strcut swap pop rpsystem.log force { "^RED^You take " value @ fabs " stuff from " target @ }cat tellme target @ { "^RED^" me @ " takes " value @ fabs " stuff from you." }cat ansi_notify else #55 { "!wc #" me @ " gives " value @ fabs " stuff to " target @ }cat dup 5 strcut swap pop rpsystem.log force { "^GREEN^You give " value @ fabs " stuff to " target @ }cat tellme target @ { "^GREEN^" me @ " gives " value @ fabs " stuff to you." }cat ansi_notify then repeat exit then mode @ MODE_ADJUSTstuff = if me @ mlevel 5 >= me @ "staff" power? or if else { "^RED^Permission denied." }tell exit then param @ not if "@givestuff =" "Give" pretty tellme exit then item @ " " explode_array foreach resolve var! target pop target @ int 0 < if { "I dont know who to give XP to! (" item @ ")" }cat "Give" pretty tellme continue then target @ 0 value @ - spendstuff #55 { "!wc #" me @ " adjusts " value @ " stuff on " target @ }cat dup 5 strcut swap pop rpsystem.log force { "^YELLOW^You adjust " value @ " stuff by " target @ }cat tellme target @ { "^YELLOW^" me @ " adjusts your stuff by " value @ "." }cat ansi_notify repeat exit then item @ if item @ authorize not if { "^RED^Permission denied." }tell exit then then mode @ MODE_RESET = if param @ not if { "System" "Stats" "Adjustable" }rpinfo mklist foreach swap pop resetter repeat { "!wc #" me @ " reset all their adjustable stats to their maximum." }cat dup 5 strcut swap pop rpsystem.log paranoia if #55 swap force else pop then { "^GREEN^All your adjustable stats have been reset to max. Staff was informed." }tell exit else item @ resetter { "!wc #" me @ " reset their (adjustable) " item @ " stat to its maximum." }cat dup 5 strcut swap pop rpsystem.log paranoia if #55 swap force else pop then { "^GREEN^Your adjustable stat ^CYAN^" item @ "^NORMAL^ has been reset to max. Staff was informed." }tell exit then then me @ item @ mode @ MODE_SET = if item @ not if "Invalid syntax, +set " "Set" pretty tellme exit then value @ else item @ not if "Invalid syntax, +adjust " "Set" pretty tellme exit then over over getstat value @ + then setstat { me @ ansi_name " has " mode @ MODE_SET = if "^YELLOW^set" else "^YELLOW^adjusted" then "^NORMAL^ their ^CYAN^" item @ mode @ MODE_SET = if "^NORMAL^ to ^GREEN^" value @ "^ ^." else "^NORMAL^ by ^GREEN^" value @ "^ ^ to ^GREEN^" me @ item @ getstat "^ ^." then }cat "Amber.Stat" pretty dup tellhere 1 unparse_ansi rpsystem.log ;