@program #1849 1 1000 d i $include $ansihack $def notify ansi_notify $def notify_exclude ansi_notify_exclude $def Rpsystem #4183 $include $lib/alynna $include $lib/gary'sMufUtils-strings $include $lib/rp lvar target lvar result lvar toggle lvar roll2 lvar roll4 lvar roll3 lvar fumbles lvar crits lvar succs lvar repeat lvar temp lvar bonusstat lvar target2 lvar max lvar max2 lvar curr2 lvar skill lvar curprop : cleaner ( i -- ) temp @ 1 + temp ! temp @ repeat @ = not if begin pop temp @ 1 + temp ! temp @ repeat @ = until then ; : jobcheck ( s -- i ) target ! target @ "" stringcmp not if 0 exit then me @ "jobs/" target @ strcat getstat if 1 exit then rpsystem "Jobs/" target @ strcat "/Requirement" strcat getpropstr dup not if pop 1 exit then ":" explode repeat ! 0 temp ! begin "/" explode pop me @ swap "Jobs/" swap strcat getstat 50 / 1 + swap atoi swap > if cleaner 0 exit then temp @ 1 + temp ! temp @ repeat @ = until 1 ; : jobskills ( s -- ) target2 ! target2 @ target ! rpsystem "Jobs/" target @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop swap atoi 2 / me @ rot rot setstat temp @ 1 + temp ! temp @ repeat @ = until rpsystem "Jobs/" target @ strcat "/Dependant" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "Jobs/" swap strcat me @ swap 25 setstat temp @ 1 + temp ! temp @ repeat @ = until ; : sheet ( s -- ) dup not if pop me @ target ! else target ! target @ match dup ok? if target ! target @ "finish" getstatint not target @ player? not and if "Invalid player." "Chargen" pretty tellme exit then else pop target @ .pmatch target ! target @ player? not if "Invalid player." "Chargen" pretty tellme exit then then then depth if dup dbref? if target ! then then ( Line 1 ) str "Chargen for " target @ cat header tellme ( Line 2 ) str " Meta?^Blue^[^Yellow^" (6) target @ "magery" getstatint 6 / if "Yes" else "No " then (9) "^Blue^]^ ^ Mage?^Blue^[^Yellow^" (18) target @ "mage?" getstatint if "Yes" else "No " then (21) "^Blue^]^ ^ HP^Blue^[^Yellow^" (27) target @ "HP" getstat tostr 4 rj "^Cyan^/^Yellow^" (32) target @ maxhp tostr 4 rj "^Blue^]^ ^" (37) " MP^Blue^[^Yellow^" (42) target @ "MP" getstat tostr 3 rj (45) "^Cyan^/^Yellow^" (46) target @ maxmp tostr 3 rj (49) "^Blue^]^ ^ TP^Blue^[^Yellow^" (55) target @ "TP" getstat tostr 2 rj (57) "^Cyan^/^Yellow^" (58) target @ maxtp tostr 2 rj (59) "^Blue^]^ ^" (61) cat tellme ( Line 3 ) str " Strength ^Blue^[^Yellow^" target @ "Strength" getstat tostr 2 rj "^Aqua^]^ ^" " Dexterity ^Blue^[^Yellow^" target @ "Dexterity" getstat tostr 2 rj "^Aqua^]^ ^" " Stamina ^Blue^[^Yellow^" target @ "Stamina" getstat tostr 2 rj "^Aqua^]^ ^" " Intelligence ^Blue^[^Yellow^" target @ "Intelligence" getstat tostr 2 rj "^Aqua^]^ ^" cat tellme str ( Line 4 ) " Perception ^Blue^[^Yellow^" target @ "Perception" getstat tostr 2 rj "^Aqua^]^ ^" " Appearance ^Blue^[^Yellow^" target @ "Appearance" getstat tostr 2 rj "^Aqua^]^ ^" " Magery ^Blue^[^Yellow^" target @ "Magery" getstat tostr 2 rj "^Aqua^]^ ^" " Willpower ^Blue^[^Yellow^" target @ "Willpower" getstat tostr 2 rj "^Aqua^]^ ^" cat tellme ; : resetter ( -- ) me @ "finish" getstatint if "You have already been chargenned." "Chargen" exit then "Default" target ! rpsystem "Jobs/" target @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop swap atoi me @ rot rot setstat temp @ 1 + temp ! temp @ repeat @ = until me @ "Job" "" setstat me @ "Jobinit" "" setstat me @ "Chargeninit" "" setstat me @ "meta?" 0 setstat me @ "mage?" 0 setstat rpsystem "Jobs/List" getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin toggle ! me @ "Jobs/" toggle @ strcat 0 setstat me @ "Jobs/" toggle @ strcat "Spent" strcat 0 setstat temp @ 1 + temp ! temp @ repeat @ = until ; : cstart ( s -- ) me @ "Chargeninit" getstat not if "Initializing.." "Chargen" pretty tellme me @ "Chargeninit" 1 setstat me @ "Strength" 1 setstat me @ "Dexterity" 1 setstat me @ "Stamina" 1 setstat me @ "Intelligence" 1 setstat me @ "Perception" 1 setstat me @ "Appearance" 1 setstat me @ "Magery" 1 setstat me @ "Willpower" 1 setstat me @ "Cpoints" 34 setstat me @ "HP" 666 setstat me @ "MP" 66 setstat me @ "TP" 6 setstat "Initializing. You have been given 1 point in every category." .tell then "me" sheet str "Chargen growth: ^Green^" me @ "cpoints" getstat toint 3 * "%^NORMAL^" cat footer tellme str "To distribute points, type +set =" cat "Chargen" pretty tellme str "When you are satisfied with your stats, type +finish to commit them." cat "Chargen" pretty tellme str "The following stats can be adjusted:" cat "Chargen" pretty tellme str " Strength Dexterity Stamina Intelligence Perception Appearance Magery Willpower" cat "Chargen" pretty tellme ; lvar change : setter ( s -- ) me @ "Chargeninit" getstat not if "Please type +chargen first, to begin chargen." "Chargen" pretty tellme exit then me @ "finish" getstat if "You cannot change your primary stats after Chargen." "Chargen" pretty tellme exit then dup not over "=" instring not and if pop "Format: +set =" "Chargen" pretty tellme exit then "=" explode 2 = not if "Format: +set =" "Chargen" pretty tellme exit then dup "{Strength|Stamina|Dexterity|Intelligence|Perception|Willpower|Appearance|Magery}" smatch not if pop "That is not a valid primary stat." "Chargen" pretty tellme exit then target ! atoi toggle ! toggle @ 1 < if "You can't reduce a stat under 1, why would you want to?" "Chargen" pretty tellme exit then toggle @ 10 > if "You can't increase a stat over 8." "Chargen" pretty tellme exit then me @ "Cpoints" getstat temp ! me @ target @ getstat dup int? not if atoi then toggle @ swap - change ! temp @ change @ - me @ "Cpoints" rot setstat me @ target @ toggle @ setstat target @ roll2 ! "me" sheet str "Chargen growth: ^Green^" me @ "cpoints" getstat toint 3 * "%^NORMAL^" cat footer tellme roll2 @ target ! str target @ " was set to ^green^" me @ target @ getstat tostr cat "Chargen" pretty tellme str "To distribute points, type +set =" cat "Chargen" pretty tellme ; : JP me @ "Jobs/" me @ "Job" getstat strcat getstat dup not if pop 0 then me @ "Jobs/" me @ "Job" getstat strcat "Spent" strcat getstat dup not if pop 0 then - ; lvar cost : skillbuy ( s -- ) me @ "finish" getstatint not if "You cannot buy skills until after you chargen." "BuySkill" pretty tellme exit then me @ "jobinit" getstat not if "You cannot buy skills until you have entered a job." "BuySkill" pretty tellme exit then dup not if pop "Format: +buyskill " "BuySkill" pretty tellme exit then "-" " " subst target ! me @ target @ getstatint dup not if pop 5.0 else 2.0 * then me @ "magery" getstatint 6 / me @ "mage?" getstatint 1 + + dup 3 = if pop 2.0 * else dup 2 = if pop 3.0 * 2 / else pop then then cost ! rpsystem "Jobs/" me @ "Job" getstatstr strcat "/Skills" strcat getpropstr ":" explode repeat ! 0 temp ! begin "/" explode pop target @ smatch if atoi temp ! me @ target @ getstatint dup not if pop 0 then JP cost @ < if str "Insufficient JP in this job for '" target @ "', it costs " cost @ intostr "." cat "BuySkill" pretty tellme exit then dup temp @ 1 - > if pop str "This job does not support '" target @ "' at that level." cat "BuySkill" pretty tellme exit then me @ target @ getstatint 1 + me @ target @ rot setstat me @ "Jobs/" me @ "Job" getstat strcat "Spent" strcat getstat dup not if pop 0 then cost @ + cost ! me @ "Jobs/" me @ "Job" getstat strcat "Spent" strcat cost @ setstat str "Skill '" target @ "' increased." cat "BuySkill" pretty tellme exit else pop then temp @ 1 + temp ! temp @ repeat @ = until "This job does not seem to support that skill. Please +rpinfo ." "BuySkill" pretty tellme ; lvar cost lvar rating : Parsecost ( i i s -- ) target ! cost ! rating ! rating @ not if "You seem to be at the maximum for this special in this job." "BuySpecial" pretty tellme exit then me @ me @ "Job" getstatstr target @ "/" instring target @ swap strcut swap pop talentcost cost ! RPsystem "Cost/" target @ strcat getpropval dup not if pop 1 then cost @ * cost ! JP cost @ < if str "You can't afford '" target @ "', it costs " cost @ "." cat "BuySpecial" pretty tellme exit then me @ "Jobs/" me @ "Job" getstat strcat "Spent" strcat getstat cost @ + me @ "Jobs/" me @ "Job" getstat strcat "Spent" strcat rot setstat me @ target @ rating @ setstat str target @ "" "Special/" subst " is now set to " rating @ "." cat "BuySpecial" pretty tellme ; lvar curprop : specialbuy ( s -- ) me @ "finish" getstatint not if "You cannot buy specials until after you chargen." "BuySpecial" pretty tellme exit then dup not if pop "Format: +buyspecial " "BuySpecial" pretty tellme exit then dup skill ! target ! rpsystem "Jobs/" me @ "Job" getstat strcat "/Special" strcat getpropstr dup not if pop "None" .tell exit then ":" explode repeat ! 0 temp ! begin "" result ! "/" explode pop swap dup curprop ! swap target @ smatch not if pop else me @ "Special/" target @ strcat getstatint not if 1 toggle ! else curprop @ "`" instring not if "You are at the cap already" .tell exit then 0 toggle ! then max ! toggle @ if max @ "`" instring dup not if pop max @ atoi else max @ swap strcut pop atoi then dup 5.0 * "Special/" target @ strcat parsecost exit else target @ toggle ! 0 target ! begin max @ "`" instring dup if 1 - max @ swap strcut 1 strcut swap pop max ! else max @ "" max ! then atoi dup me @ "Special/" toggle @ strcat getstatint = if 3.0 * max @ "`" instring dup if 1 - max @ swap strcut 1 strcut swap pop max ! else max @ "" max ! then atoi swap "Special/" toggle @ strcat parsecost exit then max @ not until str "You cannot increase '" target @ "' in this job anymore." "BuySpecial" pretty tellme exit then then temp @ 1 + temp ! temp @ repeat @ = until ; lvar total : job dup not if pop else target2 ! target2 @ jobcheck rpsystem "Jobs/" target2 @ strcat "/desc" strcat getprop and if me @ "Job" target2 @ setstat me @ "JobSwitch" 1 setstat str "Job '" target2 @ "' selected." cat "Job" pretty tellme else "Invalid job Selection." "Job" pretty tellme then then "" result ! "Job chart" header tellme rpsystem "Jobs/List" getpropstr ":" explode max2 ! 0 curr2 ! 0 total ! begin target2 ! target2 @ jobcheck if str "^Yellow^" target2 @ 20 lj "^Green^" (20) me @ "Jobs/" target2 @ strcat getstatfloat dup total @ + total ! me @ "Jobs/" target2 @ strcat "Spent" strcat getstatfloat - 2 fchop 7 rj (29) "^aqua^/^green^" (25) me @ "jobs/" target2 @ strcat getstatfloat 2 fchop 7 rj (24) "^Yellow^" me @ "Jobs/" target2 @ strcat getstatint 50 / 1 + intostr 3 right "^ ^" (33) " " (39) cat result @ strcat result ! toggle @ 1 + toggle ! toggle @ 2 = if result @ tellme 0 toggle ! "" result ! then then curr2 @ 1 + curr2 ! curr2 @ max2 @ = until toggle @ if result @ tellme then str "Job: ^Green^" me @ "job" getstat dup not if pop "" then "^Yellow^ " "Total JP: ^Green^" total @ dup me @ "TotalJP" rot setstat "^ ^" cat footer tellme me @ "jobinit" getstatint not if 0 toggle ! "Now beginning initial job selection..." "Chargen" pretty tellme begin "Select a job from the ones listed above, or use Q to abort." "Chargen" pretty tellme read dup "Q" smatch if pop "Cancelling, please use +job to select a job when you have decided." "Chargen" pretty tellme exit then dup not if "What? You didnt type anything." "Chargen" pretty tellme pop else dup "{Feral|Civilian|Meta|Guardian|Outlaw|Technician}" smatch not if "That wasnt one of the available jobs listed." "Chargen" pretty tellme pop else target ! me @ player? if target @ Jobskills me @ "Jobs/Feral" 50 setstat me @ "Jobs/" target @ strcat getstatint 50 + me @ "Jobs/" target @ strcat rot setstat then 1 toggle ! me @ "Job" target @ setstat me @ "jobinit" 1 setstat target @ "Meta" smatch if me @ "Meta?" 1 setstat then then then 1 toggle @ = until str "Job '" target @ "' selected, and 50 JP given in it." cat "Chargen" pretty tellme "You may now type +job to see your current point distribution" "Chargen" pretty tellme "Or use +buyskill and +buyspecial to begin buying skills and specials." "Chargen" pretty tellme then ; : finish me @ "finish" getstatint not if me @ "HP" me @ maxhp setstat me @ "MP" me @ maxmp setstat me @ "TP" me @ maxtp setstat me @ "HPMPInit" 1 setstat "Setting HP MP and TP to first time max." "Chargen" pretty tellme me @ "cpoints" getstatint me @ "growth" rot 3 * setstat str "Setting Growth to " me @ "growth" getstat "%" cat "Chargen" pretty tellme me @ "finish" 1 setstat "Primary stats distributed, now proceeding to job selection." "Chargen" pretty tellme job then ; : main ( s -- ) dup "RESET" strcmp not if pop resetter exit then 0 toggle ! command @ "{+skillbuy|+buyskill}" smatch if skillbuy exit then command @ "{+specialbuy|+buyspecial}" smatch if specialbuy exit then command @ "{+finish|+finished}" smatch if finish exit then command @ "+set" smatch if setter exit then command @ "+chargen" smatch if cstart exit then command @ "+job" smatch if job exit then ; . c q